From c06c731cd5a1212f043cf6e4b3ab6a6268ef5708 Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 12 Apr 2022 17:56:40 +0200 Subject: [PATCH 001/641] Update the WebXR IDL (#2863) --- crates/web-sys/Cargo.toml | 8 +- crates/web-sys/src/features/gen_XrFrame.rs | 11 ++ .../web-sys/src/features/gen_XrInputSource.rs | 12 -- crates/web-sys/src/features/gen_XrLayer.rs | 18 ++ .../features/gen_XrPermissionDescriptor.rs | 110 ++++++++++++ .../src/features/gen_XrPermissionStatus.rs | 40 +++++ crates/web-sys/src/features/gen_XrPose.rs | 24 +++ .../features/gen_XrReferenceSpaceEventInit.rs | 2 +- .../src/features/gen_XrRenderStateInit.rs | 18 ++ crates/web-sys/src/features/gen_XrSession.rs | 157 ++++++++++++++++-- .../web-sys/src/features/gen_XrSessionMode.rs | 1 + ..._XrSessionSupportedPermissionDescriptor.rs | 68 ++++++++ crates/web-sys/src/features/gen_XrView.rs | 22 +++ .../web-sys/src/features/gen_XrWebGlLayer.rs | 2 +- crates/web-sys/src/features/mod.rs | 24 +++ .../webidls/unstable/WebXRDevice.webidl | 87 ++++++---- examples/webxr/Cargo.toml | 2 +- examples/webxr/src/lib.rs | 2 +- 18 files changed, 536 insertions(+), 72 deletions(-) create mode 100644 crates/web-sys/src/features/gen_XrLayer.rs create mode 100644 crates/web-sys/src/features/gen_XrPermissionDescriptor.rs create mode 100644 crates/web-sys/src/features/gen_XrPermissionStatus.rs create mode 100644 crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 19f804a017d..e8e4da57db8 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1459,7 +1459,6 @@ XmlHttpRequestEventTarget = ["EventTarget"] XmlHttpRequestResponseType = [] XmlHttpRequestUpload = ["EventTarget", "XmlHttpRequestEventTarget"] XmlSerializer = [] -Xr = ["EventTarget"] XrBoundedReferenceSpace = ["EventTarget", "XrReferenceSpace", "XrSpace"] XrEye = [] XrFrame = [] @@ -1470,6 +1469,9 @@ XrInputSourceEvent = ["Event"] XrInputSourceEventInit = [] XrInputSourcesChangeEvent = ["Event"] XrInputSourcesChangeEventInit = [] +XrLayer = ["EventTarget"] +XrPermissionDescriptor = [] +XrPermissionStatus = ["EventTarget", "PermissionStatus"] XrPose = [] XrReferenceSpace = ["EventTarget", "XrSpace"] XrReferenceSpaceEvent = ["Event"] @@ -1483,13 +1485,15 @@ XrSessionEvent = ["Event"] XrSessionEventInit = [] XrSessionInit = [] XrSessionMode = [] +XrSessionSupportedPermissionDescriptor = [] XrSpace = ["EventTarget"] +XrSystem = ["EventTarget"] XrTargetRayMode = [] XrView = [] XrViewerPose = ["XrPose"] XrViewport = [] XrVisibilityState = [] -XrWebGlLayer = [] +XrWebGlLayer = ["EventTarget", "XrLayer"] XrWebGlLayerInit = [] XsltProcessor = [] console = [] diff --git a/crates/web-sys/src/features/gen_XrFrame.rs b/crates/web-sys/src/features/gen_XrFrame.rs index 9a4153e4c48..bdab432e924 100644 --- a/crates/web-sys/src/features/gen_XrFrame.rs +++ b/crates/web-sys/src/features/gen_XrFrame.rs @@ -28,6 +28,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn session(this: &XrFrame) -> XrSession; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRFrame" , js_name = predictedDisplayTime)] + #[doc = "Getter for the `predictedDisplayTime` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/predictedDisplayTime)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn predicted_display_time(this: &XrFrame) -> f64; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "XrPose", feature = "XrSpace",))] # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = getPose)] #[doc = "The `getPose()` method."] diff --git a/crates/web-sys/src/features/gen_XrInputSource.rs b/crates/web-sys/src/features/gen_XrInputSource.rs index a9f8ac19332..739ea37a492 100644 --- a/crates/web-sys/src/features/gen_XrInputSource.rs +++ b/crates/web-sys/src/features/gen_XrInputSource.rs @@ -16,18 +16,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrInputSource; #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "Gamepad")] - # [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = gamepad)] - #[doc = "Getter for the `gamepad` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/gamepad)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `XrInputSource`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn gamepad(this: &XrInputSource) -> Option; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrHandedness")] # [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = handedness)] #[doc = "Getter for the `handedness` field of this object."] diff --git a/crates/web-sys/src/features/gen_XrLayer.rs b/crates/web-sys/src/features/gen_XrLayer.rs new file mode 100644 index 00000000000..a68ea54d34e --- /dev/null +++ b/crates/web-sys/src/features/gen_XrLayer.rs @@ -0,0 +1,18 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = XRLayer , typescript_type = "XRLayer")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrLayer` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRLayer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrLayer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrLayer; +} diff --git a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs new file mode 100644 index 00000000000..ce11f7579ac --- /dev/null +++ b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs @@ -0,0 +1,110 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRPermissionDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrPermissionDescriptor` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrPermissionDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl XrPermissionDescriptor { + #[cfg(feature = "PermissionName")] + #[doc = "Construct a new `XrPermissionDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(name: PermissionName) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.name(name); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(&mut self, val: PermissionName) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSessionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`, `XrSessionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `optionalFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("optionalFeatures"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("requiredFeatures"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_XrPermissionStatus.rs b/crates/web-sys/src/features/gen_XrPermissionStatus.rs new file mode 100644 index 00000000000..ec403387b4b --- /dev/null +++ b/crates/web-sys/src/features/gen_XrPermissionStatus.rs @@ -0,0 +1,40 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = PermissionStatus , extends = EventTarget , extends = :: js_sys :: Object , js_name = XRPermissionStatus , typescript_type = "XRPermissionStatus")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrPermissionStatus` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrPermissionStatus; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRPermissionStatus" , js_name = granted)] + #[doc = "Getter for the `granted` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus/granted)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn granted(this: &XrPermissionStatus) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "XRPermissionStatus" , js_name = granted)] + #[doc = "Setter for the `granted` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPermissionStatus/granted)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionStatus`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_granted(this: &XrPermissionStatus, value: &::wasm_bindgen::JsValue); +} diff --git a/crates/web-sys/src/features/gen_XrPose.rs b/crates/web-sys/src/features/gen_XrPose.rs index f8a690fcdd5..bbdb63b33a4 100644 --- a/crates/web-sys/src/features/gen_XrPose.rs +++ b/crates/web-sys/src/features/gen_XrPose.rs @@ -28,6 +28,30 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transform(this: &XrPose) -> XrRigidTransform; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomPointReadOnly")] + # [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = linearVelocity)] + #[doc = "Getter for the `linearVelocity` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPose/linearVelocity)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointReadOnly`, `XrPose`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn linear_velocity(this: &XrPose) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomPointReadOnly")] + # [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = angularVelocity)] + #[doc = "Getter for the `angularVelocity` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRPose/angularVelocity)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointReadOnly`, `XrPose`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn angular_velocity(this: &XrPose) -> Option; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRPose" , js_name = emulatedPosition)] #[doc = "Getter for the `emulatedPosition` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs index 8ff8b96dd75..45b6efb64da 100644 --- a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs @@ -122,7 +122,7 @@ impl XrReferenceSpaceEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn transform(&mut self, val: &XrRigidTransform) -> &mut Self { + pub fn transform(&mut self, val: Option<&XrRigidTransform>) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), diff --git a/crates/web-sys/src/features/gen_XrRenderStateInit.rs b/crates/web-sys/src/features/gen_XrRenderStateInit.rs index 2bff16c5e0c..b3d5821aa33 100644 --- a/crates/web-sys/src/features/gen_XrRenderStateInit.rs +++ b/crates/web-sys/src/features/gen_XrRenderStateInit.rs @@ -112,6 +112,24 @@ impl XrRenderStateInit { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn layers(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layers"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } #[cfg(web_sys_unstable_apis)] impl Default for XrRenderStateInit { diff --git a/crates/web-sys/src/features/gen_XrSession.rs b/crates/web-sys/src/features/gen_XrSession.rs index fd54bb99fb0..48e4bc34c1d 100644 --- a/crates/web-sys/src/features/gen_XrSession.rs +++ b/crates/web-sys/src/features/gen_XrSession.rs @@ -28,6 +28,28 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn visibility_state(this: &XrSession) -> XrVisibilityState; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = frameRate)] + #[doc = "Getter for the `frameRate` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/frameRate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn frame_rate(this: &XrSession) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = supportedFrameRates)] + #[doc = "Getter for the `supportedFrameRates` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/supportedFrameRates)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn supported_frame_rates(this: &XrSession) -> Option>; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrRenderState")] # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = renderState)] #[doc = "Getter for the `renderState` field of this object."] @@ -74,49 +96,49 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn set_onend(this: &XrSession, value: Option<&::js_sys::Function>); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onselect)] - #[doc = "Getter for the `onselect` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = oninputsourceschange)] + #[doc = "Getter for the `oninputsourceschange` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn onselect(this: &XrSession) -> Option<::js_sys::Function>; + pub fn oninputsourceschange(this: &XrSession) -> Option<::js_sys::Function>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onselect)] - #[doc = "Setter for the `onselect` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = oninputsourceschange)] + #[doc = "Setter for the `oninputsourceschange` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_onselect(this: &XrSession, value: Option<&::js_sys::Function>); + pub fn set_oninputsourceschange(this: &XrSession, value: Option<&::js_sys::Function>); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = oninputsourceschange)] - #[doc = "Getter for the `oninputsourceschange` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onselect)] + #[doc = "Getter for the `onselect` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn oninputsourceschange(this: &XrSession) -> Option<::js_sys::Function>; + pub fn onselect(this: &XrSession) -> Option<::js_sys::Function>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = oninputsourceschange)] - #[doc = "Setter for the `oninputsourceschange` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onselect)] + #[doc = "Setter for the `onselect` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_oninputsourceschange(this: &XrSession, value: Option<&::js_sys::Function>); + pub fn set_onselect(this: &XrSession, value: Option<&::js_sys::Function>); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onselectstart)] #[doc = "Getter for the `onselectstart` field of this object."] @@ -162,6 +184,72 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn set_onselectend(this: &XrSession, value: Option<&::js_sys::Function>); #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onsqueeze)] + #[doc = "Getter for the `onsqueeze` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueeze)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onsqueeze(this: &XrSession) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onsqueeze)] + #[doc = "Setter for the `onsqueeze` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueeze)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onsqueeze(this: &XrSession, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onsqueezestart)] + #[doc = "Getter for the `onsqueezestart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezestart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onsqueezestart(this: &XrSession) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onsqueezestart)] + #[doc = "Setter for the `onsqueezestart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezestart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onsqueezestart(this: &XrSession, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onsqueezeend)] + #[doc = "Getter for the `onsqueezeend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezeend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onsqueezeend(this: &XrSession) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onsqueezeend)] + #[doc = "Setter for the `onsqueezeend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezeend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onsqueezeend(this: &XrSession, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onvisibilitychange)] #[doc = "Getter for the `onvisibilitychange` field of this object."] #[doc = ""] @@ -184,6 +272,28 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn set_onvisibilitychange(this: &XrSession, value: Option<&::js_sys::Function>); #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = onframeratechange)] + #[doc = "Getter for the `onframeratechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onframeratechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onframeratechange(this: &XrSession) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "XRSession" , js_name = onframeratechange)] + #[doc = "Setter for the `onframeratechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onframeratechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onframeratechange(this: &XrSession, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "XRSession" , js_name = cancelAnimationFrame)] #[doc = "The `cancelAnimationFrame()` method."] #[doc = ""] @@ -193,7 +303,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn cancel_animation_frame(this: &XrSession, handle: i32); + pub fn cancel_animation_frame(this: &XrSession, handle: u32); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "XRSession" , js_name = end)] #[doc = "The `end()` method."] @@ -215,7 +325,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn request_animation_frame(this: &XrSession, callback: &::js_sys::Function) -> i32; + pub fn request_animation_frame(this: &XrSession, callback: &::js_sys::Function) -> u32; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrReferenceSpaceType")] # [wasm_bindgen (method , structural , js_class = "XRSession" , js_name = requestReferenceSpace)] @@ -254,4 +364,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn update_render_state_with_state(this: &XrSession, state: &XrRenderStateInit); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRSession" , js_name = updateTargetFrameRate)] + #[doc = "The `updateTargetFrameRate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/updateTargetFrameRate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn update_target_frame_rate(this: &XrSession, rate: f32) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_XrSessionMode.rs b/crates/web-sys/src/features/gen_XrSessionMode.rs index c4bdc89b7a8..d5a6803f263 100644 --- a/crates/web-sys/src/features/gen_XrSessionMode.rs +++ b/crates/web-sys/src/features/gen_XrSessionMode.rs @@ -12,4 +12,5 @@ use wasm_bindgen::prelude::*; pub enum XrSessionMode { Inline = "inline", ImmersiveVr = "immersive-vr", + ImmersiveAr = "immersive-ar", } diff --git a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs new file mode 100644 index 00000000000..26a771f63d9 --- /dev/null +++ b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs @@ -0,0 +1,68 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRSessionSupportedPermissionDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrSessionSupportedPermissionDescriptor` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrSessionSupportedPermissionDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl XrSessionSupportedPermissionDescriptor { + #[cfg(feature = "PermissionName")] + #[doc = "Construct a new `XrSessionSupportedPermissionDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(name: PermissionName) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.name(name); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(&mut self, val: PermissionName) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSessionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionMode`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_XrView.rs b/crates/web-sys/src/features/gen_XrView.rs index 1e5a3a3e379..9f5781265a1 100644 --- a/crates/web-sys/src/features/gen_XrView.rs +++ b/crates/web-sys/src/features/gen_XrView.rs @@ -50,4 +50,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transform(this: &XrView) -> XrRigidTransform; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRView" , js_name = recommendedViewportScale)] + #[doc = "Getter for the `recommendedViewportScale` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRView/recommendedViewportScale)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn recommended_viewport_scale(this: &XrView) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRView" , js_name = requestViewportScale)] + #[doc = "The `requestViewportScale()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRView/requestViewportScale)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_viewport_scale(this: &XrView, scale: Option); } diff --git a/crates/web-sys/src/features/gen_XrWebGlLayer.rs b/crates/web-sys/src/features/gen_XrWebGlLayer.rs index cec106b3a43..96ef16db760 100644 --- a/crates/web-sys/src/features/gen_XrWebGlLayer.rs +++ b/crates/web-sys/src/features/gen_XrWebGlLayer.rs @@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRWebGLLayer , typescript_type = "XRWebGLLayer")] + # [wasm_bindgen (extends = XrLayer , extends = EventTarget , extends = :: js_sys :: Object , js_name = XRWebGLLayer , typescript_type = "XRWebGLLayer")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `XrWebGlLayer` class."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 56e88697404..de57c836abd 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8632,6 +8632,24 @@ mod gen_XrInputSourcesChangeEventInit; #[cfg(feature = "XrInputSourcesChangeEventInit")] pub use gen_XrInputSourcesChangeEventInit::*; +#[cfg(feature = "XrLayer")] +#[allow(non_snake_case)] +mod gen_XrLayer; +#[cfg(feature = "XrLayer")] +pub use gen_XrLayer::*; + +#[cfg(feature = "XrPermissionDescriptor")] +#[allow(non_snake_case)] +mod gen_XrPermissionDescriptor; +#[cfg(feature = "XrPermissionDescriptor")] +pub use gen_XrPermissionDescriptor::*; + +#[cfg(feature = "XrPermissionStatus")] +#[allow(non_snake_case)] +mod gen_XrPermissionStatus; +#[cfg(feature = "XrPermissionStatus")] +pub use gen_XrPermissionStatus::*; + #[cfg(feature = "XrPose")] #[allow(non_snake_case)] mod gen_XrPose; @@ -8710,6 +8728,12 @@ mod gen_XrSessionMode; #[cfg(feature = "XrSessionMode")] pub use gen_XrSessionMode::*; +#[cfg(feature = "XrSessionSupportedPermissionDescriptor")] +#[allow(non_snake_case)] +mod gen_XrSessionSupportedPermissionDescriptor; +#[cfg(feature = "XrSessionSupportedPermissionDescriptor")] +pub use gen_XrSessionSupportedPermissionDescriptor::*; + #[cfg(feature = "XrSpace")] #[allow(non_snake_case)] mod gen_XrSpace; diff --git a/crates/web-sys/webidls/unstable/WebXRDevice.webidl b/crates/web-sys/webidls/unstable/WebXRDevice.webidl index 4d8ed4cc98f..e3200ca46cd 100644 --- a/crates/web-sys/webidls/unstable/WebXRDevice.webidl +++ b/crates/web-sys/webidls/unstable/WebXRDevice.webidl @@ -1,9 +1,9 @@ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * WebXR Device API - * W3C Working Draft, 10 October 2019 + * W3C Working Draft, 31 March 2022 * The origin of this IDL file is: - * https://www.w3.org/TR/2019/WD-webxr-20191010/ + * https://www.w3.org/TR/2022/CR-webxr-20220331/ */ partial interface Navigator { @@ -21,7 +21,8 @@ partial interface Navigator { enum XRSessionMode { "inline", - "immersive-vr" + "immersive-vr", + "immersive-ar" }; dictionary XRSessionInit { @@ -38,25 +39,32 @@ enum XRVisibilityState { [SecureContext, Exposed=Window] interface XRSession : EventTarget { // Attributes readonly attribute XRVisibilityState visibilityState; + readonly attribute float? frameRate; + readonly attribute Float32Array? supportedFrameRates; [SameObject] readonly attribute XRRenderState renderState; [SameObject] readonly attribute XRInputSourceArray inputSources; // Methods undefined updateRenderState(optional XRRenderStateInit state = {}); + Promise updateTargetFrameRate(float rate); [NewObject] Promise requestReferenceSpace(XRReferenceSpaceType type); - long requestAnimationFrame(XRFrameRequestCallback callback); - undefined cancelAnimationFrame(long handle); + unsigned long requestAnimationFrame(XRFrameRequestCallback callback); + undefined cancelAnimationFrame(unsigned long handle); Promise end(); // Events attribute EventHandler onend; - attribute EventHandler onselect; attribute EventHandler oninputsourceschange; + attribute EventHandler onselect; attribute EventHandler onselectstart; attribute EventHandler onselectend; + attribute EventHandler onsqueeze; + attribute EventHandler onsqueezestart; + attribute EventHandler onsqueezeend; attribute EventHandler onvisibilitychange; + attribute EventHandler onframeratechange; }; dictionary XRRenderStateInit { @@ -64,6 +72,7 @@ dictionary XRRenderStateInit { double depthFar; double inlineVerticalFieldOfView; XRWebGLLayer? baseLayer; + sequence? layers; }; [SecureContext, Exposed=Window] interface XRRenderState { @@ -77,6 +86,7 @@ callback XRFrameRequestCallback = undefined (DOMHighResTimeStamp time, XRFrame f [SecureContext, Exposed=Window] interface XRFrame { [SameObject] readonly attribute XRSession session; + readonly attribute DOMHighResTimeStamp predictedDisplayTime; XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace); XRPose? getPose(XRSpace space, XRSpace baseSpace); @@ -103,10 +113,7 @@ interface XRReferenceSpace : XRSpace { [SecureContext, Exposed=Window] interface XRBoundedReferenceSpace : XRReferenceSpace { - // TODO: Re-enable FrozenArray when supported. See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 - //readonly attribute FrozenArray boundsGeometry; - [Frozen, Cached, Pure] - readonly attribute sequence boundsGeometry; + readonly attribute FrozenArray boundsGeometry; }; enum XREye { @@ -119,6 +126,9 @@ enum XREye { readonly attribute XREye eye; readonly attribute Float32Array projectionMatrix; [SameObject] readonly attribute XRRigidTransform transform; + readonly attribute double? recommendedViewportScale; + + undefined requestViewportScale(double? scale); }; [SecureContext, Exposed=Window] interface XRViewport { @@ -139,14 +149,14 @@ interface XRRigidTransform { [SecureContext, Exposed=Window] interface XRPose { [SameObject] readonly attribute XRRigidTransform transform; + [SameObject] readonly attribute DOMPointReadOnly? linearVelocity; + [SameObject] readonly attribute DOMPointReadOnly? angularVelocity; + readonly attribute boolean emulatedPosition; }; [SecureContext, Exposed=Window] interface XRViewerPose : XRPose { - // TODO: Re-enable FrozenArray when supported. See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 - //[SameObject] readonly attribute FrozenArray views; - [SameObject, Frozen, Cached, Pure] - readonly attribute sequence views; + [SameObject] readonly attribute FrozenArray views; }; enum XRHandedness { @@ -163,15 +173,11 @@ enum XRTargetRayMode { [SecureContext, Exposed=Window] interface XRInputSource { - readonly attribute Gamepad? gamepad; readonly attribute XRHandedness handedness; readonly attribute XRTargetRayMode targetRayMode; [SameObject] readonly attribute XRSpace targetRaySpace; [SameObject] readonly attribute XRSpace? gripSpace; - // TODO: Re-enable FrozenArray when supported. See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 - //[SameObject] readonly attribute FrozenArray profiles; - [SameObject, Frozen, Cached, Pure] - readonly attribute sequence profiles; + [SameObject] readonly attribute FrozenArray profiles; }; [SecureContext, Exposed=Window] @@ -181,6 +187,10 @@ interface XRInputSourceArray { getter XRInputSource(unsigned long index); }; +[SecureContext, Exposed=Window] +interface XRLayer : EventTarget {}; + + typedef (WebGLRenderingContext or WebGL2RenderingContext) XRWebGLRenderingContext; @@ -215,11 +225,11 @@ interface XRWebGLLayer: XRLayer { }; partial dictionary WebGLContextAttributes { - boolean xrCompatible = null; + boolean xrCompatible = false; }; partial interface mixin WebGLRenderingContextBase { - Promise makeXRCompatible(); + [NewObject] Promise makeXRCompatible(); }; [SecureContext, Exposed=Window] @@ -248,24 +258,14 @@ dictionary XRInputSourceEventInit : EventInit { interface XRInputSourcesChangeEvent : Event { constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict); [SameObject] readonly attribute XRSession session; - // TODO: Re-enable FrozenArray when supported. See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 - //[SameObject] readonly attribute FrozenArray added; - [SameObject, Frozen, Cached, Pure] - readonly attribute sequence added; - //[SameObject] readonly attribute FrozenArray removed; - [SameObject, Frozen, Cached, Pure] - readonly attribute sequence removed; + [SameObject] readonly attribute FrozenArray added; + [SameObject] readonly attribute FrozenArray removed; }; dictionary XRInputSourcesChangeEventInit : EventInit { required XRSession session; - // TODO: Re-enable FrozenArray when supported. See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 - //required FrozenArray added; - [Frozen, Cached, Pure] - required sequence added; - //required FrozenArray removed; - [Frozen, Cached, Pure] - required sequence removed; + required FrozenArray added; + required FrozenArray removed; }; @@ -278,5 +278,20 @@ interface XRReferenceSpaceEvent : Event { dictionary XRReferenceSpaceEventInit : EventInit { required XRReferenceSpace referenceSpace; - XRRigidTransform transform; + XRRigidTransform? transform = null; }; + +dictionary XRSessionSupportedPermissionDescriptor: PermissionDescriptor { + XRSessionMode mode; +}; + +dictionary XRPermissionDescriptor: PermissionDescriptor { + XRSessionMode mode; + sequence requiredFeatures; + sequence optionalFeatures; +}; + +[Exposed=Window] +interface XRPermissionStatus: PermissionStatus { + attribute FrozenArray granted; +}; \ No newline at end of file diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 4127ec5e1ae..0ad5fc4a542 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -30,7 +30,6 @@ features = [ 'Response', 'WebGl2RenderingContext', 'Window', - 'Xr', 'XrBoundedReferenceSpace', 'XrEye', 'XrFrame', @@ -61,5 +60,6 @@ features = [ 'XrVisibilityState', 'XrWebGlLayer', 'XrWebGlLayerInit', + 'XrSystem', 'console' ] diff --git a/examples/webxr/src/lib.rs b/examples/webxr/src/lib.rs index 7bc95d0e09e..1150e91d390 100644 --- a/examples/webxr/src/lib.rs +++ b/examples/webxr/src/lib.rs @@ -22,7 +22,7 @@ macro_rules! log { } } -fn request_animation_frame(session: &XrSession, f: &Closure) -> i32 { +fn request_animation_frame(session: &XrSession, f: &Closure) -> u32 { // This turns the Closure into a js_sys::Function // See https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen/closure/struct.Closure.html#casting-a-closure-to-a-js_sysfunction session.request_animation_frame(f.as_ref().unchecked_ref()) From 8ac33c64cb404c74bd2428540a6ad71b969184ac Mon Sep 17 00:00:00 2001 From: thisisrandy Date: Mon, 18 Apr 2022 07:25:24 -0700 Subject: [PATCH 002/641] Add note about using custom WebDrivers (#2867) --- guide/src/wasm-bindgen-test/browsers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guide/src/wasm-bindgen-test/browsers.md b/guide/src/wasm-bindgen-test/browsers.md index b3e91e1827a..5436e0fc116 100644 --- a/guide/src/wasm-bindgen-test/browsers.md +++ b/guide/src/wasm-bindgen-test/browsers.md @@ -46,6 +46,10 @@ test` with the appropriate browser flags and `--headless`: wasm-pack test --headless --chrome --firefox --safari ``` +If you wish to use a custom WebDriver, e.g. to test an older version of a +browser, use the environment variables detailed in [the +appendix](#configuring-which-browser-is-used-1). + ## Configuring Headless Browser capabilities Add the file `webdriver.json` to the root of your crate. Each browser has own From e8ea73996c8b838a34c6cedd1d29d7824123e280 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 19 Apr 2022 06:56:02 -0700 Subject: [PATCH 003/641] Revert "Add note about using custom WebDrivers (#2867)" This reverts commit 8ac33c64cb404c74bd2428540a6ad71b969184ac. --- guide/src/wasm-bindgen-test/browsers.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/guide/src/wasm-bindgen-test/browsers.md b/guide/src/wasm-bindgen-test/browsers.md index 5436e0fc116..b3e91e1827a 100644 --- a/guide/src/wasm-bindgen-test/browsers.md +++ b/guide/src/wasm-bindgen-test/browsers.md @@ -46,10 +46,6 @@ test` with the appropriate browser flags and `--headless`: wasm-pack test --headless --chrome --firefox --safari ``` -If you wish to use a custom WebDriver, e.g. to test an older version of a -browser, use the environment variables detailed in [the -appendix](#configuring-which-browser-is-used-1). - ## Configuring Headless Browser capabilities Add the file `webdriver.json` to the root of your crate. Each browser has own From 70b74208e49c357c6f210150a51db6951a1aa4ae Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 29 Apr 2022 02:21:55 +1000 Subject: [PATCH 004/641] Reference types fixes (#2832) * Don't try to make `Result`-returning functions return externrefs The check for whether an export returns an externref didn't take into account retptrs, which caused them to miscategorise functions which returned `Result`. I had to make some other changes to allow `ExternrefLoadOwned` to work with reference types enabled. * Support string interning with reference types enabled * Don't create duplicate closure adapters for the same function signature Fixes #2830 This was causing things to break with reference types enabled, since each closure adapter had a corresponding wasm export, leading to duplicate wasm exports, which is invalid. I did this by adding some deduplication for closures (both long-lived and stack). There was already some deduplication for long-lived closures (which I removed in favour of the shared deduplication), but it considered named externrefs different to unnamed externrefs, which the compiler doesn't. So with the new deduplication, I first replace all named externrefs with unnamed externrefs to make sure they're treated the same. * fmt --- crates/cli-support/src/descriptors.rs | 22 ++++-------- crates/cli-support/src/externref.rs | 19 ++++++---- crates/cli-support/src/js/binding.rs | 16 ++++++--- crates/cli-support/src/js/mod.rs | 43 ++++++++++++++++++----- crates/cli-support/src/wit/mod.rs | 48 ++++++++++++++++++++++++-- crates/cli-support/src/wit/outgoing.rs | 17 ++++++--- crates/cli-support/src/wit/section.rs | 5 ++- crates/cli-support/src/wit/standard.rs | 8 ++++- tests/wasm/closures.rs | 12 +++++++ 9 files changed, 148 insertions(+), 42 deletions(-) diff --git a/crates/cli-support/src/descriptors.rs b/crates/cli-support/src/descriptors.rs index 2486ff8d059..36e81092a3b 100644 --- a/crates/cli-support/src/descriptors.rs +++ b/crates/cli-support/src/descriptors.rs @@ -22,7 +22,6 @@ use wasm_bindgen_wasm_interpreter::Interpreter; pub struct WasmBindgenDescriptorsSection { pub descriptors: HashMap, pub closure_imports: HashMap, - cached_closures: HashMap, } pub type WasmBindgenDescriptorsSectionId = TypedCustomSectionId; @@ -120,21 +119,12 @@ impl WasmBindgenDescriptorsSection { let mut items = func_to_descriptor.into_iter().collect::>(); items.sort_by_key(|i| i.0); for (func, descriptor) in items { - // This uses a cache so that if the same closure exists multiple times it will - // deduplicate it so it only exists once. - let id = match self.cached_closures.get(&descriptor) { - Some(id) => *id, - None => { - let import_name = format!("__wbindgen_closure_wrapper{}", func.index()); - let (id, import_id) = - module.add_import_func("__wbindgen_placeholder__", &import_name, ty); - module.funcs.get_mut(id).name = Some(import_name); - self.closure_imports - .insert(import_id, descriptor.clone().unwrap_closure()); - self.cached_closures.insert(descriptor, id); - id - } - }; + let import_name = format!("__wbindgen_closure_wrapper{}", func.index()); + let (id, import_id) = + module.add_import_func("__wbindgen_placeholder__", &import_name, ty); + module.funcs.get_mut(id).name = Some(import_name); + self.closure_imports + .insert(import_id, descriptor.clone().unwrap_closure()); let local = match &mut module.funcs.get_mut(func).kind { walrus::FunctionKind::Local(l) => l, diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index 8aff6a4853a..fa158d054da 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -110,7 +110,10 @@ pub fn process(module: &mut Module) -> Result<()> { *table_and_alloc = meta.alloc.map(|id| (meta.table, id)); } - Instruction::UnwrapResult { + Instruction::ExternrefLoadOwned { + ref mut table_and_drop, + } + | Instruction::UnwrapResult { ref mut table_and_drop, } | Instruction::UnwrapResultString { @@ -118,6 +121,7 @@ pub fn process(module: &mut Module) -> Result<()> { } => { *table_and_drop = meta.drop.map(|id| (meta.table, id)); } + Instruction::CachedStringLoad { ref mut table, .. } => *table = Some(meta.table), _ => continue, }; } @@ -177,7 +181,7 @@ fn import_xform( while let Some((i, instr)) = iter.next() { match instr.instr { Instruction::CallAdapter(_) => break, - Instruction::ExternrefLoadOwned | Instruction::TableGet => { + Instruction::ExternrefLoadOwned { .. } | Instruction::TableGet => { let owned = match instr.instr { Instruction::TableGet => false, _ => true, @@ -299,13 +303,16 @@ fn export_xform(cx: &mut Context, export: Export, instrs: &mut Vec { + Instruction::LoadRetptr { .. } => uses_retptr = true, + Instruction::ExternrefLoadOwned { .. } if !uses_retptr => { ret_externref = true; to_delete.push(i); } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 9eb290ae350..50931ea9300 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -942,10 +942,17 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("{} !== 0", val)); } - Instruction::ExternrefLoadOwned => { - js.cx.expose_take_object(); + Instruction::ExternrefLoadOwned { table_and_drop } => { + let take_object = if let Some((table, drop)) = *table_and_drop { + js.cx + .expose_take_from_externref_table(table, drop)? + .to_string() + } else { + js.cx.expose_take_object(); + "takeObject".to_string() + }; let val = js.pop(); - js.push(format!("takeObject({})", val)); + js.push(format!("{}({})", take_object, val)); } Instruction::StringFromChar => { @@ -996,12 +1003,13 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> optional: _, mem, free, + table, } => { let len = js.pop(); let ptr = js.pop(); let tmp = js.tmp(); - let get = js.cx.expose_get_cached_string_from_wasm(*mem)?; + let get = js.cx.expose_get_cached_string_from_wasm(*mem, *table)?; js.prelude(&format!("var v{} = {}({}, {});", tmp, get, ptr, len)); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index ed540b0cfe3..36c8c3a8668 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1400,12 +1400,21 @@ impl<'a> Context<'a> { Ok(ret) } - fn expose_get_cached_string_from_wasm(&mut self, memory: MemoryId) -> Result { - self.expose_get_object(); - let get = self.expose_get_string_from_wasm(memory)?; + fn expose_get_cached_string_from_wasm( + &mut self, + memory: MemoryId, + table: Option, + ) -> Result { + let get_object = if let Some(table) = table { + self.expose_get_from_externref_table(table)?.to_string() + } else { + self.expose_get_object(); + "getObject".to_string() + }; + let get_string = self.expose_get_string_from_wasm(memory)?; let ret = MemView { name: "getCachedStringFromWasm", - num: get.num, + num: get_string.num, }; if !self.should_write_global(ret.to_string()) { @@ -1422,15 +1431,17 @@ impl<'a> Context<'a> { // the fact that `getObject(0)` is guaranteed to be `undefined`. self.global(&format!( " - function {}(ptr, len) {{ + function {name}(ptr, len) {{ if (ptr === 0) {{ - return getObject(len); + return {get_object}(len); }} else {{ - return {}(ptr, len); + return {get_string}(ptr, len); }} }} ", - ret, get, + name = ret, + get_string = get_string, + get_object = get_object )); Ok(ret) } @@ -2193,6 +2204,22 @@ impl<'a> Context<'a> { true } + fn expose_get_from_externref_table(&mut self, table: TableId) -> Result { + let view = self.memview_table("getFromExternrefTable", table); + assert!(self.config.externref); + if !self.should_write_global(view.to_string()) { + return Ok(view); + } + let table = self.export_name_of(table); + self.global(&format!( + "function {view}(idx) {{ return wasm.{table}.get(idx); }}", + view = view, + table = table, + )); + + Ok(view) + } + fn expose_take_from_externref_table( &mut self, table: TableId, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index b041a77841c..529c5a5c362 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -24,6 +24,8 @@ struct Context<'a> { aux: WasmBindgenAux, function_exports: HashMap, function_imports: HashMap, + /// A map from the signature of a function in the function table to its adapter, if we've already created it. + table_adapters: HashMap, memory: Option, vendor_prefixes: HashMap>, unique_crate_identifier: &'a str, @@ -55,6 +57,7 @@ pub fn process( aux: Default::default(), function_exports: Default::default(), function_imports: Default::default(), + table_adapters: Default::default(), vendor_prefixes: Default::default(), descriptors: Default::default(), unique_crate_identifier: "", @@ -1278,10 +1281,51 @@ impl<'a> Context<'a> { Ok(id) } - fn table_element_adapter(&mut self, idx: u32, signature: Function) -> Result { + fn table_element_adapter( + &mut self, + idx: u32, + mut signature: Function, + ) -> Result { + fn strip_externref_names(descriptor: &mut Descriptor) { + match descriptor { + Descriptor::NamedExternref(_) => *descriptor = Descriptor::Externref, + + Descriptor::Function(function) => strip_function_externref_names(&mut **function), + Descriptor::Closure(closure) => { + strip_function_externref_names(&mut closure.function) + } + Descriptor::Ref(descriptor) + | Descriptor::RefMut(descriptor) + | Descriptor::Slice(descriptor) + | Descriptor::Vector(descriptor) + | Descriptor::Option(descriptor) + | Descriptor::Result(descriptor) => strip_externref_names(&mut **descriptor), + + _ => {} + } + } + + fn strip_function_externref_names(descriptor: &mut Function) { + descriptor + .arguments + .iter_mut() + .for_each(strip_externref_names); + strip_externref_names(&mut descriptor.ret); + descriptor.inner_ret.as_mut().map(strip_externref_names); + } + + // We don't care about the names of externrefs here; we only care whether + // the compiler will actually keep them as separate functions. + strip_function_externref_names(&mut signature); + + if let Some(&id) = self.table_adapters.get(&signature) { + return Ok(id); + } let call = Instruction::CallTableElement(idx); // like above, largely just defer the work elsewhere - Ok(self.register_export_adapter(call, signature)?) + let id = self.register_export_adapter(call, signature.clone())?; + self.table_adapters.insert(signature, id); + Ok(id) } fn register_export_adapter( diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 26dbb151122..e2598f7e920 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -42,14 +42,18 @@ impl InstructionBuilder<'_, '_> { Descriptor::Externref => { self.instruction( &[AdapterType::I32], - Instruction::ExternrefLoadOwned, + Instruction::ExternrefLoadOwned { + table_and_drop: None, + }, &[AdapterType::Externref], ); } Descriptor::NamedExternref(name) => { self.instruction( &[AdapterType::I32], - Instruction::ExternrefLoadOwned, + Instruction::ExternrefLoadOwned { + table_and_drop: None, + }, &[AdapterType::NamedExternref(name.clone())], ); } @@ -252,14 +256,18 @@ impl InstructionBuilder<'_, '_> { // is the valid owned index. self.instruction( &[AdapterType::I32], - Instruction::ExternrefLoadOwned, + Instruction::ExternrefLoadOwned { + table_and_drop: None, + }, &[AdapterType::Externref.option()], ); } Descriptor::NamedExternref(name) => { self.instruction( &[AdapterType::I32], - Instruction::ExternrefLoadOwned, + Instruction::ExternrefLoadOwned { + table_and_drop: None, + }, &[AdapterType::NamedExternref(name.clone()).option()], ); } @@ -543,6 +551,7 @@ impl InstructionBuilder<'_, '_> { optional, mem, free, + table: None, }, &[AdapterType::String], ); diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 30a6f82acc5..7956b013e73 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -245,7 +245,10 @@ fn translate_instruction( I32FromStringFirstChar | StringFromChar => { bail!("chars aren't supported in wasm interface types"); } - I32FromExternrefOwned | I32FromExternrefBorrow | ExternrefLoadOwned | TableGet => { + // Note: if `ExternrefLoadOwned` contained `Some`, this error message wouldn't make sense, + // but that can only occur when returning `Result`, + // in which case there'll be an earlier `UnwrapResult` instruction and we'll bail before reaching this point. + I32FromExternrefOwned | I32FromExternrefBorrow | ExternrefLoadOwned { .. } | TableGet => { bail!("externref pass failed to sink into wasm module"); } I32FromExternrefRustOwned { .. } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 412f10aafc6..78df620d765 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -233,7 +233,11 @@ pub enum Instruction { /// pops a `i32`, pushes `bool` BoolFromI32, /// pops `i32`, loads externref at that slot, dealloates externref, pushes `externref` - ExternrefLoadOwned, + ExternrefLoadOwned { + /// This is needed solely for `Result`, since it can contain externrefs, + /// but has to pass them through a retptr. + table_and_drop: Option<(walrus::TableId, walrus::FunctionId)>, + }, /// pops `i32`, pushes string from that `char` StringFromChar, /// pops two `i32`, pushes a 64-bit number @@ -253,6 +257,8 @@ pub enum Instruction { optional: bool, mem: walrus::MemoryId, free: walrus::FunctionId, + /// If we're in reference-types mode, the externref table ID to get the cached string from. + table: Option, }, /// pops ptr/length, pushes a vector, frees the original data VectorLoad { diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index 4ac8ef0c11e..ca5cd729055 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -1,5 +1,6 @@ #![cfg(feature = "nightly")] +use js_sys::Number; use std::cell::{Cell, RefCell}; use std::rc::Rc; use wasm_bindgen::prelude::*; @@ -119,6 +120,11 @@ extern "C" { fn js_store_forgotten_closure(closure: &Closure); fn js_call_forgotten_closure(); + + #[wasm_bindgen(js_name = many_arity_call2)] + fn externref_call(a: &Closure); + #[wasm_bindgen(js_name = many_arity_call2)] + fn named_externref_call(a: &Closure); } #[wasm_bindgen_test] @@ -633,3 +639,9 @@ fn forget_works() { a.forget(); js_call_forgotten_closure(); } + +#[wasm_bindgen_test] +fn named_externref_no_duplicate_adapter() { + externref_call(&Closure::new(|a| assert_eq!(a, 1))); + named_externref_call(&Closure::new(|a| assert_eq!(a, 1))); +} From bf60a108795660fe77ee2229c4a8310c9a8e3b81 Mon Sep 17 00:00:00 2001 From: Alejandro Pascual Date: Fri, 29 Apr 2022 16:14:04 +0200 Subject: [PATCH 005/641] Added MediaCaptureTransform API (#2879) --- crates/web-sys/Cargo.toml | 4 ++ .../features/gen_MediaStreamTrackGenerator.rs | 54 ++++++++++++++ .../gen_MediaStreamTrackGeneratorInit.rs | 48 +++++++++++++ .../features/gen_MediaStreamTrackProcessor.rs | 54 ++++++++++++++ .../gen_MediaStreamTrackProcessorInit.rs | 71 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 24 +++++++ .../unstable/MediaCaptureTransform.webidl | 20 ++++++ 7 files changed, 275 insertions(+) create mode 100644 crates/web-sys/src/features/gen_MediaStreamTrackGenerator.rs create mode 100644 crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs create mode 100644 crates/web-sys/src/features/gen_MediaStreamTrackProcessor.rs create mode 100644 crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs create mode 100644 crates/web-sys/webidls/unstable/MediaCaptureTransform.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index e8e4da57db8..9dc2ac1045b 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -776,6 +776,10 @@ MediaStreamEventInit = [] MediaStreamTrack = ["EventTarget"] MediaStreamTrackEvent = ["Event"] MediaStreamTrackEventInit = [] +MediaStreamTrackGenerator = [] +MediaStreamTrackGeneratorInit = [] +MediaStreamTrackProcessor = [] +MediaStreamTrackProcessorInit = [] MediaStreamTrackState = [] MediaTrackConstraintSet = [] MediaTrackConstraints = [] diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGenerator.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGenerator.rs new file mode 100644 index 00000000000..eed765756f2 --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGenerator.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = MediaStreamTrack , extends = EventTarget , extends = :: js_sys :: Object , js_name = MediaStreamTrackGenerator , typescript_type = "MediaStreamTrackGenerator")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaStreamTrackGenerator` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGenerator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaStreamTrackGenerator; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamTrackGenerator" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGenerator`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &MediaStreamTrackGenerator) -> WritableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , setter , js_class = "MediaStreamTrackGenerator" , js_name = writable)] + #[doc = "Setter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGenerator`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_writable(this: &MediaStreamTrackGenerator, value: &WritableStream); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaStreamTrackGeneratorInit")] + #[wasm_bindgen(catch, constructor, js_class = "MediaStreamTrackGenerator")] + #[doc = "The `new MediaStreamTrackGenerator(..)` constructor, creating a new instance of `MediaStreamTrackGenerator`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackGenerator/MediaStreamTrackGenerator)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGenerator`, `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(init: &MediaStreamTrackGeneratorInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs new file mode 100644 index 00000000000..fc666fd7b85 --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs @@ -0,0 +1,48 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaStreamTrackGeneratorInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaStreamTrackGeneratorInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaStreamTrackGeneratorInit; +} +#[cfg(web_sys_unstable_apis)] +impl MediaStreamTrackGeneratorInit { + #[doc = "Construct a new `MediaStreamTrackGeneratorInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(kind: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.kind(kind); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `kind` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn kind(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("kind"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackProcessor.rs b/crates/web-sys/src/features/gen_MediaStreamTrackProcessor.rs new file mode 100644 index 00000000000..8f3b04980cb --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaStreamTrackProcessor.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaStreamTrackProcessor , typescript_type = "MediaStreamTrackProcessor")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaStreamTrackProcessor` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaStreamTrackProcessor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamTrackProcessor" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessor`, `ReadableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &MediaStreamTrackProcessor) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , setter , js_class = "MediaStreamTrackProcessor" , js_name = readable)] + #[doc = "Setter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessor`, `ReadableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_readable(this: &MediaStreamTrackProcessor, value: &ReadableStream); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaStreamTrackProcessorInit")] + #[wasm_bindgen(catch, constructor, js_class = "MediaStreamTrackProcessor")] + #[doc = "The `new MediaStreamTrackProcessor(..)` constructor, creating a new instance of `MediaStreamTrackProcessor`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackProcessor/MediaStreamTrackProcessor)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessor`, `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(init: &MediaStreamTrackProcessorInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs new file mode 100644 index 00000000000..8ce1dff7adc --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs @@ -0,0 +1,71 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaStreamTrackProcessorInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaStreamTrackProcessorInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaStreamTrackProcessorInit; +} +#[cfg(web_sys_unstable_apis)] +impl MediaStreamTrackProcessorInit { + #[cfg(feature = "MediaStreamTrack")] + #[doc = "Construct a new `MediaStreamTrackProcessorInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(track: &MediaStreamTrack) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.track(track); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `maxBufferSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_buffer_size(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("maxBufferSize"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaStreamTrack")] + #[doc = "Change the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("track"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index de57c836abd..531e7f0c281 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4474,6 +4474,30 @@ mod gen_MediaStreamTrackEventInit; #[cfg(feature = "MediaStreamTrackEventInit")] pub use gen_MediaStreamTrackEventInit::*; +#[cfg(feature = "MediaStreamTrackGenerator")] +#[allow(non_snake_case)] +mod gen_MediaStreamTrackGenerator; +#[cfg(feature = "MediaStreamTrackGenerator")] +pub use gen_MediaStreamTrackGenerator::*; + +#[cfg(feature = "MediaStreamTrackGeneratorInit")] +#[allow(non_snake_case)] +mod gen_MediaStreamTrackGeneratorInit; +#[cfg(feature = "MediaStreamTrackGeneratorInit")] +pub use gen_MediaStreamTrackGeneratorInit::*; + +#[cfg(feature = "MediaStreamTrackProcessor")] +#[allow(non_snake_case)] +mod gen_MediaStreamTrackProcessor; +#[cfg(feature = "MediaStreamTrackProcessor")] +pub use gen_MediaStreamTrackProcessor::*; + +#[cfg(feature = "MediaStreamTrackProcessorInit")] +#[allow(non_snake_case)] +mod gen_MediaStreamTrackProcessorInit; +#[cfg(feature = "MediaStreamTrackProcessorInit")] +pub use gen_MediaStreamTrackProcessorInit::*; + #[cfg(feature = "MediaStreamTrackState")] #[allow(non_snake_case)] mod gen_MediaStreamTrackState; diff --git a/crates/web-sys/webidls/unstable/MediaCaptureTransform.webidl b/crates/web-sys/webidls/unstable/MediaCaptureTransform.webidl new file mode 100644 index 00000000000..a81eee99435 --- /dev/null +++ b/crates/web-sys/webidls/unstable/MediaCaptureTransform.webidl @@ -0,0 +1,20 @@ +[Exposed=Window,DedicatedWorker] +interface MediaStreamTrackGenerator : MediaStreamTrack { + constructor(MediaStreamTrackGeneratorInit init); + attribute WritableStream writable; // VideoFrame or AudioData +}; + +dictionary MediaStreamTrackGeneratorInit { + required DOMString kind; +}; + +[Exposed=DedicatedWorker] +interface MediaStreamTrackProcessor { + constructor(MediaStreamTrackProcessorInit init); + attribute ReadableStream readable; +}; + +dictionary MediaStreamTrackProcessorInit { + required MediaStreamTrack track; + [EnforceRange] unsigned short maxBufferSize; +}; From f26e30b6af873234771fac8ff3e7601163907019 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 5 May 2022 01:07:48 +1000 Subject: [PATCH 006/641] Optimise memory view getters (#2886) * Speed up the check for whether we need to remake a memory view Getting the buffer of a `WebAssembly.Memory` seems to have some overhead to it, so instead check if the existing view is 0 bytes long, which happens when they become detached after the memory is grown. I'm pretty sure that they'll never be zero bytes long otherwise; but even if they are, it's not the end of the world to recreate the view every time in that rare circumstance. * Initialise memory views when wasm is initialised With the last commit, if `init` was called twice on web/no-modules, the memory views would be stuck pointing to the first copy of memory, since it never actually gets detached; this fixes that by manually resetting them. This also allows eliminating the null check in the memory view getters, but it has practically no effect on performance. * Fix names for 64-bit memviews * Update reference tests --- crates/cli-support/src/js/mod.rs | 138 +++++++++++++----- .../tests/reference/anyref-import-catch.js | 19 ++- crates/cli/tests/reference/import-catch.js | 10 +- crates/cli/tests/reference/result-string.js | 19 ++- crates/cli/tests/reference/string-arg.js | 10 +- 5 files changed, 133 insertions(+), 63 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 36c8c3a8668..55d57311c32 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -9,9 +9,10 @@ use anyhow::{anyhow, bail, Context as _, Error}; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::fmt; +use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; -use walrus::{FunctionId, ImportId, MemoryId, Module, TableId, ValType}; +use walrus::{ExportItem, FunctionId, ImportId, MemoryId, Module, TableId, ValType}; mod binding; @@ -49,9 +50,12 @@ pub struct Context<'a> { /// they're defined in as well as their version specification. pub npm_dependencies: HashMap, - /// A mapping of a index for memories as we see them. Used in function - /// names. - memory_indices: HashMap, + /// A mapping from the memory IDs as we see them to an index for that memory, + /// used in function names, as well as all the kinds of views we've created + /// of that memory. + /// + /// `BTreeMap` and `BTreeSet` are used to make the ordering deterministic. + memories: BTreeMap)>, table_indices: HashMap, /// A flag to track if the stack pointer setter shim has been injected. @@ -101,7 +105,7 @@ impl<'a> Context<'a> { next_export_idx: 0, wit, aux, - memory_indices: Default::default(), + memories: Default::default(), table_indices: Default::default(), stack_pointer_shim_injected: false, }) @@ -399,8 +403,10 @@ impl<'a> Context<'a> { ))), ); + footer.push_str(&self.post_instantiate()); + if needs_manual_start { - footer.push_str("wasm.__wbindgen_start();\n"); + footer.push_str("\nwasm.__wbindgen_start();\n"); } } @@ -411,8 +417,11 @@ impl<'a> Context<'a> { footer.push_str(&self.generate_deno_wasm_loading(module_name)); + footer.push_str("\n\n"); + footer.push_str(&self.post_instantiate()); + if needs_manual_start { - footer.push_str("wasm.__wbindgen_start();\n"); + footer.push_str("\nwasm.__wbindgen_start();\n"); } } @@ -444,6 +453,10 @@ impl<'a> Context<'a> { footer.push_str(";\n"); } } + + footer.push('\n'); + footer.push_str(&self.post_instantiate()); + if needs_manual_start { start = Some("\nwasm.__wbindgen_start();\n".to_string()); } @@ -573,6 +586,37 @@ impl<'a> Context<'a> { Ok(imports) } + /// Returns JS to be run immediately after the wasm module is instantiated, + /// before the start function is called. + fn post_instantiate(&self) -> String { + let mut out = String::new(); + // Initialise all the memory views. + for (&mem_id, &(num, ref views)) in &self.memories { + // We can't just use `export_name_of` because it takes `&mut self` and we've already borrowed `views`. + let mem = match self + .module + .exports + .iter() + .find(|export| matches!(export.item, ExportItem::Memory(id) if id == mem_id)) + { + Some(export) => &export.name, + None => continue, + }; + + for kind in views { + writeln!( + out, + "cached{kind}Memory{num} = new {kind}Array(wasm.{mem}.buffer);", + kind = kind, + num = num, + mem = mem, + ) + .unwrap() + } + } + out + } + fn ts_for_init_fn( &self, has_memory: bool, @@ -785,6 +829,8 @@ impl<'a> Context<'a> { wasm = instance.exports; init.__wbindgen_wasm_module = module; + + {post_instantiate} {start} return wasm; }} @@ -792,6 +838,7 @@ impl<'a> Context<'a> { init_memory_arg = init_memory_arg, default_module_path = default_module_path, init_memory = init_memory, + post_instantiate = self.post_instantiate(), start = if needs_manual_start { "wasm.__wbindgen_start();" } else { @@ -1065,7 +1112,7 @@ impl<'a> Context<'a> { let mem = self.expose_uint8_memory(memory); let ret = MemView { - name: "passStringToWasm", + name: "passStringToWasm".into(), num: mem.num, }; if !self.should_write_global(ret.to_string()) { @@ -1230,7 +1277,7 @@ impl<'a> Context<'a> { fn expose_pass_array_jsvalue_to_wasm(&mut self, memory: MemoryId) -> Result { let mem = self.expose_uint32_memory(memory); let ret = MemView { - name: "passArrayJsValueToWasm", + name: "passArrayJsValueToWasm".into(), num: mem.num, }; if !self.should_write_global(ret.to_string()) { @@ -1285,7 +1332,7 @@ impl<'a> Context<'a> { size: usize, ) -> Result { let ret = MemView { - name, + name: name.into(), num: view.num, }; if !self.should_write_global(ret.to_string()) { @@ -1370,7 +1417,7 @@ impl<'a> Context<'a> { self.expose_text_decoder()?; let mem = self.expose_uint8_memory(memory); let ret = MemView { - name: "getStringFromWasm", + name: "getStringFromWasm".into(), num: mem.num, }; @@ -1413,7 +1460,7 @@ impl<'a> Context<'a> { }; let get_string = self.expose_get_string_from_wasm(memory)?; let ret = MemView { - name: "getCachedStringFromWasm", + name: "getCachedStringFromWasm".into(), num: get_string.num, }; @@ -1449,7 +1496,7 @@ impl<'a> Context<'a> { fn expose_get_array_js_value_from_wasm(&mut self, memory: MemoryId) -> Result { let mem = self.expose_uint32_memory(memory); let ret = MemView { - name: "getArrayJsValueFromWasm", + name: "getArrayJsValueFromWasm".into(), num: mem.num, }; if !self.should_write_global(ret.to_string()) { @@ -1553,7 +1600,7 @@ impl<'a> Context<'a> { fn arrayget(&mut self, name: &'static str, view: MemView, size: usize) -> MemView { let ret = MemView { - name, + name: name.into(), num: view.num, }; if !self.should_write_global(name) { @@ -1573,47 +1620,47 @@ impl<'a> Context<'a> { } fn expose_int8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getInt8Memory", "new Int8Array", memory) + self.memview("Int8", memory) } fn expose_uint8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getUint8Memory", "new Uint8Array", memory) + self.memview("Uint8", memory) } fn expose_clamped_uint8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getUint8ClampedMemory", "new Uint8ClampedArray", memory) + self.memview("Uint8Clamped", memory) } fn expose_int16_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getInt16Memory", "new Int16Array", memory) + self.memview("Int16", memory) } fn expose_uint16_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getUint16Memory", "new Uint16Array", memory) + self.memview("Uint16", memory) } fn expose_int32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getInt32Memory", "new Int32Array", memory) + self.memview("Int32", memory) } fn expose_uint32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getUint32Memory", "new Uint32Array", memory) + self.memview("Uint32", memory) } fn expose_int64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getInt64Memory", "new BigInt64Array", memory) + self.memview("BigInt64", memory) } fn expose_uint64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getUint64Memory", "new BigUint64Array", memory) + self.memview("BigUint64", memory) } fn expose_f32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getFloat32Memory", "new Float32Array", memory) + self.memview("Float32", memory) } fn expose_f64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("getFloat64Memory", "new Float64Array", memory) + self.memview("Float64", memory) } fn memview_function(&mut self, t: VectorKind, memory: MemoryId) -> MemView { @@ -1635,39 +1682,52 @@ impl<'a> Context<'a> { } } - fn memview(&mut self, name: &'static str, js: &str, memory: walrus::MemoryId) -> MemView { - let view = self.memview_memory(name, memory); - if !self.should_write_global(name.to_string()) { + fn memview(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView { + let view = self.memview_memory(kind, memory); + if !self.should_write_global(view.name.clone()) { return view; } let mem = self.export_name_of(memory); + // When a buffer becomes detached, its length returns 0, + // which is why we check against that. self.global(&format!( " - let cache{name} = null; + let {cache}; function {name}() {{ - if (cache{name} === null || cache{name}.buffer !== wasm.{mem}.buffer) {{ - cache{name} = {js}(wasm.{mem}.buffer); + if ({cache}.byteLength === 0) {{ + {cache} = new {kind}Array(wasm.{mem}.buffer); }} - return cache{name}; + return {cache}; }} ", name = view, - js = js, + cache = format_args!("cached{}Memory{}", kind, view.num), + kind = kind, mem = mem, )); return view; } - fn memview_memory(&mut self, name: &'static str, memory: walrus::MemoryId) -> MemView { - let next = self.memory_indices.len(); - let num = *self.memory_indices.entry(memory).or_insert(next); - MemView { name, num } + fn memview_memory(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView { + let next = self.memories.len(); + let &mut (num, ref mut kinds) = self + .memories + .entry(memory) + .or_insert((next, Default::default())); + kinds.insert(kind); + MemView { + name: format!("get{}Memory", kind).into(), + num, + } } fn memview_table(&mut self, name: &'static str, table: walrus::TableId) -> MemView { let next = self.table_indices.len(); let num = *self.table_indices.entry(table).or_insert(next); - MemView { name, num } + MemView { + name: name.into(), + num, + } } fn expose_assert_class(&mut self) { @@ -3766,7 +3826,7 @@ impl ExportedClass { } struct MemView { - name: &'static str, + name: Cow<'static, str>, num: usize, } diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index 9e9399802f6..c4eb9714c06 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -6,12 +6,12 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachegetUint8Memory0 = null; +let cachedUint8Memory0; function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); + if (cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory0; + return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { @@ -33,12 +33,12 @@ function handleError(f, args) { } } -let cachegetInt32Memory0 = null; +let cachedInt32Memory0; function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); + if (cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } - return cachegetInt32Memory0; + return cachedInt32Memory0; } function takeFromExternrefTable0(idx) { @@ -81,3 +81,6 @@ export function __wbindgen_init_externref_table() { ; }; +cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); +cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index adaf3c2ae34..d7a7bf837f3 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -23,12 +23,12 @@ function handleError(f, args) { } } -let cachegetInt32Memory0 = null; +let cachedInt32Memory0; function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); + if (cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } - return cachegetInt32Memory0; + return cachedInt32Memory0; } function getObject(idx) { return heap[idx]; } @@ -64,3 +64,5 @@ export function __wbg_foo_8d66ddef0ff279d6() { return handleError(function () { foo(); }, arguments) }; +cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); + diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 02f56599e24..708880bb8b8 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -15,12 +15,12 @@ function addHeapObject(obj) { return idx; } -let cachegetInt32Memory0 = null; +let cachedInt32Memory0; function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); + if (cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } - return cachegetInt32Memory0; + return cachedInt32Memory0; } function getObject(idx) { return heap[idx]; } @@ -43,12 +43,12 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachegetUint8Memory0 = null; +let cachedUint8Memory0; function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); + if (cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory0; + return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { @@ -83,3 +83,6 @@ export function __wbindgen_number_new(arg0) { return addHeapObject(ret); }; +cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); +cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index e4b98fad136..9c93a69b759 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -6,12 +6,12 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachegetUint8Memory0 = null; +let cachedUint8Memory0; function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); + if (cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory0; + return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { @@ -87,3 +87,5 @@ export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + From 152816c10181e9f35eeaa6c90eac86419c4c6523 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 10 May 2022 00:17:13 +1000 Subject: [PATCH 007/641] Make `Closure::new` work on stable (#2891) * Make `Closure::new` work on stable I've removed the nightly requirement by replacing `Unsize` with a custom `IntoWasmClosure` trait, implemented for `Fn` and `FnMut`. I don't think this is a breaking change, since I don't think any stability guarantees are provided for nightly. * Update docs I also removed an outdated note about closures only being able to take WASM primitive types. * Remove nightly CI * Don't attempt to enable the removed nightly feature in doc generation --- .github/workflows/main.yml | 14 +------- Cargo.toml | 1 - src/closure.rs | 67 +++++++++++++++++++++++--------------- src/lib.rs | 1 - tests/wasm/closures.rs | 2 -- tests/wasm/imports.rs | 3 -- 6 files changed, 42 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 91718ba9d25..92e5a9c5b2c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,18 +91,6 @@ jobs: # WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 # - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features "Node Window Document" - test_wasm_bindgen_nightly: - name: "Run wasm-bindgen crate tests (nightly)" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: rustup default nightly-2021-09-02 - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 - with: - node-version: '16' - - run: cargo test --target wasm32-unknown-unknown --features nightly --test wasm - test_native: name: Run native tests runs-on: ubuntu-latest @@ -330,7 +318,7 @@ jobs: steps: - uses: actions/checkout@v2 - run: rustup update nightly && rustup default nightly - - run: cargo doc --no-deps --features 'nightly serde-serialize' + - run: cargo doc --no-deps --features 'serde-serialize' - run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml - run: cargo doc --no-deps --manifest-path crates/web-sys/Cargo.toml --all-features env: diff --git a/Cargo.toml b/Cargo.toml index d6523f44f1f..b77314cebb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ default = ["spans", "std"] spans = ["wasm-bindgen-macro/spans"] std = [] serde-serialize = ["serde", "serde_json", "std"] -nightly = [] enable-interning = ["std"] # Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on diff --git a/src/closure.rs b/src/closure.rs index 320b2ad97ef..00db2ee5e97 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -5,8 +5,6 @@ //! type itself. use std::fmt; -#[cfg(feature = "nightly")] -use std::marker::Unsize; use std::mem::{self, ManuallyDrop}; use std::prelude::v1::*; @@ -31,9 +29,7 @@ use crate::UnwrapThrowExt; /// /// The type parameter on `Closure` is the type of closure that this represents. /// Currently this can only be the `Fn` and `FnMut` traits with up to 7 -/// arguments (and an optional return value). The arguments/return value of the -/// trait must be numbers like `u32` for now, although this restriction may be -/// lifted in the future! +/// arguments (and an optional return value). /// /// # Examples /// @@ -71,9 +67,9 @@ use crate::UnwrapThrowExt; /// pub fn run() -> IntervalHandle { /// // First up we use `Closure::wrap` to wrap up a Rust closure and create /// // a JS closure. -/// let cb = Closure::wrap(Box::new(|| { +/// let cb = Closure::new(|| { /// log("interval elapsed!"); -/// }) as Box); +/// }); /// /// // Next we pass this via reference to the `setInterval` function, and /// // `setInterval` gets a handle to the corresponding JS closure. @@ -113,9 +109,9 @@ use crate::UnwrapThrowExt; /// /// #[wasm_bindgen] /// pub fn run() -> Result { -/// let cb = Closure::wrap(Box::new(|| { +/// let cb = Closure::new(|| { /// web_sys::console::log_1(&"interval elapsed!".into()); -/// }) as Box); +/// }); /// /// let window = web_sys::window().unwrap(); /// let interval_id = window.set_interval_with_callback_and_timeout_and_arguments_0( @@ -254,24 +250,9 @@ impl Closure where T: ?Sized + WasmClosure, { - /// A more ergonomic version of `Closure::wrap` that does the boxing and - /// cast to trait object for you. + /// Creates a new instance of `Closure` from the provided Rust function. /// - /// *This method requires the `nightly` feature of the `wasm-bindgen` crate - /// to be enabled, meaning this is a nightly-only API. Users on stable - /// should use `Closure::wrap`.* - #[cfg(feature = "nightly")] - pub fn new(t: F) -> Closure - where - F: Unsize + 'static, - { - Closure::wrap(Box::new(t) as Box) - } - - /// Creates a new instance of `Closure` from the provided boxed Rust - /// function. - /// - /// Note that the closure provided here, `Box`, has a few requirements + /// Note that the closure provided here, `F`, has a few requirements /// associated with it: /// /// * It must implement `Fn` or `FnMut` (for `FnOnce` functions see @@ -285,6 +266,15 @@ where /// * Its arguments and return values are all types that can be shared with /// JS (i.e. have `#[wasm_bindgen]` annotations or are simple numbers, /// etc.) + pub fn new(t: F) -> Closure + where + F: IntoWasmClosure + 'static, + { + Closure::wrap(Box::new(t).unsize()) + } + + /// A more direct version of `Closure::new` which creates a `Closure` from + /// a `Box`/`Box`, which is how it's kept internally. pub fn wrap(mut data: Box) -> Closure { assert_eq!(mem::size_of::<*const T>(), mem::size_of::>()); let (a, b) = unsafe { @@ -543,6 +533,15 @@ pub unsafe trait WasmClosure { fn describe(); } +/// An internal trait for the `Closure` type. +/// +/// This trait is not stable and it's not recommended to use this in bounds or +/// implement yourself. +#[doc(hidden)] +pub trait IntoWasmClosure { + fn unsize(self: Box) -> Box; +} + // The memory safety here in these implementations below is a bit tricky. We // want to be able to drop the `Closure` object from within the invocation of a // `Closure` for cases like promises. That means that while it's running we @@ -711,6 +710,22 @@ macro_rules! doit { js_val } } + + impl IntoWasmClosure R> for T + where T: 'static + FnMut($($var),*) -> R, + $($var: FromWasmAbi + 'static,)* + R: ReturnWasmAbi + 'static, + { + fn unsize(self: Box) -> Box R> { self } + } + + impl IntoWasmClosure R> for T + where T: 'static + Fn($($var),*) -> R, + $($var: FromWasmAbi + 'static,)* + R: ReturnWasmAbi + 'static, + { + fn unsize(self: Box) -> Box R> { self } + } )*) } diff --git a/src/lib.rs b/src/lib.rs index d4c73b6a253..a80b26d9f5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,6 @@ #![no_std] #![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] -#![cfg_attr(feature = "nightly", feature(unsize))] use core::convert::TryFrom; use core::fmt; diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index ca5cd729055..dc88b43ad59 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "nightly")] - use js_sys::Number; use std::cell::{Cell, RefCell}; use std::rc::Rc; diff --git a/tests/wasm/imports.rs b/tests/wasm/imports.rs index 5bdf77f601f..88dbf5ed674 100644 --- a/tests/wasm/imports.rs +++ b/tests/wasm/imports.rs @@ -224,7 +224,6 @@ fn dead_imports_not_generated() { } #[wasm_bindgen_test] -#[cfg(feature = "nightly")] fn import_inside_function_works() { #[wasm_bindgen(module = "tests/wasm/imports.js")] extern "C" { @@ -234,12 +233,10 @@ fn import_inside_function_works() { } #[wasm_bindgen_test] -#[cfg(feature = "nightly")] fn private_module_imports_work() { private::foo(); } -#[cfg(feature = "nightly")] mod private { use wasm_bindgen::prelude::*; From 820c5f1d6b4c2d71ce98e8a332a238399a2f5ffa Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 10 May 2022 00:19:51 +1000 Subject: [PATCH 008/641] Fix some broken tests in `js-sys` (#2888) * Fix some broken tests in `js-sys` The first one created a date in UTC and then assumed that would be the same in the local time zone (as returned by `Date.prototype.toDateString`), which isn't always the case. The second was calling `WebAssembly.instantiateStreaming` with a `Promise`, when it expects a `Response` or `Promise`; my guess as to why this wasn't failing in CI is that browsers only started enforcing it recently, and the one being used by CI doesn't. * Move the `WebAssembly.instantiateStreaming` test to `web-sys` --- crates/js-sys/Cargo.toml | 1 + crates/js-sys/tests/wasm/Date.rs | 7 ++++++- crates/js-sys/tests/wasm/WebAssembly.rs | 12 +---------- crates/web-sys/tests/wasm/response.js | 10 +++++++++ crates/web-sys/tests/wasm/response.rs | 27 +++++++++++++++++++++++-- 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index e5165da6853..10af5f0aa95 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -24,3 +24,4 @@ wasm-bindgen = { path = "../..", version = "0.2.80" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = { path = '../test', version = '=0.3.30' } wasm-bindgen-futures = { path = '../futures', version = '0.4.30' } +web-sys = { path = "../web-sys", version = "0.3.57", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/js-sys/tests/wasm/Date.rs b/crates/js-sys/tests/wasm/Date.rs index 712862ed72a..484498d4739 100644 --- a/crates/js-sys/tests/wasm/Date.rs +++ b/crates/js-sys/tests/wasm/Date.rs @@ -441,7 +441,12 @@ fn set_utc_seconds() { #[wasm_bindgen_test] fn to_date_string() { - let date = Date::new(&"05 October 2011 14:48 UTC".into()); + // Create the date from date components rather than a string because this + // constructor interprets it as a date in the local time zone, which is how + // `toDateString` outputs it. This makes sure that this test will work in any + // time zone. + // October is 9 rather than 10 because the months count from 0. + let date = Date::new_with_year_month_day_hr_min(2011, 9, 5, 14, 48); assert_eq!(JsValue::from(date.to_date_string()), "Wed Oct 05 2011"); } diff --git a/crates/js-sys/tests/wasm/WebAssembly.rs b/crates/js-sys/tests/wasm/WebAssembly.rs index 7a06e256a2c..8f9a5b6328a 100644 --- a/crates/js-sys/tests/wasm/WebAssembly.rs +++ b/crates/js-sys/tests/wasm/WebAssembly.rs @@ -2,6 +2,7 @@ use js_sys::*; use wasm_bindgen::{prelude::*, JsCast}; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; +use web_sys::{Headers, Response, ResponseInit}; #[wasm_bindgen(module = "tests/wasm/WebAssembly.js")] extern "C" { @@ -183,17 +184,6 @@ async fn instantiate_module() { assert!(inst.is_instance_of::()); } -#[wasm_bindgen_test] -async fn instantiate_streaming() { - let response = Promise::resolve(&get_valid_wasm()); - let imports = get_imports(); - let p = WebAssembly::instantiate_streaming(&response, &imports); - let obj = JsFuture::from(p).await.unwrap(); - assert!(Reflect::get(obj.as_ref(), &"instance".into()) - .unwrap() - .is_instance_of::()); -} - #[wasm_bindgen_test] fn memory_works() { let obj = Object::new(); diff --git a/crates/web-sys/tests/wasm/response.js b/crates/web-sys/tests/wasm/response.js index 3dc3e1dc79d..0d2e68647ad 100644 --- a/crates/web-sys/tests/wasm/response.js +++ b/crates/web-sys/tests/wasm/response.js @@ -1,3 +1,13 @@ export function new_response() { return new Response(null, {status: 501}); } + +export function get_wasm_imports() { + return { + imports: { + imported_func: function () { + return 1; + } + } + }; +} diff --git a/crates/web-sys/tests/wasm/response.rs b/crates/web-sys/tests/wasm/response.rs index 0bbaa50122b..1bedb6221fb 100644 --- a/crates/web-sys/tests/wasm/response.rs +++ b/crates/web-sys/tests/wasm/response.rs @@ -1,13 +1,14 @@ -use js_sys::{ArrayBuffer, DataView}; +use js_sys::{ArrayBuffer, DataView, Object, Promise, Reflect, WebAssembly}; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; -use web_sys::Response; +use web_sys::{Headers, Response, ResponseInit}; #[wasm_bindgen(module = "/tests/wasm/response.js")] extern "C" { fn new_response() -> Response; + fn get_wasm_imports() -> Object; } #[wasm_bindgen_test] @@ -44,3 +45,25 @@ async fn test_response_from_other_body() { let output = JsFuture::from(response_b.text().unwrap()).await.unwrap(); assert_eq!(JsValue::from_str(input), output); } + +// Because it relies on `Response`, this can't go in `js-sys`, so put it here instead. +#[wasm_bindgen_test] +async fn wasm_instantiate_streaming() { + // Taken from `crates/js-sys/tests/wasm/WebAssembly.js`. + let mut wasm = *b"\x00asm\x01\x00\x00\x00\x01\x08\x02`\x01\x7f\x00`\x00\x00\x02\x19\x01\x07imports\rimported_func\x00\x00\x03\x02\x01\x01\x07\x11\x01\rexported_func\x00\x01\n\x08\x01\x06\x00A*\x10\x00\x0b"; + + let headers = Headers::new().unwrap(); + headers.append("Content-Type", "application/wasm").unwrap(); + let response = Response::new_with_opt_u8_array_and_init( + Some(&mut wasm), + ResponseInit::new().headers(&headers), + ) + .unwrap(); + let response = Promise::resolve(&response); + let imports = get_wasm_imports(); + let p = WebAssembly::instantiate_streaming(&response, &imports); + let obj = JsFuture::from(p).await.unwrap(); + assert!(Reflect::get(obj.as_ref(), &"instance".into()) + .unwrap() + .is_instance_of::()); +} From 60cbce5e506c4a1d160b00bfa45a0f14c67813b6 Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Date: Mon, 9 May 2022 23:24:44 +0500 Subject: [PATCH 009/641] Respect wasm file placed in a temp path by rustdoc (#2881) * Respect wasm file placed in a temp path by rustdoc * fmt --- .../src/bin/wasm-bindgen-test-runner/main.rs | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 95a82601702..e802ef8d265 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -47,14 +47,25 @@ fn main() -> anyhow::Result<()> { None => bail!("must have a file to test as first argument"), }; - // Assume a cargo-like directory layout and generate output at - // `target/wasm32-unknown-unknown/wbg-tmp/...` - let tmpdir = wasm_file_to_test - .parent() // chop off file name - .and_then(|p| p.parent()) // chop off `deps` - .and_then(|p| p.parent()) // chop off `debug` - .map(|p| p.join("wbg-tmp")) - .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; + // wasm_file_to_test may be + // - a cargo-like directory layout and generate output at + // `target/wasm32-unknown-unknown/...` + // - a tmp directory, generated by rustdoc + // we would like a directory we have write access to. if we assume cargo-like directories, + // we end up with the path `/wbg-out` + let tmpdir = if wasm_file_to_test + .to_string_lossy() + .starts_with("/tmp/rustdoc") + { + wasm_file_to_test.parent() // chop off the file name and give us the /tmp/rustdoc directory + } else { + wasm_file_to_test + .parent() // chop off file name + .and_then(|p| dbg!(p.parent())) // chop off `deps` + .and_then(|p| dbg!(p.parent())) // chop off `debug` + } + .map(|p| p.join("wbg-tmp")) + .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; // Make sure there's no stale state from before drop(fs::remove_dir_all(&tmpdir)); From 9758e4634e607743cc1952e7ecc84c1b75a27c57 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 18 May 2022 13:18:01 +0200 Subject: [PATCH 010/641] doc(jsvalue) Fix documentation of the `in` operator. (#2897) --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a80b26d9f5e..836c1678d8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -351,7 +351,7 @@ impl JsValue { /// Applies the binary `in` JS operator on the two `JsValue`s. /// - /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) #[inline] pub fn js_in(&self, obj: &JsValue) -> bool { unsafe { __wbindgen_in(self.idx, obj.idx) == 1 } From bea87f04def0c439827481ecb90cf27aebcdbf30 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 19 May 2022 00:50:58 +1000 Subject: [PATCH 011/641] Fix memory getter checks when using shared memory (#2899) * Fix memory getter check for shared memory * Run tests with multithreading enabled in CI --- .github/workflows/main.yml | 12 ++++++++++++ crates/cli-support/src/js/mod.rs | 25 +++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92e5a9c5b2c..5ee54dbc5bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,6 +67,18 @@ jobs: WASM_BINDGEN_EXTERNREF: 1 NODE_ARGS: --experimental-wasm-reftypes + test_threads: + name: "Run wasm-bindgen crate tests with multithreading enabled" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup default nightly-2021-09-02 + - run: rustup target add wasm32-unknown-unknown + - run: rustup component add rust-src + # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. + - run: | + RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ + cargo test --target wasm32-unknown-unknown --test headless -Z build-std=std,panic_abort # I don't know why this is failing so comment this out for now, but ideally # this would be figured out at some point and solved. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 55d57311c32..d0ae901a98d 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1688,20 +1688,37 @@ impl<'a> Context<'a> { return view; } let mem = self.export_name_of(memory); - // When a buffer becomes detached, its length returns 0, - // which is why we check against that. + + let cache = format!("cached{}Memory{}", kind, view.num); + let resized_check = if self.module.memories.get(memory).shared { + // When it's backed by a `SharedArrayBuffer`, growing the wasm module's memory + // doesn't detach old references; instead, it just leaves them pointing to a + // slice of the up-to-date memory. So in order to check if it's been grown, we + // have to compare it to the up-to-date buffer. + format!( + "{cache}.buffer !== wasm.{mem}.buffer", + cache = cache, + mem = mem + ) + } else { + // Otherwise, we can do a quicker check of whether the buffer's been detached, + // which is indicated by a length of 0. + format!("{cache}.byteLength === 0", cache = cache) + }; + self.global(&format!( " let {cache}; function {name}() {{ - if ({cache}.byteLength === 0) {{ + if ({resized_check}) {{ {cache} = new {kind}Array(wasm.{mem}.buffer); }} return {cache}; }} ", name = view, - cache = format_args!("cached{}Memory{}", kind, view.num), + cache = cache, + resized_check = resized_check, kind = kind, mem = mem, )); From 63872ee3514fa656f167e2d0a716501ecc299218 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 20 May 2022 19:07:49 +0200 Subject: [PATCH 012/641] Generate bindings for the OVR_multiview2 webgl extension (#2903) --- crates/web-sys/Cargo.toml | 3 +- .../web-sys/src/features/gen_OvrMultiview2.rs | 48 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 6 +++ .../webidls/enabled/OVRMultiview2.webidl | 13 +++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 crates/web-sys/src/features/gen_OvrMultiview2.rs create mode 100644 crates/web-sys/webidls/enabled/OVRMultiview2.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 9dc2ac1045b..b5434ede8d4 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -776,7 +776,7 @@ MediaStreamEventInit = [] MediaStreamTrack = ["EventTarget"] MediaStreamTrackEvent = ["Event"] MediaStreamTrackEventInit = [] -MediaStreamTrackGenerator = [] +MediaStreamTrackGenerator = ["EventTarget", "MediaStreamTrack"] MediaStreamTrackGeneratorInit = [] MediaStreamTrackProcessor = [] MediaStreamTrackProcessorInit = [] @@ -856,6 +856,7 @@ OscillatorNode = ["AudioNode", "AudioScheduledSourceNode", "EventTarget"] OscillatorOptions = [] OscillatorType = [] OverSampleType = [] +OvrMultiview2 = [] PageTransitionEvent = ["Event"] PageTransitionEventInit = [] PaintRequest = [] diff --git a/crates/web-sys/src/features/gen_OvrMultiview2.rs b/crates/web-sys/src/features/gen_OvrMultiview2.rs new file mode 100644 index 00000000000..5015902f05a --- /dev/null +++ b/crates/web-sys/src/features/gen_OvrMultiview2.rs @@ -0,0 +1,48 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = OVR_multiview2 , typescript_type = "OVR_multiview2")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `OvrMultiview2` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OVR_multiview2)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`*"] + pub type OvrMultiview2; + #[cfg(feature = "WebGlTexture")] + # [wasm_bindgen (method , structural , js_class = "OVR_multiview2" , js_name = framebufferTextureMultiviewOVR)] + #[doc = "The `framebufferTextureMultiviewOVR()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OVR_multiview2/framebufferTextureMultiviewOVR)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`, `WebGlTexture`*"] + pub fn framebuffer_texture_multiview_ovr( + this: &OvrMultiview2, + target: u32, + attachment: u32, + texture: Option<&WebGlTexture>, + level: i32, + base_view_index: i32, + num_views: i32, + ); +} +impl OvrMultiview2 { + #[doc = "The `OVR_multiview2.FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`*"] + pub const FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR: u32 = 38448u64 as u32; + #[doc = "The `OVR_multiview2.FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`*"] + pub const FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR: u32 = 38450u64 as u32; + #[doc = "The `OVR_multiview2.MAX_VIEWS_OVR` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`*"] + pub const MAX_VIEWS_OVR: u32 = 38449u64 as u32; + #[doc = "The `OVR_multiview2.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OvrMultiview2`*"] + pub const FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: u32 = 38451u64 as u32; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 531e7f0c281..b69a1e0b49f 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4954,6 +4954,12 @@ mod gen_OverSampleType; #[cfg(feature = "OverSampleType")] pub use gen_OverSampleType::*; +#[cfg(feature = "OvrMultiview2")] +#[allow(non_snake_case)] +mod gen_OvrMultiview2; +#[cfg(feature = "OvrMultiview2")] +pub use gen_OvrMultiview2::*; + #[cfg(feature = "PageTransitionEvent")] #[allow(non_snake_case)] mod gen_PageTransitionEvent; diff --git a/crates/web-sys/webidls/enabled/OVRMultiview2.webidl b/crates/web-sys/webidls/enabled/OVRMultiview2.webidl new file mode 100644 index 00000000000..106ffddd1e4 --- /dev/null +++ b/crates/web-sys/webidls/enabled/OVRMultiview2.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The source for this IDL is found at https://www.khronos.org/registry/webgl/extensions/OVR_multiview2/ + */ +[Exposed=(Window,Worker), LegacyNoInterfaceObject] +interface OVR_multiview2 { + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 0x9630; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 0x9632; + const GLenum MAX_VIEWS_OVR = 0x9631; + const GLenum FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 0x9633; + + undefined framebufferTextureMultiviewOVR(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, GLint baseViewIndex, GLsizei numViews); +}; From 73aaa809abc400ebf58a86490d79f6d42fbabc7f Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 23 May 2022 16:32:12 +0200 Subject: [PATCH 013/641] Namespace const (#2907) * Update weedle dependency to git dependency As discussed in https://github.com/rustwasm/weedle/pull/52#issuecomment-1133060090 * Change `StringType` to `RecordKeyType` In response to https://github.com/rustwasm/weedle/pull/50 * Accommodate constants in namespaces See https://github.com/rustwasm/weedle/pull/52 * Reformat with rust-fmt --- crates/webidl/Cargo.toml | 2 +- crates/webidl/src/first_pass.rs | 38 +++++-- crates/webidl/src/generator.rs | 186 ++++++++++++++++++-------------- crates/webidl/src/idl_type.rs | 9 +- crates/webidl/src/lib.rs | 51 +++++++-- crates/webidl/src/util.rs | 30 +++--- 6 files changed, 195 insertions(+), 121 deletions(-) diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 490bab63712..4da8b0d92b5 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -21,7 +21,7 @@ proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } wasm-bindgen-backend = { version = "=0.2.80", path = "../backend" } -weedle = "0.12" +weedle = { git = "https://github.com/rustwasm/weedle.git" } lazy_static = "1.0.2" sourcefile = "0.1" structopt = "0.3.9" diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index 6b22660644c..f683c7d9498 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -15,6 +15,7 @@ use weedle::argument::Argument; use weedle::attribute::*; use weedle::interface::*; use weedle::mixin::*; +use weedle::namespace::*; use weedle::CallbackInterfaceDefinition; use weedle::{DictionaryDefinition, PartialDictionaryDefinition}; @@ -80,6 +81,8 @@ pub(crate) struct MixinData<'src> { #[derive(Default)] pub(crate) struct NamespaceData<'src> { pub(crate) operations: BTreeMap, OperationData<'src>>, + pub(crate) consts: Vec<&'src ConstNamespaceMember<'src>>, + pub(crate) stability: ApiStability, } #[derive(Default)] @@ -173,8 +176,8 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::Definition<'src> { PartialInterface(interface) => interface.first_pass(record, stability), InterfaceMixin(mixin) => mixin.first_pass(record, stability), PartialInterfaceMixin(mixin) => mixin.first_pass(record, stability), - Namespace(namespace) => namespace.first_pass(record, ()), - PartialNamespace(namespace) => namespace.first_pass(record, ()), + Namespace(namespace) => namespace.first_pass(record, stability), + PartialNamespace(namespace) => namespace.first_pass(record, stability), Typedef(typedef) => typedef.first_pass(record, ()), Callback(callback) => callback.first_pass(record, ()), CallbackInterface(iface) => iface.first_pass(record, ()), @@ -750,13 +753,18 @@ impl<'src> FirstPass<'src, ()> for weedle::TypedefDefinition<'src> { } } -impl<'src> FirstPass<'src, ()> for weedle::NamespaceDefinition<'src> { - fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> { +impl<'src> FirstPass<'src, ApiStability> for weedle::NamespaceDefinition<'src> { + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + stability: ApiStability, + ) -> Result<()> { if util::is_chrome_only(&self.attributes) { return Ok(()); } - record.namespaces.entry(self.identifier.0).or_default(); + let namespace = record.namespaces.entry(self.identifier.0).or_default(); + namespace.stability = stability; for member in &self.members.body { member.first_pass(record, self.identifier.0)?; @@ -766,13 +774,18 @@ impl<'src> FirstPass<'src, ()> for weedle::NamespaceDefinition<'src> { } } -impl<'src> FirstPass<'src, ()> for weedle::PartialNamespaceDefinition<'src> { - fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> { +impl<'src> FirstPass<'src, ApiStability> for weedle::PartialNamespaceDefinition<'src> { + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + stability: ApiStability, + ) -> Result<()> { if util::is_chrome_only(&self.attributes) { return Ok(()); } - record.namespaces.entry(self.identifier.0).or_default(); + let namespace = record.namespaces.entry(self.identifier.0).or_default(); + namespace.stability = stability; for member in &self.members.body { member.first_pass(record, self.identifier.0)?; @@ -789,6 +802,15 @@ impl<'src> FirstPass<'src, &'src str> for weedle::namespace::NamespaceMember<'sr self_name: &'src str, ) -> Result<()> { match self { + weedle::namespace::NamespaceMember::Const(const_) => { + record + .namespaces + .get_mut(self_name) + .unwrap() + .consts + .push(const_); + Ok(()) + } weedle::namespace::NamespaceMember::Operation(op) => op.first_pass(record, self_name), _ => Ok(()), } diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index c172bb5cfaf..f5f10e0e022 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -138,6 +138,82 @@ impl Enum { } } +pub enum ConstValue { + BooleanLiteral(bool), + FloatLiteral(f64), + SignedIntegerLiteral(i64), + UnsignedIntegerLiteral(u64), +} + +impl ConstValue { + fn generate(&self) -> TokenStream { + use ConstValue::*; + + match self { + BooleanLiteral(false) => quote!(false), + BooleanLiteral(true) => quote!(true), + // the actual type is unknown because of typedefs + // so we cannot use std::fxx::INFINITY + // but we can use type inference + FloatLiteral(f) if f.is_infinite() && f.is_sign_positive() => quote!(1.0 / 0.0), + FloatLiteral(f) if f.is_infinite() && f.is_sign_negative() => quote!(-1.0 / 0.0), + FloatLiteral(f) if f.is_nan() => quote!(0.0 / 0.0), + // again no suffix + // panics on +-inf, nan + FloatLiteral(f) => { + let f = Literal::f64_suffixed(*f); + quote!(#f) + } + SignedIntegerLiteral(i) => { + let i = Literal::i64_suffixed(*i); + quote!(#i) + } + UnsignedIntegerLiteral(i) => { + let i = Literal::u64_suffixed(*i); + quote!(#i) + } + } + } +} + +pub struct Const { + pub name: Ident, + pub js_name: String, + pub ty: syn::Type, + pub value: ConstValue, + pub unstable: bool, +} + +impl Const { + fn generate( + &self, + options: &Options, + parent_name: &Ident, + parent_js_name: &str, + ) -> TokenStream { + let name = &self.name; + let ty = &self.ty; + let js_name = &self.js_name; + let value = self.value.generate(); + let unstable = self.unstable; + + let unstable_attr = maybe_unstable_attr(unstable); + let unstable_docs = maybe_unstable_docs(unstable); + + let doc_comment = comment( + format!("The `{}.{}` const.", parent_js_name, js_name), + &get_features_doc(options, parent_name.to_string()), + ); + + quote! { + #unstable_attr + #doc_comment + #unstable_docs + pub const #name: #ty = #value as #ty; + } + } +} + pub enum InterfaceAttributeKind { Getter, Setter, @@ -429,89 +505,13 @@ impl InterfaceMethod { } } -pub enum InterfaceConstValue { - BooleanLiteral(bool), - FloatLiteral(f64), - SignedIntegerLiteral(i64), - UnsignedIntegerLiteral(u64), -} - -impl InterfaceConstValue { - fn generate(&self) -> TokenStream { - use InterfaceConstValue::*; - - match self { - BooleanLiteral(false) => quote!(false), - BooleanLiteral(true) => quote!(true), - // the actual type is unknown because of typedefs - // so we cannot use std::fxx::INFINITY - // but we can use type inference - FloatLiteral(f) if f.is_infinite() && f.is_sign_positive() => quote!(1.0 / 0.0), - FloatLiteral(f) if f.is_infinite() && f.is_sign_negative() => quote!(-1.0 / 0.0), - FloatLiteral(f) if f.is_nan() => quote!(0.0 / 0.0), - // again no suffix - // panics on +-inf, nan - FloatLiteral(f) => { - let f = Literal::f64_suffixed(*f); - quote!(#f) - } - SignedIntegerLiteral(i) => { - let i = Literal::i64_suffixed(*i); - quote!(#i) - } - UnsignedIntegerLiteral(i) => { - let i = Literal::u64_suffixed(*i); - quote!(#i) - } - } - } -} - -pub struct InterfaceConst { - pub name: Ident, - pub js_name: String, - pub ty: syn::Type, - pub value: InterfaceConstValue, - pub unstable: bool, -} - -impl InterfaceConst { - fn generate( - &self, - options: &Options, - parent_name: &Ident, - parent_js_name: &str, - ) -> TokenStream { - let name = &self.name; - let ty = &self.ty; - let js_name = &self.js_name; - let value = self.value.generate(); - let unstable = self.unstable; - - let unstable_attr = maybe_unstable_attr(unstable); - let unstable_docs = maybe_unstable_docs(unstable); - - let doc_comment = comment( - format!("The `{}.{}` const.", parent_js_name, js_name), - &get_features_doc(options, parent_name.to_string()), - ); - - quote! { - #unstable_attr - #doc_comment - #unstable_docs - pub const #name: #ty = #value as #ty; - } - } -} - pub struct Interface { pub name: Ident, pub js_name: String, pub deprecated: Option, pub has_interface: bool, pub parents: Vec, - pub consts: Vec, + pub consts: Vec, pub attributes: Vec, pub methods: Vec, pub unstable: bool, @@ -883,7 +883,9 @@ impl Function { pub struct Namespace { pub name: Ident, pub js_name: String, + pub consts: Vec, pub functions: Vec, + pub unstable: bool, } impl Namespace { @@ -891,24 +893,46 @@ impl Namespace { let Namespace { name, js_name, + consts, functions, + unstable, } = self; + let unstable_attr = maybe_unstable_attr(*unstable); + let unstable_docs = maybe_unstable_docs(*unstable); + let functions = functions .into_iter() .map(|x| x.generate(options, &name, js_name.to_string())) .collect::>(); + let functions = if functions.is_empty() { + None + } else { + Some(quote! { + #[wasm_bindgen] + extern "C" { + #(#functions)* + } + }) + }; + + let consts = consts + .into_iter() + .map(|x| x.generate(options, &name, js_name)) + .collect::>(); + quote! { + #unstable_attr + #unstable_docs pub mod #name { #![allow(unused_imports)] use super::super::*; use wasm_bindgen::prelude::*; - #[wasm_bindgen] - extern "C" { - #(#functions)* - } + #(#consts)* + + #functions } } } diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 91ffb8907f1..02bc65e3e3f 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -263,12 +263,13 @@ impl<'a> ToIdlType<'a> for RecordType<'a> { } } -impl<'a> ToIdlType<'a> for StringType { +impl<'a> ToIdlType<'a> for RecordKeyType<'a> { fn to_idl_type(&self, record: &FirstPassRecord<'a>) -> IdlType<'a> { match self { - StringType::Byte(t) => t.to_idl_type(record), - StringType::DOM(t) => t.to_idl_type(record), - StringType::USV(t) => t.to_idl_type(record), + RecordKeyType::Byte(t) => t.to_idl_type(record), + RecordKeyType::DOM(t) => t.to_idl_type(record), + RecordKeyType::USV(t) => t.to_idl_type(record), + RecordKeyType::NonAny(t) => t.to_idl_type(record), } } } diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index edc46b26686..55df0e63bd2 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -19,8 +19,8 @@ mod util; use crate::first_pass::{CallbackInterfaceData, OperationData}; use crate::first_pass::{FirstPass, FirstPassRecord, InterfaceData, OperationId}; use crate::generator::{ - Dictionary, DictionaryField, Enum, EnumVariant, Function, Interface, InterfaceAttribute, - InterfaceAttributeKind, InterfaceConst, InterfaceMethod, Namespace, + Const, Dictionary, DictionaryField, Enum, EnumVariant, Function, Interface, InterfaceAttribute, + InterfaceAttributeKind, InterfaceMethod, Namespace, }; use crate::idl_type::ToIdlType; use crate::traverse::TraverseType; @@ -436,24 +436,55 @@ impl<'src> FirstPassRecord<'src> { js_name: String, ns: &'src first_pass::NamespaceData<'src>, ) { + let unstable = ns.stability.is_unstable(); + + let mut consts = vec![]; let mut functions = vec![]; + for member in ns.consts.iter() { + self.append_ns_const(&mut consts, member, unstable); + } + for (id, data) in ns.operations.iter() { - self.append_ns_member(&mut functions, &js_name, id, data); + self.append_ns_operation(&mut functions, &js_name, id, data); } - if !functions.is_empty() { + if !consts.is_empty() || !functions.is_empty() { Namespace { name, js_name, + consts, functions, + unstable, } .generate(options) .to_tokens(&mut program.tokens); } } - fn append_ns_member( + fn append_ns_const( + &self, + consts: &mut Vec, + member: &'src weedle::namespace::ConstNamespaceMember<'src>, + unstable: bool, + ) { + let idl_type = member.const_type.to_idl_type(self); + let ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); + + let js_name = member.identifier.0; + let name = rust_ident(shouty_snake_case_ident(js_name).as_str()); + let value = webidl_const_v_to_backend_const_v(&member.const_value); + + consts.push(Const { + name, + js_name: js_name.to_string(), + ty, + value, + unstable, + }); + } + + fn append_ns_operation( &self, functions: &mut Vec, js_name: &'src str, @@ -486,9 +517,9 @@ impl<'src> FirstPassRecord<'src> { } } - fn append_const( + fn append_interface_const( &self, - consts: &mut Vec, + consts: &mut Vec, member: &'src weedle::interface::ConstMember<'src>, unstable: bool, ) { @@ -499,7 +530,7 @@ impl<'src> FirstPassRecord<'src> { let name = rust_ident(shouty_snake_case_ident(js_name).as_str()); let value = webidl_const_v_to_backend_const_v(&member.const_value); - consts.push(InterfaceConst { + consts.push(Const { name, js_name: js_name.to_string(), ty, @@ -536,7 +567,7 @@ impl<'src> FirstPassRecord<'src> { let mut methods = vec![]; for member in data.consts.iter() { - self.append_const(&mut consts, member, unstable); + self.append_interface_const(&mut consts, member, unstable); } for member in data.attributes.iter() { @@ -560,7 +591,7 @@ impl<'src> FirstPassRecord<'src> { for mixin_data in self.all_mixins(&js_name) { for member in &mixin_data.consts { - self.append_const(&mut consts, member, unstable); + self.append_interface_const(&mut consts, member, unstable); } for member in &mixin_data.attributes { diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index c06a4eb8d0f..02e3bd00cae 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -12,12 +12,12 @@ use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; use weedle; use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList, IdentifierOrString}; use weedle::common::Identifier; -use weedle::literal::{ConstValue, FloatLit, IntegerLit}; +use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{NonAnyType, SingleType}; use crate::constants::IMMUTABLE_SLICE_WHITELIST; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; -use crate::generator::{InterfaceConstValue, InterfaceMethod, InterfaceMethodKind}; +use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; use crate::idl_type::{IdlType, ToIdlType}; use crate::Options; @@ -104,20 +104,16 @@ pub(crate) fn array(base_ty: &str, pos: TypePosition, immutable: bool) -> syn::T } /// Map a webidl const value to the correct wasm-bindgen const value -pub fn webidl_const_v_to_backend_const_v(v: &ConstValue) -> InterfaceConstValue { +pub fn webidl_const_v_to_backend_const_v(v: &ConstValueLit) -> ConstValue { use std::f64::{INFINITY, NAN, NEG_INFINITY}; match *v { - ConstValue::Boolean(b) => InterfaceConstValue::BooleanLiteral(b.0), - ConstValue::Float(FloatLit::NegInfinity(_)) => { - InterfaceConstValue::FloatLiteral(NEG_INFINITY) - } - ConstValue::Float(FloatLit::Infinity(_)) => InterfaceConstValue::FloatLiteral(INFINITY), - ConstValue::Float(FloatLit::NaN(_)) => InterfaceConstValue::FloatLiteral(NAN), - ConstValue::Float(FloatLit::Value(s)) => { - InterfaceConstValue::FloatLiteral(s.0.parse().unwrap()) - } - ConstValue::Integer(lit) => { + ConstValueLit::Boolean(b) => ConstValue::BooleanLiteral(b.0), + ConstValueLit::Float(FloatLit::NegInfinity(_)) => ConstValue::FloatLiteral(NEG_INFINITY), + ConstValueLit::Float(FloatLit::Infinity(_)) => ConstValue::FloatLiteral(INFINITY), + ConstValueLit::Float(FloatLit::NaN(_)) => ConstValue::FloatLiteral(NAN), + ConstValueLit::Float(FloatLit::Value(s)) => ConstValue::FloatLiteral(s.0.parse().unwrap()), + ConstValueLit::Integer(lit) => { let mklit = |orig_text: &str, base: u32, offset: usize| { let (negative, text) = if orig_text.starts_with("-") { (true, &orig_text[1..]) @@ -125,7 +121,7 @@ pub fn webidl_const_v_to_backend_const_v(v: &ConstValue) -> InterfaceConstValue (false, orig_text) }; if text == "0" { - return InterfaceConstValue::SignedIntegerLiteral(0); + return ConstValue::SignedIntegerLiteral(0); } let text = &text[offset..]; let n = u64::from_str_radix(text, base) @@ -136,9 +132,9 @@ pub fn webidl_const_v_to_backend_const_v(v: &ConstValue) -> InterfaceConstValue } else { n.wrapping_neg() as i64 }; - InterfaceConstValue::SignedIntegerLiteral(n) + ConstValue::SignedIntegerLiteral(n) } else { - InterfaceConstValue::UnsignedIntegerLiteral(n) + ConstValue::UnsignedIntegerLiteral(n) } }; match lit { @@ -147,7 +143,7 @@ pub fn webidl_const_v_to_backend_const_v(v: &ConstValue) -> InterfaceConstValue IntegerLit::Dec(h) => mklit(h.0, 10, 0), } } - ConstValue::Null(_) => unimplemented!(), + ConstValueLit::Null(_) => unimplemented!(), } } From 1f89ad3990bb17bf5a2fbf5502d151fc645344ba Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Mon, 23 May 2022 22:35:42 +0800 Subject: [PATCH 014/641] Add runner headless support for msedge. (#2905) --- .../bin/wasm-bindgen-test-runner/headless.rs | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 89b5252c1c1..9ae6a1b2f1f 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -193,6 +193,7 @@ enum Driver { Gecko(Locate), Safari(Locate), Chrome(Locate), + Edge(Locate), } enum Locate { @@ -225,6 +226,7 @@ impl Driver { ("geckodriver", Driver::Gecko as fn(Locate) -> Driver), ("safaridriver", Driver::Safari as fn(Locate) -> Driver), ("chromedriver", Driver::Chrome as fn(Locate) -> Driver), + ("msedgedriver", Driver::Edge as fn(Locate) -> Driver), ]; // First up, if env vars like GECKODRIVER_REMOTE are present, use those @@ -278,11 +280,12 @@ environment variables like `GECKODRIVER=/path/to/geckodriver` or make sure that the binary is in `PATH`; to configure the address of remote webdriver you can use environment variables like `GECKODRIVER_REMOTE=http://remote.host/` -This crate currently supports `geckodriver`, `chromedriver`, and `safaridriver`, -although more driver support may be added! You can download these at: +This crate currently supports `geckodriver`, `chromedriver`, `safaridriver`, and +`msedgedriver`, although more driver support may be added! You can download these at: * geckodriver - https://github.com/mozilla/geckodriver/releases - * chromedriver - http://chromedriver.chromium.org/downloads + * chromedriver - https://chromedriver.chromium.org/downloads + * msedgedriver - https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ * safaridriver - should be preinstalled on OSX If you would prefer to not use headless testing and would instead like to do @@ -301,6 +304,7 @@ an issue against rustwasm/wasm-bindgen! Driver::Gecko(_) => "Firefox", Driver::Safari(_) => "Safari", Driver::Chrome(_) => "Chrome", + Driver::Edge(_) => "Edge", } } @@ -309,6 +313,7 @@ an issue against rustwasm/wasm-bindgen! Driver::Gecko(locate) => locate, Driver::Safari(locate) => locate, Driver::Chrome(locate) => locate, + Driver::Edge(locate) => locate, } } } @@ -421,6 +426,35 @@ impl Client { let x: Response = self.post("/session", &request)?; Ok(x.session_id) } + Driver::Edge(_) => { + #[derive(Deserialize)] + struct Response { + #[serde(rename = "sessionId")] + session_id: String, + } + cap.entry("ms:edgeOptions".to_string()) + .or_insert_with(|| Json::Object(serde_json::Map::new())) + .as_object_mut() + .expect("ms:edgeOptions wasn't a JSON object") + .entry("args".to_string()) + .or_insert_with(|| Json::Array(vec![])) + .as_array_mut() + .expect("args wasn't a JSON array") + .extend(vec![ + Json::String("headless".to_string()), + // See https://stackoverflow.com/questions/50642308/ + // for what this funky `disable-dev-shm-usage` + // option is + Json::String("disable-dev-shm-usage".to_string()), + Json::String("no-sandbox".to_string()), + ]); + let request = LegacyNewSessionParameters { + desired: cap, + required: Capabilities::new(), + }; + let x: Response = self.post("/session", &request)?; + Ok(x.session_id) + } } } From 76b525716ee529013b5702d136fd6de7ade3818a Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 24 May 2022 21:54:02 +0200 Subject: [PATCH 015/641] Update the WebGPU IDL and regenerate web-sys (#2906) --- crates/web-sys/Cargo.toml | 24 +- crates/web-sys/src/features/gen_Gpu.rs | 12 + crates/web-sys/src/features/gen_GpuAdapter.rs | 8 +- ...tisticName.rs => gen_GpuAutoLayoutMode.rs} | 12 +- .../web-sys/src/features/gen_GpuBindGroup.rs | 4 +- .../src/features/gen_GpuBindGroupLayout.rs | 4 +- crates/web-sys/src/features/gen_GpuBuffer.rs | 4 +- .../features/gen_GpuCanvasConfiguration.rs | 16 +- .../src/features/gen_GpuCanvasContext.rs | 12 - .../src/features/gen_GpuCommandBuffer.rs | 15 +- .../src/features/gen_GpuCommandEncoder.rs | 174 +++++-- .../gen_GpuCommandEncoderDescriptor.rs | 21 - .../features/gen_GpuComputePassDescriptor.rs | 21 + .../src/features/gen_GpuComputePassEncoder.rs | 166 +++---- .../gen_GpuComputePassTimestampLocation.rs | 15 + .../gen_GpuComputePassTimestampWrite.rs | 103 +++++ .../src/features/gen_GpuComputePipeline.rs | 4 +- .../gen_GpuComputePipelineDescriptor.rs | 8 +- crates/web-sys/src/features/gen_GpuDevice.rs | 4 +- .../src/features/gen_GpuDeviceDescriptor.rs | 22 + .../{gen_GpuMapMode.rs => gen_GpuError.rs} | 31 +- .../src/features/gen_GpuExternalTexture.rs | 15 +- .../src/features/gen_GpuFeatureName.rs | 8 +- .../features/gen_GpuImageCopyExternalImage.rs | 17 + crates/web-sys/src/features/gen_GpuLoadOp.rs | 1 + .../src/features/gen_GpuMipmapFilterMode.rs | 15 + .../src/features/gen_GpuOutOfMemoryError.rs | 13 +- .../features/gen_GpuPipelineDescriptorBase.rs | 14 +- .../src/features/gen_GpuPipelineLayout.rs | 4 +- .../src/features/gen_GpuPrimitiveState.rs | 42 +- .../web-sys/src/features/gen_GpuQuerySet.rs | 4 +- .../src/features/gen_GpuQuerySetDescriptor.rs | 21 - .../web-sys/src/features/gen_GpuQueryType.rs | 1 - crates/web-sys/src/features/gen_GpuQueue.rs | 4 +- .../src/features/gen_GpuQueueDescriptor.rs | 53 +++ .../src/features/gen_GpuRenderBundle.rs | 4 +- .../features/gen_GpuRenderBundleEncoder.rs | 70 +-- .../gen_GpuRenderPassColorAttachment.rs | 41 +- ...gen_GpuRenderPassDepthStencilAttachment.rs | 72 ++- .../features/gen_GpuRenderPassDescriptor.rs | 21 + .../src/features/gen_GpuRenderPassEncoder.rs | 119 ++--- .../gen_GpuRenderPassTimestampLocation.rs | 15 + .../gen_GpuRenderPassTimestampWrite.rs | 103 +++++ .../src/features/gen_GpuRenderPipeline.rs | 4 +- .../gen_GpuRenderPipelineDescriptor.rs | 8 +- .../features/gen_GpuRequestAdapterOptions.rs | 6 +- crates/web-sys/src/features/gen_GpuSampler.rs | 4 +- .../src/features/gen_GpuSamplerDescriptor.rs | 6 +- .../src/features/gen_GpuShaderModule.rs | 4 +- .../gen_GpuShaderModuleCompilationHint.rs | 49 ++ crates/web-sys/src/features/gen_GpuTexture.rs | 4 +- .../src/features/gen_GpuTextureDescriptor.rs | 21 + .../src/features/gen_GpuTextureFormat.rs | 42 +- .../src/features/gen_GpuTextureView.rs | 4 +- .../features/gen_GpuUncapturedErrorEvent.rs | 5 +- .../gen_GpuUncapturedErrorEventInit.rs | 10 +- .../src/features/gen_GpuValidationError.rs | 24 +- ...BufferUsage.rs => gen_gpu_buffer_usage.rs} | 46 +- ...puColorWrite.rs => gen_gpu_color_write.rs} | 36 +- .../web-sys/src/features/gen_gpu_map_mode.rs | 25 + ...ShaderStage.rs => gen_gpu_shader_stage.rs} | 32 +- ...xtureUsage.rs => gen_gpu_texture_usage.rs} | 36 +- crates/web-sys/src/features/mod.rs | 116 +++-- crates/web-sys/webidls/unstable/WebGPU.webidl | 430 +++++++++++------- 64 files changed, 1442 insertions(+), 807 deletions(-) rename crates/web-sys/src/features/{gen_GpuPipelineStatisticName.rs => gen_GpuAutoLayoutMode.rs} (52%) create mode 100644 crates/web-sys/src/features/gen_GpuComputePassTimestampLocation.rs create mode 100644 crates/web-sys/src/features/gen_GpuComputePassTimestampWrite.rs rename crates/web-sys/src/features/{gen_GpuMapMode.rs => gen_GpuError.rs} (61%) create mode 100644 crates/web-sys/src/features/gen_GpuMipmapFilterMode.rs create mode 100644 crates/web-sys/src/features/gen_GpuQueueDescriptor.rs create mode 100644 crates/web-sys/src/features/gen_GpuRenderPassTimestampLocation.rs create mode 100644 crates/web-sys/src/features/gen_GpuRenderPassTimestampWrite.rs create mode 100644 crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs rename crates/web-sys/src/features/{gen_GpuBufferUsage.rs => gen_gpu_buffer_usage.rs} (79%) rename crates/web-sys/src/features/{gen_GpuColorWrite.rs => gen_gpu_color_write.rs} (68%) create mode 100644 crates/web-sys/src/features/gen_gpu_map_mode.rs rename crates/web-sys/src/features/{gen_GpuShaderStage.rs => gen_gpu_shader_stage.rs} (59%) rename crates/web-sys/src/features/{gen_GpuTextureUsage.rs => gen_gpu_texture_usage.rs} (69%) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b5434ede8d4..42ccfc8012d 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -426,6 +426,7 @@ GetUserMediaRequest = [] Gpu = [] GpuAdapter = [] GpuAddressMode = [] +GpuAutoLayoutMode = [] GpuBindGroup = [] GpuBindGroupDescriptor = [] GpuBindGroupEntry = [] @@ -441,13 +442,11 @@ GpuBufferBinding = [] GpuBufferBindingLayout = [] GpuBufferBindingType = [] GpuBufferDescriptor = [] -GpuBufferUsage = [] GpuCanvasCompositingAlphaMode = [] GpuCanvasConfiguration = [] GpuCanvasContext = [] GpuColorDict = [] GpuColorTargetState = [] -GpuColorWrite = [] GpuCommandBuffer = [] GpuCommandBufferDescriptor = [] GpuCommandEncoder = [] @@ -458,6 +457,8 @@ GpuCompilationMessage = [] GpuCompilationMessageType = [] GpuComputePassDescriptor = [] GpuComputePassEncoder = [] +GpuComputePassTimestampLocation = [] +GpuComputePassTimestampWrite = [] GpuComputePipeline = [] GpuComputePipelineDescriptor = [] GpuCullMode = [] @@ -466,6 +467,7 @@ GpuDevice = ["EventTarget"] GpuDeviceDescriptor = [] GpuDeviceLostInfo = [] GpuDeviceLostReason = [] +GpuError = [] GpuErrorFilter = [] GpuExtent3dDict = [] GpuExternalTexture = [] @@ -482,16 +484,15 @@ GpuImageCopyTextureTagged = [] GpuImageDataLayout = [] GpuIndexFormat = [] GpuLoadOp = [] -GpuMapMode = [] +GpuMipmapFilterMode = [] GpuMultisampleState = [] GpuObjectDescriptorBase = [] GpuOrigin2dDict = [] GpuOrigin3dDict = [] -GpuOutOfMemoryError = [] +GpuOutOfMemoryError = ["GpuError"] GpuPipelineDescriptorBase = [] GpuPipelineLayout = [] GpuPipelineLayoutDescriptor = [] -GpuPipelineStatisticName = [] GpuPowerPreference = [] GpuPredefinedColorSpace = [] GpuPrimitiveState = [] @@ -501,6 +502,7 @@ GpuQuerySet = [] GpuQuerySetDescriptor = [] GpuQueryType = [] GpuQueue = [] +GpuQueueDescriptor = [] GpuRenderBundle = [] GpuRenderBundleDescriptor = [] GpuRenderBundleEncoder = [] @@ -510,6 +512,8 @@ GpuRenderPassDepthStencilAttachment = [] GpuRenderPassDescriptor = [] GpuRenderPassEncoder = [] GpuRenderPassLayout = [] +GpuRenderPassTimestampLocation = [] +GpuRenderPassTimestampWrite = [] GpuRenderPipeline = [] GpuRenderPipelineDescriptor = [] GpuRequestAdapterOptions = [] @@ -518,8 +522,8 @@ GpuSamplerBindingLayout = [] GpuSamplerBindingType = [] GpuSamplerDescriptor = [] GpuShaderModule = [] +GpuShaderModuleCompilationHint = [] GpuShaderModuleDescriptor = [] -GpuShaderStage = [] GpuStencilFaceState = [] GpuStencilOperation = [] GpuStorageTextureAccess = [] @@ -534,13 +538,12 @@ GpuTextureDescriptor = [] GpuTextureDimension = [] GpuTextureFormat = [] GpuTextureSampleType = [] -GpuTextureUsage = [] GpuTextureView = [] GpuTextureViewDescriptor = [] GpuTextureViewDimension = [] GpuUncapturedErrorEvent = ["Event"] GpuUncapturedErrorEventInit = [] -GpuValidationError = [] +GpuValidationError = ["GpuError"] GpuVertexAttribute = [] GpuVertexBufferLayout = [] GpuVertexFormat = [] @@ -1503,3 +1506,8 @@ XrWebGlLayerInit = [] XsltProcessor = [] console = [] css = [] +gpu_buffer_usage = [] +gpu_color_write = [] +gpu_map_mode = [] +gpu_shader_stage = [] +gpu_texture_usage = [] diff --git a/crates/web-sys/src/features/gen_Gpu.rs b/crates/web-sys/src/features/gen_Gpu.rs index bb48e073bec..6515bdab3bc 100644 --- a/crates/web-sys/src/features/gen_Gpu.rs +++ b/crates/web-sys/src/features/gen_Gpu.rs @@ -16,6 +16,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type Gpu; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + # [wasm_bindgen (method , structural , js_class = "GPU" , js_name = getPreferredCanvasFormat)] + #[doc = "The `getPreferredCanvasFormat()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPU/getPreferredCanvasFormat)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gpu`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_preferred_canvas_format(this: &Gpu) -> GpuTextureFormat; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPU" , js_name = requestAdapter)] #[doc = "The `requestAdapter()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 2700e02b360..2595ed62b09 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -51,16 +51,16 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn limits(this: &GpuAdapter) -> GpuSupportedLimits; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isSoftware)] - #[doc = "Getter for the `isSoftware` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isFallbackAdapter)] + #[doc = "Getter for the `isFallbackAdapter` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/isSoftware)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/isFallbackAdapter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_software(this: &GpuAdapter) -> bool; + pub fn is_fallback_adapter(this: &GpuAdapter) -> bool; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] diff --git a/crates/web-sys/src/features/gen_GpuPipelineStatisticName.rs b/crates/web-sys/src/features/gen_GpuAutoLayoutMode.rs similarity index 52% rename from crates/web-sys/src/features/gen_GpuPipelineStatisticName.rs rename to crates/web-sys/src/features/gen_GpuAutoLayoutMode.rs index 17cf2c90ca2..95258c4bbcd 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineStatisticName.rs +++ b/crates/web-sys/src/features/gen_GpuAutoLayoutMode.rs @@ -2,17 +2,13 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] -#[doc = "The `GpuPipelineStatisticName` enum."] +#[doc = "The `GpuAutoLayoutMode` enum."] #[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `GpuPipelineStatisticName`*"] +#[doc = "*This API requires the following crate features to be activated: `GpuAutoLayoutMode`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum GpuPipelineStatisticName { - VertexShaderInvocations = "vertex-shader-invocations", - ClipperInvocations = "clipper-invocations", - ClipperPrimitivesOut = "clipper-primitives-out", - FragmentShaderInvocations = "fragment-shader-invocations", - ComputeShaderInvocations = "compute-shader-invocations", +pub enum GpuAutoLayoutMode { + Auto = "auto", } diff --git a/crates/web-sys/src/features/gen_GpuBindGroup.rs b/crates/web-sys/src/features/gen_GpuBindGroup.rs index e235001a313..1bef0471783 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroup.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroup.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBindGroup) -> Option; + pub fn label(this: &GpuBindGroup) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroup" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuBindGroup, value: Option<&str>); + pub fn set_label(this: &GpuBindGroup, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs index d60a2b399df..0e4604fb195 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBindGroupLayout) -> Option; + pub fn label(this: &GpuBindGroupLayout) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroupLayout" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuBindGroupLayout, value: Option<&str>); + pub fn set_label(this: &GpuBindGroupLayout, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index 046b43ff04f..f1cb9d73df9 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBuffer) -> Option; + pub fn label(this: &GpuBuffer) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBuffer" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuBuffer, value: Option<&str>); + pub fn set_label(this: &GpuBuffer, value: &str); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = destroy)] #[doc = "The `destroy()` method."] diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index ec51cbc692d..1a840a8a09f 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -113,15 +113,15 @@ impl GpuCanvasConfiguration { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `size` field of this object."] + #[doc = "Change the `usage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn size(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + pub fn usage(&mut self, val: u32) -> &mut Self { use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); debug_assert!( r.is_ok(), "setting properties should never fail on our dictionary objects" @@ -130,15 +130,19 @@ impl GpuCanvasConfiguration { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usage` field of this object."] + #[doc = "Change the `viewFormats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage(&mut self, val: u32) -> &mut Self { + pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("viewFormats"), + &JsValue::from(val), + ); debug_assert!( r.is_ok(), "setting properties should never fail on our dictionary objects" diff --git a/crates/web-sys/src/features/gen_GpuCanvasContext.rs b/crates/web-sys/src/features/gen_GpuCanvasContext.rs index 3fa41f7297b..797cfe0b2e7 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasContext.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasContext.rs @@ -51,18 +51,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_current_texture(this: &GpuCanvasContext) -> GpuTexture; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuAdapter", feature = "GpuTextureFormat",))] - # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getPreferredFormat)] - #[doc = "The `getPreferredFormat()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getPreferredFormat)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuCanvasContext`, `GpuTextureFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_preferred_format(this: &GpuCanvasContext, adapter: &GpuAdapter) -> GpuTextureFormat; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = unconfigure)] #[doc = "The `unconfigure()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCommandBuffer.rs b/crates/web-sys/src/features/gen_GpuCommandBuffer.rs index 5df42c67868..445d05b0e7c 100644 --- a/crates/web-sys/src/features/gen_GpuCommandBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuCommandBuffer.rs @@ -16,17 +16,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCommandBuffer; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUCommandBuffer" , js_name = executionTime)] - #[doc = "Getter for the `executionTime` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandBuffer/executionTime)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandBuffer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn execution_time(this: &GpuCommandBuffer) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUCommandBuffer" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] @@ -36,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuCommandBuffer) -> Option; + pub fn label(this: &GpuCommandBuffer) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUCommandBuffer" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -47,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuCommandBuffer, value: Option<&str>); + pub fn set_label(this: &GpuCommandBuffer, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index ac1e1b9959f..c4ae2dc744b 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuCommandEncoder) -> Option; + pub fn label(this: &GpuCommandEncoder) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUCommandEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuCommandEncoder, value: Option<&str>); + pub fn set_label(this: &GpuCommandEncoder, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuComputePassEncoder")] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = beginComputePass)] @@ -84,6 +84,110 @@ extern "C" { ) -> GpuRenderPassEncoder; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer(this: &GpuCommandEncoder, buffer: &GpuBuffer); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_u32(this: &GpuCommandEncoder, buffer: &GpuBuffer, offset: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_f64(this: &GpuCommandEncoder, buffer: &GpuBuffer, offset: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_u32_and_u32( + this: &GpuCommandEncoder, + buffer: &GpuBuffer, + offset: u32, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_f64_and_u32( + this: &GpuCommandEncoder, + buffer: &GpuBuffer, + offset: f64, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_u32_and_f64( + this: &GpuCommandEncoder, + buffer: &GpuBuffer, + offset: u32, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] + #[doc = "The `clearBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/clearBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_buffer_with_f64_and_f64( + this: &GpuCommandEncoder, + buffer: &GpuBuffer, + offset: f64, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] @@ -372,39 +476,6 @@ extern "C" { descriptor: &GpuCommandBufferDescriptor, ) -> GpuCommandBuffer; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = insertDebugMarker)] - #[doc = "The `insertDebugMarker()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/insertDebugMarker)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn insert_debug_marker(this: &GpuCommandEncoder, marker_label: &str); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = popDebugGroup)] - #[doc = "The `popDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/popDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn pop_debug_group(this: &GpuCommandEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = pushDebugGroup)] - #[doc = "The `pushDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/pushDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn push_debug_group(this: &GpuCommandEncoder, group_label: &str); - #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuBuffer", feature = "GpuQuerySet",))] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = resolveQuerySet)] #[doc = "The `resolveQuerySet()` method."] @@ -454,4 +525,37 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_timestamp(this: &GpuCommandEncoder, query_set: &GpuQuerySet, query_index: u32); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = insertDebugMarker)] + #[doc = "The `insertDebugMarker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/insertDebugMarker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn insert_debug_marker(this: &GpuCommandEncoder, marker_label: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = popDebugGroup)] + #[doc = "The `popDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/popDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn pop_debug_group(this: &GpuCommandEncoder); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = pushDebugGroup)] + #[doc = "The `pushDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/pushDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn push_debug_group(this: &GpuCommandEncoder, group_label: &str); } diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs index d2dc0af5067..2a858a294e8 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs @@ -44,27 +44,6 @@ impl GpuCommandEncoderDescriptor { let _ = r; self } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `measureExecutionTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoderDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn measure_execution_time(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("measureExecutionTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } } #[cfg(web_sys_unstable_apis)] impl Default for GpuCommandEncoderDescriptor { diff --git a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs index 9b1ccee18e3..b708dc67eff 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs @@ -44,6 +44,27 @@ impl GpuComputePassDescriptor { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp_writes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestampWrites"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } #[cfg(web_sys_unstable_apis)] impl Default for GpuComputePassDescriptor { diff --git a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs index 35ce98ae728..a4b9e292c1f 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuComputePassEncoder) -> Option; + pub fn label(this: &GpuComputePassEncoder) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUComputePassEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,110 +36,92 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuComputePassEncoder, value: Option<&str>); + pub fn set_label(this: &GpuComputePassEncoder, value: &str); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = beginPipelineStatisticsQuery)] - #[doc = "The `beginPipelineStatisticsQuery()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchWorkgroups)] + #[doc = "The `dispatchWorkgroups()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/beginPipelineStatisticsQuery)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`, `GpuQuerySet`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn begin_pipeline_statistics_query( - this: &GpuComputePassEncoder, - query_set: &GpuQuerySet, - query_index: u32, - ); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatch)] - #[doc = "The `dispatch()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatch)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchWorkgroups)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dispatch(this: &GpuComputePassEncoder, x: u32); + pub fn dispatch_workgroups(this: &GpuComputePassEncoder, workgroup_count_x: u32); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatch)] - #[doc = "The `dispatch()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchWorkgroups)] + #[doc = "The `dispatchWorkgroups()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatch)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchWorkgroups)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dispatch_with_y(this: &GpuComputePassEncoder, x: u32, y: u32); + pub fn dispatch_workgroups_with_workgroup_count_y( + this: &GpuComputePassEncoder, + workgroup_count_x: u32, + workgroup_count_y: u32, + ); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatch)] - #[doc = "The `dispatch()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchWorkgroups)] + #[doc = "The `dispatchWorkgroups()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatch)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchWorkgroups)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dispatch_with_y_and_z(this: &GpuComputePassEncoder, x: u32, y: u32, z: u32); + pub fn dispatch_workgroups_with_workgroup_count_y_and_workgroup_count_z( + this: &GpuComputePassEncoder, + workgroup_count_x: u32, + workgroup_count_y: u32, + workgroup_count_z: u32, + ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchIndirect)] - #[doc = "The `dispatchIndirect()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchWorkgroupsIndirect)] + #[doc = "The `dispatchWorkgroupsIndirect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchIndirect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchWorkgroupsIndirect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dispatch_indirect_with_u32( + pub fn dispatch_workgroups_indirect_with_u32( this: &GpuComputePassEncoder, indirect_buffer: &GpuBuffer, indirect_offset: u32, ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchIndirect)] - #[doc = "The `dispatchIndirect()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = dispatchWorkgroupsIndirect)] + #[doc = "The `dispatchWorkgroupsIndirect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchIndirect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/dispatchWorkgroupsIndirect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dispatch_indirect_with_f64( + pub fn dispatch_workgroups_indirect_with_f64( this: &GpuComputePassEncoder, indirect_buffer: &GpuBuffer, indirect_offset: f64, ); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = endPass)] - #[doc = "The `endPass()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = end)] + #[doc = "The `end()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/endPass)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/end)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn end_pass(this: &GpuComputePassEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = endPipelineStatisticsQuery)] - #[doc = "The `endPipelineStatisticsQuery()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/endPipelineStatisticsQuery)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn end_pipeline_statistics_query(this: &GpuComputePassEncoder); + pub fn end(this: &GpuComputePassEncoder); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuComputePipeline")] # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = setPipeline)] @@ -153,51 +135,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn set_pipeline(this: &GpuComputePassEncoder, pipeline: &GpuComputePipeline); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = writeTimestamp)] - #[doc = "The `writeTimestamp()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/writeTimestamp)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`, `GpuQuerySet`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_timestamp(this: &GpuComputePassEncoder, query_set: &GpuQuerySet, query_index: u32); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = insertDebugMarker)] - #[doc = "The `insertDebugMarker()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/insertDebugMarker)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn insert_debug_marker(this: &GpuComputePassEncoder, marker_label: &str); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = popDebugGroup)] - #[doc = "The `popDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/popDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn pop_debug_group(this: &GpuComputePassEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = pushDebugGroup)] - #[doc = "The `pushDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/pushDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn push_debug_group(this: &GpuComputePassEncoder, group_label: &str); - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] @@ -264,4 +201,37 @@ extern "C" { dynamic_offsets_data_start: f64, dynamic_offsets_data_length: u32, ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = insertDebugMarker)] + #[doc = "The `insertDebugMarker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/insertDebugMarker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn insert_debug_marker(this: &GpuComputePassEncoder, marker_label: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = popDebugGroup)] + #[doc = "The `popDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/popDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn pop_debug_group(this: &GpuComputePassEncoder); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = pushDebugGroup)] + #[doc = "The `pushDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/pushDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn push_debug_group(this: &GpuComputePassEncoder, group_label: &str); } diff --git a/crates/web-sys/src/features/gen_GpuComputePassTimestampLocation.rs b/crates/web-sys/src/features/gen_GpuComputePassTimestampLocation.rs new file mode 100644 index 00000000000..72142d1310b --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuComputePassTimestampLocation.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GpuComputePassTimestampLocation` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampLocation`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GpuComputePassTimestampLocation { + Beginning = "beginning", + End = "end", +} diff --git a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrite.rs b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrite.rs new file mode 100644 index 00000000000..0d6c36da023 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrite.rs @@ -0,0 +1,103 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUComputePassTimestampWrite)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuComputePassTimestampWrite` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuComputePassTimestampWrite; +} +#[cfg(web_sys_unstable_apis)] +impl GpuComputePassTimestampWrite { + #[cfg(all(feature = "GpuComputePassTimestampLocation", feature = "GpuQuerySet",))] + #[doc = "Construct a new `GpuComputePassTimestampWrite`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampLocation`, `GpuComputePassTimestampWrite`, `GpuQuerySet`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + location: GpuComputePassTimestampLocation, + query_index: u32, + query_set: &GpuQuerySet, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.location(location); + ret.query_index(query_index); + ret.query_set(query_set); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuComputePassTimestampLocation")] + #[doc = "Change the `location` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampLocation`, `GpuComputePassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn location(&mut self, val: GpuComputePassTimestampLocation) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("location"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `queryIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_index(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("queryIndex"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQuerySet")] + #[doc = "Change the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrite`, `GpuQuerySet`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("querySet"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_GpuComputePipeline.rs b/crates/web-sys/src/features/gen_GpuComputePipeline.rs index 452e4ee6f7e..e47a232b209 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipeline.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipeline.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuComputePipeline) -> Option; + pub fn label(this: &GpuComputePipeline) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUComputePipeline" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuComputePipeline, value: Option<&str>); + pub fn set_label(this: &GpuComputePipeline, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroupLayout")] # [wasm_bindgen (method , structural , js_class = "GPUComputePipeline" , js_name = getBindGroupLayout)] diff --git a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs index 1f8e089bbe9..33ff02f8408 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs @@ -23,9 +23,10 @@ impl GpuComputePipelineDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(compute: &GpuProgrammableStage) -> Self { + pub fn new(layout: &::wasm_bindgen::JsValue, compute: &GpuProgrammableStage) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.layout(layout); ret.compute(compute); ret } @@ -47,14 +48,13 @@ impl GpuComputePipelineDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPipelineLayout")] #[doc = "Change the `layout` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`, `GpuPipelineLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn layout(&mut self, val: &GpuPipelineLayout) -> &mut Self { + pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 536725265c1..05382204e38 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuDevice) -> Option; + pub fn label(this: &GpuDevice) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUDevice" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -105,7 +105,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuDevice, value: Option<&str>); + pub fn set_label(this: &GpuDevice, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuBindGroup", feature = "GpuBindGroupDescriptor",))] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createBindGroup)] diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index 614b1104464..d29661fdc29 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -45,6 +45,28 @@ impl GpuDeviceDescriptor { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQueueDescriptor")] + #[doc = "Change the `defaultQueue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`, `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn default_queue(&mut self, val: &GpuQueueDescriptor) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("defaultQueue"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `requiredFeatures` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] diff --git a/crates/web-sys/src/features/gen_GpuMapMode.rs b/crates/web-sys/src/features/gen_GpuError.rs similarity index 61% rename from crates/web-sys/src/features/gen_GpuMapMode.rs rename to crates/web-sys/src/features/gen_GpuError.rs index 7da1a45475b..c76d7ddea0d 100644 --- a/crates/web-sys/src/features/gen_GpuMapMode.rs +++ b/crates/web-sys/src/features/gen_GpuError.rs @@ -4,34 +4,37 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUMapMode , typescript_type = "GPUMapMode")] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUError , typescript_type = "GPUError")] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuMapMode` class."] + #[doc = "The `GpuError` class."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUMapMode)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUError)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuError`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuMapMode; -} -#[cfg(web_sys_unstable_apis)] -impl GpuMapMode { + pub type GpuError; #[cfg(web_sys_unstable_apis)] - #[doc = "The `GPUMapMode.READ` const."] + # [wasm_bindgen (structural , method , getter , js_class = "GPUError" , js_name = message)] + #[doc = "Getter for the `message` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUError/message)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuError`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub const READ: u32 = 1u64 as u32; + pub fn message(this: &GpuError) -> String; #[cfg(web_sys_unstable_apis)] - #[doc = "The `GPUMapMode.WRITE` const."] + #[wasm_bindgen(catch, constructor, js_class = "GPUError")] + #[doc = "The `new GpuError(..)` constructor, creating a new instance of `GpuError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUError/GPUError)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuError`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub const WRITE: u32 = 2u64 as u32; + pub fn new(message: &str) -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuExternalTexture.rs b/crates/web-sys/src/features/gen_GpuExternalTexture.rs index 6142e8536cf..e04f4776e50 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTexture.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTexture.rs @@ -16,6 +16,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuExternalTexture; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUExternalTexture" , js_name = expired)] + #[doc = "Getter for the `expired` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUExternalTexture/expired)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExternalTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn expired(this: &GpuExternalTexture) -> bool; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUExternalTexture" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] @@ -25,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuExternalTexture) -> Option; + pub fn label(this: &GpuExternalTexture) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUExternalTexture" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +47,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuExternalTexture, value: Option<&str>); + pub fn set_label(this: &GpuExternalTexture, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index 5ebc2785a6a..b127394ffb5 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -10,10 +10,14 @@ use wasm_bindgen::prelude::*; #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuFeatureName { - DepthClamping = "depth-clamping", + DepthClipControl = "depth-clip-control", Depth24unormStencil8 = "depth24unorm-stencil8", Depth32floatStencil8 = "depth32float-stencil8", - PipelineStatisticsQuery = "pipeline-statistics-query", TextureCompressionBc = "texture-compression-bc", + TextureCompressionEtc2 = "texture-compression-etc2", + TextureCompressionAstc = "texture-compression-astc", TimestampQuery = "timestamp-query", + IndirectFirstInstance = "indirect-first-instance", + ShaderF16 = "shader-f16", + Bgra8unormStorage = "bgra8unorm-storage", } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs index a381dd24781..03d1f9c376b 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs @@ -29,6 +29,23 @@ impl GpuImageCopyExternalImage { ret } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `flipY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn flip_y(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flipY"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] diff --git a/crates/web-sys/src/features/gen_GpuLoadOp.rs b/crates/web-sys/src/features/gen_GpuLoadOp.rs index 2973e168bf3..7812306cd63 100644 --- a/crates/web-sys/src/features/gen_GpuLoadOp.rs +++ b/crates/web-sys/src/features/gen_GpuLoadOp.rs @@ -11,4 +11,5 @@ use wasm_bindgen::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuLoadOp { Load = "load", + Clear = "clear", } diff --git a/crates/web-sys/src/features/gen_GpuMipmapFilterMode.rs b/crates/web-sys/src/features/gen_GpuMipmapFilterMode.rs new file mode 100644 index 00000000000..65718e9a4c1 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuMipmapFilterMode.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GpuMipmapFilterMode` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GpuMipmapFilterMode`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GpuMipmapFilterMode { + Nearest = "nearest", + Linear = "linear", +} diff --git a/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs b/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs index d2628d32298..e7ebb5c5837 100644 --- a/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs +++ b/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs @@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUOutOfMemoryError , typescript_type = "GPUOutOfMemoryError")] + # [wasm_bindgen (extends = GpuError , extends = :: js_sys :: Object , js_name = GPUOutOfMemoryError , typescript_type = "GPUOutOfMemoryError")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `GpuOutOfMemoryError` class."] #[doc = ""] @@ -15,15 +15,4 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOutOfMemoryError; - #[cfg(web_sys_unstable_apis)] - #[wasm_bindgen(catch, constructor, js_class = "GPUOutOfMemoryError")] - #[doc = "The `new GpuOutOfMemoryError(..)` constructor, creating a new instance of `GpuOutOfMemoryError`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUOutOfMemoryError/GPUOutOfMemoryError)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuOutOfMemoryError`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs index a1d2fdcfdcd..f88b58b028e 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs @@ -22,9 +22,10 @@ impl GpuPipelineDescriptorBase { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { + pub fn new(layout: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.layout(layout); ret } #[cfg(web_sys_unstable_apis)] @@ -45,14 +46,13 @@ impl GpuPipelineDescriptorBase { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPipelineLayout")] #[doc = "Change the `layout` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`, `GpuPipelineLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn layout(&mut self, val: &GpuPipelineLayout) -> &mut Self { + pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); @@ -64,9 +64,3 @@ impl GpuPipelineDescriptorBase { self } } -#[cfg(web_sys_unstable_apis)] -impl Default for GpuPipelineDescriptorBase { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayout.rs b/crates/web-sys/src/features/gen_GpuPipelineLayout.rs index 4a9a2b7ac1f..85978241f80 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayout.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayout.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuPipelineLayout) -> Option; + pub fn label(this: &GpuPipelineLayout) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUPipelineLayout" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuPipelineLayout, value: Option<&str>); + pub fn set_label(this: &GpuPipelineLayout, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs index 36e89cdb8ae..ff82fb1e0fa 100644 --- a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs +++ b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs @@ -28,27 +28,6 @@ impl GpuPrimitiveState { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `clampDepth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn clamp_depth(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clampDepth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCullMode")] #[doc = "Change the `cullMode` field of this object."] #[doc = ""] @@ -136,6 +115,27 @@ impl GpuPrimitiveState { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `unclippedDepth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn unclipped_depth(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("unclippedDepth"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } #[cfg(web_sys_unstable_apis)] impl Default for GpuPrimitiveState { diff --git a/crates/web-sys/src/features/gen_GpuQuerySet.rs b/crates/web-sys/src/features/gen_GpuQuerySet.rs index da2a4141fcc..52dad57b724 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySet.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySet.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuQuerySet) -> Option; + pub fn label(this: &GpuQuerySet) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUQuerySet" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuQuerySet, value: Option<&str>); + pub fn set_label(this: &GpuQuerySet, value: &str); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUQuerySet" , js_name = destroy)] #[doc = "The `destroy()` method."] diff --git a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs index eca1a478427..be7fbda545e 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs @@ -65,27 +65,6 @@ impl GpuQuerySetDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `pipelineStatistics` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn pipeline_statistics(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pipelineStatistics"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueryType")] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuQueryType.rs b/crates/web-sys/src/features/gen_GpuQueryType.rs index 4355a137533..5fa437b6a9b 100644 --- a/crates/web-sys/src/features/gen_GpuQueryType.rs +++ b/crates/web-sys/src/features/gen_GpuQueryType.rs @@ -11,6 +11,5 @@ use wasm_bindgen::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuQueryType { Occlusion = "occlusion", - PipelineStatistics = "pipeline-statistics", Timestamp = "timestamp", } diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index 8e6668bf111..45b0bfeb822 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuQueue) -> Option; + pub fn label(this: &GpuQueue) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUQueue" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuQueue, value: Option<&str>); + pub fn set_label(this: &GpuQueue, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuImageCopyExternalImage", diff --git a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs new file mode 100644 index 00000000000..26f6e28d3d9 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs @@ -0,0 +1,53 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUQueueDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuQueueDescriptor` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuQueueDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl GpuQueueDescriptor { + #[doc = "Construct a new `GpuQueueDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn label(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for GpuQueueDescriptor { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_GpuRenderBundle.rs b/crates/web-sys/src/features/gen_GpuRenderBundle.rs index 7ef770ae428..2fba3c333dc 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundle.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundle.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderBundle) -> Option; + pub fn label(this: &GpuRenderBundle) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderBundle" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuRenderBundle, value: Option<&str>); + pub fn set_label(this: &GpuRenderBundle, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs index 7eba9a2fb39..c2222f67a40 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderBundleEncoder) -> Option; + pub fn label(this: &GpuRenderBundleEncoder) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderBundleEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuRenderBundleEncoder, value: Option<&str>); + pub fn set_label(this: &GpuRenderBundleEncoder, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderBundle")] # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = finish)] @@ -65,39 +65,6 @@ extern "C" { descriptor: &GpuRenderBundleDescriptor, ) -> GpuRenderBundle; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = insertDebugMarker)] - #[doc = "The `insertDebugMarker()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/insertDebugMarker)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn insert_debug_marker(this: &GpuRenderBundleEncoder, marker_label: &str); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = popDebugGroup)] - #[doc = "The `popDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/popDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn pop_debug_group(this: &GpuRenderBundleEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = pushDebugGroup)] - #[doc = "The `pushDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/pushDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn push_debug_group(this: &GpuRenderBundleEncoder, group_label: &str); - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] @@ -165,6 +132,39 @@ extern "C" { dynamic_offsets_data_length: u32, ); #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = insertDebugMarker)] + #[doc = "The `insertDebugMarker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/insertDebugMarker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn insert_debug_marker(this: &GpuRenderBundleEncoder, marker_label: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = popDebugGroup)] + #[doc = "The `popDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/popDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn pop_debug_group(this: &GpuRenderBundleEncoder); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = pushDebugGroup)] + #[doc = "The `pushDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/pushDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn push_debug_group(this: &GpuRenderBundleEncoder, group_label: &str); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = draw)] #[doc = "The `draw()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index aa05089c5b7..9945950ebfc 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -16,37 +16,37 @@ extern "C" { } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassColorAttachment { - #[cfg(all(feature = "GpuStoreOp", feature = "GpuTextureView",))] + #[cfg(all( + feature = "GpuLoadOp", + feature = "GpuStoreOp", + feature = "GpuTextureView", + ))] #[doc = "Construct a new `GpuRenderPassColorAttachment`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuStoreOp`, `GpuTextureView`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassColorAttachment`, `GpuStoreOp`, `GpuTextureView`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new( - load_value: &::wasm_bindgen::JsValue, - store_op: GpuStoreOp, - view: &GpuTextureView, - ) -> Self { + pub fn new(load_op: GpuLoadOp, store_op: GpuStoreOp, view: &GpuTextureView) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.load_value(load_value); + ret.load_op(load_op); ret.store_op(store_op); ret.view(view); ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `loadValue` field of this object."] + #[doc = "Change the `clearValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn load_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + pub fn clear_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("loadValue"), + &JsValue::from("clearValue"), &JsValue::from(val), ); debug_assert!( @@ -57,6 +57,25 @@ impl GpuRenderPassColorAttachment { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Change the `loadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn load_op(&mut self, val: GpuLoadOp) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loadOp"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] #[doc = "Change the `resolveTarget` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs index 83fbe10bc90..86117851bb8 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs @@ -16,41 +16,53 @@ extern "C" { } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassDepthStencilAttachment { - #[cfg(all(feature = "GpuStoreOp", feature = "GpuTextureView",))] + #[cfg(feature = "GpuTextureView")] #[doc = "Construct a new `GpuRenderPassDepthStencilAttachment`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuStoreOp`, `GpuTextureView`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuTextureView`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new( - depth_load_value: &::wasm_bindgen::JsValue, - depth_store_op: GpuStoreOp, - stencil_load_value: &::wasm_bindgen::JsValue, - stencil_store_op: GpuStoreOp, - view: &GpuTextureView, - ) -> Self { + pub fn new(view: &GpuTextureView) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.depth_load_value(depth_load_value); - ret.depth_store_op(depth_store_op); - ret.stencil_load_value(stencil_load_value); - ret.stencil_store_op(stencil_store_op); ret.view(view); ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `depthLoadValue` field of this object."] + #[doc = "Change the `depthClearValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_load_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + pub fn depth_clear_value(&mut self, val: f32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("depthClearValue"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Change the `depthLoadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn depth_load_op(&mut self, val: GpuLoadOp) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("depthLoadValue"), + &JsValue::from("depthLoadOp"), &JsValue::from(val), ); debug_assert!( @@ -104,17 +116,39 @@ impl GpuRenderPassDepthStencilAttachment { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `stencilLoadValue` field of this object."] + #[doc = "Change the `stencilClearValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_load_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + pub fn stencil_clear_value(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("stencilClearValue"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Change the `stencilLoadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stencil_load_op(&mut self, val: GpuLoadOp) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("stencilLoadValue"), + &JsValue::from("stencilLoadOp"), &JsValue::from(val), ); debug_assert!( diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 1228090a1ba..9b02b6992ae 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -113,4 +113,25 @@ impl GpuRenderPassDescriptor { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp_writes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestampWrites"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs index 3ae8e1f994f..ba680dfcaf0 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderPassEncoder) -> Option; + pub fn label(this: &GpuRenderPassEncoder) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderPassEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuRenderPassEncoder, value: Option<&str>); + pub fn set_label(this: &GpuRenderPassEncoder, value: &str); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = beginOcclusionQuery)] #[doc = "The `beginOcclusionQuery()` method."] @@ -49,21 +49,16 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn begin_occlusion_query(this: &GpuRenderPassEncoder, query_index: u32); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = beginPipelineStatisticsQuery)] - #[doc = "The `beginPipelineStatisticsQuery()` method."] + # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = end)] + #[doc = "The `end()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/beginPipelineStatisticsQuery)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/end)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassEncoder`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn begin_pipeline_statistics_query( - this: &GpuRenderPassEncoder, - query_set: &GpuQuerySet, - query_index: u32, - ); + pub fn end(this: &GpuRenderPassEncoder); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = endOcclusionQuery)] #[doc = "The `endOcclusionQuery()` method."] @@ -76,28 +71,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn end_occlusion_query(this: &GpuRenderPassEncoder); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = endPass)] - #[doc = "The `endPass()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/endPass)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn end_pass(this: &GpuRenderPassEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = endPipelineStatisticsQuery)] - #[doc = "The `endPipelineStatisticsQuery()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/endPipelineStatisticsQuery)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn end_pipeline_statistics_query(this: &GpuRenderPassEncoder); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = executeBundles)] #[doc = "The `executeBundles()` method."] #[doc = ""] @@ -179,51 +152,6 @@ extern "C" { max_depth: f32, ); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = writeTimestamp)] - #[doc = "The `writeTimestamp()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/writeTimestamp)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_timestamp(this: &GpuRenderPassEncoder, query_set: &GpuQuerySet, query_index: u32); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = insertDebugMarker)] - #[doc = "The `insertDebugMarker()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/insertDebugMarker)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn insert_debug_marker(this: &GpuRenderPassEncoder, marker_label: &str); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = popDebugGroup)] - #[doc = "The `popDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/popDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn pop_debug_group(this: &GpuRenderPassEncoder); - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = pushDebugGroup)] - #[doc = "The `pushDebugGroup()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/pushDebugGroup)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn push_debug_group(this: &GpuRenderPassEncoder, group_label: &str); - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] @@ -291,6 +219,39 @@ extern "C" { dynamic_offsets_data_length: u32, ); #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = insertDebugMarker)] + #[doc = "The `insertDebugMarker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/insertDebugMarker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn insert_debug_marker(this: &GpuRenderPassEncoder, marker_label: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = popDebugGroup)] + #[doc = "The `popDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/popDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn pop_debug_group(this: &GpuRenderPassEncoder); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = pushDebugGroup)] + #[doc = "The `pushDebugGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/pushDebugGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn push_debug_group(this: &GpuRenderPassEncoder, group_label: &str); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = draw)] #[doc = "The `draw()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassTimestampLocation.rs b/crates/web-sys/src/features/gen_GpuRenderPassTimestampLocation.rs new file mode 100644 index 00000000000..449d1264bc0 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuRenderPassTimestampLocation.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GpuRenderPassTimestampLocation` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampLocation`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GpuRenderPassTimestampLocation { + Beginning = "beginning", + End = "end", +} diff --git a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrite.rs b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrite.rs new file mode 100644 index 00000000000..fa35942a642 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrite.rs @@ -0,0 +1,103 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPURenderPassTimestampWrite)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuRenderPassTimestampWrite` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuRenderPassTimestampWrite; +} +#[cfg(web_sys_unstable_apis)] +impl GpuRenderPassTimestampWrite { + #[cfg(all(feature = "GpuQuerySet", feature = "GpuRenderPassTimestampLocation",))] + #[doc = "Construct a new `GpuRenderPassTimestampWrite`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampLocation`, `GpuRenderPassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + location: GpuRenderPassTimestampLocation, + query_index: u32, + query_set: &GpuQuerySet, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.location(location); + ret.query_index(query_index); + ret.query_set(query_set); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuRenderPassTimestampLocation")] + #[doc = "Change the `location` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampLocation`, `GpuRenderPassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn location(&mut self, val: GpuRenderPassTimestampLocation) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("location"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `queryIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_index(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("queryIndex"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQuerySet")] + #[doc = "Change the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampWrite`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("querySet"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_GpuRenderPipeline.rs b/crates/web-sys/src/features/gen_GpuRenderPipeline.rs index c9541566809..5655855ca7f 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipeline.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipeline.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderPipeline) -> Option; + pub fn label(this: &GpuRenderPipeline) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderPipeline" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuRenderPipeline, value: Option<&str>); + pub fn set_label(this: &GpuRenderPipeline, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroupLayout")] # [wasm_bindgen (method , structural , js_class = "GPURenderPipeline" , js_name = getBindGroupLayout)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs index fcd35bbc57d..b7ede7f58fa 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs @@ -23,9 +23,10 @@ impl GpuRenderPipelineDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(vertex: &GpuVertexState) -> Self { + pub fn new(layout: &::wasm_bindgen::JsValue, vertex: &GpuVertexState) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.layout(layout); ret.vertex(vertex); ret } @@ -47,14 +48,13 @@ impl GpuRenderPipelineDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPipelineLayout")] #[doc = "Change the `layout` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayout`, `GpuRenderPipelineDescriptor`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn layout(&mut self, val: &GpuPipelineLayout) -> &mut Self { + pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index feb52b795b9..43019647d52 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -28,17 +28,17 @@ impl GpuRequestAdapterOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `forceSoftware` field of this object."] + #[doc = "Change the `forceFallbackAdapter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn force_software(&mut self, val: bool) -> &mut Self { + pub fn force_fallback_adapter(&mut self, val: bool) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("forceSoftware"), + &JsValue::from("forceFallbackAdapter"), &JsValue::from(val), ); debug_assert!( diff --git a/crates/web-sys/src/features/gen_GpuSampler.rs b/crates/web-sys/src/features/gen_GpuSampler.rs index 42e389470ec..e98b3864297 100644 --- a/crates/web-sys/src/features/gen_GpuSampler.rs +++ b/crates/web-sys/src/features/gen_GpuSampler.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuSampler) -> Option; + pub fn label(this: &GpuSampler) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUSampler" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuSampler, value: Option<&str>); + pub fn set_label(this: &GpuSampler, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs index 90f100f0905..431414b80db 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs @@ -240,14 +240,14 @@ impl GpuSamplerDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuFilterMode")] + #[cfg(feature = "GpuMipmapFilterMode")] #[doc = "Change the `mipmapFilter` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuFilterMode`, `GpuSamplerDescriptor`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuMipmapFilterMode`, `GpuSamplerDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mipmap_filter(&mut self, val: GpuFilterMode) -> &mut Self { + pub fn mipmap_filter(&mut self, val: GpuMipmapFilterMode) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), diff --git a/crates/web-sys/src/features/gen_GpuShaderModule.rs b/crates/web-sys/src/features/gen_GpuShaderModule.rs index 7e35f25ecc4..18b78c1a460 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModule.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModule.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuShaderModule) -> Option; + pub fn label(this: &GpuShaderModule) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUShaderModule" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuShaderModule, value: Option<&str>); + pub fn set_label(this: &GpuShaderModule, value: &str); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUShaderModule" , js_name = compilationInfo)] #[doc = "The `compilationInfo()` method."] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs new file mode 100644 index 00000000000..7d4020926b5 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -0,0 +1,49 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUShaderModuleCompilationHint)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuShaderModuleCompilationHint` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuShaderModuleCompilationHint; +} +#[cfg(web_sys_unstable_apis)] +impl GpuShaderModuleCompilationHint { + #[doc = "Construct a new `GpuShaderModuleCompilationHint`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(layout: &::wasm_bindgen::JsValue) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.layout(layout); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_GpuTexture.rs b/crates/web-sys/src/features/gen_GpuTexture.rs index ff9c31bd5bf..52d410ec5ca 100644 --- a/crates/web-sys/src/features/gen_GpuTexture.rs +++ b/crates/web-sys/src/features/gen_GpuTexture.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuTexture) -> Option; + pub fn label(this: &GpuTexture) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUTexture" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuTexture, value: Option<&str>); + pub fn set_label(this: &GpuTexture, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] # [wasm_bindgen (method , structural , js_class = "GPUTexture" , js_name = createView)] diff --git a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs index c46f8887850..d4087b3f634 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs @@ -165,4 +165,25 @@ impl GpuTextureDescriptor { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `viewFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("viewFormats"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } } diff --git a/crates/web-sys/src/features/gen_GpuTextureFormat.rs b/crates/web-sys/src/features/gen_GpuTextureFormat.rs index 4f4417971bc..8d638f44568 100644 --- a/crates/web-sys/src/features/gen_GpuTextureFormat.rs +++ b/crates/web-sys/src/features/gen_GpuTextureFormat.rs @@ -51,6 +51,8 @@ pub enum GpuTextureFormat { Depth24plus = "depth24plus", Depth24plusStencil8 = "depth24plus-stencil8", Depth32float = "depth32float", + Depth24unormStencil8 = "depth24unorm-stencil8", + Depth32floatStencil8 = "depth32float-stencil8", Bc1RgbaUnorm = "bc1-rgba-unorm", Bc1RgbaUnormSrgb = "bc1-rgba-unorm-srgb", Bc2RgbaUnorm = "bc2-rgba-unorm", @@ -65,6 +67,42 @@ pub enum GpuTextureFormat { Bc6hRgbFloat = "bc6h-rgb-float", Bc7RgbaUnorm = "bc7-rgba-unorm", Bc7RgbaUnormSrgb = "bc7-rgba-unorm-srgb", - Depth24unormStencil8 = "depth24unorm-stencil8", - Depth32floatStencil8 = "depth32float-stencil8", + Etc2Rgb8unorm = "etc2-rgb8unorm", + Etc2Rgb8unormSrgb = "etc2-rgb8unorm-srgb", + Etc2Rgb8a1unorm = "etc2-rgb8a1unorm", + Etc2Rgb8a1unormSrgb = "etc2-rgb8a1unorm-srgb", + Etc2Rgba8unorm = "etc2-rgba8unorm", + Etc2Rgba8unormSrgb = "etc2-rgba8unorm-srgb", + EacR11unorm = "eac-r11unorm", + EacR11snorm = "eac-r11snorm", + EacRg11unorm = "eac-rg11unorm", + EacRg11snorm = "eac-rg11snorm", + Astc4x4Unorm = "astc-4x4-unorm", + Astc4x4UnormSrgb = "astc-4x4-unorm-srgb", + Astc5x4Unorm = "astc-5x4-unorm", + Astc5x4UnormSrgb = "astc-5x4-unorm-srgb", + Astc5x5Unorm = "astc-5x5-unorm", + Astc5x5UnormSrgb = "astc-5x5-unorm-srgb", + Astc6x5Unorm = "astc-6x5-unorm", + Astc6x5UnormSrgb = "astc-6x5-unorm-srgb", + Astc6x6Unorm = "astc-6x6-unorm", + Astc6x6UnormSrgb = "astc-6x6-unorm-srgb", + Astc8x5Unorm = "astc-8x5-unorm", + Astc8x5UnormSrgb = "astc-8x5-unorm-srgb", + Astc8x6Unorm = "astc-8x6-unorm", + Astc8x6UnormSrgb = "astc-8x6-unorm-srgb", + Astc8x8Unorm = "astc-8x8-unorm", + Astc8x8UnormSrgb = "astc-8x8-unorm-srgb", + Astc10x5Unorm = "astc-10x5-unorm", + Astc10x5UnormSrgb = "astc-10x5-unorm-srgb", + Astc10x6Unorm = "astc-10x6-unorm", + Astc10x6UnormSrgb = "astc-10x6-unorm-srgb", + Astc10x8Unorm = "astc-10x8-unorm", + Astc10x8UnormSrgb = "astc-10x8-unorm-srgb", + Astc10x10Unorm = "astc-10x10-unorm", + Astc10x10UnormSrgb = "astc-10x10-unorm-srgb", + Astc12x10Unorm = "astc-12x10-unorm", + Astc12x10UnormSrgb = "astc-12x10-unorm-srgb", + Astc12x12Unorm = "astc-12x12-unorm", + Astc12x12UnormSrgb = "astc-12x12-unorm-srgb", } diff --git a/crates/web-sys/src/features/gen_GpuTextureView.rs b/crates/web-sys/src/features/gen_GpuTextureView.rs index fceaf0e7ce0..4ab52473ebd 100644 --- a/crates/web-sys/src/features/gen_GpuTextureView.rs +++ b/crates/web-sys/src/features/gen_GpuTextureView.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuTextureView) -> Option; + pub fn label(this: &GpuTextureView) -> String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUTextureView" , js_name = label)] #[doc = "Setter for the `label` field of this object."] @@ -36,5 +36,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_label(this: &GpuTextureView, value: Option<&str>); + pub fn set_label(this: &GpuTextureView, value: &str); } diff --git a/crates/web-sys/src/features/gen_GpuUncapturedErrorEvent.rs b/crates/web-sys/src/features/gen_GpuUncapturedErrorEvent.rs index f1a4e654958..07f10daa5a3 100644 --- a/crates/web-sys/src/features/gen_GpuUncapturedErrorEvent.rs +++ b/crates/web-sys/src/features/gen_GpuUncapturedErrorEvent.rs @@ -16,16 +16,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuUncapturedErrorEvent; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuError")] # [wasm_bindgen (structural , method , getter , js_class = "GPUUncapturedErrorEvent" , js_name = error)] #[doc = "Getter for the `error` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUUncapturedErrorEvent/error)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEvent`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEvent`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn error(this: &GpuUncapturedErrorEvent) -> ::js_sys::Object; + pub fn error(this: &GpuUncapturedErrorEvent) -> GpuError; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuUncapturedErrorEventInit")] #[wasm_bindgen(catch, constructor, js_class = "GPUUncapturedErrorEvent")] diff --git a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs index b554bcb72f8..986dd50483b 100644 --- a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs @@ -16,13 +16,14 @@ extern "C" { } #[cfg(web_sys_unstable_apis)] impl GpuUncapturedErrorEventInit { + #[cfg(feature = "GpuError")] #[doc = "Construct a new `GpuUncapturedErrorEventInit`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEventInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(error: &::js_sys::Object) -> Self { + pub fn new(error: &GpuError) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret.error(error); @@ -92,13 +93,14 @@ impl GpuUncapturedErrorEventInit { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuError")] #[doc = "Change the `error` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEventInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn error(&mut self, val: &::js_sys::Object) -> &mut Self { + pub fn error(&mut self, val: &GpuError) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); debug_assert!( diff --git a/crates/web-sys/src/features/gen_GpuValidationError.rs b/crates/web-sys/src/features/gen_GpuValidationError.rs index 48f16949365..7d9b8144e04 100644 --- a/crates/web-sys/src/features/gen_GpuValidationError.rs +++ b/crates/web-sys/src/features/gen_GpuValidationError.rs @@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUValidationError , typescript_type = "GPUValidationError")] + # [wasm_bindgen (extends = GpuError , extends = :: js_sys :: Object , js_name = GPUValidationError , typescript_type = "GPUValidationError")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `GpuValidationError` class."] #[doc = ""] @@ -15,26 +15,4 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuValidationError; - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUValidationError" , js_name = message)] - #[doc = "Getter for the `message` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUValidationError/message)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuValidationError`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn message(this: &GpuValidationError) -> String; - #[cfg(web_sys_unstable_apis)] - #[wasm_bindgen(catch, constructor, js_class = "GPUValidationError")] - #[doc = "The `new GpuValidationError(..)` constructor, creating a new instance of `GpuValidationError`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUValidationError/GPUValidationError)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuValidationError`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(message: &str) -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuBufferUsage.rs b/crates/web-sys/src/features/gen_gpu_buffer_usage.rs similarity index 79% rename from crates/web-sys/src/features/gen_GpuBufferUsage.rs rename to crates/web-sys/src/features/gen_gpu_buffer_usage.rs index 313d5730b18..39b90f05b21 100644 --- a/crates/web-sys/src/features/gen_GpuBufferUsage.rs +++ b/crates/web-sys/src/features/gen_gpu_buffer_usage.rs @@ -1,27 +1,15 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUBufferUsage , typescript_type = "GPUBufferUsage")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuBufferUsage` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBufferUsage)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuBufferUsage; -} -#[cfg(web_sys_unstable_apis)] -impl GpuBufferUsage { +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +pub mod gpu_buffer_usage { + #![allow(unused_imports)] + use super::super::*; + use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.MAP_READ` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -29,7 +17,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.MAP_WRITE` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -37,7 +25,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.COPY_SRC` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -45,7 +33,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.COPY_DST` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -53,7 +41,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.INDEX` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -61,7 +49,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.VERTEX` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -69,7 +57,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.UNIFORM` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -77,7 +65,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.STORAGE` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -85,7 +73,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.INDIRECT` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -93,7 +81,7 @@ impl GpuBufferUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUBufferUsage.QUERY_RESOLVE` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_buffer_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuColorWrite.rs b/crates/web-sys/src/features/gen_gpu_color_write.rs similarity index 68% rename from crates/web-sys/src/features/gen_GpuColorWrite.rs rename to crates/web-sys/src/features/gen_gpu_color_write.rs index 47b1571225a..d037288e04e 100644 --- a/crates/web-sys/src/features/gen_GpuColorWrite.rs +++ b/crates/web-sys/src/features/gen_gpu_color_write.rs @@ -1,27 +1,15 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUColorWrite , typescript_type = "GPUColorWrite")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuColorWrite` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUColorWrite)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuColorWrite; -} -#[cfg(web_sys_unstable_apis)] -impl GpuColorWrite { +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +pub mod gpu_color_write { + #![allow(unused_imports)] + use super::super::*; + use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUColorWrite.RED` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_color_write`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -29,7 +17,7 @@ impl GpuColorWrite { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUColorWrite.GREEN` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_color_write`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -37,7 +25,7 @@ impl GpuColorWrite { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUColorWrite.BLUE` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_color_write`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -45,7 +33,7 @@ impl GpuColorWrite { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUColorWrite.ALPHA` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_color_write`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -53,7 +41,7 @@ impl GpuColorWrite { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUColorWrite.ALL` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorWrite`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_color_write`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_gpu_map_mode.rs b/crates/web-sys/src/features/gen_gpu_map_mode.rs new file mode 100644 index 00000000000..272064e75b8 --- /dev/null +++ b/crates/web-sys/src/features/gen_gpu_map_mode.rs @@ -0,0 +1,25 @@ +#[cfg(web_sys_unstable_apis)] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +pub mod gpu_map_mode { + #![allow(unused_imports)] + use super::super::*; + use wasm_bindgen::prelude::*; + #[cfg(web_sys_unstable_apis)] + #[doc = "The `GPUMapMode.READ` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `gpu_map_mode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub const READ: u32 = 1u64 as u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "The `GPUMapMode.WRITE` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `gpu_map_mode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub const WRITE: u32 = 2u64 as u32; +} diff --git a/crates/web-sys/src/features/gen_GpuShaderStage.rs b/crates/web-sys/src/features/gen_gpu_shader_stage.rs similarity index 59% rename from crates/web-sys/src/features/gen_GpuShaderStage.rs rename to crates/web-sys/src/features/gen_gpu_shader_stage.rs index f9b2538c119..5638875387b 100644 --- a/crates/web-sys/src/features/gen_GpuShaderStage.rs +++ b/crates/web-sys/src/features/gen_gpu_shader_stage.rs @@ -1,27 +1,15 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUShaderStage , typescript_type = "GPUShaderStage")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuShaderStage` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUShaderStage)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderStage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuShaderStage; -} -#[cfg(web_sys_unstable_apis)] -impl GpuShaderStage { +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +pub mod gpu_shader_stage { + #![allow(unused_imports)] + use super::super::*; + use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUShaderStage.VERTEX` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderStage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_shader_stage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -29,7 +17,7 @@ impl GpuShaderStage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUShaderStage.FRAGMENT` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderStage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_shader_stage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -37,7 +25,7 @@ impl GpuShaderStage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUShaderStage.COMPUTE` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderStage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_shader_stage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuTextureUsage.rs b/crates/web-sys/src/features/gen_gpu_texture_usage.rs similarity index 69% rename from crates/web-sys/src/features/gen_GpuTextureUsage.rs rename to crates/web-sys/src/features/gen_gpu_texture_usage.rs index 208653c933e..4cc90904979 100644 --- a/crates/web-sys/src/features/gen_GpuTextureUsage.rs +++ b/crates/web-sys/src/features/gen_gpu_texture_usage.rs @@ -1,27 +1,15 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUTextureUsage , typescript_type = "GPUTextureUsage")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuTextureUsage` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTextureUsage)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuTextureUsage; -} -#[cfg(web_sys_unstable_apis)] -impl GpuTextureUsage { +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +pub mod gpu_texture_usage { + #![allow(unused_imports)] + use super::super::*; + use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUTextureUsage.COPY_SRC` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_texture_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -29,7 +17,7 @@ impl GpuTextureUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUTextureUsage.COPY_DST` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_texture_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -37,7 +25,7 @@ impl GpuTextureUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUTextureUsage.TEXTURE_BINDING` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_texture_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -45,7 +33,7 @@ impl GpuTextureUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUTextureUsage.STORAGE_BINDING` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_texture_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -53,7 +41,7 @@ impl GpuTextureUsage { #[cfg(web_sys_unstable_apis)] #[doc = "The `GPUTextureUsage.RENDER_ATTACHMENT` const."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] + #[doc = "*This API requires the following crate features to be activated: `gpu_texture_usage`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index b69a1e0b49f..a9cf9d211c3 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2374,6 +2374,12 @@ mod gen_GpuAddressMode; #[cfg(feature = "GpuAddressMode")] pub use gen_GpuAddressMode::*; +#[cfg(feature = "GpuAutoLayoutMode")] +#[allow(non_snake_case)] +mod gen_GpuAutoLayoutMode; +#[cfg(feature = "GpuAutoLayoutMode")] +pub use gen_GpuAutoLayoutMode::*; + #[cfg(feature = "GpuBindGroup")] #[allow(non_snake_case)] mod gen_GpuBindGroup; @@ -2464,12 +2470,6 @@ mod gen_GpuBufferDescriptor; #[cfg(feature = "GpuBufferDescriptor")] pub use gen_GpuBufferDescriptor::*; -#[cfg(feature = "GpuBufferUsage")] -#[allow(non_snake_case)] -mod gen_GpuBufferUsage; -#[cfg(feature = "GpuBufferUsage")] -pub use gen_GpuBufferUsage::*; - #[cfg(feature = "GpuCanvasCompositingAlphaMode")] #[allow(non_snake_case)] mod gen_GpuCanvasCompositingAlphaMode; @@ -2500,12 +2500,6 @@ mod gen_GpuColorTargetState; #[cfg(feature = "GpuColorTargetState")] pub use gen_GpuColorTargetState::*; -#[cfg(feature = "GpuColorWrite")] -#[allow(non_snake_case)] -mod gen_GpuColorWrite; -#[cfg(feature = "GpuColorWrite")] -pub use gen_GpuColorWrite::*; - #[cfg(feature = "GpuCommandBuffer")] #[allow(non_snake_case)] mod gen_GpuCommandBuffer; @@ -2566,6 +2560,18 @@ mod gen_GpuComputePassEncoder; #[cfg(feature = "GpuComputePassEncoder")] pub use gen_GpuComputePassEncoder::*; +#[cfg(feature = "GpuComputePassTimestampLocation")] +#[allow(non_snake_case)] +mod gen_GpuComputePassTimestampLocation; +#[cfg(feature = "GpuComputePassTimestampLocation")] +pub use gen_GpuComputePassTimestampLocation::*; + +#[cfg(feature = "GpuComputePassTimestampWrite")] +#[allow(non_snake_case)] +mod gen_GpuComputePassTimestampWrite; +#[cfg(feature = "GpuComputePassTimestampWrite")] +pub use gen_GpuComputePassTimestampWrite::*; + #[cfg(feature = "GpuComputePipeline")] #[allow(non_snake_case)] mod gen_GpuComputePipeline; @@ -2614,6 +2620,12 @@ mod gen_GpuDeviceLostReason; #[cfg(feature = "GpuDeviceLostReason")] pub use gen_GpuDeviceLostReason::*; +#[cfg(feature = "GpuError")] +#[allow(non_snake_case)] +mod gen_GpuError; +#[cfg(feature = "GpuError")] +pub use gen_GpuError::*; + #[cfg(feature = "GpuErrorFilter")] #[allow(non_snake_case)] mod gen_GpuErrorFilter; @@ -2710,11 +2722,11 @@ mod gen_GpuLoadOp; #[cfg(feature = "GpuLoadOp")] pub use gen_GpuLoadOp::*; -#[cfg(feature = "GpuMapMode")] +#[cfg(feature = "GpuMipmapFilterMode")] #[allow(non_snake_case)] -mod gen_GpuMapMode; -#[cfg(feature = "GpuMapMode")] -pub use gen_GpuMapMode::*; +mod gen_GpuMipmapFilterMode; +#[cfg(feature = "GpuMipmapFilterMode")] +pub use gen_GpuMipmapFilterMode::*; #[cfg(feature = "GpuMultisampleState")] #[allow(non_snake_case)] @@ -2764,12 +2776,6 @@ mod gen_GpuPipelineLayoutDescriptor; #[cfg(feature = "GpuPipelineLayoutDescriptor")] pub use gen_GpuPipelineLayoutDescriptor::*; -#[cfg(feature = "GpuPipelineStatisticName")] -#[allow(non_snake_case)] -mod gen_GpuPipelineStatisticName; -#[cfg(feature = "GpuPipelineStatisticName")] -pub use gen_GpuPipelineStatisticName::*; - #[cfg(feature = "GpuPowerPreference")] #[allow(non_snake_case)] mod gen_GpuPowerPreference; @@ -2824,6 +2830,12 @@ mod gen_GpuQueue; #[cfg(feature = "GpuQueue")] pub use gen_GpuQueue::*; +#[cfg(feature = "GpuQueueDescriptor")] +#[allow(non_snake_case)] +mod gen_GpuQueueDescriptor; +#[cfg(feature = "GpuQueueDescriptor")] +pub use gen_GpuQueueDescriptor::*; + #[cfg(feature = "GpuRenderBundle")] #[allow(non_snake_case)] mod gen_GpuRenderBundle; @@ -2878,6 +2890,18 @@ mod gen_GpuRenderPassLayout; #[cfg(feature = "GpuRenderPassLayout")] pub use gen_GpuRenderPassLayout::*; +#[cfg(feature = "GpuRenderPassTimestampLocation")] +#[allow(non_snake_case)] +mod gen_GpuRenderPassTimestampLocation; +#[cfg(feature = "GpuRenderPassTimestampLocation")] +pub use gen_GpuRenderPassTimestampLocation::*; + +#[cfg(feature = "GpuRenderPassTimestampWrite")] +#[allow(non_snake_case)] +mod gen_GpuRenderPassTimestampWrite; +#[cfg(feature = "GpuRenderPassTimestampWrite")] +pub use gen_GpuRenderPassTimestampWrite::*; + #[cfg(feature = "GpuRenderPipeline")] #[allow(non_snake_case)] mod gen_GpuRenderPipeline; @@ -2926,18 +2950,18 @@ mod gen_GpuShaderModule; #[cfg(feature = "GpuShaderModule")] pub use gen_GpuShaderModule::*; +#[cfg(feature = "GpuShaderModuleCompilationHint")] +#[allow(non_snake_case)] +mod gen_GpuShaderModuleCompilationHint; +#[cfg(feature = "GpuShaderModuleCompilationHint")] +pub use gen_GpuShaderModuleCompilationHint::*; + #[cfg(feature = "GpuShaderModuleDescriptor")] #[allow(non_snake_case)] mod gen_GpuShaderModuleDescriptor; #[cfg(feature = "GpuShaderModuleDescriptor")] pub use gen_GpuShaderModuleDescriptor::*; -#[cfg(feature = "GpuShaderStage")] -#[allow(non_snake_case)] -mod gen_GpuShaderStage; -#[cfg(feature = "GpuShaderStage")] -pub use gen_GpuShaderStage::*; - #[cfg(feature = "GpuStencilFaceState")] #[allow(non_snake_case)] mod gen_GpuStencilFaceState; @@ -3022,12 +3046,6 @@ mod gen_GpuTextureSampleType; #[cfg(feature = "GpuTextureSampleType")] pub use gen_GpuTextureSampleType::*; -#[cfg(feature = "GpuTextureUsage")] -#[allow(non_snake_case)] -mod gen_GpuTextureUsage; -#[cfg(feature = "GpuTextureUsage")] -pub use gen_GpuTextureUsage::*; - #[cfg(feature = "GpuTextureView")] #[allow(non_snake_case)] mod gen_GpuTextureView; @@ -8835,3 +8853,33 @@ pub use gen_console::*; mod gen_css; #[cfg(feature = "css")] pub use gen_css::*; + +#[cfg(feature = "gpu_buffer_usage")] +#[allow(non_snake_case)] +mod gen_gpu_buffer_usage; +#[cfg(feature = "gpu_buffer_usage")] +pub use gen_gpu_buffer_usage::*; + +#[cfg(feature = "gpu_color_write")] +#[allow(non_snake_case)] +mod gen_gpu_color_write; +#[cfg(feature = "gpu_color_write")] +pub use gen_gpu_color_write::*; + +#[cfg(feature = "gpu_map_mode")] +#[allow(non_snake_case)] +mod gen_gpu_map_mode; +#[cfg(feature = "gpu_map_mode")] +pub use gen_gpu_map_mode::*; + +#[cfg(feature = "gpu_shader_stage")] +#[allow(non_snake_case)] +mod gen_gpu_shader_stage; +#[cfg(feature = "gpu_shader_stage")] +pub use gen_gpu_shader_stage::*; + +#[cfg(feature = "gpu_texture_usage")] +#[allow(non_snake_case)] +mod gen_gpu_texture_usage; +#[cfg(feature = "gpu_texture_usage")] +pub use gen_gpu_texture_usage::*; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 59ce1b324e5..7a2aa740112 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -1,12 +1,12 @@ interface mixin GPUObjectBase { - attribute USVString? label; + attribute USVString label; }; dictionary GPUObjectDescriptorBase { USVString label; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension1D; readonly attribute unsigned long maxTextureDimension2D; @@ -36,7 +36,7 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxComputeWorkgroupsPerDimension; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUSupportedFeatures { readonly setlike; }; @@ -46,32 +46,33 @@ enum GPUPredefinedColorSpace { }; interface mixin NavigatorGPU { - [SameObject] readonly attribute GPU gpu; + [SameObject, SecureContext] readonly attribute GPU gpu; }; Navigator includes NavigatorGPU; WorkerNavigator includes NavigatorGPU; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPU { Promise requestAdapter(optional GPURequestAdapterOptions options = {}); + GPUTextureFormat getPreferredCanvasFormat(); }; dictionary GPURequestAdapterOptions { GPUPowerPreference powerPreference; - boolean forceSoftware = false; + boolean forceFallbackAdapter = false; }; enum GPUPowerPreference { "low-power", - "high-performance" + "high-performance", }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUAdapter { readonly attribute DOMString name; [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; - readonly attribute boolean isSoftware; + readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); }; @@ -79,18 +80,23 @@ interface GPUAdapter { dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { sequence requiredFeatures = []; record requiredLimits = {}; + GPUQueueDescriptor defaultQueue = {}; }; enum GPUFeatureName { - "depth-clamping", + "depth-clip-control", "depth24unorm-stencil8", "depth32float-stencil8", - "pipeline-statistics-query", "texture-compression-bc", + "texture-compression-etc2", + "texture-compression-astc", "timestamp-query", + "indirect-first-instance", + "shader-f16", + "bgra8unorm-storage", }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; @@ -121,7 +127,7 @@ interface GPUDevice : EventTarget { }; GPUDevice includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUBuffer { Promise mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); @@ -139,7 +145,7 @@ dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { typedef [EnforceRange] unsigned long GPUBufferUsageFlags; [Exposed=(Window, DedicatedWorker)] -interface GPUBufferUsage { +namespace GPUBufferUsage { const GPUFlagsConstant MAP_READ = 0x0001; const GPUFlagsConstant MAP_WRITE = 0x0002; const GPUFlagsConstant COPY_SRC = 0x0004; @@ -154,12 +160,12 @@ interface GPUBufferUsage { typedef [EnforceRange] unsigned long GPUMapModeFlags; [Exposed=(Window, DedicatedWorker)] -interface GPUMapMode { +namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); @@ -174,6 +180,7 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { GPUTextureDimension dimension = "2d"; required GPUTextureFormat format; required GPUTextureUsageFlags usage; + sequence viewFormats = []; }; enum GPUTextureDimension { @@ -184,7 +191,7 @@ enum GPUTextureDimension { typedef [EnforceRange] unsigned long GPUTextureUsageFlags; [Exposed=(Window, DedicatedWorker)] -interface GPUTextureUsage { +namespace GPUTextureUsage { const GPUFlagsConstant COPY_SRC = 0x01; const GPUFlagsConstant COPY_DST = 0x02; const GPUFlagsConstant TEXTURE_BINDING = 0x04; @@ -192,7 +199,7 @@ interface GPUTextureUsage { const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUTextureView { }; GPUTextureView includes GPUObjectBase; @@ -213,13 +220,13 @@ enum GPUTextureViewDimension { "2d-array", "cube", "cube-array", - "3d" + "3d", }; enum GPUTextureAspect { "all", "stencil-only", - "depth-only" + "depth-only", }; enum GPUTextureFormat { @@ -270,13 +277,19 @@ enum GPUTextureFormat { "rgba32sint", "rgba32float", - // Depth and stencil formats + // Depth/stencil formats "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", + // "depth24unorm-stencil8" feature + "depth24unorm-stencil8", + + // "depth32float-stencil8" feature + "depth32float-stencil8", + // BC compressed formats usable if "texture-compression-bc" is both // supported by the device/user agent and enabled in requestDevice. "bc1-rgba-unorm", @@ -294,15 +307,54 @@ enum GPUTextureFormat { "bc7-rgba-unorm", "bc7-rgba-unorm-srgb", - // "depth24unorm-stencil8" feature - "depth24unorm-stencil8", - - // "depth32float-stencil8" feature - "depth32float-stencil8", -}; - -[Exposed=(Window, DedicatedWorker)] + // ETC2 compressed formats usable if "texture-compression-etc2" is both + // supported by the device/user agent and enabled in requestDevice. + "etc2-rgb8unorm", + "etc2-rgb8unorm-srgb", + "etc2-rgb8a1unorm", + "etc2-rgb8a1unorm-srgb", + "etc2-rgba8unorm", + "etc2-rgba8unorm-srgb", + "eac-r11unorm", + "eac-r11snorm", + "eac-rg11unorm", + "eac-rg11snorm", + + // ASTC compressed formats usable if "texture-compression-astc" is both + // supported by the device/user agent and enabled in requestDevice. + "astc-4x4-unorm", + "astc-4x4-unorm-srgb", + "astc-5x4-unorm", + "astc-5x4-unorm-srgb", + "astc-5x5-unorm", + "astc-5x5-unorm-srgb", + "astc-6x5-unorm", + "astc-6x5-unorm-srgb", + "astc-6x6-unorm", + "astc-6x6-unorm-srgb", + "astc-8x5-unorm", + "astc-8x5-unorm-srgb", + "astc-8x6-unorm", + "astc-8x6-unorm-srgb", + "astc-8x8-unorm", + "astc-8x8-unorm-srgb", + "astc-10x5-unorm", + "astc-10x5-unorm-srgb", + "astc-10x6-unorm", + "astc-10x6-unorm-srgb", + "astc-10x8-unorm", + "astc-10x8-unorm-srgb", + "astc-10x10-unorm", + "astc-10x10-unorm-srgb", + "astc-12x10-unorm", + "astc-12x10-unorm-srgb", + "astc-12x12-unorm", + "astc-12x12-unorm-srgb", +}; + +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUExternalTexture { + readonly attribute boolean expired; }; GPUExternalTexture includes GPUObjectBase; @@ -311,7 +363,7 @@ dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase { GPUPredefinedColorSpace colorSpace = "srgb"; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUSampler { }; GPUSampler includes GPUObjectBase; @@ -322,7 +374,7 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { GPUAddressMode addressModeW = "clamp-to-edge"; GPUFilterMode magFilter = "nearest"; GPUFilterMode minFilter = "nearest"; - GPUFilterMode mipmapFilter = "nearest"; + GPUMipmapFilterMode mipmapFilter = "nearest"; float lodMinClamp = 0; float lodMaxClamp = 32; GPUCompareFunction compare; @@ -332,12 +384,17 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { enum GPUAddressMode { "clamp-to-edge", "repeat", - "mirror-repeat" + "mirror-repeat", }; enum GPUFilterMode { "nearest", - "linear" + "linear", +}; + +enum GPUMipmapFilterMode { + "nearest", + "linear", }; enum GPUCompareFunction { @@ -348,10 +405,10 @@ enum GPUCompareFunction { "greater", "not-equal", "greater-equal", - "always" + "always", }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUBindGroupLayout { }; GPUBindGroupLayout includes GPUObjectBase; @@ -360,14 +417,6 @@ dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase { required sequence entries; }; -typedef [EnforceRange] unsigned long GPUShaderStageFlags; -[Exposed=(Window, DedicatedWorker)] -interface GPUShaderStage { - const GPUFlagsConstant VERTEX = 0x1; - const GPUFlagsConstant FRAGMENT = 0x2; - const GPUFlagsConstant COMPUTE = 0x4; -}; - dictionary GPUBindGroupLayoutEntry { required GPUIndex32 binding; required GPUShaderStageFlags visibility; @@ -379,6 +428,14 @@ dictionary GPUBindGroupLayoutEntry { GPUExternalTextureBindingLayout externalTexture; }; +typedef [EnforceRange] unsigned long GPUShaderStageFlags; +[Exposed=(Window, DedicatedWorker)] +namespace GPUShaderStage { + const GPUFlagsConstant VERTEX = 0x1; + const GPUFlagsConstant FRAGMENT = 0x2; + const GPUFlagsConstant COMPUTE = 0x4; +}; + enum GPUBufferBindingType { "uniform", "storage", @@ -402,11 +459,11 @@ dictionary GPUSamplerBindingLayout { }; enum GPUTextureSampleType { - "float", - "unfilterable-float", - "depth", - "sint", - "uint", + "float", + "unfilterable-float", + "depth", + "sint", + "uint", }; dictionary GPUTextureBindingLayout { @@ -428,7 +485,7 @@ dictionary GPUStorageTextureBindingLayout { dictionary GPUExternalTextureBindingLayout { }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUBindGroup { }; GPUBindGroup includes GPUObjectBase; @@ -451,7 +508,7 @@ dictionary GPUBufferBinding { GPUSize64 size; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUPipelineLayout { }; GPUPipelineLayout includes GPUObjectBase; @@ -460,7 +517,7 @@ dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { required sequence bindGroupLayouts; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUShaderModule { Promise compilationInfo(); }; @@ -469,15 +526,20 @@ GPUShaderModule includes GPUObjectBase; dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; object sourceMap; + record hints; +}; + +dictionary GPUShaderModuleCompilationHint { + required (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; enum GPUCompilationMessageType { "error", "warning", - "info" + "info", }; -[Exposed=(Window, DedicatedWorker), Serializable] +[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] interface GPUCompilationMessage { readonly attribute DOMString message; readonly attribute GPUCompilationMessageType type; @@ -487,17 +549,21 @@ interface GPUCompilationMessage { readonly attribute unsigned long long length; }; -[Exposed=(Window, DedicatedWorker), Serializable] +[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] interface GPUCompilationInfo { readonly attribute FrozenArray messages; }; +enum GPUAutoLayoutMode { + "auto", +}; + dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase { - GPUPipelineLayout layout; + required (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; interface mixin GPUPipelineBase { - GPUBindGroupLayout getBindGroupLayout(unsigned long index); + [NewObject] GPUBindGroupLayout getBindGroupLayout(unsigned long index); }; dictionary GPUProgrammableStage { @@ -506,9 +572,9 @@ dictionary GPUProgrammableStage { record constants; }; -typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32. +typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled. -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUComputePipeline { }; GPUComputePipeline includes GPUObjectBase; @@ -518,7 +584,7 @@ dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase { required GPUProgrammableStage compute; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderPipeline { }; GPURenderPipeline includes GPUObjectBase; @@ -532,33 +598,33 @@ dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { GPUFragmentState fragment; }; -enum GPUPrimitiveTopology { - "point-list", - "line-list", - "line-strip", - "triangle-list", - "triangle-strip" -}; - dictionary GPUPrimitiveState { GPUPrimitiveTopology topology = "triangle-list"; GPUIndexFormat stripIndexFormat; GPUFrontFace frontFace = "ccw"; GPUCullMode cullMode = "none"; - // Enable depth clamping (requires "depth-clamping" feature) - boolean clampDepth = false; + // Requires "depth-clip-control" feature. + boolean unclippedDepth = false; +}; + +enum GPUPrimitiveTopology { + "point-list", + "line-list", + "line-strip", + "triangle-list", + "triangle-strip", }; enum GPUFrontFace { "ccw", - "cw" + "cw", }; enum GPUCullMode { "none", "front", - "back" + "back", }; dictionary GPUMultisampleState { @@ -567,8 +633,8 @@ dictionary GPUMultisampleState { boolean alphaToCoverageEnabled = false; }; -dictionary GPUFragmentState: GPUProgrammableStage { - required sequence targets; +dictionary GPUFragmentState : GPUProgrammableStage { + required sequence targets; }; dictionary GPUColorTargetState { @@ -585,7 +651,7 @@ dictionary GPUBlendState { typedef [EnforceRange] unsigned long GPUColorWriteFlags; [Exposed=(Window, DedicatedWorker)] -interface GPUColorWrite { +namespace GPUColorWrite { const GPUFlagsConstant RED = 0x1; const GPUFlagsConstant GREEN = 0x2; const GPUFlagsConstant BLUE = 0x4; @@ -594,9 +660,9 @@ interface GPUColorWrite { }; dictionary GPUBlendComponent { + GPUBlendOperation operation = "add"; GPUBlendFactor srcFactor = "one"; GPUBlendFactor dstFactor = "zero"; - GPUBlendOperation operation = "add"; }; enum GPUBlendFactor { @@ -612,7 +678,7 @@ enum GPUBlendFactor { "one-minus-dst-alpha", "src-alpha-saturated", "constant", - "one-minus-constant" + "one-minus-constant", }; enum GPUBlendOperation { @@ -620,7 +686,7 @@ enum GPUBlendOperation { "subtract", "reverse-subtract", "min", - "max" + "max", }; dictionary GPUDepthStencilState { @@ -655,12 +721,12 @@ enum GPUStencilOperation { "increment-clamp", "decrement-clamp", "increment-wrap", - "decrement-wrap" + "decrement-wrap", }; enum GPUIndexFormat { "uint16", - "uint32" + "uint32", }; enum GPUVertexFormat { @@ -698,10 +764,10 @@ enum GPUVertexFormat { enum GPUVertexStepMode { "vertex", - "instance" + "instance", }; -dictionary GPUVertexState: GPUProgrammableStage { +dictionary GPUVertexState : GPUProgrammableStage { sequence buffers = []; }; @@ -718,16 +784,18 @@ dictionary GPUVertexAttribute { required GPUIndex32 shaderLocation; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandBuffer { - readonly attribute Promise executionTime; }; GPUCommandBuffer includes GPUObjectBase; dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker)] +interface mixin GPUCommandsMixin { +}; + +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); @@ -754,9 +822,10 @@ interface GPUCommandEncoder { GPUImageCopyTexture destination, GPUExtent3D copySize); - undefined pushDebugGroup(USVString groupLabel); - undefined popDebugGroup(); - undefined insertDebugMarker(USVString markerLabel); + undefined clearBuffer( + GPUBuffer buffer, + optional GPUSize64 offset = 0, + optional GPUSize64 size); undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); @@ -770,9 +839,10 @@ interface GPUCommandEncoder { GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); }; GPUCommandEncoder includes GPUObjectBase; +GPUCommandEncoder includes GPUCommandsMixin; +GPUCommandEncoder includes GPUDebugCommandsMixin; dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { - boolean measureExecutionTime = false; }; dictionary GPUImageDataLayout { @@ -800,9 +870,10 @@ dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture { dictionary GPUImageCopyExternalImage { required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source; GPUOrigin2D origin = {}; + boolean flipY = false; }; -interface mixin GPUProgrammablePassEncoder { +interface mixin GPUBindingCommandsMixin { undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, optional sequence dynamicOffsets = []); @@ -810,49 +881,45 @@ interface mixin GPUProgrammablePassEncoder { Uint32Array dynamicOffsetsData, GPUSize64 dynamicOffsetsDataStart, GPUSize32 dynamicOffsetsDataLength); +}; +interface mixin GPUDebugCommandsMixin { undefined pushDebugGroup(USVString groupLabel); undefined popDebugGroup(); undefined insertDebugMarker(USVString markerLabel); }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUComputePassEncoder { undefined setPipeline(GPUComputePipeline pipeline); - undefined dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1); - undefined dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); + undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); - undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex); - undefined endPipelineStatisticsQuery(); - - undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); - - undefined endPass(); + undefined end(); }; GPUComputePassEncoder includes GPUObjectBase; -GPUComputePassEncoder includes GPUProgrammablePassEncoder; +GPUComputePassEncoder includes GPUCommandsMixin; +GPUComputePassEncoder includes GPUDebugCommandsMixin; +GPUComputePassEncoder includes GPUBindingCommandsMixin; -dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { +enum GPUComputePassTimestampLocation { + "beginning", + "end", }; -interface mixin GPURenderEncoderBase { - undefined setPipeline(GPURenderPipeline pipeline); - - undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size); - undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size); +dictionary GPUComputePassTimestampWrite { + required GPUQuerySet querySet; + required GPUSize32 queryIndex; + required GPUComputePassTimestampLocation location; +}; - undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); - undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstIndex = 0, - optional GPUSignedOffset32 baseVertex = 0, - optional GPUSize32 firstInstance = 0); +typedef sequence GPUComputePassTimestampWrites; - undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); - undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); +dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { + GPUComputePassTimestampWrites timestampWrites = []; }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, float width, float height, @@ -867,60 +934,92 @@ interface GPURenderPassEncoder { undefined beginOcclusionQuery(GPUSize32 queryIndex); undefined endOcclusionQuery(); - undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex); - undefined endPipelineStatisticsQuery(); - - undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); - undefined executeBundles(sequence bundles); - undefined endPass(); + undefined end(); }; GPURenderPassEncoder includes GPUObjectBase; -GPURenderPassEncoder includes GPUProgrammablePassEncoder; -GPURenderPassEncoder includes GPURenderEncoderBase; +GPURenderPassEncoder includes GPUCommandsMixin; +GPURenderPassEncoder includes GPUDebugCommandsMixin; +GPURenderPassEncoder includes GPUBindingCommandsMixin; +GPURenderPassEncoder includes GPURenderCommandsMixin; + +enum GPURenderPassTimestampLocation { + "beginning", + "end", +}; + +dictionary GPURenderPassTimestampWrite { + required GPUQuerySet querySet; + required GPUSize32 queryIndex; + required GPURenderPassTimestampLocation location; +}; + +typedef sequence GPURenderPassTimestampWrites; dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { - required sequence colorAttachments; + required sequence colorAttachments; GPURenderPassDepthStencilAttachment depthStencilAttachment; GPUQuerySet occlusionQuerySet; + GPURenderPassTimestampWrites timestampWrites = []; }; dictionary GPURenderPassColorAttachment { required GPUTextureView view; GPUTextureView resolveTarget; - required (GPULoadOp or GPUColor) loadValue; + GPUColor clearValue; + required GPULoadOp loadOp; required GPUStoreOp storeOp; }; dictionary GPURenderPassDepthStencilAttachment { required GPUTextureView view; - required (GPULoadOp or float) depthLoadValue; - required GPUStoreOp depthStoreOp; + float depthClearValue = 0; + GPULoadOp depthLoadOp; + GPUStoreOp depthStoreOp; boolean depthReadOnly = false; - required (GPULoadOp or GPUStencilValue) stencilLoadValue; - required GPUStoreOp stencilStoreOp; + GPUStencilValue stencilClearValue = 0; + GPULoadOp stencilLoadOp; + GPUStoreOp stencilStoreOp; boolean stencilReadOnly = false; }; enum GPULoadOp { - "load" + "load", + "clear", }; enum GPUStoreOp { "store", - "discard" + "discard", }; dictionary GPURenderPassLayout: GPUObjectDescriptorBase { - required sequence colorFormats; + required sequence colorFormats; GPUTextureFormat depthStencilFormat; GPUSize32 sampleCount = 1; }; -[Exposed=(Window, DedicatedWorker)] +interface mixin GPURenderCommandsMixin { + undefined setPipeline(GPURenderPipeline pipeline); + + undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size); + undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size); + + undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); + undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstIndex = 0, + optional GPUSignedOffset32 baseVertex = 0, + optional GPUSize32 firstInstance = 0); + + undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); +}; + +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderBundle { }; GPURenderBundle includes GPUObjectBase; @@ -928,20 +1027,25 @@ GPURenderBundle includes GPUObjectBase; dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderBundleEncoder { GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; GPURenderBundleEncoder includes GPUObjectBase; -GPURenderBundleEncoder includes GPUProgrammablePassEncoder; -GPURenderBundleEncoder includes GPURenderEncoderBase; +GPURenderBundleEncoder includes GPUCommandsMixin; +GPURenderBundleEncoder includes GPUDebugCommandsMixin; +GPURenderBundleEncoder includes GPUBindingCommandsMixin; +GPURenderBundleEncoder includes GPURenderCommandsMixin; dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout { boolean depthReadOnly = false; boolean stencilReadOnly = false; }; -[Exposed=(Window, DedicatedWorker)] +dictionary GPUQueueDescriptor : GPUObjectDescriptorBase { +}; + +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUQueue { undefined submit(sequence commandBuffers); @@ -955,10 +1059,10 @@ interface GPUQueue { optional GPUSize64 size); undefined writeTexture( - GPUImageCopyTexture destination, - [AllowShared] BufferSource data, - GPUImageDataLayout dataLayout, - GPUExtent3D size); + GPUImageCopyTexture destination, + [AllowShared] BufferSource data, + GPUImageDataLayout dataLayout, + GPUExtent3D size); undefined copyExternalImageToTexture( GPUImageCopyExternalImage source, @@ -967,7 +1071,7 @@ interface GPUQueue { }; GPUQueue includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUQuerySet { undefined destroy(); }; @@ -976,31 +1080,20 @@ GPUQuerySet includes GPUObjectBase; dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase { required GPUQueryType type; required GPUSize32 count; - sequence pipelineStatistics = []; }; enum GPUQueryType { "occlusion", - "pipeline-statistics", - "timestamp" -}; - -enum GPUPipelineStatisticName { - "vertex-shader-invocations", - "clipper-invocations", - "clipper-primitives-out", - "fragment-shader-invocations", - "compute-shader-invocations" + "timestamp", }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCanvasContext { readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; undefined configure(GPUCanvasConfiguration configuration); undefined unconfigure(); - GPUTextureFormat getPreferredFormat(GPUAdapter adapter); GPUTexture getCurrentTexture(); }; @@ -1013,16 +1106,16 @@ dictionary GPUCanvasConfiguration { required GPUDevice device; required GPUTextureFormat format; GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT + sequence viewFormats = []; GPUPredefinedColorSpace colorSpace = "srgb"; GPUCanvasCompositingAlphaMode compositingAlphaMode = "opaque"; - GPUExtent3D size; }; enum GPUDeviceLostReason { "destroyed", }; -[Exposed=(Window, DedicatedWorker)] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUDeviceLostInfo { readonly attribute (GPUDeviceLostReason or undefined) reason; readonly attribute DOMString message; @@ -1034,36 +1127,35 @@ partial interface GPUDevice { enum GPUErrorFilter { "out-of-memory", - "validation" -}; - -[Exposed=(Window, DedicatedWorker)] -interface GPUOutOfMemoryError { - constructor(); + "validation", }; -[Exposed=(Window, DedicatedWorker)] -interface GPUValidationError { +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUError { constructor(DOMString message); readonly attribute DOMString message; }; -typedef (GPUOutOfMemoryError or GPUValidationError) GPUError; +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUOutOfMemoryError : GPUError { +}; + +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUValidationError : GPUError { +}; partial interface GPUDevice { undefined pushErrorScope(GPUErrorFilter filter); Promise popErrorScope(); }; -[ - Exposed=(Window, DedicatedWorker) -] +[Exposed=(Window, DedicatedWorker), SecureContext] interface GPUUncapturedErrorEvent : Event { constructor( DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict ); - [SameObject] readonly attribute GPUError error; + readonly attribute GPUError error; }; dictionary GPUUncapturedErrorEventInit : EventInit { From c2c25d0be3f6df588b6d11a42dfc2edc36bb7657 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 26 May 2022 16:35:51 +0200 Subject: [PATCH 016/641] Add an IDL file for the WebXR Gamepads Module (#2914) * Add new gamepad idl * Generate code --- crates/web-sys/src/features/gen_XrInputSource.rs | 12 ++++++++++++ .../webidls/unstable/WebXRGamepadsModule.webidl | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 crates/web-sys/webidls/unstable/WebXRGamepadsModule.webidl diff --git a/crates/web-sys/src/features/gen_XrInputSource.rs b/crates/web-sys/src/features/gen_XrInputSource.rs index 739ea37a492..f20c5e4d621 100644 --- a/crates/web-sys/src/features/gen_XrInputSource.rs +++ b/crates/web-sys/src/features/gen_XrInputSource.rs @@ -74,4 +74,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn profiles(this: &XrInputSource) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Gamepad")] + # [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = gamepad)] + #[doc = "Getter for the `gamepad` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/gamepad)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `XrInputSource`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn gamepad(this: &XrInputSource) -> Option; } diff --git a/crates/web-sys/webidls/unstable/WebXRGamepadsModule.webidl b/crates/web-sys/webidls/unstable/WebXRGamepadsModule.webidl new file mode 100644 index 00000000000..39db79b5474 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebXRGamepadsModule.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * WebXR Device API + * W3C Working Draft, 31 March 2022 + * The origin of this IDL file is: + * https://www.w3.org/TR/2022/WD-webxr-gamepads-module-1-20220426/ + */ + +partial interface XRInputSource { + [SameObject] readonly attribute Gamepad? gamepad; +}; From be961acaca686641fae1aee49bb20924ddba9f45 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 26 May 2022 17:31:30 -0400 Subject: [PATCH 017/641] feat(cli-support): expose more properties on `Output` (#2913) --- crates/cli-support/src/lib.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index d767be55d7e..f902a40b89d 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -611,9 +611,38 @@ fn unexported_unused_lld_things(module: &mut Module) { impl Output { pub fn js(&self) -> &str { + &self.gen().js + } + + pub fn ts(&self) -> Option<&str> { + let gen = self.gen(); + if gen.typescript { + Some(&gen.ts) + } else { + None + } + } + + pub fn start(&self) -> Option<&String> { + self.gen().start.as_ref() + } + + pub fn snippets(&self) -> &HashMap> { + &self.gen().snippets + } + + pub fn local_modules(&self) -> &HashMap { + &self.gen().local_modules + } + + pub fn npm_dependencies(&self) -> &HashMap { + &self.gen().npm_dependencies + } + + fn gen(&self) -> &JsGenerated { match &self.generated { Generated::InterfaceTypes => panic!("no js with interface types output"), - Generated::Js(gen) => &gen.js, + Generated::Js(gen) => &gen, } } From 6ec0ce1b3fe955d102926da741964329f82e80a3 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Tue, 31 May 2022 16:23:38 +0200 Subject: [PATCH 018/641] test(ci) Remove duplicate actions. (#2918) I was wondering if running `cargo test --target wasm32-unknown-unknown` _twice_ is necessary. If not, please discard this commit. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ee54dbc5bb..f2bb58f6d95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,6 @@ jobs: node-version: '16' - uses: ./.github/actions/setup-geckodriver - run: cargo test --target wasm32-unknown-unknown - - run: cargo test --target wasm32-unknown-unknown - run: cargo test --target wasm32-unknown-unknown --features serde-serialize - run: cargo test --target wasm32-unknown-unknown --features enable-interning - run: cargo test --target wasm32-unknown-unknown -p no-std From 96eca588e6a647e33bdd3944f0502bb324369ffc Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Tue, 31 May 2022 16:25:27 +0200 Subject: [PATCH 019/641] fix(typescript) Getters correctly define the inner results. (#2909) * fix(typescript) Getters correctly define the inner results. This patch fixes https://github.com/rustwasm/wasm-bindgen/issues/2721. Let's consider the following example: ```rust pub struct Foo { /// Hello `first`. pub first: u32, /// Hello `second`. #[wasm_bindgen(readonly)] pub second: u32, } ``` It outputs the following `.d.ts` file: ```typescript export class Foo { free(): void; /** * Hello `first`. */ first: number; /** * Hello `second`. */ readonly second: void; } ``` What's wrong here is that `second` has the type `void`. It should be `number`. What's happening? For `Foo.first`, a getter and a setter are generated. The getter never has a return type (spoiler: that's the bug), but the setter has a correct return type somehow (it's infererd from its arguments, combined with a unit descriptor, see `wasm_bindgen_cli_support::wit::Context::struct_`). When the getter and the setter are processed, they both end up calling `wasm_bindgen_cli_support::js::ExportedClass::push_accessor_ts`. This function overwrites the return type for the same field everytime it is called. So when called for the getter, the return type is missing, and when called for the setter with a type, the bug is fixed. For `Foo.second`, it's different. There is no setter generated because the field is marked as `readonly`. So the bug appears. To fix that, I've updated the getter `Function` descriptor, so that it has an `inner_ret` value. This is passed to an `Adapter.inner_results` at some point in the code, which is finally passed by `JsFunction::process` to `JsFunction::typescript_signature` to generate the typescript signature. And suddently, it's fixed! However, we got: ```typescript export class Foo { free(): void; /** * Hello `first`. * @returns {number} */ first: number; /** * Hello `second`. * @returns {number} */ readonly second: number; } ``` We're making progress! Nonetheless, the documentation is wrong now: The fields don't return anything. This problem comes from the way `js_docs` is computed globally for all export kinds in `wasm_bindgen_cli_support::js::Context::generate_adapter`. This patch also updates that to compute `js_docs` lately, for each branch. It is specialized in the `AuxExportKind::Getter` and `AuxExportKind::Setter` branches. I hope this is the correct approach. I'm not sure about the difference between `Adapter.results` and `Adapter.inner_results` as there is no documentation unfortunately (kudos for every other super-well documented place though). * test(typescript) Test readonly struct fields have correct types. --- crates/cli-support/src/js/binding.rs | 1 + crates/cli-support/src/js/mod.rs | 8 +++++++- crates/cli-support/src/wit/mod.rs | 2 +- .../typescript-tests/src/getters_setters.rs | 19 +++++++++++++++++++ .../typescript-tests/src/getters_setters.ts | 4 ++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 50931ea9300..c5eda1c9e79 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -229,6 +229,7 @@ impl<'a, 'b> Builder<'a, 'b> { asyncness, ); let js_doc = self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty); + Ok(JsFunction { code, ts_sig, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index d0ae901a98d..8c7e1bb01f6 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2521,9 +2521,10 @@ impl<'a> Context<'a> { false => None, }; - let docs = format_doc_comments(&export.comments, Some(js_doc)); match &export.kind { AuxExportKind::Function(name) => { + let docs = format_doc_comments(&export.comments, Some(js_doc)); + if let Some(ts_sig) = ts_sig { self.typescript.push_str(&docs); self.typescript.push_str("export function "); @@ -2535,6 +2536,7 @@ impl<'a> Context<'a> { self.globals.push_str("\n"); } AuxExportKind::Constructor(class) => { + let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); if exported.has_constructor { bail!("found duplicate constructor for class `{}`", class); @@ -2543,6 +2545,7 @@ impl<'a> Context<'a> { exported.push(&docs, "constructor", "", &code, ts_sig); } AuxExportKind::Getter { class, field, .. } => { + let docs = format_doc_comments(&export.comments, None); let ret_ty = match export.generate_typescript { true => match &ts_ret_ty { Some(s) => Some(s.as_str()), @@ -2554,6 +2557,7 @@ impl<'a> Context<'a> { exported.push_getter(&docs, field, &code, ret_ty); } AuxExportKind::Setter { class, field, .. } => { + let docs = format_doc_comments(&export.comments, None); let arg_ty = match export.generate_typescript { true => Some(ts_arg_tys[0].as_str()), false => None, @@ -2562,10 +2566,12 @@ impl<'a> Context<'a> { exported.push_setter(&docs, field, &code, arg_ty, might_be_optional_field); } AuxExportKind::StaticFunction { class, name } => { + let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); exported.push(&docs, name, "static ", &code, ts_sig); } AuxExportKind::Method { class, name, .. } => { + let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); exported.push(&docs, name, "", &code, ts_sig); } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 529c5a5c362..ee36d7edbfe 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -806,7 +806,7 @@ impl<'a> Context<'a> { arguments: vec![Descriptor::I32], shim_idx: 0, ret: descriptor.clone(), - inner_ret: None, + inner_ret: Some(descriptor.clone()), }; let getter_id = self.export_adapter(getter_id, getter_descriptor)?; self.aux.export_map.insert( diff --git a/crates/typescript-tests/src/getters_setters.rs b/crates/typescript-tests/src/getters_setters.rs index f2206ab3ce0..2895a639433 100644 --- a/crates/typescript-tests/src/getters_setters.rs +++ b/crates/typescript-tests/src/getters_setters.rs @@ -66,3 +66,22 @@ impl ColorWithGetterAndSetter { }; } } + +#[wasm_bindgen] +pub struct ColorWithReadonly { + #[wasm_bindgen(readonly)] + pub r: f64, + #[wasm_bindgen(readonly)] + pub g: f64, + #[wasm_bindgen(readonly)] + pub b: f64, + pub a: u8, +} + +#[wasm_bindgen] +impl ColorWithReadonly { + #[wasm_bindgen(constructor)] + pub fn new(r: f64, g: f64, b: f64) -> ColorWithReadonly { + Self { r, b, g, a: 0 } + } +} diff --git a/crates/typescript-tests/src/getters_setters.ts b/crates/typescript-tests/src/getters_setters.ts index 1c1a59783b4..5ff7abc9b37 100644 --- a/crates/typescript-tests/src/getters_setters.ts +++ b/crates/typescript-tests/src/getters_setters.ts @@ -9,3 +9,7 @@ colorWithSetter.r = 1; const colorWithGetterAndSetter: wbg.ColorWithGetterAndSetter = new wbg.ColorWithGetterAndSetter; colorWithGetterAndSetter.r = 1; const _b = colorWithGetterAndSetter.r; + +const colorWithReadonly: wbg.ColorWithReadonly = new wbg.ColorWithReadonly(1, 2, 3); +const _r: number = colorWithReadonly.r; +colorWithReadonly.a = 4; From cbcf3e78ac1e17884cceb855fced173ddde37020 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 31 May 2022 10:45:51 -0400 Subject: [PATCH 020/641] feat(cli-support): `Bindgen` - support providing bytes input (#2916) * feat(cli-support): Bindgen - support providing bytes as input * Format. * Remove needless assignment --- crates/cli-support/src/lib.rs | 56 ++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index f902a40b89d..e77137c941a 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -81,6 +81,7 @@ enum OutputMode { enum Input { Path(PathBuf), Module(Module, String), + Bytes(Vec, String), None, } @@ -147,6 +148,13 @@ impl Bindgen { return self; } + /// Specify the input as the provided Wasm bytes. + pub fn input_bytes(&mut self, name: &str, bytes: Vec) -> &mut Bindgen { + let name = name.to_string(); + self.input = Input::Bytes(bytes, name); + return self; + } + fn switch_mode(&mut self, mode: OutputMode, flag: &str) -> Result<(), Error> { match self.mode { OutputMode::Bundler { .. } => self.mode = mode, @@ -296,7 +304,7 @@ impl Bindgen { pub fn stem(&self) -> Result<&str, Error> { Ok(match &self.input { Input::None => bail!("must have an input by now"), - Input::Module(_, name) => name, + Input::Module(_, name) | Input::Bytes(_, name) => name, Input::Path(path) => match &self.out_name { Some(name) => name, None => path.file_stem().unwrap().to_str().unwrap(), @@ -312,26 +320,15 @@ impl Bindgen { mem::replace(m, blank_module) } Input::Path(ref path) => { - let wasm = wit_text::parse_file(&path) - .with_context(|| format!("failed to read `{}`", path.display()))?; - wit_validator::validate(&wasm) - .with_context(|| format!("failed to validate `{}`", path.display()))?; - let module = walrus::ModuleConfig::new() - // Skip validation of the module as LLVM's output is - // generally already well-formed and so we won't gain much - // from re-validating. Additionally LLVM's current output - // for threads includes atomic instructions but doesn't - // include shared memory, so it fails that part of - // validation! - .strict_validate(false) - .generate_dwarf(self.keep_debug) - .generate_name_section(!self.remove_name_section) - .generate_producers_section(!self.remove_producers_section) - .on_parse(wit_walrus::on_parse) - .parse(&wasm) - .context("failed to parse input file as wasm")?; - module + let bytes = std::fs::read(path) + .with_context(|| format!("failed reading '{}'", path.display()))?; + self.module_from_bytes(&bytes).with_context(|| { + format!("failed getting Wasm module for '{}'", path.display()) + })? } + Input::Bytes(ref bytes, _) => self + .module_from_bytes(&bytes) + .context("failed getting Wasm module")?, }; self.threads @@ -466,6 +463,25 @@ impl Bindgen { }) } + fn module_from_bytes(&self, bytes: &[u8]) -> Result { + let wasm = wit_text::parse_bytes(bytes).context("failed to parse bytes")?; + wit_validator::validate(&wasm).context("failed to validate")?; + walrus::ModuleConfig::new() + // Skip validation of the module as LLVM's output is + // generally already well-formed and so we won't gain much + // from re-validating. Additionally LLVM's current output + // for threads includes atomic instructions but doesn't + // include shared memory, so it fails that part of + // validation! + .strict_validate(false) + .generate_dwarf(self.keep_debug) + .generate_name_section(!self.remove_name_section) + .generate_producers_section(!self.remove_producers_section) + .on_parse(wit_walrus::on_parse) + .parse(&wasm) + .context("failed to parse input as wasm") + } + fn local_module_name(&self, module: &str) -> String { format!("./snippets/{}", module) } From a81983b884970778836f7a43ef5ea40f67b8ceb2 Mon Sep 17 00:00:00 2001 From: Samuel V Date: Thu, 2 Jun 2022 13:07:53 -0500 Subject: [PATCH 021/641] add SubmitEvent to web_sys Event types (#2922) --- .../web-sys/src/features/gen_SubmitEvent.rs | 40 ++++++++ .../src/features/gen_SubmitEventInit.rs | 96 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 12 +++ .../webidls/enabled/SubmitEvent.webidl | 18 ++++ 4 files changed, 166 insertions(+) create mode 100644 crates/web-sys/src/features/gen_SubmitEvent.rs create mode 100644 crates/web-sys/src/features/gen_SubmitEventInit.rs create mode 100644 crates/web-sys/webidls/enabled/SubmitEvent.webidl diff --git a/crates/web-sys/src/features/gen_SubmitEvent.rs b/crates/web-sys/src/features/gen_SubmitEvent.rs new file mode 100644 index 00000000000..3caca43f252 --- /dev/null +++ b/crates/web-sys/src/features/gen_SubmitEvent.rs @@ -0,0 +1,40 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = SubmitEvent , typescript_type = "SubmitEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SubmitEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEvent`*"] + pub type SubmitEvent; + #[cfg(feature = "HtmlElement")] + # [wasm_bindgen (structural , method , getter , js_class = "SubmitEvent" , js_name = submitter)] + #[doc = "Getter for the `submitter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/submitter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEvent`*"] + pub fn submitter(this: &SubmitEvent) -> Option; + #[wasm_bindgen(catch, constructor, js_class = "SubmitEvent")] + #[doc = "The `new SubmitEvent(..)` constructor, creating a new instance of `SubmitEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/SubmitEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEvent`*"] + pub fn new(type_: &str) -> Result; + #[cfg(feature = "SubmitEventInit")] + #[wasm_bindgen(catch, constructor, js_class = "SubmitEvent")] + #[doc = "The `new SubmitEvent(..)` constructor, creating a new instance of `SubmitEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/SubmitEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEvent`, `SubmitEventInit`*"] + pub fn new_with_event_init_dict( + type_: &str, + event_init_dict: &SubmitEventInit, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_SubmitEventInit.rs b/crates/web-sys/src/features/gen_SubmitEventInit.rs new file mode 100644 index 00000000000..6c5844f69d7 --- /dev/null +++ b/crates/web-sys/src/features/gen_SubmitEventInit.rs @@ -0,0 +1,96 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SubmitEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SubmitEventInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + pub type SubmitEventInit; +} +impl SubmitEventInit { + #[doc = "Construct a new `SubmitEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bubbles"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("cancelable"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + pub fn composed(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("composed"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "HtmlElement")] + #[doc = "Change the `submitter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEventInit`*"] + pub fn submitter(&mut self, val: Option<&HtmlElement>) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("submitter"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for SubmitEventInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index a9cf9d211c3..b3cb8763864 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -6742,6 +6742,18 @@ mod gen_StyleSheetList; #[cfg(feature = "StyleSheetList")] pub use gen_StyleSheetList::*; +#[cfg(feature = "SubmitEvent")] +#[allow(non_snake_case)] +mod gen_SubmitEvent; +#[cfg(feature = "SubmitEvent")] +pub use gen_SubmitEvent::*; + +#[cfg(feature = "SubmitEventInit")] +#[allow(non_snake_case)] +mod gen_SubmitEventInit; +#[cfg(feature = "SubmitEventInit")] +pub use gen_SubmitEventInit::*; + #[cfg(feature = "SubtleCrypto")] #[allow(non_snake_case)] mod gen_SubtleCrypto; diff --git a/crates/web-sys/webidls/enabled/SubmitEvent.webidl b/crates/web-sys/webidls/enabled/SubmitEvent.webidl new file mode 100644 index 00000000000..cf047e93114 --- /dev/null +++ b/crates/web-sys/webidls/enabled/SubmitEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent + */ + +[Constructor(DOMString type, optional SubmitEventInit eventInitDict), + Exposed=(Window)] +interface SubmitEvent : Event { + readonly attribute HTMLElement? submitter; +}; + +dictionary SubmitEventInit : EventInit { + HTMLElement? submitter = null; +}; From 0c7126c9c3d0c4c149f961b5767ed9207a66753d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 4 Jun 2022 00:53:47 +1000 Subject: [PATCH 022/641] Use `bigint` instead of `BigInt` in generated TypeScript (#2925) Fixes #2911 --- crates/cli-support/src/js/binding.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index c5eda1c9e79..d2a52eebe7a 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -1304,7 +1304,7 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String) { | AdapterType::U32 | AdapterType::F32 | AdapterType::F64 => dst.push_str("number"), - AdapterType::I64 | AdapterType::S64 | AdapterType::U64 => dst.push_str("BigInt"), + AdapterType::I64 | AdapterType::S64 | AdapterType::U64 => dst.push_str("bigint"), AdapterType::String => dst.push_str("string"), AdapterType::Externref => dst.push_str("any"), AdapterType::Bool => dst.push_str("boolean"), From b7b4ef3fd4300fbcc0606c3bebdaa5f13ec010e8 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Mon, 6 Jun 2022 14:06:48 -0400 Subject: [PATCH 023/641] Add mediasession api (#2926) * Added MediaSession API to web-sys * Added WebIDL inclusion instructions to web-sys README --- crates/web-sys/Cargo.toml | 8 ++ crates/web-sys/README.md | 18 +++ crates/web-sys/src/features/gen_MediaImage.rs | 82 +++++++++++ .../web-sys/src/features/gen_MediaMetadata.rs | 129 ++++++++++++++++++ .../src/features/gen_MediaMetadataInit.rs | 109 +++++++++++++++ .../src/features/gen_MediaPositionState.rs | 99 ++++++++++++++ .../web-sys/src/features/gen_MediaSession.rs | 127 +++++++++++++++++ .../src/features/gen_MediaSessionAction.rs | 25 ++++ .../features/gen_MediaSessionActionDetails.rs | 114 ++++++++++++++++ .../features/gen_MediaSessionPlaybackState.rs | 16 +++ crates/web-sys/src/features/gen_Navigator.rs | 12 ++ crates/web-sys/src/features/mod.rs | 48 +++++++ .../webidls/unstable/MediaSession.webidl | 77 +++++++++++ 13 files changed, 864 insertions(+) create mode 100644 crates/web-sys/src/features/gen_MediaImage.rs create mode 100644 crates/web-sys/src/features/gen_MediaMetadata.rs create mode 100644 crates/web-sys/src/features/gen_MediaMetadataInit.rs create mode 100644 crates/web-sys/src/features/gen_MediaPositionState.rs create mode 100644 crates/web-sys/src/features/gen_MediaSession.rs create mode 100644 crates/web-sys/src/features/gen_MediaSessionAction.rs create mode 100644 crates/web-sys/src/features/gen_MediaSessionActionDetails.rs create mode 100644 crates/web-sys/src/features/gen_MediaSessionPlaybackState.rs create mode 100644 crates/web-sys/webidls/unstable/MediaSession.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 42ccfc8012d..1911a0fa7ee 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -740,6 +740,7 @@ MediaEncodingConfiguration = [] MediaEncodingType = [] MediaEncryptedEvent = ["Event"] MediaError = [] +MediaImage = [] MediaKeyError = ["Event"] MediaKeyMessageEvent = ["Event"] MediaKeyMessageEventInit = [] @@ -757,6 +758,9 @@ MediaKeys = [] MediaKeysPolicy = [] MediaKeysRequirement = [] MediaList = [] +MediaMetadata = [] +MediaMetadataInit = [] +MediaPositionState = [] MediaQueryList = ["EventTarget"] MediaQueryListEvent = ["Event"] MediaQueryListEventInit = [] @@ -764,6 +768,10 @@ MediaRecorder = ["EventTarget"] MediaRecorderErrorEvent = ["Event"] MediaRecorderErrorEventInit = [] MediaRecorderOptions = [] +MediaSession = [] +MediaSessionAction = [] +MediaSessionActionDetails = [] +MediaSessionPlaybackState = [] MediaSource = ["EventTarget"] MediaSourceEndOfStreamError = [] MediaSourceEnum = [] diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index ed6892e6604..cfbb3517f43 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -14,3 +14,21 @@ found in `crates/web-sys/Cargo.toml`, but the rule of thumb for `web-sys` is that each type has its own cargo feature (named after the type). Using an API requires enabling the features for all types used in the API, and APIs should mention in the documentation what features they require. + +## How to add an interface + +If you don't see a particular web API in `web-sys`, here is how to add it. + +1. Copy the WebIDL specification of the API and place it in a new file in the + `webidls/unstable` folder. You can often find the IDL by going to the MDN + docs page for the API, scrolling to the bottom, clicking the + "Specifications" link, and scrolling to the bottom of the specification + page. For example, the bottom of the [MDN + docs](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession) on the + MediaSession API takes you to the + [spec](https://w3c.github.io/mediasession/#the-mediasession-interface). The + [very bottom](https://w3c.github.io/mediasession/#idl-index) of _that_ page + is the IDL. +2. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features` +3. Copy the contents of `features` into the `[features]` section of `Cargo.toml` +4. Run `git add .` to add all the generated files into git. diff --git a/crates/web-sys/src/features/gen_MediaImage.rs b/crates/web-sys/src/features/gen_MediaImage.rs new file mode 100644 index 00000000000..5a58a88bc4a --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaImage.rs @@ -0,0 +1,82 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaImage)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaImage` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaImage; +} +#[cfg(web_sys_unstable_apis)] +impl MediaImage { + #[doc = "Construct a new `MediaImage`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(src: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.src(src); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sizes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn sizes(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sizes"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `src` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn src(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("src"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn type_(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_MediaMetadata.rs b/crates/web-sys/src/features/gen_MediaMetadata.rs new file mode 100644 index 00000000000..6911f663ceb --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaMetadata.rs @@ -0,0 +1,129 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaMetadata , typescript_type = "MediaMetadata")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaMetadata` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaMetadata; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "MediaMetadata" , js_name = title)] + #[doc = "Getter for the `title` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/title)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn title(this: &MediaMetadata) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = title)] + #[doc = "Setter for the `title` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/title)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_title(this: &MediaMetadata, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "MediaMetadata" , js_name = artist)] + #[doc = "Getter for the `artist` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/artist)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn artist(this: &MediaMetadata) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = artist)] + #[doc = "Setter for the `artist` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/artist)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_artist(this: &MediaMetadata, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "MediaMetadata" , js_name = album)] + #[doc = "Getter for the `album` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/album)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn album(this: &MediaMetadata) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = album)] + #[doc = "Setter for the `album` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/album)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_album(this: &MediaMetadata, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "MediaMetadata" , js_name = artwork)] + #[doc = "Getter for the `artwork` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/artwork)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn artwork(this: &MediaMetadata) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = artwork)] + #[doc = "Setter for the `artwork` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/artwork)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_artwork(this: &MediaMetadata, value: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "MediaMetadata")] + #[doc = "The `new MediaMetadata(..)` constructor, creating a new instance of `MediaMetadata`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/MediaMetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaMetadataInit")] + #[wasm_bindgen(catch, constructor, js_class = "MediaMetadata")] + #[doc = "The `new MediaMetadata(..)` constructor, creating a new instance of `MediaMetadata`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaMetadata/MediaMetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`, `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_init(init: &MediaMetadataInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_MediaMetadataInit.rs b/crates/web-sys/src/features/gen_MediaMetadataInit.rs new file mode 100644 index 00000000000..4551618b585 --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaMetadataInit.rs @@ -0,0 +1,109 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaMetadataInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaMetadataInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaMetadataInit; +} +#[cfg(web_sys_unstable_apis)] +impl MediaMetadataInit { + #[doc = "Construct a new `MediaMetadataInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `album` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn album(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("album"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `artist` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn artist(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("artist"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `artwork` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn artwork(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("artwork"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn title(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for MediaMetadataInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_MediaPositionState.rs b/crates/web-sys/src/features/gen_MediaPositionState.rs new file mode 100644 index 00000000000..452f445cede --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaPositionState.rs @@ -0,0 +1,99 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaPositionState)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaPositionState` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaPositionState; +} +#[cfg(web_sys_unstable_apis)] +impl MediaPositionState { + #[doc = "Construct a new `MediaPositionState`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn duration(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("duration"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `playbackRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn playback_rate(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("playbackRate"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `position` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn position(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("position"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for MediaPositionState { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_MediaSession.rs b/crates/web-sys/src/features/gen_MediaSession.rs new file mode 100644 index 00000000000..5f50eec8c4d --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaSession.rs @@ -0,0 +1,127 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaSession , typescript_type = "MediaSession")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaSession` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaSession; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaMetadata")] + # [wasm_bindgen (structural , method , getter , js_class = "MediaSession" , js_name = metadata)] + #[doc = "Getter for the `metadata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/metadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`, `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn metadata(this: &MediaSession) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaMetadata")] + # [wasm_bindgen (structural , method , setter , js_class = "MediaSession" , js_name = metadata)] + #[doc = "Setter for the `metadata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/metadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadata`, `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_metadata(this: &MediaSession, value: Option<&MediaMetadata>); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSessionPlaybackState")] + # [wasm_bindgen (structural , method , getter , js_class = "MediaSession" , js_name = playbackState)] + #[doc = "Getter for the `playbackState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/playbackState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`, `MediaSessionPlaybackState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn playback_state(this: &MediaSession) -> MediaSessionPlaybackState; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSessionPlaybackState")] + # [wasm_bindgen (structural , method , setter , js_class = "MediaSession" , js_name = playbackState)] + #[doc = "Setter for the `playbackState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/playbackState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`, `MediaSessionPlaybackState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_playback_state(this: &MediaSession, value: MediaSessionPlaybackState); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSessionAction")] + # [wasm_bindgen (method , structural , js_class = "MediaSession" , js_name = setActionHandler)] + #[doc = "The `setActionHandler()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/setActionHandler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`, `MediaSessionAction`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_action_handler( + this: &MediaSession, + action: MediaSessionAction, + handler: Option<&::js_sys::Function>, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "MediaSession" , js_name = setCameraActive)] + #[doc = "The `setCameraActive()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/setCameraActive)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_camera_active(this: &MediaSession, active: bool); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "MediaSession" , js_name = setMicrophoneActive)] + #[doc = "The `setMicrophoneActive()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/setMicrophoneActive)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_microphone_active(this: &MediaSession, active: bool); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "MediaSession" , js_name = setPositionState)] + #[doc = "The `setPositionState()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/setPositionState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_position_state(this: &MediaSession); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaPositionState")] + # [wasm_bindgen (method , structural , js_class = "MediaSession" , js_name = setPositionState)] + #[doc = "The `setPositionState()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/setPositionState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`, `MediaSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_position_state_with_state(this: &MediaSession, state: &MediaPositionState); +} diff --git a/crates/web-sys/src/features/gen_MediaSessionAction.rs b/crates/web-sys/src/features/gen_MediaSessionAction.rs new file mode 100644 index 00000000000..b25bf3065e2 --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaSessionAction.rs @@ -0,0 +1,25 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `MediaSessionAction` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `MediaSessionAction`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum MediaSessionAction { + Play = "play", + Pause = "pause", + Seekbackward = "seekbackward", + Seekforward = "seekforward", + Previoustrack = "previoustrack", + Nexttrack = "nexttrack", + Skipad = "skipad", + Stop = "stop", + Seekto = "seekto", + Togglemicrophone = "togglemicrophone", + Togglecamera = "togglecamera", + Hangup = "hangup", +} diff --git a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs new file mode 100644 index 00000000000..f530e8f985f --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs @@ -0,0 +1,114 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaSessionActionDetails)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaSessionActionDetails` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaSessionActionDetails; +} +#[cfg(web_sys_unstable_apis)] +impl MediaSessionActionDetails { + #[cfg(feature = "MediaSessionAction")] + #[doc = "Construct a new `MediaSessionActionDetails`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionAction`, `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(action: MediaSessionAction) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.action(action); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSessionAction")] + #[doc = "Change the `action` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionAction`, `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn action(&mut self, val: MediaSessionAction) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("action"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `fastSeek` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fast_seek(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("fastSeek"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `seekOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn seek_offset(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("seekOffset"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `seekTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn seek_time(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("seekTime"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_MediaSessionPlaybackState.rs b/crates/web-sys/src/features/gen_MediaSessionPlaybackState.rs new file mode 100644 index 00000000000..77ea9df5904 --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaSessionPlaybackState.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `MediaSessionPlaybackState` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `MediaSessionPlaybackState`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum MediaSessionPlaybackState { + None = "none", + Paused = "paused", + Playing = "playing", +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 19e76045e3c..902d8816f81 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -129,6 +129,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn clipboard(this: &Navigator) -> Option; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSession")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = mediaSession)] + #[doc = "Getter for the `mediaSession` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mediaSession)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSession`, `Navigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn media_session(this: &Navigator) -> MediaSession; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WakeLock")] # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = wakeLock)] #[doc = "Getter for the `wakeLock` field of this object."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index b3cb8763864..c18588a32e1 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4258,6 +4258,12 @@ mod gen_MediaError; #[cfg(feature = "MediaError")] pub use gen_MediaError::*; +#[cfg(feature = "MediaImage")] +#[allow(non_snake_case)] +mod gen_MediaImage; +#[cfg(feature = "MediaImage")] +pub use gen_MediaImage::*; + #[cfg(feature = "MediaKeyError")] #[allow(non_snake_case)] mod gen_MediaKeyError; @@ -4360,6 +4366,24 @@ mod gen_MediaList; #[cfg(feature = "MediaList")] pub use gen_MediaList::*; +#[cfg(feature = "MediaMetadata")] +#[allow(non_snake_case)] +mod gen_MediaMetadata; +#[cfg(feature = "MediaMetadata")] +pub use gen_MediaMetadata::*; + +#[cfg(feature = "MediaMetadataInit")] +#[allow(non_snake_case)] +mod gen_MediaMetadataInit; +#[cfg(feature = "MediaMetadataInit")] +pub use gen_MediaMetadataInit::*; + +#[cfg(feature = "MediaPositionState")] +#[allow(non_snake_case)] +mod gen_MediaPositionState; +#[cfg(feature = "MediaPositionState")] +pub use gen_MediaPositionState::*; + #[cfg(feature = "MediaQueryList")] #[allow(non_snake_case)] mod gen_MediaQueryList; @@ -4402,6 +4426,30 @@ mod gen_MediaRecorderOptions; #[cfg(feature = "MediaRecorderOptions")] pub use gen_MediaRecorderOptions::*; +#[cfg(feature = "MediaSession")] +#[allow(non_snake_case)] +mod gen_MediaSession; +#[cfg(feature = "MediaSession")] +pub use gen_MediaSession::*; + +#[cfg(feature = "MediaSessionAction")] +#[allow(non_snake_case)] +mod gen_MediaSessionAction; +#[cfg(feature = "MediaSessionAction")] +pub use gen_MediaSessionAction::*; + +#[cfg(feature = "MediaSessionActionDetails")] +#[allow(non_snake_case)] +mod gen_MediaSessionActionDetails; +#[cfg(feature = "MediaSessionActionDetails")] +pub use gen_MediaSessionActionDetails::*; + +#[cfg(feature = "MediaSessionPlaybackState")] +#[allow(non_snake_case)] +mod gen_MediaSessionPlaybackState; +#[cfg(feature = "MediaSessionPlaybackState")] +pub use gen_MediaSessionPlaybackState::*; + #[cfg(feature = "MediaSource")] #[allow(non_snake_case)] mod gen_MediaSource; diff --git a/crates/web-sys/webidls/unstable/MediaSession.webidl b/crates/web-sys/webidls/unstable/MediaSession.webidl new file mode 100644 index 00000000000..91133c68215 --- /dev/null +++ b/crates/web-sys/webidls/unstable/MediaSession.webidl @@ -0,0 +1,77 @@ +[Exposed=Window] +partial interface Navigator { + [SameObject] readonly attribute MediaSession mediaSession; +}; + +enum MediaSessionPlaybackState { + "none", + "paused", + "playing" +}; + +enum MediaSessionAction { + "play", + "pause", + "seekbackward", + "seekforward", + "previoustrack", + "nexttrack", + "skipad", + "stop", + "seekto", + "togglemicrophone", + "togglecamera", + "hangup" +}; + +callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details); + +[Exposed=Window] +interface MediaSession { + attribute MediaMetadata? metadata; + + attribute MediaSessionPlaybackState playbackState; + + undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); + + undefined setPositionState(optional MediaPositionState state = {}); + + undefined setMicrophoneActive(boolean active); + + undefined setCameraActive(boolean active); +}; + +[Exposed=Window] +interface MediaMetadata { + constructor(optional MediaMetadataInit init = {}); + attribute DOMString title; + attribute DOMString artist; + attribute DOMString album; + attribute FrozenArray artwork; +}; + +dictionary MediaMetadataInit { + DOMString title = ""; + DOMString artist = ""; + DOMString album = ""; + sequence artwork = []; +}; + +dictionary MediaImage { + required USVString src; + DOMString sizes = ""; + DOMString type = ""; +}; + +dictionary MediaPositionState { + double duration; + double playbackRate; + double position; +}; + +dictionary MediaSessionActionDetails { + required MediaSessionAction action; + double? seekOffset; + double? seekTime; + boolean? fastSeek; +}; From 3822e671495506ad87cc13e75772e482e3e2e196 Mon Sep 17 00:00:00 2001 From: Dominic Elm Date: Wed, 8 Jun 2022 21:18:05 +0200 Subject: [PATCH 024/641] Expose helpers to allow synchronous initialization (#2924) * Expose helpers to allow synchronous initialization * fixup: fix tests --- .DS_Store | Bin 0 -> 6148 bytes .github/workflows/main.yml | 2 +- Cargo.toml | 1 + crates/cli-support/src/js/mod.rs | 73 ++++++++++++++---- crates/cli/tests/wasm-bindgen/main.rs | 4 +- examples/synchronous-instantiation/Cargo.toml | 11 +++ examples/synchronous-instantiation/README.md | 23 ++++++ examples/synchronous-instantiation/build.sh | 6 ++ examples/synchronous-instantiation/index.html | 46 +++++++++++ examples/synchronous-instantiation/src/lib.rs | 12 +++ examples/synchronous-instantiation/worker.js | 23 ++++++ .../src/examples/synchronous-instantiation.md | 33 ++++++++ 12 files changed, 216 insertions(+), 18 deletions(-) create mode 100644 .DS_Store create mode 100644 examples/synchronous-instantiation/Cargo.toml create mode 100644 examples/synchronous-instantiation/README.md create mode 100755 examples/synchronous-instantiation/build.sh create mode 100644 examples/synchronous-instantiation/index.html create mode 100644 examples/synchronous-instantiation/src/lib.rs create mode 100644 examples/synchronous-instantiation/worker.js create mode 100644 guide/src/examples/synchronous-instantiation.md diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..038ad50aa8c1fe289434b91a014e9e0c88a4ed39 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8-BN@e6nb3nTCmkpDPBUYFJMFuDm5WNgK4%jtrbckXMG``#OHBl zcLSE@;7P>Jz~-BspWU4gvOkP5K9~m`#u|(<0S%F(QXpt9bd_u{BG+R~Sj<9}`ipc@ zFwkE#;o1eP`IUKW%)YJPkChL;4}TIz>8#!U;C$(^A-fW%@yy-3W zu9S-XT=)FzC|ryh`{yc|c~KHhbwU(`5OQ}DC4pKD)I14No$DHhsEOLB(OfRO-P4xr z^*gJUT=tLKE!jQktyVR0aCmffIeL!AiFz|+a^PLdp2ZyALD{J5#hoUxN*=+N=jHK) z!~iis3=jj`!+<>lM16Zorb>wcV&I1i;Qkaq-D0{YUl!s@ng!TXp1>-VQKtNx+1V9J(k*0PU czeFA49E+Jj90lz<9gr>pnh^RB1HZt)7uwWKC;$Ke literal 0 HcmV?d00001 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2bb58f6d95..331164c5837 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -228,7 +228,7 @@ jobs: ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen - run: mv _package.json package.json && npm install && rm package.json - run: | - for dir in `ls examples | grep -v README | grep -v asm.js | grep -v raytrace | grep -v without-a-bundler | grep -v wasm-in-web-worker | grep -v websockets | grep -v webxr | grep -v deno`; do + for dir in `ls examples | grep -v README | grep -v asm.js | grep -v raytrace | grep -v without-a-bundler | grep -v wasm-in-web-worker | grep -v websockets | grep -v webxr | grep -v deno | grep -v synchronous-instantiation`; do (cd examples/$dir && ln -fs ../../node_modules . && npm run build -- --output-path ../../exbuild/$dir) || exit 1; diff --git a/Cargo.toml b/Cargo.toml index b77314cebb1..6b1fdf56a0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,6 +89,7 @@ members = [ "examples/webxr", "examples/without-a-bundler", "examples/without-a-bundler-no-modules", + "examples/synchronous-instantiation", "tests/no-std", ] diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8c7e1bb01f6..707a4523328 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -469,7 +469,8 @@ impl<'a> Context<'a> { OutputMode::Web => { self.imports_post.push_str("let wasm;\n"); init = self.gen_init(needs_manual_start, Some(&mut imports))?; - footer.push_str("export default init;\n"); + footer.push_str("export { initSync }\n"); + footer.push_str("export default init;"); } } @@ -637,12 +638,29 @@ impl<'a> Context<'a> { // So using "declare" everywhere for at least the NoModules option. // Also in (at least) the NoModules, the `init()` method is renamed to `wasm_bindgen()`. let setup_function_declaration; + let mut sync_init_function = String::new(); let declare_or_export; if self.config.mode.no_modules() { declare_or_export = "declare"; setup_function_declaration = "declare function wasm_bindgen"; } else { declare_or_export = "export"; + + sync_init_function.push_str(&format!("\ + /**\n\ + * Synchronously compiles the given `bytes` and instantiates the WebAssembly module.\n\ + *\n\ + * @param {{BufferSource}} bytes\n\ + {memory_doc}\ + *\n\ + * @returns {{InitOutput}}\n\ + */\n\ + export function initSync(bytes: BufferSource{memory_param}): InitOutput;\n\n\ + ", + memory_doc = memory_doc, + memory_param = memory_param + )); + setup_function_declaration = "export default function init"; } Ok(format!( @@ -652,6 +670,7 @@ impl<'a> Context<'a> { {declare_or_export} interface InitOutput {{\n\ {output}}}\n\ \n\ + {sync_init_function}\ /**\n\ * If `module_or_path` is {{RequestInfo}} or {{URL}}, makes a request and\n\ * for everything else, calls `WebAssembly.instantiate` directly.\n\ @@ -665,6 +684,7 @@ impl<'a> Context<'a> { (module_or_path{}: InitInput | Promise{}): Promise;\n", memory_doc, arg_optional, memory_param, output = output, + sync_init_function = sync_init_function, declare_or_export = declare_or_export, setup_function_declaration = setup_function_declaration, )) @@ -733,11 +753,11 @@ impl<'a> Context<'a> { // Initialize the `imports` object for all import definitions that we're // directed to wire up. let mut imports_init = String::new(); - if self.wasm_import_definitions.len() > 0 { - imports_init.push_str("imports."); - imports_init.push_str(module_name); - imports_init.push_str(" = {};\n"); - } + + imports_init.push_str("imports."); + imports_init.push_str(module_name); + imports_init.push_str(" = {};\n"); + for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { let import = self.module.imports.get_mut(*id); import.module = module_name.to_string(); @@ -814,26 +834,49 @@ impl<'a> Context<'a> { }} }} - async function init(input{init_memory_arg}) {{ - {default_module_path} + function getImports() {{ const imports = {{}}; {imports_init} + return imports; + }} - if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {{ - input = fetch(input); - }} - + function initMemory(imports, maybe_memory) {{ {init_memory} + }} - const {{ instance, module }} = await load(await input, imports); - + function finalizeInit(instance, module) {{ wasm = instance.exports; init.__wbindgen_wasm_module = module; - {post_instantiate} {start} return wasm; }} + + function initSync(bytes{init_memory_arg}) {{ + const imports = getImports(); + + initMemory(imports{init_memory_arg}); + + const module = new WebAssembly.Module(bytes); + const instance = new WebAssembly.Instance(module, imports); + + return finalizeInit(instance, module); + }} + + async function init(input{init_memory_arg}) {{ + {default_module_path} + const imports = getImports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {{ + input = fetch(input); + }} + + initMemory(imports{init_memory_arg}); + + const {{ instance, module }} = await load(await input, imports); + + return finalizeInit(instance, module); + }} ", init_memory_arg = init_memory_arg, default_module_path = default_module_path, diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index d534b5a9724..b52f14e64c3 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -289,7 +289,7 @@ fn omit_default_module_path_target_web() { "\ async function init(input) { - const imports = {};", + const imports = getImports();", )); } @@ -309,7 +309,7 @@ fn omit_default_module_path_target_no_modules() { "\ async function init(input) { - const imports = {};", + const imports = getImports();", )); } diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml new file mode 100644 index 00000000000..f68b62f9b9d --- /dev/null +++ b/examples/synchronous-instantiation/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "synchronous-instantiation" +version = "0.1.0" +authors = ["The wasm-bindgen Developers"] +edition = "2018" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2.80" diff --git a/examples/synchronous-instantiation/README.md b/examples/synchronous-instantiation/README.md new file mode 100644 index 00000000000..9c0bc743ed1 --- /dev/null +++ b/examples/synchronous-instantiation/README.md @@ -0,0 +1,23 @@ +# Synchronous Instantiation + +[View documentation for this example online][dox] + +[dox]: https://rustwasm.github.io/docs/wasm-bindgen/examples/synchronous-instantiation.html + +You can build the example locally with: + +``` +$ wasm-pack build --target web +``` + +Then serve this directory in your favourite webserver and navigate to `host:port` +to open the index.html in your browser: + +``` +# static server from https://crates.io/crates/https +http + +# or use python +python2 -m SimpleHTTPServer +python3 -m http.server +``` diff --git a/examples/synchronous-instantiation/build.sh b/examples/synchronous-instantiation/build.sh new file mode 100755 index 00000000000..cb05aadb1a9 --- /dev/null +++ b/examples/synchronous-instantiation/build.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -ex + +wasm-pack build --target web +python3 -m http.server diff --git a/examples/synchronous-instantiation/index.html b/examples/synchronous-instantiation/index.html new file mode 100644 index 00000000000..f62e8efb274 --- /dev/null +++ b/examples/synchronous-instantiation/index.html @@ -0,0 +1,46 @@ + + + + + + + Document + + + + + diff --git a/examples/synchronous-instantiation/src/lib.rs b/examples/synchronous-instantiation/src/lib.rs new file mode 100644 index 00000000000..e5afafcb563 --- /dev/null +++ b/examples/synchronous-instantiation/src/lib.rs @@ -0,0 +1,12 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = console)] + fn log(value: &str); +} + +#[wasm_bindgen] +pub fn greet(name: &str) { + log(&format!("Hello, {}!", name)); +} diff --git a/examples/synchronous-instantiation/worker.js b/examples/synchronous-instantiation/worker.js new file mode 100644 index 00000000000..1163234e301 --- /dev/null +++ b/examples/synchronous-instantiation/worker.js @@ -0,0 +1,23 @@ +import * as wasm from "./pkg/synchronous_instantiation.js"; + +self.onmessage = ({ data: bytes }) => { + /** + * When we receive the bytes as an `ArrayBuffer` we can use that to + * synchronously initialize the module as opposed to asynchronously + * via the default export. The synchronous method internally uses + * `new WebAssembly.Module()` and `new WebAssembly.Instance()`. + */ + wasm.initSync(bytes); + + /** + * Once initialized we can call our exported `greet()` functions. + */ + wasm.greet("Dominic"); +}; + +/** + * Once the Web Worker was spwaned we ask the main thread to fetch the bytes + * for the WebAssembly module. Once fetched it will send the bytes back via + * a `postMessage` (see above). + */ +self.postMessage({ type: "FETCH_WASM" }); diff --git a/guide/src/examples/synchronous-instantiation.md b/guide/src/examples/synchronous-instantiation.md new file mode 100644 index 00000000000..087558537dd --- /dev/null +++ b/guide/src/examples/synchronous-instantiation.md @@ -0,0 +1,33 @@ +# Synchronous Instantiation + +[View full source code][code] + +[code]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/synchronous-instantiation + +This example shows how to synchronously initialize a WebAssembly module as opposed to [asynchronously][without-bundler]. In most cases, the default way of asynchronously initializing a module will suffice. However, there might be use cases where you'd like to lazy load a module on demand and synchronously compile and instantiate it. Note that this only works off the main thread and since compilation and instantiation of large modules can be expensive you should only use this method if it's absolutely required in your use case. Otherwise you should use the [default method][without-bundler]. + +For this deployment strategy bundlers like Webpack are not required. For more information on deployment see the [dedicated +documentation][deployment]. + +First let's take a look at our tiny lib: + +```rust +{{#include ../../../examples/synchronous-instantiation/src/lib.rs}} +``` + +Next, let's have a look at the `index.html`: + +```html +{{#include ../../../examples/synchronous-instantiation/index.html}} +``` + +Otherwise the rest of the magic happens in `worker.js`: + +```js +{{#include ../../../examples/synchronous-instantiation/worker.js}} +``` + +And that's it! Be sure to read up on the [deployment options][deployment] to see what it means to deploy without a bundler. + +[deployment]: ../reference/deployment.html +[without-bundler]: ./without-a-bundler.html From ed58b791e7e8cb0bc68c8687b91cea3d0b49499c Mon Sep 17 00:00:00 2001 From: Branco Bruyneel <43569324+brancobruyneel@users.noreply.github.com> Date: Mon, 13 Jun 2022 15:36:31 +0200 Subject: [PATCH 025/641] fix(guide): missing ] (#2933) --- guide/src/reference/attributes/on-js-imports/js_name.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/attributes/on-js-imports/js_name.md b/guide/src/reference/attributes/on-js-imports/js_name.md index 840fb4f57e5..073a5b3a981 100644 --- a/guide/src/reference/attributes/on-js-imports/js_name.md +++ b/guide/src/reference/attributes/on-js-imports/js_name.md @@ -77,7 +77,7 @@ Could be accessed using this definition in Rust: ```rust #[wasm_bindgen(module = "bar")] extern "C" { - #[wasm_bindgen(js_name = default) + #[wasm_bindgen(js_name = default)] type Foo; #[wasm_bindgen(constructor, js_class = default)] pub fn new() -> Foo; From 062aa5f70a1e8a170d0ae90123ebdeb3242ac782 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 14 Jun 2022 10:06:47 -0500 Subject: [PATCH 026/641] Bump to 0.2.81 (#2935) --- CHANGELOG.md | 8 ++++++++ Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 8 ++++---- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- 49 files changed, 109 insertions(+), 101 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0316d3f176b..2c9061bc74f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## 0.2.81 + +Released 2022-06-14. + +[changes](https://github.com/rustwasm/wasm-bindgen/compare/0.2.80...0.2.81) + +-------------------------------------------------------------------------------- + ## 0.2.80 Released 2022-04-04. diff --git a/Cargo.toml b/Cargo.toml index 6b1fdf56a0d..f34dbca91f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -35,15 +35,15 @@ strict-macro = ["wasm-bindgen-macro/strict-macro"] xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.80" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.81" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.57' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.30' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.30' } +js-sys = { path = 'crates/js-sys', version = '0.3.58' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.31' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.31' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index d4b10932f52..c3a89d0e185 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -22,4 +22,4 @@ log = "0.4" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.80" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 4a1e3dbb45e..8e41ff1f688 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -19,12 +19,12 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.19.0" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.80' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.80' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.80' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.80' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.80' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.80' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.81' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.81' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.81' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.81' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.81' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.81' } wit-text = "0.8.0" wit-walrus = "0.6.0" wit-validator = "0.2.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 39b9ee93a2d..8b3fd73887e 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -26,8 +26,8 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" walrus = { version = "0.19.0", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.80" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.80" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.81" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index ddb7f621b6b..6a8d25b8d43 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 4c29dfc4e44..4f170f1b9bb 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,13 +7,13 @@ license = "MIT/Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.30" +version = "0.4.31" edition = "2018" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.57' } -wasm-bindgen = { path = "../..", version = '0.2.80' } +js-sys = { path = "../js-sys", version = '0.3.58' } +wasm-bindgen = { path = "../..", version = '0.2.81' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -28,6 +28,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.30' } +wasm-bindgen-test = { path = '../test', version = '0.3.31' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 10af5f0aa95..4a9ff33f1eb 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.57" +version = "0.3.58" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -19,9 +19,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.80" } +wasm-bindgen = { path = "../..", version = "0.2.81" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.30' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.30' } -web-sys = { path = "../web-sys", version = "0.3.57", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.31' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } +web-sys = { path = "../web-sys", version = "0.3.58", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 3bebaa3fe93..dfc68a26cb2 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -20,5 +20,5 @@ strict-macro = [] syn = { version = '1.0.67', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.80" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.80" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.81" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 510c3b9fab6..2e6e07456b2 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -20,10 +20,10 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.80" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.81" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.80", features = ['strict-macro'] } -wasm-bindgen-futures = { path = "../futures", version = "0.4.30" } +wasm-bindgen = { path = "../..", version = "0.2.81", features = ['strict-macro'] } +wasm-bindgen-futures = { path = "../futures", version = "0.4.31" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index f2c947adee3..e8c16c7fd80 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 3e76f2c1fb6..bd6ec711006 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index a234d252ec1..8e9dd7dae6c 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.30" +version = "0.3.31" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT/Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index bbd83209373..8e46962dd9b 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.30" +version = "0.3.31" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT/Apache-2.0" @@ -9,11 +9,11 @@ edition = "2018" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.57' } +js-sys = { path = '../js-sys', version = '0.3.58' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.80' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.30' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.30' } +wasm-bindgen = { path = '../..', version = '0.2.81' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.31' } [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 306a6d510c5..e4020b376c9 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -14,7 +14,7 @@ edition = "2018" [dependencies] anyhow = "1.0" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.80" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.81" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index b1120e5f04a..b0f19d19963 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index c68b7493dbc..7d2a8f3d276 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.80" +version = "0.2.81" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-interpreter" @@ -15,7 +15,7 @@ edition = '2018' anyhow = "1.0" log = "0.4" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.80" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.81" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 1911a0fa7ee..b64ca858add 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.57" +version = "0.3.58" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -21,12 +21,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.80" } -js-sys = { path = '../js-sys', version = '0.3.57' } +wasm-bindgen = { path = "../..", version = "0.2.81" } +js-sys = { path = '../js-sys', version = '0.3.58' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.30' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.30' } +wasm-bindgen-test = { path = '../test', version = '0.3.31' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 4da8b0d92b5..6af4fc57414 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -20,7 +20,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.80", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.81", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } lazy_static = "1.0.2" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index c574da2fa87..b60596c96c2 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index fe545dea38c..380ec69638d 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.57" -wasm-bindgen = "0.2.80" +js-sys = "0.3.58" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 9df7f98b981..0d1040572f9 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 8ba10c6d5c4..cd51d7a2119 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" -js-sys = "0.3.57" +wasm-bindgen = "0.2.81" +js-sys = "0.3.58" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 447b5ab0a1c..7d6a310107c 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" -web-sys = { version = "0.3.57", features = ['console'] } +wasm-bindgen = "0.2.81" +web-sys = { version = "0.3.58", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index fb22fb0c0a5..f7de714655d 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 2b198e48cb4..8f5d03ea140 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index cfb0efeb558..d0e28d782ab 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index f6e395885b5..b334fbe5cfc 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { version = "0.2.80", features = ["serde-serialize"] } -js-sys = "0.3.57" -wasm-bindgen-futures = "0.4.30" +wasm-bindgen = { version = "0.2.81", features = ["serde-serialize"] } +js-sys = "0.3.58" +wasm-bindgen-futures = "0.4.31" serde = { version = "1.0.80", features = ["derive"] } serde_derive = "^1.0.59" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 663613a15e6..bf4361e9d5f 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" -js-sys = "0.3.57" +wasm-bindgen = "0.2.81" +js-sys = "0.3.58" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 744cd4376bc..d7575e2dcac 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 83e57203c16..e1b73fc02ff 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 2fa525d927a..3d0ae81028c 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 687f89c3f75..67bfd160c12 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.57" -wasm-bindgen = "0.2.80" +js-sys = "0.3.58" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index ed2a6000a9d..c3ac0c70524 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 2cfa0049711..a49b6d91945 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -9,13 +9,13 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.57" +js-sys = "0.3.58" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = { version = "0.2.80", features = ['serde-serialize'] } -wasm-bindgen-futures = "0.4.30" +wasm-bindgen = { version = "0.2.81", features = ['serde-serialize'] } +wasm-bindgen-futures = "0.4.31" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 3d1076c8841..8b44924aab6 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index f68b62f9b9d..76ed6a2171a 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index 518dded7e0a..a5ed6cd8176 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -11,8 +11,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.57" -wasm-bindgen = "0.2.80" +js-sys = "0.3.58" +wasm-bindgen = "0.2.81" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 24518fc5037..e5173a7660f 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" -js-sys = "0.3.57" -wasm-bindgen-futures = "0.4.30" +wasm-bindgen = "0.2.81" +js-sys = "0.3.58" +wasm-bindgen-futures = "0.4.31" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 0bcfaea420f..a35ea3ca29d 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" -js-sys = "0.3.57" -wasm-bindgen-futures = "0.4.30" +wasm-bindgen = "0.2.81" +js-sys = "0.3.58" +wasm-bindgen-futures = "0.4.31" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index f17af8b964f..d8d112769fd 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 8f3bd1d8a26..6f0df344d9f 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index ff5d055af76..0af8a3a8468 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -15,7 +15,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 8499ed1ea91..c6d85ed241d 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index 2252d7187bf..a11c6aaba08 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.57" -wasm-bindgen = "0.2.80" +js-sys = "0.3.58" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 9d514b4faeb..42c4ce61720 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" js-sys = "0.3" -wasm-bindgen-futures = "0.4.30" +wasm-bindgen-futures = "0.4.31" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index f8e6caf7097..29052830da2 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 0ad5fc4a542..eb563959586 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.57" -wasm-bindgen = {version = "0.2.80", features = ["serde-serialize"]} -wasm-bindgen-futures = "0.4.30" +js-sys = "0.3.58" +wasm-bindgen = {version = "0.2.81", features = ["serde-serialize"]} +wasm-bindgen-futures = "0.4.31" serde = { version = "1.0.80", features = ["derive"] } serde_derive = "^1.0.59" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 07ac5660093..015baf4dc45 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.80" +wasm-bindgen = "0.2.81" [dependencies.web-sys] version = "0.3.4" From 1f5d12340317b69582e2e1b74997c2a272c16c06 Mon Sep 17 00:00:00 2001 From: Sophie <6781691+nannafudge@users.noreply.github.com> Date: Tue, 14 Jun 2022 19:55:10 +0100 Subject: [PATCH 027/641] Added COEP/COOP HTTP Headers to wasm-bindgen-test-runner to support WebWorker testing (#2936) * Adding COEP/COOP HTTP Headers to test-runner server response, to enable testing of Web Workers/cross-worker context sharing on Chromium/Firefox * Updating code formatting as per linter spec --- .../bin/wasm-bindgen-test-runner/server.rs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index 631d9ec2f8d..fd611ba6650 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -1,3 +1,4 @@ +use std::borrow::Cow; use std::ffi::OsString; use std::fs; use std::net::SocketAddr; @@ -75,7 +76,7 @@ pub fn spawn( } else { include_str!("index.html") }; - return Response::from_data("text/html", s); + return set_isolate_origin_headers(Response::from_data("text/html", s)); } // Otherwise we need to find the asset here. It may either be in our @@ -88,7 +89,7 @@ pub fn spawn( // Make sure browsers don't cache anything (Chrome appeared to with this // header?) response.headers.retain(|(k, _)| k != "Cache-Control"); - return response; + return set_isolate_origin_headers(response); }) .map_err(|e| anyhow!("{}", e))?; return Ok(srv); @@ -123,3 +124,22 @@ pub fn spawn( response } } + +/* + * Set the Cross-Origin-Opener-Policy and Cross-Origin_Embedder-Policy headers + * on the Server response to enable worker context sharing, as described in: + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy#certain_features_depend_on_cross-origin_isolation + * https://security.googleblog.com/2018/07/mitigating-spectre-with-site-isolation.html + */ +fn set_isolate_origin_headers(mut response: Response) -> Response { + response.headers.push(( + Cow::Borrowed("Cross-Origin-Opener-Policy"), + Cow::Borrowed("same-origin"), + )); + response.headers.push(( + Cow::Borrowed("Cross-Origin-Embedder-Policy"), + Cow::Borrowed("require-corp"), + )); + + return response; +} From 0e2a5d3c22edca05ede17f7ef6e3c03b5b2d474b Mon Sep 17 00:00:00 2001 From: Ashley Date: Tue, 14 Jun 2022 20:55:27 +0200 Subject: [PATCH 028/641] Add WebGLMultiDraw (#2937) --- crates/web-sys/Cargo.toml | 3 + .../src/features/gen_WebglMultiDraw.rs | 418 ++++++++++++++++++ crates/web-sys/src/features/mod.rs | 6 + .../webidls/enabled/WebGLMultiDraw.webidl | 31 ++ 4 files changed, 458 insertions(+) create mode 100644 crates/web-sys/src/features/gen_WebglMultiDraw.rs create mode 100644 crates/web-sys/webidls/enabled/WebGLMultiDraw.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b64ca858add..556a4fa69ad 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1162,6 +1162,8 @@ StyleSheet = [] StyleSheetApplicableStateChangeEventInit = [] StyleSheetChangeEventInit = [] StyleSheetList = [] +SubmitEvent = ["Event"] +SubmitEventInit = [] SubtleCrypto = [] SupportedType = [] SvcOutputMetadata = [] @@ -1448,6 +1450,7 @@ WebglDebugShaders = [] WebglDepthTexture = [] WebglDrawBuffers = [] WebglLoseContext = [] +WebglMultiDraw = [] WebrtcGlobalStatisticsReport = [] WheelEvent = ["Event", "MouseEvent", "UiEvent"] WheelEventInit = [] diff --git a/crates/web-sys/src/features/gen_WebglMultiDraw.rs b/crates/web-sys/src/features/gen_WebglMultiDraw.rs new file mode 100644 index 00000000000..a8d3cbc7bda --- /dev/null +++ b/crates/web-sys/src/features/gen_WebglMultiDraw.rs @@ -0,0 +1,418 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WEBGL_multi_draw , typescript_type = "WEBGL_multi_draw")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebglMultiDraw` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub type WebglMultiDraw; + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + drawcount: i32, + ); +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index c18588a32e1..80482b5e3bc 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8518,6 +8518,12 @@ mod gen_WebglLoseContext; #[cfg(feature = "WebglLoseContext")] pub use gen_WebglLoseContext::*; +#[cfg(feature = "WebglMultiDraw")] +#[allow(non_snake_case)] +mod gen_WebglMultiDraw; +#[cfg(feature = "WebglMultiDraw")] +pub use gen_WebglMultiDraw::*; + #[cfg(feature = "WebrtcGlobalStatisticsReport")] #[allow(non_snake_case)] mod gen_WebrtcGlobalStatisticsReport; diff --git a/crates/web-sys/webidls/enabled/WebGLMultiDraw.webidl b/crates/web-sys/webidls/enabled/WebGLMultiDraw.webidl new file mode 100644 index 00000000000..95feba93126 --- /dev/null +++ b/crates/web-sys/webidls/enabled/WebGLMultiDraw.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The source for this IDL is found at https://www.khronos.org/registry/webgl/extensions/WEBGL_multi_draw/ + */ + [Exposed=(Window,Worker), LegacyNoInterfaceObject] +interface WEBGL_multi_draw { + undefined multiDrawArraysWEBGL( + GLenum mode, + ([AllowShared] Int32Array or sequence) firstsList, GLuint firstsOffset, + ([AllowShared] Int32Array or sequence) countsList, GLuint countsOffset, + GLsizei drawcount); + undefined multiDrawElementsWEBGL( + GLenum mode, + ([AllowShared] Int32Array or sequence) countsList, GLuint countsOffset, + GLenum type, + ([AllowShared] Int32Array or sequence) offsetsList, GLuint offsetsOffset, + GLsizei drawcount); + undefined multiDrawArraysInstancedWEBGL( + GLenum mode, + ([AllowShared] Int32Array or sequence) firstsList, GLuint firstsOffset, + ([AllowShared] Int32Array or sequence) countsList, GLuint countsOffset, + ([AllowShared] Int32Array or sequence) instanceCountsList, GLuint instanceCountsOffset, + GLsizei drawcount); + undefined multiDrawElementsInstancedWEBGL( + GLenum mode, + ([AllowShared] Int32Array or sequence) countsList, GLuint countsOffset, + GLenum type, + ([AllowShared] Int32Array or sequence) offsetsList, GLuint offsetsOffset, + ([AllowShared] Int32Array or sequence) instanceCountsList, GLuint instanceCountsOffset, + GLsizei drawcount); +}; From 0e541c9f502e657f19cc83382d1c83980f2234e7 Mon Sep 17 00:00:00 2001 From: Yehyoung Kang Date: Wed, 15 Jun 2022 23:14:06 +0900 Subject: [PATCH 029/641] fix typo (#2940) --- .../src/reference/attributes/on-rust-exports/typescript_type.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/attributes/on-rust-exports/typescript_type.md b/guide/src/reference/attributes/on-rust-exports/typescript_type.md index 6dc68afdc67..081c5d83c39 100644 --- a/guide/src/reference/attributes/on-rust-exports/typescript_type.md +++ b/guide/src/reference/attributes/on-rust-exports/typescript_type.md @@ -35,7 +35,7 @@ impl TextStyle { } pub fn optional_new(_i: Option) -> TextStyle { - // parse JsValueo + // parse JsValue TextStyle::default() } } From 8a18913ad7e96689700403105a8d8ccc46409cec Mon Sep 17 00:00:00 2001 From: Michael Allwright Date: Fri, 17 Jun 2022 20:37:37 +0200 Subject: [PATCH 030/641] Add WebAssembly.compileStreaming to js-sys (#2944) Fixes #2928 --- crates/js-sys/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 2972376bd22..e0b1dd25a27 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -3961,6 +3961,16 @@ pub mod WebAssembly { #[wasm_bindgen(js_namespace = WebAssembly)] pub fn compile(buffer_source: &JsValue) -> Promise; + /// The `WebAssembly.compileStreaming()` function compiles a + /// `WebAssembly.Module` module directly from a streamed underlying + /// source. This function is useful if it is necessary to a compile a + /// module before it can be instantiated (otherwise, the + /// `WebAssembly.instantiateStreaming()` function should be used). + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming) + #[wasm_bindgen(js_namespace = WebAssembly, js_name = compileStreaming)] + pub fn compile_streaming(response: &Promise) -> Promise; + /// The `WebAssembly.instantiate()` function allows you to compile and /// instantiate WebAssembly code. /// From af2a7b9e762a2334ceb24e5f262a2be59c70dd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Stud=C3=BDnka?= <66028253+petrstudynka@users.noreply.github.com> Date: Fri, 17 Jun 2022 20:51:34 +0200 Subject: [PATCH 031/641] #2806 bugfix: Added checks for JS keywords in signatures. (#2855) * Mangle conflicting idents (#2806) * Added tests (#2806) --- crates/macro-support/src/parser.rs | 76 +++++++++++++++++++++++++----- tests/wasm/js_keywords.js | 24 ++++++++++ tests/wasm/js_keywords.rs | 55 +++++++++++++++++++++ tests/wasm/main.rs | 1 + 4 files changed, 143 insertions(+), 13 deletions(-) create mode 100644 tests/wasm/js_keywords.js create mode 100644 tests/wasm/js_keywords.rs diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 4768b3d15de..a4b13af95e6 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -15,6 +15,29 @@ use syn::spanned::Spanned; thread_local!(static ATTRS: AttributeParseState = Default::default()); +/// Javascript keywords which are not keywords in Rust. +const JS_KEYWORDS: [&str; 20] = [ + "class", + "case", + "catch", + "debugger", + "default", + "delete", + "export", + "extends", + "finally", + "function", + "import", + "instanceof", + "new", + "null", + "switch", + "this", + "throw", + "var", + "void", + "with", +]; #[derive(Default)] struct AttributeParseState { parsed: Cell, @@ -462,6 +485,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte self.vis.clone(), false, None, + false, )? .0; let catch = opts.catch().is_some(); @@ -704,13 +728,19 @@ impl ConvertToAst for syn::ItemFn { self.vis, false, None, + false, )?; attrs.check_used()?; Ok(ret.0) } } +pub(crate) fn is_js_keyword(keyword: &str) -> bool { + JS_KEYWORDS.contains(&keyword) +} + /// Construct a function (and gets the self type if appropriate) for our AST from a syn function. +#[allow(clippy::too_many_arguments)] fn function_from_decl( decl_name: &syn::Ident, opts: &BindgenAttrs, @@ -719,6 +749,7 @@ fn function_from_decl( vis: syn::Visibility, allow_self: bool, self_ty: Option<&Ident>, + is_from_impl: bool, ) -> Result<(ast::Function, Option), Diagnostic> { if sig.variadic.is_some() { bail_span!(sig.variadic, "can't #[wasm_bindgen] variadic functions"); @@ -754,11 +785,21 @@ fn function_from_decl( }) }; + let replace_colliding_arg = |i: &mut syn::PatType| { + if let syn::Pat::Ident(ref mut i) = *i.pat { + let ident = i.ident.to_string(); + if is_js_keyword(ident.as_str()) { + i.ident = Ident::new(format!("_{}", ident).as_str(), i.ident.span()); + } + } + }; + let mut method_self = None; let arguments = inputs .into_iter() .filter_map(|arg| match arg { syn::FnArg::Typed(mut c) => { + replace_colliding_arg(&mut c); c.ty = Box::new(replace_self(*c.ty)); Some(c) } @@ -784,21 +825,29 @@ fn function_from_decl( syn::ReturnType::Type(_, ty) => Some(replace_self(*ty)), }; - let (name, name_span, renamed_via_js_name) = - if let Some((js_name, js_name_span)) = opts.js_name() { - let kind = operation_kind(&opts); - let prefix = match kind { - OperationKind::Setter(_) => "set_", - _ => "", - }; - ( - format!("{}{}", prefix, js_name.to_string()), - js_name_span, - true, - ) + let (name, name_span, renamed_via_js_name) = if let Some((js_name, js_name_span)) = + opts.js_name() + { + let kind = operation_kind(opts); + let prefix = match kind { + OperationKind::Setter(_) => "set_", + _ => "", + }; + let name = if prefix.is_empty() && opts.method().is_none() && is_js_keyword(js_name) { + format!("_{}", js_name) } else { - (decl_name.to_string(), decl_name.span(), false) + format!("{}{}", prefix, js_name) }; + (name, js_name_span, true) + } else { + let name = + if !is_from_impl && opts.method().is_none() && is_js_keyword(&decl_name.to_string()) { + format!("_{}", decl_name) + } else { + decl_name.to_string() + }; + (name, decl_name.span(), false) + }; Ok(( ast::Function { arguments, @@ -1054,6 +1103,7 @@ impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemMethod { self.vis.clone(), true, Some(class), + true, )?; let method_kind = if opts.constructor().is_some() { ast::MethodKind::Constructor diff --git a/tests/wasm/js_keywords.js b/tests/wasm/js_keywords.js new file mode 100644 index 00000000000..f7fb26dea56 --- /dev/null +++ b/tests/wasm/js_keywords.js @@ -0,0 +1,24 @@ +const wasm = require("wasm-bindgen-test.js"); +const assert = require("assert"); + +exports.js_keywords_compile = () => { + assert.strictEqual(wasm._throw(1), 1); + assert.strictEqual(wasm._class(1, 2), false); + assert.strictEqual(wasm.classy(3), 3); + let obj = new wasm.Class("class"); + assert.strictEqual(wasm.Class.void("string"), "string"); + assert.strictEqual(obj.catch, "class"); + assert.strictEqual(obj.instanceof("Class"), "class is instance of Class"); +}; + +exports.test_keyword_1_as_fn_name = (x) => { + return wasm._throw(x); +}; + +exports.test_keyword_2_as_fn_name = (x, y) => { + return wasm._class(x, y); +}; + +exports.test_keyword_as_fn_arg = (x) => { + return wasm.classy(x); +}; diff --git a/tests/wasm/js_keywords.rs b/tests/wasm/js_keywords.rs new file mode 100644 index 00000000000..57feed7a7c6 --- /dev/null +++ b/tests/wasm/js_keywords.rs @@ -0,0 +1,55 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/js_keywords.js")] +extern "C" { + fn js_keywords_compile(); + fn test_keyword_1_as_fn_name(x: u8) -> u8; + fn test_keyword_2_as_fn_name(x: u8, y: u8) -> bool; + fn test_keyword_as_fn_arg(x: u8) -> u8; +} + +#[wasm_bindgen] +pub fn throw(class: u8) -> u8 { + class +} + +#[wasm_bindgen(js_name = class)] +pub fn fn_parsed_to_keyword(instanceof: u8, catch: u8) -> bool { + instanceof > catch +} + +#[wasm_bindgen(js_name = classy)] +pub fn arg_is_keyword(class: u8) -> u8 { + class +} + +#[wasm_bindgen] +struct Class { + name: String, +} +#[wasm_bindgen] +impl Class { + #[wasm_bindgen(constructor)] + pub fn new(void: String) -> Self { + Class { name: void } + } + pub fn instanceof(&self, class: String) -> String { + format!("{} is instance of {}", self.name.clone(), class) + } + #[wasm_bindgen(getter)] + pub fn catch(&self) -> String { + self.name.clone() + } + pub fn void(void: String) -> String { + void + } +} + +#[wasm_bindgen_test] +fn compile() { + js_keywords_compile(); + assert_eq!(test_keyword_1_as_fn_name(1), 1); + assert_eq!(test_keyword_2_as_fn_name(1, 2), false); + assert_eq!(test_keyword_as_fn_arg(1), 1); +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index a90f9f3afef..30f8dd02f30 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -27,6 +27,7 @@ pub mod futures; pub mod getters_and_setters; pub mod import_class; pub mod imports; +pub mod js_keywords; pub mod js_objects; pub mod jscast; pub mod math; From b63dd8b0d3688b8464ccafb662c4f2ee39cedfc5 Mon Sep 17 00:00:00 2001 From: Josh Groves Date: Tue, 21 Jun 2022 11:39:46 -0230 Subject: [PATCH 032/641] Update to latest WebGPU WebIDL (#2951) --- crates/web-sys/Cargo.toml | 4 +- crates/web-sys/src/features/gen_GpuAdapter.rs | 36 ++++-- .../src/features/gen_GpuAdapterInfo.rs | 62 ++++++++++ crates/web-sys/src/features/gen_GpuBuffer.rs | 22 ++++ ...AlphaMode.rs => gen_GpuCanvasAlphaMode.rs} | 6 +- .../features/gen_GpuCanvasConfiguration.rs | 32 +---- crates/web-sys/src/features/gen_GpuError.rs | 11 -- .../gen_GpuExternalTextureDescriptor.rs | 22 ---- .../src/features/gen_GpuFeatureName.rs | 1 - .../features/gen_GpuImageCopyTextureTagged.rs | 22 ---- .../src/features/gen_GpuOutOfMemoryError.rs | 11 ++ .../features/gen_GpuPredefinedColorSpace.rs | 14 --- .../web-sys/src/features/gen_GpuQuerySet.rs | 23 ++++ .../features/gen_GpuRenderPassDescriptor.rs | 21 ++++ .../gen_GpuShaderModuleCompilationHint.rs | 9 +- .../src/features/gen_GpuSupportedLimits.rs | 22 ++++ crates/web-sys/src/features/gen_GpuTexture.rs | 90 ++++++++++++++ .../src/features/gen_GpuTextureFormat.rs | 1 - .../src/features/gen_GpuValidationError.rs | 11 ++ crates/web-sys/src/features/mod.rs | 20 ++-- crates/web-sys/webidls/unstable/WebGPU.webidl | 113 ++++++++++-------- 21 files changed, 380 insertions(+), 173 deletions(-) create mode 100644 crates/web-sys/src/features/gen_GpuAdapterInfo.rs rename crates/web-sys/src/features/{gen_GpuCanvasCompositingAlphaMode.rs => gen_GpuCanvasAlphaMode.rs} (78%) delete mode 100644 crates/web-sys/src/features/gen_GpuPredefinedColorSpace.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 556a4fa69ad..b9d9102a355 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -425,6 +425,7 @@ GetRootNodeOptions = [] GetUserMediaRequest = [] Gpu = [] GpuAdapter = [] +GpuAdapterInfo = [] GpuAddressMode = [] GpuAutoLayoutMode = [] GpuBindGroup = [] @@ -442,7 +443,7 @@ GpuBufferBinding = [] GpuBufferBindingLayout = [] GpuBufferBindingType = [] GpuBufferDescriptor = [] -GpuCanvasCompositingAlphaMode = [] +GpuCanvasAlphaMode = [] GpuCanvasConfiguration = [] GpuCanvasContext = [] GpuColorDict = [] @@ -494,7 +495,6 @@ GpuPipelineDescriptorBase = [] GpuPipelineLayout = [] GpuPipelineLayoutDescriptor = [] GpuPowerPreference = [] -GpuPredefinedColorSpace = [] GpuPrimitiveState = [] GpuPrimitiveTopology = [] GpuProgrammableStage = [] diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 2595ed62b09..ee64df54afe 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -16,17 +16,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuAdapter; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = name)] - #[doc = "Getter for the `name` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/name)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(this: &GpuAdapter) -> String; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuSupportedFeatures")] # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = features)] #[doc = "Getter for the `features` field of this object."] @@ -62,6 +51,31 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_fallback_adapter(this: &GpuAdapter) -> bool; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)] + #[doc = "The `requestAdapterInfo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)] + #[doc = "The `requestAdapterInfo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_adapter_info_with_unmask_hints( + this: &GpuAdapter, + unmask_hints: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuAdapterInfo.rs b/crates/web-sys/src/features/gen_GpuAdapterInfo.rs new file mode 100644 index 00000000000..2e5609c56ea --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuAdapterInfo.rs @@ -0,0 +1,62 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUAdapterInfo , typescript_type = "GPUAdapterInfo")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuAdapterInfo` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuAdapterInfo; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = vendor)] + #[doc = "Getter for the `vendor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterInfo/vendor)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn vendor(this: &GpuAdapterInfo) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = architecture)] + #[doc = "Getter for the `architecture` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterInfo/architecture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn architecture(this: &GpuAdapterInfo) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = device)] + #[doc = "Getter for the `device` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterInfo/device)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn device(this: &GpuAdapterInfo) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = description)] + #[doc = "Getter for the `description` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterInfo/description)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn description(this: &GpuAdapterInfo) -> String; +} diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index f1cb9d73df9..0536da1a77e 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -16,6 +16,28 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBuffer; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUBuffer" , 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/GPUBuffer/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(this: &GpuBuffer) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUBuffer" , js_name = usage)] + #[doc = "Getter for the `usage` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/usage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usage(this: &GpuBuffer) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUBuffer" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCanvasCompositingAlphaMode.rs b/crates/web-sys/src/features/gen_GpuCanvasAlphaMode.rs similarity index 78% rename from crates/web-sys/src/features/gen_GpuCanvasCompositingAlphaMode.rs rename to crates/web-sys/src/features/gen_GpuCanvasAlphaMode.rs index 589dada7fdd..d823caa4706 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasCompositingAlphaMode.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasAlphaMode.rs @@ -2,14 +2,14 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] -#[doc = "The `GpuCanvasCompositingAlphaMode` enum."] +#[doc = "The `GpuCanvasAlphaMode` enum."] #[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`*"] +#[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum GpuCanvasCompositingAlphaMode { +pub enum GpuCanvasAlphaMode { Opaque = "opaque", Premultiplied = "premultiplied", } diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index 1a840a8a09f..883efb4b13c 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -31,40 +31,18 @@ impl GpuCanvasConfiguration { ret } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPredefinedColorSpace")] - #[doc = "Change the `colorSpace` field of this object."] + #[cfg(feature = "GpuCanvasAlphaMode")] + #[doc = "Change the `alphaMode` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuPredefinedColorSpace`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space(&mut self, val: GpuPredefinedColorSpace) -> &mut Self { + pub fn alpha_mode(&mut self, val: GpuCanvasAlphaMode) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("colorSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuCanvasCompositingAlphaMode")] - #[doc = "Change the `compositingAlphaMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`, `GpuCanvasConfiguration`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn compositing_alpha_mode(&mut self, val: GpuCanvasCompositingAlphaMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("compositingAlphaMode"), + &JsValue::from("alphaMode"), &JsValue::from(val), ); debug_assert!( diff --git a/crates/web-sys/src/features/gen_GpuError.rs b/crates/web-sys/src/features/gen_GpuError.rs index c76d7ddea0d..dd91c879ff0 100644 --- a/crates/web-sys/src/features/gen_GpuError.rs +++ b/crates/web-sys/src/features/gen_GpuError.rs @@ -26,15 +26,4 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn message(this: &GpuError) -> String; - #[cfg(web_sys_unstable_apis)] - #[wasm_bindgen(catch, constructor, js_class = "GPUError")] - #[doc = "The `new GpuError(..)` constructor, creating a new instance of `GpuError`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUError/GPUError)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuError`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(message: &str) -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs index 36f49b65dab..623b0649398 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs @@ -47,28 +47,6 @@ impl GpuExternalTextureDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPredefinedColorSpace")] - #[doc = "Change the `colorSpace` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`, `GpuPredefinedColorSpace`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space(&mut self, val: GpuPredefinedColorSpace) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HtmlVideoElement")] #[doc = "Change the `source` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index b127394ffb5..70537802bfc 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -11,7 +11,6 @@ use wasm_bindgen::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuFeatureName { DepthClipControl = "depth-clip-control", - Depth24unormStencil8 = "depth24unorm-stencil8", Depth32floatStencil8 = "depth32float-stencil8", TextureCompressionBc = "texture-compression-bc", TextureCompressionEtc2 = "texture-compression-etc2", diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs index 27e5a88317a..8d69dbe30d9 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs @@ -110,28 +110,6 @@ impl GpuImageCopyTextureTagged { self } #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuPredefinedColorSpace")] - #[doc = "Change the `colorSpace` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuPredefinedColorSpace`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space(&mut self, val: GpuPredefinedColorSpace) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] #[doc = "Change the `premultipliedAlpha` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] diff --git a/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs b/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs index e7ebb5c5837..91a6059151a 100644 --- a/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs +++ b/crates/web-sys/src/features/gen_GpuOutOfMemoryError.rs @@ -15,4 +15,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOutOfMemoryError; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "GPUOutOfMemoryError")] + #[doc = "The `new GpuOutOfMemoryError(..)` constructor, creating a new instance of `GpuOutOfMemoryError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUOutOfMemoryError/GPUOutOfMemoryError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOutOfMemoryError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(message: &str) -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuPredefinedColorSpace.rs b/crates/web-sys/src/features/gen_GpuPredefinedColorSpace.rs deleted file mode 100644 index 2f48cc51bc0..00000000000 --- a/crates/web-sys/src/features/gen_GpuPredefinedColorSpace.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_imports)] -use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -#[doc = "The `GpuPredefinedColorSpace` enum."] -#[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `GpuPredefinedColorSpace`*"] -#[doc = ""] -#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] -#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum GpuPredefinedColorSpace { - Srgb = "srgb", -} diff --git a/crates/web-sys/src/features/gen_GpuQuerySet.rs b/crates/web-sys/src/features/gen_GpuQuerySet.rs index 52dad57b724..802057965f1 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySet.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySet.rs @@ -16,6 +16,29 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuQuerySet; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQueryType")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUQuerySet" , js_name = type)] + #[doc = "Getter for the `type` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet/type)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuQueryType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn type_(this: &GpuQuerySet) -> GpuQueryType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUQuerySet" , js_name = count)] + #[doc = "Getter for the `count` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet/count)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn count(this: &GpuQuerySet) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUQuerySet" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 9b02b6992ae..bb7592999e3 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -92,6 +92,27 @@ impl GpuRenderPassDescriptor { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `maxDrawCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_draw_count(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("maxDrawCount"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] #[doc = "Change the `occlusionQuerySet` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index 7d4020926b5..729bf0bd1ec 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -22,10 +22,9 @@ impl GpuShaderModuleCompilationHint { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(layout: &::wasm_bindgen::JsValue) -> Self { + pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.layout(layout); ret } #[cfg(web_sys_unstable_apis)] @@ -47,3 +46,9 @@ impl GpuShaderModuleCompilationHint { self } } +#[cfg(web_sys_unstable_apis)] +impl Default for GpuShaderModuleCompilationHint { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs index 78c14a15f16..80b94bb75b8 100644 --- a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs +++ b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs @@ -236,6 +236,28 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_inter_stage_shader_components(this: &GpuSupportedLimits) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxInterStageShaderVariables)] + #[doc = "Getter for the `maxInterStageShaderVariables` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxInterStageShaderVariables)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_inter_stage_shader_variables(this: &GpuSupportedLimits) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxColorAttachments)] + #[doc = "Getter for the `maxColorAttachments` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxColorAttachments)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_color_attachments(this: &GpuSupportedLimits) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxComputeWorkgroupStorageSize)] #[doc = "Getter for the `maxComputeWorkgroupStorageSize` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuTexture.rs b/crates/web-sys/src/features/gen_GpuTexture.rs index 52d410ec5ca..acd4ffb1161 100644 --- a/crates/web-sys/src/features/gen_GpuTexture.rs +++ b/crates/web-sys/src/features/gen_GpuTexture.rs @@ -16,6 +16,96 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTexture; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = width)] + #[doc = "Getter for the `width` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/width)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn width(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = height)] + #[doc = "Getter for the `height` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/height)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn height(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = depthOrArrayLayers)] + #[doc = "Getter for the `depthOrArrayLayers` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/depthOrArrayLayers)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn depth_or_array_layers(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = mipLevelCount)] + #[doc = "Getter for the `mipLevelCount` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/mipLevelCount)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mip_level_count(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = sampleCount)] + #[doc = "Getter for the `sampleCount` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/sampleCount)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn sample_count(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureDimension")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = dimension)] + #[doc = "Getter for the `dimension` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/dimension)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`, `GpuTextureDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn dimension(this: &GpuTexture) -> GpuTextureDimension; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = format)] + #[doc = "Getter for the `format` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/format)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn format(this: &GpuTexture) -> GpuTextureFormat; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = usage)] + #[doc = "Getter for the `usage` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/usage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usage(this: &GpuTexture) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUTexture" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuTextureFormat.rs b/crates/web-sys/src/features/gen_GpuTextureFormat.rs index 8d638f44568..7f2772bb00a 100644 --- a/crates/web-sys/src/features/gen_GpuTextureFormat.rs +++ b/crates/web-sys/src/features/gen_GpuTextureFormat.rs @@ -51,7 +51,6 @@ pub enum GpuTextureFormat { Depth24plus = "depth24plus", Depth24plusStencil8 = "depth24plus-stencil8", Depth32float = "depth32float", - Depth24unormStencil8 = "depth24unorm-stencil8", Depth32floatStencil8 = "depth32float-stencil8", Bc1RgbaUnorm = "bc1-rgba-unorm", Bc1RgbaUnormSrgb = "bc1-rgba-unorm-srgb", diff --git a/crates/web-sys/src/features/gen_GpuValidationError.rs b/crates/web-sys/src/features/gen_GpuValidationError.rs index 7d9b8144e04..7b6b0d7db9c 100644 --- a/crates/web-sys/src/features/gen_GpuValidationError.rs +++ b/crates/web-sys/src/features/gen_GpuValidationError.rs @@ -15,4 +15,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuValidationError; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "GPUValidationError")] + #[doc = "The `new GpuValidationError(..)` constructor, creating a new instance of `GpuValidationError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUValidationError/GPUValidationError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuValidationError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(message: &str) -> Result; } diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 80482b5e3bc..59d6818792d 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2368,6 +2368,12 @@ mod gen_GpuAdapter; #[cfg(feature = "GpuAdapter")] pub use gen_GpuAdapter::*; +#[cfg(feature = "GpuAdapterInfo")] +#[allow(non_snake_case)] +mod gen_GpuAdapterInfo; +#[cfg(feature = "GpuAdapterInfo")] +pub use gen_GpuAdapterInfo::*; + #[cfg(feature = "GpuAddressMode")] #[allow(non_snake_case)] mod gen_GpuAddressMode; @@ -2470,11 +2476,11 @@ mod gen_GpuBufferDescriptor; #[cfg(feature = "GpuBufferDescriptor")] pub use gen_GpuBufferDescriptor::*; -#[cfg(feature = "GpuCanvasCompositingAlphaMode")] +#[cfg(feature = "GpuCanvasAlphaMode")] #[allow(non_snake_case)] -mod gen_GpuCanvasCompositingAlphaMode; -#[cfg(feature = "GpuCanvasCompositingAlphaMode")] -pub use gen_GpuCanvasCompositingAlphaMode::*; +mod gen_GpuCanvasAlphaMode; +#[cfg(feature = "GpuCanvasAlphaMode")] +pub use gen_GpuCanvasAlphaMode::*; #[cfg(feature = "GpuCanvasConfiguration")] #[allow(non_snake_case)] @@ -2782,12 +2788,6 @@ mod gen_GpuPowerPreference; #[cfg(feature = "GpuPowerPreference")] pub use gen_GpuPowerPreference::*; -#[cfg(feature = "GpuPredefinedColorSpace")] -#[allow(non_snake_case)] -mod gen_GpuPredefinedColorSpace; -#[cfg(feature = "GpuPredefinedColorSpace")] -pub use gen_GpuPredefinedColorSpace::*; - #[cfg(feature = "GpuPrimitiveState")] #[allow(non_snake_case)] mod gen_GpuPrimitiveState; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 7a2aa740112..689d7fdbfcb 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -28,6 +28,8 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxVertexAttributes; readonly attribute unsigned long maxVertexBufferArrayStride; readonly attribute unsigned long maxInterStageShaderComponents; + readonly attribute unsigned long maxInterStageShaderVariables; + readonly attribute unsigned long maxColorAttachments; readonly attribute unsigned long maxComputeWorkgroupStorageSize; readonly attribute unsigned long maxComputeInvocationsPerWorkgroup; readonly attribute unsigned long maxComputeWorkgroupSizeX; @@ -41,8 +43,12 @@ interface GPUSupportedFeatures { readonly setlike; }; -enum GPUPredefinedColorSpace { - "srgb", +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUAdapterInfo { + readonly attribute DOMString vendor; + readonly attribute DOMString architecture; + readonly attribute DOMString device; + readonly attribute DOMString description; }; interface mixin NavigatorGPU { @@ -64,17 +70,17 @@ dictionary GPURequestAdapterOptions { enum GPUPowerPreference { "low-power", - "high-performance", + "high-performance" }; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUAdapter { - readonly attribute DOMString name; [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); + Promise requestAdapterInfo(optional sequence unmaskHints = []); }; dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { @@ -85,7 +91,6 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { enum GPUFeatureName { "depth-clip-control", - "depth24unorm-stencil8", "depth32float-stencil8", "texture-compression-bc", "texture-compression-etc2", @@ -93,7 +98,7 @@ enum GPUFeatureName { "timestamp-query", "indirect-first-instance", "shader-f16", - "bgra8unorm-storage", + "bgra8unorm-storage" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -134,6 +139,9 @@ interface GPUBuffer { undefined unmap(); undefined destroy(); + + readonly attribute GPUSize64 size; + readonly attribute GPUBufferUsageFlags usage; }; GPUBuffer includes GPUObjectBase; @@ -170,6 +178,15 @@ interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); undefined destroy(); + + readonly attribute GPUIntegerCoordinate width; + readonly attribute GPUIntegerCoordinate height; + readonly attribute GPUIntegerCoordinate depthOrArrayLayers; + readonly attribute GPUIntegerCoordinate mipLevelCount; + readonly attribute GPUSize32 sampleCount; + readonly attribute GPUTextureDimension dimension; + readonly attribute GPUTextureFormat format; + readonly attribute GPUTextureUsageFlags usage; }; GPUTexture includes GPUObjectBase; @@ -186,7 +203,7 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { enum GPUTextureDimension { "1d", "2d", - "3d", + "3d" }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; @@ -220,13 +237,13 @@ enum GPUTextureViewDimension { "2d-array", "cube", "cube-array", - "3d", + "3d" }; enum GPUTextureAspect { "all", "stencil-only", - "depth-only", + "depth-only" }; enum GPUTextureFormat { @@ -284,9 +301,6 @@ enum GPUTextureFormat { "depth24plus-stencil8", "depth32float", - // "depth24unorm-stencil8" feature - "depth24unorm-stencil8", - // "depth32float-stencil8" feature "depth32float-stencil8", @@ -349,7 +363,7 @@ enum GPUTextureFormat { "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", - "astc-12x12-unorm-srgb", + "astc-12x12-unorm-srgb" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -360,7 +374,7 @@ GPUExternalTexture includes GPUObjectBase; dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase { required HTMLVideoElement source; - GPUPredefinedColorSpace colorSpace = "srgb"; + PredefinedColorSpace colorSpace = "srgb"; }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -384,17 +398,17 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { enum GPUAddressMode { "clamp-to-edge", "repeat", - "mirror-repeat", + "mirror-repeat" }; enum GPUFilterMode { "nearest", - "linear", + "linear" }; enum GPUMipmapFilterMode { "nearest", - "linear", + "linear" }; enum GPUCompareFunction { @@ -405,7 +419,7 @@ enum GPUCompareFunction { "greater", "not-equal", "greater-equal", - "always", + "always" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -439,7 +453,7 @@ namespace GPUShaderStage { enum GPUBufferBindingType { "uniform", "storage", - "read-only-storage", + "read-only-storage" }; dictionary GPUBufferBindingLayout { @@ -451,7 +465,7 @@ dictionary GPUBufferBindingLayout { enum GPUSamplerBindingType { "filtering", "non-filtering", - "comparison", + "comparison" }; dictionary GPUSamplerBindingLayout { @@ -463,7 +477,7 @@ enum GPUTextureSampleType { "unfilterable-float", "depth", "sint", - "uint", + "uint" }; dictionary GPUTextureBindingLayout { @@ -473,7 +487,7 @@ dictionary GPUTextureBindingLayout { }; enum GPUStorageTextureAccess { - "write-only", + "write-only" }; dictionary GPUStorageTextureBindingLayout { @@ -530,13 +544,13 @@ dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { }; dictionary GPUShaderModuleCompilationHint { - required (GPUPipelineLayout or GPUAutoLayoutMode) layout; + (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; enum GPUCompilationMessageType { "error", "warning", - "info", + "info" }; [Exposed=(Window, DedicatedWorker), Serializable, SecureContext] @@ -555,7 +569,7 @@ interface GPUCompilationInfo { }; enum GPUAutoLayoutMode { - "auto", + "auto" }; dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase { @@ -613,18 +627,18 @@ enum GPUPrimitiveTopology { "line-list", "line-strip", "triangle-list", - "triangle-strip", + "triangle-strip" }; enum GPUFrontFace { "ccw", - "cw", + "cw" }; enum GPUCullMode { "none", "front", - "back", + "back" }; dictionary GPUMultisampleState { @@ -678,7 +692,7 @@ enum GPUBlendFactor { "one-minus-dst-alpha", "src-alpha-saturated", "constant", - "one-minus-constant", + "one-minus-constant" }; enum GPUBlendOperation { @@ -686,7 +700,7 @@ enum GPUBlendOperation { "subtract", "reverse-subtract", "min", - "max", + "max" }; dictionary GPUDepthStencilState { @@ -721,12 +735,12 @@ enum GPUStencilOperation { "increment-clamp", "decrement-clamp", "increment-wrap", - "decrement-wrap", + "decrement-wrap" }; enum GPUIndexFormat { "uint16", - "uint32", + "uint32" }; enum GPUVertexFormat { @@ -759,12 +773,12 @@ enum GPUVertexFormat { "sint32", "sint32x2", "sint32x3", - "sint32x4", + "sint32x4" }; enum GPUVertexStepMode { "vertex", - "instance", + "instance" }; dictionary GPUVertexState : GPUProgrammableStage { @@ -863,7 +877,7 @@ dictionary GPUImageCopyTexture { }; dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture { - GPUPredefinedColorSpace colorSpace = "srgb"; + PredefinedColorSpace colorSpace = "srgb"; boolean premultipliedAlpha = false; }; @@ -904,7 +918,7 @@ GPUComputePassEncoder includes GPUBindingCommandsMixin; enum GPUComputePassTimestampLocation { "beginning", - "end", + "end" }; dictionary GPUComputePassTimestampWrite { @@ -945,7 +959,7 @@ GPURenderPassEncoder includes GPURenderCommandsMixin; enum GPURenderPassTimestampLocation { "beginning", - "end", + "end" }; dictionary GPURenderPassTimestampWrite { @@ -961,6 +975,7 @@ dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { GPURenderPassDepthStencilAttachment depthStencilAttachment; GPUQuerySet occlusionQuerySet; GPURenderPassTimestampWrites timestampWrites = []; + GPUSize64 maxDrawCount = 50000000; }; dictionary GPURenderPassColorAttachment { @@ -988,12 +1003,12 @@ dictionary GPURenderPassDepthStencilAttachment { enum GPULoadOp { "load", - "clear", + "clear" }; enum GPUStoreOp { "store", - "discard", + "discard" }; dictionary GPURenderPassLayout: GPUObjectDescriptorBase { @@ -1074,6 +1089,9 @@ GPUQueue includes GPUObjectBase; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUQuerySet { undefined destroy(); + + readonly attribute GPUQueryType type; + readonly attribute GPUSize32 count; }; GPUQuerySet includes GPUObjectBase; @@ -1084,7 +1102,7 @@ dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase { enum GPUQueryType { "occlusion", - "timestamp", + "timestamp" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1097,9 +1115,9 @@ interface GPUCanvasContext { GPUTexture getCurrentTexture(); }; -enum GPUCanvasCompositingAlphaMode { +enum GPUCanvasAlphaMode { "opaque", - "premultiplied", + "premultiplied" }; dictionary GPUCanvasConfiguration { @@ -1107,12 +1125,12 @@ dictionary GPUCanvasConfiguration { required GPUTextureFormat format; GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT sequence viewFormats = []; - GPUPredefinedColorSpace colorSpace = "srgb"; - GPUCanvasCompositingAlphaMode compositingAlphaMode = "opaque"; + PredefinedColorSpace colorSpace = "srgb"; + GPUCanvasAlphaMode alphaMode = "opaque"; }; enum GPUDeviceLostReason { - "destroyed", + "destroyed" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -1127,21 +1145,22 @@ partial interface GPUDevice { enum GPUErrorFilter { "out-of-memory", - "validation", + "validation" }; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUError { - constructor(DOMString message); readonly attribute DOMString message; }; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUOutOfMemoryError : GPUError { + constructor(DOMString message); }; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUValidationError : GPUError { + constructor(DOMString message); }; partial interface GPUDevice { From 321595803cab366dcd724c38f046b5bb3ba99302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freires?= Date: Tue, 21 Jun 2022 15:07:47 -0300 Subject: [PATCH 033/641] update nightly version (#2960) --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 331164c5837..79a08c9f65f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup default nightly-2021-09-02 + - run: rustup default nightly-2022-05-19 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. @@ -242,7 +242,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup default nightly-2021-09-02 + - run: rustup default nightly-2022-05-19 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - run: | From ebe658739c075fe78781d87ee9aa46533922476d Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Tue, 21 Jun 2022 20:11:27 +0200 Subject: [PATCH 034/641] fix(cli-support) Differentiate JS docs and TS docs when generating adapters. (#2956) A bug has been raised in https://github.com/rustwasm/wasm-bindgen/issues/2947, which is the consequence of a bug introduced in https://github.com/rustwasm/wasm-bindgen/pull/2909. This patch fixes it by differentiating JS docs and TS docs clearly. The `Context::push_setter` and `Context::push_getter` methods now receive a `js_docs` and a `ts_docs`, which prevent any confusions. --- crates/cli-support/src/js/mod.rs | 60 +++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 707a4523328..8ca6a854a40 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2564,31 +2564,33 @@ impl<'a> Context<'a> { false => None, }; + let js_docs = format_doc_comments(&export.comments, Some(js_doc)); + match &export.kind { AuxExportKind::Function(name) => { - let docs = format_doc_comments(&export.comments, Some(js_doc)); - if let Some(ts_sig) = ts_sig { - self.typescript.push_str(&docs); + self.typescript.push_str(&js_docs); self.typescript.push_str("export function "); self.typescript.push_str(&name); self.typescript.push_str(ts_sig); self.typescript.push_str(";\n"); } - self.export(&name, &format!("function{}", code), Some(&docs))?; + + self.export(&name, &format!("function{}", code), Some(&js_docs))?; self.globals.push_str("\n"); } AuxExportKind::Constructor(class) => { - let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); + if exported.has_constructor { bail!("found duplicate constructor for class `{}`", class); } + exported.has_constructor = true; - exported.push(&docs, "constructor", "", &code, ts_sig); + exported.push(&js_docs, "constructor", "", &code, ts_sig); } AuxExportKind::Getter { class, field, .. } => { - let docs = format_doc_comments(&export.comments, None); + let ts_docs = format_doc_comments(&export.comments, None); let ret_ty = match export.generate_typescript { true => match &ts_ret_ty { Some(s) => Some(s.as_str()), @@ -2596,27 +2598,34 @@ impl<'a> Context<'a> { }, false => None, }; + let exported = require_class(&mut self.exported_classes, class); - exported.push_getter(&docs, field, &code, ret_ty); + exported.push_getter(&js_docs, &ts_docs, field, &code, ret_ty); } AuxExportKind::Setter { class, field, .. } => { - let docs = format_doc_comments(&export.comments, None); + let ts_docs = format_doc_comments(&export.comments, None); let arg_ty = match export.generate_typescript { true => Some(ts_arg_tys[0].as_str()), false => None, }; let exported = require_class(&mut self.exported_classes, class); - exported.push_setter(&docs, field, &code, arg_ty, might_be_optional_field); + + exported.push_setter( + &js_docs, + &ts_docs, + field, + &code, + arg_ty, + might_be_optional_field, + ); } AuxExportKind::StaticFunction { class, name } => { - let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); - exported.push(&docs, name, "static ", &code, ts_sig); + exported.push(&js_docs, name, "static ", &code, ts_sig); } AuxExportKind::Method { class, name, .. } => { - let docs = format_doc_comments(&export.comments, Some(js_doc)); let exported = require_class(&mut self.exported_classes, class); - exported.push(&docs, name, "", &code, ts_sig); + exported.push(&js_docs, name, "", &code, ts_sig); } } } @@ -3836,11 +3845,20 @@ impl ExportedClass { /// Used for adding a getter to a class, mainly to ensure that TypeScript /// generation is handled specially. - fn push_getter(&mut self, docs: &str, field: &str, js: &str, ret_ty: Option<&str>) { - self.push_accessor(docs, field, js, "get "); + fn push_getter( + &mut self, + js_docs: &str, + ts_docs: &str, + field: &str, + js: &str, + ret_ty: Option<&str>, + ) { + self.push_accessor(js_docs, field, js, "get "); + if let Some(ret_ty) = ret_ty { - self.push_accessor_ts(docs, field, ret_ty, false); + self.push_accessor_ts(ts_docs, field, ret_ty, false); } + self.readable_properties.push(field.to_string()); } @@ -3848,15 +3866,17 @@ impl ExportedClass { /// generation is handled specially. fn push_setter( &mut self, - docs: &str, + js_docs: &str, + ts_docs: &str, field: &str, js: &str, ret_ty: Option<&str>, might_be_optional_field: bool, ) { - self.push_accessor(docs, field, js, "set "); + self.push_accessor(js_docs, field, js, "set "); + if let Some(ret_ty) = ret_ty { - let is_optional = self.push_accessor_ts(docs, field, ret_ty, true); + let is_optional = self.push_accessor_ts(ts_docs, field, ret_ty, true); *is_optional = might_be_optional_field; } } From df1b591a1cb88f0255844d26b13f5364fdb0950e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freires?= Date: Wed, 22 Jun 2022 17:44:52 -0300 Subject: [PATCH 035/641] Add exporting Rust functions as variadic JS functions (#2954) * add variadic argument into function structures * bind variadic function last argument * comment variadic assertions * add variadic functions tests * fix variadic var name * add new schema file hash in the shared crate * add variadic param in JS doc * remove assert_not_variadic references * add variadic TS tests * update variadic docs --- crates/backend/src/ast.rs | 2 + crates/backend/src/encode.rs | 1 + crates/cli-support/src/js/binding.rs | 45 +++++++++++++++++-- crates/cli-support/src/js/mod.rs | 4 +- crates/cli-support/src/wit/mod.rs | 4 ++ crates/cli-support/src/wit/nonstandard.rs | 2 + crates/macro-support/src/parser.rs | 16 +------ crates/shared/src/lib.rs | 1 + crates/shared/src/schema_hash_approval.rs | 2 +- crates/typescript-tests/src/simple_fn.rs | 5 +++ crates/typescript-tests/src/simple_fn.ts | 2 + .../attributes/on-js-imports/variadic.md | 15 +++++++ tests/wasm/api.js | 30 +++++++++---- tests/wasm/api.rs | 14 ++++++ 14 files changed, 114 insertions(+), 29 deletions(-) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 80af028f422..51e57e0293c 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -303,6 +303,8 @@ pub struct Function { pub r#async: bool, /// Whether to generate a typescript definition for this function pub generate_typescript: bool, + /// Whether this is a function with a variadict parameter + pub variadic: bool, } /// Information about a Struct being exported diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 6fa1245b32c..49973a686a1 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -212,6 +212,7 @@ fn shared_function<'a>(func: &'a ast::Function, _intern: &'a Interner) -> Functi asyncness: func.r#async, name: &func.name, generate_typescript: func.generate_typescript, + variadic: func.variadic, } } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index d2a52eebe7a..c29e808587e 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -102,6 +102,7 @@ impl<'a, 'b> Builder<'a, 'b> { instructions: &[InstructionData], explicit_arg_names: &Option>, asyncness: bool, + variadic: bool, ) -> Result { if self .cx @@ -193,7 +194,17 @@ impl<'a, 'b> Builder<'a, 'b> { let mut code = String::new(); code.push_str("("); - code.push_str(&function_args.join(", ")); + if variadic { + if let Some((last, non_variadic_args)) = function_args.split_last() { + code.push_str(&non_variadic_args.join(", ")); + if non_variadic_args.len() > 0 { + code.push_str(", "); + } + code.push_str((String::from("...") + last).as_str()) + } + } else { + code.push_str(&function_args.join(", ")); + } code.push_str(") {\n"); let mut call = js.prelude; @@ -227,8 +238,9 @@ impl<'a, 'b> Builder<'a, 'b> { &adapter.inner_results, &mut might_be_optional_field, asyncness, + variadic, ); - let js_doc = self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty); + let js_doc = self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty, variadic); Ok(JsFunction { code, @@ -254,6 +266,7 @@ impl<'a, 'b> Builder<'a, 'b> { result_tys: &[AdapterType], might_be_optional_field: &mut bool, asyncness: bool, + variadic: bool, ) -> (String, Vec, Option) { // Build up the typescript signature as well let mut omittable = true; @@ -284,7 +297,19 @@ impl<'a, 'b> Builder<'a, 'b> { } ts_args.reverse(); ts_arg_tys.reverse(); - let mut ts = format!("({})", ts_args.join(", ")); + let mut ts = String::from("("); + if variadic { + if let Some((last, non_variadic_args)) = ts_args.split_last() { + ts.push_str(&non_variadic_args.join(", ")); + if non_variadic_args.len() > 0 { + ts.push_str(", "); + } + ts.push_str((String::from("...") + last).as_str()) + } + } else { + ts.push_str(&format!("{}", ts_args.join(", "))); + }; + ts.push_str(")"); // If this function is an optional field's setter, it should have only // one arg, and omittable should be `true`. @@ -318,15 +343,27 @@ impl<'a, 'b> Builder<'a, 'b> { arg_names: &[String], arg_tys: &[&AdapterType], ts_ret: &Option, + variadic: bool, ) -> String { let mut ret = String::new(); - for (name, ty) in arg_names.iter().zip(arg_tys) { + let (variadic_arg, fn_arg_names) = match arg_names.split_last() { + Some((last, args)) if variadic => (Some(last), args), + _ => (None, arg_names), + }; + for (name, ty) in fn_arg_names.iter().zip(arg_tys) { ret.push_str("@param {"); adapter2ts(ty, &mut ret); ret.push_str("} "); ret.push_str(name); ret.push_str("\n"); } + if let (Some(name), Some(ty)) = (variadic_arg, arg_tys.last()) { + ret.push_str("@param {..."); + adapter2ts(ty, &mut ret); + ret.push_str("} "); + ret.push_str(name); + ret.push_str("\n"); + } if let Some(ts) = ts_ret { if ts != "void" { ret.push_str(&format!("@returns {{{}}}", ts)); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8ca6a854a40..2c9cddadbf9 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2511,10 +2511,12 @@ impl<'a> Context<'a> { builder.catch(catch); let mut arg_names = &None; let mut asyncness = false; + let mut variadic = false; match kind { Kind::Export(export) => { arg_names = &export.arg_names; asyncness = export.asyncness; + variadic = export.variadic; match &export.kind { AuxExportKind::Function(_) => {} AuxExportKind::StaticFunction { .. } => {} @@ -2539,7 +2541,7 @@ impl<'a> Context<'a> { catch, log_error, } = builder - .process(&adapter, instrs, arg_names, asyncness) + .process(&adapter, instrs, arg_names, asyncness, variadic) .with_context(|| match kind { Kind::Export(e) => format!("failed to generate bindings for `{}`", e.debug_name), Kind::Import(i) => { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index ee36d7edbfe..a05390d2645 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -464,6 +464,7 @@ impl<'a> Context<'a> { asyncness: export.function.asyncness, kind, generate_typescript: export.function.generate_typescript, + variadic: export.function.variadic, }, ); Ok(()) @@ -822,6 +823,7 @@ impl<'a> Context<'a> { consumed: false, }, generate_typescript: field.generate_typescript, + variadic: false, }, ); @@ -851,6 +853,7 @@ impl<'a> Context<'a> { consumed: false, }, generate_typescript: field.generate_typescript, + variadic: false, }, ); } @@ -1085,6 +1088,7 @@ impl<'a> Context<'a> { asyncness: false, kind, generate_typescript: true, + variadic: false, }; assert!(self.aux.export_map.insert(id, export).is_none()); } diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index abae06daf9c..d7131d291a2 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -79,6 +79,8 @@ pub struct AuxExport { pub kind: AuxExportKind, /// Whether typescript bindings should be generated for this export. pub generate_typescript: bool, + /// Whether typescript bindings should be generated for this export. + pub variadic: bool, } /// All possible kinds of exports from a wasm module. diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a4b13af95e6..b927f570399 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -411,7 +411,6 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { }; let attrs = BindgenAttrs::find(&mut field.attrs)?; - assert_not_variadic(&attrs)?; if attrs.skip().is_some() { attrs.check_used()?; continue; @@ -627,7 +626,6 @@ impl ConvertToAst for syn::ForeignItemType { type Target = ast::ImportKind; fn convert(self, attrs: BindgenAttrs) -> Result { - assert_not_variadic(&attrs)?; let js_name = attrs .js_name() .map(|s| s.0) @@ -678,7 +676,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte if self.mutability.is_some() { bail_span!(self.mutability, "cannot import mutable globals yet") } - assert_not_variadic(&opts)?; + let default_name = self.ident.to_string(); let js_name = opts .js_name() @@ -718,7 +716,6 @@ impl ConvertToAst for syn::ItemFn { if self.sig.unsafety.is_some() { bail_span!(self.sig.unsafety, "can only #[wasm_bindgen] safe functions"); } - assert_not_variadic(&attrs)?; let ret = function_from_decl( &self.sig.ident, @@ -859,6 +856,7 @@ fn function_from_decl( rust_vis: vis, r#async: sig.asyncness.is_some(), generate_typescript: opts.skip_typescript().is_none(), + variadic: opts.variadic().is_some(), }, method_self, )) @@ -1558,16 +1556,6 @@ fn assert_no_lifetimes(sig: &syn::Signature) -> Result<(), Diagnostic> { Diagnostic::from_vec(walk.diagnostics) } -/// This method always fails if the BindgenAttrs contain variadic -fn assert_not_variadic(attrs: &BindgenAttrs) -> Result<(), Diagnostic> { - if let Some(span) = attrs.variadic() { - let msg = "the `variadic` attribute can only be applied to imported \ - (`extern`) functions"; - return Err(Diagnostic::span_error(*span, msg)); - } - Ok(()) -} - /// Extracts the last ident from the path fn extract_path_ident(path: &syn::Path) -> Result { for segment in path.segments.iter() { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 2c2eecd33a8..11372856aff 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -118,6 +118,7 @@ macro_rules! shared_api { asyncness: bool, name: &'a str, generate_typescript: bool, + variadic: bool, } struct Struct<'a> { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 32a0f51d419..a2d788aada1 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "3468290064813615840"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "16056751188521403565"; #[test] fn schema_version() { diff --git a/crates/typescript-tests/src/simple_fn.rs b/crates/typescript-tests/src/simple_fn.rs index fe99aced910..2449886f5cc 100644 --- a/crates/typescript-tests/src/simple_fn.rs +++ b/crates/typescript-tests/src/simple_fn.rs @@ -7,3 +7,8 @@ pub fn greet(_: &str) {} pub fn take_and_return_bool(_: bool) -> bool { true } + +#[wasm_bindgen(variadic)] +pub fn variadic_function(arr: &JsValue) -> JsValue { + arr.into() +} diff --git a/crates/typescript-tests/src/simple_fn.ts b/crates/typescript-tests/src/simple_fn.ts index b25a31431f2..d7d454b70f7 100644 --- a/crates/typescript-tests/src/simple_fn.ts +++ b/crates/typescript-tests/src/simple_fn.ts @@ -4,3 +4,5 @@ import * as wasm from '../pkg/typescript_tests_bg.wasm'; const wbg_greet: (a: string) => void = wbg.greet; const wasm_greet: (a: number, b: number) => void = wasm.greet; const take_and_return_bool: (a: boolean) => boolean = wbg.take_and_return_bool; +const wbg_variadic_function: (...arr: any) => any = wbg.variadic_function; +const wasm_variadic_function: (arr: number) => number = wasm.variadic_function; diff --git a/guide/src/reference/attributes/on-js-imports/variadic.md b/guide/src/reference/attributes/on-js-imports/variadic.md index 744ca458981..31cec10a12d 100644 --- a/guide/src/reference/attributes/on-js-imports/variadic.md +++ b/guide/src/reference/attributes/on-js-imports/variadic.md @@ -36,3 +36,18 @@ extern "C" { when we call this function, the last argument will be expanded as the javascript expects. + +To export a rust function to javascript with a variadic argument, we will use the same bindgen variadic attribute and assume that the last argument will be the variadic array. For example the following rust function: + +```rust +#[wasm_bindgen(variadic)] +pub fn variadic_function(arr: &JsValue) -> JsValue { + arr.into() +} +``` + +will generate the following TS interface + +```ts +export function variadic_function(...arr: any): any; +``` diff --git a/tests/wasm/api.js b/tests/wasm/api.js index 59daca205b6..ebbce04311a 100644 --- a/tests/wasm/api.js +++ b/tests/wasm/api.js @@ -20,8 +20,8 @@ exports.js_works = () => { assert.strictEqual(wasm.api_get_false(), false); wasm.api_test_bool(true, false, 1.0); - assert.strictEqual(typeof(wasm.api_mk_symbol()), 'symbol'); - assert.strictEqual(typeof(wasm.api_mk_symbol2('a')), 'symbol'); + assert.strictEqual(typeof (wasm.api_mk_symbol()), 'symbol'); + assert.strictEqual(typeof (wasm.api_mk_symbol2('a')), 'symbol'); assert.strictEqual(Symbol.keyFor(wasm.api_mk_symbol()), undefined); assert.strictEqual(Symbol.keyFor(wasm.api_mk_symbol2('b')), undefined); @@ -29,15 +29,27 @@ exports.js_works = () => { wasm.api_acquire_string('foo', null); assert.strictEqual(wasm.api_acquire_string2(''), ''); assert.strictEqual(wasm.api_acquire_string2('a'), 'a'); + + let arr = [1, 2, 3, 4, {}, ['a', 'b', 'c']] + wasm.api_completely_variadic(...arr).forEach((element, index) => { + assert.strictEqual(element, arr[index]); + }); + assert.strictEqual( + wasm.api_completely_variadic().length, + 0 + ); + wasm.api_variadic_with_prefixed_params([], {}, ...arr).forEach((element, index) => { + assert.strictEqual(element, arr[index]); + }); }; exports.js_eq_works = () => { assert.strictEqual(wasm.eq_test('a', 'a'), true); assert.strictEqual(wasm.eq_test('a', 'b'), false); assert.strictEqual(wasm.eq_test(NaN, NaN), false); - assert.strictEqual(wasm.eq_test({a: 'a'}, {a: 'a'}), false); + assert.strictEqual(wasm.eq_test({ a: 'a' }, { a: 'a' }), false); assert.strictEqual(wasm.eq_test1(NaN), false); - let x = {a: 'a'}; + let x = { a: 'a' }; assert.strictEqual(wasm.eq_test(x, x), true); assert.strictEqual(wasm.eq_test1(x), true); }; @@ -48,16 +60,16 @@ exports.debug_values = () => ([ 0, 1.0, true, - [1,2,3], + [1, 2, 3], "string", - {test: "object"}, + { test: "object" }, [1.0, [2.0, 3.0]], () => (null), new Set(), ]); exports.assert_function_table = (x, i) => { - const rawWasm = require('wasm-bindgen-test.js').__wasm; - assert.ok(x instanceof WebAssembly.Table); - assert.strictEqual(x.get(i), rawWasm.function_table_lookup); + const rawWasm = require('wasm-bindgen-test.js').__wasm; + assert.ok(x instanceof WebAssembly.Table); + assert.strictEqual(x.get(i), rawWasm.function_table_lookup); }; diff --git a/tests/wasm/api.rs b/tests/wasm/api.rs index 84b626e6226..c1c542d67ac 100644 --- a/tests/wasm/api.rs +++ b/tests/wasm/api.rs @@ -126,6 +126,20 @@ pub fn eq_test1(a: &JsValue) -> bool { a == a } +#[wasm_bindgen(variadic)] +pub fn api_completely_variadic(args: &JsValue) -> JsValue { + args.into() +} + +#[wasm_bindgen(variadic)] +pub fn api_variadic_with_prefixed_params( + first: &JsValue, + second: &JsValue, + args: &JsValue, +) -> JsValue { + args.into() +} + #[wasm_bindgen_test] fn null_keeps_working() { assert_null(JsValue::null()); From 41e239feaf299e895fab2bf77cb9421ab76fc03b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 23 Jun 2022 23:44:35 +0200 Subject: [PATCH 036/641] Replace lazy_static with once_cell (#2962) * Remove no-op use statements * Replace lazy_static with once_cell --- crates/backend/Cargo.toml | 2 +- crates/backend/src/ast.rs | 1 - crates/backend/src/codegen.rs | 6 ++---- crates/backend/src/util.rs | 1 - crates/macro-support/src/parser.rs | 2 -- crates/test/src/rt/detect.rs | 1 - crates/test/src/rt/mod.rs | 1 - crates/web-sys/tests/wasm/indexeddb.rs | 1 - crates/webidl/Cargo.toml | 2 +- crates/webidl/src/constants.rs | 29 ++++++++++++-------------- crates/webidl/src/first_pass.rs | 1 - crates/webidl/src/idl_type.rs | 1 - crates/webidl/src/util.rs | 2 -- src/closure.rs | 1 - 14 files changed, 17 insertions(+), 34 deletions(-) diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index c3a89d0e185..0bb44bbca4a 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -17,8 +17,8 @@ extra-traits = ["syn/extra-traits"] [dependencies] bumpalo = "3.0.0" -lazy_static = "1.0.2" log = "0.4" +once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 51e57e0293c..4671bf4551a 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -5,7 +5,6 @@ use crate::Diagnostic; use proc_macro2::{Ident, Span}; use std::hash::{Hash, Hasher}; -use syn; use wasm_bindgen_shared as shared; /// An abstract syntax tree representing a rust program. Contains diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index ac179518036..348d10295ff 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -2,12 +2,12 @@ use crate::ast; use crate::encode; use crate::util::ShortHash; use crate::Diagnostic; +use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; use quote::{quote, ToTokens}; use std::collections::{HashMap, HashSet}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Mutex; -use syn; use wasm_bindgen_shared as shared; /// A trait for converting AST structs into Tokens and adding them to a TokenStream, @@ -1321,9 +1321,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { // It's up to the descriptors themselves to ensure they have unique // names for unique items imported, currently done via `ShortHash` and // hashing appropriate data into the symbol name. - lazy_static::lazy_static! { - static ref DESCRIPTORS_EMITTED: Mutex> = Default::default(); - } + static DESCRIPTORS_EMITTED: Lazy>> = Lazy::new(Default::default); let ident = self.ident; diff --git a/crates/backend/src/util.rs b/crates/backend/src/util.rs index 73cf20bb0ea..1396bd9051b 100644 --- a/crates/backend/src/util.rs +++ b/crates/backend/src/util.rs @@ -12,7 +12,6 @@ use std::sync::atomic::Ordering::SeqCst; use crate::ast; use proc_macro2::{self, Ident}; -use syn; /// Check whether a given `&str` is a Rust keyword fn is_rust_keyword(name: &str) -> bool { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index b927f570399..ac0e835dfda 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -8,8 +8,6 @@ use backend::util::{ident_ty, ShortHash}; use backend::Diagnostic; use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; -use shared; -use syn; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; diff --git a/crates/test/src/rt/detect.rs b/crates/test/src/rt/detect.rs index 6f83bae8440..eeb92455821 100644 --- a/crates/test/src/rt/detect.rs +++ b/crates/test/src/rt/detect.rs @@ -1,6 +1,5 @@ //! Runtime detection of whether we're in node.js or a browser. -use js_sys; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index bf08fe19e42..ad989426bdd 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -87,7 +87,6 @@ // Overall this is all somewhat in flux as it's pretty new, and feedback is // always of course welcome! -use console_error_panic_hook; use js_sys::{Array, Function, Promise}; use std::cell::{Cell, RefCell}; use std::fmt; diff --git a/crates/web-sys/tests/wasm/indexeddb.rs b/crates/web-sys/tests/wasm/indexeddb.rs index b85c3e4346b..cfaa2ea431b 100644 --- a/crates/web-sys/tests/wasm/indexeddb.rs +++ b/crates/web-sys/tests/wasm/indexeddb.rs @@ -1,5 +1,4 @@ use wasm_bindgen_test::*; -use web_sys; #[wasm_bindgen_test] fn accessor_works() { diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 6af4fc57414..4e6814f98fa 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -22,6 +22,6 @@ quote = '1.0' syn = { version = '1.0', features = ['full'] } wasm-bindgen-backend = { version = "=0.2.81", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } -lazy_static = "1.0.2" +once_cell = "1.12" sourcefile = "0.1" structopt = "0.3.9" diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 447e3e48d79..d2dfe839f48 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -1,9 +1,9 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::collections::BTreeSet; use std::iter::FromIterator; -lazy_static! { - pub(crate) static ref BUILTIN_IDENTS: BTreeSet<&'static str> = BTreeSet::from_iter(vec![ +pub(crate) static BUILTIN_IDENTS: Lazy> = Lazy::new(|| { + BTreeSet::from_iter(vec![ "str", "char", "bool", @@ -31,17 +31,15 @@ lazy_static! { "Function", "Clamped", "DataView", - ]); + ]) +}); +// whitelist a few names that have known polyfills +pub(crate) static POLYFILL_INTERFACES: Lazy> = + Lazy::new(|| BTreeSet::from_iter(vec!["AudioContext", "OfflineAudioContext"])); - // whitelist a few names that have known polyfills - pub(crate) static ref POLYFILL_INTERFACES: BTreeSet<&'static str> = BTreeSet::from_iter(vec![ - "AudioContext", - "OfflineAudioContext", - ]); - - - pub(crate) static ref IMMUTABLE_SLICE_WHITELIST: BTreeSet<&'static str> = BTreeSet::from_iter(vec![ +pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy::new(|| { + BTreeSet::from_iter(vec![ // ImageData "ImageData", // WebGlRenderingContext, WebGl2RenderingContext @@ -89,7 +87,6 @@ lazy_static! { "writeBuffer", "writeTexture", // AudioBuffer - "copyToChannel" - // TODO: Add another type's functions here. Leave a comment header with the type name - ]); -} + "copyToChannel", // TODO: Add another type's functions here. Leave a comment header with the type name + ]) +}); diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index f683c7d9498..186fb1786e8 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -10,7 +10,6 @@ use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet}; -use weedle; use weedle::argument::Argument; use weedle::attribute::*; use weedle::interface::*; diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 02bc65e3e3f..63abd35f799 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -1,5 +1,4 @@ use proc_macro2::{Ident, Span}; -use syn; use wasm_bindgen_backend::util::{ident_ty, leading_colon_path_ty, raw_ident, rust_ident}; use weedle::common::Identifier; use weedle::term; diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 02e3bd00cae..1c44146d5c3 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -7,9 +7,7 @@ use std::ptr; use heck::{CamelCase, ShoutySnakeCase, SnakeCase}; use proc_macro2::{Ident, TokenStream}; use quote::quote; -use syn; use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; -use weedle; use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList, IdentifierOrString}; use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; diff --git a/src/closure.rs b/src/closure.rs index 00db2ee5e97..57190cf8303 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -426,7 +426,6 @@ impl Closure { /// and everything it closes over will leak. /// /// ```rust,ignore - /// use js_sys; /// use wasm_bindgen::{prelude::*, JsCast}; /// /// let f = Closure::once_into_js(move || { From fb906f8dc27094cc98e8dc9e4f5be0cc2efced66 Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Fri, 24 Jun 2022 22:33:37 +0200 Subject: [PATCH 037/641] doc: fix typo in hello-world (#2964) --- guide/src/examples/hello-world.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/examples/hello-world.md b/guide/src/examples/hello-world.md index 05cbe929d77..b12e15e9b8a 100644 --- a/guide/src/examples/hello-world.md +++ b/guide/src/examples/hello-world.md @@ -38,7 +38,7 @@ Our JS entry point is quite small! ## Webpack-specific files -> **Note**: Webpack is not required for this example, and if you're interested +> **Note**: Webpack is required for this example, and if you're interested > in options that don't use a JS bundler [see other examples][wab]. [wab]: without-a-bundler.html From d4b372a7a6885c0c786aac82c59c596adfb69030 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 27 Jun 2022 22:20:35 +1000 Subject: [PATCH 038/641] Fix CLI tests in Node 18+ (#2966) Fixes #2946 Falls back on running Node without the `--experimental-wasm-reftypes` flag if running it with the flag fails. --- crates/cli/tests/interface-types.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/cli/tests/interface-types.rs b/crates/cli/tests/interface-types.rs index fef04583a1a..03198a9832d 100644 --- a/crates/cli/tests/interface-types.rs +++ b/crates/cli/tests/interface-types.rs @@ -59,9 +59,12 @@ fn runtest(test: &Path) -> Result<()> { .arg("--experimental-wasm-reftypes") .arg(&js) .env("NODE_PATH", td.path()), - )?; - - Ok(()) + ) + .or_else(|_| { + // The `--experimental-wasm-reftypes` flag was removed in Node 18, so that might + // have caused the error; try again without it. + exec(Command::new("node").arg(&js).env("NODE_PATH", td.path())) + }) } fn exec(cmd: &mut Command) -> Result<()> { From 7f4663b70bd492278bf0e7bba4eeddb3d840c868 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 27 Jun 2022 22:27:37 +1000 Subject: [PATCH 039/641] Fixes #2961 (#2965) In the bundler target, there's a circular dependency between the bindings and the wasm module. That means that the wasm module's exports aren't available at the top level. In #2886, I didn't realise that and made the memory views be initialised at the top level, which resulted in an error from the wasm module's memory not being available yet. This fixes that by lazily initialising the memory views like they were before #2886, except that they're reset to uninitialised in `init` to make sure they're updated if it's called multiple times (the reason I made them be immediately initialised in the first place). --- crates/cli-support/src/js/mod.rs | 64 +++++++------------ .../tests/reference/anyref-import-catch.js | 9 ++- crates/cli/tests/reference/import-catch.js | 5 +- crates/cli/tests/reference/result-string.js | 9 ++- crates/cli/tests/reference/string-arg.js | 5 +- 5 files changed, 35 insertions(+), 57 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 2c9cddadbf9..303c18546f8 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -12,7 +12,7 @@ use std::fmt; use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; -use walrus::{ExportItem, FunctionId, ImportId, MemoryId, Module, TableId, ValType}; +use walrus::{FunctionId, ImportId, MemoryId, Module, TableId, ValType}; mod binding; @@ -403,8 +403,6 @@ impl<'a> Context<'a> { ))), ); - footer.push_str(&self.post_instantiate()); - if needs_manual_start { footer.push_str("\nwasm.__wbindgen_start();\n"); } @@ -418,7 +416,6 @@ impl<'a> Context<'a> { footer.push_str(&self.generate_deno_wasm_loading(module_name)); footer.push_str("\n\n"); - footer.push_str(&self.post_instantiate()); if needs_manual_start { footer.push_str("\nwasm.__wbindgen_start();\n"); @@ -454,9 +451,6 @@ impl<'a> Context<'a> { } } - footer.push('\n'); - footer.push_str(&self.post_instantiate()); - if needs_manual_start { start = Some("\nwasm.__wbindgen_start();\n".to_string()); } @@ -587,37 +581,6 @@ impl<'a> Context<'a> { Ok(imports) } - /// Returns JS to be run immediately after the wasm module is instantiated, - /// before the start function is called. - fn post_instantiate(&self) -> String { - let mut out = String::new(); - // Initialise all the memory views. - for (&mem_id, &(num, ref views)) in &self.memories { - // We can't just use `export_name_of` because it takes `&mut self` and we've already borrowed `views`. - let mem = match self - .module - .exports - .iter() - .find(|export| matches!(export.item, ExportItem::Memory(id) if id == mem_id)) - { - Some(export) => &export.name, - None => continue, - }; - - for kind in views { - writeln!( - out, - "cached{kind}Memory{num} = new {kind}Array(wasm.{mem}.buffer);", - kind = kind, - num = num, - mem = mem, - ) - .unwrap() - } - } - out - } - fn ts_for_init_fn( &self, has_memory: bool, @@ -797,6 +760,22 @@ impl<'a> Context<'a> { imports_init.push_str(&format!("imports['{}'] = __wbg_star{};\n", extra, i)); } + let mut init_memviews = String::new(); + for &(num, ref views) in self.memories.values() { + for kind in views { + writeln!( + init_memviews, + // Reset the memory views to empty in case `init` gets called multiple times. + // Without this, the `length = 0` check would never detect that the view was + // outdated. + "cached{kind}Memory{num} = new {kind}Array();", + kind = kind, + num = num, + ) + .unwrap() + } + } + let js = format!( "\ async function load(module, imports) {{ @@ -847,7 +826,7 @@ impl<'a> Context<'a> { function finalizeInit(instance, module) {{ wasm = instance.exports; init.__wbindgen_wasm_module = module; - {post_instantiate} + {init_memviews} {start} return wasm; }} @@ -881,7 +860,7 @@ impl<'a> Context<'a> { init_memory_arg = init_memory_arg, default_module_path = default_module_path, init_memory = init_memory, - post_instantiate = self.post_instantiate(), + init_memviews = init_memviews, start = if needs_manual_start { "wasm.__wbindgen_start();" } else { @@ -1749,9 +1728,12 @@ impl<'a> Context<'a> { format!("{cache}.byteLength === 0", cache = cache) }; + // Initialize the cache to an empty array, which will trigger the resized check + // on the first call and initialise the view. + self.global(&format!("let {cache} = new {kind}Array();\n")); + self.global(&format!( " - let {cache}; function {name}() {{ if ({resized_check}) {{ {cache} = new {kind}Array(wasm.{mem}.buffer); diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index c4eb9714c06..6d5394d788a 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -6,7 +6,8 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0; +let cachedUint8Memory0 = new Uint8Array(); + function getUint8Memory0() { if (cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); @@ -33,7 +34,8 @@ function handleError(f, args) { } } -let cachedInt32Memory0; +let cachedInt32Memory0 = new Int32Array(); + function getInt32Memory0() { if (cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); @@ -81,6 +83,3 @@ export function __wbindgen_init_externref_table() { ; }; -cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); -cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); - diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index d7a7bf837f3..6f9a1bc1578 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -23,7 +23,8 @@ function handleError(f, args) { } } -let cachedInt32Memory0; +let cachedInt32Memory0 = new Int32Array(); + function getInt32Memory0() { if (cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); @@ -64,5 +65,3 @@ export function __wbg_foo_8d66ddef0ff279d6() { return handleError(function () { foo(); }, arguments) }; -cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); - diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 708880bb8b8..a9d60cc3cb0 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -15,7 +15,8 @@ function addHeapObject(obj) { return idx; } -let cachedInt32Memory0; +let cachedInt32Memory0 = new Int32Array(); + function getInt32Memory0() { if (cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); @@ -43,7 +44,8 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0; +let cachedUint8Memory0 = new Uint8Array(); + function getUint8Memory0() { if (cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); @@ -83,6 +85,3 @@ export function __wbindgen_number_new(arg0) { return addHeapObject(ret); }; -cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); -cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); - diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index 9c93a69b759..deba025f926 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -6,7 +6,8 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0; +let cachedUint8Memory0 = new Uint8Array(); + function getUint8Memory0() { if (cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); @@ -87,5 +88,3 @@ export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; -cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); - From d7072b17a70d181627904ce4e49293965ffeb912 Mon Sep 17 00:00:00 2001 From: Kotaro Abe Date: Sun, 3 Jul 2022 20:37:59 +0900 Subject: [PATCH 040/641] remove .DS_Store (#2976) --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 038ad50aa8c1fe289434b91a014e9e0c88a4ed39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-O8-BN@e6nb3nTCmkpDPBUYFJMFuDm5WNgK4%jtrbckXMG``#OHBl zcLSE@;7P>Jz~-BspWU4gvOkP5K9~m`#u|(<0S%F(QXpt9bd_u{BG+R~Sj<9}`ipc@ zFwkE#;o1eP`IUKW%)YJPkChL;4}TIz>8#!U;C$(^A-fW%@yy-3W zu9S-XT=)FzC|ryh`{yc|c~KHhbwU(`5OQ}DC4pKD)I14No$DHhsEOLB(OfRO-P4xr z^*gJUT=tLKE!jQktyVR0aCmffIeL!AiFz|+a^PLdp2ZyALD{J5#hoUxN*=+N=jHK) z!~iis3=jj`!+<>lM16Zorb>wcV&I1i;Qkaq-D0{YUl!s@ng!TXp1>-VQKtNx+1V9J(k*0PU czeFA49E+Jj90lz<9gr>pnh^RB1HZt)7uwWKC;$Ke From 1060d696c701199ba8f17aabc05e08604a53acbc Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 5 Jul 2022 22:55:18 +1000 Subject: [PATCH 041/641] Properly implement `From` and `PartialEq` for `JsValue` (#2978) * Properly implement `From` and `PartialEq` for `JsValue` Fixes #2977 Previously, `usize` and `isize` were converted to bigints when converting to JS values, when they should be converted to regular JS numbers due to being 32-bit. `PartialEq` was then implemented on top of that, checking whether `self == JsValue::from(n)`. It could be argued that they should be bigints to try and be forwards-compatible with 64-bit WebAssembly; however, they're already represented as regular numbers everywhere else. One major issue here is that this is a breaking change. You can't just use a number where a bigint is expected (or vice versa), so this will break any code that used `From` to convert from `usize`/`isize` to `JsValue`. That happens most commonly indirectly, through the return type of async functions, which are internally converted using `Into`. * fmt --- crates/typescript-tests/src/lib.rs | 1 + crates/typescript-tests/src/usize.rs | 21 ++++++++ crates/typescript-tests/src/usize.ts | 6 +++ src/lib.rs | 33 +++++++++++- tests/wasm/main.rs | 1 + tests/wasm/usize.js | 39 ++++++++++++++ tests/wasm/usize.rs | 79 ++++++++++++++++++++++++++++ 7 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 crates/typescript-tests/src/usize.rs create mode 100644 crates/typescript-tests/src/usize.ts create mode 100644 tests/wasm/usize.js create mode 100644 tests/wasm/usize.rs diff --git a/crates/typescript-tests/src/lib.rs b/crates/typescript-tests/src/lib.rs index ad8a1c3fbf8..f2ecc140914 100644 --- a/crates/typescript-tests/src/lib.rs +++ b/crates/typescript-tests/src/lib.rs @@ -7,4 +7,5 @@ pub mod simple_async_fn; pub mod simple_fn; pub mod simple_struct; pub mod typescript_type; +pub mod usize; pub mod web_sys; diff --git a/crates/typescript-tests/src/usize.rs b/crates/typescript-tests/src/usize.rs new file mode 100644 index 00000000000..65739c136e4 --- /dev/null +++ b/crates/typescript-tests/src/usize.rs @@ -0,0 +1,21 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn usize_identity(x: usize) -> usize { + x +} + +#[wasm_bindgen] +pub fn isize_identity(x: isize) -> isize { + x +} + +#[wasm_bindgen] +pub async fn async_usize_identity(x: usize) -> usize { + x +} + +#[wasm_bindgen] +pub async fn async_isize_identity(x: isize) -> isize { + x +} diff --git a/crates/typescript-tests/src/usize.ts b/crates/typescript-tests/src/usize.ts new file mode 100644 index 00000000000..0b60bdb185a --- /dev/null +++ b/crates/typescript-tests/src/usize.ts @@ -0,0 +1,6 @@ +import * as wbg from "../pkg/typescript_tests"; + +const _f1: (x: number) => number = wbg.usize_identity; +const _f2: (x: number) => number = wbg.isize_identity; +const _f3: (x: number) => Promise = wbg.async_usize_identity; +const _f4: (x: number) => Promise = wbg.async_isize_identity; diff --git a/src/lib.rs b/src/lib.rs index 836c1678d8f..7f3e82f7337 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -867,7 +867,38 @@ macro_rules! big_numbers { )*) } -big_numbers! { i64 u64 i128 u128 isize usize } +big_numbers! { i64 u64 i128 u128 } + +// `usize` and `isize` have to be treated a bit specially, because we know that +// they're 32-bit but the compiler conservatively assumes they might be bigger. +// So, we have to manually forward to the `u32`/`i32` versions. +impl PartialEq for JsValue { + #[inline] + fn eq(&self, other: &usize) -> bool { + *self == (*other as u32) + } +} + +impl From for JsValue { + #[inline] + fn from(n: usize) -> Self { + Self::from(n as u32) + } +} + +impl PartialEq for JsValue { + #[inline] + fn eq(&self, other: &isize) -> bool { + *self == (*other as i32) + } +} + +impl From for JsValue { + #[inline] + fn from(n: isize) -> Self { + Self::from(n as i32) + } +} externs! { #[link(wasm_import_module = "__wbindgen_placeholder__")] diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 30f8dd02f30..58c9b4e070b 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -43,6 +43,7 @@ pub mod slice; pub mod structural; pub mod truthy_falsy; pub mod u64; +pub mod usize; pub mod validate_prt; pub mod variadic; pub mod vendor_prefix; diff --git a/tests/wasm/usize.js b/tests/wasm/usize.js new file mode 100644 index 00000000000..a1e0723e852 --- /dev/null +++ b/tests/wasm/usize.js @@ -0,0 +1,39 @@ +const wasm = require('wasm-bindgen-test.js'); +const assert = require('assert'); + +exports.isize_js_identity = a => a; +exports.usize_js_identity = a => a; + +exports.js_works = async () => { + assert.strictEqual(wasm.usize_zero(), 0); + assert.strictEqual(wasm.usize_one(), 1); + assert.strictEqual(wasm.isize_neg_one(), -1); + assert.strictEqual(wasm.isize_i32_min(), -2147483648); + assert.strictEqual(wasm.isize_min(), -2147483648); + assert.strictEqual(wasm.usize_u32_max(), 4294967295); + assert.strictEqual(wasm.usize_max(), 4294967295); + + assert.strictEqual(wasm.isize_rust_identity(0), 0); + assert.strictEqual(wasm.isize_rust_identity(1), 1); + assert.strictEqual(wasm.isize_rust_identity(-1), -1); + assert.strictEqual(wasm.usize_rust_identity(0), 0); + assert.strictEqual(wasm.usize_rust_identity(1), 1); + + const usize_max = 4294967295; + const isize_min = -2147483648; + assert.strictEqual(wasm.isize_rust_identity(isize_min), isize_min); + assert.strictEqual(wasm.usize_rust_identity(usize_max), usize_max); + + assert.deepStrictEqual(wasm.usize_slice([]), new Uint32Array()); + assert.deepStrictEqual(wasm.isize_slice([]), new Int32Array()); + const arr1 = new Uint32Array([1, 2]); + assert.deepStrictEqual(wasm.usize_slice([1, 2]), arr1); + const arr2 = new Int32Array([1, 2]); + assert.deepStrictEqual(wasm.isize_slice([1, 2]), arr2); + + assert.deepStrictEqual(wasm.isize_slice([isize_min]), new Int32Array([isize_min])); + assert.deepStrictEqual(wasm.usize_slice([usize_max]), new Uint32Array([usize_max])); + + assert.deepStrictEqual(await wasm.async_usize_one(), 1); + assert.deepStrictEqual(await wasm.async_isize_neg_one(), -1); +}; diff --git a/tests/wasm/usize.rs b/tests/wasm/usize.rs new file mode 100644 index 00000000000..80395d21e91 --- /dev/null +++ b/tests/wasm/usize.rs @@ -0,0 +1,79 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/usize.js")] +extern "C" { + fn isize_js_identity(a: isize) -> isize; + fn usize_js_identity(a: usize) -> usize; + fn js_works(); +} + +#[wasm_bindgen] +pub fn usize_zero() -> usize { + 0 +} + +#[wasm_bindgen] +pub fn usize_one() -> usize { + 1 +} + +#[wasm_bindgen] +pub fn isize_neg_one() -> isize { + -1 +} + +#[wasm_bindgen] +pub fn isize_i32_min() -> isize { + i32::min_value() as isize +} + +#[wasm_bindgen] +pub fn usize_u32_max() -> usize { + u32::max_value() as usize +} + +#[wasm_bindgen] +pub fn isize_min() -> isize { + isize::min_value() +} + +#[wasm_bindgen] +pub fn usize_max() -> usize { + usize::max_value() +} + +#[wasm_bindgen] +pub fn isize_rust_identity(a: isize) -> isize { + isize_js_identity(a) +} + +#[wasm_bindgen] +pub fn usize_rust_identity(a: usize) -> usize { + usize_js_identity(a) +} + +#[wasm_bindgen] +pub fn isize_slice(a: &[isize]) -> Vec { + a.to_vec() +} + +#[wasm_bindgen] +pub fn usize_slice(a: &[usize]) -> Vec { + a.to_vec() +} + +#[wasm_bindgen] +pub async fn async_usize_one() -> usize { + 1 +} + +#[wasm_bindgen] +pub async fn async_isize_neg_one() -> isize { + -1 +} + +#[wasm_bindgen_test] +fn works() { + js_works(); +} From 426c6a99f08226d30c1ee1d2e3b86b0942c5f30a Mon Sep 17 00:00:00 2001 From: Zach Date: Wed, 6 Jul 2022 12:56:31 -0400 Subject: [PATCH 042/641] Add dependency to without-a-bundler guide (#2982) Fixes #2981 --- guide/src/examples/without-a-bundler.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/guide/src/examples/without-a-bundler.md b/guide/src/examples/without-a-bundler.md index 65b2df0f4da..dd37802ca2c 100644 --- a/guide/src/examples/without-a-bundler.md +++ b/guide/src/examples/without-a-bundler.md @@ -9,7 +9,20 @@ browser directly. For this deployment strategy bundlers like Webpack are not required. For more information on deployment see the [dedicated documentation][deployment]. -First let's take a look at the code and see how when we're using `--target web` +First, you'll need to add `web-sys` to your Cargo.toml. +```toml +[dependencies.web-sys] +version = "0.3.4" +features = [ + 'Document', + 'Element', + 'HtmlElement', + 'Node', + 'Window', +] +``` + +Then, let's take a look at the code and see how when we're using `--target web` we're not actually losing any functionality! ```rust From 542955514e0069bc1d56048fb73c54aa9e410cc7 Mon Sep 17 00:00:00 2001 From: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com> Date: Mon, 11 Jul 2022 01:42:44 +0530 Subject: [PATCH 043/641] Remove extra `dbg` calls (#2990) --- crates/cli/src/bin/wasm-bindgen-test-runner/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index e802ef8d265..519048e3dee 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -61,8 +61,8 @@ fn main() -> anyhow::Result<()> { } else { wasm_file_to_test .parent() // chop off file name - .and_then(|p| dbg!(p.parent())) // chop off `deps` - .and_then(|p| dbg!(p.parent())) // chop off `debug` + .and_then(|p| p.parent()) // chop off `deps` + .and_then(|p| p.parent()) // chop off `debug` } .map(|p| p.join("wbg-tmp")) .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; From 4e72af28a029199bb3ea3ef783a41b7d620265b0 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 12 Jul 2022 00:08:25 +1000 Subject: [PATCH 044/641] Respect `#[wasm_bindgen(skip_typescript)]` on structs (#2985) Fixes #2941 It looks like there was already a test for this, but the actual struct declaration in Rust was missing; so, I added that. --- crates/cli-support/src/js/mod.rs | 11 +++++++++-- crates/typescript-tests/src/omit_definition.rs | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 303c18546f8..a8870afa39e 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -66,7 +66,10 @@ pub struct Context<'a> { pub struct ExportedClass { comments: String, contents: String, + /// The TypeScript for the class's methods. typescript: String, + /// Whether TypeScript for this class should be emitted (i.e., `skip_typescript` wasn't specified). + generate_typescript: bool, has_constructor: bool, wrap_needed: bool, /// Whether to generate helper methods for inspecting the class @@ -1015,8 +1018,11 @@ impl<'a> Context<'a> { ts_dst.push_str("}\n"); self.export(&name, &dst, Some(&class.comments))?; - self.typescript.push_str(&class.comments); - self.typescript.push_str(&ts_dst); + + if class.generate_typescript { + self.typescript.push_str(&class.comments); + self.typescript.push_str(&ts_dst); + } Ok(()) } @@ -3477,6 +3483,7 @@ impl<'a> Context<'a> { let class = require_class(&mut self.exported_classes, &struct_.name); class.comments = format_doc_comments(&struct_.comments, None); class.is_inspectable = struct_.is_inspectable; + class.generate_typescript = struct_.generate_typescript; Ok(()) } diff --git a/crates/typescript-tests/src/omit_definition.rs b/crates/typescript-tests/src/omit_definition.rs index c83cdc040a3..c74613519e6 100644 --- a/crates/typescript-tests/src/omit_definition.rs +++ b/crates/typescript-tests/src/omit_definition.rs @@ -33,6 +33,11 @@ pub enum MyEnum { Three, } +#[wasm_bindgen(skip_typescript)] +pub struct MyStruct { + pub field: i32, +} + macro_rules! generate_ts { ($lit:literal) => { #[wasm_bindgen(typescript_custom_section)] From bc95e1348554810103c463f4889ce62ad3222a21 Mon Sep 17 00:00:00 2001 From: Jeff Mendez Date: Mon, 11 Jul 2022 10:15:45 -0400 Subject: [PATCH 045/641] chore(guide): fix entry to raytracing example (#2988) --- guide/src/examples/raytrace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/examples/raytrace.md b/guide/src/examples/raytrace.md index 9775a14ee6f..e731cee8700 100644 --- a/guide/src/examples/raytrace.md +++ b/guide/src/examples/raytrace.md @@ -5,7 +5,7 @@ [online]: https://wasm-bindgen.netlify.app/exbuild/raytrace-parallel/ [code]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/raytrace-parallel -This is an of using threads with WebAssembly, Rust, and `wasm-bindgen`, +This is an example of using threads with WebAssembly, Rust, and `wasm-bindgen`, culminating in a parallel raytracer demo. There's a number of moving pieces to this demo and it's unfortunately not the easiest thing to wrangle, but it's hoped that this'll give you a bit of a taste of what it's like to use threads From 9fafcf3cfabd7dcdada9299b51144df8d5cfd8d2 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 12 Jul 2022 00:16:41 +1000 Subject: [PATCH 046/641] Don't copy doc comments on imported functions to generated `extern` blocks (#2987) * Don't apply doc comments to `extern` blocks This was causing lots of 'unused doc comment' warnings while compiling `web-sys`, since doc comments have no effect on `extern` blocks. I've implemented this by removing any doc comments from the function's attributes and then adding them back to the public function. I'm not sure how good of an idea it is to forward all attributes to the extern block in the first place, but I'm playing it safe and leaving it as is. * fmt --- crates/backend/src/ast.rs | 2 +- crates/backend/src/codegen.rs | 5 +-- crates/macro-support/src/parser.rs | 52 ++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 4671bf4551a..134fb4e485b 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -162,7 +162,7 @@ pub struct ImportFunction { /// necessary conversions (EG adding a try/catch to change a thrown error into a Result) pub shim: Ident, /// The doc comment on this import, if one is provided - pub doc_comment: Option, + pub doc_comment: String, } /// The type of a function being imported diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 348d10295ff..29905070945 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1074,10 +1074,7 @@ impl TryToTokens for ast::ImportFunction { let abi_arguments = &abi_arguments; let abi_argument_names = &abi_argument_names; - let doc_comment = match &self.doc_comment { - None => "", - Some(doc_string) => doc_string, - }; + let doc_comment = &self.doc_comment; let me = if is_method { quote! { &self, } } else { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index ac0e835dfda..4f979edeedd 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -10,6 +10,7 @@ use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; +use syn::Lit; thread_local!(static ATTRS: AttributeParseState = Default::default()); @@ -474,7 +475,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte self, (opts, module): (BindgenAttrs, &'a ast::ImportModule), ) -> Result { - let wasm = function_from_decl( + let mut wasm = function_from_decl( &self.sig.ident, &opts, self.sig.clone(), @@ -602,6 +603,53 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte } } let assert_no_shim = opts.assert_no_shim().is_some(); + + let mut doc_comment = String::new(); + // Extract the doc comments from our list of attributes. + wasm.rust_attrs.retain(|attr| { + struct DocContents { + contents: String, + } + + impl Parse for DocContents { + fn parse(input: ParseStream) -> SynResult { + ::parse(input)?; + match Lit::parse(input)? { + Lit::Str(str) => Ok(Self { + contents: str.value(), + }), + other => Err(syn::Error::new_spanned(other, "expected a string literal")), + } + } + } + + /// Returns the contents of the passed `#[doc = "..."]` attribute, + /// or `None` if it isn't one. + fn get_docs(attr: &syn::Attribute) -> Option { + if attr.path.is_ident("doc") { + syn::parse2::(attr.tokens.clone()) + .ok() + .map(|doc| doc.contents) + } else { + None + } + } + + if let Some(docs) = get_docs(attr) { + if !doc_comment.is_empty() { + // Add newlines between the doc comments + doc_comment.push('\n'); + } + // Add this doc comment to the complete docs + doc_comment.push_str(&docs); + + // Remove it from the list of regular attributes + false + } else { + true + } + }); + let ret = ast::ImportKind::Function(ast::ImportFunction { function: wasm, assert_no_shim, @@ -612,7 +660,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignIte structural: opts.structural().is_some() || opts.r#final().is_none(), rust_name: self.sig.ident.clone(), shim: Ident::new(&shim, Span::call_site()), - doc_comment: None, + doc_comment, }); opts.check_used()?; From 9a7732f7a75912c57013b2983a974f236614b02b Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 12 Jul 2022 01:33:37 +1000 Subject: [PATCH 047/641] Add support for exporting static getters and setters (#2986) * Add support for exporting static getters and setters Fixes #2895 Exported methods with `#[wasm_bindgen(getter/setter)]` and no `self` parameter are now interpreted as getters/setters for static fields. Previously, attempting to do that would cause `wasm-bindgen` to crash. This can already be done for imports with `static_method_of` + `getter`. * Rename `AuxExportMethodKind` to `AuxExportedMethodKind` --- crates/cli-support/src/js/binding.rs | 3 + crates/cli-support/src/js/mod.rs | 241 +++++++++--------- crates/cli-support/src/wit/mod.rs | 61 +++-- crates/cli-support/src/wit/nonstandard.rs | 69 +++-- crates/cli-support/src/wit/section.rs | 42 +-- .../typescript-tests/src/getters_setters.rs | 16 +- .../typescript-tests/src/getters_setters.ts | 12 +- tests/wasm/getters_and_setters.js | 7 + tests/wasm/getters_and_setters.rs | 41 +++ 9 files changed, 277 insertions(+), 215 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index c29e808587e..c29f2da5433 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -64,6 +64,9 @@ pub struct JsFunction { pub js_doc: String, pub ts_arg_tys: Vec, pub ts_ret_ty: Option, + /// Whether this function has a single optional argument. + /// + /// If the function is a setter, that means that the field it sets is optional. pub might_be_optional_field: bool, pub catch: bool, pub log_error: bool, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index a8870afa39e..0f444eb78dd 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1,6 +1,8 @@ use crate::descriptor::VectorKind; use crate::intrinsic::Intrinsic; -use crate::wit::{Adapter, AdapterId, AdapterJsImportKind, AuxValue}; +use crate::wit::{ + Adapter, AdapterId, AdapterJsImportKind, AuxExportedMethodKind, AuxReceiverKind, AuxValue, +}; use crate::wit::{AdapterKind, Instruction, InstructionData}; use crate::wit::{AuxEnum, AuxExport, AuxExportKind, AuxImport, AuxStruct}; use crate::wit::{JsImport, JsImportName, NonstandardWitSection, WasmBindgenAux}; @@ -76,9 +78,9 @@ pub struct ExportedClass { is_inspectable: bool, /// All readable properties of the class readable_properties: Vec, - /// Map from field name to type as a string, docs plus whether it has a setter - /// and it is optional - typescript_fields: HashMap, + /// Map from field name to type as a string, docs plus whether it has a setter, + /// whether it's optional and whether it's static. + typescript_fields: HashMap, } const INITIAL_HEAP_VALUES: &[&str] = &["undefined", "null", "true", "false"]; @@ -999,9 +1001,12 @@ impl<'a> Context<'a> { let mut fields = class.typescript_fields.keys().collect::>(); fields.sort(); // make sure we have deterministic output for name in fields { - let (ty, docs, has_setter, is_optional) = &class.typescript_fields[name]; + let (ty, docs, has_setter, is_optional, is_static) = &class.typescript_fields[name]; ts_dst.push_str(docs); ts_dst.push_str(" "); + if *is_static { + ts_dst.push_str("static "); + } if !has_setter { ts_dst.push_str("readonly "); } @@ -2507,11 +2512,14 @@ impl<'a> Context<'a> { variadic = export.variadic; match &export.kind { AuxExportKind::Function(_) => {} - AuxExportKind::StaticFunction { .. } => {} AuxExportKind::Constructor(class) => builder.constructor(class), - AuxExportKind::Getter { consumed, .. } - | AuxExportKind::Setter { consumed, .. } - | AuxExportKind::Method { consumed, .. } => builder.method(*consumed), + AuxExportKind::Method { + receiver: reciever, .. + } => match reciever { + AuxReceiverKind::None => {} + AuxReceiverKind::Borrowed => builder.method(false), + AuxReceiverKind::Owned => builder.method(true), + }, } } Kind::Import(_) => {} @@ -2555,6 +2563,7 @@ impl<'a> Context<'a> { }; let js_docs = format_doc_comments(&export.comments, Some(js_doc)); + let ts_docs = format_doc_comments(&export.comments, None); match &export.kind { AuxExportKind::Function(name) => { @@ -2579,43 +2588,58 @@ impl<'a> Context<'a> { exported.has_constructor = true; exported.push(&js_docs, "constructor", "", &code, ts_sig); } - AuxExportKind::Getter { class, field, .. } => { - let ts_docs = format_doc_comments(&export.comments, None); - let ret_ty = match export.generate_typescript { - true => match &ts_ret_ty { - Some(s) => Some(s.as_str()), - _ => None, - }, - false => None, - }; - + AuxExportKind::Method { + class, + name, + receiver, + kind, + } => { let exported = require_class(&mut self.exported_classes, class); - exported.push_getter(&js_docs, &ts_docs, field, &code, ret_ty); - } - AuxExportKind::Setter { class, field, .. } => { - let ts_docs = format_doc_comments(&export.comments, None); - let arg_ty = match export.generate_typescript { - true => Some(ts_arg_tys[0].as_str()), - false => None, + + let mut prefix = String::new(); + if receiver.is_static() { + prefix += "static "; + } + let ts = match kind { + AuxExportedMethodKind::Method => ts_sig, + AuxExportedMethodKind::Getter => { + prefix += "get "; + // For getters and setters, we generate a separate TypeScript definition. + if export.generate_typescript { + exported.push_accessor_ts( + &ts_docs, + name, + // This is only set to `None` when generating a constructor. + ts_ret_ty + .as_deref() + .expect("missing return type for getter"), + false, + receiver.is_static(), + ); + } + // Add the getter to the list of readable fields (used to generate `toJSON`) + exported.readable_properties.push(name.clone()); + // Ignore the raw signature. + None + } + AuxExportedMethodKind::Setter => { + prefix += "set "; + if export.generate_typescript { + let is_optional = exported.push_accessor_ts( + &ts_docs, + name, + &ts_arg_tys[0], + true, + receiver.is_static(), + ); + // Set whether the field is optional. + *is_optional = might_be_optional_field; + } + None + } }; - let exported = require_class(&mut self.exported_classes, class); - exported.push_setter( - &js_docs, - &ts_docs, - field, - &code, - arg_ty, - might_be_optional_field, - ); - } - AuxExportKind::StaticFunction { class, name } => { - let exported = require_class(&mut self.exported_classes, class); - exported.push(&js_docs, name, "static ", &code, ts_sig); - } - AuxExportKind::Method { class, name, .. } => { - let exported = require_class(&mut self.exported_classes, class); - exported.push(&js_docs, name, "", &code, ts_sig); + exported.push(&js_docs, name, &prefix, &code, ts); } } } @@ -3743,45 +3767,70 @@ impl<'a> Context<'a> { fn check_duplicated_getter_and_setter_names( exports: &[(&AdapterId, &AuxExport)], ) -> Result<(), Error> { - let verify_exports = - |first_class, first_field, second_class, second_field| -> Result<(), Error> { - let both_are_in_the_same_class = first_class == second_class; - let both_are_referencing_the_same_field = first_field == second_field; - if both_are_in_the_same_class && both_are_referencing_the_same_field { - bail!(format!( - "There can be only one getter/setter definition for `{}` in `{}`", - first_field, first_class - )); - } - Ok(()) - }; + fn verify_exports( + first_class: &str, + first_field: &str, + first_receiver: &AuxReceiverKind, + second_class: &str, + second_field: &str, + second_receiver: &AuxReceiverKind, + ) -> Result<(), Error> { + let both_are_in_the_same_class = first_class == second_class; + let both_are_referencing_the_same_field = first_field == second_field + && first_receiver.is_static() == second_receiver.is_static(); + if both_are_in_the_same_class && both_are_referencing_the_same_field { + bail!(format!( + "There can be only one getter/setter definition for `{}` in `{}`", + first_field, first_class + )); + } + Ok(()) + } for (idx, (_, first_export)) in exports.iter().enumerate() { for (_, second_export) in exports.iter().skip(idx + 1) { match (&first_export.kind, &second_export.kind) { ( - AuxExportKind::Getter { + AuxExportKind::Method { class: first_class, - field: first_field, - consumed: _, + name: first_name, + kind: AuxExportedMethodKind::Getter, + receiver: first_receiver, }, - AuxExportKind::Getter { + AuxExportKind::Method { class: second_class, - field: second_field, - consumed: _, + name: second_name, + kind: AuxExportedMethodKind::Getter, + receiver: second_receiver, }, - ) => verify_exports(first_class, first_field, second_class, second_field)?, + ) => verify_exports( + first_class, + first_name, + first_receiver, + second_class, + second_name, + second_receiver, + )?, ( - AuxExportKind::Setter { + AuxExportKind::Method { class: first_class, - field: first_field, - consumed: _, + name: first_name, + kind: AuxExportedMethodKind::Setter, + receiver: first_receiver, }, - AuxExportKind::Setter { + AuxExportKind::Method { class: second_class, - field: second_field, - consumed: _, + name: second_name, + kind: AuxExportedMethodKind::Setter, + receiver: second_receiver, }, - ) => verify_exports(first_class, first_field, second_class, second_field)?, + ) => verify_exports( + first_class, + first_name, + first_receiver, + second_class, + second_name, + second_receiver, + )?, _ => {} } } @@ -3834,72 +3883,28 @@ impl ExportedClass { } } - /// Used for adding a getter to a class, mainly to ensure that TypeScript - /// generation is handled specially. - fn push_getter( - &mut self, - js_docs: &str, - ts_docs: &str, - field: &str, - js: &str, - ret_ty: Option<&str>, - ) { - self.push_accessor(js_docs, field, js, "get "); - - if let Some(ret_ty) = ret_ty { - self.push_accessor_ts(ts_docs, field, ret_ty, false); - } - - self.readable_properties.push(field.to_string()); - } - - /// Used for adding a setter to a class, mainly to ensure that TypeScript - /// generation is handled specially. - fn push_setter( - &mut self, - js_docs: &str, - ts_docs: &str, - field: &str, - js: &str, - ret_ty: Option<&str>, - might_be_optional_field: bool, - ) { - self.push_accessor(js_docs, field, js, "set "); - - if let Some(ret_ty) = ret_ty { - let is_optional = self.push_accessor_ts(ts_docs, field, ret_ty, true); - *is_optional = might_be_optional_field; - } - } - fn push_accessor_ts( &mut self, docs: &str, field: &str, - ret_ty: &str, + ty: &str, is_setter: bool, + is_static: bool, ) -> &mut bool { - let (ty, accessor_docs, has_setter, is_optional) = self + let (ty_dst, accessor_docs, has_setter, is_optional, is_static_dst) = self .typescript_fields .entry(field.to_string()) .or_insert_with(Default::default); - *ty = ret_ty.to_string(); + *ty_dst = ty.to_string(); // Deterministic output: always use the getter's docs if available if !docs.is_empty() && (accessor_docs.is_empty() || !is_setter) { *accessor_docs = docs.to_owned(); } *has_setter |= is_setter; + *is_static_dst = is_static; is_optional } - - fn push_accessor(&mut self, docs: &str, field: &str, js: &str, prefix: &str) { - self.contents.push_str(docs); - self.contents.push_str(prefix); - self.contents.push_str(field); - self.contents.push_str(js); - self.contents.push_str("\n"); - } } struct MemView { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index a05390d2645..f4e2749ca6e 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -419,36 +419,31 @@ impl<'a> Context<'a> { let class = class.to_string(); match export.method_kind { decode::MethodKind::Constructor => AuxExportKind::Constructor(class), - decode::MethodKind::Operation(op) => match op.kind { - decode::OperationKind::Getter(f) => { - descriptor.arguments.insert(0, Descriptor::I32); - AuxExportKind::Getter { - class, - field: f.to_string(), - consumed: export.consumed, - } - } - decode::OperationKind::Setter(f) => { + decode::MethodKind::Operation(op) => { + if !op.is_static { + // Make the first argument be the index of the receiver. descriptor.arguments.insert(0, Descriptor::I32); - AuxExportKind::Setter { - class, - field: f.to_string(), - consumed: export.consumed, - } } - _ if op.is_static => AuxExportKind::StaticFunction { + + let (name, kind) = match op.kind { + decode::OperationKind::Getter(f) => (f, AuxExportedMethodKind::Getter), + decode::OperationKind::Setter(f) => (f, AuxExportedMethodKind::Setter), + _ => (export.function.name, AuxExportedMethodKind::Method), + }; + + AuxExportKind::Method { class, - name: export.function.name.to_string(), - }, - _ => { - descriptor.arguments.insert(0, Descriptor::I32); - AuxExportKind::Method { - class, - name: export.function.name.to_string(), - consumed: export.consumed, - } + name: name.to_owned(), + receiver: if op.is_static { + AuxReceiverKind::None + } else if export.consumed { + AuxReceiverKind::Owned + } else { + AuxReceiverKind::Borrowed + }, + kind, } - }, + } } } None => AuxExportKind::Function(export.function.name.to_string()), @@ -817,10 +812,11 @@ impl<'a> Context<'a> { arg_names: None, asyncness: false, comments: concatenate_comments(&field.comments), - kind: AuxExportKind::Getter { + kind: AuxExportKind::Method { class: struct_.name.to_string(), - field: field.name.to_string(), - consumed: false, + name: field.name.to_string(), + receiver: AuxReceiverKind::Borrowed, + kind: AuxExportedMethodKind::Getter, }, generate_typescript: field.generate_typescript, variadic: false, @@ -847,10 +843,11 @@ impl<'a> Context<'a> { arg_names: None, asyncness: false, comments: concatenate_comments(&field.comments), - kind: AuxExportKind::Setter { + kind: AuxExportKind::Method { class: struct_.name.to_string(), - field: field.name.to_string(), - consumed: false, + name: field.name.to_string(), + receiver: AuxReceiverKind::Borrowed, + kind: AuxExportedMethodKind::Setter, }, generate_typescript: field.generate_typescript, variadic: false, diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index d7131d291a2..16f0cd2b39f 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -108,38 +108,53 @@ pub enum AuxExportKind { /// actually return just an integer which is put on an JS object currently. Constructor(String), - /// This function is intended to be a getter for a field on a class. The - /// first argument is the internal pointer and the returned value is - /// expected to be the field. - Getter { + /// A function that's associated with a class. + /// + /// This can either be a static method (indicated by `AuxReceiverKind::None`), + /// which is basically just a free function namespaced under the class, or + /// a proper method. + /// + /// It can also be a getter or a setter for a (possibly static) field of + /// the class, in which case `name` is the name of the field. + /// + /// If the function isn't static, the first argument is the index of the + /// Rust object in the JS heap. + Method { class: String, - field: String, - // same as `consumed` in `Method` - consumed: bool, + name: String, + receiver: AuxReceiverKind, + kind: AuxExportedMethodKind, }, +} - /// This function is intended to be a setter for a field on a class. The - /// first argument is the internal pointer and the second argument is - /// expected to be the field's new value. - Setter { - class: String, - field: String, - // same as `consumed` in `Method` - consumed: bool, - }, +/// All the possible kinds of exported methods. +#[derive(Debug, Clone, Copy)] +pub enum AuxExportedMethodKind { + /// A regular method. + Method, + /// A getter for a field. + Getter, + /// A setter for a field. + Setter, +} - /// This is a free function (ish) but scoped inside of a class name. - StaticFunction { class: String, name: String }, +/// The 'receiver' of a method; in other words, the type that the method is called on. +/// +/// This is `None` if the method is static, or `Borrowed` or `Owned` if the +/// method takes `&[mut] self` or `self` respectively. +#[derive(Debug, Clone, Copy)] +pub enum AuxReceiverKind { + None, + Borrowed, + Owned, +} - /// This is a member function of a class where the first parameter is the - /// implicit integer stored in the class instance. - Method { - class: String, - name: String, - /// Whether or not this is calling a by-value method in Rust and should - /// clear the internal pointer in JS automatically. - consumed: bool, - }, +impl AuxReceiverKind { + /// Returns whether this is `AuxReceiverKind::None` (in other words, + /// whether the method with this receiver is static). + pub fn is_static(self) -> bool { + matches!(self, Self::None) + } } #[derive(Debug)] diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 7956b013e73..1fe532d77b1 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -16,7 +16,7 @@ //! generating any JS glue. Any JS glue currently generated is also invalid if //! the module contains the wasm bindings section and it's actually respected. -use crate::wit::{AdapterId, AdapterJsImportKind, AdapterType, Instruction}; +use crate::wit::{AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, Instruction}; use crate::wit::{AdapterKind, NonstandardWitSection, WasmBindgenAux}; use crate::wit::{AuxExport, InstructionData}; use crate::wit::{AuxExportKind, AuxImport, AuxValue, JsImport, JsImportName}; @@ -377,38 +377,22 @@ fn check_standard_export(export: &AuxExport) -> Result<(), Error> { name, ); } - AuxExportKind::Getter { class, field, .. } => { - bail!( - "cannot export `{}::{}` getter function when generating \ - a standalone WebAssembly module with no JS glue", - class, - field, - ); - } - AuxExportKind::Setter { class, field, .. } => { - bail!( - "cannot export `{}::{}` setter function when generating \ - a standalone WebAssembly module with no JS glue", - class, - field, - ); - } - AuxExportKind::StaticFunction { class, name } => { - bail!( - "cannot export `{}::{}` static function when \ - generating a standalone WebAssembly module with no \ - JS glue", - class, - name - ); - } - AuxExportKind::Method { class, name, .. } => { + AuxExportKind::Method { + class, name, kind, .. + } => { + let kind_name = match kind { + AuxExportedMethodKind::Method => "method", + AuxExportedMethodKind::Getter => "getter", + AuxExportedMethodKind::Setter => "setter", + }; + bail!( - "cannot export `{}::{}` method when \ + "cannot export `{}::{}` {} when \ generating a standalone WebAssembly module with no \ JS glue", class, - name + name, + kind_name ); } } diff --git a/crates/typescript-tests/src/getters_setters.rs b/crates/typescript-tests/src/getters_setters.rs index 2895a639433..b5534fc0111 100644 --- a/crates/typescript-tests/src/getters_setters.rs +++ b/crates/typescript-tests/src/getters_setters.rs @@ -1,7 +1,7 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] -pub struct ColorWithGetter { +pub struct ColorWithGetters { r: f64, _g: f64, _b: f64, @@ -9,15 +9,20 @@ pub struct ColorWithGetter { } #[wasm_bindgen] -impl ColorWithGetter { +impl ColorWithGetters { #[wasm_bindgen(getter)] pub fn r(&self) -> f64 { self.r } + + #[wasm_bindgen(getter)] + pub fn color_space() -> String { + "sRGB".to_owned() + } } #[wasm_bindgen] -pub struct ColorWithSetter { +pub struct ColorWithSetters { r: f64, _g: f64, _b: f64, @@ -25,7 +30,7 @@ pub struct ColorWithSetter { } #[wasm_bindgen] -impl ColorWithSetter { +impl ColorWithSetters { #[wasm_bindgen(setter)] pub fn set_r(&mut self, r: f64) { self.r = r; @@ -37,6 +42,9 @@ impl ColorWithSetter { (self.r * 255.0) as u8 }; } + + #[wasm_bindgen(setter)] + pub fn set_color_space(_: String) {} } #[wasm_bindgen] diff --git a/crates/typescript-tests/src/getters_setters.ts b/crates/typescript-tests/src/getters_setters.ts index 5ff7abc9b37..20b257ac6ab 100644 --- a/crates/typescript-tests/src/getters_setters.ts +++ b/crates/typescript-tests/src/getters_setters.ts @@ -1,14 +1,16 @@ import * as wbg from '../pkg/typescript_tests'; -const colorWithGetter: wbg.ColorWithGetter = new wbg.ColorWithGetter; -const _a = colorWithGetter.r; +const colorWithGetters: wbg.ColorWithGetters = new wbg.ColorWithGetters; +const _a = colorWithGetters.r; +const _b = wbg.ColorWithGetters.color_space; -const colorWithSetter: wbg.ColorWithSetter = new wbg.ColorWithSetter; -colorWithSetter.r = 1; +const colorWithSetters: wbg.ColorWithSetters = new wbg.ColorWithSetters; +colorWithSetters.r = 1; +wbg.ColorWithSetters.color_space = "Linear sRGB"; const colorWithGetterAndSetter: wbg.ColorWithGetterAndSetter = new wbg.ColorWithGetterAndSetter; colorWithGetterAndSetter.r = 1; -const _b = colorWithGetterAndSetter.r; +const _c = colorWithGetterAndSetter.r; const colorWithReadonly: wbg.ColorWithReadonly = new wbg.ColorWithReadonly(1, 2, 3); const _r: number = colorWithReadonly.r; diff --git a/tests/wasm/getters_and_setters.js b/tests/wasm/getters_and_setters.js index 7c3f90c1609..48379e2e8f1 100644 --- a/tests/wasm/getters_and_setters.js +++ b/tests/wasm/getters_and_setters.js @@ -98,3 +98,10 @@ exports.test_getter_compute = x => { exports.test_setter_compute = x => { x.foo = 97; }; + +exports.test_statics = x => { + assert.equal(x.field, 3); + assert.equal(wasm.Statics.field, 4); + x.field = 13; + wasm.Statics.field = 14; +} diff --git a/tests/wasm/getters_and_setters.rs b/tests/wasm/getters_and_setters.rs index f7bb31ba5b2..7425fc23ec0 100644 --- a/tests/wasm/getters_and_setters.rs +++ b/tests/wasm/getters_and_setters.rs @@ -1,5 +1,6 @@ use std::cell::Cell; use std::rc::Rc; +use std::sync::atomic::{AtomicU32, Ordering}; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -21,6 +22,7 @@ extern "C" { fn test_getter_compute(x: GetterCompute); fn test_setter_compute(x: SetterCompute); + fn test_statics(x: Statics); } // Each getter/setter combination is derived @@ -305,3 +307,42 @@ fn setter_compute() { test_setter_compute(SetterCompute(r.clone())); assert_eq!(r.get(), 100); } + +static FIELD: AtomicU32 = AtomicU32::new(3); +static STATIC_FIELD: AtomicU32 = AtomicU32::new(4); + +#[wasm_bindgen] +struct Statics; + +#[wasm_bindgen] +impl Statics { + #[wasm_bindgen(getter = field)] + // Make sure that this still works if we make this mutable for no reason + pub fn getter(&mut self) -> u32 { + FIELD.load(Ordering::Relaxed) + } + + #[wasm_bindgen(setter = field)] + // Make sure that this still works if we make this consume the type for no reason + pub fn setter(self, x: u32) { + FIELD.store(x, Ordering::Relaxed) + } + + // Define a static field with the same name to make sure that works. + #[wasm_bindgen(getter = field)] + pub fn static_getter() -> u32 { + STATIC_FIELD.load(Ordering::Relaxed) + } + + #[wasm_bindgen(setter = field)] + pub fn static_setter(x: u32) { + STATIC_FIELD.store(x, Ordering::Relaxed) + } +} + +#[wasm_bindgen_test] +fn statics() { + test_statics(Statics); + assert_eq!(FIELD.load(Ordering::Relaxed), 13); + assert_eq!(STATIC_FIELD.load(Ordering::Relaxed), 14); +} From e322e6fb8b51d069ef20556e854ad6d715ca1e06 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 13 Jul 2022 23:55:44 +1000 Subject: [PATCH 048/641] Use `Closure::new` in examples (#2991) There isn't much of a reason to use `Closure::wrap` over `Closure::new` anymore, so this changes `wasm-bindgen`'s examples to use `Closure::new` as the recommended method of creating closures. --- crates/futures/src/queue.rs | 2 +- crates/futures/src/task/multithread.rs | 2 +- examples/closures/src/lib.rs | 6 +- examples/paint/src/lib.rs | 12 ++-- examples/raytrace-parallel/src/pool.rs | 8 +-- examples/request-animation-frame/src/lib.rs | 4 +- examples/todomvc/src/element.rs | 6 +- examples/todomvc/src/view.rs | 4 +- examples/wasm-in-web-worker/src/lib.rs | 8 +-- examples/webrtc_datachannel/src/lib.rs | 68 +++++++++------------ examples/websockets/src/lib.rs | 17 +++--- examples/webxr/src/lib.rs | 4 +- src/closure.rs | 2 +- 13 files changed, 66 insertions(+), 77 deletions(-) diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index 5822934b727..9a78571cd84 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -78,7 +78,7 @@ impl Queue { // This closure will only be called on the next microtask event // tick - Closure::wrap(Box::new(move |_| state.run_all())) + Closure::new(move |_| state.run_all()) }, state, diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index 8d51144846b..dd2fec0d641 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -97,7 +97,7 @@ impl Task { let closure = { let this = Rc::clone(&this); - Closure::wrap(Box::new(move |_| this.run()) as Box) + Closure::new(move |_| this.run()) }; *this.inner.borrow_mut() = Some(Inner { future, closure }); diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index 07d5f83c6a2..1e6db003aa4 100644 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -63,7 +63,7 @@ fn setup_clock(window: &Window, document: &Document) -> Result<(), JsValue> { .get_element_by_id("current-time") .expect("should have #current-time on the page"); update_time(¤t_time); - let a = Closure::wrap(Box::new(move || update_time(¤t_time)) as Box); + let a = Closure::::new(move || update_time(¤t_time)); window .set_interval_with_callback_and_timeout_and_arguments_0(a.as_ref().unchecked_ref(), 1000)?; fn update_time(current_time: &Element) { @@ -96,10 +96,10 @@ fn setup_clicker(document: &Document) { .get_element_by_id("num-clicks") .expect("should have #num-clicks on the page"); let mut clicks = 0; - let a = Closure::wrap(Box::new(move || { + let a = Closure::::new(move || { clicks += 1; num_clicks.set_inner_html(&clicks.to_string()); - }) as Box); + }); document .get_element_by_id("green-square") .expect("should have #green-square on the page") diff --git a/examples/paint/src/lib.rs b/examples/paint/src/lib.rs index 9b407efbcfa..c4971412314 100644 --- a/examples/paint/src/lib.rs +++ b/examples/paint/src/lib.rs @@ -22,36 +22,36 @@ pub fn start() -> Result<(), JsValue> { { let context = context.clone(); let pressed = pressed.clone(); - let closure = Closure::wrap(Box::new(move |event: web_sys::MouseEvent| { + let closure = Closure::::new(move |event: web_sys::MouseEvent| { context.begin_path(); context.move_to(event.offset_x() as f64, event.offset_y() as f64); pressed.set(true); - }) as Box); + }); canvas.add_event_listener_with_callback("mousedown", closure.as_ref().unchecked_ref())?; closure.forget(); } { let context = context.clone(); let pressed = pressed.clone(); - let closure = Closure::wrap(Box::new(move |event: web_sys::MouseEvent| { + let closure = Closure::::new(move |event: web_sys::MouseEvent| { if pressed.get() { context.line_to(event.offset_x() as f64, event.offset_y() as f64); context.stroke(); context.begin_path(); context.move_to(event.offset_x() as f64, event.offset_y() as f64); } - }) as Box); + }); canvas.add_event_listener_with_callback("mousemove", closure.as_ref().unchecked_ref())?; closure.forget(); } { let context = context.clone(); let pressed = pressed.clone(); - let closure = Closure::wrap(Box::new(move |event: web_sys::MouseEvent| { + let closure = Closure::::new(move |event: web_sys::MouseEvent| { pressed.set(false); context.line_to(event.offset_x() as f64, event.offset_y() as f64); context.stroke(); - }) as Box); + }); canvas.add_event_listener_with_callback("mouseup", closure.as_ref().unchecked_ref())?; closure.forget(); } diff --git a/examples/raytrace-parallel/src/pool.rs b/examples/raytrace-parallel/src/pool.rs index e0b30404b4b..d47b1a8ac12 100644 --- a/examples/raytrace-parallel/src/pool.rs +++ b/examples/raytrace-parallel/src/pool.rs @@ -43,10 +43,10 @@ impl WorkerPool { let pool = WorkerPool { state: Rc::new(PoolState { workers: RefCell::new(Vec::with_capacity(initial)), - callback: Closure::wrap(Box::new(|event: Event| { + callback: Closure::new(|event: Event| { console_log!("unhandled event: {}", event.type_()); crate::logv(&event); - }) as Box), + }), }), }; for _ in 0..initial { @@ -145,7 +145,7 @@ impl WorkerPool { let worker2 = worker.clone(); let reclaim_slot = Rc::new(RefCell::new(None)); let slot2 = reclaim_slot.clone(); - let reclaim = Closure::wrap(Box::new(move |event: Event| { + let reclaim = Closure::::new(move |event: Event| { if let Some(error) = event.dyn_ref::() { console_log!("error in worker: {}", error.message()); // TODO: this probably leaks memory somehow? It's sort of @@ -166,7 +166,7 @@ impl WorkerPool { console_log!("unhandled event: {}", event.type_()); crate::logv(&event); // TODO: like above, maybe a memory leak here? - }) as Box); + }); worker.set_onmessage(Some(reclaim.as_ref().unchecked_ref())); *reclaim_slot.borrow_mut() = Some(reclaim); } diff --git a/examples/request-animation-frame/src/lib.rs b/examples/request-animation-frame/src/lib.rs index 436a2deab23..cf787330dea 100644 --- a/examples/request-animation-frame/src/lib.rs +++ b/examples/request-animation-frame/src/lib.rs @@ -43,7 +43,7 @@ pub fn run() -> Result<(), JsValue> { let g = f.clone(); let mut i = 0; - *g.borrow_mut() = Some(Closure::wrap(Box::new(move || { + *g.borrow_mut() = Some(Closure::new(move || { if i > 300 { body().set_text_content(Some("All done!")); @@ -61,7 +61,7 @@ pub fn run() -> Result<(), JsValue> { // Schedule ourself for another requestAnimationFrame callback. request_animation_frame(f.borrow().as_ref().unwrap()); - }) as Box)); + })); request_animation_frame(g.borrow().as_ref().unwrap()); Ok(()) diff --git a/examples/todomvc/src/element.rs b/examples/todomvc/src/element.rs index 4b8965964a1..4a4487759b0 100644 --- a/examples/todomvc/src/element.rs +++ b/examples/todomvc/src/element.rs @@ -61,7 +61,7 @@ impl Element { where T: 'static + FnMut(web_sys::Event), { - let cb = Closure::wrap(Box::new(handler) as Box); + let cb = Closure::new(handler); if let Some(el) = self.el.take() { let el_et: EventTarget = el.into(); el_et @@ -94,7 +94,7 @@ impl Element { // TODO document selector to the target element let tg_el = document; - let cb = Closure::wrap(Box::new(move |event: web_sys::Event| { + let cb = Closure::new(move |event: web_sys::Event| { if let Some(target_element) = event.target() { let dyn_target_el: Option<&web_sys::Node> = wasm_bindgen::JsCast::dyn_ref(&target_element); @@ -116,7 +116,7 @@ impl Element { } } } - }) as Box); + }); dyn_el .add_event_listener_with_callback_and_bool( diff --git a/examples/todomvc/src/view.rs b/examples/todomvc/src/view.rs index 38cbc3ce754..52f5060cf0e 100644 --- a/examples/todomvc/src/view.rs +++ b/examples/todomvc/src/view.rs @@ -86,7 +86,7 @@ impl View { None => return, }; let sched = self.sched.clone(); - let set_page = Closure::wrap(Box::new(move || { + let set_page = Closure::::new(move || { if let Some(location) = document.location() { if let Ok(hash) = location.hash() { if let Ok(sched) = &(sched.try_borrow_mut()) { @@ -94,7 +94,7 @@ impl View { } } } - }) as Box); + }); let window_et: web_sys::EventTarget = window.into(); window_et diff --git a/examples/wasm-in-web-worker/src/lib.rs b/examples/wasm-in-web-worker/src/lib.rs index 49e8a3ef2bc..a61ab173030 100644 --- a/examples/wasm-in-web-worker/src/lib.rs +++ b/examples/wasm-in-web-worker/src/lib.rs @@ -68,7 +68,7 @@ fn setup_input_oninput_callback(worker: Rc>) { #[allow(unused_assignments)] let mut persistent_callback_handle = get_on_msg_callback(); - let callback = Closure::wrap(Box::new(move || { + let callback = Closure::new(move || { console::log_1(&"oninput callback triggered".into()); let document = web_sys::window().unwrap().document().unwrap(); @@ -103,7 +103,7 @@ fn setup_input_oninput_callback(worker: Rc>) { .set_inner_text(""); } } - }) as Box); + }); // Attach the closure as `oninput` callback to the input field. document @@ -119,7 +119,7 @@ fn setup_input_oninput_callback(worker: Rc>) { /// Create a closure to act on the message returned by the worker fn get_on_msg_callback() -> Closure { - let callback = Closure::wrap(Box::new(move |event: MessageEvent| { + let callback = Closure::new(move |event: MessageEvent| { console::log_2(&"Received response: ".into(), &event.data().into()); let result = match event.data().as_bool().unwrap() { @@ -134,7 +134,7 @@ fn get_on_msg_callback() -> Closure { .dyn_ref::() .expect("#resultField should be a HtmlInputElement") .set_inner_text(result); - }) as Box); + }); callback } diff --git a/examples/webrtc_datachannel/src/lib.rs b/examples/webrtc_datachannel/src/lib.rs index 89f747849f5..12423251868 100644 --- a/examples/webrtc_datachannel/src/lib.rs +++ b/examples/webrtc_datachannel/src/lib.rs @@ -44,15 +44,13 @@ pub async fn start() -> Result<(), JsValue> { let dc1_clone = dc1.clone(); let onmessage_callback = - Closure::wrap( - Box::new(move |ev: MessageEvent| match ev.data().as_string() { - Some(message) => { - console_warn!("{:?}", message); - dc1_clone.send_with_str("Pong from pc1.dc!").unwrap(); - } - None => {} - }) as Box, - ); + Closure::::new(move |ev: MessageEvent| match ev.data().as_string() { + Some(message) => { + console_warn!("{:?}", message); + dc1_clone.send_with_str("Pong from pc1.dc!").unwrap(); + } + None => {} + }); dc1.set_onmessage(Some(onmessage_callback.as_ref().unchecked_ref())); onmessage_callback.forget(); @@ -60,27 +58,25 @@ pub async fn start() -> Result<(), JsValue> { * If negotiation has done, this closure will be called * */ - let ondatachannel_callback = Closure::wrap(Box::new(move |ev: RtcDataChannelEvent| { + let ondatachannel_callback = Closure::::new(move |ev: RtcDataChannelEvent| { let dc2 = ev.channel(); console_log!("pc2.ondatachannel!: {:?}", dc2.label()); let onmessage_callback = - Closure::wrap( - Box::new(move |ev: MessageEvent| match ev.data().as_string() { - Some(message) => console_warn!("{:?}", message), - None => {} - }) as Box, - ); + Closure::::new(move |ev: MessageEvent| match ev.data().as_string() { + Some(message) => console_warn!("{:?}", message), + None => {} + }); dc2.set_onmessage(Some(onmessage_callback.as_ref().unchecked_ref())); onmessage_callback.forget(); let dc2_clone = dc2.clone(); - let onopen_callback = Closure::wrap(Box::new(move || { + let onopen_callback = Closure::::new(move || { dc2_clone.send_with_str("Ping from pc2.dc!").unwrap(); - }) as Box); + }); dc2.set_onopen(Some(onopen_callback.as_ref().unchecked_ref())); onopen_callback.forget(); - }) as Box); + }); pc2.set_ondatachannel(Some(ondatachannel_callback.as_ref().unchecked_ref())); ondatachannel_callback.forget(); @@ -90,31 +86,25 @@ pub async fn start() -> Result<(), JsValue> { */ let pc2_clone = pc2.clone(); let onicecandidate_callback1 = - Closure::wrap( - Box::new(move |ev: RtcPeerConnectionIceEvent| match ev.candidate() { - Some(candidate) => { - console_log!("pc1.onicecandidate: {:#?}", candidate.candidate()); - let _ = - pc2_clone.add_ice_candidate_with_opt_rtc_ice_candidate(Some(&candidate)); - } - None => {} - }) as Box, - ); + Closure::::new(move |ev: RtcPeerConnectionIceEvent| match ev.candidate() { + Some(candidate) => { + console_log!("pc1.onicecandidate: {:#?}", candidate.candidate()); + let _ = pc2_clone.add_ice_candidate_with_opt_rtc_ice_candidate(Some(&candidate)); + } + None => {} + }); pc1.set_onicecandidate(Some(onicecandidate_callback1.as_ref().unchecked_ref())); onicecandidate_callback1.forget(); let pc1_clone = pc1.clone(); let onicecandidate_callback2 = - Closure::wrap( - Box::new(move |ev: RtcPeerConnectionIceEvent| match ev.candidate() { - Some(candidate) => { - console_log!("pc2.onicecandidate: {:#?}", candidate.candidate()); - let _ = - pc1_clone.add_ice_candidate_with_opt_rtc_ice_candidate(Some(&candidate)); - } - None => {} - }) as Box, - ); + Closure::::new(move |ev: RtcPeerConnectionIceEvent| match ev.candidate() { + Some(candidate) => { + console_log!("pc2.onicecandidate: {:#?}", candidate.candidate()); + let _ = pc1_clone.add_ice_candidate_with_opt_rtc_ice_candidate(Some(&candidate)); + } + None => {} + }); pc2.set_onicecandidate(Some(onicecandidate_callback2.as_ref().unchecked_ref())); onicecandidate_callback2.forget(); diff --git a/examples/websockets/src/lib.rs b/examples/websockets/src/lib.rs index 964b4d3275a..5caba9fe5ae 100644 --- a/examples/websockets/src/lib.rs +++ b/examples/websockets/src/lib.rs @@ -20,7 +20,7 @@ pub fn start_websocket() -> Result<(), JsValue> { ws.set_binary_type(web_sys::BinaryType::Arraybuffer); // create callback let cloned_ws = ws.clone(); - let onmessage_callback = Closure::wrap(Box::new(move |e: MessageEvent| { + let onmessage_callback = Closure::::new(move |e: MessageEvent| { // Handle difference Text/Binary,... if let Ok(abuf) = e.data().dyn_into::() { console_log!("message event, received arraybuffer: {:?}", abuf); @@ -40,13 +40,12 @@ pub fn start_websocket() -> Result<(), JsValue> { let fr = web_sys::FileReader::new().unwrap(); let fr_c = fr.clone(); // create onLoadEnd callback - let onloadend_cb = Closure::wrap(Box::new(move |_e: web_sys::ProgressEvent| { + let onloadend_cb = Closure::::new(move |_e: web_sys::ProgressEvent| { let array = js_sys::Uint8Array::new(&fr_c.result().unwrap()); let len = array.byte_length() as usize; console_log!("Blob received {}bytes: {:?}", len, array.to_vec()); // here you can for example use the received image/png data - }) - as Box); + }); fr.set_onloadend(Some(onloadend_cb.as_ref().unchecked_ref())); fr.read_as_array_buffer(&blob).expect("blob not readable"); onloadend_cb.forget(); @@ -55,20 +54,20 @@ pub fn start_websocket() -> Result<(), JsValue> { } else { console_log!("message event, received Unknown: {:?}", e.data()); } - }) as Box); + }); // set message event handler on WebSocket ws.set_onmessage(Some(onmessage_callback.as_ref().unchecked_ref())); // forget the callback to keep it alive onmessage_callback.forget(); - let onerror_callback = Closure::wrap(Box::new(move |e: ErrorEvent| { + let onerror_callback = Closure::::new(move |e: ErrorEvent| { console_log!("error event: {:?}", e); - }) as Box); + }); ws.set_onerror(Some(onerror_callback.as_ref().unchecked_ref())); onerror_callback.forget(); let cloned_ws = ws.clone(); - let onopen_callback = Closure::wrap(Box::new(move |_| { + let onopen_callback = Closure::::new(move || { console_log!("socket opened"); match cloned_ws.send_with_str("ping") { Ok(_) => console_log!("message successfully sent"), @@ -79,7 +78,7 @@ pub fn start_websocket() -> Result<(), JsValue> { Ok(_) => console_log!("binary message successfully sent"), Err(err) => console_log!("error sending message: {:?}", err), } - }) as Box); + }); ws.set_onopen(Some(onopen_callback.as_ref().unchecked_ref())); onopen_callback.forget(); diff --git a/examples/webxr/src/lib.rs b/examples/webxr/src/lib.rs index 1150e91d390..f6fe310572c 100644 --- a/examples/webxr/src/lib.rs +++ b/examples/webxr/src/lib.rs @@ -121,7 +121,7 @@ impl XrApp { let g = f.clone(); let mut i = 0; - *g.borrow_mut() = Some(Closure::wrap(Box::new(move |time: f64, frame: XrFrame| { + *g.borrow_mut() = Some(Closure::new(move |time: f64, frame: XrFrame| { log!("Frame rendering..."); if i > 2 { log!("All done!"); @@ -138,7 +138,7 @@ impl XrApp { // Schedule ourself for another requestAnimationFrame callback. // TODO: WebXR Samples call this at top of request_animation_frame - should this be moved? request_animation_frame(&sess, f.borrow().as_ref().unwrap()); - }) as Box)); + })); let session: &Option = &self.session.borrow(); let sess: &XrSession = if let Some(sess) = session { diff --git a/src/closure.rs b/src/closure.rs index 57190cf8303..37cef06dcd9 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -65,7 +65,7 @@ use crate::UnwrapThrowExt; /// /// #[wasm_bindgen] /// pub fn run() -> IntervalHandle { -/// // First up we use `Closure::wrap` to wrap up a Rust closure and create +/// // First up we use `Closure::new` to wrap up a Rust closure and create /// // a JS closure. /// let cb = Closure::new(|| { /// log("interval elapsed!"); From 1bb1ab1ea1527127d6f616e3e214d6f87e10c073 Mon Sep 17 00:00:00 2001 From: jneem Date: Sun, 17 Jul 2022 02:39:01 -0500 Subject: [PATCH 049/641] Remove obsolete documentation about Stack. (#2997) --- .../design/rust-type-conversions.md | 48 +++---------------- src/describe.rs | 2 +- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/guide/src/contributing/design/rust-type-conversions.md b/guide/src/contributing/design/rust-type-conversions.md index 5565b684e04..ed3e2c3dc76 100644 --- a/guide/src/contributing/design/rust-type-conversions.md +++ b/guide/src/contributing/design/rust-type-conversions.md @@ -12,7 +12,7 @@ First up let's take a look at going from Rust to JS: ```rust pub trait IntoWasmAbi: WasmDescribe { type Abi: WasmAbi; - fn into_abi(self, extra: &mut Stack) -> Self::Abi; + fn into_abi(self) -> Self::Abi; } ``` @@ -25,9 +25,7 @@ a Rust value to a JS one. There's a few points here: and `f64`, those which can be placed on the boundary and transmitted losslessly. * And finally we have the `into_abi` function, returning the `Abi` associated - type which will be actually passed to JS. There's also this `Stack` parameter, - however. Not all Rust values can be communicated in 32 bits to the `Stack` - parameter allows transmitting more data, explained in a moment. + type which will be actually passed to JS. This trait is implemented for all types that can be converted to JS and is unconditionally used during codegen. For example you'll often see `IntoWasmAbi @@ -45,25 +43,25 @@ more complicated. Here we've got three traits: ```rust pub trait FromWasmAbi: WasmDescribe { type Abi: WasmAbi; - unsafe fn from_abi(js: Self::Abi, extra: &mut Stack) -> Self; + unsafe fn from_abi(js: Self::Abi) -> Self; } pub trait RefFromWasmAbi: WasmDescribe { type Abi: WasmAbi; type Anchor: Deref; - unsafe fn ref_from_abi(js: Self::Abi, extra: &mut Stack) -> Self::Anchor; + unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor; } pub trait RefMutFromWasmAbi: WasmDescribe { type Abi: WasmAbi; type Anchor: DerefMut; - unsafe fn ref_mut_from_abi(js: Self::Abi, extra: &mut Stack) -> Self::Anchor; + unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor; } ``` The `FromWasmAbi` is relatively straightforward, basically the opposite of `IntoWasmAbi`. It takes the ABI argument (typically the same as -`IntoWasmAbi::Abi`) and then the auxiliary stack to produce an instance of +`IntoWasmAbi::Abi`) to produce an instance of `Self`. This trait is implemented primarily for types that *don't* have internal lifetimes or are references. @@ -81,37 +79,3 @@ The `From*` family of traits are used for converting the Rust arguments in Rust exported functions to JS. They are also used for the return value in JS functions imported into Rust. -## Global stack - -Mentioned above not all Rust types will fit within 32 bits. While we can -communicate an `f64` we don't necessarily have the ability to use all the bits. -Types like `&str` need to communicate two items, a pointer and a length (64 -bits). Other types like `&Closure` have even more information to -transmit. - -As a result we need a method of communicating more data through the signatures -of functions. While we could add more arguments this is somewhat difficult to do -in the world of closures where code generation isn't quite as dynamic as a -procedural macro. Consequently a "global stack" is used to transmit extra -data for a function call. - -The global stack is a fixed-sized static allocation in the wasm module. This -stack is temporary scratch space for any one function call from either JS to -Rust or Rust to JS. Both Rust and the JS shim generated have pointers to this -global stack and will read/write information from it. - -Using this scheme whenever we want to pass `&str` from JS to Rust we can pass -the pointer as the actual ABI argument and the length is then placed in the next -spot on the global stack. - -The `Stack` argument to the conversion traits above looks like: - -```rust -pub trait Stack { - fn push(&mut self, bits: u32); - fn pop(&mut self) -> u32; -} -``` - -A trait is used here to facilitate testing but typically the calls don't end up -being virtually dispatched at runtime. diff --git a/src/describe.rs b/src/describe.rs index 84fab48f779..2b7c4b628c0 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -47,7 +47,7 @@ tys! { CLAMPED } -#[inline(always)] // see `interpret.rs` in the the cli-support crate +#[inline(always)] // see the wasm-interpreter crate pub fn inform(a: u32) { unsafe { super::__wbindgen_describe(a) } } From 0aa23f089796f6bb433994c790b5c6ec9f653261 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 18 Jul 2022 23:21:45 +1000 Subject: [PATCH 050/641] Don't attempt to update rustup in CI (#2998) For whatever reason, updating rustup sometimes fails on Windows (such as https://github.com/rustwasm/wasm-bindgen/runs/7375883557?check_suite_focus=true), so disable that since the version of rustup used has no effect on us anyway. --- .github/workflows/main.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79a08c9f65f..61f30661967 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: cargo check --all test_wasm_bindgen: @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -86,7 +86,7 @@ jobs: # runs-on: windows-latest # steps: # - uses: actions/checkout@v2 - # - run: rustup update stable && rustup default stable + # - run: rustup update --no-self-update stable && rustup default stable # - run: rustup target add wasm32-unknown-unknown # - uses: actions/setup-node@v2 # with: @@ -107,7 +107,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -126,7 +126,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -146,7 +146,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features - run: git diff --exit-code @@ -155,7 +155,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -171,7 +171,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -189,7 +189,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 with: @@ -201,7 +201,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: denoland/setup-deno@v1 with: @@ -213,14 +213,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update 1.56.0 && rustup default 1.56.0 + - run: rustup update --no-self-update 1.56.0 && rustup default 1.56.0 - run: cargo test -p wasm-bindgen-macro build_examples: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - run: | @@ -259,7 +259,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown - run: cargo run -p wasm-bindgen-cli -- target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm --out-dir benchmarks/pkg --target web @@ -272,7 +272,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add x86_64-unknown-linux-musl - run: sudo apt update -y && sudo apt install musl-tools -y - run: | @@ -289,7 +289,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 @@ -302,7 +302,7 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 - - run: rustup update stable && rustup default stable + - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: RUSTFLAGS: -Ctarget-feature=+crt-static @@ -328,7 +328,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: rustup update nightly && rustup default nightly + - run: rustup update --no-self-update nightly && rustup default nightly - run: cargo doc --no-deps --features 'serde-serialize' - run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml - run: cargo doc --no-deps --manifest-path crates/web-sys/Cargo.toml --all-features @@ -357,7 +357,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - run: rustup update nightly && rustup default nightly + - run: rustup update --no-self-update nightly && rustup default nightly - uses: actions/download-artifact@v2 with: path: artifacts From 1790a28f77a271711d9310ad936537c7ce3c4c36 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 18 Jul 2022 23:22:01 +1000 Subject: [PATCH 051/641] Add a bit more detail about how non-primitive types are represented in FFI (#2999) This is a bit of a follow-on from #2997, adding some more detail on the system that replaced `Stack`. --- .../design/rust-type-conversions.md | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/guide/src/contributing/design/rust-type-conversions.md b/guide/src/contributing/design/rust-type-conversions.md index ed3e2c3dc76..7af5f1b4dca 100644 --- a/guide/src/contributing/design/rust-type-conversions.md +++ b/guide/src/contributing/design/rust-type-conversions.md @@ -19,11 +19,27 @@ pub trait IntoWasmAbi: WasmDescribe { And that's it! This is actually the only trait needed currently for translating a Rust value to a JS one. There's a few points here: -* We'll get to `WasmDescribe` later in this section -* The associated type `Abi` is what will actually be generated as an argument to - the wasm export. The bound `WasmAbi` is only implemented for types like `u32` - and `f64`, those which can be placed on the boundary and transmitted - losslessly. +* We'll get to `WasmDescribe` later in this section. + +* The associated type `Abi` is what will actually be generated as an argument / + return type for the `extern "C"` functions used to declare wasm imports/exports. + The bound `WasmAbi` is implemented for primitive types like `u32` and `f64`, + which can be represented directly as WebAssembly values, as well of a couple + of `#[repr(C)]` types like `WasmSlice`: + + ```rust + #[repr(C)] + pub struct WasmSlice { + pub ptr: u32, + pub len: u32, + } + ``` + + This struct, which is how things like strings are represented in FFI, isn't + a WebAssembly primitive type and so isn't mapped directly to a WebAssembly + parameter / return value; instead, the C ABI flattens it out into two arguments + or stores it on the stack. + * And finally we have the `into_abi` function, returning the `Abi` associated type which will be actually passed to JS. From a8e934df8244846b4a099f9b392fa7b01e25a536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Stud=C3=BDnka?= <66028253+petrstudynka@users.noreply.github.com> Date: Tue, 19 Jul 2022 18:08:35 +0200 Subject: [PATCH 052/641] Added inspectable generation to .d.ts file (#3000) (#3001) * Added inspectable generation to .d.ts file (#3000) * Add ts tests (#3000) --- crates/cli-support/src/js/mod.rs | 10 ++++++++++ crates/typescript-tests/src/inspectable.rs | 15 +++++++++++++++ crates/typescript-tests/src/inspectable.ts | 6 ++++++ crates/typescript-tests/src/lib.rs | 1 + 4 files changed, 32 insertions(+) create mode 100644 crates/typescript-tests/src/inspectable.rs create mode 100644 crates/typescript-tests/src/inspectable.ts diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 0f444eb78dd..24779223918 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -948,6 +948,16 @@ impl<'a> Context<'a> { format!("{}{name}: this.{name},\n", fields, name = field_name) }) )); + // Also add definitions to the .d.ts file. + ts_dst.push_str( + "\ + /**\n*\ + * Return copy of self without private attributes.\n\ + */\n toJSON(): Object;\n\ + /**\n\ + * Return stringified version of self.\n\ + */\n toString(): string;\n", + ); if self.config.mode.nodejs() { // `util.inspect` must be imported in Node.js to define [inspect.custom] diff --git a/crates/typescript-tests/src/inspectable.rs b/crates/typescript-tests/src/inspectable.rs new file mode 100644 index 00000000000..cfab5babe34 --- /dev/null +++ b/crates/typescript-tests/src/inspectable.rs @@ -0,0 +1,15 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(inspectable)] +pub struct Bar { + pub foo: i32, + _private: i32, +} + +#[wasm_bindgen] +impl Bar { + #[wasm_bindgen(constructor)] + pub fn new(foo: i32) -> Self { + Self { foo, _private: 13 } + } +} diff --git a/crates/typescript-tests/src/inspectable.ts b/crates/typescript-tests/src/inspectable.ts new file mode 100644 index 00000000000..762ddbe2f5e --- /dev/null +++ b/crates/typescript-tests/src/inspectable.ts @@ -0,0 +1,6 @@ +import * as wbg from "../pkg/typescript_tests"; + +const bar: wbg.Bar = new wbg.Bar(1); +const barAsJson: Object = bar.toJSON(); +const barAsString: string = bar.toString(); +const _ = bar.foo; diff --git a/crates/typescript-tests/src/lib.rs b/crates/typescript-tests/src/lib.rs index f2ecc140914..dda6a48e9d2 100644 --- a/crates/typescript-tests/src/lib.rs +++ b/crates/typescript-tests/src/lib.rs @@ -1,5 +1,6 @@ pub mod custom_section; pub mod getters_setters; +pub mod inspectable; pub mod omit_definition; pub mod opt_args_and_ret; pub mod optional_fields; From 59883eaca6c48a0d96303f04b92ac0e4d40a717d Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Mon, 25 Jul 2022 23:06:53 +0800 Subject: [PATCH 053/641] Bump to 0.2.82 (#3002) * Bump to 0.2.82 * chore: bump version in crates/shared/src/lib.rs in sync with crates/shared/Cargo.toml * fix: update schema file hash --- Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 8 ++++---- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- 50 files changed, 103 insertions(+), 103 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f34dbca91f3..09199d47822 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -35,15 +35,15 @@ strict-macro = ["wasm-bindgen-macro/strict-macro"] xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.81" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.82" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.58' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.31' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.31' } +js-sys = { path = 'crates/js-sys', version = '0.3.59' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.32' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.32' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 0bb44bbca4a..45d2d7d387f 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -22,4 +22,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 8e41ff1f688..2c6eb736edf 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -19,12 +19,12 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.19.0" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.81' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.81' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.81' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.81' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.81' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.81' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.82' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.82' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.82' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.82' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.82' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.82' } wit-text = "0.8.0" wit-walrus = "0.6.0" wit-validator = "0.2.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 8b3fd73887e..13a13cd243c 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -26,8 +26,8 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" walrus = { version = "0.19.0", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.81" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.82" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 6a8d25b8d43..3ed8c55666e 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 4f170f1b9bb..bf7d6912888 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,13 +7,13 @@ license = "MIT/Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.31" +version = "0.4.32" edition = "2018" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.58' } -wasm-bindgen = { path = "../..", version = '0.2.81' } +js-sys = { path = "../js-sys", version = '0.3.59' } +wasm-bindgen = { path = "../..", version = '0.2.82' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -28,6 +28,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.31' } +wasm-bindgen-test = { path = '../test', version = '0.3.32' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 4a9ff33f1eb..b922a63efcc 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.58" +version = "0.3.59" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -19,9 +19,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.81" } +wasm-bindgen = { path = "../..", version = "0.2.82" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.31' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } -web-sys = { path = "../web-sys", version = "0.3.58", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.32' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } +web-sys = { path = "../web-sys", version = "0.3.59", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index dfc68a26cb2..e6aa62f2f48 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -20,5 +20,5 @@ strict-macro = [] syn = { version = '1.0.67', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.81" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.81" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.82" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 2e6e07456b2..cfe8f0f0138 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -20,10 +20,10 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.81" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.82" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.81", features = ['strict-macro'] } -wasm-bindgen-futures = { path = "../futures", version = "0.4.31" } +wasm-bindgen = { path = "../..", version = "0.2.82", features = ['strict-macro'] } +wasm-bindgen-futures = { path = "../futures", version = "0.4.32" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index e8c16c7fd80..7cb6cd9c70f 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index bd6ec711006..f79108bcafe 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 11372856aff..dfa338a3747 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.74"; +pub const SCHEMA_VERSION: &str = "0.2.82"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index a2d788aada1..8b26fc3c71c 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "16056751188521403565"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "18229224525184165582"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 8e9dd7dae6c..9d67e5ac9f1 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.31" +version = "0.3.32" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT/Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 8e46962dd9b..e9a4674e07f 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.31" +version = "0.3.32" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT/Apache-2.0" @@ -9,11 +9,11 @@ edition = "2018" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.58' } +js-sys = { path = '../js-sys', version = '0.3.59' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.81' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.31' } +wasm-bindgen = { path = '../..', version = '0.2.82' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.32' } [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index e4020b376c9..906ac264b15 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -14,7 +14,7 @@ edition = "2018" [dependencies] anyhow = "1.0" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.81" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.82" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index b0f19d19963..82da21485d3 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 7d2a8f3d276..dafb7336919 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.81" +version = "0.2.82" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-interpreter" @@ -15,7 +15,7 @@ edition = '2018' anyhow = "1.0" log = "0.4" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.81" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.82" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b9d9102a355..2dd34862c4b 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.58" +version = "0.3.59" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -21,12 +21,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.81" } -js-sys = { path = '../js-sys', version = '0.3.58' } +wasm-bindgen = { path = "../..", version = "0.2.82" } +js-sys = { path = '../js-sys', version = '0.3.59' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.31' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.31' } +wasm-bindgen-test = { path = '../test', version = '0.3.32' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 4e6814f98fa..ad9c36d67de 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -20,7 +20,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.81", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.82", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index b60596c96c2..2faf13667c3 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 380ec69638d..fceee3876ef 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.58" -wasm-bindgen = "0.2.81" +js-sys = "0.3.59" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 0d1040572f9..847dccf2b3c 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index cd51d7a2119..ec3abd123e6 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" -js-sys = "0.3.58" +wasm-bindgen = "0.2.82" +js-sys = "0.3.59" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 7d6a310107c..e656e816b67 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" -web-sys = { version = "0.3.58", features = ['console'] } +wasm-bindgen = "0.2.82" +web-sys = { version = "0.3.59", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index f7de714655d..460e9058e04 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 8f5d03ea140..703b0b535c4 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index d0e28d782ab..f3bbfa515b1 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index b334fbe5cfc..bf1f73ca5e9 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { version = "0.2.81", features = ["serde-serialize"] } -js-sys = "0.3.58" -wasm-bindgen-futures = "0.4.31" +wasm-bindgen = { version = "0.2.82", features = ["serde-serialize"] } +js-sys = "0.3.59" +wasm-bindgen-futures = "0.4.32" serde = { version = "1.0.80", features = ["derive"] } serde_derive = "^1.0.59" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index bf4361e9d5f..a0e86c792f6 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" -js-sys = "0.3.58" +wasm-bindgen = "0.2.82" +js-sys = "0.3.59" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index d7575e2dcac..f3f327868b8 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index e1b73fc02ff..31805842f8f 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 3d0ae81028c..71dc2dc5a5b 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 67bfd160c12..0cf86f90b78 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.58" -wasm-bindgen = "0.2.81" +js-sys = "0.3.59" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index c3ac0c70524..56b51718bbc 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index a49b6d91945..cb3c45a82f8 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -9,13 +9,13 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.58" +js-sys = "0.3.59" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = { version = "0.2.81", features = ['serde-serialize'] } -wasm-bindgen-futures = "0.4.31" +wasm-bindgen = { version = "0.2.82", features = ['serde-serialize'] } +wasm-bindgen-futures = "0.4.32" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 8b44924aab6..7514dae5bab 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 76ed6a2171a..19c1d089ffd 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index a5ed6cd8176..8ef6f7f00ca 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -11,8 +11,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.58" -wasm-bindgen = "0.2.81" +js-sys = "0.3.59" +wasm-bindgen = "0.2.82" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index e5173a7660f..2f187d47e74 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" -js-sys = "0.3.58" -wasm-bindgen-futures = "0.4.31" +wasm-bindgen = "0.2.82" +js-sys = "0.3.59" +wasm-bindgen-futures = "0.4.32" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index a35ea3ca29d..76edbb05e92 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" -js-sys = "0.3.58" -wasm-bindgen-futures = "0.4.31" +wasm-bindgen = "0.2.82" +js-sys = "0.3.59" +wasm-bindgen-futures = "0.4.32" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index d8d112769fd..4ef4e128e8c 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 6f0df344d9f..9b07d25f8e9 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 0af8a3a8468..2bf0d19397e 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -15,7 +15,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index c6d85ed241d..b8575e1f0df 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index a11c6aaba08..ba74e9eee1a 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.58" -wasm-bindgen = "0.2.81" +js-sys = "0.3.59" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 42c4ce61720..171b26e1ad9 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" js-sys = "0.3" -wasm-bindgen-futures = "0.4.31" +wasm-bindgen-futures = "0.4.32" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 29052830da2..78d09de7e69 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index eb563959586..d29fd571c41 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.58" -wasm-bindgen = {version = "0.2.81", features = ["serde-serialize"]} -wasm-bindgen-futures = "0.4.31" +js-sys = "0.3.59" +wasm-bindgen = {version = "0.2.82", features = ["serde-serialize"]} +wasm-bindgen-futures = "0.4.32" serde = { version = "1.0.80", features = ["derive"] } serde_derive = "^1.0.59" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 015baf4dc45..bf651e5b05e 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.81" +wasm-bindgen = "0.2.82" [dependencies.web-sys] version = "0.3.4" From 6daa3d18a80dacfdd8a637d5eff380aacb10ef80 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 29 Jul 2022 23:19:28 +0900 Subject: [PATCH 054/641] Convert Big[Ui,I]nt64Array bindings to use [u/i]64 (#3011) Using BigInt as the macro parameters leads to absurd signatures like slices of BigInt objects (can't exist). Instead, just use the numeric types. bindgen already converts them to bigint when appropriate. Closes: https://github.com/rustwasm/wasm-bindgen/issues/3009 Fixes: d6d056cd ("Add math-related intrinsics/functions for `JsValue`s (#2629)") --- crates/js-sys/src/lib.rs | 4 ++-- crates/js-sys/tests/wasm/Array.js | 5 +++-- crates/js-sys/tests/wasm/Array.rs | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index e0b1dd25a27..1f13a3fdcaf 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -5854,9 +5854,9 @@ arrays! { /// `BigInt64Array()` /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array - BigInt64Array: BigInt, + BigInt64Array: i64, /// `BigUint64Array()` /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array - BigUint64Array: BigInt, + BigUint64Array: u64, } diff --git a/crates/js-sys/tests/wasm/Array.js b/crates/js-sys/tests/wasm/Array.js index 8810bd9db88..f4d6ab71382 100644 --- a/crates/js-sys/tests/wasm/Array.js +++ b/crates/js-sys/tests/wasm/Array.js @@ -1,6 +1,7 @@ // Used for `Array.rs` tests -exports.populate_array = function(arr, start, len) { +exports.populate_array = function(arr, start, len) { + var isBigInt = typeof(arr[0]) === "bigint"; for (i = 0; i < len; i++) { - arr[i] = start + i; + arr[i] = isBigInt ? BigInt(start + i) : start + i; } }; diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index 9554f39f711..e498c2cc0a9 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -594,6 +594,15 @@ fn Int32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Int32Array::view_mut_raw, i32::from, JsValue::from); } +#[wasm_bindgen_test] +fn BigInt64Array_view_mut_raw() { + test_array_view_mut_raw( + js_sys::BigInt64Array::view_mut_raw, + i64::from, + JsValue::from, + ); +} + #[wasm_bindgen_test] fn Uint8Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Uint8Array::view_mut_raw, u8::from, JsValue::from); @@ -618,6 +627,15 @@ fn Uint32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Uint32Array::view_mut_raw, u32::from, JsValue::from); } +#[wasm_bindgen_test] +fn BigUint64Array_view_mut_raw() { + test_array_view_mut_raw( + js_sys::BigUint64Array::view_mut_raw, + u64::from, + JsValue::from, + ); +} + #[wasm_bindgen_test] fn Float32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Float32Array::view_mut_raw, f32::from, JsValue::from); From 434454da7a43e687e24b3dd295295a49bcf8a49b Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Wed, 3 Aug 2022 16:53:03 +0200 Subject: [PATCH 055/641] Handle precompiled modules in initSync on target web (#3016) --- crates/cli-support/src/js/mod.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 24779223918..3cbb7da3e7a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -614,16 +614,19 @@ impl<'a> Context<'a> { } else { declare_or_export = "export"; - sync_init_function.push_str(&format!("\ + sync_init_function.push_str(&format!( + "\ + {declare_or_export} type SyncInitInput = BufferSource | WebAssembly.Module;\n\ /**\n\ - * Synchronously compiles the given `bytes` and instantiates the WebAssembly module.\n\ + * Instantiates the given `module`, which can either be bytes or\n\ + * a precompiled `WebAssembly.Module`.\n\ *\n\ - * @param {{BufferSource}} bytes\n\ + * @param {{SyncInitInput}} module\n\ {memory_doc}\ *\n\ * @returns {{InitOutput}}\n\ */\n\ - export function initSync(bytes: BufferSource{memory_param}): InitOutput;\n\n\ + export function initSync(module: SyncInitInput{memory_param}): InitOutput;\n\n\ ", memory_doc = memory_doc, memory_param = memory_param @@ -836,12 +839,15 @@ impl<'a> Context<'a> { return wasm; }} - function initSync(bytes{init_memory_arg}) {{ + function initSync(module{init_memory_arg}) {{ const imports = getImports(); initMemory(imports{init_memory_arg}); - const module = new WebAssembly.Module(bytes); + if (!(module instanceof WebAssembly.Module)) {{ + module = new WebAssembly.Module(module); + }} + const instance = new WebAssembly.Instance(module, imports); return finalizeInit(instance, module); From 8e19dcfe5367a0a1b7616e6000f035bd3686c3db Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 6 Aug 2022 01:46:13 +1000 Subject: [PATCH 056/641] Fix `TryFrom for f64` and `JsValue::checked_div` (#3021) * Fix `TryFrom for f64` and `JsValue::checked_div` Also added some tests for those and other obscure intrinsics. * fmt --- crates/cli-support/src/js/mod.rs | 26 ++++++- tests/wasm/intrinsics.rs | 113 +++++++++++++++++++++++++++++++ tests/wasm/main.rs | 1 + 3 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 tests/wasm/intrinsics.rs diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 3cbb7da3e7a..0e8934ed809 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3200,7 +3200,14 @@ impl<'a> Context<'a> { Intrinsic::TryIntoNumber => { assert_eq!(args.len(), 1); - format!("try {{ +{} }} catch(e) {{ e }}", args[0]) + prelude.push_str("let result;\n"); + writeln!( + prelude, + "try {{ result = +{} }} catch (e) {{ result = e }}", + args[0] + ) + .unwrap(); + "result".to_owned() } Intrinsic::Neg => { @@ -3260,7 +3267,22 @@ impl<'a> Context<'a> { Intrinsic::CheckedDiv => { assert_eq!(args.len(), 2); - format!("try {{ {} / {} }} catch (e) {{ if (e instanceof RangeError) {{ e }} else {{ throw e }} }}", args[0], args[1]) + prelude.push_str("let result;\n"); + writeln!( + prelude, + "try {{ + result = {} / {}; + }} catch (e) {{ + if (e instanceof RangeError) {{ + result = e; + }} else {{ + throw e; + }} + }}", + args[0], args[1] + ) + .unwrap(); + "result".to_owned() } Intrinsic::Mul => { diff --git a/tests/wasm/intrinsics.rs b/tests/wasm/intrinsics.rs new file mode 100644 index 00000000000..15985e81213 --- /dev/null +++ b/tests/wasm/intrinsics.rs @@ -0,0 +1,113 @@ +//! Tests that some of our more obscure intrinsics work properly. + +use std::convert::TryFrom; +use std::fmt::Debug; + +use js_sys::{Object, RangeError, Reflect}; +use wasm_bindgen::{JsCast, JsValue}; +use wasm_bindgen_test::wasm_bindgen_test; + +// Shorter `JsValue::from(i32)`. +fn int(x: i32) -> JsValue { + JsValue::from(x) +} + +#[wasm_bindgen_test] +fn bitwise() { + assert_eq!(int(0b1110) & int(0b0111), 0b0110); + assert_eq!(int(0b1000) | int(0b0010), 0b1010); + assert_eq!(int(0b1110) ^ int(0b0100), 0b1010); + assert_eq!(int(0x00ffffff).bit_not(), 0xff000000u32 as i32); + + assert_eq!(int(0b0001) << int(2), 0b0100); + assert_eq!(int(0b1000) >> int(2), 0b0010); + assert_eq!(int(-0b1000) >> int(2), -0b0010); + // Note that bit-wise, this is the same as the above `-0b1000`. + assert_eq!( + JsValue::from(0xfffffff8u32).unsigned_shr(&int(2)), + 0x3ffffffe + ); +} + +#[wasm_bindgen_test] +fn arithmetic() { + assert_eq!(-int(12), -12); + assert_eq!(int(1) + int(2), 3); + assert_eq!(int(1) - int(2), -1); + assert_eq!(int(10) / int(5), 2); + assert_eq!(int(42).checked_div(&int(6)), 7); + // Note that this doesn't throw for regular numbers, since they just give + // `NaN` for invalid results. + assert!(JsValue::bigint_from_str("0") + .checked_div(&JsValue::bigint_from_str("0")) + .dyn_into::() + .is_ok()); + assert_eq!(int(12) * int(34), 408); + assert_eq!(int(17) % int(10), 7); + assert_eq!(int(2).pow(&int(8)), 256) +} + +#[wasm_bindgen_test] +fn cmp() { + assert!(int(2).lt(&int(3))); + assert!(!int(2).lt(&int(2))); + + assert!(int(2).le(&int(3))); + assert!(int(2).le(&int(2))); + + assert!(int(3).ge(&int(2))); + assert!(int(3).ge(&int(3))); + + assert!(int(3).gt(&int(2))); + assert!(!int(3).gt(&int(3))); + + assert!(int(2) == int(2)); + assert!(int(2) != int(3)); + + assert!(int(2) != JsValue::from_str("2")); + assert!(int(2).loose_eq(&JsValue::from_str("2"))); +} + +#[wasm_bindgen_test] +fn types() { + assert!( + Reflect::get(&js_sys::global(), &JsValue::from_str("Number")) + .unwrap() + .is_function() + ); + assert!(JsValue::UNDEFINED.is_undefined()); + assert!(JsValue::NULL.is_null()); + assert!(Object::new().is_object()); + assert!(JsValue::symbol(None).is_symbol()); + assert!(JsValue::from_str("hi").is_string()); + assert!(JsValue::bigint_from_str("5").is_bigint()); + assert_eq!(int(5).js_typeof(), "number"); + assert_eq!(JsValue::bigint_from_str("5").js_typeof(), "bigint"); + assert_eq!(JsValue::NULL.js_typeof(), "object"); +} + +#[wasm_bindgen_test] +fn misc() { + assert!(JsValue::from_str("Number").js_in(&js_sys::global())); + assert!(!JsValue::from_str("frob").js_in(&js_sys::global())); + + assert_eq!(int(5).unchecked_into_f64(), 5.0); + assert_eq!(JsValue::from_str("5").unchecked_into_f64(), 5.0); + + assert_eq!(f64::try_from(int(5)), Ok(5.0)); + assert_eq!(f64::try_from(JsValue::from_str("5")), Ok(5.0)); + assert!(f64::try_from(JsValue::from_str("hi")).unwrap().is_nan()); + assert!(f64::try_from(JsValue::symbol(None)).is_err()); +} + +fn debug(x: impl Debug) -> String { + format!("{x:?}") +} + +#[wasm_bindgen_test] +fn debug_string() { + assert_eq!(debug(int(5)), "JsValue(5)"); + assert_eq!(debug(JsValue::TRUE), "JsValue(true)"); + assert_eq!(debug(JsValue::symbol(None)), "JsValue(Symbol)"); + assert_eq!(debug(JsValue::from_str("hi")), "JsValue(\"hi\")"); +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 58c9b4e070b..2d3b9b5baf2 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -27,6 +27,7 @@ pub mod futures; pub mod getters_and_setters; pub mod import_class; pub mod imports; +pub mod intrinsics; pub mod js_keywords; pub mod js_objects; pub mod jscast; From 643a773429e141a140f6e121a63c5e2f946a034c Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 6 Aug 2022 01:51:41 +1000 Subject: [PATCH 057/641] Test examples in CI (#3015) * Add a test that examples don't throw any errors TODO: - run all the tests, not just the ones which use webpack (also an issue with CI) - fix webxr test - run in CI - share WebDriver instance between tests - maybe ditch async, since we don't really need it here and it adds a bunch of dependencies and build time. * Disable testing WebXR example It isn't supported in Firefox yet, which is where we're running our tests. * Test examples that aren't built with webpack * Remove `WEBDRIVER` environment variable It wouldn't have worked anyway because at least for the moment, I'm using one WebDriver session per test, and Firefox at least only allows one session to be connected. I would like to make them share a session, in which case I could add this back, but I can't right now because Firefox hasn't implemented `LogEntry.source` yet, which is needed to figure out which log entries should fail which tests. * Run in CI * Use `Once` instead of `Mutex` * Build `webxr` and `synchronous-instantiation` in CI Although we can't test them, we can still build them. * Add missing '`' * Fix running of tests * Only include dev deps when not compiling for wasm * oops, those are the native tests * Create build dirs before copying to them * Install binaryen * decompress * Follow redirects * Set `PATH` properly * Use an absolute path * Don't symlink `node_modules` and fix artifact download * Enable `web_sys_unstable_apis` This is needed for the `webxr` example. * Increase timeout to 10s * Increase timeout to 20s This seems excessive but 10s is still sometimes failing. * Disable testing the webgl example * Add binaryen to PATH directly after installing * Properly download the raytrace example artifacts * Disable example tests instead of enabling everything else * Move to a separate `example-tests` crate --- .github/workflows/main.yml | 34 +- Cargo.toml | 1 + crates/example-tests/Cargo.toml | 18 + crates/example-tests/LICENSE-APACHE | 1 + crates/example-tests/LICENSE-MIT | 1 + crates/example-tests/README.md | 6 + crates/example-tests/src/lib.rs | 424 ++++++++++++++++++ crates/example-tests/tests/shell.rs | 56 +++ crates/example-tests/tests/webpack.rs | 92 ++++ examples/raytrace-parallel/README.md | 2 +- examples/raytrace-parallel/build.sh | 2 - examples/raytrace-parallel/run.sh | 7 + examples/synchronous-instantiation/build.sh | 1 - examples/wasm-in-web-worker/build.sh | 2 +- .../wasm-in-web-worker/{www => }/index.html | 0 .../wasm-in-web-worker/{www => }/index.js | 0 .../wasm-in-web-worker/{www => }/style.css | 0 .../wasm-in-web-worker/{www => }/worker.js | 0 examples/wasm2js/build.sh | 2 - examples/websockets/build.sh | 5 + .../without-a-bundler-no-modules/build.sh | 5 + examples/without-a-bundler/build.sh | 1 - 22 files changed, 648 insertions(+), 12 deletions(-) create mode 100644 crates/example-tests/Cargo.toml create mode 120000 crates/example-tests/LICENSE-APACHE create mode 120000 crates/example-tests/LICENSE-MIT create mode 100644 crates/example-tests/README.md create mode 100644 crates/example-tests/src/lib.rs create mode 100644 crates/example-tests/tests/shell.rs create mode 100644 crates/example-tests/tests/webpack.rs create mode 100755 examples/raytrace-parallel/run.sh rename examples/wasm-in-web-worker/{www => }/index.html (100%) rename examples/wasm-in-web-worker/{www => }/index.js (100%) rename examples/wasm-in-web-worker/{www => }/style.css (100%) rename examples/wasm-in-web-worker/{www => }/worker.js (100%) create mode 100755 examples/websockets/build.sh create mode 100755 examples/without-a-bundler-no-modules/build.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61f30661967..f560eca28a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -223,16 +223,23 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + - run: | + curl -L https://github.com/WebAssembly/binaryen/releases/download/version_109/binaryen-version_109-x86_64-linux.tar.gz -sSf > binaryen-version_109-x86_64-linux.tar.gz + tar -xz -f binaryen-version_109-x86_64-linux.tar.gz + echo "$PWD/binaryen-version_109/bin" >> $GITHUB_PATH - run: | cargo build -p wasm-bindgen-cli ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen - run: mv _package.json package.json && npm install && rm package.json - run: | - for dir in `ls examples | grep -v README | grep -v asm.js | grep -v raytrace | grep -v without-a-bundler | grep -v wasm-in-web-worker | grep -v websockets | grep -v webxr | grep -v deno | grep -v synchronous-instantiation`; do + for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno`; do (cd examples/$dir && - ln -fs ../../node_modules . && - npm run build -- --output-path ../../exbuild/$dir) || exit 1; + (npm run build -- --output-path ../../exbuild/$dir || + (./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir)) + ) || exit 1; done + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis - uses: actions/upload-artifact@v2 with: name: examples1 @@ -246,7 +253,6 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - run: | - sed -i 's/python/#python/' examples/raytrace-parallel/build.sh (cd examples/raytrace-parallel && ./build.sh) mkdir exbuild cp examples/raytrace-parallel/*.{js,html,wasm} exbuild @@ -255,6 +261,26 @@ jobs: name: examples2 path: exbuild + test_examples: + needs: + - build_examples + - build_raytrace + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v3 + with: + name: examples1 + path: exbuild + - uses: actions/download-artifact@v3 + with: + name: examples2 + path: exbuild/raytrace-parallel + - run: rustup update --no-self-update stable && rustup default stable + - run: cargo test -p example-tests + env: + EXBUILD: exbuild + build_benchmarks: runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index 09199d47822..72d96aeeab4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ members = [ "crates/js-sys", "crates/test", "crates/test/sample", + "crates/example-tests", "crates/typescript-tests", "crates/web-sys", "crates/webidl", diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml new file mode 100644 index 00000000000..9c731acecff --- /dev/null +++ b/crates/example-tests/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "example-tests" +version = "0.1.0" +authors = ["The wasm-bindgen Developers"] +edition = "2018" + +[dependencies] +anyhow = "1.0.58" +futures-util = { version = "0.3.21", features = ["sink"] } +hyper = { version = "0.14.20", features = ["server", "tcp", "http1"] } +mozprofile = "0.8.0" +mozrunner = "0.14.0" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +tokio = { version = "1.20.0", features = ["macros", "time"] } +tokio-tungstenite = "0.17.2" +tower = { version = "0.4.13", features = ["make"] } +tower-http = { version = "0.3.4", features = ["fs"] } diff --git a/crates/example-tests/LICENSE-APACHE b/crates/example-tests/LICENSE-APACHE new file mode 120000 index 00000000000..1cd601d0a3a --- /dev/null +++ b/crates/example-tests/LICENSE-APACHE @@ -0,0 +1 @@ +../../LICENSE-APACHE \ No newline at end of file diff --git a/crates/example-tests/LICENSE-MIT b/crates/example-tests/LICENSE-MIT new file mode 120000 index 00000000000..b2cfbdc7b0b --- /dev/null +++ b/crates/example-tests/LICENSE-MIT @@ -0,0 +1 @@ +../../LICENSE-MIT \ No newline at end of file diff --git a/crates/example-tests/README.md b/crates/example-tests/README.md new file mode 100644 index 00000000000..812ead04a48 --- /dev/null +++ b/crates/example-tests/README.md @@ -0,0 +1,6 @@ +# example-tests + +Tests that none of our examples are broken, by opening them in a browser +and checking that no errors get logged to the console. + +This currently only supports Firefox. diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs new file mode 100644 index 00000000000..7635cda642f --- /dev/null +++ b/crates/example-tests/src/lib.rs @@ -0,0 +1,424 @@ +use std::collections::VecDeque; +use std::fmt::{self, Display, Formatter, Write}; +use std::net::TcpListener; +use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; +use std::time::{Duration, Instant}; +use std::{env, str}; + +use anyhow::{bail, Context}; +use futures_util::{future, SinkExt, StreamExt}; +use mozprofile::profile::Profile; +use mozrunner::firefox_default_path; +use mozrunner::runner::{FirefoxProcess, FirefoxRunner, Runner, RunnerProcess}; +use serde::de::DeserializeOwned; +use serde::{Deserialize, Serialize}; +use serde_json::{json, Value}; +use tokio::net::TcpStream; +use tokio::sync::oneshot; +use tokio::time::timeout; +use tokio_tungstenite::tungstenite::{self, Message}; +use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; +use tower::make::Shared; +use tower_http::services::ServeDir; + +/// A command sent from the client to the server. +#[derive(Serialize)] +struct BidiCommand<'a, T> { + id: u64, + method: &'a str, + params: T, +} + +/// A message sent from the server to the client. +#[derive(Deserialize)] +#[serde(untagged)] +enum BidiMessage { + CommandResponse { + id: u64, + #[serde(flatten)] + payload: CommandResult, + }, + Event(Event), +} + +#[derive(Deserialize)] +#[serde(untagged)] +enum CommandResult { + Ok { result: R }, + Err(CommandError), +} + +impl From> for Result { + fn from(res: CommandResult) -> Self { + match res { + CommandResult::Ok { result } => Ok(result), + CommandResult::Err(e) => Err(e), + } + } +} + +/// An error that occured while running a command. +#[derive(Serialize, Deserialize, Debug, Clone)] +struct CommandError { + /// The kind of error that occurred. + error: BidiErrorKind, + /// The message associated with the error. + message: String, + /// The stack trace associated with the error, if any. + stacktrace: Option, +} + +impl Display for CommandError { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "{}: {}", self.error, self.message)?; + if f.alternate() { + // Show the stack trace. + if let Some(stacktrace) = &self.stacktrace { + write!(f, "\n\nStack trace:\n{stacktrace}")?; + } + } + Ok(()) + } +} + +impl std::error::Error for CommandError {} + +/// A kind of error that can occur while running a command. +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)] +enum BidiErrorKind { + #[serde(rename = "unknown command")] + /// An unknown command was issued. + UnknownCommand, + /// An invalid argument was passed for a command. + #[serde(rename = "invalid argument")] + InvalidArgument, + /// Some other kind of error occured. + #[serde(rename = "unknown error")] + UnknownError, +} + +impl Display for BidiErrorKind { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + BidiErrorKind::UnknownCommand => f.pad("unknown command"), + BidiErrorKind::InvalidArgument => f.pad("invalid argument"), + BidiErrorKind::UnknownError => f.pad("unknown error"), + } + } +} + +/// An event sent from the server to the client. +#[derive(Deserialize)] +pub struct Event { + /// The name of the event. + method: String, + /// The payload of the event. + params: Value, +} + +/// A connection to a WebDriver BiDi session. +struct WebDriver { + /// The WebSocket we're connected to the WebDriver implementation with. + ws: WebSocketStream>, + /// The WebDriver process. + process: FirefoxProcess, + /// The ID that will be used for the next command. + next_id: u64, + /// Unyielded events. + events: VecDeque, +} + +impl Drop for WebDriver { + fn drop(&mut self) { + self.process.kill().unwrap(); + } +} + +impl WebDriver { + async fn new() -> anyhow::Result { + // Make the OS assign us a random port by asking for port 0. + let driver_addr = TcpListener::bind("127.0.0.1:0")?.local_addr()?; + + // For the moment, we're only supporting Firefox here. + let mut builder = FirefoxRunner::new( + &firefox_default_path().context("failed to find Firefox installation")?, + Some(Profile::new()?), + ); + builder + .arg("--remote-debugging-port") + .arg(driver_addr.port().to_string()) + .arg("--headless") + .stdout(Stdio::null()) + .stderr(Stdio::null()); + let process = builder + .start() + // `mozprofile` doesn't guarantee that its errors are `Send + Sync`, + // which means that they can't be converted to `anyhow::Error`. + // So, convert them to strings as a workaround. + .map_err(|e| anyhow::Error::msg(e.to_string()))?; + + // Connect to the Firefox instance. + let start = Instant::now(); + let ws = loop { + match tokio_tungstenite::connect_async(format!("ws://{driver_addr}/session")).await { + Ok((ws, _)) => break ws, + Err(e) => { + if start.elapsed() > Duration::from_secs(20) { + return Err(e).context("failed to connect to Firefox (after 20s)"); + } + } + } + }; + + let mut this = WebDriver { + ws, + process, + next_id: 0, + events: VecDeque::new(), + }; + + // Start the session. + let _: Value = this + .issue_cmd( + "session.new", + json!({ "capabilities": { "unhandledPromptBehavior": "dismiss" } }), + ) + .await?; + + Ok(this) + } + + async fn issue_cmd( + &mut self, + method: &str, + params: T, + ) -> anyhow::Result { + let id = self.next_id; + self.next_id += 1; + let json = serde_json::to_string(&BidiCommand { id, method, params }) + .context("failed to serialize message")?; + self.ws.send(Message::Text(json)).await?; + loop { + let msg = self + .ws + .next() + .await + .unwrap_or(Err(tungstenite::Error::AlreadyClosed))?; + + let message: BidiMessage = serde_json::from_str(&msg.into_text()?)?; + match message { + BidiMessage::CommandResponse { + id: response_id, + payload, + } => { + if response_id != id { + bail!("unexpected response to command {response_id} after sending command {id}") + } + return Result::from(payload).map_err(anyhow::Error::from); + } + BidiMessage::Event(event) => self.events.push_back(event), + } + } + } + + async fn next_event(&mut self) -> anyhow::Result { + if let Some(event) = self.events.pop_front() { + Ok(event) + } else { + loop { + let msg = self + .ws + .next() + .await + .unwrap_or(Err(tungstenite::Error::AlreadyClosed))?; + + let message: BidiMessage = serde_json::from_str(&msg.into_text()?)?; + match message { + BidiMessage::CommandResponse { .. } => bail!("unexpected command response"), + BidiMessage::Event(event) => return Ok(event), + } + } + } + } +} + +/// Run a single example with the passed name, using the passed closure to +/// build it if prebuilt examples weren't provided. +pub async fn test_example( + name: &str, + build: impl FnOnce() -> anyhow::Result, +) -> anyhow::Result<()> { + let path = if let Some(value) = env::var_os("EXBUILD") { + Path::new(&value).join(name) + } else { + build()? + }; + + let mut driver = WebDriver::new().await?; + + // Serve the path. + let server = hyper::Server::try_bind(&"127.0.0.1:0".parse().unwrap())? + .serve(Shared::new(ServeDir::new(path))); + + let addr = server.local_addr(); + + let (tx, rx) = oneshot::channel(); + + let (server_result, result) = future::join( + server.with_graceful_shutdown(async move { + let _ = rx.await; + }), + async { + #[derive(Deserialize)] + struct BrowsingContextCreateResult { + context: String, + } + + let BrowsingContextCreateResult { context } = driver + .issue_cmd("browsingContext.create", json!({ "type": "tab" })) + .await?; + + let _: Value = driver + .issue_cmd( + "session.subscribe", + json!({ + "events": ["log.entryAdded"], + "contexts": [&context], + }), + ) + .await?; + + let _: Value = driver + .issue_cmd( + "browsingContext.navigate", + json!({ + "context": &context, + "url": format!("http://{addr}"), + }), + ) + .await?; + + let start = Instant::now(); + // Wait 5 seconds for any errors to occur. + const WAIT_DURATION: Duration = Duration::from_secs(5); + while start.elapsed() < WAIT_DURATION { + match timeout(WAIT_DURATION - start.elapsed(), driver.next_event()).await { + Ok(event) => { + let event = event?; + if event.method == "log.entryAdded" { + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct LogEntry { + level: LogLevel, + // source: Source, + text: Option, + // timestamp: i64, + stack_trace: Option, + // kind: LogEntryKind, + } + + #[derive(Deserialize, Debug, PartialEq, Eq, Clone, Copy)] + #[serde(rename_all = "lowercase")] + enum LogLevel { + Debug, + Info, + Warning, + Error, + } + + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct StackTrace { + call_frames: Vec, + } + + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct StackFrame { + column_number: i64, + function_name: String, + line_number: i64, + url: String, + } + + impl Display for StackFrame { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!( + f, + "{} (at {}:{}:{})", + self.function_name, + self.url, + self.line_number, + self.column_number + ) + } + } + + let entry: LogEntry = serde_json::from_value(event.params) + .context("invalid log entry received")?; + + if entry.level == LogLevel::Error { + if let Some(text) = entry.text { + let mut msg = format!("An error occured: {text}"); + + if let Some(stack_trace) = entry.stack_trace { + write!(msg, "\n\nStack trace:").unwrap(); + for frame in stack_trace.call_frames { + write!(msg, "\n{frame}").unwrap(); + } + } + + bail!("{msg}") + } else { + bail!("An error occured") + } + } + } + } + Err(_) => break, + } + } + + tx.send(()).unwrap(); + + Ok(()) + }, + ) + .await; + + server_result.context("error running file server")?; + + result +} + +pub fn run(command: &mut Command) -> anyhow::Result<()> { + // Format the command to use in errors. + let mut cmdline = command.get_program().to_string_lossy().to_string(); + for arg in command.get_args().map(|arg| arg.to_string_lossy()) { + cmdline += " "; + cmdline += &arg; + } + + let status = command.status()?; + if !status.success() { + bail!("`{cmdline}` failed with {status}"); + } + Ok(()) +} + +/// Returns the path of root `wasm-bindgen` folder. +pub fn manifest_dir() -> &'static Path { + Path::new(env!("CARGO_MANIFEST_DIR")) + .parent() + .unwrap() + .parent() + .unwrap() +} + +/// Returns the path of the example with the passed name. +pub fn example_dir(name: &str) -> PathBuf { + [manifest_dir(), "examples".as_ref(), name.as_ref()] + .iter() + .collect() +} diff --git a/crates/example-tests/tests/shell.rs b/crates/example-tests/tests/shell.rs new file mode 100644 index 00000000000..58bd1daaa8c --- /dev/null +++ b/crates/example-tests/tests/shell.rs @@ -0,0 +1,56 @@ +// Since these run on shell scripts, they won't work outside Unix-based OSes. +#![cfg(unix)] + +use std::process::Command; +use std::str; + +use example_tests::{example_dir, run, test_example}; + +async fn test_shell_example(name: &str) -> anyhow::Result<()> { + test_example(name, || { + let path = example_dir(name); + run(Command::new(path.join("build.sh")).current_dir(&path))?; + Ok(path) + }) + .await +} + +macro_rules! shell_tests { + ($( + $(#[$attr:meta])* + $test:ident = $name:literal, + )*) => { + $( + $(#[$attr])* + #[tokio::test] + async fn $test() -> anyhow::Result<()> { + test_shell_example($name).await + } + )* + }; +} + +shell_tests! { + #[ignore = "This requires module workers, which Firefox doesn't support yet."] + synchronous_instantiation = "synchronous-instantiation", + wasm2js = "wasm2js", + wasm_in_web_worker = "wasm-in-web-worker", + websockets = "websockets", + without_a_bundler = "without-a-bundler", + without_a_bundler_no_modules = "without-a-bundler-no-modules", +} + +#[tokio::test] +async fn raytrace_parallel() -> anyhow::Result<()> { + test_example("raytrace-parallel", || { + let path = example_dir("raytrace-parallel"); + + run(Command::new(path.join("build.sh")) + .current_dir(&path) + // This example requires nightly. + .env("RUSTUP_TOOLCHAIN", "nightly"))?; + + Ok(path) + }) + .await +} diff --git a/crates/example-tests/tests/webpack.rs b/crates/example-tests/tests/webpack.rs new file mode 100644 index 00000000000..d3927c2e6f9 --- /dev/null +++ b/crates/example-tests/tests/webpack.rs @@ -0,0 +1,92 @@ +use std::fs; +use std::io::ErrorKind; +use std::process::Command; +use std::sync::Once; +use std::{io, str}; + +use example_tests::{example_dir, manifest_dir, run, test_example}; + +async fn test_webpack_example(name: &str) -> anyhow::Result<()> { + test_example(name, || { + let manifest_dir = manifest_dir(); + let path = example_dir(name); + + fn allow_already_exists(e: io::Error) -> io::Result<()> { + if e.kind() == ErrorKind::AlreadyExists { + Ok(()) + } else { + Err(e) + } + } + + // All of the examples have the same dependencies, so we can just install + // to the root `node_modules` once, since Node resolves packages from any + // outer directories as well as the one containing the `package.json`. + static INSTALL: Once = Once::new(); + INSTALL.call_once(|| { + fs::copy( + manifest_dir.join("_package.json"), + manifest_dir.join("package.json"), + ) + .map(|_| ()) + .or_else(allow_already_exists) + .unwrap(); + + run(Command::new("npm").arg("install").current_dir(manifest_dir)).unwrap(); + + fs::remove_file(manifest_dir.join("package.json")).unwrap(); + }); + + // Build the example. + run(Command::new("npm") + .arg("run") + .arg("build") + .current_dir(&path))?; + + Ok(path.join("dist")) + }) + .await +} + +macro_rules! webpack_tests { + ($( + $(#[$attr:meta])* + $test:ident = $name:literal, + )*) => { + $( + $(#[$attr])* + #[tokio::test] + async fn $test() -> anyhow::Result<()> { + test_webpack_example($name).await + } + )* + }; +} + +webpack_tests! { + add = "add", + canvas = "canvas", + char = "char", + closures = "closures", + console_log = "console_log", + dom = "dom", + duck_typed_interfaces = "duck-typed-interfaces", + fetch = "fetch", + guide_supported_types_examples = "guide-supported-types-examples", + hello_world = "hello_world", + import_js = "import_js", + julia_set = "julia_set", + paint = "paint", + performance = "performance", + request_animation_frame = "request-animation-frame", + todomvc = "todomvc", + wasm_in_wasm_imports = "wasm-in-wasm-imports", + wasm_in_wasm = "wasm-in-wasm", + weather_report = "weather_report", + webaudio = "webaudio", + #[ignore = "The CI virtual machines don't have GPUs, so this doesn't work there."] + webgl = "webgl", + webrtc_datachannel = "webrtc_datachannel", + #[ignore = "WebXR isn't supported in Firefox yet"] + webxr = "webxr", +} diff --git a/examples/raytrace-parallel/README.md b/examples/raytrace-parallel/README.md index 1c7c029082b..a35b4c4a105 100644 --- a/examples/raytrace-parallel/README.md +++ b/examples/raytrace-parallel/README.md @@ -9,7 +9,7 @@ online][compiled] You can build the example locally with: ``` -$ ./build.sh +$ ./run.sh ``` (or running the commands on Windows manually) diff --git a/examples/raytrace-parallel/build.sh b/examples/raytrace-parallel/build.sh index 82fbb659bbd..f10dcf29dfb 100755 --- a/examples/raytrace-parallel/build.sh +++ b/examples/raytrace-parallel/build.sh @@ -21,5 +21,3 @@ cargo run -p wasm-bindgen-cli -- \ ../../target/wasm32-unknown-unknown/release/raytrace_parallel.wasm \ --out-dir . \ --target no-modules - -python3 server.py diff --git a/examples/raytrace-parallel/run.sh b/examples/raytrace-parallel/run.sh new file mode 100755 index 00000000000..e32cfb456e9 --- /dev/null +++ b/examples/raytrace-parallel/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -ex + +./build.sh + +python3 server.py diff --git a/examples/synchronous-instantiation/build.sh b/examples/synchronous-instantiation/build.sh index cb05aadb1a9..3ad83cc6ead 100755 --- a/examples/synchronous-instantiation/build.sh +++ b/examples/synchronous-instantiation/build.sh @@ -3,4 +3,3 @@ set -ex wasm-pack build --target web -python3 -m http.server diff --git a/examples/wasm-in-web-worker/build.sh b/examples/wasm-in-web-worker/build.sh index 7e7b1d2b938..0e8f2607375 100755 --- a/examples/wasm-in-web-worker/build.sh +++ b/examples/wasm-in-web-worker/build.sh @@ -4,4 +4,4 @@ set -ex # This example requires to *not* create ES modules, therefore we pass the flag # `--target no-modules` -wasm-pack build --out-dir www/pkg --target no-modules +wasm-pack build --target no-modules diff --git a/examples/wasm-in-web-worker/www/index.html b/examples/wasm-in-web-worker/index.html similarity index 100% rename from examples/wasm-in-web-worker/www/index.html rename to examples/wasm-in-web-worker/index.html diff --git a/examples/wasm-in-web-worker/www/index.js b/examples/wasm-in-web-worker/index.js similarity index 100% rename from examples/wasm-in-web-worker/www/index.js rename to examples/wasm-in-web-worker/index.js diff --git a/examples/wasm-in-web-worker/www/style.css b/examples/wasm-in-web-worker/style.css similarity index 100% rename from examples/wasm-in-web-worker/www/style.css rename to examples/wasm-in-web-worker/style.css diff --git a/examples/wasm-in-web-worker/www/worker.js b/examples/wasm-in-web-worker/worker.js similarity index 100% rename from examples/wasm-in-web-worker/www/worker.js rename to examples/wasm-in-web-worker/worker.js diff --git a/examples/wasm2js/build.sh b/examples/wasm2js/build.sh index 076a6286f8b..4c77c30acb4 100755 --- a/examples/wasm2js/build.sh +++ b/examples/wasm2js/build.sh @@ -11,5 +11,3 @@ wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.wasm.js # Update our JS shim to require the JS file instead sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js.js sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js_bg.js - -http diff --git a/examples/websockets/build.sh b/examples/websockets/build.sh new file mode 100755 index 00000000000..3ad83cc6ead --- /dev/null +++ b/examples/websockets/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -ex + +wasm-pack build --target web diff --git a/examples/without-a-bundler-no-modules/build.sh b/examples/without-a-bundler-no-modules/build.sh new file mode 100755 index 00000000000..0e4c2b65256 --- /dev/null +++ b/examples/without-a-bundler-no-modules/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -ex + +wasm-pack build --target no-modules diff --git a/examples/without-a-bundler/build.sh b/examples/without-a-bundler/build.sh index cb05aadb1a9..3ad83cc6ead 100755 --- a/examples/without-a-bundler/build.sh +++ b/examples/without-a-bundler/build.sh @@ -3,4 +3,3 @@ set -ex wasm-pack build --target web -python3 -m http.server From 3da2263038d384e5d3113ea7e9b20d65fec48ee3 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Sat, 6 Aug 2022 15:34:16 +0200 Subject: [PATCH 058/641] Support wrapping unsafe functions (#3023) --- crates/backend/src/codegen.rs | 2 +- crates/macro-support/src/parser.rs | 6 --- crates/macro/ui-tests/invalid-items.rs | 3 -- crates/macro/ui-tests/invalid-items.stderr | 44 +++++++++----------- crates/macro/ui-tests/invalid-methods.rs | 5 --- crates/macro/ui-tests/invalid-methods.stderr | 6 --- 6 files changed, 20 insertions(+), 46 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 29905070945..60953f2a577 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -531,7 +531,7 @@ impl TryToTokens for ast::Export { all(target_arch = "wasm32", not(target_os = "emscripten")), export_name = #export_name, )] - pub extern "C" fn #generated_name(#(#args),*) -> #projection::Abi { + pub unsafe extern "C" fn #generated_name(#(#args),*) -> #projection::Abi { #start_check // Scope all local variables to be destroyed after we call // the function to ensure that `#convert_ret`, if it panics, diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 4f979edeedd..fc29660552d 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -759,9 +759,6 @@ impl ConvertToAst for syn::ItemFn { "can only #[wasm_bindgen] non-const functions" ); } - if self.sig.unsafety.is_some() { - bail_span!(self.sig.unsafety, "can only #[wasm_bindgen] safe functions"); - } let ret = function_from_decl( &self.sig.ident, @@ -1133,9 +1130,6 @@ impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemMethod { "can only #[wasm_bindgen] non-const functions", ); } - if self.sig.unsafety.is_some() { - bail_span!(self.sig.unsafety, "can only bindgen safe functions",); - } let opts = BindgenAttrs::find(&mut self.attrs)?; let comments = extract_doc_comments(&self.attrs); diff --git a/crates/macro/ui-tests/invalid-items.rs b/crates/macro/ui-tests/invalid-items.rs index 562a10ee33a..f1a35633107 100644 --- a/crates/macro/ui-tests/invalid-items.rs +++ b/crates/macro/ui-tests/invalid-items.rs @@ -3,9 +3,6 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] fn foo() {} -#[wasm_bindgen] -pub unsafe fn foo1() {} - #[wasm_bindgen] pub const fn foo2() {} diff --git a/crates/macro/ui-tests/invalid-items.stderr b/crates/macro/ui-tests/invalid-items.stderr index 2df6351b1b4..1800ade29d7 100644 --- a/crates/macro/ui-tests/invalid-items.stderr +++ b/crates/macro/ui-tests/invalid-items.stderr @@ -4,62 +4,56 @@ error: can only #[wasm_bindgen] public functions 4 | fn foo() {} | ^^^^^^^^^^^ -error: can only #[wasm_bindgen] safe functions +error: can only #[wasm_bindgen] non-const functions --> $DIR/invalid-items.rs:7:5 | -7 | pub unsafe fn foo1() {} - | ^^^^^^ - -error: can only #[wasm_bindgen] non-const functions - --> $DIR/invalid-items.rs:10:5 - | -10 | pub const fn foo2() {} - | ^^^^^ +7 | pub const fn foo2() {} + | ^^^^^ error: structs with #[wasm_bindgen] cannot have lifetime or type parameters currently - --> $DIR/invalid-items.rs:13:11 + --> $DIR/invalid-items.rs:10:11 | -13 | struct Foo(T); +10 | struct Foo(T); | ^^^ error: cannot import mutable globals yet - --> $DIR/invalid-items.rs:17:12 + --> $DIR/invalid-items.rs:14:12 | -17 | static mut FOO: u32; +14 | static mut FOO: u32; | ^^^ error: can't #[wasm_bindgen] variadic functions - --> $DIR/invalid-items.rs:19:25 + --> $DIR/invalid-items.rs:16:25 | -19 | pub fn foo3(x: i32, ...); +16 | pub fn foo3(x: i32, ...); | ^^^ error: only foreign mods with the `C` ABI are allowed - --> $DIR/invalid-items.rs:23:8 + --> $DIR/invalid-items.rs:20:8 | -23 | extern "system" { +20 | extern "system" { | ^^^^^^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:27:12 + --> $DIR/invalid-items.rs:24:12 | -27 | pub fn foo4() {} +24 | pub fn foo4() {} | ^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:29:12 + --> $DIR/invalid-items.rs:26:12 | -29 | pub fn foo5<'a>() {} +26 | pub fn foo5<'a>() {} | ^^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:31:12 + --> $DIR/invalid-items.rs:28:12 | -31 | pub fn foo6<'a, T>() {} +28 | pub fn foo6<'a, T>() {} | ^^^^^^^ error: #[wasm_bindgen] can only be applied to a function, struct, enum, impl, or extern block - --> $DIR/invalid-items.rs:34:1 + --> $DIR/invalid-items.rs:31:1 | -34 | trait X {} +31 | trait X {} | ^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-methods.rs b/crates/macro/ui-tests/invalid-methods.rs index 864abdfc314..bd69e6d31cf 100644 --- a/crates/macro/ui-tests/invalid-methods.rs +++ b/crates/macro/ui-tests/invalid-methods.rs @@ -39,9 +39,4 @@ impl A { pub const fn foo() {} } -#[wasm_bindgen] -impl A { - pub unsafe fn foo() {} -} - fn main() {} diff --git a/crates/macro/ui-tests/invalid-methods.stderr b/crates/macro/ui-tests/invalid-methods.stderr index 4268864b275..a785fc1ffc2 100644 --- a/crates/macro/ui-tests/invalid-methods.stderr +++ b/crates/macro/ui-tests/invalid-methods.stderr @@ -52,12 +52,6 @@ error: can only #[wasm_bindgen] non-const functions 39 | pub const fn foo() {} | ^^^^^ -error: can only bindgen safe functions - --> $DIR/invalid-methods.rs:44:9 - | -44 | pub unsafe fn foo() {} - | ^^^^^^ - warning: unused macro definition --> $DIR/invalid-methods.rs:26:1 | From d759c668ad7bf69942463a2ecce20a7720504400 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Tue, 9 Aug 2022 23:58:57 +0200 Subject: [PATCH 059/641] Update docs of raytrace-parallel (#3026) --- examples/raytrace-parallel/README.md | 2 +- guide/src/examples/raytrace.md | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/raytrace-parallel/README.md b/examples/raytrace-parallel/README.md index a35b4c4a105..296e9aa8fbe 100644 --- a/examples/raytrace-parallel/README.md +++ b/examples/raytrace-parallel/README.md @@ -4,7 +4,7 @@ online][compiled] [dox]: https://rustwasm.github.io/docs/wasm-bindgen/examples/raytrace.html -[compiled]: https://rustwasm.github.io/wasm-bindgen/exbuild/raytrace-parallel/ +[compiled]: https://wasm-bindgen.netlify.app/exbuild/raytrace-parallel/ You can build the example locally with: diff --git a/guide/src/examples/raytrace.md b/guide/src/examples/raytrace.md index e731cee8700..2b17a00a73e 100644 --- a/guide/src/examples/raytrace.md +++ b/guide/src/examples/raytrace.md @@ -52,10 +52,11 @@ through `wasm-pack`, for example. ### Running the demo -Currently it's required to use the `--target no-modules` flag with -`wasm-bindgen` to run threaded code. This is because the WebAssembly file +Currently it's required to use the `--target no-modules` or `--target web` flag +with `wasm-bindgen` to run threaded code. This is because the WebAssembly file imports memory instead of exporting it, so we need to hook initialization of the -wasm module at this time to provide the appropriate memory object. +wasm module at this time to provide the appropriate memory object. This demo +uses `--target no-modules`, because Firefox does not support modules in workers. With `--target no-modules` you'll be able to use `importScripts` inside of each web worker to import the shim JS generated by `wasm-bindgen` as well as calling @@ -79,10 +80,10 @@ improvements to be made so if you have an idea please file an issue! synchronization with the main thread. * Setting up a threaded environment is a bit wonky and doesn't feel smooth - today. For example `--target no-modules` is required with `wasm-bindgen` and - very specific shims are required on both the main thread and worker threads. - These are possible to work with but are somewhat brittle since there's no - standard way to spin up web workers as wasm threads. + today. For example `--target bundler` is unsupported and very specific shims + are required on both the main thread and worker threads. These are possible to + work with but are somewhat brittle since there's no standard way to spin up + web workers as wasm threads. * There is no standard notion of a "thread". For example the standard library has no viable route to implement the `std::thread` module. As a consequence From d881d9da64ae7b84b74f55b92f9dc0688367d013 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Sat, 13 Aug 2022 12:12:17 +0200 Subject: [PATCH 060/641] Add example with WASM audio worklet (#3017) --- .github/workflows/main.yml | 18 ++--- Cargo.toml | 1 + examples/wasm-audio-worklet/Cargo.toml | 30 ++++++++ examples/wasm-audio-worklet/README.md | 17 +++++ examples/wasm-audio-worklet/build.sh | 21 ++++++ examples/wasm-audio-worklet/index.html | 16 +++++ examples/wasm-audio-worklet/run.sh | 7 ++ examples/wasm-audio-worklet/server.py | 12 ++++ .../src/dependent_module.rs | 45 ++++++++++++ examples/wasm-audio-worklet/src/gui.rs | 39 +++++++++++ examples/wasm-audio-worklet/src/lib.rs | 20 ++++++ examples/wasm-audio-worklet/src/oscillator.rs | 54 +++++++++++++++ examples/wasm-audio-worklet/src/polyfill.js | 26 +++++++ examples/wasm-audio-worklet/src/wasm_audio.rs | 68 +++++++++++++++++++ examples/wasm-audio-worklet/src/worklet.js | 11 +++ guide/src/examples/raytrace.md | 8 ++- guide/src/examples/wasm-audio-worklet.md | 45 ++++++++++++ 17 files changed, 427 insertions(+), 11 deletions(-) create mode 100644 examples/wasm-audio-worklet/Cargo.toml create mode 100644 examples/wasm-audio-worklet/README.md create mode 100755 examples/wasm-audio-worklet/build.sh create mode 100644 examples/wasm-audio-worklet/index.html create mode 100755 examples/wasm-audio-worklet/run.sh create mode 100644 examples/wasm-audio-worklet/server.py create mode 100644 examples/wasm-audio-worklet/src/dependent_module.rs create mode 100644 examples/wasm-audio-worklet/src/gui.rs create mode 100644 examples/wasm-audio-worklet/src/lib.rs create mode 100644 examples/wasm-audio-worklet/src/oscillator.rs create mode 100644 examples/wasm-audio-worklet/src/polyfill.js create mode 100644 examples/wasm-audio-worklet/src/wasm_audio.rs create mode 100644 examples/wasm-audio-worklet/src/worklet.js create mode 100644 guide/src/examples/wasm-audio-worklet.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f560eca28a1..9d1d28cd8c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -232,7 +232,7 @@ jobs: ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen - run: mv _package.json package.json && npm install && rm package.json - run: | - for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno`; do + for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet`; do (cd examples/$dir && (npm run build -- --output-path ../../exbuild/$dir || (./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir)) @@ -245,7 +245,7 @@ jobs: name: examples1 path: exbuild - build_raytrace: + build_nightly: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -253,9 +253,11 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - run: | - (cd examples/raytrace-parallel && ./build.sh) - mkdir exbuild - cp examples/raytrace-parallel/*.{js,html,wasm} exbuild + for dir in raytrace-parallel wasm-audio-worklet; do + (cd examples/$dir && + ./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir + ) || exit 1; + done - uses: actions/upload-artifact@v2 with: name: examples2 @@ -264,7 +266,7 @@ jobs: test_examples: needs: - build_examples - - build_raytrace + - build_nightly runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -275,7 +277,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: examples2 - path: exbuild/raytrace-parallel + path: exbuild - run: rustup update --no-self-update stable && rustup default stable - run: cargo test -p example-tests env: @@ -376,7 +378,7 @@ jobs: - dist_macos - dist_windows - build_examples - - build_raytrace + - build_nightly - build_benchmarks runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index 72d96aeeab4..5101fa4b409 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,6 +78,7 @@ members = [ "examples/raytrace-parallel", "examples/request-animation-frame", "examples/todomvc", + "examples/wasm-audio-worklet", "examples/wasm-in-wasm", "examples/wasm-in-wasm-imports", "examples/wasm-in-web-worker", diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml new file mode 100644 index 00000000000..cc187f6ec36 --- /dev/null +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "wasm-audio-worklet" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +console_log = "0.2.0" +js-sys = "0.3.59" +wasm-bindgen = "0.2.82" +wasm-bindgen-futures = "0.4.32" + +[dependencies.web-sys] +version = "0.3.59" +features = [ + "AudioContext", + "AudioDestinationNode", + "AudioWorklet", + "AudioWorkletNode", + "AudioWorkletNodeOptions", + "Blob", + "BlobPropertyBag", + "Document", + "HtmlInputElement", + "HtmlLabelElement", + "Url", + "Window", +] diff --git a/examples/wasm-audio-worklet/README.md b/examples/wasm-audio-worklet/README.md new file mode 100644 index 00000000000..157e0c41ab4 --- /dev/null +++ b/examples/wasm-audio-worklet/README.md @@ -0,0 +1,17 @@ +# wasm-audio-worklet + +[View documentation for this example online][dox] or [View compiled example +online][compiled] + +[dox]: https://rustwasm.github.io/docs/wasm-bindgen/examples/wasm-audio-worklet.html +[compiled]: https://wasm-bindgen.netlify.app/exbuild/wasm-audio-worklet/ + +You can build the example locally with: + +``` +$ ./run.sh +``` + +(or running the commands on Windows manually) + +and then visiting http://localhost:8080 in a browser should run the example! diff --git a/examples/wasm-audio-worklet/build.sh b/examples/wasm-audio-worklet/build.sh new file mode 100755 index 00000000000..90b8fc9cb14 --- /dev/null +++ b/examples/wasm-audio-worklet/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -ex + +# A couple of steps are necessary to get this build working which makes it slightly +# nonstandard compared to most other builds. +# +# * First, the Rust standard library needs to be recompiled with atomics +# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. +# +# * Next we need to compile everything with the `atomics` and `bulk-memory` +# features enabled, ensuring that LLVM will generate atomic instructions, +# shared memory, passive segments, etc. + +RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ + cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort + +cargo run -p wasm-bindgen-cli -- \ + ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \ + --out-dir . \ + --target web diff --git a/examples/wasm-audio-worklet/index.html b/examples/wasm-audio-worklet/index.html new file mode 100644 index 00000000000..b2d8681ab56 --- /dev/null +++ b/examples/wasm-audio-worklet/index.html @@ -0,0 +1,16 @@ + + + + WASM audio worklet + + + + + diff --git a/examples/wasm-audio-worklet/run.sh b/examples/wasm-audio-worklet/run.sh new file mode 100755 index 00000000000..e32cfb456e9 --- /dev/null +++ b/examples/wasm-audio-worklet/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -ex + +./build.sh + +python3 server.py diff --git a/examples/wasm-audio-worklet/server.py b/examples/wasm-audio-worklet/server.py new file mode 100644 index 00000000000..8886642ae30 --- /dev/null +++ b/examples/wasm-audio-worklet/server.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +from http.server import HTTPServer, SimpleHTTPRequestHandler, test +import sys + +class RequestHandler(SimpleHTTPRequestHandler): + def end_headers(self): + self.send_header('Cross-Origin-Opener-Policy', 'same-origin') + self.send_header('Cross-Origin-Embedder-Policy', 'require-corp') + SimpleHTTPRequestHandler.end_headers(self) + +if __name__ == '__main__': + test(RequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000) diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs new file mode 100644 index 00000000000..d4180e3985e --- /dev/null +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -0,0 +1,45 @@ +use js_sys::{Array, JsString}; +use wasm_bindgen::prelude::*; +use web_sys::{Blob, BlobPropertyBag, Url}; + +// This is a not-so-clean approach to get the current bindgen ES module URL +// in Rust. This will fail at run time on bindgen targets not using ES modules. +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + type ImportMeta; + + #[wasm_bindgen(method, getter)] + fn url(this: &ImportMeta) -> JsString; + + #[wasm_bindgen(js_namespace = import, js_name = meta)] + static IMPORT_META: ImportMeta; +} + +pub fn on_the_fly(code: &str) -> Result { + // Generate the import of the bindgen ES module, assuming `--target web`: + let header = format!( + "import init, * as bindgen from '{}';\n\n", + IMPORT_META.url(), + ); + + Url::create_object_url_with_blob(&Blob::new_with_str_sequence_and_options( + &Array::of2(&JsValue::from(header.as_str()), &JsValue::from(code)), + &BlobPropertyBag::new().type_("text/javascript"), + )?) +} + +// dependent_module! takes a local file name to a JS module as input and +// returns a URL to a slightly modified module in run time. This modified module +// has an additional import statement in the header that imports the current +// bindgen JS module under the `bindgen` alias, and the separate init function. +// How this URL is produced does not matter for the macro user. on_the_fly +// creates a blob URL in run time. A better, more sophisticated solution +// would add wasm_bindgen support to put such a module in pkg/ during build time +// and return a URL to this file instead (described in #3019). +#[macro_export] +macro_rules! dependent_module { + ($file_name:expr) => { + crate::dependent_module::on_the_fly(include_str!($file_name)) + }; +} diff --git a/examples/wasm-audio-worklet/src/gui.rs b/examples/wasm-audio-worklet/src/gui.rs new file mode 100644 index 00000000000..fa96103b440 --- /dev/null +++ b/examples/wasm-audio-worklet/src/gui.rs @@ -0,0 +1,39 @@ +use crate::oscillator::Params; +use wasm_bindgen::{closure::Closure, JsCast, JsValue}; +use web_sys::{AudioContext, HtmlInputElement, HtmlLabelElement}; + +pub fn create_gui(params: &'static Params, ctx: AudioContext) { + let window = web_sys::window().unwrap(); + let document = window.document().unwrap(); + let body = document.body().unwrap(); + + let volume = add_slider(&document, &body, "Volume:").unwrap(); + let frequency = add_slider(&document, &body, "Frequency:").unwrap(); + volume.set_value("0"); + frequency.set_min("20"); + frequency.set_value("60"); + + let listener = Closure::::new(move |_: web_sys::Event| { + params.set_frequency(frequency.value().parse().unwrap()); + params.set_volume(volume.value().parse().unwrap()); + ctx.resume().unwrap(); + }) + .into_js_value(); + + body.add_event_listener_with_callback("input", listener.as_ref().unchecked_ref()) + .unwrap(); +} + +fn add_slider( + document: &web_sys::Document, + body: &web_sys::HtmlElement, + name: &str, +) -> Result { + let input: HtmlInputElement = document.create_element("input")?.unchecked_into(); + let label: HtmlLabelElement = document.create_element("label")?.unchecked_into(); + input.set_type("range"); + label.set_text_content(Some(name)); + label.append_child(&input)?; + body.append_child(&label)?; + Ok(input) +} diff --git a/examples/wasm-audio-worklet/src/lib.rs b/examples/wasm-audio-worklet/src/lib.rs new file mode 100644 index 00000000000..d5a1ded9bde --- /dev/null +++ b/examples/wasm-audio-worklet/src/lib.rs @@ -0,0 +1,20 @@ +mod dependent_module; +mod gui; +mod oscillator; +mod wasm_audio; + +use gui::create_gui; +use oscillator::{Oscillator, Params}; +use wasm_audio::wasm_audio; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub async fn web_main() { + // On the application level, audio worklet internals are abstracted by wasm_audio: + let params: &'static Params = Box::leak(Box::new(Params::default())); + let mut osc = Oscillator::new(¶ms); + let ctx = wasm_audio(Box::new(move |buf| osc.process(buf))) + .await + .unwrap(); + create_gui(params, ctx); +} diff --git a/examples/wasm-audio-worklet/src/oscillator.rs b/examples/wasm-audio-worklet/src/oscillator.rs new file mode 100644 index 00000000000..a6247703aa7 --- /dev/null +++ b/examples/wasm-audio-worklet/src/oscillator.rs @@ -0,0 +1,54 @@ +// WASM audio processors can be implemented in Rust without knowing +// about audio worklets. + +use std::sync::atomic::{AtomicU8, Ordering}; + +// Let's implement a simple sine oscillator with variable frequency and volume. +pub struct Oscillator { + params: &'static Params, + accumulator: u32, +} + +impl Oscillator { + pub fn new(params: &'static Params) -> Self { + Self { + params, + accumulator: 0, + } + } +} + +impl Oscillator { + pub fn process(&mut self, output: &mut [f32]) -> bool { + // This method is called in the audio process thread. + // All imports are set, so host functionality available in worklets + // (for example, logging) can be used: + // `web_sys::console::log_1(&JsValue::from(output.len()));` + // Note that currently TextEncoder and TextDecoder are stubs, so passing + // strings may not work in this thread. + for a in output { + let frequency = self.params.frequency.load(Ordering::Relaxed); + let volume = self.params.volume.load(Ordering::Relaxed); + self.accumulator += u32::from(frequency); + *a = (self.accumulator as f32 / 512.).sin() * (volume as f32 / 100.); + } + true + } +} + +#[derive(Default)] +pub struct Params { + // Use atomics for parameters so they can be set in the main thread and + // fetched by the audio process thread without further synchronization. + frequency: AtomicU8, + volume: AtomicU8, +} + +impl Params { + pub fn set_frequency(&self, frequency: u8) { + self.frequency.store(frequency, Ordering::Relaxed); + } + pub fn set_volume(&self, volume: u8) { + self.volume.store(volume, Ordering::Relaxed); + } +} diff --git a/examples/wasm-audio-worklet/src/polyfill.js b/examples/wasm-audio-worklet/src/polyfill.js new file mode 100644 index 00000000000..146a0e2c578 --- /dev/null +++ b/examples/wasm-audio-worklet/src/polyfill.js @@ -0,0 +1,26 @@ +if (!globalThis.TextDecoder) { + globalThis.TextDecoder = class TextDecoder { + decode(arg) { + if (typeof arg !== 'undefined') { + throw Error('TextDecoder stub called'); + } else { + return ''; + } + } + }; +} + +if (!globalThis.TextEncoder) { + globalThis.TextEncoder = class TextEncoder { + encode(arg) { + if (typeof arg !== 'undefined') { + throw Error('TextEncoder stub called'); + } else { + return new Uint8Array(0); + } + } + }; +} + +export function nop() { +} diff --git a/examples/wasm-audio-worklet/src/wasm_audio.rs b/examples/wasm-audio-worklet/src/wasm_audio.rs new file mode 100644 index 00000000000..fa149dd0471 --- /dev/null +++ b/examples/wasm-audio-worklet/src/wasm_audio.rs @@ -0,0 +1,68 @@ +use crate::dependent_module; +use wasm_bindgen::prelude::*; +use wasm_bindgen::JsValue; +use wasm_bindgen_futures::JsFuture; +use web_sys::{AudioContext, AudioWorkletNode, AudioWorkletNodeOptions}; + +#[wasm_bindgen] +pub struct WasmAudioProcessor(Box bool>); + +#[wasm_bindgen] +impl WasmAudioProcessor { + pub fn process(&mut self, buf: &mut [f32]) -> bool { + self.0(buf) + } + pub fn pack(self) -> usize { + Box::into_raw(Box::new(self)) as usize + } + pub unsafe fn unpack(val: usize) -> Self { + *Box::from_raw(val as *mut _) + } +} + +// Use wasm_audio if you have a single wasm audio processor in your application +// whose samples should be played directly. Ideally, call wasm_audio based on +// user interaction. Otherwise, resume the context on user interaction, so +// playback starts reliably on all browsers. +pub async fn wasm_audio( + process: Box bool>, +) -> Result { + let ctx = AudioContext::new()?; + prepare_wasm_audio(&ctx).await?; + let node = wasm_audio_node(&ctx, process)?; + node.connect_with_audio_node(&ctx.destination())?; + Ok(ctx) +} + +// wasm_audio_node creates an AudioWorkletNode running a wasm audio processor. +// Remember to call prepare_wasm_audio once on your context before calling +// this function. +pub fn wasm_audio_node( + ctx: &AudioContext, + process: Box bool>, +) -> Result { + AudioWorkletNode::new_with_options( + &ctx, + "WasmProcessor", + &AudioWorkletNodeOptions::new().processor_options(Some(&js_sys::Array::of3( + &wasm_bindgen::module(), + &wasm_bindgen::memory(), + &WasmAudioProcessor(process).pack().into(), + ))), + ) +} + +pub async fn prepare_wasm_audio(ctx: &AudioContext) -> Result<(), JsValue> { + nop(); + let mod_url = dependent_module!("worklet.js")?; + JsFuture::from(ctx.audio_worklet()?.add_module(&mod_url)?).await?; + Ok(()) +} + +// TextEncoder and TextDecoder are not available in Audio Worklets, but there +// is a dirty workaround: Import polyfill.js to install stub implementations +// of these classes in globalThis. +#[wasm_bindgen(module = "/src/polyfill.js")] +extern "C" { + fn nop(); +} diff --git a/examples/wasm-audio-worklet/src/worklet.js b/examples/wasm-audio-worklet/src/worklet.js new file mode 100644 index 00000000000..4223d72ca30 --- /dev/null +++ b/examples/wasm-audio-worklet/src/worklet.js @@ -0,0 +1,11 @@ +registerProcessor("WasmProcessor", class WasmProcessor extends AudioWorkletProcessor { + constructor(options) { + super(); + let [module, memory, handle] = options.processorOptions; + bindgen.initSync(module, memory); + this.processor = bindgen.WasmAudioProcessor.unpack(handle); + } + process(inputs, outputs) { + return this.processor.process(outputs[0][0]); + } +}); diff --git a/guide/src/examples/raytrace.md b/guide/src/examples/raytrace.md index 2b17a00a73e..522a2f70b96 100644 --- a/guide/src/examples/raytrace.md +++ b/guide/src/examples/raytrace.md @@ -16,12 +16,14 @@ and wasm with Rust on the web. One of the major gotchas with threaded WebAssembly is that Rust does not ship a precompiled target (e.g. standard library) which has threading support enabled. This means that you'll need to recompile the standard library with the -appropriate rustc flags, namely `-C target-feature=+atomics,+bulk-memory`. +appropriate rustc flags, namely +`-C target-feature=+atomics,+bulk-memory,+mutable-globals`. +Note that this requires a nightly Rust toolchain. To do this you can use the `RUSTFLAGS` environment variable that Cargo reads: ```sh -export RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' +export RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' ``` To recompile the standard library it's recommended to use Cargo's @@ -40,7 +42,7 @@ build-std = ['std', 'panic_abort'] [build] target = "wasm32-unknown-unknown" -rustflags = '-Ctarget-feature=+atomics,+bulk-memory' +rustflags = '-Ctarget-feature=+atomics,+bulk-memory,+mutable-globals' ``` After this `cargo build` should produce a WebAssembly file with threading diff --git a/guide/src/examples/wasm-audio-worklet.md b/guide/src/examples/wasm-audio-worklet.md new file mode 100644 index 00000000000..b7c9429f05b --- /dev/null +++ b/guide/src/examples/wasm-audio-worklet.md @@ -0,0 +1,45 @@ +# WASM audio worklet + +[View full source code][code] or [view the compiled example online][online] + +[online]: https://wasm-bindgen.netlify.app/exbuild/wasm-audio-worklet/ +[code]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/wasm-audio-worklet + +This is an example of using threads inside specific worklets with WebAssembly, +Rust, and `wasm-bindgen`, culminating in an oscillator demo. This demo should +complement the [parallel-raytrace][parallel-raytrace] example by +demonstrating an alternative approach using ES modules with on-the-fly module +creation. + +[parallel-raytrace]: https://rustwasm.github.io/docs/wasm-bindgen/examples/raytrace.html + +### Building the demo + +One of the major gotchas with threaded WebAssembly is that Rust does not ship a +precompiled target (e.g. standard library) which has threading support enabled. +This means that you'll need to recompile the standard library with the +appropriate rustc flags, namely +`-C target-feature=+atomics,+bulk-memory,+mutable-globals`. +Note that this requires a nightly Rust toolchain. See the [more detailed +instructions][build] of the parallel-raytrace example. + +[build]: https://rustwasm.github.io/docs/wasm-bindgen/examples/raytrace.html#building-the-demo + +### Caveats + +This example shares most of its [caveats][caveats] with the parallel-raytrace +example. However, it tries to encapsulate worklet creation in a Rust module, so +the application developer does not need to maintain custom JS code. + +[caveats]: https://rustwasm.github.io/docs/wasm-bindgen/examples/raytrace.html#caveats + +### Browser Requirements + +This demo should work in the latest Chrome and Safari versions at this time. +Firefox [does not support][firefox-worklet-import] imports in worklet modules, +which are difficult to avoid in this example, as `importScripts` is unavailable +in worklets. Note that this example requires HTTP headers to be set like in +[parallel-raytrace][headers]. + +[firefox-worklet-import]: https://bugzilla.mozilla.org/show_bug.cgi?id=1572644 +[headers]: https://rustwasm.github.io/docs/wasm-bindgen/examples/raytrace.html#browser-requirements From 5c3f6ed46a194f764b28c5c38fb30d5ae834e544 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Sun, 14 Aug 2022 01:17:45 +0200 Subject: [PATCH 061/641] Fix links to WASM audio worklet example (#3030) --- .github/workflows/main.yml | 2 +- guide/src/SUMMARY.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d1d28cd8c0..59d52e8d842 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -421,7 +421,7 @@ jobs: tar xf artifacts/doc_api/docs.tar.gz mv target/doc gh-pages/api mv artifacts/examples1 gh-pages/exbuild - mv artifacts/examples2 gh-pages/exbuild/raytrace-parallel + mv artifacts/examples2/* gh-pages/exbuild mv artifacts/benchmarks gh-pages/benchmarks tar czf gh-pages.tar.gz gh-pages - uses: actions/upload-artifact@v2 diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 70ee67a7fcf..907086c51f5 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -27,6 +27,7 @@ - [web-sys: A Simple Paint Program](./examples/paint.md) - [web-sys: WASM in Web Worker](./examples/wasm-in-web-worker.md) - [Parallel Raytracing](./examples/raytrace.md) + - [WASM Audio Worklet](./examples/wasm-audio-worklet.md) - [web-sys: A TODO MVC App](./examples/todomvc.md) - [Reference](./reference/index.md) - [Deployment](./reference/deployment.md) From 1e0d6c7c5dd9e39bb31f0ddc2300e2fe9cbda7b7 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Tue, 16 Aug 2022 18:44:54 +0200 Subject: [PATCH 062/641] Refactor: Use `u32::from_le_bytes` and `u32::to_le_bytes` (#3033) --- crates/backend/src/codegen.rs | 14 +++++++------- crates/backend/src/encode.rs | 7 ++----- crates/cli-support/src/wit/mod.rs | 5 +---- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 60953f2a577..f8c8405c0f3 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -98,13 +98,13 @@ impl TryToTokens for ast::Program { shared::version() ); let encoded = encode::encode(self)?; - let mut bytes = Vec::new(); - bytes.push((prefix_json.len() >> 0) as u8); - bytes.push((prefix_json.len() >> 8) as u8); - bytes.push((prefix_json.len() >> 16) as u8); - bytes.push((prefix_json.len() >> 24) as u8); - bytes.extend_from_slice(prefix_json.as_bytes()); - bytes.extend_from_slice(&encoded.custom_section); + let len = prefix_json.len() as u32; + let bytes = [ + &len.to_le_bytes()[..], + prefix_json.as_bytes(), + &encoded.custom_section, + ] + .concat(); let generated_static_length = bytes.len(); let generated_static_value = syn::LitByteStr::new(&bytes, Span::call_site()); diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 49973a686a1..f16a282613b 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -345,11 +345,8 @@ impl Encoder { } fn finish(mut self) -> Vec { - let len = self.dst.len() - 4; - self.dst[0] = (len >> 0) as u8; - self.dst[1] = (len >> 8) as u8; - self.dst[2] = (len >> 16) as u8; - self.dst[3] = (len >> 24) as u8; + let len = (self.dst.len() - 4) as u32; + self.dst[..4].copy_from_slice(&len.to_le_bytes()[..]); self.dst } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index f4e2749ca6e..c8da887542f 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -1575,10 +1575,7 @@ fn get_remaining<'a>(data: &mut &'a [u8]) -> Option<&'a [u8]> { if data.len() == 0 { return None; } - let len = ((data[0] as usize) << 0) - | ((data[1] as usize) << 8) - | ((data[2] as usize) << 16) - | ((data[3] as usize) << 24); + let len = u32::from_le_bytes([data[0], data[1], data[2], data[3]]) as usize; let (a, b) = data[4..].split_at(len); *data = b; Some(a) From f197b0e104e904c9a10c1a5e22bea559f9e809e2 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Wed, 17 Aug 2022 16:20:59 +0200 Subject: [PATCH 063/641] Refactor: unexposed __WASM_BINDGEN_GENERATED statics (#3035) --- crates/backend/src/codegen.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index f8c8405c0f3..3115015d24d 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -6,7 +6,6 @@ use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; use quote::{quote, ToTokens}; use std::collections::{HashMap, HashSet}; -use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Mutex; use wasm_bindgen_shared as shared; @@ -82,14 +81,6 @@ impl TryToTokens for ast::Program { // of the wasm executable. For now it's just a plain old static, but we'll // eventually have it actually in its own section. - static CNT: AtomicUsize = AtomicUsize::new(0); - - let generated_static_name = format!( - "__WASM_BINDGEN_GENERATED_{}", - ShortHash(CNT.fetch_add(1, Ordering::SeqCst)), - ); - let generated_static_name = Ident::new(&generated_static_name, Span::call_site()); - // See comments in `crates/cli-support/src/lib.rs` about what this // `schema_version` is. let prefix_json = format!( @@ -125,14 +116,13 @@ impl TryToTokens for ast::Program { (quote! { #[cfg(target_arch = "wasm32")] #[automatically_derived] - #[link_section = "__wasm_bindgen_unstable"] - #[doc(hidden)] - pub static #generated_static_name: [u8; #generated_static_length] = { + const _: () = { static _INCLUDED_FILES: &[&str] = &[#(#file_dependencies),*]; - *#generated_static_value + #[link_section = "__wasm_bindgen_unstable"] + pub static _GENERATED: [u8; #generated_static_length] = + *#generated_static_value; }; - }) .to_tokens(tokens); From bf109de9b2a46de0d8e7ffea198823e5a6744a1b Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 19 Aug 2022 03:23:39 +1000 Subject: [PATCH 064/641] Pass 64-bit integers directly across the wasm ABI boundary (#3037) Previously, they were passed as a pair of `i32`s; this changes them to be passed as a single `i64`, which is directly converted to a bigint on the JS end. I think they were previously passed as a pair because `wasm-bindgen`'s support for 64-bit integers predated the WebAssembly bigint integration that translates `i64`s to bigints. However, that feature has been around for quite a while now, so I think it should be fine to use. I also bumped the schema version - although the schema itself hasn't changed, the ABI has, so using an older version of the CLI with this version of the `wasm-bindgen` crate or vice versa won't work and I want the version-mismatch warning to show up. Fixes cloudflare/serde-wasm-bindgen#28. This doesn't rely on a global `BigInt64Array` like the previous `i32`-pair version, which means that code using 64-bit integers will no longer fail at load time in browsers without bigint support. --- crates/cli-support/src/js/binding.rs | 158 ++++++++-------------- crates/cli-support/src/js/mod.rs | 48 ++----- crates/cli-support/src/wit/incoming.rs | 28 +--- crates/cli-support/src/wit/mod.rs | 2 +- crates/cli-support/src/wit/outgoing.rs | 40 ++---- crates/cli-support/src/wit/section.rs | 9 +- crates/cli-support/src/wit/standard.rs | 17 --- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- src/convert/impls.rs | 89 ++---------- src/convert/traits.rs | 2 + 11 files changed, 105 insertions(+), 292 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index c29f2da5433..008e529f213 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -8,7 +8,7 @@ use crate::js::Context; use crate::wit::InstructionData; use crate::wit::{Adapter, AdapterId, AdapterKind, AdapterType, Instruction}; use anyhow::{anyhow, bail, Error}; -use walrus::Module; +use walrus::{Module, ValType}; /// A one-size-fits-all builder for processing WebIDL bindings and generating /// JS. @@ -437,6 +437,14 @@ impl<'a, 'b> JsBuilder<'a, 'b> { self.prelude(&format!("_assertNum({});", arg)); } + fn assert_bigint(&mut self, arg: &str) { + if !self.cx.config.debug { + return; + } + self.cx.expose_assert_bigint(); + self.prelude(&format!("_assertBigInt({});", arg)); + } + fn assert_bool(&mut self, arg: &str) { if !self.cx.config.debug { return; @@ -455,6 +463,16 @@ impl<'a, 'b> JsBuilder<'a, 'b> { self.prelude("}"); } + fn assert_optional_bigint(&mut self, arg: &str) { + if !self.cx.config.debug { + return; + } + self.cx.expose_is_like_none(); + self.prelude(&format!("if (!isLikeNone({})) {{", arg)); + self.assert_bigint(arg); + self.prelude("}"); + } + fn assert_optional_bool(&mut self, arg: &str) { if !self.cx.config.debug { return; @@ -560,9 +578,18 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> } } - Instruction::Standard(wit_walrus::Instruction::IntToWasm { trap: false, .. }) => { + Instruction::Standard(wit_walrus::Instruction::IntToWasm { + trap: false, input, .. + }) => { let val = js.pop(); - js.assert_number(&val); + if matches!( + input, + wit_walrus::ValType::I64 | wit_walrus::ValType::S64 | wit_walrus::ValType::U64 + ) { + js.assert_bigint(&val); + } else { + js.assert_number(&val); + } js.push(val); } @@ -577,6 +604,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> let val = js.pop(); match output { wit_walrus::ValType::U32 => js.push(format!("{} >>> 0", val)), + wit_walrus::ValType::U64 => js.push(format!("BigInt.asUintN(64, {val})")), _ => js.push(val), } } @@ -618,6 +646,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> Instruction::StoreRetptr { ty, offset, mem } => { let (mem, size) = match ty { AdapterType::I32 => (js.cx.expose_int32_memory(*mem), 4), + AdapterType::I64 => (js.cx.expose_int64_memory(*mem), 8), AdapterType::F32 => (js.cx.expose_f32_memory(*mem), 4), AdapterType::F64 => (js.cx.expose_f64_memory(*mem), 8), other => bail!("invalid aggregate return type {:?}", other), @@ -639,6 +668,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> Instruction::LoadRetptr { ty, offset, mem } => { let (mem, quads) = match ty { AdapterType::I32 => (js.cx.expose_int32_memory(*mem), 1), + AdapterType::I64 => (js.cx.expose_int64_memory(*mem), 2), AdapterType::F32 => (js.cx.expose_f32_memory(*mem), 1), AdapterType::F64 => (js.cx.expose_f64_memory(*mem), 2), other => bail!("invalid aggregate return type {:?}", other), @@ -712,52 +742,6 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("ptr{}", i)); } - Instruction::I32Split64 { signed } => { - let val = js.pop(); - let f = if *signed { - js.cx.expose_int64_cvt_shim() - } else { - js.cx.expose_uint64_cvt_shim() - }; - let i = js.tmp(); - js.prelude(&format!( - " - {f}[0] = {val}; - const low{i} = u32CvtShim[0]; - const high{i} = u32CvtShim[1]; - ", - i = i, - f = f, - val = val, - )); - js.push(format!("low{}", i)); - js.push(format!("high{}", i)); - } - - Instruction::I32SplitOption64 { signed } => { - let val = js.pop(); - js.cx.expose_is_like_none(); - let f = if *signed { - js.cx.expose_int64_cvt_shim() - } else { - js.cx.expose_uint64_cvt_shim() - }; - let i = js.tmp(); - js.prelude(&format!( - "\ - {f}[0] = isLikeNone({val}) ? BigInt(0) : {val}; - const low{i} = u32CvtShim[0]; - const high{i} = u32CvtShim[1]; - ", - i = i, - f = f, - val = val, - )); - js.push(format!("!isLikeNone({0})", val)); - js.push(format!("low{}", i)); - js.push(format!("high{}", i)); - } - Instruction::I32FromOptionExternref { table_and_alloc } => { let val = js.pop(); js.cx.expose_is_like_none(); @@ -803,12 +787,19 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("isLikeNone({0}) ? {1} : {0}", val, hole)); } - Instruction::FromOptionNative { .. } => { + Instruction::FromOptionNative { ty } => { let val = js.pop(); js.cx.expose_is_like_none(); - js.assert_optional_number(&val); + if *ty == ValType::I64 { + js.assert_optional_bigint(&val); + } else { + js.assert_optional_number(&val); + } js.push(format!("!isLikeNone({0})", val)); - js.push(format!("isLikeNone({0}) ? 0 : {0}", val)); + js.push(format!( + "isLikeNone({val}) ? 0{n} : {val}", + n = if *ty == ValType::I64 { "n" } else { "" } + )); } Instruction::VectorToMemory { kind, malloc, mem } => { @@ -1001,29 +992,6 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("String.fromCodePoint({})", val)); } - Instruction::I64FromLoHi { signed } => { - let f = if *signed { - js.cx.expose_int64_cvt_shim() - } else { - js.cx.expose_uint64_cvt_shim() - }; - let i = js.tmp(); - let high = js.pop(); - let low = js.pop(); - js.prelude(&format!( - "\ - u32CvtShim[0] = {low}; - u32CvtShim[1] = {high}; - const n{i} = {f}[0]; - ", - low = low, - high = high, - f = f, - i = i, - )); - js.push(format!("n{}", i)) - } - Instruction::RustFromI32 { class } => { js.cx.require_class_wrap(class); let val = js.pop(); @@ -1183,14 +1151,21 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("{0} === 0xFFFFFF ? undefined : {0}", val)); } - Instruction::ToOptionNative { ty: _, signed } => { + Instruction::ToOptionNative { ty, signed } => { let val = js.pop(); let present = js.pop(); js.push(format!( - "{} === 0 ? undefined : {}{}", + "{} === 0 ? undefined : {}", present, - val, - if *signed { "" } else { " >>> 0" }, + if *signed { + val + } else { + match ty { + ValType::I32 => format!("{val} >>> 0"), + ValType::I64 => format!("BigInt.asUintN(64, {val})"), + _ => unreachable!("unsigned non-integer"), + } + }, )); } @@ -1211,31 +1186,6 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> let val = js.pop(); js.push(format!("{0} === {1} ? undefined : {0}", val, hole)); } - - Instruction::Option64FromI32 { signed } => { - let f = if *signed { - js.cx.expose_int64_cvt_shim() - } else { - js.cx.expose_uint64_cvt_shim() - }; - let i = js.tmp(); - let high = js.pop(); - let low = js.pop(); - let present = js.pop(); - js.prelude(&format!( - " - u32CvtShim[0] = {low}; - u32CvtShim[1] = {high}; - const n{i} = {present} === 0 ? undefined : {f}[0]; - ", - present = present, - low = low, - high = high, - f = f, - i = i, - )); - js.push(format!("n{}", i)); - } } Ok(()) } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 0e8934ed809..063100f43ae 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1126,6 +1126,19 @@ impl<'a> Context<'a> { )); } + fn expose_assert_bigint(&mut self) { + if !self.should_write_global("assert_bigint") { + return; + } + self.global(&format!( + " + function _assertBigInt(n) {{ + if (typeof(n) !== 'bigint') throw new Error('expected a bigint argument'); + }} + " + )); + } + fn expose_assert_bool(&mut self) { if !self.should_write_global("assert_bool") { return; @@ -2036,41 +2049,6 @@ impl<'a> Context<'a> { ); } - fn expose_u32_cvt_shim(&mut self) -> &'static str { - let name = "u32CvtShim"; - if !self.should_write_global(name) { - return name; - } - self.global(&format!("const {} = new Uint32Array(2);", name)); - name - } - - fn expose_int64_cvt_shim(&mut self) -> &'static str { - let name = "int64CvtShim"; - if !self.should_write_global(name) { - return name; - } - let n = self.expose_u32_cvt_shim(); - self.global(&format!( - "const {} = new BigInt64Array({}.buffer);", - name, n - )); - name - } - - fn expose_uint64_cvt_shim(&mut self) -> &'static str { - let name = "uint64CvtShim"; - if !self.should_write_global(name) { - return name; - } - let n = self.expose_u32_cvt_shim(); - self.global(&format!( - "const {} = new BigUint64Array({}.buffer);", - name, n - )); - name - } - fn expose_is_like_none(&mut self) { if !self.should_write_global("is_like_none") { return; diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 1778516caad..1c8e2cb169c 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -89,8 +89,8 @@ impl InstructionBuilder<'_, '_> { Descriptor::U16 => self.number(WitVT::U16, WasmVT::I32), Descriptor::I32 => self.number(WitVT::S32, WasmVT::I32), Descriptor::U32 => self.number(WitVT::U32, WasmVT::I32), - Descriptor::I64 => self.number64(true), - Descriptor::U64 => self.number64(false), + Descriptor::I64 => self.number(WitVT::S64, WasmVT::I64), + Descriptor::U64 => self.number(WitVT::U64, WasmVT::I64), Descriptor::F32 => { self.get(AdapterType::F32); self.output.push(AdapterType::F32); @@ -256,17 +256,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::U32 => self.in_option_native(ValType::I32), Descriptor::F32 => self.in_option_native(ValType::F32), Descriptor::F64 => self.in_option_native(ValType::F64), - Descriptor::I64 | Descriptor::U64 => { - let (signed, ty) = match arg { - Descriptor::I64 => (true, AdapterType::S64.option()), - _ => (false, AdapterType::U64.option()), - }; - self.instruction( - &[ty], - Instruction::I32SplitOption64 { signed }, - &[AdapterType::I32, AdapterType::I32, AdapterType::I32], - ); - } + Descriptor::I64 | Descriptor::U64 => self.in_option_native(ValType::I64), Descriptor::Boolean => { self.instruction( &[AdapterType::Bool.option()], @@ -396,18 +386,6 @@ impl InstructionBuilder<'_, '_> { ); } - fn number64(&mut self, signed: bool) { - self.instruction( - &[if signed { - AdapterType::S64 - } else { - AdapterType::U64 - }], - Instruction::I32Split64 { signed }, - &[AdapterType::I32, AdapterType::I32], - ); - } - fn in_option_native(&mut self, wasm: ValType) { let ty = AdapterType::from_wasm(wasm).unwrap(); self.instruction( diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index c8da887542f..4e3a485f918 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -1646,7 +1646,7 @@ impl StructUnpacker { fn read_ty(&mut self, ty: &AdapterType) -> Result { let (quads, alignment) = match ty { AdapterType::I32 | AdapterType::U32 | AdapterType::F32 => (1, 1), - AdapterType::F64 => (2, 2), + AdapterType::I64 | AdapterType::U64 | AdapterType::F64 => (2, 2), other => bail!("invalid aggregate return type {:?}", other), }; Ok(self.append(quads, alignment)) diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index e2598f7e920..1ea9c17bf93 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -63,6 +63,8 @@ impl InstructionBuilder<'_, '_> { Descriptor::U16 => self.outgoing_i32(AdapterType::U16), Descriptor::I32 => self.outgoing_i32(AdapterType::S32), Descriptor::U32 => self.outgoing_i32(AdapterType::U32), + Descriptor::I64 => self.outgoing_i64(AdapterType::I64), + Descriptor::U64 => self.outgoing_i64(AdapterType::U64), Descriptor::F32 => { self.get(AdapterType::F32); self.output.push(AdapterType::F32); @@ -81,22 +83,6 @@ impl InstructionBuilder<'_, '_> { ); } - Descriptor::I64 | Descriptor::U64 => { - let signed = match arg { - Descriptor::I64 => true, - _ => false, - }; - self.instruction( - &[AdapterType::I32, AdapterType::I32], - Instruction::I64FromLoHi { signed }, - &[if signed { - AdapterType::S64 - } else { - AdapterType::U64 - }], - ); - } - Descriptor::RustStruct(class) => { self.instruction( &[AdapterType::I32], @@ -277,19 +263,10 @@ impl InstructionBuilder<'_, '_> { Descriptor::U16 => self.out_option_sentinel(AdapterType::U16), Descriptor::I32 => self.option_native(true, ValType::I32), Descriptor::U32 => self.option_native(false, ValType::I32), + Descriptor::I64 => self.option_native(true, ValType::I64), + Descriptor::U64 => self.option_native(false, ValType::I64), Descriptor::F32 => self.option_native(true, ValType::F32), Descriptor::F64 => self.option_native(true, ValType::F64), - Descriptor::I64 | Descriptor::U64 => { - let (signed, ty) = match arg { - Descriptor::I64 => (true, AdapterType::S64.option()), - _ => (false, AdapterType::U64.option()), - }; - self.instruction( - &[AdapterType::I32, AdapterType::I32, AdapterType::I32], - Instruction::Option64FromI32 { signed }, - &[ty], - ); - } Descriptor::Boolean => { self.instruction( &[AdapterType::I32], @@ -541,6 +518,15 @@ impl InstructionBuilder<'_, '_> { self.instruction(&[AdapterType::I32], Instruction::Standard(std), &[output]); } + fn outgoing_i64(&mut self, output: AdapterType) { + let std = wit_walrus::Instruction::WasmToInt { + input: walrus::ValType::I64, + output: output.to_wit().unwrap(), + trap: false, + }; + self.instruction(&[AdapterType::I64], Instruction::Standard(std), &[output]); + } + fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> { let mem = self.cx.memory()?; let free = self.cx.free()?; diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 1fe532d77b1..112256193cb 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -256,11 +256,7 @@ fn translate_instruction( | RustFromI32 { .. } => { bail!("rust types aren't supported in wasm interface types"); } - I32Split64 { .. } | I64FromLoHi { .. } => { - bail!("64-bit integers aren't supported in wasm-bindgen"); - } - I32SplitOption64 { .. } - | I32FromOptionExternref { .. } + I32FromOptionExternref { .. } | I32FromOptionU32Sentinel | I32FromOptionRust { .. } | I32FromOptionBool @@ -276,8 +272,7 @@ fn translate_instruction( | ToOptionNative { .. } | OptionBoolFromI32 | OptionCharFromI32 - | OptionEnumFromI32 { .. } - | Option64FromI32 { .. } => { + | OptionEnumFromI32 { .. } => { bail!("optional types aren't supported in wasm bindgen"); } UnwrapResult { .. } | UnwrapResultString { .. } => { diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 78df620d765..d07c593491a 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -146,16 +146,6 @@ pub enum Instruction { I32FromOptionRust { class: String, }, - /// Pops an `s64` or `u64` from the stack, pushing two `i32` values. - I32Split64 { - signed: bool, - }, - /// Pops an `s64` or `u64` from the stack, pushing three `i32` values. - /// First is the "some/none" bit, and the next is the low bits, and the - /// next is the high bits. - I32SplitOption64 { - signed: bool, - }, /// Pops an `externref` from the stack, pushes either 0 if it's "none" or and /// index into the owned wasm table it was stored at if it's "some" I32FromOptionExternref { @@ -240,10 +230,6 @@ pub enum Instruction { }, /// pops `i32`, pushes string from that `char` StringFromChar, - /// pops two `i32`, pushes a 64-bit number - I64FromLoHi { - signed: bool, - }, /// pops `i32`, pushes an externref for the wrapped rust class RustFromI32 { class: String, @@ -302,9 +288,6 @@ pub enum Instruction { OptionEnumFromI32 { hole: u32, }, - Option64FromI32 { - signed: bool, - }, } impl AdapterType { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index dfa338a3747..46ed0b8a72a 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.82"; +pub const SCHEMA_VERSION: &str = "0.2.83"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 8b26fc3c71c..426c9ed5b6f 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "18229224525184165582"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "6377323169918973918"; #[test] fn schema_version() { diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 429a32896af..0179cde2e4b 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -25,37 +25,36 @@ pub struct WasmOptionalU32 { unsafe impl WasmAbi for WasmOptionalU32 {} #[repr(C)] -pub struct WasmOptionalF32 { +pub struct WasmOptionalI64 { pub present: u32, - pub value: f32, + pub value: i64, } -unsafe impl WasmAbi for WasmOptionalF32 {} +unsafe impl WasmAbi for WasmOptionalI64 {} #[repr(C)] -pub struct WasmOptionalF64 { +pub struct WasmOptionalU64 { pub present: u32, - pub value: f64, + pub value: u64, } -unsafe impl WasmAbi for WasmOptionalF64 {} +unsafe impl WasmAbi for WasmOptionalU64 {} #[repr(C)] -pub struct Wasm64 { - pub low: u32, - pub high: u32, +pub struct WasmOptionalF32 { + pub present: u32, + pub value: f32, } -unsafe impl WasmAbi for Wasm64 {} +unsafe impl WasmAbi for WasmOptionalF32 {} #[repr(C)] -pub struct WasmOptional64 { +pub struct WasmOptionalF64 { pub present: u32, - pub low: u32, - pub high: u32, + pub value: f64, } -unsafe impl WasmAbi for WasmOptional64 {} +unsafe impl WasmAbi for WasmOptionalF64 {} macro_rules! type_wasm_native { ($($t:tt as $c:tt => $r:tt)*) => ($( @@ -111,6 +110,8 @@ type_wasm_native!( isize as i32 => WasmOptionalI32 u32 as u32 => WasmOptionalU32 usize as u32 => WasmOptionalU32 + i64 as i64 => WasmOptionalI64 + u64 as u64 => WasmOptionalU64 f32 as f32 => WasmOptionalF32 f64 as f64 => WasmOptionalF64 ); @@ -145,66 +146,6 @@ macro_rules! type_abi_as_u32 { type_abi_as_u32!(i8 u8 i16 u16); -macro_rules! type_64 { - ($($t:tt)*) => ($( - impl IntoWasmAbi for $t { - type Abi = Wasm64; - - #[inline] - fn into_abi(self) -> Wasm64 { - Wasm64 { - low: self as u32, - high: (self >> 32) as u32, - } - } - } - - impl FromWasmAbi for $t { - type Abi = Wasm64; - - #[inline] - unsafe fn from_abi(js: Wasm64) -> $t { - $t::from(js.low) | ($t::from(js.high) << 32) - } - } - - impl IntoWasmAbi for Option<$t> { - type Abi = WasmOptional64; - - #[inline] - fn into_abi(self) -> WasmOptional64 { - match self { - None => WasmOptional64 { - present: 0, - low: 0 as u32, - high: 0 as u32, - }, - Some(me) => WasmOptional64 { - present: 1, - low: me as u32, - high: (me >> 32) as u32, - }, - } - } - } - - impl FromWasmAbi for Option<$t> { - type Abi = WasmOptional64; - - #[inline] - unsafe fn from_abi(js: WasmOptional64) -> Self { - if js.present == 0 { - None - } else { - Some($t::from(js.low) | ($t::from(js.high) << 32)) - } - } - } - )*) -} - -type_64!(i64 u64); - impl IntoWasmAbi for bool { type Abi = u32; diff --git a/src/convert/traits.rs b/src/convert/traits.rs index dda66365012..b9d12b4c891 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -100,6 +100,8 @@ pub unsafe trait WasmAbi {} unsafe impl WasmAbi for u32 {} unsafe impl WasmAbi for i32 {} +unsafe impl WasmAbi for u64 {} +unsafe impl WasmAbi for i64 {} unsafe impl WasmAbi for f32 {} unsafe impl WasmAbi for f64 {} From d1e200f0b3fecdaae7f864e081c451ff3df23653 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Sun, 21 Aug 2022 22:18:52 +0200 Subject: [PATCH 065/641] Refactor: None is not an ImportModule (#3039) --- crates/backend/src/ast.rs | 24 ++++------------- crates/backend/src/encode.rs | 26 +++++++++++++------ crates/backend/src/util.rs | 2 +- crates/cli-support/src/wit/mod.rs | 26 ++++++++++--------- .../tests/reference/anyref-import-catch.js | 2 +- crates/cli/tests/reference/import-catch.js | 2 +- crates/macro-support/src/parser.rs | 22 ++++++++-------- crates/shared/src/lib.rs | 3 +-- crates/shared/src/schema_hash_approval.rs | 2 +- 9 files changed, 53 insertions(+), 56 deletions(-) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 134fb4e485b..7703e2570f2 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -78,8 +78,8 @@ pub enum MethodSelf { #[cfg_attr(feature = "extra-traits", derive(Debug))] #[derive(Clone)] pub struct Import { - /// The type of module being imported from - pub module: ImportModule, + /// The type of module being imported from, if any + pub module: Option, /// The namespace to access the item through, if any pub js_namespace: Option>, /// The type of item being imported @@ -90,8 +90,6 @@ pub struct Import { #[cfg_attr(feature = "extra-traits", derive(Debug))] #[derive(Clone)] pub enum ImportModule { - /// No module / import from global scope - None, /// Import from the named module, with relative paths interpreted Named(String, Span), /// Import from the named module, without interpreting paths @@ -103,21 +101,9 @@ pub enum ImportModule { impl Hash for ImportModule { fn hash(&self, h: &mut H) { match self { - ImportModule::None => { - 0u8.hash(h); - } - ImportModule::Named(name, _) => { - 1u8.hash(h); - name.hash(h); - } - ImportModule::Inline(idx, _) => { - 2u8.hash(h); - idx.hash(h); - } - ImportModule::RawNamed(name, _) => { - 3u8.hash(h); - name.hash(h); - } + ImportModule::Named(name, _) => (1u8, name).hash(h), + ImportModule::Inline(idx, _) => (2u8, idx).hash(h), + ImportModule::RawNamed(name, _) => (3u8, name).hash(h), } } } diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index f16a282613b..086ff284452 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -239,19 +239,29 @@ fn shared_variant<'a>(v: &'a ast::Variant, intern: &'a Interner) -> EnumVariant< fn shared_import<'a>(i: &'a ast::Import, intern: &'a Interner) -> Result, Diagnostic> { Ok(Import { - module: match &i.module { - ast::ImportModule::Named(m, span) => { - ImportModule::Named(intern.resolve_import_module(m, *span)?) - } - ast::ImportModule::RawNamed(m, _span) => ImportModule::RawNamed(intern.intern_str(m)), - ast::ImportModule::Inline(idx, _) => ImportModule::Inline(*idx as u32), - ast::ImportModule::None => ImportModule::None, - }, + module: i + .module + .as_ref() + .map(|m| shared_module(m, intern)) + .transpose()?, js_namespace: i.js_namespace.clone(), kind: shared_import_kind(&i.kind, intern)?, }) } +fn shared_module<'a>( + m: &'a ast::ImportModule, + intern: &'a Interner, +) -> Result, Diagnostic> { + Ok(match m { + ast::ImportModule::Named(m, span) => { + ImportModule::Named(intern.resolve_import_module(m, *span)?) + } + ast::ImportModule::RawNamed(m, _span) => ImportModule::RawNamed(intern.intern_str(m)), + ast::ImportModule::Inline(idx, _) => ImportModule::Inline(*idx as u32), + }) +} + fn shared_import_kind<'a>( i: &'a ast::ImportKind, intern: &'a Interner, diff --git a/crates/backend/src/util.rs b/crates/backend/src/util.rs index 1396bd9051b..1a2b07dce38 100644 --- a/crates/backend/src/util.rs +++ b/crates/backend/src/util.rs @@ -119,7 +119,7 @@ pub fn ident_ty(ident: Ident) -> syn::Type { /// Convert an ImportFunction into the more generic Import type, wrapping the provided function pub fn wrap_import_function(function: ast::ImportFunction) -> ast::Import { ast::Import { - module: ast::ImportModule::None, + module: None, js_namespace: None, kind: ast::ImportKind::Function(function), } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 4e3a485f918..7b8e81721c2 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -881,10 +881,10 @@ impl<'a> Context<'a> { fn determine_import(&self, import: &decode::Import<'_>, item: &str) -> Result { let is_local_snippet = match import.module { - decode::ImportModule::Named(s) => self.aux.local_modules.contains_key(s), - decode::ImportModule::RawNamed(_) => false, - decode::ImportModule::Inline(_) => true, - decode::ImportModule::None => false, + Some(decode::ImportModule::Named(s)) => self.aux.local_modules.contains_key(s), + Some(decode::ImportModule::RawNamed(_)) => false, + Some(decode::ImportModule::Inline(_)) => true, + None => false, }; // Similar to `--target no-modules`, only allow vendor prefixes @@ -902,7 +902,7 @@ impl<'a> Context<'a> { &vendor_prefixes[0] ); } - if let decode::ImportModule::Named(module) = &import.module { + if let Some(decode::ImportModule::Named(module)) = &import.module { bail!( "import of `{}` from `{}` has a polyfill of `{}` listed, but vendor prefixes aren't supported when importing from modules", @@ -938,17 +938,19 @@ impl<'a> Context<'a> { }; let name = match import.module { - decode::ImportModule::Named(module) if is_local_snippet => JsImportName::LocalModule { - module: module.to_string(), - name: name.to_string(), - }, - decode::ImportModule::Named(module) | decode::ImportModule::RawNamed(module) => { + Some(decode::ImportModule::Named(module)) if is_local_snippet => { + JsImportName::LocalModule { + module: module.to_string(), + name: name.to_string(), + } + } + Some(decode::ImportModule::Named(module) | decode::ImportModule::RawNamed(module)) => { JsImportName::Module { module: module.to_string(), name: name.to_string(), } } - decode::ImportModule::Inline(idx) => { + Some(decode::ImportModule::Inline(idx)) => { let offset = self .aux .snippets @@ -961,7 +963,7 @@ impl<'a> Context<'a> { name: name.to_string(), } } - decode::ImportModule::None => JsImportName::Global { + None => JsImportName::Global { name: name.to_string(), }, }; diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index 6d5394d788a..cd594d8c3be 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -64,7 +64,7 @@ export function exported() { } } -export function __wbg_foo_8d66ddef0ff279d6() { return handleError(function () { +export function __wbg_foo_95fe1a04017077db() { return handleError(function () { foo(); }, arguments) }; diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index 6f9a1bc1578..5fc12d3c570 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -61,7 +61,7 @@ export function exported() { } } -export function __wbg_foo_8d66ddef0ff279d6() { return handleError(function () { +export function __wbg_foo_95fe1a04017077db() { return handleError(function () { foo(); }, arguments) }; diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index fc29660552d..a3148fdb184 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -468,12 +468,12 @@ fn get_expr(mut expr: &syn::Expr) -> &syn::Expr { expr } -impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignItemFn { +impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::ForeignItemFn { type Target = ast::ImportKind; fn convert( self, - (opts, module): (BindgenAttrs, &'a ast::ImportModule), + (opts, module): (BindgenAttrs, &'a Option), ) -> Result { let mut wasm = function_from_decl( &self.sig.ident, @@ -712,12 +712,12 @@ impl ConvertToAst for syn::ForeignItemType { } } -impl<'a> ConvertToAst<(BindgenAttrs, &'a ast::ImportModule)> for syn::ForeignItemStatic { +impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::ForeignItemStatic { type Target = ast::ImportKind; fn convert( self, - (opts, module): (BindgenAttrs, &'a ast::ImportModule), + (opts, module): (BindgenAttrs, &'a Option), ) -> Result { if self.mutability.is_some() { bail_span!(self.mutability, "cannot import mutable globals yet") @@ -1197,7 +1197,7 @@ fn import_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), D } program.imports.push(ast::Import { - module: ast::ImportModule::None, + module: None, js_namespace: None, kind: ast::ImportKind::Enum(ast::ImportEnum { vis: enum_.vis, @@ -1381,19 +1381,19 @@ impl MacroParse for syn::ItemForeignMod { let msg = "cannot specify both `module` and `raw_module`"; errors.push(Diagnostic::span_error(span, msg)); } - ast::ImportModule::Named(name.to_string(), span) + Some(ast::ImportModule::Named(name.to_string(), span)) } else if let Some((name, span)) = opts.raw_module() { if opts.inline_js().is_some() { let msg = "cannot specify both `raw_module` and `inline_js`"; errors.push(Diagnostic::span_error(span, msg)); } - ast::ImportModule::RawNamed(name.to_string(), span) + Some(ast::ImportModule::RawNamed(name.to_string(), span)) } else if let Some((js, span)) = opts.inline_js() { let i = program.inline_js.len(); program.inline_js.push(js.to_string()); - ast::ImportModule::Inline(i, span) + Some(ast::ImportModule::Inline(i, span)) } else { - ast::ImportModule::None + None }; for item in self.items.into_iter() { if let Err(e) = item.macro_parse(program, module.clone()) { @@ -1406,11 +1406,11 @@ impl MacroParse for syn::ItemForeignMod { } } -impl MacroParse for syn::ForeignItem { +impl MacroParse> for syn::ForeignItem { fn macro_parse( mut self, program: &mut ast::Program, - module: ast::ImportModule, + module: Option, ) -> Result<(), Diagnostic> { let item_opts = { let attrs = match self { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 46ed0b8a72a..f69d8f4a855 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -25,13 +25,12 @@ macro_rules! shared_api { } struct Import<'a> { - module: ImportModule<'a>, + module: Option>, js_namespace: Option>, kind: ImportKind<'a>, } enum ImportModule<'a> { - None, Named(&'a str), RawNamed(&'a str), Inline(u32), diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 426c9ed5b6f..4692a28c81e 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "6377323169918973918"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "17656911631008664055"; #[test] fn schema_version() { From f29297334632294e33da761df5a12a9ed2d6811c Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 24 Aug 2022 22:00:50 +0200 Subject: [PATCH 066/641] fix: fixes #3044 (#3045) --- guide/src/examples/wasm-in-web-worker.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/src/examples/wasm-in-web-worker.md b/guide/src/examples/wasm-in-web-worker.md index b333fceff40..f17a7c31739 100644 --- a/guide/src/examples/wasm-in-web-worker.md +++ b/guide/src/examples/wasm-in-web-worker.md @@ -46,7 +46,7 @@ code in in the worker across browsers, the `index.html` also includes loading both `wasm_in_web_worker.js` and `index.js`. ```html -{{#include ../../../examples/wasm-in-web-worker/www/index.html}} +{{#include ../../../examples/wasm-in-web-worker/index.html}} ``` ## `index.js` @@ -55,7 +55,7 @@ Loads our WASM file asynchronously and calls the entry point `startup` of the main thread which will create a worker. ```js -{{#include ../../../examples/wasm-in-web-worker/www/index.js}} +{{#include ../../../examples/wasm-in-web-worker/index.js}} ``` ## `worker.js` @@ -67,5 +67,5 @@ calculation and bind a method of the object to the `onmessage` callback of the worker. ```js -{{#include ../../../examples/wasm-in-web-worker/www/worker.js}} +{{#include ../../../examples/wasm-in-web-worker/worker.js}} ``` From b2f9e1247b494610c110e703d0773f7acaef277f Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 30 Aug 2022 14:15:52 +1000 Subject: [PATCH 067/641] Move async function arguments into spawned futures (#3043) Fixes #3042 Previously, any exported async functions which borrowed their arguments would fail to compile, because the values being referenced are stored on the stack of the initial synchronous call and then dropped, leaving nothing for the spawned future to reference. This moves the referenced values into the spawned future, fixing that. --- crates/backend/src/codegen.rs | 43 +++++++++++++++++++++++------------ tests/wasm/futures.js | 3 +++ tests/wasm/futures.rs | 20 ++++++++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 3115015d24d..5be0fad3350 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -470,9 +470,7 @@ impl TryToTokens for ast::Export { quote! { () }, quote! { () }, quote! { - wasm_bindgen_futures::spawn_local(async move { - <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret.await); - }) + <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret.await) }, ) } else { @@ -480,9 +478,7 @@ impl TryToTokens for ast::Export { quote! { wasm_bindgen::JsValue }, quote! { #syn_ret }, quote! { - wasm_bindgen_futures::future_to_promise(async move { - <#syn_ret as wasm_bindgen::__rt::IntoJsResult>::into_js_result(#ret.await) - }).into() + <#syn_ret as wasm_bindgen::__rt::IntoJsResult>::into_js_result(#ret.await) }, ) } @@ -496,8 +492,32 @@ impl TryToTokens for ast::Export { (quote! { #syn_ret }, quote! { #syn_ret }, quote! { #ret }) }; + let mut call = quote! { + { + #(#arg_conversions)* + let #ret = #receiver(#(#converted_arguments),*); + #ret_expr + } + }; + + if self.function.r#async { + if self.start { + call = quote! { + wasm_bindgen_futures::spawn_local(async move { + #call + }) + } + } else { + call = quote! { + wasm_bindgen_futures::future_to_promise(async move { + #call + }).into() + } + } + } + let projection = quote! { <#ret_ty as wasm_bindgen::convert::ReturnWasmAbi> }; - let convert_ret = quote! { #projection::return_abi(#ret_expr) }; + let convert_ret = quote! { #projection::return_abi(#ret) }; let describe_ret = quote! { <#ret_ty as WasmDescribe>::describe(); <#inner_ret_ty as WasmDescribe>::describe(); @@ -523,13 +543,8 @@ impl TryToTokens for ast::Export { )] pub unsafe extern "C" fn #generated_name(#(#args),*) -> #projection::Abi { #start_check - // Scope all local variables to be destroyed after we call - // the function to ensure that `#convert_ret`, if it panics, - // doesn't leak anything. - let #ret = { - #(#arg_conversions)* - #receiver(#(#converted_arguments),*) - }; + + let #ret = #call; #convert_ret } }; diff --git a/tests/wasm/futures.js b/tests/wasm/futures.js index 386125583a4..5f4564baca3 100644 --- a/tests/wasm/futures.js +++ b/tests/wasm/futures.js @@ -15,6 +15,9 @@ exports.call_exports = async function() { await assert.rejects(wasm.async_throw_message(), /async message/); await assert.rejects(wasm.async_throw_jserror(), /async message/); await assert.rejects(wasm.async_throw_custom_error(), /custom error/); + assert.strictEqual("Hi, Jim!", await wasm.async_take_reference("Jim")); + const foo = await new wasm.AsyncStruct(); + assert.strictEqual(42, await foo.method()); }; exports.call_promise = async function() { diff --git a/tests/wasm/futures.rs b/tests/wasm/futures.rs index adf3324e826..ad2be0f71d9 100644 --- a/tests/wasm/futures.rs +++ b/tests/wasm/futures.rs @@ -106,6 +106,26 @@ pub async fn async_throw_custom_error() -> Result String { + format!("Hi, {x}!") +} + +#[wasm_bindgen] +pub struct AsyncStruct; + +#[wasm_bindgen] +impl AsyncStruct { + #[wasm_bindgen(constructor)] + pub async fn new() -> AsyncStruct { + AsyncStruct + } + + pub async fn method(&self) -> u32 { + 42 + } +} + #[wasm_bindgen_test] async fn test_promise() { assert_eq!(call_promise().await.as_string(), Some(String::from("ok"))) From 823f57698c0090066941756f71816f38f4cb2520 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 30 Aug 2022 14:17:27 +1000 Subject: [PATCH 068/641] Deprecate `JsValue::from_serde` and `JsValue::into_serde` (#3031) * Deprecate `JsValue::from_serde` and `JsValue::into_serde` I've listed `serde-wasm-bindgen` as the replacement, and changed the section of the guide that talks about Serde to talk about `serde-wasm-bindgen` instead of the deprecated methods. I didn't remove it entirely because I can imagine someone remembering it and trying to look it back up, only to find that it no longer exists, which would quite frustrating. I also added a footnote about the deprecated methods in case someone remembers the old way and wants to know what happened. There were several examples using `from_serde`/`into_serde`, which I updated to use `serde-wasm-bindgen` or not use `serde` altogether. The `fetch` example was a bit weird, in that it took a JS value, parsed it into a Rust value, only to serialize it back into a JS value. I removed that entirely in favour of just passing the original JS value directly. I suppose it behaves slightly differently in that it loses the extra validation, but a panic isn't all that much better than a JS runtime error. * fmt * Mention JSON as an alternative to `serde-wasm-bindgen` * Use `gloo-utils` instead of raw `JSON` I was considering leaving the examples using `JSON` directly and mentioning `gloo-utils` as an aside, but that has the major footgun that `JSON.stringify(undefined) === undefined`, causing a panic when deserializing `undefined` since the return type of `JSON::stringify` isn't optional. `gloo-utils` works around this, so I recommended it instead. * Mention `gloo-utils` in API docs * Rephrase section about deprecated methods --- examples/fetch/Cargo.toml | 4 +- examples/fetch/src/lib.rs | 36 +----- examples/raytrace-parallel/Cargo.toml | 3 +- examples/raytrace-parallel/src/lib.rs | 5 +- examples/webxr/Cargo.toml | 4 +- examples/webxr/src/lib.rs | 20 ++-- guide/src/examples/fetch.md | 3 +- .../reference/arbitrary-data-with-serde.md | 110 ++++++++++++------ src/lib.rs | 18 +++ 9 files changed, 110 insertions(+), 93 deletions(-) diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index bf1f73ca5e9..7ca88c051b6 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -8,11 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { version = "0.2.82", features = ["serde-serialize"] } +wasm-bindgen = "0.2.82" js-sys = "0.3.59" wasm-bindgen-futures = "0.4.32" -serde = { version = "1.0.80", features = ["derive"] } -serde_derive = "^1.0.59" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/fetch/src/lib.rs b/examples/fetch/src/lib.rs index 964387534f7..c90fde3add2 100644 --- a/examples/fetch/src/lib.rs +++ b/examples/fetch/src/lib.rs @@ -1,37 +1,8 @@ -use serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use web_sys::{Request, RequestInit, RequestMode, Response}; -/// A struct to hold some data from the github Branch API. -/// -/// Note how we don't have to define every member -- serde will ignore extra -/// data when deserializing -#[derive(Debug, Serialize, Deserialize)] -pub struct Branch { - pub name: String, - pub commit: Commit, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Commit { - pub sha: String, - pub commit: CommitDetails, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct CommitDetails { - pub author: Signature, - pub committer: Signature, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Signature { - pub name: String, - pub email: String, -} - #[wasm_bindgen] pub async fn run(repo: String) -> Result { let mut opts = RequestInit::new(); @@ -56,9 +27,6 @@ pub async fn run(repo: String) -> Result { // Convert this other `Promise` into a rust `Future`. let json = JsFuture::from(resp.json()?).await?; - // Use serde to parse the JSON into a struct. - let branch_info: Branch = json.into_serde().unwrap(); - - // Send the `Branch` struct back to JS as an `Object`. - Ok(JsValue::from_serde(&branch_info).unwrap()) + // Send the JSON response back to JS. + Ok(json) } diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index cb3c45a82f8..81145af8c20 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -13,8 +13,9 @@ js-sys = "0.3.59" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } +serde-wasm-bindgen = "0.4.3" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = { version = "0.2.82", features = ['serde-serialize'] } +wasm-bindgen = "0.2.82" wasm-bindgen-futures = "0.4.32" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/src/lib.rs b/examples/raytrace-parallel/src/lib.rs index 696c565e5b9..84a0e9f3864 100644 --- a/examples/raytrace-parallel/src/lib.rs +++ b/examples/raytrace-parallel/src/lib.rs @@ -28,11 +28,10 @@ impl Scene { /// Creates a new scene from the JSON description in `object`, which we /// deserialize here into an actual scene. #[wasm_bindgen(constructor)] - pub fn new(object: &JsValue) -> Result { + pub fn new(object: JsValue) -> Result { console_error_panic_hook::set_once(); Ok(Scene { - inner: object - .into_serde() + inner: serde_wasm_bindgen::from_value(object) .map_err(|e| JsValue::from(e.to_string()))?, }) } diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index d29fd571c41..597ccc69f92 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -10,10 +10,8 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" js-sys = "0.3.59" -wasm-bindgen = {version = "0.2.82", features = ["serde-serialize"]} +wasm-bindgen = "0.2.82" wasm-bindgen-futures = "0.4.32" -serde = { version = "1.0.80", features = ["derive"] } -serde_derive = "^1.0.59" [dependencies.web-sys] version = "0.3.36" diff --git a/examples/webxr/src/lib.rs b/examples/webxr/src/lib.rs index f6fe310572c..5451e27d2ca 100644 --- a/examples/webxr/src/lib.rs +++ b/examples/webxr/src/lib.rs @@ -3,16 +3,13 @@ #[macro_use] mod utils; -use futures::{future, Future}; -use js_sys::Promise; +use js_sys::{Object, Promise, Reflect}; use std::cell::RefCell; -use std::collections::HashMap; use std::rc::Rc; use utils::set_panic_hook; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::future_to_promise; -use wasm_bindgen_futures::JsFuture; use web_sys::*; // A macro to provide `println!(..)`-style syntax for `console.log` logging. @@ -39,12 +36,16 @@ pub fn create_webgl_context(xr_mode: bool) -> Result Promise { log!("Starting WebXR..."); let navigator: web_sys::Navigator = web_sys::window().unwrap().navigator(); - let gpu = navigator.gpu(); let xr = navigator.xr(); let session_mode = XrSessionMode::Inline; let session_supported_promise = xr.is_session_supported(session_mode); @@ -121,7 +121,7 @@ impl XrApp { let g = f.clone(); let mut i = 0; - *g.borrow_mut() = Some(Closure::new(move |time: f64, frame: XrFrame| { + *g.borrow_mut() = Some(Closure::new(move |_time: f64, frame: XrFrame| { log!("Frame rendering..."); if i > 2 { log!("All done!"); diff --git a/guide/src/examples/fetch.md b/guide/src/examples/fetch.md index 521e8dd7de3..1716e9291f1 100644 --- a/guide/src/examples/fetch.md +++ b/guide/src/examples/fetch.md @@ -11,8 +11,7 @@ then parses the resulting JSON. ## `Cargo.toml` The `Cargo.toml` enables a number of features related to the `fetch` API and -types used: `Headers`, `Request`, etc. It also enables `wasm-bindgen`'s `serde` -support. +types used: `Headers`, `Request`, etc. ```toml {{#include ../../../examples/fetch/Cargo.toml}} diff --git a/guide/src/reference/arbitrary-data-with-serde.md b/guide/src/reference/arbitrary-data-with-serde.md index 7cd43355445..c46e2464fd7 100644 --- a/guide/src/reference/arbitrary-data-with-serde.md +++ b/guide/src/reference/arbitrary-data-with-serde.md @@ -1,21 +1,19 @@ # Serializing and Deserializing Arbitrary Data Into and From `JsValue` with Serde It's possible to pass arbitrary data from Rust to JavaScript by serializing it -to JSON with [Serde](https://github.com/serde-rs/serde). `wasm-bindgen` includes -the `JsValue` type, which streamlines serializing and deserializing. +with [Serde](https://github.com/serde-rs/serde). This can be done through the +[`serde-wasm-bindgen`](https://docs.rs/serde-wasm-bindgen) crate. -## Enable the `"serde-serialize"` Feature +## Add dependencies -To enable the `"serde-serialize"` feature, do two things in `Cargo.toml`: - -1. Add the `serde` and `serde_derive` crates to `[dependencies]`. -2. Add `features = ["serde-serialize"]` to the existing `wasm-bindgen` - dependency. +To use `serde-wasm-bindgen`, you first have to add it as a dependency in your +`Cargo.toml`. You also need the `serde` crate, with the `derive` feature +enabled, to allow your types to be serialized and deserialized with Serde. ```toml [dependencies] serde = { version = "1.0", features = ["derive"] } -wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } +serde-wasm-bindgen = "0.4" ``` ## Derive the `Serialize` and `Deserialize` Traits @@ -42,7 +40,7 @@ pub struct Example { } ``` -## Send it to JavaScript with `JsValue::from_serde` +## Send it to JavaScript with `serde_wasm_bindgen::to_value` Here's a function that will pass an `Example` to JavaScript by serializing it to `JsValue`: @@ -58,28 +56,28 @@ pub fn send_example_to_js() -> JsValue { field3: [1., 2., 3., 4.] }; - JsValue::from_serde(&example).unwrap() + serde_wasm_bindgen::to_value(&example).unwrap() } ``` -## Receive it from JavaScript with `JsValue::into_serde` +## Receive it from JavaScript with `serde_wasm_bindgen::from_value` Here's a function that will receive a `JsValue` parameter from JavaScript and then deserialize an `Example` from it: ```rust #[wasm_bindgen] -pub fn receive_example_from_js(val: &JsValue) { - let example: Example = val.into_serde().unwrap(); +pub fn receive_example_from_js(val: JsValue) { + let example: Example = serde_wasm_bindgen::from_value(val).unwrap(); ... } ``` ## JavaScript Usage -In the `JsValue` that JavaScript gets, `field1` will be an `Object` (not a -JavaScript `Map`), `field2` will be a JavaScript `Array` whose members are -`Array`s of numbers, and `field3` will be an `Array` of numbers. +In the `JsValue` that JavaScript gets, `field1` will be a `Map`, `field2` will +be a JavaScript `Array` whose members are `Array`s of numbers, and `field3` +will be an `Array` of numbers. ```js import { send_example_to_js, receive_example_from_js } from "example"; @@ -94,23 +92,61 @@ example.field2.push([5, 6]); receive_example_from_js(example); ``` -## An Alternative Approach: `serde-wasm-bindgen` - -[The `serde-wasm-bindgen` -crate](https://github.com/cloudflare/serde-wasm-bindgen) serializes and -deserializes Rust structures directly to `JsValue`s, without going through -temporary JSON stringification. This approach has both advantages and -disadvantages. - -The primary advantage is smaller code size: going through JSON entrenches code -to stringify and parse floating point numbers, which is not a small amount of -code. It also supports more types than JSON does, such as `Map`, `Set`, and -array buffers. - -There are two primary disadvantages. The first is that it is not always -compatible with the default JSON-based serialization. The second is that it -performs more calls back and forth between JS and Wasm, which has not been fully -optimized in all engines, meaning it can sometimes be a speed -regression. However, in other cases, it is a speed up over the JSON-based -stringification, so — as always — make sure to profile your own use -cases as necessary. +## An alternative approach - using JSON + +`serde-wasm-bindgen` works by directly manipulating JavaScript values. This +requires a lot of calls back and forth between Rust and JavaScript, which can +sometimes be slow. An alternative way of doing this is to serialize values to +JSON, and then parse them on the other end. Browsers' JSON implementations are +usually quite fast, and so this approach can outstrip `serde-wasm-bindgen`'s +performance in some cases. + +That's not to say that using JSON is always faster, though - the JSON approach +can be anywhere from 2x to 0.2x the speed of `serde-wasm-bindgen`, depending on +the JS runtime and the values being passed. It also leads to larger code size +than `serde-wasm-bindgen`. So, make sure to profile each for your own use +cases. + +This approach is implemented in [`gloo_utils::format::JsValueSerdeExt`]: + +```toml +# Cargo.toml +[dependencies] +gloo-utils = { version = "0.1", features = ["serde"] } +``` + +```rust +use gloo_utils::format::JsValueSerdeExt; + +#[wasm_bindgen] +pub fn send_example_to_js() -> JsValue { + let mut field1 = HashMap::new(); + field1.insert(0, String::from("ex")); + let example = Example { + field1, + field2: vec![vec![1., 2.], vec![3., 4.]], + field3: [1., 2., 3., 4.] + }; + + JsValue::from_serde(&example).unwrap() +} + +#[wasm_bindgen] +pub fn receive_example_from_js(val: JsValue) { + let example: Example = val.into_serde().unwrap(); + ... +} +``` + +[`gloo_utils::format::JsValueSerdeExt`]: https://docs.rs/gloo-utils/latest/gloo_utils/format/trait.JsValueSerdeExt.html + +## History + +In previous versions of `wasm-bindgen`, `gloo-utils`'s JSON-based Serde support +(`JsValue::from_serde` and `JsValue::into_serde`) was built into `wasm-bindgen` +itself. However, this required a dependency on `serde_json`, which had a +problem: with certain features of `serde_json` and other crates enabled, +`serde_json` would end up with a circular dependency on `wasm-bindgen`, which +is illegal in Rust and caused people's code to fail to compile. So, these +methods were extracted out into `gloo-utils` with an extension trait and the +originals were deprecated. diff --git a/src/lib.rs b/src/lib.rs index 7f3e82f7337..6ad4be8a6a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -201,6 +201,14 @@ impl JsValue { /// Creates a new `JsValue` from the JSON serialization of the object `t` /// provided. /// + /// **This function is deprecated**, due to [creating a dependency cycle in + /// some circumstances][dep-cycle-issue]. Use [`serde-wasm-bindgen`] or + /// [`gloo_utils::format::JsValueSerdeExt`] instead. + /// + /// [dep-cycle-issue]: https://github.com/rustwasm/wasm-bindgen/issues/2770 + /// [`serde-wasm-bindgen`]: https://docs.rs/serde-wasm-bindgen + /// [`gloo_utils::format::JsValueSerdeExt`]: https://docs.rs/gloo-utils/latest/gloo_utils/format/trait.JsValueSerdeExt.html + /// /// This function will serialize the provided value `t` to a JSON string, /// send the JSON string to JS, parse it into a JS object, and then return /// a handle to the JS object. This is unlikely to be super speedy so it's @@ -214,6 +222,7 @@ impl JsValue { /// /// Returns any error encountered when serializing `T` into JSON. #[cfg(feature = "serde-serialize")] + #[deprecated = "causes dependency cycles, use `serde-wasm-bindgen` or `gloo_utils::format::JsValueSerdeExt` instead"] pub fn from_serde(t: &T) -> serde_json::Result where T: serde::ser::Serialize + ?Sized, @@ -225,6 +234,14 @@ impl JsValue { /// Invokes `JSON.stringify` on this value and then parses the resulting /// JSON into an arbitrary Rust value. /// + /// **This function is deprecated**, due to [creating a dependency cycle in + /// some circumstances][dep-cycle-issue]. Use [`serde-wasm-bindgen`] or + /// [`gloo_utils::format::JsValueSerdeExt`] instead. + /// + /// [dep-cycle-issue]: https://github.com/rustwasm/wasm-bindgen/issues/2770 + /// [`serde-wasm-bindgen`]: https://docs.rs/serde-wasm-bindgen + /// [`gloo_utils::format::JsValueSerdeExt`]: https://docs.rs/gloo-utils/latest/gloo_utils/format/trait.JsValueSerdeExt.html + /// /// This function will first call `JSON.stringify` on the `JsValue` itself. /// The resulting string is then passed into Rust which then parses it as /// JSON into the resulting value. @@ -236,6 +253,7 @@ impl JsValue { /// /// Returns any error encountered when parsing the JSON into a `T`. #[cfg(feature = "serde-serialize")] + #[deprecated = "causes dependency cycles, use `serde-wasm-bindgen` or `gloo_utils::format::JsValueSerdeExt` instead"] pub fn into_serde(&self) -> serde_json::Result where T: for<'a> serde::de::Deserialize<'a>, From 2e1b344cba40b2cda9e544a9f494136b0ca1bbcc Mon Sep 17 00:00:00 2001 From: Gunnlaugur Thor Briem Date: Tue, 30 Aug 2022 11:42:01 +0000 Subject: [PATCH 069/641] doc: mention inferior type support of JSON approach (#3047) --- guide/src/reference/arbitrary-data-with-serde.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guide/src/reference/arbitrary-data-with-serde.md b/guide/src/reference/arbitrary-data-with-serde.md index c46e2464fd7..fba113b0689 100644 --- a/guide/src/reference/arbitrary-data-with-serde.md +++ b/guide/src/reference/arbitrary-data-with-serde.md @@ -99,7 +99,9 @@ requires a lot of calls back and forth between Rust and JavaScript, which can sometimes be slow. An alternative way of doing this is to serialize values to JSON, and then parse them on the other end. Browsers' JSON implementations are usually quite fast, and so this approach can outstrip `serde-wasm-bindgen`'s -performance in some cases. +performance in some cases. But this approach supports only types that can be +serialized as JSON, leaving out some important types that `serde-wasm-bindgen` +supports such as `Map`, `Set`, and array buffers. That's not to say that using JSON is always faster, though - the JSON approach can be anywhere from 2x to 0.2x the speed of `serde-wasm-bindgen`, depending on From 1b9dc079e37546d1aa76dcae8dc09011b67b173d Mon Sep 17 00:00:00 2001 From: Callum Ferguson Date: Tue, 30 Aug 2022 15:37:39 -0600 Subject: [PATCH 070/641] doc: include attribute position for vertex attrib pointer (#3050) --- examples/webgl/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/webgl/src/lib.rs b/examples/webgl/src/lib.rs index 34c7a4f6a13..88fc5c9ef4a 100644 --- a/examples/webgl/src/lib.rs +++ b/examples/webgl/src/lib.rs @@ -72,7 +72,14 @@ pub fn start() -> Result<(), JsValue> { .ok_or("Could not create vertex array object")?; context.bind_vertex_array(Some(&vao)); - context.vertex_attrib_pointer_with_i32(0, 3, WebGl2RenderingContext::FLOAT, false, 0, 0); + context.vertex_attrib_pointer_with_i32( + position_attribute_location as u32, + 3, + WebGl2RenderingContext::FLOAT, + false, + 0, + 0, + ); context.enable_vertex_attrib_array(position_attribute_location as u32); context.bind_vertex_array(Some(&vao)); From da303aa81ed09d9236058853c5467a9200820ba1 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Wed, 31 Aug 2022 18:12:42 +0100 Subject: [PATCH 071/641] Allow returning Result from tests (#3051) Makes it possible to use the newer `-> Result<(), E>` way of reporting test failures instead of just panicking in `#[wasm_bindgen_test]`, similarly to how you can do that in regular `#[test]`. Resolves #2565. --- crates/test/sample/tests/common/mod.rs | 29 +++++++++++++++++---- crates/test/src/rt/mod.rs | 35 ++++++++++++++++++++------ 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/crates/test/sample/tests/common/mod.rs b/crates/test/sample/tests/common/mod.rs index 0f729006e2c..35d42654069 100644 --- a/crates/test/sample/tests/common/mod.rs +++ b/crates/test/sample/tests/common/mod.rs @@ -10,9 +10,9 @@ fn pass() { #[wasm_bindgen_test] async fn pass_after_2s() { console_log!("immediate log"); - Timeout::new(Duration::new(1, 0)).await; + Timeout::new(Duration::from_secs(1)).await; console_log!("log after 1s"); - Timeout::new(Duration::new(1, 0)).await; + Timeout::new(Duration::from_secs(1)).await; console_log!("log at end"); } @@ -25,10 +25,29 @@ fn fail() { #[wasm_bindgen_test] async fn fail_after_3s() { console_log!("immediate log"); - Timeout::new(Duration::new(1, 0)).await; + Timeout::new(Duration::from_secs(1)).await; console_log!("log after 1s"); - Timeout::new(Duration::new(1, 0)).await; + Timeout::new(Duration::from_secs(1)).await; console_log!("log after 2s"); - Timeout::new(Duration::new(1, 0)).await; + Timeout::new(Duration::from_secs(1)).await; panic!("end"); } + +#[wasm_bindgen_test] +fn result_fail() -> Result<(), Box> { + Err("failed via Result".into()) +} + +#[wasm_bindgen_test] +async fn result_fail_after_1s() -> Result<(), Box> { + Timeout::new(Duration::from_secs(1)).await; + Err("failed via Result".into()) +} + +#[wasm_bindgen_test] +fn panic_before_result_fail() -> Result<(), Box> { + panic!("panic before Result fail"); + + #[allow(unreachable_code)] + Err("failed via Result".into()) +} diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index ad989426bdd..e33d6e32317 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -354,11 +354,29 @@ fn record(args: &Array, dst: impl FnOnce(&mut Output) -> &mut String) { }); } +/// Similar to [`std::process::Termination`], but for wasm-bindgen tests. +pub trait Termination { + /// Convert this into a JS result. + fn into_js_result(self) -> Result<(), JsValue>; +} + +impl Termination for () { + fn into_js_result(self) -> Result<(), JsValue> { + Ok(()) + } +} + +impl Termination for Result<(), E> { + fn into_js_result(self) -> Result<(), JsValue> { + self.map_err(|e| JsError::new(&format!("{:?}", e)).into()) + } +} + impl Context { /// Entry point for a synchronous test in wasm. The `#[wasm_bindgen_test]` /// macro generates invocations of this method. - pub fn execute_sync(&self, name: &str, f: impl FnOnce() + 'static) { - self.execute(name, async { f() }); + pub fn execute_sync(&self, name: &str, f: impl 'static + FnOnce() -> T) { + self.execute(name, async { f().into_js_result() }); } /// Entry point for an asynchronous in wasm. The @@ -366,12 +384,13 @@ impl Context { /// method. pub fn execute_async(&self, name: &str, f: impl FnOnce() -> F + 'static) where - F: Future + 'static, + F: Future + 'static, + F::Output: Termination, { - self.execute(name, async { f().await }) + self.execute(name, async { f().await.into_js_result() }) } - fn execute(&self, name: &str, test: impl Future + 'static) { + fn execute(&self, name: &str, test: impl Future> + 'static) { // If our test is filtered out, record that it was filtered and move // on, nothing to do here. let filter = self.state.filter.borrow(); @@ -556,8 +575,8 @@ extern "C" { fn __wbg_test_invoke(f: &mut dyn FnMut()) -> Result<(), JsValue>; } -impl Future for TestFuture { - type Output = Result; +impl>> Future for TestFuture { + type Output = F::Output; fn poll(self: Pin<&mut Self>, cx: &mut task::Context) -> Poll { let output = self.output.clone(); @@ -573,7 +592,7 @@ impl Future for TestFuture { }) }); match (result, future_output) { - (_, Some(Poll::Ready(e))) => Poll::Ready(Ok(e)), + (_, Some(Poll::Ready(result))) => Poll::Ready(result), (_, Some(Poll::Pending)) => Poll::Pending, (Err(e), _) => Poll::Ready(Err(e)), (Ok(_), None) => wasm_bindgen::throw_str("invalid poll state"), From b734d34258d313feb28addba88129265ede3cc27 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Wed, 31 Aug 2022 21:34:58 +0100 Subject: [PATCH 072/641] Better BigInt conversions (#3049) --- crates/cli-support/src/intrinsic.rs | 16 +++++++++++-- crates/cli-support/src/js/mod.rs | 12 +++++++++- src/lib.rs | 22 +++++++++++++----- tests/wasm/{u64.js => bigint.js} | 36 +++++++++++++++++++++-------- tests/wasm/{u64.rs => bigint.rs} | 22 +++++++++++++++++- tests/wasm/main.rs | 2 +- 6 files changed, 89 insertions(+), 21 deletions(-) rename tests/wasm/{u64.js => bigint.js} (63%) rename tests/wasm/{u64.rs => bigint.rs} (69%) diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index efdc131ca21..c8d4436a451 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -193,9 +193,21 @@ intrinsics! { #[symbol = "__wbindgen_number_new"] #[signature = fn(F64) -> Externref] NumberNew, - #[symbol = "__wbindgen_bigint_new"] + #[symbol = "__wbindgen_bigint_from_str"] #[signature = fn(ref_string()) -> Externref] - BigIntNew, + BigIntFromStr, + #[symbol = "__wbindgen_bigint_from_i64"] + #[signature = fn(I64) -> Externref] + BigIntFromI64, + #[symbol = "__wbindgen_bigint_from_u64"] + #[signature = fn(U64) -> Externref] + BigIntFromU64, + #[symbol = "__wbindgen_bigint_from_i128"] + #[signature = fn(I64, U64) -> Externref] + BigIntFromI128, + #[symbol = "__wbindgen_bigint_from_u128"] + #[signature = fn(U64, U64) -> Externref] + BigIntFromU128, #[symbol = "__wbindgen_string_new"] #[signature = fn(ref_string()) -> Externref] StringNew, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 063100f43ae..9b733dd1e41 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3323,11 +3323,21 @@ impl<'a> Context<'a> { args[0].clone() } - Intrinsic::BigIntNew => { + Intrinsic::BigIntFromStr => { assert_eq!(args.len(), 1); format!("BigInt({})", args[0]) } + Intrinsic::BigIntFromI64 | Intrinsic::BigIntFromU64 => { + assert_eq!(args.len(), 1); + args[0].clone() + } + + Intrinsic::BigIntFromI128 | Intrinsic::BigIntFromU128 => { + assert_eq!(args.len(), 2); + format!("{} << BigInt(64) | {}", args[0], args[1]) + } + Intrinsic::StringNew => { assert_eq!(args.len(), 1); args[0].clone() diff --git a/src/lib.rs b/src/lib.rs index 6ad4be8a6a5..b286dca3f5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -154,7 +154,7 @@ impl JsValue { /// allocated large integer) and returns a handle to the JS version of it. #[inline] pub fn bigint_from_str(s: &str) -> JsValue { - unsafe { JsValue::_new(__wbindgen_bigint_new(s.as_ptr(), s.len())) } + unsafe { JsValue::_new(__wbindgen_bigint_from_str(s.as_ptr(), s.len())) } } /// Creates a new JS value which is a boolean. @@ -868,7 +868,7 @@ macro_rules! numbers { numbers! { i8 u8 i16 u16 i32 u32 f32 f64 } macro_rules! big_numbers { - ($($n:ident)*) => ($( + (|$arg:ident|, $($n:ident = $handle:expr,)*) => ($( impl PartialEq<$n> for JsValue { #[inline] fn eq(&self, other: &$n) -> bool { @@ -878,14 +878,20 @@ macro_rules! big_numbers { impl From<$n> for JsValue { #[inline] - fn from(n: $n) -> JsValue { - JsValue::bigint_from_str(&n.to_string()) + fn from($arg: $n) -> JsValue { + unsafe { JsValue::_new($handle) } } } )*) } -big_numbers! { i64 u64 i128 u128 } +big_numbers! { + |n|, + i64 = __wbindgen_bigint_from_i64(n), + u64 = __wbindgen_bigint_from_u64(n), + i128 = __wbindgen_bigint_from_i128((n >> 64) as i64, n as u64), + u128 = __wbindgen_bigint_from_u128((n >> 64) as u64, n as u64), +} // `usize` and `isize` have to be treated a bit specially, because we know that // they're 32-bit but the compiler conservatively assumes they might be bigger. @@ -926,7 +932,11 @@ externs! { fn __wbindgen_string_new(ptr: *const u8, len: usize) -> u32; fn __wbindgen_number_new(f: f64) -> u32; - fn __wbindgen_bigint_new(ptr: *const u8, len: usize) -> u32; + fn __wbindgen_bigint_from_str(ptr: *const u8, len: usize) -> u32; + fn __wbindgen_bigint_from_i64(n: i64) -> u32; + fn __wbindgen_bigint_from_u64(n: u64) -> u32; + fn __wbindgen_bigint_from_i128(hi: i64, lo: u64) -> u32; + fn __wbindgen_bigint_from_u128(hi: u64, lo: u64) -> u32; fn __wbindgen_symbol_named_new(ptr: *const u8, len: usize) -> u32; fn __wbindgen_symbol_anonymous_new() -> u32; diff --git a/tests/wasm/u64.js b/tests/wasm/bigint.js similarity index 63% rename from tests/wasm/u64.js rename to tests/wasm/bigint.js index 5555e0659c7..3971d2279d4 100644 --- a/tests/wasm/u64.js +++ b/tests/wasm/bigint.js @@ -13,17 +13,33 @@ exports.js_works = () => { assert.strictEqual(wasm.i64_min(), BigInt('-9223372036854775808')); assert.strictEqual(wasm.u64_max(), BigInt('18446744073709551615')); - assert.strictEqual(wasm.i64_rust_identity(BigInt('0')), BigInt('0')); - assert.strictEqual(wasm.i64_rust_identity(BigInt('1')), BigInt('1')); - assert.strictEqual(wasm.i64_rust_identity(BigInt('-1')), BigInt('-1')); - assert.strictEqual(wasm.u64_rust_identity(BigInt('0')), BigInt('0')); - assert.strictEqual(wasm.u64_rust_identity(BigInt('1')), BigInt('1')); - assert.strictEqual(wasm.u64_rust_identity(BigInt('1') << BigInt('64')), BigInt('0')); - - const u64_max = BigInt('18446744073709551615'); const i64_min = BigInt('-9223372036854775808'); - assert.strictEqual(wasm.i64_rust_identity(i64_min), i64_min); - assert.strictEqual(wasm.u64_rust_identity(u64_max), u64_max); + const u64_max = BigInt('18446744073709551615'); + + const identityTestI64Values = [ + BigInt('0'), + BigInt('1'), + BigInt('-1'), + i64_min, + ]; + for (const value of identityTestI64Values) { + assert.strictEqual(wasm.i64_rust_identity(value), value); + assert.strictEqual(wasm.i64_jsvalue_identity(value), value); + } + + const identityTestU64Values = [ + BigInt('0'), + BigInt('1'), + u64_max, + ]; + for (const value of identityTestU64Values) { + assert.strictEqual(wasm.u64_rust_identity(value), value); + assert.strictEqual(wasm.u64_jsvalue_identity(value), value); + } + + assert.strictEqual(wasm.u64_rust_identity(BigInt('1') << BigInt('64')), BigInt('0')); + assert.strictEqual(wasm.i128_min_jsvalue(), BigInt('-170141183460469231731687303715884105728')); + assert.strictEqual(wasm.u128_max_jsvalue(), BigInt('340282366920938463463374607431768211455')); assert.deepStrictEqual(wasm.u64_slice([]), new BigUint64Array()); assert.deepStrictEqual(wasm.i64_slice([]), new BigInt64Array()); diff --git a/tests/wasm/u64.rs b/tests/wasm/bigint.rs similarity index 69% rename from tests/wasm/u64.rs rename to tests/wasm/bigint.rs index 0165c6a20c1..7f5714e2b06 100644 --- a/tests/wasm/u64.rs +++ b/tests/wasm/bigint.rs @@ -1,7 +1,7 @@ use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; -#[wasm_bindgen(module = "tests/wasm/u64.js")] +#[wasm_bindgen(module = "tests/wasm/bigint.js")] extern "C" { fn i64_js_identity(a: i64) -> i64; fn u64_js_identity(a: u64) -> u64; @@ -53,6 +53,26 @@ pub fn u64_rust_identity(a: u64) -> u64 { u64_js_identity(a) } +#[wasm_bindgen] +pub fn i64_jsvalue_identity(a: i64) -> JsValue { + JsValue::from(a) +} + +#[wasm_bindgen] +pub fn u64_jsvalue_identity(a: u64) -> JsValue { + JsValue::from(a) +} + +#[wasm_bindgen] +pub fn i128_min_jsvalue() -> JsValue { + JsValue::from(i128::min_value()) +} + +#[wasm_bindgen] +pub fn u128_max_jsvalue() -> JsValue { + JsValue::from(u128::max_value()) +} + #[wasm_bindgen] pub fn i64_slice(a: &[i64]) -> Vec { a.to_vec() diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 2d3b9b5baf2..51e6dcafed5 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -14,6 +14,7 @@ use wasm_bindgen::prelude::*; pub mod api; pub mod arg_names; +pub mod bigint; pub mod char; pub mod classes; pub mod closures; @@ -43,7 +44,6 @@ pub mod simple; pub mod slice; pub mod structural; pub mod truthy_falsy; -pub mod u64; pub mod usize; pub mod validate_prt; pub mod variadic; From e8a499c36b41e197c7a1bd95050c73a6148e3f07 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Wed, 31 Aug 2022 16:42:08 -0400 Subject: [PATCH 073/641] web-sys: Added full Streams WebIDL (#3046) * Added full Streams living standard * Regenerated web-sys files * Removed duplicate Stream API IDLs * Regenerated web-sys files --- .../features/gen_ByteLengthQueuingStrategy.rs | 36 +++ .../src/features/gen_CountQueuingStrategy.rs | 36 +++ .../src/features/gen_QueuingStrategyInit.rs | 40 +++ .../gen_ReadableByteStreamController.rs | 67 ++++++ .../src/features/gen_ReadableStream.rs | 8 - .../gen_ReadableStreamByobReadResult.rs | 70 ------ .../features/gen_ReadableStreamByobReader.rs | 32 --- .../features/gen_ReadableStreamByobRequest.rs | 52 ++++ .../gen_ReadableStreamDefaultController.rs | 59 +++++ .../gen_ReadableStreamDefaultReadResult.rs | 70 ------ .../gen_ReadableStreamDefaultReader.rs | 28 --- .../features/gen_ReadableStreamReadResult.rs | 53 ++++ .../src/features/gen_ReadableStreamType.rs | 10 + .../src/features/gen_ReadableWritablePair.rs | 8 - .../src/features/gen_TransformStream.rs | 12 - .../gen_TransformStreamDefaultController.rs | 62 +++++ .../web-sys/src/features/gen_Transformer.rs | 104 ++++++++ .../src/features/gen_UnderlyingSink.rs | 92 +++++++ .../src/features/gen_UnderlyingSource.rs | 98 ++++++++ .../src/features/gen_WritableStream.rs | 24 -- .../gen_WritableStreamDefaultController.rs | 36 +++ .../gen_WritableStreamDefaultWriter.rs | 44 ---- crates/web-sys/src/features/mod.rs | 86 ++++++- .../webidls/enabled/ReadableStream.webidl | 47 ---- crates/web-sys/webidls/enabled/Streams.webidl | 227 ++++++++++++++++++ .../unstable/ReadableStreamBYOBReader.webidl | 22 -- .../ReadableStreamDefaultReader.webidl | 22 -- .../ReadableStreamGenericReader.webidl | 14 -- .../webidls/unstable/TransformStream.webidl | 16 -- .../webidls/unstable/WritableStream.webidl | 19 -- .../WritableStreamDefaultWriter.webidl | 22 -- 31 files changed, 1048 insertions(+), 468 deletions(-) create mode 100644 crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs create mode 100644 crates/web-sys/src/features/gen_CountQueuingStrategy.rs create mode 100644 crates/web-sys/src/features/gen_QueuingStrategyInit.rs create mode 100644 crates/web-sys/src/features/gen_ReadableByteStreamController.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamType.rs create mode 100644 crates/web-sys/src/features/gen_TransformStreamDefaultController.rs create mode 100644 crates/web-sys/src/features/gen_Transformer.rs create mode 100644 crates/web-sys/src/features/gen_UnderlyingSink.rs create mode 100644 crates/web-sys/src/features/gen_UnderlyingSource.rs create mode 100644 crates/web-sys/src/features/gen_WritableStreamDefaultController.rs delete mode 100644 crates/web-sys/webidls/enabled/ReadableStream.webidl create mode 100644 crates/web-sys/webidls/enabled/Streams.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/TransformStream.webidl delete mode 100644 crates/web-sys/webidls/unstable/WritableStream.webidl delete mode 100644 crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl diff --git a/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs b/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs new file mode 100644 index 00000000000..c29737f5378 --- /dev/null +++ b/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ByteLengthQueuingStrategy , typescript_type = "ByteLengthQueuingStrategy")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ByteLengthQueuingStrategy` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`*"] + pub type ByteLengthQueuingStrategy; + # [wasm_bindgen (structural , method , getter , js_class = "ByteLengthQueuingStrategy" , js_name = highWaterMark)] + #[doc = "Getter for the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)"] + #[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)] + #[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; + #[cfg(feature = "QueuingStrategyInit")] + #[wasm_bindgen(catch, constructor, js_class = "ByteLengthQueuingStrategy")] + #[doc = "The `new ByteLengthQueuingStrategy(..)` constructor, creating a new instance of `ByteLengthQueuingStrategy`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/ByteLengthQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`, `QueuingStrategyInit`*"] + pub fn new(init: &QueuingStrategyInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_CountQueuingStrategy.rs b/crates/web-sys/src/features/gen_CountQueuingStrategy.rs new file mode 100644 index 00000000000..779ba5b5b5d --- /dev/null +++ b/crates/web-sys/src/features/gen_CountQueuingStrategy.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = CountQueuingStrategy , typescript_type = "CountQueuingStrategy")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `CountQueuingStrategy` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`*"] + pub type CountQueuingStrategy; + # [wasm_bindgen (structural , method , getter , js_class = "CountQueuingStrategy" , js_name = highWaterMark)] + #[doc = "Getter for the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/highWaterMark)"] + #[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)] + #[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; + #[cfg(feature = "QueuingStrategyInit")] + #[wasm_bindgen(catch, constructor, js_class = "CountQueuingStrategy")] + #[doc = "The `new CountQueuingStrategy(..)` constructor, creating a new instance of `CountQueuingStrategy`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/CountQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`, `QueuingStrategyInit`*"] + pub fn new(init: &QueuingStrategyInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs new file mode 100644 index 00000000000..89141292fbc --- /dev/null +++ b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs @@ -0,0 +1,40 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = QueuingStrategyInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `QueuingStrategyInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub type QueuingStrategyInit; +} +impl QueuingStrategyInit { + #[doc = "Construct a new `QueuingStrategyInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub fn new(high_water_mark: f64) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.high_water_mark(high_water_mark); + ret + } + #[doc = "Change the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub fn high_water_mark(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("highWaterMark"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs new file mode 100644 index 00000000000..6fed9016f1c --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs @@ -0,0 +1,67 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableByteStreamController , typescript_type = "ReadableByteStreamController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableByteStreamController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController)"] + #[doc = ""] + #[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)] + #[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; + # [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; + # [wasm_bindgen (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)] + #[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_array_buffer_view( + this: &ReadableByteStreamController, + chunk: &::js_sys::Object, + ); + # [wasm_bindgen (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)] + #[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)] + #[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); +} diff --git a/crates/web-sys/src/features/gen_ReadableStream.rs b/crates/web-sys/src/features/gen_ReadableStream.rs index a68f982b964..c66b913be9e 100644 --- a/crates/web-sys/src/features/gen_ReadableStream.rs +++ b/crates/web-sys/src/features/gen_ReadableStream.rs @@ -112,7 +112,6 @@ extern "C" { transform: &ReadableWritablePair, options: &StreamPipeOptions, ) -> ReadableStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -120,11 +119,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to(this: &ReadableStream, destination: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "StreamPipeOptions", feature = "WritableStream",))] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -132,9 +127,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `StreamPipeOptions`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to_with_options( this: &ReadableStream, destination: &WritableStream, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs deleted file mode 100644 index eb58aeca844..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReadResult)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamByobReadResult` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type ReadableStreamByobReadResult; -} -#[cfg(web_sys_unstable_apis)] -impl ReadableStreamByobReadResult { - #[doc = "Construct a new `ReadableStreamByobReadResult`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -#[cfg(web_sys_unstable_apis)] -impl Default for ReadableStreamByobReadResult { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs index a630495bad7..1f051255192 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReader , typescript_type = "ReadableStreamBYOBReader")] @@ -11,22 +10,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamByobReader; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamByobReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamBYOBReader")] #[doc = "The `new ReadableStreamByobReader(..)` constructor, creating a new instance of `ReadableStreamByobReader`."] @@ -34,70 +25,47 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_array_buffer_view( this: &ReadableStreamByobReader, view: &::js_sys::Object, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_u8_array( this: &ReadableStreamByobReader, view: &mut [u8], ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamByobReader); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamByobReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamByobReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs new file mode 100644 index 00000000000..44eac4614ab --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs @@ -0,0 +1,52 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBRequest , typescript_type = "ReadableStreamBYOBRequest")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamByobRequest` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"] + pub type ReadableStreamByobRequest; + # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBRequest" , js_name = view)] + #[doc = "Getter for the `view` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/view)"] + #[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)] + #[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)] + #[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)] + #[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_array_buffer_view( + this: &ReadableStreamByobRequest, + view: &::js_sys::Object, + ); + # [wasm_bindgen (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]); +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs new file mode 100644 index 00000000000..d623f4b0ad0 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs @@ -0,0 +1,59 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultController , typescript_type = "ReadableStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] + pub type ReadableStreamDefaultController; + # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultController" , 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/ReadableStreamDefaultController/desiredSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] + pub fn desired_size(this: &ReadableStreamDefaultController) -> Option; + # [wasm_bindgen (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)] + #[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)] + #[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_with_chunk( + this: &ReadableStreamDefaultController, + chunk: &::wasm_bindgen::JsValue, + ); + # [wasm_bindgen (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)] + #[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); +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs deleted file mode 100644 index 82bbf8ca1e1..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReadResult)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamDefaultReadResult` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type ReadableStreamDefaultReadResult; -} -#[cfg(web_sys_unstable_apis)] -impl ReadableStreamDefaultReadResult { - #[doc = "Construct a new `ReadableStreamDefaultReadResult`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -#[cfg(web_sys_unstable_apis)] -impl Default for ReadableStreamDefaultReadResult { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs index e47c2a3073f..6b12a74ca6b 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReader , typescript_type = "ReadableStreamDefaultReader")] @@ -11,22 +10,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamDefaultReader; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamDefaultReader")] #[doc = "The `new ReadableStreamDefaultReader(..)` constructor, creating a new instance of `ReadableStreamDefaultReader`."] @@ -34,53 +25,34 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamDefaultReader); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamDefaultReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs new file mode 100644 index 00000000000..794dc0e9b0a --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs @@ -0,0 +1,53 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamReadResult)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamReadResult` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub type ReadableStreamReadResult; +} +impl ReadableStreamReadResult { + #[doc = "Construct a new `ReadableStreamReadResult`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn done(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for ReadableStreamReadResult { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamType.rs b/crates/web-sys/src/features/gen_ReadableStreamType.rs new file mode 100644 index 00000000000..5bbe4467f36 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamType.rs @@ -0,0 +1,10 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ReadableStreamType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ReadableStreamType { + Bytes = "bytes", +} diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index 0ce861e74ab..8a34d98aca5 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -11,14 +11,10 @@ extern "C" { pub type ReadableWritablePair; } impl ReadableWritablePair { - #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))] #[doc = "Construct a new `ReadableWritablePair`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); @@ -44,14 +40,10 @@ impl ReadableWritablePair { let _ = r; self } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[doc = "Change the `writable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(&mut self, val: &WritableStream) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( diff --git a/crates/web-sys/src/features/gen_TransformStream.rs b/crates/web-sys/src/features/gen_TransformStream.rs index d2a041a700c..9dd64d45d33 100644 --- a/crates/web-sys/src/features/gen_TransformStream.rs +++ b/crates/web-sys/src/features/gen_TransformStream.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStream , typescript_type = "TransformStream")] @@ -11,11 +10,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TransformStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = readable)] #[doc = "Getter for the `readable` field of this object."] @@ -23,11 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/readable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `TransformStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn readable(this: &TransformStream) -> ReadableStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = writable)] #[doc = "Getter for the `writable` field of this object."] @@ -35,9 +26,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/writable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(this: &TransformStream) -> WritableStream; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "TransformStream")] diff --git a/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs b/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs new file mode 100644 index 00000000000..4add045b0c0 --- /dev/null +++ b/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs @@ -0,0 +1,62 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStreamDefaultController , typescript_type = "TransformStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TransformStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub type TransformStreamDefaultController; + # [wasm_bindgen (structural , method , getter , js_class = "TransformStreamDefaultController" , 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/TransformStreamDefaultController/desiredSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn desired_size(this: &TransformStreamDefaultController) -> Option; + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] + #[doc = "The `enqueue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn enqueue(this: &TransformStreamDefaultController); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] + #[doc = "The `enqueue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn enqueue_with_chunk( + this: &TransformStreamDefaultController, + chunk: &::wasm_bindgen::JsValue, + ); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn error(this: &TransformStreamDefaultController); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn error_with_reason( + this: &TransformStreamDefaultController, + reason: &::wasm_bindgen::JsValue, + ); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = terminate)] + #[doc = "The `terminate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/terminate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn terminate(this: &TransformStreamDefaultController); +} diff --git a/crates/web-sys/src/features/gen_Transformer.rs b/crates/web-sys/src/features/gen_Transformer.rs new file mode 100644 index 00000000000..c0dddae0727 --- /dev/null +++ b/crates/web-sys/src/features/gen_Transformer.rs @@ -0,0 +1,104 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Transformer)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Transformer` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub type Transformer; +} +impl Transformer { + #[doc = "Construct a new `Transformer`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn flush(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flush"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `readableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn readable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("readableType"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn transform(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("transform"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `writableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn writable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("writableType"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for Transformer { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_UnderlyingSink.rs b/crates/web-sys/src/features/gen_UnderlyingSink.rs new file mode 100644 index 00000000000..dd69488671c --- /dev/null +++ b/crates/web-sys/src/features/gen_UnderlyingSink.rs @@ -0,0 +1,92 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSink)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UnderlyingSink` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub type UnderlyingSink; +} +impl UnderlyingSink { + #[doc = "Construct a new `UnderlyingSink`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `abort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn abort(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("abort"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `close` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn close(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("close"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn type_(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn write(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("write"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for UnderlyingSink { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_UnderlyingSource.rs b/crates/web-sys/src/features/gen_UnderlyingSource.rs new file mode 100644 index 00000000000..a6a90943179 --- /dev/null +++ b/crates/web-sys/src/features/gen_UnderlyingSource.rs @@ -0,0 +1,98 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSource)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UnderlyingSource` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub type UnderlyingSource; +} +impl UnderlyingSource { + #[doc = "Construct a new `UnderlyingSource`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `autoAllocateChunkSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn auto_allocate_chunk_size(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("autoAllocateChunkSize"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `cancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn cancel(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cancel"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `pull` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn pull(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pull"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ReadableStreamType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] + pub fn type_(&mut self, val: ReadableStreamType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for UnderlyingSource { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WritableStream.rs b/crates/web-sys/src/features/gen_WritableStream.rs index 7f9ed141e58..d4123011279 100644 --- a/crates/web-sys/src/features/gen_WritableStream.rs +++ b/crates/web-sys/src/features/gen_WritableStream.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStream , typescript_type = "WritableStream")] @@ -11,20 +10,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStream; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStream" , js_name = locked)] #[doc = "Getter for the `locked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn locked(this: &WritableStream) -> bool; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "WritableStream")] @@ -65,43 +57,30 @@ extern "C" { underlying_sink: &::js_sys::Object, strategy: &QueuingStrategy, ) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStream, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStreamDefaultWriter")] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = getWriter)] #[doc = "The `getWriter()` method."] @@ -109,8 +88,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_writer(this: &WritableStream) -> WritableStreamDefaultWriter; } diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs new file mode 100644 index 00000000000..424a635c96a --- /dev/null +++ b/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultController , typescript_type = "WritableStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WritableStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub type WritableStreamDefaultController; + #[cfg(feature = "AbortSignal")] + # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultController" , js_name = signal)] + #[doc = "Getter for the `signal` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/signal)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WritableStreamDefaultController`*"] + pub fn signal(this: &WritableStreamDefaultController) -> AbortSignal; + # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub fn error(this: &WritableStreamDefaultController); + # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub fn error_with_e(this: &WritableStreamDefaultController, e: &::wasm_bindgen::JsValue); +} diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs index 1ba5bd8b6ce..b52551db43d 100644 --- a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs +++ b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultWriter , typescript_type = "WritableStreamDefaultWriter")] @@ -11,44 +10,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStreamDefaultWriter; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , 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/WritableStreamDefaultWriter/desiredSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn desired_size(this: &WritableStreamDefaultWriter) -> Option; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = ready)] #[doc = "Getter for the `ready` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/ready)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ready(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[wasm_bindgen(catch, constructor, js_class = "WritableStreamDefaultWriter")] #[doc = "The `new WritableStreamDefaultWriter(..)` constructor, creating a new instance of `WritableStreamDefaultWriter`."] @@ -56,78 +39,51 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &WritableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStreamDefaultWriter, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = releaseLock)] #[doc = "The `releaseLock()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/releaseLock)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &WritableStreamDefaultWriter); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_with_chunk( this: &WritableStreamDefaultWriter, chunk: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 59d6818792d..dfb2a94cac1 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -718,6 +718,12 @@ mod gen_BrowserFindDirection; #[cfg(feature = "BrowserFindDirection")] pub use gen_BrowserFindDirection::*; +#[cfg(feature = "ByteLengthQueuingStrategy")] +#[allow(non_snake_case)] +mod gen_ByteLengthQueuingStrategy; +#[cfg(feature = "ByteLengthQueuingStrategy")] +pub use gen_ByteLengthQueuingStrategy::*; + #[cfg(feature = "Cache")] #[allow(non_snake_case)] mod gen_Cache; @@ -1156,6 +1162,12 @@ mod gen_Coordinates; #[cfg(feature = "Coordinates")] pub use gen_Coordinates::*; +#[cfg(feature = "CountQueuingStrategy")] +#[allow(non_snake_case)] +mod gen_CountQueuingStrategy; +#[cfg(feature = "CountQueuingStrategy")] +pub use gen_CountQueuingStrategy::*; + #[cfg(feature = "Credential")] #[allow(non_snake_case)] mod gen_Credential; @@ -5656,6 +5668,12 @@ mod gen_QueuingStrategy; #[cfg(feature = "QueuingStrategy")] pub use gen_QueuingStrategy::*; +#[cfg(feature = "QueuingStrategyInit")] +#[allow(non_snake_case)] +mod gen_QueuingStrategyInit; +#[cfg(feature = "QueuingStrategyInit")] +pub use gen_QueuingStrategyInit::*; + #[cfg(feature = "RadioNodeList")] #[allow(non_snake_case)] mod gen_RadioNodeList; @@ -5680,29 +5698,35 @@ mod gen_RcwnStatus; #[cfg(feature = "RcwnStatus")] pub use gen_RcwnStatus::*; +#[cfg(feature = "ReadableByteStreamController")] +#[allow(non_snake_case)] +mod gen_ReadableByteStreamController; +#[cfg(feature = "ReadableByteStreamController")] +pub use gen_ReadableByteStreamController::*; + #[cfg(feature = "ReadableStream")] #[allow(non_snake_case)] mod gen_ReadableStream; #[cfg(feature = "ReadableStream")] pub use gen_ReadableStream::*; -#[cfg(feature = "ReadableStreamByobReadResult")] -#[allow(non_snake_case)] -mod gen_ReadableStreamByobReadResult; -#[cfg(feature = "ReadableStreamByobReadResult")] -pub use gen_ReadableStreamByobReadResult::*; - #[cfg(feature = "ReadableStreamByobReader")] #[allow(non_snake_case)] mod gen_ReadableStreamByobReader; #[cfg(feature = "ReadableStreamByobReader")] pub use gen_ReadableStreamByobReader::*; -#[cfg(feature = "ReadableStreamDefaultReadResult")] +#[cfg(feature = "ReadableStreamByobRequest")] #[allow(non_snake_case)] -mod gen_ReadableStreamDefaultReadResult; -#[cfg(feature = "ReadableStreamDefaultReadResult")] -pub use gen_ReadableStreamDefaultReadResult::*; +mod gen_ReadableStreamByobRequest; +#[cfg(feature = "ReadableStreamByobRequest")] +pub use gen_ReadableStreamByobRequest::*; + +#[cfg(feature = "ReadableStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_ReadableStreamDefaultController; +#[cfg(feature = "ReadableStreamDefaultController")] +pub use gen_ReadableStreamDefaultController::*; #[cfg(feature = "ReadableStreamDefaultReader")] #[allow(non_snake_case)] @@ -5722,12 +5746,24 @@ mod gen_ReadableStreamIteratorOptions; #[cfg(feature = "ReadableStreamIteratorOptions")] pub use gen_ReadableStreamIteratorOptions::*; +#[cfg(feature = "ReadableStreamReadResult")] +#[allow(non_snake_case)] +mod gen_ReadableStreamReadResult; +#[cfg(feature = "ReadableStreamReadResult")] +pub use gen_ReadableStreamReadResult::*; + #[cfg(feature = "ReadableStreamReaderMode")] #[allow(non_snake_case)] mod gen_ReadableStreamReaderMode; #[cfg(feature = "ReadableStreamReaderMode")] pub use gen_ReadableStreamReaderMode::*; +#[cfg(feature = "ReadableStreamType")] +#[allow(non_snake_case)] +mod gen_ReadableStreamType; +#[cfg(feature = "ReadableStreamType")] +pub use gen_ReadableStreamType::*; + #[cfg(feature = "ReadableWritablePair")] #[allow(non_snake_case)] mod gen_ReadableWritablePair; @@ -7732,6 +7768,18 @@ mod gen_TransformStream; #[cfg(feature = "TransformStream")] pub use gen_TransformStream::*; +#[cfg(feature = "TransformStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_TransformStreamDefaultController; +#[cfg(feature = "TransformStreamDefaultController")] +pub use gen_TransformStreamDefaultController::*; + +#[cfg(feature = "Transformer")] +#[allow(non_snake_case)] +mod gen_Transformer; +#[cfg(feature = "Transformer")] +pub use gen_Transformer::*; + #[cfg(feature = "TransitionEvent")] #[allow(non_snake_case)] mod gen_TransitionEvent; @@ -7810,6 +7858,18 @@ mod gen_UiEventInit; #[cfg(feature = "UiEventInit")] pub use gen_UiEventInit::*; +#[cfg(feature = "UnderlyingSink")] +#[allow(non_snake_case)] +mod gen_UnderlyingSink; +#[cfg(feature = "UnderlyingSink")] +pub use gen_UnderlyingSink::*; + +#[cfg(feature = "UnderlyingSource")] +#[allow(non_snake_case)] +mod gen_UnderlyingSource; +#[cfg(feature = "UnderlyingSource")] +pub use gen_UnderlyingSource::*; + #[cfg(feature = "Url")] #[allow(non_snake_case)] mod gen_Url; @@ -8626,6 +8686,12 @@ mod gen_WritableStream; #[cfg(feature = "WritableStream")] pub use gen_WritableStream::*; +#[cfg(feature = "WritableStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_WritableStreamDefaultController; +#[cfg(feature = "WritableStreamDefaultController")] +pub use gen_WritableStreamDefaultController::*; + #[cfg(feature = "WritableStreamDefaultWriter")] #[allow(non_snake_case)] mod gen_WritableStreamDefaultWriter; diff --git a/crates/web-sys/webidls/enabled/ReadableStream.webidl b/crates/web-sys/webidls/enabled/ReadableStream.webidl deleted file mode 100644 index 00c8bbc8a4a..00000000000 --- a/crates/web-sys/webidls/enabled/ReadableStream.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#rs-class-definition - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface ReadableStream { - constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise cancel(optional any reason); - ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); - ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); - Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); - sequence tee(); - - async iterable(optional ReadableStreamIteratorOptions options = {}); -}; - -typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; - -enum ReadableStreamReaderMode { "byob" }; - -dictionary ReadableStreamGetReaderOptions { - ReadableStreamReaderMode mode; -}; - -dictionary ReadableStreamIteratorOptions { - boolean preventCancel = false; -}; - -dictionary ReadableWritablePair { - required ReadableStream readable; - required WritableStream writable; -}; - -dictionary StreamPipeOptions { - boolean preventClose = false; - boolean preventAbort = false; - boolean preventCancel = false; - AbortSignal signal; -}; diff --git a/crates/web-sys/webidls/enabled/Streams.webidl b/crates/web-sys/webidls/enabled/Streams.webidl new file mode 100644 index 00000000000..f5d853ff25d --- /dev/null +++ b/crates/web-sys/webidls/enabled/Streams.webidl @@ -0,0 +1,227 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative + * Commons Attribution 4.0 International License. To the extent portions of it are incorporated into + * source code, such portions in the source code are licensed under the BSD 3-Clause License + * instead. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#idl-index + */ + +[Exposed=*, Transferable] +interface ReadableStream { + constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise cancel(optional any reason); + ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); + ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); + Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); + sequence tee(); + + async iterable(optional ReadableStreamIteratorOptions options = {}); +}; + +typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; + +enum ReadableStreamReaderMode { "byob" }; + +dictionary ReadableStreamGetReaderOptions { + ReadableStreamReaderMode mode; +}; + +dictionary ReadableStreamIteratorOptions { + boolean preventCancel = false; +}; + +dictionary ReadableWritablePair { + required ReadableStream readable; + required WritableStream writable; +}; + +dictionary StreamPipeOptions { + boolean preventClose = false; + boolean preventAbort = false; + boolean preventCancel = false; + AbortSignal signal; +}; + +dictionary UnderlyingSource { + UnderlyingSourceStartCallback start; + UnderlyingSourcePullCallback pull; + UnderlyingSourceCancelCallback cancel; + ReadableStreamType type; + [EnforceRange] unsigned long long autoAllocateChunkSize; +}; + +typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; + +callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); +callback UnderlyingSourcePullCallback = Promise (ReadableStreamController controller); +callback UnderlyingSourceCancelCallback = Promise (optional any reason); + +enum ReadableStreamType { "bytes" }; + +interface mixin ReadableStreamGenericReader { + readonly attribute Promise closed; + + Promise cancel(optional any reason); +}; + +[Exposed=*] +interface ReadableStreamDefaultReader { + constructor(ReadableStream stream); + + Promise read(); + undefined releaseLock(); +}; +ReadableStreamDefaultReader includes ReadableStreamGenericReader; + +dictionary ReadableStreamReadResult { + any value; + boolean done; +}; + +[Exposed=*] +interface ReadableStreamBYOBReader { + constructor(ReadableStream stream); + + Promise read(ArrayBufferView view); + undefined releaseLock(); +}; +ReadableStreamBYOBReader includes ReadableStreamGenericReader; + +[Exposed=*] +interface ReadableStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + + undefined close(); + undefined enqueue(optional any chunk); + undefined error(optional any e); +}; + +[Exposed=*] +interface ReadableByteStreamController { + readonly attribute ReadableStreamBYOBRequest? byobRequest; + readonly attribute unrestricted double? desiredSize; + + undefined close(); + undefined enqueue(ArrayBufferView chunk); + undefined error(optional any e); +}; + +[Exposed=*] +interface ReadableStreamBYOBRequest { + readonly attribute ArrayBufferView? view; + + undefined respond([EnforceRange] unsigned long long bytesWritten); + undefined respondWithNewView(ArrayBufferView view); +}; + +[Exposed=*, Transferable] +interface WritableStream { + constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise abort(optional any reason); + Promise close(); + WritableStreamDefaultWriter getWriter(); +}; + +dictionary UnderlyingSink { + UnderlyingSinkStartCallback start; + UnderlyingSinkWriteCallback write; + UnderlyingSinkCloseCallback close; + UnderlyingSinkAbortCallback abort; + any type; +}; + +callback UnderlyingSinkStartCallback = any (WritableStreamDefaultController controller); +callback UnderlyingSinkWriteCallback = Promise (any chunk, WritableStreamDefaultController controller); +callback UnderlyingSinkCloseCallback = Promise (); +callback UnderlyingSinkAbortCallback = Promise (optional any reason); + +[Exposed=*] +interface WritableStreamDefaultWriter { + constructor(WritableStream stream); + + readonly attribute Promise closed; + readonly attribute unrestricted double? desiredSize; + readonly attribute Promise ready; + + Promise abort(optional any reason); + Promise close(); + undefined releaseLock(); + Promise write(optional any chunk); +}; + +[Exposed=*] +interface WritableStreamDefaultController { + readonly attribute AbortSignal signal; + undefined error(optional any e); +}; + +[Exposed=*, Transferable] +interface TransformStream { + constructor(optional object transformer, + optional QueuingStrategy writableStrategy = {}, + optional QueuingStrategy readableStrategy = {}); + + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; + +dictionary Transformer { + TransformerStartCallback start; + TransformerTransformCallback transform; + TransformerFlushCallback flush; + any readableType; + any writableType; +}; + +callback TransformerStartCallback = any (TransformStreamDefaultController controller); +callback TransformerFlushCallback = Promise (TransformStreamDefaultController controller); +callback TransformerTransformCallback = Promise (any chunk, TransformStreamDefaultController controller); + +[Exposed=*] +interface TransformStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + + undefined enqueue(optional any chunk); + undefined error(optional any reason); + undefined terminate(); +}; + +dictionary QueuingStrategy { + unrestricted double highWaterMark; + QueuingStrategySize size; +}; + +callback QueuingStrategySize = unrestricted double (any chunk); + +dictionary QueuingStrategyInit { + required unrestricted double highWaterMark; +}; + +[Exposed=*] +interface ByteLengthQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; +}; + +[Exposed=*] +interface CountQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; +}; + +interface mixin GenericTransformStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl deleted file mode 100644 index b8410e2e072..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader - */ - -[Exposed=(Window,Worker,Worklet)] -interface ReadableStreamBYOBReader { - constructor(ReadableStream stream); - - Promise read(ArrayBufferView view); - undefined releaseLock(); -}; -ReadableStreamBYOBReader includes ReadableStreamGenericReader; - -dictionary ReadableStreamBYOBReadResult { - ArrayBufferView value; - boolean done; -}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl deleted file mode 100644 index 076da905c12..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader - */ - -[Exposed=(Window,Worker,Worklet)] -interface ReadableStreamDefaultReader { - constructor(ReadableStream stream); - - Promise read(); - undefined releaseLock(); -}; -ReadableStreamDefaultReader includes ReadableStreamGenericReader; - -dictionary ReadableStreamDefaultReadResult { - any value; - boolean done; -}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl deleted file mode 100644 index a6c308dad41..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamgenericreader - */ - -interface mixin ReadableStreamGenericReader { - readonly attribute Promise closed; - - Promise cancel(optional any reason); -}; diff --git a/crates/web-sys/webidls/unstable/TransformStream.webidl b/crates/web-sys/webidls/unstable/TransformStream.webidl deleted file mode 100644 index 61275a85237..00000000000 --- a/crates/web-sys/webidls/unstable/TransformStream.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#transformstream - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface TransformStream { - constructor(optional object transformer, optional QueuingStrategy writableStrategy = {}, optional QueuingStrategy readableStrategy = {}); - - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; diff --git a/crates/web-sys/webidls/unstable/WritableStream.webidl b/crates/web-sys/webidls/unstable/WritableStream.webidl deleted file mode 100644 index 0eb709ed3c8..00000000000 --- a/crates/web-sys/webidls/unstable/WritableStream.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#ws-class-definition - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface WritableStream { - constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise abort(optional any reason); - Promise close(); - WritableStreamDefaultWriter getWriter(); -}; diff --git a/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl b/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl deleted file mode 100644 index 9daa09a3d35..00000000000 --- a/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#writablestreamdefaultwriter - */ - -[Exposed=(Window,Worker,Worklet)] -interface WritableStreamDefaultWriter { - constructor(WritableStream stream); - - readonly attribute Promise closed; - readonly attribute unrestricted double? desiredSize; - readonly attribute Promise ready; - - Promise abort(optional any reason); - Promise close(); - undefined releaseLock(); - Promise write(optional any chunk); -}; From 5f1b4367d7e401f60f0fa1af3396624a452cc448 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 2 Sep 2022 01:08:45 +1000 Subject: [PATCH 074/641] Return `false` from instanceof if the type being checked against doesn't exist (#3053) Fixes #2272 Previously, checking if a value was an instance of a nonexistent type would result in an uncaught exception. This changes it to return `false` instead, avoiding having to do an extra feature-test of whether the type exists before calling `dyn_into`/`dyn_ref`/etc. --- crates/cli-support/src/js/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 9b733dd1e41..760708191de 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2956,7 +2956,20 @@ impl<'a> Context<'a> { assert!(!variadic); assert_eq!(args.len(), 1); let js = self.import_name(js)?; - Ok(format!("{} instanceof {}", args[0], js)) + write!( + prelude, + "\ + let result; + try {{ + result = {} instanceof {}; + }} catch {{ + result = false; + }} + ", + args[0], js, + ) + .unwrap(); + Ok("result".to_owned()) } AuxImport::Static(js) => { From c890dc3509b71b34f53217136c8648f21c755a29 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 2 Sep 2022 01:17:28 +1000 Subject: [PATCH 075/641] Document that error types other than `JsValue` are supported (#3054) Resolves #1004 #2710 added support for returning `Result>` rather than just `Result`, but the `wasm-bindgen` guide still claims that only the latter is supported. This fixes that, and also fixes a mistake in the table for what forms `Result` can be returned in (it previously claimed that only `Option>` was supported, when in fact only a plain `Result<...>` is supported). --- guide/src/SUMMARY.md | 2 +- guide/src/reference/types/result.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 907086c51f5..4bc3c32ae06 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -58,7 +58,7 @@ - [`String`](./reference/types/string.md) - [Number Slices](./reference/types/number-slices.md) - [Boxed Number Slices](./reference/types/boxed-number-slices.md) - - [`Result`](./reference/types/result.md) + - [`Result`](./reference/types/result.md) - [`#[wasm_bindgen]` Attributes](./reference/attributes/index.md) - [On JavaScript Imports](./reference/attributes/on-js-imports/index.md) - [`catch`](./reference/attributes/on-js-imports/catch.md) diff --git a/guide/src/reference/types/result.md b/guide/src/reference/types/result.md index 1ffae1a471c..8e9b880aaaf 100644 --- a/guide/src/reference/types/result.md +++ b/guide/src/reference/types/result.md @@ -1,14 +1,14 @@ -# `Result` +# `Result` | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| No | No | No | No | No | Yes | Same as `T`, or an exception | +| No | No | No | Yes | No | No | Same as `T`, or an exception | The `Result` type can be returned from functions exported to JS as well as -closures in Rust. Only `Result` is supported where `T` can be -converted to JS. Whenever `Ok(val)` is encountered it's converted to JS and -handed off, and whenever `Err(error)` is encountered an exception is thrown in -JS with `error`. +closures in Rust. The `Ok` type must be able to be converted to JS, and the +`Err` type must implement `Into`. Whenever `Ok(val)` is encountered +it's converted to JS and handed off, and whenever `Err(error)` is encountered +an exception is thrown in JS with `error`. You can use `Result` to enable handling of JS exceptions with `?` in Rust, naturally propagating it upwards to the wasm boundary. Furthermore you can also From f75a3f8986c56d752b687cebe47b53232f403ba7 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 3 Sep 2022 00:07:02 +1000 Subject: [PATCH 076/641] js-sys: Fix `BigInt::from(usize)` and `BigInt::from(isize)` (#3056) * js-sys: Fix `BigInt::from(usize)` and `BigInt::from(isize)` Fixes #3055 This changes `isize` and `usize` to be converted to `BigInt` in the same way as `i32`/`u32`, `BigInt(JsValue::from(n))`, rather than `JsValue::from(n).unchecked_into()`. The latter is now wrong since as of #2978 that `JsValue::from` returns a `Number`, not a `BigInt`. * Add a regression test * fmt --- crates/js-sys/src/lib.rs | 4 +-- crates/js-sys/tests/wasm/BigInt.rs | 43 ++++++++++++++++++++++++++++++ crates/js-sys/tests/wasm/main.rs | 1 + 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 crates/js-sys/tests/wasm/BigInt.rs diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 1f13a3fdcaf..1b5bfa592aa 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -1051,7 +1051,7 @@ macro_rules! bigint_from { } )*) } -bigint_from!(i8 u8 i16 u16 i32 u32); +bigint_from!(i8 u8 i16 u16 i32 u32 isize usize); macro_rules! bigint_from_big { ($($x:ident)*) => ($( @@ -1070,7 +1070,7 @@ macro_rules! bigint_from_big { } )*) } -bigint_from_big!(i64 u64 i128 u128 isize usize); +bigint_from_big!(i64 u64 i128 u128); impl PartialEq for BigInt { #[inline] diff --git a/crates/js-sys/tests/wasm/BigInt.rs b/crates/js-sys/tests/wasm/BigInt.rs new file mode 100644 index 00000000000..a9cd30dfb0d --- /dev/null +++ b/crates/js-sys/tests/wasm/BigInt.rs @@ -0,0 +1,43 @@ +use js_sys::BigInt; +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::wasm_bindgen_test; + +/// `assert_eq!`, but the arguments are converted to `JsValue`s. +#[track_caller] +fn assert_jsvalue_eq(a: impl Into, b: impl Into) { + assert_eq!(a.into(), b.into()); +} + +#[wasm_bindgen_test] +fn from() { + // Test that all the `From` impls work properly. + assert_jsvalue_eq(BigInt::from(1u8), 1u64); + assert_jsvalue_eq(BigInt::from(1u16), 1u64); + assert_jsvalue_eq(BigInt::from(1u32), 1u64); + assert_jsvalue_eq(BigInt::from(1u64), 1u64); + assert_jsvalue_eq(BigInt::from(1u128), 1u64); + assert_jsvalue_eq(BigInt::from(1usize), 1u64); + assert_jsvalue_eq(BigInt::from(-3i8), -3i64); + assert_jsvalue_eq(BigInt::from(-3i16), -3i64); + assert_jsvalue_eq(BigInt::from(-3i32), -3i64); + assert_jsvalue_eq(BigInt::from(-3i64), -3i64); + assert_jsvalue_eq(BigInt::from(-3i128), -3i64); + assert_jsvalue_eq(BigInt::from(-3isize), -3i64); +} + +#[wasm_bindgen_test] +fn eq() { + // Test that all the `Eq` impls work properly. + assert_eq!(BigInt::from(1u64), 1u8); + assert_eq!(BigInt::from(1u64), 1u16); + assert_eq!(BigInt::from(1u64), 1u32); + assert_eq!(BigInt::from(1u64), 1u64); + assert_eq!(BigInt::from(1u64), 1u128); + assert_eq!(BigInt::from(1u64), 1usize); + assert_eq!(BigInt::from(-3i64), -3i8); + assert_eq!(BigInt::from(-3i64), -3i16); + assert_eq!(BigInt::from(-3i64), -3i32); + assert_eq!(BigInt::from(-3i64), -3i64); + assert_eq!(BigInt::from(-3i64), -3i128); + assert_eq!(BigInt::from(-3i64), -3isize); +} diff --git a/crates/js-sys/tests/wasm/main.rs b/crates/js-sys/tests/wasm/main.rs index 82e96759d03..627c88ddf88 100644 --- a/crates/js-sys/tests/wasm/main.rs +++ b/crates/js-sys/tests/wasm/main.rs @@ -4,6 +4,7 @@ pub mod Array; pub mod ArrayBuffer; pub mod ArrayIterator; +pub mod BigInt; pub mod Boolean; pub mod DataView; pub mod Date; From 8c7633af62b5d4a6dea2e48514a524f666644b63 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sun, 4 Sep 2022 00:58:33 +0100 Subject: [PATCH 077/641] Simplify Wasm Option ABI (#3061) FFI-safe enums via `#[repr(...)]` have been added couple of years ago, and by now there's no reason not to use them to represent an FFI-safe version of Option enum for our ABI. --- src/convert/impls.rs | 103 ++++++++++++++----------------------------- src/lib.rs | 5 ++- 2 files changed, 36 insertions(+), 72 deletions(-) diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 0179cde2e4b..79ccd67af97 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -8,56 +8,32 @@ use crate::{Clamped, JsError, JsValue}; unsafe impl WasmAbi for () {} -#[repr(C)] -pub struct WasmOptionalI32 { - pub present: u32, - pub value: i32, -} - -unsafe impl WasmAbi for WasmOptionalI32 {} - -#[repr(C)] -pub struct WasmOptionalU32 { - pub present: u32, - pub value: u32, -} - -unsafe impl WasmAbi for WasmOptionalU32 {} - -#[repr(C)] -pub struct WasmOptionalI64 { - pub present: u32, - pub value: i64, -} - -unsafe impl WasmAbi for WasmOptionalI64 {} - -#[repr(C)] -pub struct WasmOptionalU64 { - pub present: u32, - pub value: u64, +#[repr(C, u32)] +pub enum WasmOption { + None, + Some(T), } -unsafe impl WasmAbi for WasmOptionalU64 {} - -#[repr(C)] -pub struct WasmOptionalF32 { - pub present: u32, - pub value: f32, -} +unsafe impl WasmAbi for WasmOption {} -unsafe impl WasmAbi for WasmOptionalF32 {} +impl WasmOption { + pub fn from_option>(option: Option) -> Self { + match option { + Some(v) => WasmOption::Some(v.into_abi()), + None => WasmOption::None, + } + } -#[repr(C)] -pub struct WasmOptionalF64 { - pub present: u32, - pub value: f64, + pub unsafe fn into_option>(v: Self) -> Option { + match v { + WasmOption::Some(v) => Some(T::from_abi(v)), + WasmOption::None => None, + } + } } -unsafe impl WasmAbi for WasmOptionalF64 {} - macro_rules! type_wasm_native { - ($($t:tt as $c:tt => $r:tt)*) => ($( + ($($t:tt as $c:tt)*) => ($( impl IntoWasmAbi for $t { type Abi = $c; @@ -73,47 +49,34 @@ macro_rules! type_wasm_native { } impl IntoWasmAbi for Option<$t> { - type Abi = $r; + type Abi = WasmOption<$c>; #[inline] - fn into_abi(self) -> $r { - match self { - None => $r { - present: 0, - value: 0 as $c, - }, - Some(me) => $r { - present: 1, - value: me as $c, - }, - } + fn into_abi(self) -> Self::Abi { + WasmOption::from_option(self.map(|v| v as $c)) } } impl FromWasmAbi for Option<$t> { - type Abi = $r; + type Abi = WasmOption<$c>; #[inline] - unsafe fn from_abi(js: $r) -> Self { - if js.present == 0 { - None - } else { - Some(js.value as $t) - } + unsafe fn from_abi(js: Self::Abi) -> Self { + WasmOption::into_option(js).map(|v: $c| v as $t) } } )*) } type_wasm_native!( - i32 as i32 => WasmOptionalI32 - isize as i32 => WasmOptionalI32 - u32 as u32 => WasmOptionalU32 - usize as u32 => WasmOptionalU32 - i64 as i64 => WasmOptionalI64 - u64 as u64 => WasmOptionalU64 - f32 as f32 => WasmOptionalF32 - f64 as f64 => WasmOptionalF64 + i32 as i32 + isize as i32 + u32 as u32 + usize as u32 + i64 as i64 + u64 as u64 + f32 as f32 + f64 as f64 ); macro_rules! type_abi_as_u32 { diff --git a/src/lib.rs b/src/lib.rs index b286dca3f5e..933d318daf1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ use core::ops::{ }; use core::u32; -use crate::convert::{FromWasmAbi, WasmOptionalF64, WasmSlice}; +use crate::convert::{FromWasmAbi, WasmSlice}; macro_rules! if_std { ($($i:item)*) => ($( @@ -68,6 +68,7 @@ pub mod describe; mod cast; pub use crate::cast::{JsCast, JsObject}; +use convert::WasmOption; if_std! { extern crate std; @@ -976,7 +977,7 @@ externs! { fn __wbindgen_ge(a: u32, b: u32) -> u32; fn __wbindgen_gt(a: u32, b: u32) -> u32; - fn __wbindgen_number_get(idx: u32) -> WasmOptionalF64; + fn __wbindgen_number_get(idx: u32) -> WasmOption; fn __wbindgen_boolean_get(idx: u32) -> u32; fn __wbindgen_string_get(idx: u32) -> WasmSlice; From cb94b43596c0bd4076297ac0b8072a4b122aaf6e Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sun, 4 Sep 2022 08:57:04 +0100 Subject: [PATCH 078/641] Add `TryFrom` for `[iu](64|128)` (#3058) Adds a way to convert `JsValue` or a `BigInt` to `i64`/`u64`/`i128`/`u128` with type and range checks, returning the original `JsValue` otherwise. This could be optimised a little bit further via more intrinsics, but it's good enough for the initial implementation, so leaving any optimisations for the future. Fixes #2350. --- crates/cli-support/src/intrinsic.rs | 7 ++++ crates/cli-support/src/js/mod.rs | 6 +++ crates/js-sys/src/lib.rs | 13 ++++++- src/lib.rs | 57 +++++++++++++++++++++++++++++ tests/wasm/bigint.rs | 29 +++++++++++++++ 5 files changed, 110 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index c8d4436a451..8563369525f 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -80,6 +80,10 @@ fn opt_f64() -> Descriptor { Descriptor::Option(Box::new(Descriptor::F64)) } +fn opt_i64() -> Descriptor { + Descriptor::Option(Box::new(Descriptor::I64)) +} + intrinsics! { pub enum Intrinsic { #[symbol = "__wbindgen_jsval_eq"] @@ -208,6 +212,9 @@ intrinsics! { #[symbol = "__wbindgen_bigint_from_u128"] #[signature = fn(U64, U64) -> Externref] BigIntFromU128, + #[symbol = "__wbindgen_bigint_get_as_i64"] + #[signature = fn(ref_externref()) -> opt_i64()] + BigIntGetAsI64, #[symbol = "__wbindgen_string_new"] #[signature = fn(ref_string()) -> Externref] StringNew, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 760708191de..fb14e70910a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3384,6 +3384,12 @@ impl<'a> Context<'a> { format!("typeof(v) === 'boolean' ? (v ? 1 : 0) : 2") } + Intrinsic::BigIntGetAsI64 => { + assert_eq!(args.len(), 1); + prelude.push_str(&format!("const v = {};\n", args[0])); + format!("typeof(v) === 'bigint' ? v : undefined") + } + Intrinsic::Throw => { assert_eq!(args.len(), 1); format!("throw new Error({})", args[0]) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 1b5bfa592aa..12fef1cb7f7 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -20,7 +20,7 @@ use core::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub}; use std::cmp::Ordering; -use std::convert::{self, Infallible}; +use std::convert::{self, Infallible, TryFrom}; use std::f64; use std::fmt; use std::iter::{self, Product, Sum}; @@ -1046,7 +1046,7 @@ macro_rules! bigint_from { impl PartialEq<$x> for BigInt { #[inline] fn eq(&self, other: &$x) -> bool { - JsValue::from(self) == BigInt::from(*other).unchecked_into::() + JsValue::from(self) == JsValue::from(BigInt::from(*other)) } } )*) @@ -1068,6 +1068,15 @@ macro_rules! bigint_from_big { self == &BigInt::from(*other) } } + + impl TryFrom for $x { + type Error = BigInt; + + #[inline] + fn try_from(x: BigInt) -> Result { + Self::try_from(JsValue::from(x)).map_err(JsCast::unchecked_into) + } + } )*) } bigint_from_big!(i64 u64 i128 u128); diff --git a/src/lib.rs b/src/lib.rs index 933d318daf1..2ccb284b9a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -886,6 +886,62 @@ macro_rules! big_numbers { )*) } +fn bigint_get_as_i64(v: &JsValue) -> Option { + unsafe { Option::from_abi(__wbindgen_bigint_get_as_i64(v.idx)) } +} + +macro_rules! try_from_for_num64 { + ($ty:ty) => { + impl TryFrom for $ty { + type Error = JsValue; + + #[inline] + fn try_from(v: JsValue) -> Result { + bigint_get_as_i64(&v) + // Reinterpret bits; ABI-wise this is safe to do and allows us to avoid + // having separate intrinsics per signed/unsigned types. + .map(|as_i64| as_i64 as Self) + // Double-check that we didn't truncate the bigint to 64 bits. + .filter(|as_self| v == *as_self) + // Not a bigint or not in range. + .ok_or(v) + } + } + }; +} + +try_from_for_num64!(i64); +try_from_for_num64!(u64); + +macro_rules! try_from_for_num128 { + ($ty:ty, $hi_ty:ty) => { + impl TryFrom for $ty { + type Error = JsValue; + + #[inline] + fn try_from(v: JsValue) -> Result { + // Truncate the bigint to 64 bits, this will give us the lower part. + let lo = match bigint_get_as_i64(&v) { + // The lower part must be interpreted as unsigned in both i128 and u128. + Some(lo) => lo as u64, + // Not a bigint. + None => return Err(v), + }; + // Now we know it's a bigint, so we can safely use `>> 64n` without + // worrying about a JS exception on type mismatch. + let hi = v >> JsValue::from(64_u64); + // The high part is the one we want checked against a 64-bit range. + // If it fits, then our original number is in the 128-bit range. + let hi = <$hi_ty>::try_from(hi)?; + Ok(Self::from(hi) << 64 | Self::from(lo)) + } + } + }; +} + +try_from_for_num128!(i128, i64); +try_from_for_num128!(u128, u64); + big_numbers! { |n|, i64 = __wbindgen_bigint_from_i64(n), @@ -980,6 +1036,7 @@ externs! { fn __wbindgen_number_get(idx: u32) -> WasmOption; fn __wbindgen_boolean_get(idx: u32) -> u32; fn __wbindgen_string_get(idx: u32) -> WasmSlice; + fn __wbindgen_bigint_get_as_i64(idx: u32) -> WasmOption; fn __wbindgen_debug_string(ret: *mut [usize; 2], idx: u32) -> (); diff --git a/tests/wasm/bigint.rs b/tests/wasm/bigint.rs index 7f5714e2b06..30eb5c5cf7d 100644 --- a/tests/wasm/bigint.rs +++ b/tests/wasm/bigint.rs @@ -87,3 +87,32 @@ pub fn u64_slice(a: &[u64]) -> Vec { fn works() { js_works(); } + +mod try_from_works { + use super::*; + use crate::JsValue; + use core::convert::TryFrom; + + macro_rules! test_type_boundaries { + ($($ty:ident)*) => { + $( + #[wasm_bindgen_test] + fn $ty() { + // Not a bigint. + assert!($ty::try_from(JsValue::NULL).is_err()); + assert!($ty::try_from(JsValue::from_f64(0.0)).is_err()); + // Within range. + assert_eq!($ty::try_from(JsValue::from($ty::MIN)), Ok($ty::MIN)); + // Too small. + assert!($ty::try_from(JsValue::from($ty::MIN) - JsValue::from(1_i64)).is_err()); + // Within range. + assert_eq!($ty::try_from(JsValue::from($ty::MAX)), Ok($ty::MAX)); + // Too large. + assert!($ty::try_from(JsValue::from($ty::MAX) + JsValue::from(1_i64)).is_err()); + } + )* + }; + } + + test_type_boundaries!(i64 u64 i128 u128); +} From 699e78811e21b52b4642b7b78fc649d1809adad1 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Sun, 4 Sep 2022 04:01:03 -0400 Subject: [PATCH 079/641] Revert "web-sys: Added full Streams WebIDL (#3046)" (#3064) This reverts commit e8a499c36b41e197c7a1bd95050c73a6148e3f07. --- .../features/gen_ByteLengthQueuingStrategy.rs | 36 --- .../src/features/gen_CountQueuingStrategy.rs | 36 --- .../src/features/gen_QueuingStrategyInit.rs | 40 --- .../gen_ReadableByteStreamController.rs | 67 ------ .../src/features/gen_ReadableStream.rs | 8 + .../gen_ReadableStreamByobReadResult.rs | 70 ++++++ .../features/gen_ReadableStreamByobReader.rs | 32 +++ .../features/gen_ReadableStreamByobRequest.rs | 52 ---- .../gen_ReadableStreamDefaultController.rs | 59 ----- .../gen_ReadableStreamDefaultReadResult.rs | 70 ++++++ .../gen_ReadableStreamDefaultReader.rs | 28 +++ .../features/gen_ReadableStreamReadResult.rs | 53 ---- .../src/features/gen_ReadableStreamType.rs | 10 - .../src/features/gen_ReadableWritablePair.rs | 8 + .../src/features/gen_TransformStream.rs | 12 + .../gen_TransformStreamDefaultController.rs | 62 ----- .../web-sys/src/features/gen_Transformer.rs | 104 -------- .../src/features/gen_UnderlyingSink.rs | 92 ------- .../src/features/gen_UnderlyingSource.rs | 98 -------- .../src/features/gen_WritableStream.rs | 24 ++ .../gen_WritableStreamDefaultController.rs | 36 --- .../gen_WritableStreamDefaultWriter.rs | 44 ++++ crates/web-sys/src/features/mod.rs | 86 +------ .../webidls/enabled/ReadableStream.webidl | 47 ++++ crates/web-sys/webidls/enabled/Streams.webidl | 227 ------------------ .../unstable/ReadableStreamBYOBReader.webidl | 22 ++ .../ReadableStreamDefaultReader.webidl | 22 ++ .../ReadableStreamGenericReader.webidl | 14 ++ .../webidls/unstable/TransformStream.webidl | 16 ++ .../webidls/unstable/WritableStream.webidl | 19 ++ .../WritableStreamDefaultWriter.webidl | 22 ++ 31 files changed, 468 insertions(+), 1048 deletions(-) delete mode 100644 crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs delete mode 100644 crates/web-sys/src/features/gen_CountQueuingStrategy.rs delete mode 100644 crates/web-sys/src/features/gen_QueuingStrategyInit.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableByteStreamController.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamReadResult.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamType.rs delete mode 100644 crates/web-sys/src/features/gen_TransformStreamDefaultController.rs delete mode 100644 crates/web-sys/src/features/gen_Transformer.rs delete mode 100644 crates/web-sys/src/features/gen_UnderlyingSink.rs delete mode 100644 crates/web-sys/src/features/gen_UnderlyingSource.rs delete mode 100644 crates/web-sys/src/features/gen_WritableStreamDefaultController.rs create mode 100644 crates/web-sys/webidls/enabled/ReadableStream.webidl delete mode 100644 crates/web-sys/webidls/enabled/Streams.webidl create mode 100644 crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl create mode 100644 crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl create mode 100644 crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl create mode 100644 crates/web-sys/webidls/unstable/TransformStream.webidl create mode 100644 crates/web-sys/webidls/unstable/WritableStream.webidl create mode 100644 crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl diff --git a/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs b/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs deleted file mode 100644 index c29737f5378..00000000000 --- a/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ByteLengthQueuingStrategy , typescript_type = "ByteLengthQueuingStrategy")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ByteLengthQueuingStrategy` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`*"] - pub type ByteLengthQueuingStrategy; - # [wasm_bindgen (structural , method , getter , js_class = "ByteLengthQueuingStrategy" , js_name = highWaterMark)] - #[doc = "Getter for the `highWaterMark` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)"] - #[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)] - #[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; - #[cfg(feature = "QueuingStrategyInit")] - #[wasm_bindgen(catch, constructor, js_class = "ByteLengthQueuingStrategy")] - #[doc = "The `new ByteLengthQueuingStrategy(..)` constructor, creating a new instance of `ByteLengthQueuingStrategy`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/ByteLengthQueuingStrategy)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`, `QueuingStrategyInit`*"] - pub fn new(init: &QueuingStrategyInit) -> Result; -} diff --git a/crates/web-sys/src/features/gen_CountQueuingStrategy.rs b/crates/web-sys/src/features/gen_CountQueuingStrategy.rs deleted file mode 100644 index 779ba5b5b5d..00000000000 --- a/crates/web-sys/src/features/gen_CountQueuingStrategy.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = CountQueuingStrategy , typescript_type = "CountQueuingStrategy")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `CountQueuingStrategy` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`*"] - pub type CountQueuingStrategy; - # [wasm_bindgen (structural , method , getter , js_class = "CountQueuingStrategy" , js_name = highWaterMark)] - #[doc = "Getter for the `highWaterMark` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/highWaterMark)"] - #[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)] - #[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; - #[cfg(feature = "QueuingStrategyInit")] - #[wasm_bindgen(catch, constructor, js_class = "CountQueuingStrategy")] - #[doc = "The `new CountQueuingStrategy(..)` constructor, creating a new instance of `CountQueuingStrategy`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/CountQueuingStrategy)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`, `QueuingStrategyInit`*"] - pub fn new(init: &QueuingStrategyInit) -> Result; -} diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs deleted file mode 100644 index 89141292fbc..00000000000 --- a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = QueuingStrategyInit)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `QueuingStrategyInit` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] - pub type QueuingStrategyInit; -} -impl QueuingStrategyInit { - #[doc = "Construct a new `QueuingStrategyInit`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] - pub fn new(high_water_mark: f64) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.high_water_mark(high_water_mark); - ret - } - #[doc = "Change the `highWaterMark` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] - pub fn high_water_mark(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("highWaterMark"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} diff --git a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs deleted file mode 100644 index 6fed9016f1c..00000000000 --- a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs +++ /dev/null @@ -1,67 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableByteStreamController , typescript_type = "ReadableByteStreamController")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableByteStreamController` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController)"] - #[doc = ""] - #[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)] - #[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; - # [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; - # [wasm_bindgen (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)] - #[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_array_buffer_view( - this: &ReadableByteStreamController, - chunk: &::js_sys::Object, - ); - # [wasm_bindgen (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)] - #[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)] - #[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); -} diff --git a/crates/web-sys/src/features/gen_ReadableStream.rs b/crates/web-sys/src/features/gen_ReadableStream.rs index c66b913be9e..a68f982b964 100644 --- a/crates/web-sys/src/features/gen_ReadableStream.rs +++ b/crates/web-sys/src/features/gen_ReadableStream.rs @@ -112,6 +112,7 @@ extern "C" { transform: &ReadableWritablePair, options: &StreamPipeOptions, ) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -119,7 +120,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to(this: &ReadableStream, destination: &WritableStream) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "StreamPipeOptions", feature = "WritableStream",))] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -127,6 +132,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `StreamPipeOptions`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to_with_options( this: &ReadableStream, destination: &WritableStream, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs new file mode 100644 index 00000000000..eb58aeca844 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs @@ -0,0 +1,70 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReadResult)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamByobReadResult` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type ReadableStreamByobReadResult; +} +#[cfg(web_sys_unstable_apis)] +impl ReadableStreamByobReadResult { + #[doc = "Construct a new `ReadableStreamByobReadResult`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn done(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for ReadableStreamByobReadResult { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs index 1f051255192..a630495bad7 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReader , typescript_type = "ReadableStreamBYOBReader")] @@ -10,14 +11,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamByobReader; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamByobReader) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamBYOBReader")] #[doc = "The `new ReadableStreamByobReader(..)` constructor, creating a new instance of `ReadableStreamByobReader`."] @@ -25,47 +34,70 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_array_buffer_view( this: &ReadableStreamByobReader, view: &::js_sys::Object, ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_u8_array( this: &ReadableStreamByobReader, view: &mut [u8], ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamByobReader); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamByobReader) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamByobReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs deleted file mode 100644 index 44eac4614ab..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs +++ /dev/null @@ -1,52 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBRequest , typescript_type = "ReadableStreamBYOBRequest")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamByobRequest` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"] - pub type ReadableStreamByobRequest; - # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBRequest" , js_name = view)] - #[doc = "Getter for the `view` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/view)"] - #[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)] - #[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)] - #[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)] - #[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_array_buffer_view( - this: &ReadableStreamByobRequest, - view: &::js_sys::Object, - ); - # [wasm_bindgen (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]); -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs deleted file mode 100644 index d623f4b0ad0..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs +++ /dev/null @@ -1,59 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultController , typescript_type = "ReadableStreamDefaultController")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamDefaultController` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] - pub type ReadableStreamDefaultController; - # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultController" , 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/ReadableStreamDefaultController/desiredSize)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] - pub fn desired_size(this: &ReadableStreamDefaultController) -> Option; - # [wasm_bindgen (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)] - #[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)] - #[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_with_chunk( - this: &ReadableStreamDefaultController, - chunk: &::wasm_bindgen::JsValue, - ); - # [wasm_bindgen (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)] - #[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); -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs new file mode 100644 index 00000000000..82bbf8ca1e1 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs @@ -0,0 +1,70 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReadResult)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamDefaultReadResult` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type ReadableStreamDefaultReadResult; +} +#[cfg(web_sys_unstable_apis)] +impl ReadableStreamDefaultReadResult { + #[doc = "Construct a new `ReadableStreamDefaultReadResult`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn done(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for ReadableStreamDefaultReadResult { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs index 6b12a74ca6b..e47c2a3073f 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReader , typescript_type = "ReadableStreamDefaultReader")] @@ -10,14 +11,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamDefaultReader; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamDefaultReader")] #[doc = "The `new ReadableStreamDefaultReader(..)` constructor, creating a new instance of `ReadableStreamDefaultReader`."] @@ -25,34 +34,53 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamDefaultReader); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamDefaultReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs deleted file mode 100644 index 794dc0e9b0a..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamReadResult)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamReadResult` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] - pub type ReadableStreamReadResult; -} -impl ReadableStreamReadResult { - #[doc = "Construct a new `ReadableStreamReadResult`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] - pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] - pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -impl Default for ReadableStreamReadResult { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamType.rs b/crates/web-sys/src/features/gen_ReadableStreamType.rs deleted file mode 100644 index 5bbe4467f36..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamType.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![allow(unused_imports)] -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -#[doc = "The `ReadableStreamType` enum."] -#[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`*"] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ReadableStreamType { - Bytes = "bytes", -} diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index 8a34d98aca5..0ce861e74ab 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -11,10 +11,14 @@ extern "C" { pub type ReadableWritablePair; } impl ReadableWritablePair { + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))] #[doc = "Construct a new `ReadableWritablePair`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); @@ -40,10 +44,14 @@ impl ReadableWritablePair { let _ = r; self } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[doc = "Change the `writable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(&mut self, val: &WritableStream) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( diff --git a/crates/web-sys/src/features/gen_TransformStream.rs b/crates/web-sys/src/features/gen_TransformStream.rs index 9dd64d45d33..d2a041a700c 100644 --- a/crates/web-sys/src/features/gen_TransformStream.rs +++ b/crates/web-sys/src/features/gen_TransformStream.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStream , typescript_type = "TransformStream")] @@ -10,7 +11,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TransformStream; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = readable)] #[doc = "Getter for the `readable` field of this object."] @@ -18,7 +23,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/readable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `TransformStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn readable(this: &TransformStream) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = writable)] #[doc = "Getter for the `writable` field of this object."] @@ -26,6 +35,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/writable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(this: &TransformStream) -> WritableStream; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "TransformStream")] diff --git a/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs b/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs deleted file mode 100644 index 4add045b0c0..00000000000 --- a/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs +++ /dev/null @@ -1,62 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStreamDefaultController , typescript_type = "TransformStreamDefaultController")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `TransformStreamDefaultController` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub type TransformStreamDefaultController; - # [wasm_bindgen (structural , method , getter , js_class = "TransformStreamDefaultController" , 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/TransformStreamDefaultController/desiredSize)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn desired_size(this: &TransformStreamDefaultController) -> Option; - # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] - #[doc = "The `enqueue()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn enqueue(this: &TransformStreamDefaultController); - # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] - #[doc = "The `enqueue()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn enqueue_with_chunk( - this: &TransformStreamDefaultController, - chunk: &::wasm_bindgen::JsValue, - ); - # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] - #[doc = "The `error()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn error(this: &TransformStreamDefaultController); - # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] - #[doc = "The `error()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn error_with_reason( - this: &TransformStreamDefaultController, - reason: &::wasm_bindgen::JsValue, - ); - # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = terminate)] - #[doc = "The `terminate()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/terminate)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] - pub fn terminate(this: &TransformStreamDefaultController); -} diff --git a/crates/web-sys/src/features/gen_Transformer.rs b/crates/web-sys/src/features/gen_Transformer.rs deleted file mode 100644 index c0dddae0727..00000000000 --- a/crates/web-sys/src/features/gen_Transformer.rs +++ /dev/null @@ -1,104 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Transformer)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `Transformer` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub type Transformer; -} -impl Transformer { - #[doc = "Construct a new `Transformer`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[doc = "Change the `flush` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn flush(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flush"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `readableType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn readable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("readableType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `transform` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn transform(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transform"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `writableType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] - pub fn writable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("writableType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -impl Default for Transformer { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_UnderlyingSink.rs b/crates/web-sys/src/features/gen_UnderlyingSink.rs deleted file mode 100644 index dd69488671c..00000000000 --- a/crates/web-sys/src/features/gen_UnderlyingSink.rs +++ /dev/null @@ -1,92 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSink)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `UnderlyingSink` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub type UnderlyingSink; -} -impl UnderlyingSink { - #[doc = "Construct a new `UnderlyingSink`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[doc = "Change the `abort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn abort(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("abort"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `close` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn close(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("close"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn type_(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `write` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] - pub fn write(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("write"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -impl Default for UnderlyingSink { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_UnderlyingSource.rs b/crates/web-sys/src/features/gen_UnderlyingSource.rs deleted file mode 100644 index a6a90943179..00000000000 --- a/crates/web-sys/src/features/gen_UnderlyingSource.rs +++ /dev/null @@ -1,98 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSource)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `UnderlyingSource` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub type UnderlyingSource; -} -impl UnderlyingSource { - #[doc = "Construct a new `UnderlyingSource`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[doc = "Change the `autoAllocateChunkSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub fn auto_allocate_chunk_size(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoAllocateChunkSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `cancel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub fn cancel(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cancel"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `pull` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub fn pull(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pull"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] - pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(feature = "ReadableStreamType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] - pub fn type_(&mut self, val: ReadableStreamType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -impl Default for UnderlyingSource { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_WritableStream.rs b/crates/web-sys/src/features/gen_WritableStream.rs index d4123011279..7f9ed141e58 100644 --- a/crates/web-sys/src/features/gen_WritableStream.rs +++ b/crates/web-sys/src/features/gen_WritableStream.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStream , typescript_type = "WritableStream")] @@ -10,13 +11,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStream; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStream" , js_name = locked)] #[doc = "Getter for the `locked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn locked(this: &WritableStream) -> bool; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "WritableStream")] @@ -57,30 +65,43 @@ extern "C" { underlying_sink: &::js_sys::Object, strategy: &QueuingStrategy, ) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStream) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStream, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStream) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStreamDefaultWriter")] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = getWriter)] #[doc = "The `getWriter()` method."] @@ -88,5 +109,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_writer(this: &WritableStream) -> WritableStreamDefaultWriter; } diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs deleted file mode 100644 index 424a635c96a..00000000000 --- a/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultController , typescript_type = "WritableStreamDefaultController")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `WritableStreamDefaultController` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] - pub type WritableStreamDefaultController; - #[cfg(feature = "AbortSignal")] - # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultController" , js_name = signal)] - #[doc = "Getter for the `signal` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/signal)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WritableStreamDefaultController`*"] - pub fn signal(this: &WritableStreamDefaultController) -> AbortSignal; - # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] - #[doc = "The `error()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] - pub fn error(this: &WritableStreamDefaultController); - # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] - #[doc = "The `error()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] - pub fn error_with_e(this: &WritableStreamDefaultController, e: &::wasm_bindgen::JsValue); -} diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs index b52551db43d..1ba5bd8b6ce 100644 --- a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs +++ b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultWriter , typescript_type = "WritableStreamDefaultWriter")] @@ -10,28 +11,44 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStreamDefaultWriter; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , 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/WritableStreamDefaultWriter/desiredSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn desired_size(this: &WritableStreamDefaultWriter) -> Option; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = ready)] #[doc = "Getter for the `ready` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/ready)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ready(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[wasm_bindgen(catch, constructor, js_class = "WritableStreamDefaultWriter")] #[doc = "The `new WritableStreamDefaultWriter(..)` constructor, creating a new instance of `WritableStreamDefaultWriter`."] @@ -39,51 +56,78 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &WritableStream) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStreamDefaultWriter, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = releaseLock)] #[doc = "The `releaseLock()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/releaseLock)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &WritableStreamDefaultWriter); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_with_chunk( this: &WritableStreamDefaultWriter, chunk: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index dfb2a94cac1..59d6818792d 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -718,12 +718,6 @@ mod gen_BrowserFindDirection; #[cfg(feature = "BrowserFindDirection")] pub use gen_BrowserFindDirection::*; -#[cfg(feature = "ByteLengthQueuingStrategy")] -#[allow(non_snake_case)] -mod gen_ByteLengthQueuingStrategy; -#[cfg(feature = "ByteLengthQueuingStrategy")] -pub use gen_ByteLengthQueuingStrategy::*; - #[cfg(feature = "Cache")] #[allow(non_snake_case)] mod gen_Cache; @@ -1162,12 +1156,6 @@ mod gen_Coordinates; #[cfg(feature = "Coordinates")] pub use gen_Coordinates::*; -#[cfg(feature = "CountQueuingStrategy")] -#[allow(non_snake_case)] -mod gen_CountQueuingStrategy; -#[cfg(feature = "CountQueuingStrategy")] -pub use gen_CountQueuingStrategy::*; - #[cfg(feature = "Credential")] #[allow(non_snake_case)] mod gen_Credential; @@ -5668,12 +5656,6 @@ mod gen_QueuingStrategy; #[cfg(feature = "QueuingStrategy")] pub use gen_QueuingStrategy::*; -#[cfg(feature = "QueuingStrategyInit")] -#[allow(non_snake_case)] -mod gen_QueuingStrategyInit; -#[cfg(feature = "QueuingStrategyInit")] -pub use gen_QueuingStrategyInit::*; - #[cfg(feature = "RadioNodeList")] #[allow(non_snake_case)] mod gen_RadioNodeList; @@ -5698,35 +5680,29 @@ mod gen_RcwnStatus; #[cfg(feature = "RcwnStatus")] pub use gen_RcwnStatus::*; -#[cfg(feature = "ReadableByteStreamController")] -#[allow(non_snake_case)] -mod gen_ReadableByteStreamController; -#[cfg(feature = "ReadableByteStreamController")] -pub use gen_ReadableByteStreamController::*; - #[cfg(feature = "ReadableStream")] #[allow(non_snake_case)] mod gen_ReadableStream; #[cfg(feature = "ReadableStream")] pub use gen_ReadableStream::*; +#[cfg(feature = "ReadableStreamByobReadResult")] +#[allow(non_snake_case)] +mod gen_ReadableStreamByobReadResult; +#[cfg(feature = "ReadableStreamByobReadResult")] +pub use gen_ReadableStreamByobReadResult::*; + #[cfg(feature = "ReadableStreamByobReader")] #[allow(non_snake_case)] mod gen_ReadableStreamByobReader; #[cfg(feature = "ReadableStreamByobReader")] pub use gen_ReadableStreamByobReader::*; -#[cfg(feature = "ReadableStreamByobRequest")] +#[cfg(feature = "ReadableStreamDefaultReadResult")] #[allow(non_snake_case)] -mod gen_ReadableStreamByobRequest; -#[cfg(feature = "ReadableStreamByobRequest")] -pub use gen_ReadableStreamByobRequest::*; - -#[cfg(feature = "ReadableStreamDefaultController")] -#[allow(non_snake_case)] -mod gen_ReadableStreamDefaultController; -#[cfg(feature = "ReadableStreamDefaultController")] -pub use gen_ReadableStreamDefaultController::*; +mod gen_ReadableStreamDefaultReadResult; +#[cfg(feature = "ReadableStreamDefaultReadResult")] +pub use gen_ReadableStreamDefaultReadResult::*; #[cfg(feature = "ReadableStreamDefaultReader")] #[allow(non_snake_case)] @@ -5746,24 +5722,12 @@ mod gen_ReadableStreamIteratorOptions; #[cfg(feature = "ReadableStreamIteratorOptions")] pub use gen_ReadableStreamIteratorOptions::*; -#[cfg(feature = "ReadableStreamReadResult")] -#[allow(non_snake_case)] -mod gen_ReadableStreamReadResult; -#[cfg(feature = "ReadableStreamReadResult")] -pub use gen_ReadableStreamReadResult::*; - #[cfg(feature = "ReadableStreamReaderMode")] #[allow(non_snake_case)] mod gen_ReadableStreamReaderMode; #[cfg(feature = "ReadableStreamReaderMode")] pub use gen_ReadableStreamReaderMode::*; -#[cfg(feature = "ReadableStreamType")] -#[allow(non_snake_case)] -mod gen_ReadableStreamType; -#[cfg(feature = "ReadableStreamType")] -pub use gen_ReadableStreamType::*; - #[cfg(feature = "ReadableWritablePair")] #[allow(non_snake_case)] mod gen_ReadableWritablePair; @@ -7768,18 +7732,6 @@ mod gen_TransformStream; #[cfg(feature = "TransformStream")] pub use gen_TransformStream::*; -#[cfg(feature = "TransformStreamDefaultController")] -#[allow(non_snake_case)] -mod gen_TransformStreamDefaultController; -#[cfg(feature = "TransformStreamDefaultController")] -pub use gen_TransformStreamDefaultController::*; - -#[cfg(feature = "Transformer")] -#[allow(non_snake_case)] -mod gen_Transformer; -#[cfg(feature = "Transformer")] -pub use gen_Transformer::*; - #[cfg(feature = "TransitionEvent")] #[allow(non_snake_case)] mod gen_TransitionEvent; @@ -7858,18 +7810,6 @@ mod gen_UiEventInit; #[cfg(feature = "UiEventInit")] pub use gen_UiEventInit::*; -#[cfg(feature = "UnderlyingSink")] -#[allow(non_snake_case)] -mod gen_UnderlyingSink; -#[cfg(feature = "UnderlyingSink")] -pub use gen_UnderlyingSink::*; - -#[cfg(feature = "UnderlyingSource")] -#[allow(non_snake_case)] -mod gen_UnderlyingSource; -#[cfg(feature = "UnderlyingSource")] -pub use gen_UnderlyingSource::*; - #[cfg(feature = "Url")] #[allow(non_snake_case)] mod gen_Url; @@ -8686,12 +8626,6 @@ mod gen_WritableStream; #[cfg(feature = "WritableStream")] pub use gen_WritableStream::*; -#[cfg(feature = "WritableStreamDefaultController")] -#[allow(non_snake_case)] -mod gen_WritableStreamDefaultController; -#[cfg(feature = "WritableStreamDefaultController")] -pub use gen_WritableStreamDefaultController::*; - #[cfg(feature = "WritableStreamDefaultWriter")] #[allow(non_snake_case)] mod gen_WritableStreamDefaultWriter; diff --git a/crates/web-sys/webidls/enabled/ReadableStream.webidl b/crates/web-sys/webidls/enabled/ReadableStream.webidl new file mode 100644 index 00000000000..00c8bbc8a4a --- /dev/null +++ b/crates/web-sys/webidls/enabled/ReadableStream.webidl @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#rs-class-definition + */ + +[Exposed=(Window,Worker,Worklet), Transferable] +interface ReadableStream { + constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise cancel(optional any reason); + ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); + ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); + Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); + sequence tee(); + + async iterable(optional ReadableStreamIteratorOptions options = {}); +}; + +typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; + +enum ReadableStreamReaderMode { "byob" }; + +dictionary ReadableStreamGetReaderOptions { + ReadableStreamReaderMode mode; +}; + +dictionary ReadableStreamIteratorOptions { + boolean preventCancel = false; +}; + +dictionary ReadableWritablePair { + required ReadableStream readable; + required WritableStream writable; +}; + +dictionary StreamPipeOptions { + boolean preventClose = false; + boolean preventAbort = false; + boolean preventCancel = false; + AbortSignal signal; +}; diff --git a/crates/web-sys/webidls/enabled/Streams.webidl b/crates/web-sys/webidls/enabled/Streams.webidl deleted file mode 100644 index f5d853ff25d..00000000000 --- a/crates/web-sys/webidls/enabled/Streams.webidl +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative - * Commons Attribution 4.0 International License. To the extent portions of it are incorporated into - * source code, such portions in the source code are licensed under the BSD 3-Clause License - * instead. - * - * The origin of this IDL file is - * https://streams.spec.whatwg.org/#idl-index - */ - -[Exposed=*, Transferable] -interface ReadableStream { - constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise cancel(optional any reason); - ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); - ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); - Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); - sequence tee(); - - async iterable(optional ReadableStreamIteratorOptions options = {}); -}; - -typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; - -enum ReadableStreamReaderMode { "byob" }; - -dictionary ReadableStreamGetReaderOptions { - ReadableStreamReaderMode mode; -}; - -dictionary ReadableStreamIteratorOptions { - boolean preventCancel = false; -}; - -dictionary ReadableWritablePair { - required ReadableStream readable; - required WritableStream writable; -}; - -dictionary StreamPipeOptions { - boolean preventClose = false; - boolean preventAbort = false; - boolean preventCancel = false; - AbortSignal signal; -}; - -dictionary UnderlyingSource { - UnderlyingSourceStartCallback start; - UnderlyingSourcePullCallback pull; - UnderlyingSourceCancelCallback cancel; - ReadableStreamType type; - [EnforceRange] unsigned long long autoAllocateChunkSize; -}; - -typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; - -callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); -callback UnderlyingSourcePullCallback = Promise (ReadableStreamController controller); -callback UnderlyingSourceCancelCallback = Promise (optional any reason); - -enum ReadableStreamType { "bytes" }; - -interface mixin ReadableStreamGenericReader { - readonly attribute Promise closed; - - Promise cancel(optional any reason); -}; - -[Exposed=*] -interface ReadableStreamDefaultReader { - constructor(ReadableStream stream); - - Promise read(); - undefined releaseLock(); -}; -ReadableStreamDefaultReader includes ReadableStreamGenericReader; - -dictionary ReadableStreamReadResult { - any value; - boolean done; -}; - -[Exposed=*] -interface ReadableStreamBYOBReader { - constructor(ReadableStream stream); - - Promise read(ArrayBufferView view); - undefined releaseLock(); -}; -ReadableStreamBYOBReader includes ReadableStreamGenericReader; - -[Exposed=*] -interface ReadableStreamDefaultController { - readonly attribute unrestricted double? desiredSize; - - undefined close(); - undefined enqueue(optional any chunk); - undefined error(optional any e); -}; - -[Exposed=*] -interface ReadableByteStreamController { - readonly attribute ReadableStreamBYOBRequest? byobRequest; - readonly attribute unrestricted double? desiredSize; - - undefined close(); - undefined enqueue(ArrayBufferView chunk); - undefined error(optional any e); -}; - -[Exposed=*] -interface ReadableStreamBYOBRequest { - readonly attribute ArrayBufferView? view; - - undefined respond([EnforceRange] unsigned long long bytesWritten); - undefined respondWithNewView(ArrayBufferView view); -}; - -[Exposed=*, Transferable] -interface WritableStream { - constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise abort(optional any reason); - Promise close(); - WritableStreamDefaultWriter getWriter(); -}; - -dictionary UnderlyingSink { - UnderlyingSinkStartCallback start; - UnderlyingSinkWriteCallback write; - UnderlyingSinkCloseCallback close; - UnderlyingSinkAbortCallback abort; - any type; -}; - -callback UnderlyingSinkStartCallback = any (WritableStreamDefaultController controller); -callback UnderlyingSinkWriteCallback = Promise (any chunk, WritableStreamDefaultController controller); -callback UnderlyingSinkCloseCallback = Promise (); -callback UnderlyingSinkAbortCallback = Promise (optional any reason); - -[Exposed=*] -interface WritableStreamDefaultWriter { - constructor(WritableStream stream); - - readonly attribute Promise closed; - readonly attribute unrestricted double? desiredSize; - readonly attribute Promise ready; - - Promise abort(optional any reason); - Promise close(); - undefined releaseLock(); - Promise write(optional any chunk); -}; - -[Exposed=*] -interface WritableStreamDefaultController { - readonly attribute AbortSignal signal; - undefined error(optional any e); -}; - -[Exposed=*, Transferable] -interface TransformStream { - constructor(optional object transformer, - optional QueuingStrategy writableStrategy = {}, - optional QueuingStrategy readableStrategy = {}); - - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; - -dictionary Transformer { - TransformerStartCallback start; - TransformerTransformCallback transform; - TransformerFlushCallback flush; - any readableType; - any writableType; -}; - -callback TransformerStartCallback = any (TransformStreamDefaultController controller); -callback TransformerFlushCallback = Promise (TransformStreamDefaultController controller); -callback TransformerTransformCallback = Promise (any chunk, TransformStreamDefaultController controller); - -[Exposed=*] -interface TransformStreamDefaultController { - readonly attribute unrestricted double? desiredSize; - - undefined enqueue(optional any chunk); - undefined error(optional any reason); - undefined terminate(); -}; - -dictionary QueuingStrategy { - unrestricted double highWaterMark; - QueuingStrategySize size; -}; - -callback QueuingStrategySize = unrestricted double (any chunk); - -dictionary QueuingStrategyInit { - required unrestricted double highWaterMark; -}; - -[Exposed=*] -interface ByteLengthQueuingStrategy { - constructor(QueuingStrategyInit init); - - readonly attribute unrestricted double highWaterMark; - readonly attribute Function size; -}; - -[Exposed=*] -interface CountQueuingStrategy { - constructor(QueuingStrategyInit init); - - readonly attribute unrestricted double highWaterMark; - readonly attribute Function size; -}; - -interface mixin GenericTransformStream { - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl new file mode 100644 index 00000000000..b8410e2e072 --- /dev/null +++ b/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader + */ + +[Exposed=(Window,Worker,Worklet)] +interface ReadableStreamBYOBReader { + constructor(ReadableStream stream); + + Promise read(ArrayBufferView view); + undefined releaseLock(); +}; +ReadableStreamBYOBReader includes ReadableStreamGenericReader; + +dictionary ReadableStreamBYOBReadResult { + ArrayBufferView value; + boolean done; +}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl new file mode 100644 index 00000000000..076da905c12 --- /dev/null +++ b/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader + */ + +[Exposed=(Window,Worker,Worklet)] +interface ReadableStreamDefaultReader { + constructor(ReadableStream stream); + + Promise read(); + undefined releaseLock(); +}; +ReadableStreamDefaultReader includes ReadableStreamGenericReader; + +dictionary ReadableStreamDefaultReadResult { + any value; + boolean done; +}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl new file mode 100644 index 00000000000..a6c308dad41 --- /dev/null +++ b/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#readablestreamgenericreader + */ + +interface mixin ReadableStreamGenericReader { + readonly attribute Promise closed; + + Promise cancel(optional any reason); +}; diff --git a/crates/web-sys/webidls/unstable/TransformStream.webidl b/crates/web-sys/webidls/unstable/TransformStream.webidl new file mode 100644 index 00000000000..61275a85237 --- /dev/null +++ b/crates/web-sys/webidls/unstable/TransformStream.webidl @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#transformstream + */ + +[Exposed=(Window,Worker,Worklet), Transferable] +interface TransformStream { + constructor(optional object transformer, optional QueuingStrategy writableStrategy = {}, optional QueuingStrategy readableStrategy = {}); + + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; diff --git a/crates/web-sys/webidls/unstable/WritableStream.webidl b/crates/web-sys/webidls/unstable/WritableStream.webidl new file mode 100644 index 00000000000..0eb709ed3c8 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WritableStream.webidl @@ -0,0 +1,19 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#ws-class-definition + */ + +[Exposed=(Window,Worker,Worklet), Transferable] +interface WritableStream { + constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise abort(optional any reason); + Promise close(); + WritableStreamDefaultWriter getWriter(); +}; diff --git a/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl b/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl new file mode 100644 index 00000000000..9daa09a3d35 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Source: https://streams.spec.whatwg.org/#writablestreamdefaultwriter + */ + +[Exposed=(Window,Worker,Worklet)] +interface WritableStreamDefaultWriter { + constructor(WritableStream stream); + + readonly attribute Promise closed; + readonly attribute unrestricted double? desiredSize; + readonly attribute Promise ready; + + Promise abort(optional any reason); + Promise close(); + undefined releaseLock(); + Promise write(optional any chunk); +}; From e47dda5c8646317c23b41ae1f5496633dd9c3167 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Mon, 5 Sep 2022 23:05:21 -0400 Subject: [PATCH 080/641] web-sys: Added Streams API (#3065) --- crates/web-sys/Cargo.toml | 15 +- .../features/gen_ByteLengthQueuingStrategy.rs | 36 +++ .../src/features/gen_CountQueuingStrategy.rs | 36 +++ .../src/features/gen_QueuingStrategyInit.rs | 40 +++ .../gen_ReadableByteStreamController.rs | 70 ++++++ .../src/features/gen_ReadableStream.rs | 8 - .../gen_ReadableStreamByobReadResult.rs | 70 ------ .../features/gen_ReadableStreamByobReader.rs | 32 --- .../features/gen_ReadableStreamByobRequest.rs | 61 +++++ .../gen_ReadableStreamDefaultController.rs | 59 +++++ .../gen_ReadableStreamDefaultReadResult.rs | 70 ------ .../gen_ReadableStreamDefaultReader.rs | 28 --- .../features/gen_ReadableStreamReadResult.rs | 53 ++++ .../src/features/gen_ReadableStreamType.rs | 10 + .../src/features/gen_ReadableWritablePair.rs | 8 - .../src/features/gen_TransformStream.rs | 12 - .../gen_TransformStreamDefaultController.rs | 62 +++++ .../web-sys/src/features/gen_Transformer.rs | 104 ++++++++ .../src/features/gen_UnderlyingSink.rs | 92 +++++++ .../src/features/gen_UnderlyingSource.rs | 98 ++++++++ .../src/features/gen_WritableStream.rs | 28 +-- .../gen_WritableStreamDefaultController.rs | 36 +++ .../gen_WritableStreamDefaultWriter.rs | 48 +--- crates/web-sys/src/features/mod.rs | 86 ++++++- .../webidls/enabled/ReadableStream.webidl | 47 ---- crates/web-sys/webidls/enabled/Streams.webidl | 232 ++++++++++++++++++ .../unstable/ReadableStreamBYOBReader.webidl | 22 -- .../ReadableStreamDefaultReader.webidl | 22 -- .../ReadableStreamGenericReader.webidl | 14 -- .../webidls/unstable/TransformStream.webidl | 16 -- .../webidls/unstable/WritableStream.webidl | 19 -- .../WritableStreamDefaultWriter.webidl | 22 -- 32 files changed, 1082 insertions(+), 474 deletions(-) create mode 100644 crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs create mode 100644 crates/web-sys/src/features/gen_CountQueuingStrategy.rs create mode 100644 crates/web-sys/src/features/gen_QueuingStrategyInit.rs create mode 100644 crates/web-sys/src/features/gen_ReadableByteStreamController.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs delete mode 100644 crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamReadResult.rs create mode 100644 crates/web-sys/src/features/gen_ReadableStreamType.rs create mode 100644 crates/web-sys/src/features/gen_TransformStreamDefaultController.rs create mode 100644 crates/web-sys/src/features/gen_Transformer.rs create mode 100644 crates/web-sys/src/features/gen_UnderlyingSink.rs create mode 100644 crates/web-sys/src/features/gen_UnderlyingSource.rs create mode 100644 crates/web-sys/src/features/gen_WritableStreamDefaultController.rs delete mode 100644 crates/web-sys/webidls/enabled/ReadableStream.webidl create mode 100644 crates/web-sys/webidls/enabled/Streams.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl delete mode 100644 crates/web-sys/webidls/unstable/TransformStream.webidl delete mode 100644 crates/web-sys/webidls/unstable/WritableStream.webidl delete mode 100644 crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 2dd34862c4b..b0d7067a826 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -150,6 +150,7 @@ BrowserElementExecuteScriptOptions = [] BrowserFeedWriter = [] BrowserFindCaseSensitivity = [] BrowserFindDirection = [] +ByteLengthQueuingStrategy = [] Cache = [] CacheBatchOperation = [] CacheQueryOptions = [] @@ -223,6 +224,7 @@ ConvertCoordinateOptions = [] ConvolverNode = ["AudioNode", "EventTarget"] ConvolverOptions = [] Coordinates = [] +CountQueuingStrategy = [] Credential = [] CredentialCreationOptions = [] CredentialRequestOptions = [] @@ -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 = [] @@ -1319,6 +1325,8 @@ TouchList = [] TrackEvent = ["Event"] TrackEventInit = [] TransformStream = [] +TransformStreamDefaultController = [] +Transformer = [] TransitionEvent = ["Event"] TransitionEventInit = [] Transport = [] @@ -1332,6 +1340,8 @@ UdpMessageEventInit = [] UdpOptions = [] UiEvent = ["Event"] UiEventInit = [] +UnderlyingSink = [] +UnderlyingSource = [] Url = [] UrlSearchParams = [] Usb = ["EventTarget"] @@ -1468,6 +1478,7 @@ Worklet = [] WorkletGlobalScope = [] WorkletOptions = [] WritableStream = [] +WritableStreamDefaultController = [] WritableStreamDefaultWriter = [] XPathExpression = [] XPathNsResolver = [] diff --git a/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs b/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs new file mode 100644 index 00000000000..c29737f5378 --- /dev/null +++ b/crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ByteLengthQueuingStrategy , typescript_type = "ByteLengthQueuingStrategy")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ByteLengthQueuingStrategy` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`*"] + pub type ByteLengthQueuingStrategy; + # [wasm_bindgen (structural , method , getter , js_class = "ByteLengthQueuingStrategy" , js_name = highWaterMark)] + #[doc = "Getter for the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)"] + #[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)] + #[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; + #[cfg(feature = "QueuingStrategyInit")] + #[wasm_bindgen(catch, constructor, js_class = "ByteLengthQueuingStrategy")] + #[doc = "The `new ByteLengthQueuingStrategy(..)` constructor, creating a new instance of `ByteLengthQueuingStrategy`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/ByteLengthQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`, `QueuingStrategyInit`*"] + pub fn new(init: &QueuingStrategyInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_CountQueuingStrategy.rs b/crates/web-sys/src/features/gen_CountQueuingStrategy.rs new file mode 100644 index 00000000000..779ba5b5b5d --- /dev/null +++ b/crates/web-sys/src/features/gen_CountQueuingStrategy.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = CountQueuingStrategy , typescript_type = "CountQueuingStrategy")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `CountQueuingStrategy` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`*"] + pub type CountQueuingStrategy; + # [wasm_bindgen (structural , method , getter , js_class = "CountQueuingStrategy" , js_name = highWaterMark)] + #[doc = "Getter for the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/highWaterMark)"] + #[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)] + #[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; + #[cfg(feature = "QueuingStrategyInit")] + #[wasm_bindgen(catch, constructor, js_class = "CountQueuingStrategy")] + #[doc = "The `new CountQueuingStrategy(..)` constructor, creating a new instance of `CountQueuingStrategy`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/CountQueuingStrategy)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`, `QueuingStrategyInit`*"] + pub fn new(init: &QueuingStrategyInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs new file mode 100644 index 00000000000..89141292fbc --- /dev/null +++ b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs @@ -0,0 +1,40 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = QueuingStrategyInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `QueuingStrategyInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub type QueuingStrategyInit; +} +impl QueuingStrategyInit { + #[doc = "Construct a new `QueuingStrategyInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub fn new(high_water_mark: f64) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.high_water_mark(high_water_mark); + ret + } + #[doc = "Change the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + pub fn high_water_mark(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("highWaterMark"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs new file mode 100644 index 00000000000..df4509417a2 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs @@ -0,0 +1,70 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableByteStreamController , typescript_type = "ReadableByteStreamController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableByteStreamController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController)"] + #[doc = ""] + #[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)] + #[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; + # [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; + # [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) -> 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_array_buffer_view( + this: &ReadableByteStreamController, + chunk: &::js_sys::Object, + ) -> 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], + ) -> Result<(), JsValue>; + # [wasm_bindgen (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)] + #[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); +} diff --git a/crates/web-sys/src/features/gen_ReadableStream.rs b/crates/web-sys/src/features/gen_ReadableStream.rs index a68f982b964..c66b913be9e 100644 --- a/crates/web-sys/src/features/gen_ReadableStream.rs +++ b/crates/web-sys/src/features/gen_ReadableStream.rs @@ -112,7 +112,6 @@ extern "C" { transform: &ReadableWritablePair, options: &StreamPipeOptions, ) -> ReadableStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -120,11 +119,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to(this: &ReadableStream, destination: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "StreamPipeOptions", feature = "WritableStream",))] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)] #[doc = "The `pipeTo()` method."] @@ -132,9 +127,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `StreamPipeOptions`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pipe_to_with_options( this: &ReadableStream, destination: &WritableStream, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs deleted file mode 100644 index eb58aeca844..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReadResult.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReadResult)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamByobReadResult` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type ReadableStreamByobReadResult; -} -#[cfg(web_sys_unstable_apis)] -impl ReadableStreamByobReadResult { - #[doc = "Construct a new `ReadableStreamByobReadResult`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -#[cfg(web_sys_unstable_apis)] -impl Default for ReadableStreamByobReadResult { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs index a630495bad7..1f051255192 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBReader , typescript_type = "ReadableStreamBYOBReader")] @@ -11,22 +10,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamByobReader; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamByobReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamBYOBReader")] #[doc = "The `new ReadableStreamByobReader(..)` constructor, creating a new instance of `ReadableStreamByobReader`."] @@ -34,70 +25,47 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/ReadableStreamBYOBReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_array_buffer_view( this: &ReadableStreamByobReader, view: &::js_sys::Object, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_with_u8_array( this: &ReadableStreamByobReader, view: &mut [u8], ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamByobReader); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamByobReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamByobReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs new file mode 100644 index 00000000000..7638c598d1b --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs @@ -0,0 +1,61 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamBYOBRequest , typescript_type = "ReadableStreamBYOBRequest")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamByobRequest` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"] + pub type ReadableStreamByobRequest; + # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamBYOBRequest" , js_name = view)] + #[doc = "Getter for the `view` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/view)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"] + pub fn view(this: &ReadableStreamByobRequest) -> Option<::js_sys::Object>; + # [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, + ) -> 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, + ) -> 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_array_buffer_view( + this: &ReadableStreamByobRequest, + view: &::js_sys::Object, + ) -> 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], + ) -> Result<(), JsValue>; +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs new file mode 100644 index 00000000000..d721b20aaa7 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs @@ -0,0 +1,59 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultController , typescript_type = "ReadableStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] + pub type ReadableStreamDefaultController; + # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultController" , 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/ReadableStreamDefaultController/desiredSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"] + pub fn desired_size(this: &ReadableStreamDefaultController) -> Option; + # [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) -> 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) -> 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_with_chunk( + this: &ReadableStreamDefaultController, + chunk: &::wasm_bindgen::JsValue, + ) -> Result<(), JsValue>; + # [wasm_bindgen (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)] + #[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); +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs deleted file mode 100644 index 82bbf8ca1e1..00000000000 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultReadResult.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReadResult)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ReadableStreamDefaultReadResult` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type ReadableStreamDefaultReadResult; -} -#[cfg(web_sys_unstable_apis)] -impl ReadableStreamDefaultReadResult { - #[doc = "Construct a new `ReadableStreamDefaultReadResult`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReadResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} -#[cfg(web_sys_unstable_apis)] -impl Default for ReadableStreamDefaultReadResult { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs index e47c2a3073f..6b12a74ca6b 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamDefaultReader.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamDefaultReader , typescript_type = "ReadableStreamDefaultReader")] @@ -11,22 +10,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ReadableStreamDefaultReader; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ReadableStreamDefaultReader" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] #[wasm_bindgen(catch, constructor, js_class = "ReadableStreamDefaultReader")] #[doc = "The `new ReadableStreamDefaultReader(..)` constructor, creating a new instance of `ReadableStreamDefaultReader`."] @@ -34,53 +25,34 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/ReadableStreamDefaultReader)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &ReadableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (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`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &ReadableStreamDefaultReader); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)] #[doc = "The `cancel()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/cancel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancel_with_reason( this: &ReadableStreamDefaultReader, reason: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs new file mode 100644 index 00000000000..794dc0e9b0a --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs @@ -0,0 +1,53 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableStreamReadResult)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ReadableStreamReadResult` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub type ReadableStreamReadResult; +} +impl ReadableStreamReadResult { + #[doc = "Construct a new `ReadableStreamReadResult`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn done(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for ReadableStreamReadResult { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ReadableStreamType.rs b/crates/web-sys/src/features/gen_ReadableStreamType.rs new file mode 100644 index 00000000000..5bbe4467f36 --- /dev/null +++ b/crates/web-sys/src/features/gen_ReadableStreamType.rs @@ -0,0 +1,10 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ReadableStreamType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ReadableStreamType { + Bytes = "bytes", +} diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index 0ce861e74ab..8a34d98aca5 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -11,14 +11,10 @@ extern "C" { pub type ReadableWritablePair; } impl ReadableWritablePair { - #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))] #[doc = "Construct a new `ReadableWritablePair`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); @@ -44,14 +40,10 @@ impl ReadableWritablePair { let _ = r; self } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[doc = "Change the `writable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(&mut self, val: &WritableStream) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( diff --git a/crates/web-sys/src/features/gen_TransformStream.rs b/crates/web-sys/src/features/gen_TransformStream.rs index d2a041a700c..9dd64d45d33 100644 --- a/crates/web-sys/src/features/gen_TransformStream.rs +++ b/crates/web-sys/src/features/gen_TransformStream.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStream , typescript_type = "TransformStream")] @@ -11,11 +10,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TransformStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ReadableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = readable)] #[doc = "Getter for the `readable` field of this object."] @@ -23,11 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/readable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `TransformStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn readable(this: &TransformStream) -> ReadableStream; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] # [wasm_bindgen (structural , method , getter , js_class = "TransformStream" , js_name = writable)] #[doc = "Getter for the `writable` field of this object."] @@ -35,9 +26,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/writable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransformStream`, `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn writable(this: &TransformStream) -> WritableStream; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "TransformStream")] diff --git a/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs b/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs new file mode 100644 index 00000000000..6e4722973a5 --- /dev/null +++ b/crates/web-sys/src/features/gen_TransformStreamDefaultController.rs @@ -0,0 +1,62 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TransformStreamDefaultController , typescript_type = "TransformStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TransformStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub type TransformStreamDefaultController; + # [wasm_bindgen (structural , method , getter , js_class = "TransformStreamDefaultController" , 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/TransformStreamDefaultController/desiredSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn desired_size(this: &TransformStreamDefaultController) -> Option; + # [wasm_bindgen (catch , method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] + #[doc = "The `enqueue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn enqueue(this: &TransformStreamDefaultController) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "TransformStreamDefaultController" , js_name = enqueue)] + #[doc = "The `enqueue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn enqueue_with_chunk( + this: &TransformStreamDefaultController, + chunk: &::wasm_bindgen::JsValue, + ) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn error(this: &TransformStreamDefaultController); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn error_with_reason( + this: &TransformStreamDefaultController, + reason: &::wasm_bindgen::JsValue, + ); + # [wasm_bindgen (method , structural , js_class = "TransformStreamDefaultController" , js_name = terminate)] + #[doc = "The `terminate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/terminate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransformStreamDefaultController`*"] + pub fn terminate(this: &TransformStreamDefaultController); +} diff --git a/crates/web-sys/src/features/gen_Transformer.rs b/crates/web-sys/src/features/gen_Transformer.rs new file mode 100644 index 00000000000..c0dddae0727 --- /dev/null +++ b/crates/web-sys/src/features/gen_Transformer.rs @@ -0,0 +1,104 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Transformer)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Transformer` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub type Transformer; +} +impl Transformer { + #[doc = "Construct a new `Transformer`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn flush(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flush"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `readableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn readable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("readableType"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn transform(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("transform"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `writableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + pub fn writable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("writableType"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for Transformer { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_UnderlyingSink.rs b/crates/web-sys/src/features/gen_UnderlyingSink.rs new file mode 100644 index 00000000000..dd69488671c --- /dev/null +++ b/crates/web-sys/src/features/gen_UnderlyingSink.rs @@ -0,0 +1,92 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSink)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UnderlyingSink` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub type UnderlyingSink; +} +impl UnderlyingSink { + #[doc = "Construct a new `UnderlyingSink`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `abort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn abort(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("abort"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `close` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn close(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("close"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn type_(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + pub fn write(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("write"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for UnderlyingSink { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_UnderlyingSource.rs b/crates/web-sys/src/features/gen_UnderlyingSource.rs new file mode 100644 index 00000000000..a6a90943179 --- /dev/null +++ b/crates/web-sys/src/features/gen_UnderlyingSource.rs @@ -0,0 +1,98 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UnderlyingSource)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UnderlyingSource` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub type UnderlyingSource; +} +impl UnderlyingSource { + #[doc = "Construct a new `UnderlyingSource`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `autoAllocateChunkSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn auto_allocate_chunk_size(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("autoAllocateChunkSize"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `cancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn cancel(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cancel"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `pull` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn pull(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pull"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ReadableStreamType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] + pub fn type_(&mut self, val: ReadableStreamType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for UnderlyingSource { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WritableStream.rs b/crates/web-sys/src/features/gen_WritableStream.rs index 7f9ed141e58..48124a3b88d 100644 --- a/crates/web-sys/src/features/gen_WritableStream.rs +++ b/crates/web-sys/src/features/gen_WritableStream.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStream , typescript_type = "WritableStream")] @@ -11,20 +10,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStream; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStream" , js_name = locked)] #[doc = "Getter for the `locked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/locked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn locked(this: &WritableStream) -> bool; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "WritableStream")] @@ -65,52 +57,36 @@ extern "C" { underlying_sink: &::js_sys::Object, strategy: &QueuingStrategy, ) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStream, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStream) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStreamDefaultWriter")] - # [wasm_bindgen (method , structural , js_class = "WritableStream" , js_name = getWriter)] + # [wasm_bindgen (catch , method , structural , js_class = "WritableStream" , js_name = getWriter)] #[doc = "The `getWriter()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/getWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_writer(this: &WritableStream) -> WritableStreamDefaultWriter; + pub fn get_writer(this: &WritableStream) -> Result; } diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs new file mode 100644 index 00000000000..424a635c96a --- /dev/null +++ b/crates/web-sys/src/features/gen_WritableStreamDefaultController.rs @@ -0,0 +1,36 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultController , typescript_type = "WritableStreamDefaultController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WritableStreamDefaultController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub type WritableStreamDefaultController; + #[cfg(feature = "AbortSignal")] + # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultController" , js_name = signal)] + #[doc = "Getter for the `signal` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/signal)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WritableStreamDefaultController`*"] + pub fn signal(this: &WritableStreamDefaultController) -> AbortSignal; + # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub fn error(this: &WritableStreamDefaultController); + # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultController" , js_name = error)] + #[doc = "The `error()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController/error)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultController`*"] + pub fn error_with_e(this: &WritableStreamDefaultController, e: &::wasm_bindgen::JsValue); +} diff --git a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs index 1ba5bd8b6ce..2cda53f95a6 100644 --- a/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs +++ b/crates/web-sys/src/features/gen_WritableStreamDefaultWriter.rs @@ -1,7 +1,6 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WritableStreamDefaultWriter , typescript_type = "WritableStreamDefaultWriter")] @@ -11,44 +10,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WritableStreamDefaultWriter; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = closed)] #[doc = "Getter for the `closed` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/closed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = desiredSize)] + # [wasm_bindgen (structural , catch , method , getter , js_class = "WritableStreamDefaultWriter" , 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/WritableStreamDefaultWriter/desiredSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn desired_size(this: &WritableStreamDefaultWriter) -> Option; - #[cfg(web_sys_unstable_apis)] + pub fn desired_size(this: &WritableStreamDefaultWriter) -> Result, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "WritableStreamDefaultWriter" , js_name = ready)] #[doc = "Getter for the `ready` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/ready)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ready(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WritableStream")] #[wasm_bindgen(catch, constructor, js_class = "WritableStreamDefaultWriter")] #[doc = "The `new WritableStreamDefaultWriter(..)` constructor, creating a new instance of `WritableStreamDefaultWriter`."] @@ -56,78 +39,51 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/WritableStreamDefaultWriter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStream`, `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(stream: &WritableStream) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn abort_with_reason( this: &WritableStreamDefaultWriter, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/close)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = releaseLock)] #[doc = "The `releaseLock()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/releaseLock)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn release_lock(this: &WritableStreamDefaultWriter); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write(this: &WritableStreamDefaultWriter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WritableStreamDefaultWriter" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WritableStreamDefaultWriter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_with_chunk( this: &WritableStreamDefaultWriter, chunk: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 59d6818792d..dfb2a94cac1 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -718,6 +718,12 @@ mod gen_BrowserFindDirection; #[cfg(feature = "BrowserFindDirection")] pub use gen_BrowserFindDirection::*; +#[cfg(feature = "ByteLengthQueuingStrategy")] +#[allow(non_snake_case)] +mod gen_ByteLengthQueuingStrategy; +#[cfg(feature = "ByteLengthQueuingStrategy")] +pub use gen_ByteLengthQueuingStrategy::*; + #[cfg(feature = "Cache")] #[allow(non_snake_case)] mod gen_Cache; @@ -1156,6 +1162,12 @@ mod gen_Coordinates; #[cfg(feature = "Coordinates")] pub use gen_Coordinates::*; +#[cfg(feature = "CountQueuingStrategy")] +#[allow(non_snake_case)] +mod gen_CountQueuingStrategy; +#[cfg(feature = "CountQueuingStrategy")] +pub use gen_CountQueuingStrategy::*; + #[cfg(feature = "Credential")] #[allow(non_snake_case)] mod gen_Credential; @@ -5656,6 +5668,12 @@ mod gen_QueuingStrategy; #[cfg(feature = "QueuingStrategy")] pub use gen_QueuingStrategy::*; +#[cfg(feature = "QueuingStrategyInit")] +#[allow(non_snake_case)] +mod gen_QueuingStrategyInit; +#[cfg(feature = "QueuingStrategyInit")] +pub use gen_QueuingStrategyInit::*; + #[cfg(feature = "RadioNodeList")] #[allow(non_snake_case)] mod gen_RadioNodeList; @@ -5680,29 +5698,35 @@ mod gen_RcwnStatus; #[cfg(feature = "RcwnStatus")] pub use gen_RcwnStatus::*; +#[cfg(feature = "ReadableByteStreamController")] +#[allow(non_snake_case)] +mod gen_ReadableByteStreamController; +#[cfg(feature = "ReadableByteStreamController")] +pub use gen_ReadableByteStreamController::*; + #[cfg(feature = "ReadableStream")] #[allow(non_snake_case)] mod gen_ReadableStream; #[cfg(feature = "ReadableStream")] pub use gen_ReadableStream::*; -#[cfg(feature = "ReadableStreamByobReadResult")] -#[allow(non_snake_case)] -mod gen_ReadableStreamByobReadResult; -#[cfg(feature = "ReadableStreamByobReadResult")] -pub use gen_ReadableStreamByobReadResult::*; - #[cfg(feature = "ReadableStreamByobReader")] #[allow(non_snake_case)] mod gen_ReadableStreamByobReader; #[cfg(feature = "ReadableStreamByobReader")] pub use gen_ReadableStreamByobReader::*; -#[cfg(feature = "ReadableStreamDefaultReadResult")] +#[cfg(feature = "ReadableStreamByobRequest")] #[allow(non_snake_case)] -mod gen_ReadableStreamDefaultReadResult; -#[cfg(feature = "ReadableStreamDefaultReadResult")] -pub use gen_ReadableStreamDefaultReadResult::*; +mod gen_ReadableStreamByobRequest; +#[cfg(feature = "ReadableStreamByobRequest")] +pub use gen_ReadableStreamByobRequest::*; + +#[cfg(feature = "ReadableStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_ReadableStreamDefaultController; +#[cfg(feature = "ReadableStreamDefaultController")] +pub use gen_ReadableStreamDefaultController::*; #[cfg(feature = "ReadableStreamDefaultReader")] #[allow(non_snake_case)] @@ -5722,12 +5746,24 @@ mod gen_ReadableStreamIteratorOptions; #[cfg(feature = "ReadableStreamIteratorOptions")] pub use gen_ReadableStreamIteratorOptions::*; +#[cfg(feature = "ReadableStreamReadResult")] +#[allow(non_snake_case)] +mod gen_ReadableStreamReadResult; +#[cfg(feature = "ReadableStreamReadResult")] +pub use gen_ReadableStreamReadResult::*; + #[cfg(feature = "ReadableStreamReaderMode")] #[allow(non_snake_case)] mod gen_ReadableStreamReaderMode; #[cfg(feature = "ReadableStreamReaderMode")] pub use gen_ReadableStreamReaderMode::*; +#[cfg(feature = "ReadableStreamType")] +#[allow(non_snake_case)] +mod gen_ReadableStreamType; +#[cfg(feature = "ReadableStreamType")] +pub use gen_ReadableStreamType::*; + #[cfg(feature = "ReadableWritablePair")] #[allow(non_snake_case)] mod gen_ReadableWritablePair; @@ -7732,6 +7768,18 @@ mod gen_TransformStream; #[cfg(feature = "TransformStream")] pub use gen_TransformStream::*; +#[cfg(feature = "TransformStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_TransformStreamDefaultController; +#[cfg(feature = "TransformStreamDefaultController")] +pub use gen_TransformStreamDefaultController::*; + +#[cfg(feature = "Transformer")] +#[allow(non_snake_case)] +mod gen_Transformer; +#[cfg(feature = "Transformer")] +pub use gen_Transformer::*; + #[cfg(feature = "TransitionEvent")] #[allow(non_snake_case)] mod gen_TransitionEvent; @@ -7810,6 +7858,18 @@ mod gen_UiEventInit; #[cfg(feature = "UiEventInit")] pub use gen_UiEventInit::*; +#[cfg(feature = "UnderlyingSink")] +#[allow(non_snake_case)] +mod gen_UnderlyingSink; +#[cfg(feature = "UnderlyingSink")] +pub use gen_UnderlyingSink::*; + +#[cfg(feature = "UnderlyingSource")] +#[allow(non_snake_case)] +mod gen_UnderlyingSource; +#[cfg(feature = "UnderlyingSource")] +pub use gen_UnderlyingSource::*; + #[cfg(feature = "Url")] #[allow(non_snake_case)] mod gen_Url; @@ -8626,6 +8686,12 @@ mod gen_WritableStream; #[cfg(feature = "WritableStream")] pub use gen_WritableStream::*; +#[cfg(feature = "WritableStreamDefaultController")] +#[allow(non_snake_case)] +mod gen_WritableStreamDefaultController; +#[cfg(feature = "WritableStreamDefaultController")] +pub use gen_WritableStreamDefaultController::*; + #[cfg(feature = "WritableStreamDefaultWriter")] #[allow(non_snake_case)] mod gen_WritableStreamDefaultWriter; diff --git a/crates/web-sys/webidls/enabled/ReadableStream.webidl b/crates/web-sys/webidls/enabled/ReadableStream.webidl deleted file mode 100644 index 00c8bbc8a4a..00000000000 --- a/crates/web-sys/webidls/enabled/ReadableStream.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#rs-class-definition - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface ReadableStream { - constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise cancel(optional any reason); - ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); - ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); - Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); - sequence tee(); - - async iterable(optional ReadableStreamIteratorOptions options = {}); -}; - -typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; - -enum ReadableStreamReaderMode { "byob" }; - -dictionary ReadableStreamGetReaderOptions { - ReadableStreamReaderMode mode; -}; - -dictionary ReadableStreamIteratorOptions { - boolean preventCancel = false; -}; - -dictionary ReadableWritablePair { - required ReadableStream readable; - required WritableStream writable; -}; - -dictionary StreamPipeOptions { - boolean preventClose = false; - boolean preventAbort = false; - boolean preventCancel = false; - AbortSignal signal; -}; diff --git a/crates/web-sys/webidls/enabled/Streams.webidl b/crates/web-sys/webidls/enabled/Streams.webidl new file mode 100644 index 00000000000..bf57ef4ff11 --- /dev/null +++ b/crates/web-sys/webidls/enabled/Streams.webidl @@ -0,0 +1,232 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ + +/* Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative + * Commons Attribution 4.0 International License. To the extent portions of it are incorporated into + * source code, such portions in the source code are licensed under the BSD 3-Clause License + * instead. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#idl-index + * `[Throws]` attribute for each method was determined by manually checking if the method can throw + * an exception according to the spec. + * To avoid API breakage, `[Throws]` attributes are omitted from `ReadableStream` methods. + */ + +[Exposed=*, Transferable] +interface ReadableStream { + constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise cancel(optional any reason); + ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); + ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); + Promise pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); + sequence tee(); + + async iterable(optional ReadableStreamIteratorOptions options = {}); +}; + +typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; + +enum ReadableStreamReaderMode { "byob" }; + +dictionary ReadableStreamGetReaderOptions { + ReadableStreamReaderMode mode; +}; + +dictionary ReadableStreamIteratorOptions { + boolean preventCancel = false; +}; + +dictionary ReadableWritablePair { + required ReadableStream readable; + required WritableStream writable; +}; + +dictionary StreamPipeOptions { + boolean preventClose = false; + boolean preventAbort = false; + boolean preventCancel = false; + AbortSignal signal; +}; + +dictionary UnderlyingSource { + UnderlyingSourceStartCallback start; + UnderlyingSourcePullCallback pull; + UnderlyingSourceCancelCallback cancel; + ReadableStreamType type; + [EnforceRange] unsigned long long autoAllocateChunkSize; +}; + +typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; + +callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); +callback UnderlyingSourcePullCallback = Promise (ReadableStreamController controller); +callback UnderlyingSourceCancelCallback = Promise (optional any reason); + +enum ReadableStreamType { "bytes" }; + +interface mixin ReadableStreamGenericReader { + readonly attribute Promise closed; + + Promise cancel(optional any reason); +}; + +[Exposed=*] +interface ReadableStreamDefaultReader { + [Throws] constructor(ReadableStream stream); + + Promise read(); + undefined releaseLock(); +}; +ReadableStreamDefaultReader includes ReadableStreamGenericReader; + +dictionary ReadableStreamReadResult { + any value; + boolean done; +}; + +[Exposed=*] +interface ReadableStreamBYOBReader { + [Throws] constructor(ReadableStream stream); + + Promise read(ArrayBufferView view); + undefined releaseLock(); +}; +ReadableStreamBYOBReader includes ReadableStreamGenericReader; + +[Exposed=*] +interface ReadableStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + + [Throws] undefined close(); + [Throws] undefined enqueue(optional any chunk); + undefined error(optional any e); +}; + +[Exposed=*] +interface ReadableByteStreamController { + readonly attribute ReadableStreamBYOBRequest? byobRequest; + readonly attribute unrestricted double? desiredSize; + + [Throws] undefined close(); + [Throws] undefined enqueue(ArrayBufferView chunk); + undefined error(optional any e); +}; + +[Exposed=*] +interface ReadableStreamBYOBRequest { + readonly attribute ArrayBufferView? view; + + [Throws] undefined respond([EnforceRange] unsigned long long bytesWritten); + [Throws] undefined respondWithNewView(ArrayBufferView view); +}; + +[Exposed=*, Transferable] +interface WritableStream { + [Throws] constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + Promise abort(optional any reason); + Promise close(); + [Throws] WritableStreamDefaultWriter getWriter(); +}; + +dictionary UnderlyingSink { + UnderlyingSinkStartCallback start; + UnderlyingSinkWriteCallback write; + UnderlyingSinkCloseCallback close; + UnderlyingSinkAbortCallback abort; + any type; +}; + +callback UnderlyingSinkStartCallback = any (WritableStreamDefaultController controller); +callback UnderlyingSinkWriteCallback = Promise (any chunk, WritableStreamDefaultController controller); +callback UnderlyingSinkCloseCallback = Promise (); +callback UnderlyingSinkAbortCallback = Promise (optional any reason); + +[Exposed=*] +interface WritableStreamDefaultWriter { + [Throws] constructor(WritableStream stream); + + readonly attribute Promise closed; + [Throws] readonly attribute unrestricted double? desiredSize; + readonly attribute Promise ready; + + Promise abort(optional any reason); + Promise close(); + undefined releaseLock(); + Promise write(optional any chunk); +}; + +[Exposed=*] +interface WritableStreamDefaultController { + readonly attribute AbortSignal signal; + undefined error(optional any e); +}; + +[Exposed=*, Transferable] +interface TransformStream { + [Throws] + constructor(optional object transformer, + optional QueuingStrategy writableStrategy = {}, + optional QueuingStrategy readableStrategy = {}); + + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; + +dictionary Transformer { + TransformerStartCallback start; + TransformerTransformCallback transform; + TransformerFlushCallback flush; + any readableType; + any writableType; +}; + +callback TransformerStartCallback = any (TransformStreamDefaultController controller); +callback TransformerFlushCallback = Promise (TransformStreamDefaultController controller); +callback TransformerTransformCallback = Promise (any chunk, TransformStreamDefaultController controller); + +[Exposed=*] +interface TransformStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + + [Throws] undefined enqueue(optional any chunk); + undefined error(optional any reason); + undefined terminate(); +}; + +dictionary QueuingStrategy { + unrestricted double highWaterMark; + QueuingStrategySize size; +}; + +callback QueuingStrategySize = unrestricted double (any chunk); + +dictionary QueuingStrategyInit { + required unrestricted double highWaterMark; +}; + +[Exposed=*] +interface ByteLengthQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; +}; + +[Exposed=*] +interface CountQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + readonly attribute Function size; +}; + +interface mixin GenericTransformStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl deleted file mode 100644 index b8410e2e072..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader - */ - -[Exposed=(Window,Worker,Worklet)] -interface ReadableStreamBYOBReader { - constructor(ReadableStream stream); - - Promise read(ArrayBufferView view); - undefined releaseLock(); -}; -ReadableStreamBYOBReader includes ReadableStreamGenericReader; - -dictionary ReadableStreamBYOBReadResult { - ArrayBufferView value; - boolean done; -}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl deleted file mode 100644 index 076da905c12..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamDefaultReader.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader - */ - -[Exposed=(Window,Worker,Worklet)] -interface ReadableStreamDefaultReader { - constructor(ReadableStream stream); - - Promise read(); - undefined releaseLock(); -}; -ReadableStreamDefaultReader includes ReadableStreamGenericReader; - -dictionary ReadableStreamDefaultReadResult { - any value; - boolean done; -}; diff --git a/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl b/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl deleted file mode 100644 index a6c308dad41..00000000000 --- a/crates/web-sys/webidls/unstable/ReadableStreamGenericReader.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#readablestreamgenericreader - */ - -interface mixin ReadableStreamGenericReader { - readonly attribute Promise closed; - - Promise cancel(optional any reason); -}; diff --git a/crates/web-sys/webidls/unstable/TransformStream.webidl b/crates/web-sys/webidls/unstable/TransformStream.webidl deleted file mode 100644 index 61275a85237..00000000000 --- a/crates/web-sys/webidls/unstable/TransformStream.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#transformstream - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface TransformStream { - constructor(optional object transformer, optional QueuingStrategy writableStrategy = {}, optional QueuingStrategy readableStrategy = {}); - - readonly attribute ReadableStream readable; - readonly attribute WritableStream writable; -}; diff --git a/crates/web-sys/webidls/unstable/WritableStream.webidl b/crates/web-sys/webidls/unstable/WritableStream.webidl deleted file mode 100644 index 0eb709ed3c8..00000000000 --- a/crates/web-sys/webidls/unstable/WritableStream.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#ws-class-definition - */ - -[Exposed=(Window,Worker,Worklet), Transferable] -interface WritableStream { - constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); - - readonly attribute boolean locked; - - Promise abort(optional any reason); - Promise close(); - WritableStreamDefaultWriter getWriter(); -}; diff --git a/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl b/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl deleted file mode 100644 index 9daa09a3d35..00000000000 --- a/crates/web-sys/webidls/unstable/WritableStreamDefaultWriter.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Source: https://streams.spec.whatwg.org/#writablestreamdefaultwriter - */ - -[Exposed=(Window,Worker,Worklet)] -interface WritableStreamDefaultWriter { - constructor(WritableStream stream); - - readonly attribute Promise closed; - readonly attribute unrestricted double? desiredSize; - readonly attribute Promise ready; - - Promise abort(optional any reason); - Promise close(); - undefined releaseLock(); - Promise write(optional any chunk); -}; From 5c28993bec755386a92d635162cd5a17cad653f5 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 6 Sep 2022 08:38:25 +0200 Subject: [PATCH 081/641] Update WebGPU's webidl (#3067) --- crates/web-sys/src/features/gen_GpuBuffer.rs | 12 ++++ .../src/features/gen_GpuBufferMapState.rs | 16 +++++ .../src/features/gen_GpuErrorFilter.rs | 3 +- .../src/features/gen_GpuFeatureName.rs | 1 + .../src/features/gen_GpuInternalError.rs | 29 ++++++++ .../src/features/gen_GpuSupportedLimits.rs | 33 +++++++++ crates/web-sys/src/features/mod.rs | 12 ++++ crates/web-sys/webidls/unstable/WebGPU.webidl | 69 ++++++++++++------- 8 files changed, 149 insertions(+), 26 deletions(-) create mode 100644 crates/web-sys/src/features/gen_GpuBufferMapState.rs create mode 100644 crates/web-sys/src/features/gen_GpuInternalError.rs diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index 0536da1a77e..ce58b85dfd1 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -38,6 +38,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(this: &GpuBuffer) -> u32; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBufferMapState")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUBuffer" , js_name = mapState)] + #[doc = "Getter for the `mapState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuBufferMapState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn map_state(this: &GpuBuffer) -> GpuBufferMapState; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUBuffer" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuBufferMapState.rs b/crates/web-sys/src/features/gen_GpuBufferMapState.rs new file mode 100644 index 00000000000..26bb64a842d --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuBufferMapState.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GpuBufferMapState` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GpuBufferMapState`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GpuBufferMapState { + Unmapped = "unmapped", + Pending = "pending", + Mapped = "mapped", +} diff --git a/crates/web-sys/src/features/gen_GpuErrorFilter.rs b/crates/web-sys/src/features/gen_GpuErrorFilter.rs index 9c84cc776ed..36244a057e1 100644 --- a/crates/web-sys/src/features/gen_GpuErrorFilter.rs +++ b/crates/web-sys/src/features/gen_GpuErrorFilter.rs @@ -10,6 +10,7 @@ use wasm_bindgen::prelude::*; #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuErrorFilter { - OutOfMemory = "out-of-memory", Validation = "validation", + OutOfMemory = "out-of-memory", + Internal = "internal", } diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index 70537802bfc..9a34268bee1 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -19,4 +19,5 @@ pub enum GpuFeatureName { IndirectFirstInstance = "indirect-first-instance", ShaderF16 = "shader-f16", Bgra8unormStorage = "bgra8unorm-storage", + Rg11b10ufloatRenderable = "rg11b10ufloat-renderable", } diff --git a/crates/web-sys/src/features/gen_GpuInternalError.rs b/crates/web-sys/src/features/gen_GpuInternalError.rs new file mode 100644 index 00000000000..3625b54dda9 --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuInternalError.rs @@ -0,0 +1,29 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = GpuError , extends = :: js_sys :: Object , js_name = GPUInternalError , typescript_type = "GPUInternalError")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuInternalError` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUInternalError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuInternalError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuInternalError; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "GPUInternalError")] + #[doc = "The `new GpuInternalError(..)` constructor, creating a new instance of `GpuInternalError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUInternalError/GPUInternalError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuInternalError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(message: &str) -> Result; +} diff --git a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs index 80b94bb75b8..4751a20211e 100644 --- a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs +++ b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs @@ -71,6 +71,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_bind_groups(this: &GpuSupportedLimits) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxBindingsPerBindGroup)] + #[doc = "Getter for the `maxBindingsPerBindGroup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxBindingsPerBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_bindings_per_bind_group(this: &GpuSupportedLimits) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxDynamicUniformBuffersPerPipelineLayout)] #[doc = "Getter for the `maxDynamicUniformBuffersPerPipelineLayout` field of this object."] #[doc = ""] @@ -203,6 +214,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_vertex_buffers(this: &GpuSupportedLimits) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxBufferSize)] + #[doc = "Getter for the `maxBufferSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxBufferSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_buffer_size(this: &GpuSupportedLimits) -> f64; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxVertexAttributes)] #[doc = "Getter for the `maxVertexAttributes` field of this object."] #[doc = ""] @@ -258,6 +280,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_color_attachments(this: &GpuSupportedLimits) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxColorAttachmentBytesPerPixel)] + #[doc = "Getter for the `maxColorAttachmentBytesPerPixel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxColorAttachmentBytesPerPixel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_color_attachment_bytes_per_pixel(this: &GpuSupportedLimits) -> u32; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxComputeWorkgroupStorageSize)] #[doc = "Getter for the `maxComputeWorkgroupStorageSize` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index dfb2a94cac1..02b8f667c27 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2488,6 +2488,12 @@ mod gen_GpuBufferDescriptor; #[cfg(feature = "GpuBufferDescriptor")] pub use gen_GpuBufferDescriptor::*; +#[cfg(feature = "GpuBufferMapState")] +#[allow(non_snake_case)] +mod gen_GpuBufferMapState; +#[cfg(feature = "GpuBufferMapState")] +pub use gen_GpuBufferMapState::*; + #[cfg(feature = "GpuCanvasAlphaMode")] #[allow(non_snake_case)] mod gen_GpuCanvasAlphaMode; @@ -2734,6 +2740,12 @@ mod gen_GpuIndexFormat; #[cfg(feature = "GpuIndexFormat")] pub use gen_GpuIndexFormat::*; +#[cfg(feature = "GpuInternalError")] +#[allow(non_snake_case)] +mod gen_GpuInternalError; +#[cfg(feature = "GpuInternalError")] +pub use gen_GpuInternalError::*; + #[cfg(feature = "GpuLoadOp")] #[allow(non_snake_case)] mod gen_GpuLoadOp; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 689d7fdbfcb..e481dd5d9c8 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -13,6 +13,7 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension3D; readonly attribute unsigned long maxTextureArrayLayers; readonly attribute unsigned long maxBindGroups; + readonly attribute unsigned long maxBindingsPerBindGroup; readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout; readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout; readonly attribute unsigned long maxSampledTexturesPerShaderStage; @@ -25,11 +26,13 @@ interface GPUSupportedLimits { readonly attribute unsigned long minUniformBufferOffsetAlignment; readonly attribute unsigned long minStorageBufferOffsetAlignment; readonly attribute unsigned long maxVertexBuffers; + readonly attribute unsigned long long maxBufferSize; readonly attribute unsigned long maxVertexAttributes; readonly attribute unsigned long maxVertexBufferArrayStride; readonly attribute unsigned long maxInterStageShaderComponents; readonly attribute unsigned long maxInterStageShaderVariables; readonly attribute unsigned long maxColorAttachments; + readonly attribute unsigned long maxColorAttachmentBytesPerPixel; readonly attribute unsigned long maxComputeWorkgroupStorageSize; readonly attribute unsigned long maxComputeInvocationsPerWorkgroup; readonly attribute unsigned long maxComputeWorkgroupSizeX; @@ -45,10 +48,10 @@ interface GPUSupportedFeatures { [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUAdapterInfo { - readonly attribute DOMString vendor; - readonly attribute DOMString architecture; - readonly attribute DOMString device; - readonly attribute DOMString description; + readonly attribute DOMString vendor; + readonly attribute DOMString architecture; + readonly attribute DOMString device; + readonly attribute DOMString description; }; interface mixin NavigatorGPU { @@ -98,7 +101,8 @@ enum GPUFeatureName { "timestamp-query", "indirect-first-instance", "shader-f16", - "bgra8unorm-storage" + "bgra8unorm-storage", + "rg11b10ufloat-renderable" }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -134,17 +138,25 @@ GPUDevice includes GPUObjectBase; [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUBuffer { + readonly attribute GPUSize64 size; + readonly attribute GPUBufferUsageFlags usage; + + readonly attribute GPUBufferMapState mapState; + Promise mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); undefined unmap(); undefined destroy(); - - readonly attribute GPUSize64 size; - readonly attribute GPUBufferUsageFlags usage; }; GPUBuffer includes GPUObjectBase; +enum GPUBufferMapState { + "unmapped", + "pending", + "mapped" +}; + dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { required GPUSize64 size; required GPUBufferUsageFlags usage; @@ -889,12 +901,12 @@ dictionary GPUImageCopyExternalImage { interface mixin GPUBindingCommandsMixin { undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, - optional sequence dynamicOffsets = []); + optional sequence dynamicOffsets = []); undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, - Uint32Array dynamicOffsetsData, - GPUSize64 dynamicOffsetsDataStart, - GPUSize32 dynamicOffsetsDataLength); + Uint32Array dynamicOffsetsData, + GPUSize64 dynamicOffsetsDataStart, + GPUSize32 dynamicOffsetsDataLength); }; interface mixin GPUDebugCommandsMixin { @@ -936,8 +948,8 @@ dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { [Exposed=(Window, DedicatedWorker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, - float width, float height, - float minDepth, float maxDepth); + float width, float height, + float minDepth, float maxDepth); undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y, GPUIntegerCoordinate width, GPUIntegerCoordinate height); @@ -1024,11 +1036,11 @@ interface mixin GPURenderCommandsMixin { undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size); undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); + optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstIndex = 0, - optional GPUSignedOffset32 baseVertex = 0, - optional GPUSize32 firstInstance = 0); + optional GPUSize32 firstIndex = 0, + optional GPUSignedOffset32 baseVertex = 0, + optional GPUSize32 firstInstance = 0); undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); @@ -1143,26 +1155,32 @@ partial interface GPUDevice { readonly attribute Promise lost; }; -enum GPUErrorFilter { - "out-of-memory", - "validation" -}; - [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUError { readonly attribute DOMString message; }; +[Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUValidationError : GPUError { + constructor(DOMString message); +}; + [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUOutOfMemoryError : GPUError { constructor(DOMString message); }; [Exposed=(Window, DedicatedWorker), SecureContext] -interface GPUValidationError : GPUError { +interface GPUInternalError : GPUError { constructor(DOMString message); }; +enum GPUErrorFilter { + "validation", + "out-of-memory", + "internal" +}; + partial interface GPUDevice { undefined pushErrorScope(GPUErrorFilter filter); Promise popErrorScope(); @@ -1174,7 +1192,7 @@ interface GPUUncapturedErrorEvent : Event { DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict ); - readonly attribute GPUError error; + [SameObject] readonly attribute GPUError error; }; dictionary GPUUncapturedErrorEventInit : EventInit { @@ -1226,3 +1244,4 @@ dictionary GPUExtent3DDict { GPUIntegerCoordinate depthOrArrayLayers = 1; }; typedef (sequence or GPUExtent3DDict) GPUExtent3D; + From edc5adf4365831a5c9cc8b9a62cff9b011a9103f Mon Sep 17 00:00:00 2001 From: Nam Se Hyun <3580430+namse@users.noreply.github.com> Date: Wed, 7 Sep 2022 00:50:29 +0900 Subject: [PATCH 082/641] Put FontFace constructor to Immutable slice whitelist (#3072) * Put FontFace constructor to Immutable slice whitelist * Update gen_FontFace.rs --- crates/web-sys/src/features/gen_FontFace.rs | 4 ++-- crates/webidl/src/constants.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/web-sys/src/features/gen_FontFace.rs b/crates/web-sys/src/features/gen_FontFace.rs index 4c841ed0c75..b1c93184a97 100644 --- a/crates/web-sys/src/features/gen_FontFace.rs +++ b/crates/web-sys/src/features/gen_FontFace.rs @@ -185,7 +185,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn new_with_u8_array(family: &str, source: &mut [u8]) -> Result; + pub fn new_with_u8_array(family: &str, source: &[u8]) -> Result; #[cfg(feature = "FontFaceDescriptors")] #[wasm_bindgen(catch, constructor, js_class = "FontFace")] #[doc = "The `new FontFace(..)` constructor, creating a new instance of `FontFace`."] @@ -231,7 +231,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `FontFace`, `FontFaceDescriptors`*"] pub fn new_with_u8_array_and_descriptors( family: &str, - source: &mut [u8], + source: &[u8], descriptors: &FontFaceDescriptors, ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "FontFace" , js_name = load)] diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index d2dfe839f48..076110fd749 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -87,6 +87,8 @@ pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy "writeBuffer", "writeTexture", // AudioBuffer - "copyToChannel", // TODO: Add another type's functions here. Leave a comment header with the type name + "copyToChannel", + // FontFace + "FontFace", // TODO: Add another type's functions here. Leave a comment header with the type name ]) }); From f82f5c5852c3abf057bb737d545360a3a5c7d84c Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Thu, 8 Sep 2022 04:59:19 +0200 Subject: [PATCH 083/641] Refactor: normalized encoding of ImportModule (#3068) --- crates/backend/src/encode.rs | 10 ++++------ crates/cli-support/src/wit/mod.rs | 33 +++++++++++-------------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 086ff284452..41d3c8b773a 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -77,10 +77,10 @@ impl Interner { /// /// Note that repeated invocations of this function will be memoized, so the /// same `id` will always return the same resulting unique `id`. - fn resolve_import_module(&self, id: &str, span: Span) -> Result<&str, Diagnostic> { + fn resolve_import_module(&self, id: &str, span: Span) -> Result { let mut files = self.files.borrow_mut(); if let Some(file) = files.get(id) { - return Ok(self.intern_str(&file.new_identifier)); + return Ok(ImportModule::Named(self.intern_str(&file.new_identifier))); } self.check_for_package_json(); let path = if id.starts_with("/") { @@ -89,7 +89,7 @@ impl Interner { let msg = "relative module paths aren't supported yet"; return Err(Diagnostic::span_error(span, msg)); } else { - return Ok(self.intern_str(&id)); + return Ok(ImportModule::RawNamed(self.intern_str(id))); }; // Generate a unique ID which is somewhat readable as well, so mix in @@ -254,9 +254,7 @@ fn shared_module<'a>( intern: &'a Interner, ) -> Result, Diagnostic> { Ok(match m { - ast::ImportModule::Named(m, span) => { - ImportModule::Named(intern.resolve_import_module(m, *span)?) - } + ast::ImportModule::Named(m, span) => intern.resolve_import_module(m, *span)?, ast::ImportModule::RawNamed(m, _span) => ImportModule::RawNamed(intern.intern_str(m)), ast::ImportModule::Inline(idx, _) => ImportModule::Inline(*idx as u32), }) diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 7b8e81721c2..f5b56e0079d 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -880,13 +880,6 @@ impl<'a> Context<'a> { } fn determine_import(&self, import: &decode::Import<'_>, item: &str) -> Result { - let is_local_snippet = match import.module { - Some(decode::ImportModule::Named(s)) => self.aux.local_modules.contains_key(s), - Some(decode::ImportModule::RawNamed(_)) => false, - Some(decode::ImportModule::Inline(_)) => true, - None => false, - }; - // Similar to `--target no-modules`, only allow vendor prefixes // basically for web apis, shouldn't be necessary for things like npm // packages or other imported items. @@ -894,7 +887,9 @@ impl<'a> Context<'a> { if let Some(vendor_prefixes) = vendor_prefixes { assert!(vendor_prefixes.len() > 0); - if is_local_snippet { + if let Some(decode::ImportModule::Inline(_) | decode::ImportModule::Named(_)) = + &import.module + { bail!( "local JS snippets do not support vendor prefixes for \ the import of `{}` with a polyfill of `{}`", @@ -902,7 +897,7 @@ impl<'a> Context<'a> { &vendor_prefixes[0] ); } - if let Some(decode::ImportModule::Named(module)) = &import.module { + if let Some(decode::ImportModule::RawNamed(module)) = &import.module { bail!( "import of `{}` from `{}` has a polyfill of `{}` listed, but vendor prefixes aren't supported when importing from modules", @@ -938,18 +933,14 @@ impl<'a> Context<'a> { }; let name = match import.module { - Some(decode::ImportModule::Named(module)) if is_local_snippet => { - JsImportName::LocalModule { - module: module.to_string(), - name: name.to_string(), - } - } - Some(decode::ImportModule::Named(module) | decode::ImportModule::RawNamed(module)) => { - JsImportName::Module { - module: module.to_string(), - name: name.to_string(), - } - } + Some(decode::ImportModule::Named(module)) => JsImportName::LocalModule { + module: module.to_string(), + name: name.to_string(), + }, + Some(decode::ImportModule::RawNamed(module)) => JsImportName::Module { + module: module.to_string(), + name: name.to_string(), + }, Some(decode::ImportModule::Inline(idx)) => { let offset = self .aux From 595b04b24aeadd467bbea01c75193d63c3ab6db5 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 8 Sep 2022 15:48:26 +0100 Subject: [PATCH 084/641] Trigger warnings for unused wasm-bindgen attributes (#3073) * Trigger warnings for unused wasm-bindgen attributes This attempts to do something similar to #3070, but without potentially dangerous fallout from strict-mode failing on all the existing code out there. Instead of forcing a compiler error like strict-mode does, this PR will internally generate unused variables with spans pointing to unused attributes, so that users get a relatively meaningful warning. Here's how the result looks like on example from #2874: ``` warning: unused variable: `typescript_type` --> tests\headless\snippets.rs:67:28 | 67 | #[wasm_bindgen(getter, typescript_type = "Thing[]")] | ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type` | = note: `#[warn(unused_variables)]` on by default ``` This is not 100% perfect - until Rust has a built-in `compile_warning!`, nothing is - but is a better status quo than the current one and can help users find problematic attributes without actually breaking their builds. Fixes #3038. * Guide users who used the suggested (invalid) fix (#1) Co-authored-by: Ingvar Stepanyan * Deprecate strict-macro feature; update tests * Skip anonymous scope if there are no unused attrs * Fix unused-attr check for reserved attribute names * Remove defunct deprecation warning Co-authored-by: Lukas Lihotzki --- crates/macro-support/src/lib.rs | 4 +- crates/macro-support/src/parser.rs | 92 ++++++++++--------- crates/macro/Cargo.toml | 2 +- crates/macro/ui-tests/unused-attributes.rs | 25 ++++- .../macro/ui-tests/unused-attributes.stderr | 48 ++++++++-- 5 files changed, 112 insertions(+), 59 deletions(-) diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index 9996849596a..b7a35ae1bed 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -35,7 +35,7 @@ pub fn expand(attr: TokenStream, input: TokenStream) -> Result true, _ => false, diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a3148fdb184..d05f139f62e 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1,4 +1,4 @@ -use std::cell::Cell; +use std::cell::{Cell, RefCell}; use std::char; use std::str::Chars; @@ -41,6 +41,7 @@ const JS_KEYWORDS: [&str; 20] = [ struct AttributeParseState { parsed: Cell, checks: Cell, + unused_attrs: RefCell>, } /// Parsed attributes from a `#[wasm_bindgen(..)]`. @@ -94,35 +95,24 @@ macro_rules! methods { ($(($name:ident, $variant:ident($($contents:tt)*)),)*) => { $(methods!(@method $name, $variant($($contents)*));)* - #[cfg(feature = "strict-macro")] - fn check_used(self) -> Result<(), Diagnostic> { + fn check_used(self) { // Account for the fact this method was called - ATTRS.with(|state| state.checks.set(state.checks.get() + 1)); + ATTRS.with(|state| { + state.checks.set(state.checks.get() + 1); - let mut errors = Vec::new(); - for (used, attr) in self.attrs.iter() { - if used.get() { - continue - } - // The check below causes rustc to crash on powerpc64 platforms - // with an LLVM error. To avoid this, we instead use #[cfg()] - // and duplicate the function below. See #58516 for details. - /*if !cfg!(feature = "strict-macro") { - continue - }*/ - let span = match attr { - $(BindgenAttr::$variant(span, ..) => span,)* - }; - errors.push(Diagnostic::span_error(*span, "unused #[wasm_bindgen] attribute")); - } - Diagnostic::from_vec(errors) - } - - #[cfg(not(feature = "strict-macro"))] - fn check_used(self) -> Result<(), Diagnostic> { - // Account for the fact this method was called - ATTRS.with(|state| state.checks.set(state.checks.get() + 1)); - Ok(()) + state.unused_attrs.borrow_mut().extend( + self.attrs + .iter() + .filter_map(|(used, attr)| if used.get() { None } else { Some(attr) }) + .map(|attr| { + match attr { + $(BindgenAttr::$variant(span, ..) => { + syn::parse_quote_spanned!(*span => $name) + })* + } + }) + ); + }); } }; @@ -218,7 +208,7 @@ impl BindgenAttrs { } let mut attrs: BindgenAttrs = syn::parse2(group.stream())?; ret.attrs.extend(attrs.attrs.drain(..)); - attrs.check_used()?; + attrs.check_used(); } } @@ -353,7 +343,11 @@ impl Parse for BindgenAttr { attrgen!(parsers); - return Err(original.error("unknown attribute")); + return Err(original.error(if attr_string.starts_with("_") { + "unknown attribute: it's safe to remove unused attributes entirely." + } else { + "unknown attribute" + })); } } @@ -411,7 +405,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { let attrs = BindgenAttrs::find(&mut field.attrs)?; if attrs.skip().is_some() { - attrs.check_used()?; + attrs.check_used(); continue; } @@ -436,11 +430,11 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { generate_typescript: attrs.skip_typescript().is_none(), getter_with_clone: getter_with_clone || attrs.getter_with_clone().is_some(), }); - attrs.check_used()?; + attrs.check_used(); } let generate_typescript = attrs.skip_typescript().is_none(); let comments: Vec = extract_doc_comments(&self.attrs); - attrs.check_used()?; + attrs.check_used(); Ok(ast::Struct { rust_name: self.ident.clone(), js_name, @@ -662,7 +656,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo shim: Ident::new(&shim, Span::call_site()), doc_comment, }); - opts.check_used()?; + opts.check_used(); Ok(ret) } @@ -695,7 +689,7 @@ impl ConvertToAst for syn::ForeignItemType { _ => {} } } - attrs.check_used()?; + attrs.check_used(); Ok(ast::ImportKind::Type(ast::ImportType { vis: self.vis, attrs: self.attrs, @@ -734,7 +728,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo self.ident, ShortHash((&js_name, module, &self.ident)), ); - opts.check_used()?; + opts.check_used(); Ok(ast::ImportKind::Static(ast::ImportStatic { ty: *self.ty, vis: self.vis, @@ -770,7 +764,7 @@ impl ConvertToAst for syn::ItemFn { None, false, )?; - attrs.check_used()?; + attrs.check_used(); Ok(ret.0) } } @@ -1049,7 +1043,7 @@ impl<'a> MacroParse for &'a mut syn::ItemImpl { } } Diagnostic::from_vec(errors)?; - opts.check_used()?; + opts.check_used(); Ok(()) } } @@ -1160,7 +1154,7 @@ impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemMethod { rust_name: self.sig.ident.clone(), start: false, }); - opts.check_used()?; + opts.check_used(); Ok(()) } } @@ -1229,7 +1223,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { attrs: _, lit: syn::Lit::Str(_), }) => { - opts.check_used()?; + opts.check_used(); return import_enum(self, program); } _ => {} @@ -1239,7 +1233,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { .js_name() .map(|s| s.0) .map_or_else(|| self.ident.to_string(), |s| s.to_string()); - opts.check_used()?; + opts.check_used(); let has_discriminant = self.variants[0].discriminant.is_some(); @@ -1353,7 +1347,7 @@ impl MacroParse for syn::ItemConst { } } - opts.check_used()?; + opts.check_used(); Ok(()) } @@ -1401,7 +1395,7 @@ impl MacroParse for syn::ItemForeignMod { } } Diagnostic::from_vec(errors)?; - opts.check_used()?; + opts.check_used(); Ok(()) } } @@ -1617,12 +1611,22 @@ pub fn reset_attrs_used() { ATTRS.with(|state| { state.parsed.set(0); state.checks.set(0); + state.unused_attrs.borrow_mut().clear(); }) } -pub fn assert_all_attrs_checked() { +pub fn check_unused_attrs(tokens: &mut TokenStream) { ATTRS.with(|state| { assert_eq!(state.parsed.get(), state.checks.get()); + let unused_attrs = &*state.unused_attrs.borrow(); + if !unused_attrs.is_empty() { + tokens.extend(quote::quote! { + // Anonymous scope to prevent name clashes. + const _: () = { + #(let #unused_attrs: ();)* + }; + }); + } }) } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index cfe8f0f0138..671d94fc9b2 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -25,5 +25,5 @@ quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.82", features = ['strict-macro'] } +wasm-bindgen = { path = "../..", version = "0.2.82" } wasm-bindgen-futures = { path = "../futures", version = "0.4.32" } diff --git a/crates/macro/ui-tests/unused-attributes.rs b/crates/macro/ui-tests/unused-attributes.rs index de7962e4646..f517dcc4b55 100644 --- a/crates/macro/ui-tests/unused-attributes.rs +++ b/crates/macro/ui-tests/unused-attributes.rs @@ -1,12 +1,31 @@ +#![deny(unused_variables)] + use wasm_bindgen::prelude::*; -struct A; +struct A {} #[wasm_bindgen] impl A { #[wasm_bindgen(method)] - #[wasm_bindgen(method)] - pub fn foo() { + pub fn foo() {} +} + +#[wasm_bindgen] +pub struct MyStruct { + hello: String, +} + +#[wasm_bindgen(getter, typescript_custom_section)] +pub const FOO: &'static str = "FOO"; + +#[wasm_bindgen(readonly)] +pub fn bar() {} + +#[wasm_bindgen(getter_with_clone, final)] +impl MyStruct { + #[wasm_bindgen(getter, typescript_type = "Thing[]")] + pub fn hello(&self) -> String { + self.hello.clone() } } diff --git a/crates/macro/ui-tests/unused-attributes.stderr b/crates/macro/ui-tests/unused-attributes.stderr index 12f2c01f31e..c4ba32f0817 100644 --- a/crates/macro/ui-tests/unused-attributes.stderr +++ b/crates/macro/ui-tests/unused-attributes.stderr @@ -1,11 +1,41 @@ -error: unused #[wasm_bindgen] attribute - --> $DIR/unused-attributes.rs:7:20 +error: unused variable: `method` + --> ui-tests/unused-attributes.rs:9:20 | -7 | #[wasm_bindgen(method)] - | ^^^^^^ - -error: unused #[wasm_bindgen] attribute - --> $DIR/unused-attributes.rs:8:20 +9 | #[wasm_bindgen(method)] + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_method` + | +note: the lint level is defined here + --> ui-tests/unused-attributes.rs:1:9 | -8 | #[wasm_bindgen(method)] - | ^^^^^^ +1 | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: unused variable: `getter` + --> ui-tests/unused-attributes.rs:18:16 + | +18 | #[wasm_bindgen(getter, typescript_custom_section)] + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter` + +error: unused variable: `readonly` + --> ui-tests/unused-attributes.rs:21:16 + | +21 | #[wasm_bindgen(readonly)] + | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_readonly` + +error: unused variable: `getter_with_clone` + --> ui-tests/unused-attributes.rs:24:16 + | +24 | #[wasm_bindgen(getter_with_clone, final)] + | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_getter_with_clone` + +error: unused variable: `final` + --> ui-tests/unused-attributes.rs:24:35 + | +24 | #[wasm_bindgen(getter_with_clone, final)] + | ^^^^^ help: if this is intentional, prefix it with an underscore: `_final` + +error: unused variable: `typescript_type` + --> ui-tests/unused-attributes.rs:26:28 + | +26 | #[wasm_bindgen(getter, typescript_type = "Thing[]")] + | ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type` From eac9722f992e6aeef1a8c46d4b09ce5359f40bba Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 9 Sep 2022 22:14:34 +0200 Subject: [PATCH 085/641] Export `initSync` for no-module builds (#3075) --- crates/cli-support/src/js/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index fb14e70910a..59a10704d6b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -380,7 +380,10 @@ impl<'a> Context<'a> { js.push_str("const __exports = {};\n"); js.push_str("let wasm;\n"); init = self.gen_init(needs_manual_start, None)?; - footer.push_str(&format!("{} = Object.assign(init, __exports);\n", global)); + footer.push_str(&format!( + "{} = Object.assign(init, {{ initSync }}, __exports);\n", + global + )); } // With normal CommonJS node we need to defer requiring the wasm From 893812fa05622f8be9a2f1099a93c51291a73eae Mon Sep 17 00:00:00 2001 From: Jawad Date: Mon, 12 Sep 2022 19:55:46 +0530 Subject: [PATCH 086/641] web-sys: include VideoFrame in texImage* functions (#3077) --- .../features/gen_WebGl2RenderingContext.rs | 136 ++++++++++++++++++ .../src/features/gen_WebGlRenderingContext.rs | 41 ++++++ .../enabled/WebGL2RenderingContext.webidl | 22 +++ .../enabled/WebGLRenderingContext.webidl | 6 + 4 files changed, 205 insertions(+) diff --git a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs index ddaa46f2c68..1b1ab491c13 100644 --- a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs @@ -2180,6 +2180,26 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_image_2d_with_u32_and_u32_and_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] #[doc = "The `texImage2D()` method."] @@ -2305,6 +2325,29 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + border: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] #[doc = "The `texImage2D()` method."] @@ -2479,6 +2522,30 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)] + #[doc = "The `texImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_image_3d_with_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + depth: i32, + border: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)] #[doc = "The `texImage3D()` method."] @@ -2713,6 +2780,27 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_sub_image_2d_with_u32_and_u32_and_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] #[doc = "The `texSubImage2D()` method."] @@ -2840,6 +2928,29 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] #[doc = "The `texSubImage2D()` method."] @@ -3019,6 +3130,31 @@ extern "C" { type_: u32, source: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)] + #[doc = "The `texSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_sub_image_3d_with_video_frame( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + type_: u32, + source: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)] #[doc = "The `texSubImage3D()` method."] diff --git a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs index 5239284b63a..39777bbd283 100644 --- a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs @@ -375,6 +375,26 @@ extern "C" { type_: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGlRenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_image_2d_with_u32_and_u32_and_video_frame( + this: &WebGlRenderingContext, + target: u32, + level: i32, + internalformat: i32, + format: u32, + type_: u32, + video_frame: &VideoFrame, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)] #[doc = "The `texSubImage2D()` method."] #[doc = ""] @@ -496,6 +516,27 @@ extern "C" { type_: u32, video: &HtmlVideoElement, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGlRenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn tex_sub_image_2d_with_u32_and_u32_and_video_frame( + this: &WebGlRenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + format: u32, + type_: u32, + video_frame: &VideoFrame, + ) -> Result<(), JsValue>; #[cfg(feature = "WebGlUniformLocation")] # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform1fv)] #[doc = "The `uniform1fv()` method."] diff --git a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl index ef65b4c032c..730ae2790d5 100644 --- a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl @@ -364,6 +364,9 @@ interface mixin WebGL2RenderingContextBase [Throws] undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, ImageBitmap source); @@ -384,6 +387,9 @@ interface mixin WebGL2RenderingContextBase [Throws] undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ImageBitmap source); @@ -407,6 +413,10 @@ interface mixin WebGL2RenderingContextBase undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, @@ -435,6 +445,10 @@ interface mixin WebGL2RenderingContextBase undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -466,6 +480,10 @@ interface mixin WebGL2RenderingContextBase undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -495,6 +513,10 @@ interface mixin WebGL2RenderingContextBase undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + VideoFrame source); // May throw DOMException [Throws] // Another overhead throws. undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, diff --git a/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl b/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl index ad63aad65b5..2960696ef1a 100644 --- a/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl @@ -757,6 +757,9 @@ interface WebGLRenderingContext { [Throws] undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, VideoFrame video_frame); // May throw DOMException // texSubImage2D has WebGL2 overloads. [Throws] // Can't actually throw. @@ -778,6 +781,9 @@ interface WebGLRenderingContext { [Throws] undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, VideoFrame video_frame); // May throw DOMException // uniform*fv have WebGL2 overloads, or rather extensions, that are not // distinguishable from the WebGL1 versions when called with two arguments. From eba691f38ca427c9d440b3d4c44217e58c89c661 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Mon, 12 Sep 2022 10:26:21 -0400 Subject: [PATCH 087/641] Bumped crate versions (#3079) * Added example-tests to the crate nopublish list * Bumped crate versions --- Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 8 ++++---- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-audio-worklet/Cargo.toml | 6 +++--- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- publish.rs | 1 + 50 files changed, 105 insertions(+), 104 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5101fa4b409..1806dd98758 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -35,15 +35,15 @@ strict-macro = ["wasm-bindgen-macro/strict-macro"] xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.82" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.83" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.59' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.32' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.32' } +js-sys = { path = 'crates/js-sys', version = '0.3.60' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.33' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.33' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 45d2d7d387f..56dcac338a1 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -22,4 +22,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 2c6eb736edf..99294871bc4 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -19,12 +19,12 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.19.0" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.82' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.82' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.82' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.82' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.82' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.82' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.83' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.83' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.83' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.83' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.83' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.83' } wit-text = "0.8.0" wit-walrus = "0.6.0" wit-validator = "0.2.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 13a13cd243c..0d914175cef 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -26,8 +26,8 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" walrus = { version = "0.19.0", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.82" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.83" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 3ed8c55666e..57e7d7f79cc 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index bf7d6912888..696733eb3bd 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,13 +7,13 @@ license = "MIT/Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.32" +version = "0.4.33" edition = "2018" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.59' } -wasm-bindgen = { path = "../..", version = '0.2.82' } +js-sys = { path = "../js-sys", version = '0.3.60' } +wasm-bindgen = { path = "../..", version = '0.2.83' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -28,6 +28,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.32' } +wasm-bindgen-test = { path = '../test', version = '0.3.33' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index b922a63efcc..fd2efd64391 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.59" +version = "0.3.60" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -19,9 +19,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.82" } +wasm-bindgen = { path = "../..", version = "0.2.83" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.32' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } -web-sys = { path = "../web-sys", version = "0.3.59", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.33' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } +web-sys = { path = "../web-sys", version = "0.3.60", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index e6aa62f2f48..39448b154fd 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -20,5 +20,5 @@ strict-macro = [] syn = { version = '1.0.67', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.82" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.82" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.83" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 671d94fc9b2..f7a0bbb2176 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -20,10 +20,10 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.82" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.83" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.82" } -wasm-bindgen-futures = { path = "../futures", version = "0.4.32" } +wasm-bindgen = { path = "../..", version = "0.2.83" } +wasm-bindgen-futures = { path = "../futures", version = "0.4.33" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 7cb6cd9c70f..767e47d2524 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index f79108bcafe..013ccd8c6c3 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 9d67e5ac9f1..3b4da715d34 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.32" +version = "0.3.33" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT/Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index e9a4674e07f..a61ac6b7324 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.32" +version = "0.3.33" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT/Apache-2.0" @@ -9,11 +9,11 @@ edition = "2018" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.59' } +js-sys = { path = '../js-sys', version = '0.3.60' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.82' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.32' } +wasm-bindgen = { path = '../..', version = '0.2.83' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.33' } [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 906ac264b15..64c4b81e5b8 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -14,7 +14,7 @@ edition = "2018" [dependencies] anyhow = "1.0" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.82" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.83" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 82da21485d3..c677658f5da 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index dafb7336919..4635d2d1dce 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.82" +version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-interpreter" @@ -15,7 +15,7 @@ edition = '2018' anyhow = "1.0" log = "0.4" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.82" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.83" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b0d7067a826..d37f6fb8031 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.59" +version = "0.3.60" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -21,12 +21,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.82" } -js-sys = { path = '../js-sys', version = '0.3.59' } +wasm-bindgen = { path = "../..", version = "0.2.83" } +js-sys = { path = '../js-sys', version = '0.3.60' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.32' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.32' } +wasm-bindgen-test = { path = '../test', version = '0.3.33' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index ad9c36d67de..d07c4f0ab82 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -20,7 +20,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.82", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.83", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index 2faf13667c3..fdff38f2eef 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index fceee3876ef..4884000626b 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 847dccf2b3c..d6999023ed7 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index ec3abd123e6..57ebeceae08 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -js-sys = "0.3.59" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index e656e816b67..fceca22faa9 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -web-sys = { version = "0.3.59", features = ['console'] } +wasm-bindgen = "0.2.83" +web-sys = { version = "0.3.60", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 460e9058e04..307ed26e2e8 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 703b0b535c4..bb65d27f123 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index f3bbfa515b1..c51d0c4c650 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 7ca88c051b6..56650346a4b 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -js-sys = "0.3.59" -wasm-bindgen-futures = "0.4.32" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" +wasm-bindgen-futures = "0.4.33" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index a0e86c792f6..d5c6b5bb62f 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -js-sys = "0.3.59" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index f3f327868b8..abff0cf3fd8 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 31805842f8f..34af28ff828 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 71dc2dc5a5b..dc24bcdb4d4 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 0cf86f90b78..904786551fa 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 56b51718bbc..0c2cf684b13 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 81145af8c20..c3840f119cd 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -9,14 +9,14 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.59" +js-sys = "0.3.60" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.4.3" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = "0.2.82" -wasm-bindgen-futures = "0.4.32" +wasm-bindgen = "0.2.83" +wasm-bindgen-futures = "0.4.33" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 7514dae5bab..fff34c58d3f 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 19c1d089ffd..92fce05271b 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index 8ef6f7f00ca..85f566cc59c 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -11,8 +11,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index cc187f6ec36..184226d67f3 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -8,9 +8,9 @@ crate-type = ["cdylib"] [dependencies] console_log = "0.2.0" -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" -wasm-bindgen-futures = "0.4.32" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" +wasm-bindgen-futures = "0.4.33" [dependencies.web-sys] version = "0.3.59" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 2f187d47e74..f7c984fbcd3 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -js-sys = "0.3.59" -wasm-bindgen-futures = "0.4.32" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" +wasm-bindgen-futures = "0.4.33" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 76edbb05e92..6f0adfb80a3 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" -js-sys = "0.3.59" -wasm-bindgen-futures = "0.4.32" +wasm-bindgen = "0.2.83" +js-sys = "0.3.60" +wasm-bindgen-futures = "0.4.33" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 4ef4e128e8c..b104a4781da 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 9b07d25f8e9..68bceb4dc5d 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 2bf0d19397e..a91699e7726 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -15,7 +15,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index b8575e1f0df..6c50bb5ce2c 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index ba74e9eee1a..a5efb9f693e 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 171b26e1ad9..2c31ace92bf 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" js-sys = "0.3" -wasm-bindgen-futures = "0.4.32" +wasm-bindgen-futures = "0.4.33" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 78d09de7e69..fd34117a0e8 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 597ccc69f92..6955841341b 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.59" -wasm-bindgen = "0.2.82" -wasm-bindgen-futures = "0.4.32" +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" +wasm-bindgen-futures = "0.4.33" [dependencies.web-sys] version = "0.3.36" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index bf651e5b05e..4180dafafdb 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.82" +wasm-bindgen = "0.2.83" [dependencies.web-sys] version = "0.3.4" diff --git a/publish.rs b/publish.rs index ab81b2100b0..d643fc63ddd 100644 --- a/publish.rs +++ b/publish.rs @@ -46,6 +46,7 @@ const CRATES_TO_AVOID_PUBLISH: &[&str] = &[ "webidl-tests", "typescript-tests", "wasm-bindgen-webidl", + "example-tests", ]; struct Crate { From b964cf1ad293d377c45b8d109e76944e96f3e3b1 Mon Sep 17 00:00:00 2001 From: William Pride Date: Tue, 13 Sep 2022 07:25:01 -0700 Subject: [PATCH 088/641] Update syn dependency version (#3080) The latest release uses the [`syn::parse_quoted_spanned!`](https://github.com/rustwasm/wasm-bindgen/commit/595b04b24aeadd467bbea01c75193d63c3ab6db5#diff-c3d389037d8eda9768f1fef9029fef9b723ac402a47bb782eb03e6ccddba800fR110) macro that was added in [`1.0.84`](https://github.com/dtolnay/syn/releases/tag/1.0.84) --- crates/macro-support/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 39448b154fd..0e393be6069 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -17,7 +17,7 @@ extra-traits = ["syn/extra-traits"] strict-macro = [] [dependencies] -syn = { version = '1.0.67', features = ['visit', 'full'] } +syn = { version = '1.0.84', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" wasm-bindgen-backend = { path = "../backend", version = "=0.2.83" } From 2d1651f3dab24450f3f5f9314c88c93985e1bd90 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 13 Sep 2022 22:48:55 +0200 Subject: [PATCH 089/641] use console.error for error macro (#3081) --- examples/wasm-in-wasm-imports/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wasm-in-wasm-imports/src/lib.rs b/examples/wasm-in-wasm-imports/src/lib.rs index bcdc29cc871..30ea6990a0c 100644 --- a/examples/wasm-in-wasm-imports/src/lib.rs +++ b/examples/wasm-in-wasm-imports/src/lib.rs @@ -20,7 +20,7 @@ macro_rules! console_log { #[macro_use] macro_rules! console_error { - ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) + ($($t:tt)*) => (error(&format_args!($($t)*).to_string())) } const WASM: &[u8] = include_bytes!("native_add.wasm"); From 564ce74168904e95a7905a828488ec3029bcaad4 Mon Sep 17 00:00:00 2001 From: Michael Freeborn <31806808+mfreeborn@users.noreply.github.com> Date: Sun, 18 Sep 2022 13:06:37 +0100 Subject: [PATCH 090/641] add JsValue::is_array() + tests (#3087) * add JsValue::is_array() + tests * use Array.isArray() instead of instanceof --- crates/cli-support/src/intrinsic.rs | 3 +++ crates/cli-support/src/js/mod.rs | 5 +++++ src/lib.rs | 7 +++++++ tests/wasm/intrinsics.rs | 3 ++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index 8563369525f..5e5c70be698 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -95,6 +95,9 @@ intrinsics! { #[symbol = "__wbindgen_is_function"] #[signature = fn(ref_externref()) -> Boolean] IsFunction, + #[symbol = "__wbindgen_is_array"] + #[signature = fn(ref_externref()) -> Boolean] + IsArray, #[symbol = "__wbindgen_is_undefined"] #[signature = fn(ref_externref()) -> Boolean] IsUndefined, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 59a10704d6b..7762f1925c7 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3141,6 +3141,11 @@ impl<'a> Context<'a> { format!("typeof({}) === 'function'", args[0]) } + Intrinsic::IsArray => { + assert_eq!(args.len(), 1); + format!("Array.isArray({})", args[0]) + } + Intrinsic::IsUndefined => { assert_eq!(args.len(), 1); format!("{} === undefined", args[0]) diff --git a/src/lib.rs b/src/lib.rs index 2ccb284b9a7..2d6ace32639 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -348,6 +348,12 @@ impl JsValue { unsafe { __wbindgen_is_object(self.idx) == 1 } } + /// Tests whether this JS value is an instance of Array. + #[inline] + pub fn is_array(&self) -> bool { + unsafe { __wbindgen_is_array(self.idx) == 1 } + } + /// Tests whether the type of this JS value is `function`. #[inline] pub fn is_function(&self) -> bool { @@ -1003,6 +1009,7 @@ externs! { fn __wbindgen_is_undefined(idx: u32) -> u32; fn __wbindgen_is_symbol(idx: u32) -> u32; fn __wbindgen_is_object(idx: u32) -> u32; + fn __wbindgen_is_array(idx: u32) -> u32; fn __wbindgen_is_function(idx: u32) -> u32; fn __wbindgen_is_string(idx: u32) -> u32; fn __wbindgen_is_bigint(idx: u32) -> u32; diff --git a/tests/wasm/intrinsics.rs b/tests/wasm/intrinsics.rs index 15985e81213..843d2d289ec 100644 --- a/tests/wasm/intrinsics.rs +++ b/tests/wasm/intrinsics.rs @@ -3,7 +3,7 @@ use std::convert::TryFrom; use std::fmt::Debug; -use js_sys::{Object, RangeError, Reflect}; +use js_sys::{Array, Object, RangeError, Reflect}; use wasm_bindgen::{JsCast, JsValue}; use wasm_bindgen_test::wasm_bindgen_test; @@ -78,6 +78,7 @@ fn types() { assert!(JsValue::UNDEFINED.is_undefined()); assert!(JsValue::NULL.is_null()); assert!(Object::new().is_object()); + assert!(Array::new().is_array()); assert!(JsValue::symbol(None).is_symbol()); assert!(JsValue::from_str("hi").is_string()); assert!(JsValue::bigint_from_str("5").is_bigint()); From ae5e4d72749b9a2b975c8fa7ee29bb375829bbc4 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Tue, 27 Sep 2022 00:20:01 +0200 Subject: [PATCH 091/641] Add shell_test for wasm-audio-worklet example (build only) (#3093) --- crates/example-tests/tests/shell.rs | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/crates/example-tests/tests/shell.rs b/crates/example-tests/tests/shell.rs index 58bd1daaa8c..bec7b8c7a39 100644 --- a/crates/example-tests/tests/shell.rs +++ b/crates/example-tests/tests/shell.rs @@ -6,10 +6,12 @@ use std::str; use example_tests::{example_dir, run, test_example}; -async fn test_shell_example(name: &str) -> anyhow::Result<()> { +async fn test_shell_example(name: &str, envs: &[(&str, &str)]) -> anyhow::Result<()> { test_example(name, || { let path = example_dir(name); - run(Command::new(path.join("build.sh")).current_dir(&path))?; + run(Command::new(path.join("build.sh")) + .current_dir(&path) + .envs(envs.iter().copied()))?; Ok(path) }) .await @@ -18,39 +20,29 @@ async fn test_shell_example(name: &str) -> anyhow::Result<()> { macro_rules! shell_tests { ($( $(#[$attr:meta])* + $(#[$var:literal = $val:literal])* $test:ident = $name:literal, )*) => { $( $(#[$attr])* #[tokio::test] async fn $test() -> anyhow::Result<()> { - test_shell_example($name).await + test_shell_example($name, &[$(($var, $val)),*]).await } )* }; } shell_tests! { + #["RUSTUP_TOOLCHAIN" = "nightly"] + raytrace_parallel = "raytrace-parallel", #[ignore = "This requires module workers, which Firefox doesn't support yet."] synchronous_instantiation = "synchronous-instantiation", wasm2js = "wasm2js", + #["RUSTUP_TOOLCHAIN" = "nightly"] + wasm_audio_worklet = "wasm-audio-worklet", wasm_in_web_worker = "wasm-in-web-worker", websockets = "websockets", without_a_bundler = "without-a-bundler", without_a_bundler_no_modules = "without-a-bundler-no-modules", } - -#[tokio::test] -async fn raytrace_parallel() -> anyhow::Result<()> { - test_example("raytrace-parallel", || { - let path = example_dir("raytrace-parallel"); - - run(Command::new(path.join("build.sh")) - .current_dir(&path) - // This example requires nightly. - .env("RUSTUP_TOOLCHAIN", "nightly"))?; - - Ok(path) - }) - .await -} From c084e5b5e5c654ac4f3c5934a25fc2c4521e0eff Mon Sep 17 00:00:00 2001 From: tpambor Date: Wed, 28 Sep 2022 16:59:20 +0200 Subject: [PATCH 092/641] Add Web Serial API (#3096) --- crates/web-sys/Cargo.toml | 10 ++ .../src/features/gen_FlowControlType.rs | 15 ++ crates/web-sys/src/features/gen_Navigator.rs | 12 ++ crates/web-sys/src/features/gen_ParityType.rs | 16 ++ crates/web-sys/src/features/gen_Serial.rs | 99 ++++++++++ .../src/features/gen_SerialInputSignals.rs | 123 +++++++++++++ .../web-sys/src/features/gen_SerialOptions.rs | 156 ++++++++++++++++ .../src/features/gen_SerialOutputSignals.rs | 95 ++++++++++ crates/web-sys/src/features/gen_SerialPort.rs | 169 ++++++++++++++++++ .../src/features/gen_SerialPortFilter.rs | 78 ++++++++ .../src/features/gen_SerialPortInfo.rs | 78 ++++++++ .../features/gen_SerialPortRequestOptions.rs | 57 ++++++ .../src/features/gen_WorkerNavigator.rs | 12 ++ crates/web-sys/src/features/mod.rs | 60 +++++++ .../web-sys/webidls/unstable/WebSerial.webidl | 80 +++++++++ 15 files changed, 1060 insertions(+) create mode 100644 crates/web-sys/src/features/gen_FlowControlType.rs create mode 100644 crates/web-sys/src/features/gen_ParityType.rs create mode 100644 crates/web-sys/src/features/gen_Serial.rs create mode 100644 crates/web-sys/src/features/gen_SerialInputSignals.rs create mode 100644 crates/web-sys/src/features/gen_SerialOptions.rs create mode 100644 crates/web-sys/src/features/gen_SerialOutputSignals.rs create mode 100644 crates/web-sys/src/features/gen_SerialPort.rs create mode 100644 crates/web-sys/src/features/gen_SerialPortFilter.rs create mode 100644 crates/web-sys/src/features/gen_SerialPortInfo.rs create mode 100644 crates/web-sys/src/features/gen_SerialPortRequestOptions.rs create mode 100644 crates/web-sys/webidls/unstable/WebSerial.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index d37f6fb8031..e252b2d0fa6 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -391,6 +391,7 @@ FileSystemFlags = [] FillMode = [] FlashClassification = [] FlexLineGrowthState = [] +FlowControlType = [] FocusEvent = ["Event", "UiEvent"] FocusEventInit = [] FontFace = [] @@ -878,6 +879,7 @@ PaintWorkletGlobalScope = ["WorkletGlobalScope"] PannerNode = ["AudioNode", "EventTarget"] PannerOptions = [] PanningModelType = [] +ParityType = [] Path2d = [] PaymentAddress = [] PaymentComplete = [] @@ -1114,6 +1116,14 @@ SecurityPolicyViolationEvent = ["Event"] SecurityPolicyViolationEventDisposition = [] SecurityPolicyViolationEventInit = [] Selection = [] +Serial = ["EventTarget"] +SerialInputSignals = [] +SerialOptions = [] +SerialOutputSignals = [] +SerialPort = ["EventTarget"] +SerialPortFilter = [] +SerialPortInfo = [] +SerialPortRequestOptions = [] ServerSocketOptions = [] ServiceWorker = ["EventTarget"] ServiceWorkerContainer = ["EventTarget"] diff --git a/crates/web-sys/src/features/gen_FlowControlType.rs b/crates/web-sys/src/features/gen_FlowControlType.rs new file mode 100644 index 00000000000..132d1872ef8 --- /dev/null +++ b/crates/web-sys/src/features/gen_FlowControlType.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `FlowControlType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `FlowControlType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum FlowControlType { + None = "none", + Hardware = "hardware", +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 902d8816f81..1ecd65deb01 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -165,6 +165,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn hid(this: &Navigator) -> Hid; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Serial")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = serial)] + #[doc = "Getter for the `serial` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/serial)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`, `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn serial(this: &Navigator) -> Serial; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Usb")] # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = usb)] #[doc = "Getter for the `usb` field of this object."] diff --git a/crates/web-sys/src/features/gen_ParityType.rs b/crates/web-sys/src/features/gen_ParityType.rs new file mode 100644 index 00000000000..86619557036 --- /dev/null +++ b/crates/web-sys/src/features/gen_ParityType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `ParityType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ParityType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ParityType { + None = "none", + Even = "even", + Odd = "odd", +} diff --git a/crates/web-sys/src/features/gen_Serial.rs b/crates/web-sys/src/features/gen_Serial.rs new file mode 100644 index 00000000000..f6a0bf8950f --- /dev/null +++ b/crates/web-sys/src/features/gen_Serial.rs @@ -0,0 +1,99 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = Serial , typescript_type = "Serial")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Serial` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Serial; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Serial" , js_name = onconnect)] + #[doc = "Getter for the `onconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onconnect(this: &Serial) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Serial" , js_name = onconnect)] + #[doc = "Setter for the `onconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onconnect(this: &Serial, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Serial" , js_name = ondisconnect)] + #[doc = "Getter for the `ondisconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ondisconnect(this: &Serial) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Serial" , js_name = ondisconnect)] + #[doc = "Setter for the `ondisconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ondisconnect(this: &Serial, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Serial" , js_name = getPorts)] + #[doc = "The `getPorts()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/getPorts)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_ports(this: &Serial) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Serial" , js_name = requestPort)] + #[doc = "The `requestPort()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/requestPort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_port(this: &Serial) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SerialPortRequestOptions")] + # [wasm_bindgen (method , structural , js_class = "Serial" , js_name = requestPort)] + #[doc = "The `requestPort()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Serial/requestPort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`, `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_port_with_options( + this: &Serial, + options: &SerialPortRequestOptions, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_SerialInputSignals.rs b/crates/web-sys/src/features/gen_SerialInputSignals.rs new file mode 100644 index 00000000000..59b453b2ab9 --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialInputSignals.rs @@ -0,0 +1,123 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialInputSignals)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialInputSignals` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialInputSignals; +} +#[cfg(web_sys_unstable_apis)] +impl SerialInputSignals { + #[doc = "Construct a new `SerialInputSignals`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + clear_to_send: bool, + data_carrier_detect: bool, + data_set_ready: bool, + ring_indicator: bool, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.clear_to_send(clear_to_send); + ret.data_carrier_detect(data_carrier_detect); + ret.data_set_ready(data_set_ready); + ret.ring_indicator(ring_indicator); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clearToSend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_to_send(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("clearToSend"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataCarrierDetect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data_carrier_detect(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("dataCarrierDetect"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataSetReady` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data_set_ready(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("dataSetReady"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `ringIndicator` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ring_indicator(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("ringIndicator"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_SerialOptions.rs b/crates/web-sys/src/features/gen_SerialOptions.rs new file mode 100644 index 00000000000..a432f9728ae --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialOptions.rs @@ -0,0 +1,156 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialOptions; +} +#[cfg(web_sys_unstable_apis)] +impl SerialOptions { + #[doc = "Construct a new `SerialOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(baud_rate: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.baud_rate(baud_rate); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `baudRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn baud_rate(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("baudRate"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bufferSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn buffer_size(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bufferSize"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataBits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data_bits(&mut self, val: u8) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("dataBits"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FlowControlType")] + #[doc = "Change the `flowControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FlowControlType`, `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn flow_control(&mut self, val: FlowControlType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("flowControl"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ParityType")] + #[doc = "Change the `parity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ParityType`, `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn parity(&mut self, val: ParityType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("parity"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `stopBits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stop_bits(&mut self, val: u8) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("stopBits"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_SerialOutputSignals.rs b/crates/web-sys/src/features/gen_SerialOutputSignals.rs new file mode 100644 index 00000000000..7b0d98dc4b9 --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialOutputSignals.rs @@ -0,0 +1,95 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialOutputSignals)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialOutputSignals` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialOutputSignals; +} +#[cfg(web_sys_unstable_apis)] +impl SerialOutputSignals { + #[doc = "Construct a new `SerialOutputSignals`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `break` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn break_(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("break"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataTerminalReady` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data_terminal_ready(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("dataTerminalReady"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requestToSend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_to_send(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("requestToSend"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SerialOutputSignals { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_SerialPort.rs b/crates/web-sys/src/features/gen_SerialPort.rs new file mode 100644 index 00000000000..c80abca9e37 --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialPort.rs @@ -0,0 +1,169 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = SerialPort , typescript_type = "SerialPort")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialPort` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialPort; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "SerialPort" , js_name = onconnect)] + #[doc = "Getter for the `onconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onconnect(this: &SerialPort) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "SerialPort" , js_name = onconnect)] + #[doc = "Setter for the `onconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/onconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onconnect(this: &SerialPort, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "SerialPort" , js_name = ondisconnect)] + #[doc = "Getter for the `ondisconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ondisconnect(this: &SerialPort) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "SerialPort" , js_name = ondisconnect)] + #[doc = "Setter for the `ondisconnect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/ondisconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ondisconnect(this: &SerialPort, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "SerialPort" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &SerialPort) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "SerialPort" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &SerialPort) -> WritableStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = close)] + #[doc = "The `close()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/close)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn close(this: &SerialPort) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = forget)] + #[doc = "The `forget()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/forget)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn forget(this: &SerialPort) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SerialPortInfo")] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = getInfo)] + #[doc = "The `getInfo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/getInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`, `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_info(this: &SerialPort) -> SerialPortInfo; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = getSignals)] + #[doc = "The `getSignals()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/getSignals)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_signals(this: &SerialPort) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SerialOptions")] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = open)] + #[doc = "The `open()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/open)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`, `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn open(this: &SerialPort, options: &SerialOptions) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = setSignals)] + #[doc = "The `setSignals()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/setSignals)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_signals(this: &SerialPort) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SerialOutputSignals")] + # [wasm_bindgen (method , structural , js_class = "SerialPort" , js_name = setSignals)] + #[doc = "The `setSignals()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/setSignals)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`, `SerialPort`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_signals_with_signals( + this: &SerialPort, + signals: &SerialOutputSignals, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_SerialPortFilter.rs b/crates/web-sys/src/features/gen_SerialPortFilter.rs new file mode 100644 index 00000000000..aea94bb296f --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialPortFilter.rs @@ -0,0 +1,78 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialPortFilter)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialPortFilter` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialPortFilter; +} +#[cfg(web_sys_unstable_apis)] +impl SerialPortFilter { + #[doc = "Construct a new `SerialPortFilter`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usb_product_id(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("usbProductId"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("usbVendorId"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SerialPortFilter { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_SerialPortInfo.rs b/crates/web-sys/src/features/gen_SerialPortInfo.rs new file mode 100644 index 00000000000..fda2717fbf4 --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialPortInfo.rs @@ -0,0 +1,78 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialPortInfo)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialPortInfo` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialPortInfo; +} +#[cfg(web_sys_unstable_apis)] +impl SerialPortInfo { + #[doc = "Construct a new `SerialPortInfo`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usb_product_id(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("usbProductId"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("usbVendorId"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SerialPortInfo { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs new file mode 100644 index 00000000000..fa992828c0b --- /dev/null +++ b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs @@ -0,0 +1,57 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SerialPortRequestOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SerialPortRequestOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SerialPortRequestOptions; +} +#[cfg(web_sys_unstable_apis)] +impl SerialPortRequestOptions { + #[doc = "Construct a new `SerialPortRequestOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("filters"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SerialPortRequestOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index 09e987ea016..b0eb7030559 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -28,6 +28,18 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaCapabilities`, `WorkerNavigator`*"] pub fn media_capabilities(this: &WorkerNavigator) -> MediaCapabilities; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Serial")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = serial)] + #[doc = "Getter for the `serial` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/serial)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Serial`, `WorkerNavigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn serial(this: &WorkerNavigator) -> Serial; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Usb")] # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = usb)] #[doc = "Getter for the `usb` field of this object."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 02b8f667c27..8d09ffc7a68 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2164,6 +2164,12 @@ mod gen_FlexLineGrowthState; #[cfg(feature = "FlexLineGrowthState")] pub use gen_FlexLineGrowthState::*; +#[cfg(feature = "FlowControlType")] +#[allow(non_snake_case)] +mod gen_FlowControlType; +#[cfg(feature = "FlowControlType")] +pub use gen_FlowControlType::*; + #[cfg(feature = "FocusEvent")] #[allow(non_snake_case)] mod gen_FocusEvent; @@ -5098,6 +5104,12 @@ mod gen_PanningModelType; #[cfg(feature = "PanningModelType")] pub use gen_PanningModelType::*; +#[cfg(feature = "ParityType")] +#[allow(non_snake_case)] +mod gen_ParityType; +#[cfg(feature = "ParityType")] +pub use gen_ParityType::*; + #[cfg(feature = "Path2d")] #[allow(non_snake_case)] mod gen_Path2d; @@ -6514,6 +6526,54 @@ mod gen_Selection; #[cfg(feature = "Selection")] pub use gen_Selection::*; +#[cfg(feature = "Serial")] +#[allow(non_snake_case)] +mod gen_Serial; +#[cfg(feature = "Serial")] +pub use gen_Serial::*; + +#[cfg(feature = "SerialInputSignals")] +#[allow(non_snake_case)] +mod gen_SerialInputSignals; +#[cfg(feature = "SerialInputSignals")] +pub use gen_SerialInputSignals::*; + +#[cfg(feature = "SerialOptions")] +#[allow(non_snake_case)] +mod gen_SerialOptions; +#[cfg(feature = "SerialOptions")] +pub use gen_SerialOptions::*; + +#[cfg(feature = "SerialOutputSignals")] +#[allow(non_snake_case)] +mod gen_SerialOutputSignals; +#[cfg(feature = "SerialOutputSignals")] +pub use gen_SerialOutputSignals::*; + +#[cfg(feature = "SerialPort")] +#[allow(non_snake_case)] +mod gen_SerialPort; +#[cfg(feature = "SerialPort")] +pub use gen_SerialPort::*; + +#[cfg(feature = "SerialPortFilter")] +#[allow(non_snake_case)] +mod gen_SerialPortFilter; +#[cfg(feature = "SerialPortFilter")] +pub use gen_SerialPortFilter::*; + +#[cfg(feature = "SerialPortInfo")] +#[allow(non_snake_case)] +mod gen_SerialPortInfo; +#[cfg(feature = "SerialPortInfo")] +pub use gen_SerialPortInfo::*; + +#[cfg(feature = "SerialPortRequestOptions")] +#[allow(non_snake_case)] +mod gen_SerialPortRequestOptions; +#[cfg(feature = "SerialPortRequestOptions")] +pub use gen_SerialPortRequestOptions::*; + #[cfg(feature = "ServerSocketOptions")] #[allow(non_snake_case)] mod gen_ServerSocketOptions; diff --git a/crates/web-sys/webidls/unstable/WebSerial.webidl b/crates/web-sys/webidls/unstable/WebSerial.webidl new file mode 100644 index 00000000000..f2ac7d0b187 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebSerial.webidl @@ -0,0 +1,80 @@ +[Exposed=Window, SecureContext] +partial interface Navigator { + [SameObject] readonly attribute Serial serial; +}; + +[Exposed=DedicatedWorker, SecureContext] +partial interface WorkerNavigator { + [SameObject] readonly attribute Serial serial; +}; + +[Exposed=(DedicatedWorker, Window), SecureContext] +interface Serial : EventTarget { + attribute EventHandler onconnect; + attribute EventHandler ondisconnect; + Promise> getPorts(); + [Exposed=Window] Promise requestPort(optional SerialPortRequestOptions options = {}); +}; + +dictionary SerialPortRequestOptions { + sequence filters; +}; + +dictionary SerialPortFilter { + unsigned short usbVendorId; + unsigned short usbProductId; +}; + +[Exposed=(DedicatedWorker,Window), SecureContext] +interface SerialPort : EventTarget { + attribute EventHandler onconnect; + attribute EventHandler ondisconnect; + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; + + SerialPortInfo getInfo(); + + Promise open(SerialOptions options); + Promise setSignals(optional SerialOutputSignals signals = {}); + Promise getSignals(); + Promise close(); + Promise forget(); +}; + +dictionary SerialPortInfo { + unsigned short usbVendorId; + unsigned short usbProductId; +}; + +dictionary SerialOptions { + [EnforceRange] required unsigned long baudRate; + [EnforceRange] octet dataBits = 8; + [EnforceRange] octet stopBits = 1; + ParityType parity = "none"; + [EnforceRange] unsigned long bufferSize = 255; + FlowControlType flowControl = "none"; +}; + +enum ParityType { + "none", + "even", + "odd" +}; + +enum FlowControlType { + "none", + "hardware" +}; + +dictionary SerialOutputSignals { + boolean dataTerminalReady; + boolean requestToSend; + boolean break; +}; + +dictionary SerialInputSignals { + required boolean dataCarrierDetect; + required boolean clearToSend; + required boolean ringIndicator; + required boolean dataSetReady; +}; From 549dfd987dc2eeb60ee5ffb8dd7bd6f715612b7d Mon Sep 17 00:00:00 2001 From: mBornand <63592189+mBornand@users.noreply.github.com> Date: Sat, 15 Oct 2022 11:12:46 +0200 Subject: [PATCH 093/641] removes unnecessary drop() (#2984) --- crates/backend/src/codegen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 5be0fad3350..f060e0266f3 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -215,7 +215,7 @@ impl ToTokens for ast::Struct { #[no_mangle] #[doc(hidden)] pub unsafe extern "C" fn #free_fn(ptr: u32) { - drop(<#name as wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr)); + let _ = <#name as wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); //implicit `drop()` } }; From aeb028546e26c868f757fdd7ef20be43264d5c2b Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 15 Oct 2022 18:43:32 -0400 Subject: [PATCH 094/641] Update branch name to reflect renaming (#3116) --- crates/wasm-interpreter/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 4635d2d1dce..5cbe32f4643 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -3,7 +3,7 @@ name = "wasm-bindgen-wasm-interpreter" version = "0.2.83" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-interpreter" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" homepage = "https://rustwasm.github.io/wasm-bindgen/" documentation = "https://docs.rs/wasm-bindgen-wasm-interpreter" description = """ From 4458587c50291a933e808bf75125fb4ed5fb5eed Mon Sep 17 00:00:00 2001 From: Bouke van der Bijl Date: Tue, 18 Oct 2022 17:10:28 +0200 Subject: [PATCH 095/641] Call __destroy_into_raw everywhere a value is consumed (#3117) * Call __destroy_into_raw everywhere a value is consumed When using weak references the object needs to be unregistered from the finalization registry when we pass it to a Rust method that takes in the object by value. This wasn't happening, which meant that the finalizer was called despite the object already being freed. For me this manifested as a 'recursive use of an object detected which would lead to unsafe aliasing in rust' exception. * Add test that verifies we can cleanly GC * Catch b.free exception so tests pass * Fix typo --- crates/cli-support/src/js/binding.rs | 6 ++-- .../src/bin/wasm-bindgen-test-runner/node.rs | 1 + tests/wasm/classes.js | 4 +++ tests/wasm/main.rs | 1 + tests/wasm/owned.js | 13 +++++++ tests/wasm/owned.rs | 35 +++++++++++++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tests/wasm/owned.js create mode 100644 tests/wasm/owned.rs diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 008e529f213..fc642beef3a 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -716,8 +716,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.assert_class(&val, &class); js.assert_not_moved(&val); let i = js.tmp(); - js.prelude(&format!("var ptr{} = {}.ptr;", i, val)); - js.prelude(&format!("{}.ptr = 0;", val)); + js.prelude(&format!("var ptr{} = {}.__destroy_into_raw();", i, val)); js.push(format!("ptr{}", i)); } @@ -736,8 +735,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.prelude(&format!("if (!isLikeNone({0})) {{", val)); js.assert_class(&val, class); js.assert_not_moved(&val); - js.prelude(&format!("ptr{} = {}.ptr;", i, val)); - js.prelude(&format!("{}.ptr = 0;", val)); + js.prelude(&format!("ptr{} = {}.__destroy_into_raw();", i, val)); js.prelude("}"); js.push(format!("ptr{}", i)); } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 0b389682aa7..a7417aecd65 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -107,6 +107,7 @@ pub fn execute( exec( Command::new("node") .env("NODE_PATH", env::join_paths(&path).unwrap()) + .arg("--expose-gc") .args(&extra_node_args) .arg(&js_path) .args(args), diff --git a/tests/wasm/classes.js b/tests/wasm/classes.js index 93a76107a59..bcb61e05402 100644 --- a/tests/wasm/classes.js +++ b/tests/wasm/classes.js @@ -43,6 +43,10 @@ exports.js_exceptions = () => { let b = wasm.ClassesExceptions1.new(); b.foo(b); assert.throws(() => b.bar(b), /recursive use of an object/); + // TODO: throws because it tries to borrow_mut, but the throw_str from the previous line doesn't clean up the + // RefMut so the object is left in a broken state. + // We still try to call free here so the object is removed from the FinalizationRegistry when weak refs are enabled. + assert.throws(() => b.free(), /recursive use of an object/); let c = wasm.ClassesExceptions1.new(); let d = wasm.ClassesExceptions2.new(); diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 51e6dcafed5..f1f4b8eee7b 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -37,6 +37,7 @@ pub mod no_shims; pub mod node; pub mod option; pub mod optional_primitives; +pub mod owned; pub mod result; pub mod result_jserror; pub mod rethrow; diff --git a/tests/wasm/owned.js b/tests/wasm/owned.js new file mode 100644 index 00000000000..e1d5dfbe1a5 --- /dev/null +++ b/tests/wasm/owned.js @@ -0,0 +1,13 @@ +const wasm = require("wasm-bindgen-test.js"); + +exports.create_garbage = async function () { + for (let i = 0; i < 100; i++) { + new wasm.OwnedValue(1).add(new wasm.OwnedValue(2)).n(); + } + + if ("gc" in global) { + global.gc(); + } else { + console.warn("test runner doesn't expose GC function"); + } +}; diff --git a/tests/wasm/owned.rs b/tests/wasm/owned.rs new file mode 100644 index 00000000000..7d51673a557 --- /dev/null +++ b/tests/wasm/owned.rs @@ -0,0 +1,35 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen] +pub struct OwnedValue { + pub n: f64, +} + +#[wasm_bindgen] +impl OwnedValue { + #[wasm_bindgen(constructor)] + pub fn new(n: f64) -> Self { + Self { n } + } + + pub fn add(self, other: OwnedValue) -> Self { + Self { + n: self.n + other.n, + } + } + + pub fn n(self) -> f64 { + self.n + } +} + +#[wasm_bindgen(module = "tests/wasm/owned.js")] +extern "C" { + fn create_garbage(); +} + +#[wasm_bindgen_test] +fn test_create_garbage() { + create_garbage() +} From fa43337531f5b5a67c4187b5870d010737d4d174 Mon Sep 17 00:00:00 2001 From: morenol <22335041+morenol@users.noreply.github.com> Date: Wed, 19 Oct 2022 08:44:59 -0500 Subject: [PATCH 096/641] build: add aarch64-linux-gnu binary to releases (#3118) * build: add aarch64-linux-gnu binary to releases * set linker * Address feedback * Address feedback * FIX Co-authored-by: Luis Moreno --- .github/workflows/main.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 59d52e8d842..103d6ab5f75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -296,7 +296,7 @@ jobs: name: benchmarks path: benchmarks - dist_linux: + dist_linux_x86_64_musl: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -310,9 +310,25 @@ jobs: strip -g target/x86_64-unknown-linux-musl/release/wasm2es6js - uses: actions/upload-artifact@v2 with: - name: dist_linux + name: dist_linux_x86_64_musl path: "target/x86_64-unknown-linux-musl/release/wasm*" + dist_linux_aarch64_gnu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add aarch64-unknown-linux-gnu + - run: sudo apt update -y && sudo apt install gcc-aarch64-linux-gnu -y + - run: | + cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-gnu --features vendored-openssl --release + env: + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + - uses: actions/upload-artifact@v2 + with: + name: dist_linux_aarch64_gnu + path: "target/aarch64-unknown-linux-gnu/release/wasm*" + dist_macos: runs-on: macos-latest steps: @@ -374,7 +390,8 @@ jobs: needs: - doc_api - doc_book - - dist_linux + - dist_linux_x86_64_musl + - dist_linux_aarch64_gnu - dist_macos - dist_windows - build_examples @@ -409,7 +426,8 @@ jobs: chmod +x tmp/$name/wasm* tar czvf gh-release/$name.tar.gz -C tmp $name } - mk x86_64-unknown-linux-musl dist_linux + mk x86_64-unknown-linux-musl dist_linux_x86_64_musl + mk aarch64-unknown-linux-gnu dist_linux_aarch64_gnu mk x86_64-apple-darwin dist_macos mk x86_64-pc-windows-msvc dist_windows - uses: actions/upload-artifact@v2 From 0ebfbb6395f881aa316a0b069caebdf2df723b0f Mon Sep 17 00:00:00 2001 From: Ethan D Twardy Date: Mon, 31 Oct 2022 15:19:27 +0000 Subject: [PATCH 097/641] guide: Add documentation for use of static in extern blocks (#3127) This commit helps address #2820 by providing additional documentation for accessing exports of JS snippets and modules directly. --- guide/src/SUMMARY.md | 1 + guide/src/reference/static-js-objects.md | 64 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 guide/src/reference/static-js-objects.md diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 4bc3c32ae06..2bd611cfe06 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -32,6 +32,7 @@ - [Reference](./reference/index.md) - [Deployment](./reference/deployment.md) - [JS snippets](./reference/js-snippets.md) + - [Static JS Objects](./reference/static-js-objects.md) - [Passing Rust Closures to JS](./reference/passing-rust-closures-to-js.md) - [Receiving JS Closures in Rust](./reference/receiving-js-closures-in-rust.md) - [`Promise`s and `Future`s](./reference/js-promises-and-rust-futures.md) diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md new file mode 100644 index 00000000000..f4826ea0dd1 --- /dev/null +++ b/guide/src/reference/static-js-objects.md @@ -0,0 +1,64 @@ +# Use of `static` to Access JS Objects + +JavaScript modules will often export arbitrary static objects for use with +their provided interfaces. These objects can be accessed from Rust by declaring +a named `static` in the `extern` block. `wasm-bindgen` will bind a `JsStatic` +for these objects, which can be cloned into a `JsValue`. For example, given the +following JavaScript: + +```js +let COLORS = { + red: 'rgb(255, 0, 0)', + green: 'rgb(0, 255, 0)', + blue: 'rgb(0, 0, 255)', +}; +``` + +`static` can aid in the access of this object from Rust: + +```rust +#[wasm_bindgen] +extern "C" { + static COLORS; +} + +fn get_colors() -> JsValue { + COLORS.clone() +} +``` + +Since `COLORS` is effectively a JavaScript namespace, we can use the same +mechanism to refer directly to namespaces exported from JavaScript modules, and +even to exported classes: + +```js +let namespace = { + // Members of namespace... +}; + +class SomeType { + // Definition of SomeType... +}; + +export { SomeType, namespace }; +``` + +The binding for this module: + +```rust +#[wasm_bindgen(module = "/js/some-rollup.js")] +extern "C" { + // Likewise with the namespace--this refers to the object directly. + #[wasm_bindgen(js_name = namespace)] + static NAMESPACE: JsValue; + + // Refer to SomeType's class + #[wasm_bindgen(js_name = SomeType)] + static SOME_TYPE: JsValue; + + // Other bindings for SomeType + type SomeType; + #[wasm_bindgen(constructor)] + fn new() -> SomeType; +} +``` From 8ae0f7ff4c9106fdd65c98297b1a8f8c6ea14645 Mon Sep 17 00:00:00 2001 From: printfn <1643883+printfn@users.noreply.github.com> Date: Wed, 2 Nov 2022 02:51:37 +1300 Subject: [PATCH 098/641] add aarch64-apple-darwin binary to releases (#3129) Co-authored-by: printfn --- .github/workflows/main.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 103d6ab5f75..f047be3ba8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -329,7 +329,7 @@ jobs: name: dist_linux_aarch64_gnu path: "target/aarch64-unknown-linux-gnu/release/wasm*" - dist_macos: + dist_macos_x86_64: runs-on: macos-latest steps: - uses: actions/checkout@v2 @@ -339,9 +339,24 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 10.7 - uses: actions/upload-artifact@v2 with: - name: dist_macos + name: dist_macos_x86_64 path: "target/release/wasm*" + dist_macos_aarch64: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add aarch64-apple-darwin + - run: | + cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-apple-darwin --release + env: + MACOSX_DEPLOYMENT_TARGET: 10.7 + - uses: actions/upload-artifact@v2 + with: + name: dist_macos_aarch64 + path: "target/aarch64-apple-darwin/release/wasm*" + dist_windows: runs-on: windows-latest steps: @@ -392,7 +407,8 @@ jobs: - doc_book - dist_linux_x86_64_musl - dist_linux_aarch64_gnu - - dist_macos + - dist_macos_x86_64 + - dist_macos_aarch64 - dist_windows - build_examples - build_nightly @@ -428,7 +444,8 @@ jobs: } mk x86_64-unknown-linux-musl dist_linux_x86_64_musl mk aarch64-unknown-linux-gnu dist_linux_aarch64_gnu - mk x86_64-apple-darwin dist_macos + mk x86_64-apple-darwin dist_macos_x86_64 + mk aarch64-apple-darwin dist_macos_aarch64 mk x86_64-pc-windows-msvc dist_windows - uses: actions/upload-artifact@v2 with: From c94546043b04d5b1d707142f2a15aab3c6f01217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=B4=E5=85=9C=7E?= Date: Sun, 6 Nov 2022 06:35:52 +0800 Subject: [PATCH 099/641] js-sys: Atomics support for BigInt64Array (#3124) --- crates/js-sys/src/lib.rs | 160 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 12fef1cb7f7..c7d3899d35d 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -823,20 +823,47 @@ pub mod Atomics { /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `add_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/add) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn add(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.add()` method adds a given value at a given + /// position in the array and returns the old value at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/add) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = add)] + pub fn add_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; + /// The static `Atomics.and()` method computes a bitwise AND with a given /// value at a given position in the array, and returns the old value /// at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `and_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/and) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn and(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.and()` method computes a bitwise AND with a given + /// value at a given position in the array, and returns the old value + /// at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/and) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = and)] + pub fn and_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; + /// The static `Atomics.compareExchange()` method exchanges a given /// replacement value at a given position in the array, if a given expected /// value equals the old value. It returns the old value at that position @@ -844,6 +871,8 @@ pub mod Atomics { /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `compare_exchange_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/compareExchange) #[wasm_bindgen(js_namespace = Atomics, catch, js_name = compareExchange)] pub fn compare_exchange( @@ -853,15 +882,50 @@ pub mod Atomics { replacement_value: i32, ) -> Result; + /// The static `Atomics.compareExchange()` method exchanges a given + /// replacement value at a given position in the array, if a given expected + /// value equals the old value. It returns the old value at that position + /// whether it was equal to the expected value or not. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/compareExchange) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = compareExchange)] + pub fn compare_exchange_bigint( + typed_array: &JsValue, + index: u32, + expected_value: i64, + replacement_value: i64, + ) -> Result; + /// The static `Atomics.exchange()` method stores a given value at a given /// position in the array and returns the old value at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `exchange_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/exchange) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn exchange(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.exchange()` method stores a given value at a given + /// position in the array and returns the old value at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/exchange) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = exchange)] + pub fn exchange_bigint( + typed_array: &JsValue, + index: u32, + value: i64, + ) -> Result; + /// The static `Atomics.isLockFree()` method is used to determine /// whether to use locks or atomic operations. It returns true, /// if the given size is one of the `BYTES_PER_ELEMENT` property @@ -874,10 +938,21 @@ pub mod Atomics { /// The static `Atomics.load()` method returns a value at a given /// position in the array. /// + /// You should use `load_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/load) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn load(typed_array: &JsValue, index: u32) -> Result; + /// The static `Atomics.load()` method returns a value at a given + /// position in the array. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/load) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = load)] + pub fn load_bigint(typed_array: &JsValue, index: i64) -> Result; + /// The static `Atomics.notify()` method notifies up some agents that /// are sleeping in the wait queue. /// Note: This operation works with a shared `Int32Array` only. @@ -900,26 +975,63 @@ pub mod Atomics { /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `or_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/or) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn or(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.or()` method computes a bitwise OR with a given value + /// at a given position in the array, and returns the old value at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/or) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = or)] + pub fn or_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; + /// The static `Atomics.store()` method stores a given value at the given /// position in the array and returns that value. /// + /// You should use `store_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/store) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn store(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.store()` method stores a given value at the given + /// position in the array and returns that value. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/store) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = store)] + pub fn store_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; + /// The static `Atomics.sub()` method substracts a given value at a /// given position in the array and returns the old value at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `sub_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/sub) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn sub(typed_array: &JsValue, index: u32, value: i32) -> Result; + /// The static `Atomics.sub()` method substracts a given value at a + /// given position in the array and returns the old value at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/sub) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = sub)] + pub fn sub_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; + /// The static `Atomics.wait()` method verifies that a given /// position in an `Int32Array` still contains a given value /// and if so sleeps, awaiting a wakeup or a timeout. @@ -927,12 +1039,33 @@ pub mod Atomics { /// Note: This operation only works with a shared `Int32Array` /// and may not be allowed on the main thread. /// + /// You should use `wait_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn wait(typed_array: &Int32Array, index: u32, value: i32) -> Result; + /// The static `Atomics.wait()` method verifies that a given + /// position in an `Int32Array` still contains a given value + /// and if so sleeps, awaiting a wakeup or a timeout. + /// It returns a string which is either "ok", "not-equal", or "timed-out". + /// Note: This operation only works with a shared `Int32Array` + /// and may not be allowed on the main thread. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] + pub fn wait_bigint( + typed_array: &Int32Array, + index: u32, + value: i64, + ) -> Result; + /// Like `wait()`, but with timeout /// + /// You should use `wait_with_timeout_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] pub fn wait_with_timeout( @@ -942,15 +1075,42 @@ pub mod Atomics { timeout: f64, ) -> Result; + /// Like `wait()`, but with timeout + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)] + pub fn wait_with_timeout_bigint( + typed_array: &Int32Array, + index: u32, + value: i64, + timeout: f64, + ) -> Result; + /// The static `Atomics.xor()` method computes a bitwise XOR /// with a given value at a given position in the array, /// and returns the old value at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. /// + /// You should use `xor_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`. + /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/xor) #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn xor(typed_array: &JsValue, index: u32, value: i32) -> Result; + + /// The static `Atomics.xor()` method computes a bitwise XOR + /// with a given value at a given position in the array, + /// and returns the old value at that position. + /// This atomic operation guarantees that no other write happens + /// until the modified value is written back. + /// + /// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/xor) + #[wasm_bindgen(js_namespace = Atomics, catch, js_name = xor)] + pub fn xor_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; } } From 2bd09811c6fabf0ee7f40b22b968fe9f1ad5d0c0 Mon Sep 17 00:00:00 2001 From: Eli Front <63875354+eli-front@users.noreply.github.com> Date: Sun, 6 Nov 2022 13:31:41 -0600 Subject: [PATCH 100/641] remove unused ShortHash (#3132) --- crates/backend/src/codegen.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index f060e0266f3..72e32398734 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1,6 +1,5 @@ use crate::ast; use crate::encode; -use crate::util::ShortHash; use crate::Diagnostic; use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; From 6139212137fdeff9107283f0c6d4a8b0bca31af5 Mon Sep 17 00:00:00 2001 From: Eli Front <63875354+eli-front@users.noreply.github.com> Date: Sun, 6 Nov 2022 13:32:06 -0600 Subject: [PATCH 101/641] Weather report example improvement (#3134) * remove unused ShortHash * Revert "remove unused ShortHash" This reverts commit 91388900fbf6be0fd303ba4f5007f4476c9e09a2. * fix set attr error handling --- examples/weather_report/src/lib.rs | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/examples/weather_report/src/lib.rs b/examples/weather_report/src/lib.rs index 82917512f7d..52cfdc5e889 100644 --- a/examples/weather_report/src/lib.rs +++ b/examples/weather_report/src/lib.rs @@ -177,7 +177,10 @@ pub fn run() -> Result<(), JsValue> { let h: &str = &parsed["main"]["humidity"].to_owned().to_string(); let sun_r = ((&parsed["sys"]["sunrise"]).to_owned().as_f64().unwrap()) as u64; let sun_s = ((&parsed["sys"]["sunset"]).to_owned().as_f64().unwrap()) as u64; - temp_d.set_attribute("style", "display: block"); + + temp_d + .set_attribute("style", "display: block") + .expect("failed to set attr style"); city.set_inner_html(&place); image.set_inner_html(&content); weather.set_inner_html(&parsed["weather"][0]["main"].to_owned().to_string()); @@ -206,9 +209,15 @@ fn create_div(document: &Document, id: &str, class: &str) -> Element { fn create_submit_box(document: &Document) -> Element { let submit_box: Element = document.create_element("input").unwrap(); - submit_box.set_attribute("type", "button"); - submit_box.set_attribute("value", "Search"); - submit_box.set_attribute("name", "submit"); + submit_box + .set_attribute("type", "button") + .expect("failed to set attr type to button"); + submit_box + .set_attribute("value", "Search") + .expect("failed to set attr value to Search"); + submit_box + .set_attribute("name", "submit") + .expect("failed to set attr name to submit"); submit_box.set_id("submit"); submit_box.set_class_name(" ReportStyles-bootstrapButton btn btn-info"); submit_box @@ -216,10 +225,19 @@ fn create_submit_box(document: &Document) -> Element { fn create_input_box(document: &Document) -> Element { let input_box = document.create_element("input").unwrap(); - input_box.set_attribute("name", "name"); - input_box.set_attribute("value", "Delhi"); - input_box.set_attribute("type", "text"); - input_box.set_attribute("placeholder", "Type city name here"); + input_box + .set_attribute("name", "name") + .expect("failed to set attr name to name"); + input_box.set_attribute("value", "Delhi").expect( + " + failed to set attr value to Delhi", + ); + input_box + .set_attribute("type", "text") + .expect("failed to set attr type to text"); + input_box + .set_attribute("placeholder", "Type city name here") + .expect("Failed to set attr placeholder to Type city name here"); input_box.set_id("name"); input_box.set_class_name("ReportStyles-search"); input_box From 4f865308afbe8d2463968457711ad356bae63b71 Mon Sep 17 00:00:00 2001 From: Eli Front <63875354+eli-front@users.noreply.github.com> Date: Mon, 7 Nov 2022 09:09:31 -0600 Subject: [PATCH 102/641] macro misuse fix #3135 (#3137) --- examples/wasm-in-wasm-imports/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/wasm-in-wasm-imports/src/lib.rs b/examples/wasm-in-wasm-imports/src/lib.rs index 30ea6990a0c..4b0f502f919 100644 --- a/examples/wasm-in-wasm-imports/src/lib.rs +++ b/examples/wasm-in-wasm-imports/src/lib.rs @@ -13,12 +13,10 @@ extern "C" { } -#[macro_use] macro_rules! console_log { ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) } -#[macro_use] macro_rules! console_error { ($($t:tt)*) => (error(&format_args!($($t)*).to_string())) } From 0fa592d76feb040b828e4d25d664125b624e9723 Mon Sep 17 00:00:00 2001 From: nasso <11479594+nasso@users.noreply.github.com> Date: Sun, 13 Nov 2022 20:20:24 -0800 Subject: [PATCH 103/641] Update web-sys features (#3145) --- crates/web-sys/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index e252b2d0fa6..ed23ad9b09d 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -446,6 +446,7 @@ GpuBufferBinding = [] GpuBufferBindingLayout = [] GpuBufferBindingType = [] GpuBufferDescriptor = [] +GpuBufferMapState = [] GpuCanvasAlphaMode = [] GpuCanvasConfiguration = [] GpuCanvasContext = [] @@ -487,6 +488,7 @@ GpuImageCopyTexture = [] GpuImageCopyTextureTagged = [] GpuImageDataLayout = [] GpuIndexFormat = [] +GpuInternalError = ["GpuError"] GpuLoadOp = [] GpuMipmapFilterMode = [] GpuMultisampleState = [] From 8d56c532dc97edb2235d85d76d4af1c0df8dd1d5 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 15 Nov 2022 09:56:27 +1100 Subject: [PATCH 104/641] Use indexing syntax for invalid JS identifiers (#3146) * Use indexing syntax for invalid JS identifiers Fixes #3113 * fmt --- crates/cli-support/Cargo.toml | 1 + crates/cli-support/src/js/mod.rs | 88 +++++++++++++++++++++++++++++--- tests/wasm/import_class.js | 20 ++++++++ tests/wasm/import_class.rs | 21 ++++++++ tests/wasm/imports.js | 5 +- tests/wasm/imports.rs | 12 +++++ 6 files changed, 140 insertions(+), 7 deletions(-) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 99294871bc4..fe676396e69 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -28,3 +28,4 @@ wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2. wit-text = "0.8.0" wit-walrus = "0.6.0" wit-validator = "0.2.0" +unicode-ident = "1.0.5" diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 7762f1925c7..526062a3e10 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2951,7 +2951,12 @@ impl<'a> Context<'a> { AuxImport::ValueWithThis(class, name) => { let class = self.import_name(class)?; - Ok(format!("{}.{}({})", class, name, variadic_args(&args)?)) + Ok(format!( + "{}{}({})", + class, + property_accessor(name), + variadic_args(&args)? + )) } AuxImport::Instanceof(js) => { @@ -3023,14 +3028,19 @@ impl<'a> Context<'a> { Some(pair) => pair, None => bail!("structural method calls must have at least one argument"), }; - Ok(format!("{}.{}({})", receiver, name, variadic_args(args)?)) + Ok(format!( + "{}{}({})", + receiver, + property_accessor(name), + variadic_args(args)? + )) } AuxImport::StructuralGetter(field) => { assert!(kind == AdapterJsImportKind::Normal); assert!(!variadic); assert_eq!(args.len(), 1); - Ok(format!("{}.{}", args[0], field)) + Ok(format!("{}{}", args[0], property_accessor(field))) } AuxImport::StructuralClassGetter(class, field) => { @@ -3038,14 +3048,19 @@ impl<'a> Context<'a> { assert!(!variadic); assert_eq!(args.len(), 0); let class = self.import_name(class)?; - Ok(format!("{}.{}", class, field)) + Ok(format!("{}{}", class, property_accessor(field))) } AuxImport::StructuralSetter(field) => { assert!(kind == AdapterJsImportKind::Normal); assert!(!variadic); assert_eq!(args.len(), 2); - Ok(format!("{}.{} = {}", args[0], field, args[1])) + Ok(format!( + "{}{} = {}", + args[0], + property_accessor(field), + args[1] + )) } AuxImport::StructuralClassSetter(class, field) => { @@ -3053,7 +3068,12 @@ impl<'a> Context<'a> { assert!(!variadic); assert_eq!(args.len(), 1); let class = self.import_name(class)?; - Ok(format!("{}.{} = {}", class, field, args[0])) + Ok(format!( + "{}{} = {}", + class, + property_accessor(field), + args[0] + )) } AuxImport::IndexingGetterOfClass(class) => { @@ -3912,6 +3932,62 @@ fn require_class<'a>( .or_insert_with(ExportedClass::default) } +/// Returns whether a character has the Unicode `ID_Start` properly. +/// +/// This is only ever-so-slightly different from `XID_Start` in a few edge +/// cases, so we handle those edge cases manually and delegate everything else +/// to `unicode-ident`. +fn is_id_start(c: char) -> bool { + match c { + '\u{037A}' | '\u{0E33}' | '\u{0EB3}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' + | '\u{FC5F}' | '\u{FC60}' | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' + | '\u{FDFB}' | '\u{FE70}' | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' + | '\u{FE7A}' | '\u{FE7C}' | '\u{FE7E}' | '\u{FF9E}' | '\u{FF9F}' => true, + _ => unicode_ident::is_xid_start(c), + } +} + +/// Returns whether a character has the Unicode `ID_Continue` properly. +/// +/// This is only ever-so-slightly different from `XID_Continue` in a few edge +/// cases, so we handle those edge cases manually and delegate everything else +/// to `unicode-ident`. +fn is_id_continue(c: char) -> bool { + match c { + '\u{037A}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' | '\u{FC5F}' | '\u{FC60}' + | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' | '\u{FDFB}' | '\u{FE70}' + | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' | '\u{FE7A}' | '\u{FE7C}' + | '\u{FE7E}' => true, + _ => unicode_ident::is_xid_continue(c), + } +} + +/// Returns whether a string is a valid JavaScript identifier. +/// Defined at https://tc39.es/ecma262/#prod-IdentifierName. +fn is_valid_ident(name: &str) -> bool { + name.chars().enumerate().all(|(i, char)| { + if i == 0 { + is_id_start(char) || char == '$' || char == '_' + } else { + is_id_continue(char) || char == '$' || char == '\u{200C}' || char == '\u{200D}' + } + }) +} + +/// Returns a string to tack on to the end of an expression to access a +/// property named `name` of the object that expression resolves to. +/// +/// In most cases, this is `.`, generating accesses like `foo.bar`. +/// However, if `name` is not a valid JavaScript identifier, it becomes +/// `[""]` instead, creating accesses like `foo["kebab-case"]`. +fn property_accessor(name: &str) -> String { + if is_valid_ident(name) { + format!(".{name}") + } else { + format!("[\"{}\"]", name.escape_default()) + } +} + impl ExportedClass { fn push( &mut self, diff --git a/tests/wasm/import_class.js b/tests/wasm/import_class.js index 848be7b14f0..778ffd15bf6 100644 --- a/tests/wasm/import_class.js +++ b/tests/wasm/import_class.js @@ -25,6 +25,26 @@ class Construct { assert_internal_string(s) { assert.strictEqual(this.internal_string, s); } + + ["kebab-case"]() { + return 42; + } + + get ["kebab-case-val"]() { + return 42; + } + + set ["kebab-case-val"](val) {} + + static ["static-kebab-case"]() { + return 42; + } + + static get ["static-kebab-case-val"]() { + return 42; + } + + static set ["static-kebab-case-val"](val) {} } Construct.internal_string = ''; diff --git a/tests/wasm/import_class.rs b/tests/wasm/import_class.rs index 7de986147cb..55cc1d1be98 100644 --- a/tests/wasm/import_class.rs +++ b/tests/wasm/import_class.rs @@ -23,6 +23,19 @@ extern "C" { #[wasm_bindgen(method)] fn assert_internal_string(this: &Construct, s: &str); + #[wasm_bindgen(method, js_name = "kebab-case")] + fn kebab_case(this: &Construct) -> u32; + #[wasm_bindgen(method, getter, js_name = "kebab-case-val")] + fn kebab_case_val(this: &Construct) -> u32; + #[wasm_bindgen(method, setter, js_name = "kebab-case-val")] + fn set_kebab_case_val(this: &Construct, val: u32); + #[wasm_bindgen(static_method_of = Construct, js_name = "static-kebab-case")] + fn static_kebab_case() -> u32; + #[wasm_bindgen(static_method_of = Construct, getter, js_name = "static-kebab-case-val")] + fn static_kebab_case_val() -> u32; + #[wasm_bindgen(static_method_of = Construct, setter, js_name = "static-kebab-case-val")] + fn set_static_kebab_case_val(val: u32); + type NewConstructors; #[wasm_bindgen(constructor)] fn new(arg: i32) -> NewConstructors; @@ -137,6 +150,14 @@ fn construct() { assert_eq!(f.clone().get_internal_string(), "this"); f.append_to_internal_string(" foo"); f.assert_internal_string("this foo"); + + assert_eq!(f.kebab_case(), 42); + f.set_kebab_case_val(0); + // our setter does nothing so this is 42 anyway + assert_eq!(f.kebab_case_val(), 42); + assert_eq!(Construct::static_kebab_case(), 42); + Construct::set_static_kebab_case_val(0); + assert_eq!(Construct::static_kebab_case_val(), 42); } #[wasm_bindgen_test] diff --git a/tests/wasm/imports.js b/tests/wasm/imports.js index 70d8a3b087d..a47968d35d2 100644 --- a/tests/wasm/imports.js +++ b/tests/wasm/imports.js @@ -140,4 +140,7 @@ exports.same_name_from_import = (a) => a * 3; exports.same_js_namespace_from_module = { func_from_module_1_same_js_namespace: (a) => a * 5 -} \ No newline at end of file +} + +exports["kebab-case"] = () => 42; +exports["\"string'literal\nbreakers\r"] = () => 42; diff --git a/tests/wasm/imports.rs b/tests/wasm/imports.rs index 88dbf5ed674..27e4a67dca3 100644 --- a/tests/wasm/imports.rs +++ b/tests/wasm/imports.rs @@ -81,6 +81,12 @@ extern "C" { #[wasm_bindgen(js_namespace = same_js_namespace_from_module)] fn func_from_module_1_same_js_namespace(s: i32) -> i32; + + #[wasm_bindgen(js_name = "kebab-case")] + fn kebab_case() -> u32; + + #[wasm_bindgen(js_name = "\"string'literal\nbreakers\r")] + fn string_literal_breakers() -> u32; } #[wasm_bindgen(module = "tests/wasm/imports_2.js")] @@ -321,3 +327,9 @@ fn func_from_two_modules_same_js_namespace() { assert_eq!(func_from_module_1_same_js_namespace(2), 10); assert_eq!(func_from_module_2_same_js_namespace(2), 12); } + +#[wasm_bindgen_test] +fn invalid_idents() { + assert_eq!(kebab_case(), 42); + assert_eq!(string_literal_breakers(), 42); +} From f5b2ef8c5cda2c1933fd5d2c2337eb4ca26470e8 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 14 Nov 2022 17:56:55 -0500 Subject: [PATCH 105/641] Add an option to keep LLD exports (#3147) --- crates/cli-support/src/lib.rs | 11 ++++++++++- crates/cli/src/bin/wasm-bindgen.rs | 3 +++ guide/src/reference/cli.md | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index e77137c941a..fa67474436e 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -30,6 +30,7 @@ pub struct Bindgen { typescript: bool, omit_imports: bool, demangle: bool, + keep_lld_exports: bool, keep_debug: bool, remove_name_section: bool, remove_producers_section: bool, @@ -107,6 +108,7 @@ impl Bindgen { typescript: false, omit_imports: false, demangle: true, + keep_lld_exports: false, keep_debug: false, remove_name_section: false, remove_producers_section: false, @@ -267,6 +269,11 @@ impl Bindgen { self } + pub fn keep_lld_exports(&mut self, keep_lld_exports: bool) -> &mut Bindgen { + self.keep_lld_exports = keep_lld_exports; + self + } + pub fn keep_debug(&mut self, keep_debug: bool) -> &mut Bindgen { self.keep_debug = keep_debug; self @@ -340,7 +347,9 @@ impl Bindgen { if self.demangle { demangle(&mut module); } - unexported_unused_lld_things(&mut module); + if !self.keep_lld_exports { + unexported_unused_lld_things(&mut module); + } // We're making quite a few changes, list ourselves as a producer. module diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index 877b0c41a12..ff16a908dda 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -31,6 +31,7 @@ Options: --omit-imports Don't emit imports in generated JavaScript --debug Include otherwise-extraneous debug checks in output --no-demangle Don't demangle Rust symbol names + --keep-lld-exports Keep exports synthesized by LLD --keep-debug Keep debug sections in wasm files --remove-name-section Remove the debugging `name` section of the file --remove-producers-section Remove the telemetry `producers` section @@ -64,6 +65,7 @@ struct Args { flag_remove_producers_section: bool, flag_weak_refs: Option, flag_reference_types: Option, + flag_keep_lld_exports: bool, flag_keep_debug: bool, flag_encode_into: Option, flag_target: Option, @@ -115,6 +117,7 @@ fn rmain(args: &Args) -> Result<(), Error> { .no_modules(args.flag_no_modules)? .debug(args.flag_debug) .demangle(!args.flag_no_demangle) + .keep_lld_exports(args.flag_keep_lld_exports) .keep_debug(args.flag_keep_debug) .remove_name_section(args.flag_remove_name_section) .remove_producers_section(args.flag_remove_producers_section) diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index dfc71c9f323..9c26649606f 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -68,6 +68,11 @@ errors, but this output isn't intended to be shipped to production. When post-processing the `.wasm` binary, do not demangle Rust symbols in the "names" custom section. +### `--keep-lld-exports` + +When post-processing the `.wasm` binary, do not remove exports that are +synthesized by Rust's linker, LLD. + ### `--keep-debug` When post-processing the `.wasm` binary, do not strip DWARF debug info custom From 237908d009b63c1f8d78b0eabfa909be8d5310c0 Mon Sep 17 00:00:00 2001 From: nasso <11479594+nasso@users.noreply.github.com> Date: Wed, 16 Nov 2022 18:23:53 -0800 Subject: [PATCH 106/641] Add support for `maplike` interfaces (#3144) --- .../web-sys/src/features/gen_AudioParamMap.rs | 50 +++ .../gen_BluetoothManufacturerDataMap.rs | 80 +++++ .../features/gen_BluetoothServiceDataMap.rs | 80 +++++ .../web-sys/src/features/gen_MidiInputMap.rs | 50 +++ .../web-sys/src/features/gen_MidiOutputMap.rs | 50 +++ .../src/features/gen_RtcStatsReport.rs | 49 +++ crates/webidl-tests/globals.js | 55 ++++ crates/webidl-tests/main.rs | 1 + crates/webidl-tests/maplike.rs | 104 ++++++ .../webidls/enabled/maplike.webidl | 9 + crates/webidl/Cargo.toml | 1 + crates/webidl/src/constants.rs | 1 + crates/webidl/src/first_pass.rs | 303 ++++++++++++++++-- crates/webidl/src/idl_type.rs | 5 + crates/webidl/src/util.rs | 45 ++- 15 files changed, 851 insertions(+), 32 deletions(-) create mode 100644 crates/webidl-tests/maplike.rs create mode 100644 crates/webidl-tests/webidls/enabled/maplike.webidl diff --git a/crates/web-sys/src/features/gen_AudioParamMap.rs b/crates/web-sys/src/features/gen_AudioParamMap.rs index 02c3953081d..043b0d1ff08 100644 --- a/crates/web-sys/src/features/gen_AudioParamMap.rs +++ b/crates/web-sys/src/features/gen_AudioParamMap.rs @@ -11,4 +11,54 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] pub type AudioParamMap; + # [wasm_bindgen (structural , method , getter , js_class = "AudioParamMap" , 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/AudioParamMap/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn size(this: &AudioParamMap) -> u32; + # [wasm_bindgen (method , structural , js_class = "AudioParamMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn entries(this: &AudioParamMap) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "AudioParamMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn for_each(this: &AudioParamMap, callback: &::js_sys::Function) -> Result<(), JsValue>; + #[cfg(feature = "AudioParam")] + # [wasm_bindgen (method , structural , js_class = "AudioParamMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParam`, `AudioParamMap`*"] + pub fn get(this: &AudioParamMap, key: &str) -> Option; + # [wasm_bindgen (method , structural , js_class = "AudioParamMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn has(this: &AudioParamMap, key: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "AudioParamMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn keys(this: &AudioParamMap) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "AudioParamMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParamMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParamMap`*"] + pub fn values(this: &AudioParamMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_BluetoothManufacturerDataMap.rs b/crates/web-sys/src/features/gen_BluetoothManufacturerDataMap.rs index db317c7dc75..0c0aba9fa51 100644 --- a/crates/web-sys/src/features/gen_BluetoothManufacturerDataMap.rs +++ b/crates/web-sys/src/features/gen_BluetoothManufacturerDataMap.rs @@ -15,4 +15,84 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothManufacturerDataMap; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "BluetoothManufacturerDataMap" , 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/BluetoothManufacturerDataMap/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(this: &BluetoothManufacturerDataMap) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entries(this: &BluetoothManufacturerDataMap) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn for_each( + this: &BluetoothManufacturerDataMap, + callback: &::js_sys::Function, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get(this: &BluetoothManufacturerDataMap, key: u16) -> Option<::js_sys::DataView>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn has(this: &BluetoothManufacturerDataMap, key: u16) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keys(this: &BluetoothManufacturerDataMap) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothManufacturerDataMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothManufacturerDataMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn values(this: &BluetoothManufacturerDataMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_BluetoothServiceDataMap.rs b/crates/web-sys/src/features/gen_BluetoothServiceDataMap.rs index cb089efcc6a..c378eb0bd1c 100644 --- a/crates/web-sys/src/features/gen_BluetoothServiceDataMap.rs +++ b/crates/web-sys/src/features/gen_BluetoothServiceDataMap.rs @@ -15,4 +15,84 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothServiceDataMap; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "BluetoothServiceDataMap" , 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/BluetoothServiceDataMap/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(this: &BluetoothServiceDataMap) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothServiceDataMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entries(this: &BluetoothServiceDataMap) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothServiceDataMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn for_each( + this: &BluetoothServiceDataMap, + callback: &::js_sys::Function, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothServiceDataMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get(this: &BluetoothServiceDataMap, key: &str) -> Option<::js_sys::DataView>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothServiceDataMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn has(this: &BluetoothServiceDataMap, key: &str) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothServiceDataMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keys(this: &BluetoothServiceDataMap) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "BluetoothServiceDataMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothServiceDataMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn values(this: &BluetoothServiceDataMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_MidiInputMap.rs b/crates/web-sys/src/features/gen_MidiInputMap.rs index 7a682bdad00..c0a4094126e 100644 --- a/crates/web-sys/src/features/gen_MidiInputMap.rs +++ b/crates/web-sys/src/features/gen_MidiInputMap.rs @@ -11,4 +11,54 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] pub type MidiInputMap; + # [wasm_bindgen (structural , method , getter , js_class = "MIDIInputMap" , 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/MIDIInputMap/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn size(this: &MidiInputMap) -> u32; + # [wasm_bindgen (method , structural , js_class = "MIDIInputMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn entries(this: &MidiInputMap) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "MIDIInputMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn for_each(this: &MidiInputMap, callback: &::js_sys::Function) -> Result<(), JsValue>; + #[cfg(feature = "MidiInput")] + # [wasm_bindgen (method , structural , js_class = "MIDIInputMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInput`, `MidiInputMap`*"] + pub fn get(this: &MidiInputMap, key: &str) -> Option; + # [wasm_bindgen (method , structural , js_class = "MIDIInputMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn has(this: &MidiInputMap, key: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "MIDIInputMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn keys(this: &MidiInputMap) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "MIDIInputMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIInputMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiInputMap`*"] + pub fn values(this: &MidiInputMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_MidiOutputMap.rs b/crates/web-sys/src/features/gen_MidiOutputMap.rs index d20f434544b..e0b9f86f130 100644 --- a/crates/web-sys/src/features/gen_MidiOutputMap.rs +++ b/crates/web-sys/src/features/gen_MidiOutputMap.rs @@ -11,4 +11,54 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] pub type MidiOutputMap; + # [wasm_bindgen (structural , method , getter , js_class = "MIDIOutputMap" , 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/MIDIOutputMap/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn size(this: &MidiOutputMap) -> u32; + # [wasm_bindgen (method , structural , js_class = "MIDIOutputMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn entries(this: &MidiOutputMap) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "MIDIOutputMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn for_each(this: &MidiOutputMap, callback: &::js_sys::Function) -> Result<(), JsValue>; + #[cfg(feature = "MidiOutput")] + # [wasm_bindgen (method , structural , js_class = "MIDIOutputMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutput`, `MidiOutputMap`*"] + pub fn get(this: &MidiOutputMap, key: &str) -> Option; + # [wasm_bindgen (method , structural , js_class = "MIDIOutputMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn has(this: &MidiOutputMap, key: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "MIDIOutputMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn keys(this: &MidiOutputMap) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "MIDIOutputMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutputMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOutputMap`*"] + pub fn values(this: &MidiOutputMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_RtcStatsReport.rs b/crates/web-sys/src/features/gen_RtcStatsReport.rs index 5d419f22854..a72b561ba95 100644 --- a/crates/web-sys/src/features/gen_RtcStatsReport.rs +++ b/crates/web-sys/src/features/gen_RtcStatsReport.rs @@ -11,4 +11,53 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] pub type RtcStatsReport; + # [wasm_bindgen (structural , method , getter , js_class = "RTCStatsReport" , 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/RTCStatsReport/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn size(this: &RtcStatsReport) -> u32; + # [wasm_bindgen (method , structural , js_class = "RTCStatsReport" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn entries(this: &RtcStatsReport) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "RTCStatsReport" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn for_each(this: &RtcStatsReport, callback: &::js_sys::Function) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "RTCStatsReport" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn get(this: &RtcStatsReport, key: &str) -> Option<::js_sys::Object>; + # [wasm_bindgen (method , structural , js_class = "RTCStatsReport" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn has(this: &RtcStatsReport, key: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "RTCStatsReport" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn keys(this: &RtcStatsReport) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "RTCStatsReport" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReport`*"] + pub fn values(this: &RtcStatsReport) -> ::js_sys::Iterator; } diff --git a/crates/webidl-tests/globals.js b/crates/webidl-tests/globals.js index 00a45ecf6f2..1a2d6693e69 100644 --- a/crates/webidl-tests/globals.js +++ b/crates/webidl-tests/globals.js @@ -164,6 +164,61 @@ const map = { global.get_global = () => map; +global.TestReadOnlyMapLike = class { + constructor() { + this.map = new Map(); + this.map.set('a', 1); + this.map.set('b', 2); + this.map.set('c', 3); + } + + entries() { + return this.map.entries(); + } + + forEach(callback, thisArg) { + return this.map.forEach(callback, thisArg); + } + + get(key) { + return this.map.get(key); + } + + has(key) { + return this.map.has(key); + } + + keys() { + return this.map.keys(); + } + + values() { + return this.map.values(); + } + + get size() { + return this.map.size; + } +}; + +global.TestReadWriteMapLike = class extends global.TestReadOnlyMapLike { + constructor() { + super(); + } + + set(key, value) { + return this.map.set(key, value); + } + + delete(key) { + return this.map.delete(key); + } + + clear() { + return this.map.clear(); + } +}; + global.math_test = { pow(base, exp) { return Math.pow(base, exp); diff --git a/crates/webidl-tests/main.rs b/crates/webidl-tests/main.rs index c9fc9ebc47a..99a0129f5e6 100644 --- a/crates/webidl-tests/main.rs +++ b/crates/webidl-tests/main.rs @@ -26,6 +26,7 @@ pub mod consts; pub mod dictionary; pub mod enums; pub mod global; +pub mod maplike; pub mod namespace; pub mod no_interface; pub mod promise; diff --git a/crates/webidl-tests/maplike.rs b/crates/webidl-tests/maplike.rs new file mode 100644 index 00000000000..0a9fd10613a --- /dev/null +++ b/crates/webidl-tests/maplike.rs @@ -0,0 +1,104 @@ +use crate::generated::*; +use wasm_bindgen::prelude::*; +use wasm_bindgen::JsCast; +use wasm_bindgen_test::*; + +macro_rules! read_test_suite { + ($maplike:ty, $name:ident) => { + #[wasm_bindgen_test] + fn $name() { + // { "a": 1, "b": 2, "c": 3 } + let maplike = <$maplike>::new().unwrap(); + + // readonly attribute unsigned long size; + assert_eq!(maplike.size(), 3); + + // boolean has(K key); + assert!(maplike.has("a")); + assert!(maplike.has("b")); + assert!(maplike.has("c")); + assert!(!maplike.has("d")); + + // V? get(K key); + assert_eq!(maplike.get("a"), Some(1)); + assert_eq!(maplike.get("b"), Some(2)); + assert_eq!(maplike.get("c"), Some(3)); + assert_eq!(maplike.get("d"), None); + + // { "a": 1, "b": 2, "c": 3 } + let cb = Closure::wrap(Box::new(|value: u32, key: String| match key.as_str() { + "a" => assert_eq!(value, 1), + "b" => assert_eq!(value, 2), + "c" => assert_eq!(value, 3), + _ => panic!("unexpected key"), + }) as Box); + + maplike.for_each(cb.as_ref().unchecked_ref()).unwrap(); + + let mut entries_vec = vec![]; + + for entry in maplike.entries().into_iter() { + let entry = entry.unwrap(); + let pair = entry.dyn_into::().unwrap(); + let key = pair.get(0).as_string().unwrap(); + let value = pair.get(1).as_f64().unwrap() as u32; + + entries_vec.push((key, value)); + } + + assert_eq!( + &entries_vec, + &[ + ("a".to_string(), 1), + ("b".to_string(), 2), + ("c".to_string(), 3) + ] + ); + + let mut keys_vec = vec![]; + + for key in maplike.keys().into_iter() { + let key = key.unwrap(); + keys_vec.push(key.as_string().unwrap()); + } + + assert_eq!( + &keys_vec, + &["a".to_string(), "b".to_string(), "c".to_string()] + ); + + let mut values_vec = vec![]; + + for value in maplike.values().into_iter() { + let value = value.unwrap(); + values_vec.push(value.as_f64().unwrap() as u32); + } + + assert_eq!(&values_vec, &[1, 2, 3]); + } + }; +} + +read_test_suite!(TestReadOnlyMapLike, read_readonly_maplike); +read_test_suite!(TestReadWriteMapLike, read_maplike); + +#[wasm_bindgen_test] +fn write_maplike() { + // { "a": 1, "b": 2, "c": 3 } + let maplike = TestReadWriteMapLike::new().unwrap(); + + // undefined set(K key, V value); + maplike.set("a", 4); + maplike.set("d", 5); + assert_eq!(maplike.get("a"), Some(4)); + assert_eq!(maplike.get("d"), Some(5)); + + // boolean delete(K key); + assert!(maplike.delete("a")); + assert_eq!(maplike.get("a"), None); + assert!(!maplike.delete("a")); + + // undefined clear(); + maplike.clear(); + assert_eq!(maplike.size(), 0); +} diff --git a/crates/webidl-tests/webidls/enabled/maplike.webidl b/crates/webidl-tests/webidls/enabled/maplike.webidl new file mode 100644 index 00000000000..2199e11930b --- /dev/null +++ b/crates/webidl-tests/webidls/enabled/maplike.webidl @@ -0,0 +1,9 @@ +[Constructor()] +interface TestReadOnlyMapLike { + readonly maplike; +}; + +[Constructor()] +interface TestReadWriteMapLike { + maplike; +}; diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index d07c4f0ab82..52b60e96bd0 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -25,3 +25,4 @@ weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" structopt = "0.3.9" +lazy_static = "1.4.0" diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 076110fd749..0124d4d7a96 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -31,6 +31,7 @@ pub(crate) static BUILTIN_IDENTS: Lazy> = Lazy::new(|| { "Function", "Clamped", "DataView", + "Iterator", ]) }); diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index 186fb1786e8..b2d3b226887 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -10,11 +10,15 @@ use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet}; +use lazy_static::lazy_static; use weedle::argument::Argument; use weedle::attribute::*; +use weedle::common::{Identifier, Punctuated}; use weedle::interface::*; use weedle::mixin::*; use weedle::namespace::*; +use weedle::term; +use weedle::types::*; use weedle::CallbackInterfaceDefinition; use weedle::{DictionaryDefinition, PartialDictionaryDefinition}; @@ -24,6 +28,36 @@ use crate::{ ApiStability, }; +lazy_static! { + // [Throws] + static ref THROWS_ATTR: Option> = { + Some(ExtendedAttributeList { + open_bracket: term::OpenBracket, + body: Punctuated { + list: vec![ExtendedAttribute::NoArgs(ExtendedAttributeNoArgs( + Identifier("Throws"), + ))], + separator: term!(,), + }, + close_bracket: term::CloseBracket, + }) + }; + + // [NewObject] + static ref NEW_OBJECT_ATTR: Option> = { + Some(ExtendedAttributeList { + open_bracket: term::OpenBracket, + body: Punctuated { + list: vec![ExtendedAttribute::NoArgs(ExtendedAttributeNoArgs( + Identifier("NewObject"), + ))], + separator: term!(,), + }, + close_bracket: term::CloseBracket, + }) + }; +} + /// Collection of constructs that may use partial. #[derive(Default)] pub(crate) struct FirstPassRecord<'src> { @@ -36,6 +70,7 @@ pub(crate) struct FirstPassRecord<'src> { pub(crate) includes: BTreeMap<&'src str, BTreeSet<&'src str>>, pub(crate) dictionaries: BTreeMap<&'src str, DictionaryData<'src>>, pub(crate) callbacks: BTreeSet<&'src str>, + pub(crate) iterators: BTreeSet<&'src str>, pub(crate) callback_interfaces: BTreeMap<&'src str, CallbackInterfaceData<'src>>, } @@ -138,6 +173,27 @@ pub(crate) struct Arg<'src> { pub(crate) variadic: bool, } +impl<'a> From<&'a Argument<'a>> for Arg<'a> { + fn from(arg: &'a Argument<'a>) -> Self { + let (name, ty, optional, variadic) = match arg { + Argument::Single(single) => ( + single.identifier.0, + &single.type_.type_, + single.optional.is_some(), + false, + ), + Argument::Variadic(variadic) => (variadic.identifier.0, &variadic.type_, false, true), + }; + + Self { + name, + ty, + optional, + variadic, + } + } +} + /// Implemented on an AST node to populate the `FirstPassRecord` struct. pub(crate) trait FirstPass<'src, Ctx> { /// Populate `record` with any constructs in `self`. @@ -270,12 +326,12 @@ enum FirstPassOperationType { Namespace, } -fn first_pass_operation<'src>( +fn first_pass_operation<'src, A: Into> + 'src>( record: &mut FirstPassRecord<'src>, first_pass_operation_type: FirstPassOperationType, self_name: &'src str, ids: &[OperationId<'src>], - arguments: &'src [Argument<'src>], + arguments: impl IntoIterator, ret: &weedle::types::ReturnType<'src>, attrs: &'src Option>, is_static: bool, @@ -284,13 +340,6 @@ fn first_pass_operation<'src>( return; } - let mut names = Vec::with_capacity(arguments.len()); - for argument in arguments { - match argument { - Argument::Single(single) => names.push(single.identifier.0), - Argument::Variadic(variadic) => names.push(variadic.identifier.0), - } - } let operations = match first_pass_operation_type { FirstPassOperationType::Interface => { let x = record @@ -314,24 +363,7 @@ fn first_pass_operation<'src>( &mut x.operations } }; - let mut args = Vec::with_capacity(arguments.len()); - for argument in arguments { - let (name, ty, optional, variadic) = match argument { - Argument::Single(single) => ( - single.identifier.0, - &single.type_.type_, - single.optional.is_some(), - false, - ), - Argument::Variadic(variadic) => (variadic.identifier.0, &variadic.type_, false, true), - }; - args.push(Arg { - name, - ty, - optional, - variadic, - }); - } + let args = arguments.into_iter().map(Into::into).collect::>(); for id in ids { let op = operations.entry(*id).or_default(); op.is_static = is_static; @@ -483,11 +515,8 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int log::warn!("Unsupported WebIDL iterable interface member: {:?}", self); Ok(()) } + InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx.0), // TODO - InterfaceMember::Maplike(_) => { - log::warn!("Unsupported WebIDL Maplike interface member: {:?}", self); - Ok(()) - } InterfaceMember::Stringifier(_) => { log::warn!( "Unsupported WebIDL Stringifier interface member: {:?}", @@ -579,6 +608,218 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::ConstructorInterfac } } +impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMember<'src> { + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + self_name: &'src str, + ) -> Result<()> { + let key_ty = &self.generics.body.0; + let value_ty = &self.generics.body.2; + let key_arg = || Arg { + name: "key", + ty: &key_ty.type_, + optional: false, + variadic: false, + }; + let value_arg = || Arg { + name: "value", + ty: &value_ty.type_, + optional: false, + variadic: false, + }; + let opt_value_ret = || ReturnType::Type(util::nullable(value_ty.type_.clone())); + let undefined_ret = || ReturnType::Undefined(term!(undefined)); + + // readonly attribute unsigned long size; + record + .interfaces + .get_mut(self_name) + .unwrap() + .attributes + .push(AttributeInterfaceData { + definition: &AttributeInterfaceMember { + attributes: None, + modifier: None, + readonly: Some(term!(readonly)), + attribute: term!(attribute), + type_: AttributedType { + attributes: None, + type_: Type::Single(SingleType::NonAny(NonAnyType::Integer(MayBeNull { + type_: IntegerType::Long(LongType { + unsigned: Some(term!(unsigned)), + long: term!(long), + }), + q_mark: None, + }))), + }, + identifier: Identifier("size"), + semi_colon: term!(;), + }, + stability: ApiStability::Stable, + }); + + // boolean has(K key); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("has"))], + [key_arg()], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Boolean( + MayBeNull { + type_: term!(boolean), + q_mark: None, + }, + )))), + &None, + false, + ); + + // V? get(K key); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("get"))], + [key_arg()], + &opt_value_ret(), + &None, + false, + ); + + // callback MapLikeForEachCallback = undefined (V value, K key); + // TODO: the signature of the callback is erased, could we keep it? + let foreach_callback_arg = Arg { + name: "callback", + ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { + type_: Identifier("MapLikeForEachCallback"), + q_mark: None, + }))), + optional: false, + variadic: false, + }; + + record.callbacks.insert("MapLikeForEachCallback"); + + // [Throws] undefined forEach(MapLikeForEachCallback cb); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("forEach"))], + [foreach_callback_arg], + &undefined_ret(), + &THROWS_ATTR, + false, + ); + + // TODO: iterators could have stronger types by generating specialised interfaces for each + // maplike/setlike. Right now, `value` is always `any`. + + // declare the iterator interface + record.iterators.insert("MapLikeIterator"); + + // [NewObject] MapLikeIterator entries(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("entries"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("MapLikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ); + + // [NewObject] MapLikeIterator keys(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("keys"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("MapLikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ); + + // [NewObject] MapLikeIterator values(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("values"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("MapLikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ); + + // add writeable interface if *not* readonly + if self.readonly.is_none() { + // undefined clear(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("clear"))], + &[], + &undefined_ret(), + &None, + false, + ); + + // boolean delete(K key); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("delete"))], + [key_arg()], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Boolean( + MayBeNull { + type_: term!(boolean), + q_mark: None, + }, + )))), + &None, + false, + ); + + // TODO: `set` actually returns `this` but we don't have a way to express that just yet + // undefined set(K key, V value); + first_pass_operation( + record, + FirstPassOperationType::Interface, + self_name, + &[OperationId::Operation(Some("set"))], + [key_arg(), value_arg()], + &undefined_ret(), + &None, + false, + ); + } + + Ok(()) + } +} + impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::AttributeInterfaceMember<'src> { diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 63abd35f799..54be320f0a3 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -29,6 +29,7 @@ pub(crate) enum IdlType<'a> { Symbol, Error, Callback, + Iterator, ArrayBuffer, DataView, @@ -331,6 +332,8 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { IdlType::Enum(self.0) } else if record.callbacks.contains(self.0) { IdlType::Callback + } else if record.iterators.contains(self.0) { + IdlType::Iterator } else if let Some(data) = record.callback_interfaces.get(self.0) { IdlType::CallbackInterface { name: self.0, @@ -433,6 +436,7 @@ impl<'a> IdlType<'a> { IdlType::Symbol => dst.push_str("symbol"), IdlType::Error => dst.push_str("error"), IdlType::Callback => dst.push_str("callback"), + IdlType::Iterator => dst.push_str("iterator"), IdlType::ArrayBuffer => dst.push_str("array_buffer"), IdlType::DataView => dst.push_str("data_view"), @@ -644,6 +648,7 @@ impl<'a> IdlType<'a> { IdlType::Any => Ok(js_value), IdlType::Undefined => Ok(None), IdlType::Callback => Ok(js_sys("Function")), + IdlType::Iterator => Ok(js_sys("Iterator")), IdlType::UnknownInterface(_) => Err(TypeError::CannotConvert), } } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 1c44146d5c3..1eca2ff9c8b 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -11,7 +11,7 @@ use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList, IdentifierOrString}; use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; -use weedle::types::{NonAnyType, SingleType}; +use weedle::types::{MayBeNull, NonAnyType, SingleType}; use crate::constants::IMMUTABLE_SLICE_WHITELIST; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; @@ -671,3 +671,46 @@ pub fn get_cfg_features(options: &Options, features: &BTreeSet) -> Optio } } } + +pub fn nullable(mut ty: weedle::types::Type) -> weedle::types::Type { + use weedle::types::Type; + + fn make_nullable(mb: &mut MayBeNull) { + mb.q_mark = Some(weedle::term::QMark); + } + + match &mut ty { + Type::Single(SingleType::Any(_) | SingleType::NonAny(NonAnyType::Promise(_))) => (), + Type::Single(SingleType::NonAny(NonAnyType::Integer(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::FloatingPoint(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Boolean(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Byte(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Octet(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::ByteString(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::DOMString(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::USVString(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Sequence(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Object(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Symbol(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Error(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::ArrayBuffer(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::DataView(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Int8Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Int16Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Int32Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Uint8Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Uint16Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Uint32Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Uint8ClampedArray(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Float32Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Float64Array(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::ArrayBufferView(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::BufferSource(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::FrozenArrayType(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::RecordType(mb))) => make_nullable(mb), + Type::Single(SingleType::NonAny(NonAnyType::Identifier(mb))) => make_nullable(mb), + Type::Union(mb) => make_nullable(mb), + } + + ty +} From bc4f1c3b245ec388015c354eba75009aaae68679 Mon Sep 17 00:00:00 2001 From: nasso <11479594+nasso@users.noreply.github.com> Date: Wed, 16 Nov 2022 18:47:00 -0800 Subject: [PATCH 107/641] Undeprecate Safari WebIDL (#3151) Four years ago, we manually deprecated `BaseAudioContext` and `AudioScheduledSourceNode` because Safari did not support them. The stable version of Safari at the time was 12.0 (September 2018). The current stable version of Safari is 16.1 (October 2022). Safari has introduced support for `AudioScheduledSourceNode` in version 14.0 (September 2020), and `BaseAudioContext` in version 14.1 (April 2021). --- .../features/gen_AudioScheduledSourceNode.rs | 7 ---- .../src/features/gen_BaseAudioContext.rs | 38 ------------------- .../enabled/AudioScheduledSourceNode.webidl | 1 - .../webidls/enabled/BaseAudioContext.webidl | 1 - 4 files changed, 47 deletions(-) diff --git a/crates/web-sys/src/features/gen_AudioScheduledSourceNode.rs b/crates/web-sys/src/features/gen_AudioScheduledSourceNode.rs index 5c18efeed31..3d7644e12e7 100644 --- a/crates/web-sys/src/features/gen_AudioScheduledSourceNode.rs +++ b/crates/web-sys/src/features/gen_AudioScheduledSourceNode.rs @@ -10,9 +10,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioScheduledSourceNode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] pub type AudioScheduledSourceNode; - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (structural , method , getter , js_class = "AudioScheduledSourceNode" , js_name = onended)] #[doc = "Getter for the `onended` field of this object."] #[doc = ""] @@ -20,7 +18,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] pub fn onended(this: &AudioScheduledSourceNode) -> Option<::js_sys::Function>; - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (structural , method , setter , js_class = "AudioScheduledSourceNode" , js_name = onended)] #[doc = "Setter for the `onended` field of this object."] #[doc = ""] @@ -28,7 +25,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] pub fn set_onended(this: &AudioScheduledSourceNode, value: Option<&::js_sys::Function>); - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (catch , method , structural , js_class = "AudioScheduledSourceNode" , js_name = start)] #[doc = "The `start()` method."] #[doc = ""] @@ -36,7 +32,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] pub fn start(this: &AudioScheduledSourceNode) -> Result<(), JsValue>; - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (catch , method , structural , js_class = "AudioScheduledSourceNode" , js_name = start)] #[doc = "The `start()` method."] #[doc = ""] @@ -44,7 +39,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] pub fn start_with_when(this: &AudioScheduledSourceNode, when: f64) -> Result<(), JsValue>; - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (catch , method , structural , js_class = "AudioScheduledSourceNode" , js_name = stop)] #[doc = "The `stop()` method."] #[doc = ""] @@ -52,7 +46,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioScheduledSourceNode`*"] pub fn stop(this: &AudioScheduledSourceNode) -> Result<(), JsValue>; - #[deprecated(note = "doesn't exist in Safari, use parent class methods instead")] # [wasm_bindgen (catch , method , structural , js_class = "AudioScheduledSourceNode" , js_name = stop)] #[doc = "The `stop()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BaseAudioContext.rs b/crates/web-sys/src/features/gen_BaseAudioContext.rs index 4fa90216942..9f18ee2410b 100644 --- a/crates/web-sys/src/features/gen_BaseAudioContext.rs +++ b/crates/web-sys/src/features/gen_BaseAudioContext.rs @@ -10,9 +10,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`*"] - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] pub type BaseAudioContext; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioDestinationNode")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = destination)] #[doc = "Getter for the `destination` field of this object."] @@ -21,7 +19,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioDestinationNode`, `BaseAudioContext`*"] pub fn destination(this: &BaseAudioContext) -> AudioDestinationNode; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = sampleRate)] #[doc = "Getter for the `sampleRate` field of this object."] #[doc = ""] @@ -29,7 +26,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`*"] pub fn sample_rate(this: &BaseAudioContext) -> f32; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = currentTime)] #[doc = "Getter for the `currentTime` field of this object."] #[doc = ""] @@ -37,7 +33,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`*"] pub fn current_time(this: &BaseAudioContext) -> f64; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioListener")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = listener)] #[doc = "Getter for the `listener` field of this object."] @@ -46,7 +41,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioListener`, `BaseAudioContext`*"] pub fn listener(this: &BaseAudioContext) -> AudioListener; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioContextState")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = state)] #[doc = "Getter for the `state` field of this object."] @@ -55,7 +49,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioContextState`, `BaseAudioContext`*"] pub fn state(this: &BaseAudioContext) -> AudioContextState; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioWorklet")] # [wasm_bindgen (structural , catch , method , getter , js_class = "BaseAudioContext" , js_name = audioWorklet)] #[doc = "Getter for the `audioWorklet` field of this object."] @@ -64,7 +57,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorklet`, `BaseAudioContext`*"] pub fn audio_worklet(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (structural , method , getter , js_class = "BaseAudioContext" , js_name = onstatechange)] #[doc = "Getter for the `onstatechange` field of this object."] #[doc = ""] @@ -72,7 +64,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`*"] pub fn onstatechange(this: &BaseAudioContext) -> Option<::js_sys::Function>; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (structural , method , setter , js_class = "BaseAudioContext" , js_name = onstatechange)] #[doc = "Setter for the `onstatechange` field of this object."] #[doc = ""] @@ -80,7 +71,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`*"] pub fn set_onstatechange(this: &BaseAudioContext, value: Option<&::js_sys::Function>); - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AnalyserNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createAnalyser)] #[doc = "The `createAnalyser()` method."] @@ -89,7 +79,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`, `BaseAudioContext`*"] pub fn create_analyser(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "BiquadFilterNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createBiquadFilter)] #[doc = "The `createBiquadFilter()` method."] @@ -98,7 +87,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `BiquadFilterNode`*"] pub fn create_biquad_filter(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioBuffer")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createBuffer)] #[doc = "The `createBuffer()` method."] @@ -112,7 +100,6 @@ extern "C" { length: u32, sample_rate: f32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "AudioBufferSourceNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createBufferSource)] #[doc = "The `createBufferSource()` method."] @@ -121,7 +108,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceNode`, `BaseAudioContext`*"] pub fn create_buffer_source(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ChannelMergerNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createChannelMerger)] #[doc = "The `createChannelMerger()` method."] @@ -130,7 +116,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `ChannelMergerNode`*"] pub fn create_channel_merger(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ChannelMergerNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createChannelMerger)] #[doc = "The `createChannelMerger()` method."] @@ -142,7 +127,6 @@ extern "C" { this: &BaseAudioContext, number_of_inputs: u32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ChannelSplitterNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createChannelSplitter)] #[doc = "The `createChannelSplitter()` method."] @@ -152,7 +136,6 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `ChannelSplitterNode`*"] pub fn create_channel_splitter(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ChannelSplitterNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createChannelSplitter)] #[doc = "The `createChannelSplitter()` method."] @@ -164,7 +147,6 @@ extern "C" { this: &BaseAudioContext, number_of_outputs: u32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ConstantSourceNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createConstantSource)] #[doc = "The `createConstantSource()` method."] @@ -173,7 +155,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `ConstantSourceNode`*"] pub fn create_constant_source(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ConvolverNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createConvolver)] #[doc = "The `createConvolver()` method."] @@ -182,7 +163,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `ConvolverNode`*"] pub fn create_convolver(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "DelayNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createDelay)] #[doc = "The `createDelay()` method."] @@ -191,7 +171,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `DelayNode`*"] pub fn create_delay(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "DelayNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createDelay)] #[doc = "The `createDelay()` method."] @@ -203,7 +182,6 @@ extern "C" { this: &BaseAudioContext, max_delay_time: f64, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "DynamicsCompressorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createDynamicsCompressor)] #[doc = "The `createDynamicsCompressor()` method."] @@ -214,7 +192,6 @@ extern "C" { pub fn create_dynamics_compressor( this: &BaseAudioContext, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "GainNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createGain)] #[doc = "The `createGain()` method."] @@ -223,7 +200,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `GainNode`*"] pub fn create_gain(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "IirFilterNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createIIRFilter)] #[doc = "The `createIIRFilter()` method."] @@ -236,7 +212,6 @@ extern "C" { feedforward: &::wasm_bindgen::JsValue, feedback: &::wasm_bindgen::JsValue, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "OscillatorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createOscillator)] #[doc = "The `createOscillator()` method."] @@ -245,7 +220,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `OscillatorNode`*"] pub fn create_oscillator(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "PannerNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPanner)] #[doc = "The `createPanner()` method."] @@ -254,7 +228,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PannerNode`*"] pub fn create_panner(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "PeriodicWave")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] #[doc = "The `createPeriodicWave()` method."] @@ -267,7 +240,6 @@ extern "C" { real: &mut [f32], imag: &mut [f32], ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] #[doc = "The `createPeriodicWave()` method."] @@ -281,7 +253,6 @@ extern "C" { imag: &mut [f32], constraints: &PeriodicWaveConstraints, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] @@ -291,7 +262,6 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `ScriptProcessorNode`*"] pub fn create_script_processor(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] @@ -303,7 +273,6 @@ extern "C" { this: &BaseAudioContext, buffer_size: u32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] @@ -316,7 +285,6 @@ extern "C" { buffer_size: u32, number_of_input_channels: u32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] @@ -330,7 +298,6 @@ extern "C" { number_of_input_channels: u32, number_of_output_channels: u32, ) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "StereoPannerNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createStereoPanner)] #[doc = "The `createStereoPanner()` method."] @@ -339,7 +306,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `StereoPannerNode`*"] pub fn create_stereo_panner(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] #[cfg(feature = "WaveShaperNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createWaveShaper)] #[doc = "The `createWaveShaper()` method."] @@ -348,7 +314,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `WaveShaperNode`*"] pub fn create_wave_shaper(this: &BaseAudioContext) -> Result; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = decodeAudioData)] #[doc = "The `decodeAudioData()` method."] #[doc = ""] @@ -359,7 +324,6 @@ extern "C" { this: &BaseAudioContext, audio_data: &::js_sys::ArrayBuffer, ) -> Result<::js_sys::Promise, JsValue>; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = decodeAudioData)] #[doc = "The `decodeAudioData()` method."] #[doc = ""] @@ -371,7 +335,6 @@ extern "C" { audio_data: &::js_sys::ArrayBuffer, success_callback: &::js_sys::Function, ) -> Result<::js_sys::Promise, JsValue>; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = decodeAudioData)] #[doc = "The `decodeAudioData()` method."] #[doc = ""] @@ -384,7 +347,6 @@ extern "C" { success_callback: &::js_sys::Function, error_callback: &::js_sys::Function, ) -> Result<::js_sys::Promise, JsValue>; - #[deprecated(note = "doesn't exist in Safari, use `AudioContext` instead now")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = resume)] #[doc = "The `resume()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/AudioScheduledSourceNode.webidl b/crates/web-sys/webidls/enabled/AudioScheduledSourceNode.webidl index e8b4717e266..12876dcd981 100644 --- a/crates/web-sys/webidls/enabled/AudioScheduledSourceNode.webidl +++ b/crates/web-sys/webidls/enabled/AudioScheduledSourceNode.webidl @@ -10,7 +10,6 @@ * liability, trademark and document use rules apply. */ -[RustDeprecated="doesn't exist in Safari, use parent class methods instead"] interface AudioScheduledSourceNode : AudioNode { }; diff --git a/crates/web-sys/webidls/enabled/BaseAudioContext.webidl b/crates/web-sys/webidls/enabled/BaseAudioContext.webidl index 863fcc60953..7f12a5af16e 100644 --- a/crates/web-sys/webidls/enabled/BaseAudioContext.webidl +++ b/crates/web-sys/webidls/enabled/BaseAudioContext.webidl @@ -19,7 +19,6 @@ enum AudioContextState { "closed" }; -[RustDeprecated="doesn't exist in Safari, use `AudioContext` instead now"] interface BaseAudioContext : EventTarget { }; From 721c86c3467750bf2a46bf85941e6c211ae9e87a Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 18 Nov 2022 02:28:15 +1100 Subject: [PATCH 108/641] Get rid of the circular dependency when targeting ES modules (#3152) * Get rid of the circular dependency when targeting ES modules Fixes #3102 Fixes #3149 I've changed the `*_bg.js` file to not import from the wasm module, eliminating the circular dependency between them. It begins with an undefined `let wasm` which gets initialized by the user-facing JS file before calling `__wbindgen_start`, by calling an exported function `__wbg_set_wasm` that sets `wasm`. * fmt * Tweak formatting & update reference tests --- crates/cli-support/src/js/mod.rs | 36 +++++++++++-------- crates/cli-support/src/lib.rs | 7 ++-- crates/cli/tests/reference/add.js | 5 ++- crates/cli/tests/reference/anyref-empty.js | 6 +++- .../tests/reference/anyref-import-catch.js | 6 +++- crates/cli/tests/reference/anyref-nop.js | 5 ++- crates/cli/tests/reference/empty.js | 5 ++- crates/cli/tests/reference/import-catch.js | 6 +++- crates/cli/tests/reference/nop.js | 5 ++- crates/cli/tests/reference/result-string.js | 6 +++- crates/cli/tests/reference/string-arg.js | 6 +++- 11 files changed, 68 insertions(+), 25 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 526062a3e10..9ee154cca1e 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -437,10 +437,6 @@ impl<'a> Context<'a> { | OutputMode::Node { experimental_modules: true, } => { - imports.push_str(&format!( - "import * as wasm from './{}_bg.wasm';\n", - module_name - )); for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { let import = self.module.imports.get_mut(*id); import.module = format!("./{}_bg.js", module_name); @@ -459,6 +455,15 @@ impl<'a> Context<'a> { } } + self.imports_post.push_str( + "\ + let wasm; + export function __wbg_set_wasm(val) { + wasm = val; + } + ", + ); + if needs_manual_start { start = Some("\nwasm.__wbindgen_start();\n".to_string()); } @@ -495,20 +500,23 @@ impl<'a> Context<'a> { !self.config.mode.uses_es_modules() || js.is_empty(), "ES modules require imports to be at the start of the file" ); - js.push_str(&imports); - js.push_str("\n"); - js.push_str(&self.imports_post); - js.push_str("\n"); + + let mut push_with_newline = |s| { + js.push_str(s); + if !s.is_empty() { + js.push('\n'); + } + }; + + push_with_newline(&imports); + push_with_newline(&self.imports_post); // Emit all our exports from this module - js.push_str(&self.globals); - js.push_str("\n"); + push_with_newline(&self.globals); // Generate the initialization glue, if there was any - js.push_str(&init_js); - js.push_str("\n"); - js.push_str(&footer); - js.push_str("\n"); + push_with_newline(&init_js); + push_with_newline(&footer); if self.config.mode.no_modules() { js.push_str("})();\n"); } diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index fa67474436e..feba5193562 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -755,8 +755,11 @@ impl Output { write( &js_path, format!( - "import * as wasm from \"./{}.wasm\";\nexport * from \"./{}\";{}", - wasm_name, js_name, start + "import * as wasm from \"./{wasm_name}.wasm\"; +import {{ __wbg_set_wasm }} from \"./{js_name}\"; +__wbg_set_wasm(wasm); +export * from \"./{js_name}\"; +{start}" ), )?; diff --git a/crates/cli/tests/reference/add.js b/crates/cli/tests/reference/add.js index 23c05cafe9f..4828d396ae5 100644 --- a/crates/cli/tests/reference/add.js +++ b/crates/cli/tests/reference/add.js @@ -1,4 +1,7 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} /** * @param {number} a diff --git a/crates/cli/tests/reference/anyref-empty.js b/crates/cli/tests/reference/anyref-empty.js index 74cbbafc276..a25c33a1af9 100644 --- a/crates/cli/tests/reference/anyref-empty.js +++ b/crates/cli/tests/reference/anyref-empty.js @@ -1,4 +1,8 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + export function __wbindgen_init_externref_table() { const table = wasm.__wbindgen_export_0; diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index cd594d8c3be..e21de878906 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -1,4 +1,8 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; diff --git a/crates/cli/tests/reference/anyref-nop.js b/crates/cli/tests/reference/anyref-nop.js index 116b85fcbfd..236d93eaf93 100644 --- a/crates/cli/tests/reference/anyref-nop.js +++ b/crates/cli/tests/reference/anyref-nop.js @@ -1,4 +1,7 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} /** */ diff --git a/crates/cli/tests/reference/empty.js b/crates/cli/tests/reference/empty.js index 275ace8aee5..95b0793b585 100644 --- a/crates/cli/tests/reference/empty.js +++ b/crates/cli/tests/reference/empty.js @@ -1,2 +1,5 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index 5fc12d3c570..49a77f42eae 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -1,4 +1,8 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + const heap = new Array(32).fill(undefined); diff --git a/crates/cli/tests/reference/nop.js b/crates/cli/tests/reference/nop.js index edac6e410e5..86488ff66d1 100644 --- a/crates/cli/tests/reference/nop.js +++ b/crates/cli/tests/reference/nop.js @@ -1,4 +1,7 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} /** */ diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index a9d60cc3cb0..455b7eb1cdf 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -1,4 +1,8 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + const heap = new Array(32).fill(undefined); diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index deba025f926..279d278c838 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -1,4 +1,8 @@ -import * as wasm from './reference_test_bg.wasm'; +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; From db3da1ed71f11f1dc9e67b3fa7800f40cded57e0 Mon Sep 17 00:00:00 2001 From: Rodrigo Oliveira Date: Thu, 17 Nov 2022 19:27:23 -0300 Subject: [PATCH 109/641] Add WebXrHandInput Module (#3150) --- crates/web-sys/Cargo.toml | 2 + crates/web-sys/src/features/gen_XrFrame.rs | 48 +++++++++++++ crates/web-sys/src/features/gen_XrHand.rs | 41 +++++++++++ .../web-sys/src/features/gen_XrHandJoint.rs | 38 ++++++++++ .../web-sys/src/features/gen_XrInputSource.rs | 12 ++++ .../web-sys/src/features/gen_XrJointPose.rs | 29 ++++++++ .../web-sys/src/features/gen_XrJointSpace.rs | 30 ++++++++ crates/web-sys/src/features/mod.rs | 24 +++++++ .../unstable/WebXRHandInputModule.webidl | 69 +++++++++++++++++++ 9 files changed, 293 insertions(+) create mode 100644 crates/web-sys/src/features/gen_XrHand.rs create mode 100644 crates/web-sys/src/features/gen_XrHandJoint.rs create mode 100644 crates/web-sys/src/features/gen_XrJointPose.rs create mode 100644 crates/web-sys/src/features/gen_XrJointSpace.rs create mode 100644 crates/web-sys/webidls/unstable/WebXRHandInputModule.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index ed23ad9b09d..349050d86a0 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1505,6 +1505,8 @@ XrBoundedReferenceSpace = ["EventTarget", "XrReferenceSpace", "XrSpace"] XrEye = [] XrFrame = [] XrHandedness = [] +XrHand = ["XrHandJoint"] +XrHandJoint = [] XrInputSource = [] XrInputSourceArray = [] XrInputSourceEvent = ["Event"] diff --git a/crates/web-sys/src/features/gen_XrFrame.rs b/crates/web-sys/src/features/gen_XrFrame.rs index bdab432e924..2152022716a 100644 --- a/crates/web-sys/src/features/gen_XrFrame.rs +++ b/crates/web-sys/src/features/gen_XrFrame.rs @@ -39,6 +39,54 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn predicted_display_time(this: &XrFrame) -> f64; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] + #[doc = "The `fillJointRadii()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillJointRadii)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_joint_radii( + this: &XrFrame, + joint_spaces: &::wasm_bindgen::JsValue, + radii: &mut [f32], + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSpace")] + # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillPoses)] + #[doc = "The `fillPoses()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillPoses)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_poses( + this: &XrFrame, + spaces: &::wasm_bindgen::JsValue, + base_space: &XrSpace, + transforms: &mut [f32], + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "XrJointPose", feature = "XrJointSpace", feature = "XrSpace",))] + # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = getJointPose)] + #[doc = "The `getJointPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getJointPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrJointPose`, `XrJointSpace`, `XrSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_joint_pose( + this: &XrFrame, + joint: &XrJointSpace, + base_space: &XrSpace, + ) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "XrPose", feature = "XrSpace",))] # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = getPose)] #[doc = "The `getPose()` method."] diff --git a/crates/web-sys/src/features/gen_XrHand.rs b/crates/web-sys/src/features/gen_XrHand.rs new file mode 100644 index 00000000000..c0484be8f75 --- /dev/null +++ b/crates/web-sys/src/features/gen_XrHand.rs @@ -0,0 +1,41 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRHand , typescript_type = "XRHand")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrHand` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrHand; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRHand" , 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/XRHand/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(this: &XrHand) -> u32; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "XrHandJoint", feature = "XrJointSpace",))] + # [wasm_bindgen (method , structural , js_class = "XRHand" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`, `XrHandJoint`, `XrJointSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get(this: &XrHand, key: XrHandJoint) -> XrJointSpace; +} diff --git a/crates/web-sys/src/features/gen_XrHandJoint.rs b/crates/web-sys/src/features/gen_XrHandJoint.rs new file mode 100644 index 00000000000..85dd9456395 --- /dev/null +++ b/crates/web-sys/src/features/gen_XrHandJoint.rs @@ -0,0 +1,38 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `XrHandJoint` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `XrHandJoint`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum XrHandJoint { + Wrist = "wrist", + ThumbMetacarpal = "thumb-metacarpal", + ThumbPhalanxProximal = "thumb-phalanx-proximal", + ThumbPhalanxDistal = "thumb-phalanx-distal", + ThumbTip = "thumb-tip", + IndexFingerMetacarpal = "index-finger-metacarpal", + IndexFingerPhalanxProximal = "index-finger-phalanx-proximal", + IndexFingerPhalanxIntermediate = "index-finger-phalanx-intermediate", + IndexFingerPhalanxDistal = "index-finger-phalanx-distal", + IndexFingerTip = "index-finger-tip", + MiddleFingerMetacarpal = "middle-finger-metacarpal", + MiddleFingerPhalanxProximal = "middle-finger-phalanx-proximal", + MiddleFingerPhalanxIntermediate = "middle-finger-phalanx-intermediate", + MiddleFingerPhalanxDistal = "middle-finger-phalanx-distal", + MiddleFingerTip = "middle-finger-tip", + RingFingerMetacarpal = "ring-finger-metacarpal", + RingFingerPhalanxProximal = "ring-finger-phalanx-proximal", + RingFingerPhalanxIntermediate = "ring-finger-phalanx-intermediate", + RingFingerPhalanxDistal = "ring-finger-phalanx-distal", + RingFingerTip = "ring-finger-tip", + PinkyFingerMetacarpal = "pinky-finger-metacarpal", + PinkyFingerPhalanxProximal = "pinky-finger-phalanx-proximal", + PinkyFingerPhalanxIntermediate = "pinky-finger-phalanx-intermediate", + PinkyFingerPhalanxDistal = "pinky-finger-phalanx-distal", + PinkyFingerTip = "pinky-finger-tip", +} diff --git a/crates/web-sys/src/features/gen_XrInputSource.rs b/crates/web-sys/src/features/gen_XrInputSource.rs index f20c5e4d621..e02f1e92791 100644 --- a/crates/web-sys/src/features/gen_XrInputSource.rs +++ b/crates/web-sys/src/features/gen_XrInputSource.rs @@ -86,4 +86,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn gamepad(this: &XrInputSource) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrHand")] + # [wasm_bindgen (structural , method , getter , js_class = "XRInputSource" , js_name = hand)] + #[doc = "Getter for the `hand` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/hand)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`, `XrInputSource`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn hand(this: &XrInputSource) -> Option; } diff --git a/crates/web-sys/src/features/gen_XrJointPose.rs b/crates/web-sys/src/features/gen_XrJointPose.rs new file mode 100644 index 00000000000..0145afb5761 --- /dev/null +++ b/crates/web-sys/src/features/gen_XrJointPose.rs @@ -0,0 +1,29 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = XrPose , extends = :: js_sys :: Object , js_name = XRJointPose , typescript_type = "XRJointPose")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrJointPose` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRJointPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrJointPose`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrJointPose; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "XRJointPose" , js_name = radius)] + #[doc = "Getter for the `radius` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRJointPose/radius)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrJointPose`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn radius(this: &XrJointPose) -> f32; +} diff --git a/crates/web-sys/src/features/gen_XrJointSpace.rs b/crates/web-sys/src/features/gen_XrJointSpace.rs new file mode 100644 index 00000000000..68801e9c442 --- /dev/null +++ b/crates/web-sys/src/features/gen_XrJointSpace.rs @@ -0,0 +1,30 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = XrSpace , extends = EventTarget , extends = :: js_sys :: Object , js_name = XRJointSpace , typescript_type = "XRJointSpace")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `XrJointSpace` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRJointSpace)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrJointSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type XrJointSpace; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrHandJoint")] + # [wasm_bindgen (structural , method , getter , js_class = "XRJointSpace" , js_name = jointName)] + #[doc = "Getter for the `jointName` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRJointSpace/jointName)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHandJoint`, `XrJointSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn joint_name(this: &XrJointSpace) -> XrHandJoint; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 8d09ffc7a68..968525fa680 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8842,6 +8842,18 @@ mod gen_XrFrame; #[cfg(feature = "XrFrame")] pub use gen_XrFrame::*; +#[cfg(feature = "XrHand")] +#[allow(non_snake_case)] +mod gen_XrHand; +#[cfg(feature = "XrHand")] +pub use gen_XrHand::*; + +#[cfg(feature = "XrHandJoint")] +#[allow(non_snake_case)] +mod gen_XrHandJoint; +#[cfg(feature = "XrHandJoint")] +pub use gen_XrHandJoint::*; + #[cfg(feature = "XrHandedness")] #[allow(non_snake_case)] mod gen_XrHandedness; @@ -8884,6 +8896,18 @@ mod gen_XrInputSourcesChangeEventInit; #[cfg(feature = "XrInputSourcesChangeEventInit")] pub use gen_XrInputSourcesChangeEventInit::*; +#[cfg(feature = "XrJointPose")] +#[allow(non_snake_case)] +mod gen_XrJointPose; +#[cfg(feature = "XrJointPose")] +pub use gen_XrJointPose::*; + +#[cfg(feature = "XrJointSpace")] +#[allow(non_snake_case)] +mod gen_XrJointSpace; +#[cfg(feature = "XrJointSpace")] +pub use gen_XrJointSpace::*; + #[cfg(feature = "XrLayer")] #[allow(non_snake_case)] mod gen_XrLayer; diff --git a/crates/web-sys/webidls/unstable/WebXRHandInputModule.webidl b/crates/web-sys/webidls/unstable/WebXRHandInputModule.webidl new file mode 100644 index 00000000000..b88323eda48 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebXRHandInputModule.webidl @@ -0,0 +1,69 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * WebXR Device API + * W3C Working Draft, 19 April 2022 + * The origin of this IDL file is: + * https://www.w3.org/TR/2022/WD-webxr-hand-input-1-20220419/ + */ + +partial interface XRInputSource { + [SameObject] readonly attribute XRHand? hand; +}; + +enum XRHandJoint { + "wrist", + + "thumb-metacarpal", + "thumb-phalanx-proximal", + "thumb-phalanx-distal", + "thumb-tip", + + "index-finger-metacarpal", + "index-finger-phalanx-proximal", + "index-finger-phalanx-intermediate", + "index-finger-phalanx-distal", + "index-finger-tip", + + "middle-finger-metacarpal", + "middle-finger-phalanx-proximal", + "middle-finger-phalanx-intermediate", + "middle-finger-phalanx-distal", + "middle-finger-tip", + + "ring-finger-metacarpal", + "ring-finger-phalanx-proximal", + "ring-finger-phalanx-intermediate", + "ring-finger-phalanx-distal", + "ring-finger-tip", + + "pinky-finger-metacarpal", + "pinky-finger-phalanx-proximal", + "pinky-finger-phalanx-intermediate", + "pinky-finger-phalanx-distal", + "pinky-finger-tip" +}; + +[Exposed=Window] +interface XRHand { + iterable; + + readonly attribute unsigned long size; + XRJointSpace get(XRHandJoint key); +}; + +[Exposed=Window] +interface XRJointSpace: XRSpace { + readonly attribute XRHandJoint jointName; +}; + +partial interface XRFrame { + XRJointPose? getJointPose(XRJointSpace joint, XRSpace baseSpace); + boolean fillJointRadii(sequence jointSpaces, Float32Array radii); + + boolean fillPoses(sequence spaces, XRSpace baseSpace, Float32Array transforms); +}; + +[Exposed=Window] +interface XRJointPose: XRPose { + readonly attribute float radius; +}; From 5597988ef44b1421f73db2035842099cf9347e0c Mon Sep 17 00:00:00 2001 From: Thomas Marches <56929277+ThomasMarches@users.noreply.github.com> Date: Sun, 20 Nov 2022 21:46:31 -0800 Subject: [PATCH 110/641] Allow returning `Result<*mut T, _>` and `Result<*const T, _>` from async functions (#3059) --- crates/macro/ui-tests/async-errors.stderr | 4 ++-- src/lib.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index 492492a181e..f4ebb47842f 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -40,8 +40,8 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not sati > > > - > - and 73 others + > + and 75 others = note: required because of the requirements on the impl of `Into` for `BadType` = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` note: required by `into_js_result` diff --git a/src/lib.rs b/src/lib.rs index 2d6ace32639..19a7fe74e6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -785,6 +785,20 @@ impl<'a> From<&'a str> for JsValue { } } +impl From<*mut T> for JsValue { + #[inline] + fn from(s: *mut T) -> JsValue { + JsValue::from(s as usize) + } +} + +impl From<*const T> for JsValue { + #[inline] + fn from(s: *const T) -> JsValue { + JsValue::from(s as usize) + } +} + if_std! { impl<'a> From<&'a String> for JsValue { #[inline] From 4d07b9278dec35adbe81276347a77ef255dc2a0f Mon Sep 17 00:00:00 2001 From: ivanschuetz Date: Mon, 21 Nov 2022 18:08:33 +0100 Subject: [PATCH 111/641] Show conversion to JsValue (#3158) --- .../reference/attributes/on-rust-exports/typescript_type.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guide/src/reference/attributes/on-rust-exports/typescript_type.md b/guide/src/reference/attributes/on-rust-exports/typescript_type.md index 081c5d83c39..a435c95fa24 100644 --- a/guide/src/reference/attributes/on-rust-exports/typescript_type.md +++ b/guide/src/reference/attributes/on-rust-exports/typescript_type.md @@ -29,7 +29,8 @@ pub struct TextStyle { #[wasm_bindgen] impl TextStyle { #[wasm_bindgen(constructor)] - pub fn new(_i: ITextStyle) -> TextStyle { + pub fn new(i: ITextStyle) -> TextStyle { + let _js_value: JsValue = i.into(); // parse JsValue TextStyle::default() } From 7c626e4b3a7ea40da9c2fcb4475bda5f4eb2dd73 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Thu, 24 Nov 2022 16:03:51 -0600 Subject: [PATCH 112/641] Don't emit BigInt literals (#3164) --- crates/cli-support/src/js/binding.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index fc642beef3a..f2a0a721d9d 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -795,8 +795,12 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> } js.push(format!("!isLikeNone({0})", val)); js.push(format!( - "isLikeNone({val}) ? 0{n} : {val}", - n = if *ty == ValType::I64 { "n" } else { "" } + "isLikeNone({val}) ? {zero} : {val}", + zero = if *ty == ValType::I64 { + "BigInt(0)" + } else { + "0" + } )); } From f0b154e1927a3524d57d5b3ccf3ca647b719462b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Volf?= Date: Sat, 26 Nov 2022 02:08:05 +0100 Subject: [PATCH 113/641] Increase interpreter buffer memory size (#3162) * Increase interpreter buffer memory size * Fix test --- crates/wasm-interpreter/src/lib.rs | 2 +- crates/wasm-interpreter/tests/smoke.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 1b875492d77..699ea97c699 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -72,7 +72,7 @@ impl Interpreter { // (the LLVM call stack, now the wasm stack). To handle that let's give // our selves a little bit of memory and set the stack pointer (global // 0) to the top. - ret.mem = vec![0; 0x100]; + ret.mem = vec![0; 0x400]; ret.sp = ret.mem.len() as i32; // Figure out where the `__wbindgen_describe` imported function is, if diff --git a/crates/wasm-interpreter/tests/smoke.rs b/crates/wasm-interpreter/tests/smoke.rs index 33b2575e420..c485d7b9199 100644 --- a/crates/wasm-interpreter/tests/smoke.rs +++ b/crates/wasm-interpreter/tests/smoke.rs @@ -87,7 +87,8 @@ fn globals() { (export "foo" (func $foo)) ) "#; - interpret(wat, "foo", Some(&[256])); + // __wbindgen_describe is called with a global - in Frame.eval we assume all access to globals is the stack pointer + interpret(wat, "foo", Some(&[1024])); } #[test] From 6ed6883ae19d3e10d5e6715731ec886dd8830470 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 28 Nov 2022 00:35:58 +0100 Subject: [PATCH 114/641] Fix automatic .wasm file detection with no-modules (#3169) --- crates/cli-support/src/js/mod.rs | 17 ++++++++++------- crates/cli/tests/wasm-bindgen/main.rs | 16 +++++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 9ee154cca1e..c697a52ba05 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -378,6 +378,15 @@ impl<'a> Context<'a> { // function. OutputMode::NoModules { global } => { js.push_str("const __exports = {};\n"); + js.push_str("let script_src;\n"); + js.push_str( + "\ + if (typeof document === 'undefined') { + script_src = location.href; + } else { + script_src = document.currentScript.src; + }\n", + ); js.push_str("let wasm;\n"); init = self.gen_init(needs_manual_start, None)?; footer.push_str(&format!( @@ -712,13 +721,7 @@ impl<'a> Context<'a> { ), OutputMode::NoModules { .. } => "\ if (typeof input === 'undefined') { - let src; - if (typeof document === 'undefined') { - src = location.href; - } else { - src = document.currentScript.src; - } - input = src.replace(/\\.js$/, '_bg.wasm'); + input = script_src.replace(/\\.js$/, '_bg.wasm'); }" .to_string(), _ => "".to_string(), diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index b52f14e64c3..1fb94f7c97b 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -258,17 +258,19 @@ fn default_module_path_target_no_modules() { cmd.assert().success(); let contents = fs::read_to_string(out_dir.join("default_module_path_target_no_modules.js")).unwrap(); + assert!(contents.contains( + "\ + if (typeof document === 'undefined') { + script_src = location.href; + } else { + script_src = document.currentScript.src; + }", + )); assert!(contents.contains( "\ async function init(input) { if (typeof input === 'undefined') { - let src; - if (typeof document === 'undefined') { - src = location.href; - } else { - src = document.currentScript.src; - } - input = src.replace(/\\.js$/, '_bg.wasm'); + input = script_src.replace(/\\.js$/, '_bg.wasm'); }", )); } From a8695bb66c4d92cde4a1746a474084c58801a989 Mon Sep 17 00:00:00 2001 From: Rodrigo Oliveira Date: Tue, 6 Dec 2022 12:20:36 -0300 Subject: [PATCH 115/641] Add XrJointPose and XrJointSpace features (#3179) --- crates/web-sys/Cargo.toml | 2 ++ examples/webxr/Cargo.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 349050d86a0..76850432ee8 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1513,6 +1513,8 @@ XrInputSourceEvent = ["Event"] XrInputSourceEventInit = [] XrInputSourcesChangeEvent = ["Event"] XrInputSourcesChangeEventInit = [] +XrJointPose = [] +XrJointSpace = [] XrLayer = ["EventTarget"] XrPermissionDescriptor = [] XrPermissionStatus = ["EventTarget", "PermissionStatus"] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 6955841341b..8351328d6e7 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -37,6 +37,8 @@ features = [ 'XrInputSourceEvent', 'XrInputSourceEventInit', 'XrInputSourcesChangeEvent', + 'XrJointPose', + 'XrJointSpace', 'XrPose', 'XrReferenceSpace', 'XrReferenceSpaceEvent', From 9a2f615d2a7610b37082f7af2adb78ce1dc621d5 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 8 Dec 2022 03:02:18 +1100 Subject: [PATCH 116/641] Apply `#[allow(dead_code)]` to `#[wasm_bindgen]`'d functions (#3180) * Apply `#[allow(dead_code)]` to `#[wasm_bindgen]`'d functions Fixes #2726 `#[wasm_bindgen]`'d functions are always used, since they're exported to JS. However, that doesn't happen when not building for the wasm target, and so a dead code warning is shown if the function isn't used for anything else. This fixes that by adding `#[allow(dead_code)]` to `#[wasm_bindgen]`'d functions to supress the warning. * fix syntax error on rust 1.56 I'm not sure what exactly was invalid about it, but `quote! { ... }.to_tokens(...)` was causing syntax errors on Rust 1.56 in CI for some reason, so I changed it to `tokens.extend(...)`, which is used elsewhere in the file and so should work. --- crates/macro-support/src/parser.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index d05f139f62e..92f8187fc02 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -928,6 +928,10 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { _ => {} } let comments = extract_doc_comments(&f.attrs); + // If the function isn't used for anything other than being exported to JS, + // it'll be unused when not building for the wasm target and produce a + // `dead_code` warning. So, add `#[allow(dead_code)]` before it to avoid that. + tokens.extend(quote::quote! { #[allow(dead_code)] }); f.to_tokens(tokens); let opts = opts.unwrap_or_default(); if opts.start().is_some() { From e466b31e732ccaf1171128ae51383b921bbd2a46 Mon Sep 17 00:00:00 2001 From: Yaroslav Shmelev Date: Thu, 8 Dec 2022 10:24:50 +0300 Subject: [PATCH 117/641] [js-sys bindings] Intl.RelativeTimeFormat binding implementation (#3182) * Binding for Intl.RelativeTimeFormat * missing static method, fixing comments wip * fix doc comments * add test and fix api Intl.RelativeTimeFormat bindings * cargo fmt * Fix doc comment for format * Update UI test expectations Co-authored-by: Liam Murphy --- crates/js-sys/src/lib.rs | 58 +++++++++++ crates/js-sys/tests/wasm/Intl.rs | 20 ++++ crates/macro/ui-tests/async-errors.stderr | 114 +++++++++++----------- 3 files changed, 135 insertions(+), 57 deletions(-) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index c7d3899d35d..9366896f983 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -5528,6 +5528,64 @@ pub mod Intl { ) } } + + // Intl.RelativeTimeFormat + #[wasm_bindgen] + extern "C" { + /// The `Intl.RelativeTimeFormat` object is a constructor for objects + /// that enable language-sensitive relative time formatting. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat) + #[wasm_bindgen(extends = Object, js_namespace = Intl, typescript_type = "Intl.RelativeTimeFormat")] + #[derive(Clone, Debug)] + pub type RelativeTimeFormat; + + /// The `Intl.RelativeTimeFormat` object is a constructor for objects + /// that enable language-sensitive relative time formatting. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat) + #[wasm_bindgen(constructor, js_namespace = Intl)] + pub fn new(locales: &Array, options: &Object) -> RelativeTimeFormat; + + /// The `Intl.RelativeTimeFormat.prototype.format` method formats a `value` and `unit` + /// according to the locale and formatting options of this Intl.RelativeTimeFormat object. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format) + #[wasm_bindgen(method, js_class = "Intl.RelativeTimeFormat")] + pub fn format(this: &RelativeTimeFormat, value: f64, unit: &str) -> JsString; + + /// The `Intl.RelativeTimeFormat.prototype.formatToParts()` method returns an array of + /// objects representing the relative time format in parts that can be used for custom locale-aware formatting. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts) + #[wasm_bindgen(method, js_class = "Intl.RelativeTimeFormat", js_name = formatToParts)] + pub fn format_to_parts(this: &RelativeTimeFormat, value: f64, unit: &str) -> Array; + + /// The `Intl.RelativeTimeFormat.prototype.resolvedOptions()` method returns a new + /// object with properties reflecting the locale and relative time formatting + /// options computed during initialization of this RelativeTimeFormat object. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions) + #[wasm_bindgen(method, js_namespace = Intl, js_name = resolvedOptions)] + pub fn resolved_options(this: &RelativeTimeFormat) -> Object; + + /// The `Intl.RelativeTimeFormat.supportedLocalesOf()` method returns an array + /// containing those of the provided locales that are supported in date and time + /// formatting without having to fall back to the runtime's default locale. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat/supportedLocalesOf) + #[wasm_bindgen(static_method_of = RelativeTimeFormat, js_namespace = Intl, js_name = supportedLocalesOf)] + pub fn supported_locales_of(locales: &Array, options: &Object) -> Array; + } + + impl Default for RelativeTimeFormat { + fn default() -> Self { + Self::new( + &JsValue::UNDEFINED.unchecked_into(), + &JsValue::UNDEFINED.unchecked_into(), + ) + } + } } // Promise diff --git a/crates/js-sys/tests/wasm/Intl.rs b/crates/js-sys/tests/wasm/Intl.rs index 427ea00a5da..a58d12abe27 100644 --- a/crates/js-sys/tests/wasm/Intl.rs +++ b/crates/js-sys/tests/wasm/Intl.rs @@ -112,6 +112,26 @@ fn plural_rules() { assert!(a.is_instance_of::()); } +#[wasm_bindgen_test] +fn relative_time_format() { + let locales = Array::of1(&JsValue::from("en-US")); + let opts = Object::new(); + + let c = Intl::RelativeTimeFormat::new(&locales, &opts); + assert!(c.format(1_f64.into(), &"seconds").is_string()); + assert!(c + .format_to_parts(1_f64.into(), &"seconds") + .is_instance_of::()); + assert!(c.resolved_options().is_instance_of::()); + + assert_eq!(c.format(1_f64.into(), &"seconds"), "in 1 second"); + assert_eq!(c.format(1.5.into(), &"seconds"), "in 1.5 seconds"); + assert_eq!(c.format((-1.5).into(), &"seconds"), "1.5 seconds ago"); + + let a = Intl::RelativeTimeFormat::supported_locales_of(&locales, &opts); + assert!(a.is_instance_of::()); +} + #[wasm_bindgen_test] fn plural_rules_inheritance() { let locales = Array::of1(&JsValue::from("en-US")); diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index f4ebb47842f..c1fec077d0e 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -1,68 +1,68 @@ error[E0277]: the trait bound `Result<(), ()>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:30:1 - | -30 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` - | - = help: the following implementations were found: - as IntoJsResult> - as IntoJsResult> + --> ui-tests/async-errors.rs:30:1 + | +30 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` + | + = help: the following implementations were found: + as IntoJsResult> + as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:32:1 - | -32 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` - | - = help: the following implementations were found: - as IntoJsResult> - as IntoJsResult> + --> ui-tests/async-errors.rs:32:1 + | +32 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` + | + = help: the following implementations were found: + as IntoJsResult> + as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not satisfied - --> ui-tests/async-errors.rs:34:1 - | -34 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue` - | - = help: the following implementations were found: - > - > - > - > - and 75 others - = note: required because of the requirements on the impl of `Into` for `BadType` - = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` + --> ui-tests/async-errors.rs:34:1 + | +34 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue` + | + = help: the following implementations were found: + > + > + > + > + and $N others + = note: required because of the requirements on the impl of `Into` for `BadType` + = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:36:1 - | -36 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result` - | - = help: the following implementations were found: - as IntoJsResult> - as IntoJsResult> + --> ui-tests/async-errors.rs:36:1 + | +36 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result` + | + = help: the following implementations were found: + as IntoJsResult> + as IntoJsResult> note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/lib.rs + | + | fn into_js_result(self) -> Result; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) From a23ae4d963b9feb79f9bc8a3e0d1c70f37086b6e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 8 Dec 2022 20:23:37 +0100 Subject: [PATCH 118/641] Use standard mode in tests (#3185) --- crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html | 1 + crates/cli/src/bin/wasm-bindgen-test-runner/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html index a65c242fd58..e8a9295f799 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html @@ -1,3 +1,4 @@ + diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html index 1fc86aafb95..c5a4b329738 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html @@ -1,3 +1,4 @@ + From b57eb8d8dbae8cf91e0704dace5bf0cfb8fe1794 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 9 Dec 2022 00:55:50 +0200 Subject: [PATCH 119/641] build: harden main.yml permissions (#3187) Signed-off-by: Alex Signed-off-by: Alex --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f047be3ba8e..4fff2677b47 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: read # to fetch code (actions/checkout) + jobs: # Check Code style quickly by running `rustfmt` over all code rustfmt: @@ -402,6 +405,9 @@ jobs: deploy: + permissions: + contents: write # to push changes in repo (jamesives/github-pages-deploy-action) + needs: - doc_api - doc_book From 1837233851aa96b371997e370c61cd9b5d996297 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 9 Dec 2022 11:51:51 +1100 Subject: [PATCH 120/641] Improve error messages for invalidly invoked closures (#3174) * Improve error messages for invalidly invoked closures The error message for an `Fn` closure being invoked after being dropped was confusing, because it was the same as for `FnMut`, 'closure invoked recursively or destroyed already'. The bit about being invoked recursively is misleading, since it's perfectly valid for an `Fn` closure to be invoked recursively. So, I removed that bit from the error message for `Fn` closures, and also rephrased 'destroyed already' to 'after being dropped', since I think that makes it a bit clearer that it's caused by the closure being dropped on the Rust side, rather than the more abstract wording of 'destroyed'. * Fix tests * Revert accidental formatting --- src/closure.rs | 8 ++++---- src/convert/closures.rs | 8 ++++---- tests/wasm/closures.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/closure.rs b/src/closure.rs index 37cef06dcd9..c8d2ba22537 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -571,7 +571,7 @@ macro_rules! doit { $($var: <$var as FromWasmAbi>::Abi),* ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked after being dropped"); } // Make sure all stack variables are converted before we // convert `ret` as it may throw (for `Result`, for @@ -623,7 +623,7 @@ macro_rules! doit { $($var: <$var as FromWasmAbi>::Abi),* ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked recursively or after being dropped"); } // Make sure all stack variables are converted before we // convert `ret` as it may throw (for `Result`, for @@ -759,7 +759,7 @@ where arg: ::Abi, ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked after being dropped"); } // Make sure all stack variables are converted before we // convert `ret` as it may throw (for `Result`, for @@ -802,7 +802,7 @@ where arg: ::Abi, ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked recursively or after being dropped"); } // Make sure all stack variables are converted before we // convert `ret` as it may throw (for `Result`, for diff --git a/src/convert/closures.rs b/src/convert/closures.rs index 97755b8ee46..9137065a292 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -29,7 +29,7 @@ macro_rules! stack_closures { $($var: <$var as FromWasmAbi>::Abi),* ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked after being dropped"); } // Scope all local variables before we call `return_abi` to // ensure they're all destroyed as `return_abi` may throw @@ -78,7 +78,7 @@ macro_rules! stack_closures { $($var: <$var as FromWasmAbi>::Abi),* ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked recursively or after being dropped"); } // Scope all local variables before we call `return_abi` to // ensure they're all destroyed as `return_abi` may throw @@ -145,7 +145,7 @@ unsafe extern "C" fn invoke1_ref( arg: ::Abi, ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked after being dropped"); } // Scope all local variables before we call `return_abi` to // ensure they're all destroyed as `return_abi` may throw @@ -197,7 +197,7 @@ unsafe extern "C" fn invoke1_mut_ref( arg: ::Abi, ) -> ::Abi { if a == 0 { - throw_str("closure invoked recursively or destroyed already"); + throw_str("closure invoked recursively or after being dropped"); } // Scope all local variables before we call `return_abi` to // ensure they're all destroyed as `return_abi` may throw diff --git a/tests/wasm/closures.js b/tests/wasm/closures.js index dfc3d871e7d..9d2ca1e983b 100644 --- a/tests/wasm/closures.js +++ b/tests/wasm/closures.js @@ -150,7 +150,7 @@ exports.pass_reference_first_arg_twice = (a, b, c) => { }; exports.call_destroyed = f => { - assert.throws(f, /invoked recursively or destroyed/); + assert.throws(f, /closure invoked.*after being dropped/); }; let FORGOTTEN_CLOSURE = null; From 17874c4cfc3a6c3e426b0bfc2bd17d99f1fb2cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A6=88=EB=88=85?= Date: Sat, 10 Dec 2022 08:25:51 +0900 Subject: [PATCH 121/641] guide: typo (#3191) --- guide/src/contributing/design/exporting-rust-struct.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/contributing/design/exporting-rust-struct.md b/guide/src/contributing/design/exporting-rust-struct.md index c38ccaced26..1ea759cd6aa 100644 --- a/guide/src/contributing/design/exporting-rust-struct.md +++ b/guide/src/contributing/design/exporting-rust-struct.md @@ -96,7 +96,7 @@ let's take a look at that. // original input to `#[wasm_bindgen]` omitted ... #[export_name = "foo_new"] -pub extern "C" fn __wasm_bindgen_generated_Foo_new(arg0: i32) -> u32 +pub extern "C" fn __wasm_bindgen_generated_Foo_new(arg0: i32) -> u32 { let ret = Foo::new(arg0); Box::into_raw(Box::new(WasmRefCell::new(ret))) as u32 } From 46a8ae187dc8b4e29514d3c9f5c11c2ce6f3fbf2 Mon Sep 17 00:00:00 2001 From: Michael Allwright Date: Mon, 12 Dec 2022 16:31:40 +0100 Subject: [PATCH 122/641] Increase stack size to 128 (#3194) * Increase stack size to 128 * Fix expected output in CLI tests * Adjust expected output for externref tests * Adjust expected output for missed externref tests --- crates/cli-support/src/js/mod.rs | 2 +- crates/cli/tests/reference/anyref-empty.wat | 2 +- crates/cli/tests/reference/anyref-import-catch.wat | 2 +- crates/cli/tests/reference/anyref-nop.wat | 2 +- crates/cli/tests/reference/import-catch.js | 4 ++-- crates/cli/tests/reference/result-string.js | 4 ++-- crates/externref-xform/src/lib.rs | 2 +- crates/externref-xform/tests/anyref-param-owned.wat | 2 +- crates/externref-xform/tests/anyref-param.wat | 4 ++-- crates/externref-xform/tests/clone-ref-intrinsic.wat | 2 +- crates/externref-xform/tests/drop-ref-intrinsic.wat | 2 +- crates/externref-xform/tests/import-anyref-owned.wat | 2 +- crates/externref-xform/tests/import-anyref-ret.wat | 2 +- crates/externref-xform/tests/import-anyref.wat | 2 +- crates/externref-xform/tests/mixed-export.wat | 4 ++-- crates/externref-xform/tests/mixed.wat | 2 +- crates/externref-xform/tests/ret-anyref.wat | 2 +- crates/externref-xform/tests/table-grow-intrinsic.wat | 2 +- crates/externref-xform/tests/table-set-null-intrinsic.wat | 2 +- crates/externref-xform/tests/table.wat | 2 +- crates/externref-xform/tests/tee-before-grow.wat | 2 +- src/lib.rs | 2 +- 22 files changed, 26 insertions(+), 26 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index c697a52ba05..10da9ca0811 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -85,7 +85,7 @@ pub struct ExportedClass { const INITIAL_HEAP_VALUES: &[&str] = &["undefined", "null", "true", "false"]; // Must be kept in sync with `src/lib.rs` of the `wasm-bindgen` crate -const INITIAL_HEAP_OFFSET: usize = 32; +const INITIAL_HEAP_OFFSET: usize = 128; impl<'a> Context<'a> { pub fn new( diff --git a/crates/cli/tests/reference/anyref-empty.wat b/crates/cli/tests/reference/anyref-empty.wat index f5cc60b84a0..4d130dc9f17 100644 --- a/crates/cli/tests/reference/anyref-empty.wat +++ b/crates/cli/tests/reference/anyref-empty.wat @@ -1,7 +1,7 @@ (module (type (;0;) (func)) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (memory (;0;) 16) (export "memory" (memory 0)) (export "__wbindgen_export_0" (table 0)) diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 6b1b5b7e2cf..71b3aeae388 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -9,7 +9,7 @@ (func $exported (type 2) (param i32)) (func $__externref_table_alloc (type 1) (result i32)) (func $__wbindgen_add_to_stack_pointer (type 3) (param i32) (result i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) diff --git a/crates/cli/tests/reference/anyref-nop.wat b/crates/cli/tests/reference/anyref-nop.wat index 7c42a885375..bda9382a266 100644 --- a/crates/cli/tests/reference/anyref-nop.wat +++ b/crates/cli/tests/reference/anyref-nop.wat @@ -2,7 +2,7 @@ (type (;0;) (func)) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $foo (type 0)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "foo" (func $foo)) diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index 49a77f42eae..468d38a0e41 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -4,7 +4,7 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(32).fill(undefined); +const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -39,7 +39,7 @@ function getInt32Memory0() { function getObject(idx) { return heap[idx]; } function dropObject(idx) { - if (idx < 36) return; + if (idx < 132) return; heap[idx] = heap_next; heap_next = idx; } diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 455b7eb1cdf..b70e4ef55ce 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -4,7 +4,7 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(32).fill(undefined); +const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -31,7 +31,7 @@ function getInt32Memory0() { function getObject(idx) { return heap[idx]; } function dropObject(idx) { - if (idx < 36) return; + if (idx < 132) return; heap[idx] = heap_next; heap_next = idx; } diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index 168c108fe8e..ab738a0c35c 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -24,7 +24,7 @@ use walrus::{ElementId, ExportId, ImportId, InstrLocId, TypeId}; use walrus::{FunctionId, GlobalId, InitExpr, Module, TableId, ValType}; // must be kept in sync with src/lib.rs and EXTERNREF_HEAP_START -const DEFAULT_MIN: u32 = 32; +const DEFAULT_MIN: u32 = 128; /// State of the externref pass, used to collect information while bindings are /// generated and used eventually to actually execute the entire pass. diff --git a/crates/externref-xform/tests/anyref-param-owned.wat b/crates/externref-xform/tests/anyref-param-owned.wat index 84171fc1bb8..649e30f506d 100644 --- a/crates/externref-xform/tests/anyref-param-owned.wat +++ b/crates/externref-xform/tests/anyref-param-owned.wat @@ -23,6 +23,6 @@ (func $alloc (type 0) (result i32) i32.const 0) (func $foo (type 1) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/anyref-param.wat b/crates/externref-xform/tests/anyref-param.wat index e1dd54c2098..9f8f92a9cdf 100644 --- a/crates/externref-xform/tests/anyref-param.wat +++ b/crates/externref-xform/tests/anyref-param.wat @@ -31,7 +31,7 @@ i32.add global.set 0) (func $foo (type 0) (param i32)) - (table (;0;) 32 externref) - (global (;0;) (mut i32) i32.const 32) + (table (;0;) 128 externref) + (global (;0;) (mut i32) i32.const 128) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/clone-ref-intrinsic.wat b/crates/externref-xform/tests/clone-ref-intrinsic.wat index e618dc458ea..10d51d315a4 100644 --- a/crates/externref-xform/tests/clone-ref-intrinsic.wat +++ b/crates/externref-xform/tests/clone-ref-intrinsic.wat @@ -43,6 +43,6 @@ (func $alloc (type 0) (result i32) i32.const 0) (func $dealloc (type 1) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/drop-ref-intrinsic.wat b/crates/externref-xform/tests/drop-ref-intrinsic.wat index 14dba696009..3b4756ddaa7 100644 --- a/crates/externref-xform/tests/drop-ref-intrinsic.wat +++ b/crates/externref-xform/tests/drop-ref-intrinsic.wat @@ -30,6 +30,6 @@ (func $alloc (type 0) (result i32) i32.const 0) (func $dealloc (type 1) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/import-anyref-owned.wat b/crates/externref-xform/tests/import-anyref-owned.wat index 2e999901c0d..26ba0f7a1c8 100644 --- a/crates/externref-xform/tests/import-anyref-owned.wat +++ b/crates/externref-xform/tests/import-anyref-owned.wat @@ -26,6 +26,6 @@ i32.const 0 call $#func1) (func $dealloc (type 1) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func 2))) ;) diff --git a/crates/externref-xform/tests/import-anyref-ret.wat b/crates/externref-xform/tests/import-anyref-ret.wat index 0de6f44ae42..2f229ecfad4 100644 --- a/crates/externref-xform/tests/import-anyref-ret.wat +++ b/crates/externref-xform/tests/import-anyref-ret.wat @@ -27,6 +27,6 @@ call $#func1) (func $alloc (type 0) (result i32) i32.const 0) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func 2))) ;) diff --git a/crates/externref-xform/tests/import-anyref.wat b/crates/externref-xform/tests/import-anyref.wat index 698e293a3f3..3ca2dc6c705 100644 --- a/crates/externref-xform/tests/import-anyref.wat +++ b/crates/externref-xform/tests/import-anyref.wat @@ -23,6 +23,6 @@ (func (;2;) (type 0) i32.const 0 call $#func1) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func 2))) ;) diff --git a/crates/externref-xform/tests/mixed-export.wat b/crates/externref-xform/tests/mixed-export.wat index 2f103708db1..34f8130d971 100644 --- a/crates/externref-xform/tests/mixed-export.wat +++ b/crates/externref-xform/tests/mixed-export.wat @@ -42,7 +42,7 @@ (func $alloc (type 0) (result i32) i32.const 0) (func $a (type 1) (param f32 i32 i64 i32 i32)) - (table (;0;) 32 externref) - (global (;0;) (mut i32) i32.const 32) + (table (;0;) 128 externref) + (global (;0;) (mut i32) i32.const 128) (export "a" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/mixed.wat b/crates/externref-xform/tests/mixed.wat index 9582cf053a3..96a8f38ae38 100644 --- a/crates/externref-xform/tests/mixed.wat +++ b/crates/externref-xform/tests/mixed.wat @@ -40,6 +40,6 @@ i32.const 5 call $#func1) (func $dealloc (type 1) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func 2))) ;) diff --git a/crates/externref-xform/tests/ret-anyref.wat b/crates/externref-xform/tests/ret-anyref.wat index be0610abd0c..19acfc3de32 100644 --- a/crates/externref-xform/tests/ret-anyref.wat +++ b/crates/externref-xform/tests/ret-anyref.wat @@ -24,6 +24,6 @@ (func $foo (type 0) (result i32) i32.const 0) (func $dealloc (type 2) (param i32)) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/table-grow-intrinsic.wat b/crates/externref-xform/tests/table-grow-intrinsic.wat index 20265152e47..ff1f4db5781 100644 --- a/crates/externref-xform/tests/table-grow-intrinsic.wat +++ b/crates/externref-xform/tests/table-grow-intrinsic.wat @@ -35,6 +35,6 @@ call $foo) (func $alloc (type 0) (result i32) i32.const 0) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func1))) ;) diff --git a/crates/externref-xform/tests/table-set-null-intrinsic.wat b/crates/externref-xform/tests/table-set-null-intrinsic.wat index 39f043db865..6ca40e0ea57 100644 --- a/crates/externref-xform/tests/table-set-null-intrinsic.wat +++ b/crates/externref-xform/tests/table-set-null-intrinsic.wat @@ -30,6 +30,6 @@ table.set 0) (func $alloc (type 0) (result i32) i32.const 0) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func0))) ;) diff --git a/crates/externref-xform/tests/table.wat b/crates/externref-xform/tests/table.wat index 98e24308402..0f0578666dd 100644 --- a/crates/externref-xform/tests/table.wat +++ b/crates/externref-xform/tests/table.wat @@ -26,7 +26,7 @@ i32.const 0) (func $foo (type 1) (param i32)) (table (;0;) 2 funcref) - (table (;1;) 32 externref) + (table (;1;) 128 externref) (export "func" (table 0)) (elem (;0;) (i32.const 0) func $foo) (elem (;1;) (i32.const 1) func $#func0)) diff --git a/crates/externref-xform/tests/tee-before-grow.wat b/crates/externref-xform/tests/tee-before-grow.wat index a168abac04e..5ac8415951d 100644 --- a/crates/externref-xform/tests/tee-before-grow.wat +++ b/crates/externref-xform/tests/tee-before-grow.wat @@ -38,6 +38,6 @@ call $foo) (func $alloc (type 0) (result i32) i32.const 0) - (table (;0;) 32 externref) + (table (;0;) 128 externref) (export "foo" (func $#func1))) ;) diff --git a/src/lib.rs b/src/lib.rs index 19a7fe74e6b..7fda080e89c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,7 +91,7 @@ pub struct JsValue { _marker: marker::PhantomData<*mut u8>, // not at all threadsafe } -const JSIDX_OFFSET: u32 = 32; // keep in sync with js/mod.rs +const JSIDX_OFFSET: u32 = 128; // keep in sync with js/mod.rs const JSIDX_UNDEFINED: u32 = JSIDX_OFFSET + 0; const JSIDX_NULL: u32 = JSIDX_OFFSET + 1; const JSIDX_TRUE: u32 = JSIDX_OFFSET + 2; From ef4303e3066ca0c537bd9cfb5cba2e297fb21619 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 13 Dec 2022 02:35:53 +1100 Subject: [PATCH 123/641] Fix references passed to async functions (#3188) * Fix references passed to async functions Fixes #3167 #3167 was happening because references to `JsValue`s work by pushing the JS value onto the JS stack, and then popping it off again when the function returns. This breaks for async functions, because the `JsValue` needs to remain valid for the lifetime of the future, not just the initial synchronous call. To fix this, I introduced a new descriptor, `LONGREF`, which is used instead of `REF` in async functions and marks that the reference can't be invalidated after the function returns. I then made a `LONGREF` to a `JsValue` behave the same as an owned `JsValue`, while working like a regular `REF` for everything else. I also had to add a new version of `RefFromWasmAbi`, `LongRefFromWasmAbi`, to accomodate for `LONGREF`s to `JsValue`s requiring that the `JsValue` is destroyed from the Rust side. While working on that, I also noticed that mutable references to slices were broken in async functions. They work by copying the data from JS to Rust, and then copying it back after the function returns to apply the changes. For async functions, that means that it's copied back before the future is actually finished, and so the changes won't be applied properly. To fix that, I changed it so that the data is copied back from the Rust side when the anchor is dropped, which happens when the future resolves for async functions. I also bumped the schema version, since this is a breaking change in the interface between the macro and the CLI, even though the schema itself is unchanged. * Update UI tests * Use a separate instruction to lower the typed array reference `Instruction::MutableSliceToMemory` previously manually lowered the reference to the type array using `addHeapObject`, but that broke when reference types were enabled. The most direct solution would have been to check whether reference types were enabled and use `addToExternrefTable` instead if so, but using a separate instruction means that it gets picked up by `wasm-bindgen-externref-xform`, and an `externref` is passed directly to wasm. --- crates/backend/src/codegen.rs | 78 ++++++++++++++--- crates/cli-support/src/descriptor.rs | 12 ++- crates/cli-support/src/intrinsic.rs | 7 ++ crates/cli-support/src/js/binding.rs | 32 ++----- crates/cli-support/src/js/mod.rs | 9 ++ crates/cli-support/src/wit/incoming.rs | 29 ++++++- crates/cli-support/src/wit/standard.rs | 8 +- crates/macro/ui-tests/missing-catch.stderr | 30 +++---- .../ui-tests/traits-not-implemented.stderr | 32 +++---- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- src/convert/impls.rs | 12 ++- src/convert/slices.rs | 84 ++++++++++++++++--- src/convert/traits.rs | 27 ++++++ src/describe.rs | 1 + src/lib.rs | 24 ++++++ tests/wasm/futures.js | 4 + tests/wasm/futures.rs | 10 +++ 18 files changed, 311 insertions(+), 92 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 72e32398734..8eebc0315f3 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -242,6 +242,16 @@ impl ToTokens for ast::Struct { } } + #[automatically_derived] + impl wasm_bindgen::convert::LongRefFromWasmAbi for #name { + type Abi = u32; + type Anchor = wasm_bindgen::__rt::Ref<'static, #name>; + + unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor { + ::ref_from_abi(js) + } + } + #[automatically_derived] impl wasm_bindgen::convert::OptionIntoWasmAbi for #name { #[inline] @@ -404,7 +414,7 @@ impl TryToTokens for ast::Export { let mut argtys = Vec::new(); for (i, arg) in self.function.arguments.iter().enumerate() { - argtys.push(&arg.ty); + argtys.push(&*arg.ty); let i = i + offset; let ident = Ident::new(&format!("arg{}", i), Span::call_site()); let ty = &arg.ty; @@ -426,16 +436,31 @@ impl TryToTokens for ast::Export { }); } syn::Type::Reference(syn::TypeReference { elem, .. }) => { - args.push(quote! { - #ident: <#elem as wasm_bindgen::convert::RefFromWasmAbi>::Abi - }); - arg_conversions.push(quote! { - let #ident = unsafe { - <#elem as wasm_bindgen::convert::RefFromWasmAbi> - ::ref_from_abi(#ident) - }; - let #ident = &*#ident; - }); + if self.function.r#async { + args.push(quote! { + #ident: <#elem as wasm_bindgen::convert::LongRefFromWasmAbi>::Abi + }); + arg_conversions.push(quote! { + let #ident = unsafe { + <#elem as wasm_bindgen::convert::LongRefFromWasmAbi> + ::long_ref_from_abi(#ident) + }; + let #ident = <<#elem as wasm_bindgen::convert::LongRefFromWasmAbi> + ::Anchor as core::borrow::Borrow<#elem>> + ::borrow(&#ident); + }); + } else { + args.push(quote! { + #ident: <#elem as wasm_bindgen::convert::RefFromWasmAbi>::Abi + }); + arg_conversions.push(quote! { + let #ident = unsafe { + <#elem as wasm_bindgen::convert::RefFromWasmAbi> + ::ref_from_abi(#ident) + }; + let #ident = &*#ident; + }); + } } _ => { args.push(quote! { @@ -550,6 +575,22 @@ impl TryToTokens for ast::Export { }) .to_tokens(into); + let describe_args: TokenStream = argtys + .iter() + .map(|ty| match ty { + syn::Type::Reference(reference) + if self.function.r#async && reference.mutability.is_none() => + { + let inner = &reference.elem; + quote! { + inform(LONGREF); + <#inner as WasmDescribe>::describe(); + } + } + _ => quote! { <#ty as WasmDescribe>::describe(); }, + }) + .collect(); + // In addition to generating the shim function above which is what // our generated JS will invoke, we *also* generate a "descriptor" // shim. This descriptor shim uses the `WasmDescribe` trait to @@ -573,7 +614,7 @@ impl TryToTokens for ast::Export { inform(FUNCTION); inform(0); inform(#nargs); - #(<#argtys as WasmDescribe>::describe();)* + #describe_args #describe_ret }, attrs: attrs.clone(), @@ -659,7 +700,7 @@ impl ToTokens for ast::ImportType { const #const_name: () = { use wasm_bindgen::convert::{IntoWasmAbi, FromWasmAbi}; use wasm_bindgen::convert::{OptionIntoWasmAbi, OptionFromWasmAbi}; - use wasm_bindgen::convert::RefFromWasmAbi; + use wasm_bindgen::convert::{RefFromWasmAbi, LongRefFromWasmAbi}; use wasm_bindgen::describe::WasmDescribe; use wasm_bindgen::{JsValue, JsCast, JsObject}; use wasm_bindgen::__rt::core; @@ -731,6 +772,17 @@ impl ToTokens for ast::ImportType { } } + impl LongRefFromWasmAbi for #rust_name { + type Abi = ::Abi; + type Anchor = #rust_name; + + #[inline] + unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor { + let tmp = ::long_ref_from_abi(js); + #rust_name { obj: tmp.into() } + } + } + // TODO: remove this on the next major version impl From for #rust_name { #[inline] diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index a3b73a2221a..6f7a6ceef42 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -28,6 +28,7 @@ tys! { STRING REF REFMUT + LONGREF SLICE VECTOR EXTERNREF @@ -89,7 +90,7 @@ pub struct Closure { pub mutable: bool, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum VectorKind { I8, U8, @@ -132,6 +133,15 @@ impl Descriptor { CLOSURE => Descriptor::Closure(Box::new(Closure::decode(data))), REF => Descriptor::Ref(Box::new(Descriptor::_decode(data, clamped))), REFMUT => Descriptor::RefMut(Box::new(Descriptor::_decode(data, clamped))), + LONGREF => { + // This descriptor basically just serves as a macro, where most things + // become normal `Ref`s, but long refs to externrefs become owned. + let contents = Descriptor::_decode(data, clamped); + match contents { + Descriptor::Externref | Descriptor::NamedExternref(_) => contents, + _ => Descriptor::Ref(Box::new(contents)), + } + } SLICE => Descriptor::Slice(Box::new(Descriptor::_decode(data, clamped))), VECTOR => Descriptor::Vector(Box::new(Descriptor::_decode(data, clamped))), OPTIONAL => Descriptor::Option(Box::new(Descriptor::_decode(data, clamped))), diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index 5e5c70be698..e8874d5e055 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -84,6 +84,10 @@ fn opt_i64() -> Descriptor { Descriptor::Option(Box::new(Descriptor::I64)) } +fn slice(contents: Descriptor) -> Descriptor { + Descriptor::Ref(Box::new(Descriptor::Slice(Box::new(contents)))) +} + intrinsics! { pub enum Intrinsic { #[symbol = "__wbindgen_jsval_eq"] @@ -263,6 +267,9 @@ intrinsics! { #[symbol = "__wbindgen_json_serialize"] #[signature = fn(ref_externref()) -> String] JsonSerialize, + #[symbol = "__wbindgen_copy_to_typed_array"] + #[signature = fn(slice(U8), ref_externref()) -> Unit] + CopyToTypedArray, #[symbol = "__wbindgen_externref_heap_live_count"] #[signature = fn() -> I32] ExternrefHeapLiveCount, diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index f2a0a721d9d..0723928ee9f 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -929,15 +929,8 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> js.push(format!("len{}", i)); } - Instruction::MutableSliceToMemory { - kind, - malloc, - mem, - free, - } => { - // First up, pass the JS value into wasm, getting out a pointer and - // a length. These two pointer/length values get pushed onto the - // value stack. + Instruction::MutableSliceToMemory { kind, malloc, mem } => { + // Copy the contents of the typed array into wasm. let val = js.pop(); let func = js.cx.pass_to_wasm_function(kind.clone(), *mem)?; let malloc = js.cx.export_name_of(*malloc); @@ -950,25 +943,12 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> malloc = malloc, )); js.prelude(&format!("var len{} = WASM_VECTOR_LEN;", i)); + // Then pass it the pointer and the length of where we copied it. js.push(format!("ptr{}", i)); js.push(format!("len{}", i)); - - // Next we set up a `finally` clause which will both update the - // original mutable slice with any modifications, and then free the - // Rust-backed memory. - let free = js.cx.export_name_of(*free); - let get = js.cx.memview_function(kind.clone(), *mem); - js.finally(&format!( - " - {val}.set({get}().subarray(ptr{i} / {size}, ptr{i} / {size} + len{i})); - wasm.{free}(ptr{i}, len{i} * {size}); - ", - val = val, - get = get, - free = free, - size = kind.size(), - i = i, - )); + // Then we give wasm a reference to the original typed array, so that it can + // update it with modifications made on the wasm side before returning. + js.push(val); } Instruction::BoolFromI32 => { diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 10da9ca0811..671f67ded2e 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3498,6 +3498,15 @@ impl<'a> Context<'a> { "JSON.stringify(obj === undefined ? null : obj)".to_string() } + Intrinsic::CopyToTypedArray => { + assert_eq!(args.len(), 2); + format!( + "new Uint8Array({dst}.buffer, {dst}.byteOffset, {dst}.byteLength).set({src})", + src = args[0], + dst = args[1] + ) + } + Intrinsic::ExternrefHeapLiveCount => { assert_eq!(args.len(), 0); self.expose_global_heap(); diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 1c8e2cb169c..a940f884dd5 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -204,9 +204,13 @@ impl InstructionBuilder<'_, '_> { kind, malloc: self.cx.malloc()?, mem: self.cx.memory()?, - free: self.cx.free()?, }, - &[AdapterType::I32, AdapterType::I32], + &[AdapterType::I32, AdapterType::I32, AdapterType::Externref], + ); + self.late_instruction( + &[AdapterType::Externref], + Instruction::I32FromExternrefOwned, + &[AdapterType::I32], ); } else { self.instruction( @@ -373,6 +377,27 @@ impl InstructionBuilder<'_, '_> { self.output.extend_from_slice(outputs); } + /// Add an instruction whose inputs are the results of previous instructions + /// instead of the parameters from JS / results from Rust. + pub fn late_instruction( + &mut self, + inputs: &[AdapterType], + instr: Instruction, + outputs: &[AdapterType], + ) { + for input in inputs { + assert_eq!(self.output.pop().unwrap(), *input); + } + self.instructions.push(InstructionData { + instr, + stack_change: StackChange::Modified { + popped: inputs.len(), + pushed: outputs.len(), + }, + }); + self.output.extend_from_slice(outputs); + } + fn number(&mut self, input: wit_walrus::ValType, output: walrus::ValType) { let std = wit_walrus::Instruction::IntToWasm { input, diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index d07c593491a..7dc98a42beb 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -65,7 +65,7 @@ pub enum AdapterJsImportKind { Normal, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AdapterType { S8, S16, @@ -185,7 +185,6 @@ pub enum Instruction { MutableSliceToMemory { kind: VectorKind, malloc: walrus::FunctionId, - free: walrus::FunctionId, mem: walrus::MemoryId, }, @@ -469,12 +468,9 @@ impl walrus::CustomSection for NonstandardWitSection { roots.push_memory(mem); roots.push_func(malloc); } - MutableSliceToMemory { - free, malloc, mem, .. - } => { + MutableSliceToMemory { malloc, mem, .. } => { roots.push_memory(mem); roots.push_func(malloc); - roots.push_func(free); } VectorLoad { free, mem, .. } | OptionVectorLoad { free, mem, .. } diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index 4c20dbe76f7..d08553b1b37 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -1,17 +1,17 @@ error[E0277]: the trait bound `Result: FromWasmAbi` is not satisfied - --> $DIR/missing-catch.rs:6:9 - | -6 | pub fn foo() -> Result; - | ^^^ the trait `FromWasmAbi` is not implemented for `Result` - | + --> ui-tests/missing-catch.rs:6:9 + | +6 | pub fn foo() -> Result; + | ^^^ the trait `FromWasmAbi` is not implemented for `Result` + | note: required by a bound in `FromWasmAbi` - --> $DIR/traits.rs:23:1 - | -23 | / pub trait FromWasmAbi: WasmDescribe { -24 | | /// The wasm ABI type that this converts from when coming back out from the -25 | | /// ABI boundary. -26 | | type Abi: WasmAbi; -... | -35 | | unsafe fn from_abi(js: Self::Abi) -> Self; -36 | | } - | |_^ required by this bound in `FromWasmAbi` + --> $WORKSPACE/src/convert/traits.rs + | + | / pub trait FromWasmAbi: WasmDescribe { + | | /// The wasm ABI type that this converts from when coming back out from the + | | /// ABI boundary. + | | type Abi: WasmAbi; +... | + | | unsafe fn from_abi(js: Self::Abi) -> Self; + | | } + | |_^ required by this bound in `FromWasmAbi` diff --git a/crates/macro/ui-tests/traits-not-implemented.stderr b/crates/macro/ui-tests/traits-not-implemented.stderr index 7b0f90f574c..aaad988af58 100644 --- a/crates/macro/ui-tests/traits-not-implemented.stderr +++ b/crates/macro/ui-tests/traits-not-implemented.stderr @@ -1,18 +1,18 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied - --> $DIR/traits-not-implemented.rs:5:1 - | -5 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` - | + --> ui-tests/traits-not-implemented.rs:5:1 + | +5 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` + | note: required by a bound in `IntoWasmAbi` - --> $DIR/traits.rs:9:1 - | -9 | / pub trait IntoWasmAbi: WasmDescribe { -10 | | /// The wasm ABI type that this converts into when crossing the ABI -11 | | /// boundary. -12 | | type Abi: WasmAbi; -... | -16 | | fn into_abi(self) -> Self::Abi; -17 | | } - | |_^ required by this bound in `IntoWasmAbi` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/src/convert/traits.rs + | + | / pub trait IntoWasmAbi: WasmDescribe { + | | /// The wasm ABI type that this converts into when crossing the ABI + | | /// boundary. + | | type Abi: WasmAbi; +... | + | | fn into_abi(self) -> Self::Abi; + | | } + | |_^ required by this bound in `IntoWasmAbi` + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index f69d8f4a855..bb20598ddce 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.83"; +pub const SCHEMA_VERSION: &str = "0.2.84"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 4692a28c81e..25084e90566 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "17656911631008664055"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "1473650450341157828"; #[test] fn schema_version() { diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 79ccd67af97..e8636fe9e66 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -2,7 +2,7 @@ use core::char; use core::mem::{self, ManuallyDrop}; use crate::convert::traits::WasmAbi; -use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi}; +use crate::convert::{FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi}; use crate::convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi}; use crate::{Clamped, JsError, JsValue}; @@ -248,6 +248,16 @@ impl RefFromWasmAbi for JsValue { } } +impl LongRefFromWasmAbi for JsValue { + type Abi = u32; + type Anchor = JsValue; + + #[inline] + unsafe fn long_ref_from_abi(js: u32) -> Self::Anchor { + Self::from_abi(js) + } +} + impl IntoWasmAbi for Option { type Abi = T::Abi; diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 9d0970f4e6a..58608b8c520 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -1,12 +1,15 @@ #[cfg(feature = "std")] use std::prelude::v1::*; -use core::slice; +use core::ops::{Deref, DerefMut}; use core::str; +use crate::__wbindgen_copy_to_typed_array; use crate::cast::JsObject; use crate::convert::OptionIntoWasmAbi; -use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi}; +use crate::convert::{ + FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi, +}; use cfg_if::cfg_if; if_std! { @@ -27,6 +30,50 @@ fn null_slice() -> WasmSlice { WasmSlice { ptr: 0, len: 0 } } +if_std! { + #[repr(C)] + pub struct WasmMutSlice { + pub slice: WasmSlice, + pub idx: u32, + } + + unsafe impl WasmAbi for WasmMutSlice {} + + /// The representation of a mutable slice passed from JS to Rust. + pub struct MutSlice { + /// A copy of the data in the JS typed array. + contents: Box<[T]>, + /// A reference to the original JS typed array. + js: JsValue, + } + + impl Drop for MutSlice { + fn drop(&mut self) { + unsafe { + __wbindgen_copy_to_typed_array( + self.contents.as_ptr() as *const u8, + self.contents.len() * mem::size_of::(), + self.js.idx + ); + } + } + } + + impl Deref for MutSlice { + type Target = [T]; + + fn deref(&self) -> &[T] { + &self.contents + } + } + + impl DerefMut for MutSlice { + fn deref_mut(&mut self) -> &mut [T] { + &mut self.contents + } + } +} + macro_rules! vectors { ($($t:ident)*) => ($( if_std! { @@ -109,17 +156,24 @@ macro_rules! vectors { } impl RefMutFromWasmAbi for [$t] { + type Abi = WasmMutSlice; + type Anchor = MutSlice<$t>; + + #[inline] + unsafe fn ref_mut_from_abi(js: WasmMutSlice) -> MutSlice<$t> { + let contents = >::from_abi(js.slice); + let js = JsValue::from_abi(js.idx); + MutSlice { contents, js } + } + } + + impl LongRefFromWasmAbi for [$t] { type Abi = WasmSlice; - type Anchor = &'static mut [$t]; + type Anchor = Box<[$t]>; #[inline] - unsafe fn ref_mut_from_abi(js: WasmSlice) - -> &'static mut [$t] - { - slice::from_raw_parts_mut( - <*mut $t>::from_abi(js.ptr), - js.len as usize, - ) + unsafe fn long_ref_from_abi(js: WasmSlice) -> Box<[$t]> { + Self::ref_from_abi(js) } } )*) @@ -233,6 +287,16 @@ impl RefFromWasmAbi for str { } } +impl LongRefFromWasmAbi for str { + type Abi = <[u8] as RefFromWasmAbi>::Abi; + type Anchor = Box; + + #[inline] + unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor { + Self::ref_from_abi(js) + } +} + if_std! { use crate::JsValue; diff --git a/src/convert/traits.rs b/src/convert/traits.rs index b9d12b4c891..17b72a837c2 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -1,3 +1,4 @@ +use core::borrow::Borrow; use core::ops::{Deref, DerefMut}; use crate::describe::*; @@ -58,6 +59,32 @@ pub trait RefFromWasmAbi: WasmDescribe { unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor; } +/// A version of the `RefFromWasmAbi` trait with the additional requirement +/// that the reference must remain valid as long as the anchor isn't dropped. +/// +/// This isn't the case for `JsValue`'s `RefFromWasmAbi` implementation. To +/// avoid having to allocate a spot for the `JsValue` on the `JsValue` heap, +/// the `JsValue` is instead pushed onto the `JsValue` stack, and popped off +/// again after the function that the reference was passed to returns. So, +/// `JsValue` has a different `LongRefFromWasmAbi` implementation that behaves +/// the same as `FromWasmAbi`, putting the value on the heap. +/// +/// This is needed for async functions, where the reference needs to be valid +/// for the whole length of the `Future`, rather than the initial synchronous +/// call. +/// +/// 'long ref' is short for 'long-lived reference'. +pub trait LongRefFromWasmAbi: WasmDescribe { + /// Same as `RefFromWasmAbi::Abi` + type Abi: WasmAbi; + + /// Same as `RefFromWasmAbi::Anchor` + type Anchor: Borrow; + + /// Same as `RefFromWasmAbi::ref_from_abi` + unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor; +} + /// Dual of the `RefFromWasmAbi` trait, except for mutable references. pub trait RefMutFromWasmAbi: WasmDescribe { /// Same as `RefFromWasmAbi::Abi` diff --git a/src/describe.rs b/src/describe.rs index 2b7c4b628c0..be149d7a90b 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -34,6 +34,7 @@ tys! { STRING REF REFMUT + LONGREF SLICE VECTOR EXTERNREF diff --git a/src/lib.rs b/src/lib.rs index 7fda080e89c..6bc9be3776d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1075,6 +1075,8 @@ externs! { fn __wbindgen_jsval_eq(a: u32, b: u32) -> u32; fn __wbindgen_jsval_loose_eq(a: u32, b: u32) -> u32; + fn __wbindgen_copy_to_typed_array(ptr: *const u8, len: usize, idx: u32) -> (); + fn __wbindgen_not(idx: u32) -> u32; fn __wbindgen_memory() -> u32; @@ -1367,6 +1369,7 @@ pub fn function_table() -> JsValue { #[doc(hidden)] pub mod __rt { use crate::JsValue; + use core::borrow::{Borrow, BorrowMut}; use core::cell::{Cell, UnsafeCell}; use core::ops::{Deref, DerefMut}; @@ -1486,6 +1489,13 @@ pub mod __rt { } } + impl<'b, T: ?Sized> Borrow for Ref<'b, T> { + #[inline] + fn borrow(&self) -> &T { + self.value + } + } + impl<'b, T: ?Sized> Drop for Ref<'b, T> { fn drop(&mut self) { self.borrow.set(self.borrow.get() - 1); @@ -1513,6 +1523,20 @@ pub mod __rt { } } + impl<'b, T: ?Sized> Borrow for RefMut<'b, T> { + #[inline] + fn borrow(&self) -> &T { + self.value + } + } + + impl<'b, T: ?Sized> BorrowMut for RefMut<'b, T> { + #[inline] + fn borrow_mut(&mut self) -> &mut T { + self.value + } + } + impl<'b, T: ?Sized> Drop for RefMut<'b, T> { fn drop(&mut self) { self.borrow.set(0); diff --git a/tests/wasm/futures.js b/tests/wasm/futures.js index 5f4564baca3..b9560866071 100644 --- a/tests/wasm/futures.js +++ b/tests/wasm/futures.js @@ -18,6 +18,10 @@ exports.call_exports = async function() { assert.strictEqual("Hi, Jim!", await wasm.async_take_reference("Jim")); const foo = await new wasm.AsyncStruct(); assert.strictEqual(42, await foo.method()); + await wasm.async_take_js_reference(42); + const buffer = new Int32Array([1, 2, 3, 4]); + await wasm.async_take_mut_slice(buffer); + assert.deepStrictEqual(buffer, new Int32Array([42, 42, 42, 42])); }; exports.call_promise = async function() { diff --git a/tests/wasm/futures.rs b/tests/wasm/futures.rs index ad2be0f71d9..7dfddf2092e 100644 --- a/tests/wasm/futures.rs +++ b/tests/wasm/futures.rs @@ -126,6 +126,16 @@ impl AsyncStruct { } } +#[wasm_bindgen] +pub async fn async_take_js_reference(x: &JsValue) { + assert_eq!(*x, 42); +} + +#[wasm_bindgen] +pub async fn async_take_mut_slice(x: &mut [i32]) { + x.fill(42); +} + #[wasm_bindgen_test] async fn test_promise() { assert_eq!(call_promise().await.as_string(), Some(String::from("ok"))) From 430c68c90c6beabb346f22a9d1886ede33858c14 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Mon, 12 Dec 2022 16:39:50 +0100 Subject: [PATCH 124/641] allow thread destruction to run in other thread (#3177) --- crates/threads-xform/src/lib.rs | 76 +++++++++++++++----- crates/threads-xform/tests/basic.wat | 88 ++++++++++++++---------- crates/threads-xform/tests/unaligned.wat | 88 ++++++++++++++---------- 3 files changed, 161 insertions(+), 91 deletions(-) diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 7a7cb898f73..5f8361c21b0 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -155,6 +155,8 @@ impl Config { size: self.thread_stack_size, }; + let _ = module.exports.add("__stack_alloc", stack.alloc); + inject_start(module, &tls, &stack, thread_counter_addr, memory)?; // we expose a `__wbindgen_thread_destroy()` helper function that deallocates stack space. @@ -163,6 +165,16 @@ impl Config { // After calling this function in a given agent, the instance should be considered // "destroyed" and any further invocations into it will trigger UB. This function // should not be called from an agent that cannot block (e.g. the main document thread). + // + // You can also call it from a "leader" agent, passing appropriate values, if said leader + // is in charge of cleaning up after a "follower" agent. In that case: + // - The "appropriate values" are the values of the `__tls_base` and `__stack_alloc` globals + // from the follower thread, after initialization. + // - The leader does _not_ need to block. + // - Similar restrictions apply: the follower thread should be considered unusable afterwards, + // the leader should not call this function with the same set of parameteres twice. + // - Moreover, concurrent calls can lead to UB: the follower could be in the middle of a + // call while the leader is destroying its stack! You should make sure that this cannot happen. inject_destroy(module, &tls, &stack, memory)?; Ok(()) @@ -365,37 +377,63 @@ fn inject_destroy( ) -> Result<(), Error> { let free = find_function(module, "__wbindgen_free")?; - let mut builder = walrus::FunctionBuilder::new(&mut module.types, &[], &[]); + let mut builder = + walrus::FunctionBuilder::new(&mut module.types, &[ValType::I32, ValType::I32], &[]); builder.name("__wbindgen_thread_destroy".into()); let mut body = builder.func_body(); + // if no explicit parameters are passed (i.e. their value is 0) then we assume + // we're being called from the agent that must be destroyed and rely on its globals + let tls_base = module.locals.add(ValType::I32); + let stack_alloc = module.locals.add(ValType::I32); + // Ideally, at this point, we would destroy the values stored in TLS. // We can't really do that without help from the standard library. // See https://github.com/rustwasm/wasm-bindgen/pull/2769#issuecomment-1015775467. - // free the TLS space - body.global_get(tls.base) - .i32_const(tls.size as i32) - .call(free); - - // set tls.base = i32::MIN to trigger invalid memory - body.i32_const(i32::MIN).global_set(tls.base); - - // free the stack callin `__wbindgen_free(stack.alloc, stack.size)` - with_temp_stack(&mut body, memory, stack, |body| { - body.global_get(stack.alloc) - .i32_const(stack.size as i32) - .call(free); - }); + body.local_get(tls_base).if_else( + None, + |body| { + body.local_get(tls_base) + .i32_const(tls.size as i32) + .call(free); + }, + |body| { + body.global_get(tls.base) + .i32_const(tls.size as i32) + .call(free); + + // set tls.base = i32::MIN to trigger invalid memory + body.i32_const(i32::MIN).global_set(tls.base); + }, + ); + + // free the stack calling `__wbindgen_free(stack.alloc, stack.size)` + body.local_get(stack_alloc).if_else( + None, + |body| { + // we're destroying somebody else's stack, so we can use our own + body.local_get(stack_alloc) + .i32_const(stack.size as i32) + .call(free); + }, + |mut body| { + with_temp_stack(&mut body, memory, stack, |body| { + body.global_get(stack.alloc) + .i32_const(stack.size as i32) + .call(free); + }); - // set stack.alloc = 0 to trigger invalid memory - body.i32_const(0).global_set(stack.alloc); + // set stack.alloc = 0 to trigger invalid memory + body.i32_const(0).global_set(stack.alloc); + }, + ); - let free_id = builder.finish(Vec::new(), &mut module.funcs); + let destroy_id = builder.finish(Vec::new(), &mut module.funcs); - module.exports.add("__wbindgen_thread_destroy", free_id); + module.exports.add("__wbindgen_thread_destroy", destroy_id); Ok(()) } diff --git a/crates/threads-xform/tests/basic.wat b/crates/threads-xform/tests/basic.wat index 2c0b03aeee9..5f22078d8fc 100644 --- a/crates/threads-xform/tests/basic.wat +++ b/crates/threads-xform/tests/basic.wat @@ -76,41 +76,56 @@ global.set 1 global.get 1 call $__wasm_init_tls) - (func $__wbindgen_thread_destroy (type 0) - global.get 1 - i32.const 128 - call $__wbindgen_free - i32.const -2147483648 - global.set 1 - i32.const 393216 - global.set 2 - loop ;; label = @1 - i32.const 327684 - i32.const 0 - i32.const 1 - i32.atomic.rmw.cmpxchg - if ;; label = @2 + (func $__wbindgen_thread_destroy (type 3) (param i32 i32) + (local i32 i32) + local.get 0 + if ;; label = @1 + local.get 0 + i32.const 128 + call $__wbindgen_free + else + global.get 1 + i32.const 128 + call $__wbindgen_free + i32.const -2147483648 + global.set 1 + end + local.get 1 + if ;; label = @1 + local.get 1 + i32.const 1048576 + call $__wbindgen_free + else + i32.const 393216 + global.set 2 + loop ;; label = @2 i32.const 327684 + i32.const 0 i32.const 1 - i64.const -1 - memory.atomic.wait32 - drop - br 1 (;@1;) - else + i32.atomic.rmw.cmpxchg + if ;; label = @3 + i32.const 327684 + i32.const 1 + i64.const -1 + memory.atomic.wait32 + drop + br 1 (;@2;) + else + end end - end - global.get 3 - i32.const 1048576 - call $__wbindgen_free - i32.const 327684 - i32.const 0 - i32.atomic.store - i32.const 327684 - i32.const 1 - memory.atomic.notify - drop - i32.const 0 - global.set 3) + global.get 3 + i32.const 1048576 + call $__wbindgen_free + i32.const 327684 + i32.const 0 + i32.atomic.store + i32.const 327684 + i32.const 1 + memory.atomic.notify + drop + i32.const 0 + global.set 3 + end) (func $__wasm_init_tls (type 1) (param i32) i32.const 232323 drop) @@ -120,14 +135,15 @@ (func $__wbindgen_malloc (type 2) (param i32) (result i32) i32.const 999999) (func $__wbindgen_free (type 3) (param i32 i32)) - (global (;0;) i32 (i32.const 393216)) - (global (;1;) (mut i32) (i32.const 0)) - (global (;2;) (mut i32) (i32.const 65536)) - (global (;3;) (mut i32) (i32.const 0)) + (global (;0;) i32 i32.const 393216) + (global (;1;) (mut i32) i32.const 0) + (global (;2;) (mut i32) i32.const 65536) + (global (;3;) (mut i32) i32.const 0) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_free" (func $__wbindgen_free)) (export "__heap_base" (global 0)) (export "__tls_base" (global 1)) + (export "__stack_alloc" (global 3)) (export "__wbindgen_thread_destroy" (func $__wbindgen_thread_destroy)) (start 0)) ;) diff --git a/crates/threads-xform/tests/unaligned.wat b/crates/threads-xform/tests/unaligned.wat index 241f7ce05d4..816868946e4 100644 --- a/crates/threads-xform/tests/unaligned.wat +++ b/crates/threads-xform/tests/unaligned.wat @@ -76,41 +76,56 @@ global.set 1 global.get 1 call $__wasm_init_tls) - (func $__wbindgen_thread_destroy (type 0) - global.get 1 - i32.const 128 - call $__wbindgen_free - i32.const -2147483648 - global.set 1 - i32.const 393216 - global.set 2 - loop ;; label = @1 - i32.const 327688 - i32.const 0 - i32.const 1 - i32.atomic.rmw.cmpxchg - if ;; label = @2 + (func $__wbindgen_thread_destroy (type 3) (param i32 i32) + (local i32 i32) + local.get 0 + if ;; label = @1 + local.get 0 + i32.const 128 + call $__wbindgen_free + else + global.get 1 + i32.const 128 + call $__wbindgen_free + i32.const -2147483648 + global.set 1 + end + local.get 1 + if ;; label = @1 + local.get 1 + i32.const 1048576 + call $__wbindgen_free + else + i32.const 393216 + global.set 2 + loop ;; label = @2 i32.const 327688 + i32.const 0 i32.const 1 - i64.const -1 - memory.atomic.wait32 - drop - br 1 (;@1;) - else + i32.atomic.rmw.cmpxchg + if ;; label = @3 + i32.const 327688 + i32.const 1 + i64.const -1 + memory.atomic.wait32 + drop + br 1 (;@2;) + else + end end - end - global.get 3 - i32.const 1048576 - call $__wbindgen_free - i32.const 327688 - i32.const 0 - i32.atomic.store - i32.const 327688 - i32.const 1 - memory.atomic.notify - drop - i32.const 0 - global.set 3) + global.get 3 + i32.const 1048576 + call $__wbindgen_free + i32.const 327688 + i32.const 0 + i32.atomic.store + i32.const 327688 + i32.const 1 + memory.atomic.notify + drop + i32.const 0 + global.set 3 + end) (func $__wasm_init_tls (type 1) (param i32) i32.const 232323 drop) @@ -120,14 +135,15 @@ (func $__wbindgen_malloc (type 2) (param i32) (result i32) i32.const 999999) (func $__wbindgen_free (type 3) (param i32 i32)) - (global (;0;) i32 (i32.const 393219)) - (global (;1;) (mut i32) (i32.const 0)) - (global (;2;) (mut i32) (i32.const 65536)) - (global (;3;) (mut i32) (i32.const 0)) + (global (;0;) i32 i32.const 393219) + (global (;1;) (mut i32) i32.const 0) + (global (;2;) (mut i32) i32.const 65536) + (global (;3;) (mut i32) i32.const 0) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_free" (func $__wbindgen_free)) (export "__heap_base" (global 0)) (export "__tls_base" (global 1)) + (export "__stack_alloc" (global 3)) (export "__wbindgen_thread_destroy" (func $__wbindgen_thread_destroy)) (start 0)) ;) From eebb201ac2310e2ca0319fbed51a9243cc350a64 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 16 Dec 2022 11:42:02 +1100 Subject: [PATCH 125/641] Don't give generated consts names (#3198) This removes any possibility of them causing a name collision. --- crates/backend/src/codegen.rs | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 8eebc0315f3..b0ff20e7d27 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -137,7 +137,6 @@ impl ToTokens for ast::Struct { let name_chars = name_str.chars().map(|c| c as u32); let new_fn = Ident::new(&shared::new_function(&name_str), Span::call_site()); let free_fn = Ident::new(&shared::free_function(&name_str), Span::call_site()); - let free_fn_const = Ident::new(&format!("{}__const", free_fn), free_fn.span()); (quote! { #[automatically_derived] impl wasm_bindgen::describe::WasmDescribe for #name { @@ -210,7 +209,7 @@ impl ToTokens for ast::Struct { #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] #[automatically_derived] - const #free_fn_const: () = { + const _: () = { #[no_mangle] #[doc(hidden)] pub unsafe extern "C" fn #free_fn(ptr: u32) { @@ -293,11 +292,9 @@ impl ToTokens for ast::StructField { quote! {} }; - let getter_const = Ident::new(&format!("{}__const", getter), getter.span()); - (quote! { #[automatically_derived] - const #getter_const: () = { + const _: () = { #[cfg_attr(all(target_arch = "wasm32", not(target_os = "emscripten")), no_mangle)] #[doc(hidden)] pub unsafe extern "C" fn #getter(js: u32) @@ -331,12 +328,10 @@ impl ToTokens for ast::StructField { return; } - let setter_const = Ident::new(&format!("{}__const", setter), setter.span()); - (quote! { #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] #[automatically_derived] - const #setter_const: () = { + const _: () = { #[no_mangle] #[doc(hidden)] pub unsafe extern "C" fn #setter( @@ -555,11 +550,9 @@ impl TryToTokens for ast::Export { quote! {} }; - let generated_name_const = - Ident::new(&format!("{}__const", generated_name), generated_name.span()); (quote! { #[automatically_derived] - const #generated_name_const: () = { + const _: () = { #(#attrs)* #[cfg_attr( all(target_arch = "wasm32", not(target_os = "emscripten")), @@ -647,8 +640,6 @@ impl ToTokens for ast::ImportType { None => "", Some(comment) => comment, }; - let const_name = format!("__wbg_generated_const_{}", rust_name); - let const_name = Ident::new(&const_name, Span::call_site()); let instanceof_shim = Ident::new(&self.instanceof_shim, Span::call_site()); let internal_obj = match self.extends.first() { @@ -697,7 +688,7 @@ impl ToTokens for ast::ImportType { } #[automatically_derived] - const #const_name: () = { + const _: () = { use wasm_bindgen::convert::{IntoWasmAbi, FromWasmAbi}; use wasm_bindgen::convert::{OptionIntoWasmAbi, OptionFromWasmAbi}; use wasm_bindgen::convert::{RefFromWasmAbi, LongRefFromWasmAbi}; @@ -1387,16 +1378,12 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { } let name = Ident::new(&format!("__wbindgen_describe_{}", ident), ident.span()); - let const_name = Ident::new( - &format!("__wbindgen_const_describe_{}", ident), - ident.span(), - ); let inner = &self.inner; let attrs = &self.attrs; (quote! { #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] #[automatically_derived] - const #const_name: () = { + const _: () = { #(#attrs)* #[no_mangle] #[doc(hidden)] From 125d39a61602244e904fe23c843add4e8eff24ef Mon Sep 17 00:00:00 2001 From: Brooklyn Zelenka Date: Tue, 20 Dec 2022 22:09:45 +0000 Subject: [PATCH 126/641] Docfix: Remove dangling word (#3210) --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6bc9be3776d..3f67c6296a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ macro_rules! externs { ) } -/// A module which is typically glob imported from: +/// A module which is typically glob imported. /// /// ``` /// use wasm_bindgen::prelude::*; From 3e11267b43e77330a9d5908eeb3d7c5bd992ae31 Mon Sep 17 00:00:00 2001 From: FrankReh Date: Tue, 20 Dec 2022 18:00:15 -0500 Subject: [PATCH 127/641] update benchmark's README and index.html (#3212) The args to wasm-bindgen have changed a little and the name of the main branch has changed. --- benchmarks/README.md | 2 +- benchmarks/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/README.md b/benchmarks/README.md index 2309bcb8af2..697074addfe 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -21,7 +21,7 @@ Next, `cd` into that directory and execute: ``` $ cargo build --release --target wasm32-unknown-unknown -$ wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/crate.wasm +$ wasm-bindgen --out-dir pkg --target web ./target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm ``` Next, use your favorite static file server to host the current directory. For diff --git a/benchmarks/index.html b/benchmarks/index.html index 42cd3dc515d..7c3736e9da1 100644 --- a/benchmarks/index.html +++ b/benchmarks/index.html @@ -22,7 +22,7 @@ - Source code + Source code

JS / wasm-bindgen comparison

From f35fda91350703b10cd2bdfe8a3be9d95ba394ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Thu, 29 Dec 2022 00:22:40 +0100 Subject: [PATCH 128/641] add HtmlInputElement::show_picker from latest spec draft (#3215) Copy-paste the `showPicker` WebIDL from [1] into the hopefully proper location. Fixes #3036 [1] https://html.spec.whatwg.org/multipage/input.html --- crates/web-sys/README.md | 7 ++++--- crates/web-sys/src/features/gen_HtmlInputElement.rs | 7 +++++++ crates/web-sys/webidls/enabled/HTMLInputElement.webidl | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index cfbb3517f43..71bb2be3149 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -29,6 +29,7 @@ If you don't see a particular web API in `web-sys`, here is how to add it. [spec](https://w3c.github.io/mediasession/#the-mediasession-interface). The [very bottom](https://w3c.github.io/mediasession/#idl-index) of _that_ page is the IDL. -2. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features` -3. Copy the contents of `features` into the `[features]` section of `Cargo.toml` -4. Run `git add .` to add all the generated files into git. +2. Annotate the functions that can throw with `[Throws]` +3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features` +4. Copy the contents of `features` into the `[features]` section of `Cargo.toml` +5. Run `git add .` to add all the generated files into git. diff --git a/crates/web-sys/src/features/gen_HtmlInputElement.rs b/crates/web-sys/src/features/gen_HtmlInputElement.rs index 4c51bf220a6..506557d2422 100644 --- a/crates/web-sys/src/features/gen_HtmlInputElement.rs +++ b/crates/web-sys/src/features/gen_HtmlInputElement.rs @@ -698,4 +698,11 @@ extern "C" { end: u32, direction: &str, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "HTMLInputElement" , js_name = showPicker)] + #[doc = "The `showPicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + pub fn show_picker(this: &HtmlInputElement) -> Result<(), JsValue>; } diff --git a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl index 8f5c492f379..572f7468e01 100644 --- a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl @@ -135,6 +135,9 @@ interface HTMLInputElement : HTMLElement { [Throws] undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); + [Throws] + undefined showPicker(); + // also has obsolete members }; From e029bc825698b9e882e24197e357fad68e393190 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 4 Jan 2023 02:38:15 +1100 Subject: [PATCH 129/641] Exclude `#[wasm_bindgen]`'d functions in `discover_main` (#3206) * Exclude `#[wasm_bindgen]`'d functions in `discover_main` This is a partial fix for #3199. I couldn't find any way to reliably detect whether a `main` function was actually a proper Rust `main` function, but the common case of a `#[wasm_bindgen]`'d function named main happening to have the same signature can be avoided, by just checking whether the function is a `#[wasm_bindgen]` export before marking it as the start function. This PR does that. It's still possible for a function to be mistakenly treated as `main` if it's exported manually, but that's much less likely to occur. Resolves #3199. * Use `self.adapters.exports`, not `self.function_exports` `self.function_exports` is the list of _all_ exported functions, not just the `#[wasm_bindgen]`'d ones. So, this was completely broken before. I'm still not 100% sure if `self.adapters.exports` is the right thing to be using though. --- crates/cli-support/src/wit/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index f5b56e0079d..e466e1b688e 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -22,7 +22,9 @@ struct Context<'a> { module: &'a mut Module, adapters: NonstandardWitSection, aux: WasmBindgenAux, + /// All of the wasm module's exported functions. function_exports: HashMap, + /// All of the wasm module's imported functions. function_imports: HashMap, /// A map from the signature of a function in the function table to its adapter, if we've already created it. table_adapters: HashMap, @@ -264,7 +266,12 @@ impl<'a> Context<'a> { // type has to be `(i32, i32) -> i32` let ty = self.module.types.get(x.ty()); let type_matches = ty.params() == [I32, I32] && ty.results() == [I32]; - name_matches && type_matches + // Having the correct name and signature doesn't necessarily mean that it's + // actually a `main` function. Unfortunately, there doesn't seem to be any 100% + // reliable way to make sure that it is, but we can at least rule out any + // `#[wasm_bindgen]` exported functions. + let unknown = !self.adapters.exports.iter().any(|(name, _)| name == "main"); + name_matches && type_matches && unknown }) .map(|x| x.id()); let main_id = match main_id { From ee89f9051e0325553022e49ff713dadd6ecea5c1 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 4 Jan 2023 02:38:45 +1100 Subject: [PATCH 130/641] Validate the schema version before processing descriptors (#3205) While looking into #3204 I noticed that the error given by `wasm-pack test` was a panic while decoding descriptors, rather than the 'version mismatch' error that using an incompatible CLI version should give. It turns out that that was happening because descriptors were getting parsed before the custom section, and hence before the version check. So, I reordered things so that the custom section is parsed (but not processed) before the descriptors, which includes checking the schema version. The custom section still gets processed afterwards, though, since that seems to depend on the results of processing descriptors. --- crates/cli-support/src/lib.rs | 17 ++++++++++++++--- crates/cli-support/src/wit/mod.rs | 10 ++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index feba5193562..abe5ec226ee 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -356,20 +356,31 @@ impl Bindgen { .producers .add_processed_by("wasm-bindgen", &wasm_bindgen_shared::version()); + // Parse and remove our custom section before executing descriptors. + // That includes checking that the binary has the same schema version + // as this version of the CLI, which is why we do it first - to make + // sure that this binary was produced by a compatible version of the + // wasm-bindgen macro before attempting to interpret our unstable + // descriptor format. That way, we give a more helpful version mismatch + // error instead of an unhelpful panic if an incompatible descriptor is + // found. + let mut storage = Vec::new(); + let programs = wit::extract_programs(&mut module, &mut storage)?; + // Learn about the type signatures of all wasm-bindgen imports and // exports by executing `__wbindgen_describe_*` functions. This'll // effectively move all the descriptor functions to their own custom // sections. descriptors::execute(&mut module)?; - // Process and remove our raw custom sections emitted by the - // #[wasm_bindgen] macro and the compiler. In their stead insert a - // forward-compatible wasm interface types section as well as an + // Process the custom section we extracted earlier. In its stead insert + // a forward-compatible wasm interface types section as well as an // auxiliary section for all sorts of miscellaneous information and // features #[wasm_bindgen] supports that aren't covered by wasm // interface types. wit::process( &mut module, + programs, self.externref, self.wasm_interface_types, self.emit_start, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index e466e1b688e..d098eab93bc 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -47,13 +47,11 @@ struct InstructionBuilder<'a, 'b> { pub fn process( module: &mut Module, + programs: Vec, externref_enabled: bool, wasm_interface_types: bool, support_start: bool, ) -> Result<(NonstandardWitSectionId, WasmBindgenAuxId), Error> { - let mut storage = Vec::new(); - let programs = extract_programs(module, &mut storage)?; - let mut cx = Context { adapters: Default::default(), aux: Default::default(), @@ -1500,7 +1498,11 @@ impl<'a> Context<'a> { } } -fn extract_programs<'a>( +/// Extract all of the `Program`s encoded in our custom section. +/// +/// `program_storage` is used to squirrel away the raw bytes of the custom +/// section, so that they can be referenced by the `Program`s we return. +pub fn extract_programs<'a>( module: &mut Module, program_storage: &'a mut Vec>, ) -> Result>, Error> { From a10e9491270ed9d60ca14b75cd43a8f0761d8c56 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 4 Jan 2023 02:44:23 +1100 Subject: [PATCH 131/641] Add `JsCast` to `wasm_bindgen::prelude` (#3221) * Add `JsCast` to `wasm_bindgen::prelude` `JsCast` is a very commonly used trait, but for some reason has never been added to `wasm_bindgen::prelude`, leading to the constant annoyance of having to manually import it. * Remove redundant imports --- benchmarks/src/lib.rs | 1 - crates/futures/src/stream.rs | 2 +- crates/futures/src/task/multithread.rs | 1 - crates/futures/src/task/wait_async_polyfill.rs | 1 - crates/futures/tests/tests.rs | 3 +-- crates/js-sys/src/lib.rs | 1 - crates/js-sys/tests/wasm/Array.rs | 2 -- crates/js-sys/tests/wasm/JSON.rs | 1 - crates/js-sys/tests/wasm/JsString.rs | 2 -- crates/js-sys/tests/wasm/Number.rs | 1 - crates/js-sys/tests/wasm/Object.rs | 1 - crates/js-sys/tests/wasm/Set.rs | 1 - crates/js-sys/tests/wasm/SharedArrayBuffer.rs | 1 - crates/js-sys/tests/wasm/Temporal.rs | 1 - crates/js-sys/tests/wasm/TypedArray.rs | 1 - crates/js-sys/tests/wasm/WeakMap.rs | 1 - crates/js-sys/tests/wasm/WeakSet.rs | 1 - crates/js-sys/tests/wasm/WebAssembly.rs | 2 +- crates/test/src/rt/detect.rs | 1 - crates/web-sys/tests/wasm/blob.rs | 1 - crates/web-sys/tests/wasm/event.rs | 1 - crates/web-sys/tests/wasm/html_element.rs | 1 - crates/web-sys/tests/wasm/response.rs | 1 - crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs | 2 +- crates/webidl-tests/maplike.rs | 1 - crates/webidl-tests/simple.rs | 1 - examples/canvas/src/lib.rs | 1 - examples/closures/src/lib.rs | 1 - examples/fetch/src/lib.rs | 1 - examples/paint/src/lib.rs | 1 - examples/raytrace-parallel/src/lib.rs | 1 - examples/raytrace-parallel/src/pool.rs | 1 - examples/request-animation-frame/src/lib.rs | 1 - examples/todomvc/src/element.rs | 1 - examples/todomvc/src/view.rs | 1 - examples/wasm-in-wasm-imports/src/lib.rs | 1 - examples/wasm-in-wasm/src/lib.rs | 1 - examples/wasm-in-web-worker/src/lib.rs | 1 - examples/weather_report/src/lib.rs | 1 - examples/webgl/src/lib.rs | 1 - examples/webrtc_datachannel/src/lib.rs | 1 - examples/websockets/src/lib.rs | 1 - examples/webxr/src/lib.rs | 1 - src/lib.rs | 1 + tests/wasm/api.rs | 1 - tests/wasm/closures.rs | 1 - tests/wasm/jscast.rs | 1 - tests/wasm/simple.rs | 2 +- 48 files changed, 6 insertions(+), 50 deletions(-) diff --git a/benchmarks/src/lib.rs b/benchmarks/src/lib.rs index f6c375db6ad..f6869acdd78 100644 --- a/benchmarks/src/lib.rs +++ b/benchmarks/src/lib.rs @@ -2,7 +2,6 @@ extern crate wasm_bindgen; extern crate web_sys; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::Node; #[wasm_bindgen(raw_module = "../globals.js")] diff --git a/crates/futures/src/stream.rs b/crates/futures/src/stream.rs index 208120c3106..7189c00066d 100644 --- a/crates/futures/src/stream.rs +++ b/crates/futures/src/stream.rs @@ -11,7 +11,7 @@ use core::pin::Pin; use core::task::{Context, Poll}; use futures_core::stream::Stream; use js_sys::{AsyncIterator, IteratorNext}; -use wasm_bindgen::{prelude::*, JsCast}; +use wasm_bindgen::prelude::*; /// A `Stream` that yields values from an underlying `AsyncIterator`. pub struct JsStream { diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index dd2fec0d641..6cfdfcb5437 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -8,7 +8,6 @@ use std::sync::atomic::Ordering::SeqCst; use std::sync::Arc; use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; const SLEEPING: i32 = 0; const AWAKE: i32 = 1; diff --git a/crates/futures/src/task/wait_async_polyfill.rs b/crates/futures/src/task/wait_async_polyfill.rs index 14b8f0eadf5..81b50d95259 100644 --- a/crates/futures/src/task/wait_async_polyfill.rs +++ b/crates/futures/src/task/wait_async_polyfill.rs @@ -40,7 +40,6 @@ use js_sys::{encode_uri_component, Array, Promise}; use std::cell::RefCell; use std::sync::atomic::AtomicI32; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{MessageEvent, Worker}; const HELPER_CODE: &'static str = " diff --git a/crates/futures/tests/tests.rs b/crates/futures/tests/tests.rs index ab7c147c941..6a950f7c869 100644 --- a/crates/futures/tests/tests.rs +++ b/crates/futures/tests/tests.rs @@ -5,7 +5,7 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); use futures_channel::oneshot; use js_sys::Promise; use std::ops::FnMut; -use wasm_bindgen::{prelude::*, JsValue}; +use wasm_bindgen::prelude::*; use wasm_bindgen_futures::{future_to_promise, spawn_local, JsFuture}; use wasm_bindgen_test::*; @@ -138,7 +138,6 @@ async fn can_create_multiple_futures_from_same_promise() { #[wasm_bindgen_test] async fn can_use_an_async_iterable_as_stream() { use futures_lite::stream::StreamExt; - use wasm_bindgen::JsCast; use wasm_bindgen_futures::stream::JsStream; let async_iter = js_sys::Function::new_no_args( diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 9366896f983..838611362b9 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -29,7 +29,6 @@ use std::str; use std::str::FromStr; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; // When adding new imports: // diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index e498c2cc0a9..02243a86856 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -1,8 +1,6 @@ use js_sys::*; use std::iter::FromIterator; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; -use wasm_bindgen::JsValue; use wasm_bindgen_test::*; macro_rules! js_array { diff --git a/crates/js-sys/tests/wasm/JSON.rs b/crates/js-sys/tests/wasm/JSON.rs index 920ac1d6f62..a5b006759da 100644 --- a/crates/js-sys/tests/wasm/JSON.rs +++ b/crates/js-sys/tests/wasm/JSON.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen_test] diff --git a/crates/js-sys/tests/wasm/JsString.rs b/crates/js-sys/tests/wasm/JsString.rs index 33cd53bce9f..c96046234b8 100644 --- a/crates/js-sys/tests/wasm/JsString.rs +++ b/crates/js-sys/tests/wasm/JsString.rs @@ -1,7 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; -use wasm_bindgen::JsValue; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/JsString.js")] diff --git a/crates/js-sys/tests/wasm/Number.rs b/crates/js-sys/tests/wasm/Number.rs index 6c3416eda5b..94fd551f33e 100644 --- a/crates/js-sys/tests/wasm/Number.rs +++ b/crates/js-sys/tests/wasm/Number.rs @@ -2,7 +2,6 @@ use std::f64::{INFINITY, NAN}; use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/Number.js")] diff --git a/crates/js-sys/tests/wasm/Object.rs b/crates/js-sys/tests/wasm/Object.rs index 4f1ade9727c..69db1af3af5 100644 --- a/crates/js-sys/tests/wasm/Object.rs +++ b/crates/js-sys/tests/wasm/Object.rs @@ -1,7 +1,6 @@ use js_sys::*; use std::f64::NAN; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen] diff --git a/crates/js-sys/tests/wasm/Set.rs b/crates/js-sys/tests/wasm/Set.rs index 045e192e6dd..94905bef1ff 100644 --- a/crates/js-sys/tests/wasm/Set.rs +++ b/crates/js-sys/tests/wasm/Set.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; fn set2vec(s: &Set) -> Vec { diff --git a/crates/js-sys/tests/wasm/SharedArrayBuffer.rs b/crates/js-sys/tests/wasm/SharedArrayBuffer.rs index fdfd55d9bbb..6b50d7278b5 100644 --- a/crates/js-sys/tests/wasm/SharedArrayBuffer.rs +++ b/crates/js-sys/tests/wasm/SharedArrayBuffer.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/SharedArrayBuffer.js")] diff --git a/crates/js-sys/tests/wasm/Temporal.rs b/crates/js-sys/tests/wasm/Temporal.rs index 5ea651bee06..feff11991c3 100644 --- a/crates/js-sys/tests/wasm/Temporal.rs +++ b/crates/js-sys/tests/wasm/Temporal.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/Temporal.js")] diff --git a/crates/js-sys/tests/wasm/TypedArray.rs b/crates/js-sys/tests/wasm/TypedArray.rs index ef06a4c440b..653e6ea7212 100644 --- a/crates/js-sys/tests/wasm/TypedArray.rs +++ b/crates/js-sys/tests/wasm/TypedArray.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; macro_rules! each { diff --git a/crates/js-sys/tests/wasm/WeakMap.rs b/crates/js-sys/tests/wasm/WeakMap.rs index 1eab1cb9d99..b308c05f478 100644 --- a/crates/js-sys/tests/wasm/WeakMap.rs +++ b/crates/js-sys/tests/wasm/WeakMap.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen] diff --git a/crates/js-sys/tests/wasm/WeakSet.rs b/crates/js-sys/tests/wasm/WeakSet.rs index 094038b5fc3..2e5d576d2a4 100644 --- a/crates/js-sys/tests/wasm/WeakSet.rs +++ b/crates/js-sys/tests/wasm/WeakSet.rs @@ -1,6 +1,5 @@ use js_sys::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen] diff --git a/crates/js-sys/tests/wasm/WebAssembly.rs b/crates/js-sys/tests/wasm/WebAssembly.rs index 8f9a5b6328a..8a9b6ce18ce 100644 --- a/crates/js-sys/tests/wasm/WebAssembly.rs +++ b/crates/js-sys/tests/wasm/WebAssembly.rs @@ -1,5 +1,5 @@ use js_sys::*; -use wasm_bindgen::{prelude::*, JsCast}; +use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; use web_sys::{Headers, Response, ResponseInit}; diff --git a/crates/test/src/rt/detect.rs b/crates/test/src/rt/detect.rs index eeb92455821..40cc23e84bf 100644 --- a/crates/test/src/rt/detect.rs +++ b/crates/test/src/rt/detect.rs @@ -1,7 +1,6 @@ //! Runtime detection of whether we're in node.js or a browser. use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; #[wasm_bindgen] extern "C" { diff --git a/crates/web-sys/tests/wasm/blob.rs b/crates/web-sys/tests/wasm/blob.rs index f4881a73294..726ffc715fe 100644 --- a/crates/web-sys/tests/wasm/blob.rs +++ b/crates/web-sys/tests/wasm/blob.rs @@ -1,6 +1,5 @@ use js_sys::{Array, ArrayBuffer}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; use web_sys::Blob; diff --git a/crates/web-sys/tests/wasm/event.rs b/crates/web-sys/tests/wasm/event.rs index 08d74ec83ad..4ffb48f167d 100644 --- a/crates/web-sys/tests/wasm/event.rs +++ b/crates/web-sys/tests/wasm/event.rs @@ -1,6 +1,5 @@ use js_sys::{Object, Promise}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; use web_sys::Event; diff --git a/crates/web-sys/tests/wasm/html_element.rs b/crates/web-sys/tests/wasm/html_element.rs index 7cf15cdd491..73157ceeee1 100644 --- a/crates/web-sys/tests/wasm/html_element.rs +++ b/crates/web-sys/tests/wasm/html_element.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; use web_sys::HtmlElement; diff --git a/crates/web-sys/tests/wasm/response.rs b/crates/web-sys/tests/wasm/response.rs index 1bedb6221fb..bd172797157 100644 --- a/crates/web-sys/tests/wasm/response.rs +++ b/crates/web-sys/tests/wasm/response.rs @@ -1,6 +1,5 @@ use js_sys::{ArrayBuffer, DataView, Object, Promise, Reflect, WebAssembly}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; use web_sys::{Headers, Response, ResponseInit}; diff --git a/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs b/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs index 5ebc0edc06c..38b30dd0bee 100644 --- a/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs +++ b/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs @@ -1,4 +1,4 @@ -use wasm_bindgen::{prelude::*, JsCast}; +use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_test::*; diff --git a/crates/webidl-tests/maplike.rs b/crates/webidl-tests/maplike.rs index 0a9fd10613a..758ed00a9b2 100644 --- a/crates/webidl-tests/maplike.rs +++ b/crates/webidl-tests/maplike.rs @@ -1,6 +1,5 @@ use crate::generated::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; macro_rules! read_test_suite { diff --git a/crates/webidl-tests/simple.rs b/crates/webidl-tests/simple.rs index 7f7c010ac35..793cf867b6a 100644 --- a/crates/webidl-tests/simple.rs +++ b/crates/webidl-tests/simple.rs @@ -1,7 +1,6 @@ use crate::generated::*; use js_sys::Object; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen_test] diff --git a/examples/canvas/src/lib.rs b/examples/canvas/src/lib.rs index 11340b30992..30891cce291 100644 --- a/examples/canvas/src/lib.rs +++ b/examples/canvas/src/lib.rs @@ -1,6 +1,5 @@ use std::f64; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; #[wasm_bindgen(start)] pub fn start() { diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index 1e6db003aa4..ec808d304d1 100644 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -1,6 +1,5 @@ use js_sys::{Array, Date}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{Document, Element, HtmlElement, Window}; #[wasm_bindgen(start)] diff --git a/examples/fetch/src/lib.rs b/examples/fetch/src/lib.rs index c90fde3add2..95af06e4c28 100644 --- a/examples/fetch/src/lib.rs +++ b/examples/fetch/src/lib.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use web_sys::{Request, RequestInit, RequestMode, Response}; diff --git a/examples/paint/src/lib.rs b/examples/paint/src/lib.rs index c4971412314..17853837e42 100644 --- a/examples/paint/src/lib.rs +++ b/examples/paint/src/lib.rs @@ -1,7 +1,6 @@ use std::cell::Cell; use std::rc::Rc; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; #[wasm_bindgen(start)] pub fn start() -> Result<(), JsValue> { diff --git a/examples/raytrace-parallel/src/lib.rs b/examples/raytrace-parallel/src/lib.rs index 84a0e9f3864..9cd27273418 100644 --- a/examples/raytrace-parallel/src/lib.rs +++ b/examples/raytrace-parallel/src/lib.rs @@ -2,7 +2,6 @@ use futures_channel::oneshot; use js_sys::{Promise, Uint8ClampedArray, WebAssembly}; use rayon::prelude::*; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; macro_rules! console_log { ($($t:tt)*) => (crate::log(&format_args!($($t)*).to_string())) diff --git a/examples/raytrace-parallel/src/pool.rs b/examples/raytrace-parallel/src/pool.rs index d47b1a8ac12..37ef4518c00 100644 --- a/examples/raytrace-parallel/src/pool.rs +++ b/examples/raytrace-parallel/src/pool.rs @@ -8,7 +8,6 @@ use std::cell::RefCell; use std::rc::Rc; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{DedicatedWorkerGlobalScope, MessageEvent}; use web_sys::{ErrorEvent, Event, Worker}; diff --git a/examples/request-animation-frame/src/lib.rs b/examples/request-animation-frame/src/lib.rs index cf787330dea..f8a3c68f72f 100644 --- a/examples/request-animation-frame/src/lib.rs +++ b/examples/request-animation-frame/src/lib.rs @@ -1,7 +1,6 @@ use std::cell::RefCell; use std::rc::Rc; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; fn window() -> web_sys::Window { web_sys::window().expect("no global `window` exists") diff --git a/examples/todomvc/src/element.rs b/examples/todomvc/src/element.rs index 4a4487759b0..619bf9b817b 100644 --- a/examples/todomvc/src/element.rs +++ b/examples/todomvc/src/element.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::EventTarget; /// Wrapper for `web_sys::Element` to simplify calling different interfaces diff --git a/examples/todomvc/src/view.rs b/examples/todomvc/src/view.rs index 52f5060cf0e..c307c0aea5b 100644 --- a/examples/todomvc/src/view.rs +++ b/examples/todomvc/src/view.rs @@ -5,7 +5,6 @@ use crate::store::ItemList; use crate::{Message, Scheduler}; use std::cell::RefCell; use std::rc::Rc; -use wasm_bindgen::JsCast; use crate::template::Template; diff --git a/examples/wasm-in-wasm-imports/src/lib.rs b/examples/wasm-in-wasm-imports/src/lib.rs index 4b0f502f919..45f2cae5c06 100644 --- a/examples/wasm-in-wasm-imports/src/lib.rs +++ b/examples/wasm-in-wasm-imports/src/lib.rs @@ -1,6 +1,5 @@ use js_sys::{Function, Map, Object, Reflect, WebAssembly}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::{spawn_local, JsFuture}; #[wasm_bindgen] diff --git a/examples/wasm-in-wasm/src/lib.rs b/examples/wasm-in-wasm/src/lib.rs index 51decfedf0b..6923dfe692a 100644 --- a/examples/wasm-in-wasm/src/lib.rs +++ b/examples/wasm-in-wasm/src/lib.rs @@ -1,6 +1,5 @@ use js_sys::{Function, Object, Reflect, WebAssembly}; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::{spawn_local, JsFuture}; // lifted from the `console_log` example diff --git a/examples/wasm-in-web-worker/src/lib.rs b/examples/wasm-in-web-worker/src/lib.rs index a61ab173030..8f72d0a2e41 100644 --- a/examples/wasm-in-web-worker/src/lib.rs +++ b/examples/wasm-in-web-worker/src/lib.rs @@ -1,7 +1,6 @@ use std::cell::RefCell; use std::rc::Rc; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{console, HtmlElement, HtmlInputElement, MessageEvent, Worker}; /// A number evaluation struct diff --git a/examples/weather_report/src/lib.rs b/examples/weather_report/src/lib.rs index 52cfdc5e889..818fbedc4a9 100644 --- a/examples/weather_report/src/lib.rs +++ b/examples/weather_report/src/lib.rs @@ -8,7 +8,6 @@ use std::time::{Duration, UNIX_EPOCH}; use gloo::events::EventListener; use json::JsonValue; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::spawn_local; use web_sys::Document; use web_sys::Element; diff --git a/examples/webgl/src/lib.rs b/examples/webgl/src/lib.rs index 88fc5c9ef4a..d1d7a3c8c22 100644 --- a/examples/webgl/src/lib.rs +++ b/examples/webgl/src/lib.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{WebGl2RenderingContext, WebGlProgram, WebGlShader}; #[wasm_bindgen(start)] diff --git a/examples/webrtc_datachannel/src/lib.rs b/examples/webrtc_datachannel/src/lib.rs index 12423251868..0ddac87040c 100644 --- a/examples/webrtc_datachannel/src/lib.rs +++ b/examples/webrtc_datachannel/src/lib.rs @@ -1,6 +1,5 @@ use js_sys::Reflect; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use web_sys::{ MessageEvent, RtcDataChannelEvent, RtcPeerConnection, RtcPeerConnectionIceEvent, RtcSdpType, diff --git a/examples/websockets/src/lib.rs b/examples/websockets/src/lib.rs index 5caba9fe5ae..a78fb384651 100644 --- a/examples/websockets/src/lib.rs +++ b/examples/websockets/src/lib.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use web_sys::{ErrorEvent, MessageEvent, WebSocket}; macro_rules! console_log { diff --git a/examples/webxr/src/lib.rs b/examples/webxr/src/lib.rs index 5451e27d2ca..ff85a60376c 100644 --- a/examples/webxr/src/lib.rs +++ b/examples/webxr/src/lib.rs @@ -8,7 +8,6 @@ use std::cell::RefCell; use std::rc::Rc; use utils::set_panic_hook; use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_futures::future_to_promise; use web_sys::*; diff --git a/src/lib.rs b/src/lib.rs index 3f67c6296a5..50920321b37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,6 +50,7 @@ macro_rules! externs { /// use wasm_bindgen::prelude::*; /// ``` pub mod prelude { + pub use crate::JsCast; pub use crate::JsValue; pub use crate::UnwrapThrowExt; #[doc(hidden)] diff --git a/tests/wasm/api.rs b/tests/wasm/api.rs index c1c542d67ac..26da4fc9ab0 100644 --- a/tests/wasm/api.rs +++ b/tests/wasm/api.rs @@ -1,6 +1,5 @@ use js_sys::{Uint8Array, WebAssembly}; use wasm_bindgen::prelude::*; -use wasm_bindgen::{self, JsCast}; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/api.js")] diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index dc88b43ad59..e94ed242700 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -493,7 +493,6 @@ fn test_closure_returner() { type ClosureType = dyn FnMut() -> BadStruct; use js_sys::{Object, Reflect}; - use wasm_bindgen::JsCast; js_test_closure_returner(); diff --git a/tests/wasm/jscast.rs b/tests/wasm/jscast.rs index 1279634d2a8..45d0b862b65 100644 --- a/tests/wasm/jscast.rs +++ b/tests/wasm/jscast.rs @@ -1,5 +1,4 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::JsCast; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/jscast.js")] diff --git a/tests/wasm/simple.rs b/tests/wasm/simple.rs index 611b5320a8b..5f22b6ea93e 100644 --- a/tests/wasm/simple.rs +++ b/tests/wasm/simple.rs @@ -1,5 +1,5 @@ use wasm_bindgen::prelude::*; -use wasm_bindgen::{intern, unintern, JsCast}; +use wasm_bindgen::{intern, unintern}; use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/simple.js")] From d8b280238f49008c8addde53a8efb9ec5a37a033 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 4 Jan 2023 02:44:40 +1100 Subject: [PATCH 132/641] wasm-bindgen-webidl: only invoke `rustfmt` once (#3220) This significantly reduces how long it takes to run, from ~42s down to ~3s on my computer. --- crates/webidl/src/lib.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 55df0e63bd2..e8591b5a7ac 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -795,8 +795,6 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { let out_file_path = to.join(format!("gen_{}.rs", name)); fs::write(&out_file_path, &feature.code)?; - - rustfmt(&out_file_path, name)?; } let binding_file = features.keys().map(|name| { @@ -809,7 +807,12 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { fs::write(to.join("mod.rs"), binding_file)?; - rustfmt(&to.join("mod.rs"), "mod")?; + let to_format = features + .iter() + .map(|(name, _)| to.join(format!("gen_{}.rs", name))) + .chain([to.join("mod.rs")]); + + rustfmt(to_format)?; return if generate_features { let features = features @@ -846,16 +849,16 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { Ok(source) } - fn rustfmt(path: &PathBuf, name: &str) -> Result<()> { + fn rustfmt<'a>(paths: impl IntoIterator) -> Result<()> { // run rustfmt on the generated file - really handy for debugging let result = Command::new("rustfmt") .arg("--edition") .arg("2018") - .arg(&path) + .args(paths) .status() - .context(format!("rustfmt on file {}", name))?; + .context("rustfmt failed")?; - assert!(result.success(), "rustfmt on file {}", name); + assert!(result.success(), "rustfmt failed"); Ok(()) } From aa94557d4ceaa273df92a581736462eea385ce82 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 4 Jan 2023 02:59:36 +1100 Subject: [PATCH 133/641] webidl: track stability of individual interface & namespace members (#3214) Fixes #2560 It's possible for some members of an interface (or namespace) to be stable and others not, if a `partial interface` is defined in an unstable webidl file which adds to an interface defined in a stable file. This wasn't properly kept track of for all interface members before, most notebly for operations. This PR fixes that. --- .../features/gen_WebGl2RenderingContext.rs | 4 + .../features/gen_WebGlContextAttributes.rs | 4 + .../src/features/gen_WebGlRenderingContext.rs | 4 + crates/webidl/src/first_pass.rs | 114 +++++++++++++----- crates/webidl/src/generator.rs | 11 -- crates/webidl/src/lib.rs | 26 ++-- crates/webidl/src/util.rs | 20 ++- 7 files changed, 122 insertions(+), 61 deletions(-) diff --git a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs index 1b1ab491c13..10939857e6e 100644 --- a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs @@ -5980,12 +5980,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlProgram`*"] pub fn link_program(this: &WebGl2RenderingContext, program: &WebGlProgram); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = makeXRCompatible)] #[doc = "The `makeXRCompatible()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/makeXRCompatible)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn make_xr_compatible(this: &WebGl2RenderingContext) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = pixelStorei)] #[doc = "The `pixelStorei()` method."] diff --git a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs index 4be2298032d..2584339b90f 100644 --- a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs +++ b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs @@ -148,9 +148,13 @@ impl WebGlContextAttributes { let _ = r; self } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `xrCompatible` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn xr_compatible(&mut self, val: bool) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( diff --git a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs index 39777bbd283..ccf87315850 100644 --- a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs @@ -1599,12 +1599,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlProgram`, `WebGlRenderingContext`*"] pub fn link_program(this: &WebGlRenderingContext, program: &WebGlProgram); + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = makeXRCompatible)] #[doc = "The `makeXRCompatible()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/makeXRCompatible)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn make_xr_compatible(this: &WebGlRenderingContext) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = pixelStorei)] #[doc = "The `pixelStorei()` method."] diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index b2d3b226887..8d7cd22e5f9 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -79,6 +79,17 @@ pub(crate) struct AttributeInterfaceData<'src> { pub(crate) stability: ApiStability, } +pub(crate) struct ConstData<'src> { + pub(crate) definition: &'src ConstMember<'src>, + pub(crate) stability: ApiStability, +} + +#[derive(Clone)] +pub(crate) struct ConstNamespaceData<'src> { + pub(crate) definition: &'src ConstNamespaceMember<'src>, + pub(crate) stability: ApiStability, +} + /// We need to collect interface data during the first pass, to be used later. #[derive(Default)] pub(crate) struct InterfaceData<'src> { @@ -87,7 +98,7 @@ pub(crate) struct InterfaceData<'src> { pub(crate) has_interface: bool, pub(crate) deprecated: Option, pub(crate) attributes: Vec>, - pub(crate) consts: Vec<&'src ConstMember<'src>>, + pub(crate) consts: Vec>, pub(crate) operations: BTreeMap, OperationData<'src>>, pub(crate) superclass: Option<&'src str>, pub(crate) definition_attributes: Option<&'src ExtendedAttributeList<'src>>, @@ -115,13 +126,18 @@ pub(crate) struct MixinData<'src> { #[derive(Default)] pub(crate) struct NamespaceData<'src> { pub(crate) operations: BTreeMap, OperationData<'src>>, - pub(crate) consts: Vec<&'src ConstNamespaceMember<'src>>, + pub(crate) consts: Vec>, + pub(crate) stability: ApiStability, +} + +pub(crate) struct PartialDictionaryData<'src> { + pub(crate) definition: &'src PartialDictionaryDefinition<'src>, pub(crate) stability: ApiStability, } #[derive(Default)] pub(crate) struct DictionaryData<'src> { - pub(crate) partials: Vec<&'src PartialDictionaryDefinition<'src>>, + pub(crate) partials: Vec>, pub(crate) definition: Option<&'src DictionaryDefinition<'src>>, pub(crate) stability: ApiStability, } @@ -156,6 +172,7 @@ pub(crate) enum OperationId<'src> { pub(crate) struct OperationData<'src> { pub(crate) signatures: Vec>, pub(crate) is_static: bool, + pub(crate) stability: ApiStability, } #[derive(Clone, Debug)] @@ -224,7 +241,7 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::Definition<'src> { match self { Dictionary(dictionary) => dictionary.first_pass(record, stability), - PartialDictionary(dictionary) => dictionary.first_pass(record, ()), + PartialDictionary(dictionary) => dictionary.first_pass(record, stability), Enum(enum_) => enum_.first_pass(record, stability), IncludesStatement(includes) => includes.first_pass(record, ()), Interface(interface) => interface.first_pass(record, stability), @@ -260,8 +277,12 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::DictionaryDefinition<'src> } } -impl<'src> FirstPass<'src, ()> for weedle::PartialDictionaryDefinition<'src> { - fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> { +impl<'src> FirstPass<'src, ApiStability> for weedle::PartialDictionaryDefinition<'src> { + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + stability: ApiStability, + ) -> Result<()> { if util::is_chrome_only(&self.attributes) { return Ok(()); } @@ -271,7 +292,10 @@ impl<'src> FirstPass<'src, ()> for weedle::PartialDictionaryDefinition<'src> { .entry(self.identifier.0) .or_default() .partials - .push(self); + .push(PartialDictionaryData { + definition: self, + stability, + }); Ok(()) } @@ -335,6 +359,7 @@ fn first_pass_operation<'src, A: Into> + 'src>( ret: &weedle::types::ReturnType<'src>, attrs: &'src Option>, is_static: bool, + stability: ApiStability, ) { if util::is_chrome_only(attrs) { return; @@ -367,6 +392,7 @@ fn first_pass_operation<'src, A: Into> + 'src>( for id in ids { let op = operations.entry(*id).or_default(); op.is_static = is_static; + op.stability = stability; op.signatures.push(Signature { args: args.clone(), ret: ret.clone(), @@ -412,6 +438,7 @@ fn process_interface_attribute<'src>( self_name: &'src str, attr: &'src ExtendedAttribute<'src>, ) { + let stability = record.interfaces[self_name].stability; let ident = weedle::common::Identifier(self_name); let non_null = weedle::types::MayBeNull { type_: ident, @@ -432,6 +459,7 @@ fn process_interface_attribute<'src>( &return_ty, &None, false, + stability, ); } ExtendedAttribute::NoArgs(other) if (other.0).0 == "Constructor" => { @@ -444,6 +472,7 @@ fn process_interface_attribute<'src>( &return_ty, &None, false, + stability, ); } ExtendedAttribute::NamedArgList(list) if list.lhs_identifier.0 == "NamedConstructor" => { @@ -458,6 +487,7 @@ fn process_interface_attribute<'src>( &return_ty, &None, false, + stability, ); } _ => {} @@ -497,7 +527,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int ) -> Result<()> { match self { InterfaceMember::Attribute(attr) => attr.first_pass(record, ctx), - InterfaceMember::Operation(op) => op.first_pass(record, ctx.0), + InterfaceMember::Operation(op) => op.first_pass(record, ctx), InterfaceMember::Const(const_) => { if util::is_chrome_only(&const_.attributes) { return Ok(()); @@ -507,15 +537,18 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int .get_mut(ctx.0) .unwrap() .consts - .push(const_); + .push(ConstData { + definition: const_, + stability: ctx.1, + }); Ok(()) } - InterfaceMember::Constructor(constr) => constr.first_pass(record, ctx.0), + InterfaceMember::Constructor(constr) => constr.first_pass(record, ctx), InterfaceMember::Iterable(_iterable) => { log::warn!("Unsupported WebIDL iterable interface member: {:?}", self); Ok(()) } - InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx.0), + InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx), // TODO InterfaceMember::Stringifier(_) => { log::warn!( @@ -539,11 +572,13 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int } } -impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceMember<'src> { +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::OperationInterfaceMember<'src> +{ fn first_pass( &'src self, record: &mut FirstPassRecord<'src>, - self_name: &'src str, + (self_name, stability): (&'src str, ApiStability), ) -> Result<()> { let is_static = match self.modifier { Some(StringifierOrStatic::Stringifier(_)) => { @@ -572,16 +607,19 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceM &self.return_type, &self.attributes, is_static, + stability, ); Ok(()) } } -impl<'src> FirstPass<'src, &'src str> for weedle::interface::ConstructorInterfaceMember<'src> { +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::ConstructorInterfaceMember<'src> +{ fn first_pass( &'src self, record: &mut FirstPassRecord<'src>, - self_name: &'src str, + (self_name, stability): (&'src str, ApiStability), ) -> Result<()> { let ident = weedle::common::Identifier(self_name); let non_null = weedle::types::MayBeNull { @@ -602,17 +640,20 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::ConstructorInterfac &return_ty, &self.attributes, false, + stability, ); Ok(()) } } -impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMember<'src> { +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::MaplikeInterfaceMember<'src> +{ fn first_pass( &'src self, record: &mut FirstPassRecord<'src>, - self_name: &'src str, + (self_name, stability): (&'src str, ApiStability), ) -> Result<()> { let key_ty = &self.generics.body.0; let value_ty = &self.generics.body.2; @@ -656,7 +697,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem identifier: Identifier("size"), semi_colon: term!(;), }, - stability: ApiStability::Stable, + stability, }); // boolean has(K key); @@ -674,6 +715,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem )))), &None, false, + stability, ); // V? get(K key); @@ -686,6 +728,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem &opt_value_ret(), &None, false, + stability, ); // callback MapLikeForEachCallback = undefined (V value, K key); @@ -712,6 +755,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem &undefined_ret(), &THROWS_ATTR, false, + stability, ); // TODO: iterators could have stronger types by generating specialised interfaces for each @@ -735,6 +779,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem )))), &NEW_OBJECT_ATTR, false, + stability, ); // [NewObject] MapLikeIterator keys(); @@ -752,6 +797,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem )))), &NEW_OBJECT_ATTR, false, + stability, ); // [NewObject] MapLikeIterator values(); @@ -769,6 +815,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem )))), &NEW_OBJECT_ATTR, false, + stability, ); // add writeable interface if *not* readonly @@ -783,6 +830,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem &undefined_ret(), &None, false, + stability, ); // boolean delete(K key); @@ -800,6 +848,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem )))), &None, false, + stability, ); // TODO: `set` actually returns `this` but we don't have a way to express that just yet @@ -813,6 +862,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::MaplikeInterfaceMem &undefined_ret(), &None, false, + stability, ); } @@ -943,6 +993,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> &self.return_type, &self.attributes, false, + ctx.1, ); Ok(()) } @@ -1007,7 +1058,7 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::NamespaceDefinition<'src> { namespace.stability = stability; for member in &self.members.body { - member.first_pass(record, self.identifier.0)?; + member.first_pass(record, (self.identifier.0, stability))?; } Ok(()) @@ -1024,44 +1075,46 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::PartialNamespaceDefinition< return Ok(()); } - let namespace = record.namespaces.entry(self.identifier.0).or_default(); - namespace.stability = stability; - for member in &self.members.body { - member.first_pass(record, self.identifier.0)?; + member.first_pass(record, (self.identifier.0, stability))?; } Ok(()) } } -impl<'src> FirstPass<'src, &'src str> for weedle::namespace::NamespaceMember<'src> { +impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::namespace::NamespaceMember<'src> { fn first_pass( &'src self, record: &mut FirstPassRecord<'src>, - self_name: &'src str, + ctx: (&'src str, ApiStability), ) -> Result<()> { match self { weedle::namespace::NamespaceMember::Const(const_) => { record .namespaces - .get_mut(self_name) + .get_mut(ctx.0) .unwrap() .consts - .push(const_); + .push(ConstNamespaceData { + definition: const_, + stability: ctx.1, + }); Ok(()) } - weedle::namespace::NamespaceMember::Operation(op) => op.first_pass(record, self_name), + weedle::namespace::NamespaceMember::Operation(op) => op.first_pass(record, ctx), _ => Ok(()), } } } -impl<'src> FirstPass<'src, &'src str> for weedle::namespace::OperationNamespaceMember<'src> { +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::namespace::OperationNamespaceMember<'src> +{ fn first_pass( &'src self, record: &mut FirstPassRecord<'src>, - self_name: &'src str, + (self_name, stability): (&'src str, ApiStability), ) -> Result<()> { first_pass_operation( record, @@ -1072,6 +1125,7 @@ impl<'src> FirstPass<'src, &'src str> for weedle::namespace::OperationNamespaceM &self.return_type, &self.attributes, true, + stability, ); Ok(()) } diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index f5f10e0e022..e0efe77f9a4 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -710,15 +710,6 @@ impl Dictionary { } } - // The constructor is unstable if any of the fields are - let (unstable_ctor, unstable_ctor_docs) = match unstable { - true => (None, None), - false => { - let unstable = fields.iter().any(|f| f.unstable); - (maybe_unstable_attr(unstable), maybe_unstable_docs(unstable)) - } - }; - required_features.remove(&name.to_string()); let cfg_features = get_cfg_features(options, &required_features); @@ -756,11 +747,9 @@ impl Dictionary { #unstable_attr impl #name { - #unstable_ctor #cfg_features #ctor_doc_comment #unstable_docs - #unstable_ctor_docs pub fn new(#(#required_args),*) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index e8591b5a7ac..5bf88d95c2c 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -35,10 +35,10 @@ use quote::ToTokens; use sourcefile::SourceFile; use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::ffi::OsStr; -use std::fmt; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; +use std::{fmt, iter}; use wasm_bindgen_backend::util::rust_ident; use weedle::attribute::ExtendedAttributeList; use weedle::common::Identifier; @@ -335,8 +335,14 @@ impl<'src> FirstPassRecord<'src> { // > comprise their identifiers. let start = dst.len(); let members = definition.members.body.iter(); - let partials = dict_data.partials.iter().flat_map(|d| &d.members.body); - for member in members.chain(partials) { + let partials = dict_data.partials.iter().flat_map(|d| { + d.definition + .members + .body + .iter() + .zip(iter::repeat(unstable || d.stability.is_unstable())) + }); + for (member, unstable) in members.zip(iter::repeat(unstable)).chain(partials) { match self.dictionary_field(member, unstable, unstable_types) { Some(f) => dst.push(f), None => { @@ -442,7 +448,7 @@ impl<'src> FirstPassRecord<'src> { let mut functions = vec![]; for member in ns.consts.iter() { - self.append_ns_const(&mut consts, member, unstable); + self.append_ns_const(&mut consts, member.clone(), unstable); } for (id, data) in ns.operations.iter() { @@ -465,22 +471,22 @@ impl<'src> FirstPassRecord<'src> { fn append_ns_const( &self, consts: &mut Vec, - member: &'src weedle::namespace::ConstNamespaceMember<'src>, + member: first_pass::ConstNamespaceData<'src>, unstable: bool, ) { - let idl_type = member.const_type.to_idl_type(self); + let idl_type = member.definition.const_type.to_idl_type(self); let ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); - let js_name = member.identifier.0; + let js_name = member.definition.identifier.0; let name = rust_ident(shouty_snake_case_ident(js_name).as_str()); - let value = webidl_const_v_to_backend_const_v(&member.const_value); + let value = webidl_const_v_to_backend_const_v(&member.definition.const_value); consts.push(Const { name, js_name: js_name.to_string(), ty, value, - unstable, + unstable: unstable || member.stability.is_unstable(), }); } @@ -567,6 +573,8 @@ impl<'src> FirstPassRecord<'src> { let mut methods = vec![]; for member in data.consts.iter() { + let unstable = unstable || member.stability.is_unstable(); + let member = member.definition; self.append_interface_const(&mut consts, member, unstable); } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 1eca2ff9c8b..4e01d2a5f3c 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -437,15 +437,13 @@ impl<'src> FirstPassRecord<'src> { // Stable types can have methods that have unstable argument types. // If any of the arguments types are `unstable` then this method is downgraded // to be unstable. - let unstable_override = match unstable { - // only downgrade stable methods - false => signature - .orig - .args - .iter() - .any(|arg| is_type_unstable(arg.ty, unstable_types)), - true => true, - }; + let has_unstable_args = signature + .orig + .args + .iter() + .any(|arg| is_type_unstable(arg.ty, unstable_types)); + + let unstable = unstable || data.stability.is_unstable() || has_unstable_args; if let Some(arguments) = arguments { if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) { @@ -459,7 +457,7 @@ impl<'src> FirstPassRecord<'src> { structural, catch, variadic, - unstable: unstable_override, + unstable, }); } } @@ -490,7 +488,7 @@ impl<'src> FirstPassRecord<'src> { structural, catch, variadic: false, - unstable: unstable_override, + unstable, }); } } From 3c1f5a9e3ee197988ab9afe35d7244b751ad8cbb Mon Sep 17 00:00:00 2001 From: jneem Date: Fri, 6 Jan 2023 16:37:44 -0600 Subject: [PATCH 134/641] Add VideoFrame and OffscreenCanvas to CanvasImageSource. (#3225) * Add VideoFrame and OffscreenCanvas to CanvasImageSource. * Fix instability of the new methods. Now that we have union types where only some of the variants are unstable, the instability checker has to check the specialized argument types of a method instead of just the original ones. --- .../features/gen_CanvasRenderingContext2d.rs | 134 ++++++++++++++++++ crates/web-sys/src/features/gen_VideoFrame.rs | 53 +++++++ crates/web-sys/src/features/gen_Window.rs | 60 ++++++++ .../src/features/gen_WorkerGlobalScope.rs | 60 ++++++++ .../enabled/CanvasRenderingContext2D.webidl | 4 +- .../webidls/enabled/ImageBitmap.webidl | 2 + crates/webidl/src/util.rs | 13 +- 7 files changed, 324 insertions(+), 2 deletions(-) diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index 3f353b91177..886090b1d11 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -372,6 +372,36 @@ extern "C" { dx: f64, dy: f64, ) -> Result<(), JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `OffscreenCanvas`*"] + pub fn draw_image_with_offscreen_canvas( + this: &CanvasRenderingContext2d, + image: &OffscreenCanvas, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame( + this: &CanvasRenderingContext2d, + image: &VideoFrame, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] #[doc = "The `drawImage()` method."] @@ -447,6 +477,40 @@ extern "C" { dw: f64, dh: f64, ) -> Result<(), JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `OffscreenCanvas`*"] + pub fn draw_image_with_offscreen_canvas_and_dw_and_dh( + this: &CanvasRenderingContext2d, + image: &OffscreenCanvas, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame_and_dw_and_dh( + this: &CanvasRenderingContext2d, + image: &VideoFrame, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] #[doc = "The `drawImage()` method."] @@ -542,6 +606,48 @@ extern "C" { dw: f64, dh: f64, ) -> Result<(), JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `OffscreenCanvas`*"] + pub fn draw_image_with_offscreen_canvas_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &CanvasRenderingContext2d, + image: &OffscreenCanvas, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &CanvasRenderingContext2d, + image: &VideoFrame, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = beginPath)] #[doc = "The `beginPath()` method."] #[doc = ""] @@ -782,6 +888,34 @@ extern "C" { image: &ImageBitmap, repetition: &str, ) -> Result, JsValue>; + #[cfg(all(feature = "CanvasPattern", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`, `OffscreenCanvas`*"] + pub fn create_pattern_with_offscreen_canvas( + this: &CanvasRenderingContext2d, + image: &OffscreenCanvas, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_video_frame( + this: &CanvasRenderingContext2d, + image: &VideoFrame, + repetition: &str, + ) -> Result, JsValue>; #[cfg(feature = "CanvasGradient")] # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = createRadialGradient)] #[doc = "The `createRadialGradient()` method."] diff --git a/crates/web-sys/src/features/gen_VideoFrame.rs b/crates/web-sys/src/features/gen_VideoFrame.rs index b0f29df7644..bed84f2ed83 100644 --- a/crates/web-sys/src/features/gen_VideoFrame.rs +++ b/crates/web-sys/src/features/gen_VideoFrame.rs @@ -190,6 +190,29 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new_with_image_bitmap(image: &ImageBitmap) -> Result; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OffscreenCanvas")] + #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] + #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_offscreen_canvas(image: &OffscreenCanvas) -> Result; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] + #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_video_frame(image: &VideoFrame) -> Result; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "HtmlImageElement", feature = "VideoFrameInit",))] #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] @@ -265,6 +288,36 @@ extern "C" { init: &VideoFrameInit, ) -> Result; #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "OffscreenCanvas", feature = "VideoFrameInit",))] + #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] + #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `VideoFrame`, `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_offscreen_canvas_and_video_frame_init( + image: &OffscreenCanvas, + init: &VideoFrameInit, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrameInit")] + #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] + #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_video_frame_and_video_frame_init( + image: &VideoFrame, + init: &VideoFrameInit, + ) -> Result; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrameBufferInit")] #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 5b9a7512f2d..b5313565d2c 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -2412,6 +2412,32 @@ extern "C" { this: &Window, a_image: &ImageBitmap, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas( + this: &Window, + a_image: &OffscreenCanvas, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame( + this: &Window, + a_image: &VideoFrame, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] @@ -2537,6 +2563,40 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + this: &Window, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + this: &Window, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index 3f51a6d0cf9..6596aa9d56b 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -335,6 +335,32 @@ extern "C" { this: &WorkerGlobalScope, a_image: &ImageBitmap, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] @@ -460,6 +486,40 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl index 143f202572b..476a968827d 100644 --- a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl +++ b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl @@ -32,7 +32,9 @@ typedef (HTMLImageElement or typedef (HTMLOrSVGImageElement or HTMLCanvasElement or HTMLVideoElement or - ImageBitmap) CanvasImageSource; + ImageBitmap or + OffscreenCanvas or + VideoFrame) CanvasImageSource; interface CanvasRenderingContext2D { diff --git a/crates/web-sys/webidls/enabled/ImageBitmap.webidl b/crates/web-sys/webidls/enabled/ImageBitmap.webidl index 585a19abb56..314f6b7d28e 100644 --- a/crates/web-sys/webidls/enabled/ImageBitmap.webidl +++ b/crates/web-sys/webidls/enabled/ImageBitmap.webidl @@ -28,6 +28,8 @@ typedef (HTMLImageElement or ImageData or CanvasRenderingContext2D or ImageBitmap or + OffscreenCanvas or + VideoFrame or BufferSource) ImageBitmapSource; [Exposed=(Window,Worker)] diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 4e01d2a5f3c..c738de8292f 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -441,7 +441,11 @@ impl<'src> FirstPassRecord<'src> { .orig .args .iter() - .any(|arg| is_type_unstable(arg.ty, unstable_types)); + .any(|arg| is_type_unstable(arg.ty, unstable_types)) + | signature + .args + .iter() + .any(|arg| is_idl_type_unstable(arg, unstable_types)); let unstable = unstable || data.stability.is_unstable() || has_unstable_args; @@ -532,6 +536,13 @@ pub fn is_type_unstable(ty: &weedle::types::Type, unstable_types: &HashSet) -> bool { + match ty { + IdlType::Interface(name) => unstable_types.contains(&Identifier(name)), + _ => false, + } +} + /// Search for an attribute by name in some webidl object's attributes. fn has_named_attribute(list: Option<&ExtendedAttributeList>, attribute: &str) -> bool { let list = match list { From 8f4c4d8622c92bceef4b4fc25ba74a9e8ada2fd2 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 13 Jan 2023 06:12:47 +1100 Subject: [PATCH 135/641] BREAKING(web-sys): Remove support for `CanvasRenderingContext2D` and `BufferSource` from `createImageBitmap` (#3231) Resolves #3227 Both APIs are broken, to some extent, which is why I think it makes sense to remove them despite the potential breakage. Calling `createImageBitmap` with a `BufferSource` will instantly throw an error, and calling it with a `CanvasRenderingContext2D` will also fail except in Firefox, where it gives a deprecation warning. `BufferSource` was there as part of the abandoned video capture worker API (https://w3c.github.io/mediacapture-worker). It looks like we inherited it from Firefox, which supported it behind a flag at the time we copied our WebIDL from it but later removed it. I also removed the rest of that API while I was at it. `CanvasRenderingContext2D` is there because, for whatever reason, Firefox non-standardly accepts it in `createImageBitmap`, and we took our WebIDL from them. It's deprecated, and https://bugzilla.mozilla.org/show_bug.cgi?id=1500782 talks about removing it, but it hasn't been done yet. --- .../src/features/gen_ChannelPixelLayout.rs | 122 ------ .../gen_ChannelPixelLayoutDataType.rs | 17 - .../web-sys/src/features/gen_ImageBitmap.rs | 56 --- .../src/features/gen_ImageBitmapFormat.rs | 22 - crates/web-sys/src/features/gen_Window.rs | 112 ++--- .../src/features/gen_WorkerGlobalScope.rs | 112 ++--- crates/web-sys/src/features/mod.rs | 18 - .../webidls/enabled/ImageBitmap.webidl | 386 +----------------- 8 files changed, 66 insertions(+), 779 deletions(-) delete mode 100644 crates/web-sys/src/features/gen_ChannelPixelLayout.rs delete mode 100644 crates/web-sys/src/features/gen_ChannelPixelLayoutDataType.rs delete mode 100644 crates/web-sys/src/features/gen_ImageBitmapFormat.rs diff --git a/crates/web-sys/src/features/gen_ChannelPixelLayout.rs b/crates/web-sys/src/features/gen_ChannelPixelLayout.rs deleted file mode 100644 index ac5623667bb..00000000000 --- a/crates/web-sys/src/features/gen_ChannelPixelLayout.rs +++ /dev/null @@ -1,122 +0,0 @@ -#![allow(unused_imports)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ChannelPixelLayout)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `ChannelPixelLayout` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub type ChannelPixelLayout; -} -impl ChannelPixelLayout { - #[cfg(feature = "ChannelPixelLayoutDataType")] - #[doc = "Construct a new `ChannelPixelLayout`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`, `ChannelPixelLayoutDataType`*"] - pub fn new( - data_type: ChannelPixelLayoutDataType, - height: u32, - offset: u32, - skip: u32, - stride: u32, - width: u32, - ) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data_type(data_type); - ret.height(height); - ret.offset(offset); - ret.skip(skip); - ret.stride(stride); - ret.width(width); - ret - } - #[cfg(feature = "ChannelPixelLayoutDataType")] - #[doc = "Change the `dataType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`, `ChannelPixelLayoutDataType`*"] - pub fn data_type(&mut self, val: ChannelPixelLayoutDataType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub fn height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub fn offset(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `skip` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub fn skip(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("skip"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `stride` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub fn stride(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stride"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"] - pub fn width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; - self - } -} diff --git a/crates/web-sys/src/features/gen_ChannelPixelLayoutDataType.rs b/crates/web-sys/src/features/gen_ChannelPixelLayoutDataType.rs deleted file mode 100644 index d9ddd58742a..00000000000 --- a/crates/web-sys/src/features/gen_ChannelPixelLayoutDataType.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(unused_imports)] -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -#[doc = "The `ChannelPixelLayoutDataType` enum."] -#[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayoutDataType`*"] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ChannelPixelLayoutDataType { - Uint8 = "uint8", - Int8 = "int8", - Uint16 = "uint16", - Int16 = "int16", - Uint32 = "uint32", - Int32 = "int32", - Float32 = "float32", - Float64 = "float64", -} diff --git a/crates/web-sys/src/features/gen_ImageBitmap.rs b/crates/web-sys/src/features/gen_ImageBitmap.rs index c400d2f813d..7d73db26d78 100644 --- a/crates/web-sys/src/features/gen_ImageBitmap.rs +++ b/crates/web-sys/src/features/gen_ImageBitmap.rs @@ -32,60 +32,4 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`*"] pub fn close(this: &ImageBitmap); - #[cfg(feature = "ImageBitmapFormat")] - # [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = findOptimalFormat)] - #[doc = "The `findOptimalFormat()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/findOptimalFormat)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"] - pub fn find_optimal_format(this: &ImageBitmap) -> Result; - #[cfg(feature = "ImageBitmapFormat")] - # [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = findOptimalFormat)] - #[doc = "The `findOptimalFormat()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/findOptimalFormat)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"] - pub fn find_optimal_format_with_a_possible_formats( - this: &ImageBitmap, - a_possible_formats: &::wasm_bindgen::JsValue, - ) -> Result; - #[cfg(feature = "ImageBitmapFormat")] - # [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mapDataInto)] - #[doc = "The `mapDataInto()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mapDataInto)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"] - pub fn map_data_into_with_buffer_source( - this: &ImageBitmap, - a_format: ImageBitmapFormat, - a_buffer: &::js_sys::Object, - a_offset: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageBitmapFormat")] - # [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mapDataInto)] - #[doc = "The `mapDataInto()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mapDataInto)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"] - pub fn map_data_into_with_u8_array( - this: &ImageBitmap, - a_format: ImageBitmapFormat, - a_buffer: &mut [u8], - a_offset: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageBitmapFormat")] - # [wasm_bindgen (catch , method , structural , js_class = "ImageBitmap" , js_name = mappedDataLength)] - #[doc = "The `mappedDataLength()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap/mappedDataLength)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapFormat`*"] - pub fn mapped_data_length( - this: &ImageBitmap, - a_format: ImageBitmapFormat, - ) -> Result; } diff --git a/crates/web-sys/src/features/gen_ImageBitmapFormat.rs b/crates/web-sys/src/features/gen_ImageBitmapFormat.rs deleted file mode 100644 index e3d63c57376..00000000000 --- a/crates/web-sys/src/features/gen_ImageBitmapFormat.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![allow(unused_imports)] -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -#[doc = "The `ImageBitmapFormat` enum."] -#[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `ImageBitmapFormat`*"] -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ImageBitmapFormat { - Rgba32 = "RGBA32", - Bgra32 = "BGRA32", - Rgb24 = "RGB24", - Bgr24 = "BGR24", - Gray8 = "GRAY8", - Yuv444p = "YUV444P", - Yuv422p = "YUV422P", - Yuv420p = "YUV420P", - Yuv420spNv12 = "YUV420SP_NV12", - Yuv420spNv21 = "YUV420SP_NV21", - Hsv = "HSV", - Lab = "Lab", - Depth = "DEPTH", -} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index b5313565d2c..3d6d1ec099e 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -2346,16 +2346,16 @@ extern "C" { this: &Window, a_image: &HtmlImageElement, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "HtmlVideoElement")] + #[cfg(feature = "SvgImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `Window`*"] - pub fn create_image_bitmap_with_html_video_element( + #[doc = "*This API requires the following crate features to be activated: `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element( this: &Window, - a_image: &HtmlVideoElement, + a_image: &SvgImageElement, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlCanvasElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] @@ -2368,38 +2368,16 @@ extern "C" { this: &Window, a_image: &HtmlCanvasElement, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "Blob")] - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Blob`, `Window`*"] - pub fn create_image_bitmap_with_blob( - this: &Window, - a_image: &Blob, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageData")] - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageData`, `Window`*"] - pub fn create_image_bitmap_with_image_data( - this: &Window, - a_image: &ImageData, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "CanvasRenderingContext2d")] + #[cfg(feature = "HtmlVideoElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `Window`*"] - pub fn create_image_bitmap_with_canvas_rendering_context_2d( + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element( this: &Window, - a_image: &CanvasRenderingContext2d, + a_image: &HtmlVideoElement, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] @@ -2438,25 +2416,27 @@ extern "C" { this: &Window, a_image: &VideoFrame, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn create_image_bitmap_with_buffer_source( + #[doc = "*This API requires the following crate features to be activated: `Blob`, `Window`*"] + pub fn create_image_bitmap_with_blob( this: &Window, - a_image: &::js_sys::Object, + a_image: &Blob, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "ImageData")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn create_image_bitmap_with_u8_array( + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data( this: &Window, - a_image: &mut [u8], + a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] @@ -2473,16 +2453,16 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "HtmlVideoElement")] + #[cfg(feature = "SvgImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `Window`*"] - pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &Window, - a_image: &HtmlVideoElement, + a_image: &SvgImageElement, a_sx: i32, a_sy: i32, a_sw: i32, @@ -2503,46 +2483,16 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "Blob")] - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Blob`, `Window`*"] - pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh( - this: &Window, - a_image: &Blob, - a_sx: i32, - a_sy: i32, - a_sw: i32, - a_sh: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageData")] - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageData`, `Window`*"] - pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh( - this: &Window, - a_image: &ImageData, - a_sx: i32, - a_sy: i32, - a_sw: i32, - a_sh: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "CanvasRenderingContext2d")] + #[cfg(feature = "HtmlVideoElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `Window`*"] - pub fn create_image_bitmap_with_canvas_rendering_context_2d_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &Window, - a_image: &CanvasRenderingContext2d, + a_image: &HtmlVideoElement, a_sx: i32, a_sy: i32, a_sw: i32, @@ -2597,29 +2547,31 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn create_image_bitmap_with_buffer_source_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `Blob`, `Window`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &Window, - a_image: &::js_sys::Object, + a_image: &Blob, a_sx: i32, a_sy: i32, a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "ImageData")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn create_image_bitmap_with_u8_array_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &Window, - a_image: &mut [u8], + a_image: &ImageData, a_sx: i32, a_sy: i32, a_sw: i32, diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index 6596aa9d56b..353e8207318 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -269,16 +269,16 @@ extern "C" { this: &WorkerGlobalScope, a_image: &HtmlImageElement, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "HtmlVideoElement")] + #[cfg(feature = "SvgImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_html_video_element( + #[doc = "*This API requires the following crate features to be activated: `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element( this: &WorkerGlobalScope, - a_image: &HtmlVideoElement, + a_image: &SvgImageElement, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlCanvasElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] @@ -291,38 +291,16 @@ extern "C" { this: &WorkerGlobalScope, a_image: &HtmlCanvasElement, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "Blob")] - # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Blob`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_blob( - this: &WorkerGlobalScope, - a_image: &Blob, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageData")] - # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageData`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_image_data( - this: &WorkerGlobalScope, - a_image: &ImageData, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "CanvasRenderingContext2d")] + #[cfg(feature = "HtmlVideoElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_canvas_rendering_context_2d( + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element( this: &WorkerGlobalScope, - a_image: &CanvasRenderingContext2d, + a_image: &HtmlVideoElement, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] @@ -361,25 +339,27 @@ extern "C" { this: &WorkerGlobalScope, a_image: &VideoFrame, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_buffer_source( + #[doc = "*This API requires the following crate features to be activated: `Blob`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob( this: &WorkerGlobalScope, - a_image: &::js_sys::Object, + a_image: &Blob, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "ImageData")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_u8_array( + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data( this: &WorkerGlobalScope, - a_image: &mut [u8], + a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] @@ -396,16 +376,16 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "HtmlVideoElement")] + #[cfg(feature = "SvgImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &WorkerGlobalScope, - a_image: &HtmlVideoElement, + a_image: &SvgImageElement, a_sx: i32, a_sy: i32, a_sw: i32, @@ -426,46 +406,16 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "Blob")] - # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Blob`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh( - this: &WorkerGlobalScope, - a_image: &Blob, - a_sx: i32, - a_sy: i32, - a_sw: i32, - a_sh: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "ImageData")] - # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] - #[doc = "The `createImageBitmap()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageData`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh( - this: &WorkerGlobalScope, - a_image: &ImageData, - a_sx: i32, - a_sy: i32, - a_sw: i32, - a_sh: i32, - ) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "CanvasRenderingContext2d")] + #[cfg(feature = "HtmlVideoElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_canvas_rendering_context_2d_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &WorkerGlobalScope, - a_image: &CanvasRenderingContext2d, + a_image: &HtmlVideoElement, a_sx: i32, a_sy: i32, a_sw: i32, @@ -520,29 +470,31 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_buffer_source_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `Blob`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &WorkerGlobalScope, - a_image: &::js_sys::Object, + a_image: &Blob, a_sx: i32, a_sy: i32, a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "ImageData")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn create_image_bitmap_with_u8_array_and_a_sx_and_a_sy_and_a_sw_and_a_sh( + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh( this: &WorkerGlobalScope, - a_image: &mut [u8], + a_image: &ImageData, a_sx: i32, a_sy: i32, a_sw: i32, diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 968525fa680..6ee7c1fa0f0 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -832,18 +832,6 @@ mod gen_ChannelMergerOptions; #[cfg(feature = "ChannelMergerOptions")] pub use gen_ChannelMergerOptions::*; -#[cfg(feature = "ChannelPixelLayout")] -#[allow(non_snake_case)] -mod gen_ChannelPixelLayout; -#[cfg(feature = "ChannelPixelLayout")] -pub use gen_ChannelPixelLayout::*; - -#[cfg(feature = "ChannelPixelLayoutDataType")] -#[allow(non_snake_case)] -mod gen_ChannelPixelLayoutDataType; -#[cfg(feature = "ChannelPixelLayoutDataType")] -pub use gen_ChannelPixelLayoutDataType::*; - #[cfg(feature = "ChannelSplitterNode")] #[allow(non_snake_case)] mod gen_ChannelSplitterNode; @@ -3958,12 +3946,6 @@ mod gen_ImageBitmap; #[cfg(feature = "ImageBitmap")] pub use gen_ImageBitmap::*; -#[cfg(feature = "ImageBitmapFormat")] -#[allow(non_snake_case)] -mod gen_ImageBitmapFormat; -#[cfg(feature = "ImageBitmapFormat")] -pub use gen_ImageBitmapFormat::*; - #[cfg(feature = "ImageBitmapRenderingContext")] #[allow(non_snake_case)] mod gen_ImageBitmapRenderingContext; diff --git a/crates/web-sys/webidls/enabled/ImageBitmap.webidl b/crates/web-sys/webidls/enabled/ImageBitmap.webidl index 314f6b7d28e..02fc0a66e1e 100644 --- a/crates/web-sys/webidls/enabled/ImageBitmap.webidl +++ b/crates/web-sys/webidls/enabled/ImageBitmap.webidl @@ -5,32 +5,11 @@ * * The origin of this IDL file is * https://html.spec.whatwg.org/multipage/webappapis.html#images - * - * The origin of the extended IDL file is - * http://w3c.github.io/mediacapture-worker/#imagebitmap-extensions */ -// Extensions -// Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its -// underlying image data -// -// Note: -// Our overload resolution implementation doesn't deal with a union as the -// distinguishing argument which means we cannot overload functions via union -// types, a.k.a. we cannot overload createImageBitmap() via ImageBitmapSource -// and BufferSource. Here, we work around this issue by adding the BufferSource -// into ImageBitmapSource. - -typedef (HTMLImageElement or - HTMLVideoElement or - HTMLCanvasElement or +typedef (CanvasImageSource or Blob or - ImageData or - CanvasRenderingContext2D or - ImageBitmap or - OffscreenCanvas or - VideoFrame or - BufferSource) ImageBitmapSource; + ImageData) ImageBitmapSource; [Exposed=(Window,Worker)] interface ImageBitmap { @@ -51,364 +30,3 @@ partial interface ImageBitmap { // Dispose of all graphical resources associated with this ImageBitmap. undefined close(); }; - -// ImageBitmap-extensions -// Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its -// underlying image data - -/* - * An image or a video frame is conceptually a two-dimensional array of data and - * each element in the array is called a pixel. The pixels are usually stored in - * a one-dimensional array and could be arranged in a variety of image formats. - * Developers need to know how the pixels are formatted so that they are able to - * process them. - * - * The image format describes how pixels in an image are arranged. A single - * pixel has at least one, but usually multiple pixel values. The range of a - * pixel value varies, which means different image formats use different data - * types to store a single pixel value. - * - * The most frequently used data type is 8-bit unsigned integer whose range is - * from 0 to 255, others could be 16-bit integer or 32-bit floating points and - * so forth. The number of pixel values of a single pixel is called the number - * of channels of the image format. Multiple pixel values of a pixel are used - * together to describe the captured property which could be color or depth - * information. For example, if the data is a color image in RGB color space, - * then it is a three-channel image format and a pixel is described by R, G and - * B three pixel values with range from 0 to 255. As another example, if the - * data is a gray image, then it is a single-channel image format with 8-bit - * unsigned integer data type and the pixel value describes the gray scale. For - * depth data, it is a single channel image format too, but the data type is - * 16-bit unsigned integer and the pixel value is the depth level. - * - * For those image formats whose pixels contain multiple pixel values, the pixel - * values might be arranged in one of the following ways: - * 1) Planar pixel layout: - * each channel has its pixel values stored consecutively in separated - * buffers (a.k.a. planes) and then all channel buffers are stored - * consecutively in memory. - * (Ex: RRRRRR......GGGGGG......BBBBBB......) - * 2) Interleaving pixel layout: - * each pixel has its pixel values from all channels stored together and - * interleaves all channels. - * (Ex: RGBRGBRGBRGBRGB......) - */ - - -/* - * The ImageBitmap extensions use this enumeration to negotiate the image format - * while 1) accessing the underlying data of an ImageBitmap and - * 2) creating a new ImageBitmap. - * - * For each format in this enumeration, we use a 2x2 small image (4 pixels) as - * example to illustrate the pixel layout. - * - * 2x2 image: +--------+--------+ - * | pixel1 | pixel2 | - * +--------+--------+ - * | pixel3 | pixel4 | - * +--------+--------+ - * - */ -enum ImageBitmapFormat { - /* - * Channel order: R, G, B, A - * Channel size: full rgba-chennels - * Pixel layout: interleaving rgba-channels - * Pixel layout illustration: - * [Plane1]: R1 G1 B1 A1 R2 G2 B2 A2 R3 G3 B3 A3 R4 G4 B4 A4 - * Data type: 8-bit unsigned integer - */ - "RGBA32", - - /* - * Channel order: B, G, R, A - * Channel size: full bgra-channels - * Pixel layout: interleaving bgra-channels - * Pixel layout illustration: - * [Plane1]: B1 G1 R1 A1 B2 G2 R2 A2 B3 G3 R3 A3 B4 G4 R4 A4 - * Data type: 8-bit unsigned integer - */ - "BGRA32", - - /* - * Channel order: R, G, B - * Channel size: full rgb-channels - * Pixel layout: interleaving rgb-channels - * Pixel layout illustration: - * [Plane1]: R1 G1 B1 R2 G2 B2 R3 G3 B3 R4 G4 B4 - * Data type: 8-bit unsigned integer - */ - "RGB24", - - /* - * Channel order: B, G, R - * Channel size: full bgr-channels - * Pixel layout: interleaving bgr-channels - * Pixel layout illustration: - * [Plane1]: B1 G1 R1 B2 G2 R2 B3 G3 R3 B4 G4 R4 - * Data type: 8-bit unsigned integer - */ - "BGR24", - - /* - * Channel order: GRAY - * Channel size: full gray-channel - * Pixel layout: planar gray-channel - * Pixel layout illustration: - * [Plane1]: GRAY1 GRAY2 GRAY3 GRAY4 - * Data type: 8-bit unsigned integer - */ - "GRAY8", - - /* - * Channel order: Y, U, V - * Channel size: full yuv-channels - * Pixel layout: planar yuv-channels - * Pixel layout illustration: - * [Plane1]: Y1 Y2 Y3 Y4 - * [Plane2]: U1 U2 U3 U4 - * [Plane3]: V1 V2 V3 V4 - * Data type: 8-bit unsigned integer - */ - "YUV444P", - - /* - * Channel order: Y, U, V - * Channel size: full y-channel, half uv-channels - * Pixel layout: planar yuv-channels - * Pixel layout illustration: - * [Plane1]: Y1 Y2 Y3 Y4 - * [Plane2]: U1 U3 - * [Plane3]: V1 V3 - * Data type: 8-bit unsigned integer - */ - "YUV422P", - - /* - * Channel order: Y, U, V - * Channel size: full y-channel, quarter uv-channels - * Pixel layout: planar yuv-channels - * Pixel layout illustration: - * [Plane1]: Y1 Y2 Y3 Y4 - * [Plane2]: U1 - * [Plane3]: V1 - * Data type: 8-bit unsigned integer - */ - "YUV420P", - - /* - * Channel order: Y, U, V - * Channel size: full y-channel, quarter uv-channels - * Pixel layout: planar y-channel, interleaving uv-channels - * Pixel layout illustration: - * [Plane1]: Y1 Y2 Y3 Y4 - * [Plane2]: U1 V1 - * Data type: 8-bit unsigned integer - */ - "YUV420SP_NV12", - - /* - * Channel order: Y, V, U - * Channel size: full y-channel, quarter vu-channels - * Pixel layout: planar y-channel, interleaving vu-channels - * Pixel layout illustration: - * [Plane1]: Y1 Y2 Y3 Y4 - * [Plane2]: V1 U1 - * Data type: 8-bit unsigned integer - */ - "YUV420SP_NV21", - - /* - * Channel order: H, S, V - * Channel size: full hsv-channels - * Pixel layout: interleaving hsv-channels - * Pixel layout illustration: - * [Plane1]: H1 S1 V1 H2 S2 V2 H3 S3 V3 - * Data type: 32-bit floating point value - */ - "HSV", - - /* - * Channel order: l, a, b - * Channel size: full lab-channels - * Pixel layout: interleaving lab-channels - * Pixel layout illustration: - * [Plane1]: l1 a1 b1 l2 a2 b2 l3 a3 b3 - * Data type: 32-bit floating point value - */ - "Lab", - - /* - * Channel order: DEPTH - * Channel size: full depth-channel - * Pixel layout: planar depth-channel - * Pixel layout illustration: - * [Plane1]: DEPTH1 DEPTH2 DEPTH3 DEPTH4 - * Data type: 16-bit unsigned integer - */ - "DEPTH", -}; - -enum ChannelPixelLayoutDataType { - "uint8", - "int8", - "uint16", - "int16", - "uint32", - "int32", - "float32", - "float64" -}; - -/* - * Two concepts, ImagePixelLayout and ChannelPixelLayout, together generalize - * the variety of pixel layouts among image formats. - * - * The ChannelPixelLayout represents the pixel layout of a single channel in a - * certain image format and the ImagePixelLayout is just the collection of - * ChannelPixelLayouts. So, the ChannelPixelLayout is defined as a dictionary - * type with properties to describe the layout and the ImagePixelLayout is just - * an alias name to a sequence of ChannelPixelLayout objects. - * - * Since an image format is composed of at least one channel, an - * ImagePixelLayout object contains at least one ChannelPixelLayout object. - * - * Although an image or a video frame is a two-dimensional structure, its data - * is usually stored in a one-dimensional array in the row-major way and the - * ChannelPixelLayout objects use the following properties to describe the - * layout of pixel values in the buffer. - * - * 1) offset: - * denotes the beginning position of the channel's data relative to the - * beginning position of the one-dimensional array. - * 2) width & height: - * denote the width and height of the channel respectively. Each channel in - * an image format may have different height and width. - * 3) data type: - * denotes the format used to store one single pixel value. - * 4) stride: - * the number of bytes between the beginning two consecutive rows in memory. - * (The total bytes of each row plus the padding bytes of each raw.) - * 5) skip value: - * the value is zero for the planar pixel layout, and a positive integer for - * the interleaving pixel layout. (Describes how many bytes there are between - * two adjacent pixel values in this channel.) - */ - -/* - * Example1: RGBA image, width = 620, height = 480, stride = 2560 - * - * chanel_r: offset = 0, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 - * chanel_g: offset = 1, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 - * chanel_b: offset = 2, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 - * chanel_a: offset = 3, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 - * - * <---------------------------- stride ----------------------------> - * <---------------------- width x 4 ----------------------> - * [index] 01234 8 12 16 20 24 28 2479 2559 - * |||||---|---|---|---|---|---|----------------------------|-------| - * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% - * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% - * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% - * ^^^ - * r-skip - */ - -/* - * Example2: YUV420P image, width = 620, height = 480, stride = 640 - * - * chanel_y: offset = 0, width = 620, height = 480, stride = 640, skip = 0 - * chanel_u: offset = 307200, width = 310, height = 240, data type = uint8, stride = 320, skip = 0 - * chanel_v: offset = 384000, width = 310, height = 240, data type = uint8, stride = 320, skip = 0 - * - * <--------------------------- y-stride ---------------------------> - * <----------------------- y-width -----------------------> - * [index] 012345 619 639 - * ||||||--------------------------------------------------|--------| - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] ...... - * <-------- u-stride ----------> - * <----- u-width -----> - * [index] 307200 307509 307519 - * |-------------------|--------| - * [data] UUUUUUUUUU... U%%%%%%%%% - * [data] UUUUUUUUUU... U%%%%%%%%% - * [data] UUUUUUUUUU... U%%%%%%%%% - * [data] ...... - * <-------- v-stride ----------> - * <- --- v-width -----> - * [index] 384000 384309 384319 - * |-------------------|--------| - * [data] VVVVVVVVVV... V%%%%%%%%% - * [data] VVVVVVVVVV... V%%%%%%%%% - * [data] VVVVVVVVVV... V%%%%%%%%% - * [data] ...... - */ - -/* - * Example3: YUV420SP_NV12 image, width = 620, height = 480, stride = 640 - * - * chanel_y: offset = 0, width = 620, height = 480, stride = 640, skip = 0 - * chanel_u: offset = 307200, width = 310, height = 240, data type = uint8, stride = 640, skip = 1 - * chanel_v: offset = 307201, width = 310, height = 240, data type = uint8, stride = 640, skip = 1 - * - * <--------------------------- y-stride --------------------------> - * <----------------------- y-width ----------------------> - * [index] 012345 619 639 - * ||||||-------------------------------------------------|--------| - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% - * [data] ...... - * <--------------------- u-stride / v-stride --------------------> - * <------------------ u-width + v-width -----------------> - * [index] 307200(u-offset) 307819 307839 - * |------------------------------------------------------|-------| - * [index] |307201(v-offset) |307820 | - * ||-----------------------------------------------------||------| - * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% - * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% - * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% - * ^ ^ - * u-skip v-skip - */ - -/* - * Example4: DEPTH image, width = 640, height = 480, stride = 1280 - * - * chanel_d: offset = 0, width = 640, height = 480, data type = uint16, stride = 1280, skip = 0 - * - * note: each DEPTH value uses two bytes - * - * <----------------------- d-stride ----------------------> - * <----------------------- d-width -----------------------> - * [index] 02468 1278 - * |||||---------------------------------------------------| - * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D - * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D - * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D - * [data] ...... - */ - -dictionary ChannelPixelLayout { - required unsigned long offset; - required unsigned long width; - required unsigned long height; - required ChannelPixelLayoutDataType dataType; - required unsigned long stride; - required unsigned long skip; -}; - -typedef sequence ImagePixelLayout; - -partial interface ImageBitmap { - [Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"] - ImageBitmapFormat findOptimalFormat (optional sequence aPossibleFormats); - [Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"] - long mappedDataLength (ImageBitmapFormat aFormat); - [Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"] - Promise mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset); -}; From 85eeeb3a7d075499b39c2bcfd32b418f1b337e53 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 13 Jan 2023 06:13:12 +1100 Subject: [PATCH 136/641] Add support for `local.tee` to `wasm-bindgen-wasm-interpreter` (#3232) This doesn't solve #2969, since WASI uses plenty of instructions we don't support aside from `local.tee`, but it hopefully might solve [@tv42's issue](https://github.com/rustwasm/wasm-bindgen/issues/2969#issuecomment-1374524820). --- crates/wasm-interpreter/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 699ea97c699..1b89eed6b1d 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -270,6 +270,10 @@ impl Frame<'_> { let val = stack.pop().unwrap(); self.locals.insert(e.local, val); } + Instr::LocalTee(e) => { + let val = stack.last().unwrap().clone(); + self.locals.insert(e.local, val); + } // Blindly assume all globals are the stack pointer Instr::GlobalGet(_) => stack.push(self.interp.sp), From 37bba2f98a63e42d91641991b2bdfdfd58128830 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 14 Jan 2023 00:04:02 +0100 Subject: [PATCH 137/641] Call main only once take 4 (#3236) * Modify `module.start` instead of wrapping it * Call main only once --- crates/cli-support/src/lib.rs | 4 ++- crates/cli-support/src/wit/mod.rs | 51 ++++++++++++++++-------------- crates/threads-xform/src/lib.rs | 50 +++++++++++++++++------------ crates/wasm-conventions/src/lib.rs | 38 +++++++++++++++++++++- 4 files changed, 97 insertions(+), 46 deletions(-) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index abe5ec226ee..9da7f9ad5a1 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -338,7 +338,8 @@ impl Bindgen { .context("failed getting Wasm module")?, }; - self.threads + let thread_count = self + .threads .run(&mut module) .with_context(|| "failed to prepare module for threading")?; @@ -383,6 +384,7 @@ impl Bindgen { programs, self.externref, self.wasm_interface_types, + thread_count, self.emit_start, )?; diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index d098eab93bc..cd8deace584 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -8,6 +8,7 @@ use std::str; use walrus::MemoryId; use walrus::{ExportId, FunctionId, ImportId, Module}; use wasm_bindgen_shared::struct_function_export_name; +use wasm_bindgen_threads_xform::ThreadCount; mod incoming; mod nonstandard; @@ -34,6 +35,7 @@ struct Context<'a> { descriptors: HashMap, externref_enabled: bool, wasm_interface_types: bool, + thread_count: Option, support_start: bool, } @@ -50,6 +52,7 @@ pub fn process( programs: Vec, externref_enabled: bool, wasm_interface_types: bool, + thread_count: Option, support_start: bool, ) -> Result<(NonstandardWitSectionId, WasmBindgenAuxId), Error> { let mut cx = Context { @@ -66,6 +69,7 @@ pub fn process( start_found: false, externref_enabled, wasm_interface_types, + thread_count, support_start, }; cx.init()?; @@ -312,14 +316,14 @@ impl<'a> Context<'a> { self.module .add_import_func(PLACEHOLDER_MODULE, "__wbindgen_init_externref_table", ty); - self.module.start = Some(match self.module.start { - Some(prev_start) => { - let mut builder = walrus::FunctionBuilder::new(&mut self.module.types, &[], &[]); - builder.func_body().call(import).call(prev_start); - builder.finish(Vec::new(), &mut self.module.funcs) - } - None => import, - }); + if self.module.start.is_some() { + let builder = + wasm_bindgen_wasm_conventions::get_or_insert_start_builder(&mut self.module); + builder.func_body().call_at(0, import); + } else { + self.module.start = Some(import); + } + self.bind_intrinsic(import_id, Intrinsic::InitExternrefTable)?; Ok(()) @@ -481,22 +485,23 @@ impl<'a> Context<'a> { return Ok(()); } - let prev_start = match self.module.start { - Some(f) => f, - None => { - self.module.start = Some(id); - return Ok(()); - } - }; + if let Some(thread_count) = self.thread_count { + let builder = + wasm_bindgen_wasm_conventions::get_or_insert_start_builder(&mut self.module); + thread_count.wrap_start(builder, id); + } else if self.module.start.is_some() { + let builder = + wasm_bindgen_wasm_conventions::get_or_insert_start_builder(&mut self.module); + + // Note that we leave the previous start function, if any, first. This is + // because the start function currently only shows up when it's injected + // through thread/externref transforms. These injected start functions + // need to happen before user code, so we always schedule them first. + builder.func_body().call(id); + } else { + self.module.start = Some(id); + } - // Note that we call the previous start function, if any, first. This is - // because the start function currently only shows up when it's injected - // through thread/externref transforms. These injected start functions - // need to happen before user code, so we always schedule them first. - let mut builder = walrus::FunctionBuilder::new(&mut self.module.types, &[], &[]); - builder.func_body().call(prev_start).call(id); - let new_start = builder.finish(Vec::new(), &mut self.module.funcs); - self.module.start = Some(new_start); Ok(()) } diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 5f8361c21b0..4893de652b3 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -23,6 +23,9 @@ pub struct Config { enabled: bool, } +#[derive(Clone, Copy)] +pub struct ThreadCount(walrus::LocalId); + impl Config { /// Create a new configuration with default settings. pub fn new() -> Config { @@ -103,9 +106,9 @@ impl Config { /// * Some stack space is prepared for each thread after the first one. /// /// More and/or less may happen here over time, stay tuned! - pub fn run(&self, module: &mut Module) -> Result<(), Error> { + pub fn run(&self, module: &mut Module) -> Result, Error> { if !self.is_enabled(module) { - return Ok(()); + return Ok(None); } let memory = wasm_conventions::get_memory(module)?; @@ -157,7 +160,7 @@ impl Config { let _ = module.exports.add("__stack_alloc", stack.alloc); - inject_start(module, &tls, &stack, thread_counter_addr, memory)?; + let thread_count = inject_start(module, &tls, &stack, thread_counter_addr, memory)?; // we expose a `__wbindgen_thread_destroy()` helper function that deallocates stack space. // @@ -177,7 +180,21 @@ impl Config { // call while the leader is destroying its stack! You should make sure that this cannot happen. inject_destroy(module, &tls, &stack, memory)?; - Ok(()) + Ok(Some(thread_count)) + } +} + +impl ThreadCount { + pub fn wrap_start(self, builder: &mut walrus::FunctionBuilder, start: FunctionId) { + // We only want to call the start function if we are in the first thread. + // The thread counter should be 0 for the first thread. + builder.func_body().local_get(self.0).if_else( + None, + |_| {}, + |body| { + body.call(start); + }, + ); } } @@ -300,23 +317,19 @@ fn inject_start( stack: &Stack, thread_counter_addr: i32, memory: MemoryId, -) -> Result<(), Error> { +) -> Result { use walrus::ir::*; assert!(stack.size % PAGE_SIZE == 0); - let mut builder = walrus::FunctionBuilder::new(&mut module.types, &[], &[]); + let local = module.locals.add(ValType::I32); + let thread_count = module.locals.add(ValType::I32); - let mut body = builder.func_body(); + let malloc = find_function(module, "__wbindgen_malloc")?; - // Call previous start function if one is available. Currently this is - // always true because LLVM injects a call to `__wasm_init_memory` as the - // start function which, well, initializes memory. - if let Some(prev) = module.start.take() { - body.call(prev); - } + let builder = wasm_bindgen_wasm_conventions::get_or_insert_start_builder(module); - let malloc = find_function(module, "__wbindgen_malloc")?; + let mut body = builder.func_body(); // Perform an if/else based on whether we're the first thread or not. Our // thread ID will be zero if we're the first thread, otherwise it'll be @@ -324,6 +337,7 @@ fn inject_start( body.i32_const(thread_counter_addr) .i32_const(1) .atomic_rmw(memory, AtomicOp::Add, AtomicWidth::I32, ATOMIC_MEM_ARG) + .local_tee(thread_count) .if_else( None, // If our thread id is nonzero then we're the second or greater thread, so @@ -360,13 +374,7 @@ fn inject_start( .global_get(tls.base) .call(tls.init); - // Finish off our newly generated function. - let start_id = builder.finish(Vec::new(), &mut module.funcs); - - // ... and finally flag it as the new start function - module.start = Some(start_id); - - Ok(()) + Ok(ThreadCount(thread_count)) } fn inject_destroy( diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index 19b706f83a1..e1617397151 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -8,7 +8,8 @@ use anyhow::{anyhow, bail, Result}; use walrus::{ - ir::Value, ElementId, FunctionId, GlobalId, GlobalKind, InitExpr, MemoryId, Module, ValType, + ir::Value, ElementId, FunctionBuilder, FunctionId, FunctionKind, GlobalId, GlobalKind, + InitExpr, MemoryId, Module, ValType, }; /// Get a Wasm module's canonical linear memory. @@ -112,3 +113,38 @@ pub fn get_function_table_entry(module: &Module, idx: u32) -> Result &mut FunctionBuilder { + let prev_start = { + match module.start { + Some(start) => match module.funcs.get_mut(start).kind { + FunctionKind::Import(_) => Err(Some(start)), + FunctionKind::Local(_) => Ok(start), + FunctionKind::Uninitialized(_) => todo!(), + }, + None => Err(None), + } + }; + + let id = match prev_start { + Ok(id) => id, + Err(prev_start) => { + let mut builder = FunctionBuilder::new(&mut module.types, &[], &[]); + + if let Some(prev_start) = prev_start { + builder.func_body().call(prev_start); + } + + let id = builder.finish(Vec::new(), &mut module.funcs); + module.start = Some(id); + id + } + }; + + module + .funcs + .get_mut(id) + .kind + .unwrap_local_mut() + .builder_mut() +} From 4d43a63d5a0a9376523f4f6f8a2b818a35d737d2 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 17 Jan 2023 13:05:03 +1100 Subject: [PATCH 138/641] Include enum values in TypeScript definitions (#3239) Fixes #2730 --- crates/cli-support/src/js/mod.rs | 2 +- crates/typescript-tests/src/enums.rs | 7 +++++++ crates/typescript-tests/src/enums.ts | 8 ++++++++ crates/typescript-tests/src/lib.rs | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 crates/typescript-tests/src/enums.rs create mode 100644 crates/typescript-tests/src/enums.ts diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 671f67ded2e..6850b91169f 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3581,7 +3581,7 @@ impl<'a> Context<'a> { if !variant_docs.is_empty() { self.typescript.push_str(&variant_docs); } - self.typescript.push_str(&format!(" {},", name)); + self.typescript.push_str(&format!(" {name} = {value},")); } } if enum_.generate_typescript { diff --git a/crates/typescript-tests/src/enums.rs b/crates/typescript-tests/src/enums.rs new file mode 100644 index 00000000000..3d711ad01b0 --- /dev/null +++ b/crates/typescript-tests/src/enums.rs @@ -0,0 +1,7 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub enum Foo { + A = 1, + B = 3, +} diff --git a/crates/typescript-tests/src/enums.ts b/crates/typescript-tests/src/enums.ts new file mode 100644 index 00000000000..3cda5bc78ff --- /dev/null +++ b/crates/typescript-tests/src/enums.ts @@ -0,0 +1,8 @@ +import * as wbg from '../pkg/typescript_tests'; + +const a1: wbg.Foo = wbg.Foo.A; +const a2: wbg.Foo.A = wbg.Foo.A; +const a3: wbg.Foo.A = 1; +const b1: wbg.Foo = wbg.Foo.B; +const b2: wbg.Foo.B = wbg.Foo.B; +const b3: wbg.Foo.B = 3; diff --git a/crates/typescript-tests/src/lib.rs b/crates/typescript-tests/src/lib.rs index dda6a48e9d2..c4f597c6d93 100644 --- a/crates/typescript-tests/src/lib.rs +++ b/crates/typescript-tests/src/lib.rs @@ -1,4 +1,5 @@ pub mod custom_section; +pub mod enums; pub mod getters_setters; pub mod inspectable; pub mod omit_definition; From cef9f4ac80800788f0738700432f705cfbace9ba Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Jan 2023 17:18:49 +0100 Subject: [PATCH 139/641] Add no-modules support to wasm-bindgen-test-runner (#3084) --- .../index-headless.html | 2 +- .../bin/wasm-bindgen-test-runner/index.html | 2 +- .../src/bin/wasm-bindgen-test-runner/main.rs | 13 +++- .../bin/wasm-bindgen-test-runner/server.rs | 60 +++++++++++++++---- 4 files changed, 60 insertions(+), 17 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html index e8a9295f799..790245f20db 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html @@ -37,6 +37,6 @@ window.__wbg_test_invoke = f => f(); - + diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html index c5a4b329738..aaf6afc7e0d 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index.html @@ -25,6 +25,6 @@ window.__wbg_test_invoke = f => f(); - + diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 519048e3dee..5ddca003120 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -33,6 +33,7 @@ enum TestMode { Node, Deno, Browser, + NoModule, } fn main() -> anyhow::Result<()> { @@ -103,7 +104,13 @@ fn main() -> anyhow::Result<()> { let custom_section = wasm.customs.remove_raw("__wasm_bindgen_test_unstable"); let test_mode = match custom_section { - Some(section) if section.data.contains(&0x01) => TestMode::Browser, + Some(section) if section.data.contains(&0x01) => { + if std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok() { + TestMode::NoModule + } else { + TestMode::Browser + } + } Some(_) => bail!("invalid __wasm_bingen_test_unstable value"), None if std::env::var("WASM_BINDGEN_USE_DENO").is_ok() => TestMode::Deno, None => TestMode::Node, @@ -161,6 +168,7 @@ integration test.\ TestMode::Node => b.nodejs(true)?, TestMode::Deno => b.deno(true)?, TestMode::Browser => b.web(true)?, + TestMode::NoModule => b.no_modules(true)?, }; b.debug(debug) @@ -176,7 +184,7 @@ integration test.\ match test_mode { TestMode::Node => node::execute(&module, &tmpdir, &args, &tests)?, TestMode::Deno => deno::execute(&module, &tmpdir, &args, &tests)?, - TestMode::Browser => { + TestMode::Browser | TestMode::NoModule => { let srv = server::spawn( &if headless { "127.0.0.1:0".parse().unwrap() @@ -188,6 +196,7 @@ integration test.\ &tmpdir, &args, &tests, + matches!(test_mode, TestMode::NoModule), ) .context("failed to spawn server")?; let addr = srv.server_addr(); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index fd611ba6650..94177b945a2 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -10,23 +10,43 @@ use rouille::{Request, Response, Server}; pub fn spawn( addr: &SocketAddr, headless: bool, - module: &str, + module: &'static str, tmpdir: &Path, args: &[OsString], tests: &[String], + no_module: bool, ) -> Result Response + Send + Sync>, Error> { - let mut js_to_execute = format!( - r#" - import {{ - WasmBindgenTestContext as Context, - __wbgtest_console_debug, - __wbgtest_console_log, - __wbgtest_console_info, - __wbgtest_console_warn, - __wbgtest_console_error, - default as init, - }} from './{0}'; + let mut js_to_execute = if no_module { + String::from( + r#" + let Context = wasm_bindgen.WasmBindgenTestContext; + let __wbgtest_console_debug = wasm_bindgen.__wbgtest_console_debug; + let __wbgtest_console_log = wasm_bindgen.__wbgtest_console_log; + let __wbgtest_console_info = wasm_bindgen.__wbgtest_console_info; + let __wbgtest_console_warn = wasm_bindgen.__wbgtest_console_warn; + let __wbgtest_console_error = wasm_bindgen.__wbgtest_console_error; + let init = wasm_bindgen; + "#, + ) + } else { + format!( + r#" + import {{ + WasmBindgenTestContext as Context, + __wbgtest_console_debug, + __wbgtest_console_log, + __wbgtest_console_info, + __wbgtest_console_warn, + __wbgtest_console_error, + default as init, + }} from './{}'; + "#, + module, + ) + }; + js_to_execute.push_str(&format!( + r#" // Now that we've gotten to the point where JS is executing, update our // status text as at this point we should be asynchronously fetching the // wasm module. @@ -54,7 +74,7 @@ pub fn spawn( const tests = []; "#, module, args, - ); + )); for test in tests { js_to_execute.push_str(&format!("tests.push('{}');\n", test)); } @@ -76,6 +96,20 @@ pub fn spawn( } else { include_str!("index.html") }; + let s = if no_module { + s.replace( + "", + &format!( + "\n", + module + ), + ) + } else { + s.replace( + "", + "", + ) + }; return set_isolate_origin_headers(Response::from_data("text/html", s)); } From e218b7d9a8e05fa55688b34258134dc8fe44685b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 19 Jan 2023 02:42:07 +0100 Subject: [PATCH 140/641] `#[wasm_bindgen(start)]` shouldn't require `pub` (#3243) * `#[wasm_bindgen(start)]` shouldn't require `pub` * Adjust examples and tests --- crates/cli/tests/wasm-bindgen/npm.rs | 6 +++--- crates/macro-support/src/parser.rs | 1 + crates/macro/ui-tests/start-function.rs | 20 +++++++++---------- crates/macro/ui-tests/start-function.stderr | 12 +++++------ examples/canvas/src/lib.rs | 2 +- examples/closures/src/lib.rs | 2 +- examples/console_log/src/lib.rs | 2 +- examples/dom/src/lib.rs | 2 +- examples/import_js/crate/src/lib.rs | 2 +- examples/paint/src/lib.rs | 2 +- examples/performance/src/lib.rs | 2 +- examples/request-animation-frame/src/lib.rs | 2 +- examples/todomvc/src/lib.rs | 2 +- examples/wasm-in-wasm-imports/src/lib.rs | 2 +- examples/wasm-in-wasm/src/lib.rs | 2 +- examples/wasm2js/src/lib.rs | 2 +- examples/weather_report/src/lib.rs | 2 +- examples/webgl/src/lib.rs | 2 +- examples/webrtc_datachannel/src/lib.rs | 2 +- examples/websockets/src/lib.rs | 2 +- .../without-a-bundler-no-modules/src/lib.rs | 2 +- examples/without-a-bundler/src/lib.rs | 2 +- .../attributes/on-rust-exports/start.md | 2 +- tests/wasm/main.rs | 2 +- 24 files changed, 40 insertions(+), 39 deletions(-) diff --git a/crates/cli/tests/wasm-bindgen/npm.rs b/crates/cli/tests/wasm-bindgen/npm.rs index a727345bfef..9f35723ac70 100644 --- a/crates/cli/tests/wasm-bindgen/npm.rs +++ b/crates/cli/tests/wasm-bindgen/npm.rs @@ -14,7 +14,7 @@ fn no_modules_rejects_npm() { } #[wasm_bindgen(start)] - pub fn main() { + fn main() { foo(); } "#, @@ -48,7 +48,7 @@ fn more_package_json_fields_ignored() { } #[wasm_bindgen(start)] - pub fn main() { + fn main() { foo(); } "#, @@ -102,7 +102,7 @@ fn npm_conflict_rejected() { } #[wasm_bindgen(start)] - pub fn main() { + fn main() { foo(); bar::foo(); } diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 92f8187fc02..4b8afc49bbc 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -745,6 +745,7 @@ impl ConvertToAst for syn::ItemFn { fn convert(self, attrs: BindgenAttrs) -> Result { match self.vis { syn::Visibility::Public(_) => {} + _ if attrs.start().is_some() => {} _ => bail_span!(self, "can only #[wasm_bindgen] public functions"), } if self.sig.constness.is_some() { diff --git a/crates/macro/ui-tests/start-function.rs b/crates/macro/ui-tests/start-function.rs index 65ad90bf283..6bc94c3be08 100644 --- a/crates/macro/ui-tests/start-function.rs +++ b/crates/macro/ui-tests/start-function.rs @@ -1,33 +1,33 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] -pub fn foo() {} +fn foo() {} #[wasm_bindgen(start)] -pub fn foo2(x: u32) {} +fn foo2(x: u32) {} #[wasm_bindgen(start)] -pub fn foo3() {} +fn foo3() {} #[wasm_bindgen(start)] -pub fn foo4() -> Result<(), JsValue> { Ok(()) } +fn foo4() -> Result<(), JsValue> { Ok(()) } #[wasm_bindgen(start)] -pub fn foo5() -> Result { Err(()) } +fn foo5() -> Result { Err(()) } #[wasm_bindgen(start)] -pub fn foo6() -> Result { Ok(JsValue::from(1u32)) } +fn foo6() -> Result { Ok(JsValue::from(1u32)) } #[wasm_bindgen(start)] -pub async fn foo_async1() {} +async fn foo_async1() {} #[wasm_bindgen(start)] -pub async fn foo_async2() -> Result<(), JsValue> { Ok(()) } +async fn foo_async2() -> Result<(), JsValue> { Ok(()) } #[wasm_bindgen(start)] -pub async fn foo_async3() -> Result { Err(()) } +async fn foo_async3() -> Result { Err(()) } #[wasm_bindgen(start)] -pub async fn foo_async4() -> Result { Ok(JsValue::from(1u32)) } +async fn foo_async4() -> Result { Ok(JsValue::from(1u32)) } fn main() {} diff --git a/crates/macro/ui-tests/start-function.stderr b/crates/macro/ui-tests/start-function.stderr index 8f459863d2e..aac6fccf00a 100644 --- a/crates/macro/ui-tests/start-function.stderr +++ b/crates/macro/ui-tests/start-function.stderr @@ -1,14 +1,14 @@ error: the start function cannot have arguments - --> ui-tests/start-function.rs:7:13 + --> ui-tests/start-function.rs:7:9 | -7 | pub fn foo2(x: u32) {} - | ^^^^^^ +7 | fn foo2(x: u32) {} + | ^^^^^^ error: the start function cannot have generics - --> ui-tests/start-function.rs:10:12 + --> ui-tests/start-function.rs:10:8 | -10 | pub fn foo3() {} - | ^^^ +10 | fn foo3() {} + | ^^^ error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied --> ui-tests/start-function.rs:15:1 diff --git a/examples/canvas/src/lib.rs b/examples/canvas/src/lib.rs index 30891cce291..240dad3e6df 100644 --- a/examples/canvas/src/lib.rs +++ b/examples/canvas/src/lib.rs @@ -2,7 +2,7 @@ use std::f64; use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] -pub fn start() { +fn start() { let document = web_sys::window().unwrap().document().unwrap(); let canvas = document.get_element_by_id("canvas").unwrap(); let canvas: web_sys::HtmlCanvasElement = canvas diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index ec808d304d1..7ee531987e2 100644 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -3,7 +3,7 @@ use wasm_bindgen::prelude::*; use web_sys::{Document, Element, HtmlElement, Window}; #[wasm_bindgen(start)] -pub fn run() -> Result<(), JsValue> { +fn run() -> Result<(), JsValue> { let window = web_sys::window().expect("should have a window in this context"); let document = window.document().expect("window should have a document"); diff --git a/examples/console_log/src/lib.rs b/examples/console_log/src/lib.rs index 49e9c1db854..f0e5a4954e2 100644 --- a/examples/console_log/src/lib.rs +++ b/examples/console_log/src/lib.rs @@ -1,7 +1,7 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] -pub fn run() { +fn run() { bare_bones(); using_a_macro(); using_web_sys(); diff --git a/examples/dom/src/lib.rs b/examples/dom/src/lib.rs index dc1a55c44f0..1703a6a75c6 100644 --- a/examples/dom/src/lib.rs +++ b/examples/dom/src/lib.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::*; // Called by our JS entry point to run the example #[wasm_bindgen(start)] -pub fn run() -> Result<(), JsValue> { +fn run() -> Result<(), JsValue> { // Use `web_sys`'s global `window` function to get a handle on the global // window object. let window = web_sys::window().expect("no global `window` exists"); diff --git a/examples/import_js/crate/src/lib.rs b/examples/import_js/crate/src/lib.rs index e6fdad89978..30520081c5c 100644 --- a/examples/import_js/crate/src/lib.rs +++ b/examples/import_js/crate/src/lib.rs @@ -25,7 +25,7 @@ extern "C" { } #[wasm_bindgen(start)] -pub fn run() { +fn run() { log(&format!("Hello from {}!", name())); // should output "Hello from Rust!" let x = MyClass::new(); diff --git a/examples/paint/src/lib.rs b/examples/paint/src/lib.rs index 17853837e42..bc1826d135d 100644 --- a/examples/paint/src/lib.rs +++ b/examples/paint/src/lib.rs @@ -3,7 +3,7 @@ use std::rc::Rc; use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] -pub fn start() -> Result<(), JsValue> { +fn start() -> Result<(), JsValue> { let document = web_sys::window().unwrap().document().unwrap(); let canvas = document .create_element("canvas")? diff --git a/examples/performance/src/lib.rs b/examples/performance/src/lib.rs index f2b863a6883..af4dd6cdd0b 100644 --- a/examples/performance/src/lib.rs +++ b/examples/performance/src/lib.rs @@ -14,7 +14,7 @@ macro_rules! console_log { } #[wasm_bindgen(start)] -pub fn run() { +fn run() { let window = web_sys::window().expect("should have a window in this context"); let performance = window .performance() diff --git a/examples/request-animation-frame/src/lib.rs b/examples/request-animation-frame/src/lib.rs index f8a3c68f72f..7cf0dc81979 100644 --- a/examples/request-animation-frame/src/lib.rs +++ b/examples/request-animation-frame/src/lib.rs @@ -24,7 +24,7 @@ fn body() -> web_sys::HtmlElement { // This function is automatically invoked after the wasm module is instantiated. #[wasm_bindgen(start)] -pub fn run() -> Result<(), JsValue> { +fn run() -> Result<(), JsValue> { // Here we want to call `requestAnimationFrame` in a loop, but only a fixed // number of times. After it's done we want all our resources cleaned up. To // achieve this we're using an `Rc`. The `Rc` will eventually store the diff --git a/examples/todomvc/src/lib.rs b/examples/todomvc/src/lib.rs index e0463ad7581..092304becf9 100644 --- a/examples/todomvc/src/lib.rs +++ b/examples/todomvc/src/lib.rs @@ -58,7 +58,7 @@ fn app(name: &str) { /// Entry point into the program from JavaScript #[wasm_bindgen(start)] -pub fn run() -> Result<(), JsValue> { +fn run() -> Result<(), JsValue> { console_error_panic_hook::set_once(); app("todos-wasmbindgen"); diff --git a/examples/wasm-in-wasm-imports/src/lib.rs b/examples/wasm-in-wasm-imports/src/lib.rs index 45f2cae5c06..ed122627bdd 100644 --- a/examples/wasm-in-wasm-imports/src/lib.rs +++ b/examples/wasm-in-wasm-imports/src/lib.rs @@ -73,7 +73,7 @@ impl Imports { } #[wasm_bindgen(start)] -pub fn run() { +fn run() { spawn_local(async { match run_async().await { Ok(_) => console_log!("Finished"), diff --git a/examples/wasm-in-wasm/src/lib.rs b/examples/wasm-in-wasm/src/lib.rs index 6923dfe692a..6f91b07b683 100644 --- a/examples/wasm-in-wasm/src/lib.rs +++ b/examples/wasm-in-wasm/src/lib.rs @@ -41,7 +41,7 @@ async fn run_async() -> Result<(), JsValue> { } #[wasm_bindgen(start)] -pub fn run() { +fn run() { spawn_local(async { run_async().await.unwrap_throw(); }); diff --git a/examples/wasm2js/src/lib.rs b/examples/wasm2js/src/lib.rs index 0e156c499c5..70f3c510dc8 100644 --- a/examples/wasm2js/src/lib.rs +++ b/examples/wasm2js/src/lib.rs @@ -8,6 +8,6 @@ extern "C" { } #[wasm_bindgen(start)] -pub fn run() { +fn run() { log("Hello, World!"); } diff --git a/examples/weather_report/src/lib.rs b/examples/weather_report/src/lib.rs index 818fbedc4a9..e06de175e27 100644 --- a/examples/weather_report/src/lib.rs +++ b/examples/weather_report/src/lib.rs @@ -19,7 +19,7 @@ extern "C" { } #[wasm_bindgen(start)] -pub fn run() -> Result<(), JsValue> { +fn run() -> Result<(), JsValue> { let window = web_sys::window().expect("no global `window` exists"); let document = window.document().expect("should have a document on window"); let body = document.body().expect("document should have a body"); diff --git a/examples/webgl/src/lib.rs b/examples/webgl/src/lib.rs index d1d7a3c8c22..2515234632d 100644 --- a/examples/webgl/src/lib.rs +++ b/examples/webgl/src/lib.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::*; use web_sys::{WebGl2RenderingContext, WebGlProgram, WebGlShader}; #[wasm_bindgen(start)] -pub fn start() -> Result<(), JsValue> { +fn start() -> Result<(), JsValue> { let document = web_sys::window().unwrap().document().unwrap(); let canvas = document.get_element_by_id("canvas").unwrap(); let canvas: web_sys::HtmlCanvasElement = canvas.dyn_into::()?; diff --git a/examples/webrtc_datachannel/src/lib.rs b/examples/webrtc_datachannel/src/lib.rs index 0ddac87040c..bf166e39225 100644 --- a/examples/webrtc_datachannel/src/lib.rs +++ b/examples/webrtc_datachannel/src/lib.rs @@ -22,7 +22,7 @@ extern "C" { } #[wasm_bindgen(start)] -pub async fn start() -> Result<(), JsValue> { +async fn start() -> Result<(), JsValue> { /* * Set up PeerConnections * pc1 <=> pc2 diff --git a/examples/websockets/src/lib.rs b/examples/websockets/src/lib.rs index a78fb384651..d4b8f5579e1 100644 --- a/examples/websockets/src/lib.rs +++ b/examples/websockets/src/lib.rs @@ -12,7 +12,7 @@ extern "C" { } #[wasm_bindgen(start)] -pub fn start_websocket() -> Result<(), JsValue> { +fn start_websocket() -> Result<(), JsValue> { // Connect to an echo server let ws = WebSocket::new("wss://echo.websocket.events")?; // For small binary messages, like CBOR, Arraybuffer is more efficient than Blob handling diff --git a/examples/without-a-bundler-no-modules/src/lib.rs b/examples/without-a-bundler-no-modules/src/lib.rs index 017c6615e9d..3f365b50825 100644 --- a/examples/without-a-bundler-no-modules/src/lib.rs +++ b/examples/without-a-bundler-no-modules/src/lib.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::*; // Called when the wasm module is instantiated #[wasm_bindgen(start)] -pub fn main() -> Result<(), JsValue> { +fn main() -> Result<(), JsValue> { // Use `web_sys`'s global `window` function to get a handle on the global // window object. let window = web_sys::window().expect("no global `window` exists"); diff --git a/examples/without-a-bundler/src/lib.rs b/examples/without-a-bundler/src/lib.rs index 017c6615e9d..3f365b50825 100644 --- a/examples/without-a-bundler/src/lib.rs +++ b/examples/without-a-bundler/src/lib.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::*; // Called when the wasm module is instantiated #[wasm_bindgen(start)] -pub fn main() -> Result<(), JsValue> { +fn main() -> Result<(), JsValue> { // Use `web_sys`'s global `window` function to get a handle on the global // window object. let window = web_sys::window().expect("no global `window` exists"); diff --git a/guide/src/reference/attributes/on-rust-exports/start.md b/guide/src/reference/attributes/on-rust-exports/start.md index 8dd52f7388f..3cbf67d0ac2 100644 --- a/guide/src/reference/attributes/on-rust-exports/start.md +++ b/guide/src/reference/attributes/on-rust-exports/start.md @@ -6,7 +6,7 @@ soon as the wasm module is instantiated. ```rust #[wasm_bindgen(start)] -pub fn main() { +fn main() { // executed automatically ... } ``` diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index f1f4b8eee7b..fc838ada611 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -52,6 +52,6 @@ pub mod vendor_prefix; // should not be executed #[wasm_bindgen(start)] -pub fn start() { +fn start() { panic!(); } From 979b335e4ef1fdd59bfb520d3868a39e61cd703d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 20 Jan 2023 02:11:12 +1100 Subject: [PATCH 141/641] Add `js_sys::Array::set_length` (#3246) Fixes #3244 --- crates/js-sys/src/lib.rs | 13 +++++++++++++ crates/js-sys/tests/wasm/Array.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 838611362b9..92890a62b72 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -447,6 +447,19 @@ extern "C" { #[wasm_bindgen(method, getter, structural)] pub fn length(this: &Array) -> u32; + /// Sets the length of the array. + /// + /// If it is set to less than the current length of the array, it will + /// shrink the array. + /// + /// If it is set to more than the current length of the array, it will + /// increase the length of the array, filling the new space with empty + /// slots. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) + #[wasm_bindgen(method, setter)] + pub fn set_length(this: &Array, value: u32); + /// `map()` calls a provided callback function once for each element in an array, /// in order, and constructs a new array from the results. callback is invoked /// only for indexes of the array which have assigned values, including undefined. diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index 02243a86856..3934389f077 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -534,6 +534,33 @@ fn for_each() { assert_eq!(sum_indices_of_evens(&js_array![3, 5, 7, 10]), 3); } +#[wasm_bindgen_test] +fn set_length() { + let array = js_array![1, 2, 3, 4, 5]; + array.set_length(3); + assert_eq!( + array.iter().collect::>(), + [1.0, 2.0, 3.0].map(|x| JsValue::from_f64(x)) + ); + + array.set_length(7); + assert_eq!( + array.iter().collect::>(), + [1.0, 2.0, 3.0] + .iter() + .copied() + .map(|x| JsValue::from_f64(x)) + .chain([JsValue::UNDEFINED; 4]) + .collect::>() + ); + + let mut calls = 0; + array.for_each(&mut |_, _, _| calls += 1); + // The later elements don't get filled with `undefined`, they get filled with + // empty slots, which get skipped by `for_each`. + assert_eq!(calls, 3); +} + #[wasm_bindgen_test] fn array_inheritance() { let array = Array::new(); From a4788cac0f7b1ffd86f1564bbab2596f2d0d9b1a Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 25 Jan 2023 02:14:25 +1100 Subject: [PATCH 142/641] Lazily initialize memory views (#3253) * Lazily initialize memory views This stops load-time errors in versions of Safari before 15 if the `BigInt64Array` or `BigUint64Array` memory views are included but never used. Pointed out in https://github.com/rustwasm/wasm-bindgen/issues/2716#issuecomment-1397621198. * Update reference tests --- crates/cli-support/src/js/mod.rs | 10 ++++------ crates/cli/tests/reference/anyref-import-catch.js | 8 ++++---- crates/cli/tests/reference/import-catch.js | 4 ++-- crates/cli/tests/reference/result-string.js | 8 ++++---- crates/cli/tests/reference/string-arg.js | 4 ++-- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 6850b91169f..a3112d6f3b9 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -787,10 +787,10 @@ impl<'a> Context<'a> { for kind in views { writeln!( init_memviews, - // Reset the memory views to empty in case `init` gets called multiple times. + // Reset the memory views to null in case `init` gets called multiple times. // Without this, the `length = 0` check would never detect that the view was // outdated. - "cached{kind}Memory{num} = new {kind}Array();", + "cached{kind}Memory{num} = null;", kind = kind, num = num, ) @@ -1782,14 +1782,12 @@ impl<'a> Context<'a> { format!("{cache}.byteLength === 0", cache = cache) }; - // Initialize the cache to an empty array, which will trigger the resized check - // on the first call and initialise the view. - self.global(&format!("let {cache} = new {kind}Array();\n")); + self.global(&format!("let {cache} = null;\n")); self.global(&format!( " function {name}() {{ - if ({resized_check}) {{ + if ({cache} === null || {resized_check}) {{ {cache} = new {kind}Array(wasm.{mem}.buffer); }} return {cache}; diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index e21de878906..d73f9ff7f3d 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -10,10 +10,10 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = new Uint8Array(); +let cachedUint8Memory0 = null; function getUint8Memory0() { - if (cachedUint8Memory0.byteLength === 0) { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8Memory0; @@ -38,10 +38,10 @@ function handleError(f, args) { } } -let cachedInt32Memory0 = new Int32Array(); +let cachedInt32Memory0 = null; function getInt32Memory0() { - if (cachedInt32Memory0.byteLength === 0) { + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachedInt32Memory0; diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index 468d38a0e41..f587b8346c3 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -27,10 +27,10 @@ function handleError(f, args) { } } -let cachedInt32Memory0 = new Int32Array(); +let cachedInt32Memory0 = null; function getInt32Memory0() { - if (cachedInt32Memory0.byteLength === 0) { + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachedInt32Memory0; diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index b70e4ef55ce..1ade844742c 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -19,10 +19,10 @@ function addHeapObject(obj) { return idx; } -let cachedInt32Memory0 = new Int32Array(); +let cachedInt32Memory0 = null; function getInt32Memory0() { - if (cachedInt32Memory0.byteLength === 0) { + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); } return cachedInt32Memory0; @@ -48,10 +48,10 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = new Uint8Array(); +let cachedUint8Memory0 = null; function getUint8Memory0() { - if (cachedUint8Memory0.byteLength === 0) { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8Memory0; diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index 279d278c838..bf5ba77b739 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -10,10 +10,10 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = new Uint8Array(); +let cachedUint8Memory0 = null; function getUint8Memory0() { - if (cachedUint8Memory0.byteLength === 0) { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8Memory0; From 79cbace56872813dae04f194f6107ca7b9f6bfc9 Mon Sep 17 00:00:00 2001 From: Quinn Wilton Date: Wed, 25 Jan 2023 04:50:24 -0800 Subject: [PATCH 143/641] Fix typos in futures/src/stream.rs documentation (#3264) --- crates/futures/src/stream.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/futures/src/stream.rs b/crates/futures/src/stream.rs index 7189c00066d..fe35d81c735 100644 --- a/crates/futures/src/stream.rs +++ b/crates/futures/src/stream.rs @@ -1,7 +1,7 @@ //! Converting JavaScript `AsyncIterator`s to Rust `Stream`s. //! -//! Analogous to the promise to future convertion, this module allows the -//! turing objects implementing the async iterator protocol into `Stream`s +//! Analogous to the promise to future conversion, this module allows +//! turning objects implementing the async iterator protocol into `Stream`s //! that produce values that can be awaited from. //! From 5fff0a9846c6a48d15befea7f9f572d19fbbe45a Mon Sep 17 00:00:00 2001 From: Harald Reingruber <74898239+haraldreingruber-dedalus@users.noreply.github.com> Date: Sat, 28 Jan 2023 23:50:47 +0100 Subject: [PATCH 144/641] Add WebGL extension type for 16-bit normalized formats (EXT_texture_norm16) (#3266) --- crates/web-sys/Cargo.toml | 1 + .../src/features/gen_ExtTextureNorm16.rs | 48 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 6 +++ .../enabled/WebGL2RenderingContext.webidl | 13 +++++ 4 files changed, 68 insertions(+) create mode 100644 crates/web-sys/src/features/gen_ExtTextureNorm16.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 76850432ee8..6663b222d93 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -361,6 +361,7 @@ ExtFragDepth = [] ExtSRgb = [] ExtShaderTextureLod = [] ExtTextureFilterAnisotropic = [] +ExtTextureNorm16 = [] ExtendableEvent = ["Event"] ExtendableEventInit = [] ExtendableMessageEvent = ["Event", "ExtendableEvent"] diff --git a/crates/web-sys/src/features/gen_ExtTextureNorm16.rs b/crates/web-sys/src/features/gen_ExtTextureNorm16.rs new file mode 100644 index 00000000000..d4ab27eaf75 --- /dev/null +++ b/crates/web-sys/src/features/gen_ExtTextureNorm16.rs @@ -0,0 +1,48 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (is_type_of = | _ | false , extends = :: js_sys :: Object , js_name = EXT_texture_norm16 , typescript_type = "EXT_texture_norm16")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ExtTextureNorm16` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_norm16)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub type ExtTextureNorm16; +} +impl ExtTextureNorm16 { + #[doc = "The `EXT_texture_norm16.R16_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const R16_EXT: u32 = 33322u64 as u32; + #[doc = "The `EXT_texture_norm16.RG16_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RG16_EXT: u32 = 33324u64 as u32; + #[doc = "The `EXT_texture_norm16.RGB16_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RGB16_EXT: u32 = 32852u64 as u32; + #[doc = "The `EXT_texture_norm16.RGBA16_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RGBA16_EXT: u32 = 32859u64 as u32; + #[doc = "The `EXT_texture_norm16.R16_SNORM_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const R16_SNORM_EXT: u32 = 36760u64 as u32; + #[doc = "The `EXT_texture_norm16.RG16_SNORM_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RG16_SNORM_EXT: u32 = 36761u64 as u32; + #[doc = "The `EXT_texture_norm16.RGB16_SNORM_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RGB16_SNORM_EXT: u32 = 36762u64 as u32; + #[doc = "The `EXT_texture_norm16.RGBA16_SNORM_EXT` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtTextureNorm16`*"] + pub const RGBA16_SNORM_EXT: u32 = 36763u64 as u32; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 6ee7c1fa0f0..a83613cea17 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -1972,6 +1972,12 @@ mod gen_ExtTextureFilterAnisotropic; #[cfg(feature = "ExtTextureFilterAnisotropic")] pub use gen_ExtTextureFilterAnisotropic::*; +#[cfg(feature = "ExtTextureNorm16")] +#[allow(non_snake_case)] +mod gen_ExtTextureNorm16; +#[cfg(feature = "ExtTextureNorm16")] +pub use gen_ExtTextureNorm16::*; + #[cfg(feature = "ExtendableEvent")] #[allow(non_snake_case)] mod gen_ExtendableEvent; diff --git a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl index 730ae2790d5..2b6efb550b5 100644 --- a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl @@ -722,3 +722,16 @@ WebGL2RenderingContext includes WebGL2RenderingContextBase; [NoInterfaceObject] interface EXT_color_buffer_float { }; + +[NoInterfaceObject] +interface EXT_texture_norm16 +{ + const GLenum R16_EXT = 0x822A; + const GLenum RG16_EXT = 0x822C; + const GLenum RGB16_EXT = 0x8054; + const GLenum RGBA16_EXT = 0x805B; + const GLenum R16_SNORM_EXT = 0x8F98; + const GLenum RG16_SNORM_EXT = 0x8F99; + const GLenum RGB16_SNORM_EXT = 0x8F9A; + const GLenum RGBA16_SNORM_EXT = 0x8F9B; +}; From 8fc0e2b085ea555354ba3094e66cd0bc94add0af Mon Sep 17 00:00:00 2001 From: Mauro Gentile <62186646+gents83@users.noreply.github.com> Date: Mon, 30 Jan 2023 09:15:17 +0100 Subject: [PATCH 145/641] Add support for setlike interfaces (#3268) * Add support for setlike interfaces * Fixing setlike test suite --- .../src/features/gen_GpuSupportedFeatures.rs | 69 ++++++ crates/webidl-tests/globals.js | 81 +++++-- crates/webidl-tests/main.rs | 1 + crates/webidl-tests/setlike.rs | 90 ++++++++ .../webidls/enabled/setlike.webidl | 9 + crates/webidl/src/first_pass.rs | 212 +++++++++++++++++- 6 files changed, 441 insertions(+), 21 deletions(-) create mode 100644 crates/webidl-tests/setlike.rs create mode 100644 crates/webidl-tests/webidls/enabled/setlike.webidl diff --git a/crates/web-sys/src/features/gen_GpuSupportedFeatures.rs b/crates/web-sys/src/features/gen_GpuSupportedFeatures.rs index da11a61c5cd..7d893c05c8f 100644 --- a/crates/web-sys/src/features/gen_GpuSupportedFeatures.rs +++ b/crates/web-sys/src/features/gen_GpuSupportedFeatures.rs @@ -15,4 +15,73 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuSupportedFeatures; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedFeatures" , 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/GPUSupportedFeatures/size)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(this: &GpuSupportedFeatures) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUSupportedFeatures" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedFeatures/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entries(this: &GpuSupportedFeatures) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUSupportedFeatures" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedFeatures/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn for_each( + this: &GpuSupportedFeatures, + callback: &::js_sys::Function, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUSupportedFeatures" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedFeatures/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn has(this: &GpuSupportedFeatures, value: &str) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUSupportedFeatures" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedFeatures/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keys(this: &GpuSupportedFeatures) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUSupportedFeatures" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedFeatures/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSupportedFeatures`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn values(this: &GpuSupportedFeatures) -> ::js_sys::Iterator; } diff --git a/crates/webidl-tests/globals.js b/crates/webidl-tests/globals.js index 1a2d6693e69..bf70171c1ca 100644 --- a/crates/webidl-tests/globals.js +++ b/crates/webidl-tests/globals.js @@ -1,6 +1,6 @@ const strictEqual = require('assert').strictEqual; -exports.noop = function () {}; +exports.noop = function () { }; global.TestArrays = class { strings(x) { @@ -97,11 +97,11 @@ global.ArrayBufferTest = class { }; global.TakeCallbackInterface = class { - a() {} - b() {} + a() { } + b() { } }; -global.assert_dict_c = function(c) { +global.assert_dict_c = function (c) { strictEqual(c.a, 1); strictEqual(c.b, 2); strictEqual(c.c, 3); @@ -112,17 +112,17 @@ global.assert_dict_c = function(c) { strictEqual(c.h, 8); }; -global.mk_dict_a = function() { +global.mk_dict_a = function () { return {}; }; -global.assert_dict_required = function(c) { +global.assert_dict_required = function (c) { strictEqual(c.a, 3); strictEqual(c.b, "a"); strictEqual(c.c, 4); }; -global.assert_camel_case = function(dict) { +global.assert_camel_case = function (dict) { strictEqual(dict.wierd_fieldName, 1); } @@ -219,6 +219,57 @@ global.TestReadWriteMapLike = class extends global.TestReadOnlyMapLike { } }; +global.TestReadOnlySetLike = class { + constructor() { + this.set = new Set(); + this.set.add('a'); + this.set.add('b'); + this.set.add('c'); + } + + entries() { + return this.set.entries(); + } + + forEach(callback, thisArg) { + return this.set.forEach(callback, thisArg); + } + + has(value) { + return this.set.has(value); + } + + keys() { + return this.set.keys(); + } + + values() { + return this.set.values(); + } + + get size() { + return this.set.size; + } +}; + +global.TestReadWriteSetLike = class extends global.TestReadOnlySetLike { + constructor() { + super(); + } + + add(value) { + return this.set.add(value); + } + + delete(value) { + return this.set.delete(value); + } + + clear() { + return this.set.clear(); + } +}; + global.math_test = { pow(base, exp) { return Math.pow(base, exp); @@ -233,7 +284,7 @@ global.GetNoInterfaceObject = class { static get() { return { number: 3, - foo: () => {}, + foo: () => { }, } } }; @@ -266,7 +317,7 @@ global.NamedConstructorParent = class NamedConstructor { this._value = 0; } - get value(){ + get value() { return this._value; } }; @@ -296,7 +347,7 @@ global.StaticMethod = class StaticMethod { StaticMethod.value = 0; global.StaticProperty = class StaticProperty { - static get value(){ + static get value() { return StaticProperty._value; } @@ -308,14 +359,14 @@ global.StaticProperty = class StaticProperty { StaticProperty._value = 0; global.UndefinedMethod = class UndefinedMethod { - constructor() {} + constructor() { } ok_method() { return true; } }; global.NullableMethod = class NullableMethod { - constructor() {} + constructor() { } opt(a) { if (a == undefined) { return undefined; @@ -355,14 +406,14 @@ global.Indexing = function () { }; global.OptionalAndUnionArguments = class OptionalAndUnionArguments { - constructor() {} + constructor() { } m(a, b = true, c = 123, d = 456) { return [typeof a, a, typeof b, b, typeof c, c, typeof d, d].join(', '); } }; global.Variadic = class Variadic { - constructor() {} + constructor() { } sum(...values) { return values.reduce((a, b) => a + b, 0); } @@ -402,7 +453,7 @@ global.MixinFoo = class MixinFoo { }; global.Overloads = class { - foo() {} + foo() { } }; global.InvokeCallback = class { diff --git a/crates/webidl-tests/main.rs b/crates/webidl-tests/main.rs index 99a0129f5e6..de1e5046670 100644 --- a/crates/webidl-tests/main.rs +++ b/crates/webidl-tests/main.rs @@ -30,6 +30,7 @@ pub mod maplike; pub mod namespace; pub mod no_interface; pub mod promise; +pub mod setlike; pub mod simple; pub mod throws; pub mod unstable; diff --git a/crates/webidl-tests/setlike.rs b/crates/webidl-tests/setlike.rs new file mode 100644 index 00000000000..d77dd61c16e --- /dev/null +++ b/crates/webidl-tests/setlike.rs @@ -0,0 +1,90 @@ +use crate::generated::*; +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +macro_rules! read_test_suite { + ($setlike:ty, $name:ident) => { + #[wasm_bindgen_test] + fn $name() { + // { "a", "b", "c" } + let setlike = <$setlike>::new().unwrap(); + + // readonly attribute unsigned long size; + assert_eq!(setlike.size(), 3); + + // boolean has(V value); + assert!(setlike.has("a")); + assert!(setlike.has("b")); + assert!(setlike.has("c")); + assert!(!setlike.has("d")); + + // { "a", "b", "c" } + let cb = Closure::wrap(Box::new(|value: String| match value.as_str() { + "a" => assert_eq!(value, "a"), + "b" => assert_eq!(value, "b"), + "c" => assert_eq!(value, "c"), + _ => panic!("unexpected key"), + }) as Box); + + setlike.for_each(cb.as_ref().unchecked_ref()).unwrap(); + + let mut entries_vec = vec![]; + + for entry in setlike.entries().into_iter() { + let entry = entry.unwrap(); + let pair = entry.dyn_into::().unwrap(); + let value = pair.get(1).as_string().unwrap(); + + entries_vec.push(value); + } + + assert_eq!( + &entries_vec, + &["a".to_string(), "b".to_string(), "c".to_string()] + ); + + let mut keys_vec = vec![]; + + for key in setlike.keys().into_iter() { + let key = key.unwrap(); + keys_vec.push(key.as_string().unwrap()); + } + + assert_eq!( + &keys_vec, + &["a".to_string(), "b".to_string(), "c".to_string()] + ); + + let mut values_vec = vec![]; + + for value in setlike.values().into_iter() { + let value = value.unwrap(); + values_vec.push(value.as_string().unwrap()); + } + + assert_eq!( + &values_vec, + &["a".to_string(), "b".to_string(), "c".to_string()] + ); + } + }; +} + +read_test_suite!(TestReadOnlySetLike, read_readonly_setlike); +read_test_suite!(TestReadWriteSetLike, read_setlike); + +#[wasm_bindgen_test] +fn write_setlike() { + // { "a", "b", "c" } + let setlike = TestReadWriteSetLike::new().unwrap(); + + setlike.add("d"); + assert_eq!(setlike.size(), 4); + + assert!(setlike.delete("d")); + assert_eq!(setlike.size(), 3); + + // undefined clear(); + setlike.clear(); + assert_eq!(setlike.size(), 0); +} diff --git a/crates/webidl-tests/webidls/enabled/setlike.webidl b/crates/webidl-tests/webidls/enabled/setlike.webidl new file mode 100644 index 00000000000..8638cd25d05 --- /dev/null +++ b/crates/webidl-tests/webidls/enabled/setlike.webidl @@ -0,0 +1,9 @@ +[Constructor()] +interface TestReadOnlySetLike { + readonly setlike; +}; + +[Constructor()] +interface TestReadWriteSetLike { + setlike; +}; diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index 8d7cd22e5f9..68e4a8c129d 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -544,12 +544,13 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int Ok(()) } InterfaceMember::Constructor(constr) => constr.first_pass(record, ctx), + InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx), + InterfaceMember::Setlike(sl) => sl.first_pass(record, ctx), + // TODO InterfaceMember::Iterable(_iterable) => { log::warn!("Unsupported WebIDL iterable interface member: {:?}", self); Ok(()) } - InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx), - // TODO InterfaceMember::Stringifier(_) => { log::warn!( "Unsupported WebIDL Stringifier interface member: {:?}", @@ -557,10 +558,6 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int ); Ok(()) } - InterfaceMember::Setlike(_) => { - log::warn!("Unsupported WebIDL Setlike interface member: {:?}", self); - Ok(()) - } InterfaceMember::AsyncIterable(_iterable) => { log::warn!( "Unsupported WebIDL async iterable interface member: {:?}", @@ -870,6 +867,209 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> } } +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::SetlikeInterfaceMember<'src> +{ + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + ctx: (&'src str, ApiStability), + ) -> Result<()> { + let value_ty = &self.generics.body; + let value_arg = || Arg { + name: "value", + ty: &value_ty.type_, + optional: false, + variadic: false, + }; + + let undefined_ret = || ReturnType::Undefined(term!(undefined)); + + // readonly attribute unsigned long size; + record + .interfaces + .get_mut(ctx.0) + .unwrap() + .attributes + .push(AttributeInterfaceData { + definition: &AttributeInterfaceMember { + attributes: None, + modifier: None, + readonly: Some(term!(readonly)), + attribute: term!(attribute), + type_: AttributedType { + attributes: None, + type_: Type::Single(SingleType::NonAny(NonAnyType::Integer(MayBeNull { + type_: IntegerType::Long(LongType { + unsigned: Some(term!(unsigned)), + long: term!(long), + }), + q_mark: None, + }))), + }, + identifier: Identifier("size"), + semi_colon: term!(;), + }, + stability: ctx.1, + }); + + // boolean has(V value); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("has"))], + [value_arg()], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Boolean( + MayBeNull { + type_: term!(boolean), + q_mark: None, + }, + )))), + &None, + false, + ctx.1, + ); + + // callback SetlikeForEachCallback = undefined (V value); + // TODO: the signature of the callback is erased, could we keep it? + let foreach_callback_arg = Arg { + name: "callback", + ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { + type_: Identifier("SetlikeForEachCallback"), + q_mark: None, + }))), + optional: false, + variadic: false, + }; + + record.callbacks.insert("SetlikeForEachCallback"); + + // [Throws] undefined forEach(SetlikeForEachCallback cb); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("forEach"))], + [foreach_callback_arg], + &undefined_ret(), + &THROWS_ATTR, + false, + ctx.1, + ); + + // TODO: iterators could have stronger types by generating specialised interfaces for each + // maplike/setlike. Right now, `value` is always `any`. + + // declare the iterator interface + record.iterators.insert("SetlikeIterator"); + + // [NewObject] SetlikeIterator entries(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("entries"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("SetlikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + // [NewObject] SetlikeIterator keys(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("keys"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("SetlikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + // [NewObject] SetlikeIterator values(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("values"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("SetlikeIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + // add writeable interface if *not* readonly + if self.readonly.is_none() { + // undefined clear(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("clear"))], + &[], + &undefined_ret(), + &None, + false, + ctx.1, + ); + + // boolean delete(V value); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("delete"))], + [value_arg()], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Boolean( + MayBeNull { + type_: term!(boolean), + q_mark: None, + }, + )))), + &None, + false, + ctx.1, + ); + + // TODO: `add` actually returns `this` but we don't have a way to express that just yet + // undefined add(V value); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("add"))], + [value_arg()], + &undefined_ret(), + &None, + false, + ctx.1, + ); + } + + Ok(()) + } +} + impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::AttributeInterfaceMember<'src> { From d6964278b557e1d4cf608d1dfb67162b1ce3b53a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 31 Jan 2023 10:32:04 +0100 Subject: [PATCH 146/641] Implement `ImageBitmapOptions` (#3269) --- crates/web-sys/Cargo.toml | 5 + .../src/features/gen_ColorSpaceConversion.rs | 11 + .../src/features/gen_ImageBitmapOptions.rs | 133 +++++++++ .../src/features/gen_ImageDecoderInit.rs | 44 +++ .../src/features/gen_ImageOrientation.rs | 11 + .../src/features/gen_PremultiplyAlpha.rs | 12 + .../web-sys/src/features/gen_ResizeQuality.rs | 13 + crates/web-sys/src/features/gen_Window.rs | 260 ++++++++++++++++++ .../src/features/gen_WorkerGlobalScope.rs | 260 ++++++++++++++++++ crates/web-sys/src/features/mod.rs | 30 ++ .../webidls/enabled/ImageBitmap.webidl | 14 + .../enabled/WindowOrWorkerGlobalScope.webidl | 7 +- crates/webidl/src/constants.rs | 24 ++ crates/webidl/src/util.rs | 9 +- 14 files changed, 830 insertions(+), 3 deletions(-) create mode 100644 crates/web-sys/src/features/gen_ColorSpaceConversion.rs create mode 100644 crates/web-sys/src/features/gen_ImageBitmapOptions.rs create mode 100644 crates/web-sys/src/features/gen_ImageOrientation.rs create mode 100644 crates/web-sys/src/features/gen_PremultiplyAlpha.rs create mode 100644 crates/web-sys/src/features/gen_ResizeQuality.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 6663b222d93..8fbc9384d68 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -194,6 +194,7 @@ CloseEvent = ["Event"] CloseEventInit = [] CodecState = [] CollectedClientData = [] +ColorSpaceConversion = [] Comment = ["CharacterData", "EventTarget", "Node"] CompositeOperation = [] CompositionEvent = ["Event", "UiEvent"] @@ -692,6 +693,7 @@ IirFilterNode = ["AudioNode", "EventTarget"] IirFilterOptions = [] ImageBitmap = [] ImageBitmapFormat = [] +ImageBitmapOptions = [] ImageBitmapRenderingContext = [] ImageCapture = [] ImageCaptureError = [] @@ -702,6 +704,7 @@ ImageDecodeOptions = [] ImageDecodeResult = [] ImageDecoder = [] ImageDecoderInit = [] +ImageOrientation = [] ImageTrack = ["EventTarget"] ImageTrackList = [] InputEvent = ["Event", "UiEvent"] @@ -933,6 +936,7 @@ Position = [] PositionAlignSetting = [] PositionError = [] PositionOptions = [] +PremultiplyAlpha = [] Presentation = [] PresentationAvailability = ["EventTarget"] PresentationConnection = ["EventTarget"] @@ -1017,6 +1021,7 @@ ResizeObserverBoxOptions = [] ResizeObserverEntry = [] ResizeObserverOptions = [] ResizeObserverSize = [] +ResizeQuality = [] Response = [] ResponseInit = [] ResponseType = [] diff --git a/crates/web-sys/src/features/gen_ColorSpaceConversion.rs b/crates/web-sys/src/features/gen_ColorSpaceConversion.rs new file mode 100644 index 00000000000..becd676d01d --- /dev/null +++ b/crates/web-sys/src/features/gen_ColorSpaceConversion.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ColorSpaceConversion` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ColorSpaceConversion { + None = "none", + Default = "default", +} diff --git a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs new file mode 100644 index 00000000000..e789794d0a1 --- /dev/null +++ b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs @@ -0,0 +1,133 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ImageBitmapOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ImageBitmapOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub type ImageBitmapOptions; +} +impl ImageBitmapOptions { + #[doc = "Construct a new `ImageBitmapOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Change the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] + pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("colorSpaceConversion"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ImageOrientation")] + #[doc = "Change the `imageOrientation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] + pub fn image_orientation(&mut self, val: ImageOrientation) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("imageOrientation"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Change the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] + pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("premultiplyAlpha"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `resizeHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn resize_height(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeHeight"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ResizeQuality")] + #[doc = "Change the `resizeQuality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] + pub fn resize_quality(&mut self, val: ResizeQuality) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeQuality"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `resizeWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn resize_width(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeWidth"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for ImageBitmapOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index 87bd70c957b..a787ca67205 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -30,6 +30,28 @@ impl ImageDecoderInit { ret } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Change the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("colorSpaceConversion"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] @@ -110,6 +132,28 @@ impl ImageDecoderInit { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Change the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `PremultiplyAlpha`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("premultiplyAlpha"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] diff --git a/crates/web-sys/src/features/gen_ImageOrientation.rs b/crates/web-sys/src/features/gen_ImageOrientation.rs new file mode 100644 index 00000000000..8c1c25c1321 --- /dev/null +++ b/crates/web-sys/src/features/gen_ImageOrientation.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ImageOrientation` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ImageOrientation`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ImageOrientation { + FromImage = "from-image", + FlipY = "flipY", +} diff --git a/crates/web-sys/src/features/gen_PremultiplyAlpha.rs b/crates/web-sys/src/features/gen_PremultiplyAlpha.rs new file mode 100644 index 00000000000..f838d000e7b --- /dev/null +++ b/crates/web-sys/src/features/gen_PremultiplyAlpha.rs @@ -0,0 +1,12 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `PremultiplyAlpha` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `PremultiplyAlpha`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PremultiplyAlpha { + None = "none", + Premultiply = "premultiply", + Default = "default", +} diff --git a/crates/web-sys/src/features/gen_ResizeQuality.rs b/crates/web-sys/src/features/gen_ResizeQuality.rs new file mode 100644 index 00000000000..fbb1e106672 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeQuality.rs @@ -0,0 +1,13 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ResizeQuality` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ResizeQuality`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ResizeQuality { + Pixelated = "pixelated", + Low = "low", + Medium = "medium", + High = "high", +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 3d6d1ec099e..724f293baf6 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -2438,6 +2438,118 @@ extern "C" { this: &Window, a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_image_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element_and_image_bitmap_options( + this: &Window, + a_image: &SvgImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlCanvasElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlVideoElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_image_bitmap_and_image_bitmap_options( + this: &Window, + a_image: &ImageBitmap, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_image_bitmap_options( + this: &Window, + a_image: &OffscreenCanvas, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_image_bitmap_options( + this: &Window, + a_image: &VideoFrame, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_blob_and_image_bitmap_options( + this: &Window, + a_image: &Blob, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data_and_image_bitmap_options( + this: &Window, + a_image: &ImageData, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] @@ -2577,6 +2689,154 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &SvgImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlCanvasElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlVideoElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &ImageBitmap, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &Blob, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &ImageData, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "Request")] # [wasm_bindgen (method , structural , js_class = "Window" , js_name = fetch)] #[doc = "The `fetch()` method."] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index 353e8207318..52e9a44c963 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -361,6 +361,118 @@ extern "C" { this: &WorkerGlobalScope, a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_image_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &SvgImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlCanvasElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlVideoElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_bitmap_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &ImageBitmap, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &Blob, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &ImageData, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] @@ -500,6 +612,154 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &SvgImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlCanvasElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlVideoElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &ImageBitmap, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &Blob, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &ImageData, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "Request")] # [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = fetch)] #[doc = "The `fetch()` method."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index a83613cea17..680471c2fb4 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -970,6 +970,12 @@ mod gen_CollectedClientData; #[cfg(feature = "CollectedClientData")] pub use gen_CollectedClientData::*; +#[cfg(feature = "ColorSpaceConversion")] +#[allow(non_snake_case)] +mod gen_ColorSpaceConversion; +#[cfg(feature = "ColorSpaceConversion")] +pub use gen_ColorSpaceConversion::*; + #[cfg(feature = "Comment")] #[allow(non_snake_case)] mod gen_Comment; @@ -3952,6 +3958,12 @@ mod gen_ImageBitmap; #[cfg(feature = "ImageBitmap")] pub use gen_ImageBitmap::*; +#[cfg(feature = "ImageBitmapOptions")] +#[allow(non_snake_case)] +mod gen_ImageBitmapOptions; +#[cfg(feature = "ImageBitmapOptions")] +pub use gen_ImageBitmapOptions::*; + #[cfg(feature = "ImageBitmapRenderingContext")] #[allow(non_snake_case)] mod gen_ImageBitmapRenderingContext; @@ -4012,6 +4024,12 @@ mod gen_ImageDecoderInit; #[cfg(feature = "ImageDecoderInit")] pub use gen_ImageDecoderInit::*; +#[cfg(feature = "ImageOrientation")] +#[allow(non_snake_case)] +mod gen_ImageOrientation; +#[cfg(feature = "ImageOrientation")] +pub use gen_ImageOrientation::*; + #[cfg(feature = "ImageTrack")] #[allow(non_snake_case)] mod gen_ImageTrack; @@ -5398,6 +5416,12 @@ mod gen_PositionOptions; #[cfg(feature = "PositionOptions")] pub use gen_PositionOptions::*; +#[cfg(feature = "PremultiplyAlpha")] +#[allow(non_snake_case)] +mod gen_PremultiplyAlpha; +#[cfg(feature = "PremultiplyAlpha")] +pub use gen_PremultiplyAlpha::*; + #[cfg(feature = "Presentation")] #[allow(non_snake_case)] mod gen_Presentation; @@ -5902,6 +5926,12 @@ mod gen_ResizeObserverSize; #[cfg(feature = "ResizeObserverSize")] pub use gen_ResizeObserverSize::*; +#[cfg(feature = "ResizeQuality")] +#[allow(non_snake_case)] +mod gen_ResizeQuality; +#[cfg(feature = "ResizeQuality")] +pub use gen_ResizeQuality::*; + #[cfg(feature = "Response")] #[allow(non_snake_case)] mod gen_Response; diff --git a/crates/web-sys/webidls/enabled/ImageBitmap.webidl b/crates/web-sys/webidls/enabled/ImageBitmap.webidl index 02fc0a66e1e..e9120355a7c 100644 --- a/crates/web-sys/webidls/enabled/ImageBitmap.webidl +++ b/crates/web-sys/webidls/enabled/ImageBitmap.webidl @@ -30,3 +30,17 @@ partial interface ImageBitmap { // Dispose of all graphical resources associated with this ImageBitmap. undefined close(); }; + +enum ImageOrientation { "from-image", "flipY" }; +enum PremultiplyAlpha { "none", "premultiply", "default" }; +enum ColorSpaceConversion { "none", "default" }; +enum ResizeQuality { "pixelated", "low", "medium", "high" }; + +dictionary ImageBitmapOptions { + ImageOrientation imageOrientation = "from-image"; + PremultiplyAlpha premultiplyAlpha = "default"; + ColorSpaceConversion colorSpaceConversion = "default"; + [EnforceRange] unsigned long resizeWidth; + [EnforceRange] unsigned long resizeHeight; + ResizeQuality resizeQuality = "low"; +}; diff --git a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl index c7b7dd698f0..89b818c4b63 100644 --- a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl +++ b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl @@ -37,9 +37,12 @@ interface mixin WindowOrWorkerGlobalScope { // ImageBitmap [Throws] - Promise createImageBitmap(ImageBitmapSource aImage); + Promise createImageBitmap(ImageBitmapSource aImage, + optional ImageBitmapOptions aOptions = {}); [Throws] - Promise createImageBitmap(ImageBitmapSource aImage, long aSx, long aSy, long aSw, long aSh); + Promise createImageBitmap(ImageBitmapSource aImage, + long aSx, long aSy, long aSw, long aSh, + optional ImageBitmapOptions aOptions = {}); }; // https://fetch.spec.whatwg.org/#fetch-method diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 0124d4d7a96..79814e4644b 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -1,4 +1,5 @@ use once_cell::sync::Lazy; +use std::collections::BTreeMap; use std::collections::BTreeSet; use std::iter::FromIterator; @@ -93,3 +94,26 @@ pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy "FontFace", // TODO: Add another type's functions here. Leave a comment header with the type name ]) }); + +pub(crate) static FIXED_INTERFACES: Lazy> = Lazy::new(|| { + BTreeMap::from_iter(vec![ + ("create_image_bitmap_with_html_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_svg_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_canvas_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_video_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_image_bitmap_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_offscreen_canvas_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_svg_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_html_canvas_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_html_video_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_image_bitmap_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_offscreen_canvas_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ]) +}); diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index c738de8292f..dd6a4cc4ec8 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -13,7 +13,7 @@ use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{MayBeNull, NonAnyType, SingleType}; -use crate::constants::IMMUTABLE_SLICE_WHITELIST; +use crate::constants::{FIXED_INTERFACES, IMMUTABLE_SLICE_WHITELIST}; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; use crate::idl_type::{IdlType, ToIdlType}; @@ -498,6 +498,13 @@ impl<'src> FirstPassRecord<'src> { } } } + + for interface in &mut ret { + if let Some(fixed) = FIXED_INTERFACES.get(&interface.name.to_string().as_ref()) { + interface.name = rust_ident(fixed); + } + } + return ret; } From e1b44b75704107bff62abe764294394ce6669ede Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Tue, 31 Jan 2023 23:53:41 +0100 Subject: [PATCH 147/641] Add support for linked modules (#3069) * Add support for linked modules * Use `wasm_bindgen::link_to!` in wasm-bindgen-futures * Fix tests * Update schema * Return `String` instead of `Result` * Add documentation * Add tests * Refactor: Return Diagnostic from module_from_opts * Refactor: Use Option::filter * Fix inline_js offsets * Fully-qualified names in quote * Return absolute URLs and add node tests * Fix message * Enable compile doctest for example * Disallow module paths in `link_to!` * Fix documentation * Opt-in to linked modules in wasm-bindgen with `--allow-links` * Fix tests * Support embedding for local modules * Remove linked module embed limit * Fix escaping * Add and refer to the documentation * Rename option and improve documentation * Improve documentation * Update crates/macro/src/lib.rs Co-authored-by: Liam Murphy * Add paragraph break in docs --- crates/backend/src/ast.rs | 19 +++- crates/backend/src/codegen.rs | 77 +++++++++---- crates/backend/src/encode.rs | 17 +++ crates/cli-support/src/js/mod.rs | 37 +++++- crates/cli-support/src/lib.rs | 7 ++ crates/cli-support/src/wit/mod.rs | 62 +++++++++- crates/cli-support/src/wit/nonstandard.rs | 6 + crates/cli-support/src/wit/section.rs | 3 + crates/cli/src/bin/wasm-bindgen.rs | 8 +- crates/cli/tests/wasm-bindgen/main.rs | 2 +- .../futures/src/task/wait_async_polyfill.rs | 18 +-- crates/futures/src/task/worker.js | 6 + crates/macro-support/src/lib.rs | 12 ++ crates/macro-support/src/parser.rs | 107 ++++++++++++------ crates/macro/Cargo.toml | 1 + crates/macro/src/lib.rs | 29 +++++ crates/macro/src/worker.js | 1 + crates/macro/ui-tests/link-to.rs | 32 ++++++ crates/macro/ui-tests/link-to.stderr | 31 +++++ crates/shared/src/lib.rs | 6 + crates/shared/src/schema_hash_approval.rs | 2 +- guide/src/reference/cli.md | 20 +++- src/lib.rs | 2 + tests/wasm/link_to.js | 4 + tests/wasm/link_to.rs | 30 +++++ tests/wasm/linked_module.js | 1 + tests/wasm/main.rs | 1 + 27 files changed, 468 insertions(+), 73 deletions(-) create mode 100644 crates/futures/src/task/worker.js create mode 100644 crates/macro/src/worker.js create mode 100644 crates/macro/ui-tests/link-to.rs create mode 100644 crates/macro/ui-tests/link-to.stderr create mode 100644 tests/wasm/link_to.js create mode 100644 tests/wasm/link_to.rs create mode 100644 tests/wasm/linked_module.js diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 7703e2570f2..064e0137713 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -2,7 +2,7 @@ //! with all the added metadata necessary to generate WASM bindings //! for it. -use crate::Diagnostic; +use crate::{util::ShortHash, Diagnostic}; use proc_macro2::{Ident, Span}; use std::hash::{Hash, Hasher}; use wasm_bindgen_shared as shared; @@ -16,6 +16,8 @@ pub struct Program { pub exports: Vec, /// js -> rust interfaces pub imports: Vec, + /// linked-to modules + pub linked_modules: Vec, /// rust enums pub enums: Vec, /// rust structs @@ -36,8 +38,23 @@ impl Program { && self.typescript_custom_sections.is_empty() && self.inline_js.is_empty() } + + /// Name of the link function for a specific linked module + pub fn link_function_name(&self, idx: usize) -> String { + let hash = match &self.linked_modules[idx] { + ImportModule::Inline(idx, _) => ShortHash((1, &self.inline_js[*idx])).to_string(), + other => ShortHash((0, other)).to_string(), + }; + format!("__wbindgen_link_{}", hash) + } } +/// An abstract syntax tree representing a link to a module in Rust. +/// In contrast to Program, LinkToModule must expand to an expression. +/// linked_modules of the inner Program must contain exactly one element +/// whose link is produced by the expression. +pub struct LinkToModule(pub Program); + /// A rust to js interface. Allows interaction with rust objects/functions /// from javascript. #[cfg_attr(feature = "extra-traits", derive(Debug))] diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index b0ff20e7d27..e2d57f43373 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -129,6 +129,29 @@ impl TryToTokens for ast::Program { } } +impl TryToTokens for ast::LinkToModule { + fn try_to_tokens(&self, tokens: &mut TokenStream) -> Result<(), Diagnostic> { + let mut program = TokenStream::new(); + self.0.try_to_tokens(&mut program)?; + let link_function_name = self.0.link_function_name(0); + let name = Ident::new(&link_function_name, Span::call_site()); + let abi_ret = quote! { ::Abi }; + let extern_fn = extern_fn(&name, &[], &[], &[], abi_ret); + (quote! { + { + #program + #extern_fn + + unsafe { + ::from_abi(#name()) + } + } + }) + .to_tokens(tokens); + Ok(()) + } +} + impl ToTokens for ast::Struct { fn to_tokens(&self, tokens: &mut TokenStream) { let name = &self.rust_name; @@ -1118,8 +1141,8 @@ impl TryToTokens for ast::ImportFunction { let import_name = &self.shim; let attrs = &self.function.rust_attrs; let arguments = &arguments; - let abi_arguments = &abi_arguments; - let abi_argument_names = &abi_argument_names; + let abi_arguments = &abi_arguments[..]; + let abi_argument_names = &abi_argument_names[..]; let doc_comment = &self.doc_comment; let me = if is_method { @@ -1144,23 +1167,13 @@ impl TryToTokens for ast::ImportFunction { // like rustc itself doesn't do great in that regard so let's just do // the best we can in the meantime. let extern_fn = respan( - quote! { - #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] - #(#attrs)* - #[link(wasm_import_module = "__wbindgen_placeholder__")] - extern "C" { - fn #import_name(#(#abi_arguments),*) -> #abi_ret; - } - - #[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))] - unsafe fn #import_name(#(#abi_arguments),*) -> #abi_ret { - #( - drop(#abi_argument_names); - )* - panic!("cannot call wasm-bindgen imported functions on \ - non-wasm targets"); - } - }, + extern_fn( + import_name, + attrs, + abi_arguments, + abi_argument_names, + abi_ret, + ), &self.rust_name, ); @@ -1399,6 +1412,32 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { } } +fn extern_fn( + import_name: &Ident, + attrs: &[syn::Attribute], + abi_arguments: &[TokenStream], + abi_argument_names: &[Ident], + abi_ret: TokenStream, +) -> TokenStream { + quote! { + #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] + #(#attrs)* + #[link(wasm_import_module = "__wbindgen_placeholder__")] + extern "C" { + fn #import_name(#(#abi_arguments),*) -> #abi_ret; + } + + #[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))] + unsafe fn #import_name(#(#abi_arguments),*) -> #abi_ret { + #( + drop(#abi_argument_names); + )* + panic!("cannot call wasm-bindgen imported functions on \ + non-wasm targets"); + } + } +} + /// Converts `span` into a stream of tokens, and attempts to ensure that `input` /// has all the appropriate span information so errors in it point to `span`. fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 41d3c8b773a..254d0e88537 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -146,6 +146,12 @@ fn shared_program<'a>( .iter() .map(|x| -> &'a str { &x }) .collect(), + linked_modules: prog + .linked_modules + .iter() + .enumerate() + .map(|(i, a)| shared_linked_module(&prog.link_function_name(i), a, intern)) + .collect::, _>>()?, local_modules: intern .files .borrow() @@ -249,6 +255,17 @@ fn shared_import<'a>(i: &'a ast::Import, intern: &'a Interner) -> Result( + name: &str, + i: &'a ast::ImportModule, + intern: &'a Interner, +) -> Result, Diagnostic> { + Ok(LinkedModule { + module: shared_module(i, intern)?, + link_function_name: intern.intern_str(name), + }) +} + fn shared_module<'a>( m: &'a ast::ImportModule, intern: &'a Interner, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index a3112d6f3b9..5f0cb08abe3 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -384,7 +384,7 @@ impl<'a> Context<'a> { if (typeof document === 'undefined') { script_src = location.href; } else { - script_src = document.currentScript.src; + script_src = new URL(document.currentScript.src, location.href).toString(); }\n", ); js.push_str("let wasm;\n"); @@ -3143,6 +3143,41 @@ impl<'a> Context<'a> { assert!(!variadic); self.invoke_intrinsic(intrinsic, args, prelude) } + + AuxImport::LinkTo(path, content) => { + assert!(kind == AdapterJsImportKind::Normal); + assert!(!variadic); + assert_eq!(args.len(), 0); + if self.config.split_linked_modules { + let base = match self.config.mode { + OutputMode::Web + | OutputMode::Bundler { .. } + | OutputMode::Deno + | OutputMode::Node { + experimental_modules: true, + } => "import.meta.url", + OutputMode::Node { + experimental_modules: false, + } => "require('url').pathToFileURL(__filename)", + OutputMode::NoModules { .. } => "script_src", + }; + Ok(format!("new URL('{}', {}).toString()", path, base)) + } else { + if let Some(content) = content { + let mut escaped = String::with_capacity(content.len()); + content.chars().for_each(|c| match c { + '`' | '\\' | '$' => escaped.extend(['\\', c]), + _ => escaped.extend([c]), + }); + Ok(format!( + "\"data:application/javascript,\" + encodeURIComponent(`{escaped}`)" + )) + } else { + Err(anyhow!("wasm-bindgen needs to be invoked with `--split-linked-modules`, because \"{}\" cannot be embedded.\n\ + See https://rustwasm.github.io/wasm-bindgen/reference/cli.html#--split-linked-modules for details.", path)) + } + } + } } } diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 9da7f9ad5a1..1f8b446c2dd 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -46,6 +46,7 @@ pub struct Bindgen { multi_value: bool, wasm_interface_types: bool, encode_into: EncodeInto, + split_linked_modules: bool, } pub struct Output { @@ -120,6 +121,7 @@ impl Bindgen { wasm_interface_types, encode_into: EncodeInto::Test, omit_default_module_path: true, + split_linked_modules: true, } } @@ -304,6 +306,11 @@ impl Bindgen { self } + pub fn split_linked_modules(&mut self, split_linked_modules: bool) -> &mut Bindgen { + self.split_linked_modules = split_linked_modules; + self + } + pub fn generate>(&mut self, path: P) -> Result<(), Error> { self.generate_output()?.emit(path.as_ref()) } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index cd8deace584..7986afb1c3a 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -1,3 +1,4 @@ +use crate::decode::LocalModule; use crate::descriptor::{Descriptor, Function}; use crate::descriptors::WasmBindgenDescriptorsSection; use crate::intrinsic::Intrinsic; @@ -340,6 +341,45 @@ impl<'a> Context<'a> { Ok(()) } + fn link_module( + &mut self, + id: ImportId, + module: &decode::ImportModule, + offset: usize, + local_modules: &[LocalModule], + inline_js: &[&str], + ) -> Result<(), Error> { + let descriptor = Function { + shim_idx: 0, + arguments: Vec::new(), + ret: Descriptor::String, + inner_ret: None, + }; + let id = self.import_adapter(id, descriptor, AdapterJsImportKind::Normal)?; + let (path, content) = match module { + decode::ImportModule::Named(n) => ( + format!("snippets/{}", n), + local_modules + .iter() + .find(|m| m.identifier == *n) + .map(|m| m.contents), + ), + decode::ImportModule::RawNamed(n) => (n.to_string(), None), + decode::ImportModule::Inline(idx) => ( + format!( + "snippets/{}/inline{}.js", + self.unique_crate_identifier, + *idx as usize + offset + ), + Some(inline_js[*idx as usize]), + ), + }; + self.aux + .import_map + .insert(id, AuxImport::LinkTo(path, content.map(str::to_string))); + Ok(()) + } + fn program(&mut self, program: decode::Program<'a>) -> Result<(), Error> { self.unique_crate_identifier = program.unique_crate_identifier; let decode::Program { @@ -352,9 +392,10 @@ impl<'a> Context<'a> { inline_js, unique_crate_identifier, package_json, + linked_modules, } = program; - for module in local_modules { + for module in &local_modules { // All local modules we find should be unique, but the same module // may have showed up in a few different blocks. If that's the case // all the same identifiers should have the same contents. @@ -373,6 +414,25 @@ impl<'a> Context<'a> { self.export(export)?; } + let offset = self + .aux + .snippets + .get(unique_crate_identifier) + .map(|s| s.len()) + .unwrap_or(0); + for module in linked_modules { + match self.function_imports.remove(module.link_function_name) { + Some((id, _)) => self.link_module( + id, + &module.module, + offset, + &local_modules[..], + &inline_js[..], + )?, + None => (), + } + } + // Register vendor prefixes for all types before we walk over all the // imports to ensure that if a vendor prefix is listed somewhere it'll // apply to all the imports. diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 16f0cd2b39f..4c7eb523555 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -328,6 +328,12 @@ pub enum AuxImport { /// This is an intrinsic function expected to be implemented with a JS glue /// shim. Each intrinsic has its own expected signature and implementation. Intrinsic(Intrinsic), + + /// This is a function which returns a URL pointing to a specific file, + /// usually a JS snippet. The supplied path is relative to the JS glue shim. + /// The Option may contain the contents of the linked file, so it can be + /// embedded. + LinkTo(String, Option), } /// Values that can be imported verbatim to hook up to an import. diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 112256193cb..bd1fb23a2e7 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -355,6 +355,9 @@ fn check_standard_import(import: &AuxImport) -> Result<(), Error> { AuxImport::Intrinsic(intrinsic) => { format!("wasm-bindgen specific intrinsic `{}`", intrinsic.name()) } + AuxImport::LinkTo(path, _) => { + format!("wasm-bindgen specific link function for `{}`", path) + } AuxImport::Closure { .. } => format!("creating a `Closure` wrapper"), }; bail!("import of {} requires JS glue", item); diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index ff16a908dda..f6e16a4fb8e 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -36,6 +36,8 @@ Options: --remove-name-section Remove the debugging `name` section of the file --remove-producers-section Remove the telemetry `producers` section --omit-default-module-path Don't add WebAssembly fallback imports in generated JavaScript + --split-linked-modules Split linked modules out into their own files. Recommended if possible. + If a bundler is used, it needs to be set up accordingly. --encode-into MODE Whether or not to use TextEncoder#encodeInto, valid values are [test, always, never] --nodejs Deprecated, use `--target nodejs` @@ -44,6 +46,8 @@ Options: --weak-refs Enable usage of the JS weak references proposal --reference-types Enable usage of WebAssembly reference types -V --version Print the version number of wasm-bindgen + +Additional documentation: https://rustwasm.github.io/wasm-bindgen/reference/cli.html "; #[derive(Debug, Deserialize)] @@ -70,6 +74,7 @@ struct Args { flag_encode_into: Option, flag_target: Option, flag_omit_default_module_path: bool, + flag_split_linked_modules: bool, arg_input: Option, } @@ -123,7 +128,8 @@ fn rmain(args: &Args) -> Result<(), Error> { .remove_producers_section(args.flag_remove_producers_section) .typescript(typescript) .omit_imports(args.flag_omit_imports) - .omit_default_module_path(args.flag_omit_default_module_path); + .omit_default_module_path(args.flag_omit_default_module_path) + .split_linked_modules(args.flag_split_linked_modules); if let Some(true) = args.flag_weak_refs { b.weak_refs(true); } diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 1fb94f7c97b..e854de23e51 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -263,7 +263,7 @@ fn default_module_path_target_no_modules() { if (typeof document === 'undefined') { script_src = location.href; } else { - script_src = document.currentScript.src; + script_src = new URL(document.currentScript.src, location.href).toString(); }", )); assert!(contents.contains( diff --git a/crates/futures/src/task/wait_async_polyfill.rs b/crates/futures/src/task/wait_async_polyfill.rs index 81b50d95259..68332d91a57 100644 --- a/crates/futures/src/task/wait_async_polyfill.rs +++ b/crates/futures/src/task/wait_async_polyfill.rs @@ -36,21 +36,12 @@ * when possible. The worker communicates with its parent using postMessage. */ -use js_sys::{encode_uri_component, Array, Promise}; +use js_sys::{Array, Promise}; use std::cell::RefCell; use std::sync::atomic::AtomicI32; use wasm_bindgen::prelude::*; use web_sys::{MessageEvent, Worker}; -const HELPER_CODE: &'static str = " -onmessage = function (ev) { - let [ia, index, value] = ev.data; - ia = new Int32Array(ia.buffer); - let result = Atomics.wait(ia, index, value); - postMessage(result); -}; -"; - thread_local! { static HELPERS: RefCell> = RefCell::new(vec![]); } @@ -61,11 +52,8 @@ fn alloc_helper() -> Worker { return helper; } - let mut initialization_string = "data:application/javascript,".to_owned(); - let encoded: String = encode_uri_component(HELPER_CODE).into(); - initialization_string.push_str(&encoded); - - Worker::new(&initialization_string).unwrap_or_else(|js| wasm_bindgen::throw_val(js)) + let worker_url = wasm_bindgen::link_to!(module = "/src/task/worker.js"); + Worker::new(&worker_url).unwrap_or_else(|js| wasm_bindgen::throw_val(js)) }) } diff --git a/crates/futures/src/task/worker.js b/crates/futures/src/task/worker.js new file mode 100644 index 00000000000..d25dab6606d --- /dev/null +++ b/crates/futures/src/task/worker.js @@ -0,0 +1,6 @@ +onmessage = function (ev) { + let [ia, index, value] = ev.data; + ia = new Int32Array(ia.buffer); + let result = Atomics.wait(ia, index, value); + postMessage(result); +}; diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index b7a35ae1bed..bf9f71a9d20 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -40,6 +40,18 @@ pub fn expand(attr: TokenStream, input: TokenStream) -> Result Result { + parser::reset_attrs_used(); + let opts = syn::parse2(input)?; + + let mut tokens = proc_macro2::TokenStream::new(); + let link = parser::link_to(opts)?; + link.try_to_tokens(&mut tokens)?; + + Ok(tokens) +} + /// Takes the parsed input from a `#[wasm_bindgen]` macro and returns the generated bindings pub fn expand_class_marker( attr: TokenStream, diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 4b8afc49bbc..def3642cc51 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -95,6 +95,23 @@ macro_rules! methods { ($(($name:ident, $variant:ident($($contents:tt)*)),)*) => { $(methods!(@method $name, $variant($($contents)*));)* + fn enforce_used(self) -> Result<(), Diagnostic> { + // Account for the fact this method was called + ATTRS.with(|state| state.checks.set(state.checks.get() + 1)); + + let mut errors = Vec::new(); + for (used, attr) in self.attrs.iter() { + if used.get() { + continue + } + let span = match attr { + $(BindgenAttr::$variant(span, ..) => span,)* + }; + errors.push(Diagnostic::span_error(*span, "unused wasm_bindgen attribute")); + } + Diagnostic::from_vec(errors) + } + fn check_used(self) { // Account for the fact this method was called ATTRS.with(|state| { @@ -1361,39 +1378,15 @@ impl MacroParse for syn::ItemConst { impl MacroParse for syn::ItemForeignMod { fn macro_parse(self, program: &mut ast::Program, opts: BindgenAttrs) -> Result<(), Diagnostic> { let mut errors = Vec::new(); - match self.abi.name { - Some(ref l) if l.value() == "C" => {} - None => {} - Some(ref other) => { - errors.push(err_span!( - other, - "only foreign mods with the `C` ABI are allowed" - )); - } + if let Some(other) = self.abi.name.filter(|l| l.value() != "C") { + errors.push(err_span!( + other, + "only foreign mods with the `C` ABI are allowed" + )); } - let module = if let Some((name, span)) = opts.module() { - if opts.inline_js().is_some() { - let msg = "cannot specify both `module` and `inline_js`"; - errors.push(Diagnostic::span_error(span, msg)); - } - if opts.raw_module().is_some() { - let msg = "cannot specify both `module` and `raw_module`"; - errors.push(Diagnostic::span_error(span, msg)); - } - Some(ast::ImportModule::Named(name.to_string(), span)) - } else if let Some((name, span)) = opts.raw_module() { - if opts.inline_js().is_some() { - let msg = "cannot specify both `raw_module` and `inline_js`"; - errors.push(Diagnostic::span_error(span, msg)); - } - Some(ast::ImportModule::RawNamed(name.to_string(), span)) - } else if let Some((js, span)) = opts.inline_js() { - let i = program.inline_js.len(); - program.inline_js.push(js.to_string()); - Some(ast::ImportModule::Inline(i, span)) - } else { - None - }; + let module = module_from_opts(program, &opts) + .map_err(|e| errors.push(e)) + .unwrap_or_default(); for item in self.items.into_iter() { if let Err(e) = item.macro_parse(program, module.clone()) { errors.push(e); @@ -1438,6 +1431,38 @@ impl MacroParse> for syn::ForeignItem { } } +pub fn module_from_opts( + program: &mut ast::Program, + opts: &BindgenAttrs, +) -> Result, Diagnostic> { + let mut errors = Vec::new(); + let module = if let Some((name, span)) = opts.module() { + if opts.inline_js().is_some() { + let msg = "cannot specify both `module` and `inline_js`"; + errors.push(Diagnostic::span_error(span, msg)); + } + if opts.raw_module().is_some() { + let msg = "cannot specify both `module` and `raw_module`"; + errors.push(Diagnostic::span_error(span, msg)); + } + Some(ast::ImportModule::Named(name.to_string(), span)) + } else if let Some((name, span)) = opts.raw_module() { + if opts.inline_js().is_some() { + let msg = "cannot specify both `raw_module` and `inline_js`"; + errors.push(Diagnostic::span_error(span, msg)); + } + Some(ast::ImportModule::RawNamed(name.to_string(), span)) + } else if let Some((js, span)) = opts.inline_js() { + let i = program.inline_js.len(); + program.inline_js.push(js.to_string()); + Some(ast::ImportModule::Inline(i, span)) + } else { + None + }; + Diagnostic::from_vec(errors)?; + Ok(module) +} + /// Get the first type parameter of a generic type, errors on incorrect input. fn extract_first_ty_param(ty: Option<&syn::Type>) -> Result, Diagnostic> { let t = match ty { @@ -1654,3 +1679,21 @@ fn operation_kind(opts: &BindgenAttrs) -> ast::OperationKind { } operation_kind } + +pub fn link_to(opts: BindgenAttrs) -> Result { + let mut program = ast::Program::default(); + let module = module_from_opts(&mut program, &opts)?.ok_or_else(|| { + Diagnostic::span_error(Span::call_site(), "`link_to!` requires a module.") + })?; + if let ast::ImportModule::Named(p, s) | ast::ImportModule::RawNamed(p, s) = &module { + if !p.starts_with("./") && !p.starts_with("../") && !p.starts_with("/") { + return Err(Diagnostic::span_error( + *s, + "`link_to!` does not support module paths.", + )); + } + } + opts.enforce_used()?; + program.linked_modules.push(module); + Ok(ast::LinkToModule(program)) +} diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index f7a0bbb2176..9807e6870c4 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -27,3 +27,4 @@ quote = "1.0" trybuild = "1.0" wasm-bindgen = { path = "../..", version = "0.2.83" } wasm-bindgen-futures = { path = "../futures", version = "0.4.33" } +web-sys = { path = "../web-sys", version = "0.3.60" } diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index c677aaf24bf..fbae818750e 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -18,6 +18,35 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { } } +/// This macro takes a JS module as input and returns a URL that can be used to +/// access it at runtime. +/// +/// The module can be specified in a few ways: +/// - You can use `inline_js = "..."` to create an inline JS file. +/// - You can use `module = "/foo/bar"` to reference a file relative to the +/// root of the crate the macro is invoked in. +/// +/// The returned URL can be used for things like creating workers/worklets: +/// ```no_run +/// use web_sys::Worker; +/// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js")); +/// ``` +#[proc_macro] +pub fn link_to(input: TokenStream) -> TokenStream { + match wasm_bindgen_macro_support::expand_link_to(input.into()) { + Ok(tokens) => { + if cfg!(feature = "xxx_debug_only_print_generated_code") { + println!("{}", tokens); + } + tokens.into() + } + // This `String::clone` is here so that IDEs know this is supposed to be a + // `String` and can keep type-checking the rest of the program even if the macro + // fails. + Err(diagnostic) => (quote! { String::clone(#diagnostic) }).into(), + } +} + #[proc_macro_attribute] pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { diff --git a/crates/macro/src/worker.js b/crates/macro/src/worker.js new file mode 100644 index 00000000000..360d4d42923 --- /dev/null +++ b/crates/macro/src/worker.js @@ -0,0 +1 @@ +// This file is needed for the doctest of `crate::link_to`. diff --git a/crates/macro/ui-tests/link-to.rs b/crates/macro/ui-tests/link-to.rs new file mode 100644 index 00000000000..ce51c128e2e --- /dev/null +++ b/crates/macro/ui-tests/link-to.rs @@ -0,0 +1,32 @@ +fn good1() -> String { + wasm_bindgen::link_to!(inline_js = "console.log('Hello world!');") +} + +fn good2() -> String { + wasm_bindgen::link_to!(raw_module = "./foo.js") +} + +fn bad1() -> String { + wasm_bindgen::link_to!(module = "package/foo.js") +} + +fn bad2() -> String { + wasm_bindgen::link_to!(raw_module = "package/foo.js") +} + +fn bad3() -> String { + wasm_bindgen::link_to!(module = "/src/not-found.js") +} + +fn bad4() -> String { + wasm_bindgen::link_to!() +} + +fn bad5() -> String { + wasm_bindgen::link_to!( + inline_js = "console.log('Hello world!');", + js_namespace = foo + ) +} + +fn main() {} diff --git a/crates/macro/ui-tests/link-to.stderr b/crates/macro/ui-tests/link-to.stderr new file mode 100644 index 00000000000..61aaec7830f --- /dev/null +++ b/crates/macro/ui-tests/link-to.stderr @@ -0,0 +1,31 @@ +error: `link_to!` does not support module paths. + --> ui-tests/link-to.rs:10:37 + | +10 | wasm_bindgen::link_to!(module = "package/foo.js") + | ^^^^^^^^^^^^^^^^ + +error: `link_to!` does not support module paths. + --> ui-tests/link-to.rs:14:41 + | +14 | wasm_bindgen::link_to!(raw_module = "package/foo.js") + | ^^^^^^^^^^^^^^^^ + +error: failed to read file `$WORKSPACE/target/tests/trybuild/wasm-bindgen-macro/src/not-found.js`: No such file or directory (os error 2) + --> ui-tests/link-to.rs:18:37 + | +18 | wasm_bindgen::link_to!(module = "/src/not-found.js") + | ^^^^^^^^^^^^^^^^^^^ + +error: `link_to!` requires a module. + --> ui-tests/link-to.rs:22:5 + | +22 | wasm_bindgen::link_to!() + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `wasm_bindgen::link_to` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unused wasm_bindgen attribute + --> ui-tests/link-to.rs:28:9 + | +28 | js_namespace = foo + | ^^^^^^^^^^^^ diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index bb20598ddce..408613be9f1 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -22,6 +22,7 @@ macro_rules! shared_api { inline_js: Vec<&'a str>, unique_crate_identifier: &'a str, package_json: Option<&'a str>, + linked_modules: Vec>, } struct Import<'a> { @@ -30,6 +31,11 @@ macro_rules! shared_api { kind: ImportKind<'a>, } + struct LinkedModule<'a> { + module: ImportModule<'a>, + link_function_name: &'a str, + } + enum ImportModule<'a> { Named(&'a str), RawNamed(&'a str), diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 25084e90566..0d4d0bb38f1 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "1473650450341157828"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "584864585234329974"; #[test] fn schema_version() { diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index 9c26649606f..d08e066361c 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -103,4 +103,22 @@ about reference types](./reference-types.md). ### `--omit-default-module-path` -Don't add WebAssembly fallback imports in generated JavaScript. \ No newline at end of file +Don't add WebAssembly fallback imports in generated JavaScript. + +### `--split-linked-modules` + +Controls whether wasm-bindgen will split linked modules out into their own +files. Enabling this is recommended, because it allows lazy-loading the linked +modules and setting a stricter Content Security Policy. + +wasm-bindgen uses the `new URL('…', import.meta.url)` syntax to resolve the +links to such split out files. This breaks with most bundlers, since the bundler +doesn't know to include the linked module in its output. That's why this option +is disabled by default. Webpack 5 is an exception, which has special treatment +for that syntax. + +For other bundlers, you'll need to take extra steps to get it to work, likely by +using a plugin. Alternatively, you can leave the syntax as is and instead +manually configure the bundler to copy all files in `snippets/` to the output +directory, preserving their paths relative to whichever bundled file ends up +containing the JS shim. diff --git a/src/lib.rs b/src/lib.rs index 50920321b37..f8576ed4c3e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,6 +64,8 @@ pub mod prelude { pub use crate::JsError; } +pub use wasm_bindgen_macro::link_to; + pub mod convert; pub mod describe; diff --git a/tests/wasm/link_to.js b/tests/wasm/link_to.js new file mode 100644 index 00000000000..3028a6ae8a6 --- /dev/null +++ b/tests/wasm/link_to.js @@ -0,0 +1,4 @@ +const fs = require('fs'); +const url = require('url'); + +exports.read_file = (str) => fs.readFileSync(url.fileURLToPath(str), "utf8"); diff --git a/tests/wasm/link_to.rs b/tests/wasm/link_to.rs new file mode 100644 index 00000000000..e631bdb03d9 --- /dev/null +++ b/tests/wasm/link_to.rs @@ -0,0 +1,30 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "/tests/wasm/link_to.js")] +extern "C" { + #[wasm_bindgen(catch)] + fn read_file(url: &str) -> Result; +} + +#[wasm_bindgen_test] +fn test_module() { + let link = wasm_bindgen::link_to!(module = "/tests/wasm/linked_module.js"); + assert_eq!(read_file(&link).unwrap(), "// linked module\n"); +} + +#[wasm_bindgen_test] +fn test_raw_module() { + let link = wasm_bindgen::link_to!(raw_module = "./not-found.js"); + assert!(read_file(&link).is_err()); +} + +#[wasm_bindgen_test] +fn test_inline_js() { + // Test two invocations to ensure that snippet indices from different + // Program structs are offset correctly. + let link1 = wasm_bindgen::link_to!(inline_js = "// inline js 1\n"); + let link2 = wasm_bindgen::link_to!(inline_js = "// inline js 2\n"); + assert_eq!(read_file(&link1).unwrap(), "// inline js 1\n"); + assert_eq!(read_file(&link2).unwrap(), "// inline js 2\n"); +} diff --git a/tests/wasm/linked_module.js b/tests/wasm/linked_module.js new file mode 100644 index 00000000000..b979535b28e --- /dev/null +++ b/tests/wasm/linked_module.js @@ -0,0 +1 @@ +// linked module diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index fc838ada611..987962c88aa 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -32,6 +32,7 @@ pub mod intrinsics; pub mod js_keywords; pub mod js_objects; pub mod jscast; +pub mod link_to; pub mod math; pub mod no_shims; pub mod node; From 1f3c76bca62fa62a05aaae8194c454d693ecc712 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 2 Feb 2023 03:48:22 +1100 Subject: [PATCH 148/641] fix: Make maplike `set` and setlike `add` return `this`, not `undefined` (#3270) --- crates/webidl-tests/globals.js | 6 ++++-- crates/webidl-tests/maplike.rs | 6 ++++-- crates/webidl-tests/setlike.rs | 3 ++- crates/webidl/src/first_pass.rs | 20 ++++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/crates/webidl-tests/globals.js b/crates/webidl-tests/globals.js index bf70171c1ca..5816c108e42 100644 --- a/crates/webidl-tests/globals.js +++ b/crates/webidl-tests/globals.js @@ -207,7 +207,8 @@ global.TestReadWriteMapLike = class extends global.TestReadOnlyMapLike { } set(key, value) { - return this.map.set(key, value); + this.map.set(key, value); + return this; } delete(key) { @@ -258,7 +259,8 @@ global.TestReadWriteSetLike = class extends global.TestReadOnlySetLike { } add(value) { - return this.set.add(value); + this.set.add(value); + return this; } delete(value) { diff --git a/crates/webidl-tests/maplike.rs b/crates/webidl-tests/maplike.rs index 758ed00a9b2..6e63eb1b76b 100644 --- a/crates/webidl-tests/maplike.rs +++ b/crates/webidl-tests/maplike.rs @@ -87,10 +87,12 @@ fn write_maplike() { let maplike = TestReadWriteMapLike::new().unwrap(); // undefined set(K key, V value); - maplike.set("a", 4); - maplike.set("d", 5); + let ret1 = maplike.set("a", 4); + let ret2 = maplike.set("d", 5); assert_eq!(maplike.get("a"), Some(4)); assert_eq!(maplike.get("d"), Some(5)); + assert_eq!(ret1, maplike); + assert_eq!(ret2, maplike); // boolean delete(K key); assert!(maplike.delete("a")); diff --git a/crates/webidl-tests/setlike.rs b/crates/webidl-tests/setlike.rs index d77dd61c16e..74700627391 100644 --- a/crates/webidl-tests/setlike.rs +++ b/crates/webidl-tests/setlike.rs @@ -78,8 +78,9 @@ fn write_setlike() { // { "a", "b", "c" } let setlike = TestReadWriteSetLike::new().unwrap(); - setlike.add("d"); + let ret = setlike.add("d"); assert_eq!(setlike.size(), 4); + assert_eq!(ret, setlike); assert!(setlike.delete("d")); assert_eq!(setlike.size(), 3); diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index 68e4a8c129d..91f3ed143bf 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -848,15 +848,19 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> stability, ); - // TODO: `set` actually returns `this` but we don't have a way to express that just yet - // undefined set(K key, V value); + // set(K key, V value); first_pass_operation( record, FirstPassOperationType::Interface, self_name, &[OperationId::Operation(Some("set"))], [key_arg(), value_arg()], - &undefined_ret(), + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier(self_name), + q_mark: None, + }, + )))), &None, false, stability, @@ -1051,15 +1055,19 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> ctx.1, ); - // TODO: `add` actually returns `this` but we don't have a way to express that just yet - // undefined add(V value); + // add(V value); first_pass_operation( record, FirstPassOperationType::Interface, ctx.0, &[OperationId::Operation(Some("add"))], [value_arg()], - &undefined_ret(), + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier(ctx.0), + q_mark: None, + }, + )))), &None, false, ctx.1, From 995adac992e859428694e08960467c1110c579bf Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Wed, 1 Feb 2023 17:48:50 +0100 Subject: [PATCH 149/641] Remove explicit allocator (#3273) --- crates/cli/src/bin/wasm-bindgen-test-runner/main.rs | 4 ---- crates/cli/src/bin/wasm-bindgen.rs | 4 ---- crates/cli/src/bin/wasm2es6js.rs | 4 ---- 3 files changed, 12 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 5ddca003120..067367b9fc5 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -18,10 +18,6 @@ use std::path::PathBuf; use std::thread; use wasm_bindgen_cli_support::Bindgen; -// no need for jemalloc bloat in this binary (and we don't need speed) -#[global_allocator] -static ALLOC: std::alloc::System = std::alloc::System; - mod deno; mod headless; mod node; diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index f6e16a4fb8e..e5542af5e27 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -5,10 +5,6 @@ use std::path::PathBuf; use std::process; use wasm_bindgen_cli_support::{Bindgen, EncodeInto}; -// no need for jemalloc bloat in this binary (and we don't need speed) -#[global_allocator] -static ALLOC: std::alloc::System = std::alloc::System; - const USAGE: &'static str = " Generating JS bindings for a wasm file diff --git a/crates/cli/src/bin/wasm2es6js.rs b/crates/cli/src/bin/wasm2es6js.rs index caa35cf122b..3893858dfc3 100644 --- a/crates/cli/src/bin/wasm2es6js.rs +++ b/crates/cli/src/bin/wasm2es6js.rs @@ -4,10 +4,6 @@ use serde::Deserialize; use std::fs; use std::path::PathBuf; -// no need for jemalloc bloat in this binary (and we don't need speed) -#[global_allocator] -static ALLOC: std::alloc::System = std::alloc::System; - const USAGE: &'static str = " Converts a wasm file to an ES6 JS module From cea8cc3d2968bd11560ea6a64f8b6b1ff6673c12 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 1 Feb 2023 11:06:50 -0600 Subject: [PATCH 150/641] Bump to 0.2.84 (#3274) Closes #3267 --- Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 10 +++++----- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-audio-worklet/Cargo.toml | 6 +++--- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- 49 files changed, 105 insertions(+), 105 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1806dd98758..ebbeda2cf8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -35,15 +35,15 @@ strict-macro = ["wasm-bindgen-macro/strict-macro"] xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.83" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.84" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.60' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.33' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.33' } +js-sys = { path = 'crates/js-sys', version = '0.3.61' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.34' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.34' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 56dcac338a1..9c674369341 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -22,4 +22,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.84" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index fe676396e69..3634deecb3e 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -19,12 +19,12 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.19.0" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.83' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.83' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.83' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.83' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.83' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.83' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.84' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.84' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.84' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.84' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.84' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.84' } wit-text = "0.8.0" wit-walrus = "0.6.0" wit-validator = "0.2.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 0d914175cef..d754991020b 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -26,8 +26,8 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" walrus = { version = "0.19.0", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.83" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.84" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.84" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 57e7d7f79cc..8bd66dea0b3 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 696733eb3bd..126ac5bb8ed 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,13 +7,13 @@ license = "MIT/Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.33" +version = "0.4.34" edition = "2018" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.60' } -wasm-bindgen = { path = "../..", version = '0.2.83' } +js-sys = { path = "../js-sys", version = '0.3.61' } +wasm-bindgen = { path = "../..", version = '0.2.84' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -28,6 +28,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.33' } +wasm-bindgen-test = { path = '../test', version = '0.3.34' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index fd2efd64391..357c0059ce3 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.60" +version = "0.3.61" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -19,9 +19,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.83" } +wasm-bindgen = { path = "../..", version = "0.2.84" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.33' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } -web-sys = { path = "../web-sys", version = "0.3.60", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.34' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.34' } +web-sys = { path = "../web-sys", version = "0.3.61", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 0e393be6069..d44821c5b66 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -20,5 +20,5 @@ strict-macro = [] syn = { version = '1.0.84', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.83" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.83" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.84" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.84" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 9807e6870c4..818bf5c4bfb 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -20,11 +20,11 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.83" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.84" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.83" } -wasm-bindgen-futures = { path = "../futures", version = "0.4.33" } -web-sys = { path = "../web-sys", version = "0.3.60" } +wasm-bindgen = { path = "../..", version = "0.2.84" } +wasm-bindgen-futures = { path = "../futures", version = "0.4.34" } +web-sys = { path = "../web-sys", version = "0.3.61" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 767e47d2524..ac5b6c6e3b7 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 013ccd8c6c3..2cb4ed7924b 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 3b4da715d34..52278d58d01 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.33" +version = "0.3.34" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT/Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index a61ac6b7324..7b7ef2192c1 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.33" +version = "0.3.34" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT/Apache-2.0" @@ -9,11 +9,11 @@ edition = "2018" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.60' } +js-sys = { path = '../js-sys', version = '0.3.61' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.83' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.33' } +wasm-bindgen = { path = '../..', version = '0.2.84' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.34' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.34' } [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 64c4b81e5b8..c2908ab5fa9 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -14,7 +14,7 @@ edition = "2018" [dependencies] anyhow = "1.0" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.83" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.84" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index c677658f5da..d0c1034f26b 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 5cbe32f4643..77d095aeced 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.83" +version = "0.2.84" authors = ["The wasm-bindgen Developers"] license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" @@ -15,7 +15,7 @@ edition = '2018' anyhow = "1.0" log = "0.4" walrus = "0.19.0" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.83" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.84" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 8fbc9384d68..9515ee84858 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.60" +version = "0.3.61" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -21,12 +21,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.83" } -js-sys = { path = '../js-sys', version = '0.3.60' } +wasm-bindgen = { path = "../..", version = "0.2.84" } +js-sys = { path = '../js-sys', version = '0.3.61' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.33' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.33' } +wasm-bindgen-test = { path = '../test', version = '0.3.34' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.34' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 52b60e96bd0..5285e45b348 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -20,7 +20,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '1.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.83", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.84", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index fdff38f2eef..5d524496928 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 4884000626b..7556ee941f6 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index d6999023ed7..e2f335087d7 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 57ebeceae08..a2b5d87b81c 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" +wasm-bindgen = "0.2.84" +js-sys = "0.3.61" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index fceca22faa9..2bb59c60385 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -web-sys = { version = "0.3.60", features = ['console'] } +wasm-bindgen = "0.2.84" +web-sys = { version = "0.3.61", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 307ed26e2e8..13b9dad8751 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index bb65d27f123..42b68c763c1 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index c51d0c4c650..c6fa54c71ad 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 56650346a4b..c8ebb46977b 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.84" +js-sys = "0.3.61" +wasm-bindgen-futures = "0.4.34" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index d5c6b5bb62f..2d25b7037fa 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" +wasm-bindgen = "0.2.84" +js-sys = "0.3.61" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index abff0cf3fd8..0de7d193861 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 34af28ff828..540bf214188 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index dc24bcdb4d4..d42a367055d 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 904786551fa..0b6c1347bf0 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 0c2cf684b13..1a7ba6827ef 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index c3840f119cd..def3a635945 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -9,14 +9,14 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.60" +js-sys = "0.3.61" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.4.3" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = "0.2.83" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.84" +wasm-bindgen-futures = "0.4.34" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index fff34c58d3f..d3b0aa2499f 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 92fce05271b..6644b450386 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index 85f566cc59c..72223c904aa 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -11,8 +11,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index 184226d67f3..6cc73c463e1 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -8,9 +8,9 @@ crate-type = ["cdylib"] [dependencies] console_log = "0.2.0" -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" -wasm-bindgen-futures = "0.4.33" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" +wasm-bindgen-futures = "0.4.34" [dependencies.web-sys] version = "0.3.59" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index f7c984fbcd3..d89122f0bd0 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.84" +js-sys = "0.3.61" +wasm-bindgen-futures = "0.4.34" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 6f0adfb80a3..ce810d9c6ee 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.84" +js-sys = "0.3.61" +wasm-bindgen-futures = "0.4.34" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index b104a4781da..0e187a531c9 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 68bceb4dc5d..d0cef92950b 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index a91699e7726..b64e23e3919 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -15,7 +15,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 6c50bb5ce2c..a4a16ba4235 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index a5efb9f693e..c53b952dbe7 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 2c31ace92bf..ce80a2d0a0d 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" js-sys = "0.3" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen-futures = "0.4.34" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index fd34117a0e8..014ad0c86e6 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 8351328d6e7..2598649bdf2 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" -wasm-bindgen-futures = "0.4.33" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" +wasm-bindgen-futures = "0.4.34" [dependencies.web-sys] version = "0.3.36" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 4180dafafdb..038a7829cb6 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.83" +wasm-bindgen = "0.2.84" [dependencies.web-sys] version = "0.3.4" From 5f6e651ea17bff33775c4477e036d644c4c2b6e9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 2 Feb 2023 10:17:41 +0100 Subject: [PATCH 151/641] Adjust examples and docs to thread-aware `start` (#3248) --- crates/wasm-conventions/src/lib.rs | 2 +- examples/wasm-in-web-worker/index.js | 13 ++----------- examples/wasm-in-web-worker/src/lib.rs | 4 ++-- guide/src/examples/wasm-in-web-worker.md | 13 ++++++------- .../reference/attributes/on-rust-exports/start.md | 2 -- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index e1617397151..cf5b209c0d2 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -120,7 +120,7 @@ pub fn get_or_insert_start_builder(module: &mut Module) -> &mut FunctionBuilder Some(start) => match module.funcs.get_mut(start).kind { FunctionKind::Import(_) => Err(Some(start)), FunctionKind::Local(_) => Ok(start), - FunctionKind::Uninitialized(_) => todo!(), + FunctionKind::Uninitialized(_) => unimplemented!(), }, None => Err(None), } diff --git a/examples/wasm-in-web-worker/index.js b/examples/wasm-in-web-worker/index.js index 9de6d133004..af228cf0dc3 100644 --- a/examples/wasm-in-web-worker/index.js +++ b/examples/wasm-in-web-worker/index.js @@ -1,18 +1,9 @@ -// We only need `startup` here which is the main entry point -// In theory, we could also use all other functions/struct types from Rust which we have bound with -// `#[wasm_bindgen]` -const {startup} = wasm_bindgen; - async function run_wasm() { + console.log('index.js loaded'); + // Load the wasm file by awaiting the Promise returned by `wasm_bindgen` // `wasm_bindgen` was imported in `index.html` await wasm_bindgen('./pkg/wasm_in_web_worker_bg.wasm'); - - console.log('index.js loaded'); - - // Run main WASM entry point - // This will create a worker from within our Rust code compiled to WASM - startup(); } run_wasm(); diff --git a/examples/wasm-in-web-worker/src/lib.rs b/examples/wasm-in-web-worker/src/lib.rs index 8f72d0a2e41..8b06a5f38a4 100644 --- a/examples/wasm-in-web-worker/src/lib.rs +++ b/examples/wasm-in-web-worker/src/lib.rs @@ -42,8 +42,8 @@ impl NumberEval { } /// Run entry point for the main thread. -#[wasm_bindgen] -pub fn startup() { +#[wasm_bindgen(start)] +fn start() { // Here, we create our worker. In a larger app, multiple callbacks should be // able to interact with the code in the worker. Therefore, we wrap it in // `Rc` following the interior mutability pattern. Here, it would diff --git a/guide/src/examples/wasm-in-web-worker.md b/guide/src/examples/wasm-in-web-worker.md index f17a7c31739..d088c22dc17 100644 --- a/guide/src/examples/wasm-in-web-worker.md +++ b/guide/src/examples/wasm-in-web-worker.md @@ -27,11 +27,10 @@ the JS console, creating a worker and reacting to message events. ## `src/lib.rs` Creates a struct `NumberEval` with methods to act as stateful object in the -worker and function `startup` to be launched in the main thread. Also includes -internal helper functions `setup_input_oninput_callback` to attach a -`wasm_bindgen::Closure` as callback to the `oninput` event of the input field -and `get_on_msg_callback` to create a `wasm_bindgen::Closure` which is triggered -when the worker returns a message. +worker and `start` function. Also includes internal helper functions +`setup_input_oninput_callback` to attach a `wasm_bindgen::Closure` as callback +to the `oninput` event of the input field and `get_on_msg_callback` to create a +`wasm_bindgen::Closure` which is triggered when the worker returns a message. ```rust {{#include ../../../examples/wasm-in-web-worker/src/lib.rs}} @@ -51,8 +50,8 @@ both `wasm_in_web_worker.js` and `index.js`. ## `index.js` -Loads our WASM file asynchronously and calls the entry point `startup` of the -main thread which will create a worker. +Loads our WASM file asynchronously which calls the `start` function and creates +a worker. ```js {{#include ../../../examples/wasm-in-web-worker/index.js}} diff --git a/guide/src/reference/attributes/on-rust-exports/start.md b/guide/src/reference/attributes/on-rust-exports/start.md index 3cbf67d0ac2..83bd7f4ae04 100644 --- a/guide/src/reference/attributes/on-rust-exports/start.md +++ b/guide/src/reference/attributes/on-rust-exports/start.md @@ -25,7 +25,5 @@ There's a few caveats to be aware of when using the `start` attribute: dependencies. If more than one is specified then `wasm-bindgen` will fail when the CLI is run. It's recommended that only applications use this attribute. * The `start` function will not be executed when testing. -* If you're experimenting with WebAssembly threads, the `start` function is - executed *once per thread*, not once globally! * Note that the `start` function is relatively new, so if you find any bugs with it, please feel free to report an issue! From c5b073ae58cb3b6d44252108ea9862bf0d04f3b6 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Thu, 2 Feb 2023 13:09:28 +0100 Subject: [PATCH 152/641] examples/wasm-audio-worklet: `link_to!` polyfill (#3272) --- examples/wasm-audio-worklet/build.sh | 3 ++- examples/wasm-audio-worklet/src/dependent_module.rs | 7 +++++-- examples/wasm-audio-worklet/src/polyfill.js | 3 --- examples/wasm-audio-worklet/src/wasm_audio.rs | 9 --------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/examples/wasm-audio-worklet/build.sh b/examples/wasm-audio-worklet/build.sh index 90b8fc9cb14..576fec80605 100755 --- a/examples/wasm-audio-worklet/build.sh +++ b/examples/wasm-audio-worklet/build.sh @@ -18,4 +18,5 @@ RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ cargo run -p wasm-bindgen-cli -- \ ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \ --out-dir . \ - --target web + --target web \ + --split-linked-modules diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs index d4180e3985e..fa01b0acb23 100644 --- a/examples/wasm-audio-worklet/src/dependent_module.rs +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -17,9 +17,12 @@ extern "C" { } pub fn on_the_fly(code: &str) -> Result { - // Generate the import of the bindgen ES module, assuming `--target web`: + // Generate the import of the bindgen ES module, assuming `--target web`, + // preluded by the TextEncoder/TextDecoder polyfill needed inside worklets. let header = format!( - "import init, * as bindgen from '{}';\n\n", + "import '{}';\n\ + import init, * as bindgen from '{}';\n\n", + wasm_bindgen::link_to!(module = "/src/polyfill.js"), IMPORT_META.url(), ); diff --git a/examples/wasm-audio-worklet/src/polyfill.js b/examples/wasm-audio-worklet/src/polyfill.js index 146a0e2c578..d4d57e9fa67 100644 --- a/examples/wasm-audio-worklet/src/polyfill.js +++ b/examples/wasm-audio-worklet/src/polyfill.js @@ -21,6 +21,3 @@ if (!globalThis.TextEncoder) { } }; } - -export function nop() { -} diff --git a/examples/wasm-audio-worklet/src/wasm_audio.rs b/examples/wasm-audio-worklet/src/wasm_audio.rs index fa149dd0471..8fe7c6d77c7 100644 --- a/examples/wasm-audio-worklet/src/wasm_audio.rs +++ b/examples/wasm-audio-worklet/src/wasm_audio.rs @@ -53,16 +53,7 @@ pub fn wasm_audio_node( } pub async fn prepare_wasm_audio(ctx: &AudioContext) -> Result<(), JsValue> { - nop(); let mod_url = dependent_module!("worklet.js")?; JsFuture::from(ctx.audio_worklet()?.add_module(&mod_url)?).await?; Ok(()) } - -// TextEncoder and TextDecoder are not available in Audio Worklets, but there -// is a dirty workaround: Import polyfill.js to install stub implementations -// of these classes in globalThis. -#[wasm_bindgen(module = "/src/polyfill.js")] -extern "C" { - fn nop(); -} From 3a939c4047c28b9276253d58f053f13df8d2ae72 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 2 Feb 2023 13:26:51 +0100 Subject: [PATCH 153/641] Remove faulty `location.href` fallback and disable `--split-linked-modules` by default (#3279) * Remove faulty `location.href` fallback * Disable `--split-linked-modules` in cli-support --- .github/workflows/main.yml | 2 ++ crates/cli-support/src/js/mod.rs | 6 ++---- crates/cli-support/src/lib.rs | 2 +- crates/cli/src/bin/wasm-bindgen-test-runner/main.rs | 4 ++++ crates/cli/tests/wasm-bindgen/main.rs | 6 ++---- guide/src/reference/cli.md | 4 ++++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4fff2677b47..e46a64a709f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,6 +41,8 @@ jobs: test_wasm_bindgen: name: "Run wasm-bindgen crate tests (unix)" runs-on: ubuntu-latest + env: + WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 steps: - uses: actions/checkout@v2 - run: rustup update --no-self-update stable && rustup default stable diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 5f0cb08abe3..eb2583a9e7c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -381,9 +381,7 @@ impl<'a> Context<'a> { js.push_str("let script_src;\n"); js.push_str( "\ - if (typeof document === 'undefined') { - script_src = location.href; - } else { + if (typeof document !== 'undefined') { script_src = new URL(document.currentScript.src, location.href).toString(); }\n", ); @@ -720,7 +718,7 @@ impl<'a> Context<'a> { stem = self.config.stem()? ), OutputMode::NoModules { .. } => "\ - if (typeof input === 'undefined') { + if (typeof input === 'undefined' && script_src !== 'undefined') { input = script_src.replace(/\\.js$/, '_bg.wasm'); }" .to_string(), diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 1f8b446c2dd..00800ca08a3 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -121,7 +121,7 @@ impl Bindgen { wasm_interface_types, encode_into: EncodeInto::Test, omit_default_module_path: true, - split_linked_modules: true, + split_linked_modules: false, } } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 067367b9fc5..7f6606a3e33 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -167,6 +167,10 @@ integration test.\ TestMode::NoModule => b.no_modules(true)?, }; + if std::env::var("WASM_BINDGEN_SPLIT_LINKED_MODULES").is_ok() { + b.split_linked_modules(true); + } + b.debug(debug) .input_module(module, wasm) .keep_debug(false) diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index e854de23e51..bed6b2de9ad 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -260,16 +260,14 @@ fn default_module_path_target_no_modules() { fs::read_to_string(out_dir.join("default_module_path_target_no_modules.js")).unwrap(); assert!(contents.contains( "\ - if (typeof document === 'undefined') { - script_src = location.href; - } else { + if (typeof document !== 'undefined') { script_src = new URL(document.currentScript.src, location.href).toString(); }", )); assert!(contents.contains( "\ async function init(input) { - if (typeof input === 'undefined') { + if (typeof input === 'undefined' && script_src !== 'undefined') { input = script_src.replace(/\\.js$/, '_bg.wasm'); }", )); diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index d08e066361c..0d66d5cd7f1 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -122,3 +122,7 @@ using a plugin. Alternatively, you can leave the syntax as is and instead manually configure the bundler to copy all files in `snippets/` to the output directory, preserving their paths relative to whichever bundled file ends up containing the JS shim. + +On the no-modules target, `link_to!` won't work if used outside of a document, +e.g. inside a worker. This is because it's impossible to figure out what the +URL of the linked module is without a reference point like `import.meta.url`. From 46ea32f20eb4e56ac35ef46acc438d7f4767c12c Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 3 Feb 2023 02:29:11 +1100 Subject: [PATCH 154/641] Revert #3248's changes to the `wasm-in-web-worker` example (#3278) The start function still gets called on every thread in that example because it doesn't actually use wasm multithreading; each thread's instance has it's own separate memory pool and is completely unaware of the other thread. So, attempting to switch it to use a regular start function caused the worker thread to spawn another one, which does likewise, quickly spiralling out of control. It also ended up panicking because, thinking it was the main thread, the code was trying to access `window` inside of a worker. --- examples/wasm-in-web-worker/index.js | 13 +++++++++++-- examples/wasm-in-web-worker/src/lib.rs | 4 ++-- guide/src/examples/wasm-in-web-worker.md | 13 +++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/wasm-in-web-worker/index.js b/examples/wasm-in-web-worker/index.js index af228cf0dc3..9de6d133004 100644 --- a/examples/wasm-in-web-worker/index.js +++ b/examples/wasm-in-web-worker/index.js @@ -1,9 +1,18 @@ -async function run_wasm() { - console.log('index.js loaded'); +// We only need `startup` here which is the main entry point +// In theory, we could also use all other functions/struct types from Rust which we have bound with +// `#[wasm_bindgen]` +const {startup} = wasm_bindgen; +async function run_wasm() { // Load the wasm file by awaiting the Promise returned by `wasm_bindgen` // `wasm_bindgen` was imported in `index.html` await wasm_bindgen('./pkg/wasm_in_web_worker_bg.wasm'); + + console.log('index.js loaded'); + + // Run main WASM entry point + // This will create a worker from within our Rust code compiled to WASM + startup(); } run_wasm(); diff --git a/examples/wasm-in-web-worker/src/lib.rs b/examples/wasm-in-web-worker/src/lib.rs index 8b06a5f38a4..8f72d0a2e41 100644 --- a/examples/wasm-in-web-worker/src/lib.rs +++ b/examples/wasm-in-web-worker/src/lib.rs @@ -42,8 +42,8 @@ impl NumberEval { } /// Run entry point for the main thread. -#[wasm_bindgen(start)] -fn start() { +#[wasm_bindgen] +pub fn startup() { // Here, we create our worker. In a larger app, multiple callbacks should be // able to interact with the code in the worker. Therefore, we wrap it in // `Rc` following the interior mutability pattern. Here, it would diff --git a/guide/src/examples/wasm-in-web-worker.md b/guide/src/examples/wasm-in-web-worker.md index d088c22dc17..f17a7c31739 100644 --- a/guide/src/examples/wasm-in-web-worker.md +++ b/guide/src/examples/wasm-in-web-worker.md @@ -27,10 +27,11 @@ the JS console, creating a worker and reacting to message events. ## `src/lib.rs` Creates a struct `NumberEval` with methods to act as stateful object in the -worker and `start` function. Also includes internal helper functions -`setup_input_oninput_callback` to attach a `wasm_bindgen::Closure` as callback -to the `oninput` event of the input field and `get_on_msg_callback` to create a -`wasm_bindgen::Closure` which is triggered when the worker returns a message. +worker and function `startup` to be launched in the main thread. Also includes +internal helper functions `setup_input_oninput_callback` to attach a +`wasm_bindgen::Closure` as callback to the `oninput` event of the input field +and `get_on_msg_callback` to create a `wasm_bindgen::Closure` which is triggered +when the worker returns a message. ```rust {{#include ../../../examples/wasm-in-web-worker/src/lib.rs}} @@ -50,8 +51,8 @@ both `wasm_in_web_worker.js` and `index.js`. ## `index.js` -Loads our WASM file asynchronously which calls the `start` function and creates -a worker. +Loads our WASM file asynchronously and calls the entry point `startup` of the +main thread which will create a worker. ```js {{#include ../../../examples/wasm-in-web-worker/index.js}} From 6dd732ad73b7522a0c4c7874105295867e8ccf1b Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 3 Feb 2023 22:24:44 +0100 Subject: [PATCH 155/641] Fix some typos (#3281) --- crates/cli-support/src/descriptors.rs | 2 +- crates/cli-support/src/externref.rs | 4 ++-- crates/cli-support/src/js/mod.rs | 4 ++-- crates/cli-support/src/wit/nonstandard.rs | 4 ++-- crates/cli/src/bin/wasm2es6js.rs | 2 +- crates/example-tests/src/lib.rs | 8 ++++---- crates/futures/README.md | 2 +- crates/js-sys/src/lib.rs | 8 ++++---- crates/test/sample/tests/common/mod.rs | 2 +- crates/threads-xform/src/lib.rs | 4 ++-- crates/web-sys/tests/wasm/element.rs | 2 +- src/cast.rs | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/cli-support/src/descriptors.rs b/crates/cli-support/src/descriptors.rs index 36e81092a3b..72ca72d4f40 100644 --- a/crates/cli-support/src/descriptors.rs +++ b/crates/cli-support/src/descriptors.rs @@ -3,7 +3,7 @@ //! The purpose of this module is to basically execute a pass on a raw wasm //! module that just came out of the compiler. The pass will execute all //! relevant descriptor functions contained in the module which wasm-bindgen -//! uses to convey type infomation here, to the CLI. +//! uses to convey type information here, to the CLI. //! //! All descriptor functions are removed after this pass runs and in their stead //! a new custom section, defined in this module, is inserted into the diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index fa158d054da..7e69fcce70d 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -74,7 +74,7 @@ pub fn process(module: &mut Module) -> Result<()> { aux.externref_drop_slice = meta.drop_slice; } - // Additonally we may need to update some adapter instructions other than + // Additionally we may need to update some adapter instructions other than // those found for the externref pass. These are some general "fringe support" // things necessary to get absolutely everything working. for (_, adapter) in section.adapters.iter_mut() { @@ -411,7 +411,7 @@ pub fn force_contiguous_elements(module: &mut Module) -> Result<()> { // Here we take a look at all element segments in the module to see if we // need to split them. for segment in module.elements.iter_mut() { - // If this segment has all-`Some` members then it's alrady contiguous + // If this segment has all-`Some` members then it's already contiguous // and we can skip it. if segment.members.iter().all(|m| m.is_some()) { continue; diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index eb2583a9e7c..13379ec26cd 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1207,7 +1207,7 @@ impl<'a> Context<'a> { // Another possibility is to use `TextEncoder#encodeInto` which is much // newer and isn't implemented everywhere yet. It's more efficient, - // however, becaues it allows us to elide an intermediate allocation. + // however, because it allows us to elide an intermediate allocation. let encode_into = "function (arg, view) { return cachedTextEncoder.encodeInto(arg, view); }"; @@ -2876,7 +2876,7 @@ impl<'a> Context<'a> { /// Generates a JS snippet appropriate for invoking `import`. /// /// This is generating code for `binding` where `bindings` has more type - /// infomation. The `args` array is the list of JS expressions representing + /// information. The `args` array is the list of JS expressions representing /// the arguments to pass to JS. Finally `variadic` indicates whether the /// last argument is a list to be splatted in a variadic way, and `prelude` /// is a location to push some more initialization JS if necessary. diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 4c7eb523555..46bcfedd8ff 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -97,14 +97,14 @@ pub struct AuxExport { /// currently take integer parameters and require a JS wrapper, but ideally /// we'd change them one day to taking/receiving `externref` which then use some /// sort of webidl import to customize behavior or something like that. In any -/// case this doesn't feel quite right in terms of priviledge separation, so +/// case this doesn't feel quite right in terms of privilege separation, so /// we'll want to work on this. For now though it works. #[derive(Debug)] pub enum AuxExportKind { /// A free function that's just listed on the exported module Function(String), - /// A function that's used to create an instane of a class. The function + /// A function that's used to create an instance of a class. The function /// actually return just an integer which is put on an JS object currently. Constructor(String), diff --git a/crates/cli/src/bin/wasm2es6js.rs b/crates/cli/src/bin/wasm2es6js.rs index 3893858dfc3..e66d2abe13e 100644 --- a/crates/cli/src/bin/wasm2es6js.rs +++ b/crates/cli/src/bin/wasm2es6js.rs @@ -14,7 +14,7 @@ Usage: Options: -h --help Show this screen. -o --output FILE File to place output in - --out-dir DIR Directory to place ouptut in + --out-dir DIR Directory to place output in --typescript Output a `*.d.ts` file next to the JS output --base64 Inline the wasm module using base64 encoding --fetch PATH Load module by passing the PATH argument to `fetch()` diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 7635cda642f..4b3d6c99f9c 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -58,7 +58,7 @@ impl From> for Result { } } -/// An error that occured while running a command. +/// An error that occurred while running a command. #[derive(Serialize, Deserialize, Debug, Clone)] struct CommandError { /// The kind of error that occurred. @@ -93,7 +93,7 @@ enum BidiErrorKind { /// An invalid argument was passed for a command. #[serde(rename = "invalid argument")] InvalidArgument, - /// Some other kind of error occured. + /// Some other kind of error occurred. #[serde(rename = "unknown error")] UnknownError, } @@ -360,7 +360,7 @@ pub async fn test_example( if entry.level == LogLevel::Error { if let Some(text) = entry.text { - let mut msg = format!("An error occured: {text}"); + let mut msg = format!("An error occurred: {text}"); if let Some(stack_trace) = entry.stack_trace { write!(msg, "\n\nStack trace:").unwrap(); @@ -371,7 +371,7 @@ pub async fn test_example( bail!("{msg}") } else { - bail!("An error occured") + bail!("An error occurred") } } } diff --git a/crates/futures/README.md b/crates/futures/README.md index eb0a067f3ca..f458c0448e1 100644 --- a/crates/futures/README.md +++ b/crates/futures/README.md @@ -1,6 +1,6 @@ # `wasm-bindgen-futures` -[API Documention][docs] +[API Documentation][docs] This crate bridges the gap between a Rust `Future` and a JavaScript `Promise`. It provides two conversions: diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 92890a62b72..ecbc11270b0 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -1022,7 +1022,7 @@ pub mod Atomics { #[wasm_bindgen(js_namespace = Atomics, catch, js_name = store)] pub fn store_bigint(typed_array: &JsValue, index: u32, value: i64) -> Result; - /// The static `Atomics.sub()` method substracts a given value at a + /// The static `Atomics.sub()` method subtracts a given value at a /// given position in the array and returns the old value at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. @@ -1033,7 +1033,7 @@ pub mod Atomics { #[wasm_bindgen(js_namespace = Atomics, catch)] pub fn sub(typed_array: &JsValue, index: u32, value: i32) -> Result; - /// The static `Atomics.sub()` method substracts a given value at a + /// The static `Atomics.sub()` method subtracts a given value at a /// given position in the array and returns the old value at that position. /// This atomic operation guarantees that no other write happens /// until the modified value is written back. @@ -4425,7 +4425,7 @@ pub mod WebAssembly { #[wasm_bindgen(method, getter, js_namespace = WebAssembly)] pub fn buffer(this: &Memory) -> JsValue; - /// The `grow()` protoype method of the `Memory` object increases the + /// The `grow()` prototype method of the `Memory` object increases the /// size of the memory instance by a specified number of WebAssembly /// pages. /// @@ -5964,7 +5964,7 @@ macro_rules! arrays { /// the returned value here to be invalidated. Use with caution! /// /// Additionally the returned object can be safely mutated, - /// the changes are guranteed to be reflected in the input array. + /// the changes are guaranteed to be reflected in the input array. pub unsafe fn view_mut_raw(ptr: *mut $ty, length: usize) -> $name { let buf = wasm_bindgen::memory(); let mem = buf.unchecked_ref::(); diff --git a/crates/test/sample/tests/common/mod.rs b/crates/test/sample/tests/common/mod.rs index 35d42654069..7c8135f0e73 100644 --- a/crates/test/sample/tests/common/mod.rs +++ b/crates/test/sample/tests/common/mod.rs @@ -18,7 +18,7 @@ async fn pass_after_2s() { #[wasm_bindgen_test] fn fail() { - console_log!("helpful messsage, please see me"); + console_log!("helpful message, please see me"); panic!("this is a failing test"); } diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 4893de652b3..cddcaa0dc1a 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -47,7 +47,7 @@ impl Config { // that we have work to do. If shared memory isn't enabled, though then // this isn't an atomic module so there's nothing to do. We still allow, // though, an environment variable to force us to go down this path to - // remain compatibile with older LLVM outputs. + // remain compatible with older LLVM outputs. match wasm_conventions::get_memory(module) { Ok(memory) => module.memories.get(memory).shared, Err(_) => false, @@ -454,7 +454,7 @@ fn find_function(module: &Module, name: &str) -> Result { .ok_or_else(|| anyhow!("failed to find `{}`", name))?; match e.item { walrus::ExportItem::Function(f) => Ok(f), - _ => bail!("`{}` wasn't a funtion", name), + _ => bail!("`{}` wasn't a function", name), } } diff --git a/crates/web-sys/tests/wasm/element.rs b/crates/web-sys/tests/wasm/element.rs index a408a9c7cdf..0184b8525cf 100644 --- a/crates/web-sys/tests/wasm/element.rs +++ b/crates/web-sys/tests/wasm/element.rs @@ -160,7 +160,7 @@ fn element() { assert_eq!( element.inner_html(), "Hey!Web!", - "Should return HTML conent" + "Should return HTML content" ); assert_eq!( element.query_selector_all("strong").unwrap().length(), diff --git a/src/cast.rs b/src/cast.rs index 6be56a2d75a..e462cf8364b 100644 --- a/src/cast.rs +++ b/src/cast.rs @@ -3,7 +3,7 @@ use crate::{describe::WasmDescribe, JsValue}; /// A trait for checked and unchecked casting between JS types. /// /// Specified [in an RFC][rfc] this trait is intended to provide support for -/// casting JS values between differnet types of one another. In JS there aren't +/// casting JS values between different types of one another. In JS there aren't /// many static types but we've ascribed JS values with static types in Rust, /// yet they often need to be switched to other types temporarily! This trait /// provides both checked and unchecked casting into various kinds of values. From ff079ae196c9c0a012dbf9a5049afa7867cc9fb3 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 3 Feb 2023 22:25:14 +0100 Subject: [PATCH 156/641] Update actions/checkout in GitHub Actions workflows to v3 (#3282) --- .github/workflows/main.yml | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e46a64a709f..1d6680ec367 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check @@ -34,7 +34,7 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: cargo check --all @@ -44,7 +44,7 @@ jobs: env: WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -75,7 +75,7 @@ jobs: name: "Run wasm-bindgen crate tests with multithreading enabled" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup default nightly-2022-05-19 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src @@ -90,7 +90,7 @@ jobs: # name: "Run wasm-bindgen crate tests (Windows)" # runs-on: windows-latest # steps: - # - uses: actions/checkout@v2 + # - uses: actions/checkout@v3 # - run: rustup update --no-self-update stable && rustup default stable # - run: rustup target add wasm32-unknown-unknown # - uses: actions/setup-node@v2 @@ -111,7 +111,7 @@ jobs: name: Run native tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -130,7 +130,7 @@ jobs: name: "Run web-sys crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -150,7 +150,7 @@ jobs: name: "Verify that web-sys is compiled correctly" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features - run: git diff --exit-code @@ -159,7 +159,7 @@ jobs: name: "Run js-sys crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -175,7 +175,7 @@ jobs: name: "Run wasm-bindgen-webidl crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -193,7 +193,7 @@ jobs: name: "Test TypeScript output of wasm-bindgen" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v2 @@ -205,7 +205,7 @@ jobs: name: "Build and test the deno example" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: denoland/setup-deno@v1 @@ -217,14 +217,14 @@ jobs: name: Run UI compile-fail tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update 1.56.0 && rustup default 1.56.0 - run: cargo test -p wasm-bindgen-macro build_examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f @@ -253,7 +253,7 @@ jobs: build_nightly: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup default nightly-2022-05-19 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src @@ -274,7 +274,7 @@ jobs: - build_nightly runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: name: examples1 @@ -291,7 +291,7 @@ jobs: build_benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown @@ -304,7 +304,7 @@ jobs: dist_linux_x86_64_musl: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add x86_64-unknown-linux-musl - run: sudo apt update -y && sudo apt install musl-tools -y @@ -337,7 +337,7 @@ jobs: dist_macos_x86_64: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: @@ -350,7 +350,7 @@ jobs: dist_macos_aarch64: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add aarch64-apple-darwin - run: | @@ -365,7 +365,7 @@ jobs: dist_windows: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: @@ -378,7 +378,7 @@ jobs: doc_book: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: | curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf - echo $PWD >> $GITHUB_PATH @@ -391,7 +391,7 @@ jobs: doc_api: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustup update --no-self-update nightly && rustup default nightly - run: cargo doc --no-deps --features 'serde-serialize' - run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml @@ -423,7 +423,7 @@ jobs: - build_benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - run: rustup update --no-self-update nightly && rustup default nightly From 5550e767f5e96f1c31a62f02d55cf14c05582a41 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 3 Feb 2023 22:25:33 +0100 Subject: [PATCH 157/641] Update actions/upload-artifact in GitHub Actions workflows to v3 (#3283) --- .github/workflows/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d6680ec367..a92b9d455fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -245,7 +245,7 @@ jobs: done env: RUSTFLAGS: --cfg=web_sys_unstable_apis - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: examples1 path: exbuild @@ -263,7 +263,7 @@ jobs: ./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir ) || exit 1; done - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: examples2 path: exbuild @@ -296,7 +296,7 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown - run: cargo run -p wasm-bindgen-cli -- target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm --out-dir benchmarks/pkg --target web - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: benchmarks path: benchmarks @@ -313,7 +313,7 @@ jobs: strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen-test-runner strip -g target/x86_64-unknown-linux-musl/release/wasm2es6js - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist_linux_x86_64_musl path: "target/x86_64-unknown-linux-musl/release/wasm*" @@ -329,7 +329,7 @@ jobs: cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-gnu --features vendored-openssl --release env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist_linux_aarch64_gnu path: "target/aarch64-unknown-linux-gnu/release/wasm*" @@ -342,7 +342,7 @@ jobs: - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist_macos_x86_64 path: "target/release/wasm*" @@ -357,7 +357,7 @@ jobs: cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-apple-darwin --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist_macos_aarch64 path: "target/aarch64-apple-darwin/release/wasm*" @@ -370,7 +370,7 @@ jobs: - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: RUSTFLAGS: -Ctarget-feature=+crt-static - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist_windows path: "target/release/wasm*" @@ -383,7 +383,7 @@ jobs: curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf - echo $PWD >> $GITHUB_PATH - run: (cd guide && mdbook build) - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: doc_book path: guide/book/html @@ -400,7 +400,7 @@ jobs: RUSTDOCFLAGS: --cfg=web_sys_unstable_apis - run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml - run: tar czvf docs.tar.gz target/doc - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: doc_api path: docs.tar.gz @@ -455,7 +455,7 @@ jobs: mk x86_64-apple-darwin dist_macos_x86_64 mk aarch64-apple-darwin dist_macos_aarch64 mk x86_64-pc-windows-msvc dist_windows - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: gh-release path: gh-release @@ -467,7 +467,7 @@ jobs: mv artifacts/examples2/* gh-pages/exbuild mv artifacts/benchmarks gh-pages/benchmarks tar czf gh-pages.tar.gz gh-pages - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: gh-pages path: gh-pages.tar.gz From 7ea5fb09120978599218f208225a25b220ce27cd Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 3 Feb 2023 22:58:39 +0100 Subject: [PATCH 158/641] Update actions/setup-node in GitHub Actions workflows to v3 (#3284) --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a92b9d455fe..e58de016e66 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - uses: ./.github/actions/setup-geckodriver @@ -93,7 +93,7 @@ jobs: # - uses: actions/checkout@v3 # - run: rustup update --no-self-update stable && rustup default stable # - run: rustup target add wasm32-unknown-unknown - # - uses: actions/setup-node@v2 + # - uses: actions/setup-node@v3 # with: # node-version: '16' # - uses: ./.github/actions/setup-geckodriver @@ -114,7 +114,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - run: cargo test @@ -133,7 +133,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - uses: ./.github/actions/setup-geckodriver @@ -162,7 +162,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - uses: ./.github/actions/setup-geckodriver @@ -178,7 +178,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - run: cargo test -p wasm-bindgen-webidl @@ -196,7 +196,7 @@ jobs: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: '16' - run: cd crates/typescript-tests && ./run.sh From 6c04512737a3113a9c4f613642dab05b88e6fc65 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Sat, 4 Feb 2023 00:25:15 +0100 Subject: [PATCH 159/641] Update actions/download-artifact in GitHub Actions workflows to v3 (#3285) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e58de016e66..a46c10ab83c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -427,7 +427,7 @@ jobs: with: fetch-depth: 0 - run: rustup update --no-self-update nightly && rustup default nightly - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: path: artifacts - run: find artifacts From 8a263d01f9eff3b374c4b2c45ae0172107e19550 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Sat, 4 Feb 2023 00:25:26 +0100 Subject: [PATCH 160/641] Update setup-geckodriver action to use Node 16 (#3286) Actions using Node.js 12 are deprecated, so let's move on. --- .github/actions/setup-geckodriver/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-geckodriver/action.yml b/.github/actions/setup-geckodriver/action.yml index 57d5578a512..40611a1d536 100644 --- a/.github/actions/setup-geckodriver/action.yml +++ b/.github/actions/setup-geckodriver/action.yml @@ -2,5 +2,5 @@ name: 'Setup Geckodriver' description: 'Setup Geckodriver' runs: - using: node12 + using: node16 main: 'main.js' From 312e6e587135ecfd0b26fe096e813ac7da85ecda Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Mon, 6 Feb 2023 01:29:53 +0100 Subject: [PATCH 161/641] Update JamesIves/github-pages-deploy-action in GHA workflow to v4.4.1 (#3287) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a46c10ab83c..34d89b4302b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -471,7 +471,7 @@ jobs: with: name: gh-pages path: gh-pages.tar.gz - - uses: JamesIves/github-pages-deploy-action@4.1.4 + - uses: JamesIves/github-pages-deploy-action@v4.4.1 with: branch: gh-pages folder: gh-pages From 8780e5da512cd676cf96b82233f779db2feeb44d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 8 Feb 2023 02:21:46 +1100 Subject: [PATCH 162/641] Add a proper error for attempting to use a linked module outside the main thread with `--target no-modules` + `--split-linked-modules` (#3289) Previously, it would give an unhelpful 'invalid URL' error, which would probably be quite annoying to debug. With this PR, an error is thrown instead, which clearly states 'disable `--split-linked-modules` to fix this'. --- crates/cli-support/src/js/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 13379ec26cd..aa88537370f 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3157,7 +3157,19 @@ impl<'a> Context<'a> { OutputMode::Node { experimental_modules: false, } => "require('url').pathToFileURL(__filename)", - OutputMode::NoModules { .. } => "script_src", + OutputMode::NoModules { .. } => { + prelude.push_str( + "if (script_src === undefined) { + throw new Error( + \"When `--split-linked-modules` is enabled on the `no-modules` target, \ + linked modules cannot be used outside of a web page's main thread.\n\ + \n\ + To fix this, disable `--split-linked-modules`.\" + ); + }", + ); + "script_src" + } }; Ok(format!("new URL('{}', {}).toString()", path, base)) } else { From 0f6621a9b411584841bfc6d0b74803e8665f2d43 Mon Sep 17 00:00:00 2001 From: Vincent Esche <138017+regexident@users.noreply.github.com> Date: Fri, 10 Feb 2023 02:11:25 +0100 Subject: [PATCH 163/641] =?UTF-8?q?Support=20for=20specifying=20a=20defaul?= =?UTF-8?q?t=20`js=5Fnamespace`=20on=20an=20`extern=20"C"=20{=20=E2=80=A6?= =?UTF-8?q?=20}`=20block=20(#3280)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for specifying a default `js_namespace` on an `extern "C" { … }` block * Improve wording in `js_namespace` section of guide Co-authored-by: Liam Murphy --------- Co-authored-by: Liam Murphy --- crates/macro-support/src/parser.rs | 24 +++++++++++++--- .../attributes/on-js-imports/js_namespace.md | 28 +++++++++++++++++++ tests/wasm/import_class.rs | 6 ++-- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index def3642cc51..71214be20e8 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1384,11 +1384,16 @@ impl MacroParse for syn::ItemForeignMod { "only foreign mods with the `C` ABI are allowed" )); } + let js_namespace = opts.js_namespace().map(|(s, _)| s.to_owned()); let module = module_from_opts(program, &opts) .map_err(|e| errors.push(e)) .unwrap_or_default(); for item in self.items.into_iter() { - if let Err(e) = item.macro_parse(program, module.clone()) { + let ctx = ForeignItemCtx { + module: module.clone(), + js_namespace: js_namespace.clone(), + }; + if let Err(e) = item.macro_parse(program, ctx) { errors.push(e); } } @@ -1398,11 +1403,16 @@ impl MacroParse for syn::ItemForeignMod { } } -impl MacroParse> for syn::ForeignItem { +struct ForeignItemCtx { + module: Option, + js_namespace: Option>, +} + +impl MacroParse for syn::ForeignItem { fn macro_parse( mut self, program: &mut ast::Program, - module: Option, + ctx: ForeignItemCtx, ) -> Result<(), Diagnostic> { let item_opts = { let attrs = match self { @@ -1413,7 +1423,13 @@ impl MacroParse> for syn::ForeignItem { }; BindgenAttrs::find(attrs)? }; - let js_namespace = item_opts.js_namespace().map(|(s, _)| s.to_owned()); + + let js_namespace = item_opts + .js_namespace() + .map(|(s, _)| s.to_owned()) + .or(ctx.js_namespace); + let module = ctx.module; + let kind = match self { syn::ForeignItem::Fn(f) => f.convert((item_opts, &module))?, syn::ForeignItem::Type(t) => t.convert(item_opts)?, diff --git a/guide/src/reference/attributes/on-js-imports/js_namespace.md b/guide/src/reference/attributes/on-js-imports/js_namespace.md index 0d6d6672548..86dae9c5b93 100644 --- a/guide/src/reference/attributes/on-js-imports/js_namespace.md +++ b/guide/src/reference/attributes/on-js-imports/js_namespace.md @@ -39,3 +39,31 @@ write("hello, document!"); ``` This example shows how to bind `window.document.write` in Rust. + +If all items in the `extern "C" { … }` block have the same `js_namespace = …`: + +```rust +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = Math)] + fn random() -> f64; + #[wasm_bindgen(js_namespace = Math)] + fn log(a: f64) -> f64; + // ... +} +``` + +Then that macro argument can also be moved to the outer block: + +```rust +#[wasm_bindgen(js_namespace = Math)] +extern "C" { + #[wasm_bindgen] + fn random() -> f64; + #[wasm_bindgen] + fn log(a: f64) -> f64; + // ... +} +``` + +`js_namespace = …` on an individual item takes precedence over the outer block's `js_namespace = …`. diff --git a/tests/wasm/import_class.rs b/tests/wasm/import_class.rs index 55cc1d1be98..a8e538931d9 100644 --- a/tests/wasm/import_class.rs +++ b/tests/wasm/import_class.rs @@ -124,11 +124,11 @@ extern "C" { fn assert_internal_int(this: &InnerClass, i: u32); } -#[wasm_bindgen] +#[wasm_bindgen(js_namespace = Math)] extern "C" { - #[wasm_bindgen(js_namespace = Math)] + #[wasm_bindgen] fn random() -> f64; - #[wasm_bindgen(js_namespace = Math)] + #[wasm_bindgen] fn log(a: f64) -> f64; } From d090e94512c87cc2495d1491a79d8bdc500074d3 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Fri, 10 Feb 2023 05:16:53 +0100 Subject: [PATCH 164/641] Refactor try_unescape in macro-support (#3292) * Add unit test for fix_unescape * Refactor try_unescape in macro-support --- .github/workflows/main.yml | 1 + crates/macro-support/src/parser.rs | 67 ++++++++++++++---------------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34d89b4302b..8a0cf721c9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -121,6 +121,7 @@ jobs: - run: cargo test -p wasm-bindgen-cli-support - run: cargo test -p wasm-bindgen-cli - run: cargo test -p wasm-bindgen-externref-xform + - run: cargo test -p wasm-bindgen-macro-support - run: cargo test -p wasm-bindgen-multi-value-xform - run: cargo test -p wasm-bindgen-wasm-interpreter - run: cargo test -p wasm-bindgen-futures diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 71214be20e8..94786143d44 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1545,25 +1545,13 @@ fn extract_doc_comments(attrs: &[syn::Attribute]) -> Vec { } // Unescapes a quoted string. char::escape_debug() was used to escape the text. -fn try_unescape(s: &str) -> Option { - if s.is_empty() { - return Some(String::new()); - } +fn try_unescape(mut s: &str) -> Option { + s = s.strip_prefix('"').unwrap_or(s); + s = s.strip_suffix('"').unwrap_or(s); let mut result = String::with_capacity(s.len()); let mut chars = s.chars(); - for i in 0.. { - let c = match chars.next() { - Some(c) => c, - None => { - if result.ends_with('"') { - result.pop(); - } - return Some(result); - } - }; - if i == 0 && c == '"' { - // ignore it - } else if c == '\\' { + while let Some(c) = chars.next() { + if c == '\\' { let c = chars.next()?; match c { 't' => result.push('\t'), @@ -1586,30 +1574,17 @@ fn try_unescape(s: &str) -> Option { result.push(c); } } - None + Some(result) } fn unescape_unicode(chars: &mut Chars) -> Option<(char, char)> { let mut value = 0; - for i in 0..7 { - let c = chars.next()?; - let num = if c >= '0' && c <= '9' { - c as u32 - '0' as u32 - } else if c >= 'a' && c <= 'f' { - c as u32 - 'a' as u32 + 10 - } else if c >= 'A' && c <= 'F' { - c as u32 - 'A' as u32 + 10 - } else { - if i == 0 { - return None; - } - let decoded = char::from_u32(value)?; - return Some((decoded, c)); - }; - if i >= 6 { - return None; + for (i, c) in chars.enumerate() { + match (i, c.to_digit(16)) { + (0..=5, Some(num)) => value = (value << 4) | num, + (1.., None) => return Some((char::from_u32(value)?, c)), + _ => break, } - value = (value << 4) | num; } None } @@ -1713,3 +1688,23 @@ pub fn link_to(opts: BindgenAttrs) -> Result { program.linked_modules.push(module); Ok(ast::LinkToModule(program)) } + +#[cfg(test)] +mod tests { + #[test] + fn test_try_unescape() { + use super::try_unescape; + assert_eq!(try_unescape("hello").unwrap(), "hello"); + assert_eq!(try_unescape("\"hello").unwrap(), "hello"); + assert_eq!(try_unescape("hello\"").unwrap(), "hello"); + assert_eq!(try_unescape("\"hello\"").unwrap(), "hello"); + assert_eq!(try_unescape("hello\\\\").unwrap(), "hello\\"); + assert_eq!(try_unescape("hello\\n").unwrap(), "hello\n"); + assert_eq!(try_unescape("hello\\u"), None); + assert_eq!(try_unescape("hello\\u{"), None); + assert_eq!(try_unescape("hello\\u{}"), None); + assert_eq!(try_unescape("hello\\u{0}").unwrap(), "hello\0"); + assert_eq!(try_unescape("hello\\u{000000}").unwrap(), "hello\0"); + assert_eq!(try_unescape("hello\\u{0000000}"), None); + } +} From c75eb0fb4d34a55eae0ebc94fb35021567dce3b4 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 14 Feb 2023 08:42:34 +1100 Subject: [PATCH 165/641] Improve error message when `#[wasm_bindgen(getter_with_clone)]` is used on non-`Clone` JS types (#3295) * Improve error message when `#[wasm_bindgen(getter_with_clone)]` is used on non-`Clone` JS types Fixes #3291 Previously, the implementation of that attribute would call `.clone()` on the field to try and clone it. The problem is that imported JS types implement `Deref`, which meant that calling `.clone()` would auto-deref the type into a `JsValue`, and then clone that. So, instead of a '`Foo` does not implement `Clone`' error, you would get a cryptic error about a type mismatch. This fixes that by clarifying the `clone` call to use the `::clone(&val)` syntax instead. I also added some spans so that the error message will point out the field that's causing the problem. * fmt --- crates/backend/src/ast.rs | 8 ++++++-- crates/backend/src/codegen.rs | 15 ++++++++------- crates/macro-support/src/parser.rs | 4 ++-- crates/macro/ui-tests/struct-fields.rs | 15 +++++++++++++++ crates/macro/ui-tests/struct-fields.stderr | 20 ++++++++++++++++++++ 5 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 crates/macro/ui-tests/struct-fields.rs create mode 100644 crates/macro/ui-tests/struct-fields.stderr diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 064e0137713..7dc728fd356 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -349,8 +349,12 @@ pub struct StructField { pub comments: Vec, /// Whether to generate a typescript definition for this field pub generate_typescript: bool, - /// Whether to use .clone() in the auto-generated getter for this field - pub getter_with_clone: bool, + /// The span of the `#[wasm_bindgen(getter_with_clone)]` attribute applied + /// to this field, if any. + /// + /// If this is `Some`, the auto-generated getter for this field must clone + /// the field instead of copying it. + pub getter_with_clone: Option, } /// Information about an Enum being exported diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index e2d57f43373..34cf3a32472 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -3,9 +3,11 @@ use crate::encode; use crate::Diagnostic; use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; +use quote::quote_spanned; use quote::{quote, ToTokens}; use std::collections::{HashMap, HashSet}; use std::sync::Mutex; +use syn::spanned::Spanned; use wasm_bindgen_shared as shared; /// A trait for converting AST structs into Tokens and adding them to a TokenStream, @@ -302,18 +304,17 @@ impl ToTokens for ast::StructField { let getter = &self.getter; let setter = &self.setter; - let maybe_assert_copy = if self.getter_with_clone { + let maybe_assert_copy = if self.getter_with_clone.is_some() { quote! {} } else { quote! { assert_copy::<#ty>() } }; let maybe_assert_copy = respan(maybe_assert_copy, ty); - let maybe_clone = if self.getter_with_clone { - quote! { .clone() } - } else { - quote! {} - }; + let mut val = quote_spanned!(self.rust_name.span()=> (*js).borrow().#rust_name); + if let Some(span) = self.getter_with_clone { + val = quote_spanned!(span=> <#ty as Clone>::clone(&#val) ); + } (quote! { #[automatically_derived] @@ -331,7 +332,7 @@ impl ToTokens for ast::StructField { let js = js as *mut WasmRefCell<#struct_name>; assert_not_null(js); - let val = (*js).borrow().#rust_name#maybe_clone; + let val = #val; <#ty as IntoWasmAbi>::into_abi(val) } }; diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 94786143d44..148cc55f9cb 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -409,7 +409,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { .map(|s| s.0.to_string()) .unwrap_or(self.ident.to_string()); let is_inspectable = attrs.inspectable().is_some(); - let getter_with_clone = attrs.getter_with_clone().is_some(); + let getter_with_clone = attrs.getter_with_clone(); for (i, field) in self.fields.iter_mut().enumerate() { match field.vis { syn::Visibility::Public(..) => {} @@ -445,7 +445,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { setter: Ident::new(&setter, Span::call_site()), comments, generate_typescript: attrs.skip_typescript().is_none(), - getter_with_clone: getter_with_clone || attrs.getter_with_clone().is_some(), + getter_with_clone: attrs.getter_with_clone().or(getter_with_clone).copied(), }); attrs.check_used(); } diff --git a/crates/macro/ui-tests/struct-fields.rs b/crates/macro/ui-tests/struct-fields.rs new file mode 100644 index 00000000000..dee2c89343d --- /dev/null +++ b/crates/macro/ui-tests/struct-fields.rs @@ -0,0 +1,15 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + pub type Foo; +} + +#[wasm_bindgen] +struct Bar { + pub a: Foo, + #[wasm_bindgen(getter_with_clone)] + pub b: Foo, +} + +fn main() {} diff --git a/crates/macro/ui-tests/struct-fields.stderr b/crates/macro/ui-tests/struct-fields.stderr new file mode 100644 index 00000000000..b6e6a168a25 --- /dev/null +++ b/crates/macro/ui-tests/struct-fields.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `Foo: std::marker::Copy` is not satisfied + --> ui-tests/struct-fields.rs:10:12 + | +10 | pub a: Foo, + | ^^^ the trait `std::marker::Copy` is not implemented for `Foo` + | +note: required by a bound in `__wbg_get_bar_a::assert_copy` + --> ui-tests/struct-fields.rs:8:1 + | +8 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ required by this bound in `__wbg_get_bar_a::assert_copy` + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo: Clone` is not satisfied + --> ui-tests/struct-fields.rs:11:20 + | +11 | #[wasm_bindgen(getter_with_clone)] + | ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` + | +note: required by `clone` From d9e113b73558bdf8cfe3fabbf9fb67eb12a25990 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 13 Feb 2023 22:53:17 +0100 Subject: [PATCH 166/641] Implement `#[should_panic(expected = "...")]` handling (#3293) --- .github/workflows/main.yml | 3 +- crates/futures/tests/tests.rs | 18 +++ crates/macro/ui-tests/async-errors.stderr | 20 --- crates/macro/ui-tests/invalid-imports.stderr | 24 ++-- crates/macro/ui-tests/invalid-methods.stderr | 24 ++-- crates/macro/ui-tests/missing-catch.stderr | 12 -- crates/macro/ui-tests/start-function.stderr | 84 +++++------ .../ui-tests/traits-not-implemented.stderr | 11 -- .../macro/ui-tests/unused-attributes.stderr | 12 +- crates/test-macro/Cargo.toml | 8 +- crates/test-macro/src/lib.rs | 131 ++++++++++++++++- crates/test-macro/tests/ui.rs | 5 + crates/test-macro/ui-tests/should_panic.rs | 68 +++++++++ .../test-macro/ui-tests/should_panic.stderr | 59 ++++++++ crates/test/sample/tests/common/mod.rs | 18 +++ crates/test/src/rt/mod.rs | 132 +++++++++++++++--- tests/wasm/should_panic.rs | 17 +++ 17 files changed, 491 insertions(+), 155 deletions(-) create mode 100644 crates/test-macro/tests/ui.rs create mode 100644 crates/test-macro/ui-tests/should_panic.rs create mode 100644 crates/test-macro/ui-tests/should_panic.stderr create mode 100644 tests/wasm/should_panic.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a0cf721c9e..cf560554715 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -219,8 +219,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: rustup update --no-self-update 1.56.0 && rustup default 1.56.0 + - run: rustup update --no-self-update 1.59.0 && rustup default 1.59.0 - run: cargo test -p wasm-bindgen-macro + - run: cargo test -p wasm-bindgen-test-macro build_examples: runs-on: ubuntu-latest diff --git a/crates/futures/tests/tests.rs b/crates/futures/tests/tests.rs index 6a950f7c869..ac3c07449f9 100644 --- a/crates/futures/tests/tests.rs +++ b/crates/futures/tests/tests.rs @@ -155,3 +155,21 @@ async fn can_use_an_async_iterable_as_stream() { assert_eq!(stream.next().await, Some(Ok(JsValue::from(24)))); assert_eq!(stream.next().await, None); } + +#[wasm_bindgen_test] +#[should_panic] +async fn should_panic() { + panic!() +} + +#[wasm_bindgen_test] +#[should_panic = "error message"] +async fn should_panic_string() { + panic!("error message") +} + +#[wasm_bindgen_test] +#[should_panic(expected = "error message")] +async fn should_panic_expected() { + panic!("error message") +} diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index c1fec077d0e..f02498aaf1b 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -7,11 +7,6 @@ error[E0277]: the trait bound `Result<(), ()>: IntoJsResult` is not satisfied = help: the following implementations were found: as IntoJsResult> as IntoJsResult> -note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfied @@ -23,11 +18,6 @@ error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfi = help: the following implementations were found: as IntoJsResult> as IntoJsResult> -note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not satisfied @@ -44,11 +34,6 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not sati and $N others = note: required because of the requirements on the impl of `Into` for `BadType` = note: required because of the requirements on the impl of `IntoJsResult` for `BadType` -note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: IntoJsResult` is not satisfied @@ -60,9 +45,4 @@ error[E0277]: the trait bound `Result: IntoJsRes = help: the following implementations were found: as IntoJsResult> as IntoJsResult> -note: required by `into_js_result` - --> $WORKSPACE/src/lib.rs - | - | fn into_js_result(self) -> Result; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/invalid-imports.stderr b/crates/macro/ui-tests/invalid-imports.stderr index aeb09c574cb..0679f388306 100644 --- a/crates/macro/ui-tests/invalid-imports.stderr +++ b/crates/macro/ui-tests/invalid-imports.stderr @@ -1,71 +1,71 @@ error: it is currently not sound to use lifetimes in function signatures - --> $DIR/invalid-imports.rs:7:16 + --> ui-tests/invalid-imports.rs:7:16 | 7 | fn f() -> &'static u32; | ^^^^^^^ error: imported methods must have at least one argument - --> $DIR/invalid-imports.rs:10:5 + --> ui-tests/invalid-imports.rs:10:5 | 10 | fn f1(); | ^^^^^^^^ error: first argument of method must be a shared reference - --> $DIR/invalid-imports.rs:12:14 + --> ui-tests/invalid-imports.rs:12:14 | 12 | fn f2(x: u32); | ^^^ error: first argument of method must be a path - --> $DIR/invalid-imports.rs:14:14 + --> ui-tests/invalid-imports.rs:14:14 | 14 | fn f3(x: &&u32); | ^^^^^ error: paths with type parameters are not supported yet - --> $DIR/invalid-imports.rs:20:15 + --> ui-tests/invalid-imports.rs:20:15 | 20 | fn f4(x: &Bar); | ^^^^^^ error: paths with type parameters are not supported yet - --> $DIR/invalid-imports.rs:22:15 + --> ui-tests/invalid-imports.rs:22:15 | 22 | fn f4(x: &Fn(T)); | ^^^^^ error: constructor returns must be bare types - --> $DIR/invalid-imports.rs:25:5 + --> ui-tests/invalid-imports.rs:25:5 | 25 | fn f(); | ^^^^^^^ error: return value of constructor must be a bare path - --> $DIR/invalid-imports.rs:29:5 + --> ui-tests/invalid-imports.rs:29:5 | 29 | fn f() -> &Bar; | ^^^^^^^^^^^^^^^ error: must be Result<...> - --> $DIR/invalid-imports.rs:32:15 + --> ui-tests/invalid-imports.rs:32:15 | 32 | fn f() -> u32; | ^^^ error: must be Result<...> - --> $DIR/invalid-imports.rs:34:15 + --> ui-tests/invalid-imports.rs:34:15 | 34 | fn f() -> &u32; | ^^^^ error: must have at least one generic parameter - --> $DIR/invalid-imports.rs:36:15 + --> ui-tests/invalid-imports.rs:36:15 | 36 | fn f() -> Result<>; | ^^^^^^^^ error: it is currently not sound to use lifetimes in function signatures - --> $DIR/invalid-imports.rs:38:22 + --> ui-tests/invalid-imports.rs:38:22 | 38 | fn f() -> Result<'a>; | ^^ diff --git a/crates/macro/ui-tests/invalid-methods.stderr b/crates/macro/ui-tests/invalid-methods.stderr index a785fc1ffc2..798e1af9aec 100644 --- a/crates/macro/ui-tests/invalid-methods.stderr +++ b/crates/macro/ui-tests/invalid-methods.stderr @@ -1,61 +1,61 @@ error: #[wasm_bindgen] default impls are not supported - --> $DIR/invalid-methods.rs:7:1 + --> ui-tests/invalid-methods.rs:7:1 | 7 | default impl A { | ^^^^^^^ error: #[wasm_bindgen] unsafe impls are not supported - --> $DIR/invalid-methods.rs:11:1 + --> ui-tests/invalid-methods.rs:11:1 | 11 | unsafe impl A { | ^^^^^^ error: #[wasm_bindgen] trait impls are not supported - --> $DIR/invalid-methods.rs:15:6 + --> ui-tests/invalid-methods.rs:15:6 | 15 | impl Clone for A { | ^^^^^ error: #[wasm_bindgen] generic impls aren't supported - --> $DIR/invalid-methods.rs:19:5 + --> ui-tests/invalid-methods.rs:19:5 | 19 | impl A { | ^^^ error: unsupported self type in #[wasm_bindgen] impl - --> $DIR/invalid-methods.rs:23:6 + --> ui-tests/invalid-methods.rs:23:6 | 23 | impl &'static A { | ^^^^^^^^^^ error: const definitions aren't supported with #[wasm_bindgen] - --> $DIR/invalid-methods.rs:30:5 + --> ui-tests/invalid-methods.rs:30:5 | 30 | const X: u32 = 3; | ^^^^^^^^^^^^^^^^^ error: type definitions in impls aren't supported with #[wasm_bindgen] - --> $DIR/invalid-methods.rs:31:5 + --> ui-tests/invalid-methods.rs:31:5 | 31 | type Y = u32; | ^^^^^^^^^^^^^ error: macros in impls aren't supported - --> $DIR/invalid-methods.rs:32:5 + --> ui-tests/invalid-methods.rs:32:5 | 32 | x!(); | ^^^^^ error: can only #[wasm_bindgen] non-const functions - --> $DIR/invalid-methods.rs:39:9 + --> ui-tests/invalid-methods.rs:39:9 | 39 | pub const fn foo() {} | ^^^^^ -warning: unused macro definition - --> $DIR/invalid-methods.rs:26:1 +warning: unused macro definition: `x` + --> ui-tests/invalid-methods.rs:26:14 | 26 | macro_rules! x { () => () } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = note: `#[warn(unused_macros)]` on by default diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index d08553b1b37..8ebd44ab80e 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -3,15 +3,3 @@ error[E0277]: the trait bound `Result Result; | ^^^ the trait `FromWasmAbi` is not implemented for `Result` - | -note: required by a bound in `FromWasmAbi` - --> $WORKSPACE/src/convert/traits.rs - | - | / pub trait FromWasmAbi: WasmDescribe { - | | /// The wasm ABI type that this converts from when coming back out from the - | | /// ABI boundary. - | | type Abi: WasmAbi; -... | - | | unsafe fn from_abi(js: Self::Abi) -> Self; - | | } - | |_^ required by this bound in `FromWasmAbi` diff --git a/crates/macro/ui-tests/start-function.stderr b/crates/macro/ui-tests/start-function.stderr index aac6fccf00a..f1afe556396 100644 --- a/crates/macro/ui-tests/start-function.stderr +++ b/crates/macro/ui-tests/start-function.stderr @@ -11,61 +11,41 @@ error: the start function cannot have generics | ^^^ error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:15:1 - | -15 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` - | - = help: the following implementations were found: - as wasm_bindgen::__rt::Start> -note: required by `start` - --> $WORKSPACE/src/lib.rs - | - | fn start(self); - | ^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> ui-tests/start-function.rs:15:1 + | +15 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` + | + = help: the following implementations were found: + as wasm_bindgen::__rt::Start> + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:18:1 - | -18 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` - | - = help: the following implementations were found: - as wasm_bindgen::__rt::Start> -note: required by `start` - --> $WORKSPACE/src/lib.rs - | - | fn start(self); - | ^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> ui-tests/start-function.rs:18:1 + | +18 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` + | + = help: the following implementations were found: + as wasm_bindgen::__rt::Start> + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:27:1 - | -27 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` - | - = help: the following implementations were found: - as wasm_bindgen::__rt::Start> -note: required by `start` - --> $WORKSPACE/src/lib.rs - | - | fn start(self); - | ^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> ui-tests/start-function.rs:27:1 + | +27 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` + | + = help: the following implementations were found: + as wasm_bindgen::__rt::Start> + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:30:1 - | -30 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` - | - = help: the following implementations were found: - as wasm_bindgen::__rt::Start> -note: required by `start` - --> $WORKSPACE/src/lib.rs - | - | fn start(self); - | ^^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + --> ui-tests/start-function.rs:30:1 + | +30 | #[wasm_bindgen(start)] + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` + | + = help: the following implementations were found: + as wasm_bindgen::__rt::Start> + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/traits-not-implemented.stderr b/crates/macro/ui-tests/traits-not-implemented.stderr index aaad988af58..4b1f97eaa35 100644 --- a/crates/macro/ui-tests/traits-not-implemented.stderr +++ b/crates/macro/ui-tests/traits-not-implemented.stderr @@ -4,15 +4,4 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied 5 | #[wasm_bindgen] | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` | -note: required by a bound in `IntoWasmAbi` - --> $WORKSPACE/src/convert/traits.rs - | - | / pub trait IntoWasmAbi: WasmDescribe { - | | /// The wasm ABI type that this converts into when crossing the ABI - | | /// boundary. - | | type Abi: WasmAbi; -... | - | | fn into_abi(self) -> Self::Abi; - | | } - | |_^ required by this bound in `IntoWasmAbi` = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/unused-attributes.stderr b/crates/macro/ui-tests/unused-attributes.stderr index c4ba32f0817..1df8f26a021 100644 --- a/crates/macro/ui-tests/unused-attributes.stderr +++ b/crates/macro/ui-tests/unused-attributes.stderr @@ -22,6 +22,12 @@ error: unused variable: `readonly` 21 | #[wasm_bindgen(readonly)] | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_readonly` +error: unused variable: `typescript_type` + --> ui-tests/unused-attributes.rs:26:28 + | +26 | #[wasm_bindgen(getter, typescript_type = "Thing[]")] + | ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type` + error: unused variable: `getter_with_clone` --> ui-tests/unused-attributes.rs:24:16 | @@ -33,9 +39,3 @@ error: unused variable: `final` | 24 | #[wasm_bindgen(getter_with_clone, final)] | ^^^^^ help: if this is intentional, prefix it with an underscore: `_final` - -error: unused variable: `typescript_type` - --> ui-tests/unused-attributes.rs:26:28 - | -26 | #[wasm_bindgen(getter, typescript_type = "Thing[]")] - | ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type` diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 52278d58d01..e090b57ac83 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,9 +7,13 @@ license = "MIT/Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen" edition = "2018" +[lib] +proc-macro = true + [dependencies] proc-macro2 = "1.0" quote = "1.0" -[lib] -proc-macro = true +[dev-dependencies] +wasm-bindgen-test = { path = "../test" } +trybuild = "1.0" diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index b5a8032b298..d67055c63a4 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -5,6 +5,7 @@ extern crate proc_macro; use proc_macro2::*; use quote::quote; +use quote::quote_spanned; use std::sync::atomic::*; static CNT: AtomicUsize = AtomicUsize::new(0); @@ -16,23 +17,49 @@ pub fn wasm_bindgen_test( ) -> proc_macro::TokenStream { let mut attr = attr.into_iter(); let mut r#async = false; + let mut should_panic = None; while let Some(token) = attr.next() { match &token { proc_macro::TokenTree::Ident(i) if i.to_string() == "async" => r#async = true, - _ => panic!("malformed `#[wasm_bindgen_test]` attribute"), + _ => { + return compile_error( + token.span().into(), + "malformed `#[wasm_bindgen_test]` attribute", + ) + } } match &attr.next() { Some(proc_macro::TokenTree::Punct(op)) if op.as_char() == ',' => {} - Some(_) => panic!("malformed `#[wasm_bindgen_test]` attribute"), + Some(_) => { + return compile_error( + token.span().into(), + "malformed `#[wasm_bindgen_test]` attribute", + ) + } None => break, } } - let mut body = TokenStream::from(body).into_iter(); + let mut body = TokenStream::from(body).into_iter().peekable(); // Skip over other attributes to `fn #ident ...`, and extract `#ident` let mut leading_tokens = Vec::new(); while let Some(token) = body.next() { + match parse_should_panic(&mut body, &token) { + Ok(Some((new_should_panic, span))) => { + if should_panic.replace(new_should_panic).is_some() { + return compile_error(span, "duplicate `should_panic` attribute"); + } + + // If we found a `should_panic`, we should skip the `#` and `[...]`. + // The `[...]` is skipped here, the current `#` is skipped by using `continue`. + body.next(); + continue; + } + Ok(None) => (), + Err(error) => return error, + } + leading_tokens.push(token.clone()); if let TokenTree::Ident(token) = token { if token == "async" { @@ -47,10 +74,16 @@ pub fn wasm_bindgen_test( let mut tokens = Vec::::new(); + let should_panic = match should_panic { + Some(Some(lit)) => quote! { Some(Some(#lit)) }, + Some(None) => quote! { Some(None) }, + None => quote! { None }, + }; + let test_body = if r#async { - quote! { cx.execute_async(test_name, #ident); } + quote! { cx.execute_async(test_name, #ident, #should_panic); } } else { - quote! { cx.execute_sync(test_name, #ident); } + quote! { cx.execute_sync(test_name, #ident, #should_panic); } }; // We generate a `#[no_mangle]` with a known prefix so the test harness can @@ -76,7 +109,89 @@ pub fn wasm_bindgen_test( tokens.into_iter().collect::().into() } -fn find_ident(iter: &mut token_stream::IntoIter) -> Option { +fn parse_should_panic( + body: &mut std::iter::Peekable, + token: &TokenTree, +) -> Result, Span)>, proc_macro::TokenStream> { + // Start by parsing the `#` + match token { + TokenTree::Punct(op) if op.as_char() == '#' => (), + _ => return Ok(None), + } + + // Parse `[...]` + let group = match body.peek() { + Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Bracket => group, + _ => return Ok(None), + }; + + let mut stream = group.stream().into_iter(); + + // Parse `should_panic` + let mut span = match stream.next() { + Some(TokenTree::Ident(token)) if token == "should_panic" => token.span(), + _ => return Ok(None), + }; + + let should_panic = span; + + // We are interested in the `expected` attribute or string if there is any + match stream.next() { + // Parse the `(...)` in `#[should_panic(...)]` + Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Parenthesis => { + let span = group.span(); + stream = group.stream().into_iter(); + + // Parse `expected` + match stream.next() { + Some(TokenTree::Ident(token)) if token == "expected" => (), + _ => { + return Err(compile_error( + span, + "malformed `#[should_panic(...)]` attribute", + )) + } + } + + // Parse `=` + match stream.next() { + Some(TokenTree::Punct(op)) if op.as_char() == '=' => (), + _ => { + return Err(compile_error( + span, + "malformed `#[should_panic(...)]` attribute", + )) + } + } + } + // Parse `=` + Some(TokenTree::Punct(op)) if op.as_char() == '=' => (), + Some(token) => { + return Err(compile_error( + token.span(), + "malformed `#[should_panic = \"...\"]` attribute", + )) + } + None => { + return Ok(Some((None, should_panic))); + } + } + + // Parse string in `#[should_panic(expected = "string")]` or `#[should_panic = "string"]` + if let Some(TokenTree::Literal(lit)) = stream.next() { + span = lit.span(); + let string = lit.to_string(); + + // Verify it's a string. + if string.starts_with('"') && string.ends_with('"') { + return Ok(Some((Some(lit), should_panic))); + } + } + + Err(compile_error(span, "malformed `#[should_panic]` attribute")) +} + +fn find_ident(iter: &mut impl Iterator) -> Option { match iter.next()? { TokenTree::Ident(i) => Some(i), TokenTree::Group(g) if g.delimiter() == Delimiter::None => { @@ -85,3 +200,7 @@ fn find_ident(iter: &mut token_stream::IntoIter) -> Option { _ => None, } } + +fn compile_error(span: Span, msg: &str) -> proc_macro::TokenStream { + quote_spanned! { span => compile_error!(#msg); }.into() +} diff --git a/crates/test-macro/tests/ui.rs b/crates/test-macro/tests/ui.rs new file mode 100644 index 00000000000..da15c92148c --- /dev/null +++ b/crates/test-macro/tests/ui.rs @@ -0,0 +1,5 @@ +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("ui-tests/*.rs"); +} diff --git a/crates/test-macro/ui-tests/should_panic.rs b/crates/test-macro/ui-tests/should_panic.rs new file mode 100644 index 00000000000..0357a423dd7 --- /dev/null +++ b/crates/test-macro/ui-tests/should_panic.rs @@ -0,0 +1,68 @@ +use wasm_bindgen_test_macro::wasm_bindgen_test; + +#[wasm_bindgen_test] +#[should_panic] +fn success_1() {} + +#[wasm_bindgen_test] +#[should_panic = "test"] +fn success_2() {} + +#[wasm_bindgen_test] +#[should_panic(expected = "test")] +fn success_3() {} + +#[wasm_bindgen_test] +#[should_panic] +async fn async_success_1() {} + +#[wasm_bindgen_test] +#[should_panic = "test"] +async fn async_success_2() {} + +#[wasm_bindgen_test] +#[should_panic(expected = "test")] +async fn async_success_3() {} + +#[wasm_bindgen_test] +#[should_panic::error] +fn fail_1() {} + +#[wasm_bindgen_test] +#[should_panic = 42] +fn fail_2() {} + +#[wasm_bindgen_test] +#[should_panic[]] +fn fail_3() {} + +#[wasm_bindgen_test] +#[should_panic(42)] +fn fail_4() {} + +#[wasm_bindgen_test] +#[should_panic(test)] +fn fail_5() {} + +#[wasm_bindgen_test] +#[should_panic(expected)] +fn fail_6() {} + +#[wasm_bindgen_test] +#[should_panic(expected::error)] +fn fail_7() {} + +#[wasm_bindgen_test] +#[should_panic(expected =)] +fn fail_8() {} + +#[wasm_bindgen_test] +#[should_panic(expected = 5)] +fn fail_9() {} + +#[wasm_bindgen_test] +#[should_panic = "test"] +#[should_panic = "test"] +fn fail_10() {} + +fn main() {} diff --git a/crates/test-macro/ui-tests/should_panic.stderr b/crates/test-macro/ui-tests/should_panic.stderr new file mode 100644 index 00000000000..423caa5dd28 --- /dev/null +++ b/crates/test-macro/ui-tests/should_panic.stderr @@ -0,0 +1,59 @@ +error: malformed `#[should_panic = "..."]` attribute + --> ui-tests/should_panic.rs:28:15 + | +28 | #[should_panic::error] + | ^^ + +error: malformed `#[should_panic]` attribute + --> ui-tests/should_panic.rs:32:18 + | +32 | #[should_panic = 42] + | ^^ + +error: malformed `#[should_panic = "..."]` attribute + --> ui-tests/should_panic.rs:36:15 + | +36 | #[should_panic[]] + | ^^ + +error: malformed `#[should_panic(...)]` attribute + --> ui-tests/should_panic.rs:40:15 + | +40 | #[should_panic(42)] + | ^^^^ + +error: malformed `#[should_panic(...)]` attribute + --> ui-tests/should_panic.rs:44:15 + | +44 | #[should_panic(test)] + | ^^^^^^ + +error: malformed `#[should_panic(...)]` attribute + --> ui-tests/should_panic.rs:48:15 + | +48 | #[should_panic(expected)] + | ^^^^^^^^^^ + +error: malformed `#[should_panic(...)]` attribute + --> ui-tests/should_panic.rs:52:15 + | +52 | #[should_panic(expected::error)] + | ^^^^^^^^^^^^^^^^^ + +error: malformed `#[should_panic]` attribute + --> ui-tests/should_panic.rs:56:3 + | +56 | #[should_panic(expected =)] + | ^^^^^^^^^^^^ + +error: malformed `#[should_panic]` attribute + --> ui-tests/should_panic.rs:60:27 + | +60 | #[should_panic(expected = 5)] + | ^ + +error: duplicate `should_panic` attribute + --> ui-tests/should_panic.rs:65:3 + | +65 | #[should_panic = "test"] + | ^^^^^^^^^^^^ diff --git a/crates/test/sample/tests/common/mod.rs b/crates/test/sample/tests/common/mod.rs index 7c8135f0e73..79525d39323 100644 --- a/crates/test/sample/tests/common/mod.rs +++ b/crates/test/sample/tests/common/mod.rs @@ -51,3 +51,21 @@ fn panic_before_result_fail() -> Result<(), Box> { #[allow(unreachable_code)] Err("failed via Result".into()) } + +#[wasm_bindgen_test] +#[should_panic] +fn should_panic() { + panic!() +} + +#[wasm_bindgen_test] +#[should_panic = "error message"] +fn should_panic_string() { + panic!("error message") +} + +#[wasm_bindgen_test] +#[should_panic(expected = "error message")] +fn should_panic_expected() { + panic!("error message") +} diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index e33d6e32317..247603bab00 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -93,6 +93,7 @@ use std::fmt; use std::future::Future; use std::pin::Pin; use std::rc::Rc; +use std::sync::Once; use std::task::{self, Poll}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; @@ -135,7 +136,7 @@ struct State { /// /// Each test listed here is paired with a `JsValue` that represents the /// exception thrown which caused the test to fail. - failures: RefCell>, + failures: RefCell>, /// Remaining tests to execute, when empty we're just waiting on the /// `Running` tests to finish. @@ -150,6 +151,17 @@ struct State { formatter: Box, } +/// Failure reasons. +enum Failure { + /// Normal failing test. + Error(JsValue), + /// A test that `should_panic` but didn't. + ShouldPanic, + /// A test that `should_panic` with a specific message, + /// but panicked with a different message. + ShouldPanicExpected, +} + /// Representation of one test that needs to be executed. /// /// Tests are all represented as futures, and tests perform no work until their @@ -158,6 +170,7 @@ struct Test { name: String, future: Pin>>>, output: Rc>, + should_panic: Option>, } /// Captured output of each test. @@ -168,6 +181,8 @@ struct Output { info: String, warn: String, error: String, + panic: String, + should_panic: bool, } trait Formatter { @@ -207,7 +222,20 @@ impl Context { /// tests. #[wasm_bindgen(constructor)] pub fn new() -> Context { - console_error_panic_hook::set_once(); + static SET_HOOK: Once = Once::new(); + SET_HOOK.call_once(|| { + std::panic::set_hook(Box::new(|panic_info| { + let should_panic = CURRENT_OUTPUT.with(|output| { + let mut output = output.borrow_mut(); + output.panic.push_str(&panic_info.to_string()); + output.should_panic + }); + + if !should_panic { + console_error_panic_hook::hook(panic_info); + } + })); + }); let formatter = match node::Node::new() { Some(node) => Box::new(node) as Box, @@ -375,22 +403,36 @@ impl Termination for Result<(), E> { impl Context { /// Entry point for a synchronous test in wasm. The `#[wasm_bindgen_test]` /// macro generates invocations of this method. - pub fn execute_sync(&self, name: &str, f: impl 'static + FnOnce() -> T) { - self.execute(name, async { f().into_js_result() }); + pub fn execute_sync( + &self, + name: &str, + f: impl 'static + FnOnce() -> T, + should_panic: Option>, + ) { + self.execute(name, async { f().into_js_result() }, should_panic); } /// Entry point for an asynchronous in wasm. The /// `#[wasm_bindgen_test(async)]` macro generates invocations of this /// method. - pub fn execute_async(&self, name: &str, f: impl FnOnce() -> F + 'static) - where + pub fn execute_async( + &self, + name: &str, + f: impl FnOnce() -> F + 'static, + should_panic: Option>, + ) where F: Future + 'static, F::Output: Termination, { - self.execute(name, async { f().await.into_js_result() }) + self.execute(name, async { f().await.into_js_result() }, should_panic) } - fn execute(&self, name: &str, test: impl Future> + 'static) { + fn execute( + &self, + name: &str, + test: impl Future> + 'static, + should_panic: Option>, + ) { // If our test is filtered out, record that it was filtered and move // on, nothing to do here. let filter = self.state.filter.borrow(); @@ -404,7 +446,11 @@ impl Context { // Looks like we've got a test that needs to be executed! Push it onto // the list of remaining tests. - let output = Rc::new(RefCell::new(Output::default())); + let output = Output { + should_panic: should_panic.is_some(), + ..Default::default() + }; + let output = Rc::new(RefCell::new(output)); let future = TestFuture { output: output.clone(), test, @@ -413,6 +459,7 @@ impl Context { name: name.to_string(), future: Pin::from(Box::new(future)), output, + should_panic, }); } } @@ -474,14 +521,35 @@ impl Future for ExecuteTests { impl State { fn log_test_result(&self, test: Test, result: Result<(), JsValue>) { - // Print out information about the test passing or failing - self.formatter.log_test(&test.name, &result); - // Save off the test for later processing when we print the final // results. - match result { - Ok(()) => self.succeeded.set(self.succeeded.get() + 1), - Err(e) => self.failures.borrow_mut().push((test, e)), + if let Some(should_panic) = test.should_panic { + if let Err(e) = result { + if let Some(expected) = should_panic { + if !test.output.borrow().panic.contains(expected) { + self.formatter.log_test(&test.name, &Err(JsValue::NULL)); + self.failures + .borrow_mut() + .push((test, Failure::ShouldPanicExpected)); + return; + } + } + + self.formatter.log_test(&test.name, &Ok(())); + self.succeeded.set(self.succeeded.get() + 1); + } else { + self.formatter.log_test(&test.name, &Err(JsValue::NULL)); + self.failures + .borrow_mut() + .push((test, Failure::ShouldPanic)); + } + } else { + self.formatter.log_test(&test.name, &result); + + match result { + Ok(()) => self.succeeded.set(self.succeeded.get() + 1), + Err(e) => self.failures.borrow_mut().push((test, Failure::Error(e))), + } } } @@ -489,8 +557,8 @@ impl State { let failures = self.failures.borrow(); if failures.len() > 0 { self.formatter.writeln("\nfailures:\n"); - for (test, error) in failures.iter() { - self.print_failure(test, error); + for (test, failure) in failures.iter() { + self.print_failure(test, failure); } self.formatter.writeln("failures:\n"); for (test, _) in failures.iter() { @@ -520,17 +588,39 @@ impl State { logs.push('\n'); } - fn print_failure(&self, test: &Test, error: &JsValue) { + fn print_failure(&self, test: &Test, failure: &Failure) { let mut logs = String::new(); let output = test.output.borrow(); + + match failure { + Failure::ShouldPanic => { + logs.push_str(&format!( + "note: {} did not panic as expected\n\n", + test.name + )); + } + Failure::ShouldPanicExpected => { + logs.push_str("note: panic did not contain expected string\n"); + logs.push_str(&format!(" panic message: `\"{}\"`,\n", output.panic)); + logs.push_str(&format!( + " expected substring: `\"{}\"`\n\n", + test.should_panic.unwrap().unwrap() + )); + } + _ => (), + } + self.accumulate_console_output(&mut logs, "debug", &output.debug); self.accumulate_console_output(&mut logs, "log", &output.log); self.accumulate_console_output(&mut logs, "info", &output.info); self.accumulate_console_output(&mut logs, "warn", &output.warn); self.accumulate_console_output(&mut logs, "error", &output.error); - logs.push_str("JS exception that was thrown:\n"); - let error_string = self.formatter.stringify_error(error); - logs.push_str(&tab(&error_string)); + + if let Failure::Error(error) = failure { + logs.push_str("JS exception that was thrown:\n"); + let error_string = self.formatter.stringify_error(&error); + logs.push_str(&tab(&error_string)); + } let msg = format!("---- {} output ----\n{}", test.name, tab(&logs)); self.formatter.writeln(&msg); diff --git a/tests/wasm/should_panic.rs b/tests/wasm/should_panic.rs new file mode 100644 index 00000000000..6c0788b2722 --- /dev/null +++ b/tests/wasm/should_panic.rs @@ -0,0 +1,17 @@ +#[wasm_bindgen_test] +#[should_panic] +fn should_panic() { + panic!() +} + +#[wasm_bindgen_test] +#[should_panic = "error message"] +fn should_panic_string() { + panic!("error message") +} + +#[wasm_bindgen_test] +#[should_panic(expected = "error message")] +fn should_panic_expected() { + panic!("error message") +} From 5b89c29dbabf12b5ff372138c15054a9e16f4fc2 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 17 Feb 2023 02:34:32 +1100 Subject: [PATCH 167/641] Update expected results for UI tests (#3312) * Update expected results for UI tests Apparently, #3293 didn't quite update them properly, causing CI to fail. I'm not sure why CI passed when checking the PR but failed on `main`, but this should fix the CI failure. * Use updated trybuild It looks like trybuild moved where it puts its output, and so CI's up-to-date trybuild and my older local trybuild disagreed on what a path should be. --- crates/macro/ui-tests/struct-fields.stderr | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/macro/ui-tests/struct-fields.stderr b/crates/macro/ui-tests/struct-fields.stderr index b6e6a168a25..932c91aa869 100644 --- a/crates/macro/ui-tests/struct-fields.stderr +++ b/crates/macro/ui-tests/struct-fields.stderr @@ -16,5 +16,3 @@ error[E0277]: the trait bound `Foo: Clone` is not satisfied | 11 | #[wasm_bindgen(getter_with_clone)] | ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` - | -note: required by `clone` From 629a623adfe27c67a21408c120d3466965575e45 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 16 Feb 2023 16:35:00 +0100 Subject: [PATCH 168/641] Retain `unsafe` in imports (#3302) --- crates/backend/src/ast.rs | 2 ++ crates/backend/src/codegen.rs | 7 ++++++- crates/macro-support/src/parser.rs | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 7dc728fd356..4a98f858cbf 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -301,6 +301,8 @@ pub struct Function { pub rust_attrs: Vec, /// The visibility of this function in Rust pub rust_vis: syn::Visibility, + /// Whether this is an `unsafe` function + pub r#unsafe: bool, /// Whether this is an `async` function pub r#async: bool, /// Whether to generate a typescript definition for this function diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 34cf3a32472..d9e3d9bd301 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1178,6 +1178,11 @@ impl TryToTokens for ast::ImportFunction { &self.rust_name, ); + let maybe_unsafe = if self.function.r#unsafe { + Some(quote! {unsafe}) + } else { + None + }; let maybe_async = if self.function.r#async { Some(quote! {async}) } else { @@ -1190,7 +1195,7 @@ impl TryToTokens for ast::ImportFunction { #[allow(clippy::all, clippy::nursery, clippy::pedantic, clippy::restriction)] #(#attrs)* #[doc = #doc_comment] - #vis #maybe_async fn #rust_name(#me #(#arguments),*) #ret { + #vis #maybe_async #maybe_unsafe fn #rust_name(#me #(#arguments),*) #ret { #extern_fn unsafe { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 148cc55f9cb..a54d8e5934a 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -909,6 +909,7 @@ fn function_from_decl( ret, rust_attrs: attrs, rust_vis: vis, + r#unsafe: sig.unsafety.is_some(), r#async: sig.asyncness.is_some(), generate_typescript: opts.skip_typescript().is_none(), variadic: opts.variadic().is_some(), From 1aee7e8e275c8399f5981eedd8e33a1f61a44b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20S=C3=B8holm?= Date: Fri, 17 Feb 2023 16:10:06 +0100 Subject: [PATCH 169/641] Fix large pointers from WASM (#3310) Pointers being passed from WASM to JS are interpreted as signed, so large pointers ended up negative. This prevented WASM programs from allocating more than 2GB. To fix it we make all pointers unsigned (via >>> 0) for all malloc/realloc calls and inside shim functions. Ideally we would have an abstraction that guarantees we catch all cases, but that would require a major refactor. To test it we add gg-alloc as an optional system allocator for wasm-bindgen-test. It only allocates in the upper 2GB range and was made to test this exact issue but was never upstreamed. Fixes #2388 Fixes #2957 --- Cargo.toml | 8 +++++++- crates/cli-support/src/js/mod.rs | 19 ++++++++++++------- .../tests/reference/anyref-import-catch.js | 1 + crates/cli/tests/reference/result-string.js | 1 + crates/cli/tests/reference/string-arg.js | 7 ++++--- crates/test/Cargo.toml | 1 + crates/test/src/lib.rs | 6 ++++++ 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ebbeda2cf8f..d7179ac09a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,9 +30,15 @@ enable-interning = ["std"] # all unused attributes strict-macro = ["wasm-bindgen-macro/strict-macro"] +# Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers +# are handled correctly +gg-alloc = ["wasm-bindgen-test/gg-alloc"] + # This is only for debugging wasm-bindgen! No stability guarantees, so enable # this at your own peril! -xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] +xxx_debug_only_print_generated_code = [ + "wasm-bindgen-macro/xxx_debug_only_print_generated_code", +] [dependencies] wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.84" } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index aa88537370f..1a1de40e909 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -920,6 +920,7 @@ impl<'a> Context<'a> { dst.push_str(&format!( " static __wrap(ptr) {{ + ptr = ptr >>> 0; const obj = Object.create({}.prototype); obj.ptr = ptr; {} @@ -937,7 +938,7 @@ impl<'a> Context<'a> { if self.config.weak_refs { self.global(&format!( - "const {}Finalization = new FinalizationRegistry(ptr => wasm.{}(ptr));", + "const {}Finalization = new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));", name, wasm_bindgen_shared::free_function(&name), )); @@ -1259,14 +1260,14 @@ impl<'a> Context<'a> { "\ if (realloc === undefined) {{ const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length); + const ptr = malloc(buf.length) >>> 0; {mem}().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; }} let len = arg.length; - let ptr = malloc(len); + let ptr = malloc(len) >>> 0; const mem = {mem}(); @@ -1294,7 +1295,7 @@ impl<'a> Context<'a> { if (offset !== 0) {{ arg = arg.slice(offset); }} - ptr = realloc(ptr, len, len = offset + arg.length * 3); + ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0; const view = {mem}().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); {debug_end} @@ -1366,7 +1367,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(array, malloc) {{ - const ptr = malloc(array.length * 4); + const ptr = malloc(array.length * 4) >>> 0; const mem = {}(); for (let i = 0; i < array.length; i++) {{ mem[ptr / 4 + i] = {}(array[i]); @@ -1383,7 +1384,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(array, malloc) {{ - const ptr = malloc(array.length * 4); + const ptr = malloc(array.length * 4) >>> 0; const mem = {}(); for (let i = 0; i < array.length; i++) {{ mem[ptr / 4 + i] = addHeapObject(array[i]); @@ -1416,7 +1417,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(arg, malloc) {{ - const ptr = malloc(arg.length * {size}); + const ptr = malloc(arg.length * {size}) >>> 0; {}().set(arg, ptr / {size}); WASM_VECTOR_LEN = arg.length; return ptr; @@ -1513,6 +1514,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(ptr, len) {{ + ptr = ptr >>> 0; return cachedTextDecoder.decode({}().{}(ptr, ptr + len)); }} ", @@ -1583,6 +1585,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(ptr, len) {{ + ptr = ptr >>> 0; const mem = {}(); const slice = mem.subarray(ptr / 4, ptr / 4 + len); const result = []; @@ -1601,6 +1604,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {}(ptr, len) {{ + ptr = ptr >>> 0; const mem = {}(); const slice = mem.subarray(ptr / 4, ptr / 4 + len); const result = []; @@ -1683,6 +1687,7 @@ impl<'a> Context<'a> { self.global(&format!( " function {name}(ptr, len) {{ + ptr = ptr >>> 0; return {mem}().subarray(ptr / {size}, ptr / {size} + len); }} ", diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index d73f9ff7f3d..f7727f5e627 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -20,6 +20,7 @@ function getUint8Memory0() { } function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 1ade844742c..6d28e06c7e4 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -58,6 +58,7 @@ function getUint8Memory0() { } function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index bf5ba77b739..7921d3ca422 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -20,6 +20,7 @@ function getUint8Memory0() { } function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } @@ -46,14 +47,14 @@ function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length); + const ptr = malloc(buf.length) >>> 0; getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; - let ptr = malloc(len); + let ptr = malloc(len) >>> 0; const mem = getUint8Memory0(); @@ -69,7 +70,7 @@ function passStringToWasm0(arg, malloc, realloc) { if (offset !== 0) { arg = arg.slice(offset); } - ptr = realloc(ptr, len, len = offset + arg.length * 3); + ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0; const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 7b7ef2192c1..ff6b046f289 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -14,6 +14,7 @@ scoped-tls = "1.0" wasm-bindgen = { path = '../..', version = '0.2.84' } wasm-bindgen-futures = { path = '../futures', version = '0.4.34' } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.34' } +gg-alloc = { version = "1.0", optional = true } [lib] test = false diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index 7fc5bc0a239..4fcb28aeb49 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -6,6 +6,12 @@ pub use wasm_bindgen_test_macro::wasm_bindgen_test; +// Custom allocator that only returns pointers in the 2GB-4GB range +// To ensure we actually support more than 2GB of memory +#[cfg(all(test, feature = "gg-alloc"))] +#[global_allocator] +static A: gg_alloc::GgAlloc = gg_alloc::GgAlloc::new(std::alloc::System); + /// Helper macro which acts like `println!` only routes to `console.log` /// instead. #[macro_export] From 7807a47c991b35a34b277048c32d119d7f6ca1e3 Mon Sep 17 00:00:00 2001 From: Mike Seddon Date: Sun, 19 Feb 2023 09:30:36 +1100 Subject: [PATCH 170/641] OffscreenCanvasRenderingContext2d (#3319) * followed the basic instructions for [OffscreenCanvasRenderingContext2d](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D) --- crates/web-sys/Cargo.toml | 1 + .../gen_OffscreenCanvasRenderingContext2d.rs | 1598 +++++++++++++++++ crates/web-sys/src/features/mod.rs | 6 + .../OffscreenCanvasRenderingContext2D.webidl | 21 + 4 files changed, 1626 insertions(+) create mode 100644 crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs create mode 100644 crates/web-sys/webidls/unstable/OffscreenCanvasRenderingContext2D.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 9515ee84858..a0126805e14 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -868,6 +868,7 @@ OfflineAudioContext = ["BaseAudioContext", "EventTarget"] OfflineAudioContextOptions = [] OfflineResourceList = ["EventTarget"] OffscreenCanvas = ["EventTarget"] +OffscreenCanvasRenderingContext2d = [] OpenWindowEventDetail = [] OptionalEffectTiming = [] OrientationLockType = [] diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs new file mode 100644 index 00000000000..328d6720ff5 --- /dev/null +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -0,0 +1,1598 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = OffscreenCanvasRenderingContext2D , typescript_type = "OffscreenCanvasRenderingContext2D")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `OffscreenCanvasRenderingContext2d` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type OffscreenCanvasRenderingContext2d; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = canvas)] + #[doc = "Getter for the `canvas` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/canvas)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn canvas(this: &OffscreenCanvasRenderingContext2d) -> OffscreenCanvas; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = globalAlpha)] + #[doc = "Getter for the `globalAlpha` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/globalAlpha)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn global_alpha(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = globalAlpha)] + #[doc = "Setter for the `globalAlpha` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/globalAlpha)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_global_alpha(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , catch , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = globalCompositeOperation)] + #[doc = "Getter for the `globalCompositeOperation` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/globalCompositeOperation)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn global_composite_operation( + this: &OffscreenCanvasRenderingContext2d, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , catch , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = globalCompositeOperation)] + #[doc = "Setter for the `globalCompositeOperation` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/globalCompositeOperation)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_global_composite_operation( + this: &OffscreenCanvasRenderingContext2d, + value: &str, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Getter for the `strokeStyle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke_style(this: &OffscreenCanvasRenderingContext2d) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_stroke_style( + this: &OffscreenCanvasRenderingContext2d, + value: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Getter for the `fillStyle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_style(this: &OffscreenCanvasRenderingContext2d) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_fill_style( + this: &OffscreenCanvasRenderingContext2d, + value: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = filter)] + #[doc = "Getter for the `filter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/filter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn filter(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = filter)] + #[doc = "Setter for the `filter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/filter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_filter(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = imageSmoothingEnabled)] + #[doc = "Getter for the `imageSmoothingEnabled` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/imageSmoothingEnabled)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn image_smoothing_enabled(this: &OffscreenCanvasRenderingContext2d) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = imageSmoothingEnabled)] + #[doc = "Setter for the `imageSmoothingEnabled` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/imageSmoothingEnabled)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_image_smoothing_enabled(this: &OffscreenCanvasRenderingContext2d, value: bool); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineWidth)] + #[doc = "Getter for the `lineWidth` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineWidth)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn line_width(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineWidth)] + #[doc = "Setter for the `lineWidth` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineWidth)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_line_width(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineCap)] + #[doc = "Getter for the `lineCap` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineCap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn line_cap(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineCap)] + #[doc = "Setter for the `lineCap` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineCap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_line_cap(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineJoin)] + #[doc = "Getter for the `lineJoin` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineJoin)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn line_join(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineJoin)] + #[doc = "Setter for the `lineJoin` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineJoin)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_line_join(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = miterLimit)] + #[doc = "Getter for the `miterLimit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/miterLimit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn miter_limit(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = miterLimit)] + #[doc = "Setter for the `miterLimit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/miterLimit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_miter_limit(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineDashOffset)] + #[doc = "Getter for the `lineDashOffset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineDashOffset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn line_dash_offset(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineDashOffset)] + #[doc = "Setter for the `lineDashOffset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineDashOffset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_line_dash_offset(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowOffsetX)] + #[doc = "Getter for the `shadowOffsetX` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowOffsetX)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn shadow_offset_x(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowOffsetX)] + #[doc = "Setter for the `shadowOffsetX` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowOffsetX)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_shadow_offset_x(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowOffsetY)] + #[doc = "Getter for the `shadowOffsetY` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowOffsetY)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn shadow_offset_y(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowOffsetY)] + #[doc = "Setter for the `shadowOffsetY` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowOffsetY)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_shadow_offset_y(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowBlur)] + #[doc = "Getter for the `shadowBlur` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowBlur)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn shadow_blur(this: &OffscreenCanvasRenderingContext2d) -> f64; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowBlur)] + #[doc = "Setter for the `shadowBlur` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowBlur)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_shadow_blur(this: &OffscreenCanvasRenderingContext2d, value: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowColor)] + #[doc = "Getter for the `shadowColor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowColor)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn shadow_color(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowColor)] + #[doc = "Setter for the `shadowColor` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowColor)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_shadow_color(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = font)] + #[doc = "Getter for the `font` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/font)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn font(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = font)] + #[doc = "Setter for the `font` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/font)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_font(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textAlign)] + #[doc = "Getter for the `textAlign` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textAlign)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn text_align(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textAlign)] + #[doc = "Setter for the `textAlign` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textAlign)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_text_align(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textBaseline)] + #[doc = "Getter for the `textBaseline` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textBaseline)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn text_baseline(this: &OffscreenCanvasRenderingContext2d) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textBaseline)] + #[doc = "Setter for the `textBaseline` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textBaseline)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_text_baseline(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = commit)] + #[doc = "The `commit()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/commit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn commit(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_image_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlImageElement, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SvgImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `SvgImageElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_svg_image_element( + this: &OffscreenCanvasRenderingContext2d, + image: &SvgImageElement, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlCanvasElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_canvas_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlCanvasElement, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlVideoElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_video_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlVideoElement, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageBitmap")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_image_bitmap( + this: &OffscreenCanvasRenderingContext2d, + image: &ImageBitmap, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_offscreen_canvas( + this: &OffscreenCanvasRenderingContext2d, + image: &OffscreenCanvas, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame( + this: &OffscreenCanvasRenderingContext2d, + image: &VideoFrame, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_image_element_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlImageElement, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SvgImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `SvgImageElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_svg_image_element_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &SvgImageElement, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlCanvasElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_canvas_element_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlCanvasElement, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlVideoElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_video_element_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlVideoElement, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageBitmap")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_image_bitmap_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &ImageBitmap, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_offscreen_canvas_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &OffscreenCanvas, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &VideoFrame, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_image_element_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlImageElement, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SvgImageElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `SvgImageElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_svg_image_element_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &SvgImageElement, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlCanvasElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_canvas_element_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlCanvasElement, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HtmlVideoElement")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_html_video_element_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlVideoElement, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageBitmap")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_image_bitmap_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &ImageBitmap, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OffscreenCanvas")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvas`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_offscreen_canvas_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &OffscreenCanvas, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = drawImage)] + #[doc = "The `drawImage()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/drawImage)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draw_image_with_video_frame_and_sw_and_sh_and_dx_and_dy_and_dw_and_dh( + this: &OffscreenCanvasRenderingContext2d, + image: &VideoFrame, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + dx: f64, + dy: f64, + dw: f64, + dh: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = beginPath)] + #[doc = "The `beginPath()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/beginPath)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn begin_path(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = clip)] + #[doc = "The `clip()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/clip)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clip(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CanvasWindingRule")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = clip)] + #[doc = "The `clip()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/clip)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clip_with_canvas_winding_rule( + this: &OffscreenCanvasRenderingContext2d, + winding: CanvasWindingRule, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Path2d")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = clip)] + #[doc = "The `clip()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/clip)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clip_with_path_2d(this: &OffscreenCanvasRenderingContext2d, path: &Path2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasWindingRule", feature = "Path2d",))] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = clip)] + #[doc = "The `clip()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/clip)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clip_with_path_2d_and_winding( + this: &OffscreenCanvasRenderingContext2d, + path: &Path2d, + winding: CanvasWindingRule, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fill)] + #[doc = "The `fill()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fill)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CanvasWindingRule")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fill)] + #[doc = "The `fill()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fill)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_with_canvas_winding_rule( + this: &OffscreenCanvasRenderingContext2d, + winding: CanvasWindingRule, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Path2d")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fill)] + #[doc = "The `fill()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fill)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_with_path_2d(this: &OffscreenCanvasRenderingContext2d, path: &Path2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasWindingRule", feature = "Path2d",))] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fill)] + #[doc = "The `fill()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fill)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_with_path_2d_and_winding( + this: &OffscreenCanvasRenderingContext2d, + path: &Path2d, + winding: CanvasWindingRule, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInPath)] + #[doc = "The `isPointInPath()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInPath)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_path_with_f64( + this: &OffscreenCanvasRenderingContext2d, + x: f64, + y: f64, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CanvasWindingRule")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInPath)] + #[doc = "The `isPointInPath()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInPath)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_path_with_f64_and_canvas_winding_rule( + this: &OffscreenCanvasRenderingContext2d, + x: f64, + y: f64, + winding: CanvasWindingRule, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Path2d")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInPath)] + #[doc = "The `isPointInPath()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInPath)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_path_with_path_2d_and_f64( + this: &OffscreenCanvasRenderingContext2d, + path: &Path2d, + x: f64, + y: f64, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasWindingRule", feature = "Path2d",))] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInPath)] + #[doc = "The `isPointInPath()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInPath)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasWindingRule`, `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_path_with_path_2d_and_f64_and_winding( + this: &OffscreenCanvasRenderingContext2d, + path: &Path2d, + x: f64, + y: f64, + winding: CanvasWindingRule, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInStroke)] + #[doc = "The `isPointInStroke()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInStroke)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_stroke_with_x_and_y( + this: &OffscreenCanvasRenderingContext2d, + x: f64, + y: f64, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Path2d")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = isPointInStroke)] + #[doc = "The `isPointInStroke()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/isPointInStroke)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_point_in_stroke_with_path_and_x_and_y( + this: &OffscreenCanvasRenderingContext2d, + path: &Path2d, + x: f64, + y: f64, + ) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = stroke)] + #[doc = "The `stroke()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/stroke)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Path2d")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = stroke)] + #[doc = "The `stroke()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/stroke)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `Path2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke_with_path(this: &OffscreenCanvasRenderingContext2d, path: &Path2d); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createLinearGradient)] + #[doc = "The `createLinearGradient()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createLinearGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_linear_gradient( + this: &OffscreenCanvasRenderingContext2d, + x0: f64, + y0: f64, + x1: f64, + y1: f64, + ) -> CanvasGradient; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "HtmlImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `HtmlImageElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_html_image_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlImageElement, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`, `SvgImageElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_svg_image_element( + this: &OffscreenCanvasRenderingContext2d, + image: &SvgImageElement, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "HtmlCanvasElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `HtmlCanvasElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_html_canvas_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlCanvasElement, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "HtmlVideoElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `HtmlVideoElement`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_html_video_element( + this: &OffscreenCanvasRenderingContext2d, + image: &HtmlVideoElement, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "ImageBitmap",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `ImageBitmap`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_image_bitmap( + this: &OffscreenCanvasRenderingContext2d, + image: &ImageBitmap, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvas`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_offscreen_canvas( + this: &OffscreenCanvasRenderingContext2d, + image: &OffscreenCanvas, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "CanvasPattern", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createPattern)] + #[doc = "The `createPattern()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_pattern_with_video_frame( + this: &OffscreenCanvasRenderingContext2d, + image: &VideoFrame, + repetition: &str, + ) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createRadialGradient)] + #[doc = "The `createRadialGradient()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createRadialGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_radial_gradient( + this: &OffscreenCanvasRenderingContext2d, + x0: f64, + y0: f64, + r0: f64, + x1: f64, + y1: f64, + r1: f64, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageData")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createImageData)] + #[doc = "The `createImageData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_data_with_sw_and_sh( + this: &OffscreenCanvasRenderingContext2d, + sw: f64, + sh: f64, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageData")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = createImageData)] + #[doc = "The `createImageData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/createImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_data_with_imagedata( + this: &OffscreenCanvasRenderingContext2d, + imagedata: &ImageData, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageData")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = getImageData)] + #[doc = "The `getImageData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/getImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_image_data( + this: &OffscreenCanvasRenderingContext2d, + sx: f64, + sy: f64, + sw: f64, + sh: f64, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageData")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = putImageData)] + #[doc = "The `putImageData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/putImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn put_image_data( + this: &OffscreenCanvasRenderingContext2d, + imagedata: &ImageData, + dx: f64, + dy: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ImageData")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = putImageData)] + #[doc = "The `putImageData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/putImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn put_image_data_with_dirty_x_and_dirty_y_and_dirty_width_and_dirty_height( + this: &OffscreenCanvasRenderingContext2d, + imagedata: &ImageData, + dx: f64, + dy: f64, + dirty_x: f64, + dirty_y: f64, + dirty_width: f64, + dirty_height: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = getLineDash)] + #[doc = "The `getLineDash()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/getLineDash)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_line_dash(this: &OffscreenCanvasRenderingContext2d) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setLineDash)] + #[doc = "The `setLineDash()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setLineDash)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_line_dash( + this: &OffscreenCanvasRenderingContext2d, + segments: &::wasm_bindgen::JsValue, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = clearRect)] + #[doc = "The `clearRect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/clearRect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn clear_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillRect)] + #[doc = "The `fillRect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillRect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeRect)] + #[doc = "The `strokeRect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeRect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = restore)] + #[doc = "The `restore()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/restore)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn restore(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = save)] + #[doc = "The `save()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/save)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn save(this: &OffscreenCanvasRenderingContext2d); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillText)] + #[doc = "The `fillText()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_text( + this: &OffscreenCanvasRenderingContext2d, + text: &str, + x: f64, + y: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillText)] + #[doc = "The `fillText()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_text_with_max_width( + this: &OffscreenCanvasRenderingContext2d, + text: &str, + x: f64, + y: f64, + max_width: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TextMetrics")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = measureText)] + #[doc = "The `measureText()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/measureText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`, `TextMetrics`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn measure_text( + this: &OffscreenCanvasRenderingContext2d, + text: &str, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeText)] + #[doc = "The `strokeText()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke_text( + this: &OffscreenCanvasRenderingContext2d, + text: &str, + x: f64, + y: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeText)] + #[doc = "The `strokeText()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stroke_text_with_max_width( + this: &OffscreenCanvasRenderingContext2d, + text: &str, + x: f64, + y: f64, + max_width: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomMatrix")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = getTransform)] + #[doc = "The `getTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/getTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix`, `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_transform(this: &OffscreenCanvasRenderingContext2d) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = resetTransform)] + #[doc = "The `resetTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/resetTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn reset_transform(this: &OffscreenCanvasRenderingContext2d) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = rotate)] + #[doc = "The `rotate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/rotate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn rotate(this: &OffscreenCanvasRenderingContext2d, angle: f64) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = scale)] + #[doc = "The `scale()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/scale)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scale(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_transform( + this: &OffscreenCanvasRenderingContext2d, + a: f64, + b: f64, + c: f64, + d: f64, + e: f64, + f: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = transform)] + #[doc = "The `transform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/transform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transform( + this: &OffscreenCanvasRenderingContext2d, + a: f64, + b: f64, + c: f64, + d: f64, + e: f64, + f: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = translate)] + #[doc = "The `translate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/translate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn translate( + this: &OffscreenCanvasRenderingContext2d, + x: f64, + y: f64, + ) -> Result<(), JsValue>; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 680471c2fb4..ec4e23dc595 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -5008,6 +5008,12 @@ mod gen_OffscreenCanvas; #[cfg(feature = "OffscreenCanvas")] pub use gen_OffscreenCanvas::*; +#[cfg(feature = "OffscreenCanvasRenderingContext2d")] +#[allow(non_snake_case)] +mod gen_OffscreenCanvasRenderingContext2d; +#[cfg(feature = "OffscreenCanvasRenderingContext2d")] +pub use gen_OffscreenCanvasRenderingContext2d::*; + #[cfg(feature = "OpenWindowEventDetail")] #[allow(non_snake_case)] mod gen_OpenWindowEventDetail; diff --git a/crates/web-sys/webidls/unstable/OffscreenCanvasRenderingContext2D.webidl b/crates/web-sys/webidls/unstable/OffscreenCanvasRenderingContext2D.webidl new file mode 100644 index 00000000000..bb8a75ee6b3 --- /dev/null +++ b/crates/web-sys/webidls/unstable/OffscreenCanvasRenderingContext2D.webidl @@ -0,0 +1,21 @@ +[Exposed = (Window, Worker)] +interface OffscreenCanvasRenderingContext2D { + undefined commit(); + readonly attribute OffscreenCanvas canvas; +}; + +OffscreenCanvasRenderingContext2D includes CanvasState; +OffscreenCanvasRenderingContext2D includes CanvasTransform; +OffscreenCanvasRenderingContext2D includes CanvasCompositing; +OffscreenCanvasRenderingContext2D includes CanvasImageSmoothing; +OffscreenCanvasRenderingContext2D includes CanvasFillStrokeStyles; +OffscreenCanvasRenderingContext2D includes CanvasShadowStyles; +OffscreenCanvasRenderingContext2D includes CanvasFilters; +OffscreenCanvasRenderingContext2D includes CanvasRect; +OffscreenCanvasRenderingContext2D includes CanvasDrawPath; +OffscreenCanvasRenderingContext2D includes CanvasText; +OffscreenCanvasRenderingContext2D includes CanvasDrawImage; +OffscreenCanvasRenderingContext2D includes CanvasImageData; +OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles; +OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles; +OffscreenCanvasRenderingContext2D includes CanvasPath; From c92104c37ab3260f41b69d52e78d0314d748c243 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 18 Feb 2023 23:33:30 +0100 Subject: [PATCH 171/641] Add `WASM_BINDGEN_TEST_ADDRESS` (#3314) --- crates/cli/src/bin/wasm-bindgen-test-runner/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 7f6606a3e33..3286a118cc7 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -188,6 +188,8 @@ integration test.\ let srv = server::spawn( &if headless { "127.0.0.1:0".parse().unwrap() + } else if let Ok(address) = std::env::var("WASM_BINDGEN_TEST_ADDRESS") { + address.parse().unwrap() } else { "127.0.0.1:8000".parse().unwrap() }, From 78421dc53ccbe9dc4be437cd8b09961cb8159ddc Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 27 Feb 2023 01:08:53 +0100 Subject: [PATCH 172/641] Don't force `TextDe/Encoder` (#3329) --- crates/cli-support/src/js/mod.rs | 41 +++++++++++++++---- .../src/dependent_module.rs | 7 +--- examples/wasm-audio-worklet/src/polyfill.js | 23 ----------- 3 files changed, 35 insertions(+), 36 deletions(-) delete mode 100644 examples/wasm-audio-worklet/src/polyfill.js diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 1a1de40e909..b53997c1b1a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1434,7 +1434,7 @@ impl<'a> Context<'a> { if !self.should_write_global("text_encoder") { return Ok(()); } - self.expose_text_processor("TextEncoder", "('utf-8')") + self.expose_text_processor("TextEncoder", "('utf-8')", None) } fn expose_text_decoder(&mut self) -> Result<(), Error> { @@ -1442,18 +1442,27 @@ impl<'a> Context<'a> { return Ok(()); } - // `ignoreBOM` is needed so that the BOM will be preserved when sending a string from Rust to JS - // `fatal` is needed to catch any weird encoding bugs when sending a string from Rust to JS - self.expose_text_processor("TextDecoder", "('utf-8', { ignoreBOM: true, fatal: true })")?; - // This is needed to workaround a bug in Safari // See: https://github.com/rustwasm/wasm-bindgen/issues/1825 - self.global("cachedTextDecoder.decode();"); + let init = Some("cachedTextDecoder.decode();"); + + // `ignoreBOM` is needed so that the BOM will be preserved when sending a string from Rust to JS + // `fatal` is needed to catch any weird encoding bugs when sending a string from Rust to JS + self.expose_text_processor( + "TextDecoder", + "('utf-8', { ignoreBOM: true, fatal: true })", + init, + )?; Ok(()) } - fn expose_text_processor(&mut self, s: &str, args: &str) -> Result<(), Error> { + fn expose_text_processor( + &mut self, + s: &str, + args: &str, + init: Option<&str>, + ) -> Result<(), Error> { match &self.config.mode { OutputMode::Node { .. } => { let name = self.import_name(&JsImport { @@ -1481,10 +1490,26 @@ impl<'a> Context<'a> { | OutputMode::Web | OutputMode::NoModules { .. } | OutputMode::Bundler { browser_only: true } => { - self.global(&format!("const cached{0} = new {0}{1};", s, args)) + self.global(&format!("const cached{0} = (typeof {0} !== 'undefined' ? new {0}{1} : {{ decode: () => {{ throw Error('{0} not available') }} }} );", s, args)) } }; + if let Some(init) = init { + match &self.config.mode { + OutputMode::Node { .. } + | OutputMode::Bundler { + browser_only: false, + } => self.global(init), + OutputMode::Deno + | OutputMode::Web + | OutputMode::NoModules { .. } + | OutputMode::Bundler { browser_only: true } => self.global(&format!( + "if (typeof {} !== 'undefined') {{ {} }};", + s, init + )), + } + } + Ok(()) } diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs index fa01b0acb23..a1706d46ccf 100644 --- a/examples/wasm-audio-worklet/src/dependent_module.rs +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -17,12 +17,9 @@ extern "C" { } pub fn on_the_fly(code: &str) -> Result { - // Generate the import of the bindgen ES module, assuming `--target web`, - // preluded by the TextEncoder/TextDecoder polyfill needed inside worklets. + // Generate the import of the bindgen ES module, assuming `--target web`. let header = format!( - "import '{}';\n\ - import init, * as bindgen from '{}';\n\n", - wasm_bindgen::link_to!(module = "/src/polyfill.js"), + "import init, * as bindgen from '{}';\n\n", IMPORT_META.url(), ); diff --git a/examples/wasm-audio-worklet/src/polyfill.js b/examples/wasm-audio-worklet/src/polyfill.js deleted file mode 100644 index d4d57e9fa67..00000000000 --- a/examples/wasm-audio-worklet/src/polyfill.js +++ /dev/null @@ -1,23 +0,0 @@ -if (!globalThis.TextDecoder) { - globalThis.TextDecoder = class TextDecoder { - decode(arg) { - if (typeof arg !== 'undefined') { - throw Error('TextDecoder stub called'); - } else { - return ''; - } - } - }; -} - -if (!globalThis.TextEncoder) { - globalThis.TextEncoder = class TextEncoder { - encode(arg) { - if (typeof arg !== 'undefined') { - throw Error('TextEncoder stub called'); - } else { - return new Uint8Array(0); - } - } - }; -} From 3d9fe5327070814701fbcf0d605fcf9b042f8fb6 Mon Sep 17 00:00:00 2001 From: Tom Ballinger Date: Sun, 26 Feb 2023 20:45:51 -0800 Subject: [PATCH 173/641] Fix link in deployment docs. (#3334) --- guide/src/reference/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/deployment.md b/guide/src/reference/deployment.md index b0de3b1e8b3..d0530941a55 100644 --- a/guide/src/reference/deployment.md +++ b/guide/src/reference/deployment.md @@ -20,7 +20,7 @@ The methods of deployment and integration here are primarily tied to the [`web`]: #without-a-bundler [`no-modules`]: #without-a-bundler [`nodejs`]: #nodejs -[`deno`]: #Deno +[`deno`]: #deno ## Bundlers From 03e270458e70b350239161db04c244e8304acdd9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 27 Feb 2023 23:05:22 +0100 Subject: [PATCH 174/641] Adjust examples to auto `.wasm` file detection (#3249) --- examples/raytrace-parallel/index.js | 2 +- examples/wasm-in-web-worker/index.js | 2 +- examples/without-a-bundler-no-modules/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/raytrace-parallel/index.js b/examples/raytrace-parallel/index.js index 328d891d384..4ef286715a9 100644 --- a/examples/raytrace-parallel/index.js +++ b/examples/raytrace-parallel/index.js @@ -26,7 +26,7 @@ function loadWasm() { return } - wasm_bindgen('./raytrace_parallel_bg.wasm') + wasm_bindgen() .then(run) .catch(console.error); } diff --git a/examples/wasm-in-web-worker/index.js b/examples/wasm-in-web-worker/index.js index 9de6d133004..5429ff98bb5 100644 --- a/examples/wasm-in-web-worker/index.js +++ b/examples/wasm-in-web-worker/index.js @@ -6,7 +6,7 @@ const {startup} = wasm_bindgen; async function run_wasm() { // Load the wasm file by awaiting the Promise returned by `wasm_bindgen` // `wasm_bindgen` was imported in `index.html` - await wasm_bindgen('./pkg/wasm_in_web_worker_bg.wasm'); + await wasm_bindgen(); console.log('index.js loaded'); diff --git a/examples/without-a-bundler-no-modules/index.html b/examples/without-a-bundler-no-modules/index.html index f5184ed2a70..effdec477a7 100644 --- a/examples/without-a-bundler-no-modules/index.html +++ b/examples/without-a-bundler-no-modules/index.html @@ -19,7 +19,7 @@ const { add } = wasm_bindgen; async function run() { - await wasm_bindgen('./pkg/without_a_bundler_no_modules_bg.wasm'); + await wasm_bindgen(); const result = add(1, 2); console.log(`1 + 2 = ${result}`); From 9e4c604cf0182881a56cf080144705e130714632 Mon Sep 17 00:00:00 2001 From: Michael Allwright Date: Thu, 2 Mar 2023 22:24:52 +0100 Subject: [PATCH 175/641] Update Web IDLs for capturing from a HtmlCanvasElement (#3325) --- crates/web-sys/Cargo.toml | 12 ++++---- .../gen_CanvasCaptureMediaStreamTrack.rs | 29 +++++++++++++++++++ .../src/features/gen_HtmlCanvasElement.rs | 19 ++++++++++++ crates/web-sys/src/features/mod.rs | 6 ++++ .../enabled/CanvasCaptureMediaStream.webidl | 2 +- .../CanvasCaptureMediaStreamTrack.webidl | 17 +++++++++++ .../webidls/enabled/HTMLCanvasElement.webidl | 9 +++++- 7 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 crates/web-sys/src/features/gen_CanvasCaptureMediaStreamTrack.rs create mode 100644 crates/web-sys/webidls/enabled/CanvasCaptureMediaStreamTrack.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index a0126805e14..3ada582de5c 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -157,6 +157,7 @@ CacheQueryOptions = [] CacheStorage = [] CacheStorageNamespace = [] CanvasCaptureMediaStream = ["EventTarget", "MediaStream"] +CanvasCaptureMediaStreamTrack = ["EventTarget", "MediaStreamTrack"] CanvasGradient = [] CanvasPattern = [] CanvasRenderingContext2d = [] @@ -169,8 +170,6 @@ ChannelCountMode = [] ChannelInterpretation = [] ChannelMergerNode = ["AudioNode", "EventTarget"] ChannelMergerOptions = [] -ChannelPixelLayout = [] -ChannelPixelLayoutDataType = [] ChannelSplitterNode = ["AudioNode", "EventTarget"] ChannelSplitterOptions = [] CharacterData = ["EventTarget", "Node"] @@ -692,7 +691,6 @@ IdleRequestOptions = [] IirFilterNode = ["AudioNode", "EventTarget"] IirFilterOptions = [] ImageBitmap = [] -ImageBitmapFormat = [] ImageBitmapOptions = [] ImageBitmapRenderingContext = [] ImageCapture = [] @@ -1511,17 +1509,17 @@ XmlSerializer = [] XrBoundedReferenceSpace = ["EventTarget", "XrReferenceSpace", "XrSpace"] XrEye = [] XrFrame = [] -XrHandedness = [] -XrHand = ["XrHandJoint"] +XrHand = [] XrHandJoint = [] +XrHandedness = [] XrInputSource = [] XrInputSourceArray = [] XrInputSourceEvent = ["Event"] XrInputSourceEventInit = [] XrInputSourcesChangeEvent = ["Event"] XrInputSourcesChangeEventInit = [] -XrJointPose = [] -XrJointSpace = [] +XrJointPose = ["XrPose"] +XrJointSpace = ["EventTarget", "XrSpace"] XrLayer = ["EventTarget"] XrPermissionDescriptor = [] XrPermissionStatus = ["EventTarget", "PermissionStatus"] diff --git a/crates/web-sys/src/features/gen_CanvasCaptureMediaStreamTrack.rs b/crates/web-sys/src/features/gen_CanvasCaptureMediaStreamTrack.rs new file mode 100644 index 00000000000..c7985af3683 --- /dev/null +++ b/crates/web-sys/src/features/gen_CanvasCaptureMediaStreamTrack.rs @@ -0,0 +1,29 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = MediaStreamTrack , extends = EventTarget , extends = :: js_sys :: Object , js_name = CanvasCaptureMediaStreamTrack , typescript_type = "CanvasCaptureMediaStreamTrack")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `CanvasCaptureMediaStreamTrack` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasCaptureMediaStreamTrack)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasCaptureMediaStreamTrack`*"] + pub type CanvasCaptureMediaStreamTrack; + #[cfg(feature = "HtmlCanvasElement")] + # [wasm_bindgen (structural , method , getter , js_class = "CanvasCaptureMediaStreamTrack" , js_name = canvas)] + #[doc = "Getter for the `canvas` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasCaptureMediaStreamTrack/canvas)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasCaptureMediaStreamTrack`, `HtmlCanvasElement`*"] + pub fn canvas(this: &CanvasCaptureMediaStreamTrack) -> HtmlCanvasElement; + # [wasm_bindgen (method , structural , js_class = "CanvasCaptureMediaStreamTrack" , js_name = requestFrame)] + #[doc = "The `requestFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasCaptureMediaStreamTrack/requestFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasCaptureMediaStreamTrack`*"] + pub fn request_frame(this: &CanvasCaptureMediaStreamTrack); +} diff --git a/crates/web-sys/src/features/gen_HtmlCanvasElement.rs b/crates/web-sys/src/features/gen_HtmlCanvasElement.rs index ff8ab7e2dce..70e6a1b9c10 100644 --- a/crates/web-sys/src/features/gen_HtmlCanvasElement.rs +++ b/crates/web-sys/src/features/gen_HtmlCanvasElement.rs @@ -39,6 +39,25 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"] pub fn set_height(this: &HtmlCanvasElement, value: u32); + #[cfg(feature = "MediaStream")] + # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = captureStream)] + #[doc = "The `captureStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `MediaStream`*"] + pub fn capture_stream(this: &HtmlCanvasElement) -> Result; + #[cfg(feature = "MediaStream")] + # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = captureStream)] + #[doc = "The `captureStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `MediaStream`*"] + pub fn capture_stream_with_frame_request_rate( + this: &HtmlCanvasElement, + frame_request_rate: f64, + ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = getContext)] #[doc = "The `getContext()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index ec4e23dc595..e6126b5e2c3 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -760,6 +760,12 @@ mod gen_CanvasCaptureMediaStream; #[cfg(feature = "CanvasCaptureMediaStream")] pub use gen_CanvasCaptureMediaStream::*; +#[cfg(feature = "CanvasCaptureMediaStreamTrack")] +#[allow(non_snake_case)] +mod gen_CanvasCaptureMediaStreamTrack; +#[cfg(feature = "CanvasCaptureMediaStreamTrack")] +pub use gen_CanvasCaptureMediaStreamTrack::*; + #[cfg(feature = "CanvasGradient")] #[allow(non_snake_case)] mod gen_CanvasGradient; diff --git a/crates/web-sys/webidls/enabled/CanvasCaptureMediaStream.webidl b/crates/web-sys/webidls/enabled/CanvasCaptureMediaStream.webidl index 9bd5044173f..f206f36f5d6 100644 --- a/crates/web-sys/webidls/enabled/CanvasCaptureMediaStream.webidl +++ b/crates/web-sys/webidls/enabled/CanvasCaptureMediaStream.webidl @@ -10,7 +10,7 @@ * W3C liability, trademark and document use rules apply. */ -[Pref="canvas.capturestream.enabled"] +[Deprecated] interface CanvasCaptureMediaStream : MediaStream { readonly attribute HTMLCanvasElement canvas; undefined requestFrame(); diff --git a/crates/web-sys/webidls/enabled/CanvasCaptureMediaStreamTrack.webidl b/crates/web-sys/webidls/enabled/CanvasCaptureMediaStreamTrack.webidl new file mode 100644 index 00000000000..e5a7a698193 --- /dev/null +++ b/crates/web-sys/webidls/enabled/CanvasCaptureMediaStreamTrack.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-fromelement/index.html + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface CanvasCaptureMediaStreamTrack : MediaStreamTrack { + readonly attribute HTMLCanvasElement canvas; + undefined requestFrame(); +}; diff --git a/crates/web-sys/webidls/enabled/HTMLCanvasElement.webidl b/crates/web-sys/webidls/enabled/HTMLCanvasElement.webidl index 6d9f5828042..708122a9e90 100644 --- a/crates/web-sys/webidls/enabled/HTMLCanvasElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLCanvasElement.webidl @@ -36,8 +36,15 @@ interface HTMLCanvasElement : HTMLElement { // For OffscreenCanvas // Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas partial interface HTMLCanvasElement { - [Pref="gfx.offscreencanvas.enabled", Throws] + [Throws] OffscreenCanvas transferControlToOffscreen(); }; +// For MediaStream +// Reference: https://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediastream +partial interface HTMLCanvasElement { + [Throws] + MediaStream captureStream (optional double frameRequestRate); +}; + callback BlobCallback = undefined(Blob? blob); From 268fe648ee0c9266ea90863021909e0e2144ef8f Mon Sep 17 00:00:00 2001 From: erwanvivien <44021072+erwanvivien@users.noreply.github.com> Date: Tue, 7 Mar 2023 00:00:48 +0100 Subject: [PATCH 176/641] fix #3307: do nothing when calling init multiple times (#3320) --- crates/cli-support/src/js/mod.rs | 6 +++++- crates/cli/tests/wasm-bindgen/main.rs | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index b53997c1b1a..d42e43a5138 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -385,7 +385,7 @@ impl<'a> Context<'a> { script_src = new URL(document.currentScript.src, location.href).toString(); }\n", ); - js.push_str("let wasm;\n"); + js.push_str("let wasm = undefined;\n"); init = self.gen_init(needs_manual_start, None)?; footer.push_str(&format!( "{} = Object.assign(init, {{ initSync }}, __exports);\n", @@ -852,6 +852,8 @@ impl<'a> Context<'a> { }} function initSync(module{init_memory_arg}) {{ + if (wasm !== undefined) return wasm; + const imports = getImports(); initMemory(imports{init_memory_arg}); @@ -866,6 +868,8 @@ impl<'a> Context<'a> { }} async function init(input{init_memory_arg}) {{ + if (wasm !== undefined) return wasm; + {default_module_path} const imports = getImports(); diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index bed6b2de9ad..8bc0849767a 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -240,6 +240,8 @@ fn default_module_path_target_web() { assert!(contents.contains( "\ async function init(input) { + if (wasm !== undefined) return wasm; + if (typeof input === 'undefined') { input = new URL('default_module_path_target_web_bg.wasm', import.meta.url); }", @@ -267,6 +269,8 @@ fn default_module_path_target_no_modules() { assert!(contents.contains( "\ async function init(input) { + if (wasm !== undefined) return wasm; + if (typeof input === 'undefined' && script_src !== 'undefined') { input = script_src.replace(/\\.js$/, '_bg.wasm'); }", @@ -288,6 +292,8 @@ fn omit_default_module_path_target_web() { assert!(contents.contains( "\ async function init(input) { + if (wasm !== undefined) return wasm; + const imports = getImports();", )); @@ -308,6 +314,8 @@ fn omit_default_module_path_target_no_modules() { assert!(contents.contains( "\ async function init(input) { + if (wasm !== undefined) return wasm; + const imports = getImports();", )); From 5d22f5b9d6ad979579b6e18332b4280a2d2e7c83 Mon Sep 17 00:00:00 2001 From: Nam Se Hyun <3580430+namse@users.noreply.github.com> Date: Wed, 8 Mar 2023 16:40:02 +0900 Subject: [PATCH 177/641] Append features to web-sys Cargo.toml by wasm-bindgen-webidl (#3343) --- .github/workflows/main.yml | 2 +- crates/web-sys/README.md | 5 +-- crates/webidl/src/main.rs | 18 ++++++--- crates/webidl/src/update_cargo_toml.rs | 39 +++++++++++++++++++ .../web-sys/supporting-more-web-apis.md | 2 +- 5 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 crates/webidl/src/update_cargo_toml.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf560554715..05d7997f864 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,7 +153,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: rustup update --no-self-update stable && rustup default stable - - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features + - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml - run: git diff --exit-code test_js_sys: diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index 71bb2be3149..965f41ede0c 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -30,6 +30,5 @@ If you don't see a particular web API in `web-sys`, here is how to add it. [very bottom](https://w3c.github.io/mediasession/#idl-index) of _that_ page is the IDL. 2. Annotate the functions that can throw with `[Throws]` -3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features` -4. Copy the contents of `features` into the `[features]` section of `Cargo.toml` -5. Run `git add .` to add all the generated files into git. +3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml` +4. Run `git add .` to add all the generated files into git. diff --git a/crates/webidl/src/main.rs b/crates/webidl/src/main.rs index b5c13e56f98..57960a2cc66 100644 --- a/crates/webidl/src/main.rs +++ b/crates/webidl/src/main.rs @@ -1,7 +1,9 @@ -use anyhow::{Context, Result}; -use std::fs; +mod update_cargo_toml; + +use anyhow::Result; use std::path::PathBuf; use structopt::StructOpt; +use update_cargo_toml::update_cargo_toml_features; #[derive(StructOpt, Debug)] #[structopt( @@ -17,6 +19,9 @@ struct Opt { #[structopt(long)] no_features: bool, + + #[structopt(parse(from_os_str))] + cargo_toml_path: Option, } fn main() -> Result<()> { @@ -32,9 +37,12 @@ fn main() -> Result<()> { wasm_bindgen_webidl::Options { features }, )?; - if features { - fs::write(&"features", generated_features) - .context("writing features to current directory")?; + if let Some(cargo_toml_path) = opt.cargo_toml_path { + if features { + update_cargo_toml_features(&cargo_toml_path, &generated_features)?; + } else { + log::warn!("with no_features, not updating Cargo.toml"); + } } Ok(()) diff --git a/crates/webidl/src/update_cargo_toml.rs b/crates/webidl/src/update_cargo_toml.rs new file mode 100644 index 00000000000..cc8f6fdc641 --- /dev/null +++ b/crates/webidl/src/update_cargo_toml.rs @@ -0,0 +1,39 @@ +use anyhow::{Context, Result}; +use std::{fs, path::PathBuf}; + +pub fn update_cargo_toml_features( + cargo_toml_path: &PathBuf, + generated_features: &str, +) -> Result<()> { + let mut cargo_toml_text = fs::read_to_string(cargo_toml_path).context("reading Cargo.toml")?; + let comment = "# This list is auto-generated by the wasm-bindgen-webidl program"; + let features_head = "[features]"; + let features_table = format!( + r"{comment} +{features_head} +{generated_features} +" + ); + + match cargo_toml_text.find(features_head) { + Some(features_start) => { + let comment_start = cargo_toml_text[..features_start] + .rfind(comment) + .unwrap_or(features_start); + + let end = cargo_toml_text[features_start..] + .find("\n[") // find start of next toml table + .map(|i| i + features_start) + .unwrap_or_else(|| cargo_toml_text.len()); // or end of file + + cargo_toml_text.replace_range(comment_start..end, &features_table); + } + None => { + cargo_toml_text.push_str(&features_table); + } + } + + fs::write(cargo_toml_path, cargo_toml_text).context("writing features to Cargo.toml")?; + + Ok(()) +} diff --git a/guide/src/contributing/web-sys/supporting-more-web-apis.md b/guide/src/contributing/web-sys/supporting-more-web-apis.md index 17740fd0362..2061ba83705 100644 --- a/guide/src/contributing/web-sys/supporting-more-web-apis.md +++ b/guide/src/contributing/web-sys/supporting-more-web-apis.md @@ -33,7 +33,7 @@ ```sh cd crates/web-sys - cargo run --release --package wasm-bindgen-webidl -- webidls src/features + cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml ``` You can then use `git diff` to ensure the bindings look correct. From 0b72e391fdc9f3d6b5461ef491e52fa8c8a9c2bb Mon Sep 17 00:00:00 2001 From: Chris Ohk Date: Fri, 10 Mar 2023 17:00:57 +0900 Subject: [PATCH 178/641] Correct several minor typos (#3346) --- CHANGELOG.md | 8 ++++---- crates/cli-support/src/js/mod.rs | 4 +--- crates/js-sys/tests/wasm/Boolean.rs | 2 +- crates/js-sys/tests/wasm/TypedArray.rs | 6 +++--- crates/test-macro/README.md | 2 +- crates/threads-xform/src/lib.rs | 2 +- crates/web-sys/tests/wasm/element.rs | 2 +- crates/web-sys/webidls/enabled/DOMException.webidl | 2 +- crates/web-sys/webidls/enabled/Document.webidl | 2 +- crates/web-sys/webidls/enabled/Element.webidl | 2 +- .../webidls/enabled/ImageBitmapRenderingContext.webidl | 2 +- .../web-sys/webidls/enabled/PresentationConnection.webidl | 2 +- crates/web-sys/webidls/enabled/RTCRtpSender.webidl | 2 +- crates/web-sys/webidls/enabled/ScrollBoxObject.webidl | 2 +- crates/web-sys/webidls/enabled/TreeView.webidl | 2 +- crates/webidl-tests/dictionary.rs | 2 +- crates/webidl-tests/globals.js | 2 +- crates/webidl-tests/webidls/enabled/dictionary.webidl | 2 +- crates/webidl/src/idl_type.rs | 2 +- examples/synchronous-instantiation/worker.js | 2 +- guide/src/reference/attributes/on-js-imports/final.md | 2 +- .../on-rust-exports/typescript_custom_section.md | 2 +- src/convert/traits.rs | 2 +- src/externref.rs | 2 +- 24 files changed, 29 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9061bc74f..d6db092517a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -419,7 +419,7 @@ Released 2020-03-03. tightended up a bit. [#1987](https://github.com/rustwasm/wasm-bindgen/pull/1987) -* The `self` identifier is no longe used on the `no-modules` target, making it a +* The `self` identifier is no longer used on the `no-modules` target, making it a bit more flexible in more environments. [#1995](https://github.com/rustwasm/wasm-bindgen/pull/1995) @@ -662,7 +662,7 @@ Released 2019-08-14. * Add binding for `Element.getElementsByClassName`. [#1665](https://github.com/rustwasm/wasm-bindgen/pull/1665) -* `PartialEq` and `Eq` are now implementd for all `web-sys` types. +* `PartialEq` and `Eq` are now implemented for all `web-sys` types. [#1673](https://github.com/rustwasm/wasm-bindgen/pull/1673) * The `wasm-bindgen-futures` crate now has support for futures when the @@ -793,7 +793,7 @@ Released 2019-06-14. * Bindings for `Array#flat` and `Array#flatMap` have been added. [#1573](https://github.com/rustwasm/wasm-bindgen/pull/1573) -* All `#[wasm_bindgen]` types now `AsRef` to themslves. +* All `#[wasm_bindgen]` types now `AsRef` to themselves. [#1583](https://github.com/rustwasm/wasm-bindgen/pull/1583) * When using `--target web` the path passed to `init` is no longer required. @@ -1117,7 +1117,7 @@ Released 2019-03-04. landed and is enabled with `WASM_BINDGEN_ANYREF=1`. [#1002](https://github.com/rustwasm/wasm-bindgen/pull/1002) -* Support fot the new browser `TextEncode#encodeInto` API has been added. +* Support for the new browser `TextEncode#encodeInto` API has been added. [#1279](https://github.com/rustwasm/wasm-bindgen/pull/1279) * JS doc comments are now added to TypeScript bindings in addition to the JS diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index d42e43a5138..cf92dabf214 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2551,9 +2551,7 @@ impl<'a> Context<'a> { match &export.kind { AuxExportKind::Function(_) => {} AuxExportKind::Constructor(class) => builder.constructor(class), - AuxExportKind::Method { - receiver: reciever, .. - } => match reciever { + AuxExportKind::Method { receiver, .. } => match receiver { AuxReceiverKind::None => {} AuxReceiverKind::Borrowed => builder.method(false), AuxReceiverKind::Owned => builder.method(true), diff --git a/crates/js-sys/tests/wasm/Boolean.rs b/crates/js-sys/tests/wasm/Boolean.rs index 5e4b3faa486..2021d10a24c 100644 --- a/crates/js-sys/tests/wasm/Boolean.rs +++ b/crates/js-sys/tests/wasm/Boolean.rs @@ -11,7 +11,7 @@ fn new_undefined() { #[allow(deprecated)] #[wasm_bindgen_test] -fn new_truely() { +fn new_truly() { assert_eq!(Boolean::new(&JsValue::from("foo")).value_of(), true); } diff --git a/crates/js-sys/tests/wasm/TypedArray.rs b/crates/js-sys/tests/wasm/TypedArray.rs index 653e6ea7212..adb468313e6 100644 --- a/crates/js-sys/tests/wasm/TypedArray.rs +++ b/crates/js-sys/tests/wasm/TypedArray.rs @@ -16,7 +16,7 @@ macro_rules! each { }; } -macro_rules! test_inheritence { +macro_rules! test_inheritance { ($arr:ident) => {{ let arr = $arr::new(&JsValue::undefined()); assert!(arr.is_instance_of::<$arr>()); @@ -25,8 +25,8 @@ macro_rules! test_inheritence { }}; } #[wasm_bindgen_test] -fn inheritence() { - each!(test_inheritence); +fn inheritance() { + each!(test_inheritance); } macro_rules! test_undefined { diff --git a/crates/test-macro/README.md b/crates/test-macro/README.md index 64f20b4a8b4..c58270f0832 100644 --- a/crates/test-macro/README.md +++ b/crates/test-macro/README.md @@ -1,5 +1,5 @@ # wasm-bindgen-test-runner This is an **experimental** crate for enabling `cargo test --target -wasm32-unknown-unknown`. For more information see the README fo +wasm32-unknown-unknown`. For more information see the README of `wasm-bindgen-test`. diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index cddcaa0dc1a..2e0b74bb7dd 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -175,7 +175,7 @@ impl Config { // from the follower thread, after initialization. // - The leader does _not_ need to block. // - Similar restrictions apply: the follower thread should be considered unusable afterwards, - // the leader should not call this function with the same set of parameteres twice. + // the leader should not call this function with the same set of parameters twice. // - Moreover, concurrent calls can lead to UB: the follower could be in the middle of a // call while the leader is destroying its stack! You should make sure that this cannot happen. inject_destroy(module, &tls, &stack, memory)?; diff --git a/crates/web-sys/tests/wasm/element.rs b/crates/web-sys/tests/wasm/element.rs index 0184b8525cf..8f8f2b12bb4 100644 --- a/crates/web-sys/tests/wasm/element.rs +++ b/crates/web-sys/tests/wasm/element.rs @@ -98,7 +98,7 @@ fn element() { ); /* Tests needed for: remove_attribute_ns - has_attribure_ns + has_attribute_ns closest */ diff --git a/crates/web-sys/webidls/enabled/DOMException.webidl b/crates/web-sys/webidls/enabled/DOMException.webidl index 7e979187052..7ce10e3a5ee 100644 --- a/crates/web-sys/webidls/enabled/DOMException.webidl +++ b/crates/web-sys/webidls/enabled/DOMException.webidl @@ -42,7 +42,7 @@ interface mixin ExceptionMembers [ChromeOnly, Exposed=Window] readonly attribute StackFrame? location; - // Arbitary data for the implementation. + // Arbitrary data for the implementation. [Exposed=Window] readonly attribute nsISupports? data; diff --git a/crates/web-sys/webidls/enabled/Document.webidl b/crates/web-sys/webidls/enabled/Document.webidl index df41dfbf140..a0dba3e5d6e 100644 --- a/crates/web-sys/webidls/enabled/Document.webidl +++ b/crates/web-sys/webidls/enabled/Document.webidl @@ -355,7 +355,7 @@ partial interface Document { [ChromeOnly] readonly attribute boolean userHasInteracted; }; -// Extension to give chrome JS the ability to simulate activate the docuement +// Extension to give chrome JS the ability to simulate activate the document // by user gesture. partial interface Document { [ChromeOnly] diff --git a/crates/web-sys/webidls/enabled/Element.webidl b/crates/web-sys/webidls/enabled/Element.webidl index 02704b3185c..2aa383a2a43 100644 --- a/crates/web-sys/webidls/enabled/Element.webidl +++ b/crates/web-sys/webidls/enabled/Element.webidl @@ -110,7 +110,7 @@ interface Element : Node { /** * Set this during a mousedown event to grab and retarget all mouse events * to this element until the mouse button is released or releaseCapture is - * called. If retargetToElement is true, then all events are targetted at + * called. If retargetToElement is true, then all events are targeted at * this element. If false, events can also fire at descendants of this * element. * diff --git a/crates/web-sys/webidls/enabled/ImageBitmapRenderingContext.webidl b/crates/web-sys/webidls/enabled/ImageBitmapRenderingContext.webidl index 7a4e0fde542..e8c1b38fff0 100644 --- a/crates/web-sys/webidls/enabled/ImageBitmapRenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/ImageBitmapRenderingContext.webidl @@ -28,7 +28,7 @@ interface ImageBitmapRenderingContext { // it does not change the canvas's intrinsic width or height. // // The ImageBitmap, when displayed, is clipped to the rectangle - // defined by the canvas's instrinsic width and height. Pixels that + // defined by the canvas's intrinsic width and height. Pixels that // would be covered by the canvas's bitmap which are not covered by // the supplied ImageBitmap are rendered transparent black. Any CSS // styles affecting the display of the canvas are applied as usual. diff --git a/crates/web-sys/webidls/enabled/PresentationConnection.webidl b/crates/web-sys/webidls/enabled/PresentationConnection.webidl index 753dfee16b0..e3bc8c5a6c4 100644 --- a/crates/web-sys/webidls/enabled/PresentationConnection.webidl +++ b/crates/web-sys/webidls/enabled/PresentationConnection.webidl @@ -9,7 +9,7 @@ enum PresentationConnectionState { - // The initial state when a PresentationConnection is ceated. + // The initial state when a PresentationConnection is created. "connecting", // Existing presentation, and the communication channel is active. diff --git a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index e7b375b90ec..3b1c49c7bc2 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -76,7 +76,7 @@ interface RTCRtpSender { Promise getStats(); [Pref="media.peerconnection.dtmf.enabled"] readonly attribute RTCDTMFSender? dtmf; - // Ugh, can't use a ChromeOnly attibute sequence... + // Ugh, can't use a ChromeOnly attribute sequence... [ChromeOnly] sequence getStreams(); [ChromeOnly] diff --git a/crates/web-sys/webidls/enabled/ScrollBoxObject.webidl b/crates/web-sys/webidls/enabled/ScrollBoxObject.webidl index 4f9e31f492f..b9cff7fd828 100644 --- a/crates/web-sys/webidls/enabled/ScrollBoxObject.webidl +++ b/crates/web-sys/webidls/enabled/ScrollBoxObject.webidl @@ -18,7 +18,7 @@ interface ScrollBoxObject : BoxObject { /** * Scroll the given amount of device pixels to the right and down. - * Values will be clamped to make the resuling position legal. + * Values will be clamped to make the resulting position legal. */ [Throws] undefined scrollBy(long dx, long dy); diff --git a/crates/web-sys/webidls/enabled/TreeView.webidl b/crates/web-sys/webidls/enabled/TreeView.webidl index 9aee1ce401e..2ec9942752a 100644 --- a/crates/web-sys/webidls/enabled/TreeView.webidl +++ b/crates/web-sys/webidls/enabled/TreeView.webidl @@ -110,7 +110,7 @@ interface TreeView /** * The level is an integer value that represents * the level of indentation. It is multiplied by the width specified in the - * :moz-tree-indentation pseudoelement to compute the exact indendation. + * :moz-tree-indentation pseudoelement to compute the exact indentation. */ [Throws] long getLevel(long row); diff --git a/crates/webidl-tests/dictionary.rs b/crates/webidl-tests/dictionary.rs index 99e8e69d9ae..da9000d37da 100644 --- a/crates/webidl-tests/dictionary.rs +++ b/crates/webidl-tests/dictionary.rs @@ -54,5 +54,5 @@ fn required() { #[wasm_bindgen_test] fn correct_casing_in_js() { - assert_camel_case(PreserveNames::new().wierd_field_name(1)); + assert_camel_case(PreserveNames::new().weird_field_name(1)); } diff --git a/crates/webidl-tests/globals.js b/crates/webidl-tests/globals.js index 5816c108e42..bdc453e7f5d 100644 --- a/crates/webidl-tests/globals.js +++ b/crates/webidl-tests/globals.js @@ -123,7 +123,7 @@ global.assert_dict_required = function (c) { }; global.assert_camel_case = function (dict) { - strictEqual(dict.wierd_fieldName, 1); + strictEqual(dict.weird_fieldName, 1); } global.Shape = class Shape { diff --git a/crates/webidl-tests/webidls/enabled/dictionary.webidl b/crates/webidl-tests/webidls/enabled/dictionary.webidl index f513323a58c..45dd609aac3 100644 --- a/crates/webidl-tests/webidls/enabled/dictionary.webidl +++ b/crates/webidl-tests/webidls/enabled/dictionary.webidl @@ -47,5 +47,5 @@ dictionary Required { }; dictionary PreserveNames { - long wierd_fieldName; + long weird_fieldName; }; diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 54be320f0a3..4507939de5c 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -615,7 +615,7 @@ impl<'a> IdlType<'a> { // Note that most union types have already been expanded to // their components via `flatten`. Unions in a return position // or dictionary fields, however, haven't been flattened, which - // means we may need to conver them to a `syn` type. + // means we may need to convert them to a `syn` type. // // Currently this does a bit of a "poor man's" tree traversal by // saying that if all union members are interfaces we can assume diff --git a/examples/synchronous-instantiation/worker.js b/examples/synchronous-instantiation/worker.js index 1163234e301..33fb148fe94 100644 --- a/examples/synchronous-instantiation/worker.js +++ b/examples/synchronous-instantiation/worker.js @@ -16,7 +16,7 @@ self.onmessage = ({ data: bytes }) => { }; /** - * Once the Web Worker was spwaned we ask the main thread to fetch the bytes + * Once the Web Worker was spawned we ask the main thread to fetch the bytes * for the WebAssembly module. Once fetched it will send the bytes back via * a `postMessage` (see above). */ diff --git a/guide/src/reference/attributes/on-js-imports/final.md b/guide/src/reference/attributes/on-js-imports/final.md index 3c55c5fd307..e62620b2f10 100644 --- a/guide/src/reference/attributes/on-js-imports/final.md +++ b/guide/src/reference/attributes/on-js-imports/final.md @@ -116,7 +116,7 @@ The `arg1` and `arg2` values here are actually a pointer and a length to a utf-8 encoded string, and with host bindings we'll be able to annotate that this import should take those two arguments and convert them to a JS string (that is, the *host* should do this, the WebAssembly engine). Using that feature we can -futher trim this down to: +further trim this down to: ```js const __wbg_bar_target = Foo.prototype.bar; diff --git a/guide/src/reference/attributes/on-rust-exports/typescript_custom_section.md b/guide/src/reference/attributes/on-rust-exports/typescript_custom_section.md index 77cd8546d7f..16bb3bd1b60 100644 --- a/guide/src/reference/attributes/on-rust-exports/typescript_custom_section.md +++ b/guide/src/reference/attributes/on-rust-exports/typescript_custom_section.md @@ -31,4 +31,4 @@ picked up by wasm-bindgen-cli. This would be equivalent to the contents of the TS_APPEND_CONTENT string in the first example. This feature allows plain data objects to be typechecked in Rust and in -TypeScript by outputing a type definition generated at compile time. +TypeScript by outputting a type definition generated at compile time. diff --git a/src/convert/traits.rs b/src/convert/traits.rs index 17b72a837c2..30cc4813c56 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -132,7 +132,7 @@ unsafe impl WasmAbi for i64 {} unsafe impl WasmAbi for f32 {} unsafe impl WasmAbi for f64 {} -/// A trait representing how to interepret the return value of a function for +/// A trait representing how to interpret the return value of a function for /// the wasm ABI. /// /// This is very similar to the `IntoWasmAbi` trait and in fact has a blanket diff --git a/src/externref.rs b/src/externref.rs index a7e5f3ebcc3..340fdcbeb67 100644 --- a/src/externref.rs +++ b/src/externref.rs @@ -43,7 +43,7 @@ impl Slab { if self.base == 0 { self.base = r as usize; } else if self.base + self.data.len() != r as usize { - internal_error("someone else allocated table entires?") + internal_error("someone else allocated table entries?") } // poor man's `try_reserve_exact` until that's stable From 5bb3520d7e3dfa03087b0c38a1c9b4848476df0d Mon Sep 17 00:00:00 2001 From: jneem Date: Fri, 10 Mar 2023 02:05:53 -0600 Subject: [PATCH 179/641] Add a skip_jsdoc attribute. (#3338) --- crates/backend/src/ast.rs | 4 ++ crates/backend/src/encode.rs | 2 + crates/cli-support/src/js/binding.rs | 7 +++- crates/cli-support/src/js/mod.rs | 11 ++++- crates/cli-support/src/wit/mod.rs | 4 ++ crates/cli-support/src/wit/nonstandard.rs | 2 + crates/cli/tests/reference/skip-jsdoc.d.ts | 9 ++++ crates/cli/tests/reference/skip-jsdoc.js | 16 +++++++ crates/cli/tests/reference/skip-jsdoc.rs | 10 +++++ crates/cli/tests/reference/skip-jsdoc.wat | 6 +++ crates/macro-support/src/parser.rs | 3 ++ crates/shared/src/lib.rs | 4 +- crates/shared/src/schema_hash_approval.rs | 2 +- guide/src/SUMMARY.md | 1 + .../attributes/on-rust-exports/skip_jsdoc.md | 42 +++++++++++++++++++ 15 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 crates/cli/tests/reference/skip-jsdoc.d.ts create mode 100644 crates/cli/tests/reference/skip-jsdoc.js create mode 100644 crates/cli/tests/reference/skip-jsdoc.rs create mode 100644 crates/cli/tests/reference/skip-jsdoc.wat create mode 100644 guide/src/reference/attributes/on-rust-exports/skip_jsdoc.md diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 4a98f858cbf..9e2d0b173e2 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -307,6 +307,8 @@ pub struct Function { pub r#async: bool, /// Whether to generate a typescript definition for this function pub generate_typescript: bool, + /// Whether to generate jsdoc documentation for this function + pub generate_jsdoc: bool, /// Whether this is a function with a variadict parameter pub variadic: bool, } @@ -351,6 +353,8 @@ pub struct StructField { pub comments: Vec, /// Whether to generate a typescript definition for this field pub generate_typescript: bool, + /// Whether to generate jsdoc documentation for this field + pub generate_jsdoc: bool, /// The span of the `#[wasm_bindgen(getter_with_clone)]` attribute applied /// to this field, if any. /// diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 254d0e88537..e89cae7c0ff 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -218,6 +218,7 @@ fn shared_function<'a>(func: &'a ast::Function, _intern: &'a Interner) -> Functi asyncness: func.r#async, name: &func.name, generate_typescript: func.generate_typescript, + generate_jsdoc: func.generate_jsdoc, variadic: func.variadic, } } @@ -351,6 +352,7 @@ fn shared_struct_field<'a>(s: &'a ast::StructField, _intern: &'a Interner) -> St readonly: s.readonly, comments: s.comments.iter().map(|s| &**s).collect(), generate_typescript: s.generate_typescript, + generate_jsdoc: s.generate_jsdoc, } } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 0723928ee9f..8c7e9d4e641 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -106,6 +106,7 @@ impl<'a, 'b> Builder<'a, 'b> { explicit_arg_names: &Option>, asyncness: bool, variadic: bool, + generate_jsdoc: bool, ) -> Result { if self .cx @@ -243,7 +244,11 @@ impl<'a, 'b> Builder<'a, 'b> { asyncness, variadic, ); - let js_doc = self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty, variadic); + let js_doc = if generate_jsdoc { + self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty, variadic) + } else { + String::new() + }; Ok(JsFunction { code, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index cf92dabf214..4d3cd336b12 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2543,11 +2543,13 @@ impl<'a> Context<'a> { let mut arg_names = &None; let mut asyncness = false; let mut variadic = false; + let mut generate_jsdoc = false; match kind { Kind::Export(export) => { arg_names = &export.arg_names; asyncness = export.asyncness; variadic = export.variadic; + generate_jsdoc = export.generate_jsdoc; match &export.kind { AuxExportKind::Function(_) => {} AuxExportKind::Constructor(class) => builder.constructor(class), @@ -2573,7 +2575,14 @@ impl<'a> Context<'a> { catch, log_error, } = builder - .process(&adapter, instrs, arg_names, asyncness, variadic) + .process( + &adapter, + instrs, + arg_names, + asyncness, + variadic, + generate_jsdoc, + ) .with_context(|| match kind { Kind::Export(e) => format!("failed to generate bindings for `{}`", e.debug_name), Kind::Import(i) => { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 7986afb1c3a..ef78a15d2a7 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -528,6 +528,7 @@ impl<'a> Context<'a> { asyncness: export.function.asyncness, kind, generate_typescript: export.function.generate_typescript, + generate_jsdoc: export.function.generate_jsdoc, variadic: export.function.variadic, }, ); @@ -889,6 +890,7 @@ impl<'a> Context<'a> { kind: AuxExportedMethodKind::Getter, }, generate_typescript: field.generate_typescript, + generate_jsdoc: field.generate_jsdoc, variadic: false, }, ); @@ -920,6 +922,7 @@ impl<'a> Context<'a> { kind: AuxExportedMethodKind::Setter, }, generate_typescript: field.generate_typescript, + generate_jsdoc: field.generate_jsdoc, variadic: false, }, ); @@ -1148,6 +1151,7 @@ impl<'a> Context<'a> { asyncness: false, kind, generate_typescript: true, + generate_jsdoc: true, variadic: false, }; assert!(self.aux.export_map.insert(id, export).is_none()); diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 46bcfedd8ff..d05761bfda0 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -79,6 +79,8 @@ pub struct AuxExport { pub kind: AuxExportKind, /// Whether typescript bindings should be generated for this export. pub generate_typescript: bool, + /// Whether jsdoc comments should be generated for this export. + pub generate_jsdoc: bool, /// Whether typescript bindings should be generated for this export. pub variadic: bool, } diff --git a/crates/cli/tests/reference/skip-jsdoc.d.ts b/crates/cli/tests/reference/skip-jsdoc.d.ts new file mode 100644 index 00000000000..dda14e231eb --- /dev/null +++ b/crates/cli/tests/reference/skip-jsdoc.d.ts @@ -0,0 +1,9 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +* Manually documented function +* +* @param {number} arg - This is my arg. It is mine. +* @returns to whence I came +*/ +export function docme(arg: number): number; diff --git a/crates/cli/tests/reference/skip-jsdoc.js b/crates/cli/tests/reference/skip-jsdoc.js new file mode 100644 index 00000000000..a617a8f3098 --- /dev/null +++ b/crates/cli/tests/reference/skip-jsdoc.js @@ -0,0 +1,16 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + +/** +* Manually documented function +* +* @param {number} arg - This is my arg. It is mine. +* @returns to whence I came +*/ +export function docme(arg) { + const ret = wasm.docme(arg); + return ret >>> 0; +} + diff --git a/crates/cli/tests/reference/skip-jsdoc.rs b/crates/cli/tests/reference/skip-jsdoc.rs new file mode 100644 index 00000000000..b4a131615c1 --- /dev/null +++ b/crates/cli/tests/reference/skip-jsdoc.rs @@ -0,0 +1,10 @@ +use wasm_bindgen::prelude::*; + +/// Manually documented function +/// +/// @param {number} arg - This is my arg. It is mine. +/// @returns to whence I came +#[wasm_bindgen(skip_jsdoc)] +pub fn docme(arg: u32) -> u32 { + arg + 1 +} diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat new file mode 100644 index 00000000000..bac987a58bd --- /dev/null +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -0,0 +1,6 @@ +(module + (type (;0;) (func (param i32) (result i32))) + (func $docme (type 0) (param i32) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "docme" (func $docme))) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a54d8e5934a..27310452f7e 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -80,6 +80,7 @@ macro_rules! attrgen { (variadic, Variadic(Span)), (typescript_custom_section, TypescriptCustomSection(Span)), (skip_typescript, SkipTypescript(Span)), + (skip_jsdoc, SkipJsDoc(Span)), (start, Start(Span)), (skip, Skip(Span)), (typescript_type, TypeScriptType(Span, String, Span)), @@ -445,6 +446,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { setter: Ident::new(&setter, Span::call_site()), comments, generate_typescript: attrs.skip_typescript().is_none(), + generate_jsdoc: attrs.skip_jsdoc().is_none(), getter_with_clone: attrs.getter_with_clone().or(getter_with_clone).copied(), }); attrs.check_used(); @@ -912,6 +914,7 @@ fn function_from_decl( r#unsafe: sig.unsafety.is_some(), r#async: sig.asyncness.is_some(), generate_typescript: opts.skip_typescript().is_none(), + generate_jsdoc: opts.skip_jsdoc().is_none(), variadic: opts.variadic().is_some(), }, method_self, diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 408613be9f1..54647d32a5d 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.84"; +pub const SCHEMA_VERSION: &str = "0.2.85"; #[macro_export] macro_rules! shared_api { @@ -123,6 +123,7 @@ macro_rules! shared_api { asyncness: bool, name: &'a str, generate_typescript: bool, + generate_jsdoc: bool, variadic: bool, } @@ -139,6 +140,7 @@ macro_rules! shared_api { readonly: bool, comments: Vec<&'a str>, generate_typescript: bool, + generate_jsdoc: bool, } struct LocalModule<'a> { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 0d4d0bb38f1..a410a360ac9 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &'static str = "584864585234329974"; +const APPROVED_SCHEMA_FILE_HASH: &'static str = "11107065389885651666"; #[test] fn schema_version() { diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 2bd611cfe06..c6fcc31737a 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -83,6 +83,7 @@ - [`js_name = Blah`](./reference/attributes/on-rust-exports/js_name.md) - [`readonly`](./reference/attributes/on-rust-exports/readonly.md) - [`skip`](./reference/attributes/on-rust-exports/skip.md) + - [`skip_jsdoc`](./reference/attributes/on-rust-exports/skip_jsdoc.md) - [`start`](./reference/attributes/on-rust-exports/start.md) - [`typescript_custom_section`](./reference/attributes/on-rust-exports/typescript_custom_section.md) - [`getter` and `setter`](./reference/attributes/on-rust-exports/getter-and-setter.md) diff --git a/guide/src/reference/attributes/on-rust-exports/skip_jsdoc.md b/guide/src/reference/attributes/on-rust-exports/skip_jsdoc.md new file mode 100644 index 00000000000..ddbdf6c55ee --- /dev/null +++ b/guide/src/reference/attributes/on-rust-exports/skip_jsdoc.md @@ -0,0 +1,42 @@ +# `skip_jsdoc` + +When attached to a function or a method, prevents `wasm-bindgen` from auto-generating JSDoc-style doc comments. +By default, `wasm-bindgen` adds `@param` and `@returns` annotations to doc comments in the generated +JS files. A `skip_jsdoc` annotation prevents this, allowing you to supply your own doc comments. + +The following rust uses `skip_jsdoc` to omit one of the auto-generated doc comments. + +```rust +use wasm_bindgen::prelude::*; + +/// Autogenerated docs. +#[wasm_bindgen] +pub fn foo(arg: u32) -> u32 { arg + 1 } + +/// Manually written docs. +/// +/// @param {number} arg - A descriptive description. +/// @returns {number} Something a bit bigger. +#[wasm_bindgen(skip_jsdoc)] +pub fn bar(arg: u32) -> u32 { arg + 2 } +``` + +The `wasm-bindgen`-generated JS interface of the above code will look something like this: + +```js +/** +* Autogenerated docs. +* +* @param {number} arg +* @returns {number} +*/ +export function foo(arg) { /* ... */ } + +/** +* Manually written docs. +* +* @param {number} arg - A descriptive description. +* @returns {number} Something a bit bigger. +*/ +export function bar(arg) { /* ... */ } +``` From 27173549f6a196a869cec525f8f87adec55c738c Mon Sep 17 00:00:00 2001 From: Dario A Lencina-Talarico Date: Fri, 10 Mar 2023 17:20:57 -0500 Subject: [PATCH 180/641] Add WebTransport webidl to unstable (#3344) --- crates/web-sys/Cargo.toml | 17 ++ .../web-sys/src/features/gen_WebTransport.rs | 200 ++++++++++++ .../gen_WebTransportBidirectionalStream.rs | 42 +++ .../src/features/gen_WebTransportCloseInfo.rs | 75 +++++ .../gen_WebTransportCongestionControl.rs | 16 + .../gen_WebTransportDatagramDuplexStream.rs | 141 +++++++++ .../features/gen_WebTransportDatagramStats.rs | 120 ++++++++ .../src/features/gen_WebTransportError.rs | 64 ++++ .../src/features/gen_WebTransportErrorInit.rs | 78 +++++ .../features/gen_WebTransportErrorSource.rs | 15 + .../src/features/gen_WebTransportHash.rs | 74 +++++ .../src/features/gen_WebTransportOptions.rs | 121 ++++++++ .../features/gen_WebTransportReceiveStream.rs | 29 ++ .../gen_WebTransportReceiveStreamStats.rs | 99 ++++++ .../features/gen_WebTransportSendStream.rs | 29 ++ .../gen_WebTransportSendStreamOptions.rs | 57 ++++ .../gen_WebTransportSendStreamStats.rs | 120 ++++++++ .../src/features/gen_WebTransportStats.rs | 286 ++++++++++++++++++ crates/web-sys/src/features/mod.rs | 102 +++++++ .../webidls/unstable/WebTransport.webidl | 143 +++++++++ 20 files changed, 1828 insertions(+) create mode 100644 crates/web-sys/src/features/gen_WebTransport.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportBidirectionalStream.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportCloseInfo.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportCongestionControl.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportDatagramStats.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportError.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportErrorInit.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportErrorSource.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportHash.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportOptions.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportReceiveStream.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportSendStream.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs create mode 100644 crates/web-sys/src/features/gen_WebTransportStats.rs create mode 100644 crates/web-sys/webidls/unstable/WebTransport.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 3ada582de5c..7201f8c5e01 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1464,6 +1464,23 @@ WebKitCssMatrix = ["DomMatrix", "DomMatrixReadOnly"] WebSocket = ["EventTarget"] WebSocketDict = [] WebSocketElement = [] +WebTransport = [] +WebTransportBidirectionalStream = [] +WebTransportCloseInfo = [] +WebTransportCongestionControl = [] +WebTransportDatagramDuplexStream = [] +WebTransportDatagramStats = [] +WebTransportError = ["DomException"] +WebTransportErrorInit = [] +WebTransportErrorSource = [] +WebTransportHash = [] +WebTransportOptions = [] +WebTransportReceiveStream = ["ReadableStream"] +WebTransportReceiveStreamStats = [] +WebTransportSendStream = ["WritableStream"] +WebTransportSendStreamOptions = [] +WebTransportSendStreamStats = [] +WebTransportStats = [] WebglColorBufferFloat = [] WebglCompressedTextureAstc = [] WebglCompressedTextureAtc = [] diff --git a/crates/web-sys/src/features/gen_WebTransport.rs b/crates/web-sys/src/features/gen_WebTransport.rs new file mode 100644 index 00000000000..de518eff379 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransport.rs @@ -0,0 +1,200 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransport , typescript_type = "WebTransport")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransport` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransport; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = ready)] + #[doc = "Getter for the `ready` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/ready)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ready(this: &WebTransport) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportCongestionControl")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = congestionControl)] + #[doc = "Getter for the `congestionControl` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/congestionControl)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportCongestionControl`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn congestion_control(this: &WebTransport) -> WebTransportCongestionControl; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = closed)] + #[doc = "Getter for the `closed` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/closed)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn closed(this: &WebTransport) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportDatagramDuplexStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = datagrams)] + #[doc = "Getter for the `datagrams` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/datagrams)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn datagrams(this: &WebTransport) -> WebTransportDatagramDuplexStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = incomingBidirectionalStreams)] + #[doc = "Getter for the `incomingBidirectionalStreams` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/incomingBidirectionalStreams)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn incoming_bidirectional_streams(this: &WebTransport) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = incomingUnidirectionalStreams)] + #[doc = "Getter for the `incomingUnidirectionalStreams` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/incomingUnidirectionalStreams)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn incoming_unidirectional_streams(this: &WebTransport) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "WebTransport")] + #[doc = "The `new WebTransport(..)` constructor, creating a new instance of `WebTransport`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/WebTransport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(url: &str) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportOptions")] + #[wasm_bindgen(catch, constructor, js_class = "WebTransport")] + #[doc = "The `new WebTransport(..)` constructor, creating a new instance of `WebTransport`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/WebTransport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options( + url: &str, + options: &WebTransportOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = close)] + #[doc = "The `close()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/close)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn close(this: &WebTransport); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportCloseInfo")] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = close)] + #[doc = "The `close()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/close)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn close_with_close_info(this: &WebTransport, close_info: &WebTransportCloseInfo); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = createBidirectionalStream)] + #[doc = "The `createBidirectionalStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/createBidirectionalStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_bidirectional_stream(this: &WebTransport) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportSendStreamOptions")] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = createBidirectionalStream)] + #[doc = "The `createBidirectionalStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/createBidirectionalStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_bidirectional_stream_with_options( + this: &WebTransport, + options: &WebTransportSendStreamOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = createUnidirectionalStream)] + #[doc = "The `createUnidirectionalStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/createUnidirectionalStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_unidirectional_stream(this: &WebTransport) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportSendStreamOptions")] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = createUnidirectionalStream)] + #[doc = "The `createUnidirectionalStream()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/createUnidirectionalStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_unidirectional_stream_with_options( + this: &WebTransport, + options: &WebTransportSendStreamOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransport" , js_name = getStats)] + #[doc = "The `getStats()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/getStats)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_stats(this: &WebTransport) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_WebTransportBidirectionalStream.rs b/crates/web-sys/src/features/gen_WebTransportBidirectionalStream.rs new file mode 100644 index 00000000000..a2196c25d2e --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportBidirectionalStream.rs @@ -0,0 +1,42 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportBidirectionalStream , typescript_type = "WebTransportBidirectionalStream")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportBidirectionalStream` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportBidirectionalStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportBidirectionalStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportBidirectionalStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportReceiveStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportBidirectionalStream" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportBidirectionalStream/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportBidirectionalStream`, `WebTransportReceiveStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &WebTransportBidirectionalStream) -> WebTransportReceiveStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportSendStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportBidirectionalStream" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportBidirectionalStream/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportBidirectionalStream`, `WebTransportSendStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &WebTransportBidirectionalStream) -> WebTransportSendStream; +} diff --git a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs new file mode 100644 index 00000000000..18f6c116a6b --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs @@ -0,0 +1,75 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportCloseInfo)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportCloseInfo` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportCloseInfo; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportCloseInfo { + #[doc = "Construct a new `WebTransportCloseInfo`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `closeCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn close_code(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("closeCode"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn reason(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportCloseInfo { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportCongestionControl.rs b/crates/web-sys/src/features/gen_WebTransportCongestionControl.rs new file mode 100644 index 00000000000..f7fffe7c083 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportCongestionControl.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `WebTransportCongestionControl` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WebTransportCongestionControl`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WebTransportCongestionControl { + Default = "default", + Throughput = "throughput", + LowLatency = "low-latency", +} diff --git a/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs b/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs new file mode 100644 index 00000000000..86a839fba6c --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs @@ -0,0 +1,141 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportDatagramDuplexStream , typescript_type = "WebTransportDatagramDuplexStream")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportDatagramDuplexStream` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportDatagramDuplexStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &WebTransportDatagramDuplexStream) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &WebTransportDatagramDuplexStream) -> WritableStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = maxDatagramSize)] + #[doc = "Getter for the `maxDatagramSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/maxDatagramSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max_datagram_size(this: &WebTransportDatagramDuplexStream) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingMaxAge)] + #[doc = "Getter for the `incomingMaxAge` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/incomingMaxAge)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn incoming_max_age(this: &WebTransportDatagramDuplexStream) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingMaxAge)] + #[doc = "Setter for the `incomingMaxAge` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/incomingMaxAge)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_incoming_max_age(this: &WebTransportDatagramDuplexStream, value: Option); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingMaxAge)] + #[doc = "Getter for the `outgoingMaxAge` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/outgoingMaxAge)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn outgoing_max_age(this: &WebTransportDatagramDuplexStream) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingMaxAge)] + #[doc = "Setter for the `outgoingMaxAge` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/outgoingMaxAge)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_outgoing_max_age(this: &WebTransportDatagramDuplexStream, value: Option); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingHighWaterMark)] + #[doc = "Getter for the `incomingHighWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/incomingHighWaterMark)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn incoming_high_water_mark(this: &WebTransportDatagramDuplexStream) -> i32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingHighWaterMark)] + #[doc = "Setter for the `incomingHighWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/incomingHighWaterMark)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_incoming_high_water_mark(this: &WebTransportDatagramDuplexStream, value: i32); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingHighWaterMark)] + #[doc = "Getter for the `outgoingHighWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/outgoingHighWaterMark)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream) -> i32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingHighWaterMark)] + #[doc = "Setter for the `outgoingHighWaterMark` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportDatagramDuplexStream/outgoingHighWaterMark)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramDuplexStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream, value: i32); +} diff --git a/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs new file mode 100644 index 00000000000..207fd40ffe6 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs @@ -0,0 +1,120 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportDatagramStats)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportDatagramStats` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportDatagramStats; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportDatagramStats { + #[doc = "Construct a new `WebTransportDatagramStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `droppedIncoming` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn dropped_incoming(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("droppedIncoming"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `expiredOutgoing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn expired_outgoing(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("expiredOutgoing"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `lostOutgoing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn lost_outgoing(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("lostOutgoing"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestamp"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportDatagramStats { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportError.rs b/crates/web-sys/src/features/gen_WebTransportError.rs new file mode 100644 index 00000000000..865294e7dc8 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportError.rs @@ -0,0 +1,64 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = DomException , extends = :: js_sys :: Object , js_name = WebTransportError , typescript_type = "WebTransportError")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportError` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportError; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportErrorSource")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportError" , js_name = source)] + #[doc = "Getter for the `source` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/source)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`, `WebTransportErrorSource`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn source(this: &WebTransportError) -> WebTransportErrorSource; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransportError" , js_name = streamErrorCode)] + #[doc = "Getter for the `streamErrorCode` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/streamErrorCode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stream_error_code(this: &WebTransportError) -> Option; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "WebTransportError")] + #[doc = "The `new WebTransportError(..)` constructor, creating a new instance of `WebTransportError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/WebTransportError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportErrorInit")] + #[wasm_bindgen(catch, constructor, js_class = "WebTransportError")] + #[doc = "The `new WebTransportError(..)` constructor, creating a new instance of `WebTransportError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/WebTransportError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`, `WebTransportErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_init(init: &WebTransportErrorInit) -> Result; +} diff --git a/crates/web-sys/src/features/gen_WebTransportErrorInit.rs b/crates/web-sys/src/features/gen_WebTransportErrorInit.rs new file mode 100644 index 00000000000..28a2ee1c339 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportErrorInit.rs @@ -0,0 +1,78 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportErrorInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportErrorInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportErrorInit; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportErrorInit { + #[doc = "Construct a new `WebTransportErrorInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn message(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("message"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `streamErrorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn stream_error_code(&mut self, val: u8) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("streamErrorCode"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportErrorInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportErrorSource.rs b/crates/web-sys/src/features/gen_WebTransportErrorSource.rs new file mode 100644 index 00000000000..ec7429565ff --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportErrorSource.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `WebTransportErrorSource` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WebTransportErrorSource`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WebTransportErrorSource { + Stream = "stream", + Session = "session", +} diff --git a/crates/web-sys/src/features/gen_WebTransportHash.rs b/crates/web-sys/src/features/gen_WebTransportHash.rs new file mode 100644 index 00000000000..cc15fa2c4ae --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportHash.rs @@ -0,0 +1,74 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportHash)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportHash` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportHash; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportHash { + #[doc = "Construct a new `WebTransportHash`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `algorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn algorithm(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("algorithm"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportHash { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportOptions.rs b/crates/web-sys/src/features/gen_WebTransportOptions.rs new file mode 100644 index 00000000000..eb0eaa3cb18 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportOptions.rs @@ -0,0 +1,121 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportOptions; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportOptions { + #[doc = "Construct a new `WebTransportOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowPooling` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn allow_pooling(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("allowPooling"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportCongestionControl")] + #[doc = "Change the `congestionControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCongestionControl`, `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn congestion_control(&mut self, val: WebTransportCongestionControl) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("congestionControl"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requireUnreliable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn require_unreliable(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("requireUnreliable"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `serverCertificateHashes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn server_certificate_hashes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("serverCertificateHashes"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportReceiveStream.rs b/crates/web-sys/src/features/gen_WebTransportReceiveStream.rs new file mode 100644 index 00000000000..86d8fd14f78 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportReceiveStream.rs @@ -0,0 +1,29 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = ReadableStream , extends = :: js_sys :: Object , js_name = WebTransportReceiveStream , typescript_type = "WebTransportReceiveStream")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportReceiveStream` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportReceiveStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportReceiveStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransportReceiveStream" , js_name = getStats)] + #[doc = "The `getStats()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportReceiveStream/getStats)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_stats(this: &WebTransportReceiveStream) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs new file mode 100644 index 00000000000..b7d586b1b77 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs @@ -0,0 +1,99 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportReceiveStreamStats)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportReceiveStreamStats` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportReceiveStreamStats; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportReceiveStreamStats { + #[doc = "Construct a new `WebTransportReceiveStreamStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesRead` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_read(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesRead"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_received(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesReceived"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestamp"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportReceiveStreamStats { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportSendStream.rs b/crates/web-sys/src/features/gen_WebTransportSendStream.rs new file mode 100644 index 00000000000..09c145ec8bc --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportSendStream.rs @@ -0,0 +1,29 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = WritableStream , extends = :: js_sys :: Object , js_name = WebTransportSendStream , typescript_type = "WebTransportSendStream")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportSendStream` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportSendStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportSendStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "WebTransportSendStream" , js_name = getStats)] + #[doc = "The `getStats()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportSendStream/getStats)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_stats(this: &WebTransportSendStream) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs new file mode 100644 index 00000000000..b9e3213eee1 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs @@ -0,0 +1,57 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportSendStreamOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportSendStreamOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportSendStreamOptions; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportSendStreamOptions { + #[doc = "Construct a new `WebTransportSendStreamOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sendOrder` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn send_order(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("sendOrder"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportSendStreamOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs new file mode 100644 index 00000000000..aab7efbd085 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs @@ -0,0 +1,120 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportSendStreamStats)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportSendStreamStats` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportSendStreamStats; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportSendStreamStats { + #[doc = "Construct a new `WebTransportSendStreamStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesAcknowledged` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_acknowledged(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesAcknowledged"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_sent(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesSent"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesWritten` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_written(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesWritten"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestamp"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportSendStreamStats { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WebTransportStats.rs b/crates/web-sys/src/features/gen_WebTransportStats.rs new file mode 100644 index 00000000000..9c713e127d8 --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportStats.rs @@ -0,0 +1,286 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportStats)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WebTransportStats` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WebTransportStats; +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportStats { + #[doc = "Construct a new `WebTransportStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_received(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesReceived"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bytes_sent(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bytesSent"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportDatagramStats")] + #[doc = "Change the `datagrams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`, `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn datagrams(&mut self, val: &WebTransportDatagramStats) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("datagrams"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `minRtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn min_rtt(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("minRtt"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `numIncomingStreamsCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn num_incoming_streams_created(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("numIncomingStreamsCreated"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `numOutgoingStreamsCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn num_outgoing_streams_created(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("numOutgoingStreamsCreated"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `packetsLost` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn packets_lost(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("packetsLost"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `packetsReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn packets_received(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("packetsReceived"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `packetsSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn packets_sent(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("packetsSent"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rttVariation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn rtt_variation(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("rttVariation"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `smoothedRtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn smoothed_rtt(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("smoothedRtt"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("timestamp"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for WebTransportStats { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index e6126b5e2c3..460a80068b9 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8602,6 +8602,108 @@ mod gen_WebSocketElement; #[cfg(feature = "WebSocketElement")] pub use gen_WebSocketElement::*; +#[cfg(feature = "WebTransport")] +#[allow(non_snake_case)] +mod gen_WebTransport; +#[cfg(feature = "WebTransport")] +pub use gen_WebTransport::*; + +#[cfg(feature = "WebTransportBidirectionalStream")] +#[allow(non_snake_case)] +mod gen_WebTransportBidirectionalStream; +#[cfg(feature = "WebTransportBidirectionalStream")] +pub use gen_WebTransportBidirectionalStream::*; + +#[cfg(feature = "WebTransportCloseInfo")] +#[allow(non_snake_case)] +mod gen_WebTransportCloseInfo; +#[cfg(feature = "WebTransportCloseInfo")] +pub use gen_WebTransportCloseInfo::*; + +#[cfg(feature = "WebTransportCongestionControl")] +#[allow(non_snake_case)] +mod gen_WebTransportCongestionControl; +#[cfg(feature = "WebTransportCongestionControl")] +pub use gen_WebTransportCongestionControl::*; + +#[cfg(feature = "WebTransportDatagramDuplexStream")] +#[allow(non_snake_case)] +mod gen_WebTransportDatagramDuplexStream; +#[cfg(feature = "WebTransportDatagramDuplexStream")] +pub use gen_WebTransportDatagramDuplexStream::*; + +#[cfg(feature = "WebTransportDatagramStats")] +#[allow(non_snake_case)] +mod gen_WebTransportDatagramStats; +#[cfg(feature = "WebTransportDatagramStats")] +pub use gen_WebTransportDatagramStats::*; + +#[cfg(feature = "WebTransportError")] +#[allow(non_snake_case)] +mod gen_WebTransportError; +#[cfg(feature = "WebTransportError")] +pub use gen_WebTransportError::*; + +#[cfg(feature = "WebTransportErrorInit")] +#[allow(non_snake_case)] +mod gen_WebTransportErrorInit; +#[cfg(feature = "WebTransportErrorInit")] +pub use gen_WebTransportErrorInit::*; + +#[cfg(feature = "WebTransportErrorSource")] +#[allow(non_snake_case)] +mod gen_WebTransportErrorSource; +#[cfg(feature = "WebTransportErrorSource")] +pub use gen_WebTransportErrorSource::*; + +#[cfg(feature = "WebTransportHash")] +#[allow(non_snake_case)] +mod gen_WebTransportHash; +#[cfg(feature = "WebTransportHash")] +pub use gen_WebTransportHash::*; + +#[cfg(feature = "WebTransportOptions")] +#[allow(non_snake_case)] +mod gen_WebTransportOptions; +#[cfg(feature = "WebTransportOptions")] +pub use gen_WebTransportOptions::*; + +#[cfg(feature = "WebTransportReceiveStream")] +#[allow(non_snake_case)] +mod gen_WebTransportReceiveStream; +#[cfg(feature = "WebTransportReceiveStream")] +pub use gen_WebTransportReceiveStream::*; + +#[cfg(feature = "WebTransportReceiveStreamStats")] +#[allow(non_snake_case)] +mod gen_WebTransportReceiveStreamStats; +#[cfg(feature = "WebTransportReceiveStreamStats")] +pub use gen_WebTransportReceiveStreamStats::*; + +#[cfg(feature = "WebTransportSendStream")] +#[allow(non_snake_case)] +mod gen_WebTransportSendStream; +#[cfg(feature = "WebTransportSendStream")] +pub use gen_WebTransportSendStream::*; + +#[cfg(feature = "WebTransportSendStreamOptions")] +#[allow(non_snake_case)] +mod gen_WebTransportSendStreamOptions; +#[cfg(feature = "WebTransportSendStreamOptions")] +pub use gen_WebTransportSendStreamOptions::*; + +#[cfg(feature = "WebTransportSendStreamStats")] +#[allow(non_snake_case)] +mod gen_WebTransportSendStreamStats; +#[cfg(feature = "WebTransportSendStreamStats")] +pub use gen_WebTransportSendStreamStats::*; + +#[cfg(feature = "WebTransportStats")] +#[allow(non_snake_case)] +mod gen_WebTransportStats; +#[cfg(feature = "WebTransportStats")] +pub use gen_WebTransportStats::*; + #[cfg(feature = "WebglColorBufferFloat")] #[allow(non_snake_case)] mod gen_WebglColorBufferFloat; diff --git a/crates/web-sys/webidls/unstable/WebTransport.webidl b/crates/web-sys/webidls/unstable/WebTransport.webidl new file mode 100644 index 00000000000..a2e4853a946 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebTransport.webidl @@ -0,0 +1,143 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webtransport/ + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. + * You are granted a license to use, reproduce and create derivative works of this document. + */ + +[Exposed=(Window,Worker), SecureContext] +interface WebTransportDatagramDuplexStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; + + readonly attribute unsigned long maxDatagramSize; + attribute double? incomingMaxAge; + attribute double? outgoingMaxAge; + attribute long incomingHighWaterMark; + attribute long outgoingHighWaterMark; +}; + +[Exposed=(Window,Worker), SecureContext] +interface WebTransport { + constructor(USVString url, optional WebTransportOptions options = {}); + + Promise getStats(); + readonly attribute Promise ready; + readonly attribute WebTransportReliabilityMode reliability; + readonly attribute WebTransportCongestionControl congestionControl; + readonly attribute Promise closed; + undefined close(optional WebTransportCloseInfo closeInfo = {}); + + readonly attribute WebTransportDatagramDuplexStream datagrams; + + Promise createBidirectionalStream( + optional WebTransportSendStreamOptions options = {}); + /* a ReadableStream of WebTransportBidirectionalStream objects */ + readonly attribute ReadableStream incomingBidirectionalStreams; + + Promise createUnidirectionalStream( + optional WebTransportSendStreamOptions options = {}); + /* a ReadableStream of WebTransportReceiveStream objects */ + readonly attribute ReadableStream incomingUnidirectionalStreams; +}; + +dictionary WebTransportHash { + DOMString algorithm; + BufferSource value; +}; + +dictionary WebTransportOptions { + boolean allowPooling = false; + boolean requireUnreliable = false; + sequence serverCertificateHashes; + WebTransportCongestionControl congestionControl = "default"; +}; + +enum WebTransportCongestionControl { + "default", + "throughput", + "low-latency", +}; + +dictionary WebTransportCloseInfo { + unsigned long closeCode = 0; + USVString reason = ""; +}; + +dictionary WebTransportSendStreamOptions { + long long? sendOrder = null; +}; + +dictionary WebTransportStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesSent; + unsigned long long packetsSent; + unsigned long long packetsLost; + unsigned long numOutgoingStreamsCreated; + unsigned long numIncomingStreamsCreated; + unsigned long long bytesReceived; + unsigned long long packetsReceived; + DOMHighResTimeStamp smoothedRtt; + DOMHighResTimeStamp rttVariation; + DOMHighResTimeStamp minRtt; + WebTransportDatagramStats datagrams; +}; + +[Exposed=(Window,Worker), SecureContext, Transferable] +interface WebTransportSendStream : WritableStream { + Promise getStats(); +}; + +dictionary WebTransportDatagramStats { + DOMHighResTimeStamp timestamp; + unsigned long long expiredOutgoing; + unsigned long long droppedIncoming; + unsigned long long lostOutgoing; +}; + +dictionary WebTransportSendStreamStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesWritten; + unsigned long long bytesSent; + unsigned long long bytesAcknowledged; +}; + +[Exposed=(Window,Worker), SecureContext, Transferable] +interface WebTransportReceiveStream : ReadableStream { + Promise getStats(); +}; + +dictionary WebTransportReceiveStreamStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesReceived; + unsigned long long bytesRead; +}; + +[Exposed=(Window,Worker), SecureContext] +interface WebTransportBidirectionalStream { + readonly attribute WebTransportReceiveStream readable; + readonly attribute WebTransportSendStream writable; +}; + +[Exposed=(Window,Worker), SecureContext] +interface WebTransportError : DOMException { + constructor(optional WebTransportErrorInit init = {}); + + readonly attribute WebTransportErrorSource source; + readonly attribute octet? streamErrorCode; +}; + +dictionary WebTransportErrorInit { + [Clamp] octet streamErrorCode; + DOMString message; +}; + +enum WebTransportErrorSource { + "stream", + "session", +}; From 76e4cad8bb0dadc27b532bc051817ecf9bc3ac7a Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Mon, 13 Mar 2023 10:10:44 +0000 Subject: [PATCH 181/641] Fixes #3259: use verbose names for load / init / getImports (#3349) `init` / `load` / `getImports` are common names for functions, and clash when generated with `--target web`. This adds verbose prefixes to them so there's a smaller chance of clashing with already defined functions. Fixes #3259. --- crates/cli-support/src/js/mod.rs | 34 +++++++++++++-------------- crates/cli/tests/wasm-bindgen/main.rs | 12 +++++----- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 4d3cd336b12..5d6e850c5b0 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -388,7 +388,7 @@ impl<'a> Context<'a> { js.push_str("let wasm = undefined;\n"); init = self.gen_init(needs_manual_start, None)?; footer.push_str(&format!( - "{} = Object.assign(init, {{ initSync }}, __exports);\n", + "{} = Object.assign(__wbg_init, {{ initSync }}, __exports);\n", global )); } @@ -484,7 +484,7 @@ impl<'a> Context<'a> { self.imports_post.push_str("let wasm;\n"); init = self.gen_init(needs_manual_start, Some(&mut imports))?; footer.push_str("export { initSync }\n"); - footer.push_str("export default init;"); + footer.push_str("export default __wbg_init;"); } } @@ -650,7 +650,7 @@ impl<'a> Context<'a> { memory_param = memory_param )); - setup_function_declaration = "export default function init"; + setup_function_declaration = "export default function __wbg_init"; } Ok(format!( "\n\ @@ -798,7 +798,7 @@ impl<'a> Context<'a> { let js = format!( "\ - async function load(module, imports) {{ + async function __wbg_load(module, imports) {{ if (typeof Response === 'function' && module instanceof Response) {{ if (typeof WebAssembly.instantiateStreaming === 'function') {{ try {{ @@ -833,19 +833,19 @@ impl<'a> Context<'a> { }} }} - function getImports() {{ + function __wbg_get_imports() {{ const imports = {{}}; {imports_init} return imports; }} - function initMemory(imports, maybe_memory) {{ + function __wbg_init_memory(imports, maybe_memory) {{ {init_memory} }} - function finalizeInit(instance, module) {{ + function __wbg_finalize_init(instance, module) {{ wasm = instance.exports; - init.__wbindgen_wasm_module = module; + __wbg_init.__wbindgen_wasm_module = module; {init_memviews} {start} return wasm; @@ -854,9 +854,9 @@ impl<'a> Context<'a> { function initSync(module{init_memory_arg}) {{ if (wasm !== undefined) return wasm; - const imports = getImports(); + const imports = __wbg_get_imports(); - initMemory(imports{init_memory_arg}); + __wbg_init_memory(imports{init_memory_arg}); if (!(module instanceof WebAssembly.Module)) {{ module = new WebAssembly.Module(module); @@ -864,24 +864,24 @@ impl<'a> Context<'a> { const instance = new WebAssembly.Instance(module, imports); - return finalizeInit(instance, module); + return __wbg_finalize_init(instance, module); }} - async function init(input{init_memory_arg}) {{ + async function __wbg_init(input{init_memory_arg}) {{ if (wasm !== undefined) return wasm; {default_module_path} - const imports = getImports(); + const imports = __wbg_get_imports(); if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {{ input = fetch(input); }} - initMemory(imports{init_memory_arg}); + __wbg_init_memory(imports{init_memory_arg}); - const {{ instance, module }} = await load(await input, imports); + const {{ instance, module }} = await __wbg_load(await input, imports); - return finalizeInit(instance, module); + return __wbg_finalize_init(instance, module); }} ", init_memory_arg = init_memory_arg, @@ -3536,7 +3536,7 @@ impl<'a> Context<'a> { `--target no-modules` and `--target web`" ); } - format!("init.__wbindgen_wasm_module") + format!("__wbg_init.__wbindgen_wasm_module") } Intrinsic::Memory => { diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 8bc0849767a..48ff59b2ff8 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -239,7 +239,7 @@ fn default_module_path_target_web() { let contents = fs::read_to_string(out_dir.join("default_module_path_target_web.js")).unwrap(); assert!(contents.contains( "\ -async function init(input) { +async function __wbg_init(input) { if (wasm !== undefined) return wasm; if (typeof input === 'undefined') { @@ -268,7 +268,7 @@ fn default_module_path_target_no_modules() { )); assert!(contents.contains( "\ - async function init(input) { + async function __wbg_init(input) { if (wasm !== undefined) return wasm; if (typeof input === 'undefined' && script_src !== 'undefined') { @@ -291,11 +291,11 @@ fn omit_default_module_path_target_web() { fs::read_to_string(out_dir.join("omit_default_module_path_target_web.js")).unwrap(); assert!(contents.contains( "\ -async function init(input) { +async function __wbg_init(input) { if (wasm !== undefined) return wasm; - const imports = getImports();", + const imports = __wbg_get_imports();", )); } @@ -313,11 +313,11 @@ fn omit_default_module_path_target_no_modules() { fs::read_to_string(out_dir.join("omit_default_module_path_target_no_modules.js")).unwrap(); assert!(contents.contains( "\ - async function init(input) { + async function __wbg_init(input) { if (wasm !== undefined) return wasm; - const imports = getImports();", + const imports = __wbg_get_imports();", )); } From e7c3f52e15f73702d8c94959574bcee1a0d86227 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Tue, 14 Mar 2023 23:32:11 +0100 Subject: [PATCH 182/641] Add caveat of `--target no-modules` (#3354) --- guide/src/examples/without-a-bundler.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/src/examples/without-a-bundler.md b/guide/src/examples/without-a-bundler.md index dd37802ca2c..fed2ad9445d 100644 --- a/guide/src/examples/without-a-bundler.md +++ b/guide/src/examples/without-a-bundler.md @@ -54,6 +54,8 @@ few caveats: * It does not support [local JS snippets][snippets] * It does not generate an ES module +* It does not support `--split-linked-modules` outside of a document, e.g. + inside a worker With that in mind the main difference is how the wasm/JS code is loaded, and here's an example of loading the output of `wasm-pack` for the same module as From 9958e2ec44651fd7b02b023439118328181b1733 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 19 Mar 2023 00:25:19 +0100 Subject: [PATCH 183/641] Update `syn` to v2 (#3361) --- crates/backend/Cargo.toml | 2 +- crates/macro-support/Cargo.toml | 2 +- crates/macro-support/src/lib.rs | 4 +- crates/macro-support/src/parser.rs | 86 ++++++++++---------- crates/macro/ui-tests/invalid-imports.rs | 2 +- crates/macro/ui-tests/invalid-imports.stderr | 6 +- crates/webidl/Cargo.toml | 2 +- crates/webidl/src/traverse.rs | 4 +- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 9c674369341..736554125d3 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -21,5 +21,5 @@ log = "0.4" once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' -syn = { version = '1.0', features = ['full'] } +syn = { version = '2.0', features = ['full'] } wasm-bindgen-shared = { path = "../shared", version = "=0.2.84" } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index d44821c5b66..771ec131158 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -17,7 +17,7 @@ extra-traits = ["syn/extra-traits"] strict-macro = [] [dependencies] -syn = { version = '1.0.84', features = ['visit', 'full'] } +syn = { version = '2.0', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" wasm-bindgen-backend = { path = "../backend", version = "=0.2.84" } diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index bf9f71a9d20..5d937497b52 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -58,7 +58,7 @@ pub fn expand_class_marker( input: TokenStream, ) -> Result { parser::reset_attrs_used(); - let mut item = syn::parse2::(input)?; + let mut item = syn::parse2::(input)?; let opts: ClassMarker = syn::parse2(attr)?; let mut program = backend::ast::Program::default(); @@ -73,7 +73,7 @@ pub fn expand_class_marker( // statics and such, and they should all be valid in the context of the // start of a function. // - // We manually implement `ToTokens for ImplItemMethod` here, injecting our + // We manually implement `ToTokens for ImplItemFn` here, injecting our // program's tokens before the actual method's inner body tokens. let mut tokens = proc_macro2::TokenStream::new(); tokens.append_all(item.attrs.iter().filter(|attr| match attr.style { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 27310452f7e..c63f7e0d783 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -6,11 +6,11 @@ use ast::OperationKind; use backend::ast; use backend::util::{ident_ty, ShortHash}; use backend::Diagnostic; -use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; +use proc_macro2::{Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; -use syn::Lit; +use syn::{Lit, MacroDelimiter}; thread_local!(static ATTRS: AttributeParseState = Default::default()); @@ -205,26 +205,25 @@ impl BindgenAttrs { let pos = attrs .iter() .enumerate() - .find(|&(_, ref m)| m.path.segments[0].ident == "wasm_bindgen") + .find(|&(_, ref m)| m.path().segments[0].ident == "wasm_bindgen") .map(|a| a.0); let pos = match pos { Some(i) => i, None => return Ok(ret), }; let attr = attrs.remove(pos); - let mut tts = attr.tokens.clone().into_iter(); - let group = match tts.next() { - Some(TokenTree::Group(d)) => d, - Some(_) => bail_span!(attr, "malformed #[wasm_bindgen] attribute"), - None => continue, + let tokens = match attr.meta { + syn::Meta::Path(_) => continue, + syn::Meta::List(syn::MetaList { + delimiter: MacroDelimiter::Paren(_), + tokens, + .. + }) => tokens, + syn::Meta::List(_) | syn::Meta::NameValue(_) => { + bail_span!(attr, "malformed #[wasm_bindgen] attribute") + } }; - if tts.next().is_some() { - bail_span!(attr, "malformed #[wasm_bindgen] attribute"); - } - if group.delimiter() != Delimiter::Parenthesis { - bail_span!(attr, "malformed #[wasm_bindgen] attribute"); - } - let mut attrs: BindgenAttrs = syn::parse2(group.stream())?; + let mut attrs: BindgenAttrs = syn::parse2(tokens)?; ret.attrs.extend(attrs.attrs.drain(..)); attrs.check_used(); } @@ -620,29 +619,22 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo let mut doc_comment = String::new(); // Extract the doc comments from our list of attributes. wasm.rust_attrs.retain(|attr| { - struct DocContents { - contents: String, - } - - impl Parse for DocContents { - fn parse(input: ParseStream) -> SynResult { - ::parse(input)?; - match Lit::parse(input)? { - Lit::Str(str) => Ok(Self { - contents: str.value(), - }), - other => Err(syn::Error::new_spanned(other, "expected a string literal")), - } - } - } - /// Returns the contents of the passed `#[doc = "..."]` attribute, /// or `None` if it isn't one. fn get_docs(attr: &syn::Attribute) -> Option { - if attr.path.is_ident("doc") { - syn::parse2::(attr.tokens.clone()) - .ok() - .map(|doc| doc.contents) + if attr.path().is_ident("doc") { + if let syn::Meta::NameValue(syn::MetaNameValue { + value: + syn::Expr::Lit(syn::ExprLit { + lit: Lit::Str(str), .. + }), + .. + }) = &attr.meta + { + Some(str.value()) + } else { + None + } } else { None } @@ -732,7 +724,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo self, (opts, module): (BindgenAttrs, &'a Option), ) -> Result { - if self.mutability.is_some() { + if let syn::StaticMutability::Mut(_) = self.mutability { bail_span!(self.mutability, "cannot import mutable globals yet") } @@ -941,7 +933,6 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { .attrs .iter() .enumerate() - .filter_map(|(i, m)| m.parse_meta().ok().map(|m| (i, m))) .find(|(_, m)| m.path().is_ident("no_mangle")); match no_mangle { Some((i, _)) => { @@ -1088,7 +1079,7 @@ fn prepare_for_impl_recursion( impl_opts: &BindgenAttrs, ) -> Result<(), Diagnostic> { let method = match item { - syn::ImplItem::Method(m) => m, + syn::ImplItem::Fn(m) => m, syn::ImplItem::Const(_) => { bail_span!( &*item, @@ -1123,15 +1114,14 @@ fn prepare_for_impl_recursion( pound_token: Default::default(), style: syn::AttrStyle::Outer, bracket_token: Default::default(), - path: syn::parse_quote! { wasm_bindgen::prelude::__wasm_bindgen_class_marker }, - tokens: quote::quote! { (#class = #js_class) }.into(), + meta: syn::parse_quote! { wasm_bindgen::prelude::__wasm_bindgen_class_marker(#class = #js_class) }, }, ); Ok(()) } -impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemMethod { +impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemFn { fn macro_parse( self, program: &mut ast::Program, @@ -1526,10 +1516,20 @@ fn extract_doc_comments(attrs: &[syn::Attribute]) -> Vec { .filter_map(|a| { // if the path segments include an ident of "doc" we know this // this is a doc comment - if a.path.segments.iter().any(|s| s.ident.to_string() == "doc") { + if a.path() + .segments + .iter() + .any(|s| s.ident.to_string() == "doc") + { + let tokens = match &a.meta { + syn::Meta::Path(_) => None, + syn::Meta::List(list) => Some(list.tokens.clone()), + syn::Meta::NameValue(name_value) => Some(name_value.value.to_token_stream()), + }; + Some( // We want to filter out any Puncts so just grab the Literals - a.tokens.clone().into_iter().filter_map(|t| match t { + tokens.into_iter().flatten().filter_map(|t| match t { TokenTree::Literal(lit) => { let quoted = lit.to_string(); Some(try_unescape("ed).unwrap_or_else(|| quoted)) diff --git a/crates/macro/ui-tests/invalid-imports.rs b/crates/macro/ui-tests/invalid-imports.rs index ecd223b706a..ceb7d33bf81 100644 --- a/crates/macro/ui-tests/invalid-imports.rs +++ b/crates/macro/ui-tests/invalid-imports.rs @@ -19,7 +19,7 @@ extern "C" { #[wasm_bindgen(method)] fn f4(x: &Bar); #[wasm_bindgen(method)] - fn f4(x: &Fn(T)); + fn f4(x: &dyn Fn(T)); #[wasm_bindgen(constructor)] fn f(); diff --git a/crates/macro/ui-tests/invalid-imports.stderr b/crates/macro/ui-tests/invalid-imports.stderr index 0679f388306..401c056ae6c 100644 --- a/crates/macro/ui-tests/invalid-imports.stderr +++ b/crates/macro/ui-tests/invalid-imports.stderr @@ -28,11 +28,11 @@ error: paths with type parameters are not supported yet 20 | fn f4(x: &Bar); | ^^^^^^ -error: paths with type parameters are not supported yet +error: first argument of method must be a path --> ui-tests/invalid-imports.rs:22:15 | -22 | fn f4(x: &Fn(T)); - | ^^^^^ +22 | fn f4(x: &dyn Fn(T)); + | ^^^^^^^^^ error: constructor returns must be bare types --> ui-tests/invalid-imports.rs:25:5 diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 5285e45b348..ebdb2fb3467 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -19,7 +19,7 @@ heck = "0.3" log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' -syn = { version = '1.0', features = ['full'] } +syn = { version = '2.0', features = ['full'] } wasm-bindgen-backend = { version = "=0.2.84", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" diff --git a/crates/webidl/src/traverse.rs b/crates/webidl/src/traverse.rs index 107b11658ca..f01e9fece5f 100644 --- a/crates/webidl/src/traverse.rs +++ b/crates/webidl/src/traverse.rs @@ -136,13 +136,13 @@ impl TraverseType for syn::GenericArgument { { match self { Self::Type(x) => x.traverse_type(f), - Self::Binding(x) => x.traverse_type(f), + Self::AssocType(x) => x.traverse_type(f), _ => {} } } } -impl TraverseType for syn::Binding { +impl TraverseType for syn::AssocType { fn traverse_type(&self, f: &mut F) where F: FnMut(&Ident), From bea9bdb484470e5ffaecbdffff86bc3d65985b9d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 25 Mar 2023 02:21:10 +1100 Subject: [PATCH 184/641] Don't rely on the name section for detecting `main` (#3364) Fixes #3362 In some cases, the name section can fail to be parsed because one of the names is too long, which then causes the main function to not be detected because we don't know what any functions' names are. However, `main` is also exported with the name `main`, so we can look for an export named `main` instead to avoid relying on the name section. --- crates/cli-support/src/wit/mod.rs | 17 +++-- crates/cli/Cargo.toml | 1 + crates/cli/tests/wasm-bindgen/main.rs | 93 +++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 5 deletions(-) diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index ef78a15d2a7..7ca01e6f9ff 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -261,13 +261,19 @@ impl<'a> Context<'a> { // find a `main(i32, i32) -> i32` let main_id = self .module - .functions() - .find(|x| { + .exports + .iter() + .filter_map(|export| match export.item { + walrus::ExportItem::Function(id) => Some((export, self.module.funcs.get(id))), + _ => None, + }) + .find(|(export, func)| { use walrus::ValType::I32; + // name has to be `main` - let name_matches = x.name.as_ref().map_or(false, |x| x == "main"); + let name_matches = export.name == "main"; // type has to be `(i32, i32) -> i32` - let ty = self.module.types.get(x.ty()); + let ty = self.module.types.get(func.ty()); let type_matches = ty.params() == [I32, I32] && ty.results() == [I32]; // Having the correct name and signature doesn't necessarily mean that it's // actually a `main` function. Unfortunately, there doesn't seem to be any 100% @@ -276,7 +282,8 @@ impl<'a> Context<'a> { let unknown = !self.adapters.exports.iter().any(|(name, _)| name == "main"); name_matches && type_matches && unknown }) - .map(|x| x.id()); + .map(|(_, func)| func.id()); + let main_id = match main_id { Some(x) => x, None => return Ok(()), diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index d754991020b..bc029b57888 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -35,6 +35,7 @@ diff = "0.1" predicates = "1.0.0" rayon = "1.0" tempfile = "3.0" +wasmparser = "0.102.0" wasmprinter = "0.2, <=0.2.33" # pinned for wit-printer wit-printer = "0.2" wit-text = "0.8" diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 48ff59b2ff8..c6cf4131954 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -17,6 +17,7 @@ use std::env; use std::fs; use std::path::PathBuf; use std::process::Command; +use wasmparser::Payload; fn target_dir() -> PathBuf { let mut dir = PathBuf::from(env::current_exe().unwrap()); @@ -226,6 +227,98 @@ fn bin_crate_works() { .stdout("hello, world\n"); } +#[test] +fn bin_crate_works_without_name_section() { + let mut project = Project::new("bin_crate_works_without_name_section"); + project + .file( + "src/main.rs", + r#" + use wasm_bindgen::prelude::*; + #[wasm_bindgen] + extern "C" { + #[wasm_bindgen(js_namespace = console)] + fn log(data: &str); + } + + fn main() { + log("hello, world"); + } + "#, + ) + .file( + "Cargo.toml", + &format!( + " + [package] + name = \"bin_crate_works_without_name_section\" + authors = [] + version = \"1.0.0\" + edition = '2018' + + [dependencies] + wasm-bindgen = {{ path = '{}' }} + + [workspace] + ", + repo_root().display(), + ), + ); + let wasm = project.build(); + + // Remove the name section from the module. + // This simulates a situation like #3362 where it fails to parse because one of + // the names is too long. + // Unfortunately, we can't use `walrus` to do this because it gives the name + // section special treatment, so instead we use `wasmparser` directly. + let mut contents = fs::read(&wasm).unwrap(); + for payload in wasmparser::Parser::new(0).parse_all(&contents.clone()) { + match payload.unwrap() { + Payload::CustomSection(reader) if reader.name() == "name" => { + /// Figures out how many bytes `x` will take up when encoded in + /// unsigned LEB128. + fn leb128_len(x: u32) -> usize { + match x { + 0..=0x07f => 1, + 0x80..=0x3fff => 2, + 0x4000..=0x1fffff => 3, + 0x200000..=0xfffffff => 4, + 0x10000000..=0xffffffff => 5, + } + } + + // Figure out the length of the section header. + let header_len = 1 + leb128_len(reader.data().len() as u32); + + // Remove the section. + contents.drain(reader.range().start - header_len..reader.range().end); + } + // Ignore everything else. + _ => {} + } + } + + fs::write(&wasm, contents).unwrap(); + + // Then run wasm-bindgen on the result. + let out_dir = project.root.join("pkg"); + fs::create_dir_all(&out_dir).unwrap(); + let mut cmd = Command::cargo_bin("wasm-bindgen").unwrap(); + cmd.arg("--out-dir") + .arg(&out_dir) + .arg(&wasm) + .arg("--target") + .arg("nodejs"); + cmd.assert().success(); + + Command::new("node") + .arg("bin_crate_works_without_name_section.js") + .current_dir(out_dir) + .assert() + .success() + .stdout("hello, world\n"); +} + #[test] fn default_module_path_target_web() { let (mut cmd, out_dir) = Project::new("default_module_path_target_web") From 2a28cfb1ff878779c2538fab356e3b446978893c Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 25 Mar 2023 02:21:39 +1100 Subject: [PATCH 185/641] Don't install `wasm-opt` in CI (#3366) * Don't install binaryen in CI This is a workaround for rustwasm/wasm-pack#1247, which causes `wasm-pack` to fail to run if a local version of `wasm-opt` is installed. That in turn caused the `build_examples` CI job to break. This PR fixes that by not having it download binaryen, instead letting `wasm-pack` install it itself, which still works. * Put back the binaryen-installing step, but only install wasm2js instead of the whole thing. I also updated to binaryen 112 while I was at it. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 05d7997f864..68f0006ed8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -231,9 +231,9 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - run: | - curl -L https://github.com/WebAssembly/binaryen/releases/download/version_109/binaryen-version_109-x86_64-linux.tar.gz -sSf > binaryen-version_109-x86_64-linux.tar.gz - tar -xz -f binaryen-version_109-x86_64-linux.tar.gz - echo "$PWD/binaryen-version_109/bin" >> $GITHUB_PATH + curl -L https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-linux.tar.gz -sSf > binaryen-version_112-x86_64-linux.tar.gz + tar -xz -f binaryen-version_112-x86_64-linux.tar.gz binaryen-version_112/bin/wasm2js + echo "$PWD/binaryen-version_112/bin" >> $GITHUB_PATH - run: | cargo build -p wasm-bindgen-cli ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen From b41de3f22fc2427babe3a7d4184c369651452136 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 29 Mar 2023 01:26:14 +1100 Subject: [PATCH 186/641] Fix race condition in reference tests (#3373) The reference test runner was attempting to compile all of them in parallel, with all of their outputs being written to `target/wasm32-unknown-unknown/debug/reference_test.wasm`. That led to a race condition if this happened: * test a finishes compiling, emits `reference_test.wasm` * test b finishes compiling, emits `reference_test.wasm` * test a runs `wasm-bindgen` on the `reference_test.wasm` that test b just emitted. This led to the results of reference tests getting mixed up. For whatever reason, this only happens on my Mac laptop and not my Linux desktop. It could be an OS difference, or just because the laptop's a lot faster, I don't know. I solved it by just not running them in parallel, since parallelising them didn't do much anyway thanks to `cargo` locking the build directory. --- crates/cli/tests/reference.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index e09d0d8f0b9..38782b95c63 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -11,7 +11,6 @@ use anyhow::{bail, Result}; use assert_cmd::prelude::*; -use rayon::prelude::*; use std::env; use std::fs; use std::path::{Path, PathBuf}; @@ -37,7 +36,7 @@ fn main() -> Result<()> { tests.sort(); let errs = tests - .par_iter() + .iter() .filter_map(|t| runtest(t).err().map(|e| (t, e))) .collect::>(); From 8481b4f812737df154f1baf3149deddf6ad3fdf6 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 11 Apr 2023 00:34:12 +1000 Subject: [PATCH 187/641] Remove experimental interface types support (#3372) * Change the bare minimum to be able to remove the wit-* deps * Remove some holdovers Namely `Generated` being an enum and the `trap` fields of `Instruction::IntToWasm` and `Instruction::WasmToInt`. * remove tests for interface types * update reference tests * fix reference tests (again) * Allow enabling multi-value For some reason wasm-bindgen would only allow enabling multi-value if interface types were enabled, throwing an error otherwise. I couldn't see any reason why, so I changed that. Since that also meant that multi-value + JS bindings wasn't being tested, allowing it exposed some bugs that I fixed. * update test expectations --- .github/workflows/main.yml | 3 + crates/cli-support/Cargo.toml | 3 - crates/cli-support/src/externref.rs | 4 +- crates/cli-support/src/intrinsic.rs | 9 -- crates/cli-support/src/js/binding.rs | 80 +++++----- crates/cli-support/src/js/mod.rs | 25 ++- crates/cli-support/src/lib.rs | 120 ++++---------- crates/cli-support/src/multivalue.rs | 74 ++++++++- crates/cli-support/src/throw2unreachable.rs | 87 ----------- crates/cli-support/src/wit/incoming.rs | 35 ++--- crates/cli-support/src/wit/mod.rs | 146 +----------------- crates/cli-support/src/wit/outgoing.rs | 36 ++--- crates/cli-support/src/wit/section.rs | 88 +---------- crates/cli-support/src/wit/standard.rs | 79 +++------- crates/cli/Cargo.toml | 10 +- crates/cli/tests/interface-types.rs | 90 ----------- crates/cli/tests/interface-types/anyref.js | 16 -- crates/cli/tests/interface-types/anyref.wat | 26 ---- .../cli/tests/interface-types/defer-call.js | 5 - .../cli/tests/interface-types/defer-call.wat | 21 --- crates/cli/tests/interface-types/empty.js | 2 - crates/cli/tests/interface-types/empty.wat | 1 - crates/cli/tests/interface-types/integers.js | 9 -- crates/cli/tests/interface-types/integers.wat | 54 ------- .../tests/interface-types/memory-to-string.js | 5 - .../interface-types/memory-to-string.wat | 21 --- crates/cli/tests/interface-types/no-wasm.js | 5 - crates/cli/tests/interface-types/no-wasm.wat | 5 - .../tests/interface-types/string-to-memory.js | 11 -- .../interface-types/string-to-memory.wat | 27 ---- crates/cli/tests/reference.rs | 29 +--- crates/cli/tests/reference/add.wat | 7 +- crates/cli/tests/reference/anyref-empty.wat | 3 +- .../tests/reference/anyref-import-catch.wat | 13 +- crates/cli/tests/reference/anyref-nop.wat | 5 +- crates/cli/tests/reference/empty.wat | 3 +- crates/cli/tests/reference/import-catch.wat | 9 +- .../tests/reference/interface-types-anyref.rs | 8 - .../reference/interface-types-anyref.wat | 12 -- .../tests/reference/interface-types-empty.rs | 7 - .../tests/reference/interface-types-empty.wat | 10 -- .../reference/interface-types-integers.rs | 46 ------ .../reference/interface-types-integers.wat | 81 ---------- .../reference/interface-types-interop.rs | 8 - .../reference/interface-types-interop.wat | 13 -- .../reference/interface-types-strings.rs | 11 -- .../reference/interface-types-strings.wat | 29 ---- crates/cli/tests/reference/nop.wat | 5 +- crates/cli/tests/reference/result-string.js | 14 +- crates/cli/tests/reference/result-string.wat | 9 +- crates/cli/tests/reference/skip-jsdoc.wat | 5 +- crates/cli/tests/reference/string-arg.wat | 9 +- crates/cli/tests/wasm-bindgen/main.rs | 137 ---------------- .../tests/anyref-param-owned.wat | 15 +- crates/externref-xform/tests/anyref-param.wat | 10 +- .../tests/clone-ref-intrinsic.wat | 25 +-- .../tests/drop-ref-intrinsic.wat | 20 ++- .../tests/import-anyref-owned.wat | 15 +- .../tests/import-anyref-ret.wat | 18 ++- .../externref-xform/tests/import-anyref.wat | 13 +- crates/externref-xform/tests/mixed-export.wat | 15 +- crates/externref-xform/tests/mixed.wat | 15 +- crates/externref-xform/tests/ret-anyref.wat | 15 +- .../tests/table-grow-intrinsic.wat | 18 ++- .../tests/table-set-null-intrinsic.wat | 18 ++- crates/externref-xform/tests/table.wat | 15 +- .../externref-xform/tests/tee-before-grow.wat | 18 ++- crates/multi-value-xform/tests/align.wat | 10 +- crates/multi-value-xform/tests/many.wat | 10 +- crates/multi-value-xform/tests/simple.wat | 31 ++-- 70 files changed, 438 insertions(+), 1413 deletions(-) delete mode 100644 crates/cli-support/src/throw2unreachable.rs delete mode 100644 crates/cli/tests/interface-types.rs delete mode 100644 crates/cli/tests/interface-types/anyref.js delete mode 100644 crates/cli/tests/interface-types/anyref.wat delete mode 100644 crates/cli/tests/interface-types/defer-call.js delete mode 100644 crates/cli/tests/interface-types/defer-call.wat delete mode 100644 crates/cli/tests/interface-types/empty.js delete mode 100644 crates/cli/tests/interface-types/empty.wat delete mode 100644 crates/cli/tests/interface-types/integers.js delete mode 100644 crates/cli/tests/interface-types/integers.wat delete mode 100644 crates/cli/tests/interface-types/memory-to-string.js delete mode 100644 crates/cli/tests/interface-types/memory-to-string.wat delete mode 100644 crates/cli/tests/interface-types/no-wasm.js delete mode 100644 crates/cli/tests/interface-types/no-wasm.wat delete mode 100644 crates/cli/tests/interface-types/string-to-memory.js delete mode 100644 crates/cli/tests/interface-types/string-to-memory.wat delete mode 100644 crates/cli/tests/reference/interface-types-anyref.rs delete mode 100644 crates/cli/tests/reference/interface-types-anyref.wat delete mode 100644 crates/cli/tests/reference/interface-types-empty.rs delete mode 100644 crates/cli/tests/reference/interface-types-empty.wat delete mode 100644 crates/cli/tests/reference/interface-types-integers.rs delete mode 100644 crates/cli/tests/reference/interface-types-integers.wat delete mode 100644 crates/cli/tests/reference/interface-types-interop.rs delete mode 100644 crates/cli/tests/reference/interface-types-interop.wat delete mode 100644 crates/cli/tests/reference/interface-types-strings.rs delete mode 100644 crates/cli/tests/reference/interface-types-strings.wat diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 68f0006ed8f..d6e9bb4a8c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,6 +70,9 @@ jobs: env: WASM_BINDGEN_EXTERNREF: 1 NODE_ARGS: --experimental-wasm-reftypes + - run: cargo test --target wasm32-unknown-unknown + env: + WASM_BINDGEN_MULTI_VALUE: 1 test_threads: name: "Run wasm-bindgen crate tests with multithreading enabled" diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 3634deecb3e..dae0216c73c 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -25,7 +25,4 @@ wasm-bindgen-shared = { path = "../shared", version = '=0.2.84' } wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.84' } wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.84' } wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.84' } -wit-text = "0.8.0" -wit-walrus = "0.6.0" -wit-validator = "0.2.0" unicode-ident = "1.0.5" diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index 7e69fcce70d..ce16e5e7fa2 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -99,7 +99,7 @@ pub fn process(module: &mut Module) -> Result<()> { AuxImport::Intrinsic(Intrinsic::ExternrefHeapLiveCount) => {} _ => continue, } - instr.instr = Instruction::Standard(wit_walrus::Instruction::CallCore(id)); + instr.instr = Instruction::CallCore(id); } // Optional externref values are now managed in the wasm module, so @@ -199,7 +199,7 @@ fn import_xform( args.push(Some(arg)); to_delete.push(i); } - Instruction::Standard(wit_walrus::Instruction::ArgGet(n)) => { + Instruction::ArgGet(n) => { args.push(Some(Arg { idx: n as usize, externref: None, diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index e8874d5e055..f2653a2f9ab 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -51,15 +51,6 @@ macro_rules! intrinsics { )* } } - - /// Returns the symbol name of this intrinsic - pub fn name(&self) -> &'static str { - match self { - $( - Intrinsic::$name => $sym, - )* - } - } } }; } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 8c7e9d4e641..9107160d12d 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -8,6 +8,7 @@ use crate::js::Context; use crate::wit::InstructionData; use crate::wit::{Adapter, AdapterId, AdapterKind, AdapterType, Instruction}; use anyhow::{anyhow, bail, Error}; +use std::fmt::Write; use walrus::{Module, ValType}; /// A one-size-fits-all builder for processing WebIDL bindings and generating @@ -39,6 +40,9 @@ pub struct JsBuilder<'a, 'b> { /// built so far. prelude: String, + /// Code which should go before the `try {` in a try-finally block. + pre_try: String, + /// JS code to execute in a `finally` block in case any exceptions happen. finally: String, @@ -211,10 +215,14 @@ impl<'a, 'b> Builder<'a, 'b> { } code.push_str(") {\n"); - let mut call = js.prelude; - if js.finally.len() != 0 { - call = format!("try {{\n{}}} finally {{\n{}}}\n", call, js.finally); - } + let call = if js.finally.len() != 0 { + format!( + "{}try {{\n{}}} finally {{\n{}}}\n", + js.pre_try, js.prelude, js.finally + ) + } else { + js.pre_try + &js.prelude + }; if self.catch { js.cx.expose_handle_error()?; @@ -387,6 +395,7 @@ impl<'a, 'b> JsBuilder<'a, 'b> { cx, args: Vec::new(), tmp: 0, + pre_try: String::new(), finally: String::new(), prelude: String::new(), stack: Vec::new(), @@ -533,29 +542,38 @@ impl<'a, 'b> JsBuilder<'a, 'b> { fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> Result<(), Error> { match instr { - Instruction::Standard(wit_walrus::Instruction::ArgGet(n)) => { + Instruction::ArgGet(n) => { let arg = js.arg(*n).to_string(); js.push(arg); } - Instruction::Standard(wit_walrus::Instruction::CallAdapter(_)) => { - panic!("standard call adapter functions should be mapped to our adapters"); - } - - Instruction::Standard(wit_walrus::Instruction::CallCore(_)) + Instruction::CallCore(_) | Instruction::CallExport(_) | Instruction::CallAdapter(_) | Instruction::CallTableElement(_) - | Instruction::Standard(wit_walrus::Instruction::DeferCallCore(_)) => { + | Instruction::DeferCallCore(_) => { let invoc = Invocation::from(instr, js.cx.module)?; let (params, results) = invoc.params_results(js.cx); - // Pop off the number of parameters for the function we're calling let mut args = Vec::new(); - for _ in 0..params { - args.push(js.pop()); + let tmp = js.tmp(); + if invoc.defer() { + // If the call is deferred, the arguments to the function still need to be + // accessible in the `finally` block, so we declare variables to hold the args + // outside of the try-finally block and then set those to the args. + for (i, arg) in js.stack[js.stack.len() - params..].iter().enumerate() { + let name = format!("deferred{tmp}_{i}"); + writeln!(js.pre_try, "let {name};").unwrap(); + writeln!(js.prelude, "{name} = {arg};").unwrap(); + args.push(name); + } + } else { + // Otherwise, pop off the number of parameters for the function we're calling. + for _ in 0..params { + args.push(js.pop()); + } + args.reverse(); } - args.reverse(); // Call the function through an export of the underlying module. let call = invoc.invoke(js.cx, &args, &mut js.prelude, log_error)?; @@ -566,7 +584,6 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> match (invoc.defer(), results) { (true, 0) => { js.finally(&format!("{};", call)); - js.stack.extend(args); } (true, _) => panic!("deferred calls must have no results"), (false, 0) => js.prelude(&format!("{};", call)), @@ -583,13 +600,11 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> } } - Instruction::Standard(wit_walrus::Instruction::IntToWasm { - trap: false, input, .. - }) => { + Instruction::IntToWasm { input, .. } => { let val = js.pop(); if matches!( input, - wit_walrus::ValType::I64 | wit_walrus::ValType::S64 | wit_walrus::ValType::U64 + AdapterType::I64 | AdapterType::S64 | AdapterType::U64 ) { js.assert_bigint(&val); } else { @@ -601,35 +616,22 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> // When converting to a JS number we need to specially handle the `u32` // case because if the high bit is set then it comes out as a negative // number, but we want to switch that to an unsigned representation. - Instruction::Standard(wit_walrus::Instruction::WasmToInt { - trap: false, - output, - .. - }) => { + Instruction::WasmToInt { output, .. } => { let val = js.pop(); match output { - wit_walrus::ValType::U32 => js.push(format!("{} >>> 0", val)), - wit_walrus::ValType::U64 => js.push(format!("BigInt.asUintN(64, {val})")), + AdapterType::U32 => js.push(format!("{} >>> 0", val)), + AdapterType::U64 => js.push(format!("BigInt.asUintN(64, {val})")), _ => js.push(val), } } - Instruction::Standard(wit_walrus::Instruction::WasmToInt { trap: true, .. }) - | Instruction::Standard(wit_walrus::Instruction::IntToWasm { trap: true, .. }) => { - bail!("trapping wasm-to-int and int-to-wasm instructions not supported") - } - - Instruction::Standard(wit_walrus::Instruction::MemoryToString(mem)) => { + Instruction::MemoryToString(mem) => { let len = js.pop(); let ptr = js.pop(); let get = js.cx.expose_get_string_from_wasm(*mem)?; js.push(format!("{}({}, {})", get, ptr, len)); } - Instruction::Standard(wit_walrus::Instruction::StringToMemory { mem, malloc }) => { - js.string_to_memory(*mem, *malloc, None)?; - } - Instruction::StringToMemory { mem, malloc, @@ -1186,12 +1188,12 @@ impl Invocation { fn from(instr: &Instruction, module: &Module) -> Result { use Instruction::*; Ok(match instr { - Standard(wit_walrus::Instruction::CallCore(f)) => Invocation::Core { + CallCore(f) => Invocation::Core { id: *f, defer: false, }, - Standard(wit_walrus::Instruction::DeferCallCore(f)) => Invocation::Core { + DeferCallCore(f) => Invocation::Core { id: *f, defer: true, }, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 5d6e850c5b0..fb812c41f92 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1,7 +1,8 @@ use crate::descriptor::VectorKind; use crate::intrinsic::Intrinsic; use crate::wit::{ - Adapter, AdapterId, AdapterJsImportKind, AuxExportedMethodKind, AuxReceiverKind, AuxValue, + Adapter, AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, AuxReceiverKind, + AuxValue, }; use crate::wit::{AdapterKind, Instruction, InstructionData}; use crate::wit::{AuxEnum, AuxExport, AuxExportKind, AuxImport, AuxStruct}; @@ -2757,10 +2758,7 @@ impl<'a> Context<'a> { } Instruction::CallExport(_) | Instruction::CallTableElement(_) - | Instruction::Standard(wit_walrus::Instruction::CallCore(_)) - | Instruction::Standard(wit_walrus::Instruction::CallAdapter(_)) => { - return Ok(false) - } + | Instruction::CallCore(_) => return Ok(false), _ => {} } } @@ -2862,20 +2860,15 @@ impl<'a> Context<'a> { fn representable_without_js_glue(&self, instrs: &[InstructionData]) -> bool { use Instruction::*; - let standard_enabled = self.config.wasm_interface_types; let mut last_arg = None; let mut saw_call = false; for instr in instrs { match instr.instr { - // Is an adapter section getting emitted? If so, then every - // standard operation is natively supported! - Standard(_) if standard_enabled => {} - // Fetching arguments is just that, a fetch, so no need for // glue. Note though that the arguments must be fetched in order // for this to actually work, - Standard(wit_walrus::Instruction::ArgGet(i)) => { + ArgGet(i) => { if saw_call { return false; } @@ -2892,16 +2885,16 @@ impl<'a> Context<'a> { // Conversions to wasm integers are always supported since // they're coerced into i32/f32/f64 appropriately. - Standard(wit_walrus::Instruction::IntToWasm { .. }) => {} + IntToWasm { .. } => {} // Converts from wasm to JS, however, only supports most // integers. Converting into a u32 isn't supported because we // need to generate glue to change the sign. - Standard(wit_walrus::Instruction::WasmToInt { - output: wit_walrus::ValType::U32, + WasmToInt { + output: AdapterType::U32, .. - }) => return false, - Standard(wit_walrus::Instruction::WasmToInt { .. }) => {} + } => return false, + WasmToInt { .. } => {} // JS spec automatically coerces boolean values to i32 of 0 or 1 // depending on true/false diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 00800ca08a3..a661b9a19a5 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -18,7 +18,6 @@ mod externref; mod intrinsic; mod js; mod multivalue; -mod throw2unreachable; pub mod wasm2es6js; mod wit; @@ -44,7 +43,6 @@ pub struct Bindgen { threads: wasm_bindgen_threads_xform::Config, externref: bool, multi_value: bool, - wasm_interface_types: bool, encode_into: EncodeInto, split_linked_modules: bool, } @@ -55,12 +53,7 @@ pub struct Output { generated: Generated, } -enum Generated { - InterfaceTypes, - Js(JsGenerated), -} - -struct JsGenerated { +struct Generated { mode: OutputMode, js: String, ts: String, @@ -97,7 +90,6 @@ impl Bindgen { pub fn new() -> Bindgen { let externref = env::var("WASM_BINDGEN_ANYREF").is_ok() || env::var("WASM_BINDGEN_EXTERNREF").is_ok(); - let wasm_interface_types = env::var("WASM_INTERFACE_TYPES").is_ok(); let multi_value = env::var("WASM_BINDGEN_MULTI_VALUE").is_ok(); Bindgen { input: Input::None, @@ -116,9 +108,8 @@ impl Bindgen { emit_start: true, weak_refs: env::var("WASM_BINDGEN_WEAKREF").is_ok(), threads: threads_config(), - externref: externref || wasm_interface_types, - multi_value: multi_value || wasm_interface_types, - wasm_interface_types, + externref, + multi_value, encode_into: EncodeInto::Test, omit_default_module_path: true, split_linked_modules: false, @@ -390,7 +381,6 @@ impl Bindgen { &mut module, programs, self.externref, - self.wasm_interface_types, thread_count, self.emit_start, )?; @@ -423,23 +413,9 @@ impl Bindgen { externref::force_contiguous_elements(&mut module)?; } - // If wasm interface types are enabled then the `__wbindgen_throw` - // intrinsic isn't available but it may be used by our runtime, so - // change all calls to this function to calls to `unreachable` instead. - // See more documentation in the pass documentation itself. - if self.wasm_interface_types { - throw2unreachable::run(&mut module); - } - // Using all of our metadata convert our module to a multi-value using // module if applicable. if self.multi_value { - if !self.wasm_interface_types { - anyhow::bail!( - "Wasm multi-value is currently only available when \ - Wasm interface types is also enabled" - ); - } multivalue::run(&mut module) .context("failed to transform return pointers into multi-value Wasm")?; } @@ -451,38 +427,27 @@ impl Bindgen { let stem = self.stem()?; - // We're ready for the final emission passes now. If we're in wasm - // interface types mode then we execute the various passes there and - // generate a valid interface types section into the wasm module. - // - // Otherwise we execute the JS generation passes to actually emit - // JS/TypeScript/etc. The output here is unused in wasm interfac - let generated = if self.wasm_interface_types { - wit::section::add(&mut module) - .context("failed to generate a standard interface types section")?; - Generated::InterfaceTypes - } else { - let aux = module - .customs - .delete_typed::() - .expect("aux section should be present"); - let adapters = module - .customs - .delete_typed::() - .unwrap(); - let mut cx = js::Context::new(&mut module, self, &adapters, &aux)?; - cx.generate()?; - let (js, ts, start) = cx.finalize(stem)?; - Generated::Js(JsGenerated { - snippets: aux.snippets.clone(), - local_modules: aux.local_modules.clone(), - mode: self.mode.clone(), - typescript: self.typescript, - npm_dependencies: cx.npm_dependencies.clone(), - js, - ts, - start, - }) + // Now we execute the JS generation passes to actually emit JS/TypeScript/etc. + let aux = module + .customs + .delete_typed::() + .expect("aux section should be present"); + let adapters = module + .customs + .delete_typed::() + .unwrap(); + let mut cx = js::Context::new(&mut module, self, &adapters, &aux)?; + cx.generate()?; + let (js, ts, start) = cx.finalize(stem)?; + let generated = Generated { + snippets: aux.snippets.clone(), + local_modules: aux.local_modules.clone(), + mode: self.mode.clone(), + typescript: self.typescript, + npm_dependencies: cx.npm_dependencies.clone(), + js, + ts, + start, }; Ok(Output { @@ -493,8 +458,6 @@ impl Bindgen { } fn module_from_bytes(&self, bytes: &[u8]) -> Result { - let wasm = wit_text::parse_bytes(bytes).context("failed to parse bytes")?; - wit_validator::validate(&wasm).context("failed to validate")?; walrus::ModuleConfig::new() // Skip validation of the module as LLVM's output is // generally already well-formed and so we won't gain much @@ -506,8 +469,7 @@ impl Bindgen { .generate_dwarf(self.keep_debug) .generate_name_section(!self.remove_name_section) .generate_producers_section(!self.remove_producers_section) - .on_parse(wit_walrus::on_parse) - .parse(&wasm) + .parse(&bytes) .context("failed to parse input as wasm") } @@ -656,39 +618,31 @@ fn unexported_unused_lld_things(module: &mut Module) { impl Output { pub fn js(&self) -> &str { - &self.gen().js + &self.generated.js } pub fn ts(&self) -> Option<&str> { - let gen = self.gen(); - if gen.typescript { - Some(&gen.ts) + if self.generated.typescript { + Some(&self.generated.ts) } else { None } } pub fn start(&self) -> Option<&String> { - self.gen().start.as_ref() + self.generated.start.as_ref() } pub fn snippets(&self) -> &HashMap> { - &self.gen().snippets + &self.generated.snippets } pub fn local_modules(&self) -> &HashMap { - &self.gen().local_modules + &self.generated.local_modules } pub fn npm_dependencies(&self) -> &HashMap { - &self.gen().npm_dependencies - } - - fn gen(&self) -> &JsGenerated { - match &self.generated { - Generated::InterfaceTypes => panic!("no js with interface types output"), - Generated::Js(gen) => &gen, - } + &self.generated.npm_dependencies } pub fn wasm(&self) -> &walrus::Module { @@ -704,20 +658,14 @@ impl Output { } fn _emit(&mut self, out_dir: &Path) -> Result<(), Error> { - let wasm_name = match &self.generated { - Generated::InterfaceTypes => self.stem.clone(), - Generated::Js(_) => format!("{}_bg", self.stem), - }; + let wasm_name = format!("{}_bg", self.stem); let wasm_path = out_dir.join(&wasm_name).with_extension("wasm"); fs::create_dir_all(out_dir)?; let wasm_bytes = self.module.emit_wasm(); fs::write(&wasm_path, wasm_bytes) .with_context(|| format!("failed to write `{}`", wasm_path.display()))?; - let gen = match &self.generated { - Generated::InterfaceTypes => return Ok(()), - Generated::Js(gen) => gen, - }; + let gen = &self.generated; // Write out all local JS snippets to the final destination now that // we've collected them from all the programs. diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index 601b2bf5a51..dc83a69fa2c 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -1,7 +1,8 @@ use crate::wit::{Adapter, NonstandardWitSection}; use crate::wit::{AdapterKind, Instruction, WasmBindgenAux}; use anyhow::{anyhow, Error}; -use walrus::Module; +use walrus::ir::Value; +use walrus::{FunctionId, InitExpr, Module}; use wasm_bindgen_multi_value_xform as multi_value_xform; use wasm_bindgen_wasm_conventions as wasm_conventions; @@ -37,6 +38,7 @@ pub fn run(module: &mut Module) -> Result<(), Error> { match slot { Slot::Id(s) => *s = id, Slot::Export(e) => module.exports.get_mut(e).item = id.into(), + Slot::TableElement(index) => set_table_entry(module, index, id), } } @@ -48,6 +50,7 @@ pub fn run(module: &mut Module) -> Result<(), Error> { enum Slot<'a> { Id(&'a mut walrus::FunctionId), Export(walrus::ExportId), + TableElement(u32), } fn extract_xform<'a>( @@ -76,13 +79,13 @@ fn extract_xform<'a>( }); let slot = instructions .iter_mut() - .filter_map(|i| match &mut i.instr { - Instruction::Standard(wit_walrus::Instruction::CallCore(f)) => Some(Slot::Id(f)), + .find_map(|i| match &mut i.instr { + Instruction::CallCore(f) => Some(Slot::Id(f)), Instruction::CallExport(e) => Some(Slot::Export(*e)), + Instruction::CallTableElement(index) => Some(Slot::TableElement(*index)), _ => None, }) - .next() - .expect("should have found call-core"); + .expect("adapter never calls the underlying function"); // LLVM currently always uses the first parameter for the return // pointer. We hard code that here, since we have no better option. @@ -92,6 +95,7 @@ fn extract_xform<'a>( walrus::ExportItem::Function(f) => f, _ => panic!("found call to non-function export"), }, + Slot::TableElement(func_index) => resolve_table_entry(module, *func_index), }; to_xform.push((id, 0, types)); slots.push(slot); @@ -104,3 +108,63 @@ fn extract_xform<'a>( // FIXME(#1872) handle this // if let Some(Instruction::StoreRetptr { .. }) = instructions.last() {} } + +/// Resolves an index in the function table to a function ID. +fn resolve_table_entry(module: &Module, func_index: u32) -> FunctionId { + let table_id = module + .tables + .main_function_table() + .ok() + .flatten() + .expect("there should only be one function table"); + module + .tables + .get(table_id) + .elem_segments + .iter() + .find_map(|&id| { + let elem = module.elements.get(id); + let offset = match elem.kind { + walrus::ElementKind::Active { offset, .. } => match offset { + InitExpr::Value(Value::I32(value)) => value as u32, + _ => panic!("table offset was not an i32 value"), + }, + _ => panic!("found non-active element section for function table"), + }; + elem.members.iter().enumerate().find_map(|(i, &func_id)| { + let table_index = i as u32 + offset; + if table_index == func_index { + func_id + } else { + None + } + }) + }) + .expect("function in function table is not initialized") +} + +/// Changes the function ID at an index in the function table. +fn set_table_entry(module: &mut Module, func_index: u32, new_id: FunctionId) { + let table_id = module + .tables + .main_function_table() + .ok() + .flatten() + .expect("there should only be one function table"); + for &id in module.tables.get(table_id).elem_segments.iter() { + let elem = module.elements.get_mut(id); + let offset = match elem.kind { + walrus::ElementKind::Active { offset, .. } => match offset { + InitExpr::Value(Value::I32(value)) => value as u32, + _ => panic!("table offset was not an i32 value"), + }, + _ => panic!("found non-active element section for function table"), + }; + for (i, func_id) in elem.members.iter_mut().enumerate() { + let table_index = i as u32 + offset; + if table_index == func_index { + *func_id = Some(new_id); + } + } + } +} diff --git a/crates/cli-support/src/throw2unreachable.rs b/crates/cli-support/src/throw2unreachable.rs deleted file mode 100644 index 6050911b482..00000000000 --- a/crates/cli-support/src/throw2unreachable.rs +++ /dev/null @@ -1,87 +0,0 @@ -use crate::intrinsic::Intrinsic; -use crate::wit::Instruction; -use crate::wit::{AdapterKind, AuxImport, NonstandardWitSection, WasmBindgenAux}; -use walrus::ir::*; -use walrus::Module; - -/// Runs a small pass over `Module` to replace all calls to the -/// `__wbindgen_throw` intrinsic with an `unreachable` instruction. -/// -/// This pass is executed as part of the wasm interface types support. This is -/// done to support debug mode executables with wasm interface types. Debug mode -/// executables will use malloc as well as externref intrinsics. These intrinsics -/// internally, when they fail, abort the instance. This abort is done through -/// the `__wbindgen_throw` intrinsic in debug mode to provide a hopefully -/// useful error message. In release mode it's simply an `unreachable` -/// instruction. -/// -/// With wasm interface types we can't rely on intrinsics being available, so we -/// need to do something about this in debug mode. Our answer is to remove calls -/// to `__wbindgen_throw` and replace them with `unreachable`. -/// -/// This has the unintended side effect of making the user-visible function -/// `wasm_bindgen::throw_str` "just work", but that's hoped to get fix with a -/// split of crates like described in #1841 -pub fn run(module: &mut Module) { - // Find the adapter ID which is the import for the call to the throw - // intrinsic. - let aux = module.customs.get_typed::().unwrap(); - let throw_import = aux.import_map.iter().find(|(_, import)| match import { - AuxImport::Intrinsic(Intrinsic::Throw) => true, - _ => false, - }); - let throw_adapter = match throw_import { - Some((id, _)) => *id, - None => return, - }; - - // Find the adapter, if any, which calls this intrinsic - let wit = module.customs.get_typed::().unwrap(); - let adapter_calling_throw = wit.adapters.iter().find(|(_, adapter)| { - let instrs = match &adapter.kind { - AdapterKind::Local { instructions } => instructions, - _ => return false, - }; - instrs.iter().any(|i| match i.instr { - Instruction::CallAdapter(a) => a == throw_adapter, - _ => false, - }) - }); - let adapter_calling_throw = match adapter_calling_throw { - Some((id, _)) => *id, - None => return, - }; - - // ... then using the adapter that calls the intrinsic, find which core - // import in the wasm module it's implementing. - let import = wit - .implements - .iter() - .find(|(_, _, adapter)| *adapter == adapter_calling_throw); - let function = match import { - Some((_, function, _)) => *function, - None => return, - }; - - // .. and now replace all calls to `function` with `unreachable` - // instructions - for (_, func) in module.funcs.iter_local_mut() { - let entry = func.entry_block(); - dfs_pre_order_mut(&mut Rewrite { function }, func, entry); - } - - struct Rewrite { - function: walrus::FunctionId, - } - - impl VisitorMut for Rewrite { - fn visit_instr_mut(&mut self, instr: &mut Instr, _: &mut InstrLocId) { - match instr { - Instr::Call(c) if c.func == self.function => { - *instr = Unreachable {}.into(); - } - _ => {} - } - } - } -} diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index a940f884dd5..483185ce627 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -44,7 +44,6 @@ impl InstructionBuilder<'_, '_> { fn _incoming(&mut self, arg: &Descriptor) -> Result<(), Error> { use walrus::ValType as WasmVT; - use wit_walrus::ValType as WitVT; match arg { Descriptor::Boolean => { self.instruction( @@ -83,14 +82,14 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); } - Descriptor::I8 => self.number(WitVT::S8, WasmVT::I32), - Descriptor::U8 => self.number(WitVT::U8, WasmVT::I32), - Descriptor::I16 => self.number(WitVT::S16, WasmVT::I32), - Descriptor::U16 => self.number(WitVT::U16, WasmVT::I32), - Descriptor::I32 => self.number(WitVT::S32, WasmVT::I32), - Descriptor::U32 => self.number(WitVT::U32, WasmVT::I32), - Descriptor::I64 => self.number(WitVT::S64, WasmVT::I64), - Descriptor::U64 => self.number(WitVT::U64, WasmVT::I64), + Descriptor::I8 => self.number(AdapterType::S8, WasmVT::I32), + Descriptor::U8 => self.number(AdapterType::U8, WasmVT::I32), + Descriptor::I16 => self.number(AdapterType::S16, WasmVT::I32), + Descriptor::U16 => self.number(AdapterType::U16, WasmVT::I32), + Descriptor::I32 => self.number(AdapterType::S32, WasmVT::I32), + Descriptor::U32 => self.number(AdapterType::U32, WasmVT::I32), + Descriptor::I64 => self.number(AdapterType::S64, WasmVT::I64), + Descriptor::U64 => self.number(AdapterType::U64, WasmVT::I64), Descriptor::F32 => { self.get(AdapterType::F32); self.output.push(AdapterType::F32); @@ -99,7 +98,7 @@ impl InstructionBuilder<'_, '_> { self.get(AdapterType::F64); self.output.push(AdapterType::F64); } - Descriptor::Enum { .. } => self.number(WitVT::U32, WasmVT::I32), + Descriptor::Enum { .. } => self.number(AdapterType::U32, WasmVT::I32), Descriptor::Ref(d) => self.incoming_ref(false, d)?, Descriptor::RefMut(d) => self.incoming_ref(true, d)?, Descriptor::Option(d) => self.incoming_option(d)?, @@ -339,9 +338,8 @@ impl InstructionBuilder<'_, '_> { // fetch them from the parameters. if !self.return_position { let idx = self.input.len() as u32 - 1; - let std = wit_walrus::Instruction::ArgGet(idx); self.instructions.push(InstructionData { - instr: Instruction::Standard(std), + instr: Instruction::ArgGet(idx), stack_change: StackChange::Modified { pushed: 1, popped: 0, @@ -398,17 +396,12 @@ impl InstructionBuilder<'_, '_> { self.output.extend_from_slice(outputs); } - fn number(&mut self, input: wit_walrus::ValType, output: walrus::ValType) { - let std = wit_walrus::Instruction::IntToWasm { - input, + fn number(&mut self, input: AdapterType, output: walrus::ValType) { + let instr = Instruction::IntToWasm { + input: input.clone(), output, - trap: false, }; - self.instruction( - &[AdapterType::from_wit(input)], - Instruction::Standard(std), - &[AdapterType::from_wasm(output).unwrap()], - ); + self.instruction(&[input], instr, &[AdapterType::from_wasm(output).unwrap()]); } fn in_option_native(&mut self, wasm: ValType) { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 7ca01e6f9ff..f19aae24ab6 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -14,7 +14,6 @@ use wasm_bindgen_threads_xform::ThreadCount; mod incoming; mod nonstandard; mod outgoing; -pub mod section; mod standard; pub use self::nonstandard::*; pub use self::standard::*; @@ -35,7 +34,6 @@ struct Context<'a> { unique_crate_identifier: &'a str, descriptors: HashMap, externref_enabled: bool, - wasm_interface_types: bool, thread_count: Option, support_start: bool, } @@ -52,7 +50,6 @@ pub fn process( module: &mut Module, programs: Vec, externref_enabled: bool, - wasm_interface_types: bool, thread_count: Option, support_start: bool, ) -> Result<(NonstandardWitSectionId, WasmBindgenAuxId), Error> { @@ -69,7 +66,6 @@ pub fn process( module, start_found: false, externref_enabled, - wasm_interface_types, thread_count, support_start, }; @@ -83,10 +79,6 @@ pub fn process( cx.discover_main()?; } - if let Some(standard) = cx.module.customs.delete_typed() { - cx.standard(&standard)?; - } - cx.verify()?; cx.unexport_intrinsics(); @@ -315,7 +307,7 @@ impl<'a> Context<'a> { // since that's a slightly different environment for now which doesn't have // quite the same initialization. fn inject_externref_initialization(&mut self) -> Result<(), Error> { - if !self.externref_enabled || self.wasm_interface_types { + if !self.externref_enabled { return Ok(()); } @@ -1041,142 +1033,6 @@ impl<'a> Context<'a> { Ok(JsImport { name, fields }) } - fn standard(&mut self, std: &wit_walrus::WasmInterfaceTypes) -> Result<(), Error> { - let mut walrus2us = HashMap::new(); - let params_and_results = |id: wit_walrus::TypeId| -> (Vec<_>, Vec<_>) { - let ty = std.types.get(id); - let params = ty - .params() - .iter() - .cloned() - .map(AdapterType::from_wit) - .collect(); - let results = ty - .results() - .iter() - .cloned() - .map(AdapterType::from_wit) - .collect(); - (params, results) - }; - - // Register all imports, allocating our own id for them and configuring - // where the JS value for the import is coming from. - for import in std.imports.iter() { - let func = std.funcs.get(import.func); - let (params, results) = params_and_results(func.ty); - let id = self.adapters.append( - params, - results, - vec![], - AdapterKind::Import { - module: import.module.clone(), - name: import.name.clone(), - kind: AdapterJsImportKind::Normal, - }, - ); - walrus2us.insert(import.func, id); - let js = JsImport { - name: JsImportName::Module { - module: import.module.clone(), - name: import.name.clone(), - }, - fields: Vec::new(), - }; - let value = AuxValue::Bare(js); - assert!(self - .aux - .import_map - .insert(id, AuxImport::Value(value)) - .is_none()); - } - - // Register all functions, allocating our own id system for each of the - // functions. - for func in std.funcs.iter() { - if let wit_walrus::FuncKind::Import(_) = func.kind { - continue; - } - let (params, results) = params_and_results(func.ty); - walrus2us.insert( - func.id(), - self.adapters.append( - params, - results, - vec![], - AdapterKind::Local { - instructions: Vec::new(), - }, - ), - ); - } - - // .. and then actually translate all functions using our id mapping, - // now that we're able to remap all the `CallAdapter` instructions. - for func in std.funcs.iter() { - let instrs = match &func.kind { - wit_walrus::FuncKind::Local(instrs) => instrs, - wit_walrus::FuncKind::Import(_) => continue, - }; - let instrs = instrs - .iter() - .map(|i| match i { - wit_walrus::Instruction::CallAdapter(f) => { - Instruction::CallAdapter(walrus2us[&f]) - } - other => Instruction::Standard(other.clone()), - }) - .map(|instr| InstructionData { - instr, - stack_change: StackChange::Unknown, - }) - .collect::>(); - - // Store the instrs into the adapter function directly. - let adapter = self - .adapters - .adapters - .get_mut(&walrus2us[&func.id()]) - .unwrap(); - match &mut adapter.kind { - AdapterKind::Local { instructions } => *instructions = instrs, - _ => unreachable!(), - } - } - - // next up register all exports, ensuring that our export map says - // what's happening as well for JS - for export in std.exports.iter() { - let id = walrus2us[&export.func]; - self.adapters.exports.push((export.name.clone(), id)); - - let kind = AuxExportKind::Function(export.name.clone()); - let export = AuxExport { - debug_name: format!("standard export {:?}", id), - comments: String::new(), - arg_names: None, - asyncness: false, - kind, - generate_typescript: true, - generate_jsdoc: true, - variadic: false, - }; - assert!(self.aux.export_map.insert(id, export).is_none()); - } - - // ... and finally the `implements` section - for i in std.implements.iter() { - let import_id = match &self.module.funcs.get(i.core_func).kind { - walrus::FunctionKind::Import(i) => i.import, - _ => panic!("malformed wasm interface typess section"), - }; - self.adapters - .implements - .push((import_id, i.core_func, walrus2us[&i.adapter_func])); - } - Ok(()) - } - /// Perform a small verification pass over the module to perform some /// internal sanity checks. fn verify(&self) -> Result<(), Error> { diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 1ea9c17bf93..890b79b2fb0 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -104,9 +104,8 @@ impl InstructionBuilder<'_, '_> { // ... then defer a call to `free` to happen later let free = self.cx.free()?; - let std = wit_walrus::Instruction::DeferCallCore(free); self.instructions.push(InstructionData { - instr: Instruction::Standard(std), + instr: Instruction::DeferCallCore(free), stack_change: StackChange::Modified { popped: 2, pushed: 2, @@ -114,9 +113,8 @@ impl InstructionBuilder<'_, '_> { }); // ... and then convert it to a string type - let std = wit_walrus::Instruction::MemoryToString(self.cx.memory()?); self.instructions.push(InstructionData { - instr: Instruction::Standard(std), + instr: Instruction::MemoryToString(self.cx.memory()?), stack_change: StackChange::Modified { popped: 2, pushed: 1, @@ -181,10 +179,9 @@ impl InstructionBuilder<'_, '_> { Descriptor::CachedString => self.cached_string(false, false)?, Descriptor::String => { - let std = wit_walrus::Instruction::MemoryToString(self.cx.memory()?); self.instruction( &[AdapterType::I32, AdapterType::I32], - Instruction::Standard(std), + Instruction::MemoryToString(self.cx.memory()?), &[AdapterType::String], ); } @@ -390,10 +387,9 @@ impl InstructionBuilder<'_, '_> { // check we did not add any deferred calls, because we have undermined the idea of // running them unconditionally in a finally {} block. String does this, but we // special case it. - assert!(!self.instructions[len..].iter().any(|idata| matches!( - idata.instr, - Instruction::Standard(wit_walrus::Instruction::DeferCallCore(_)) - ))); + assert!(!self.instructions[len..] + .iter() + .any(|idata| matches!(idata.instr, Instruction::DeferCallCore(_)))); // Finally, we add the two inputs to UnwrapResult, and everything checks out // @@ -432,9 +428,8 @@ impl InstructionBuilder<'_, '_> { // implementation is always safe. We do this in UnwrapResultString's // implementation. let free = self.cx.free()?; - let std = wit_walrus::Instruction::DeferCallCore(free); self.instructions.push(InstructionData { - instr: Instruction::Standard(std), + instr: Instruction::DeferCallCore(free), stack_change: StackChange::Modified { popped: 2, pushed: 2, @@ -442,9 +437,8 @@ impl InstructionBuilder<'_, '_> { }); // ... and then convert it to a string type - let std = wit_walrus::Instruction::MemoryToString(self.cx.memory()?); self.instructions.push(InstructionData { - instr: Instruction::Standard(std), + instr: Instruction::MemoryToString(self.cx.memory()?), stack_change: StackChange::Modified { popped: 2, pushed: 1, @@ -510,21 +504,19 @@ impl InstructionBuilder<'_, '_> { } fn outgoing_i32(&mut self, output: AdapterType) { - let std = wit_walrus::Instruction::WasmToInt { + let instr = Instruction::WasmToInt { input: walrus::ValType::I32, - output: output.to_wit().unwrap(), - trap: false, + output: output.clone(), }; - self.instruction(&[AdapterType::I32], Instruction::Standard(std), &[output]); + self.instruction(&[AdapterType::I32], instr, &[output]); } fn outgoing_i64(&mut self, output: AdapterType) { - let std = wit_walrus::Instruction::WasmToInt { + let instr = Instruction::WasmToInt { input: walrus::ValType::I64, - output: output.to_wit().unwrap(), - trap: false, + output: output.clone(), }; - self.instruction(&[AdapterType::I64], Instruction::Standard(std), &[output]); + self.instruction(&[AdapterType::I64], instr, &[output]); } fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> { diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index bd1fb23a2e7..85da8965291 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -16,9 +16,9 @@ //! generating any JS glue. Any JS glue currently generated is also invalid if //! the module contains the wasm bindings section and it's actually respected. +use crate::wit::AuxExport; use crate::wit::{AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, Instruction}; use crate::wit::{AdapterKind, NonstandardWitSection, WasmBindgenAux}; -use crate::wit::{AuxExport, InstructionData}; use crate::wit::{AuxExportKind, AuxImport, AuxValue, JsImport, JsImportName}; use anyhow::{anyhow, bail, Context, Error}; use std::collections::HashMap; @@ -204,92 +204,6 @@ pub fn add(module: &mut Module) -> Result<(), Error> { Ok(()) } -fn translate_instruction( - instr: &InstructionData, - us2walrus: &HashMap, - module: &Module, -) -> Result { - use Instruction::*; - - match &instr.instr { - Standard(s) => Ok(s.clone()), - CallAdapter(id) => { - let id = us2walrus[id]; - Ok(wit_walrus::Instruction::CallAdapter(id)) - } - CallExport(e) => match module.exports.get(*e).item { - walrus::ExportItem::Function(f) => Ok(wit_walrus::Instruction::CallCore(f)), - _ => bail!("can only call exported functions"), - }, - CallTableElement(e) => { - let entry = wasm_bindgen_wasm_conventions::get_function_table_entry(module, *e)?; - let id = entry - .func - .ok_or_else(|| anyhow!("function table wasn't filled in a {}", e))?; - Ok(wit_walrus::Instruction::CallCore(id)) - } - StringToMemory { - mem, - malloc, - realloc: _, - } => Ok(wit_walrus::Instruction::StringToMemory { - mem: *mem, - malloc: *malloc, - }), - StoreRetptr { .. } | LoadRetptr { .. } | Retptr { .. } => { - bail!("return pointers aren't supported in wasm interface types"); - } - I32FromBool | BoolFromI32 => { - bail!("booleans aren't supported in wasm interface types"); - } - I32FromStringFirstChar | StringFromChar => { - bail!("chars aren't supported in wasm interface types"); - } - // Note: if `ExternrefLoadOwned` contained `Some`, this error message wouldn't make sense, - // but that can only occur when returning `Result`, - // in which case there'll be an earlier `UnwrapResult` instruction and we'll bail before reaching this point. - I32FromExternrefOwned | I32FromExternrefBorrow | ExternrefLoadOwned { .. } | TableGet => { - bail!("externref pass failed to sink into wasm module"); - } - I32FromExternrefRustOwned { .. } - | I32FromExternrefRustBorrow { .. } - | RustFromI32 { .. } => { - bail!("rust types aren't supported in wasm interface types"); - } - I32FromOptionExternref { .. } - | I32FromOptionU32Sentinel - | I32FromOptionRust { .. } - | I32FromOptionBool - | I32FromOptionChar - | I32FromOptionEnum { .. } - | FromOptionNative { .. } - | OptionVector { .. } - | OptionString { .. } - | OptionRustFromI32 { .. } - | OptionVectorLoad { .. } - | OptionView { .. } - | OptionU32Sentinel - | ToOptionNative { .. } - | OptionBoolFromI32 - | OptionCharFromI32 - | OptionEnumFromI32 { .. } => { - bail!("optional types aren't supported in wasm bindgen"); - } - UnwrapResult { .. } | UnwrapResultString { .. } => { - bail!("self-unwrapping result types aren't supported in wasm bindgen"); - } - MutableSliceToMemory { .. } | VectorToMemory { .. } | VectorLoad { .. } | View { .. } => { - bail!("vector slices aren't supported in wasm interface types yet"); - } - CachedStringLoad { .. } => { - bail!("cached strings aren't supported in wasm interface types"); - } - StackClosure { .. } => { - bail!("closures aren't supported in wasm interface types"); - } - } -} - fn check_standard_import(import: &AuxImport) -> Result<(), Error> { let desc_js = |js: &JsImport| { let mut extra = String::new(); diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 7dc98a42beb..bde7b5b9318 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -91,9 +91,11 @@ pub enum AdapterType { #[derive(Debug, Clone)] pub enum Instruction { - /// A known instruction in the "standard" - Standard(wit_walrus::Instruction), - + /// Calls a function by its id. + CallCore(walrus::FunctionId), + /// Schedules a function to be called after the whole lift/lower cycle is + /// finished, e.g. to deallocate a string or something. + DeferCallCore(walrus::FunctionId), /// A call to one of our own defined adapters, similar to the standard /// call-adapter instruction CallAdapter(AdapterId), @@ -102,6 +104,9 @@ pub enum Instruction { /// Call an element in the function table of the core module CallTableElement(u32), + /// Gets an argument by its index. + ArgGet(u32), + /// An instruction to store `ty` at the `offset` index in the return pointer StoreRetptr { ty: AdapterType, @@ -120,6 +125,17 @@ pub enum Instruction { size: u32, }, + /// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain wasm `i32` or `i64` equivalent. + IntToWasm { + input: AdapterType, + output: walrus::ValType, + }, + /// Pops a wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent. + WasmToInt { + input: walrus::ValType, + output: AdapterType, + }, + /// Pops a `bool` from the stack and pushes an `i32` equivalent I32FromBool, /// Pops a `string` from the stack and pushes the first character as `i32` @@ -200,6 +216,8 @@ pub enum Instruction { mem: walrus::MemoryId, realloc: Option, }, + /// Pops a pointer + length, pushes a string + MemoryToString(walrus::MemoryId), /// Pops an externref, pushes pointer/length or all zeros OptionVector { @@ -290,25 +308,6 @@ pub enum Instruction { } impl AdapterType { - pub fn from_wit(wit: wit_walrus::ValType) -> AdapterType { - match wit { - wit_walrus::ValType::S8 => AdapterType::S8, - wit_walrus::ValType::S16 => AdapterType::S16, - wit_walrus::ValType::S32 => AdapterType::S32, - wit_walrus::ValType::S64 => AdapterType::S64, - wit_walrus::ValType::U8 => AdapterType::U8, - wit_walrus::ValType::U16 => AdapterType::U16, - wit_walrus::ValType::U32 => AdapterType::U32, - wit_walrus::ValType::U64 => AdapterType::U64, - wit_walrus::ValType::F32 => AdapterType::F32, - wit_walrus::ValType::F64 => AdapterType::F64, - wit_walrus::ValType::String => AdapterType::String, - wit_walrus::ValType::Externref => AdapterType::Externref, - wit_walrus::ValType::I32 => AdapterType::I32, - wit_walrus::ValType::I64 => AdapterType::I64, - } - } - pub fn from_wasm(wasm: walrus::ValType) -> Option { Some(match wasm { walrus::ValType::I32 => AdapterType::I32, @@ -331,33 +330,6 @@ impl AdapterType { }) } - pub fn to_wit(&self) -> Option { - Some(match self { - AdapterType::S8 => wit_walrus::ValType::S8, - AdapterType::S16 => wit_walrus::ValType::S16, - AdapterType::S32 => wit_walrus::ValType::S32, - AdapterType::S64 => wit_walrus::ValType::S64, - AdapterType::U8 => wit_walrus::ValType::U8, - AdapterType::U16 => wit_walrus::ValType::U16, - AdapterType::U32 => wit_walrus::ValType::U32, - AdapterType::U64 => wit_walrus::ValType::U64, - AdapterType::F32 => wit_walrus::ValType::F32, - AdapterType::F64 => wit_walrus::ValType::F64, - AdapterType::String => wit_walrus::ValType::String, - AdapterType::Externref | AdapterType::NamedExternref(_) => { - wit_walrus::ValType::Externref - } - - AdapterType::I32 => wit_walrus::ValType::I32, - AdapterType::I64 => wit_walrus::ValType::I64, - AdapterType::Option(_) - | AdapterType::Function - | AdapterType::Struct(_) - | AdapterType::Bool - | AdapterType::Vector(_) => return None, - }) - } - pub fn option(self) -> AdapterType { AdapterType::Option(Box::new(self)) } @@ -451,20 +423,17 @@ impl walrus::CustomSection for NonstandardWitSection { }; for instr in instrs { match instr.instr { - Standard(wit_walrus::Instruction::DeferCallCore(f)) - | Standard(wit_walrus::Instruction::CallCore(f)) => { + DeferCallCore(f) | CallCore(f) => { roots.push_func(f); } StoreRetptr { mem, .. } | LoadRetptr { mem, .. } | View { mem, .. } | OptionView { mem, .. } - | Standard(wit_walrus::Instruction::MemoryToString(mem)) => { + | MemoryToString(mem) => { roots.push_memory(mem); } - VectorToMemory { malloc, mem, .. } - | OptionVector { malloc, mem, .. } - | Standard(wit_walrus::Instruction::StringToMemory { mem, malloc }) => { + VectorToMemory { malloc, mem, .. } | OptionVector { malloc, mem, .. } => { roots.push_memory(mem); roots.push_func(malloc); } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index bc029b57888..a1c1c90b65b 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -36,19 +36,11 @@ predicates = "1.0.0" rayon = "1.0" tempfile = "3.0" wasmparser = "0.102.0" -wasmprinter = "0.2, <=0.2.33" # pinned for wit-printer -wit-printer = "0.2" -wit-text = "0.8" -wit-validator = "0.2" -wit-walrus = "0.6" +wasmprinter = "0.2.54" [[test]] name = "reference" harness = false -[[test]] -name = "interface-types" -harness = false - [features] vendored-openssl = ['openssl/vendored'] diff --git a/crates/cli/tests/interface-types.rs b/crates/cli/tests/interface-types.rs deleted file mode 100644 index 03198a9832d..00000000000 --- a/crates/cli/tests/interface-types.rs +++ /dev/null @@ -1,90 +0,0 @@ -use anyhow::{bail, Result}; -use assert_cmd::prelude::*; -use rayon::prelude::*; -use std::env; -use std::path::Path; -use std::process::Command; - -fn main() -> Result<()> { - let filter = env::args().nth(1); - - let mut tests = Vec::new(); - let dir = env::current_dir()?.join("tests/interface-types"); - for entry in dir.read_dir()? { - let path = entry?.path(); - if path.extension().and_then(|s| s.to_str()) != Some("wat") { - continue; - } - if let Some(filter) = &filter { - if !path.display().to_string().contains(filter) { - continue; - } - } - tests.push(path); - } - tests.sort(); - - let errs = tests - .par_iter() - .filter_map(|t| runtest(t).err().map(|e| (t, e))) - .collect::>(); - - if errs.len() == 0 { - println!("{} tests passed", tests.len()); - return Ok(()); - } - eprintln!("failed tests:\n"); - for (test, err) in errs { - eprintln!("{} failure\n{}", test.display(), tab(&format!("{:?}", err))); - } - bail!("tests failed"); -} - -fn runtest(test: &Path) -> Result<()> { - let js = test.with_extension("js"); - let td = tempfile::TempDir::new()?; - - let mut bindgen = Command::cargo_bin("wasm-bindgen")?; - bindgen - .arg("--out-dir") - .arg(td.path()) - .arg(test) - .arg("--out-name=wasm") - .arg("--nodejs") - .arg("--no-typescript"); - exec(&mut bindgen)?; - - exec( - Command::new("node") - .arg("--experimental-wasm-reftypes") - .arg(&js) - .env("NODE_PATH", td.path()), - ) - .or_else(|_| { - // The `--experimental-wasm-reftypes` flag was removed in Node 18, so that might - // have caused the error; try again without it. - exec(Command::new("node").arg(&js).env("NODE_PATH", td.path())) - }) -} - -fn exec(cmd: &mut Command) -> Result<()> { - let output = cmd.output()?; - if output.status.success() { - return Ok(()); - } - let mut err = format!("command failed {:?}", cmd); - err.push_str(&format!("\nstatus: {}", output.status)); - err.push_str(&format!( - "\nstderr:\n{}", - tab(&String::from_utf8_lossy(&output.stderr)) - )); - err.push_str(&format!( - "\nstdout:\n{}", - tab(&String::from_utf8_lossy(&output.stdout)) - )); - bail!("{}", err); -} - -fn tab(s: &str) -> String { - format!(" {}", s.replace("\n", "\n ")) -} diff --git a/crates/cli/tests/interface-types/anyref.js b/crates/cli/tests/interface-types/anyref.js deleted file mode 100644 index 20caf0d46db..00000000000 --- a/crates/cli/tests/interface-types/anyref.js +++ /dev/null @@ -1,16 +0,0 @@ -const assert = require('assert'); -const wasm = require('wasm'); - -const obj = {}; -assert.strictEqual(wasm.foo(obj), obj); - -wasm.store('x'); -assert.strictEqual(wasm.load(), 'x'); - -const obj2 = {}; -wasm.store(obj2); -assert.strictEqual(wasm.load(), obj2); -assert.strictEqual(wasm.load(), obj2); - -wasm.store(undefined); -assert.strictEqual(wasm.load(), undefined); diff --git a/crates/cli/tests/interface-types/anyref.wat b/crates/cli/tests/interface-types/anyref.wat deleted file mode 100644 index 7a7a8ee3592..00000000000 --- a/crates/cli/tests/interface-types/anyref.wat +++ /dev/null @@ -1,26 +0,0 @@ -(module - (func $foo (param externref) (result externref) - local.get 0) - - (func $store (param externref) - i32.const 0 - local.get 0 - table.set 0) - - (func $load (result externref) - i32.const 0 - table.get 0) - - (table 1 externref) - - (@interface func (export "foo") (param externref) (result externref) - arg.get 0 - call-core $foo) - - (@interface func (export "store") (param externref) - arg.get 0 - call-core $store) - - (@interface func (export "load") (result externref) - call-core $load) -) diff --git a/crates/cli/tests/interface-types/defer-call.js b/crates/cli/tests/interface-types/defer-call.js deleted file mode 100644 index a8abdc319dc..00000000000 --- a/crates/cli/tests/interface-types/defer-call.js +++ /dev/null @@ -1,5 +0,0 @@ -const wasm = require('wasm'); -const assert = require('assert'); - -assert.strictEqual(wasm.foo(), 0); -assert.strictEqual(wasm.get(), 1); diff --git a/crates/cli/tests/interface-types/defer-call.wat b/crates/cli/tests/interface-types/defer-call.wat deleted file mode 100644 index 4b4b5955ce6..00000000000 --- a/crates/cli/tests/interface-types/defer-call.wat +++ /dev/null @@ -1,21 +0,0 @@ -(module - (global $ctr (mut i32) (i32.const 0)) - - (func $increment - global.get $ctr - i32.const 1 - i32.add - global.set $ctr) - - (func $get (result i32) - global.get $ctr) - - (@interface func (export "foo") (result s32) - defer-call-core $increment - call-core $get - i32-to-s32) - - (@interface func (export "get") (result s32) - call-core $get - i32-to-s32) -) diff --git a/crates/cli/tests/interface-types/empty.js b/crates/cli/tests/interface-types/empty.js deleted file mode 100644 index 050212fa60f..00000000000 --- a/crates/cli/tests/interface-types/empty.js +++ /dev/null @@ -1,2 +0,0 @@ -const m = require('wasm'); - diff --git a/crates/cli/tests/interface-types/empty.wat b/crates/cli/tests/interface-types/empty.wat deleted file mode 100644 index 3af8f254547..00000000000 --- a/crates/cli/tests/interface-types/empty.wat +++ /dev/null @@ -1 +0,0 @@ -(module) diff --git a/crates/cli/tests/interface-types/integers.js b/crates/cli/tests/interface-types/integers.js deleted file mode 100644 index 05cbabc5228..00000000000 --- a/crates/cli/tests/interface-types/integers.js +++ /dev/null @@ -1,9 +0,0 @@ -const assert = require('assert'); -const wasm = require('wasm'); - -assert.strictEqual(wasm.add_i8(0, 1), 1); -assert.strictEqual(wasm.add_u8(0, 1), 1); -assert.strictEqual(wasm.add_i16(0, 1), 1); -assert.strictEqual(wasm.add_u16(0, 1), 1); -assert.strictEqual(wasm.add_i32(0, 1), 1); -assert.strictEqual(wasm.add_u32(0, 1), 1); diff --git a/crates/cli/tests/interface-types/integers.wat b/crates/cli/tests/interface-types/integers.wat deleted file mode 100644 index b240b84516f..00000000000 --- a/crates/cli/tests/interface-types/integers.wat +++ /dev/null @@ -1,54 +0,0 @@ -(module - (func $add_i32 (param i32 i32) (result i32) - local.get 0 - local.get 1 - i32.add) - - (@interface func (export "add_i8") (param s8) (param s8) (result s8) - arg.get 0 - s8-to-i32 - arg.get 1 - s8-to-i32 - call-core $add_i32 - i32-to-s8) - - (@interface func (export "add_i16") (param s16) (param s16) (result s16) - arg.get 0 - s16-to-i32 - arg.get 1 - s16-to-i32 - call-core $add_i32 - i32-to-s16) - - (@interface func (export "add_i32") (param s32) (param s32) (result s32) - arg.get 0 - s32-to-i32 - arg.get 1 - s32-to-i32 - call-core $add_i32 - i32-to-s32) - - (@interface func (export "add_u8") (param s8) (param s8) (result s8) - arg.get 0 - s8-to-i32 - arg.get 1 - s8-to-i32 - call-core $add_i32 - i32-to-s8) - - (@interface func (export "add_u16") (param u16) (param u16) (result u16) - arg.get 0 - u16-to-i32 - arg.get 1 - u16-to-i32 - call-core $add_i32 - i32-to-u16) - - (@interface func (export "add_u32") (param u32) (param u32) (result u32) - arg.get 0 - u32-to-i32 - arg.get 1 - u32-to-i32 - call-core $add_i32 - i32-to-u32) -) diff --git a/crates/cli/tests/interface-types/memory-to-string.js b/crates/cli/tests/interface-types/memory-to-string.js deleted file mode 100644 index df3cc794572..00000000000 --- a/crates/cli/tests/interface-types/memory-to-string.js +++ /dev/null @@ -1,5 +0,0 @@ -const wasm = require('wasm'); -const assert = require('assert'); - -assert.strictEqual(wasm.foo(), 'foo'); -assert.strictEqual(wasm.hexa(), 'hexa'); diff --git a/crates/cli/tests/interface-types/memory-to-string.wat b/crates/cli/tests/interface-types/memory-to-string.wat deleted file mode 100644 index 95fd609799b..00000000000 --- a/crates/cli/tests/interface-types/memory-to-string.wat +++ /dev/null @@ -1,21 +0,0 @@ -(module - (memory 1) - - (func $foo (result i32 i32) - i32.const 0 - i32.const 3) - (func $hexa (result i32 i32) - i32.const 10 - i32.const 4) - - (data (i32.const 0) "foo") - (data (i32.const 10) "hexa") - - (@interface func (export "foo") (result string) - call-core $foo - memory-to-string) - - (@interface func (export "hexa") (result string) - call-core $hexa - memory-to-string) -) diff --git a/crates/cli/tests/interface-types/no-wasm.js b/crates/cli/tests/interface-types/no-wasm.js deleted file mode 100644 index 50b0b21a17e..00000000000 --- a/crates/cli/tests/interface-types/no-wasm.js +++ /dev/null @@ -1,5 +0,0 @@ -const assert = require('assert'); -const wasm = require('wasm'); - -wasm.nop(); -assert.strictEqual(wasm.roundtrip(1), 1); diff --git a/crates/cli/tests/interface-types/no-wasm.wat b/crates/cli/tests/interface-types/no-wasm.wat deleted file mode 100644 index 91c427f0311..00000000000 --- a/crates/cli/tests/interface-types/no-wasm.wat +++ /dev/null @@ -1,5 +0,0 @@ -(module - (@interface func (export "nop")) - (@interface func (export "roundtrip") (param s32) (result s32) - arg.get 0) -) diff --git a/crates/cli/tests/interface-types/string-to-memory.js b/crates/cli/tests/interface-types/string-to-memory.js deleted file mode 100644 index cc9051bf0e0..00000000000 --- a/crates/cli/tests/interface-types/string-to-memory.js +++ /dev/null @@ -1,11 +0,0 @@ -const wasm = require('wasm'); -const assert = require('assert'); - -const test = s => { - wasm.set(s); - assert.strictEqual(s, wasm.get()); -}; - -test(''); -test('x'); -test('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); diff --git a/crates/cli/tests/interface-types/string-to-memory.wat b/crates/cli/tests/interface-types/string-to-memory.wat deleted file mode 100644 index 25f9576b343..00000000000 --- a/crates/cli/tests/interface-types/string-to-memory.wat +++ /dev/null @@ -1,27 +0,0 @@ -(module - (memory 1) - - (global $glen (mut i32) (i32.const 0)) - (global $gptr (mut i32) (i32.const 0)) - - (func $malloc (param i32) (result i32) i32.const 23) - - (func $set (param $ptr i32) (param $len i32) - local.get $ptr - global.set $gptr - local.get $len - global.set $glen) - - (func $get (result i32 i32) - global.get $gptr - global.get $glen) - - (@interface func (export "set") (param string) - arg.get 0 - string-to-memory $malloc - call-core $set) - - (@interface func (export "get") (result string) - call-core $get - memory-to-string) -) diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index 38782b95c63..2bb7d5f9c74 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -75,7 +75,6 @@ fn runtest(test: &Path) -> Result<()> { repo_root().display(), test.display(), ); - let interface_types = contents.contains("// interface-types"); fs::write(td.path().join("Cargo.toml"), manifest)?; let target_dir = target_dir(); @@ -98,26 +97,16 @@ fn runtest(test: &Path) -> Result<()> { if contents.contains("// enable-externref") { bindgen.env("WASM_BINDGEN_EXTERNREF", "1"); } - if interface_types { - bindgen.env("WASM_INTERFACE_TYPES", "1"); - } exec(&mut bindgen)?; - if interface_types { - let wasm = td.path().join("reference_test.wasm"); - wit_validator::validate(&fs::read(&wasm)?)?; - let wat = sanitize_wasm(&wasm)?; + if !contents.contains("async") { + let js = fs::read_to_string(td.path().join("reference_test_bg.js"))?; + assert_same(&js, &test.with_extension("js"))?; + let wat = sanitize_wasm(&td.path().join("reference_test_bg.wasm"))?; assert_same(&wat, &test.with_extension("wat"))?; - } else { - if !contents.contains("async") { - let js = fs::read_to_string(td.path().join("reference_test_bg.js"))?; - assert_same(&js, &test.with_extension("js"))?; - let wat = sanitize_wasm(&td.path().join("reference_test_bg.wasm"))?; - assert_same(&wat, &test.with_extension("wat"))?; - } - let d_ts = fs::read_to_string(td.path().join("reference_test.d.ts"))?; - assert_same(&d_ts, &test.with_extension("d.ts"))?; } + let d_ts = fs::read_to_string(td.path().join("reference_test.d.ts"))?; + assert_same(&d_ts, &test.with_extension("d.ts"))?; Ok(()) } @@ -136,9 +125,7 @@ fn sanitize_wasm(wasm: &Path) -> Result { // Clean up the wasm module by removing all function // implementations/instructions, data sections, etc. This'll help us largely // only deal with exports/imports which is all we're really interested in. - let mut module = walrus::ModuleConfig::new() - .on_parse(wit_walrus::on_parse) - .parse_file(wasm)?; + let mut module = walrus::Module::from_file(wasm)?; for func in module.funcs.iter_mut() { let local = match &mut func.kind { walrus::FunctionKind::Local(l) => l, @@ -173,7 +160,7 @@ fn sanitize_wasm(wasm: &Path) -> Result { module.exports.delete(id); } walrus::passes::gc::run(&mut module); - let mut wat = wit_printer::print_bytes(&module.emit_wasm())?; + let mut wat = wasmprinter::print_bytes(&module.emit_wasm())?; wat.push_str("\n"); Ok(wat) } diff --git a/crates/cli/tests/reference/add.wat b/crates/cli/tests/reference/add.wat index 990d0158736..63ac9eaee5b 100644 --- a/crates/cli/tests/reference/add.wat +++ b/crates/cli/tests/reference/add.wat @@ -1,8 +1,9 @@ (module (type (;0;) (func (param i32 i32) (result i32))) - (func $add_u32 (type 0) (param i32 i32) (result i32)) - (func $add_i32 (type 0) (param i32 i32) (result i32)) + (func $add_u32 (;0;) (type 0) (param i32 i32) (result i32)) + (func $add_i32 (;1;) (type 0) (param i32 i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "add_u32" (func $add_u32)) - (export "add_i32" (func $add_i32))) + (export "add_i32" (func $add_i32)) +) diff --git a/crates/cli/tests/reference/anyref-empty.wat b/crates/cli/tests/reference/anyref-empty.wat index 4d130dc9f17..cbea17aa06d 100644 --- a/crates/cli/tests/reference/anyref-empty.wat +++ b/crates/cli/tests/reference/anyref-empty.wat @@ -5,4 +5,5 @@ (memory (;0;) 16) (export "memory" (memory 0)) (export "__wbindgen_export_0" (table 0)) - (export "__wbindgen_start" (func 0))) + (export "__wbindgen_start" (func 0)) +) diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 71b3aeae388..48071a315d7 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -4,11 +4,11 @@ (type (;2;) (func (param i32))) (type (;3;) (func (param i32) (result i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $__wbindgen_exn_store (type 2) (param i32)) - (func $__externref_table_dealloc (type 2) (param i32)) - (func $exported (type 2) (param i32)) - (func $__externref_table_alloc (type 1) (result i32)) - (func $__wbindgen_add_to_stack_pointer (type 3) (param i32) (result i32)) + (func $__wbindgen_exn_store (;1;) (type 2) (param i32)) + (func $__externref_table_dealloc (;2;) (type 2) (param i32)) + (func $exported (;3;) (type 2) (param i32)) + (func $__externref_table_alloc (;4;) (type 1) (result i32)) + (func $__wbindgen_add_to_stack_pointer (;5;) (type 3) (param i32) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) @@ -18,4 +18,5 @@ (export "__externref_table_alloc" (func $__externref_table_alloc)) (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__externref_table_dealloc" (func $__externref_table_dealloc)) - (export "__wbindgen_start" (func 0))) + (export "__wbindgen_start" (func 0)) +) diff --git a/crates/cli/tests/reference/anyref-nop.wat b/crates/cli/tests/reference/anyref-nop.wat index bda9382a266..eb547fdf02f 100644 --- a/crates/cli/tests/reference/anyref-nop.wat +++ b/crates/cli/tests/reference/anyref-nop.wat @@ -1,10 +1,11 @@ (module (type (;0;) (func)) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $foo (type 0)) + (func $foo (;1;) (type 0)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "foo" (func $foo)) (export "__wbindgen_export_0" (table 0)) - (export "__wbindgen_start" (func 0))) + (export "__wbindgen_start" (func 0)) +) diff --git a/crates/cli/tests/reference/empty.wat b/crates/cli/tests/reference/empty.wat index d54fa33542f..887f8cfa07c 100644 --- a/crates/cli/tests/reference/empty.wat +++ b/crates/cli/tests/reference/empty.wat @@ -1,3 +1,4 @@ (module (memory (;0;) 16) - (export "memory" (memory 0))) + (export "memory" (memory 0)) +) diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import-catch.wat index 1298798b7a7..f291a4a46a3 100644 --- a/crates/cli/tests/reference/import-catch.wat +++ b/crates/cli/tests/reference/import-catch.wat @@ -1,11 +1,12 @@ (module (type (;0;) (func (param i32))) (type (;1;) (func (param i32) (result i32))) - (func $__wbindgen_exn_store (type 0) (param i32)) - (func $exported (type 0) (param i32)) - (func $__wbindgen_add_to_stack_pointer (type 1) (param i32) (result i32)) + (func $__wbindgen_exn_store (;0;) (type 0) (param i32)) + (func $exported (;1;) (type 0) (param i32)) + (func $__wbindgen_add_to_stack_pointer (;2;) (type 1) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) - (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer))) + (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) +) diff --git a/crates/cli/tests/reference/interface-types-anyref.rs b/crates/cli/tests/reference/interface-types-anyref.rs deleted file mode 100644 index 86fb2b93dec..00000000000 --- a/crates/cli/tests/reference/interface-types-anyref.rs +++ /dev/null @@ -1,8 +0,0 @@ -// interface-types - -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn externref_in_out(a: &JsValue, b: JsValue) -> JsValue { - b -} diff --git a/crates/cli/tests/reference/interface-types-anyref.wat b/crates/cli/tests/reference/interface-types-anyref.wat deleted file mode 100644 index 09f1584537c..00000000000 --- a/crates/cli/tests/reference/interface-types-anyref.wat +++ /dev/null @@ -1,12 +0,0 @@ -(module - (type (;0;) (func (param externref externref) (result externref))) - (func $#func0 (@name "externref_in_out externref shim") (type 0) (param externref externref) (result externref)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "externref_in_out" (func $#func0)) - (@interface type (;0;) (func (param externref) (param externref) (result externref))) - (@interface func (;0;) (type 0) - arg.get 0 - arg.get 1 - call-core $#func0) - (@interface export "externref_in_out" (func 0))) diff --git a/crates/cli/tests/reference/interface-types-empty.rs b/crates/cli/tests/reference/interface-types-empty.rs deleted file mode 100644 index a29187d750c..00000000000 --- a/crates/cli/tests/reference/interface-types-empty.rs +++ /dev/null @@ -1,7 +0,0 @@ -// interface-types -// -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn empty() {} - diff --git a/crates/cli/tests/reference/interface-types-empty.wat b/crates/cli/tests/reference/interface-types-empty.wat deleted file mode 100644 index 256b406f947..00000000000 --- a/crates/cli/tests/reference/interface-types-empty.wat +++ /dev/null @@ -1,10 +0,0 @@ -(module - (type (;0;) (func)) - (func $empty (type 0)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "empty" (func $empty)) - (@interface type (;0;) (func)) - (@interface func (;0;) (type 0) - call-core $empty) - (@interface export "empty" (func 0))) diff --git a/crates/cli/tests/reference/interface-types-integers.rs b/crates/cli/tests/reference/interface-types-integers.rs deleted file mode 100644 index f5016b31bec..00000000000 --- a/crates/cli/tests/reference/interface-types-integers.rs +++ /dev/null @@ -1,46 +0,0 @@ -// interface-types - -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn integers(_a1: u8, _a2: i8, _a3: u16, _a4: i16, _a5: u32, _a6: i32, _a7: f32, _a8: f64) {} - -#[wasm_bindgen] -pub fn ret_i8() -> i8 { - 0 -} - -#[wasm_bindgen] -pub fn ret_u8() -> u8 { - 1 -} - -#[wasm_bindgen] -pub fn ret_i16() -> i16 { - 2 -} - -#[wasm_bindgen] -pub fn ret_u16() -> u16 { - 3 -} - -#[wasm_bindgen] -pub fn ret_i32() -> i32 { - 4 -} - -#[wasm_bindgen] -pub fn ret_u32() -> u32 { - 5 -} - -#[wasm_bindgen] -pub fn ret_f32() -> f32 { - 6.0 -} - -#[wasm_bindgen] -pub fn ret_f64() -> f64 { - 7.0 -} diff --git a/crates/cli/tests/reference/interface-types-integers.wat b/crates/cli/tests/reference/interface-types-integers.wat deleted file mode 100644 index e00118c037f..00000000000 --- a/crates/cli/tests/reference/interface-types-integers.wat +++ /dev/null @@ -1,81 +0,0 @@ -(module - (type (;0;) (func (result i32))) - (type (;1;) (func (result f32))) - (type (;2;) (func (result f64))) - (type (;3;) (func (param i32 i32 i32 i32 i32 i32 f32 f64))) - (func $integers (type 3) (param i32 i32 i32 i32 i32 i32 f32 f64)) - (func $ret_i8 (type 0) (result i32)) - (func $ret_u8 (type 0) (result i32)) - (func $ret_i16 (type 0) (result i32)) - (func $ret_u16 (type 0) (result i32)) - (func $ret_i32 (type 0) (result i32)) - (func $ret_u32 (type 0) (result i32)) - (func $ret_f32 (type 1) (result f32)) - (func $ret_f64 (type 2) (result f64)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "integers" (func $integers)) - (export "ret_i8" (func $ret_i8)) - (export "ret_u8" (func $ret_u8)) - (export "ret_i16" (func $ret_i16)) - (export "ret_u16" (func $ret_u16)) - (export "ret_i32" (func $ret_i32)) - (export "ret_u32" (func $ret_u32)) - (export "ret_f32" (func $ret_f32)) - (export "ret_f64" (func $ret_f64)) - (@interface type (;0;) (func (param u8) (param s8) (param u16) (param s16) (param u32) (param s32) (param f32) (param f64))) - (@interface type (;1;) (func (result s8))) - (@interface type (;2;) (func (result u8))) - (@interface type (;3;) (func (result s16))) - (@interface type (;4;) (func (result u16))) - (@interface type (;5;) (func (result s32))) - (@interface type (;6;) (func (result u32))) - (@interface type (;7;) (func (result f32))) - (@interface type (;8;) (func (result f64))) - (@interface func (;0;) (type 0) - arg.get 0 - u8-to-i32 - arg.get 1 - s8-to-i32 - arg.get 2 - u16-to-i32 - arg.get 3 - s16-to-i32 - arg.get 4 - u32-to-i32 - arg.get 5 - s32-to-i32 - arg.get 6 - arg.get 7 - call-core $integers) - (@interface func (;1;) (type 1) - call-core $ret_i8 - i32-to-s8) - (@interface func (;2;) (type 2) - call-core $ret_u8 - i32-to-u8) - (@interface func (;3;) (type 3) - call-core $ret_i16 - i32-to-s16) - (@interface func (;4;) (type 4) - call-core $ret_u16 - i32-to-u16) - (@interface func (;5;) (type 5) - call-core $ret_i32 - i32-to-s32) - (@interface func (;6;) (type 6) - call-core $ret_u32 - i32-to-u32) - (@interface func (;7;) (type 7) - call-core $ret_f32) - (@interface func (;8;) (type 8) - call-core $ret_f64) - (@interface export "integers" (func 0)) - (@interface export "ret_i8" (func 1)) - (@interface export "ret_u8" (func 2)) - (@interface export "ret_i16" (func 3)) - (@interface export "ret_u16" (func 4)) - (@interface export "ret_i32" (func 5)) - (@interface export "ret_u32" (func 6)) - (@interface export "ret_f32" (func 7)) - (@interface export "ret_f64" (func 8))) diff --git a/crates/cli/tests/reference/interface-types-interop.rs b/crates/cli/tests/reference/interface-types-interop.rs deleted file mode 100644 index 191426d54a6..00000000000 --- a/crates/cli/tests/reference/interface-types-interop.rs +++ /dev/null @@ -1,8 +0,0 @@ -// interface-types - -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn take_and_return(a: u8) -> u16 { - a.into() -} diff --git a/crates/cli/tests/reference/interface-types-interop.wat b/crates/cli/tests/reference/interface-types-interop.wat deleted file mode 100644 index 193b8f18e23..00000000000 --- a/crates/cli/tests/reference/interface-types-interop.wat +++ /dev/null @@ -1,13 +0,0 @@ -(module - (type (;0;) (func (param i32) (result i32))) - (func $take_and_return (type 0) (param i32) (result i32)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "take_and_return" (func $take_and_return)) - (@interface type (;0;) (func (param u8) (result u16))) - (@interface func (;0;) (type 0) - arg.get 0 - u8-to-i32 - call-core $take_and_return - i32-to-u16) - (@interface export "take_and_return" (func 0))) diff --git a/crates/cli/tests/reference/interface-types-strings.rs b/crates/cli/tests/reference/interface-types-strings.rs deleted file mode 100644 index d7a67f0f20e..00000000000 --- a/crates/cli/tests/reference/interface-types-strings.rs +++ /dev/null @@ -1,11 +0,0 @@ -// interface-types - -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn strings(a: &str) -> String { - String::new() -} - -#[wasm_bindgen] -pub fn many_strings(a: &str, b: String) {} diff --git a/crates/cli/tests/reference/interface-types-strings.wat b/crates/cli/tests/reference/interface-types-strings.wat deleted file mode 100644 index ddb2ce3d951..00000000000 --- a/crates/cli/tests/reference/interface-types-strings.wat +++ /dev/null @@ -1,29 +0,0 @@ -(module - (type (;0;) (func (param i32) (result i32))) - (type (;1;) (func (param i32 i32))) - (type (;2;) (func (param i32 i32) (result i32 i32))) - (type (;3;) (func (param i32 i32 i32 i32))) - (func $__wbindgen_malloc (type 0) (param i32) (result i32)) - (func $many_strings (type 3) (param i32 i32 i32 i32)) - (func $__wbindgen_free (type 1) (param i32 i32)) - (func $#func3 (@name "strings multivalue shim") (type 2) (param i32 i32) (result i32 i32)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "strings" (func $#func3)) - (export "many_strings" (func $many_strings)) - (@interface type (;0;) (func (param string) (result string))) - (@interface type (;1;) (func (param string) (param string))) - (@interface func (;0;) (type 0) - arg.get 0 - string-to-memory $__wbindgen_malloc - call-core $#func3 - defer-call-core $__wbindgen_free - memory-to-string) - (@interface func (;1;) (type 1) - arg.get 0 - string-to-memory $__wbindgen_malloc - arg.get 1 - string-to-memory $__wbindgen_malloc - call-core $many_strings) - (@interface export "strings" (func 0)) - (@interface export "many_strings" (func 1))) diff --git a/crates/cli/tests/reference/nop.wat b/crates/cli/tests/reference/nop.wat index 4ec164815de..82c51874819 100644 --- a/crates/cli/tests/reference/nop.wat +++ b/crates/cli/tests/reference/nop.wat @@ -1,6 +1,7 @@ (module (type (;0;) (func)) - (func $nop (type 0)) + (func $nop (;0;) (type 0)) (memory (;0;) 17) (export "memory" (memory 0)) - (export "nop" (func $nop))) + (export "nop" (func $nop)) +) diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 6d28e06c7e4..3415b902951 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -65,6 +65,8 @@ function getStringFromWasm0(ptr, len) { * @returns {string} */ export function exported() { + let deferred2_0; + let deferred2_1; try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.exported(retptr); @@ -72,16 +74,18 @@ export function exported() { var r1 = getInt32Memory0()[retptr / 4 + 1]; var r2 = getInt32Memory0()[retptr / 4 + 2]; var r3 = getInt32Memory0()[retptr / 4 + 3]; - var ptr0 = r0; - var len0 = r1; + var ptr1 = r0; + var len1 = r1; if (r3) { - ptr0 = 0; len0 = 0; + ptr1 = 0; len1 = 0; throw takeObject(r2); } - return getStringFromWasm0(ptr0, len0); + deferred2_0 = ptr1; + deferred2_1 = len1; + return getStringFromWasm0(ptr1, len1); } finally { wasm.__wbindgen_add_to_stack_pointer(16); - wasm.__wbindgen_free(ptr0, len0); + wasm.__wbindgen_free(deferred2_0, deferred2_1); } } diff --git a/crates/cli/tests/reference/result-string.wat b/crates/cli/tests/reference/result-string.wat index efe5e65189c..00277c9f806 100644 --- a/crates/cli/tests/reference/result-string.wat +++ b/crates/cli/tests/reference/result-string.wat @@ -2,11 +2,12 @@ (type (;0;) (func (param i32))) (type (;1;) (func (param i32) (result i32))) (type (;2;) (func (param i32 i32))) - (func $exported (type 0) (param i32)) - (func $__wbindgen_free (type 2) (param i32 i32)) - (func $__wbindgen_add_to_stack_pointer (type 1) (param i32) (result i32)) + (func $exported (;0;) (type 0) (param i32)) + (func $__wbindgen_free (;1;) (type 2) (param i32 i32)) + (func $__wbindgen_add_to_stack_pointer (;2;) (type 1) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) - (export "__wbindgen_free" (func $__wbindgen_free))) + (export "__wbindgen_free" (func $__wbindgen_free)) +) diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index bac987a58bd..31d66a20de3 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -1,6 +1,7 @@ (module (type (;0;) (func (param i32) (result i32))) - (func $docme (type 0) (param i32) (result i32)) + (func $docme (;0;) (type 0) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) - (export "docme" (func $docme))) + (export "docme" (func $docme)) +) diff --git a/crates/cli/tests/reference/string-arg.wat b/crates/cli/tests/reference/string-arg.wat index bf24ad9158c..bc970113904 100644 --- a/crates/cli/tests/reference/string-arg.wat +++ b/crates/cli/tests/reference/string-arg.wat @@ -2,11 +2,12 @@ (type (;0;) (func (param i32) (result i32))) (type (;1;) (func (param i32 i32))) (type (;2;) (func (param i32 i32 i32) (result i32))) - (func $__wbindgen_realloc (type 2) (param i32 i32 i32) (result i32)) - (func $__wbindgen_malloc (type 0) (param i32) (result i32)) - (func $foo (type 1) (param i32 i32)) + (func $__wbindgen_realloc (;0;) (type 2) (param i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;1;) (type 0) (param i32) (result i32)) + (func $foo (;2;) (type 1) (param i32 i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "foo" (func $foo)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) - (export "__wbindgen_realloc" (func $__wbindgen_realloc))) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) +) diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index c6cf4131954..31ebc606340 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -414,143 +414,6 @@ fn omit_default_module_path_target_no_modules() { )); } -#[test] -fn empty_interface_types() { - let (mut cmd, _out_dir) = Project::new("empty_interface_types") - .file( - "src/lib.rs", - r#" - #[no_mangle] - pub extern fn foo() {} - "#, - ) - .file( - "Cargo.toml", - &format!( - " - [package] - name = \"empty_interface_types\" - authors = [] - version = \"1.0.0\" - edition = '2018' - - [dependencies] - wasm-bindgen = {{ path = '{}' }} - - [lib] - crate-type = ['cdylib'] - - [workspace] - ", - repo_root().display(), - ), - ) - .wasm_bindgen(""); - cmd.env("WASM_INTERFACE_TYPES", "1"); - cmd.assert().success(); -} - -#[test] -fn bad_interface_types_export() -> anyhow::Result<()> { - let (mut cmd, _out_dir) = Project::new("bad_interface_types_export") - .file( - "src/lib.rs", - r#" - use wasm_bindgen::prelude::*; - - #[wasm_bindgen] - pub fn foo(a: Vec) {} - "#, - ) - .file( - "Cargo.toml", - &format!( - " - [package] - name = \"bad_interface_types_export\" - authors = [] - version = \"1.0.0\" - edition = '2018' - - [lib] - crate-type = [\"cdylib\"] - - [dependencies] - wasm-bindgen = {{ path = '{}' }} - - [workspace] - ", - repo_root().display(), - ), - ) - .wasm_bindgen(""); - cmd.env("WASM_INTERFACE_TYPES", "1"); - cmd.assert().failure().code(1).stderr(str::is_match( - "\ -error: failed to generate a standard interface types section - -Caused by: - 0: in function export `foo` - 1: type Vector\\(U8\\) isn't supported in standard interface types -$", - )?); - Ok(()) -} - -#[test] -fn bad_interface_types_import() -> anyhow::Result<()> { - let (mut cmd, _out_dir) = Project::new("bad_interface_types_import") - .file( - "src/lib.rs", - r#" - use wasm_bindgen::prelude::*; - - #[wasm_bindgen] - extern "C" { - pub fn foo() -> Vec; - } - - #[wasm_bindgen] - pub fn bar() { - foo(); - } - "#, - ) - .file( - "Cargo.toml", - &format!( - " - [package] - name = \"bad_interface_types_import\" - authors = [] - version = \"1.0.0\" - edition = '2018' - - [lib] - crate-type = [\"cdylib\"] - - [dependencies] - wasm-bindgen = {{ path = '{}' }} - - [workspace] - ", - repo_root().display(), - ), - ) - .wasm_bindgen(""); - cmd.env("WASM_INTERFACE_TYPES", "1"); - cmd.assert().failure().code(1).stderr(str::is_match( - "\ -error: failed to generate a standard interface types section - -Caused by: - 0: in adapter function - 1: import of global `foo` requires JS glue -$", - )?); - Ok(()) -} - #[test] fn function_table_preserved() { let (mut cmd, _out_dir) = Project::new("function_table_preserved") diff --git a/crates/externref-xform/tests/anyref-param-owned.wat b/crates/externref-xform/tests/anyref-param-owned.wat index 649e30f506d..e61883d71da 100644 --- a/crates/externref-xform/tests/anyref-param-owned.wat +++ b/crates/externref-xform/tests/anyref-param-owned.wat @@ -12,17 +12,20 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (type 2) (param externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 0 local.get 1 - call $foo) - (func $alloc (type 0) (result i32) - i32.const 0) - (func $foo (type 1) (param i32)) + call $foo + ) + (func $alloc (;1;) (type 0) (result i32) + i32.const 0 + ) + (func $foo (;2;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/anyref-param.wat b/crates/externref-xform/tests/anyref-param.wat index 9f8f92a9cdf..02e1eb4c050 100644 --- a/crates/externref-xform/tests/anyref-param.wat +++ b/crates/externref-xform/tests/anyref-param.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (param i32))) (type (;1;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (type 1) (param externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 1) (param externref) (local i32) global.get 0 i32.const 1 @@ -29,9 +29,11 @@ local.get 1 i32.const 1 i32.add - global.set 0) - (func $foo (type 0) (param i32)) + global.set 0 + ) + (func $foo (;1;) (type 0) (param i32)) (table (;0;) 128 externref) (global (;0;) (mut i32) i32.const 128) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/clone-ref-intrinsic.wat b/crates/externref-xform/tests/clone-ref-intrinsic.wat index 10d51d315a4..e62fabdc164 100644 --- a/crates/externref-xform/tests/clone-ref-intrinsic.wat +++ b/crates/externref-xform/tests/clone-ref-intrinsic.wat @@ -17,7 +17,7 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param i32) (result i32))) (type (;3;) (func (param externref) (result externref))) - (func $#func0 (@name "foo externref shim") (type 3) (param externref) (result externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 3) (param externref) (result externref) (local i32) call $alloc local.tee 1 @@ -28,21 +28,26 @@ local.tee 1 table.get 0 local.get 1 - call $dealloc) - (func $__wbindgen_object_clone_ref (type 2) (param i32) (result i32) + call $dealloc + ) + (func $__wbindgen_object_clone_ref (;1;) (type 2) (param i32) (result i32) (local i32) call $alloc local.tee 1 local.get 0 table.get 0 table.set 0 - local.get 1) - (func $foo (type 2) (param i32) (result i32) + local.get 1 + ) + (func $foo (;2;) (type 2) (param i32) (result i32) local.get 0 - call $__wbindgen_object_clone_ref) - (func $alloc (type 0) (result i32) - i32.const 0) - (func $dealloc (type 1) (param i32)) + call $__wbindgen_object_clone_ref + ) + (func $alloc (;3;) (type 0) (result i32) + i32.const 0 + ) + (func $dealloc (;4;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/drop-ref-intrinsic.wat b/crates/externref-xform/tests/drop-ref-intrinsic.wat index 3b4756ddaa7..782c85419f8 100644 --- a/crates/externref-xform/tests/drop-ref-intrinsic.wat +++ b/crates/externref-xform/tests/drop-ref-intrinsic.wat @@ -16,20 +16,24 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (type 2) (param externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 0 local.get 1 - call $foo) - (func $foo (type 1) (param i32) + call $foo + ) + (func $foo (;1;) (type 1) (param i32) local.get 0 - call $dealloc) - (func $alloc (type 0) (result i32) - i32.const 0) - (func $dealloc (type 1) (param i32)) + call $dealloc + ) + (func $alloc (;2;) (type 0) (result i32) + i32.const 0 + ) + (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/import-anyref-owned.wat b/crates/externref-xform/tests/import-anyref-owned.wat index 26ba0f7a1c8..b77bd7e7655 100644 --- a/crates/externref-xform/tests/import-anyref-owned.wat +++ b/crates/externref-xform/tests/import-anyref-owned.wat @@ -15,17 +15,20 @@ (type (;0;) (func)) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (import "" "a" (func $a (type 2))) - (func $#func1 (@name "a externref shim") (type 1) (param i32) + (import "" "a" (func $a (;0;) (type 2))) + (func $#func1 (@name "a externref shim") (;1;) (type 1) (param i32) local.get 0 table.get 0 local.get 0 call $dealloc - call $a) + call $a + ) (func (;2;) (type 0) i32.const 0 - call $#func1) - (func $dealloc (type 1) (param i32)) + call $#func1 + ) + (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func 2))) + (export "foo" (func 2)) +) ;) diff --git a/crates/externref-xform/tests/import-anyref-ret.wat b/crates/externref-xform/tests/import-anyref-ret.wat index 2f229ecfad4..14878d3444c 100644 --- a/crates/externref-xform/tests/import-anyref-ret.wat +++ b/crates/externref-xform/tests/import-anyref-ret.wat @@ -13,8 +13,8 @@ (module (type (;0;) (func (result i32))) (type (;1;) (func (result externref))) - (import "" "a" (func $a (type 1))) - (func $#func1 (@name "a externref shim") (type 0) (result i32) + (import "" "a" (func $a (;0;) (type 1))) + (func $#func1 (@name "a externref shim") (;1;) (type 0) (result i32) (local i32 externref) call $a local.set 1 @@ -22,11 +22,15 @@ local.tee 0 local.get 1 table.set 0 - local.get 0) + local.get 0 + ) (func (;2;) (type 0) (result i32) - call $#func1) - (func $alloc (type 0) (result i32) - i32.const 0) + call $#func1 + ) + (func $alloc (;3;) (type 0) (result i32) + i32.const 0 + ) (table (;0;) 128 externref) - (export "foo" (func 2))) + (export "foo" (func 2)) +) ;) diff --git a/crates/externref-xform/tests/import-anyref.wat b/crates/externref-xform/tests/import-anyref.wat index 3ca2dc6c705..55fe31976bb 100644 --- a/crates/externref-xform/tests/import-anyref.wat +++ b/crates/externref-xform/tests/import-anyref.wat @@ -15,14 +15,17 @@ (type (;0;) (func)) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (import "" "a" (func $a (type 2))) - (func $#func1 (@name "a externref shim") (type 1) (param i32) + (import "" "a" (func $a (;0;) (type 2))) + (func $#func1 (@name "a externref shim") (;1;) (type 1) (param i32) local.get 0 table.get 0 - call $a) + call $a + ) (func (;2;) (type 0) i32.const 0 - call $#func1) + call $#func1 + ) (table (;0;) 128 externref) - (export "foo" (func 2))) + (export "foo" (func 2)) +) ;) diff --git a/crates/externref-xform/tests/mixed-export.wat b/crates/externref-xform/tests/mixed-export.wat index 34f8130d971..e1ed4014c42 100644 --- a/crates/externref-xform/tests/mixed-export.wat +++ b/crates/externref-xform/tests/mixed-export.wat @@ -12,7 +12,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param f32 i32 i64 i32 i32))) (type (;2;) (func (param f32 externref i64 externref i32))) - (func $#func0 (@name "a externref shim") (type 2) (param f32 externref i64 externref i32) + (func $#func0 (@name "a externref shim") (;0;) (type 2) (param f32 externref i64 externref i32) (local i32 i32) global.get 0 i32.const 1 @@ -38,11 +38,14 @@ local.get 5 i32.const 1 i32.add - global.set 0) - (func $alloc (type 0) (result i32) - i32.const 0) - (func $a (type 1) (param f32 i32 i64 i32 i32)) + global.set 0 + ) + (func $alloc (;1;) (type 0) (result i32) + i32.const 0 + ) + (func $a (;2;) (type 1) (param f32 i32 i64 i32 i32)) (table (;0;) 128 externref) (global (;0;) (mut i32) i32.const 128) - (export "a" (func $#func0))) + (export "a" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/mixed.wat b/crates/externref-xform/tests/mixed.wat index 96a8f38ae38..5eba64fd171 100644 --- a/crates/externref-xform/tests/mixed.wat +++ b/crates/externref-xform/tests/mixed.wat @@ -20,8 +20,8 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param f32 i32 i64 i32 i32))) (type (;3;) (func (param f32 externref i64 externref i32))) - (import "" "a" (func $a (type 3))) - (func $#func1 (@name "a externref shim") (type 2) (param f32 i32 i64 i32 i32) + (import "" "a" (func $a (;0;) (type 3))) + (func $#func1 (@name "a externref shim") (;1;) (type 2) (param f32 i32 i64 i32 i32) local.get 0 local.get 1 table.get 0 @@ -31,15 +31,18 @@ local.get 3 call $dealloc local.get 4 - call $a) + call $a + ) (func (;2;) (type 0) f32.const 0x1p+0 (;=1;) i32.const 2 i64.const 3 i32.const 4 i32.const 5 - call $#func1) - (func $dealloc (type 1) (param i32)) + call $#func1 + ) + (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func 2))) + (export "foo" (func 2)) +) ;) diff --git a/crates/externref-xform/tests/ret-anyref.wat b/crates/externref-xform/tests/ret-anyref.wat index 19acfc3de32..811c46b9a37 100644 --- a/crates/externref-xform/tests/ret-anyref.wat +++ b/crates/externref-xform/tests/ret-anyref.wat @@ -14,16 +14,19 @@ (type (;0;) (func (result i32))) (type (;1;) (func (result externref))) (type (;2;) (func (param i32))) - (func $#func0 (@name "foo externref shim") (type 1) (result externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 1) (result externref) (local i32) call $foo local.tee 0 table.get 0 local.get 0 - call $dealloc) - (func $foo (type 0) (result i32) - i32.const 0) - (func $dealloc (type 2) (param i32)) + call $dealloc + ) + (func $foo (;1;) (type 0) (result i32) + i32.const 0 + ) + (func $dealloc (;2;) (type 2) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/table-grow-intrinsic.wat b/crates/externref-xform/tests/table-grow-intrinsic.wat index ff1f4db5781..ec7cc07ce0b 100644 --- a/crates/externref-xform/tests/table-grow-intrinsic.wat +++ b/crates/externref-xform/tests/table-grow-intrinsic.wat @@ -17,24 +17,28 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $foo (type 1) (param i32) + (func $foo (;0;) (type 1) (param i32) (local i32) i32.const 0 local.set 1 ref.null extern local.get 1 table.grow 0 - drop) - (func $#func1 (@name "foo externref shim") (type 2) (param externref) + drop + ) + (func $#func1 (@name "foo externref shim") (;1;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 0 local.get 1 - call $foo) - (func $alloc (type 0) (result i32) - i32.const 0) + call $foo + ) + (func $alloc (;2;) (type 0) (result i32) + i32.const 0 + ) (table (;0;) 128 externref) - (export "foo" (func $#func1))) + (export "foo" (func $#func1)) +) ;) diff --git a/crates/externref-xform/tests/table-set-null-intrinsic.wat b/crates/externref-xform/tests/table-set-null-intrinsic.wat index 6ca40e0ea57..3f5cf954986 100644 --- a/crates/externref-xform/tests/table-set-null-intrinsic.wat +++ b/crates/externref-xform/tests/table-set-null-intrinsic.wat @@ -16,20 +16,24 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (type 2) (param externref) + (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 0 local.get 1 - call $foo) - (func $foo (type 1) (param i32) + call $foo + ) + (func $foo (;1;) (type 1) (param i32) local.get 0 ref.null extern - table.set 0) - (func $alloc (type 0) (result i32) - i32.const 0) + table.set 0 + ) + (func $alloc (;2;) (type 0) (result i32) + i32.const 0 + ) (table (;0;) 128 externref) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/externref-xform/tests/table.wat b/crates/externref-xform/tests/table.wat index 0f0578666dd..1acda79e6f6 100644 --- a/crates/externref-xform/tests/table.wat +++ b/crates/externref-xform/tests/table.wat @@ -14,20 +14,23 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "closure0 externref shim") (type 2) (param externref) + (func $#func0 (@name "closure0 externref shim") (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 1 local.get 1 - call $foo) - (func $alloc (type 0) (result i32) - i32.const 0) - (func $foo (type 1) (param i32)) + call $foo + ) + (func $alloc (;1;) (type 0) (result i32) + i32.const 0 + ) + (func $foo (;2;) (type 1) (param i32)) (table (;0;) 2 funcref) (table (;1;) 128 externref) (export "func" (table 0)) (elem (;0;) (i32.const 0) func $foo) - (elem (;1;) (i32.const 1) func $#func0)) + (elem (;1;) (i32.const 1) func $#func0) +) ;) diff --git a/crates/externref-xform/tests/tee-before-grow.wat b/crates/externref-xform/tests/tee-before-grow.wat index 5ac8415951d..b73ffe083fb 100644 --- a/crates/externref-xform/tests/tee-before-grow.wat +++ b/crates/externref-xform/tests/tee-before-grow.wat @@ -19,7 +19,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $foo (type 1) (param i32) + (func $foo (;0;) (type 1) (param i32) (local i32) i32.const 0 local.tee 0 @@ -27,17 +27,21 @@ ref.null extern local.get 1 table.grow 0 - drop) - (func $#func1 (@name "foo externref shim") (type 2) (param externref) + drop + ) + (func $#func1 (@name "foo externref shim") (;1;) (type 2) (param externref) (local i32) call $alloc local.tee 1 local.get 0 table.set 0 local.get 1 - call $foo) - (func $alloc (type 0) (result i32) - i32.const 0) + call $foo + ) + (func $alloc (;2;) (type 0) (result i32) + i32.const 0 + ) (table (;0;) 128 externref) - (export "foo" (func $#func1))) + (export "foo" (func $#func1)) +) ;) diff --git a/crates/multi-value-xform/tests/align.wat b/crates/multi-value-xform/tests/align.wat index 5c53ddaa458..4a5b9e18a86 100644 --- a/crates/multi-value-xform/tests/align.wat +++ b/crates/multi-value-xform/tests/align.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (result f64 i32 i64))) (type (;1;) (func (param i32))) - (func $#func0 (@name "foo multivalue shim") (type 0) (result f64 i32 i64) + (func $#func0 (@name "foo multivalue shim") (;0;) (type 0) (result f64 i32 i64) (local i32) global.get 0 i32.const 32 @@ -29,9 +29,11 @@ local.get 0 i32.const 32 i32.add - global.set 0) - (func $foo (type 1) (param i32)) + global.set 0 + ) + (func $foo (;1;) (type 1) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/multi-value-xform/tests/many.wat b/crates/multi-value-xform/tests/many.wat index df78e205ffb..680715f4a89 100644 --- a/crates/multi-value-xform/tests/many.wat +++ b/crates/multi-value-xform/tests/many.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (result i32 f32 f64 i64))) (type (;1;) (func (param i32))) - (func $#func0 (@name "foo multivalue shim") (type 0) (result i32 f32 f64 i64) + (func $#func0 (@name "foo multivalue shim") (;0;) (type 0) (result i32 f32 f64 i64) (local i32) global.get 0 i32.const 32 @@ -31,9 +31,11 @@ local.get 0 i32.const 32 i32.add - global.set 0) - (func $foo (type 1) (param i32)) + global.set 0 + ) + (func $foo (;1;) (type 1) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) - (export "foo" (func $#func0))) + (export "foo" (func $#func0)) +) ;) diff --git a/crates/multi-value-xform/tests/simple.wat b/crates/multi-value-xform/tests/simple.wat index 9e89e3c76ea..045bab590bb 100644 --- a/crates/multi-value-xform/tests/simple.wat +++ b/crates/multi-value-xform/tests/simple.wat @@ -20,7 +20,7 @@ (type (;2;) (func (result f32))) (type (;3;) (func (result f64))) (type (;4;) (func (param i32))) - (func $#func0 (@name "i32 multivalue shim") (type 0) (result i32) + (func $#func0 (@name "i32 multivalue shim") (;0;) (type 0) (result i32) (local i32) global.get 0 i32.const 16 @@ -34,8 +34,9 @@ local.get 0 i32.const 16 i32.add - global.set 0) - (func $#func1 (@name "i64 multivalue shim") (type 1) (result i64) + global.set 0 + ) + (func $#func1 (@name "i64 multivalue shim") (;1;) (type 1) (result i64) (local i32) global.get 0 i32.const 16 @@ -49,8 +50,9 @@ local.get 0 i32.const 16 i32.add - global.set 0) - (func $#func2 (@name "f32 multivalue shim") (type 2) (result f32) + global.set 0 + ) + (func $#func2 (@name "f32 multivalue shim") (;2;) (type 2) (result f32) (local i32) global.get 0 i32.const 16 @@ -64,8 +66,9 @@ local.get 0 i32.const 16 i32.add - global.set 0) - (func $#func3 (@name "f64 multivalue shim") (type 3) (result f64) + global.set 0 + ) + (func $#func3 (@name "f64 multivalue shim") (;3;) (type 3) (result f64) (local i32) global.get 0 i32.const 16 @@ -79,15 +82,17 @@ local.get 0 i32.const 16 i32.add - global.set 0) - (func $i32 (type 4) (param i32)) - (func $i64 (type 4) (param i32)) - (func $f32 (type 4) (param i32)) - (func $f64 (type 4) (param i32)) + global.set 0 + ) + (func $i32 (;4;) (type 4) (param i32)) + (func $i64 (;5;) (type 4) (param i32)) + (func $f32 (;6;) (type 4) (param i32)) + (func $f64 (;7;) (type 4) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) (export "i32" (func $#func0)) (export "i64" (func $#func1)) (export "f32" (func $#func2)) - (export "f64" (func $#func3))) + (export "f64" (func $#func3)) +) ;) From 37a24408f59185079ad13673f8c4a840b82c40e2 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 11 Apr 2023 21:19:11 +0200 Subject: [PATCH 188/641] Implement `requestAnimationFrame` for `DedicatedWorkerGlobalScope` (#3378) --- .../gen_DedicatedWorkerGlobalScope.rs | 20 +++++++++++ crates/web-sys/src/features/gen_Window.rs | 34 +++++++++---------- .../webidls/enabled/AnimationFrame.webidl | 10 ++++++ crates/web-sys/webidls/enabled/Window.webidl | 8 ----- 4 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 crates/web-sys/webidls/enabled/AnimationFrame.webidl diff --git a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs index c16c3690d28..f87278c46e3 100644 --- a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs @@ -77,4 +77,24 @@ extern "C" { message: &::wasm_bindgen::JsValue, transfer: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "DedicatedWorkerGlobalScope" , js_name = cancelAnimationFrame)] + #[doc = "The `cancelAnimationFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"] + pub fn cancel_animation_frame( + this: &DedicatedWorkerGlobalScope, + handle: i32, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "DedicatedWorkerGlobalScope" , js_name = requestAnimationFrame)] + #[doc = "The `requestAnimationFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"] + pub fn request_animation_frame( + this: &DedicatedWorkerGlobalScope, + callback: &::js_sys::Function, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 724f293baf6..92a714e3699 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1966,13 +1966,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn blur(this: &Window) -> Result<(), JsValue>; - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = cancelAnimationFrame)] - #[doc = "The `cancelAnimationFrame()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn cancel_animation_frame(this: &Window, handle: i32) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "Window" , js_name = cancelIdleCallback)] #[doc = "The `cancelIdleCallback()` method."] #[doc = ""] @@ -2167,16 +2160,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn release_events(this: &Window); - # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = requestAnimationFrame)] - #[doc = "The `requestAnimationFrame()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn request_animation_frame( - this: &Window, - callback: &::js_sys::Function, - ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = requestIdleCallback)] #[doc = "The `requestIdleCallback()` method."] #[doc = ""] @@ -2293,6 +2276,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn get(this: &Window, name: &str) -> Option<::js_sys::Object>; + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = cancelAnimationFrame)] + #[doc = "The `cancelAnimationFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + pub fn cancel_animation_frame(this: &Window, handle: i32) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = requestAnimationFrame)] + #[doc = "The `requestAnimationFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + pub fn request_animation_frame( + this: &Window, + callback: &::js_sys::Function, + ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = atob)] #[doc = "The `atob()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/AnimationFrame.webidl b/crates/web-sys/webidls/enabled/AnimationFrame.webidl new file mode 100644 index 00000000000..6f81d3e1fc7 --- /dev/null +++ b/crates/web-sys/webidls/enabled/AnimationFrame.webidl @@ -0,0 +1,10 @@ +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames + +callback FrameRequestCallback = undefined (DOMHighResTimeStamp time); + +interface mixin AnimationFrameProvider { + [Throws] long requestAnimationFrame(FrameRequestCallback callback); + [Throws] undefined cancelAnimationFrame(long handle); +}; +Window includes AnimationFrameProvider; +DedicatedWorkerGlobalScope includes AnimationFrameProvider; diff --git a/crates/web-sys/webidls/enabled/Window.webidl b/crates/web-sys/webidls/enabled/Window.webidl index d2985fca949..fb8735f8b50 100644 --- a/crates/web-sys/webidls/enabled/Window.webidl +++ b/crates/web-sys/webidls/enabled/Window.webidl @@ -9,7 +9,6 @@ * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html * http://dev.w3.org/csswg/cssom/ * http://dev.w3.org/csswg/cssom-view/ - * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html @@ -196,13 +195,6 @@ partial interface Window { [Replaceable] readonly attribute double devicePixelRatio; }; -// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html -partial interface Window { - [Throws] long requestAnimationFrame(FrameRequestCallback callback); - [Throws] undefined cancelAnimationFrame(long handle); -}; -callback FrameRequestCallback = undefined (DOMHighResTimeStamp time); - // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html partial interface Window { [Replaceable, Pure, StoreInSlot] readonly attribute Performance? performance; From ab5da24e235338876a100ffcea06c3aaf33e6d6a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 11 Apr 2023 21:43:09 +0200 Subject: [PATCH 189/641] Add attribute for custom path to `wasm_bindgen` (#3360) --- crates/backend/src/ast.rs | 43 +++- crates/backend/src/codegen.rs | 236 ++++++++++++---------- crates/macro-support/src/lib.rs | 51 ++++- crates/macro-support/src/parser.rs | 89 ++++++-- crates/macro/ui-tests/wasm-bindgen.rs | 43 ++++ crates/macro/ui-tests/wasm-bindgen.stderr | 19 ++ 6 files changed, 351 insertions(+), 130 deletions(-) create mode 100644 crates/macro/ui-tests/wasm-bindgen.rs create mode 100644 crates/macro/ui-tests/wasm-bindgen.stderr diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 9e2d0b173e2..9b37cf16532 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -5,12 +5,13 @@ use crate::{util::ShortHash, Diagnostic}; use proc_macro2::{Ident, Span}; use std::hash::{Hash, Hasher}; +use syn::Path; use wasm_bindgen_shared as shared; /// An abstract syntax tree representing a rust program. Contains /// extra information for joining up this rust code with javascript. #[cfg_attr(feature = "extra-traits", derive(Debug))] -#[derive(Default, Clone)] +#[derive(Clone)] pub struct Program { /// rust -> js interfaces pub exports: Vec, @@ -26,6 +27,26 @@ pub struct Program { pub typescript_custom_sections: Vec, /// Inline JS snippets pub inline_js: Vec, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, + /// Path to wasm_bindgen_futures + pub wasm_bindgen_futures: Path, +} + +impl Default for Program { + fn default() -> Self { + Self { + exports: Default::default(), + imports: Default::default(), + linked_modules: Default::default(), + enums: Default::default(), + structs: Default::default(), + typescript_custom_sections: Default::default(), + inline_js: Default::default(), + wasm_bindgen: syn::parse_quote! { wasm_bindgen }, + wasm_bindgen_futures: syn::parse_quote! { wasm_bindgen_futures }, + } + } } impl Program { @@ -77,6 +98,10 @@ pub struct Export { /// Whether or not this function should be flagged as the wasm start /// function. pub start: bool, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, + /// Path to wasm_bindgen_futures + pub wasm_bindgen_futures: Path, } /// The 3 types variations of `self`. @@ -166,6 +191,10 @@ pub struct ImportFunction { pub shim: Ident, /// The doc comment on this import, if one is provided pub doc_comment: String, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, + /// Path to wasm_bindgen_futures + pub wasm_bindgen_futures: Path, } /// The type of a function being imported @@ -237,6 +266,8 @@ pub struct ImportStatic { pub rust_name: Ident, /// The name of this static on the JS side pub js_name: String, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// The metadata for a type being imported @@ -265,6 +296,8 @@ pub struct ImportType { pub vendor_prefixes: Vec, /// If present, don't generate a `Deref` impl pub no_deref: bool, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// The metadata for an Enum being imported @@ -281,6 +314,8 @@ pub struct ImportEnum { pub variant_values: Vec, /// Attributes to apply to the Rust enum pub rust_attrs: Vec, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// Information about a function being imported or exported @@ -329,6 +364,8 @@ pub struct Struct { pub is_inspectable: bool, /// Whether to generate a typescript definition for this struct pub generate_typescript: bool, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// The field of a struct @@ -361,6 +398,8 @@ pub struct StructField { /// If this is `Some`, the auto-generated getter for this field must clone /// the field instead of copying it. pub getter_with_clone: Option, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// Information about an Enum being exported @@ -379,6 +418,8 @@ pub struct Enum { pub hole: u32, /// Whether to generate a typescript definition for this enum pub generate_typescript: bool, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, } /// The variant of an enum diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index d9e3d9bd301..c3f3bf7d8ec 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -43,7 +43,11 @@ impl TryToTokens for ast::Program { } } for i in self.imports.iter() { - DescribeImport { kind: &i.kind }.to_tokens(tokens); + DescribeImport { + kind: &i.kind, + wasm_bindgen: &self.wasm_bindgen, + } + .to_tokens(tokens); // If there is a js namespace, check that name isn't a type. If it is, // this import might be a method on that type. @@ -137,7 +141,8 @@ impl TryToTokens for ast::LinkToModule { self.0.try_to_tokens(&mut program)?; let link_function_name = self.0.link_function_name(0); let name = Ident::new(&link_function_name, Span::call_site()); - let abi_ret = quote! { ::Abi }; + let wasm_bindgen = &self.0.wasm_bindgen; + let abi_ret = quote! { ::Abi }; let extern_fn = extern_fn(&name, &[], &[], &[], abi_ret); (quote! { { @@ -145,7 +150,7 @@ impl TryToTokens for ast::LinkToModule { #extern_fn unsafe { - ::from_abi(#name()) + ::from_abi(#name()) } } }) @@ -162,18 +167,19 @@ impl ToTokens for ast::Struct { let name_chars = name_str.chars().map(|c| c as u32); let new_fn = Ident::new(&shared::new_function(&name_str), Span::call_site()); let free_fn = Ident::new(&shared::free_function(&name_str), Span::call_site()); + let wasm_bindgen = &self.wasm_bindgen; (quote! { #[automatically_derived] - impl wasm_bindgen::describe::WasmDescribe for #name { + impl #wasm_bindgen::describe::WasmDescribe for #name { fn describe() { - use wasm_bindgen::__wbindgen_if_not_std; + use #wasm_bindgen::__wbindgen_if_not_std; __wbindgen_if_not_std! { compile_error! { "exporting a class to JS requires the `std` feature to \ be enabled in the `wasm-bindgen` crate" } } - use wasm_bindgen::describe::*; + use #wasm_bindgen::describe::*; inform(RUST_STRUCT); inform(#name_len); #(inform(#name_chars);)* @@ -181,23 +187,23 @@ impl ToTokens for ast::Struct { } #[automatically_derived] - impl wasm_bindgen::convert::IntoWasmAbi for #name { + impl #wasm_bindgen::convert::IntoWasmAbi for #name { type Abi = u32; fn into_abi(self) -> u32 { - use wasm_bindgen::__rt::std::boxed::Box; - use wasm_bindgen::__rt::WasmRefCell; + use #wasm_bindgen::__rt::std::boxed::Box; + use #wasm_bindgen::__rt::WasmRefCell; Box::into_raw(Box::new(WasmRefCell::new(self))) as u32 } } #[automatically_derived] - impl wasm_bindgen::convert::FromWasmAbi for #name { + impl #wasm_bindgen::convert::FromWasmAbi for #name { type Abi = u32; unsafe fn from_abi(js: u32) -> Self { - use wasm_bindgen::__rt::std::boxed::Box; - use wasm_bindgen::__rt::{assert_not_null, WasmRefCell}; + use #wasm_bindgen::__rt::std::boxed::Box; + use #wasm_bindgen::__rt::{assert_not_null, WasmRefCell}; let ptr = js as *mut WasmRefCell<#name>; assert_not_null(ptr); @@ -208,11 +214,11 @@ impl ToTokens for ast::Struct { } #[automatically_derived] - impl wasm_bindgen::__rt::core::convert::From<#name> for - wasm_bindgen::JsValue + impl #wasm_bindgen::__rt::core::convert::From<#name> for + #wasm_bindgen::JsValue { fn from(value: #name) -> Self { - let ptr = wasm_bindgen::convert::IntoWasmAbi::into_abi(value); + let ptr = #wasm_bindgen::convert::IntoWasmAbi::into_abi(value); #[link(wasm_import_module = "__wbindgen_placeholder__")] #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] @@ -226,7 +232,7 @@ impl ToTokens for ast::Struct { } unsafe { - + <#wasm_bindgen::JsValue as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#new_fn(ptr)) } } @@ -238,52 +244,52 @@ impl ToTokens for ast::Struct { #[no_mangle] #[doc(hidden)] pub unsafe extern "C" fn #free_fn(ptr: u32) { - let _ = <#name as wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); //implicit `drop()` + let _ = <#name as #wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); //implicit `drop()` } }; #[automatically_derived] - impl wasm_bindgen::convert::RefFromWasmAbi for #name { + impl #wasm_bindgen::convert::RefFromWasmAbi for #name { type Abi = u32; - type Anchor = wasm_bindgen::__rt::Ref<'static, #name>; + type Anchor = #wasm_bindgen::__rt::Ref<'static, #name>; unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor { - let js = js as *mut wasm_bindgen::__rt::WasmRefCell<#name>; - wasm_bindgen::__rt::assert_not_null(js); + let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; + #wasm_bindgen::__rt::assert_not_null(js); (*js).borrow() } } #[automatically_derived] - impl wasm_bindgen::convert::RefMutFromWasmAbi for #name { + impl #wasm_bindgen::convert::RefMutFromWasmAbi for #name { type Abi = u32; - type Anchor = wasm_bindgen::__rt::RefMut<'static, #name>; + type Anchor = #wasm_bindgen::__rt::RefMut<'static, #name>; unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor { - let js = js as *mut wasm_bindgen::__rt::WasmRefCell<#name>; - wasm_bindgen::__rt::assert_not_null(js); + let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; + #wasm_bindgen::__rt::assert_not_null(js); (*js).borrow_mut() } } #[automatically_derived] - impl wasm_bindgen::convert::LongRefFromWasmAbi for #name { + impl #wasm_bindgen::convert::LongRefFromWasmAbi for #name { type Abi = u32; - type Anchor = wasm_bindgen::__rt::Ref<'static, #name>; + type Anchor = #wasm_bindgen::__rt::Ref<'static, #name>; unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor { - ::ref_from_abi(js) + ::ref_from_abi(js) } } #[automatically_derived] - impl wasm_bindgen::convert::OptionIntoWasmAbi for #name { + impl #wasm_bindgen::convert::OptionIntoWasmAbi for #name { #[inline] fn none() -> Self::Abi { 0 } } #[automatically_derived] - impl wasm_bindgen::convert::OptionFromWasmAbi for #name { + impl #wasm_bindgen::convert::OptionFromWasmAbi for #name { #[inline] fn is_none(abi: &Self::Abi) -> bool { *abi == 0 } } @@ -316,16 +322,18 @@ impl ToTokens for ast::StructField { val = quote_spanned!(span=> <#ty as Clone>::clone(&#val) ); } + let wasm_bindgen = &self.wasm_bindgen; + (quote! { #[automatically_derived] const _: () = { #[cfg_attr(all(target_arch = "wasm32", not(target_os = "emscripten")), no_mangle)] #[doc(hidden)] pub unsafe extern "C" fn #getter(js: u32) - -> <#ty as wasm_bindgen::convert::IntoWasmAbi>::Abi + -> <#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi { - use wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; - use wasm_bindgen::convert::IntoWasmAbi; + use #wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; + use #wasm_bindgen::convert::IntoWasmAbi; fn assert_copy(){} #maybe_assert_copy; @@ -345,6 +353,7 @@ impl ToTokens for ast::StructField { <#ty as WasmDescribe>::describe(); }, attrs: vec![], + wasm_bindgen: &self.wasm_bindgen, } .to_tokens(tokens); @@ -360,10 +369,10 @@ impl ToTokens for ast::StructField { #[doc(hidden)] pub unsafe extern "C" fn #setter( js: u32, - val: <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi, + val: <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi, ) { - use wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; - use wasm_bindgen::convert::FromWasmAbi; + use #wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; + use #wasm_bindgen::convert::FromWasmAbi; let js = js as *mut WasmRefCell<#struct_name>; assert_not_null(js); @@ -393,12 +402,14 @@ impl TryToTokens for ast::Export { }; let name = &self.rust_name; + let wasm_bindgen = &self.wasm_bindgen; + let wasm_bindgen_futures = &self.wasm_bindgen_futures; let receiver = match self.method_self { Some(ast::MethodSelf::ByValue) => { let class = self.rust_class.as_ref().unwrap(); arg_conversions.push(quote! { let me = unsafe { - <#class as wasm_bindgen::convert::FromWasmAbi>::from_abi(me) + <#class as #wasm_bindgen::convert::FromWasmAbi>::from_abi(me) }; }); quote! { me.#name } @@ -407,7 +418,7 @@ impl TryToTokens for ast::Export { let class = self.rust_class.as_ref().unwrap(); arg_conversions.push(quote! { let mut me = unsafe { - <#class as wasm_bindgen::convert::RefMutFromWasmAbi> + <#class as #wasm_bindgen::convert::RefMutFromWasmAbi> ::ref_mut_from_abi(me) }; let me = &mut *me; @@ -418,7 +429,7 @@ impl TryToTokens for ast::Export { let class = self.rust_class.as_ref().unwrap(); arg_conversions.push(quote! { let me = unsafe { - <#class as wasm_bindgen::convert::RefFromWasmAbi> + <#class as #wasm_bindgen::convert::RefFromWasmAbi> ::ref_from_abi(me) }; let me = &*me; @@ -444,11 +455,11 @@ impl TryToTokens for ast::Export { .. }) => { args.push(quote! { - #ident: <#elem as wasm_bindgen::convert::RefMutFromWasmAbi>::Abi + #ident: <#elem as #wasm_bindgen::convert::RefMutFromWasmAbi>::Abi }); arg_conversions.push(quote! { let mut #ident = unsafe { - <#elem as wasm_bindgen::convert::RefMutFromWasmAbi> + <#elem as #wasm_bindgen::convert::RefMutFromWasmAbi> ::ref_mut_from_abi(#ident) }; let #ident = &mut *#ident; @@ -457,24 +468,24 @@ impl TryToTokens for ast::Export { syn::Type::Reference(syn::TypeReference { elem, .. }) => { if self.function.r#async { args.push(quote! { - #ident: <#elem as wasm_bindgen::convert::LongRefFromWasmAbi>::Abi + #ident: <#elem as #wasm_bindgen::convert::LongRefFromWasmAbi>::Abi }); arg_conversions.push(quote! { let #ident = unsafe { - <#elem as wasm_bindgen::convert::LongRefFromWasmAbi> + <#elem as #wasm_bindgen::convert::LongRefFromWasmAbi> ::long_ref_from_abi(#ident) }; - let #ident = <<#elem as wasm_bindgen::convert::LongRefFromWasmAbi> + let #ident = <<#elem as #wasm_bindgen::convert::LongRefFromWasmAbi> ::Anchor as core::borrow::Borrow<#elem>> ::borrow(&#ident); }); } else { args.push(quote! { - #ident: <#elem as wasm_bindgen::convert::RefFromWasmAbi>::Abi + #ident: <#elem as #wasm_bindgen::convert::RefFromWasmAbi>::Abi }); arg_conversions.push(quote! { let #ident = unsafe { - <#elem as wasm_bindgen::convert::RefFromWasmAbi> + <#elem as #wasm_bindgen::convert::RefFromWasmAbi> ::ref_from_abi(#ident) }; let #ident = &*#ident; @@ -483,11 +494,11 @@ impl TryToTokens for ast::Export { } _ => { args.push(quote! { - #ident: <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi + #ident: <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi }); arg_conversions.push(quote! { let #ident = unsafe { - <#ty as wasm_bindgen::convert::FromWasmAbi> + <#ty as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ident) }; }); @@ -513,15 +524,15 @@ impl TryToTokens for ast::Export { quote! { () }, quote! { () }, quote! { - <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret.await) + <#syn_ret as #wasm_bindgen::__rt::Start>::start(#ret.await) }, ) } else { ( - quote! { wasm_bindgen::JsValue }, + quote! { #wasm_bindgen::JsValue }, quote! { #syn_ret }, quote! { - <#syn_ret as wasm_bindgen::__rt::IntoJsResult>::into_js_result(#ret.await) + <#syn_ret as #wasm_bindgen::__rt::IntoJsResult>::into_js_result(#ret.await) }, ) } @@ -529,7 +540,7 @@ impl TryToTokens for ast::Export { ( quote! { () }, quote! { () }, - quote! { <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret) }, + quote! { <#syn_ret as #wasm_bindgen::__rt::Start>::start(#ret) }, ) } else { (quote! { #syn_ret }, quote! { #syn_ret }, quote! { #ret }) @@ -546,20 +557,20 @@ impl TryToTokens for ast::Export { if self.function.r#async { if self.start { call = quote! { - wasm_bindgen_futures::spawn_local(async move { + #wasm_bindgen_futures::spawn_local(async move { #call }) } } else { call = quote! { - wasm_bindgen_futures::future_to_promise(async move { + #wasm_bindgen_futures::future_to_promise(async move { #call }).into() } } } - let projection = quote! { <#ret_ty as wasm_bindgen::convert::ReturnWasmAbi> }; + let projection = quote! { <#ret_ty as #wasm_bindgen::convert::ReturnWasmAbi> }; let convert_ret = quote! { #projection::return_abi(#ret) }; let describe_ret = quote! { <#ret_ty as WasmDescribe>::describe(); @@ -635,6 +646,7 @@ impl TryToTokens for ast::Export { #describe_ret }, attrs: attrs.clone(), + wasm_bindgen: &self.wasm_bindgen, } .to_tokens(into); @@ -666,12 +678,13 @@ impl ToTokens for ast::ImportType { }; let instanceof_shim = Ident::new(&self.instanceof_shim, Span::call_site()); + let wasm_bindgen = &self.wasm_bindgen; let internal_obj = match self.extends.first() { Some(target) => { quote! { #target } } None => { - quote! { wasm_bindgen::JsValue } + quote! { #wasm_bindgen::JsValue } } }; @@ -679,7 +692,7 @@ impl ToTokens for ast::ImportType { let typescript_type_len = typescript_type.len() as u32; let typescript_type_chars = typescript_type.chars().map(|c| c as u32); quote! { - use wasm_bindgen::describe::*; + use #wasm_bindgen::describe::*; inform(NAMED_EXTERNREF); inform(#typescript_type_len); #(inform(#typescript_type_chars);)* @@ -713,12 +726,12 @@ impl ToTokens for ast::ImportType { #[automatically_derived] const _: () = { - use wasm_bindgen::convert::{IntoWasmAbi, FromWasmAbi}; - use wasm_bindgen::convert::{OptionIntoWasmAbi, OptionFromWasmAbi}; - use wasm_bindgen::convert::{RefFromWasmAbi, LongRefFromWasmAbi}; - use wasm_bindgen::describe::WasmDescribe; - use wasm_bindgen::{JsValue, JsCast, JsObject}; - use wasm_bindgen::__rt::core; + use #wasm_bindgen::convert::{IntoWasmAbi, FromWasmAbi}; + use #wasm_bindgen::convert::{OptionIntoWasmAbi, OptionFromWasmAbi}; + use #wasm_bindgen::convert::{RefFromWasmAbi, LongRefFromWasmAbi}; + use #wasm_bindgen::describe::WasmDescribe; + use #wasm_bindgen::{JsValue, JsCast, JsObject}; + use #wasm_bindgen::__rt::core; impl WasmDescribe for #rust_name { fn describe() { @@ -882,7 +895,7 @@ impl ToTokens for ast::ImportType { impl From<#rust_name> for #superclass { #[inline] fn from(obj: #rust_name) -> #superclass { - use wasm_bindgen::JsCast; + use #wasm_bindgen::JsCast; #superclass::unchecked_from_js(obj.into()) } } @@ -891,7 +904,7 @@ impl ToTokens for ast::ImportType { impl AsRef<#superclass> for #rust_name { #[inline] fn as_ref(&self) -> &#superclass { - use wasm_bindgen::JsCast; + use #wasm_bindgen::JsCast; #superclass::unchecked_from_js_ref(self.as_ref()) } } @@ -933,6 +946,8 @@ impl ToTokens for ast::ImportEnum { // Borrow variant_paths because we need to use it multiple times inside the quote! macro let variant_paths_ref = &variant_paths; + let wasm_bindgen = &self.wasm_bindgen; + (quote! { #(#attrs)* #vis enum #name { @@ -958,55 +973,55 @@ impl ToTokens for ast::ImportEnum { } } - #vis fn from_js_value(obj: &wasm_bindgen::JsValue) -> Option<#name> { + #vis fn from_js_value(obj: &#wasm_bindgen::JsValue) -> Option<#name> { obj.as_string().and_then(|obj_str| Self::from_str(obj_str.as_str())) } } // It should really be using &str for all of these, but that requires some major changes to cli-support #[automatically_derived] - impl wasm_bindgen::describe::WasmDescribe for #name { + impl #wasm_bindgen::describe::WasmDescribe for #name { fn describe() { - ::describe() + <#wasm_bindgen::JsValue as #wasm_bindgen::describe::WasmDescribe>::describe() } } #[automatically_derived] - impl wasm_bindgen::convert::IntoWasmAbi for #name { - type Abi = ::Abi; + impl #wasm_bindgen::convert::IntoWasmAbi for #name { + type Abi = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::IntoWasmAbi>::Abi; #[inline] fn into_abi(self) -> Self::Abi { - ::into_abi(self.into()) + <#wasm_bindgen::JsValue as #wasm_bindgen::convert::IntoWasmAbi>::into_abi(self.into()) } } #[automatically_derived] - impl wasm_bindgen::convert::FromWasmAbi for #name { - type Abi = ::Abi; + impl #wasm_bindgen::convert::FromWasmAbi for #name { + type Abi = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::FromWasmAbi>::Abi; unsafe fn from_abi(js: Self::Abi) -> Self { - let s = ::from_abi(js); + let s = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::FromWasmAbi>::from_abi(js); #name::from_js_value(&s).unwrap_or(#name::__Nonexhaustive) } } #[automatically_derived] - impl wasm_bindgen::convert::OptionIntoWasmAbi for #name { + impl #wasm_bindgen::convert::OptionIntoWasmAbi for #name { #[inline] - fn none() -> Self::Abi { <::js_sys::Object as wasm_bindgen::convert::OptionIntoWasmAbi>::none() } + fn none() -> Self::Abi { <::js_sys::Object as #wasm_bindgen::convert::OptionIntoWasmAbi>::none() } } #[automatically_derived] - impl wasm_bindgen::convert::OptionFromWasmAbi for #name { + impl #wasm_bindgen::convert::OptionFromWasmAbi for #name { #[inline] - fn is_none(abi: &Self::Abi) -> bool { <::js_sys::Object as wasm_bindgen::convert::OptionFromWasmAbi>::is_none(abi) } + fn is_none(abi: &Self::Abi) -> bool { <::js_sys::Object as #wasm_bindgen::convert::OptionFromWasmAbi>::is_none(abi) } } #[automatically_derived] - impl From<#name> for wasm_bindgen::JsValue { - fn from(obj: #name) -> wasm_bindgen::JsValue { - wasm_bindgen::JsValue::from(obj.to_str()) + impl From<#name> for #wasm_bindgen::JsValue { + fn from(obj: #name) -> #wasm_bindgen::JsValue { + #wasm_bindgen::JsValue::from(obj.to_str()) } } }).to_tokens(tokens); @@ -1042,6 +1057,8 @@ impl TryToTokens for ast::ImportFunction { let mut arg_conversions = Vec::new(); let mut arguments = Vec::new(); let ret_ident = Ident::new("_ret", Span::call_site()); + let wasm_bindgen = &self.wasm_bindgen; + let wasm_bindgen_futures = &self.wasm_bindgen_futures; for (i, arg) in self.function.arguments.iter().enumerate() { let ty = &arg.ty; @@ -1061,7 +1078,7 @@ impl TryToTokens for ast::ImportFunction { abi_argument_names.push(name.clone()); abi_arguments.push(quote! { - #name: <#ty as wasm_bindgen::convert::IntoWasmAbi>::Abi + #name: <#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi }); let var = if i == 0 && is_method { quote! { self } @@ -1070,7 +1087,7 @@ impl TryToTokens for ast::ImportFunction { quote! { #name } }; arg_conversions.push(quote! { - let #name = <#ty as wasm_bindgen::convert::IntoWasmAbi> + let #name = <#ty as #wasm_bindgen::convert::IntoWasmAbi> ::into_abi(#var); }); } @@ -1086,10 +1103,10 @@ impl TryToTokens for ast::ImportFunction { Some(ref ty) => { if self.function.r#async { abi_ret = - quote! { ::Abi }; + quote! { ::Abi }; let future = quote! { - wasm_bindgen_futures::JsFuture::from( - + #wasm_bindgen_futures::JsFuture::from( + ::from_abi(#ret_ident) ).await }; @@ -1100,10 +1117,10 @@ impl TryToTokens for ast::ImportFunction { }; } else { abi_ret = quote! { - <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi + <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi }; convert_ret = quote! { - <#ty as wasm_bindgen::convert::FromWasmAbi> + <#ty as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ret_ident) }; } @@ -1111,10 +1128,10 @@ impl TryToTokens for ast::ImportFunction { None => { if self.function.r#async { abi_ret = - quote! { ::Abi }; + quote! { ::Abi }; let future = quote! { - wasm_bindgen_futures::JsFuture::from( - + #wasm_bindgen_futures::JsFuture::from( + ::from_abi(#ret_ident) ).await }; @@ -1134,7 +1151,7 @@ impl TryToTokens for ast::ImportFunction { if self.catch && !self.function.r#async { convert_ret = quote! { Ok(#convert_ret) }; exceptional_ret = quote! { - wasm_bindgen::__rt::take_last_exception()?; + #wasm_bindgen::__rt::take_last_exception()?; }; } @@ -1228,6 +1245,7 @@ impl TryToTokens for ast::ImportFunction { // See comment above in ast::Export for what's going on here. struct DescribeImport<'a> { kind: &'a ast::ImportKind, + wasm_bindgen: &'a syn::Path, } impl<'a> ToTokens for DescribeImport<'a> { @@ -1258,6 +1276,7 @@ impl<'a> ToTokens for DescribeImport<'a> { #inform_ret }, attrs: f.function.rust_attrs.clone(), + wasm_bindgen: &self.wasm_bindgen, } .to_tokens(tokens); } @@ -1275,9 +1294,10 @@ impl ToTokens for ast::Enum { } } }); + let wasm_bindgen = &self.wasm_bindgen; (quote! { #[automatically_derived] - impl wasm_bindgen::convert::IntoWasmAbi for #enum_name { + impl #wasm_bindgen::convert::IntoWasmAbi for #enum_name { type Abi = u32; #[inline] @@ -1287,33 +1307,33 @@ impl ToTokens for ast::Enum { } #[automatically_derived] - impl wasm_bindgen::convert::FromWasmAbi for #enum_name { + impl #wasm_bindgen::convert::FromWasmAbi for #enum_name { type Abi = u32; #[inline] unsafe fn from_abi(js: u32) -> Self { #(#cast_clauses else)* { - wasm_bindgen::throw_str("invalid enum value passed") + #wasm_bindgen::throw_str("invalid enum value passed") } } } #[automatically_derived] - impl wasm_bindgen::convert::OptionFromWasmAbi for #enum_name { + impl #wasm_bindgen::convert::OptionFromWasmAbi for #enum_name { #[inline] fn is_none(val: &u32) -> bool { *val == #hole } } #[automatically_derived] - impl wasm_bindgen::convert::OptionIntoWasmAbi for #enum_name { + impl #wasm_bindgen::convert::OptionIntoWasmAbi for #enum_name { #[inline] fn none() -> Self::Abi { #hole } } #[automatically_derived] - impl wasm_bindgen::describe::WasmDescribe for #enum_name { + impl #wasm_bindgen::describe::WasmDescribe for #enum_name { fn describe() { - use wasm_bindgen::describe::*; + use #wasm_bindgen::describe::*; inform(ENUM); inform(#hole); } @@ -1329,26 +1349,27 @@ impl ToTokens for ast::ImportStatic { let ty = &self.ty; let shim_name = &self.shim; let vis = &self.vis; + let wasm_bindgen = &self.wasm_bindgen; (quote! { #[automatically_derived] - #vis static #name: wasm_bindgen::JsStatic<#ty> = { + #vis static #name: #wasm_bindgen::JsStatic<#ty> = { fn init() -> #ty { #[link(wasm_import_module = "__wbindgen_placeholder__")] #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] extern "C" { - fn #shim_name() -> <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi; + fn #shim_name() -> <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi; } #[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))] - unsafe fn #shim_name() -> <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi { + unsafe fn #shim_name() -> <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi { panic!("cannot access imported statics on non-wasm targets") } unsafe { - <#ty as wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name()) + <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name()) } } thread_local!(static _VAL: #ty = init();); - wasm_bindgen::JsStatic { + #wasm_bindgen::JsStatic { __inner: &_VAL, } }; @@ -1361,6 +1382,7 @@ impl ToTokens for ast::ImportStatic { <#ty as WasmDescribe>::describe(); }, attrs: vec![], + wasm_bindgen: &self.wasm_bindgen, } .to_tokens(into); } @@ -1372,6 +1394,7 @@ struct Descriptor<'a, T> { ident: &'a Ident, inner: T, attrs: Vec, + wasm_bindgen: &'a syn::Path, } impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { @@ -1399,6 +1422,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { let name = Ident::new(&format!("__wbindgen_describe_{}", ident), ident.span()); let inner = &self.inner; let attrs = &self.attrs; + let wasm_bindgen = &self.wasm_bindgen; (quote! { #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] #[automatically_derived] @@ -1407,9 +1431,9 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { #[no_mangle] #[doc(hidden)] pub extern "C" fn #name() { - use wasm_bindgen::describe::*; + use #wasm_bindgen::describe::*; // See definition of `link_mem_intrinsics` for what this is doing - wasm_bindgen::__rt::link_mem_intrinsics(); + #wasm_bindgen::__rt::link_mem_intrinsics(); #inner } }; diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index 5d937497b52..f44faa6ba7a 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -62,7 +62,7 @@ pub fn expand_class_marker( let opts: ClassMarker = syn::parse2(attr)?; let mut program = backend::ast::Program::default(); - item.macro_parse(&mut program, (&opts.class, &opts.js_class))?; + item.macro_parse(&mut program, &opts)?; // This is where things are slightly different, we are being expanded in the // context of an impl so we can't inject arbitrary item-like tokens into the @@ -105,6 +105,8 @@ pub fn expand_class_marker( struct ClassMarker { class: syn::Ident, js_class: String, + wasm_bindgen: syn::Path, + wasm_bindgen_futures: syn::Path, } impl Parse for ClassMarker { @@ -112,6 +114,51 @@ impl Parse for ClassMarker { let class = input.parse::()?; input.parse::()?; let js_class = input.parse::()?.value(); - Ok(ClassMarker { class, js_class }) + + let mut wasm_bindgen = None; + let mut wasm_bindgen_futures = None; + + loop { + if input.parse::>()?.is_some() { + let ident = input.parse::()?; + + if ident == "wasm_bindgen" { + if wasm_bindgen.is_some() { + return Err(syn::Error::new( + ident.span(), + "found duplicate `wasm_bindgen`", + )); + } + + input.parse::()?; + wasm_bindgen = Some(input.parse::()?); + } else if ident == "wasm_bindgen_futures" { + if wasm_bindgen_futures.is_some() { + return Err(syn::Error::new( + ident.span(), + "found duplicate `wasm_bindgen_futures`", + )); + } + + input.parse::()?; + wasm_bindgen_futures = Some(input.parse::()?); + } else { + return Err(syn::Error::new( + ident.span(), + "expected `wasm_bindgen` or `wasm_bindgen_futures`", + )); + } + } else { + break; + } + } + + Ok(ClassMarker { + class, + js_class, + wasm_bindgen: wasm_bindgen.unwrap_or_else(|| syn::parse_quote! { wasm_bindgen }), + wasm_bindgen_futures: wasm_bindgen_futures + .unwrap_or_else(|| syn::parse_quote! { wasm_bindgen_futures }), + }) } } diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index c63f7e0d783..2fcacb756e1 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -12,6 +12,8 @@ use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; use syn::{Lit, MacroDelimiter}; +use crate::ClassMarker; + thread_local!(static ATTRS: AttributeParseState = Default::default()); /// Javascript keywords which are not keywords in Rust. @@ -82,6 +84,8 @@ macro_rules! attrgen { (skip_typescript, SkipTypescript(Span)), (skip_jsdoc, SkipJsDoc(Span)), (start, Start(Span)), + (wasm_bindgen, WasmBindgen(Span, syn::Path)), + (wasm_bindgen_futures, WasmBindgenFutures(Span, syn::Path)), (skip, Skip(Span)), (typescript_type, TypeScriptType(Span, String, Span)), (getter_with_clone, GetterWithClone(Span)), @@ -392,10 +396,13 @@ trait ConvertToAst { fn convert(self, context: Ctx) -> Result; } -impl<'a> ConvertToAst for &'a mut syn::ItemStruct { +impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs)> for &'a mut syn::ItemStruct { type Target = ast::Struct; - fn convert(self, attrs: BindgenAttrs) -> Result { + fn convert( + self, + (program, attrs): (&ast::Program, BindgenAttrs), + ) -> Result { if self.generics.params.len() > 0 { bail_span!( self.generics, @@ -447,6 +454,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { generate_typescript: attrs.skip_typescript().is_none(), generate_jsdoc: attrs.skip_jsdoc().is_none(), getter_with_clone: attrs.getter_with_clone().or(getter_with_clone).copied(), + wasm_bindgen: program.wasm_bindgen.clone(), }); attrs.check_used(); } @@ -460,6 +468,7 @@ impl<'a> ConvertToAst for &'a mut syn::ItemStruct { comments, is_inspectable, generate_typescript, + wasm_bindgen: program.wasm_bindgen.clone(), }) } } @@ -480,12 +489,14 @@ fn get_expr(mut expr: &syn::Expr) -> &syn::Expr { expr } -impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::ForeignItemFn { +impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option)> + for syn::ForeignItemFn +{ type Target = ast::ImportKind; fn convert( self, - (opts, module): (BindgenAttrs, &'a Option), + (program, opts, module): (&ast::Program, BindgenAttrs, &'a Option), ) -> Result { let mut wasm = function_from_decl( &self.sig.ident, @@ -666,6 +677,8 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo rust_name: self.sig.ident.clone(), shim: Ident::new(&shim, Span::call_site()), doc_comment, + wasm_bindgen: program.wasm_bindgen.clone(), + wasm_bindgen_futures: program.wasm_bindgen_futures.clone(), }); opts.check_used(); @@ -673,10 +686,13 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo } } -impl ConvertToAst for syn::ForeignItemType { +impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType { type Target = ast::ImportKind; - fn convert(self, attrs: BindgenAttrs) -> Result { + fn convert( + self, + (program, attrs): (&ast::Program, BindgenAttrs), + ) -> Result { let js_name = attrs .js_name() .map(|s| s.0) @@ -713,16 +729,19 @@ impl ConvertToAst for syn::ForeignItemType { extends, vendor_prefixes, no_deref, + wasm_bindgen: program.wasm_bindgen.clone(), })) } } -impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::ForeignItemStatic { +impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option)> + for syn::ForeignItemStatic +{ type Target = ast::ImportKind; fn convert( self, - (opts, module): (BindgenAttrs, &'a Option), + (program, opts, module): (&ast::Program, BindgenAttrs, &'a Option), ) -> Result { if let syn::StaticMutability::Mut(_) = self.mutability { bail_span!(self.mutability, "cannot import mutable globals yet") @@ -746,6 +765,7 @@ impl<'a> ConvertToAst<(BindgenAttrs, &'a Option)> for syn::Fo rust_name: self.ident.clone(), js_name, shim: Ident::new(&shim, Span::call_site()), + wasm_bindgen: program.wasm_bindgen.clone(), })) } } @@ -947,6 +967,12 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { tokens.extend(quote::quote! { #[allow(dead_code)] }); f.to_tokens(tokens); let opts = opts.unwrap_or_default(); + if let Some(path) = opts.wasm_bindgen() { + program.wasm_bindgen = path.clone(); + } + if let Some(path) = opts.wasm_bindgen_futures() { + program.wasm_bindgen_futures = path.clone(); + } if opts.start().is_some() { if f.sig.generics.params.len() > 0 { bail_span!(&f.sig.generics, "the start function cannot have generics",); @@ -970,11 +996,13 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { rust_class: None, rust_name, start, + wasm_bindgen: program.wasm_bindgen.clone(), + wasm_bindgen_futures: program.wasm_bindgen_futures.clone(), }); } syn::Item::Struct(mut s) => { let opts = opts.unwrap_or_default(); - program.structs.push((&mut s).convert(opts)?); + program.structs.push((&mut s).convert((program, opts))?); s.to_tokens(tokens); } syn::Item::Impl(mut i) => { @@ -1017,11 +1045,7 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { } impl<'a> MacroParse for &'a mut syn::ItemImpl { - fn macro_parse( - self, - _program: &mut ast::Program, - opts: BindgenAttrs, - ) -> Result<(), Diagnostic> { + fn macro_parse(self, program: &mut ast::Program, opts: BindgenAttrs) -> Result<(), Diagnostic> { if self.defaultness.is_some() { bail_span!( self.defaultness, @@ -1055,7 +1079,7 @@ impl<'a> MacroParse for &'a mut syn::ItemImpl { }; let mut errors = Vec::new(); for item in self.items.iter_mut() { - if let Err(e) = prepare_for_impl_recursion(item, &name, &opts) { + if let Err(e) = prepare_for_impl_recursion(item, &name, program, &opts) { errors.push(e); } } @@ -1076,6 +1100,7 @@ impl<'a> MacroParse for &'a mut syn::ItemImpl { fn prepare_for_impl_recursion( item: &mut syn::ImplItem, class: &syn::Path, + program: &ast::Program, impl_opts: &BindgenAttrs, ) -> Result<(), Diagnostic> { let method = match item { @@ -1108,25 +1133,35 @@ fn prepare_for_impl_recursion( .map(|s| s.0.to_string()) .unwrap_or(ident.to_string()); + let wasm_bindgen = &program.wasm_bindgen; + let wasm_bindgen_futures = &program.wasm_bindgen_futures; method.attrs.insert( 0, syn::Attribute { pound_token: Default::default(), style: syn::AttrStyle::Outer, bracket_token: Default::default(), - meta: syn::parse_quote! { wasm_bindgen::prelude::__wasm_bindgen_class_marker(#class = #js_class) }, + meta: syn::parse_quote! { #wasm_bindgen::prelude::__wasm_bindgen_class_marker(#class = #js_class, wasm_bindgen = #wasm_bindgen, wasm_bindgen_futures = #wasm_bindgen_futures) }, }, ); Ok(()) } -impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemFn { +impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn { fn macro_parse( self, program: &mut ast::Program, - (class, js_class): (&'a Ident, &'a str), + ClassMarker { + class, + js_class, + wasm_bindgen, + wasm_bindgen_futures, + }: &ClassMarker, ) -> Result<(), Diagnostic> { + program.wasm_bindgen = wasm_bindgen.clone(); + program.wasm_bindgen_futures = wasm_bindgen_futures.clone(); + match self.vis { syn::Visibility::Public(_) => {} _ => return Ok(()), @@ -1169,6 +1204,8 @@ impl<'a, 'b> MacroParse<(&'a Ident, &'a str)> for &'b mut syn::ImplItemFn { rust_class: Some(class.clone()), rust_name: self.sig.ident.clone(), start: false, + wasm_bindgen: program.wasm_bindgen.clone(), + wasm_bindgen_futures: program.wasm_bindgen_futures.clone(), }); opts.check_used(); Ok(()) @@ -1215,6 +1252,7 @@ fn import_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), D variants, variant_values, rust_attrs: enum_.attrs, + wasm_bindgen: program.wasm_bindgen.clone(), }), }); @@ -1339,6 +1377,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { comments, hole, generate_typescript, + wasm_bindgen: program.wasm_bindgen.clone(), }); Ok(()) } @@ -1425,9 +1464,9 @@ impl MacroParse for syn::ForeignItem { let module = ctx.module; let kind = match self { - syn::ForeignItem::Fn(f) => f.convert((item_opts, &module))?, - syn::ForeignItem::Type(t) => t.convert(item_opts)?, - syn::ForeignItem::Static(s) => s.convert((item_opts, &module))?, + syn::ForeignItem::Fn(f) => f.convert((program, item_opts, &module))?, + syn::ForeignItem::Type(t) => t.convert((program, item_opts))?, + syn::ForeignItem::Static(s) => s.convert((program, item_opts, &module))?, _ => panic!("only foreign functions/types allowed for now"), }; @@ -1445,6 +1484,14 @@ pub fn module_from_opts( program: &mut ast::Program, opts: &BindgenAttrs, ) -> Result, Diagnostic> { + if let Some(path) = opts.wasm_bindgen() { + program.wasm_bindgen = path.clone(); + } + + if let Some(path) = opts.wasm_bindgen_futures() { + program.wasm_bindgen_futures = path.clone(); + } + let mut errors = Vec::new(); let module = if let Some((name, span)) = opts.module() { if opts.inline_js().is_some() { diff --git a/crates/macro/ui-tests/wasm-bindgen.rs b/crates/macro/ui-tests/wasm-bindgen.rs new file mode 100644 index 00000000000..1675034a438 --- /dev/null +++ b/crates/macro/ui-tests/wasm-bindgen.rs @@ -0,0 +1,43 @@ +extern crate wasm_bindgen as extern_test; + +use wasm_bindgen::prelude::*; + +mod test { + pub use wasm_bindgen as test; + pub use wasm_bindgen; +} + +#[wasm_bindgen(wasm_bindgen = wasm_bindgen)] +pub fn good1() {} + +#[wasm_bindgen(wasm_bindgen = ::wasm_bindgen)] +pub fn good2() {} + +#[wasm_bindgen(wasm_bindgen = test::wasm_bindgen)] +pub fn good3() {} + +#[wasm_bindgen(wasm_bindgen = test::test)] +pub fn good4() {} + +#[wasm_bindgen(wasm_bindgen = extern_test)] +pub fn good5() {} + +#[wasm_bindgen(wasm_bindgen_futures = wasm_bindgen_futures)] +pub fn good6() {} + +#[wasm_bindgen(wasm_bindgen = wasm_bindgen)] +pub async fn good7() {} + +#[wasm_bindgen(wasm_bindgen_futures = wasm_bindgen_futures)] +pub async fn good8() {} + +#[wasm_bindgen(wasm_bindgen = wasm_bindgen, wasm_bindgen_futures = wasm_bindgen_futures)] +pub async fn good9() {} + +#[wasm_bindgen(wasm_bindgen = test)] +pub fn bad1() {} + +#[wasm_bindgen(wasm_bindgen_futures = test)] +pub async fn bad2() {} + +fn main() {} diff --git a/crates/macro/ui-tests/wasm-bindgen.stderr b/crates/macro/ui-tests/wasm-bindgen.stderr new file mode 100644 index 00000000000..7ed892ebb0a --- /dev/null +++ b/crates/macro/ui-tests/wasm-bindgen.stderr @@ -0,0 +1,19 @@ +error[E0433]: failed to resolve: could not find `convert` in `test` + --> ui-tests/wasm-bindgen.rs:37:1 + | +37 | #[wasm_bindgen(wasm_bindgen = test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `convert` in `test` + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0425]: cannot find function `future_to_promise` in module `test` + --> ui-tests/wasm-bindgen.rs:40:1 + | +40 | #[wasm_bindgen(wasm_bindgen_futures = test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `test` + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider importing this function + | +3 | use wasm_bindgen_futures::future_to_promise; + | From 153a6aa9c7a989c1865df7f93b2ddbca1113a175 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 12 Apr 2023 15:51:54 +0200 Subject: [PATCH 190/641] Introduce `#[wasm_bindgen(main)]` (#3299) --- crates/macro-support/src/parser.rs | 79 +++++++++++++++++-- crates/macro/ui-tests/main-async.rs | 7 ++ crates/macro/ui-tests/main-async.stderr | 5 ++ crates/macro/ui-tests/main-debug.rs | 18 +++++ crates/macro/ui-tests/main-debug.stderr | 5 ++ crates/macro/ui-tests/main-infallible.rs | 10 +++ crates/macro/ui-tests/main-infallible.stderr | 5 ++ crates/macro/ui-tests/main-jsvalue.rs | 9 +++ crates/macro/ui-tests/main-jsvalue.stderr | 5 ++ crates/macro/ui-tests/main-unit.rs | 7 ++ crates/macro/ui-tests/main-unit.stderr | 5 ++ crates/macro/ui-tests/main.rs | 7 ++ crates/macro/ui-tests/main.stderr | 5 ++ guide/src/SUMMARY.md | 1 + .../attributes/on-rust-exports/main.md | 33 ++++++++ src/lib.rs | 37 +++++++++ 16 files changed, 230 insertions(+), 8 deletions(-) create mode 100644 crates/macro/ui-tests/main-async.rs create mode 100644 crates/macro/ui-tests/main-async.stderr create mode 100644 crates/macro/ui-tests/main-debug.rs create mode 100644 crates/macro/ui-tests/main-debug.stderr create mode 100644 crates/macro/ui-tests/main-infallible.rs create mode 100644 crates/macro/ui-tests/main-infallible.stderr create mode 100644 crates/macro/ui-tests/main-jsvalue.rs create mode 100644 crates/macro/ui-tests/main-jsvalue.stderr create mode 100644 crates/macro/ui-tests/main-unit.rs create mode 100644 crates/macro/ui-tests/main-unit.stderr create mode 100644 crates/macro/ui-tests/main.rs create mode 100644 crates/macro/ui-tests/main.stderr create mode 100644 guide/src/reference/attributes/on-rust-exports/main.md diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 2fcacb756e1..791f1ca1ea2 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -10,7 +10,7 @@ use proc_macro2::{Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; -use syn::{Lit, MacroDelimiter}; +use syn::{ItemFn, Lit, MacroDelimiter, ReturnType}; use crate::ClassMarker; @@ -83,6 +83,7 @@ macro_rules! attrgen { (typescript_custom_section, TypescriptCustomSection(Span)), (skip_typescript, SkipTypescript(Span)), (skip_jsdoc, SkipJsDoc(Span)), + (main, Main(Span)), (start, Start(Span)), (wasm_bindgen, WasmBindgen(Span, syn::Path)), (wasm_bindgen_futures, WasmBindgenFutures(Span, syn::Path)), @@ -949,6 +950,19 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { ) -> Result<(), Diagnostic> { match self { syn::Item::Fn(mut f) => { + let opts = opts.unwrap_or_default(); + if let Some(path) = opts.wasm_bindgen() { + program.wasm_bindgen = path.clone(); + } + if let Some(path) = opts.wasm_bindgen_futures() { + program.wasm_bindgen_futures = path.clone(); + } + + if opts.main().is_some() { + opts.check_used(); + return main(program, f, tokens); + } + let no_mangle = f .attrs .iter() @@ -966,13 +980,6 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { // `dead_code` warning. So, add `#[allow(dead_code)]` before it to avoid that. tokens.extend(quote::quote! { #[allow(dead_code)] }); f.to_tokens(tokens); - let opts = opts.unwrap_or_default(); - if let Some(path) = opts.wasm_bindgen() { - program.wasm_bindgen = path.clone(); - } - if let Some(path) = opts.wasm_bindgen_futures() { - program.wasm_bindgen_futures = path.clone(); - } if opts.start().is_some() { if f.sig.generics.params.len() > 0 { bail_span!(&f.sig.generics, "the start function cannot have generics",); @@ -1740,6 +1747,62 @@ pub fn link_to(opts: BindgenAttrs) -> Result { Ok(ast::LinkToModule(program)) } +fn main(program: &ast::Program, mut f: ItemFn, tokens: &mut TokenStream) -> Result<(), Diagnostic> { + if f.sig.ident != "main" { + bail_span!(&f.sig.ident, "the main function has to be called main"); + } + if let Some(constness) = f.sig.constness { + bail_span!(&constness, "the main function cannot be const"); + } + if !f.sig.generics.params.is_empty() { + bail_span!(&f.sig.generics, "the main function cannot have generics"); + } + if !f.sig.inputs.is_empty() { + bail_span!(&f.sig.inputs, "the main function cannot have arguments"); + } + + let r#return = f.sig.output; + f.sig.output = ReturnType::Default; + let body = f.block; + + let wasm_bindgen = &program.wasm_bindgen; + let wasm_bindgen_futures = &program.wasm_bindgen_futures; + + if f.sig.asyncness.take().is_some() { + f.block = Box::new( + syn::parse2(quote::quote! { + { + async fn __wasm_bindgen_generated_main() #r#return #body + #wasm_bindgen_futures::spawn_local( + async move { + use #wasm_bindgen::__rt::Main; + let __ret = __wasm_bindgen_generated_main(); + (&mut &mut &mut #wasm_bindgen::__rt::MainWrapper(Some(__ret.await))).__wasm_bindgen_main() + }, + ) + } + }) + .unwrap(), + ); + } else { + f.block = Box::new( + syn::parse2(quote::quote! { + { + fn __wasm_bindgen_generated_main() #r#return #body + use #wasm_bindgen::__rt::Main; + let __ret = __wasm_bindgen_generated_main(); + (&mut &mut &mut #wasm_bindgen::__rt::MainWrapper(Some(__ret))).__wasm_bindgen_main() + } + }) + .unwrap(), + ); + } + + f.to_tokens(tokens); + + Ok(()) +} + #[cfg(test)] mod tests { #[test] diff --git a/crates/macro/ui-tests/main-async.rs b/crates/macro/ui-tests/main-async.rs new file mode 100644 index 00000000000..8e11f45b386 --- /dev/null +++ b/crates/macro/ui-tests/main-async.rs @@ -0,0 +1,7 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +async fn main() {} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main-async.stderr b/crates/macro/ui-tests/main-async.stderr new file mode 100644 index 00000000000..71c4689a049 --- /dev/null +++ b/crates/macro/ui-tests/main-async.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main-async.rs:7:4 + | +7 | fn fail() {} + | ^^^^ diff --git a/crates/macro/ui-tests/main-debug.rs b/crates/macro/ui-tests/main-debug.rs new file mode 100644 index 00000000000..2fc9aa7ca6a --- /dev/null +++ b/crates/macro/ui-tests/main-debug.rs @@ -0,0 +1,18 @@ +use std::fmt; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +fn main() -> Result<(), Test> { + unimplemented!() +} + +struct Test; + +impl fmt::Debug for Test { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + unimplemented!() + } +} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main-debug.stderr b/crates/macro/ui-tests/main-debug.stderr new file mode 100644 index 00000000000..2b3c670ecf6 --- /dev/null +++ b/crates/macro/ui-tests/main-debug.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main-debug.rs:18:4 + | +18 | fn fail() {} + | ^^^^ diff --git a/crates/macro/ui-tests/main-infallible.rs b/crates/macro/ui-tests/main-infallible.rs new file mode 100644 index 00000000000..75ccd429a7b --- /dev/null +++ b/crates/macro/ui-tests/main-infallible.rs @@ -0,0 +1,10 @@ +use std::convert::Infallible; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +fn main() -> Infallible { + unimplemented!() +} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main-infallible.stderr b/crates/macro/ui-tests/main-infallible.stderr new file mode 100644 index 00000000000..fd8c9c99769 --- /dev/null +++ b/crates/macro/ui-tests/main-infallible.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main-infallible.rs:10:4 + | +10 | fn fail() {} + | ^^^^ diff --git a/crates/macro/ui-tests/main-jsvalue.rs b/crates/macro/ui-tests/main-jsvalue.rs new file mode 100644 index 00000000000..d2f5816acce --- /dev/null +++ b/crates/macro/ui-tests/main-jsvalue.rs @@ -0,0 +1,9 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +fn main() -> Result<(), JsValue> { + unimplemented!() +} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main-jsvalue.stderr b/crates/macro/ui-tests/main-jsvalue.stderr new file mode 100644 index 00000000000..6d32d6209d0 --- /dev/null +++ b/crates/macro/ui-tests/main-jsvalue.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main-jsvalue.rs:9:4 + | +9 | fn fail() {} + | ^^^^ diff --git a/crates/macro/ui-tests/main-unit.rs b/crates/macro/ui-tests/main-unit.rs new file mode 100644 index 00000000000..5e04c8dc772 --- /dev/null +++ b/crates/macro/ui-tests/main-unit.rs @@ -0,0 +1,7 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +fn main() -> () {} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main-unit.stderr b/crates/macro/ui-tests/main-unit.stderr new file mode 100644 index 00000000000..f49066e906b --- /dev/null +++ b/crates/macro/ui-tests/main-unit.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main-unit.rs:7:4 + | +7 | fn fail() {} + | ^^^^ diff --git a/crates/macro/ui-tests/main.rs b/crates/macro/ui-tests/main.rs new file mode 100644 index 00000000000..5babfb92a9e --- /dev/null +++ b/crates/macro/ui-tests/main.rs @@ -0,0 +1,7 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(main)] +fn main() {} + +#[wasm_bindgen(main)] +fn fail() {} diff --git a/crates/macro/ui-tests/main.stderr b/crates/macro/ui-tests/main.stderr new file mode 100644 index 00000000000..94f13b1db70 --- /dev/null +++ b/crates/macro/ui-tests/main.stderr @@ -0,0 +1,5 @@ +error: the main function has to be called main + --> ui-tests/main.rs:7:4 + | +7 | fn fail() {} + | ^^^^ diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index c6fcc31737a..a442e084a5d 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -85,6 +85,7 @@ - [`skip`](./reference/attributes/on-rust-exports/skip.md) - [`skip_jsdoc`](./reference/attributes/on-rust-exports/skip_jsdoc.md) - [`start`](./reference/attributes/on-rust-exports/start.md) + - [`main`](./reference/attributes/on-rust-exports/main.md) - [`typescript_custom_section`](./reference/attributes/on-rust-exports/typescript_custom_section.md) - [`getter` and `setter`](./reference/attributes/on-rust-exports/getter-and-setter.md) - [`inspectable`](./reference/attributes/on-rust-exports/inspectable.md) diff --git a/guide/src/reference/attributes/on-rust-exports/main.md b/guide/src/reference/attributes/on-rust-exports/main.md new file mode 100644 index 00000000000..0947186b9cf --- /dev/null +++ b/guide/src/reference/attributes/on-rust-exports/main.md @@ -0,0 +1,33 @@ +# `main` + +When attached to the `main` function this attribute will adjust it to properly +throw errors if they can be. + +```rust +#[wasm_bindgen(main)] +fn main() -> Result<(), JsValue> { + Err(JsValue::from("this error message will be thrown")) +} +``` + +The attribute also allows using `async fn main()` in Cargo binaries. + +```rust +#[wasm_bindgen(main)] +async fn main() { + // ... + future.await; +} +``` + +This attribute is only intended to be used on the `main` function of binaries or +examples. Unlike `#[wasm_bindgen(start)]`, it will not cause an arbitrary +function to be executed on start in a library. + +The return type support is modeled after [`Termination`]. `()` and `Infallible` +are supported, but [`Termination`] itself is not. In order, wasm-bindgen will +first detect a `Result<(), impl Into>` and will throw proper +`JsValue`s, `Result<(), impl Debug>` will convert an error to a string and throw +that. + +[`Termination`]: https://doc.rust-lang.org/std/process/trait.Termination.html diff --git a/src/lib.rs b/src/lib.rs index f8576ed4c3e..f5d70e16668 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1374,6 +1374,7 @@ pub mod __rt { use crate::JsValue; use core::borrow::{Borrow, BorrowMut}; use core::cell::{Cell, UnsafeCell}; + use core::convert::Infallible; use core::ops::{Deref, DerefMut}; pub extern crate core; @@ -1728,6 +1729,42 @@ pub mod __rt { } } } + + /// An internal helper struct for usage in `#[wasm_bindgen(main)]` + /// functions to throw the error (if it is `Err`). + pub struct MainWrapper(pub Option); + + pub trait Main { + fn __wasm_bindgen_main(&mut self); + } + + impl Main for &mut &mut MainWrapper<()> { + #[inline] + fn __wasm_bindgen_main(&mut self) {} + } + + impl Main for &mut &mut MainWrapper { + #[inline] + fn __wasm_bindgen_main(&mut self) {} + } + + impl> Main for &mut &mut MainWrapper> { + #[inline] + fn __wasm_bindgen_main(&mut self) { + if let Err(e) = self.0.take().unwrap() { + crate::throw_val(e.into()); + } + } + } + + impl Main for &mut MainWrapper> { + #[inline] + fn __wasm_bindgen_main(&mut self) { + if let Err(e) = self.0.take().unwrap() { + crate::throw_str(&std::format!("{:?}", e)); + } + } + } } /// A wrapper type around slices and vectors for binding the `Uint8ClampedArray` From 0753bec4c6f51d7e27b82c357e65cefab3c61dd3 Mon Sep 17 00:00:00 2001 From: WhizSid Date: Wed, 26 Apr 2023 19:39:15 +0530 Subject: [PATCH 191/641] Worker tests (#3351) * Running tests on workers without displaying errors * Initializing the wasm bindgen only in worker * Adding tests to run in workers * Format * Adding webdriver.json file * Removed memory module from worker tests * Keeping original JsValue without overwriting * Updated the documentation --- .gitignore | 1 - .../src/bin/wasm-bindgen-test-runner/main.rs | 30 ++-- .../bin/wasm-bindgen-test-runner/server.rs | 169 ++++++++++++++---- crates/test/src/lib.rs | 8 + crates/test/src/rt/detect.rs | 44 +++-- crates/test/src/rt/mod.rs | 9 +- crates/test/src/rt/node.rs | 10 +- crates/test/src/rt/worker.rs | 66 +++++++ guide/src/wasm-bindgen-test/browsers.md | 17 ++ tests/worker/main.rs | 18 ++ tests/worker/modules.js | 3 + tests/worker/modules.rs | 12 ++ webdriver.json | 8 + 13 files changed, 327 insertions(+), 68 deletions(-) create mode 100644 crates/test/src/rt/worker.rs create mode 100644 tests/worker/main.rs create mode 100644 tests/worker/modules.js create mode 100644 tests/worker/modules.rs create mode 100644 webdriver.json diff --git a/.gitignore b/.gitignore index 8cdf73b9e4f..749720c7b27 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ yarn.lock /publish /publish.exe .vscode -webdriver.json diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 3286a118cc7..2647104c8a2 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -28,8 +28,8 @@ mod shell; enum TestMode { Node, Deno, - Browser, - NoModule, + Browser { no_modules: bool }, + Worker { no_modules: bool }, } fn main() -> anyhow::Result<()> { @@ -100,13 +100,12 @@ fn main() -> anyhow::Result<()> { let custom_section = wasm.customs.remove_raw("__wasm_bindgen_test_unstable"); let test_mode = match custom_section { - Some(section) if section.data.contains(&0x01) => { - if std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok() { - TestMode::NoModule - } else { - TestMode::Browser - } - } + Some(section) if section.data.contains(&0x01) => TestMode::Browser { + no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), + }, + Some(section) if section.data.contains(&0x10) => TestMode::Worker { + no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), + }, Some(_) => bail!("invalid __wasm_bingen_test_unstable value"), None if std::env::var("WASM_BINDGEN_USE_DENO").is_ok() => TestMode::Deno, None => TestMode::Node, @@ -163,8 +162,12 @@ integration test.\ match test_mode { TestMode::Node => b.nodejs(true)?, TestMode::Deno => b.deno(true)?, - TestMode::Browser => b.web(true)?, - TestMode::NoModule => b.no_modules(true)?, + TestMode::Browser { no_modules: false } | TestMode::Worker { no_modules: false } => { + b.web(true)? + } + TestMode::Browser { no_modules: true } | TestMode::Worker { no_modules: true } => { + b.no_modules(true)? + } }; if std::env::var("WASM_BINDGEN_SPLIT_LINKED_MODULES").is_ok() { @@ -184,7 +187,7 @@ integration test.\ match test_mode { TestMode::Node => node::execute(&module, &tmpdir, &args, &tests)?, TestMode::Deno => deno::execute(&module, &tmpdir, &args, &tests)?, - TestMode::Browser | TestMode::NoModule => { + TestMode::Browser { no_modules } | TestMode::Worker { no_modules } => { let srv = server::spawn( &if headless { "127.0.0.1:0".parse().unwrap() @@ -198,7 +201,8 @@ integration test.\ &tmpdir, &args, &tests, - matches!(test_mode, TestMode::NoModule), + no_modules, + matches!(test_mode, TestMode::Worker { no_modules: _ }), ) .context("failed to spawn server")?; let addr = srv.server_addr(); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index 94177b945a2..ddbe2b5b661 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -15,8 +15,11 @@ pub fn spawn( args: &[OsString], tests: &[String], no_module: bool, + worker: bool, ) -> Result Response + Send + Sync>, Error> { - let mut js_to_execute = if no_module { + let mut js_to_execute = String::new(); + + let wbg_import_script = if no_module { String::from( r#" let Context = wasm_bindgen.WasmBindgenTestContext; @@ -45,36 +48,140 @@ pub fn spawn( ) }; - js_to_execute.push_str(&format!( - r#" - // Now that we've gotten to the point where JS is executing, update our - // status text as at this point we should be asynchronously fetching the - // wasm module. - document.getElementById('output').textContent = "Loading wasm module..."; - - async function main(test) {{ - const wasm = await init('./{0}_bg.wasm'); - - const cx = new Context(); - window.on_console_debug = __wbgtest_console_debug; - window.on_console_log = __wbgtest_console_log; - window.on_console_info = __wbgtest_console_info; - window.on_console_warn = __wbgtest_console_warn; - window.on_console_error = __wbgtest_console_error; - - // Forward runtime arguments. These arguments are also arguments to the - // `wasm-bindgen-test-runner` which forwards them to node which we - // forward to the test harness. this is basically only used for test - // filters for now. - cx.args({1:?}); - - await cx.run(test.map(s => wasm[s])); - }} - - const tests = []; - "#, - module, args, - )); + if worker { + let mut worker_script = if no_module { + format!(r#"importScripts("{0}.js");"#, module) + } else { + String::new() + }; + + worker_script.push_str(&wbg_import_script); + + worker_script.push_str(&format!( + r#" + const wrap = method => {{ + const on_method = `on_console_${{method}}`; + self.console[method] = function (...args) {{ + if (self[on_method]) {{ + self[on_method](args); + }} + postMessage(["__wbgtest_" + method, args]); + }}; + }}; + + self.__wbg_test_invoke = f => f(); + self.__wbg_test_output = ""; + self.__wbg_test_output_writeln = function (line) {{ + self.__wbg_test_output += line + "\n"; + postMessage(["__wbgtest_output", self.__wbg_test_output]); + }} + + wrap("debug"); + wrap("log"); + wrap("info"); + wrap("warn"); + wrap("error"); + + async function run_in_worker(tests) {{ + const wasm = await init("./{0}_bg.wasm"); + const t = self; + const cx = new Context(); + + self.on_console_debug = __wbgtest_console_debug; + self.on_console_log = __wbgtest_console_log; + self.on_console_info = __wbgtest_console_info; + self.on_console_warn = __wbgtest_console_warn; + self.on_console_error = __wbgtest_console_error; + + cx.args({1:?}); + await cx.run(tests.map(s => wasm[s])); + }} + + onmessage = function(e) {{ + let tests = e.data; + run_in_worker(tests); + }} + "#, + module, args, + )); + + let worker_js_path = tmpdir.join("worker.js"); + fs::write(&worker_js_path, worker_script).context("failed to write JS file")?; + + js_to_execute.push_str(&format!( + r#" + // Now that we've gotten to the point where JS is executing, update our + // status text as at this point we should be asynchronously fetching the + // wasm module. + document.getElementById('output').textContent = "Loading wasm module..."; + const worker = new Worker("worker.js", {{type: "{}"}}); + + worker.addEventListener("message", function(e) {{ + // Checking the whether the message is from wasm_bindgen_test + if( + e.data && + Array.isArray(e.data) && + e.data[0] && + typeof e.data[0] == "string" && + e.data[0].slice(0,10)=="__wbgtest_" + ) {{ + const method = e.data[0].slice(10); + const args = e.data.slice(1); + + if ( + method == "log" || method == "error" || + method == "warn" || method == "info" || + method == "debug" + ) {{ + console[method].apply(undefined, args[0]); + }} else if (method == "output") {{ + document.getElementById("output").textContent = args[0]; + }} + }} + }}); + + async function main(test) {{ + worker.postMessage(test) + }} + + const tests = []; + "#, + if no_module { "classic" } else { "module" } + )); + } else { + js_to_execute.push_str(&wbg_import_script); + + js_to_execute.push_str(&format!( + r#" + // Now that we've gotten to the point where JS is executing, update our + // status text as at this point we should be asynchronously fetching the + // wasm module. + document.getElementById('output').textContent = "Loading wasm module..."; + + async function main(test) {{ + const wasm = await init('./{0}_bg.wasm'); + + const cx = new Context(); + window.on_console_debug = __wbgtest_console_debug; + window.on_console_log = __wbgtest_console_log; + window.on_console_info = __wbgtest_console_info; + window.on_console_warn = __wbgtest_console_warn; + window.on_console_error = __wbgtest_console_error; + + // Forward runtime arguments. These arguments are also arguments to the + // `wasm-bindgen-test-runner` which forwards them to node which we + // forward to the test harness. this is basically only used for test + // filters for now. + cx.args({1:?}); + + await cx.run(test.map(s => wasm[s])); + }} + + const tests = []; + "#, + module, args, + )); + } for test in tests { js_to_execute.push_str(&format!("tests.push('{}');\n", test)); } diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index 4fcb28aeb49..72d3fc9df6c 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -35,6 +35,8 @@ macro_rules! console_log { /// /// * `run_in_browser` - requires that this test is run in a browser rather than /// node.js, which is the default for executing tests. +/// * `run_in_worker` - requires that this test is run in a web worker rather than +/// node.js, which is the default for executing tests. /// /// This macro may be invoked at most one time per test suite (an entire binary /// like `tests/foo.rs`, not per module) @@ -46,6 +48,12 @@ macro_rules! wasm_bindgen_test_configure { pub static __WBG_TEST_RUN_IN_BROWSER: [u8; 1] = [0x01]; $crate::wasm_bindgen_test_configure!($($others)*); ); + (run_in_worker $($others:tt)*) => ( + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_WORKER: [u8; 1] = [0x10]; + $crate::wasm_bindgen_test_configure!($($others)*); + ); () => () } diff --git a/crates/test/src/rt/detect.rs b/crates/test/src/rt/detect.rs index 40cc23e84bf..81cb1c70455 100644 --- a/crates/test/src/rt/detect.rs +++ b/crates/test/src/rt/detect.rs @@ -6,19 +6,37 @@ use wasm_bindgen::prelude::*; extern "C" { type This; #[wasm_bindgen(method, getter, structural, js_name = self)] - fn self_(me: &This) -> JsValue; + fn self_(me: &This) -> Option; + + type Scope; + #[wasm_bindgen(method, getter, structural)] + fn constructor(me: &Scope) -> Constructor; + + type Constructor; + #[wasm_bindgen(method, getter, structural)] + fn name(me: &Constructor) -> String; +} + +/// Detecting the current JS scope +pub fn detect() -> Runtime { + // Test whether we're in a browser/worker by seeing if the `self` property is + // defined on the global object and it is not equal to a WorkerScope, which should in turn + // only be true in browsers. + match js_sys::global().unchecked_into::().self_() { + Some(scope) => match scope.constructor().name().as_str() { + "DedicatedWorkerGlobalScope" | "SharedWorkerGlobalScope" => Runtime::Worker, + _ => Runtime::Browser, + }, + None => Runtime::Node, + } } -/// Returns whether it's likely we're executing in a browser environment, as -/// opposed to node.js. -// If this function is inlined then there's no other functions in this module -// (which becomes an object file) to actually pull in the custom section listed -// above. Force this to never be inlined so if this module is needed its forced -// to pull in the descriptor section from `#[wasm_bindgen]` above. -#[inline(never)] -pub fn is_browser() -> bool { - // Test whether we're in a browser by seeing if the `self` property is - // defined on the global object, which should in turn only be true in - // browsers. - js_sys::global().unchecked_into::().self_() != JsValue::undefined() +/// Current runtime environment +pub enum Runtime { + /// Current scope is a browser scope + Browser, + /// Current scope is a node scope + Node, + /// Current scope is a worker scope + Worker, } diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 247603bab00..634d3b791c5 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -109,6 +109,7 @@ const CONCURRENCY: usize = 1; pub mod browser; pub mod detect; pub mod node; +pub mod worker; /// Runtime test harness support instantiated in JS. /// @@ -237,10 +238,12 @@ impl Context { })); }); - let formatter = match node::Node::new() { - Some(node) => Box::new(node) as Box, - None => Box::new(browser::Browser::new()), + let formatter = match detect::detect() { + detect::Runtime::Browser => Box::new(browser::Browser::new()) as Box, + detect::Runtime::Node => Box::new(node::Node::new()) as Box, + detect::Runtime::Worker => Box::new(worker::Worker::new()) as Box, }; + Context { state: Rc::new(State { filter: Default::default(), diff --git a/crates/test/src/rt/node.rs b/crates/test/src/rt/node.rs index ecfa4bd4f73..c5c85cd887e 100644 --- a/crates/test/src/rt/node.rs +++ b/crates/test/src/rt/node.rs @@ -18,13 +18,9 @@ extern "C" { } impl Node { - /// Attempts to create a new formatter for node.js, returning `None` if this - /// is executing in a browser and Node won't work. - pub fn new() -> Option { - if super::detect::is_browser() { - return None; - } - Some(Node {}) + /// Attempts to create a new formatter for node.js + pub fn new() -> Node { + Node {} } } diff --git a/crates/test/src/rt/worker.rs b/crates/test/src/rt/worker.rs new file mode 100644 index 00000000000..6dabab1a899 --- /dev/null +++ b/crates/test/src/rt/worker.rs @@ -0,0 +1,66 @@ +//! Support for printing status information of a test suite in a browser. +//! +//! Currently this is quite simple, rendering the same as the console tests in +//! node.js. Output here is rendered in a `pre`, however. + +use js_sys::Error; +use wasm_bindgen::prelude::*; + +/// Implementation of `Formatter` for browsers. +/// +/// Routes all output to a `pre` on the page currently. Eventually this probably +/// wants to be a pretty table with colors and folding and whatnot. +pub struct Worker {} + +#[wasm_bindgen] +extern "C" { + type WorkerError; + #[wasm_bindgen(method, getter, structural)] + fn stack(this: &WorkerError) -> JsValue; + + #[wasm_bindgen(js_name = "__wbg_test_output_writeln")] + fn write_output_line(data: JsValue); +} + +impl Worker { + /// Attempts to create a new formatter for web worker + pub fn new() -> Worker { + Worker {} + } +} + +impl super::Formatter for Worker { + fn writeln(&self, line: &str) { + write_output_line(JsValue::from(String::from(line))); + } + + fn log_test(&self, name: &str, result: &Result<(), JsValue>) { + let s = if result.is_ok() { "ok" } else { "FAIL" }; + self.writeln(&format!("test {} ... {}", name, s)); + } + + fn stringify_error(&self, err: &JsValue) -> String { + // TODO: this should be a checked cast to `Error` + let error = Error::from(err.clone()); + let name = String::from(error.name()); + let message = String::from(error.message()); + let err = WorkerError::from(err.clone()); + let stack = err.stack(); + + let header = format!("{}: {}", name, message); + let stack = match stack.as_string() { + Some(stack) => stack, + None => return header, + }; + + // If the `stack` variable contains the name/message already, this is + // probably a chome-like error which is already rendered well, so just + // return this info + if stack.contains(&header) { + return stack; + } + + // Fallback to make sure we don't lose any info + format!("{}\n{}", header, stack) + } +} diff --git a/guide/src/wasm-bindgen-test/browsers.md b/guide/src/wasm-bindgen-test/browsers.md index b3e91e1827a..1df038e32c7 100644 --- a/guide/src/wasm-bindgen-test/browsers.md +++ b/guide/src/wasm-bindgen-test/browsers.md @@ -10,6 +10,16 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; wasm_bindgen_test_configure!(run_in_browser); ``` +Or if you need to run your tests inside a web worker, you can also +configured it using the `wasm_bindgen_test_configure` macro as following +snippet. + +```rust +use wasm_bindgen_test::wasm_bindgen_test_configure; + +wasm_bindgen_test_configure!(run_in_worker); +``` + Note that although a particular test crate must target either headless browsers or Node.js, you can have test suites for both Node.js and browsers for your project by using multiple test crates. For example: @@ -18,6 +28,7 @@ project by using multiple test crates. For example: $MY_CRATE/ `-- tests |-- node.rs # The tests in this suite use the default Node.js. + |-- worker.rs # The tests in this suite are configured for workers. `-- web.rs # The tests in this suite are configured for browsers. ``` @@ -75,6 +86,12 @@ Full list supported capabilities can be found: Note that the `headless` argument is always enabled for both browsers. +You have to enable the special preference `dom.workers.modules.enabled` for +firefox when running the tests in Web Workers without using +`WASM_BINDGEN_USE_NO_MODULE` variable. Because firefox supported +ECMAScript modules in last release (2023-03-14) behind a special +preference. + ### Debugging Headless Browser Tests Omitting the `--headless` flag will disable headless mode, and allow you to diff --git a/tests/worker/main.rs b/tests/worker/main.rs new file mode 100644 index 00000000000..70ae686b92e --- /dev/null +++ b/tests/worker/main.rs @@ -0,0 +1,18 @@ +#![cfg(target_arch = "wasm32")] + +extern crate js_sys; +extern crate wasm_bindgen; +extern crate wasm_bindgen_test; + +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure}; + +wasm_bindgen_test_configure!(run_in_worker); + +pub mod modules; + +// should not be executed +#[wasm_bindgen(start)] +fn start() { + panic!(); +} diff --git a/tests/worker/modules.js b/tests/worker/modules.js new file mode 100644 index 00000000000..c6ce3f0eb49 --- /dev/null +++ b/tests/worker/modules.js @@ -0,0 +1,3 @@ +export function get_five() { + return 5; +} diff --git a/tests/worker/modules.rs b/tests/worker/modules.rs new file mode 100644 index 00000000000..37445ea1af2 --- /dev/null +++ b/tests/worker/modules.rs @@ -0,0 +1,12 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(raw_module = "./tests/worker/modules.js")] +extern "C" { + fn get_five() -> u32; +} + +#[wasm_bindgen_test] +fn test_get_five() { + assert_eq!(get_five(), 5); +} diff --git a/webdriver.json b/webdriver.json new file mode 100644 index 00000000000..84740385c72 --- /dev/null +++ b/webdriver.json @@ -0,0 +1,8 @@ +{ + "moz:firefoxOptions": { + "prefs": { + "dom.workers.modules.enabled": true + }, + "args": [] + } +} From 5aad55a6a32a3ad2437c86255b76a728fecabd3a Mon Sep 17 00:00:00 2001 From: Melanie Riise Date: Mon, 8 May 2023 08:14:32 -0700 Subject: [PATCH 192/641] update rust ver for UI tests in CI to 1.60.0 (#3409) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6e9bb4a8c4..3f938c8538f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -222,7 +222,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: rustup update --no-self-update 1.59.0 && rustup default 1.59.0 + - run: rustup update --no-self-update 1.60.0 && rustup default 1.60.0 - run: cargo test -p wasm-bindgen-macro - run: cargo test -p wasm-bindgen-test-macro From ac96e60cbb962b62ae993b9b83ab57d415431590 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 8 May 2023 17:14:56 +0200 Subject: [PATCH 193/641] docs: fix typo in imported-js-types.md (#3403) Signed-off-by: Daniel Bevenius --- guide/src/reference/types/imported-js-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/types/imported-js-types.md b/guide/src/reference/types/imported-js-types.md index 8d64fa33228..283b0faeccb 100644 --- a/guide/src/reference/types/imported-js-types.md +++ b/guide/src/reference/types/imported-js-types.md @@ -2,7 +2,7 @@ | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| Yes | Yes | No | Yes | Yes | Yes | Instances of the extant `Whatever` JavaScript class / prototype constructor | +| Yes | Yes | No | Yes | Yes | Yes | Instances of the extern `Whatever` JavaScript class / prototype constructor | ## Example Rust Usage From 56a4d444b5ded6d875b91c31dcc2e789a156b715 Mon Sep 17 00:00:00 2001 From: Melanie Riise Date: Mon, 8 May 2023 08:15:31 -0700 Subject: [PATCH 194/641] Update webtransport IDL to the april 5th version (#3399) * update webtransport IDL toa he pril 5th version * update bindings & features * remove duplicate bindings --- crates/web-sys/Cargo.toml | 3 +- .../web-sys/src/features/gen_WebTransport.rs | 23 ++++++++++++ .../gen_WebTransportDatagramDuplexStream.rs | 16 ++++----- .../src/features/gen_WebTransportError.rs | 20 +++++++++-- ...nit.rs => gen_WebTransportErrorOptions.rs} | 34 +++++++++--------- .../gen_WebTransportReliabilityMode.rs | 16 +++++++++ crates/web-sys/src/features/mod.rs | 14 +++++--- .../webidls/unstable/WebTransport.webidl | 35 +++++++++++-------- 8 files changed, 113 insertions(+), 48 deletions(-) rename crates/web-sys/src/features/{gen_WebTransportErrorInit.rs => gen_WebTransportErrorOptions.rs} (75%) create mode 100644 crates/web-sys/src/features/gen_WebTransportReliabilityMode.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 7201f8c5e01..780a66e80a2 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1471,12 +1471,13 @@ WebTransportCongestionControl = [] WebTransportDatagramDuplexStream = [] WebTransportDatagramStats = [] WebTransportError = ["DomException"] -WebTransportErrorInit = [] +WebTransportErrorOptions = [] WebTransportErrorSource = [] WebTransportHash = [] WebTransportOptions = [] WebTransportReceiveStream = ["ReadableStream"] WebTransportReceiveStreamStats = [] +WebTransportReliabilityMode = [] WebTransportSendStream = ["WritableStream"] WebTransportSendStreamOptions = [] WebTransportSendStreamStats = [] diff --git a/crates/web-sys/src/features/gen_WebTransport.rs b/crates/web-sys/src/features/gen_WebTransport.rs index de518eff379..770a2cbdab5 100644 --- a/crates/web-sys/src/features/gen_WebTransport.rs +++ b/crates/web-sys/src/features/gen_WebTransport.rs @@ -27,6 +27,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ready(this: &WebTransport) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportReliabilityMode")] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = reliability)] + #[doc = "Getter for the `reliability` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/reliability)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`, `WebTransportReliabilityMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn reliability(this: &WebTransport) -> WebTransportReliabilityMode; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportCongestionControl")] # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = congestionControl)] #[doc = "Getter for the `congestionControl` field of this object."] @@ -50,6 +62,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn closed(this: &WebTransport) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = draining)] + #[doc = "Getter for the `draining` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/draining)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn draining(this: &WebTransport) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportDatagramDuplexStream")] # [wasm_bindgen (structural , method , getter , js_class = "WebTransport" , js_name = datagrams)] #[doc = "Getter for the `datagrams` field of this object."] diff --git a/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs b/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs index 86a839fba6c..bd96f417051 100644 --- a/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs +++ b/crates/web-sys/src/features/gen_WebTransportDatagramDuplexStream.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn incoming_max_age(this: &WebTransportDatagramDuplexStream) -> Option; + pub fn incoming_max_age(this: &WebTransportDatagramDuplexStream) -> f64; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingMaxAge)] #[doc = "Setter for the `incomingMaxAge` field of this object."] @@ -71,7 +71,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_incoming_max_age(this: &WebTransportDatagramDuplexStream, value: Option); + pub fn set_incoming_max_age(this: &WebTransportDatagramDuplexStream, value: f64); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingMaxAge)] #[doc = "Getter for the `outgoingMaxAge` field of this object."] @@ -82,7 +82,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn outgoing_max_age(this: &WebTransportDatagramDuplexStream) -> Option; + pub fn outgoing_max_age(this: &WebTransportDatagramDuplexStream) -> f64; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingMaxAge)] #[doc = "Setter for the `outgoingMaxAge` field of this object."] @@ -93,7 +93,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_outgoing_max_age(this: &WebTransportDatagramDuplexStream, value: Option); + pub fn set_outgoing_max_age(this: &WebTransportDatagramDuplexStream, value: f64); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingHighWaterMark)] #[doc = "Getter for the `incomingHighWaterMark` field of this object."] @@ -104,7 +104,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn incoming_high_water_mark(this: &WebTransportDatagramDuplexStream) -> i32; + pub fn incoming_high_water_mark(this: &WebTransportDatagramDuplexStream) -> f64; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = incomingHighWaterMark)] #[doc = "Setter for the `incomingHighWaterMark` field of this object."] @@ -115,7 +115,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_incoming_high_water_mark(this: &WebTransportDatagramDuplexStream, value: i32); + pub fn set_incoming_high_water_mark(this: &WebTransportDatagramDuplexStream, value: f64); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingHighWaterMark)] #[doc = "Getter for the `outgoingHighWaterMark` field of this object."] @@ -126,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream) -> i32; + pub fn outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream) -> f64; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "WebTransportDatagramDuplexStream" , js_name = outgoingHighWaterMark)] #[doc = "Setter for the `outgoingHighWaterMark` field of this object."] @@ -137,5 +137,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream, value: i32); + pub fn set_outgoing_high_water_mark(this: &WebTransportDatagramDuplexStream, value: f64); } diff --git a/crates/web-sys/src/features/gen_WebTransportError.rs b/crates/web-sys/src/features/gen_WebTransportError.rs index 865294e7dc8..029cd100ed9 100644 --- a/crates/web-sys/src/features/gen_WebTransportError.rs +++ b/crates/web-sys/src/features/gen_WebTransportError.rs @@ -50,15 +50,29 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new() -> Result; #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "WebTransportErrorInit")] #[wasm_bindgen(catch, constructor, js_class = "WebTransportError")] #[doc = "The `new WebTransportError(..)` constructor, creating a new instance of `WebTransportError`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/WebTransportError)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportError`, `WebTransportErrorInit`*"] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_message(message: &str) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportErrorOptions")] + #[wasm_bindgen(catch, constructor, js_class = "WebTransportError")] + #[doc = "The `new WebTransportError(..)` constructor, creating a new instance of `WebTransportError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebTransportError/WebTransportError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportError`, `WebTransportErrorOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new_with_init(init: &WebTransportErrorInit) -> Result; + pub fn new_with_message_and_options( + message: &str, + options: &WebTransportErrorOptions, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_WebTransportErrorInit.rs b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs similarity index 75% rename from crates/web-sys/src/features/gen_WebTransportErrorInit.rs rename to crates/web-sys/src/features/gen_WebTransportErrorOptions.rs index 28a2ee1c339..83b8a6d8eab 100644 --- a/crates/web-sys/src/features/gen_WebTransportErrorInit.rs +++ b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs @@ -4,21 +4,21 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportErrorInit)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebTransportErrorOptions)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `WebTransportErrorInit` dictionary."] + #[doc = "The `WebTransportErrorOptions` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type WebTransportErrorInit; + pub type WebTransportErrorOptions; } #[cfg(web_sys_unstable_apis)] -impl WebTransportErrorInit { - #[doc = "Construct a new `WebTransportErrorInit`."] +impl WebTransportErrorOptions { + #[doc = "Construct a new `WebTransportErrorOptions`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -28,19 +28,17 @@ impl WebTransportErrorInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `message` field of this object."] + #[cfg(feature = "WebTransportErrorSource")] + #[doc = "Change the `source` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`, `WebTransportErrorSource`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn message(&mut self, val: &str) -> &mut Self { + pub fn source(&mut self, val: WebTransportErrorSource) -> &mut Self { use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); debug_assert!( r.is_ok(), "setting properties should never fail on our dictionary objects" @@ -51,11 +49,11 @@ impl WebTransportErrorInit { #[cfg(web_sys_unstable_apis)] #[doc = "Change the `streamErrorCode` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorInit`*"] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stream_error_code(&mut self, val: u8) -> &mut Self { + pub fn stream_error_code(&mut self, val: Option) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), @@ -71,7 +69,7 @@ impl WebTransportErrorInit { } } #[cfg(web_sys_unstable_apis)] -impl Default for WebTransportErrorInit { +impl Default for WebTransportErrorOptions { fn default() -> Self { Self::new() } diff --git a/crates/web-sys/src/features/gen_WebTransportReliabilityMode.rs b/crates/web-sys/src/features/gen_WebTransportReliabilityMode.rs new file mode 100644 index 00000000000..b703503193e --- /dev/null +++ b/crates/web-sys/src/features/gen_WebTransportReliabilityMode.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `WebTransportReliabilityMode` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WebTransportReliabilityMode`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WebTransportReliabilityMode { + Pending = "pending", + ReliableOnly = "reliable-only", + SupportsUnreliable = "supports-unreliable", +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 460a80068b9..8b758e8575c 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8644,11 +8644,11 @@ mod gen_WebTransportError; #[cfg(feature = "WebTransportError")] pub use gen_WebTransportError::*; -#[cfg(feature = "WebTransportErrorInit")] +#[cfg(feature = "WebTransportErrorOptions")] #[allow(non_snake_case)] -mod gen_WebTransportErrorInit; -#[cfg(feature = "WebTransportErrorInit")] -pub use gen_WebTransportErrorInit::*; +mod gen_WebTransportErrorOptions; +#[cfg(feature = "WebTransportErrorOptions")] +pub use gen_WebTransportErrorOptions::*; #[cfg(feature = "WebTransportErrorSource")] #[allow(non_snake_case)] @@ -8680,6 +8680,12 @@ mod gen_WebTransportReceiveStreamStats; #[cfg(feature = "WebTransportReceiveStreamStats")] pub use gen_WebTransportReceiveStreamStats::*; +#[cfg(feature = "WebTransportReliabilityMode")] +#[allow(non_snake_case)] +mod gen_WebTransportReliabilityMode; +#[cfg(feature = "WebTransportReliabilityMode")] +pub use gen_WebTransportReliabilityMode::*; + #[cfg(feature = "WebTransportSendStream")] #[allow(non_snake_case)] mod gen_WebTransportSendStream; diff --git a/crates/web-sys/webidls/unstable/WebTransport.webidl b/crates/web-sys/webidls/unstable/WebTransport.webidl index a2e4853a946..f0a85b948b2 100644 --- a/crates/web-sys/webidls/unstable/WebTransport.webidl +++ b/crates/web-sys/webidls/unstable/WebTransport.webidl @@ -16,10 +16,10 @@ interface WebTransportDatagramDuplexStream { readonly attribute WritableStream writable; readonly attribute unsigned long maxDatagramSize; - attribute double? incomingMaxAge; - attribute double? outgoingMaxAge; - attribute long incomingHighWaterMark; - attribute long outgoingHighWaterMark; + attribute unrestricted double incomingMaxAge; + attribute unrestricted double outgoingMaxAge; + attribute unrestricted double incomingHighWaterMark; + attribute unrestricted double outgoingHighWaterMark; }; [Exposed=(Window,Worker), SecureContext] @@ -31,6 +31,7 @@ interface WebTransport { readonly attribute WebTransportReliabilityMode reliability; readonly attribute WebTransportCongestionControl congestionControl; readonly attribute Promise closed; + readonly attribute Promise draining; undefined close(optional WebTransportCloseInfo closeInfo = {}); readonly attribute WebTransportDatagramDuplexStream datagrams; @@ -46,6 +47,12 @@ interface WebTransport { readonly attribute ReadableStream incomingUnidirectionalStreams; }; +enum WebTransportReliabilityMode { + "pending", + "reliable-only", + "supports-unreliable", +}; + dictionary WebTransportHash { DOMString algorithm; BufferSource value; @@ -88,11 +95,6 @@ dictionary WebTransportStats { WebTransportDatagramStats datagrams; }; -[Exposed=(Window,Worker), SecureContext, Transferable] -interface WebTransportSendStream : WritableStream { - Promise getStats(); -}; - dictionary WebTransportDatagramStats { DOMHighResTimeStamp timestamp; unsigned long long expiredOutgoing; @@ -100,6 +102,11 @@ dictionary WebTransportDatagramStats { unsigned long long lostOutgoing; }; +[Exposed=(Window,Worker), SecureContext, Transferable] +interface WebTransportSendStream : WritableStream { + Promise getStats(); +}; + dictionary WebTransportSendStreamStats { DOMHighResTimeStamp timestamp; unsigned long long bytesWritten; @@ -124,17 +131,17 @@ interface WebTransportBidirectionalStream { readonly attribute WebTransportSendStream writable; }; -[Exposed=(Window,Worker), SecureContext] +[Exposed=(Window,Worker), Serializable, SecureContext] interface WebTransportError : DOMException { - constructor(optional WebTransportErrorInit init = {}); + constructor(optional DOMString message = "", optional WebTransportErrorOptions options = {}); readonly attribute WebTransportErrorSource source; readonly attribute octet? streamErrorCode; }; -dictionary WebTransportErrorInit { - [Clamp] octet streamErrorCode; - DOMString message; +dictionary WebTransportErrorOptions { + WebTransportErrorSource source = "stream"; + [Clamp] octet? streamErrorCode = null; }; enum WebTransportErrorSource { From dbea2a29e1ddf14d01bc16d370828cce409d2d11 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 8 May 2023 11:16:17 -0400 Subject: [PATCH 195/641] add verbose name for internal `ptr` property (#3408) * add verbose name for internal `ptr` property Fixes #3388 Signed-off-by: Oliver T * fixed failing tests Signed-off-by: Oliver T --------- Signed-off-by: Oliver T --- crates/cli-support/src/js/binding.rs | 8 ++++---- crates/cli-support/src/js/mod.rs | 8 ++++---- tests/wasm/classes.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 9107160d12d..4f4bea6d841 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -134,14 +134,14 @@ impl<'a, 'b> Builder<'a, 'b> { drop(params.next()); if js.cx.config.debug { js.prelude( - "if (this.ptr == 0) throw new Error('Attempt to use a moved value');", + "if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');", ); } if consumes_self { js.prelude("const ptr = this.__destroy_into_raw();"); js.args.push("ptr".into()); } else { - js.args.push("this.ptr".into()); + js.args.push("this.__wbg_ptr".into()); } } None => {} @@ -503,7 +503,7 @@ impl<'a, 'b> JsBuilder<'a, 'b> { } self.prelude(&format!( "\ - if ({0}.ptr === 0) {{ + if ({0}.__wbg_ptr === 0) {{ throw new Error('Attempt to use a moved value'); }} ", @@ -731,7 +731,7 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> let val = js.pop(); js.assert_class(&val, &class); js.assert_not_moved(&val); - js.push(format!("{}.ptr", val)); + js.push(format!("{}.__wbg_ptr", val)); } Instruction::I32FromOptionRust { class } => { diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index fb812c41f92..139f3151885 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -927,14 +927,14 @@ impl<'a> Context<'a> { static __wrap(ptr) {{ ptr = ptr >>> 0; const obj = Object.create({}.prototype); - obj.ptr = ptr; + obj.__wbg_ptr = ptr; {} return obj; }} ", name, if self.config.weak_refs { - format!("{}Finalization.register(obj, obj.ptr, obj);", name) + format!("{}Finalization.register(obj, obj.__wbg_ptr, obj);", name) } else { String::new() }, @@ -1010,8 +1010,8 @@ impl<'a> Context<'a> { dst.push_str(&format!( " __destroy_into_raw() {{ - const ptr = this.ptr; - this.ptr = 0; + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; {} return ptr; }} diff --git a/tests/wasm/classes.js b/tests/wasm/classes.js index bcb61e05402..8e503c65803 100644 --- a/tests/wasm/classes.js +++ b/tests/wasm/classes.js @@ -228,7 +228,7 @@ exports.js_test_inspectable_classes = () => { assert.strictEqual(not_inspectable.toJSON, undefined); assert.strictEqual(not_inspectable.toString(), '[object Object]'); // Non-inspectable classes in Node.js have no special console.log formatting - assert.strictEqual(console_log_to_string(not_inspectable), `NotInspectable { ptr: ${not_inspectable.ptr} }`); + assert.strictEqual(console_log_to_string(not_inspectable), `NotInspectable { __wbg_ptr: ${not_inspectable.__wbg_ptr} }`); inspectable.free(); not_inspectable.free(); }; From a5973d6039b6608abe85d5b64c86ebca6a4fc0b2 Mon Sep 17 00:00:00 2001 From: mx Date: Tue, 9 May 2023 03:16:47 +1200 Subject: [PATCH 196/641] Fixed document.currentScript is null #3398 (#3402) * Fixed document.currentScript is null #3398 * document.currentScript can be null in browser extensions * its src prop can also be null, but I don't know under what conditions * replace null with '' and use location.href * see rustwasm/wasm-bindgen#3398 for details * Simplified document.currentScript check #3398 * Removed null check for document.currentScript.src #3398 * Replaced document.currentScript check with typeoff #3398 --- crates/cli-support/src/js/mod.rs | 3 ++- crates/cli/tests/wasm-bindgen/main.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 139f3151885..c6b495fb633 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -377,12 +377,13 @@ impl<'a> Context<'a> { // In `--target no-modules` mode we need to both expose a name on // the global object as well as generate our own custom start // function. + // `document.currentScript` property can be null in browser extensions OutputMode::NoModules { global } => { js.push_str("const __exports = {};\n"); js.push_str("let script_src;\n"); js.push_str( "\ - if (typeof document !== 'undefined') { + if (typeof document !== 'undefined' && typeof document.currentScript !== 'null') { script_src = new URL(document.currentScript.src, location.href).toString(); }\n", ); diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 31ebc606340..825be0972e1 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -355,7 +355,7 @@ fn default_module_path_target_no_modules() { fs::read_to_string(out_dir.join("default_module_path_target_no_modules.js")).unwrap(); assert!(contents.contains( "\ - if (typeof document !== 'undefined') { + if (typeof document !== 'undefined' && typeof document.currentScript !== 'null') { script_src = new URL(document.currentScript.src, location.href).toString(); }", )); From 43e16a70aedf935e0cdccfa29f6ba4cd9030b995 Mon Sep 17 00:00:00 2001 From: Nam Se Hyun <3580430+namse@users.noreply.github.com> Date: Tue, 9 May 2023 00:17:28 +0900 Subject: [PATCH 197/641] Update ParentNode (#3386) * Update ParentNode * Keep only --- crates/web-sys/src/features/gen_Document.rs | 196 ++++++++++++++++++ .../src/features/gen_DocumentFragment.rs | 196 ++++++++++++++++++ crates/web-sys/src/features/gen_Element.rs | 191 +++++++++++++++++ .../web-sys/webidls/enabled/ParentNode.webidl | 2 + 4 files changed, 585 insertions(+) diff --git a/crates/web-sys/src/features/gen_Document.rs b/crates/web-sys/src/features/gen_Document.rs index 6d8cd542cb6..9128ddb88d7 100644 --- a/crates/web-sys/src/features/gen_Document.rs +++ b/crates/web-sys/src/features/gen_Document.rs @@ -2849,6 +2849,202 @@ extern "C" { nodes_6: &str, nodes_7: &str, ) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , variadic , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node(this: &Document, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_0(this: &Document); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_1(this: &Document, nodes_1: &Node); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_2(this: &Document, nodes_1: &Node, nodes_2: &Node); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_3( + this: &Document, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_4( + this: &Document, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_5( + this: &Document, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_6( + this: &Document, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_node_7( + this: &Document, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + nodes_7: &Node, + ); + # [wasm_bindgen (method , structural , variadic , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str(this: &Document, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_0(this: &Document); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_1(this: &Document, nodes_1: &str); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_2(this: &Document, nodes_1: &str, nodes_2: &str); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_3( + this: &Document, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_4( + this: &Document, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_5( + this: &Document, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_6( + this: &Document, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Document" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn replace_children_with_str_7( + this: &Document, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + nodes_7: &str, + ); #[cfg(feature = "XPathExpression")] # [wasm_bindgen (catch , method , structural , js_class = "Document" , js_name = createExpression)] #[doc = "The `createExpression()` method."] diff --git a/crates/web-sys/src/features/gen_DocumentFragment.rs b/crates/web-sys/src/features/gen_DocumentFragment.rs index fa64d510a18..b35f33f0610 100644 --- a/crates/web-sys/src/features/gen_DocumentFragment.rs +++ b/crates/web-sys/src/features/gen_DocumentFragment.rs @@ -497,4 +497,200 @@ extern "C" { nodes_6: &str, nodes_7: &str, ) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , variadic , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node(this: &DocumentFragment, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_0(this: &DocumentFragment); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_1(this: &DocumentFragment, nodes_1: &Node); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_2(this: &DocumentFragment, nodes_1: &Node, nodes_2: &Node); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_3( + this: &DocumentFragment, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_4( + this: &DocumentFragment, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_5( + this: &DocumentFragment, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_6( + this: &DocumentFragment, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_node_7( + this: &DocumentFragment, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + nodes_7: &Node, + ); + # [wasm_bindgen (method , structural , variadic , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str(this: &DocumentFragment, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_0(this: &DocumentFragment); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_1(this: &DocumentFragment, nodes_1: &str); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_2(this: &DocumentFragment, nodes_1: &str, nodes_2: &str); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_3( + this: &DocumentFragment, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_4( + this: &DocumentFragment, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_5( + this: &DocumentFragment, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_6( + this: &DocumentFragment, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + ); + # [wasm_bindgen (method , structural , js_class = "DocumentFragment" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`*"] + pub fn replace_children_with_str_7( + this: &DocumentFragment, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + nodes_7: &str, + ); } diff --git a/crates/web-sys/src/features/gen_Element.rs b/crates/web-sys/src/features/gen_Element.rs index 011b65d28b7..c3b2fd0bf71 100644 --- a/crates/web-sys/src/features/gen_Element.rs +++ b/crates/web-sys/src/features/gen_Element.rs @@ -1949,4 +1949,195 @@ extern "C" { nodes_6: &str, nodes_7: &str, ) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , variadic , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node(this: &Element, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_0(this: &Element); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_1(this: &Element, nodes_1: &Node); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_2(this: &Element, nodes_1: &Node, nodes_2: &Node); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_3( + this: &Element, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_4( + this: &Element, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_5( + this: &Element, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_6( + this: &Element, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_node_7( + this: &Element, + nodes_1: &Node, + nodes_2: &Node, + nodes_3: &Node, + nodes_4: &Node, + nodes_5: &Node, + nodes_6: &Node, + nodes_7: &Node, + ); + # [wasm_bindgen (method , structural , variadic , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str(this: &Element, nodes: &::js_sys::Array); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_0(this: &Element); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_1(this: &Element, nodes_1: &str); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_2(this: &Element, nodes_1: &str, nodes_2: &str); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_3(this: &Element, nodes_1: &str, nodes_2: &str, nodes_3: &str); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_4( + this: &Element, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_5( + this: &Element, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_6( + this: &Element, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + ); + # [wasm_bindgen (method , structural , js_class = "Element" , js_name = replaceChildren)] + #[doc = "The `replaceChildren()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`*"] + pub fn replace_children_with_str_7( + this: &Element, + nodes_1: &str, + nodes_2: &str, + nodes_3: &str, + nodes_4: &str, + nodes_5: &str, + nodes_6: &str, + nodes_7: &str, + ); } diff --git a/crates/web-sys/webidls/enabled/ParentNode.webidl b/crates/web-sys/webidls/enabled/ParentNode.webidl index 5256d189b95..b94c876f388 100644 --- a/crates/web-sys/webidls/enabled/ParentNode.webidl +++ b/crates/web-sys/webidls/enabled/ParentNode.webidl @@ -21,4 +21,6 @@ interface mixin ParentNode { undefined prepend((Node or DOMString)... nodes); [CEReactions, Throws, Unscopable] undefined append((Node or DOMString)... nodes); + [CEReactions, Unscopable] + undefined replaceChildren((Node or DOMString)... nodes); }; From 4afb62c62b0130d1374da1aec492d99e3b5159d5 Mon Sep 17 00:00:00 2001 From: Erik Moqvist Date: Mon, 8 May 2023 17:18:13 +0200 Subject: [PATCH 198/641] Add RTCPeerConnection connectionState (#3380) --- crates/web-sys/Cargo.toml | 1 + .../src/features/gen_RtcPeerConnection.rs | 25 +++++++++++++++++++ .../features/gen_RtcPeerConnectionState.rs | 15 +++++++++++ crates/web-sys/src/features/mod.rs | 6 +++++ .../webidls/enabled/RTCPeerConnection.webidl | 11 ++++++++ 5 files changed, 58 insertions(+) create mode 100644 crates/web-sys/src/features/gen_RtcPeerConnectionState.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 780a66e80a2..660e68ffc12 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1069,6 +1069,7 @@ RtcOutboundRtpStreamStats = [] RtcPeerConnection = ["EventTarget"] RtcPeerConnectionIceEvent = ["Event"] RtcPeerConnectionIceEventInit = [] +RtcPeerConnectionState = [] RtcPriorityType = [] RtcRtcpParameters = [] RtcRtpCodecParameters = [] diff --git a/crates/web-sys/src/features/gen_RtcPeerConnection.rs b/crates/web-sys/src/features/gen_RtcPeerConnection.rs index 455a8820beb..2abdbadff64 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnection.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnection.rs @@ -90,6 +90,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceConnectionState`, `RtcPeerConnection`*"] pub fn ice_connection_state(this: &RtcPeerConnection) -> RtcIceConnectionState; + #[cfg(feature = "RtcPeerConnectionState")] + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnection" , js_name = connectionState)] + #[doc = "Getter for the `connectionState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/connectionState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`, `RtcPeerConnectionState`*"] + pub fn connection_state(this: &RtcPeerConnection) -> RtcPeerConnectionState; # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnection" , js_name = peerIdentity)] #[doc = "Getter for the `peerIdentity` field of this object."] #[doc = ""] @@ -236,6 +244,23 @@ extern "C" { this: &RtcPeerConnection, value: Option<&::js_sys::Function>, ); + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnection" , js_name = onconnectionstatechange)] + #[doc = "Getter for the `onconnectionstatechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/onconnectionstatechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] + pub fn onconnectionstatechange(this: &RtcPeerConnection) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "RTCPeerConnection" , js_name = onconnectionstatechange)] + #[doc = "Setter for the `onconnectionstatechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/onconnectionstatechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] + pub fn set_onconnectionstatechange( + this: &RtcPeerConnection, + value: Option<&::js_sys::Function>, + ); # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnection" , js_name = ondatachannel)] #[doc = "Getter for the `ondatachannel` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionState.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionState.rs new file mode 100644 index 00000000000..37b11089709 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcPeerConnectionState.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `RtcPeerConnectionState` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionState`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RtcPeerConnectionState { + Closed = "closed", + Failed = "failed", + Disconnected = "disconnected", + New = "new", + Connecting = "connecting", + Connected = "connected", +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 8b758e8575c..d8c2dc74f10 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -6232,6 +6232,12 @@ mod gen_RtcPeerConnectionIceEventInit; #[cfg(feature = "RtcPeerConnectionIceEventInit")] pub use gen_RtcPeerConnectionIceEventInit::*; +#[cfg(feature = "RtcPeerConnectionState")] +#[allow(non_snake_case)] +mod gen_RtcPeerConnectionState; +#[cfg(feature = "RtcPeerConnectionState")] +pub use gen_RtcPeerConnectionState::*; + #[cfg(feature = "RtcPriorityType")] #[allow(non_snake_case)] mod gen_RtcPriorityType; diff --git a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl index 9c74b611efd..b91563e99c3 100644 --- a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl +++ b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl @@ -36,6 +36,15 @@ enum RTCIceConnectionState { "closed" }; +enum RTCPeerConnectionState { + "closed", + "failed", + "disconnected", + "new", + "connecting", + "connected" +}; + dictionary RTCDataChannelInit { boolean ordered = true; unsigned short maxPacketLifeTime; @@ -89,6 +98,7 @@ interface RTCPeerConnection : EventTarget { readonly attribute boolean? canTrickleIceCandidates; readonly attribute RTCIceGatheringState iceGatheringState; readonly attribute RTCIceConnectionState iceConnectionState; + readonly attribute RTCPeerConnectionState connectionState; [Pref="media.peerconnection.identity.enabled"] readonly attribute Promise peerIdentity; [Pref="media.peerconnection.identity.enabled"] @@ -130,6 +140,7 @@ interface RTCPeerConnection : EventTarget { attribute EventHandler onremovestream; attribute EventHandler oniceconnectionstatechange; attribute EventHandler onicegatheringstatechange; + attribute EventHandler onconnectionstatechange; Promise getStats (optional MediaStreamTrack? selector); From ccbc14fe6c20b69f182b74b11957b7ca022e9190 Mon Sep 17 00:00:00 2001 From: Jonas Matser Date: Mon, 8 May 2023 17:18:32 +0200 Subject: [PATCH 199/641] Add missing field 'type' to RegistrationOptions (#3375) --- .../web-sys/src/features/gen_RegistrationOptions.rs | 13 +++++++++++++ .../webidls/enabled/ServiceWorkerContainer.webidl | 1 + 2 files changed, 14 insertions(+) diff --git a/crates/web-sys/src/features/gen_RegistrationOptions.rs b/crates/web-sys/src/features/gen_RegistrationOptions.rs index 9c186a6c8e6..28c45c79696 100644 --- a/crates/web-sys/src/features/gen_RegistrationOptions.rs +++ b/crates/web-sys/src/features/gen_RegistrationOptions.rs @@ -32,6 +32,19 @@ impl RegistrationOptions { let _ = r; self } + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] + pub fn type_(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[cfg(feature = "ServiceWorkerUpdateViaCache")] #[doc = "Change the `updateViaCache` field of this object."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/ServiceWorkerContainer.webidl b/crates/web-sys/webidls/enabled/ServiceWorkerContainer.webidl index 3d0bc34f261..384b53cd4bc 100644 --- a/crates/web-sys/webidls/enabled/ServiceWorkerContainer.webidl +++ b/crates/web-sys/webidls/enabled/ServiceWorkerContainer.webidl @@ -42,5 +42,6 @@ partial interface ServiceWorkerContainer { dictionary RegistrationOptions { USVString scope; + USVString type; ServiceWorkerUpdateViaCache updateViaCache = "imports"; }; From 8994cb94dae9c7f8b9d0e034729071232440d1ea Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 8 May 2023 17:19:24 +0200 Subject: [PATCH 200/641] Update cargo dependency resolver to v2 (#3358) --- .github/workflows/main.yml | 1 - Cargo.toml | 1 + crates/macro/Cargo.toml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f938c8538f..11e0db624cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,6 @@ jobs: - run: cargo test --target wasm32-unknown-unknown - run: cargo test --target wasm32-unknown-unknown --features serde-serialize - run: cargo test --target wasm32-unknown-unknown --features enable-interning - - run: cargo test --target wasm32-unknown-unknown -p no-std - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures - run: cargo test --target wasm32-unknown-unknown --test wasm env: diff --git a/Cargo.toml b/Cargo.toml index d7179ac09a7..d0c845491e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,6 +100,7 @@ members = [ "examples/synchronous-instantiation", "tests/no-std", ] +resolver = "2" [patch.crates-io] wasm-bindgen = { path = '.' } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 818bf5c4bfb..a9f714d6e6b 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -27,4 +27,4 @@ quote = "1.0" trybuild = "1.0" wasm-bindgen = { path = "../..", version = "0.2.84" } wasm-bindgen-futures = { path = "../futures", version = "0.4.34" } -web-sys = { path = "../web-sys", version = "0.3.61" } +web-sys = { path = "../web-sys", version = "0.3.61", features = ["Worker"] } From 80b616e3de7c3d0acda81dd4bea3c86841ea1fa3 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 8 May 2023 17:20:08 +0200 Subject: [PATCH 201/641] Fix `TextEncoder` stub name (#3357) --- crates/cli-support/src/js/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index c6b495fb633..371e7b03ec1 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1440,7 +1440,7 @@ impl<'a> Context<'a> { if !self.should_write_global("text_encoder") { return Ok(()); } - self.expose_text_processor("TextEncoder", "('utf-8')", None) + self.expose_text_processor("TextEncoder", "encode", "('utf-8')", None) } fn expose_text_decoder(&mut self) -> Result<(), Error> { @@ -1456,6 +1456,7 @@ impl<'a> Context<'a> { // `fatal` is needed to catch any weird encoding bugs when sending a string from Rust to JS self.expose_text_processor( "TextDecoder", + "decode", "('utf-8', { ignoreBOM: true, fatal: true })", init, )?; @@ -1466,6 +1467,7 @@ impl<'a> Context<'a> { fn expose_text_processor( &mut self, s: &str, + op: &str, args: &str, init: Option<&str>, ) -> Result<(), Error> { @@ -1496,7 +1498,7 @@ impl<'a> Context<'a> { | OutputMode::Web | OutputMode::NoModules { .. } | OutputMode::Bundler { browser_only: true } => { - self.global(&format!("const cached{0} = (typeof {0} !== 'undefined' ? new {0}{1} : {{ decode: () => {{ throw Error('{0} not available') }} }} );", s, args)) + self.global(&format!("const cached{0} = (typeof {0} !== 'undefined' ? new {0}{1} : {{ {2}: () => {{ throw Error('{0} not available') }} }} );", s, args, op)) } }; From e76fcfd8021deaeb49bc949b55551f0a3baf8416 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 8 May 2023 17:20:28 +0200 Subject: [PATCH 202/641] Update mdbook (#3353) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11e0db624cb..8177b72c89b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -384,7 +384,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: | - curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf - + curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar xzf - echo $PWD >> $GITHUB_PATH - run: (cd guide && mdbook build) - uses: actions/upload-artifact@v3 From 5600b159bd8ad5597cb526c2337e52ffd57f874c Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 8 May 2023 17:20:44 +0200 Subject: [PATCH 203/641] Remove outdated browser support caveats (#3352) --- guide/src/reference/browser-support.md | 51 ++------------------------ 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/guide/src/reference/browser-support.md b/guide/src/reference/browser-support.md index ecf8fbe52da..f2a05cad3f9 100644 --- a/guide/src/reference/browser-support.md +++ b/guide/src/reference/browser-support.md @@ -2,9 +2,9 @@ The output of `wasm-bindgen` includes a JS file, and as a result it's good to know what browsers that file is expected to be used in! By default the output -uses ES modules which isn't implemented in all browsers today, but when using a -bundler (like Webpack) you should be able to produce output suitable for all -browsers. +uses ES modules with Wasm imports which isn't implemented in browsers today, +but when using a bundler (like Webpack) or `--target web` you should be able +to produce output suitable for all browsers. Firefox, Chrome, Safari, and Edge browsers are all supported by `wasm-bindgen`. If you find a problem in one of these browsers please [report @@ -19,54 +19,9 @@ also like to be aware of it! an example of doing this too](../examples/wasm2js.html)). Note that at this time no bundler will do this by default, but we'd love to document plugins which do this if you are aware of one! - -* **Edge before 79+** - the `TextEncoder` and `TextDecoder` APIs, which - `wasm-bindgen` uses to encode/decode strings between JS and Rust, were not - available before version 79. You can polyfill this with at least one of two - strategies: - - 1. If using a bundler, you can likely configure the bundler to polyfill these - types by default. For example if you're using Webpack you can use the - [`ProvidePlugin` interface][wpp] like so after also adding - [`text-encoding`] to your `package.json` - - ```js - const webpack = require('webpack'); - module.exports = { - plugins: [ - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) - ] - // ... other configuration options - }; - ``` - - **Warning:** doing this implies the polyfill will always be used, - even if native APIs are available. This has a very significant - performance impact (the polyfill was measured to be 100x slower in Chromium)! - - 2. If you're not using a bundler you can also include support manually by - adding a `
diff --git a/examples/todomvc/index.js b/examples/todomvc/index.js index 8504fa51418..fc065dbb0dd 100644 --- a/examples/todomvc/index.js +++ b/examples/todomvc/index.js @@ -1,6 +1,7 @@ // For more comments about what's going on here, check out the `hello_world` // example const rust = import('./pkg'); +const css = import('./index.css'); rust .then(m => m.run()) diff --git a/examples/todomvc/package.json b/examples/todomvc/package.json index 8332534cfb4..8d72e6a97a3 100644 --- a/examples/todomvc/package.json +++ b/examples/todomvc/package.json @@ -5,7 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", + "css-loader": "^6.8.1", "html-webpack-plugin": "^5.3.2", + "mini-css-extract-plugin": "^2.7.6", "text-encoding": "^0.7.0", "webpack": "^5.49.0", "webpack-cli": "^4.7.2", diff --git a/examples/todomvc/webpack.config.js b/examples/todomvc/webpack.config.js index 95559a4445e..27eafe3279d 100644 --- a/examples/todomvc/webpack.config.js +++ b/examples/todomvc/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require('webpack'); const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { entry: './index.js', @@ -13,6 +14,7 @@ module.exports = { new HtmlWebpackPlugin({ template: 'index.html' }), + new MiniCssExtractPlugin(), new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), @@ -26,5 +28,13 @@ module.exports = { mode: 'development', experiments: { asyncWebAssembly: true - } + }, + module: { + rules: [ + { + test: /\.css$/, + use: [MiniCssExtractPlugin.loader, 'css-loader'], + } + ] + } }; From ed43f546bcfb76e10c9615968faa3a1001b227ea Mon Sep 17 00:00:00 2001 From: Birk Tjelmeland Date: Fri, 11 Aug 2023 17:18:14 +0200 Subject: [PATCH 257/641] Add `HtmlElement` `inert` property (#3557) See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert --- crates/web-sys/src/features/gen_HtmlElement.rs | 14 ++++++++++++++ crates/web-sys/webidls/enabled/HTMLElement.webidl | 2 ++ 2 files changed, 16 insertions(+) diff --git a/crates/web-sys/src/features/gen_HtmlElement.rs b/crates/web-sys/src/features/gen_HtmlElement.rs index 91b027780d4..e3259400231 100644 --- a/crates/web-sys/src/features/gen_HtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlElement.rs @@ -118,6 +118,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_hidden(this: &HtmlElement, value: bool); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = inert)] + #[doc = "Getter for the `inert` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn inert(this: &HtmlElement) -> bool; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = inert)] + #[doc = "Setter for the `inert` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_inert(this: &HtmlElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = tabIndex)] #[doc = "Getter for the `tabIndex` field of this object."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/HTMLElement.webidl b/crates/web-sys/webidls/enabled/HTMLElement.webidl index 3ec1d63d6fc..196638e71fb 100644 --- a/crates/web-sys/webidls/enabled/HTMLElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLElement.webidl @@ -35,6 +35,8 @@ interface HTMLElement : Element { // user interaction [CEReactions, SetterThrows, Pure] attribute boolean hidden; + [CEReactions] + attribute boolean inert; [NeedsCallerType] undefined click(); [CEReactions, SetterThrows, Pure] From f5d2e5c39d7fdf6b92f70fad78fa373e8c50cd5a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 22 Aug 2023 10:58:43 +0200 Subject: [PATCH 258/641] Fix changelog (#3565) --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3185009da14..5964d2a9943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,13 @@ * Add support for installing pre-built artifacts of `wasm-bindgen-cli` via `cargo binstall wasm-bindgen-cli`. + [#3544](https://github.com/rustwasm/wasm-bindgen/pull/3544) + +* Add bindings for `RTCDataChannel.id`. + [#3547](https://github.com/rustwasm/wasm-bindgen/pull/3547) + +* Add bindings for `HTMLElement.inert`. + [#3557](https://github.com/rustwasm/wasm-bindgen/pull/3557) ### Changed @@ -53,6 +60,12 @@ * Fixed `wasm_bindgen_test` macro to handle raw identifiers in test names. [#3541](https://github.com/rustwasm/wasm-bindgen/pull/3541) +* Fixed Cargo license field to follow the SPDX 2.1 license expression standard. + [#3529](https://github.com/rustwasm/wasm-bindgen/pull/3529) + +* Use fully qualified paths in the `wasm_bindgen_test` macro. + [#3549](https://github.com/rustwasm/wasm-bindgen/pull/3549) + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. From f906f6dad692d82498102c3363be8db8c922f4e3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 25 Aug 2023 00:04:26 +0200 Subject: [PATCH 259/641] Fix Clippy (#3567) --- crates/test-macro/src/lib.rs | 5 ++--- crates/webidl/src/generator.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 848ffaf25dc..53050be011c 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -94,14 +94,13 @@ pub fn wasm_bindgen_test( // main test harness. This is the entry point for all tests. let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); tokens.extend( - (quote! { + quote! { #[no_mangle] pub extern "C" fn #name(cx: &::wasm_bindgen_test::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body } - }) - .into_iter(), + }, ); tokens.extend(leading_tokens); diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index c167ff0f248..cf7e942cdc8 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -774,7 +774,7 @@ impl Dictionary { } }; - base_stream.extend(default_impl.into_iter()); + base_stream.extend(default_impl); } base_stream From 6788a8fb157a8b63deb655a68ff82308f4302a8a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 25 Aug 2023 11:39:33 +0200 Subject: [PATCH 260/641] Prioritized Task Scheduling API (#3566) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 11 ++ .../src/features/gen_IsInputPendingOptions.rs | 58 +++++++++ crates/web-sys/src/features/gen_Navigator.rs | 12 ++ crates/web-sys/src/features/gen_Scheduler.rs | 46 +++++++ .../features/gen_SchedulerPostTaskOptions.rs | 95 ++++++++++++++ crates/web-sys/src/features/gen_Scheduling.rs | 45 +++++++ .../src/features/gen_TaskController.rs | 54 ++++++++ .../src/features/gen_TaskControllerInit.rs | 59 +++++++++ .../web-sys/src/features/gen_TaskPriority.rs | 17 +++ .../features/gen_TaskPriorityChangeEvent.rs | 46 +++++++ .../gen_TaskPriorityChangeEventInit.rs | 118 ++++++++++++++++++ crates/web-sys/src/features/gen_TaskSignal.rs | 77 ++++++++++++ .../src/features/gen_TaskSignalAnyInit.rs | 58 +++++++++ crates/web-sys/src/features/gen_Window.rs | 12 ++ .../src/features/gen_WorkerGlobalScope.rs | 12 ++ crates/web-sys/src/features/mod.rs | 66 ++++++++++ .../webidls/unstable/is-input-pending.webidl | 11 ++ .../webidls/unstable/scheduling-apis.webidl | 58 +++++++++ 19 files changed, 858 insertions(+) create mode 100644 crates/web-sys/src/features/gen_IsInputPendingOptions.rs create mode 100644 crates/web-sys/src/features/gen_Scheduler.rs create mode 100644 crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs create mode 100644 crates/web-sys/src/features/gen_Scheduling.rs create mode 100644 crates/web-sys/src/features/gen_TaskController.rs create mode 100644 crates/web-sys/src/features/gen_TaskControllerInit.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriority.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs create mode 100644 crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs create mode 100644 crates/web-sys/src/features/gen_TaskSignal.rs create mode 100644 crates/web-sys/src/features/gen_TaskSignalAnyInit.rs create mode 100644 crates/web-sys/webidls/unstable/is-input-pending.webidl create mode 100644 crates/web-sys/webidls/unstable/scheduling-apis.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 5964d2a9943..44fd41c535d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ * Add bindings for `HTMLElement.inert`. [#3557](https://github.com/rustwasm/wasm-bindgen/pull/3557) +* Add unstable bindings for the Prioritized Task Scheduling API. + [#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index c648fdeb487..64d7700131b 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -733,6 +733,7 @@ IntersectionObserverEntry = [] IntersectionObserverEntryInit = [] IntersectionObserverInit = [] IntlUtils = [] +IsInputPendingOptions = [] IterableKeyAndValueResult = [] IterableKeyOrValueResult = [] IterationCompositeOperation = [] @@ -1130,6 +1131,9 @@ RtcdtmfToneChangeEvent = ["Event"] RtcdtmfToneChangeEventInit = [] RtcrtpContributingSourceStats = [] RtcrtpStreamStats = [] +Scheduler = [] +SchedulerPostTaskOptions = [] +Scheduling = [] Screen = ["EventTarget"] ScreenColorGamut = [] ScreenLuminance = [] @@ -1338,6 +1342,13 @@ SvggElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsEleme SvgmPathElement = ["Element", "EventTarget", "Node", "SvgElement"] SvgsvgElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsElement"] SvgtSpanElement = ["Element", "EventTarget", "Node", "SvgElement", "SvgGraphicsElement", "SvgTextContentElement", "SvgTextPositioningElement"] +TaskController = ["AbortController"] +TaskControllerInit = [] +TaskPriority = [] +TaskPriorityChangeEvent = ["Event"] +TaskPriorityChangeEventInit = [] +TaskSignal = ["AbortSignal", "EventTarget"] +TaskSignalAnyInit = [] TcpReadyState = [] TcpServerSocket = ["EventTarget"] TcpServerSocketEvent = ["Event"] diff --git a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs new file mode 100644 index 00000000000..9820eb88b0f --- /dev/null +++ b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs @@ -0,0 +1,58 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = IsInputPendingOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `IsInputPendingOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type IsInputPendingOptions; +} +#[cfg(web_sys_unstable_apis)] +impl IsInputPendingOptions { + #[doc = "Construct a new `IsInputPendingOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `includeContinuous` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn include_continuous(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("includeContinuous"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for IsInputPendingOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 7bb30670ff3..dbd6fad8961 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -201,6 +201,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn xr(this: &Navigator) -> XrSystem; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduling")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = scheduling)] + #[doc = "Getter for the `scheduling` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/scheduling)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`, `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduling(this: &Navigator) -> Scheduling; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = hardwareConcurrency)] #[doc = "Getter for the `hardwareConcurrency` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Scheduler.rs b/crates/web-sys/src/features/gen_Scheduler.rs new file mode 100644 index 00000000000..09966ed0c61 --- /dev/null +++ b/crates/web-sys/src/features/gen_Scheduler.rs @@ -0,0 +1,46 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Scheduler , typescript_type = "Scheduler")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Scheduler` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Scheduler; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Scheduler" , js_name = postTask)] + #[doc = "The `postTask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn post_task(this: &Scheduler, callback: &::js_sys::Function) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SchedulerPostTaskOptions")] + # [wasm_bindgen (method , structural , js_class = "Scheduler" , js_name = postTask)] + #[doc = "The `postTask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn post_task_with_options( + this: &Scheduler, + callback: &::js_sys::Function, + options: &SchedulerPostTaskOptions, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs new file mode 100644 index 00000000000..d1e8818cb04 --- /dev/null +++ b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs @@ -0,0 +1,95 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SchedulerPostTaskOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SchedulerPostTaskOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SchedulerPostTaskOptions; +} +#[cfg(web_sys_unstable_apis)] +impl SchedulerPostTaskOptions { + #[doc = "Construct a new `SchedulerPostTaskOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn delay(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SchedulerPostTaskOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Scheduling.rs b/crates/web-sys/src/features/gen_Scheduling.rs new file mode 100644 index 00000000000..a6f0748e0d6 --- /dev/null +++ b/crates/web-sys/src/features/gen_Scheduling.rs @@ -0,0 +1,45 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Scheduling , typescript_type = "Scheduling")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Scheduling` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Scheduling; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "Scheduling" , js_name = isInputPending)] + #[doc = "The `isInputPending()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling/isInputPending)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_input_pending(this: &Scheduling) -> bool; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IsInputPendingOptions")] + # [wasm_bindgen (method , structural , js_class = "Scheduling" , js_name = isInputPending)] + #[doc = "The `isInputPending()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Scheduling/isInputPending)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`, `Scheduling`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_input_pending_with_is_input_pending_options( + this: &Scheduling, + is_input_pending_options: &IsInputPendingOptions, + ) -> bool; +} diff --git a/crates/web-sys/src/features/gen_TaskController.rs b/crates/web-sys/src/features/gen_TaskController.rs new file mode 100644 index 00000000000..f108a34c42c --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskController.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = AbortController , extends = :: js_sys :: Object , js_name = TaskController , typescript_type = "TaskController")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskController` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskController; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "TaskController")] + #[doc = "The `new TaskController(..)` constructor, creating a new instance of `TaskController`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskControllerInit")] + #[wasm_bindgen(catch, constructor, js_class = "TaskController")] + #[doc = "The `new TaskController(..)` constructor, creating a new instance of `TaskController`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/TaskController)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`, `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_init(init: &TaskControllerInit) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (method , structural , js_class = "TaskController" , js_name = setPriority)] + #[doc = "The `setPriority()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/setPriority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskController`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_priority(this: &TaskController, priority: TaskPriority); +} diff --git a/crates/web-sys/src/features/gen_TaskControllerInit.rs b/crates/web-sys/src/features/gen_TaskControllerInit.rs new file mode 100644 index 00000000000..e66e8663d71 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskControllerInit.rs @@ -0,0 +1,59 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskControllerInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskControllerInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskControllerInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskControllerInit { + #[doc = "Construct a new `TaskControllerInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for TaskControllerInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_TaskPriority.rs b/crates/web-sys/src/features/gen_TaskPriority.rs new file mode 100644 index 00000000000..4d04fe23c15 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriority.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `TaskPriority` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `TaskPriority`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TaskPriority { + UserBlocking = "user-blocking", + UserVisible = "user-visible", + Background = "background", +} diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs new file mode 100644 index 00000000000..618696a7bde --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEvent.rs @@ -0,0 +1,46 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = TaskPriorityChangeEvent , typescript_type = "TaskPriorityChangeEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskPriorityChangeEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskPriorityChangeEvent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (structural , method , getter , js_class = "TaskPriorityChangeEvent" , js_name = previousPriority)] + #[doc = "Getter for the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent/previousPriority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn previous_priority(this: &TaskPriorityChangeEvent) -> TaskPriority; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriorityChangeEventInit")] + #[wasm_bindgen(catch, constructor, js_class = "TaskPriorityChangeEvent")] + #[doc = "The `new TaskPriorityChangeEvent(..)` constructor, creating a new instance of `TaskPriorityChangeEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskPriorityChangeEvent/TaskPriorityChangeEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEvent`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + type_: &str, + priority_change_event_init_dict: &TaskPriorityChangeEventInit, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs new file mode 100644 index 00000000000..9992965d1cc --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs @@ -0,0 +1,118 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskPriorityChangeEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskPriorityChangeEventInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskPriorityChangeEventInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskPriorityChangeEventInit { + #[cfg(feature = "TaskPriority")] + #[doc = "Construct a new `TaskPriorityChangeEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(previous_priority: TaskPriority) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.previous_priority(previous_priority); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("bubbles"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("cancelable"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn composed(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("composed"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Change the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn previous_priority(&mut self, val: TaskPriority) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("previousPriority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_TaskSignal.rs b/crates/web-sys/src/features/gen_TaskSignal.rs new file mode 100644 index 00000000000..be9a5564545 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskSignal.rs @@ -0,0 +1,77 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = AbortSignal , extends = EventTarget , extends = :: js_sys :: Object , js_name = TaskSignal , typescript_type = "TaskSignal")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskSignal` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskSignal; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + # [wasm_bindgen (structural , method , getter , js_class = "TaskSignal" , js_name = priority)] + #[doc = "Getter for the `priority` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/priority)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(this: &TaskSignal) -> TaskPriority; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "TaskSignal" , js_name = onprioritychange)] + #[doc = "Getter for the `onprioritychange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/onprioritychange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onprioritychange(this: &TaskSignal) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "TaskSignal" , js_name = onprioritychange)] + #[doc = "Setter for the `onprioritychange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/onprioritychange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onprioritychange(this: &TaskSignal, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] + #[doc = "The `any()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn any(signals: &::wasm_bindgen::JsValue) -> TaskSignal; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskSignalAnyInit")] + # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] + #[doc = "The `any()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignal`, `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn any_with_init(signals: &::wasm_bindgen::JsValue, init: &TaskSignalAnyInit) + -> TaskSignal; +} diff --git a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs new file mode 100644 index 00000000000..3a81c9682d8 --- /dev/null +++ b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs @@ -0,0 +1,58 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TaskSignalAnyInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TaskSignalAnyInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type TaskSignalAnyInit; +} +#[cfg(web_sys_unstable_apis)] +impl TaskSignalAnyInit { + #[doc = "Construct a new `TaskSignalAnyInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn priority(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("priority"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for TaskSignalAnyInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 03b43db44e9..e7540b80818 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1938,6 +1938,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheStorage`, `Window`*"] pub fn caches(this: &Window) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduler")] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = scheduler)] + #[doc = "Getter for the `scheduler` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduler(this: &Window) -> Scheduler; #[cfg(feature = "Storage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = sessionStorage)] #[doc = "Getter for the `sessionStorage` field of this object."] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index e63bf3be961..df08803f585 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -123,6 +123,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheStorage`, `WorkerGlobalScope`*"] pub fn caches(this: &WorkerGlobalScope) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Scheduler")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = scheduler)] + #[doc = "Getter for the `scheduler` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/scheduler)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Scheduler`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scheduler(this: &WorkerGlobalScope) -> Scheduler; # [wasm_bindgen (catch , method , structural , variadic , js_class = "WorkerGlobalScope" , js_name = importScripts)] #[doc = "The `importScripts()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 9ddcb4b267c..2a27e7dfe2b 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4210,6 +4210,12 @@ mod gen_IntlUtils; #[cfg(feature = "IntlUtils")] pub use gen_IntlUtils::*; +#[cfg(feature = "IsInputPendingOptions")] +#[allow(non_snake_case)] +mod gen_IsInputPendingOptions; +#[cfg(feature = "IsInputPendingOptions")] +pub use gen_IsInputPendingOptions::*; + #[cfg(feature = "IterableKeyAndValueResult")] #[allow(non_snake_case)] mod gen_IterableKeyAndValueResult; @@ -6592,6 +6598,24 @@ mod gen_RtcrtpStreamStats; #[cfg(feature = "RtcrtpStreamStats")] pub use gen_RtcrtpStreamStats::*; +#[cfg(feature = "Scheduler")] +#[allow(non_snake_case)] +mod gen_Scheduler; +#[cfg(feature = "Scheduler")] +pub use gen_Scheduler::*; + +#[cfg(feature = "SchedulerPostTaskOptions")] +#[allow(non_snake_case)] +mod gen_SchedulerPostTaskOptions; +#[cfg(feature = "SchedulerPostTaskOptions")] +pub use gen_SchedulerPostTaskOptions::*; + +#[cfg(feature = "Scheduling")] +#[allow(non_snake_case)] +mod gen_Scheduling; +#[cfg(feature = "Scheduling")] +pub use gen_Scheduling::*; + #[cfg(feature = "Screen")] #[allow(non_snake_case)] mod gen_Screen; @@ -7840,6 +7864,48 @@ mod gen_SvgtSpanElement; #[cfg(feature = "SvgtSpanElement")] pub use gen_SvgtSpanElement::*; +#[cfg(feature = "TaskController")] +#[allow(non_snake_case)] +mod gen_TaskController; +#[cfg(feature = "TaskController")] +pub use gen_TaskController::*; + +#[cfg(feature = "TaskControllerInit")] +#[allow(non_snake_case)] +mod gen_TaskControllerInit; +#[cfg(feature = "TaskControllerInit")] +pub use gen_TaskControllerInit::*; + +#[cfg(feature = "TaskPriority")] +#[allow(non_snake_case)] +mod gen_TaskPriority; +#[cfg(feature = "TaskPriority")] +pub use gen_TaskPriority::*; + +#[cfg(feature = "TaskPriorityChangeEvent")] +#[allow(non_snake_case)] +mod gen_TaskPriorityChangeEvent; +#[cfg(feature = "TaskPriorityChangeEvent")] +pub use gen_TaskPriorityChangeEvent::*; + +#[cfg(feature = "TaskPriorityChangeEventInit")] +#[allow(non_snake_case)] +mod gen_TaskPriorityChangeEventInit; +#[cfg(feature = "TaskPriorityChangeEventInit")] +pub use gen_TaskPriorityChangeEventInit::*; + +#[cfg(feature = "TaskSignal")] +#[allow(non_snake_case)] +mod gen_TaskSignal; +#[cfg(feature = "TaskSignal")] +pub use gen_TaskSignal::*; + +#[cfg(feature = "TaskSignalAnyInit")] +#[allow(non_snake_case)] +mod gen_TaskSignalAnyInit; +#[cfg(feature = "TaskSignalAnyInit")] +pub use gen_TaskSignalAnyInit::*; + #[cfg(feature = "TcpReadyState")] #[allow(non_snake_case)] mod gen_TcpReadyState; diff --git a/crates/web-sys/webidls/unstable/is-input-pending.webidl b/crates/web-sys/webidls/unstable/is-input-pending.webidl new file mode 100644 index 00000000000..c29aaa45542 --- /dev/null +++ b/crates/web-sys/webidls/unstable/is-input-pending.webidl @@ -0,0 +1,11 @@ +dictionary IsInputPendingOptions { + boolean includeContinuous = false; +}; + +[Exposed=Window] interface Scheduling { + boolean isInputPending(optional IsInputPendingOptions isInputPendingOptions = {}); +}; + +partial interface Navigator { + readonly attribute Scheduling scheduling; +}; diff --git a/crates/web-sys/webidls/unstable/scheduling-apis.webidl b/crates/web-sys/webidls/unstable/scheduling-apis.webidl new file mode 100644 index 00000000000..ff89281519c --- /dev/null +++ b/crates/web-sys/webidls/unstable/scheduling-apis.webidl @@ -0,0 +1,58 @@ +enum TaskPriority { + "user-blocking", + "user-visible", + "background" +}; + +dictionary SchedulerPostTaskOptions { + AbortSignal signal; + TaskPriority priority; + [EnforceRange] unsigned long long delay = 0; +}; + +callback SchedulerPostTaskCallback = any (); + +[Exposed=(Window, Worker)] +interface Scheduler { + Promise postTask(SchedulerPostTaskCallback callback, + optional SchedulerPostTaskOptions options = {}); +}; + +[Exposed=(Window, Worker)] +interface TaskPriorityChangeEvent : Event { + constructor(DOMString type, TaskPriorityChangeEventInit priorityChangeEventInitDict); + + readonly attribute TaskPriority previousPriority; +}; + +dictionary TaskPriorityChangeEventInit : EventInit { + required TaskPriority previousPriority; +}; + +dictionary TaskControllerInit { + TaskPriority priority = "user-visible"; +}; + +[Exposed=(Window,Worker)] +interface TaskController : AbortController { + constructor(optional TaskControllerInit init = {}); + + undefined setPriority(TaskPriority priority); +}; + +dictionary TaskSignalAnyInit { + (TaskPriority or TaskSignal) priority = "user-visible"; +}; + +[Exposed=(Window, Worker)] +interface TaskSignal : AbortSignal { + [NewObject] static TaskSignal _any(sequence signals, optional TaskSignalAnyInit init = {}); + + readonly attribute TaskPriority priority; + + attribute EventHandler onprioritychange; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + [Replaceable] readonly attribute Scheduler scheduler; +}; From 1b136e30075fab42ce3b31fcdc257d2aad7294a1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 25 Aug 2023 13:01:05 +0200 Subject: [PATCH 261/641] `TaskController.setPriority` can throw (#3568) --- crates/web-sys/src/features/gen_TaskController.rs | 4 ++-- crates/web-sys/webidls/unstable/scheduling-apis.webidl | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/web-sys/src/features/gen_TaskController.rs b/crates/web-sys/src/features/gen_TaskController.rs index f108a34c42c..3dcb523db71 100644 --- a/crates/web-sys/src/features/gen_TaskController.rs +++ b/crates/web-sys/src/features/gen_TaskController.rs @@ -41,7 +41,7 @@ extern "C" { pub fn new_with_init(init: &TaskControllerInit) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] - # [wasm_bindgen (method , structural , js_class = "TaskController" , js_name = setPriority)] + # [wasm_bindgen (catch , method , structural , js_class = "TaskController" , js_name = setPriority)] #[doc = "The `setPriority()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskController/setPriority)"] @@ -50,5 +50,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_priority(this: &TaskController, priority: TaskPriority); + pub fn set_priority(this: &TaskController, priority: TaskPriority) -> Result<(), JsValue>; } diff --git a/crates/web-sys/webidls/unstable/scheduling-apis.webidl b/crates/web-sys/webidls/unstable/scheduling-apis.webidl index ff89281519c..b63aff54629 100644 --- a/crates/web-sys/webidls/unstable/scheduling-apis.webidl +++ b/crates/web-sys/webidls/unstable/scheduling-apis.webidl @@ -37,6 +37,7 @@ dictionary TaskControllerInit { interface TaskController : AbortController { constructor(optional TaskControllerInit init = {}); + [Throws] undefined setPriority(TaskPriority priority); }; From e7cfba5a14e88bbb734c4c9b460fdc12a731976e Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 25 Aug 2023 19:23:28 -0400 Subject: [PATCH 262/641] Remove class wrap for constructors in Rust exports (#3562) * Remove class wrap for constructors in Rust exports After #1594 constructors of Rust exported structs started using class wrapping when generating JS shims. Wrapping erases prototype information from the object instance in JS and as a result it is not possible to override methods (via inheritance) of the generated class. Additionally, some checks to ensure constructors always return an instance of `Self` were lost. This PR is rebased from #3561, it passes the constructor information from the `Builder` into the instruction translation function which is then used to modify the generated bindings. The `return` statement is also removed instead the value is directly attached to the instance. Signed-off-by: Oliver T * Fix typo Co-authored-by: Liam Murphy * Disallow returning JS primitives from constructors Signed-off-by: Oliver T * Added missing String in match Signed-off-by: Oliver T * Handle nested descriptors Signed-off-by: Oliver T --------- Signed-off-by: Oliver T Co-authored-by: Liam Murphy --- CHANGELOG.md | 8 +++ crates/cli-support/src/js/binding.rs | 31 ++++++++-- crates/cli-support/src/wit/mod.rs | 35 ++++++++++- crates/cli/tests/reference/builder.d.ts | 11 ++++ crates/cli/tests/reference/builder.js | 61 +++++++++++++++++++ crates/cli/tests/reference/builder.rs | 11 ++++ crates/cli/tests/reference/builder.wat | 10 +++ crates/cli/tests/reference/constructor.d.ts | 10 +++ crates/cli/tests/reference/constructor.js | 53 ++++++++++++++++ crates/cli/tests/reference/constructor.rs | 13 ++++ crates/cli/tests/reference/constructor.wat | 10 +++ crates/cli/tests/wasm-bindgen/main.rs | 24 ++++++++ .../attributes/on-rust-exports/constructor.md | 38 ++++++++++++ 13 files changed, 308 insertions(+), 7 deletions(-) create mode 100644 crates/cli/tests/reference/builder.d.ts create mode 100644 crates/cli/tests/reference/builder.js create mode 100644 crates/cli/tests/reference/builder.rs create mode 100644 crates/cli/tests/reference/builder.wat create mode 100644 crates/cli/tests/reference/constructor.d.ts create mode 100644 crates/cli/tests/reference/constructor.js create mode 100644 crates/cli/tests/reference/constructor.rs create mode 100644 crates/cli/tests/reference/constructor.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index 44fd41c535d..e92134a7331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,11 @@ bindgen placeholder. [#3233](https://github.com/rustwasm/wasm-bindgen/pull/3233) +* Changed constructor implementation in generated JS bindings, it is now + possible to override methods from generated JS classes using inheritance. + When exported constructors return `Self`. + [#3562](https://github.com/rustwasm/wasm-bindgen/pull/3562) + ### Fixed * Fixed bindings and comments for `Atomics.wait`. @@ -69,6 +74,9 @@ * Use fully qualified paths in the `wasm_bindgen_test` macro. [#3549](https://github.com/rustwasm/wasm-bindgen/pull/3549) +* Fixed bug allowing JS primitives to be returned from exported constructors. + [#3562](https://github.com/rustwasm/wasm-bindgen/pull/3562) + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 83a04f92fb6..467220d05ff 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -166,7 +166,12 @@ impl<'a, 'b> Builder<'a, 'b> { // more JIT-friendly. The generated code should be equivalent to the // wasm interface types stack machine, however. for instr in instructions { - instruction(&mut js, &instr.instr, &mut self.log_error)?; + instruction( + &mut js, + &instr.instr, + &mut self.log_error, + &self.constructor, + )?; } assert_eq!(js.stack.len(), adapter.results.len()); @@ -537,7 +542,12 @@ impl<'a, 'b> JsBuilder<'a, 'b> { } } -fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> Result<(), Error> { +fn instruction( + js: &mut JsBuilder, + instr: &Instruction, + log_error: &mut bool, + constructor: &Option, +) -> Result<(), Error> { match instr { Instruction::ArgGet(n) => { let arg = js.arg(*n).to_string(); @@ -987,18 +997,27 @@ fn instruction(js: &mut JsBuilder, instr: &Instruction, log_error: &mut bool) -> } Instruction::RustFromI32 { class } => { - js.cx.require_class_wrap(class); let val = js.pop(); - js.push(format!("{}.__wrap({})", class, val)); + match constructor { + Some(name) if name == class => { + js.prelude(&format!("this.__wbg_ptr = {} >>> 0;", val)); + js.push(String::from("this")); + } + Some(_) | None => { + js.cx.require_class_wrap(class); + js.push(format!("{}.__wrap({})", class, val)); + } + } } Instruction::OptionRustFromI32 { class } => { - js.cx.require_class_wrap(class); + assert!(constructor.is_none()); let val = js.pop(); + js.cx.require_class_wrap(class); js.push(format!( "{0} === 0 ? undefined : {1}.__wrap({0})", val, class, - )) + )); } Instruction::CachedStringLoad { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 9d7b18e84c0..38402aafe9d 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -484,7 +484,10 @@ impl<'a> Context<'a> { Some(class) => { let class = class.to_string(); match export.method_kind { - decode::MethodKind::Constructor => AuxExportKind::Constructor(class), + decode::MethodKind::Constructor => { + verify_constructor_return(&class, &descriptor.ret)?; + AuxExportKind::Constructor(class) + } decode::MethodKind::Operation(op) => { if !op.is_static { // Make the first argument be the index of the receiver. @@ -1424,6 +1427,36 @@ impl<'a> Context<'a> { } } +/// Verifies exported constructor return value is not a JS primitive type +fn verify_constructor_return(class: &str, ret: &Descriptor) -> Result<(), Error> { + match ret { + Descriptor::I8 + | Descriptor::U8 + | Descriptor::ClampedU8 + | Descriptor::I16 + | Descriptor::U16 + | Descriptor::I32 + | Descriptor::U32 + | Descriptor::F32 + | Descriptor::F64 + | Descriptor::I64 + | Descriptor::U64 + | Descriptor::Boolean + | Descriptor::Char + | Descriptor::CachedString + | Descriptor::String + | Descriptor::Option(_) + | Descriptor::Enum { .. } + | Descriptor::Unit => { + bail!("The constructor for class `{}` tries to return a JS primitive type, which would cause the return value to be ignored. Use a builder instead (remove the `constructor` attribute).", class); + } + Descriptor::Result(ref d) | Descriptor::Ref(ref d) | Descriptor::RefMut(ref d) => { + verify_constructor_return(class, d) + } + _ => Ok(()), + } +} + /// Extract all of the `Program`s encoded in our custom section. /// /// `program_storage` is used to squirrel away the raw bytes of the custom diff --git a/crates/cli/tests/reference/builder.d.ts b/crates/cli/tests/reference/builder.d.ts new file mode 100644 index 00000000000..ede348c9632 --- /dev/null +++ b/crates/cli/tests/reference/builder.d.ts @@ -0,0 +1,11 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +*/ +export class ClassBuilder { + free(): void; +/** +* @returns {ClassBuilder} +*/ + static builder(): ClassBuilder; +} diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js new file mode 100644 index 00000000000..3402667dd0d --- /dev/null +++ b/crates/cli/tests/reference/builder.js @@ -0,0 +1,61 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8Memory0 = null; + +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} +/** +*/ +export class ClassBuilder { + + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(ClassBuilder.prototype); + obj.__wbg_ptr = ptr; + + return obj; + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_classbuilder_free(ptr); + } + /** + * @returns {ClassBuilder} + */ + static builder() { + const ret = wasm.classbuilder_builder(); + return ClassBuilder.__wrap(ret); + } +} + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/builder.rs b/crates/cli/tests/reference/builder.rs new file mode 100644 index 00000000000..317f20cad92 --- /dev/null +++ b/crates/cli/tests/reference/builder.rs @@ -0,0 +1,11 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct ClassBuilder(()); + +#[wasm_bindgen] +impl ClassBuilder { + pub fn builder() -> ClassBuilder { + ClassBuilder(()) + } +} diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat new file mode 100644 index 00000000000..cd38fc7fc6a --- /dev/null +++ b/crates/cli/tests/reference/builder.wat @@ -0,0 +1,10 @@ +(module + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32))) + (func $__wbg_classbuilder_free (;0;) (type 1) (param i32)) + (func $classbuilder_builder (;1;) (type 0) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) + (export "classbuilder_builder" (func $classbuilder_builder)) +) diff --git a/crates/cli/tests/reference/constructor.d.ts b/crates/cli/tests/reference/constructor.d.ts new file mode 100644 index 00000000000..f35e8c72fa1 --- /dev/null +++ b/crates/cli/tests/reference/constructor.d.ts @@ -0,0 +1,10 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +*/ +export class ClassConstructor { + free(): void; +/** +*/ + constructor(); +} diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js new file mode 100644 index 00000000000..1973256e15c --- /dev/null +++ b/crates/cli/tests/reference/constructor.js @@ -0,0 +1,53 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8Memory0 = null; + +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} +/** +*/ +export class ClassConstructor { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_classconstructor_free(ptr); + } + /** + */ + constructor() { + const ret = wasm.classconstructor_new(); + this.__wbg_ptr = ret >>> 0; + return this; + } +} + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/constructor.rs b/crates/cli/tests/reference/constructor.rs new file mode 100644 index 00000000000..ca4bac080b3 --- /dev/null +++ b/crates/cli/tests/reference/constructor.rs @@ -0,0 +1,13 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct ClassConstructor(()); + +#[wasm_bindgen] +impl ClassConstructor { + + #[wasm_bindgen(constructor)] + pub fn new() -> ClassConstructor { + ClassConstructor(()) + } +} diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat new file mode 100644 index 00000000000..a5596470321 --- /dev/null +++ b/crates/cli/tests/reference/constructor.wat @@ -0,0 +1,10 @@ +(module + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32))) + (func $__wbg_classconstructor_free (;0;) (type 1) (param i32)) + (func $classconstructor_new (;1;) (type 0) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) + (export "classconstructor_new" (func $classconstructor_new)) +) diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 055fad5ed1f..f2502d8c313 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -431,3 +431,27 @@ fn function_table_preserved() { .wasm_bindgen(""); cmd.assert().success(); } + +#[test] +fn constructor_cannot_return_option_struct() { + let (mut cmd, _out_dir) = Project::new("constructor_cannot_return_option_struct") + .file( + "src/lib.rs", + r#" + use wasm_bindgen::prelude::*; + + #[wasm_bindgen] + pub struct Foo(()); + + #[wasm_bindgen] + impl Foo { + #[wasm_bindgen(constructor)] + pub fn new() -> Option { + Some(Foo(())) + } + } + "#, + ) + .wasm_bindgen("--target web"); + cmd.assert().failure(); +} diff --git a/guide/src/reference/attributes/on-rust-exports/constructor.md b/guide/src/reference/attributes/on-rust-exports/constructor.md index 1d6fcf4f625..3e5fc2d4deb 100644 --- a/guide/src/reference/attributes/on-rust-exports/constructor.md +++ b/guide/src/reference/attributes/on-rust-exports/constructor.md @@ -32,3 +32,41 @@ import { Foo } from './my_module'; const f = new Foo(); console.log(f.get_contents()); ``` + +## Caveats + +Starting from v0.2.48 there is a bug in `wasm-bindgen` which breaks inheritance of exported Rust structs from JavaScript side (see [#3213](https://github.com/rustwasm/wasm-bindgen/issues/3213)). If you want to inherit from a Rust struct such as: + +```rust +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct Parent { + msg: String, +} + +#[wasm_bindgen] +impl Parent { + #[wasm_bindgen(constructor)] + fn new() -> Self { + Parent { + msg: String::from("Hello from Parent!"), + } + } +} +``` + +You will need to reset the prototype of `this` back to the `Child` class prototype after calling the `Parent`'s constructor via `super`. + +```js +import { Parent } from './my_module'; + +class Child extends Parent { + constructor() { + super(); + Object.setPrototypeOf(this, Child.prototype); + } +} +``` + +This is no longer required as of v0.2.88. From 99983c85e1bd3d3d7e40831942e19049ff432a0e Mon Sep 17 00:00:00 2001 From: magic-akari Date: Tue, 29 Aug 2023 15:59:50 +0800 Subject: [PATCH 263/641] fix: Optional JSDoc `@param` (#3577) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/binding.rs | 32 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e92134a7331..0862a5d8fd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,9 @@ * Fixed bug allowing JS primitives to be returned from exported constructors. [#3562](https://github.com/rustwasm/wasm-bindgen/pull/3562) +* Fixed optional parameters in JSDoc. + [#3577](https://github.com/rustwasm/wasm-bindgen/pull/3577) + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 467220d05ff..1cd3e0f22da 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -363,18 +363,36 @@ impl<'a, 'b> Builder<'a, 'b> { ts_ret: &Option, variadic: bool, ) -> String { - let mut ret = String::new(); let (variadic_arg, fn_arg_names) = match arg_names.split_last() { Some((last, args)) if variadic => (Some(last), args), _ => (None, arg_names), }; - for (name, ty) in fn_arg_names.iter().zip(arg_tys) { - ret.push_str("@param {"); - adapter2ts(ty, &mut ret); - ret.push_str("} "); - ret.push_str(name); - ret.push('\n'); + + let mut omittable = true; + let mut js_doc_args = Vec::new(); + + for (name, ty) in fn_arg_names.iter().zip(arg_tys).rev() { + let mut arg = "@param {".to_string(); + + adapter2ts(ty, &mut arg); + arg.push_str("} "); + match ty { + AdapterType::Option(..) if omittable => { + arg.push('['); + arg.push_str(name); + arg.push(']'); + } + _ => { + omittable = false; + arg.push_str(name); + } + } + arg.push('\n'); + js_doc_args.push(arg); } + + let mut ret: String = js_doc_args.into_iter().rev().collect(); + if let (Some(name), Some(ty)) = (variadic_arg, arg_tys.last()) { ret.push_str("@param {..."); adapter2ts(ty, &mut ret); From 7e4f73e45383981de6eaa6c2a5a8722c3f87b428 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 29 Aug 2023 11:01:02 +0200 Subject: [PATCH 264/641] Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)` (#3580) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 2 + .../web-sys/src/features/gen_CanvasPattern.rs | 2 +- .../features/gen_CanvasRenderingContext2d.rs | 20 ++ .../src/features/gen_DomMatrix2dInit.rs | 184 ++++++++++ .../web-sys/src/features/gen_DomMatrixInit.rs | 327 ++++++++++++++++++ .../gen_OffscreenCanvasRenderingContext2d.rs | 20 ++ crates/web-sys/src/features/mod.rs | 12 + .../enabled/CanvasRenderingContext2D.webidl | 2 + .../web-sys/webidls/enabled/DOMMatrix.webidl | 28 ++ crates/webidl/src/constants.rs | 2 + 11 files changed, 601 insertions(+), 1 deletion(-) create mode 100644 crates/web-sys/src/features/gen_DomMatrix2dInit.rs create mode 100644 crates/web-sys/src/features/gen_DomMatrixInit.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0862a5d8fd1..c07eb12e3da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Add unstable bindings for the Prioritized Task Scheduling API. [#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566) +* Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)`. + [#3580](https://github.com/rustwasm/wasm-bindgen/pull/3580) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 64d7700131b..ab52e7a142f 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -306,6 +306,8 @@ DomError = [] DomException = [] DomImplementation = [] DomMatrix = ["DomMatrixReadOnly"] +DomMatrix2dInit = [] +DomMatrixInit = [] DomMatrixReadOnly = [] DomParser = [] DomPoint = ["DomPointReadOnly"] diff --git a/crates/web-sys/src/features/gen_CanvasPattern.rs b/crates/web-sys/src/features/gen_CanvasPattern.rs index bc939b0df17..cab7fbaebb7 100644 --- a/crates/web-sys/src/features/gen_CanvasPattern.rs +++ b/crates/web-sys/src/features/gen_CanvasPattern.rs @@ -19,5 +19,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `SvgMatrix`*"] - pub fn set_transform(this: &CanvasPattern, matrix: &SvgMatrix); + pub fn set_transform_with_default_dom_matrix_2d_init(this: &CanvasPattern, matrix: &SvgMatrix); } diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index 3355768706e..c5878c132f0 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -1385,6 +1385,26 @@ extern "C" { e: f64, f: f64, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn set_transform_with_default_dom_matrix_2d_init( + this: &CanvasRenderingContext2d, + ) -> Result<(), JsValue>; + #[cfg(feature = "DomMatrix2dInit")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `DomMatrix2dInit`*"] + pub fn set_transform_with_dom_matrix_2d_init( + this: &CanvasRenderingContext2d, + transform: &DomMatrix2dInit, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = transform)] #[doc = "The `transform()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs new file mode 100644 index 00000000000..f91b401cec6 --- /dev/null +++ b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs @@ -0,0 +1,184 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DOMMatrix2DInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DomMatrix2dInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub type DomMatrix2dInit; +} +impl DomMatrix2dInit { + #[doc = "Construct a new `DomMatrix2dInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn a(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn b(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn c(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn d(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn e(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn f(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m11(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m12(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m21(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m22(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m41(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m42(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for DomMatrix2dInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_DomMatrixInit.rs b/crates/web-sys/src/features/gen_DomMatrixInit.rs new file mode 100644 index 00000000000..573a0c4d65e --- /dev/null +++ b/crates/web-sys/src/features/gen_DomMatrixInit.rs @@ -0,0 +1,327 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DOMMatrixInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DomMatrixInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub type DomMatrixInit; +} +impl DomMatrixInit { + #[doc = "Construct a new `DomMatrixInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn a(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn b(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn c(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn d(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn e(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn f(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m11(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m12(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m21(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m22(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m41(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m42(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `is2D` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn is_2d(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("is2D"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m13` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m13(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m13"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m14` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m14(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m14"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m23` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m23(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m23"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m24` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m24(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m24"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m31` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m31(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m31"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m32` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m32(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m32"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m33` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m33(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m33"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m34` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m34(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m34"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m43` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m43(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m43"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m44` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m44(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m44"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for DomMatrixInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index ef40e59a5a3..aed70a10e68 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1341,6 +1341,26 @@ extern "C" { e: f64, f: f64, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn set_transform_with_default_dom_matrix_2d_init( + this: &OffscreenCanvasRenderingContext2d, + ) -> Result<(), JsValue>; + #[cfg(feature = "DomMatrix2dInit")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_transform_with_dom_matrix_2d_init( + this: &OffscreenCanvasRenderingContext2d, + transform: &DomMatrix2dInit, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = transform)] #[doc = "The `transform()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 2a27e7dfe2b..3e0f90fd6a4 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -1648,6 +1648,18 @@ mod gen_DomMatrix; #[cfg(feature = "DomMatrix")] pub use gen_DomMatrix::*; +#[cfg(feature = "DomMatrix2dInit")] +#[allow(non_snake_case)] +mod gen_DomMatrix2dInit; +#[cfg(feature = "DomMatrix2dInit")] +pub use gen_DomMatrix2dInit::*; + +#[cfg(feature = "DomMatrixInit")] +#[allow(non_snake_case)] +mod gen_DomMatrixInit; +#[cfg(feature = "DomMatrixInit")] +pub use gen_DomMatrixInit::*; + #[cfg(feature = "DomMatrixReadOnly")] #[allow(non_snake_case)] mod gen_DomMatrixReadOnly; diff --git a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl index a21b0e5ae55..557246d3333 100644 --- a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl +++ b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl @@ -147,6 +147,8 @@ interface mixin CanvasTransform { [Throws, LenientFloat] undefined setTransform(double a, double b, double c, double d, double e, double f); [Throws] + undefined setTransform(optional DOMMatrix2DInit transform = {}); + [Throws] undefined resetTransform(); [NewObject, Throws] DOMMatrix getTransform(); diff --git a/crates/web-sys/webidls/enabled/DOMMatrix.webidl b/crates/web-sys/webidls/enabled/DOMMatrix.webidl index 06a0da44b3e..e4080137330 100644 --- a/crates/web-sys/webidls/enabled/DOMMatrix.webidl +++ b/crates/web-sys/webidls/enabled/DOMMatrix.webidl @@ -148,3 +148,31 @@ interface DOMMatrix : DOMMatrixReadOnly { [Throws] DOMMatrix setMatrixValue(DOMString transformList); }; +dictionary DOMMatrix2DInit { + unrestricted double a; + unrestricted double b; + unrestricted double c; + unrestricted double d; + unrestricted double e; + unrestricted double f; + unrestricted double m11; + unrestricted double m12; + unrestricted double m21; + unrestricted double m22; + unrestricted double m41; + unrestricted double m42; +}; + +dictionary DOMMatrixInit : DOMMatrix2DInit { + unrestricted double m13 = 0; + unrestricted double m14 = 0; + unrestricted double m23 = 0; + unrestricted double m24 = 0; + unrestricted double m31 = 0; + unrestricted double m32 = 0; + unrestricted double m33 = 1; + unrestricted double m34 = 0; + unrestricted double m43 = 0; + unrestricted double m44 = 1; + boolean is2D; +}; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 3118807ff81..3d02b820bab 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -117,5 +117,7 @@ pub(crate) static FIXED_INTERFACES: Lazy> = ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("set_transform", "set_transform_with_default_dom_matrix_2d_init"), + ("set_transform_with_a_and_b_and_c_and_d_and_e_and_f", "set_transform"), ]) }); From 77cfb61a6c4c503fb45345dcfa8d72ea7dd0b9c2 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 29 Aug 2023 14:46:15 +0200 Subject: [PATCH 265/641] Filter interface fixes by type name (#3581) --- .../web-sys/src/features/gen_CanvasPattern.rs | 2 +- crates/webidl/src/constants.rs | 29 +++++++++++++++--- crates/webidl/src/lib.rs | 30 ++++++++++++++++--- crates/webidl/src/util.rs | 7 +++-- 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/crates/web-sys/src/features/gen_CanvasPattern.rs b/crates/web-sys/src/features/gen_CanvasPattern.rs index cab7fbaebb7..bc939b0df17 100644 --- a/crates/web-sys/src/features/gen_CanvasPattern.rs +++ b/crates/web-sys/src/features/gen_CanvasPattern.rs @@ -19,5 +19,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `SvgMatrix`*"] - pub fn set_transform_with_default_dom_matrix_2d_init(this: &CanvasPattern, matrix: &SvgMatrix); + pub fn set_transform(this: &CanvasPattern, matrix: &SvgMatrix); } diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 3d02b820bab..651c99aac3b 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -97,8 +97,10 @@ pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy ]) }); -pub(crate) static FIXED_INTERFACES: Lazy> = Lazy::new(|| { - BTreeMap::from_iter(vec![ +pub(crate) static FIXED_INTERFACES: Lazy< + BTreeMap<&'static str, BTreeMap<&'static str, &'static str>>, +> = Lazy::new(|| { + let image_bitmap = BTreeMap::from_iter([ ("create_image_bitmap_with_html_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), ("create_image_bitmap_with_svg_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), ("create_image_bitmap_with_html_canvas_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), @@ -117,7 +119,26 @@ pub(crate) static FIXED_INTERFACES: Lazy> = ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), - ("set_transform", "set_transform_with_default_dom_matrix_2d_init"), - ("set_transform_with_a_and_b_and_c_and_d_and_e_and_f", "set_transform"), + ]); + + let canvas_rendering_context = BTreeMap::from_iter([ + ( + "set_transform", + "set_transform_with_default_dom_matrix_2d_init", + ), + ( + "set_transform_with_a_and_b_and_c_and_d_and_e_and_f", + "set_transform", + ), + ]); + + BTreeMap::from_iter([ + ("Window", image_bitmap.clone()), + ("WorkerGlobalScope", image_bitmap), + ("CanvasRenderingContext2d", canvas_rendering_context.clone()), + ( + "OffscreenCanvasRenderingContext2d", + canvas_rendering_context, + ), ]) }); diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 66f2ebd70be..60a92d020f5 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -504,7 +504,7 @@ impl<'src> FirstPassRecord<'src> { } } - for x in self.create_imports(None, id, data, false, &HashSet::new()) { + for x in self.create_imports(None, None, id, data, false, &HashSet::new()) { functions.push(Function { name: x.name, js_name: x.js_name, @@ -588,7 +588,14 @@ impl<'src> FirstPassRecord<'src> { } for (id, op_data) in data.operations.iter() { - self.member_operation(&mut methods, data, id, op_data, unstable_types); + self.member_operation( + &name.to_string(), + &mut methods, + data, + id, + op_data, + unstable_types, + ); } for mixin_data in self.all_mixins(&js_name) { @@ -614,7 +621,14 @@ impl<'src> FirstPassRecord<'src> { } for (id, op_data) in mixin_data.operations.iter() { - self.member_operation(&mut methods, data, id, op_data, unstable_types); + self.member_operation( + &name.to_string(), + &mut methods, + data, + id, + op_data, + unstable_types, + ); } } @@ -702,6 +716,7 @@ impl<'src> FirstPassRecord<'src> { fn member_operation( &self, + type_name: &str, methods: &mut Vec, data: &InterfaceData<'src>, id: &OperationId<'src>, @@ -711,7 +726,14 @@ impl<'src> FirstPassRecord<'src> { let attrs = data.definition_attributes; let unstable = data.stability.is_unstable(); - for method in self.create_imports(attrs, id, op_data, unstable, unstable_types) { + for method in self.create_imports( + Some(type_name), + attrs, + id, + op_data, + unstable, + unstable_types, + ) { methods.push(method); } } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index e1a47886ac9..343996952c7 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -196,6 +196,7 @@ pub enum TypePosition { impl<'src> FirstPassRecord<'src> { pub fn create_imports( &self, + type_name: Option<&str>, container_attrs: Option<&ExtendedAttributeList<'src>>, id: &OperationId<'src>, data: &OperationData<'src>, @@ -500,8 +501,10 @@ impl<'src> FirstPassRecord<'src> { } for interface in &mut ret { - if let Some(fixed) = FIXED_INTERFACES.get(&interface.name.to_string().as_ref()) { - interface.name = rust_ident(fixed); + if let Some(map) = type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name)) { + if let Some(fixed) = map.get(&interface.name.to_string().as_ref()) { + interface.name = rust_ident(fixed); + } } } From 865923bdefba6568adbb95d1a2134281f2ca976c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 30 Aug 2023 00:13:19 +0200 Subject: [PATCH 266/641] Remove `ReadableStreamByobReader::read_with_u8_array()` (#3582) --- CHANGELOG.md | 5 ++ .../features/gen_ReadableStreamByobReader.rs | 10 ---- crates/web-sys/webidls/enabled/Streams.webidl | 1 + crates/webidl/src/constants.rs | 4 ++ crates/webidl/src/idl_type.rs | 47 ++++++++++++------- crates/webidl/src/util.rs | 6 ++- 6 files changed, 46 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c07eb12e3da..33776de3656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,11 @@ * Fixed optional parameters in JSDoc. [#3577](https://github.com/rustwasm/wasm-bindgen/pull/3577) +### Removed + +* Removed `ReadableStreamByobReader::read_with_u8_array()` because it doesn't work with Wasm. + [#3582](https://github.com/rustwasm/wasm-bindgen/pull/3582) + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs index 4a12b6ee5a6..fb169472383 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamByobReader.rs @@ -37,16 +37,6 @@ extern "C" { this: &ReadableStreamByobReader, view: &::js_sys::Object, ) -> ::js_sys::Promise; - # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = read)] - #[doc = "The `read()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"] - pub fn read_with_u8_array( - this: &ReadableStreamByobReader, - view: &mut [u8], - ) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = releaseLock)] #[doc = "The `releaseLock()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/Streams.webidl b/crates/web-sys/webidls/enabled/Streams.webidl index bf57ef4ff11..b3a9201fbc8 100644 --- a/crates/web-sys/webidls/enabled/Streams.webidl +++ b/crates/web-sys/webidls/enabled/Streams.webidl @@ -91,6 +91,7 @@ dictionary ReadableStreamReadResult { interface ReadableStreamBYOBReader { [Throws] constructor(ReadableStream stream); + [RustNotWasmMemory] Promise read(ArrayBufferView view); undefined releaseLock(); }; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 651c99aac3b..0d68af02da7 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -140,5 +140,9 @@ pub(crate) static FIXED_INTERFACES: Lazy< "OffscreenCanvasRenderingContext2d", canvas_rendering_context, ), + ( + "ReadableStreamByobReader", + BTreeMap::from_iter([("read", "read_with_array_buffer_view")]), + ), ]) }); diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 08ef155b9da..1843210da5a 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -1,5 +1,6 @@ use proc_macro2::{Ident, Span}; use wasm_bindgen_backend::util::{ident_ty, leading_colon_path_ty, raw_ident, rust_ident}; +use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList}; use weedle::common::Identifier; use weedle::term; use weedle::types::*; @@ -659,36 +660,36 @@ impl<'a> IdlType<'a> { /// but also flattens unions inside generics of other types. /// /// [flattened union member types]: https://heycam.github.io/webidl/#dfn-flattened-union-member-types - pub(crate) fn flatten(&self) -> Vec { + pub(crate) fn flatten(&self, attrs: Option<&ExtendedAttributeList<'_>>) -> Vec { match self { IdlType::Nullable(idl_type) => idl_type - .flatten() + .flatten(attrs) .into_iter() .map(Box::new) .map(IdlType::Nullable) .collect(), IdlType::FrozenArray(idl_type) => idl_type - .flatten() + .flatten(attrs) .into_iter() .map(Box::new) .map(IdlType::FrozenArray) .collect(), IdlType::Sequence(idl_type) => idl_type - .flatten() + .flatten(attrs) .into_iter() .map(Box::new) .map(IdlType::Sequence) .collect(), IdlType::Promise(idl_type) => idl_type - .flatten() + .flatten(attrs) .into_iter() .map(Box::new) .map(IdlType::Promise) .collect(), IdlType::Record(idl_type_from, idl_type_to) => { let mut idl_types = Vec::new(); - for idl_type_from in idl_type_from.flatten() { - for idl_type_to in idl_type_to.flatten() { + for idl_type_from in idl_type_from.flatten(attrs) { + for idl_type_to in idl_type_to.flatten(attrs) { idl_types.push(IdlType::Record( Box::new(idl_type_from.clone()), Box::new(idl_type_to.clone()), @@ -699,16 +700,30 @@ impl<'a> IdlType<'a> { } IdlType::Union(idl_types) => idl_types .iter() - .flat_map(|idl_type| idl_type.flatten()) + .flat_map(|idl_type| idl_type.flatten(attrs)) .collect(), - IdlType::ArrayBufferView { immutable } => vec![ - IdlType::ArrayBufferView { + IdlType::ArrayBufferView { immutable } => { + let view = IdlType::ArrayBufferView { immutable: *immutable, - }, - IdlType::Uint8Array { - immutable: *immutable, - }, - ], + }; + + if let Some(attrs) = attrs { + for attr in &attrs.body.list { + if let ExtendedAttribute::NoArgs(attr) = attr { + if attr.0 .0 == "RustNotWasmMemory" { + return vec![view]; + } + } + } + } + + vec![ + view, + IdlType::Uint8Array { + immutable: *immutable, + }, + ] + } IdlType::BufferSource { immutable } => vec![ IdlType::BufferSource { immutable: *immutable, @@ -758,7 +773,7 @@ fn idl_type_flatten_test() { Interface("NodeList"), ])),), ]) - .flatten(), + .flatten(None), vec![ Interface("Node"), Sequence(Box::new(Long)), diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 343996952c7..04c07e3d991 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -266,7 +266,11 @@ impl<'src> FirstPassRecord<'src> { // in-place, but all other flattened types will cause new // signatures to be created. let cur = actual_signatures.len(); - for (j, idl_type) in idl_type.flatten().into_iter().enumerate() { + for (j, idl_type) in idl_type + .flatten(signature.attrs.as_ref()) + .into_iter() + .enumerate() + { for k in start..cur { if j == 0 { actual_signatures[k].args.push(idl_type.clone()); From 86fd961bfec72587a7f5eec7d5dd3e4c1b57ee0d Mon Sep 17 00:00:00 2001 From: Nicolas Gryman Date: Wed, 30 Aug 2023 12:47:21 +0200 Subject: [PATCH 267/641] Add constructor, replace, and replaceSync methods to CssStyleSheet (#3573) --- CHANGELOG.md | 3 +++ .../web-sys/src/features/gen_CssStyleSheet.rs | 21 +++++++++++++++++++ .../webidls/enabled/CSSStyleSheet.webidl | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33776de3656..ad1467af0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Add unstable bindings for the Prioritized Task Scheduling API. [#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566) +* Add bindings for `CssStyleSheet` constructor and `replace(_sync)` methods. + [#3573](https://github.com/rustwasm/wasm-bindgen/pull/3573) + * Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)`. [#3580](https://github.com/rustwasm/wasm-bindgen/pull/3580) diff --git a/crates/web-sys/src/features/gen_CssStyleSheet.rs b/crates/web-sys/src/features/gen_CssStyleSheet.rs index b8a1044f559..833c2fd6574 100644 --- a/crates/web-sys/src/features/gen_CssStyleSheet.rs +++ b/crates/web-sys/src/features/gen_CssStyleSheet.rs @@ -28,6 +28,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssRuleList`, `CssStyleSheet`*"] pub fn css_rules(this: &CssStyleSheet) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "CSSStyleSheet")] + #[doc = "The `new CssStyleSheet(..)` constructor, creating a new instance of `CssStyleSheet`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/CSSStyleSheet)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`*"] + pub fn new() -> Result; # [wasm_bindgen (catch , method , structural , js_class = "CSSStyleSheet" , js_name = deleteRule)] #[doc = "The `deleteRule()` method."] #[doc = ""] @@ -53,4 +60,18 @@ extern "C" { rule: &str, index: u32, ) -> Result; + # [wasm_bindgen (method , structural , js_class = "CSSStyleSheet" , js_name = replace)] + #[doc = "The `replace()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replace)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`*"] + pub fn replace(this: &CssStyleSheet, text: &str) -> ::js_sys::Promise; + # [wasm_bindgen (catch , method , structural , js_class = "CSSStyleSheet" , js_name = replaceSync)] + #[doc = "The `replaceSync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replaceSync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`*"] + pub fn replace_sync(this: &CssStyleSheet, text: &str) -> Result<(), JsValue>; } diff --git a/crates/web-sys/webidls/enabled/CSSStyleSheet.webidl b/crates/web-sys/webidls/enabled/CSSStyleSheet.webidl index 7605c949a7a..4f8754f1af3 100644 --- a/crates/web-sys/webidls/enabled/CSSStyleSheet.webidl +++ b/crates/web-sys/webidls/enabled/CSSStyleSheet.webidl @@ -14,6 +14,8 @@ enum CSSStyleSheetParsingMode { }; interface CSSStyleSheet : StyleSheet { + [Throws] + constructor(); [Pure] readonly attribute CSSRule? ownerRule; [Throws, NeedsSubjectPrincipal] @@ -24,4 +26,8 @@ interface CSSStyleSheet : StyleSheet { unsigned long insertRule(DOMString rule, optional unsigned long index = 0); [Throws, NeedsSubjectPrincipal] undefined deleteRule(unsigned long index); + [NewObject] + Promise replace(USVString text); + [Throws] + undefined replaceSync(USVString text); }; From 4d4851d45200d0d1aeaa07108072dfa0f1f185f7 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 4 Sep 2023 17:38:22 +1000 Subject: [PATCH 268/641] Allow creating `Vec`s of and implement `TryFrom` for strings and exported Rust types (#3554) * Enable passing String vectors and boxed slices across ABI This is accomplished via conversion of the Strings to/from JsValues. * Enable passing custom struct vectors over ABI This was done by converting the structs to/from JsValues. It was necessary to change the way relevant traits (e.g. WasmDescribe, IntoWasmAbi etc.) are implemented. It's impossible to implement these for `Box<[#name]>` in codegen.rs because implementing traits on generic types is only allowed in the crate in which the trait is defined. Naively adding a blanket implementation on the wasm-bindgen side doesn't work either because it conflicts with the implementation for JsObjects. The solution was to create traits like VectorIntoWasmAbi etc. that are defined on the concrete type and contain the implementation for IntoWasmAbi etc. for vectors of that type. JsObjects are blanket implemented as before, and struct types are implemented in codegen.rs. Due to the way these traits are defined, Rust requires implementing types to be Sized, so they can't be used for the existing String implementations. Converting structs from JsValues was accomplished by adding an unwrap function to the generated JavaScript class, and calling that from Rust. * Remove unneeded require * Move uses out of if_std * Add documentation * Move incorrect use statements * Fix mistake in comment * Throw on invalid array elements instead of silently removing them I put some work into making sure that you can tell what function the error message is coming from. You still have to dig into the call stack of the error message to see it, but hopefully that's not too big an ask? * Get rid of `JsValueVector` The main reason for this, which I didn't mention before, is that I found it really confusing when I was originally reviewing this PR what the difference was between `JsValueVector` and `Vector{From,Into}WasmAbi`, since it really looks like another conversion trait at first glance. * Respect the configured `wasm_bindgen` crate path * Change the error type for String and rust structs' TryFrom impls to JsValue * test string vecs too * Refactor `String` impls I moved the `TryFrom` impl out of convert/slices.rs, it doesn't really belong there, and also got rid of the `js_value_vectors!` macro in favour of just implementing it for `String` directly; there's not much point in a macro you only use for one type. * Don't require manual `OptionVector{From,Into}WasmAbi` impls I noticed that strings and rust structs weren't implementing `OptionVectorFromWasmAbi`, so I tried to make a failing test and... it worked. That threw me for a loop for a bit until I realised that it was because I'd used `Vec`, and `Vec`'s impls of `Option{From,Into}WasmAbi` didn't actually rely on `Box<[T]>` implementing the traits: they just required that it implemented `{From,Into}WasmAbi` with an ABI of `WasmSlice`, since from there the element type doesn't matter. So then I thought 'well, why not do that for `Box<[T]>` too? so that's how this commit's pile of new tests came to be. * fix clippy * Fix generated typescript Since vecs of strings and rust structs were describing themselves as `Box<[JsValue]>`, they got typed as such - as `any[]`. This fixes that by using `NAMED_EXTERNREF` instead of just plain `EXTERNREF` with the type we want. This is maybe _slightly_ sketchy, since `NAMED_EXTERNREF` is meant for imported JS types, but ehhh it's fine. You can already put arbitrary TypeScript in there with `typescript_type`. * reorder some impls This is the nitpickiest of nitpicks, but this is my PR goddammit and I can do what I want :) * Update schema hash I didn't actually bump the schema version because it didn't change. If you don't use the `TryFrom` impl for Rust structs (or pass a `Vec` of them from JS to Rust), using an old CLI version will work fine; if you do though, you get a bit of a cryptic error message: ``` error: import of `__wbg_foo_unwrap` doesn't have an adapter listed ``` (That's from trying to pass a `Vec` from JS to Rust.) So idk, maybe that's worth bumping the schema version over anyway? * undo some unnecessary refactors * don't pointlessly use assert.deepStrictEqual for numbers * Update the guide * update reference tests * add WASI check * Extremely nitpicky tweaks --------- Co-authored-by: Billy Bradley Co-authored-by: Billy Bradley --- crates/backend/src/codegen.rs | 73 ++++++++- crates/cli-support/src/js/mod.rs | 27 ++++ crates/cli-support/src/wit/mod.rs | 35 ++++- crates/cli-support/src/wit/nonstandard.rs | 5 + crates/cli-support/src/wit/section.rs | 3 + crates/macro/ui-tests/missing-catch.stderr | 12 +- .../ui-tests/traits-not-implemented.stderr | 2 +- crates/shared/src/lib.rs | 7 + crates/shared/src/schema_hash_approval.rs | 2 +- guide/src/SUMMARY.md | 2 +- ...boxed-jsvalue-slice.md => boxed-slices.md} | 13 +- src/convert/impls.rs | 45 +++++- src/convert/slices.rs | 143 +++++++++++------- src/convert/traits.rs | 21 +++ src/describe.rs | 25 ++- src/lib.rs | 11 ++ tests/wasm/main.rs | 2 + tests/wasm/slice.js | 21 +++ tests/wasm/slice.rs | 32 ++-- tests/wasm/string_vecs.js | 23 +++ tests/wasm/string_vecs.rs | 29 ++++ tests/wasm/struct_vecs.js | 23 +++ tests/wasm/struct_vecs.rs | 40 +++++ 23 files changed, 511 insertions(+), 85 deletions(-) rename guide/src/reference/types/{boxed-jsvalue-slice.md => boxed-slices.md} (58%) create mode 100644 tests/wasm/string_vecs.js create mode 100644 tests/wasm/string_vecs.rs create mode 100644 tests/wasm/struct_vecs.js create mode 100644 tests/wasm/struct_vecs.rs diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 08e6c31869c..837245d5e6d 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -164,9 +164,10 @@ impl ToTokens for ast::Struct { let name = &self.rust_name; let name_str = self.js_name.to_string(); let name_len = name_str.len() as u32; - let name_chars = name_str.chars().map(|c| c as u32); + let name_chars: Vec = name_str.chars().map(|c| c as u32).collect(); let new_fn = Ident::new(&shared::new_function(&name_str), Span::call_site()); let free_fn = Ident::new(&shared::free_function(&name_str), Span::call_site()); + let unwrap_fn = Ident::new(&shared::unwrap_function(&name_str), Span::call_site()); let wasm_bindgen = &self.wasm_bindgen; (quote! { #[automatically_derived] @@ -293,6 +294,76 @@ impl ToTokens for ast::Struct { #[inline] fn is_none(abi: &Self::Abi) -> bool { *abi == 0 } } + + #[allow(clippy::all)] + impl #wasm_bindgen::__rt::core::convert::TryFrom<#wasm_bindgen::JsValue> for #name { + type Error = #wasm_bindgen::JsValue; + + fn try_from(value: #wasm_bindgen::JsValue) + -> #wasm_bindgen::__rt::std::result::Result { + let idx = #wasm_bindgen::convert::IntoWasmAbi::into_abi(&value); + + #[link(wasm_import_module = "__wbindgen_placeholder__")] + #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + extern "C" { + fn #unwrap_fn(ptr: u32) -> u32; + } + + #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + unsafe fn #unwrap_fn(_: u32) -> u32 { + panic!("cannot convert from JsValue outside of the wasm target") + } + + let ptr = unsafe { #unwrap_fn(idx) }; + if ptr == 0 { + #wasm_bindgen::__rt::std::result::Result::Err(value) + } else { + // Don't run `JsValue`'s destructor, `unwrap_fn` already did that for us. + #wasm_bindgen::__rt::std::mem::forget(value); + unsafe { + #wasm_bindgen::__rt::std::result::Result::Ok( + ::from_abi(ptr) + ) + } + } + } + } + + impl #wasm_bindgen::describe::WasmDescribeVector for #name { + fn describe_vector() { + use #wasm_bindgen::describe::*; + inform(VECTOR); + inform(NAMED_EXTERNREF); + inform(#name_len); + #(inform(#name_chars);)* + } + } + + impl #wasm_bindgen::convert::VectorIntoWasmAbi for #name { + type Abi = < + #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + as #wasm_bindgen::convert::IntoWasmAbi + >::Abi; + + fn vector_into_abi( + vector: #wasm_bindgen::__rt::std::boxed::Box<[#name]> + ) -> Self::Abi { + #wasm_bindgen::convert::js_value_vector_into_abi(vector) + } + } + + impl #wasm_bindgen::convert::VectorFromWasmAbi for #name { + type Abi = < + #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + as #wasm_bindgen::convert::FromWasmAbi + >::Abi; + + unsafe fn vector_from_abi( + js: Self::Abi + ) -> #wasm_bindgen::__rt::std::boxed::Box<[#name]> { + #wasm_bindgen::convert::js_value_vector_from_abi(js) + } + } }) .to_tokens(tokens); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 56847262544..86dcc058119 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -75,6 +75,7 @@ pub struct ExportedClass { generate_typescript: bool, has_constructor: bool, wrap_needed: bool, + unwrap_needed: bool, /// Whether to generate helper methods for inspecting the class is_inspectable: bool, /// All readable properties of the class @@ -935,6 +936,20 @@ impl<'a> Context<'a> { )); } + if class.unwrap_needed { + dst.push_str(&format!( + " + static __unwrap(jsValue) {{ + if (!(jsValue instanceof {})) {{ + return 0; + }} + return jsValue.__destroy_into_raw(); + }} + ", + name, + )); + } + if self.config.weak_refs { self.global(&format!( "const {}Finalization = new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));", @@ -2247,6 +2262,10 @@ impl<'a> Context<'a> { require_class(&mut self.exported_classes, name).wrap_needed = true; } + fn require_class_unwrap(&mut self, name: &str) { + require_class(&mut self.exported_classes, name).unwrap_needed = true; + } + fn add_module_import(&mut self, module: String, name: &str, actual: &str) { let rename = if name == actual { None @@ -3213,6 +3232,14 @@ impl<'a> Context<'a> { See https://rustwasm.github.io/wasm-bindgen/reference/cli.html#--split-linked-modules for details.", path)) } } + + AuxImport::UnwrapExportedClass(class) => { + assert!(kind == AdapterJsImportKind::Normal); + assert!(!variadic); + assert_eq!(args.len(), 1); + self.require_class_unwrap(class); + Ok(format!("{}.__unwrap({})", class, args[0])) + } } } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 38402aafe9d..bfb6c42b814 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -934,17 +934,40 @@ impl<'a> Context<'a> { self.aux.structs.push(aux); let wrap_constructor = wasm_bindgen_shared::new_function(struct_.name); - if let Some((import_id, _id)) = self.function_imports.get(&wrap_constructor).cloned() { + self.add_aux_import_to_import_map( + &wrap_constructor, + vec![Descriptor::I32], + Descriptor::Externref, + AuxImport::WrapInExportedClass(struct_.name.to_string()), + )?; + + let unwrap_fn = wasm_bindgen_shared::unwrap_function(struct_.name); + self.add_aux_import_to_import_map( + &unwrap_fn, + vec![Descriptor::Externref], + Descriptor::I32, + AuxImport::UnwrapExportedClass(struct_.name.to_string()), + )?; + + Ok(()) + } + + fn add_aux_import_to_import_map( + &mut self, + fn_name: &String, + arguments: Vec, + ret: Descriptor, + aux_import: AuxImport, + ) -> Result<(), Error> { + if let Some((import_id, _id)) = self.function_imports.get(fn_name).cloned() { let signature = Function { shim_idx: 0, - arguments: vec![Descriptor::I32], - ret: Descriptor::Externref, + arguments, + ret, inner_ret: None, }; let id = self.import_adapter(import_id, signature, AdapterJsImportKind::Normal)?; - self.aux - .import_map - .insert(id, AuxImport::WrapInExportedClass(struct_.name.to_string())); + self.aux.import_map.insert(id, aux_import); } Ok(()) diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index d05761bfda0..fe8142d027e 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -336,6 +336,11 @@ pub enum AuxImport { /// The Option may contain the contents of the linked file, so it can be /// embedded. LinkTo(String, Option), + + /// This import is a generated shim which will attempt to unwrap JsValue to an + /// instance of the given exported class. The class name is one that is + /// exported from the Rust/wasm. + UnwrapExportedClass(String), } /// Values that can be imported verbatim to hook up to an import. diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 85da8965291..4b22e6f97c6 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -273,6 +273,9 @@ fn check_standard_import(import: &AuxImport) -> Result<(), Error> { format!("wasm-bindgen specific link function for `{}`", path) } AuxImport::Closure { .. } => format!("creating a `Closure` wrapper"), + AuxImport::UnwrapExportedClass(name) => { + format!("unwrapping a pointer from a `{}` js class wrapper", name) + } }; bail!("import of {} requires JS glue", item); } diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index 55466de06d6..5e54e41e7f7 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -8,9 +8,9 @@ error[E0277]: the trait bound `Result - Box<[f32]> - Box<[f64]> - Box<[i16]> - Box<[i32]> - Box<[i64]> - and 35 others + Clamped + Option + Option + Option + Option + and $N others diff --git a/crates/macro/ui-tests/traits-not-implemented.stderr b/crates/macro/ui-tests/traits-not-implemented.stderr index 5b8e122287f..714050a53b5 100644 --- a/crates/macro/ui-tests/traits-not-implemented.stderr +++ b/crates/macro/ui-tests/traits-not-implemented.stderr @@ -13,5 +13,5 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied &'a (dyn Fn(A, B, C, D, E) -> R + 'b) &'a (dyn Fn(A, B, C, D, E, F) -> R + 'b) &'a (dyn Fn(A, B, C, D, E, F, G) -> R + 'b) - and 84 others + and $N others = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index fb3e92cd95f..2b1ba52b3c9 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -165,6 +165,13 @@ pub fn free_function(struct_name: &str) -> String { name } +pub fn unwrap_function(struct_name: &str) -> String { + let mut name = "__wbg_".to_string(); + name.extend(struct_name.chars().flat_map(|s| s.to_lowercase())); + name.push_str("_unwrap"); + name +} + pub fn free_function_export_name(function_name: &str) -> String { function_name.to_string() } diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 731dcea0214..4217bde716e 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "12040133795598472740"; +const APPROVED_SCHEMA_FILE_HASH: &str = "5679641936258023729"; #[test] fn schema_version() { diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 9ef9c260ff6..5d9c362902c 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -52,7 +52,7 @@ - [Imported JavaScript Types](./reference/types/imported-js-types.md) - [Exported Rust Types](./reference/types/exported-rust-types.md) - [`JsValue`](./reference/types/jsvalue.md) - - [`Box<[JsValue]>`](./reference/types/boxed-jsvalue-slice.md) + - [`Box<[T]>` and `Vec`](./reference/types/boxed-slices.md) - [`*const T` and `*mut T`](./reference/types/pointers.md) - [Numbers](./reference/types/numbers.md) - [`bool`](./reference/types/bool.md) diff --git a/guide/src/reference/types/boxed-jsvalue-slice.md b/guide/src/reference/types/boxed-slices.md similarity index 58% rename from guide/src/reference/types/boxed-jsvalue-slice.md rename to guide/src/reference/types/boxed-slices.md index 8060d194a7c..ed299462292 100644 --- a/guide/src/reference/types/boxed-jsvalue-slice.md +++ b/guide/src/reference/types/boxed-slices.md @@ -1,10 +1,19 @@ -# `Box<[JsValue]>` +# `Box<[T]>` and `Vec` | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | Yes | No | No | Yes | Yes | Yes | A JavaScript `Array` object | -Boxed slices of imported JS types and exported Rust types are also supported. `Vec` is supported wherever `Box<[T]>` is. +You can pass boxed slices and `Vec`s of several different types to and from JS: + +- `JsValue`s. +- Imported JavaScript types. +- Exported Rust types. +- `String`s. + +[You can also pass boxed slices of numbers to JS](boxed-number-slices.html), +except that they're converted to typed arrays (`Uint8Array`, `Int32Array`, etc.) +instead of regular arrays. ## Example Rust Usage diff --git a/src/convert/impls.rs b/src/convert/impls.rs index e8636fe9e66..637d9d979ad 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -4,7 +4,14 @@ use core::mem::{self, ManuallyDrop}; use crate::convert::traits::WasmAbi; use crate::convert::{FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi}; use crate::convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi}; -use crate::{Clamped, JsError, JsValue}; +use crate::{Clamped, JsError, JsValue, UnwrapThrowExt}; + +if_std! { + use std::boxed::Box; + use std::convert::{TryFrom, TryInto}; + use std::fmt::Debug; + use std::vec::Vec; +} unsafe impl WasmAbi for () {} @@ -321,7 +328,7 @@ impl IntoWasmAbi for () { /// - u32/i32/f32/f64 fields at the "leaf fields" of the "field tree" /// - layout equivalent to a completely flattened repr(C) struct, constructed by an in order /// traversal of all the leaf fields in it. -/// +/// /// This means that you can't embed struct A(u32, f64) as struct B(u32, A); because the "completely /// flattened" struct AB(u32, u32, f64) would miss the 4 byte padding that is actually present /// within B and then as a consequence also miss the 4 byte padding within A that repr(C) inserts. @@ -386,3 +393,37 @@ impl IntoWasmAbi for JsError { self.value.into_abi() } } + +if_std! { + // Note: this can't take `&[T]` because the `Into` impl needs + // ownership of `T`. + pub fn js_value_vector_into_abi>(vector: Box<[T]>) -> as IntoWasmAbi>::Abi { + let js_vals: Box<[JsValue]> = vector + .into_vec() + .into_iter() + .map(|x| x.into()) + .collect(); + + js_vals.into_abi() + } + + pub unsafe fn js_value_vector_from_abi>(js: as FromWasmAbi>::Abi) -> Box<[T]> where T::Error: Debug { + let js_vals = as FromWasmAbi>::from_abi(js); + + let mut result = Vec::with_capacity(js_vals.len()); + for value in js_vals { + // We push elements one-by-one instead of using `collect` in order to improve + // error messages. When using `collect`, this `expect_throw` is buried in a + // giant chain of internal iterator functions, which results in the actual + // function that takes this `Vec` falling off the end of the call stack. + // So instead, make sure to call it directly within this function. + // + // This is only a problem in debug mode. Since this is the browser's error stack + // we're talking about, it can only see functions that actually make it to the + // final wasm binary (i.e., not inlined functions). All of those internal + // iterator functions get inlined in release mode, and so they don't show up. + result.push(value.try_into().expect_throw("array contains a value of the wrong type")); + } + result.into_boxed_slice() + } +} diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 40ea6edc7c8..b356df5eb27 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -10,11 +10,14 @@ use crate::convert::OptionIntoWasmAbi; use crate::convert::{ FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi, }; +use crate::convert::{VectorFromWasmAbi, VectorIntoWasmAbi}; +use crate::describe::*; use cfg_if::cfg_if; if_std! { use core::mem; use crate::convert::OptionFromWasmAbi; + use crate::convert::{js_value_vector_from_abi, js_value_vector_into_abi}; } #[repr(C)] @@ -77,14 +80,21 @@ if_std! { macro_rules! vectors { ($($t:ident)*) => ($( if_std! { - impl IntoWasmAbi for Box<[$t]> { + impl WasmDescribeVector for $t { + fn describe_vector() { + inform(VECTOR); + $t::describe(); + } + } + + impl VectorIntoWasmAbi for $t { type Abi = WasmSlice; #[inline] - fn into_abi(self) -> WasmSlice { - let ptr = self.as_ptr(); - let len = self.len(); - mem::forget(self); + fn vector_into_abi(vector: Box<[$t]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); WasmSlice { ptr: ptr.into_abi(), len: len as u32, @@ -92,26 +102,16 @@ macro_rules! vectors { } } - impl OptionIntoWasmAbi for Box<[$t]> { - #[inline] - fn none() -> WasmSlice { null_slice() } - } - - impl FromWasmAbi for Box<[$t]> { + impl VectorFromWasmAbi for $t { type Abi = WasmSlice; #[inline] - unsafe fn from_abi(js: WasmSlice) -> Self { + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[$t]> { let ptr = <*mut $t>::from_abi(js.ptr); let len = js.len as usize; Vec::from_raw_parts(ptr, len, len).into_boxed_slice() } } - - impl OptionFromWasmAbi for Box<[$t]> { - #[inline] - fn is_none(slice: &WasmSlice) -> bool { slice.ptr == 0 } - } } impl<'a> IntoWasmAbi for &'a [$t] { @@ -183,6 +183,39 @@ vectors! { u8 i8 u16 i16 u32 i32 u64 i64 usize isize f32 f64 } +if_std! { + impl WasmDescribeVector for String { + fn describe_vector() { + inform(VECTOR); + inform(NAMED_EXTERNREF); + // Trying to use an actual loop for this breaks the wasm interpreter. + inform(6); + inform('s' as u32); + inform('t' as u32); + inform('r' as u32); + inform('i' as u32); + inform('n' as u32); + inform('g' as u32); + } + } + + impl VectorIntoWasmAbi for String { + type Abi = as IntoWasmAbi>::Abi; + + fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi { + js_value_vector_into_abi(vector) + } + } + + impl VectorFromWasmAbi for String { + type Abi = as FromWasmAbi>::Abi; + + unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]> { + js_value_vector_from_abi(js) + } + } +} + cfg_if! { if #[cfg(feature = "enable-interning")] { #[inline] @@ -300,14 +333,42 @@ impl LongRefFromWasmAbi for str { if_std! { use crate::JsValue; - impl IntoWasmAbi for Box<[JsValue]> { + impl IntoWasmAbi for Box<[T]> { + type Abi = ::Abi; + + fn into_abi(self) -> Self::Abi { + T::vector_into_abi(self) + } + } + + impl OptionIntoWasmAbi for Box<[T]> where Self: IntoWasmAbi { + fn none() -> WasmSlice { + null_slice() + } + } + + impl FromWasmAbi for Box<[T]> { + type Abi = ::Abi; + + unsafe fn from_abi(js: Self::Abi) -> Self { + T::vector_from_abi(js) + } + } + + impl OptionFromWasmAbi for Box<[T]> where Self: FromWasmAbi { + fn is_none(slice: &WasmSlice) -> bool { + slice.ptr == 0 + } + } + + impl VectorIntoWasmAbi for JsValue { type Abi = WasmSlice; #[inline] - fn into_abi(self) -> WasmSlice { - let ptr = self.as_ptr(); - let len = self.len(); - mem::forget(self); + fn vector_into_abi(vector: Box<[Self]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); WasmSlice { ptr: ptr.into_abi(), len: len as u32, @@ -315,35 +376,25 @@ if_std! { } } - impl OptionIntoWasmAbi for Box<[JsValue]> { - #[inline] - fn none() -> WasmSlice { null_slice() } - } - - impl FromWasmAbi for Box<[JsValue]> { + impl VectorFromWasmAbi for JsValue { type Abi = WasmSlice; #[inline] - unsafe fn from_abi(js: WasmSlice) -> Self { + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[Self]> { let ptr = <*mut JsValue>::from_abi(js.ptr); let len = js.len as usize; Vec::from_raw_parts(ptr, len, len).into_boxed_slice() } } - impl OptionFromWasmAbi for Box<[JsValue]> { - #[inline] - fn is_none(slice: &WasmSlice) -> bool { slice.ptr == 0 } - } - - impl IntoWasmAbi for Box<[T]> where T: JsObject { + impl VectorIntoWasmAbi for T where T: JsObject { type Abi = WasmSlice; #[inline] - fn into_abi(self) -> WasmSlice { - let ptr = self.as_ptr(); - let len = self.len(); - mem::forget(self); + fn vector_into_abi(vector: Box<[T]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); WasmSlice { ptr: ptr.into_abi(), len: len as u32, @@ -351,25 +402,15 @@ if_std! { } } - impl OptionIntoWasmAbi for Box<[T]> where T: JsObject { - #[inline] - fn none() -> WasmSlice { null_slice() } - } - - impl FromWasmAbi for Box<[T]> where T: JsObject { + impl VectorFromWasmAbi for T where T: JsObject { type Abi = WasmSlice; #[inline] - unsafe fn from_abi(js: WasmSlice) -> Self { + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[T]> { let ptr = <*mut JsValue>::from_abi(js.ptr); let len = js.len as usize; let vec: Vec = Vec::from_raw_parts(ptr, len, len).drain(..).map(|js_value| T::unchecked_from_js(js_value)).collect(); vec.into_boxed_slice() } } - - impl OptionFromWasmAbi for Box<[T]> where T: JsObject { - #[inline] - fn is_none(slice: &WasmSlice) -> bool { slice.ptr == 0 } - } } diff --git a/src/convert/traits.rs b/src/convert/traits.rs index fe31aab63a4..dc74caae15a 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -158,3 +158,24 @@ impl ReturnWasmAbi for T { self.into_abi() } } + +if_std! { + use core::marker::Sized; + use std::boxed::Box; + + /// Trait for element types to implement IntoWasmAbi for vectors of + /// themselves. + pub trait VectorIntoWasmAbi: WasmDescribeVector + Sized { + type Abi: WasmAbi; + + fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi; + } + + /// Trait for element types to implement FromWasmAbi for vectors of + /// themselves. + pub trait VectorFromWasmAbi: WasmDescribeVector + Sized { + type Abi: WasmAbi; + + unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>; + } +} diff --git a/src/describe.rs b/src/describe.rs index be149d7a90b..12a48554ac6 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -3,7 +3,7 @@ #![doc(hidden)] -use crate::{Clamped, JsError, JsValue}; +use crate::{Clamped, JsError, JsObject, JsValue}; use cfg_if::cfg_if; macro_rules! tys { @@ -57,6 +57,12 @@ pub trait WasmDescribe { fn describe(); } +/// Trait for element types to implement WasmDescribe for vectors of +/// themselves. +pub trait WasmDescribeVector { + fn describe_vector(); +} + macro_rules! simple { ($($t:ident => $d:ident)*) => ($( impl WasmDescribe for $t { @@ -145,13 +151,26 @@ if_std! { } } - impl WasmDescribe for Box<[T]> { - fn describe() { + impl WasmDescribeVector for JsValue { + fn describe_vector() { + inform(VECTOR); + JsValue::describe(); + } + } + + impl WasmDescribeVector for T { + fn describe_vector() { inform(VECTOR); T::describe(); } } + impl WasmDescribe for Box<[T]> { + fn describe() { + T::describe_vector(); + } + } + impl WasmDescribe for Vec where Box<[T]>: WasmDescribe { fn describe() { >::describe(); diff --git a/src/lib.rs b/src/lib.rs index 1df9cd92b0d..44844f63b8b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -805,6 +805,17 @@ if_std! { JsValue::from_str(&s) } } + + impl TryFrom for String { + type Error = JsValue; + + fn try_from(value: JsValue) -> Result { + match value.as_string() { + Some(s) => Ok(s), + None => Err(value), + } + } + } } impl From for JsValue { diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 508a9ea1f78..eebde19677e 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -46,6 +46,8 @@ pub mod result_jserror; pub mod rethrow; pub mod simple; pub mod slice; +pub mod string_vecs; +pub mod struct_vecs; pub mod structural; pub mod truthy_falsy; pub mod usize; diff --git a/tests/wasm/slice.js b/tests/wasm/slice.js index c23535e9b1f..3e65dfc5238 100644 --- a/tests/wasm/slice.js +++ b/tests/wasm/slice.js @@ -6,39 +6,60 @@ exports.js_export = () => { i8[0] = 1; i8[1] = 2; assert.deepStrictEqual(wasm.export_i8(i8), i8); + assert.deepStrictEqual(wasm.export_optional_i8(i8), i8); const u8 = new Uint8Array(2); u8[0] = 1; u8[1] = 2; assert.deepStrictEqual(wasm.export_u8(u8), u8); + assert.deepStrictEqual(wasm.export_optional_u8(u8), u8); const i16 = new Int16Array(2); i16[0] = 1; i16[1] = 2; assert.deepStrictEqual(wasm.export_i16(i16), i16); + assert.deepStrictEqual(wasm.export_optional_i16(i16), i16); const u16 = new Uint16Array(2); u16[0] = 1; u16[1] = 2; assert.deepStrictEqual(wasm.export_u16(u16), u16); + assert.deepStrictEqual(wasm.export_optional_u16(u16), u16); const i32 = new Int32Array(2); i32[0] = 1; i32[1] = 2; assert.deepStrictEqual(wasm.export_i32(i32), i32); + assert.deepStrictEqual(wasm.export_optional_i32(i32), i32); assert.deepStrictEqual(wasm.export_isize(i32), i32); + assert.deepStrictEqual(wasm.export_optional_isize(i32), i32); const u32 = new Uint32Array(2); u32[0] = 1; u32[1] = 2; assert.deepStrictEqual(wasm.export_u32(u32), u32); + assert.deepStrictEqual(wasm.export_optional_u32(u32), u32); assert.deepStrictEqual(wasm.export_usize(u32), u32); + assert.deepStrictEqual(wasm.export_optional_usize(u32), u32); const f32 = new Float32Array(2); f32[0] = 1; f32[1] = 2; assert.deepStrictEqual(wasm.export_f32(f32), f32); + assert.deepStrictEqual(wasm.export_optional_f32(f32), f32); const f64 = new Float64Array(2); f64[0] = 1; f64[1] = 2; assert.deepStrictEqual(wasm.export_f64(f64), f64); + assert.deepStrictEqual(wasm.export_optional_f64(f64), f64); + + assert.strictEqual(wasm.export_optional_i8(undefined), undefined); + assert.strictEqual(wasm.export_optional_u8(undefined), undefined); + assert.strictEqual(wasm.export_optional_i16(undefined), undefined); + assert.strictEqual(wasm.export_optional_u16(undefined), undefined); + assert.strictEqual(wasm.export_optional_i32(undefined), undefined); + assert.strictEqual(wasm.export_optional_isize(undefined), undefined); + assert.strictEqual(wasm.export_optional_u32(undefined), undefined); + assert.strictEqual(wasm.export_optional_usize(undefined), undefined); + assert.strictEqual(wasm.export_optional_f32(undefined), undefined); + assert.strictEqual(wasm.export_optional_f64(undefined), undefined); }; const test_import = (a, b, c) => { diff --git a/tests/wasm/slice.rs b/tests/wasm/slice.rs index 6e659ce6f54..9f9066fe720 100644 --- a/tests/wasm/slice.rs +++ b/tests/wasm/slice.rs @@ -22,7 +22,7 @@ extern "C" { } macro_rules! export_macro { - ($(($i:ident, $n:ident))*) => ($( + ($(($i:ident, $n:ident, $optional_n:ident))*) => ($( #[wasm_bindgen] pub fn $n(a: &[$i]) -> Vec<$i> { assert_eq!(a.len(), 2); @@ -30,20 +30,30 @@ macro_rules! export_macro { assert_eq!(a[1], 2 as $i); a.to_vec() } + + #[wasm_bindgen] + pub fn $optional_n(a: Option>) -> Option> { + a.map(|a| { + assert_eq!(a.len(), 2); + assert_eq!(a[0], 1 as $i); + assert_eq!(a[1], 2 as $i); + a.to_vec() + }) + } )*) } export_macro! { - (i8, export_i8) - (u8, export_u8) - (i16, export_i16) - (u16, export_u16) - (i32, export_i32) - (u32, export_u32) - (isize, export_isize) - (usize, export_usize) - (f32, export_f32) - (f64, export_f64) + (i8, export_i8, export_optional_i8) + (u8, export_u8, export_optional_u8) + (i16, export_i16, export_optional_i16) + (u16, export_u16, export_optional_u16) + (i32, export_i32, export_optional_i32) + (u32, export_u32, export_optional_u32) + (isize, export_isize, export_optional_isize) + (usize, export_usize, export_optional_usize) + (f32, export_f32, export_optional_f32) + (f64, export_f64, export_optional_f64) } #[wasm_bindgen_test] diff --git a/tests/wasm/string_vecs.js b/tests/wasm/string_vecs.js new file mode 100644 index 00000000000..de9b0ef580a --- /dev/null +++ b/tests/wasm/string_vecs.js @@ -0,0 +1,23 @@ +const wasm = require('wasm-bindgen-test.js'); +const assert = require('assert'); + +exports.pass_string_vec = () => { + assert.deepStrictEqual( + wasm.consume_string_vec(["hello", "world"]), + ["hello", "world", "Hello from Rust!"], + ); + assert.deepStrictEqual( + wasm.consume_optional_string_vec(["hello", "world"]), + ["hello", "world", "Hello from Rust!"], + ); + assert.strictEqual(wasm.consume_optional_string_vec(undefined), undefined); +}; + +exports.pass_invalid_string_vec = () => { + try { + wasm.consume_string_vec([42]); + } catch (e) { + assert.match(e.message, /array contains a value of the wrong type/) + assert.match(e.stack, /consume_string_vec/) + } +}; diff --git a/tests/wasm/string_vecs.rs b/tests/wasm/string_vecs.rs new file mode 100644 index 00000000000..1234d03d9b0 --- /dev/null +++ b/tests/wasm/string_vecs.rs @@ -0,0 +1,29 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/string_vecs.js")] +extern "C" { + fn pass_string_vec(); + fn pass_invalid_string_vec(); +} + +#[wasm_bindgen] +pub fn consume_string_vec(mut vec: Vec) -> Vec { + vec.push("Hello from Rust!".to_owned()); + vec +} + +#[wasm_bindgen] +pub fn consume_optional_string_vec(vec: Option>) -> Option> { + vec.map(consume_string_vec) +} + +#[wasm_bindgen_test] +fn test_valid() { + pass_string_vec(); +} + +#[wasm_bindgen_test] +fn test_invalid() { + pass_invalid_string_vec(); +} diff --git a/tests/wasm/struct_vecs.js b/tests/wasm/struct_vecs.js new file mode 100644 index 00000000000..23eb154fd80 --- /dev/null +++ b/tests/wasm/struct_vecs.js @@ -0,0 +1,23 @@ +const wasm = require('wasm-bindgen-test.js'); +const assert = require('assert'); + +exports.pass_struct_vec = () => { + const el1 = new wasm.ArrayElement(); + const el2 = new wasm.ArrayElement(); + const ret = wasm.consume_struct_vec([el1, el2]); + assert.strictEqual(ret.length, 3); + + const ret2 = wasm.consume_optional_struct_vec(ret); + assert.strictEqual(ret2.length, 4); + + assert.strictEqual(wasm.consume_optional_struct_vec(undefined), undefined); +}; + +exports.pass_invalid_struct_vec = () => { + try { + wasm.consume_struct_vec(['not a struct']); + } catch (e) { + assert.match(e.message, /array contains a value of the wrong type/) + assert.match(e.stack, /consume_struct_vec/) + } +}; diff --git a/tests/wasm/struct_vecs.rs b/tests/wasm/struct_vecs.rs new file mode 100644 index 00000000000..2440abc2037 --- /dev/null +++ b/tests/wasm/struct_vecs.rs @@ -0,0 +1,40 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/struct_vecs.js")] +extern "C" { + fn pass_struct_vec(); + fn pass_invalid_struct_vec(); +} + +#[wasm_bindgen] +pub struct ArrayElement; + +#[wasm_bindgen] +impl ArrayElement { + #[wasm_bindgen(constructor)] + pub fn new() -> ArrayElement { + ArrayElement + } +} + +#[wasm_bindgen] +pub fn consume_struct_vec(mut vec: Vec) -> Vec { + vec.push(ArrayElement); + vec +} + +#[wasm_bindgen] +pub fn consume_optional_struct_vec(vec: Option>) -> Option> { + vec.map(consume_struct_vec) +} + +#[wasm_bindgen_test] +fn test_valid() { + pass_struct_vec(); +} + +#[wasm_bindgen_test] +fn test_invalid() { + pass_invalid_struct_vec(); +} From 41617bdce3d3c76656a62edb7fc79b310f2e2c16 Mon Sep 17 00:00:00 2001 From: FirelightFlagboy <30697622+FirelightFlagboy@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:55:18 +0200 Subject: [PATCH 269/641] Add attribute `crate` to proc-macro `wasm-bindgen-test` (#3593) --- CHANGELOG.md | 4 ++ crates/test-macro/Cargo.toml | 1 + crates/test-macro/src/lib.rs | 61 ++++++++++++++----------- crates/test-macro/ui-tests/crate.rs | 20 ++++++++ crates/test-macro/ui-tests/crate.stderr | 5 ++ 5 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 crates/test-macro/ui-tests/crate.rs create mode 100644 crates/test-macro/ui-tests/crate.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index ad1467af0c8..9a12d912268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ * Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)`. [#3580](https://github.com/rustwasm/wasm-bindgen/pull/3580) +* Add a `crate` attribute to the `wasm_bindgen_test` proc-macro to specify a + non-default path to the `wasm-bindgen-test` crate. + [#3593](https://github.com/rustwasm/wasm-bindgen/pull/3593) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 88d8c5de171..540fd7f0a7a 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -14,6 +14,7 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" +syn = { version = "2.0", default-features = false, features = [ "parsing", "proc-macro", "derive", "printing" ] } [dev-dependencies] wasm-bindgen-test = { path = "../test" } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 53050be011c..8215bb3206a 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -16,30 +16,11 @@ pub fn wasm_bindgen_test( attr: proc_macro::TokenStream, body: proc_macro::TokenStream, ) -> proc_macro::TokenStream { - let mut attr = attr.into_iter(); - let mut r#async = false; + let mut attributes = Attributes::default(); + let attribute_parser = syn::meta::parser(|meta| attributes.parse(meta)); + + syn::parse_macro_input!(attr with attribute_parser); let mut should_panic = None; - while let Some(token) = attr.next() { - match &token { - proc_macro::TokenTree::Ident(i) if i.to_string() == "async" => r#async = true, - _ => { - return compile_error( - token.span().into(), - "malformed `#[wasm_bindgen_test]` attribute", - ) - } - } - match &attr.next() { - Some(proc_macro::TokenTree::Punct(op)) if op.as_char() == ',' => {} - Some(_) => { - return compile_error( - token.span().into(), - "malformed `#[wasm_bindgen_test]` attribute", - ) - } - None => break, - } - } let mut body = TokenStream::from(body).into_iter().peekable(); @@ -64,7 +45,7 @@ pub fn wasm_bindgen_test( leading_tokens.push(token.clone()); if let TokenTree::Ident(token) = token { if token == "async" { - r#async = true; + attributes.r#async = true; } if token == "fn" { break; @@ -83,7 +64,7 @@ pub fn wasm_bindgen_test( None => quote! { ::core::option::Option::None }, }; - let test_body = if r#async { + let test_body = if attributes.r#async { quote! { cx.execute_async(test_name, #ident, #should_panic); } } else { quote! { cx.execute_sync(test_name, #ident, #should_panic); } @@ -93,10 +74,11 @@ pub fn wasm_bindgen_test( // later slurp up all of these functions and pass them as arguments to the // main test harness. This is the entry point for all tests. let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); + let wasm_bindgen_path = attributes.wasm_bindgen_path; tokens.extend( quote! { #[no_mangle] - pub extern "C" fn #name(cx: &::wasm_bindgen_test::__rt::Context) { + pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body } @@ -205,3 +187,30 @@ fn find_ident(iter: &mut impl Iterator) -> Option { fn compile_error(span: Span, msg: &str) -> proc_macro::TokenStream { quote_spanned! { span => compile_error!(#msg); }.into() } + +struct Attributes { + r#async: bool, + wasm_bindgen_path: syn::Path, +} + +impl Default for Attributes { + fn default() -> Self { + Self { + r#async: false, + wasm_bindgen_path: syn::parse_quote!(::wasm_bindgen_test), + } + } +} + +impl Attributes { + fn parse(&mut self, meta: syn::meta::ParseNestedMeta) -> syn::parse::Result<()> { + if meta.path.is_ident("async") { + self.r#async = true; + } else if meta.path.is_ident("crate") { + self.wasm_bindgen_path = meta.value()?.parse::()?; + } else { + return Err(meta.error("unknown attribute")); + } + Ok(()) + } +} diff --git a/crates/test-macro/ui-tests/crate.rs b/crates/test-macro/ui-tests/crate.rs new file mode 100644 index 00000000000..2087f7575b6 --- /dev/null +++ b/crates/test-macro/ui-tests/crate.rs @@ -0,0 +1,20 @@ +#![no_implicit_prelude] + +extern crate wasm_bindgen_test_macro; +// +use wasm_bindgen_test_macro::wasm_bindgen_test; + +pub mod wasm { + pub extern crate wasm_bindgen_test as test; +} + +#[wasm_bindgen_test(crate = ::wasm_bindgen_test)] +fn success_1() {} + +#[wasm_bindgen_test(crate = crate::wasm::test)] +fn success_2() {} + +#[wasm_bindgen_test(crate = foo)] +fn failure_1() {} + +fn main() {} diff --git a/crates/test-macro/ui-tests/crate.stderr b/crates/test-macro/ui-tests/crate.stderr new file mode 100644 index 00000000000..2bace352ee4 --- /dev/null +++ b/crates/test-macro/ui-tests/crate.stderr @@ -0,0 +1,5 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `foo` + --> ui-tests/crate.rs:17:29 + | +17 | #[wasm_bindgen_test(crate = foo)] + | ^^^ use of undeclared crate or module `foo` From f89a0fb720bfad2b77eb99b72dd4d48042262860 Mon Sep 17 00:00:00 2001 From: Pauan Date: Wed, 6 Sep 2023 22:15:47 +0200 Subject: [PATCH 270/641] Minor improvements to wasm-bindgen-futures (#3594) --- crates/futures/src/task/singlethread.rs | 29 ++++++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/crates/futures/src/task/singlethread.rs b/crates/futures/src/task/singlethread.rs index 975e88754a8..ad52f552400 100644 --- a/crates/futures/src/task/singlethread.rs +++ b/crates/futures/src/task/singlethread.rs @@ -35,6 +35,23 @@ impl Task { crate::queue::QUEUE.with(|queue| queue.schedule_task(this)); } + fn force_wake(this: Rc) { + crate::queue::QUEUE.with(|queue| { + queue.push_task(this); + }); + } + + fn wake(this: Rc) { + // If we've already been placed on the run queue then there's no need to + // requeue ourselves since we're going to run at some point in the + // future anyway. + if this.is_queued.replace(true) { + return; + } + + Self::force_wake(this); + } + fn wake_by_ref(this: &Rc) { // If we've already been placed on the run queue then there's no need to // requeue ourselves since we're going to run at some point in the @@ -43,9 +60,7 @@ impl Task { return; } - crate::queue::QUEUE.with(|queue| { - queue.push_task(Rc::clone(this)); - }); + Self::force_wake(Rc::clone(this)); } /// Creates a standard library `RawWaker` from an `Rc` of ourselves. @@ -55,15 +70,17 @@ impl Task { /// however, everything is guaranteed to be singlethreaded (since we're /// compiled without the `atomics` feature) so we "safely lie" and say our /// `Rc` pointer is good enough. + /// + /// The implementation is based off of futures::task::ArcWake unsafe fn into_raw_waker(this: Rc) -> RawWaker { unsafe fn raw_clone(ptr: *const ()) -> RawWaker { let ptr = ManuallyDrop::new(Rc::from_raw(ptr as *const Task)); - Task::into_raw_waker((*ptr).clone()) + Task::into_raw_waker(Rc::clone(&ptr)) } unsafe fn raw_wake(ptr: *const ()) { let ptr = Rc::from_raw(ptr as *const Task); - Task::wake_by_ref(&ptr); + Task::wake(ptr); } unsafe fn raw_wake_by_ref(ptr: *const ()) { @@ -75,7 +92,7 @@ impl Task { drop(Rc::from_raw(ptr as *const Task)); } - const VTABLE: RawWakerVTable = + static VTABLE: RawWakerVTable = RawWakerVTable::new(raw_clone, raw_wake, raw_wake_by_ref, raw_drop); RawWaker::new(Rc::into_raw(this) as *const (), &VTABLE) From 0cbc0c926fb74df4d6fa4bc3ee170e6e6065053d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 7 Sep 2023 19:03:01 +1000 Subject: [PATCH 271/641] Add missing changelog entries for #3554 (#3599) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a12d912268..de3af2ccb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,12 @@ non-default path to the `wasm-bindgen-test` crate. [#3593](https://github.com/rustwasm/wasm-bindgen/pull/3593) +* Add support for passing `Vec`s of exported Rust types and strings to/from JS. + [#3554](https://github.com/rustwasm/wasm-bindgen/pull/3554) + +* Implement `TryFrom` for exported Rust types and strings. + [#3554](https://github.com/rustwasm/wasm-bindgen/pull/3554) + ### Changed * Updated the WebGPU WebIDL. From 2c622715c9e6602f7bb377828c72f7953b178ed7 Mon Sep 17 00:00:00 2001 From: Leonard Date: Thu, 7 Sep 2023 22:48:21 +0200 Subject: [PATCH 272/641] Add experimental `ViewTransition` interface (#3598) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 1 + crates/web-sys/src/features/gen_Document.rs | 27 ++++++++ .../src/features/gen_ViewTransition.rs | 63 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 6 ++ .../webidls/unstable/ViewTransition.webidl | 15 +++++ 6 files changed, 115 insertions(+) create mode 100644 crates/web-sys/src/features/gen_ViewTransition.rs create mode 100644 crates/web-sys/webidls/unstable/ViewTransition.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index de3af2ccb65..536b2a8ba64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add bindings for `ViewTransition` to `web-sys`. + [#3598](https://github.com/rustwasm/wasm-bindgen/pull/3598) + * Extend `AudioContext` with unstable features supporting audio sink configuration. [#3433](https://github.com/rustwasm/wasm-bindgen/pull/3433) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index ab52e7a142f..576d1adb0b8 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1458,6 +1458,7 @@ VideoStreamTrack = ["EventTarget", "MediaStreamTrack"] VideoTrack = [] VideoTrackList = ["EventTarget"] VideoTransferCharacteristics = [] +ViewTransition = [] VisibilityState = [] VoidCallback = [] VrDisplay = ["EventTarget"] diff --git a/crates/web-sys/src/features/gen_Document.rs b/crates/web-sys/src/features/gen_Document.rs index d2ad9eb374f..b910b43c3e8 100644 --- a/crates/web-sys/src/features/gen_Document.rs +++ b/crates/web-sys/src/features/gen_Document.rs @@ -2155,6 +2155,33 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] pub fn release_capture(this: &Document); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ViewTransition")] + # [wasm_bindgen (catch , method , structural , js_class = "Document" , js_name = startViewTransition)] + #[doc = "The `startViewTransition()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`, `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_view_transition(this: &Document) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ViewTransition")] + # [wasm_bindgen (catch , method , structural , js_class = "Document" , js_name = startViewTransition)] + #[doc = "The `startViewTransition()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`, `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_view_transition_with_update_callback( + this: &Document, + update_callback: Option<&::js_sys::Function>, + ) -> Result; #[cfg(feature = "Element")] # [wasm_bindgen (method , structural , js_class = "Document" , js_name = elementFromPoint)] #[doc = "The `elementFromPoint()` method."] diff --git a/crates/web-sys/src/features/gen_ViewTransition.rs b/crates/web-sys/src/features/gen_ViewTransition.rs new file mode 100644 index 00000000000..aa8f5ae1ef4 --- /dev/null +++ b/crates/web-sys/src/features/gen_ViewTransition.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ViewTransition , typescript_type = "ViewTransition")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ViewTransition` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type ViewTransition; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "ViewTransition" , js_name = updateCallbackDone)] + #[doc = "Getter for the `updateCallbackDone` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/updateCallbackDone)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn update_callback_done(this: &ViewTransition) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "ViewTransition" , js_name = ready)] + #[doc = "Getter for the `ready` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/ready)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ready(this: &ViewTransition) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "ViewTransition" , js_name = finished)] + #[doc = "Getter for the `finished` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/finished)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn finished(this: &ViewTransition) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "ViewTransition" , js_name = skipTransition)] + #[doc = "The `skipTransition()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/skipTransition)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ViewTransition`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn skip_transition(this: &ViewTransition) -> Result<(), JsValue>; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 3e0f90fd6a4..e02ad43ad3e 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -8560,6 +8560,12 @@ mod gen_VideoTransferCharacteristics; #[cfg(feature = "VideoTransferCharacteristics")] pub use gen_VideoTransferCharacteristics::*; +#[cfg(feature = "ViewTransition")] +#[allow(non_snake_case)] +mod gen_ViewTransition; +#[cfg(feature = "ViewTransition")] +pub use gen_ViewTransition::*; + #[cfg(feature = "VisibilityState")] #[allow(non_snake_case)] mod gen_VisibilityState; diff --git a/crates/web-sys/webidls/unstable/ViewTransition.webidl b/crates/web-sys/webidls/unstable/ViewTransition.webidl new file mode 100644 index 00000000000..3f84c572497 --- /dev/null +++ b/crates/web-sys/webidls/unstable/ViewTransition.webidl @@ -0,0 +1,15 @@ +partial interface Document { + [Throws] + ViewTransition startViewTransition(optional UpdateCallback? updateCallback = null); +}; + +callback UpdateCallback = Promise (); + +[Exposed=Window] +interface ViewTransition { + readonly attribute Promise updateCallbackDone; + readonly attribute Promise ready; + readonly attribute Promise finished; + [Throws] + undefined skipTransition(); +}; From 51e89ebee5bedb585464b492c6456048093054f8 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 12 Sep 2023 22:24:36 +1000 Subject: [PATCH 273/641] Make `wasm-bindgen` compatible with the standard C ABI (#3595) * Make `wasm-bindgen` compatible with the standard C ABI * Update the guide * Fix reference tests For some reason a couple of functions got switched around; no actual meaningful changes. * Add changelog entry * Add spacing * Mention `WasmAbi` in the changelog * fix a tiny typo --- CHANGELOG.md | 11 ++ crates/backend/src/codegen.rs | 124 +++++++++----- .../tests/reference/anyref-import-catch.wat | 4 +- crates/cli/tests/reference/builder.wat | 4 +- crates/cli/tests/reference/constructor.wat | 4 +- .../design/rust-type-conversions.md | 32 +++- src/closure.rs | 66 +++++--- src/convert/closures.rs | 68 +++++--- src/convert/impls.rs | 158 +++++++++--------- src/convert/slices.rs | 46 ++++- src/convert/traits.rs | 96 +++++++++-- src/lib.rs | 11 +- 12 files changed, 424 insertions(+), 200 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 536b2a8ba64..cce1b9d2852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,17 @@ When exported constructors return `Self`. [#3562](https://github.com/rustwasm/wasm-bindgen/pull/3562) +* Made `wasm-bindgen` forwards-compatible with the standard C ABI. + [#3595](https://github.com/rustwasm/wasm-bindgen/pull/3595) + +* Changed the design of the internal `WasmAbi` trait. Rather than marking a type + which can be passed directly as a parameter/result to/from JS, it now lets + types specify how they can be split into / recreated from multiple primitive + types which are then passed to/from JS. + `WasmPrimitive` now serves the old function of `WasmAbi`, minus allowing + `#[repr(C)]` types. + [#3595](https://github.com/rustwasm/wasm-bindgen/pull/3595) + ### Fixed * Fixed bindings and comments for `Atomics.wait`. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 837245d5e6d..4e3d6ca8d9a 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -3,6 +3,7 @@ use crate::encode; use crate::Diagnostic; use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; +use quote::format_ident; use quote::quote_spanned; use quote::{quote, ToTokens}; use std::collections::{HashMap, HashSet}; @@ -142,7 +143,7 @@ impl TryToTokens for ast::LinkToModule { let link_function_name = self.0.link_function_name(0); let name = Ident::new(&link_function_name, Span::call_site()); let wasm_bindgen = &self.0.wasm_bindgen; - let abi_ret = quote! { ::Abi }; + let abi_ret = quote! { #wasm_bindgen::convert::WasmRet<::Abi> }; let extern_fn = extern_fn(&name, &[], &[], &[], abi_ret); (quote! { { @@ -150,7 +151,7 @@ impl TryToTokens for ast::LinkToModule { #extern_fn unsafe { - ::from_abi(#name()) + ::from_abi(#name().join()) } } }) @@ -401,7 +402,7 @@ impl ToTokens for ast::StructField { #[cfg_attr(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))), no_mangle)] #[doc(hidden)] pub unsafe extern "C" fn #getter(js: u32) - -> <#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi + -> #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi> { use #wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; use #wasm_bindgen::convert::IntoWasmAbi; @@ -412,7 +413,7 @@ impl ToTokens for ast::StructField { let js = js as *mut WasmRefCell<#struct_name>; assert_not_null(js); let val = #val; - <#ty as IntoWasmAbi>::into_abi(val) + <#ty as IntoWasmAbi>::into_abi(val).into() } }; }) @@ -432,6 +433,9 @@ impl ToTokens for ast::StructField { return; } + let abi = quote! { <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi }; + let (args, names) = splat(wasm_bindgen, &Ident::new("val", rust_name.span()), &abi); + (quote! { #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] #[automatically_derived] @@ -440,13 +444,14 @@ impl ToTokens for ast::StructField { #[doc(hidden)] pub unsafe extern "C" fn #setter( js: u32, - val: <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi, + #(#args,)* ) { use #wasm_bindgen::__rt::{WasmRefCell, assert_not_null}; use #wasm_bindgen::convert::FromWasmAbi; let js = js as *mut WasmRefCell<#struct_name>; assert_not_null(js); + let val = <#abi as #wasm_bindgen::convert::WasmAbi>::join(#(#names),*); let val = <#ty as FromWasmAbi>::from_abi(val); (*js).borrow_mut().#rust_name = val; } @@ -525,52 +530,61 @@ impl TryToTokens for ast::Export { elem, .. }) => { - args.push(quote! { - #ident: <#elem as #wasm_bindgen::convert::RefMutFromWasmAbi>::Abi - }); + let abi = quote! { <#elem as #wasm_bindgen::convert::RefMutFromWasmAbi>::Abi }; + let (prim_args, prim_names) = splat(wasm_bindgen, &ident, &abi); + args.extend(prim_args); arg_conversions.push(quote! { let mut #ident = unsafe { <#elem as #wasm_bindgen::convert::RefMutFromWasmAbi> - ::ref_mut_from_abi(#ident) + ::ref_mut_from_abi( + <#abi as #wasm_bindgen::convert::WasmAbi>::join(#(#prim_names),*) + ) }; let #ident = &mut *#ident; }); } syn::Type::Reference(syn::TypeReference { elem, .. }) => { if self.function.r#async { - args.push(quote! { - #ident: <#elem as #wasm_bindgen::convert::LongRefFromWasmAbi>::Abi - }); + let abi = + quote! { <#elem as #wasm_bindgen::convert::LongRefFromWasmAbi>::Abi }; + let (prim_args, prim_names) = splat(wasm_bindgen, &ident, &abi); + args.extend(prim_args); arg_conversions.push(quote! { let #ident = unsafe { <#elem as #wasm_bindgen::convert::LongRefFromWasmAbi> - ::long_ref_from_abi(#ident) + ::long_ref_from_abi( + <#abi as #wasm_bindgen::convert::WasmAbi>::join(#(#prim_names),*) + ) }; let #ident = <<#elem as #wasm_bindgen::convert::LongRefFromWasmAbi> ::Anchor as core::borrow::Borrow<#elem>> ::borrow(&#ident); }); } else { - args.push(quote! { - #ident: <#elem as #wasm_bindgen::convert::RefFromWasmAbi>::Abi - }); + let abi = quote! { <#elem as #wasm_bindgen::convert::RefFromWasmAbi>::Abi }; + let (prim_args, prim_names) = splat(wasm_bindgen, &ident, &abi); + args.extend(prim_args); arg_conversions.push(quote! { let #ident = unsafe { <#elem as #wasm_bindgen::convert::RefFromWasmAbi> - ::ref_from_abi(#ident) + ::ref_from_abi( + <#abi as #wasm_bindgen::convert::WasmAbi>::join(#(#prim_names),*) + ) }; let #ident = &*#ident; }); } } _ => { - args.push(quote! { - #ident: <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi - }); + let abi = quote! { <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi }; + let (prim_args, prim_names) = splat(wasm_bindgen, &ident, &abi); + args.extend(prim_args); arg_conversions.push(quote! { let #ident = unsafe { <#ty as #wasm_bindgen::convert::FromWasmAbi> - ::from_abi(#ident) + ::from_abi( + <#abi as #wasm_bindgen::convert::WasmAbi>::join(#(#prim_names),*) + ) }; }); } @@ -642,7 +656,7 @@ impl TryToTokens for ast::Export { } let projection = quote! { <#ret_ty as #wasm_bindgen::convert::ReturnWasmAbi> }; - let convert_ret = quote! { #projection::return_abi(#ret) }; + let convert_ret = quote! { #projection::return_abi(#ret).into() }; let describe_ret = quote! { <#ret_ty as WasmDescribe>::describe(); <#inner_ret_ty as WasmDescribe>::describe(); @@ -664,7 +678,7 @@ impl TryToTokens for ast::Export { all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))), export_name = #export_name, )] - pub unsafe extern "C" fn #generated_name(#(#args),*) -> #projection::Abi { + pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { #start_check let #ret = #call; @@ -1147,10 +1161,11 @@ impl TryToTokens for ast::ImportFunction { ), }; - abi_argument_names.push(name.clone()); - abi_arguments.push(quote! { - #name: <#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi - }); + let abi = quote! { <#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi }; + let (prim_args, prim_names) = splat(wasm_bindgen, &name, &abi); + abi_arguments.extend(prim_args); + abi_argument_names.extend(prim_names.iter().cloned()); + let var = if i == 0 && is_method { quote! { self } } else { @@ -1160,6 +1175,7 @@ impl TryToTokens for ast::ImportFunction { arg_conversions.push(quote! { let #name = <#ty as #wasm_bindgen::convert::IntoWasmAbi> ::into_abi(#var); + let (#(#prim_names),*) = <#abi as #wasm_bindgen::convert::WasmAbi>::split(#name); }); } let abi_ret; @@ -1173,12 +1189,13 @@ impl TryToTokens for ast::ImportFunction { } Some(ref ty) => { if self.function.r#async { - abi_ret = - quote! { ::Abi }; + abi_ret = quote! { + #wasm_bindgen::convert::WasmRet<::Abi> + }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - ::from_abi(#ret_ident) + ::from_abi(#ret_ident.join()) ).await }; convert_ret = if self.catch { @@ -1188,22 +1205,23 @@ impl TryToTokens for ast::ImportFunction { }; } else { abi_ret = quote! { - <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi + #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; convert_ret = quote! { <#ty as #wasm_bindgen::convert::FromWasmAbi> - ::from_abi(#ret_ident) + ::from_abi(#ret_ident.join()) }; } } None => { if self.function.r#async { - abi_ret = - quote! { ::Abi }; + abi_ret = quote! { + #wasm_bindgen::convert::WasmRet<::Abi> + }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - ::from_abi(#ret_ident) + ::from_abi(#ret_ident.join()) ).await }; convert_ret = if self.catch { @@ -1421,6 +1439,10 @@ impl ToTokens for ast::ImportStatic { let shim_name = &self.shim; let vis = &self.vis; let wasm_bindgen = &self.wasm_bindgen; + + let abi_ret = quote! { + #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi> + }; (quote! { #[automatically_derived] #vis static #name: #wasm_bindgen::JsStatic<#ty> = { @@ -1428,16 +1450,16 @@ impl ToTokens for ast::ImportStatic { #[link(wasm_import_module = "__wbindgen_placeholder__")] #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] extern "C" { - fn #shim_name() -> <#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi; + fn #shim_name() -> #abi_ret; } #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] - unsafe fn #shim_name() -> <#ty as wasm_bindgen::convert::FromWasmAbi>::Abi { + unsafe fn #shim_name() -> #abi_ret { panic!("cannot access imported statics on non-wasm targets") } unsafe { - <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name()) + <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name().join()) } } thread_local!(static _VAL: #ty = init();); @@ -1540,6 +1562,32 @@ fn extern_fn( } } +/// Splats an argument with the given name and ABI type into 4 arguments, one +/// for each primitive that the ABI type splits into. +/// +/// Returns an `(args, names)` pair, where `args` is the list of arguments to +/// be inserted into the function signature, and `names` is a list of the names +/// of those arguments. +fn splat( + wasm_bindgen: &syn::Path, + name: &Ident, + abi: &TokenStream, +) -> (Vec, Vec) { + let mut args = Vec::new(); + let mut names = Vec::new(); + + for n in 1..=4 { + let arg_name = format_ident!("{name}_{n}"); + let prim_name = format_ident!("Prim{n}"); + args.push(quote! { + #arg_name: <#abi as #wasm_bindgen::convert::WasmAbi>::#prim_name + }); + names.push(arg_name); + } + + (args, names) +} + /// Converts `span` into a stream of tokens, and attempts to ensure that `input` /// has all the appropriate span information so errors in it point to `span`. fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 48071a315d7..ed8e5683402 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -5,8 +5,8 @@ (type (;3;) (func (param i32) (result i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $__wbindgen_exn_store (;1;) (type 2) (param i32)) - (func $__externref_table_dealloc (;2;) (type 2) (param i32)) - (func $exported (;3;) (type 2) (param i32)) + (func $exported (;2;) (type 2) (param i32)) + (func $__externref_table_dealloc (;3;) (type 2) (param i32)) (func $__externref_table_alloc (;4;) (type 1) (result i32)) (func $__wbindgen_add_to_stack_pointer (;5;) (type 3) (param i32) (result i32)) (table (;0;) 128 externref) diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index cd38fc7fc6a..c6761d480fd 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -1,8 +1,8 @@ (module (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) - (func $__wbg_classbuilder_free (;0;) (type 1) (param i32)) - (func $classbuilder_builder (;1;) (type 0) (result i32)) + (func $classbuilder_builder (;0;) (type 0) (result i32)) + (func $__wbg_classbuilder_free (;1;) (type 1) (param i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index a5596470321..bad14a1de88 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -1,8 +1,8 @@ (module (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) - (func $__wbg_classconstructor_free (;0;) (type 1) (param i32)) - (func $classconstructor_new (;1;) (type 0) (result i32)) + (func $classconstructor_new (;0;) (type 0) (result i32)) + (func $__wbg_classconstructor_free (;1;) (type 1) (param i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) diff --git a/guide/src/contributing/design/rust-type-conversions.md b/guide/src/contributing/design/rust-type-conversions.md index 7af5f1b4dca..89776893f21 100644 --- a/guide/src/contributing/design/rust-type-conversions.md +++ b/guide/src/contributing/design/rust-type-conversions.md @@ -21,14 +21,12 @@ a Rust value to a JS one. There's a few points here: * We'll get to `WasmDescribe` later in this section. -* The associated type `Abi` is what will actually be generated as an argument / - return type for the `extern "C"` functions used to declare wasm imports/exports. +* The associated type `Abi` is the type of the raw data that we actually want to pass to JS. The bound `WasmAbi` is implemented for primitive types like `u32` and `f64`, which can be represented directly as WebAssembly values, as well of a couple - of `#[repr(C)]` types like `WasmSlice`: + of other types like `WasmSlice`: ```rust - #[repr(C)] pub struct WasmSlice { pub ptr: u32, pub len: u32, @@ -36,9 +34,28 @@ a Rust value to a JS one. There's a few points here: ``` This struct, which is how things like strings are represented in FFI, isn't - a WebAssembly primitive type and so isn't mapped directly to a WebAssembly - parameter / return value; instead, the C ABI flattens it out into two arguments - or stores it on the stack. + a WebAssembly primitive type, and so it can't be mapped directly to a + WebAssembly parameter / return value. This is why `WasmAbi` lets types specify + how they can be split up into multiple WebAssembly parameters: + + ```rust + impl WasmAbi for WasmSlice { + fn split(self) -> (u32, u32, (), ()) { + (self.ptr, self.len, (), ()) + } + + // some other details to specify return type of `split`, go in the other direction + } + ``` + + This means that a `WasmSlice` gets split up into two `u32` parameters. + The extra unit types on the end are there because Rust doesn't let us make + `WasmAbi` generic over variable-length tuples, so we just take tuples of 4 + elements. The unit types still end up getting passed to/from JS, but the C ABI + just completely ignores them and doesn't generate any arguments. + + Since we can't return multiple values, when returning a `WasmSlice` we instead + put the two `u32`s into a `#[repr(C)]` struct and return that. * And finally we have the `into_abi` function, returning the `Abi` associated type which will be actually passed to JS. @@ -94,4 +111,3 @@ and remain anonymous. The `From*` family of traits are used for converting the Rust arguments in Rust exported functions to JS. They are also used for the return value in JS functions imported into Rust. - diff --git a/src/closure.rs b/src/closure.rs index a498d6d2513..319f4c63c24 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -559,7 +559,7 @@ pub trait IntoWasmClosure { macro_rules! doit { ($( - ($($var:ident)*) + ($($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*) )*) => ($( unsafe impl<$($var,)* R> WasmClosure for dyn Fn($($var),*) -> R + 'static where $($var: FromWasmAbi + 'static,)* @@ -570,8 +570,13 @@ macro_rules! doit { unsafe extern "C" fn invoke<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, - $($var: <$var as FromWasmAbi>::Abi),* - ) -> ::Abi { + $( + $arg1: <$var::Abi as WasmAbi>::Prim1, + $arg2: <$var::Abi as WasmAbi>::Prim2, + $arg3: <$var::Abi as WasmAbi>::Prim3, + $arg4: <$var::Abi as WasmAbi>::Prim4, + )* + ) -> WasmRet { if a == 0 { throw_str("closure invoked after being dropped"); } @@ -582,11 +587,11 @@ macro_rules! doit { let f: *const dyn Fn($($var),*) -> R = FatPtr { fields: (a, b) }.ptr; $( - let $var = <$var as FromWasmAbi>::from_abi($var); + let $var = <$var as FromWasmAbi>::from_abi($var::Abi::join($arg1, $arg2, $arg3, $arg4)); )* (*f)($($var),*) }; - ret.return_abi() + ret.return_abi().into() } inform(invoke::<$($var,)* R> as u32); @@ -622,8 +627,13 @@ macro_rules! doit { unsafe extern "C" fn invoke<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, - $($var: <$var as FromWasmAbi>::Abi),* - ) -> ::Abi { + $( + $arg1: <$var::Abi as WasmAbi>::Prim1, + $arg2: <$var::Abi as WasmAbi>::Prim2, + $arg3: <$var::Abi as WasmAbi>::Prim3, + $arg4: <$var::Abi as WasmAbi>::Prim4, + )* + ) -> WasmRet { if a == 0 { throw_str("closure invoked recursively or after being dropped"); } @@ -635,11 +645,11 @@ macro_rules! doit { FatPtr { fields: (a, b) }.ptr; let f = f as *mut dyn FnMut($($var),*) -> R; $( - let $var = <$var as FromWasmAbi>::from_abi($var); + let $var = <$var as FromWasmAbi>::from_abi($var::Abi::join($arg1, $arg2, $arg3, $arg4)); )* (*f)($($var),*) }; - ret.return_abi() + ret.return_abi().into() } inform(invoke::<$($var,)* R> as u32); @@ -732,14 +742,14 @@ macro_rules! doit { doit! { () - (A) - (A B) - (A B C) - (A B C D) - (A B C D E) - (A B C D E F) - (A B C D E F G) - (A B C D E F G H) + (A a1 a2 a3 a4) + (A a1 a2 a3 a4 B b1 b2 b3 b4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4 G g1 g2 g3 g4) + (A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4 G g1 g2 g3 g4 H h1 h2 h3 h4) } // Copy the above impls down here for where there's only one argument and it's a @@ -758,8 +768,11 @@ where unsafe extern "C" fn invoke( a: usize, b: usize, - arg: ::Abi, - ) -> ::Abi { + arg1: ::Prim1, + arg2: ::Prim2, + arg3: ::Prim3, + arg4: ::Prim4, + ) -> WasmRet { if a == 0 { throw_str("closure invoked after being dropped"); } @@ -768,10 +781,10 @@ where // example) let ret = { let f: *const dyn Fn(&A) -> R = FatPtr { fields: (a, b) }.ptr; - let arg = ::ref_from_abi(arg); + let arg = ::ref_from_abi(A::Abi::join(arg1, arg2, arg3, arg4)); (*f)(&*arg) }; - ret.return_abi() + ret.return_abi().into() } inform(invoke:: as u32); @@ -801,8 +814,11 @@ where unsafe extern "C" fn invoke( a: usize, b: usize, - arg: ::Abi, - ) -> ::Abi { + arg1: ::Prim1, + arg2: ::Prim2, + arg3: ::Prim3, + arg4: ::Prim4, + ) -> WasmRet { if a == 0 { throw_str("closure invoked recursively or after being dropped"); } @@ -812,10 +828,10 @@ where let ret = { let f: *const dyn FnMut(&A) -> R = FatPtr { fields: (a, b) }.ptr; let f = f as *mut dyn FnMut(&A) -> R; - let arg = ::ref_from_abi(arg); + let arg = ::ref_from_abi(A::Abi::join(arg1, arg2, arg3, arg4)); (*f)(&*arg) }; - ret.return_abi() + ret.return_abi().into() } inform(invoke:: as u32); diff --git a/src/convert/closures.rs b/src/convert/closures.rs index 02527173d37..8227a6b622f 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -4,12 +4,12 @@ use core::mem; use crate::convert::slices::WasmSlice; use crate::convert::RefFromWasmAbi; -use crate::convert::{FromWasmAbi, IntoWasmAbi, ReturnWasmAbi}; +use crate::convert::{FromWasmAbi, IntoWasmAbi, ReturnWasmAbi, WasmAbi, WasmRet}; use crate::describe::{inform, WasmDescribe, FUNCTION}; use crate::throw_str; macro_rules! stack_closures { - ($( ($cnt:tt $invoke:ident $invoke_mut:ident $($var:ident)*) )*) => ($( + ($( ($cnt:tt $invoke:ident $invoke_mut:ident $($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*) )*) => ($( impl<'a, 'b, $($var,)* R> IntoWasmAbi for &'a (dyn Fn($($var),*) -> R + 'b) where $($var: FromWasmAbi,)* R: ReturnWasmAbi @@ -28,8 +28,13 @@ macro_rules! stack_closures { unsafe extern "C" fn $invoke<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, - $($var: <$var as FromWasmAbi>::Abi),* - ) -> ::Abi { + $( + $arg1: <$var::Abi as WasmAbi>::Prim1, + $arg2: <$var::Abi as WasmAbi>::Prim2, + $arg3: <$var::Abi as WasmAbi>::Prim3, + $arg4: <$var::Abi as WasmAbi>::Prim4, + )* + ) -> WasmRet { if a == 0 { throw_str("closure invoked after being dropped"); } @@ -38,11 +43,11 @@ macro_rules! stack_closures { let ret = { let f: &dyn Fn($($var),*) -> R = mem::transmute((a, b)); $( - let $var = <$var as FromWasmAbi>::from_abi($var); + let $var = <$var as FromWasmAbi>::from_abi($var::Abi::join($arg1, $arg2, $arg3, $arg4)); )* f($($var),*) }; - ret.return_abi() + ret.return_abi().into() } impl<'a, $($var,)* R> WasmDescribe for dyn Fn($($var),*) -> R + 'a @@ -77,8 +82,13 @@ macro_rules! stack_closures { unsafe extern "C" fn $invoke_mut<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, - $($var: <$var as FromWasmAbi>::Abi),* - ) -> ::Abi { + $( + $arg1: <$var::Abi as WasmAbi>::Prim1, + $arg2: <$var::Abi as WasmAbi>::Prim2, + $arg3: <$var::Abi as WasmAbi>::Prim3, + $arg4: <$var::Abi as WasmAbi>::Prim4, + )* + ) -> WasmRet { if a == 0 { throw_str("closure invoked recursively or after being dropped"); } @@ -87,11 +97,11 @@ macro_rules! stack_closures { let ret = { let f: &mut dyn FnMut($($var),*) -> R = mem::transmute((a, b)); $( - let $var = <$var as FromWasmAbi>::from_abi($var); + let $var = <$var as FromWasmAbi>::from_abi($var::Abi::join($arg1, $arg2, $arg3, $arg4)); )* f($($var),*) }; - ret.return_abi() + ret.return_abi().into() } impl<'a, $($var,)* R> WasmDescribe for dyn FnMut($($var),*) -> R + 'a @@ -112,14 +122,14 @@ macro_rules! stack_closures { stack_closures! { (0 invoke0 invoke0_mut) - (1 invoke1 invoke1_mut A) - (2 invoke2 invoke2_mut A B) - (3 invoke3 invoke3_mut A B C) - (4 invoke4 invoke4_mut A B C D) - (5 invoke5 invoke5_mut A B C D E) - (6 invoke6 invoke6_mut A B C D E F) - (7 invoke7 invoke7_mut A B C D E F G) - (8 invoke8 invoke8_mut A B C D E F G H) + (1 invoke1 invoke1_mut A a1 a2 a3 a4) + (2 invoke2 invoke2_mut A a1 a2 a3 a4 B b1 b2 b3 b4) + (3 invoke3 invoke3_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4) + (4 invoke4 invoke4_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4) + (5 invoke5 invoke5_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4) + (6 invoke6 invoke6_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4) + (7 invoke7 invoke7_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4 G g1 g2 g3 g4) + (8 invoke8 invoke8_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4 G g1 g2 g3 g4 H h1 h2 h3 h4) } impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(&A) -> R + 'b) @@ -144,8 +154,11 @@ where unsafe extern "C" fn invoke1_ref( a: usize, b: usize, - arg: ::Abi, -) -> ::Abi { + arg1: ::Prim1, + arg2: ::Prim2, + arg3: ::Prim3, + arg4: ::Prim4, +) -> WasmRet { if a == 0 { throw_str("closure invoked after being dropped"); } @@ -153,10 +166,10 @@ unsafe extern "C" fn invoke1_ref( // ensure they're all destroyed as `return_abi` may throw let ret = { let f: &dyn Fn(&A) -> R = mem::transmute((a, b)); - let arg = ::ref_from_abi(arg); + let arg = ::ref_from_abi(A::Abi::join(arg1, arg2, arg3, arg4)); f(&*arg) }; - ret.return_abi() + ret.return_abi().into() } impl<'a, A, R> WasmDescribe for dyn Fn(&A) -> R + 'a @@ -196,8 +209,11 @@ where unsafe extern "C" fn invoke1_mut_ref( a: usize, b: usize, - arg: ::Abi, -) -> ::Abi { + arg1: ::Prim1, + arg2: ::Prim2, + arg3: ::Prim3, + arg4: ::Prim4, +) -> WasmRet { if a == 0 { throw_str("closure invoked recursively or after being dropped"); } @@ -205,10 +221,10 @@ unsafe extern "C" fn invoke1_mut_ref( // ensure they're all destroyed as `return_abi` may throw let ret = { let f: &mut dyn FnMut(&A) -> R = mem::transmute((a, b)); - let arg = ::ref_from_abi(arg); + let arg = ::ref_from_abi(A::Abi::join(arg1, arg2, arg3, arg4)); f(&*arg) }; - ret.return_abi() + ret.return_abi().into() } impl<'a, A, R> WasmDescribe for dyn FnMut(&A) -> R + 'a diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 637d9d979ad..8c0c3c014bb 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -1,7 +1,7 @@ use core::char; use core::mem::{self, ManuallyDrop}; -use crate::convert::traits::WasmAbi; +use crate::convert::traits::{WasmAbi, WasmPrimitive}; use crate::convert::{FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi}; use crate::convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi}; use crate::{Clamped, JsError, JsValue, UnwrapThrowExt}; @@ -13,28 +13,53 @@ if_std! { use std::vec::Vec; } -unsafe impl WasmAbi for () {} +// Primitive types can always be passed over the ABI. +impl WasmAbi for T { + type Prim1 = Self; + type Prim2 = (); + type Prim3 = (); + type Prim4 = (); -#[repr(C, u32)] -pub enum WasmOption { - None, - Some(T), + #[inline] + fn split(self) -> (Self, (), (), ()) { + (self, (), (), ()) + } + + #[inline] + fn join(prim: Self, _: (), _: (), _: ()) -> Self { + prim + } } -unsafe impl WasmAbi for WasmOption {} +impl> WasmAbi for Option { + /// Whether this `Option` is a `Some` value. + type Prim1 = u32; + type Prim2 = T::Prim1; + type Prim3 = T::Prim2; + type Prim4 = T::Prim3; -impl WasmOption { - pub fn from_option>(option: Option) -> Self { - match option { - Some(v) => WasmOption::Some(v.into_abi()), - None => WasmOption::None, + #[inline] + fn split(self) -> (u32, T::Prim1, T::Prim2, T::Prim3) { + match self { + None => ( + 0, + Default::default(), + Default::default(), + Default::default(), + ), + Some(value) => { + let (prim1, prim2, prim3, ()) = value.split(); + (1, prim1, prim2, prim3) + } } } - pub unsafe fn into_option>(v: Self) -> Option { - match v { - WasmOption::Some(v) => Some(T::from_abi(v)), - WasmOption::None => None, + #[inline] + fn join(is_some: u32, prim1: T::Prim1, prim2: T::Prim2, prim3: T::Prim3) -> Self { + if is_some == 0 { + None + } else { + Some(T::join(prim1, prim2, prim3, ())) } } } @@ -56,20 +81,20 @@ macro_rules! type_wasm_native { } impl IntoWasmAbi for Option<$t> { - type Abi = WasmOption<$c>; + type Abi = Option<$c>; #[inline] fn into_abi(self) -> Self::Abi { - WasmOption::from_option(self.map(|v| v as $c)) + self.map(|v| v as $c) } } impl FromWasmAbi for Option<$t> { - type Abi = WasmOption<$c>; + type Abi = Option<$c>; #[inline] unsafe fn from_abi(js: Self::Abi) -> Self { - WasmOption::into_option(js).map(|v: $c| v as $t) + js.map(|v: $c| v as $t) } } )*) @@ -317,70 +342,53 @@ impl IntoWasmAbi for () { } } -/// This is an encoding of a Result. It can only store things that can be decoded by the JS -/// bindings. -/// -/// At the moment, we do not write the exact struct packing layout of everything into the -/// glue/descriptions of datatypes, so T cannot be arbitrary. The current requirements of the -/// struct unpacker (StructUnpacker), which apply to ResultAbi as a whole, are as follows: -/// -/// - repr(C), of course -/// - u32/i32/f32/f64 fields at the "leaf fields" of the "field tree" -/// - layout equivalent to a completely flattened repr(C) struct, constructed by an in order -/// traversal of all the leaf fields in it. -/// -/// This means that you can't embed struct A(u32, f64) as struct B(u32, A); because the "completely -/// flattened" struct AB(u32, u32, f64) would miss the 4 byte padding that is actually present -/// within B and then as a consequence also miss the 4 byte padding within A that repr(C) inserts. -/// -/// The enemy is padding. Padding is only required when there is an `f64` field. So the enemy is -/// `f64` after anything else, particularly anything arbitrary. There is no smaller sized type, so -/// we don't need to worry about 1-byte integers, etc. It's best, therefore, to place your f64s -/// first in your structs, that's why we have `abi` first, although here it doesn't matter as the -/// other two fields total 8 bytes anyway. -/// -#[repr(C)] -pub struct ResultAbi { - /// This field is the same size/align as `T`. - abi: ResultAbiUnion, - /// Order of args here is such that we can pop() the possible error first, deal with it and - /// move on. Later fields are popped off the stack first. - err: u32, - is_err: u32, -} +impl> WasmAbi for Result { + type Prim1 = T::Prim1; + type Prim2 = T::Prim2; + // The order of primitives here is such that we can pop() the possible error + // first, deal with it and move on. Later primitives are popped off the + // stack first. + /// If this `Result` is an `Err`, the error value. + type Prim3 = u32; + /// Whether this `Result` is an `Err`. + type Prim4 = u32; -#[repr(C)] -pub union ResultAbiUnion { - // ManuallyDrop is #[repr(transparent)] - ok: std::mem::ManuallyDrop, - err: (), + #[inline] + fn split(self) -> (T::Prim1, T::Prim2, u32, u32) { + match self { + Ok(value) => { + let (prim1, prim2, (), ()) = value.split(); + (prim1, prim2, 0, 0) + } + Err(err) => (Default::default(), Default::default(), err, 1), + } + } + + #[inline] + fn join(prim1: T::Prim1, prim2: T::Prim2, err: u32, is_err: u32) -> Self { + if is_err == 0 { + Ok(T::join(prim1, prim2, (), ())) + } else { + Err(err) + } + } } -unsafe impl WasmAbi for ResultAbi {} -unsafe impl WasmAbi for ResultAbiUnion {} +impl ReturnWasmAbi for Result +where + T: IntoWasmAbi, + E: Into, + T::Abi: WasmAbi, +{ + type Abi = Result; -impl> ReturnWasmAbi for Result { - type Abi = ResultAbi; #[inline] fn return_abi(self) -> Self::Abi { match self { - Ok(v) => { - let abi = ResultAbiUnion { - ok: std::mem::ManuallyDrop::new(v.into_abi()), - }; - ResultAbi { - abi, - is_err: 0, - err: 0, - } - } + Ok(v) => Ok(v.into_abi()), Err(e) => { let jsval = e.into(); - ResultAbi { - abi: ResultAbiUnion { err: () }, - is_err: 1, - err: jsval.into_abi(), - } + Err(jsval.into_abi()) } } } diff --git a/src/convert/slices.rs b/src/convert/slices.rs index b356df5eb27..b051e3814a0 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -20,13 +20,33 @@ if_std! { use crate::convert::{js_value_vector_from_abi, js_value_vector_into_abi}; } +// note: `WasmAbi` types do not need to be FFI-safe themselves, it's just more +// convenient to directly write `WasmSlice` in some of the manually-written FFI +// functions in `lib.rs` rather than `WasmRet`. #[repr(C)] pub struct WasmSlice { pub ptr: u32, pub len: u32, } -unsafe impl WasmAbi for WasmSlice {} +impl WasmAbi for WasmSlice { + /// `self.ptr` + type Prim1 = u32; + /// `self.len` + type Prim2 = u32; + type Prim3 = (); + type Prim4 = (); + + #[inline] + fn split(self) -> (u32, u32, (), ()) { + (self.ptr, self.len, (), ()) + } + + #[inline] + fn join(ptr: u32, len: u32, _: (), _: ()) -> Self { + Self { ptr, len } + } +} #[inline] fn null_slice() -> WasmSlice { @@ -34,13 +54,33 @@ fn null_slice() -> WasmSlice { } if_std! { - #[repr(C)] pub struct WasmMutSlice { pub slice: WasmSlice, pub idx: u32, } - unsafe impl WasmAbi for WasmMutSlice {} + impl WasmAbi for WasmMutSlice { + /// `self.slice.ptr` + type Prim1 = u32; + /// `self.slice.len` + type Prim2 = u32; + /// `self.idx` + type Prim3 = u32; + type Prim4 = (); + + #[inline] + fn split(self) -> (u32, u32, u32, ()) { + (self.slice.ptr, self.slice.len, self.idx, ()) + } + + #[inline] + fn join(ptr: u32, len: u32, idx: u32, _: ()) -> Self { + Self { + slice: WasmSlice { ptr, len }, + idx, + } + } + } /// The representation of a mutable slice passed from JS to Rust. pub struct MutSlice { diff --git a/src/convert/traits.rs b/src/convert/traits.rs index dc74caae15a..fd06c3adba3 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -117,22 +117,54 @@ pub trait OptionFromWasmAbi: FromWasmAbi { fn is_none(abi: &Self::Abi) -> bool; } -/// An unsafe trait which represents types that are ABI-safe to pass via wasm -/// arguments. +/// A trait for any type which maps to a Wasm primitive type when used in FFI +/// (`i32`, `i64`, `f32`, or `f64`). +/// +/// This is with the exception of `()` (and other zero-sized types), which are +/// also allowed because they're ignored: no arguments actually get added. /// /// # Safety /// -/// This is an unsafe trait to implement as there's no guarantee the type is -/// actually safe to transfer across the was boundary, it's up to you to -/// guarantee this, so codegen works correctly. -pub unsafe trait WasmAbi {} - -unsafe impl WasmAbi for u32 {} -unsafe impl WasmAbi for i32 {} -unsafe impl WasmAbi for u64 {} -unsafe impl WasmAbi for i64 {} -unsafe impl WasmAbi for f32 {} -unsafe impl WasmAbi for f64 {} +/// This is an unsafe trait to implement as there's no guarantee the type +/// actually maps to a primitive type. +pub unsafe trait WasmPrimitive: Default {} + +unsafe impl WasmPrimitive for u32 {} +unsafe impl WasmPrimitive for i32 {} +unsafe impl WasmPrimitive for u64 {} +unsafe impl WasmPrimitive for i64 {} +unsafe impl WasmPrimitive for f32 {} +unsafe impl WasmPrimitive for f64 {} +unsafe impl WasmPrimitive for () {} + +/// A trait which represents types that can be passed across the Wasm ABI +/// boundary, by being split into multiple Wasm primitive types. +/// +/// Up to 4 primitives are supported; if you don't want to use all of them, you +/// can set the rest to `()`, which will cause them to be ignored. +/// +/// You need to be careful how many primitives you use, however: +/// `Result` uses up 2 primitives to store the error, and so it +/// doesn't work if `T` uses more than 2 primitives. +/// +/// So, if you're adding support for a type that needs 3 or more primitives and +/// is able to be returned, you have to add another primitive here. +/// +/// There's already one type that uses 3 primitives: `&mut [T]`. However, it +/// can't be returned anyway, so it doesn't matter that +/// `Result<&mut [T], JsValue>` wouldn't work. +pub trait WasmAbi { + type Prim1: WasmPrimitive; + type Prim2: WasmPrimitive; + type Prim3: WasmPrimitive; + type Prim4: WasmPrimitive; + + /// Splits this type up into primitives to be sent over the ABI. + fn split(self) -> (Self::Prim1, Self::Prim2, Self::Prim3, Self::Prim4); + /// Reconstructs this type from primitives received over the ABI. + fn join(prim1: Self::Prim1, prim2: Self::Prim2, prim3: Self::Prim3, prim4: Self::Prim4) + -> Self; +} /// A trait representing how to interpret the return value of a function for /// the wasm ABI. @@ -179,3 +211,41 @@ if_std! { unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>; } } + +/// A repr(C) struct containing all of the primitives of a `WasmAbi` type, in +/// order. +/// +/// This is used as the return type of imported/exported functions. `WasmAbi` +/// types aren't guaranteed to be FFI-safe, so we can't return them directly: +/// instead we return this. +/// +/// If all but one of the primitives is `()`, this corresponds to returning the +/// remaining primitive directly, otherwise a return pointer is used. +#[repr(C)] +pub struct WasmRet { + prim1: T::Prim1, + prim2: T::Prim2, + prim3: T::Prim3, + prim4: T::Prim4, +} + +impl From for WasmRet { + fn from(value: T) -> Self { + let (prim1, prim2, prim3, prim4) = value.split(); + Self { + prim1, + prim2, + prim3, + prim4, + } + } +} + +// Ideally this'd just be an `Into` implementation, but unfortunately that +// doesn't work because of the orphan rule. +impl WasmRet { + /// Joins the components of this `WasmRet` back into the type they represent. + pub fn join(self) -> T { + T::join(self.prim1, self.prim2, self.prim3, self.prim4) + } +} diff --git a/src/lib.rs b/src/lib.rs index 44844f63b8b..f188e023ddf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ use core::ops::{ }; use core::u32; -use crate::convert::{FromWasmAbi, WasmSlice}; +use crate::convert::{FromWasmAbi, WasmRet, WasmSlice}; macro_rules! if_std { ($($i:item)*) => ($( @@ -71,7 +71,6 @@ pub mod describe; mod cast; pub use crate::cast::{JsCast, JsObject}; -use convert::WasmOption; if_std! { extern crate std; @@ -265,7 +264,7 @@ impl JsValue { /// `None`. #[inline] pub fn as_f64(&self) -> Option { - unsafe { FromWasmAbi::from_abi(__wbindgen_number_get(self.idx)) } + unsafe { __wbindgen_number_get(self.idx).join() } } /// Tests whether this JS value is a JS string. @@ -910,7 +909,7 @@ macro_rules! big_numbers { } fn bigint_get_as_i64(v: &JsValue) -> Option { - unsafe { Option::from_abi(__wbindgen_bigint_get_as_i64(v.idx)) } + unsafe { __wbindgen_bigint_get_as_i64(v.idx).join() } } macro_rules! try_from_for_num64 { @@ -1057,10 +1056,10 @@ externs! { fn __wbindgen_ge(a: u32, b: u32) -> u32; fn __wbindgen_gt(a: u32, b: u32) -> u32; - fn __wbindgen_number_get(idx: u32) -> WasmOption; + fn __wbindgen_number_get(idx: u32) -> WasmRet>; fn __wbindgen_boolean_get(idx: u32) -> u32; fn __wbindgen_string_get(idx: u32) -> WasmSlice; - fn __wbindgen_bigint_get_as_i64(idx: u32) -> WasmOption; + fn __wbindgen_bigint_get_as_i64(idx: u32) -> WasmRet>; fn __wbindgen_debug_string(ret: *mut [usize; 2], idx: u32) -> (); From e7c760fb3c08b3ada2838efa14d87e4b1d5f3a5f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 13 Sep 2023 10:34:53 +0200 Subject: [PATCH 274/641] Fix `wasm_bindgen_futures` not using custom path (#3602) --- CHANGELOG.md | 11 +++++++++-- crates/backend/src/codegen.rs | 8 ++++---- crates/futures/src/lib.rs | 3 +++ crates/macro/ui-tests/async-errors.stderr | 8 ++++---- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cce1b9d2852..9f3b664e66a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,13 @@ * Add bindings for `WebAssembly.Tag` and `WebAssembly.Exception`. [#3484](https://github.com/rustwasm/wasm-bindgen/pull/3484) -* Re-export `wasm-bindgen` from `js-sys` and `web-sys`. +* Re-export `wasm-bindgen` from `js-sys`, `web-sys` and `wasm-bindgen-futures`. [#3466](https://github.com/rustwasm/wasm-bindgen/pull/3466) + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) -* Re-export `js-sys` from `web-sys`. +* Re-export `js-sys` from `web-sys` and `wasm-bindgen-futures`. [#3466](https://github.com/rustwasm/wasm-bindgen/pull/3466) + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) * Add bindings for async variants of `Atomics.wait`. [#3504](https://github.com/rustwasm/wasm-bindgen/pull/3504) @@ -110,6 +112,11 @@ * Fixed optional parameters in JSDoc. [#3577](https://github.com/rustwasm/wasm-bindgen/pull/3577) +* Use re-exported `js-sys` from `wasm-bindgen-futures` to account for + non-default path specified by the `crate` attribute in `wasm_bindgen_futures` + proc-macro. + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) + ### Removed * Removed `ReadableStreamByobReader::read_with_u8_array()` because it doesn't work with Wasm. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 4e3d6ca8d9a..e45d4e50ba1 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1190,11 +1190,11 @@ impl TryToTokens for ast::ImportFunction { Some(ref ty) => { if self.function.r#async { abi_ret = quote! { - #wasm_bindgen::convert::WasmRet<::Abi> + #wasm_bindgen::convert::WasmRet<<#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - + <#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ret_ident.join()) ).await }; @@ -1216,11 +1216,11 @@ impl TryToTokens for ast::ImportFunction { None => { if self.function.r#async { abi_ret = quote! { - #wasm_bindgen::convert::WasmRet<::Abi> + #wasm_bindgen::convert::WasmRet<<#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - + <#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ret_ident.join()) ).await }; diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index c2a59d76286..8a02a51bc39 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -46,6 +46,9 @@ mod queue; #[cfg(feature = "futures-core-03-stream")] pub mod stream; +pub use js_sys; +pub use wasm_bindgen; + mod task { use cfg_if::cfg_if; diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index 188192c5d87..a128c73c090 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -32,10 +32,10 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not sati > > > - > - > - >> - and 74 others + > + > + > + and $N others = note: required for `BadType` to implement `Into` = note: required for `BadType` to implement `IntoJsResult` = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) From 26e83779c8f9af98e8ec6e737bbcff696291541a Mon Sep 17 00:00:00 2001 From: Cormac Relf Date: Fri, 15 Sep 2023 00:16:47 +1000 Subject: [PATCH 275/641] add .sha256 checksums to binary distribution tarballs (#3605) --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9746c2b162..eafcc99c43e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -486,6 +486,7 @@ jobs: tmp/$name/ chmod +x tmp/$name/wasm* tar czvf gh-release/$name.tar.gz -C tmp $name + sha256sum gh-release/$name.tar.gz > gh-release/$name.tar.gz.sha256sum } mk x86_64-unknown-linux-musl dist_linux_x86_64_musl mk aarch64-unknown-linux-gnu dist_linux_aarch64_gnu @@ -517,4 +518,4 @@ jobs: - uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: "gh-release/*.tar.gz" + files: "gh-release/*.tar.gz*" From 8d063a49082f98a6e0bfaaa19b649c58a54b8468 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Fri, 15 Sep 2023 12:50:01 +1000 Subject: [PATCH 276/641] Fix example tests (#3614) * Fix example tests I went to enable testing for the `synchronous-instantiation` example now that Firefox supports module workers, but then found that the `wasm-audio-worklet` example was failing because the test server doesn't set the headers needed to enable `SharedArrayBuffer`. It turns out that CI wasn't failing because it's been broken this whole whole time: it specifies the path to the built examples as simply `exbuild`, which doesn't work because the tests are run with their working directory set to `crates/example-tests`, not the root of the repo. This means that any requests that the examples try to make will 404. So this PR specifies it as an absolute path instead. At the moment, Firefox doesn't directly indicate any kind of error when navigation fails, which meant that the tests would just silently fail without actually testing anything. According to the spec, `browsingContext.navigate` is supposed to wait for the navigation to complete, and result in an error if something goes wrong; but I think Firefox is behind, because it seems to instead immediately return. To work around this, I've made it so that the tests manually wait for the `network.responseCompleted` event to check if fetching the page suceeded, and so this shouldn't happen again. I've left the actual fix for the `wasm-audio-worklet` example commented out to make sure that CI actually catches the issue now; that's why this PR is a draft. * properly interpolate repo root * use correct variable It looks like `env` is specifically for variables that you set manually, not arbitrary environment variables. * Fix wasm_audio_worklet * tweak doc comment --- .github/workflows/main.yml | 2 +- crates/example-tests/Cargo.toml | 11 +- crates/example-tests/src/lib.rs | 206 ++++++++++++++++++---------- crates/example-tests/tests/shell.rs | 1 - 4 files changed, 142 insertions(+), 78 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eafcc99c43e..b4078fe6d75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -323,7 +323,7 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: cargo test -p example-tests env: - EXBUILD: exbuild + EXBUILD: ${{ github.workspace }}/exbuild build_benchmarks: runs-on: ubuntu-latest diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index b7df800fb60..ff75a3b65f1 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -6,14 +6,15 @@ edition = "2018" rust-version = "1.56" [dependencies] -anyhow = "1.0.58" -futures-util = { version = "0.3.21", features = ["sink"] } -hyper = { version = "0.14.20", features = ["server", "tcp", "http1"] } +anyhow = "1.0.75" +futures-util = { version = "0.3.28", features = ["sink"] } +http = "0.2.9" +hyper = { version = "0.14.27", features = ["server", "tcp", "http1"] } mozprofile = "0.8.0" mozrunner = "0.14.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -tokio = { version = "1.20.0", features = ["macros", "time"] } +tokio = { version = "1.29.1", features = ["macros", "time"] } tokio-tungstenite = "0.17.2" tower = { version = "0.4.13", features = ["make"] } -tower-http = { version = "0.3.4", features = ["fs"] } +tower-http = { version = "0.3.5", features = ["fs", "util", "set-header"] } diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 9dbbf05a96c..b064858c0db 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -8,6 +8,7 @@ use std::{env, str}; use anyhow::{bail, Context}; use futures_util::{future, SinkExt, StreamExt}; +use http::{HeaderName, HeaderValue}; use mozprofile::profile::Profile; use mozrunner::firefox_default_path; use mozrunner::runner::{FirefoxProcess, FirefoxRunner, Runner, RunnerProcess}; @@ -20,7 +21,9 @@ use tokio::time::timeout; use tokio_tungstenite::tungstenite::{self, Message}; use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; use tower::make::Shared; +use tower::ServiceBuilder; use tower_http::services::ServeDir; +use tower_http::ServiceBuilderExt; /// A command sent from the client to the server. #[derive(Serialize)] @@ -241,6 +244,73 @@ impl WebDriver { } } +/// Handles a `log.entryAdded` event with the given parameters, and returns an +/// error if the log entry is an error (or something else goes wrong). +fn handle_log_event(params: Value) -> anyhow::Result<()> { + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct LogEntry { + level: LogLevel, + text: Option, + stack_trace: Option, + } + + #[derive(Deserialize, Debug, PartialEq, Eq, Clone, Copy)] + #[serde(rename_all = "lowercase")] + enum LogLevel { + Debug, + Info, + Warn, + Error, + } + + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct StackTrace { + call_frames: Vec, + } + + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct StackFrame { + column_number: i64, + function_name: String, + line_number: i64, + url: String, + } + + impl Display for StackFrame { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!( + f, + "{} (at {}:{}:{})", + self.function_name, self.url, self.line_number, self.column_number + ) + } + } + + let entry: LogEntry = serde_json::from_value(params).context("invalid log entry received")?; + + if entry.level == LogLevel::Error { + if let Some(text) = entry.text { + let mut msg = format!("An error occurred: {text}"); + + if let Some(stack_trace) = entry.stack_trace { + write!(msg, "\n\nStack trace:").unwrap(); + for frame in stack_trace.call_frames { + write!(msg, "\n{frame}").unwrap(); + } + } + + bail!("{msg}") + } else { + bail!("An error occurred") + } + } + + Ok(()) +} + /// Run a single example with the passed name, using the passed closure to /// build it if prebuilt examples weren't provided. pub async fn test_example( @@ -256,8 +326,18 @@ pub async fn test_example( let mut driver = WebDriver::new().await?; // Serve the path. - let server = hyper::Server::try_bind(&"127.0.0.1:0".parse().unwrap())? - .serve(Shared::new(ServeDir::new(path))); + let service = ServiceBuilder::new() + .override_response_header( + HeaderName::from_static("cross-origin-opener-policy"), + HeaderValue::from_static("same-origin"), + ) + .override_response_header( + HeaderName::from_static("cross-origin-embedder-policy"), + HeaderValue::from_static("require-corp"), + ) + .service(ServeDir::new(path)); + let server = + hyper::Server::try_bind(&"127.0.0.1:0".parse().unwrap())?.serve(Shared::new(service)); let addr = server.local_addr(); @@ -281,13 +361,18 @@ pub async fn test_example( .issue_cmd( "session.subscribe", json!({ - "events": ["log.entryAdded"], + "events": ["log.entryAdded", "network.responseCompleted"], "contexts": [&context], }), ) .await?; - let _: Value = driver + #[derive(Deserialize)] + struct BrowsingContextNavigateResult { + navigation: Option, + } + + let BrowsingContextNavigateResult { navigation } = driver .issue_cmd( "browsingContext.navigate", json!({ @@ -296,6 +381,51 @@ pub async fn test_example( }), ) .await?; + // Apparently this being null means that 'the navigation [was] canceled before + // making progress'. + // source: https://w3c.github.io/webdriver-bidi/#module-browsingContext + let navigation = navigation.context("navigation canceled")?; + + // Wait for the page to be fetched, so that we can check whether it succeeds. + // Note: I'm pretty sure that `browsingContext.navigate` is supposed to report + // an error anyway if this fails, but Firefox seems to be behind the spec here. + loop { + let event = driver + .next_event() + .await + .context("websocket unexpectedly closed")?; + match event.method.as_str() { + "log.entryAdded" => handle_log_event(event.params)?, + "network.responseCompleted" => { + #[derive(Deserialize)] + struct NetworkReponseCompletedParameters { + navigation: Option, + response: NetworkResponseData, + } + + #[derive(Deserialize)] + #[serde(rename_all = "camelCase")] + struct NetworkResponseData { + status: u64, + status_text: String, + } + + let params: NetworkReponseCompletedParameters = + serde_json::from_value(event.params)?; + if params.navigation.as_ref() == Some(&navigation) { + if !(200..300).contains(¶ms.response.status) { + bail!( + "fetching page failed ({} {})", + params.response.status, + params.response.status_text + ) + } + break; + } + } + _ => {} + } + } let start = Instant::now(); // Wait 5 seconds for any errors to occur. @@ -305,73 +435,7 @@ pub async fn test_example( Ok(event) => { let event = event?; if event.method == "log.entryAdded" { - #[derive(Deserialize)] - #[serde(rename_all = "camelCase")] - struct LogEntry { - level: LogLevel, - // source: Source, - text: Option, - // timestamp: i64, - stack_trace: Option, - // kind: LogEntryKind, - } - - #[derive(Deserialize, Debug, PartialEq, Eq, Clone, Copy)] - #[serde(rename_all = "lowercase")] - enum LogLevel { - Debug, - Info, - Warning, - Error, - } - - #[derive(Deserialize)] - #[serde(rename_all = "camelCase")] - struct StackTrace { - call_frames: Vec, - } - - #[derive(Deserialize)] - #[serde(rename_all = "camelCase")] - struct StackFrame { - column_number: i64, - function_name: String, - line_number: i64, - url: String, - } - - impl Display for StackFrame { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!( - f, - "{} (at {}:{}:{})", - self.function_name, - self.url, - self.line_number, - self.column_number - ) - } - } - - let entry: LogEntry = serde_json::from_value(event.params) - .context("invalid log entry received")?; - - if entry.level == LogLevel::Error { - if let Some(text) = entry.text { - let mut msg = format!("An error occurred: {text}"); - - if let Some(stack_trace) = entry.stack_trace { - write!(msg, "\n\nStack trace:").unwrap(); - for frame in stack_trace.call_frames { - write!(msg, "\n{frame}").unwrap(); - } - } - - bail!("{msg}") - } else { - bail!("An error occurred") - } - } + handle_log_event(event.params)?; } } Err(_) => break, diff --git a/crates/example-tests/tests/shell.rs b/crates/example-tests/tests/shell.rs index bec7b8c7a39..19af0db4fec 100644 --- a/crates/example-tests/tests/shell.rs +++ b/crates/example-tests/tests/shell.rs @@ -36,7 +36,6 @@ macro_rules! shell_tests { shell_tests! { #["RUSTUP_TOOLCHAIN" = "nightly"] raytrace_parallel = "raytrace-parallel", - #[ignore = "This requires module workers, which Firefox doesn't support yet."] synchronous_instantiation = "synchronous-instantiation", wasm2js = "wasm2js", #["RUSTUP_TOOLCHAIN" = "nightly"] From d41202a62a43c8af1d5b18d748ae2dba2ac215a1 Mon Sep 17 00:00:00 2001 From: flumm Date: Fri, 15 Sep 2023 16:33:15 +0200 Subject: [PATCH 277/641] `wasm-bindgen-futures`: use `queueMicrotask` for next tick runs (#3203) (#3611) --- CHANGELOG.md | 6 ++++++ crates/futures/src/queue.rs | 29 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3b664e66a..9201b1fa8b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,12 @@ `#[repr(C)]` types. [#3595](https://github.com/rustwasm/wasm-bindgen/pull/3595) +* Use `queueMicrotask` in `wasm-bindgen-futures` for scheduling tasks on the next tick. + If that is not available, use the previous `Promise.then` mechanism as a fallback. + This should avoid quirks, like exceptions thrown get now properly reported + as normal exceptions rather than as rejected promises. + [#3611](https://github.com/rustwasm/wasm-bindgen/pull/3611) + ### Fixed * Fixed bindings and comments for `Atomics.wait`. diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index 9a78571cd84..2e17eb5ecf1 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -4,6 +4,17 @@ use std::collections::VecDeque; use std::rc::Rc; use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + fn queueMicrotask(closure: &Closure); + + type Global; + + #[wasm_bindgen(method, getter, js_name = queueMicrotask)] + fn hasQueueMicrotask(this: &Global) -> JsValue; +} + struct QueueState { // The queue of Tasks which are to be run in order. In practice this is all the // synchronous work of futures, and each `Task` represents calling `poll` on @@ -42,17 +53,21 @@ pub(crate) struct Queue { state: Rc, promise: Promise, closure: Closure, + has_queue_microtask: bool, } impl Queue { // Schedule a task to run on the next tick pub(crate) fn schedule_task(&self, task: Rc) { self.state.tasks.borrow_mut().push_back(task); - // Note that we currently use a promise and a closure to do this, but - // eventually we should probably use something like `queueMicrotask`: - // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask + // Use queueMicrotask to execute as soon as possible. If it does not exist + // fall back to the promise resolution if !self.state.is_scheduled.replace(true) { - let _ = self.promise.then(&self.closure); + if self.has_queue_microtask { + queueMicrotask(&self.closure); + } else { + let _ = self.promise.then(&self.closure); + } } } // Append a task to the currently running queue, or schedule it @@ -70,6 +85,11 @@ impl Queue { tasks: RefCell::new(VecDeque::new()), }); + let has_queue_microtask = js_sys::global() + .unchecked_into::() + .hasQueueMicrotask() + .is_function(); + Self { promise: Promise::resolve(&JsValue::undefined()), @@ -82,6 +102,7 @@ impl Queue { }, state, + has_queue_microtask, } } } From 373b7a57be3b8632499ce2198ea832fe216ef7fd Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 16 Sep 2023 01:56:11 -0400 Subject: [PATCH 278/641] Replace `filter_map().next()` with `find_map` (#3620) `rust-analyzer` emits a weak warning for this which leads to unnecessary noise in some editors. Signed-off-by: Oliver T --- crates/cli-support/src/externref.rs | 3 +-- crates/macro-support/src/parser.rs | 15 +++++---------- crates/threads-xform/src/lib.rs | 5 ++--- crates/wasm-interpreter/tests/smoke.rs | 3 +-- crates/webidl/src/util.rs | 3 +-- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index 2baa66286e9..51b0db14b72 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -136,7 +136,7 @@ fn find_call_export(instrs: &[InstructionData]) -> Option { instrs .iter() .enumerate() - .filter_map(|(i, instr)| match instr.instr { + .find_map(|(i, instr)| match instr.instr { Instruction::CallExport(e) => Some(Export::Export(e)), Instruction::CallTableElement(e) => Some(Export::TableElement { idx: e, @@ -144,7 +144,6 @@ fn find_call_export(instrs: &[InstructionData]) -> Option { }), _ => None, }) - .next() } enum Export { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 9765cddd74c..e65cc0509b5 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -143,14 +143,13 @@ macro_rules! methods { fn $name(&self) -> Option<(&str, Span)> { self.attrs .iter() - .filter_map(|a| match &a.1 { + .find_map(|a| match &a.1 { BindgenAttr::$variant(_, s, span) => { a.0.set(true); Some((&s[..], *span)) } _ => None, }) - .next() } }; @@ -158,14 +157,13 @@ macro_rules! methods { fn $name(&self) -> Option<(&[String], &[Span])> { self.attrs .iter() - .filter_map(|a| match &a.1 { + .find_map(|a| match &a.1 { BindgenAttr::$variant(_, ss, spans) => { a.0.set(true); Some((&ss[..], &spans[..])) } _ => None, }) - .next() } }; @@ -174,14 +172,13 @@ macro_rules! methods { fn $name(&self) -> Option<&$($other)*> { self.attrs .iter() - .filter_map(|a| match &a.1 { + .find_map(|a| match &a.1 { BindgenAttr::$variant(_, s) => { a.0.set(true); Some(s) } _ => None, }) - .next() } }; @@ -190,14 +187,13 @@ macro_rules! methods { fn $name(&self) -> Option<&$($other)*> { self.attrs .iter() - .filter_map(|a| match &a.1 { + .find_map(|a| match &a.1 { BindgenAttr::$variant(s) => { a.0.set(true); Some(s) } _ => None, }) - .next() } }; } @@ -1355,14 +1351,13 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { values.sort(); let hole = values .windows(2) - .filter_map(|window| { + .find_map(|window| { if window[0] + 1 != window[1] { Some(window[0] + 1) } else { None } }) - .next() .unwrap_or(*values.last().unwrap() + 1); for value in values { assert!(hole != value); diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 29e5aa35804..326d6a292b0 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -249,11 +249,10 @@ fn allocate_static_data( .exports .iter() .filter(|e| e.name == "__heap_base") - .filter_map(|e| match e.item { + .find_map(|e| match e.item { ExportItem::Global(id) => Some(id), _ => None, - }) - .next(); + }); let heap_base = match heap_base { Some(idx) => idx, None => bail!("failed to find `__heap_base` for injecting thread id"), diff --git a/crates/wasm-interpreter/tests/smoke.rs b/crates/wasm-interpreter/tests/smoke.rs index 611bf373e82..c14545c2ffa 100644 --- a/crates/wasm-interpreter/tests/smoke.rs +++ b/crates/wasm-interpreter/tests/smoke.rs @@ -12,11 +12,10 @@ fn interpret(wat: &str, name: &str, result: Option<&[u32]>) { .exports .iter() .filter(|e| e.name == name) - .filter_map(|e| match e.item { + .find_map(|e| match e.item { walrus::ExportItem::Function(f) => Some(f), _ => None, }) - .next() .unwrap(); assert_eq!(i.interpret_descriptor(id, &module), result); } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 04c07e3d991..db53f7f5846 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -602,11 +602,10 @@ pub fn get_rust_deprecated<'a>(ext_attrs: &Option>) -> _ => None, }) .filter(|attr| attr.lhs_identifier.0 == "RustDeprecated") - .filter_map(|ident| match ident.rhs { + .find_map(|ident| match ident.rhs { IdentifierOrString::String(s) => Some(s), IdentifierOrString::Identifier(_) => None, }) - .next() .map(|s| s.0) } From e617fca147466d4aa76e6c60f1fcd073addd14c2 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 17 Sep 2023 02:30:16 +0800 Subject: [PATCH 279/641] feat: add new web lock api interface (#3604) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 6 + crates/web-sys/src/features/gen_Lock.rs | 42 +++++++ crates/web-sys/src/features/gen_LockInfo.rs | 93 +++++++++++++++ .../web-sys/src/features/gen_LockManager.rs | 62 ++++++++++ .../src/features/gen_LockManagerSnapshot.rs | 75 ++++++++++++ crates/web-sys/src/features/gen_LockMode.rs | 16 +++ .../web-sys/src/features/gen_LockOptions.rs | 112 ++++++++++++++++++ crates/web-sys/src/features/gen_Navigator.rs | 12 ++ .../src/features/gen_WorkerNavigator.rs | 12 ++ crates/web-sys/src/features/mod.rs | 36 ++++++ .../webidls/unstable/weblock-apis.webidl | 45 +++++++ 12 files changed, 514 insertions(+) create mode 100644 crates/web-sys/src/features/gen_Lock.rs create mode 100644 crates/web-sys/src/features/gen_LockInfo.rs create mode 100644 crates/web-sys/src/features/gen_LockManager.rs create mode 100644 crates/web-sys/src/features/gen_LockManagerSnapshot.rs create mode 100644 crates/web-sys/src/features/gen_LockMode.rs create mode 100644 crates/web-sys/src/features/gen_LockOptions.rs create mode 100644 crates/web-sys/webidls/unstable/weblock-apis.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 9201b1fa8b5..02f0bcffcb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add bindings for the Web Locks API to `web-sys`. + [#3604](https://github.com/rustwasm/wasm-bindgen/pull/3604) + * Add bindings for `ViewTransition` to `web-sys`. [#3598](https://github.com/rustwasm/wasm-bindgen/pull/3598) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 576d1adb0b8..6b319f5e4e4 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -757,6 +757,12 @@ ListBoxObject = [] LocalMediaStream = ["EventTarget", "MediaStream"] LocaleInfo = [] Location = [] +Lock = [] +LockInfo = [] +LockManager = [] +LockManagerSnapshot = [] +LockMode = [] +LockOptions = [] MediaCapabilities = [] MediaCapabilitiesInfo = [] MediaConfiguration = [] diff --git a/crates/web-sys/src/features/gen_Lock.rs b/crates/web-sys/src/features/gen_Lock.rs new file mode 100644 index 00000000000..98b93739a91 --- /dev/null +++ b/crates/web-sys/src/features/gen_Lock.rs @@ -0,0 +1,42 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Lock , typescript_type = "Lock")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `Lock` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Lock)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Lock`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type Lock; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Lock" , js_name = name)] + #[doc = "Getter for the `name` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Lock/name)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Lock`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(this: &Lock) -> String; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + # [wasm_bindgen (structural , method , getter , js_class = "Lock" , js_name = mode)] + #[doc = "Getter for the `mode` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Lock/mode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Lock`, `LockMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(this: &Lock) -> LockMode; +} diff --git a/crates/web-sys/src/features/gen_LockInfo.rs b/crates/web-sys/src/features/gen_LockInfo.rs new file mode 100644 index 00000000000..d9ea0f7ec87 --- /dev/null +++ b/crates/web-sys/src/features/gen_LockInfo.rs @@ -0,0 +1,93 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = LockInfo)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `LockInfo` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type LockInfo; +} +#[cfg(web_sys_unstable_apis)] +impl LockInfo { + #[doc = "Construct a new `LockInfo`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clientId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn client_id(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("clientId"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`, `LockMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: LockMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for LockInfo { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_LockManager.rs b/crates/web-sys/src/features/gen_LockManager.rs new file mode 100644 index 00000000000..d1d52894863 --- /dev/null +++ b/crates/web-sys/src/features/gen_LockManager.rs @@ -0,0 +1,62 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = LockManager , typescript_type = "LockManager")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `LockManager` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/LockManager)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type LockManager; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "LockManager" , js_name = query)] + #[doc = "The `query()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/LockManager/query)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query(this: &LockManager) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "LockManager" , js_name = request)] + #[doc = "The `request()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_with_callback( + this: &LockManager, + name: &str, + callback: &::js_sys::Function, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockOptions")] + # [wasm_bindgen (method , structural , js_class = "LockManager" , js_name = request)] + #[doc = "The `request()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`, `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_with_options_and_callback( + this: &LockManager, + name: &str, + options: &LockOptions, + callback: &::js_sys::Function, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_LockManagerSnapshot.rs b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs new file mode 100644 index 00000000000..87d1eed1670 --- /dev/null +++ b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs @@ -0,0 +1,75 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = LockManagerSnapshot)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `LockManagerSnapshot` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type LockManagerSnapshot; +} +#[cfg(web_sys_unstable_apis)] +impl LockManagerSnapshot { + #[doc = "Construct a new `LockManagerSnapshot`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `held` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn held(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("held"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `pending` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn pending(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("pending"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for LockManagerSnapshot { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_LockMode.rs b/crates/web-sys/src/features/gen_LockMode.rs new file mode 100644 index 00000000000..18459e67ec1 --- /dev/null +++ b/crates/web-sys/src/features/gen_LockMode.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `LockMode` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `LockMode`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum LockMode { + Shared = "shared", + Exclusive = "exclusive", +} diff --git a/crates/web-sys/src/features/gen_LockOptions.rs b/crates/web-sys/src/features/gen_LockOptions.rs new file mode 100644 index 00000000000..27131f050d3 --- /dev/null +++ b/crates/web-sys/src/features/gen_LockOptions.rs @@ -0,0 +1,112 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = LockOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `LockOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type LockOptions; +} +#[cfg(web_sys_unstable_apis)] +impl LockOptions { + #[doc = "Construct a new `LockOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `ifAvailable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn if_available(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("ifAvailable"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockMode`, `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: LockMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `steal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn steal(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("steal"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for LockOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index dbd6fad8961..17197347dce 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -296,6 +296,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] pub fn languages(this: &Navigator) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockManager")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = locks)] + #[doc = "Getter for the `locks` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/locks)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`, `Navigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn locks(this: &Navigator) -> LockManager; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = onLine)] #[doc = "Getter for the `onLine` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index e1038bda317..dc9fdf19315 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -127,6 +127,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] pub fn languages(this: &WorkerNavigator) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockManager")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = locks)] + #[doc = "Getter for the `locks` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/locks)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManager`, `WorkerNavigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn locks(this: &WorkerNavigator) -> LockManager; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = onLine)] #[doc = "Getter for the `onLine` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index e02ad43ad3e..9a3bb1d99c1 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4354,6 +4354,42 @@ mod gen_Location; #[cfg(feature = "Location")] pub use gen_Location::*; +#[cfg(feature = "Lock")] +#[allow(non_snake_case)] +mod gen_Lock; +#[cfg(feature = "Lock")] +pub use gen_Lock::*; + +#[cfg(feature = "LockInfo")] +#[allow(non_snake_case)] +mod gen_LockInfo; +#[cfg(feature = "LockInfo")] +pub use gen_LockInfo::*; + +#[cfg(feature = "LockManager")] +#[allow(non_snake_case)] +mod gen_LockManager; +#[cfg(feature = "LockManager")] +pub use gen_LockManager::*; + +#[cfg(feature = "LockManagerSnapshot")] +#[allow(non_snake_case)] +mod gen_LockManagerSnapshot; +#[cfg(feature = "LockManagerSnapshot")] +pub use gen_LockManagerSnapshot::*; + +#[cfg(feature = "LockMode")] +#[allow(non_snake_case)] +mod gen_LockMode; +#[cfg(feature = "LockMode")] +pub use gen_LockMode::*; + +#[cfg(feature = "LockOptions")] +#[allow(non_snake_case)] +mod gen_LockOptions; +#[cfg(feature = "LockOptions")] +pub use gen_LockOptions::*; + #[cfg(feature = "MediaCapabilities")] #[allow(non_snake_case)] mod gen_MediaCapabilities; diff --git a/crates/web-sys/webidls/unstable/weblock-apis.webidl b/crates/web-sys/webidls/unstable/weblock-apis.webidl new file mode 100644 index 00000000000..14bc3a22cc3 --- /dev/null +++ b/crates/web-sys/webidls/unstable/weblock-apis.webidl @@ -0,0 +1,45 @@ +[SecureContext] +interface mixin NavigatorLocks { + readonly attribute LockManager locks; +}; +Navigator includes NavigatorLocks; +WorkerNavigator includes NavigatorLocks; + +[SecureContext, Exposed=(Window,Worker)] +interface LockManager { + Promise request(DOMString name, + LockGrantedCallback callback); + Promise request(DOMString name, + LockOptions options, + LockGrantedCallback callback); + + Promise query(); +}; + +callback LockGrantedCallback = Promise (Lock? lock); + +enum LockMode { "shared", "exclusive" }; + +dictionary LockOptions { + LockMode mode = "exclusive"; + boolean ifAvailable = false; + boolean steal = false; + AbortSignal signal; +}; + +dictionary LockManagerSnapshot { + sequence held; + sequence pending; +}; + +dictionary LockInfo { + DOMString name; + LockMode mode; + DOMString clientId; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface Lock { + readonly attribute DOMString name; + readonly attribute LockMode mode; +}; From 2b7ab446767d63548bfb9bbb2815e325affb32ac Mon Sep 17 00:00:00 2001 From: Christopher Schramm Date: Sat, 16 Sep 2023 21:01:40 +0200 Subject: [PATCH 280/641] Lower the ES target for instanceof code (#3618) Since #3053 the code makes use of the ES2019 optional catch binding syntax, while generated code in general seems to be compatible with ES2015. --- crates/cli-support/src/js/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 86dcc058119..f81d981398b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3023,7 +3023,7 @@ impl<'a> Context<'a> { let result; try {{ result = {} instanceof {}; - }} catch {{ + }} catch (_) {{ result = false; }} ", From 9ae2a606e172ed657d246c7d79f3d7a16a214c66 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 20 Sep 2023 16:42:35 +0800 Subject: [PATCH 281/641] fix: handle raw identifier in field (#3621) --- CHANGELOG.md | 3 +++ crates/macro-support/src/parser.rs | 3 ++- tests/wasm/getters_and_setters.rs | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f0bcffcb3..3b089562066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,6 +103,9 @@ ### Fixed +* Fixed `wasm_bindgen` macro to handle raw identifiers in field names. + [#3621](https://github.com/rustwasm/wasm-bindgen/pull/3621) + * Fixed bindings and comments for `Atomics.wait`. [#3509](https://github.com/rustwasm/wasm-bindgen/pull/3509) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index e65cc0509b5..73b9c2166f0 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -8,6 +8,7 @@ use backend::util::{ident_ty, ShortHash}; use backend::Diagnostic; use proc_macro2::{Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; +use syn::ext::IdentExt; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; use syn::{ItemFn, Lit, MacroDelimiter, ReturnType}; @@ -420,7 +421,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs)> for &'a mut syn::ItemStruct _ => continue, } let (js_field_name, member) = match &field.ident { - Some(ident) => (ident.to_string(), syn::Member::Named(ident.clone())), + Some(ident) => (ident.unraw().to_string(), syn::Member::Named(ident.clone())), None => (i.to_string(), syn::Member::Unnamed(i.into())), }; diff --git a/tests/wasm/getters_and_setters.rs b/tests/wasm/getters_and_setters.rs index 7425fc23ec0..8c841198362 100644 --- a/tests/wasm/getters_and_setters.rs +++ b/tests/wasm/getters_and_setters.rs @@ -20,6 +20,8 @@ extern "C" { fn _12_js(rules: Rules) -> Rules; fn _13_js(rules: Rules) -> Rules; + fn raw_identifer(rules: RulesWithRawField) -> RulesWithRawField; + fn test_getter_compute(x: GetterCompute); fn test_setter_compute(x: SetterCompute); fn test_statics(x: Statics); @@ -32,6 +34,23 @@ pub struct Rules { pub field: i32, } +#[wasm_bindgen] +pub struct RulesWithRawField { + pub r#mod: i32, +} + +#[wasm_bindgen] +impl RulesWithRawField { + #[wasm_bindgen] + pub fn get_field_value(&self) -> i32 { + self.r#mod + } + #[wasm_bindgen] + pub fn set_field_value(&mut self, value: i32) { + self.r#mod = value; + } +} + #[wasm_bindgen] #[allow(non_snake_case)] impl Rules { From 4bafdbebcc9b7b714ef10d52c8f46c79ffae0464 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 20 Sep 2023 16:57:15 -0400 Subject: [PATCH 282/641] Unwrap argument types in macro (#3625) --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 12 ++++++++++-- tests/wasm/macro_rules.rs | 12 ++++++++++++ tests/wasm/main.rs | 1 + 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/wasm/macro_rules.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b089562066..96f7ff54b0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,6 +129,9 @@ proc-macro. [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) +* Fix bug with function arguments coming from `macro_rules!`. + [#3625](https://github.com/rustwasm/wasm-bindgen/pull/3625) + ### Removed * Removed `ReadableStreamByobReader::read_with_u8_array()` because it doesn't work with Wasm. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index e45d4e50ba1..a65418fdf86 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -523,8 +523,16 @@ impl TryToTokens for ast::Export { argtys.push(&*arg.ty); let i = i + offset; let ident = Ident::new(&format!("arg{}", i), Span::call_site()); - let ty = &arg.ty; - match &*arg.ty { + fn unwrap_nested_types(ty: &syn::Type) -> &syn::Type { + match &ty { + syn::Type::Group(syn::TypeGroup { ref elem, .. }) => unwrap_nested_types(elem), + syn::Type::Paren(syn::TypeParen { ref elem, .. }) => unwrap_nested_types(elem), + _ => ty, + } + } + let ty = unwrap_nested_types(&arg.ty); + + match &ty { syn::Type::Reference(syn::TypeReference { mutability: Some(_), elem, diff --git a/tests/wasm/macro_rules.rs b/tests/wasm/macro_rules.rs new file mode 100644 index 00000000000..42c4b2a1d1d --- /dev/null +++ b/tests/wasm/macro_rules.rs @@ -0,0 +1,12 @@ +//! This tests that the `wasm_bindgen` macro produces code that compiles for this use case. +//! `cargo test --target wasm32-unknown-unknown` will not run if this test breaks. +use wasm_bindgen::prelude::*; + +macro_rules! my_export { + ($i: ident, $s: ty) => { + #[wasm_bindgen] + pub fn $i(_: $s) {} + }; +} + +my_export!(should_compile, &[i32]); diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index eebde19677e..30ea94b422d 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -35,6 +35,7 @@ pub mod js_keywords; pub mod js_objects; pub mod jscast; pub mod link_to; +pub mod macro_rules; pub mod math; pub mod no_shims; pub mod node; From e14a7adfe510613b6a1ee7568c817f8f85891934 Mon Sep 17 00:00:00 2001 From: Christopher Schramm Date: Thu, 21 Sep 2023 00:59:39 +0200 Subject: [PATCH 283/641] Allow creating `Vec`s of exported enums (#3624) --- crates/backend/src/codegen.rs | 60 +++++++++++++++++++++++++++++++++++ tests/wasm/enum_vecs.js | 23 ++++++++++++++ tests/wasm/enum_vecs.rs | 36 +++++++++++++++++++++ tests/wasm/main.rs | 1 + 4 files changed, 120 insertions(+) create mode 100644 tests/wasm/enum_vecs.js create mode 100644 tests/wasm/enum_vecs.rs diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index a65418fdf86..86a584becc8 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1391,6 +1391,7 @@ impl ToTokens for ast::Enum { } } }); + let try_from_cast_clauses = cast_clauses.clone(); let wasm_bindgen = &self.wasm_bindgen; (quote! { #[automatically_derived] @@ -1435,6 +1436,65 @@ impl ToTokens for ast::Enum { inform(#hole); } } + + #[automatically_derived] + impl #wasm_bindgen::__rt::core::convert::From<#enum_name> for + #wasm_bindgen::JsValue + { + fn from(value: #enum_name) -> Self { + #wasm_bindgen::JsValue::from_f64((value as u32).into()) + } + } + + #[allow(clippy::all)] + impl #wasm_bindgen::__rt::core::convert::TryFrom<#wasm_bindgen::JsValue> for #enum_name { + type Error = #wasm_bindgen::JsValue; + + fn try_from(value: #wasm_bindgen::JsValue) + -> #wasm_bindgen::__rt::std::result::Result { + let js = f64::try_from(&value)? as u32; + + #wasm_bindgen::__rt::std::result::Result::Ok( + #(#try_from_cast_clauses else)* { + return #wasm_bindgen::__rt::std::result::Result::Err(value) + } + ) + } + } + + impl #wasm_bindgen::describe::WasmDescribeVector for #enum_name { + fn describe_vector() { + use #wasm_bindgen::describe::*; + inform(VECTOR); + <#wasm_bindgen::JsValue as #wasm_bindgen::describe::WasmDescribe>::describe(); + } + } + + impl #wasm_bindgen::convert::VectorIntoWasmAbi for #enum_name { + type Abi = < + #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + as #wasm_bindgen::convert::IntoWasmAbi + >::Abi; + + fn vector_into_abi( + vector: #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]> + ) -> Self::Abi { + #wasm_bindgen::convert::js_value_vector_into_abi(vector) + } + } + + impl #wasm_bindgen::convert::VectorFromWasmAbi for #enum_name { + type Abi = < + #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + as #wasm_bindgen::convert::FromWasmAbi + >::Abi; + + unsafe fn vector_from_abi( + js: Self::Abi + ) -> #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]> { + #wasm_bindgen::convert::js_value_vector_from_abi(js) + } + } }) .to_tokens(into); } diff --git a/tests/wasm/enum_vecs.js b/tests/wasm/enum_vecs.js new file mode 100644 index 00000000000..bef43b3e417 --- /dev/null +++ b/tests/wasm/enum_vecs.js @@ -0,0 +1,23 @@ +const wasm = require('wasm-bindgen-test.js'); +const assert = require('assert'); + +exports.pass_enum_vec = () => { + const el1 = wasm.EnumArrayElement.Unit; + const el2 = wasm.EnumArrayElement.Unit; + const ret = wasm.consume_enum_vec([el1, el2]); + assert.strictEqual(ret.length, 3); + + const ret2 = wasm.consume_optional_enum_vec(ret); + assert.strictEqual(ret2.length, 4); + + assert.strictEqual(wasm.consume_optional_enum_vec(undefined), undefined); +}; + +exports.pass_invalid_enum_vec = () => { + try { + wasm.consume_enum_vec(['not an enum value']); + } catch (e) { + assert.match(e.message, /invalid enum value passed/) + assert.match(e.stack, /consume_enum_vec/) + } +}; diff --git a/tests/wasm/enum_vecs.rs b/tests/wasm/enum_vecs.rs new file mode 100644 index 00000000000..7b6e6bcaf46 --- /dev/null +++ b/tests/wasm/enum_vecs.rs @@ -0,0 +1,36 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/enum_vecs.js")] +extern "C" { + fn pass_enum_vec(); + fn pass_invalid_enum_vec(); +} + +#[wasm_bindgen] +pub enum EnumArrayElement { + Unit, +} + +#[wasm_bindgen] +pub fn consume_enum_vec(mut vec: Vec) -> Vec { + vec.push(EnumArrayElement::Unit); + vec +} + +#[wasm_bindgen] +pub fn consume_optional_enum_vec( + vec: Option>, +) -> Option> { + vec.map(consume_enum_vec) +} + +#[wasm_bindgen_test] +fn test_valid() { + pass_enum_vec(); +} + +#[wasm_bindgen_test] +fn test_invalid() { + pass_invalid_enum_vec(); +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 30ea94b422d..72bb5c414f4 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -23,6 +23,7 @@ pub mod closures; pub mod comments; pub mod duplicate_deps; pub mod duplicates; +pub mod enum_vecs; pub mod enums; #[path = "final.rs"] pub mod final_; From ba244b92e1abbe1b2ceb76d2ed7d106bb7df1eea Mon Sep 17 00:00:00 2001 From: flumm Date: Thu, 21 Sep 2023 11:37:14 +0200 Subject: [PATCH 284/641] guide: add missing and fix incorrect testing info (#3629) * guide: add missing and fix incorrect testing info in the contributing section. Some tests need `WASM_BINDGEN_SPLIT_LINKED_MODULES` set to run through, and the macro ui-tests are not a workspace package anymore Signed-off-by: Dominik Csapak * guide: improve macro test invocation by using `-p wasm-bindgen-macro` instead of changing dir to `crates/macro` Signed-off-by: Dominik Csapak --------- Signed-off-by: Dominik Csapak --- guide/src/contributing/testing.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guide/src/contributing/testing.md b/guide/src/contributing/testing.md index fe3bca622a4..4fa5ec0a2fc 100644 --- a/guide/src/contributing/testing.md +++ b/guide/src/contributing/testing.md @@ -7,7 +7,7 @@ These are the largest test suites, and most common to run in day to day Node.js or a headless browser via the WebDriver protocol. ```bash -cargo test --target wasm32-unknown-unknown +WASM_BINDGEN_SPLIT_LINKED_MODULES=1 cargo test --target wasm32-unknown-unknown ``` See [the `wasm-bindgen-test` crate's @@ -34,8 +34,11 @@ cargo test -p webidl-tests --target wasm32-unknown-unknown These tests assert that we have reasonable error messages that point to the right source spans when the `#[wasm_bindgen]` proc-macro is misused. +You can run these tests by running `cargo test` for the `wasm-bindgen-macro` +crate: + ``` -cargo test -p ui-tests +cargo test -p wasm-bindgen-macro ``` ## The `js-sys` Tests From 792be2d1faf7072fd51358558eacfc58b6c48642 Mon Sep 17 00:00:00 2001 From: Jeff Hemphill Date: Wed, 27 Sep 2023 15:33:22 -0700 Subject: [PATCH 285/641] Update parallel raytracing .gitignore (#3606) --- examples/raytrace-parallel/.gitignore | 2 - examples/raytrace-parallel/README.md | 4 +- examples/raytrace-parallel/build.py | 57 +++++++++++++++++++++++++ examples/raytrace-parallel/build.sh | 20 +-------- examples/raytrace-parallel/index.html | 2 +- examples/raytrace-parallel/run.py | 9 ++++ examples/raytrace-parallel/run.sh | 2 +- examples/raytrace-parallel/worker.js | 2 +- examples/wasm-audio-worklet/README.md | 2 +- examples/wasm-audio-worklet/build.py | 58 ++++++++++++++++++++++++++ examples/wasm-audio-worklet/build.sh | 19 +-------- examples/wasm-audio-worklet/index.html | 2 +- examples/wasm-audio-worklet/run.py | 9 ++++ examples/wasm-audio-worklet/run.sh | 2 +- 14 files changed, 142 insertions(+), 48 deletions(-) delete mode 100644 examples/raytrace-parallel/.gitignore create mode 100755 examples/raytrace-parallel/build.py create mode 100755 examples/raytrace-parallel/run.py create mode 100644 examples/wasm-audio-worklet/build.py create mode 100644 examples/wasm-audio-worklet/run.py diff --git a/examples/raytrace-parallel/.gitignore b/examples/raytrace-parallel/.gitignore deleted file mode 100644 index 8b5555eb0cf..00000000000 --- a/examples/raytrace-parallel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -raytrace_parallel.js -raytrace_parallel_bg.wasm diff --git a/examples/raytrace-parallel/README.md b/examples/raytrace-parallel/README.md index 296e9aa8fbe..a09c42bbf2a 100644 --- a/examples/raytrace-parallel/README.md +++ b/examples/raytrace-parallel/README.md @@ -9,9 +9,7 @@ online][compiled] You can build the example locally with: ``` -$ ./run.sh +$ python3 run.py ``` -(or running the commands on Windows manually) - and then visiting http://localhost:8080 in a browser should run the example! diff --git a/examples/raytrace-parallel/build.py b/examples/raytrace-parallel/build.py new file mode 100755 index 00000000000..0e14f490711 --- /dev/null +++ b/examples/raytrace-parallel/build.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +import os +import subprocess + +root_dir = os.path.dirname(__file__) + +# A couple of steps are necessary to get this build working which makes it slightly +# nonstandard compared to most other builds. +# +# * First, the Rust standard library needs to be recompiled with atomics +# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. +# +# * Next we need to compile everything with the `atomics` and `bulk-memory` +# features enabled, ensuring that LLVM will generate atomic instructions, +# shared memory, passive segments, etc. + +os.environ.update( + {"RUSTFLAGS": "-C target-feature=+atomics,+bulk-memory,+mutable-globals"} +) + +subprocess.run( + [ + "cargo", + "build", + "--target", + "wasm32-unknown-unknown", + "--release", + "-Zbuild-std=std,panic_abort", + ], + cwd=root_dir, +).check_returncode() + +# Note the usage of `--target no-modules` here which is required for passing +# the memory import to each wasm module. +subprocess.run( + [ + "cargo", + "run", + "-p", + "wasm-bindgen-cli", + "--", + os.path.join( + root_dir, + "..", + "..", + "target", + "wasm32-unknown-unknown", + "release", + "raytrace_parallel.wasm", + ), + "--out-dir", + os.path.join(root_dir, "pkg"), + "--target", + "no-modules", + ], + cwd=root_dir, +).check_returncode() diff --git a/examples/raytrace-parallel/build.sh b/examples/raytrace-parallel/build.sh index f10dcf29dfb..09786f553ce 100755 --- a/examples/raytrace-parallel/build.sh +++ b/examples/raytrace-parallel/build.sh @@ -2,22 +2,4 @@ set -ex -# A couple of steps are necessary to get this build working which makes it slightly -# nonstandard compared to most other builds. -# -# * First, the Rust standard library needs to be recompiled with atomics -# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. -# -# * Next we need to compile everything with the `atomics` and `bulk-memory` -# features enabled, ensuring that LLVM will generate atomic instructions, -# shared memory, passive segments, etc. - -RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ - cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort - -# Note the usage of `--target no-modules` here which is required for passing -# the memory import to each wasm module. -cargo run -p wasm-bindgen-cli -- \ - ../../target/wasm32-unknown-unknown/release/raytrace_parallel.wasm \ - --out-dir . \ - --target no-modules +python3 build.py diff --git a/examples/raytrace-parallel/index.html b/examples/raytrace-parallel/index.html index bc9cae70616..2feedce4b00 100644 --- a/examples/raytrace-parallel/index.html +++ b/examples/raytrace-parallel/index.html @@ -219,7 +219,7 @@ document.getElementById('render').disabled = true; document.getElementById('concurrency').disabled = true; - + diff --git a/examples/raytrace-parallel/run.py b/examples/raytrace-parallel/run.py new file mode 100755 index 00000000000..411fb94d0e3 --- /dev/null +++ b/examples/raytrace-parallel/run.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +import os +import subprocess + +root_dir = os.path.dirname(__file__) + +subprocess.run(["python3", "build.py"], cwd=root_dir).check_returncode() + +subprocess.run(["python3", "server.py"], cwd=root_dir).check_returncode() diff --git a/examples/raytrace-parallel/run.sh b/examples/raytrace-parallel/run.sh index e32cfb456e9..1590260c287 100755 --- a/examples/raytrace-parallel/run.sh +++ b/examples/raytrace-parallel/run.sh @@ -2,6 +2,6 @@ set -ex -./build.sh +python3 build.py python3 server.py diff --git a/examples/raytrace-parallel/worker.js b/examples/raytrace-parallel/worker.js index 26d40c62dea..2c5863316bf 100644 --- a/examples/raytrace-parallel/worker.js +++ b/examples/raytrace-parallel/worker.js @@ -1,5 +1,5 @@ // synchronously, using the browser, import out shim JS scripts -importScripts('raytrace_parallel.js'); +importScripts('pkg/raytrace_parallel.js'); // Wait for the main thread to send us the shared module/memory. Once we've got // it, initialize it all with the `wasm_bindgen` global we imported via diff --git a/examples/wasm-audio-worklet/README.md b/examples/wasm-audio-worklet/README.md index 157e0c41ab4..fae3fd6714f 100644 --- a/examples/wasm-audio-worklet/README.md +++ b/examples/wasm-audio-worklet/README.md @@ -9,7 +9,7 @@ online][compiled] You can build the example locally with: ``` -$ ./run.sh +$ python3 run.py ``` (or running the commands on Windows manually) diff --git a/examples/wasm-audio-worklet/build.py b/examples/wasm-audio-worklet/build.py new file mode 100644 index 00000000000..e2e53d16596 --- /dev/null +++ b/examples/wasm-audio-worklet/build.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +import os +import subprocess + +root_dir = os.path.dirname(__file__) + +# A couple of steps are necessary to get this build working which makes it slightly +# nonstandard compared to most other builds. +# +# * First, the Rust standard library needs to be recompiled with atomics +# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. +# +# * Next we need to compile everything with the `atomics` and `bulk-memory` +# features enabled, ensuring that LLVM will generate atomic instructions, +# shared memory, passive segments, etc. + +os.environ.update( + {"RUSTFLAGS": "-C target-feature=+atomics,+bulk-memory,+mutable-globals"} +) + +subprocess.run( + [ + "cargo", + "build", + "--target", + "wasm32-unknown-unknown", + "--release", + "-Zbuild-std=std,panic_abort", + ], + cwd=root_dir, +).check_returncode() + +# Note the usage of `--target no-modules` here which is required for passing +# the memory import to each wasm module. +subprocess.run( + [ + "cargo", + "run", + "-p", + "wasm-bindgen-cli", + "--", + os.path.join( + root_dir, + "..", + "..", + "target", + "wasm32-unknown-unknown", + "release", + "wasm_audio_worklet.wasm", + ), + "--out-dir", + os.path.join(root_dir, "pkg"), + "--target", + "web", + "--split-linked-modules", + ], + cwd=root_dir, +).check_returncode() diff --git a/examples/wasm-audio-worklet/build.sh b/examples/wasm-audio-worklet/build.sh index 576fec80605..09786f553ce 100755 --- a/examples/wasm-audio-worklet/build.sh +++ b/examples/wasm-audio-worklet/build.sh @@ -2,21 +2,4 @@ set -ex -# A couple of steps are necessary to get this build working which makes it slightly -# nonstandard compared to most other builds. -# -# * First, the Rust standard library needs to be recompiled with atomics -# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. -# -# * Next we need to compile everything with the `atomics` and `bulk-memory` -# features enabled, ensuring that LLVM will generate atomic instructions, -# shared memory, passive segments, etc. - -RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ - cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort - -cargo run -p wasm-bindgen-cli -- \ - ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \ - --out-dir . \ - --target web \ - --split-linked-modules +python3 build.py diff --git a/examples/wasm-audio-worklet/index.html b/examples/wasm-audio-worklet/index.html index 9cb5882cbd7..0f4eaa16933 100644 --- a/examples/wasm-audio-worklet/index.html +++ b/examples/wasm-audio-worklet/index.html @@ -5,7 +5,7 @@ - + diff --git a/examples/raytrace-parallel/run.py b/examples/raytrace-parallel/run.py deleted file mode 100755 index 411fb94d0e3..00000000000 --- a/examples/raytrace-parallel/run.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 -import os -import subprocess - -root_dir = os.path.dirname(__file__) - -subprocess.run(["python3", "build.py"], cwd=root_dir).check_returncode() - -subprocess.run(["python3", "server.py"], cwd=root_dir).check_returncode() diff --git a/examples/raytrace-parallel/run.sh b/examples/raytrace-parallel/run.sh index 1590260c287..e32cfb456e9 100755 --- a/examples/raytrace-parallel/run.sh +++ b/examples/raytrace-parallel/run.sh @@ -2,6 +2,6 @@ set -ex -python3 build.py +./build.sh python3 server.py diff --git a/examples/raytrace-parallel/worker.js b/examples/raytrace-parallel/worker.js index 2c5863316bf..26d40c62dea 100644 --- a/examples/raytrace-parallel/worker.js +++ b/examples/raytrace-parallel/worker.js @@ -1,5 +1,5 @@ // synchronously, using the browser, import out shim JS scripts -importScripts('pkg/raytrace_parallel.js'); +importScripts('raytrace_parallel.js'); // Wait for the main thread to send us the shared module/memory. Once we've got // it, initialize it all with the `wasm_bindgen` global we imported via diff --git a/examples/wasm-audio-worklet/README.md b/examples/wasm-audio-worklet/README.md index fae3fd6714f..157e0c41ab4 100644 --- a/examples/wasm-audio-worklet/README.md +++ b/examples/wasm-audio-worklet/README.md @@ -9,7 +9,7 @@ online][compiled] You can build the example locally with: ``` -$ python3 run.py +$ ./run.sh ``` (or running the commands on Windows manually) diff --git a/examples/wasm-audio-worklet/build.py b/examples/wasm-audio-worklet/build.py deleted file mode 100644 index e2e53d16596..00000000000 --- a/examples/wasm-audio-worklet/build.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 -import os -import subprocess - -root_dir = os.path.dirname(__file__) - -# A couple of steps are necessary to get this build working which makes it slightly -# nonstandard compared to most other builds. -# -# * First, the Rust standard library needs to be recompiled with atomics -# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. -# -# * Next we need to compile everything with the `atomics` and `bulk-memory` -# features enabled, ensuring that LLVM will generate atomic instructions, -# shared memory, passive segments, etc. - -os.environ.update( - {"RUSTFLAGS": "-C target-feature=+atomics,+bulk-memory,+mutable-globals"} -) - -subprocess.run( - [ - "cargo", - "build", - "--target", - "wasm32-unknown-unknown", - "--release", - "-Zbuild-std=std,panic_abort", - ], - cwd=root_dir, -).check_returncode() - -# Note the usage of `--target no-modules` here which is required for passing -# the memory import to each wasm module. -subprocess.run( - [ - "cargo", - "run", - "-p", - "wasm-bindgen-cli", - "--", - os.path.join( - root_dir, - "..", - "..", - "target", - "wasm32-unknown-unknown", - "release", - "wasm_audio_worklet.wasm", - ), - "--out-dir", - os.path.join(root_dir, "pkg"), - "--target", - "web", - "--split-linked-modules", - ], - cwd=root_dir, -).check_returncode() diff --git a/examples/wasm-audio-worklet/build.sh b/examples/wasm-audio-worklet/build.sh index 09786f553ce..576fec80605 100755 --- a/examples/wasm-audio-worklet/build.sh +++ b/examples/wasm-audio-worklet/build.sh @@ -2,4 +2,21 @@ set -ex -python3 build.py +# A couple of steps are necessary to get this build working which makes it slightly +# nonstandard compared to most other builds. +# +# * First, the Rust standard library needs to be recompiled with atomics +# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. +# +# * Next we need to compile everything with the `atomics` and `bulk-memory` +# features enabled, ensuring that LLVM will generate atomic instructions, +# shared memory, passive segments, etc. + +RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ + cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort + +cargo run -p wasm-bindgen-cli -- \ + ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \ + --out-dir . \ + --target web \ + --split-linked-modules diff --git a/examples/wasm-audio-worklet/index.html b/examples/wasm-audio-worklet/index.html index 0f4eaa16933..9cb5882cbd7 100644 --- a/examples/wasm-audio-worklet/index.html +++ b/examples/wasm-audio-worklet/index.html @@ -5,7 +5,7 @@ - + diff --git a/examples/raytrace-parallel/run.py b/examples/raytrace-parallel/run.py new file mode 100755 index 00000000000..411fb94d0e3 --- /dev/null +++ b/examples/raytrace-parallel/run.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +import os +import subprocess + +root_dir = os.path.dirname(__file__) + +subprocess.run(["python3", "build.py"], cwd=root_dir).check_returncode() + +subprocess.run(["python3", "server.py"], cwd=root_dir).check_returncode() diff --git a/examples/raytrace-parallel/run.sh b/examples/raytrace-parallel/run.sh index e32cfb456e9..1590260c287 100755 --- a/examples/raytrace-parallel/run.sh +++ b/examples/raytrace-parallel/run.sh @@ -2,6 +2,6 @@ set -ex -./build.sh +python3 build.py python3 server.py diff --git a/examples/raytrace-parallel/worker.js b/examples/raytrace-parallel/worker.js index 26d40c62dea..2c5863316bf 100644 --- a/examples/raytrace-parallel/worker.js +++ b/examples/raytrace-parallel/worker.js @@ -1,5 +1,5 @@ // synchronously, using the browser, import out shim JS scripts -importScripts('raytrace_parallel.js'); +importScripts('pkg/raytrace_parallel.js'); // Wait for the main thread to send us the shared module/memory. Once we've got // it, initialize it all with the `wasm_bindgen` global we imported via diff --git a/examples/wasm-audio-worklet/README.md b/examples/wasm-audio-worklet/README.md index 157e0c41ab4..7b32e68ba70 100644 --- a/examples/wasm-audio-worklet/README.md +++ b/examples/wasm-audio-worklet/README.md @@ -9,9 +9,7 @@ online][compiled] You can build the example locally with: ``` -$ ./run.sh +$ python3 run.py ``` -(or running the commands on Windows manually) - and then visiting http://localhost:8080 in a browser should run the example! diff --git a/examples/wasm-audio-worklet/build.py b/examples/wasm-audio-worklet/build.py new file mode 100644 index 00000000000..e2e53d16596 --- /dev/null +++ b/examples/wasm-audio-worklet/build.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +import os +import subprocess + +root_dir = os.path.dirname(__file__) + +# A couple of steps are necessary to get this build working which makes it slightly +# nonstandard compared to most other builds. +# +# * First, the Rust standard library needs to be recompiled with atomics +# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. +# +# * Next we need to compile everything with the `atomics` and `bulk-memory` +# features enabled, ensuring that LLVM will generate atomic instructions, +# shared memory, passive segments, etc. + +os.environ.update( + {"RUSTFLAGS": "-C target-feature=+atomics,+bulk-memory,+mutable-globals"} +) + +subprocess.run( + [ + "cargo", + "build", + "--target", + "wasm32-unknown-unknown", + "--release", + "-Zbuild-std=std,panic_abort", + ], + cwd=root_dir, +).check_returncode() + +# Note the usage of `--target no-modules` here which is required for passing +# the memory import to each wasm module. +subprocess.run( + [ + "cargo", + "run", + "-p", + "wasm-bindgen-cli", + "--", + os.path.join( + root_dir, + "..", + "..", + "target", + "wasm32-unknown-unknown", + "release", + "wasm_audio_worklet.wasm", + ), + "--out-dir", + os.path.join(root_dir, "pkg"), + "--target", + "web", + "--split-linked-modules", + ], + cwd=root_dir, +).check_returncode() diff --git a/examples/wasm-audio-worklet/build.sh b/examples/wasm-audio-worklet/build.sh index 576fec80605..09786f553ce 100755 --- a/examples/wasm-audio-worklet/build.sh +++ b/examples/wasm-audio-worklet/build.sh @@ -2,21 +2,4 @@ set -ex -# A couple of steps are necessary to get this build working which makes it slightly -# nonstandard compared to most other builds. -# -# * First, the Rust standard library needs to be recompiled with atomics -# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature. -# -# * Next we need to compile everything with the `atomics` and `bulk-memory` -# features enabled, ensuring that LLVM will generate atomic instructions, -# shared memory, passive segments, etc. - -RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ - cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort - -cargo run -p wasm-bindgen-cli -- \ - ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \ - --out-dir . \ - --target web \ - --split-linked-modules +python3 build.py diff --git a/examples/wasm-audio-worklet/index.html b/examples/wasm-audio-worklet/index.html index 9cb5882cbd7..0f4eaa16933 100644 --- a/examples/wasm-audio-worklet/index.html +++ b/examples/wasm-audio-worklet/index.html @@ -5,7 +5,7 @@ ", ) }; - return set_isolate_origin_headers(Response::from_data("text/html", s)); + + let mut response = Response::from_data("text/html", s); + + if isolate_origin { + set_isolate_origin_headers(&mut response) + } + + return response; } // Otherwise we need to find the asset here. It may either be in our @@ -304,7 +312,10 @@ pub(crate) fn spawn( // Make sure browsers don't cache anything (Chrome appeared to with this // header?) response.headers.retain(|(k, _)| k != "Cache-Control"); - set_isolate_origin_headers(response) + if isolate_origin { + set_isolate_origin_headers(&mut response) + } + response }) .map_err(|e| anyhow!("{}", e))?; return Ok(srv); @@ -346,7 +357,7 @@ pub(crate) fn spawn( * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy#certain_features_depend_on_cross-origin_isolation * https://security.googleblog.com/2018/07/mitigating-spectre-with-site-isolation.html */ -fn set_isolate_origin_headers(mut response: Response) -> Response { +fn set_isolate_origin_headers(response: &mut Response) { response.headers.push(( Cow::Borrowed("Cross-Origin-Opener-Policy"), Cow::Borrowed("same-origin"), @@ -355,6 +366,4 @@ fn set_isolate_origin_headers(mut response: Response) -> Response { Cow::Borrowed("Cross-Origin-Embedder-Policy"), Cow::Borrowed("require-corp"), )); - - response } From c4f81f5922c42c77e37179b4de421e8f6025b063 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 24 Jan 2024 12:13:36 +0100 Subject: [PATCH 341/641] Add unstable bindings for the FileSystemAccess API (#3799) (#3810) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 9 ++ .../src/features/gen_DataTransferItem.rs | 11 ++ .../features/gen_DirectoryPickerOptions.rs | 93 ++++++++++++ .../src/features/gen_FilePickerAcceptType.rs | 58 ++++++++ .../src/features/gen_FilePickerOptions.rs | 113 +++++++++++++++ .../src/features/gen_FileSystemHandle.rs | 52 +++++++ ...en_FileSystemHandlePermissionDescriptor.rs | 55 +++++++ .../gen_FileSystemPermissionDescriptor.rs | 89 ++++++++++++ .../features/gen_FileSystemPermissionMode.rs | 16 +++ .../src/features/gen_OpenFilePickerOptions.rs | 134 ++++++++++++++++++ .../src/features/gen_SaveFilePickerOptions.rs | 134 ++++++++++++++++++ .../src/features/gen_WellKnownDirectory.rs | 20 +++ crates/web-sys/src/features/gen_Window.rs | 78 ++++++++++ crates/web-sys/src/features/mod.rs | 63 ++++++++ ...mAccess.webidl => FileSystemHandle.webidl} | 0 .../webidls/unstable/FileSystemAccess.webidl | 70 +++++++++ 17 files changed, 998 insertions(+) create mode 100644 crates/web-sys/src/features/gen_DirectoryPickerOptions.rs create mode 100644 crates/web-sys/src/features/gen_FilePickerAcceptType.rs create mode 100644 crates/web-sys/src/features/gen_FilePickerOptions.rs create mode 100644 crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs create mode 100644 crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs create mode 100644 crates/web-sys/src/features/gen_FileSystemPermissionMode.rs create mode 100644 crates/web-sys/src/features/gen_OpenFilePickerOptions.rs create mode 100644 crates/web-sys/src/features/gen_SaveFilePickerOptions.rs create mode 100644 crates/web-sys/src/features/gen_WellKnownDirectory.rs rename crates/web-sys/webidls/enabled/{FileSystemAccess.webidl => FileSystemHandle.webidl} (100%) create mode 100644 crates/web-sys/webidls/unstable/FileSystemAccess.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 58546a4344e..73ba0b93fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add unstable bindings for the FileSystemAccess API + [#3810](https://github.com/rustwasm/wasm-bindgen/pull/3810) + * Added support for running tests in shared and service workers with ``wasm_bindgen_test_configure!` `run_in_shared_worker` and `run_in_service_worker`. [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804) diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 8fa18897608..55dfc9fcaf7 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -289,6 +289,7 @@ DeviceRotationRateInit = [] DhKeyDeriveParams = [] DirectionSetting = [] Directory = [] +DirectoryPickerOptions = [] DisplayMediaStreamConstraints = [] DisplayNameOptions = [] DisplayNameResult = [] @@ -384,6 +385,8 @@ FetchState = [] File = ["Blob"] FileCallback = [] FileList = [] +FilePickerAcceptType = [] +FilePickerOptions = [] FilePropertyBag = [] FileReader = ["EventTarget"] FileReaderSync = [] @@ -402,6 +405,9 @@ FileSystemGetDirectoryOptions = [] FileSystemGetFileOptions = [] FileSystemHandle = [] FileSystemHandleKind = [] +FileSystemHandlePermissionDescriptor = [] +FileSystemPermissionDescriptor = [] +FileSystemPermissionMode = [] FileSystemReadWriteOptions = [] FileSystemRemoveOptions = [] FileSystemSyncAccessHandle = [] @@ -895,6 +901,7 @@ OfflineAudioContextOptions = [] OfflineResourceList = ["EventTarget"] OffscreenCanvas = ["EventTarget"] OffscreenCanvasRenderingContext2d = [] +OpenFilePickerOptions = [] OpenWindowEventDetail = [] OptionalEffectTiming = [] OrientationLockType = [] @@ -1135,6 +1142,7 @@ RtcdtmfToneChangeEvent = ["Event"] RtcdtmfToneChangeEventInit = [] RtcrtpContributingSourceStats = [] RtcrtpStreamStats = [] +SaveFilePickerOptions = [] Scheduler = [] SchedulerPostTaskOptions = [] Scheduling = [] @@ -1541,6 +1549,7 @@ WebglDepthTexture = [] WebglDrawBuffers = [] WebglLoseContext = [] WebglMultiDraw = [] +WellKnownDirectory = [] WgslLanguageFeatures = [] WheelEvent = ["Event", "MouseEvent", "UiEvent"] WheelEventInit = [] diff --git a/crates/web-sys/src/features/gen_DataTransferItem.rs b/crates/web-sys/src/features/gen_DataTransferItem.rs index 4dec7731ba1..98f4e8dba94 100644 --- a/crates/web-sys/src/features/gen_DataTransferItem.rs +++ b/crates/web-sys/src/features/gen_DataTransferItem.rs @@ -34,6 +34,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransferItem`, `File`*"] pub fn get_as_file(this: &DataTransferItem) -> Result, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "DataTransferItem" , js_name = getAsFileSystemHandle)] + #[doc = "The `getAsFileSystemHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/getAsFileSystemHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DataTransferItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_as_file_system_handle(this: &DataTransferItem) -> ::js_sys::Promise; # [wasm_bindgen (catch , method , structural , js_class = "DataTransferItem" , js_name = getAsString)] #[doc = "The `getAsString()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs new file mode 100644 index 00000000000..a7886ebc0be --- /dev/null +++ b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs @@ -0,0 +1,93 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DirectoryPickerOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DirectoryPickerOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type DirectoryPickerOptions; +} +#[cfg(web_sys_unstable_apis)] +impl DirectoryPickerOptions { + #[doc = "Construct a new `DirectoryPickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn id(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("startIn"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for DirectoryPickerOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs new file mode 100644 index 00000000000..cd2e41ab994 --- /dev/null +++ b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs @@ -0,0 +1,58 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FilePickerAcceptType)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FilePickerAcceptType` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FilePickerAcceptType; +} +#[cfg(web_sys_unstable_apis)] +impl FilePickerAcceptType { + #[doc = "Construct a new `FilePickerAcceptType`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn description(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("description"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FilePickerAcceptType { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FilePickerOptions.rs b/crates/web-sys/src/features/gen_FilePickerOptions.rs new file mode 100644 index 00000000000..1548a514129 --- /dev/null +++ b/crates/web-sys/src/features/gen_FilePickerOptions.rs @@ -0,0 +1,113 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FilePickerOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FilePickerOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FilePickerOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FilePickerOptions { + #[doc = "Construct a new `FilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `excludeAcceptAllOption` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("excludeAcceptAllOption"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn id(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("startIn"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FilePickerOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemHandle.rs b/crates/web-sys/src/features/gen_FileSystemHandle.rs index 6a019fe67db..b29a9d2eea0 100644 --- a/crates/web-sys/src/features/gen_FileSystemHandle.rs +++ b/crates/web-sys/src/features/gen_FileSystemHandle.rs @@ -34,4 +34,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] pub fn is_same_entry(this: &FileSystemHandle, other: &FileSystemHandle) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = queryPermission)] + #[doc = "The `queryPermission()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_permission(this: &FileSystemHandle) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemHandlePermissionDescriptor")] + # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = queryPermission)] + #[doc = "The `queryPermission()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemHandlePermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn query_permission_with_descriptor( + this: &FileSystemHandle, + descriptor: &FileSystemHandlePermissionDescriptor, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = requestPermission)] + #[doc = "The `requestPermission()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_permission(this: &FileSystemHandle) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemHandlePermissionDescriptor")] + # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = requestPermission)] + #[doc = "The `requestPermission()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemHandlePermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn request_permission_with_descriptor( + this: &FileSystemHandle, + descriptor: &FileSystemHandlePermissionDescriptor, + ) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs new file mode 100644 index 00000000000..00f6d96fe30 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs @@ -0,0 +1,55 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemHandlePermissionDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemHandlePermissionDescriptor` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemHandlePermissionDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemHandlePermissionDescriptor { + #[doc = "Construct a new `FileSystemHandlePermissionDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemHandlePermissionDescriptor { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs new file mode 100644 index 00000000000..b4a2a512c11 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs @@ -0,0 +1,89 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemPermissionDescriptor)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemPermissionDescriptor` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemPermissionDescriptor; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemPermissionDescriptor { + #[cfg(all(feature = "FileSystemHandle", feature = "PermissionName",))] + #[doc = "Construct a new `FileSystemPermissionDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(name: PermissionName, handle: &FileSystemHandle) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.name(name); + ret.handle(handle); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(&mut self, val: PermissionName) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemHandle")] + #[doc = "Change the `handle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn handle(&mut self, val: &FileSystemHandle) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("handle"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemPermissionMode.rs b/crates/web-sys/src/features/gen_FileSystemPermissionMode.rs new file mode 100644 index 00000000000..11636456c13 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemPermissionMode.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `FileSystemPermissionMode` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionMode`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum FileSystemPermissionMode { + Read = "read", + Readwrite = "readwrite", +} diff --git a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs new file mode 100644 index 00000000000..7662f05b2e2 --- /dev/null +++ b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs @@ -0,0 +1,134 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = OpenFilePickerOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `OpenFilePickerOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type OpenFilePickerOptions; +} +#[cfg(web_sys_unstable_apis)] +impl OpenFilePickerOptions { + #[doc = "Construct a new `OpenFilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `excludeAcceptAllOption` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("excludeAcceptAllOption"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn id(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("startIn"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `multiple` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn multiple(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("multiple"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for OpenFilePickerOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs new file mode 100644 index 00000000000..46530763c59 --- /dev/null +++ b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs @@ -0,0 +1,134 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SaveFilePickerOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SaveFilePickerOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SaveFilePickerOptions; +} +#[cfg(web_sys_unstable_apis)] +impl SaveFilePickerOptions { + #[doc = "Construct a new `SaveFilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `excludeAcceptAllOption` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("excludeAcceptAllOption"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn id(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("startIn"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `suggestedName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn suggested_name(&mut self, val: Option<&str>) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("suggestedName"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SaveFilePickerOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WellKnownDirectory.rs b/crates/web-sys/src/features/gen_WellKnownDirectory.rs new file mode 100644 index 00000000000..a99a80592e5 --- /dev/null +++ b/crates/web-sys/src/features/gen_WellKnownDirectory.rs @@ -0,0 +1,20 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `WellKnownDirectory` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WellKnownDirectory`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WellKnownDirectory { + Desktop = "desktop", + Documents = "documents", + Downloads = "downloads", + Music = "music", + Pictures = "pictures", + Videos = "videos", +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index e7540b80818..9d4d08354c8 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -2301,6 +2301,84 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`, `Window`*"] pub fn scroll_to_with_scroll_to_options(this: &Window, options: &ScrollToOptions); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showDirectoryPicker)] + #[doc = "The `showDirectoryPicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showDirectoryPicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_directory_picker(this: &Window) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DirectoryPickerOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showDirectoryPicker)] + #[doc = "The `showDirectoryPicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showDirectoryPicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_directory_picker_with_options( + this: &Window, + options: &DirectoryPickerOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showOpenFilePicker)] + #[doc = "The `showOpenFilePicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_open_file_picker(this: &Window) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "OpenFilePickerOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showOpenFilePicker)] + #[doc = "The `showOpenFilePicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_open_file_picker_with_options( + this: &Window, + options: &OpenFilePickerOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showSaveFilePicker)] + #[doc = "The `showSaveFilePicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_save_file_picker(this: &Window) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SaveFilePickerOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = showSaveFilePicker)] + #[doc = "The `showSaveFilePicker()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn show_save_file_picker_with_options( + this: &Window, + options: &SaveFilePickerOptions, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = stop)] #[doc = "The `stop()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index cc817704a40..c3bb7d92089 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -1804,6 +1804,13 @@ mod gen_Directory; #[allow(unused_imports)] pub use gen_Directory::*; +#[cfg(feature = "DirectoryPickerOptions")] +#[allow(non_snake_case)] +mod gen_DirectoryPickerOptions; +#[cfg(feature = "DirectoryPickerOptions")] +#[allow(unused_imports)] +pub use gen_DirectoryPickerOptions::*; + #[cfg(feature = "DisplayMediaStreamConstraints")] #[allow(non_snake_case)] mod gen_DisplayMediaStreamConstraints; @@ -2469,6 +2476,20 @@ mod gen_FileList; #[allow(unused_imports)] pub use gen_FileList::*; +#[cfg(feature = "FilePickerAcceptType")] +#[allow(non_snake_case)] +mod gen_FilePickerAcceptType; +#[cfg(feature = "FilePickerAcceptType")] +#[allow(unused_imports)] +pub use gen_FilePickerAcceptType::*; + +#[cfg(feature = "FilePickerOptions")] +#[allow(non_snake_case)] +mod gen_FilePickerOptions; +#[cfg(feature = "FilePickerOptions")] +#[allow(unused_imports)] +pub use gen_FilePickerOptions::*; + #[cfg(feature = "FilePropertyBag")] #[allow(non_snake_case)] mod gen_FilePropertyBag; @@ -2595,6 +2616,27 @@ mod gen_FileSystemHandleKind; #[allow(unused_imports)] pub use gen_FileSystemHandleKind::*; +#[cfg(feature = "FileSystemHandlePermissionDescriptor")] +#[allow(non_snake_case)] +mod gen_FileSystemHandlePermissionDescriptor; +#[cfg(feature = "FileSystemHandlePermissionDescriptor")] +#[allow(unused_imports)] +pub use gen_FileSystemHandlePermissionDescriptor::*; + +#[cfg(feature = "FileSystemPermissionDescriptor")] +#[allow(non_snake_case)] +mod gen_FileSystemPermissionDescriptor; +#[cfg(feature = "FileSystemPermissionDescriptor")] +#[allow(unused_imports)] +pub use gen_FileSystemPermissionDescriptor::*; + +#[cfg(feature = "FileSystemPermissionMode")] +#[allow(non_snake_case)] +mod gen_FileSystemPermissionMode; +#[cfg(feature = "FileSystemPermissionMode")] +#[allow(unused_imports)] +pub use gen_FileSystemPermissionMode::*; + #[cfg(feature = "FileSystemReadWriteOptions")] #[allow(non_snake_case)] mod gen_FileSystemReadWriteOptions; @@ -6046,6 +6088,13 @@ mod gen_OffscreenCanvasRenderingContext2d; #[allow(unused_imports)] pub use gen_OffscreenCanvasRenderingContext2d::*; +#[cfg(feature = "OpenFilePickerOptions")] +#[allow(non_snake_case)] +mod gen_OpenFilePickerOptions; +#[cfg(feature = "OpenFilePickerOptions")] +#[allow(unused_imports)] +pub use gen_OpenFilePickerOptions::*; + #[cfg(feature = "OpenWindowEventDetail")] #[allow(non_snake_case)] mod gen_OpenWindowEventDetail; @@ -7726,6 +7775,13 @@ mod gen_RtcrtpStreamStats; #[allow(unused_imports)] pub use gen_RtcrtpStreamStats::*; +#[cfg(feature = "SaveFilePickerOptions")] +#[allow(non_snake_case)] +mod gen_SaveFilePickerOptions; +#[cfg(feature = "SaveFilePickerOptions")] +#[allow(unused_imports)] +pub use gen_SaveFilePickerOptions::*; + #[cfg(feature = "Scheduler")] #[allow(non_snake_case)] mod gen_Scheduler; @@ -10568,6 +10624,13 @@ mod gen_WebglMultiDraw; #[allow(unused_imports)] pub use gen_WebglMultiDraw::*; +#[cfg(feature = "WellKnownDirectory")] +#[allow(non_snake_case)] +mod gen_WellKnownDirectory; +#[cfg(feature = "WellKnownDirectory")] +#[allow(unused_imports)] +pub use gen_WellKnownDirectory::*; + #[cfg(feature = "WgslLanguageFeatures")] #[allow(non_snake_case)] mod gen_WgslLanguageFeatures; diff --git a/crates/web-sys/webidls/enabled/FileSystemAccess.webidl b/crates/web-sys/webidls/enabled/FileSystemHandle.webidl similarity index 100% rename from crates/web-sys/webidls/enabled/FileSystemAccess.webidl rename to crates/web-sys/webidls/enabled/FileSystemHandle.webidl diff --git a/crates/web-sys/webidls/unstable/FileSystemAccess.webidl b/crates/web-sys/webidls/unstable/FileSystemAccess.webidl new file mode 100644 index 00000000000..066dc3cd4f5 --- /dev/null +++ b/crates/web-sys/webidls/unstable/FileSystemAccess.webidl @@ -0,0 +1,70 @@ +enum FileSystemPermissionMode { + "read", + "readwrite" +}; + +dictionary FileSystemPermissionDescriptor : PermissionDescriptor { + required FileSystemHandle handle; + FileSystemPermissionMode mode = "read"; +}; + +dictionary FileSystemHandlePermissionDescriptor { + FileSystemPermissionMode mode = "read"; +}; + +[Exposed=(Window,Worker), SecureContext, Serializable] +partial interface FileSystemHandle { + Promise queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); + Promise requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); +}; + +enum WellKnownDirectory { + "desktop", + "documents", + "downloads", + "music", + "pictures", + "videos", +}; + +typedef (WellKnownDirectory or FileSystemHandle) StartInDirectory; + +dictionary FilePickerAcceptType { + USVString description = ""; + record)> accept; +}; + +dictionary FilePickerOptions { + sequence types; + boolean excludeAcceptAllOption = false; + DOMString id; + StartInDirectory startIn; +}; + +dictionary OpenFilePickerOptions : FilePickerOptions { + boolean multiple = false; +}; + +dictionary SaveFilePickerOptions : FilePickerOptions { + USVString? suggestedName; +}; + +dictionary DirectoryPickerOptions { + DOMString id; + StartInDirectory startIn; + FileSystemPermissionMode mode = "read"; +}; + +[SecureContext] +partial interface Window { + [Throws] + Promise> showOpenFilePicker(optional OpenFilePickerOptions options = {}); + [Throws] + Promise showSaveFilePicker(optional SaveFilePickerOptions options = {}); + [Throws] + Promise showDirectoryPicker(optional DirectoryPickerOptions options = {}); +}; + +partial interface DataTransferItem { + Promise getAsFileSystemHandle(); +}; From 034fb355c36ad6351ab2ef9a0acb2427a6f00116 Mon Sep 17 00:00:00 2001 From: Gabriel Grant Date: Thu, 25 Jan 2024 00:11:35 -0800 Subject: [PATCH 342/641] Add step to update CHANGELOG in publishing.md (#3765) --- guide/src/contributing/publishing.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/guide/src/contributing/publishing.md b/guide/src/contributing/publishing.md index 0eedb7d88aa..ca302dd079a 100644 --- a/guide/src/contributing/publishing.md +++ b/guide/src/contributing/publishing.md @@ -13,9 +13,11 @@ ./publish bump ``` -3. Send a pull request for the version bump. +3. Update CHANGELOG.md to add the to-be-released version number, compare URL and release date. [See this example](https://github.com/rustwasm/wasm-bindgen/commit/0b5f0eec2f3d5e75a923fd67ef14b3b5cc855c80#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed) -4. After the pull request's CI is green and it has been +4. Send a pull request for the version bump. + +5. After the pull request's CI is green and it has been merged, publish to cargo: ``` From acef364c7ed4d4a32e31f00a7a834d03c4900eb7 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 25 Jan 2024 20:05:55 +1100 Subject: [PATCH 343/641] Shrink JS-allocated strings down to the correct size before passing them to Rust (#3808) * Shrink JS-allocated strings down to the correct size before passing them to Rust Fixes #3801. I opted to solve it this way rather than just pass the capacity to Rust as well because it means the allocation isn't up to 3x bigger than it needs to be anymore. I also removed a TODO about fixing that. * Update reference tests * Add changelog entry --- CHANGELOG.md | 5 +++++ crates/cli-support/src/js/mod.rs | 6 +----- crates/cli/tests/reference/string-arg.js | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ba0b93fa3..da0f386a3c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,11 @@ * Deprecate `wasm_bindgen_test_configure!`s `run_in_worker` in favor of `run_in_dedicated_worker`. [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804) +### Fixed + +* Fixed UB when freeing strings received from JS if not using the default allocator. + [#3808](https://github.com/rustwasm/wasm-bindgen/pull/3808) + ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90) Released 2024-01-06 diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index ee1c4790ff8..5a5ebfee527 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1296,11 +1296,6 @@ impl<'a> Context<'a> { mem = mem, ); - // TODO: - // When converting a JS string to UTF-8, the maximum size is `arg.length * 3`, - // so we just allocate that. This wastes memory, so we should investigate - // looping over the string to calculate the precise size, or perhaps using - // `shrink_to_fit` on the Rust side. self.global(&format!( "function {name}(arg, malloc, realloc) {{ {debug} @@ -1314,6 +1309,7 @@ impl<'a> Context<'a> { const ret = encodeString(arg, view); {debug_end} offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; }} WASM_VECTOR_LEN = offset; diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index 8c006997f9d..7ce1a4db2f3 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -75,6 +75,7 @@ function passStringToWasm0(arg, malloc, realloc) { const ret = encodeString(arg, view); offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; } WASM_VECTOR_LEN = offset; From c1945151e3616327cb4950116671e980316c2aef Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 26 Jan 2024 02:04:55 +0100 Subject: [PATCH 344/641] Run `cargo publich` on deployment (#3811) --- .github/workflows/bump.yml | 55 -------------------------------------- .github/workflows/main.yml | 9 ++++++- 2 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/bump.yml diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml deleted file mode 100644 index 89e43bf7172..00000000000 --- a/.github/workflows/bump.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Bump packages - -permissions: - contents: write - -on: - workflow_dispatch: - inputs: - action: - description: 'bump or publish' - required: true - default: 'bump' - type: choice - options: - - bump - - publish - -jobs: - bump: - permissions: - contents: write - pull-requests: write - - runs-on: ubuntu-latest - if: github.event.inputs.action == 'bump' - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - name: configure git - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - - run: rustc publish.rs - - run: git checkout -b bump - - run: printf "bump versions for release\n\n" > /tmp/bump - - run: ./publish bump >> /tmp/bump - - run: git add . - - run: git commit -m "bump" - - run: git push origin bump - - run: gh pr create --fill --body-file /tmp/bump - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - publish: - runs-on: ubuntu-latest - if: github.event.inputs.action == 'publish' - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - run: rustc publish.rs - - name: assert we're on bump branch - run: test "$(git branch --show-current)" = "bump" - - run: ./publish publish - env: - CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4ba9447102..117e538f16b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -462,7 +462,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - run: rustup update --no-self-update nightly && rustup default nightly - uses: actions/download-artifact@v3 with: path: artifacts @@ -518,3 +517,11 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: "gh-release/*.tar.gz*" + - uses: dtolnay/rust-toolchain@stable + if: startsWith(github.ref, 'refs/tags/') + - run: rustc publish.rs + if: startsWith(github.ref, 'refs/tags/') + - run: ./publish publish + if: startsWith(github.ref, 'refs/tags/') + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} From fb518d3b190ca8885dbac5e149ce1bbef3d8a92b Mon Sep 17 00:00:00 2001 From: Akiomi Kamakura Date: Fri, 26 Jan 2024 18:20:47 +0900 Subject: [PATCH 345/641] Fix example code in guide (#3813) --- guide/src/reference/passing-rust-closures-to-js.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/src/reference/passing-rust-closures-to-js.md b/guide/src/reference/passing-rust-closures-to-js.md index 0c1574003c8..f370154ab83 100644 --- a/guide/src/reference/passing-rust-closures-to-js.md +++ b/guide/src/reference/passing-rust-closures-to-js.md @@ -82,7 +82,7 @@ as arguments and returns. #[wasm_bindgen] extern "C" { fn setInterval(closure: &Closure, millis: u32) -> f64; - fn cancelInterval(token: f64); + fn clearInterval(token: f64); #[wasm_bindgen(js_namespace = console)] fn log(s: &str); @@ -109,10 +109,10 @@ impl Interval { } } -// When the Interval is destroyed, cancel its `setInterval` timer. +// When the Interval is destroyed, clear its `setInterval` timer. impl Drop for Interval { fn drop(&mut self) { - cancelInterval(self.token); + clearInterval(self.token); } } From b1047882dcc3ac984485a518b1899670efcc3aa8 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 30 Jan 2024 06:26:37 -0500 Subject: [PATCH 346/641] chore(webgpu)!: update to latest WebGPU IDL as of 2024-01-30 (#3816) --- CHANGELOG.md | 3 + crates/web-sys/src/features/gen_GpuAdapter.rs | 14 --- .../src/features/gen_GpuCommandEncoder.rs | 12 -- .../src/features/gen_GpuDepthStencilState.rs | 12 +- .../src/features/gen_GpuFragmentState.rs | 7 +- .../src/features/gen_GpuProgrammableStage.rs | 3 +- .../gen_GpuRenderPassColorAttachment.rs | 21 ++++ .../gen_GpuShaderModuleCompilationHint.rs | 30 +++-- .../features/gen_GpuShaderModuleDescriptor.rs | 21 ++++ .../features/gen_GpuStorageTextureAccess.rs | 2 + .../src/features/gen_GpuTextureFormat.rs | 1 + .../src/features/gen_GpuVertexFormat.rs | 1 + .../src/features/gen_GpuVertexState.rs | 3 +- crates/web-sys/webidls/unstable/WebGPU.webidl | 116 ++++++++++-------- 14 files changed, 142 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da0f386a3c5..3d7c633bfc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Deprecate `wasm_bindgen_test_configure!`s `run_in_worker` in favor of `run_in_dedicated_worker`. [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804) +* Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods. + [#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816) + ### Fixed * Fixed UB when freeing strings received from JS if not using the default allocator. diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 47d9b96b106..760614c78ef 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -63,20 +63,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)] - #[doc = "The `requestAdapterInfo()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn request_adapter_info_with_unmask_hints( - this: &GpuAdapter, - unmask_hints: &::wasm_bindgen::JsValue, - ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index bc9e5860e8e..5e8deb5d8e7 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -515,18 +515,6 @@ extern "C" { destination_offset: f64, ); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = writeTimestamp)] - #[doc = "The `writeTimestamp()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/writeTimestamp)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuQuerySet`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_timestamp(this: &GpuCommandEncoder, query_set: &GpuQuerySet, query_index: u32); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs index 19454864785..8869e1ce387 100644 --- a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs +++ b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs @@ -17,22 +17,16 @@ extern "C" { } #[cfg(web_sys_unstable_apis)] impl GpuDepthStencilState { - #[cfg(all(feature = "GpuCompareFunction", feature = "GpuTextureFormat",))] + #[cfg(feature = "GpuTextureFormat")] #[doc = "Construct a new `GpuDepthStencilState`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuDepthStencilState`, `GpuTextureFormat`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuTextureFormat`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new( - depth_compare: GpuCompareFunction, - depth_write_enabled: bool, - format: GpuTextureFormat, - ) -> Self { + pub fn new(format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.depth_compare(depth_compare); - ret.depth_write_enabled(depth_write_enabled); ret.format(format); ret } diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 01045694c41..4b2fe1e5080 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -24,14 +24,9 @@ impl GpuFragmentState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new( - entry_point: &str, - module: &GpuShaderModule, - targets: &::wasm_bindgen::JsValue, - ) -> Self { + pub fn new(module: &GpuShaderModule, targets: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret.targets(targets); ret diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index c36ee597e27..7934d6afdc1 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -24,10 +24,9 @@ impl GpuProgrammableStage { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(entry_point: &str, module: &GpuShaderModule) -> Self { + pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index e02f53ad529..513ba98d251 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -58,6 +58,27 @@ impl GpuRenderPassColorAttachment { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `depthSlice` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn depth_slice(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("depthSlice"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuLoadOp")] #[doc = "Change the `loadOp` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index f33ce1b1db4..1793d68dcbf 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -23,12 +23,34 @@ impl GpuShaderModuleCompilationHint { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { + pub fn new(entry_point: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.entry_point(entry_point); ret } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entry_point(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("entryPoint"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `layout` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] @@ -47,9 +69,3 @@ impl GpuShaderModuleCompilationHint { self } } -#[cfg(web_sys_unstable_apis)] -impl Default for GpuShaderModuleCompilationHint { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index 73fe9f040ee..74255136180 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -64,6 +64,27 @@ impl GpuShaderModuleDescriptor { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `compilationHints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("compilationHints"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sourceMap` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] diff --git a/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs b/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs index e68ce7b3ca9..e0069d0992f 100644 --- a/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs +++ b/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs @@ -12,4 +12,6 @@ use wasm_bindgen::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuStorageTextureAccess { WriteOnly = "write-only", + ReadOnly = "read-only", + ReadWrite = "read-write", } diff --git a/crates/web-sys/src/features/gen_GpuTextureFormat.rs b/crates/web-sys/src/features/gen_GpuTextureFormat.rs index cc2be609a29..5b67dce2fdf 100644 --- a/crates/web-sys/src/features/gen_GpuTextureFormat.rs +++ b/crates/web-sys/src/features/gen_GpuTextureFormat.rs @@ -36,6 +36,7 @@ pub enum GpuTextureFormat { Bgra8unorm = "bgra8unorm", Bgra8unormSrgb = "bgra8unorm-srgb", Rgb9e5ufloat = "rgb9e5ufloat", + Rgb10a2uint = "rgb10a2uint", Rgb10a2unorm = "rgb10a2unorm", Rg11b10ufloat = "rg11b10ufloat", Rg32uint = "rg32uint", diff --git a/crates/web-sys/src/features/gen_GpuVertexFormat.rs b/crates/web-sys/src/features/gen_GpuVertexFormat.rs index 509357ff20c..783adc5387f 100644 --- a/crates/web-sys/src/features/gen_GpuVertexFormat.rs +++ b/crates/web-sys/src/features/gen_GpuVertexFormat.rs @@ -41,4 +41,5 @@ pub enum GpuVertexFormat { Sint32x2 = "sint32x2", Sint32x3 = "sint32x3", Sint32x4 = "sint32x4", + Unorm1010102 = "unorm10-10-10-2", } diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index a551e1c49a3..aa0259bd31d 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -24,10 +24,9 @@ impl GpuVertexState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(entry_point: &str, module: &GpuShaderModule) -> Self { + pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret } diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 05dd50203d5..32397b6e27b 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -3,10 +3,10 @@ interface mixin GPUObjectBase { }; dictionary GPUObjectDescriptorBase { - USVString label; + USVString label = ""; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension1D; readonly attribute unsigned long maxTextureDimension2D; @@ -42,17 +42,17 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxComputeWorkgroupsPerDimension; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSupportedFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface WGSLLanguageFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUAdapterInfo { readonly attribute DOMString vendor; readonly attribute DOMString architecture; @@ -66,7 +66,7 @@ interface mixin NavigatorGPU { Navigator includes NavigatorGPU; WorkerNavigator includes NavigatorGPU; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPU { Promise requestAdapter(optional GPURequestAdapterOptions options = {}); GPUTextureFormat getPreferredCanvasFormat(); @@ -83,14 +83,14 @@ enum GPUPowerPreference { "high-performance", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUAdapter { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); - Promise requestAdapterInfo(optional sequence unmaskHints = []); + Promise requestAdapterInfo(); }; dictionary GPUDeviceDescriptor @@ -114,7 +114,7 @@ enum GPUFeatureName { "float32-filterable", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; @@ -145,7 +145,7 @@ interface GPUDevice : EventTarget { }; GPUDevice includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBuffer { readonly attribute GPUSize64Out size; readonly attribute GPUFlagsConstant usage; @@ -174,7 +174,7 @@ dictionary GPUBufferDescriptor }; typedef [EnforceRange] unsigned long GPUBufferUsageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUBufferUsage { const GPUFlagsConstant MAP_READ = 0x0001; const GPUFlagsConstant MAP_WRITE = 0x0002; @@ -189,13 +189,13 @@ namespace GPUBufferUsage { }; typedef [EnforceRange] unsigned long GPUMapModeFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); @@ -230,7 +230,7 @@ enum GPUTextureDimension { }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUTextureUsage { const GPUFlagsConstant COPY_SRC = 0x01; const GPUFlagsConstant COPY_DST = 0x02; @@ -239,7 +239,7 @@ namespace GPUTextureUsage { const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUTextureView { }; GPUTextureView includes GPUObjectBase; @@ -302,6 +302,7 @@ enum GPUTextureFormat { "bgra8unorm-srgb", // Packed 32-bit formats "rgb9e5ufloat", + "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", @@ -390,7 +391,7 @@ enum GPUTextureFormat { "astc-12x12-unorm-srgb", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUExternalTexture { }; GPUExternalTexture includes GPUObjectBase; @@ -401,7 +402,7 @@ dictionary GPUExternalTextureDescriptor PredefinedColorSpace colorSpace = "srgb"; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSampler { }; GPUSampler includes GPUObjectBase; @@ -447,7 +448,7 @@ enum GPUCompareFunction { "always", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBindGroupLayout { }; GPUBindGroupLayout includes GPUObjectBase; @@ -469,7 +470,7 @@ dictionary GPUBindGroupLayoutEntry { }; typedef [EnforceRange] unsigned long GPUShaderStageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUShaderStage { const GPUFlagsConstant VERTEX = 0x1; const GPUFlagsConstant FRAGMENT = 0x2; @@ -514,6 +515,8 @@ dictionary GPUTextureBindingLayout { enum GPUStorageTextureAccess { "write-only", + "read-only", + "read-write", }; dictionary GPUStorageTextureBindingLayout { @@ -525,7 +528,7 @@ dictionary GPUStorageTextureBindingLayout { dictionary GPUExternalTextureBindingLayout { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBindGroup { }; GPUBindGroup includes GPUObjectBase; @@ -549,7 +552,7 @@ dictionary GPUBufferBinding { GPUSize64 size; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUPipelineLayout { }; GPUPipelineLayout includes GPUObjectBase; @@ -559,7 +562,7 @@ dictionary GPUPipelineLayoutDescriptor required sequence bindGroupLayouts; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUShaderModule { Promise getCompilationInfo(); }; @@ -569,10 +572,11 @@ dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; object sourceMap; - record hints; + sequence compilationHints = []; }; dictionary GPUShaderModuleCompilationHint { + required USVString entryPoint; (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; @@ -582,7 +586,7 @@ enum GPUCompilationMessageType { "info", }; -[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] interface GPUCompilationMessage { readonly attribute DOMString message; readonly attribute GPUCompilationMessageType type; @@ -592,12 +596,12 @@ interface GPUCompilationMessage { readonly attribute unsigned long long length; }; -[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] interface GPUCompilationInfo { readonly attribute FrozenArray messages; }; -[Exposed=(Window, DedicatedWorker), SecureContext, Serializable] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext, Serializable] interface GPUPipelineError : DOMException { constructor(DOMString message, GPUPipelineErrorInit options); readonly attribute GPUPipelineErrorReason reason; @@ -627,13 +631,13 @@ interface mixin GPUPipelineBase { dictionary GPUProgrammableStage { required GPUShaderModule module; - required USVString entryPoint; + USVString entryPoint; record constants; }; -typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled. +typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled. -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUComputePipeline { }; GPUComputePipeline includes GPUObjectBase; @@ -644,7 +648,7 @@ dictionary GPUComputePipelineDescriptor required GPUProgrammableStage compute; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderPipeline { }; GPURenderPipeline includes GPUObjectBase; @@ -712,7 +716,7 @@ dictionary GPUBlendState { }; typedef [EnforceRange] unsigned long GPUColorWriteFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUColorWrite { const GPUFlagsConstant RED = 0x1; const GPUFlagsConstant GREEN = 0x2; @@ -754,8 +758,8 @@ enum GPUBlendOperation { dictionary GPUDepthStencilState { required GPUTextureFormat format; - required boolean depthWriteEnabled; - required GPUCompareFunction depthCompare; + boolean depthWriteEnabled; + GPUCompareFunction depthCompare; GPUStencilFaceState stencilFront = {}; GPUStencilFaceState stencilBack = {}; @@ -822,6 +826,7 @@ enum GPUVertexFormat { "sint32x2", "sint32x3", "sint32x4", + "unorm10-10-10-2", }; enum GPUVertexStepMode { @@ -871,13 +876,21 @@ dictionary GPUImageCopyTextureTagged boolean premultipliedAlpha = false; }; +typedef (ImageBitmap or + ImageData or + HTMLImageElement or + HTMLVideoElement or + VideoFrame or + HTMLCanvasElement or + OffscreenCanvas) GPUImageCopyExternalImageSource; + dictionary GPUImageCopyExternalImage { - required (ImageBitmap or HTMLVideoElement or HTMLCanvasElement or OffscreenCanvas) source; + required GPUImageCopyExternalImageSource source; GPUOrigin2D origin = {}; boolean flipY = false; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCommandBuffer { }; GPUCommandBuffer includes GPUObjectBase; @@ -889,7 +902,7 @@ dictionary GPUCommandBufferDescriptor interface mixin GPUCommandsMixin { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); @@ -921,8 +934,6 @@ interface GPUCommandEncoder { optional GPUSize64 offset = 0, optional GPUSize64 size); - undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); - undefined resolveQuerySet( GPUQuerySet querySet, GPUSize32 firstQuery, @@ -956,7 +967,7 @@ interface mixin GPUDebugCommandsMixin { undefined insertDebugMarker(USVString markerLabel); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUComputePassEncoder { undefined setPipeline(GPUComputePipeline pipeline); undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); @@ -980,7 +991,7 @@ dictionary GPUComputePassDescriptor GPUComputePassTimestampWrites timestampWrites; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, float width, float height, @@ -1021,6 +1032,7 @@ dictionary GPURenderPassDescriptor dictionary GPURenderPassColorAttachment { required GPUTextureView view; + GPUIntegerCoordinate depthSlice; GPUTextureView resolveTarget; GPUColor clearValue; @@ -1076,7 +1088,7 @@ interface mixin GPURenderCommandsMixin { undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderBundle { }; GPURenderBundle includes GPUObjectBase; @@ -1085,7 +1097,7 @@ dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderBundleEncoder { GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; @@ -1105,7 +1117,7 @@ dictionary GPUQueueDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUQueue { undefined submit(sequence commandBuffers); @@ -1131,7 +1143,7 @@ interface GPUQueue { }; GPUQueue includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUQuerySet { undefined destroy(); @@ -1151,7 +1163,7 @@ enum GPUQueryType { "timestamp", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCanvasContext { readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; @@ -1180,7 +1192,7 @@ enum GPUDeviceLostReason { "destroyed", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUDeviceLostInfo { readonly attribute GPUDeviceLostReason reason; readonly attribute DOMString message; @@ -1190,24 +1202,24 @@ partial interface GPUDevice { readonly attribute Promise lost; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUError { readonly attribute DOMString message; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUValidationError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUOutOfMemoryError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUInternalError : GPUError { constructor(DOMString message); @@ -1224,7 +1236,7 @@ partial interface GPUDevice { Promise popErrorScope(); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUUncapturedErrorEvent : Event { constructor( DOMString type, @@ -1238,7 +1250,7 @@ dictionary GPUUncapturedErrorEventInit : EventInit { }; partial interface GPUDevice { - [Exposed=(Window, DedicatedWorker)] + [Exposed=(Window, DedicatedWorker, ServiceWorker)] attribute EventHandler onuncapturederror; }; From 305cb25cbda96152a6af9fd47674c699929a50fa Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 31 Jan 2024 22:40:37 +0100 Subject: [PATCH 347/641] Fixed temporary folder detection on MacOS (#3817) --- CHANGELOG.md | 3 +++ .../src/bin/wasm-bindgen-test-runner/main.rs | 25 +++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7c633bfc7..f51e847c4f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Fixed UB when freeing strings received from JS if not using the default allocator. [#3808](https://github.com/rustwasm/wasm-bindgen/pull/3808) +* Fixed temporary folder detection by `wasm-bindgen-test-runner` on MacOS. + [#3817](https://github.com/rustwasm/wasm-bindgen/pull/3817) + ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90) Released 2024-01-06 diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 88d5bc686d9..06d386119ed 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -88,19 +88,18 @@ fn main() -> anyhow::Result<()> { // - a tmp directory, generated by rustdoc // we would like a directory we have write access to. if we assume cargo-like directories, // we end up with the path `/wbg-out` - let tmpdir = if wasm_file_to_test - .to_string_lossy() - .starts_with("/tmp/rustdoc") - { - wasm_file_to_test.parent() // chop off the file name and give us the /tmp/rustdoc directory - } else { - wasm_file_to_test - .parent() // chop off file name - .and_then(|p| p.parent()) // chop off `deps` - .and_then(|p| p.parent()) // chop off `debug` - } - .map(|p| p.join(format!("wbg-tmp-{}", file_name))) - .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; + let wasm_file_str = wasm_file_to_test.to_string_lossy(); + let tmpdir = + if wasm_file_str.starts_with("/tmp/rustdoc") || wasm_file_str.starts_with("/var/folders") { + wasm_file_to_test.parent() // chop off the file name and give us the /tmp/rustdoc directory + } else { + wasm_file_to_test + .parent() // chop off file name + .and_then(|p| p.parent()) // chop off `deps` + .and_then(|p| p.parent()) // chop off `debug` + } + .map(|p| p.join(format!("wbg-tmp-{}", file_name))) + .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; // Make sure there's no stale state from before drop(fs::remove_dir_all(&tmpdir)); From 9e699ac45dc1b0ee318fdec7741e47531f5bb0d0 Mon Sep 17 00:00:00 2001 From: Martin <16228305+maartin0@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:44:39 +0000 Subject: [PATCH 348/641] Add deployment note for first `wasm-pack build --target web` example (#3819) --- guide/src/examples/without-a-bundler.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/guide/src/examples/without-a-bundler.md b/guide/src/examples/without-a-bundler.md index fed2ad9445d..5cd4c5da9bb 100644 --- a/guide/src/examples/without-a-bundler.md +++ b/guide/src/examples/without-a-bundler.md @@ -35,9 +35,25 @@ Otherwise the rest of the deployment magic happens in `index.html`: {{#include ../../../examples/without-a-bundler/index.html}} ``` +> **Note**: You cannot directly open `index.html` in your web browser due to [CORS][cors] +> limitations. Instead, you can set up a quick development environment using +> Python's built-in HTTP server: +> ```sh +> wasm-pack build --target web +> python3 -m http.server 8080 +> ``` +> If you don't have Python installed, you can also use [miniserve][miniserve] which +> is installable via Cargo: +> ```sh +> cargo install miniserve +> miniserve . --index "index.html" -p 8080 +> ``` + And that's it! Be sure to read up on the [deployment options][deployment] to see what it means to deploy without a bundler. +[cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS +[miniserve]: https://crates.io/crates/miniserve [deployment]: ../reference/deployment.html ## Using the older `--target no-modules` From 1f019db03ae2eee37e6ef848faeb61a19c4be630 Mon Sep 17 00:00:00 2001 From: G2 <72430668+G2-Games@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:53:19 -0600 Subject: [PATCH 349/641] Enabled and auto generated `forget()` method for `UsbDevice` (#3821) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_UsbDevice.rs | 11 +++++++++++ crates/web-sys/webidls/unstable/WebUSB.webidl | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f51e847c4f5..6bebf0116a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Introduce environment variable `WASM_BINDGEN_TEST_NO_ORIGIN_ISOLATION` to disable origin isolation for `wasm-bindgen-test-runner`. [#3807](https://github.com/rustwasm/wasm-bindgen/pull/3807) +* Add bindings for `USBDevice.forget()`. + [#3821](https://github.com/rustwasm/wasm-bindgen/pull/3821) + ### Changed * Stabilize `ClipboardEvent`. diff --git a/crates/web-sys/src/features/gen_UsbDevice.rs b/crates/web-sys/src/features/gen_UsbDevice.rs index bb8194405eb..5bedd76cc51 100644 --- a/crates/web-sys/src/features/gen_UsbDevice.rs +++ b/crates/web-sys/src/features/gen_UsbDevice.rs @@ -306,6 +306,17 @@ extern "C" { data: &mut [u8], ) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = forget)] + #[doc = "The `forget()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/forget)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn forget(this: &UsbDevice) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = isochronousTransferIn)] #[doc = "The `isochronousTransferIn()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/unstable/WebUSB.webidl b/crates/web-sys/webidls/unstable/WebUSB.webidl index 17b9676fc1a..a337ae1f9eb 100644 --- a/crates/web-sys/webidls/unstable/WebUSB.webidl +++ b/crates/web-sys/webidls/unstable/WebUSB.webidl @@ -62,6 +62,7 @@ interface USBDevice { readonly attribute FrozenArray configurations; readonly attribute boolean opened; Promise open(); + Promise forget(); Promise close(); Promise selectConfiguration(octet configurationValue); Promise claimInterface(octet interfaceNumber); @@ -240,4 +241,4 @@ dictionary USBPermissionStorage { [Exposed=(DedicatedWorker,SharedWorker,Window)] interface USBPermissionResult : PermissionStatus { attribute FrozenArray devices; -}; \ No newline at end of file +}; From 1f7942dfdb64680f485c94c16cf967b5cfa3b6b1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 5 Feb 2024 08:53:57 +0100 Subject: [PATCH 350/641] Fix `#[wasm_bindgen(js_name = default)]` for module imports (#3823) --- CHANGELOG.md | 3 ++ crates/macro-support/src/parser.rs | 53 ++++++++++++++++++------------ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bebf0116a3..af1bbb8eb71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,9 @@ * Fixed temporary folder detection by `wasm-bindgen-test-runner` on MacOS. [#3817](https://github.com/rustwasm/wasm-bindgen/pull/3817) +* Fixed using `#[wasm_bindgen(js_name = default)]` with `#[wasm_bindgen(module = ...)]`. + [#3823](https://github.com/rustwasm/wasm-bindgen/pull/3823) + ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90) Released 2024-01-06 diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 39ab459f864..eee4f66e95d 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -505,6 +505,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option for syn::ItemFn { false, None, false, + None, )?; attrs.check_used(); Ok(ret.0) } } -pub(crate) fn is_js_keyword(keyword: &str) -> bool { - JS_KEYWORDS.contains(&keyword) +pub(crate) fn is_js_keyword(keyword: &str, skip: Option<&[&str]>) -> bool { + JS_KEYWORDS + .iter() + .filter(|keyword| skip.filter(|skip| skip.contains(keyword)).is_none()) + .any(|this| *this == keyword) } /// Construct a function (and gets the self type if appropriate) for our AST from a syn function. @@ -814,6 +819,7 @@ fn function_from_decl( allow_self: bool, self_ty: Option<&Ident>, is_from_impl: bool, + skip_keywords: Option<&[&str]>, ) -> Result<(ast::Function, Option), Diagnostic> { if sig.variadic.is_some() { bail_span!(sig.variadic, "can't #[wasm_bindgen] variadic functions"); @@ -852,7 +858,7 @@ fn function_from_decl( let replace_colliding_arg = |i: &mut syn::PatType| { if let syn::Pat::Ident(ref mut i) = *i.pat { let ident = i.ident.to_string(); - if is_js_keyword(ident.as_str()) { + if is_js_keyword(ident.as_str(), skip_keywords) { i.ident = Ident::new(format!("_{}", ident).as_str(), i.ident.span()); } } @@ -889,29 +895,33 @@ fn function_from_decl( syn::ReturnType::Type(_, ty) => Some(replace_self(*ty)), }; - let (name, name_span, renamed_via_js_name) = if let Some((js_name, js_name_span)) = - opts.js_name() - { - let kind = operation_kind(opts); - let prefix = match kind { - OperationKind::Setter(_) => "set_", - _ => "", - }; - let name = if prefix.is_empty() && opts.method().is_none() && is_js_keyword(js_name) { - format!("_{}", js_name) + let (name, name_span, renamed_via_js_name) = + if let Some((js_name, js_name_span)) = opts.js_name() { + let kind = operation_kind(opts); + let prefix = match kind { + OperationKind::Setter(_) => "set_", + _ => "", + }; + let name = if prefix.is_empty() + && opts.method().is_none() + && is_js_keyword(js_name, skip_keywords) + { + format!("_{}", js_name) + } else { + format!("{}{}", prefix, js_name) + }; + (name, js_name_span, true) } else { - format!("{}{}", prefix, js_name) - }; - (name, js_name_span, true) - } else { - let name = - if !is_from_impl && opts.method().is_none() && is_js_keyword(&decl_name.to_string()) { + let name = if !is_from_impl + && opts.method().is_none() + && is_js_keyword(&decl_name.to_string(), skip_keywords) + { format!("_{}", decl_name) } else { decl_name.to_string() }; - (name, decl_name.span(), false) - }; + (name, decl_name.span(), false) + }; Ok(( ast::Function { arguments, @@ -1188,6 +1198,7 @@ impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn { true, Some(class), true, + None, )?; let method_kind = if opts.constructor().is_some() { ast::MethodKind::Constructor From 3e469b265464e60645f7eceb5745fa2558aea703 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 5 Feb 2024 09:01:50 +0100 Subject: [PATCH 351/641] Deprecate `--weak-refs` in favor of run-time detection (#3822) * Deprecate `--weak-refs` in favor of run-time detection * Generate empty functions instead * Fix integration tests * Improve `Closure::into_js_value()` docs --- .github/workflows/main.yml | 7 -- CHANGELOG.md | 3 + crates/cli-support/src/js/mod.rs | 79 +++++++---------------- crates/cli-support/src/lib.rs | 9 --- crates/cli/src/bin/wasm-bindgen.rs | 5 +- crates/cli/tests/reference/builder.js | 8 ++- crates/cli/tests/reference/constructor.js | 6 +- guide/src/reference/cli.md | 9 --- guide/src/reference/weak-references.md | 14 ++-- src/closure.rs | 16 ++--- 10 files changed, 50 insertions(+), 106 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 117e538f16b..233af6fb532 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,14 +90,7 @@ jobs: - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures - run: cargo test --target wasm32-unknown-unknown --test wasm env: - WASM_BINDGEN_WEAKREF: 1 - - run: cargo test --target wasm32-unknown-unknown --test wasm - env: - WASM_BINDGEN_WEAKREF: 1 WASM_BINDGEN_NO_DEBUG: 1 - - run: cargo test --target wasm32-unknown-unknown --test wasm --features serde-serialize - env: - WASM_BINDGEN_WEAKREF: 1 - run: cargo test --target wasm32-unknown-unknown env: WASM_BINDGEN_EXTERNREF: 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index af1bbb8eb71..0a73f06b206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,9 @@ * Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods. [#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816) +* Depreate `--weak-refs` and `WASM_BINDGEN_WEAKREF` in favor of automatic run-time detection. + [#3822](https://github.com/rustwasm/wasm-bindgen/pull/3822) + ### Fixed * Fixed UB when freeing strings received from JS if not using the default allocator. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 5a5ebfee527..2e7744874b4 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -921,18 +921,12 @@ impl<'a> Context<'a> { " static __wrap(ptr) {{ ptr = ptr >>> 0; - const obj = Object.create({}.prototype); + const obj = Object.create({name}.prototype); obj.__wbg_ptr = ptr; - {} + {name}Finalization.register(obj, obj.__wbg_ptr, obj); return obj; }} - ", - name, - if self.config.weak_refs { - format!("{}Finalization.register(obj, obj.__wbg_ptr, obj);", name) - } else { - String::new() - }, + " )); } @@ -950,13 +944,13 @@ impl<'a> Context<'a> { )); } - if self.config.weak_refs { - self.global(&format!( - "const {}Finalization = new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));", - name, - wasm_bindgen_shared::free_function(name), - )); - } + self.global(&format!( + " + const {name}Finalization = (typeof FinalizationRegistry === 'undefined') + ? {{ register: () => {{}}, unregister: () => {{}} }} + : new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));", + wasm_bindgen_shared::free_function(name), + )); // If the class is inspectable, generate `toJSON` and `toString` // to expose all readable properties of the class. Otherwise, @@ -1021,7 +1015,7 @@ impl<'a> Context<'a> { __destroy_into_raw() {{ const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; - {} + {name}Finalization.unregister(this); return ptr; }} @@ -1030,11 +1024,6 @@ impl<'a> Context<'a> { wasm.{}(ptr); }} ", - if self.config.weak_refs { - format!("{}Finalization.unregister(this);", name) - } else { - String::new() - }, wasm_bindgen_shared::free_function(name), )); ts_dst.push_str(" free(): void;\n"); @@ -2121,15 +2110,7 @@ impl<'a> Context<'a> { let table = self.export_function_table()?; - let (register, unregister) = if self.config.weak_refs { - self.expose_closure_finalization()?; - ( - "CLOSURE_DTORS.register(real, state, state);", - "CLOSURE_DTORS.unregister(state)", - ) - } else { - ("", "") - }; + self.expose_closure_finalization()?; // For mutable closures they can't be invoked recursively. // To handle that we swap out the `this.a` pointer with zero @@ -2152,20 +2133,17 @@ impl<'a> Context<'a> { }} finally {{ if (--state.cnt === 0) {{ wasm.{table}.get(state.dtor)(a, state.b); - {unregister} + CLOSURE_DTORS.unregister(state); }} else {{ state.a = a; }} }} }}; real.original = state; - {register} + CLOSURE_DTORS.register(real, state, state); return real; }} ", - table = table, - register = register, - unregister = unregister, )); Ok(()) @@ -2178,15 +2156,7 @@ impl<'a> Context<'a> { let table = self.export_function_table()?; - let (register, unregister) = if self.config.weak_refs { - self.expose_closure_finalization()?; - ( - "CLOSURE_DTORS.register(real, state, state);", - "CLOSURE_DTORS.unregister(state)", - ) - } else { - ("", "") - }; + self.expose_closure_finalization()?; // For shared closures they can be invoked recursively so we // just immediately pass through `this.a`. If we end up @@ -2208,18 +2178,15 @@ impl<'a> Context<'a> { if (--state.cnt === 0) {{ wasm.{table}.get(state.dtor)(state.a, state.b); state.a = 0; - {unregister} + CLOSURE_DTORS.unregister(state); }} }} }}; real.original = state; - {register} + CLOSURE_DTORS.register(real, state, state); return real; }} ", - table = table, - register = register, - unregister = unregister, )); Ok(()) @@ -2229,15 +2196,15 @@ impl<'a> Context<'a> { if !self.should_write_global("closure_finalization") { return Ok(()); } - assert!(self.config.weak_refs); let table = self.export_function_table()?; self.global(&format!( " - const CLOSURE_DTORS = new FinalizationRegistry(state => {{ - wasm.{}.get(state.dtor)(state.a, state.b) - }}); - ", - table + const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') + ? {{ register: () => {{}}, unregister: () => {{}} }} + : new FinalizationRegistry(state => {{ + wasm.{table}.get(state.dtor)(state.a, state.b) + }}); + " )); Ok(()) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index ee07fe86b28..c3e24bd2ff1 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -35,9 +35,6 @@ pub struct Bindgen { remove_producers_section: bool, omit_default_module_path: bool, emit_start: bool, - // Experimental support for weakrefs, an upcoming ECMAScript feature. - // Currently only enable-able through an env var. - weak_refs: bool, // Support for the wasm threads proposal, transforms the wasm module to be // "ready to be instantiated on any thread" threads: wasm_bindgen_threads_xform::Config, @@ -106,7 +103,6 @@ impl Bindgen { remove_name_section: false, remove_producers_section: false, emit_start: true, - weak_refs: env::var("WASM_BINDGEN_WEAKREF").is_ok(), threads: threads_config(), externref, multi_value, @@ -126,11 +122,6 @@ impl Bindgen { self } - pub fn weak_refs(&mut self, enable: bool) -> &mut Bindgen { - self.weak_refs = enable; - self - } - pub fn reference_types(&mut self, enable: bool) -> &mut Bindgen { self.externref = enable; self diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index 74d29a1611a..78d9e1bd6be 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -39,7 +39,7 @@ Options: --nodejs Deprecated, use `--target nodejs` --web Deprecated, use `--target web` --no-modules Deprecated, use `--target no-modules` - --weak-refs Enable usage of the JS weak references proposal + --weak-refs Deprecated, is runtime-detected --reference-types Enable usage of WebAssembly reference types -V --version Print the version number of wasm-bindgen @@ -126,9 +126,6 @@ fn rmain(args: &Args) -> Result<(), Error> { .omit_imports(args.flag_omit_imports) .omit_default_module_path(args.flag_omit_default_module_path) .split_linked_modules(args.flag_split_linked_modules); - if let Some(true) = args.flag_weak_refs { - b.weak_refs(true); - } if let Some(true) = args.flag_reference_types { b.reference_types(true); } diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js index 3402667dd0d..6db7eb3fbf0 100644 --- a/crates/cli/tests/reference/builder.js +++ b/crates/cli/tests/reference/builder.js @@ -23,6 +23,10 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } + +const ClassBuilderFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_classbuilder_free(ptr >>> 0)); /** */ export class ClassBuilder { @@ -31,14 +35,14 @@ export class ClassBuilder { ptr = ptr >>> 0; const obj = Object.create(ClassBuilder.prototype); obj.__wbg_ptr = ptr; - + ClassBuilderFinalization.register(obj, obj.__wbg_ptr, obj); return obj; } __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; - + ClassBuilderFinalization.unregister(this); return ptr; } diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js index 1973256e15c..a485efbe747 100644 --- a/crates/cli/tests/reference/constructor.js +++ b/crates/cli/tests/reference/constructor.js @@ -23,6 +23,10 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } + +const ClassConstructorFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_classconstructor_free(ptr >>> 0)); /** */ export class ClassConstructor { @@ -30,7 +34,7 @@ export class ClassConstructor { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; - + ClassConstructorFinalization.unregister(this); return ptr; } diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index 0d66d5cd7f1..f7377ae7abf 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -84,15 +84,6 @@ When generating bundler-compatible code (see the section on [deployment]) this indicates that the bundled code is always intended to go into a browser so a few checks for Node.js can be elided. -### `--weak-refs` - -Enables usage of the [TC39 Weak References -proposal](https://github.com/tc39/proposal-weakrefs), ensuring that all Rust -memory is eventually deallocated regardless of whether you're calling `free` or -not. This is off-by-default while we're waiting for support to percolate into -all major browsers. For more information see the [documentation about weak -references](./weak-references.md). - ### `--reference-types` Enables usage of the [WebAssembly References Types diff --git a/guide/src/reference/weak-references.md b/guide/src/reference/weak-references.md index 00e7fc328ad..5e3cfa92049 100644 --- a/guide/src/reference/weak-references.md +++ b/guide/src/reference/weak-references.md @@ -1,9 +1,8 @@ # Support for Weak References -By default wasm-bindgen does not use the [TC39 weak references -proposal](https://github.com/tc39/proposal-weakrefs). This proposal just -advanced to stage 4 at the time of this writing, but it will still stake some -time for support to percolate into all the major browsers. +By default wasm-bindgen does use the [TC39 weak references +proposal](https://github.com/tc39/proposal-weakrefs) if support is detected. +At the time of this writing all major browsers do support it. Without weak references your JS integration may be susceptible to memory leaks in Rust, for example: @@ -15,9 +14,8 @@ in Rust, for example: * Rust closures have `Closure::{into_js_value,forget}` methods which explicitly do not free the underlying memory. -These issues are all solved with the weak references proposal in JS. The -`--weak-refs` flag to the `wasm-bindgen` CLI will enable usage of -`FinalizationRegistry` to ensure that all memory is cleaned up, regardless of +These issues are all solved with the weak references proposal in JS. +`FinalizationRegistry` will ensure that all memory is cleaned up, regardless of whether it's explicitly deallocated or not. Note that explicit deallocation is always a possibility and supported, but if it's not called then memory will -still be automatically deallocated with the `--weak-refs` flag. +still be automatically deallocated if `FinalizationRegistry` support is detected. diff --git a/src/closure.rs b/src/closure.rs index 319f4c63c24..430cee5df05 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -356,16 +356,12 @@ where /// lifetime dynamically managed by the JS GC. This function can be used /// to drop this `Closure` while keeping the associated JS function still /// valid. - /// - /// By default this function will leak memory. This can be dangerous if this - /// function is called many times in an application because the memory leak - /// will overwhelm the page quickly and crash the wasm. - /// - /// If the browser, however, supports weak references, then this function - /// will not leak memory. Instead the Rust memory will be reclaimed when the - /// JS closure is GC'd. Weak references are not enabled by default since - /// they're still a proposal for the JS standard. They can be enabled with - /// `WASM_BINDGEN_WEAKREF=1` when running `wasm-bindgen`, however. + /// + /// If the platform supports weak references, the Rust memory will be + /// reclaimed when the JS closure is GC'd. If weak references is not + /// supported, this can be dangerous if this function is called many times + /// in an application because the memory leak will overwhelm the page + /// quickly and crash the wasm. pub fn into_js_value(self) -> JsValue { let idx = self.js.idx; mem::forget(self); From 22f84e3b1cc270f179ab26a1e543a228e315553f Mon Sep 17 00:00:00 2001 From: Daniel Bergey Date: Tue, 6 Feb 2024 04:39:39 -0500 Subject: [PATCH 352/641] readme: build badge for Github actions, not Azure pipeline (#3825) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be034243c61..9b1728cfe6e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- Build Status + Build Status Crates.io version Download docs.rs docs From 4b6ef26f8a1dc1cd62329918dbe646cf9c142113 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 6 Feb 2024 11:20:08 +0100 Subject: [PATCH 353/641] Fixed nighly build of `wasm-bindgen-futures` (#3827) --- .github/workflows/main.yml | 4 ++-- CHANGELOG.md | 3 +++ crates/futures/src/lib.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 233af6fb532..457b09cf550 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -103,7 +103,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: rustup default nightly-2023-05-08 + - run: rustup default nightly-2024-02-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. @@ -283,7 +283,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: rustup default nightly-2023-05-08 + - run: rustup default nightly-2024-02-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a73f06b206..2ff30f9eeef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ * Fixed using `#[wasm_bindgen(js_name = default)]` with `#[wasm_bindgen(module = ...)]`. [#3823](https://github.com/rustwasm/wasm-bindgen/pull/3823) +* Fixed nighly build of `wasm-bindgen-futures`. + [#3827](https://github.com/rustwasm/wasm-bindgen/pull/3827) + ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90) Released 2024-01-06 diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 8a02a51bc39..a44ec7c6d27 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -30,7 +30,7 @@ //! systems and make sure that Rust/JavaScript can work together with //! asynchronous and I/O work. -#![cfg_attr(target_feature = "atomics", feature(stdsimd))] +#![cfg_attr(target_feature = "atomics", feature(stdarch_wasm_atomic_wait))] #![deny(missing_docs)] use js_sys::Promise; From fe8bc949b5553ca6da811f13209d9f3b86cc5b1e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 6 Feb 2024 12:37:22 +0100 Subject: [PATCH 354/641] Prepare v0.2.91 release (#3829) --- CHANGELOG.md | 4 +++- Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 10 +++++----- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-audio-worklet/Cargo.toml | 6 +++--- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- 50 files changed, 108 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff30f9eeef..20c87a0e073 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) + +Released 2024-02-06 ### Added diff --git a/Cargo.toml b/Cargo.toml index b1faa4e8e6a..08cd2dfaa8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -42,15 +42,15 @@ xxx_debug_only_print_generated_code = [ ] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.90" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.91" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.67' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.40' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.40' } +js-sys = { path = 'crates/js-sys', version = '0.3.68' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.41' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.41' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 8be4e953a1f..b2dccbbbc4a 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -23,4 +23,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 0dae8e03959..ec12dc3dbdc 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -20,10 +20,10 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.20.2" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.90' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.90' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.90' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.90' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.90' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.90' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.91' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.91' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.91' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.91' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.91' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.91' } unicode-ident = "1.0.5" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index e7d09100875..81f27693583 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -34,8 +34,8 @@ ureq = { version = "2.7", default-features = false, features = [ "gzip", ] } walrus = { version = "0.20.2", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.90" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.91" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index d1082290d09..0b5f80f3779 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index f5462b2a351..860e6d741db 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,14 +7,14 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.40" +version = "0.4.41" edition = "2018" rust-version = "1.57" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.67' } -wasm-bindgen = { path = "../..", version = '0.2.90' } +js-sys = { path = "../js-sys", version = '0.3.68' } +wasm-bindgen = { path = "../..", version = '0.2.91' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -29,6 +29,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.40' } +wasm-bindgen-test = { path = '../test', version = '0.3.41' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 80a940af9c0..ca5f849f85b 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.67" +version = "0.3.68" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -20,9 +20,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.90" } +wasm-bindgen = { path = "../..", version = "0.2.91" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.40' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.40' } -web-sys = { path = "../web-sys", version = "0.3.67", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.41' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } +web-sys = { path = "../web-sys", version = "0.3.68", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 1ba1c8717b8..6a13463b9be 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -21,5 +21,5 @@ strict-macro = [] syn = { version = '2.0', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.90" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.90" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.91" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index ae7a3044ced..46ceac29a36 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -21,11 +21,11 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.90" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.91" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.90" } -wasm-bindgen-futures = { path = "../futures", version = "0.4.40" } -web-sys = { path = "../web-sys", version = "0.3.67", features = ["Worker"] } +wasm-bindgen = { path = "../..", version = "0.2.91" } +wasm-bindgen-futures = { path = "../futures", version = "0.4.41" } +web-sys = { path = "../web-sys", version = "0.3.68", features = ["Worker"] } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index a03bf6f5688..dd6a7a0e6f4 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index eb2ab22c3b4..a5d90fcda60 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 0acca18e48f..4dccf097327 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.40" +version = "0.3.41" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT OR Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 51c1a59ca0e..d7f5dc0794a 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.40" +version = "0.3.41" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT OR Apache-2.0" @@ -10,11 +10,11 @@ rust-version = "1.57" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.67' } +js-sys = { path = '../js-sys', version = '0.3.68' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.90' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.40' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.40' } +wasm-bindgen = { path = '../..', version = '0.2.91' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.41' } gg-alloc = { version = "1.0", optional = true } [lib] diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 220e8022dff..e55df83bfdb 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -15,7 +15,7 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" walrus = "0.20.2" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.90" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.91" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 234d499fada..aee55476b0c 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 94d33d3b134..5f53464da0f 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.90" +version = "0.2.91" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" @@ -16,7 +16,7 @@ rust-version = "1.57" anyhow = "1.0" log = "0.4" walrus = "0.20.2" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.90" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.91" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 55dfc9fcaf7..11f287f5c24 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.67" +version = "0.3.68" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -22,12 +22,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.90" } -js-sys = { path = '../js-sys', version = '0.3.67' } +wasm-bindgen = { path = "../..", version = "0.2.91" } +js-sys = { path = '../js-sys', version = '0.3.68' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.40' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.40' } +wasm-bindgen-test = { path = '../test', version = '0.3.41' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index b5183178e88..d004298a23f 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -21,7 +21,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.90", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.91", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index 41b635908f5..cdeabc31055 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index e1afecc8037..d0088cc344c 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 6f61f63f079..c848952902a 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 6e37abd8332..1021f1a35cd 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -js-sys = "0.3.67" +wasm-bindgen = "0.2.91" +js-sys = "0.3.68" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index c1ee13c313f..64f5939909e 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -9,5 +9,5 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -web-sys = { version = "0.3.67", features = ['console'] } +wasm-bindgen = "0.2.91" +web-sys = { version = "0.3.68", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 37c916928f4..d2a17d0d6fe 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index f559e374d83..4556a2c7eb5 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index 9d58b57d083..c5f6b1d6108 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index f7ff31cf775..0f6e74688f5 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -9,9 +9,9 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -js-sys = "0.3.67" -wasm-bindgen-futures = "0.4.40" +wasm-bindgen = "0.2.91" +js-sys = "0.3.68" +wasm-bindgen-futures = "0.4.41" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 1a0658499b2..c61262759d7 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -9,5 +9,5 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -js-sys = "0.3.67" +wasm-bindgen = "0.2.91" +js-sys = "0.3.68" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 64d83ba5e8d..5ea4ba06bdc 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 599ac18164b..cd87a9b86dc 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 9a54e10ede6..e16590c3782 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 1786bdaf536..e4a108d5672 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 38c62cd05bd..46aa55a156e 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 2b8ff0b86ea..ebdf77b6037 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -10,14 +10,14 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.67" +js-sys = "0.3.68" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.4.3" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = "0.2.90" -wasm-bindgen-futures = "0.4.40" +wasm-bindgen = "0.2.91" +wasm-bindgen-futures = "0.4.41" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index f0455d2407c..69a7ace580b 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index db5a4a735fd..bdf4115e491 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index ce7a6bd3b40..e8966679a0f 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -12,8 +12,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index d9575a9dd31..1bcbe841bae 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] console_log = "0.2.0" -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" -wasm-bindgen-futures = "0.4.40" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" +wasm-bindgen-futures = "0.4.41" [dependencies.web-sys] version = "0.3.59" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index efdab87936e..5431abe2766 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -9,6 +9,6 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -js-sys = "0.3.67" -wasm-bindgen-futures = "0.4.40" +wasm-bindgen = "0.2.91" +js-sys = "0.3.68" +wasm-bindgen-futures = "0.4.41" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 13a307d5e23..b2a8e4837d7 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -9,6 +9,6 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" -js-sys = "0.3.67" -wasm-bindgen-futures = "0.4.40" +wasm-bindgen = "0.2.91" +js-sys = "0.3.68" +wasm-bindgen-futures = "0.4.41" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 25769363e80..8314c662b1e 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 29e8eef312a..d36f812dd9f 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 1e76e800573..628c24be45a 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -16,7 +16,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 03b440dc89f..a49681852c9 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index bab7b4cff03..c1452b377f9 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 7f7fbca4339..32fcd5dd78d 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -9,9 +9,9 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" js-sys = "0.3" -wasm-bindgen-futures = "0.4.40" +wasm-bindgen-futures = "0.4.41" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 0cfd4214a33..97f537d4800 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index c934e4c8b5e..1ed18c404e5 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -10,9 +10,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.67" -wasm-bindgen = "0.2.90" -wasm-bindgen-futures = "0.4.40" +js-sys = "0.3.68" +wasm-bindgen = "0.2.91" +wasm-bindgen-futures = "0.4.41" [dependencies.web-sys] version = "0.3.37" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 3d7a30ba77d..b55ed46122c 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.90" +wasm-bindgen = "0.2.91" [dependencies.web-sys] version = "0.3.4" From b56728f0f46473e648b31719af2b8013db83e024 Mon Sep 17 00:00:00 2001 From: logist322 <53333039+logist322@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:04:56 +0400 Subject: [PATCH 355/641] Add `RTCRtpTransceiver.setCodecPreferences()` (#3828) --- CHANGELOG.md | 5 ++++- .../features/gen_RtcRtpEncodingParameters.rs | 21 +++++++++++++++++++ .../src/features/gen_RtcRtpTransceiver.rs | 7 +++++++ .../webidls/enabled/RTCRtpTransceiver.webidl | 3 +-- .../webidls/unstable/RTCRtpSender.webidl | 3 +++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 crates/web-sys/webidls/unstable/RTCRtpSender.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c87a0e073..8282284769f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ Released 2024-02-06 ### Added +* Added bindings for the `RTCRtpTransceiver.setCodecPreferences()` and unstable bindings for the `RTCRtpEncodingParameters.scalabilityMode`. + [#3828](https://github.com/rustwasm/wasm-bindgen/pull/3828) + * Add unstable bindings for the FileSystemAccess API [#3810](https://github.com/rustwasm/wasm-bindgen/pull/3810) -* Added support for running tests in shared and service workers with ``wasm_bindgen_test_configure!` `run_in_shared_worker` and `run_in_service_worker`. +* Added support for running tests in shared and service workers with `wasm_bindgen_test_configure!` `run_in_shared_worker` and `run_in_service_worker`. [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804) * Accept the `--skip` flag with `wasm-bindgen-test-runner`. diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index a872f8a33f0..4bafe39090c 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -128,6 +128,27 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scalability_mode(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("scalabilityMode"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[doc = "Change the `scaleResolutionDownBy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs index 98be39537ff..8b8fca690bb 100644 --- a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs @@ -73,6 +73,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"] pub fn get_remote_track_id(this: &RtcRtpTransceiver) -> String; + # [wasm_bindgen (method , structural , js_class = "RTCRtpTransceiver" , js_name = setCodecPreferences)] + #[doc = "The `setCodecPreferences()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/setCodecPreferences)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"] + pub fn set_codec_preferences(this: &RtcRtpTransceiver, codecs: &::wasm_bindgen::JsValue); # [wasm_bindgen (method , structural , js_class = "RTCRtpTransceiver" , js_name = stop)] #[doc = "The `stop()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl index fb8d594d741..4c89a032b4c 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl @@ -33,8 +33,7 @@ interface RTCRtpTransceiver { readonly attribute RTCRtpTransceiverDirection? currentDirection; undefined stop(); - // TODO: bug 1396922 - // undefined setCodecPreferences(sequence codecs); + undefined setCodecPreferences(sequence codecs); [ChromeOnly] undefined setRemoteTrackId(DOMString trackId); diff --git a/crates/web-sys/webidls/unstable/RTCRtpSender.webidl b/crates/web-sys/webidls/unstable/RTCRtpSender.webidl new file mode 100644 index 00000000000..b1b5eb39f7d --- /dev/null +++ b/crates/web-sys/webidls/unstable/RTCRtpSender.webidl @@ -0,0 +1,3 @@ +partial dictionary RTCRtpEncodingParameters { + DOMString scalabilityMode; +}; From 8198d2d25920e1f4fc593e9f8eb9d199e004d731 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 6 Feb 2024 20:21:27 +0100 Subject: [PATCH 356/641] Fix crates.io secret --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 457b09cf550..70693dd1e7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -517,4 +517,4 @@ jobs: - run: ./publish publish if: startsWith(github.ref, 'refs/tags/') env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_PUBLISH_TOKEN }} From 0d2d56cc5e8b057f678fa64f18056bb6076b61cf Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Thu, 8 Feb 2024 11:17:33 +0100 Subject: [PATCH 357/641] Update actions/checkout in GitHub Actions workflows to v4 (#3837) --- .github/workflows/main.yml | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 70693dd1e7e..6ab213d78d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check @@ -34,7 +34,7 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: cargo check --all @@ -43,7 +43,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings @@ -77,7 +77,7 @@ jobs: env: WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -102,7 +102,7 @@ jobs: name: "Run wasm-bindgen crate tests with multithreading enabled" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup default nightly-2024-02-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src @@ -117,7 +117,7 @@ jobs: # name: "Run wasm-bindgen crate tests (Windows)" # runs-on: windows-latest # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - run: rustup update --no-self-update stable && rustup default stable # - run: rustup target add wasm32-unknown-unknown # - uses: actions/setup-node@v3 @@ -138,7 +138,7 @@ jobs: name: Run native tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -158,7 +158,7 @@ jobs: name: "Run web-sys crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -178,7 +178,7 @@ jobs: name: "Verify that web-sys is compiled correctly" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml - run: git diff --exit-code @@ -187,7 +187,7 @@ jobs: name: "Run js-sys crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -203,7 +203,7 @@ jobs: name: "Run wasm-bindgen-webidl crate tests" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -221,7 +221,7 @@ jobs: name: "Test TypeScript output of wasm-bindgen" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: actions/setup-node@v3 @@ -233,7 +233,7 @@ jobs: name: "Build and test the deno example" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - uses: denoland/setup-deno@v1 @@ -245,7 +245,7 @@ jobs: name: Run UI compile-fail tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update 1.69.0 && rustup default 1.69.0 - run: cargo test -p wasm-bindgen-macro - run: cargo test -p wasm-bindgen-test-macro @@ -253,7 +253,7 @@ jobs: build_examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f @@ -282,7 +282,7 @@ jobs: build_nightly: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup default nightly-2024-02-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src @@ -303,7 +303,7 @@ jobs: - build_nightly runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v3 with: name: examples1 @@ -320,7 +320,7 @@ jobs: build_benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown @@ -333,7 +333,7 @@ jobs: dist_linux_x86_64_musl: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add x86_64-unknown-linux-musl - run: sudo apt update -y && sudo apt install musl-tools -y @@ -350,7 +350,7 @@ jobs: dist_linux_aarch64_gnu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add aarch64-unknown-linux-gnu - run: sudo apt update -y && sudo apt install gcc-aarch64-linux-gnu -y @@ -366,7 +366,7 @@ jobs: dist_macos_x86_64: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: @@ -379,7 +379,7 @@ jobs: dist_macos_aarch64: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add aarch64-apple-darwin - run: | @@ -394,7 +394,7 @@ jobs: dist_windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: @@ -407,7 +407,7 @@ jobs: doc_book: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar xzf - echo $PWD >> $GITHUB_PATH @@ -420,7 +420,7 @@ jobs: doc_api: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup update --no-self-update nightly && rustup default nightly - run: cargo doc --no-deps --features 'serde-serialize' - run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml @@ -452,7 +452,7 @@ jobs: - build_benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/download-artifact@v3 From 6eecd5b62461e183dd81a1a0dfc6a046737a4176 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Thu, 8 Feb 2024 11:18:17 +0100 Subject: [PATCH 358/641] Update actions/setup-node in GitHub Actions workflows to v4 (#3838) --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ab213d78d1..4db634ba4ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,7 +80,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - uses: ./.github/actions/setup-geckodriver @@ -120,7 +120,7 @@ jobs: # - uses: actions/checkout@v4 # - run: rustup update --no-self-update stable && rustup default stable # - run: rustup target add wasm32-unknown-unknown - # - uses: actions/setup-node@v3 + # - uses: actions/setup-node@v4 # with: # node-version: '20' # - uses: ./.github/actions/setup-geckodriver @@ -141,7 +141,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - run: cargo test @@ -161,7 +161,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - uses: ./.github/actions/setup-geckodriver @@ -190,7 +190,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - uses: ./.github/actions/setup-geckodriver @@ -206,7 +206,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - run: cargo test -p wasm-bindgen-webidl @@ -224,7 +224,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '20' - run: cd crates/typescript-tests && ./run.sh From 1f12124a60629f178ba65eea0785e3941d34827e Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Thu, 8 Feb 2024 11:19:01 +0100 Subject: [PATCH 359/641] Update setup-geckodriver action to use Node.js 20 (#3839) --- .github/actions/setup-geckodriver/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-geckodriver/action.yml b/.github/actions/setup-geckodriver/action.yml index 40611a1d536..89dd42cad35 100644 --- a/.github/actions/setup-geckodriver/action.yml +++ b/.github/actions/setup-geckodriver/action.yml @@ -2,5 +2,5 @@ name: 'Setup Geckodriver' description: 'Setup Geckodriver' runs: - using: node16 + using: node20 main: 'main.js' From e9cb333116c02310ef3712b41f3e61ee8bb32b80 Mon Sep 17 00:00:00 2001 From: evdokimovs <49490279+evdokimovs@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:15:23 +0100 Subject: [PATCH 360/641] Add `RtcPeerConnectionIceErrorEvent` WebAPI (#3835) --- CHANGELOG.md | 17 +++++++ crates/web-sys/Cargo.toml | 1 + .../gen_RtcPeerConnectionIceErrorEvent.rs | 50 +++++++++++++++++++ crates/web-sys/src/features/mod.rs | 7 +++ .../RTCPeerConnectionIceErrorEvent.webidl | 18 +++++++ 5 files changed, 93 insertions(+) create mode 100644 crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs create mode 100644 crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 8282284769f..1650b86efb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Added + +* Add bindings for `RTCPeerConnectionIceErrorEvent`. + [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835) + +-------------------------------------------------------------------------------- + ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) Released 2024-02-06 @@ -56,6 +65,8 @@ Released 2024-02-06 * Fixed nighly build of `wasm-bindgen-futures`. [#3827](https://github.com/rustwasm/wasm-bindgen/pull/3827) +-------------------------------------------------------------------------------- + ## [0.2.90](https://github.com/rustwasm/wasm-bindgen/compare/0.2.89...0.2.90) Released 2024-01-06 @@ -98,6 +109,8 @@ Released 2024-01-06 `RtcLifecycleEvent` and `WebrtcGlobalStatisticsReport` features. [#3723](https://github.com/rustwasm/wasm-bindgen/pull/3723) +-------------------------------------------------------------------------------- + ## [0.2.89](https://github.com/rustwasm/wasm-bindgen/compare/0.2.88...0.2.89) Released 2023-11-27. @@ -126,6 +139,8 @@ Released 2023-11-27. * Removed Gecko-internal dictionary bindings `Csp`, `CspPolicies`, `CspReport` and `CspReportProperties`. [#3721](https://github.com/rustwasm/wasm-bindgen/pull/3721) +-------------------------------------------------------------------------------- + ## [0.2.88](https://github.com/rustwasm/wasm-bindgen/compare/0.2.87...0.2.88) Released 2023-11-01 @@ -290,6 +305,8 @@ Released 2023-11-01 * Removed `GetNotificationOptions`, `NotificationBehavior` and `Notification.get()` because they don't exist anymore. +-------------------------------------------------------------------------------- + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 11f287f5c24..66ce7b01134 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1102,6 +1102,7 @@ RtcOfferAnswerOptions = [] RtcOfferOptions = [] RtcOutboundRtpStreamStats = [] RtcPeerConnection = ["EventTarget"] +RtcPeerConnectionIceErrorEvent = ["Event"] RtcPeerConnectionIceEvent = ["Event"] RtcPeerConnectionIceEventInit = [] RtcPeerConnectionState = [] diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs new file mode 100644 index 00000000000..fd0fc4a29ac --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs @@ -0,0 +1,50 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = RTCPeerConnectionIceErrorEvent , typescript_type = "RTCPeerConnectionIceErrorEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcPeerConnectionIceErrorEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub type RtcPeerConnectionIceErrorEvent; + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = address)] + #[doc = "Getter for the `address` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/address)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub fn address(this: &RtcPeerConnectionIceErrorEvent) -> Option; + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = port)] + #[doc = "Getter for the `port` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/port)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub fn port(this: &RtcPeerConnectionIceErrorEvent) -> Option; + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = url)] + #[doc = "Getter for the `url` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/url)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub fn url(this: &RtcPeerConnectionIceErrorEvent) -> String; + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = errorCode)] + #[doc = "Getter for the `errorCode` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorCode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub fn error_code(this: &RtcPeerConnectionIceErrorEvent) -> u16; + # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = errorText)] + #[doc = "Getter for the `errorText` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorText)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] + pub fn error_text(this: &RtcPeerConnectionIceErrorEvent) -> String; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index c3bb7d92089..9e5d51569e5 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -7495,6 +7495,13 @@ mod gen_RtcPeerConnection; #[allow(unused_imports)] pub use gen_RtcPeerConnection::*; +#[cfg(feature = "RtcPeerConnectionIceErrorEvent")] +#[allow(non_snake_case)] +mod gen_RtcPeerConnectionIceErrorEvent; +#[cfg(feature = "RtcPeerConnectionIceErrorEvent")] +#[allow(unused_imports)] +pub use gen_RtcPeerConnectionIceErrorEvent::*; + #[cfg(feature = "RtcPeerConnectionIceEvent")] #[allow(non_snake_case)] mod gen_RtcPeerConnectionIceEvent; diff --git a/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl b/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl new file mode 100644 index 00000000000..91e148ca8e5 --- /dev/null +++ b/crates/web-sys/webidls/enabled/RTCPeerConnectionIceErrorEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceerrorevent + */ + +[Exposed=Window] +interface RTCPeerConnectionIceErrorEvent : Event { + constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict); + readonly attribute DOMString? address; + readonly attribute unsigned short? port; + readonly attribute DOMString url; + readonly attribute unsigned short errorCode; + readonly attribute USVString errorText; +}; From 114a4a198c824a0bb6ff7429337f7f8badb0f03e Mon Sep 17 00:00:00 2001 From: Thomas Etter Date: Thu, 8 Feb 2024 22:24:33 +0100 Subject: [PATCH 361/641] Add a typescript test (not just a compile test) for enums (#3740) --- crates/typescript-tests/jest.config.cjs | 17 ++++++++-- crates/typescript-tests/src/enums.ts | 41 +++++++++++++++++-------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/crates/typescript-tests/jest.config.cjs b/crates/typescript-tests/jest.config.cjs index c63e1456977..2db7cd7178d 100644 --- a/crates/typescript-tests/jest.config.cjs +++ b/crates/typescript-tests/jest.config.cjs @@ -4,8 +4,21 @@ module.exports = { testEnvironment: 'node', extensionsToTreatAsEsm: [".ts"], verbose: true, - // TODO: match all test files - testMatch: ['**/src/simple_struct.ts', '**/src/typescript_type.ts'], + testMatch: ['**/src/*.ts'], + // TODO: migrate all test files and remove this + testPathIgnorePatterns: [ + ".*/src/custom_section.ts$", + ".*/src/getters_setters.ts$", + ".*/src/inspectable.ts$", + ".*/src/memory.ts$", + ".*/src/omit_definition.ts$", + ".*/src/optional_fields.ts$", + ".*/src/opt_args_and_ret.ts$", + ".*/src/simple_async_fn.ts$", + ".*/src/simple_fn.ts$", + ".*/src/web_sys.ts$", + ".*/src/usize.ts$" + ], injectGlobals: false, globals: { 'ts-jest': diff --git a/crates/typescript-tests/src/enums.ts b/crates/typescript-tests/src/enums.ts index ea246fc847a..595586bee95 100644 --- a/crates/typescript-tests/src/enums.ts +++ b/crates/typescript-tests/src/enums.ts @@ -1,13 +1,28 @@ -import * as wbg from '../pkg/typescript_tests'; - -const a1: wbg.Foo = wbg.Foo.A; -const a2: wbg.Foo.A = wbg.Foo.A; -const a3: wbg.Foo.A = 1; -const b1: wbg.Foo = wbg.Foo.B; -const b2: wbg.Foo.B = wbg.Foo.B; -const b3: wbg.Foo.B = 3; - -const fn_expects_enum: (_: wbg.Foo) => void = wbg.fn_expects_enum; -const fn_returns_enum: () => wbg.Foo = wbg.fn_returns_enum; -const fn_expects_option_enum: (_?: wbg.Foo) => void = wbg.fn_expects_option_enum; -const fn_returns_option_enum: () => wbg.Foo | undefined = wbg.fn_returns_option_enum; +import * as wbg from "../pkg/typescript_tests"; +import { expect, jest, test } from "@jest/globals"; + +test("construction", () => { + const a1: wbg.Foo = wbg.Foo.A; + const a2: wbg.Foo.A = wbg.Foo.A; + expect(a1).toStrictEqual(a2); + const a3: wbg.Foo.A = 1; + expect(a1).toStrictEqual(a3); + + const b1: wbg.Foo = wbg.Foo.B; + const b2: wbg.Foo.B = wbg.Foo.B; + expect(b1).toStrictEqual(b2); + const b3: wbg.Foo.B = 3; + expect(b1).toStrictEqual(b3); + expect(a1).not.toStrictEqual(b1); +}); + +test("function calls", () => { + const fn_expects_enum: (_: wbg.Foo) => void = wbg.fn_expects_enum; + const fn_returns_enum: () => wbg.Foo = wbg.fn_returns_enum; + const fn_expects_option_enum: (_?: wbg.Foo) => void = wbg.fn_expects_option_enum; + const fn_returns_option_enum: () => wbg.Foo | undefined = wbg.fn_returns_option_enum; + + fn_expects_enum(wbg.Foo.B); + expect(fn_returns_enum()).toStrictEqual(wbg.Foo.A); + expect(fn_returns_option_enum()).toStrictEqual(wbg.Foo.A); +}); From 9f1d1188cab0c9ad54df734a7945dbdcd0fe67b1 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 9 Feb 2024 12:30:25 +0100 Subject: [PATCH 362/641] Update actions/upload-artifact + actions/download-artifact to v4 (#3842) --- .github/workflows/main.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4db634ba4ac..d5e26e66731 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -274,7 +274,7 @@ jobs: done env: RUSTFLAGS: --cfg=web_sys_unstable_apis - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: examples1 path: exbuild @@ -292,7 +292,7 @@ jobs: ./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir ) || exit 1; done - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: examples2 path: exbuild @@ -304,11 +304,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: examples1 path: exbuild - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: examples2 path: exbuild @@ -325,7 +325,7 @@ jobs: - run: rustup target add wasm32-unknown-unknown - run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown - run: cargo run -p wasm-bindgen-cli -- target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm --out-dir benchmarks/pkg --target web - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: benchmarks path: benchmarks @@ -342,7 +342,7 @@ jobs: strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen-test-runner strip -g target/x86_64-unknown-linux-musl/release/wasm2es6js - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: dist_linux_x86_64_musl path: "target/x86_64-unknown-linux-musl/release/wasm*" @@ -358,7 +358,7 @@ jobs: cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-gnu --features vendored-openssl --release env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: dist_linux_aarch64_gnu path: "target/aarch64-unknown-linux-gnu/release/wasm*" @@ -371,7 +371,7 @@ jobs: - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: dist_macos_x86_64 path: "target/release/wasm*" @@ -386,7 +386,7 @@ jobs: cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-apple-darwin --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: dist_macos_aarch64 path: "target/aarch64-apple-darwin/release/wasm*" @@ -399,7 +399,7 @@ jobs: - run: cargo build --manifest-path crates/cli/Cargo.toml --release env: RUSTFLAGS: -Ctarget-feature=+crt-static - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: dist_windows path: "target/release/wasm*" @@ -412,7 +412,7 @@ jobs: curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar xzf - echo $PWD >> $GITHUB_PATH - run: (cd guide && mdbook build) - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: doc_book path: guide/book/html @@ -429,7 +429,7 @@ jobs: RUSTDOCFLAGS: --cfg=web_sys_unstable_apis - run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml - run: tar czvf docs.tar.gz target/doc - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: doc_api path: docs.tar.gz @@ -455,7 +455,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: path: artifacts - run: find artifacts @@ -484,7 +484,7 @@ jobs: mk x86_64-apple-darwin dist_macos_x86_64 mk aarch64-apple-darwin dist_macos_aarch64 mk x86_64-pc-windows-msvc dist_windows - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: gh-release path: gh-release @@ -496,7 +496,7 @@ jobs: mv artifacts/examples2/* gh-pages/exbuild mv artifacts/benchmarks gh-pages/benchmarks tar czf gh-pages.tar.gz gh-pages - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: gh-pages path: gh-pages.tar.gz From db91cc2a289423b722090008a33da54001e2ec58 Mon Sep 17 00:00:00 2001 From: Daniel Bergey Date: Fri, 9 Feb 2024 16:18:21 -0500 Subject: [PATCH 363/641] readme: also link the guide built from the main branch (#3826) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b1728cfe6e..82a9da42182 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@

- Guide + Guide (main branch) | API Docs | From a396d03d9e2e94186b220ccf0042d4a2e3bbcb6d Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 09:00:36 +0100 Subject: [PATCH 364/641] feat(#3843): Add support for CanvasState.reset (#3844) --- CHANGELOG.md | 3 +++ .../web-sys/src/features/gen_CanvasRenderingContext2d.rs | 7 +++++++ .../src/features/gen_OffscreenCanvasRenderingContext2d.rs | 7 +++++++ .../webidls/enabled/CanvasRenderingContext2D.webidl | 1 + 4 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1650b86efb5..56fb600f0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Add bindings for `RTCPeerConnectionIceErrorEvent`. [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835) +* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. + [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) + -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index c5878c132f0..5d4a7f79c27 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -1266,6 +1266,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn stroke_rect(this: &CanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn reset(this: &CanvasRenderingContext2d); # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = restore)] #[doc = "The `restore()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index aed70a10e68..c795d1a8659 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1222,6 +1222,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn stroke_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn reset(this: &OffscreenCanvasRenderingContext2d); # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = restore)] #[doc = "The `restore()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl index 557246d3333..82157774a2c 100644 --- a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl +++ b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl @@ -131,6 +131,7 @@ interface mixin CanvasState { // state undefined save(); // push state on state stack undefined restore(); // pop state stack and restore state + undefined reset(); // clears the backing buffer, drawing state stack, any defined paths, and styles }; interface mixin CanvasTransform { From 12889ef666f9b355585602e268be2b70d7f3ec80 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Sat, 10 Feb 2024 23:43:24 +0100 Subject: [PATCH 365/641] Update JamesIves/github-pages-deploy-action in GHA workflow to newest v4 (#3841) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5e26e66731..b2851321610 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -500,7 +500,7 @@ jobs: with: name: gh-pages path: gh-pages.tar.gz - - uses: JamesIves/github-pages-deploy-action@v4.4.1 + - uses: JamesIves/github-pages-deploy-action@v4 with: branch: gh-pages folder: gh-pages From 7ce38b42d32d897e2d90f52af5f58b9450f388bf Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 20 Feb 2024 10:59:25 +0100 Subject: [PATCH 366/641] Use single-threaded impl when MT is impossible --- CHANGELOG.md | 5 ++ crates/futures/src/lib.rs | 42 +++++++++++++---- crates/futures/src/queue.rs | 6 +-- crates/futures/src/task/multithread.rs | 45 +++++++++--------- crates/futures/src/task/singlethread.rs | 62 +++++++++++++------------ 5 files changed, 96 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56fb600f0c3..6f449256e10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ * Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) +### Fixed + +* Allow `wasm-bindgen-futures` to run correctly when using the atomics target feature in an environment that has no support for `Atomics.waitAsync()` and without cross-origin isolation. + [#3848](https://github.com/rustwasm/wasm-bindgen/pull/3848) + -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index a44ec7c6d27..0e43314bf1a 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -50,18 +50,40 @@ pub use js_sys; pub use wasm_bindgen; mod task { + use std::future::Future; + use std::pin::Pin; + use cfg_if::cfg_if; - cfg_if! { - if #[cfg(target_feature = "atomics")] { - mod wait_async_polyfill; - mod multithread; - pub(crate) use multithread::*; + #[cfg(target_feature = "atomics")] + mod multithread; + mod singlethread; + #[cfg(target_feature = "atomics")] + mod wait_async_polyfill; + + pub(crate) fn spawn(future: Pin + 'static>>) { + cfg_if! { + if #[cfg(target_feature = "atomics")] { + #[wasm_bindgen::prelude::wasm_bindgen] + extern "C" { + /// Returns [`crossOriginIsolated`](https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated) global property. + #[wasm_bindgen(js_name = crossOriginIsolated)] + static CROSS_ORIGIN_ISOLATED: bool; + } + + if *CROSS_ORIGIN_ISOLATED { + multithread::Task::spawn(future) + } else { + singlethread::Task::spawn(future) + } + } else { + singlethread::Task::spawn(future) + } + } + } - } else { - mod singlethread; - pub(crate) use singlethread::*; - } + pub(crate) trait Task { + fn run(&self); } } @@ -81,7 +103,7 @@ pub fn spawn_local(future: F) where F: Future + 'static, { - task::Task::spawn(Box::pin(future)); + task::spawn(Box::pin(future)); } struct Inner { diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index 2e17eb5ecf1..f2162e60240 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -19,7 +19,7 @@ struct QueueState { // The queue of Tasks which are to be run in order. In practice this is all the // synchronous work of futures, and each `Task` represents calling `poll` on // a future "at the right time". - tasks: RefCell>>, + tasks: RefCell>>, // This flag indicates whether we've scheduled `run_all` to run in the future. // This is used to ensure that it's only scheduled once. @@ -58,7 +58,7 @@ pub(crate) struct Queue { impl Queue { // Schedule a task to run on the next tick - pub(crate) fn schedule_task(&self, task: Rc) { + pub(crate) fn schedule_task(&self, task: Rc) { self.state.tasks.borrow_mut().push_back(task); // Use queueMicrotask to execute as soon as possible. If it does not exist // fall back to the promise resolution @@ -71,7 +71,7 @@ impl Queue { } } // Append a task to the currently running queue, or schedule it - pub(crate) fn push_task(&self, task: Rc) { + pub(crate) fn push_task(&self, task: Rc) { // It would make sense to run this task on the same tick. For now, we // make the simplifying choice of always scheduling tasks for a future tick. self.schedule_task(task) diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index 6cfdfcb5437..73bd2b723cc 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -1,3 +1,4 @@ +use super::Task as _; use std::cell::RefCell; use std::future::Future; use std::mem::ManuallyDrop; @@ -84,27 +85,8 @@ pub(crate) struct Task { inner: RefCell>, } -impl Task { - pub(crate) fn spawn(future: Pin + 'static>>) { - let atomic = AtomicWaker::new(); - let waker = unsafe { Waker::from_raw(AtomicWaker::into_raw_waker(atomic.clone())) }; - let this = Rc::new(Task { - atomic, - waker, - inner: RefCell::new(None), - }); - - let closure = { - let this = Rc::clone(&this); - Closure::new(move |_| this.run()) - }; - *this.inner.borrow_mut() = Some(Inner { future, closure }); - - // Queue up the Future's work to happen on the next microtask tick. - crate::queue::QUEUE.with(move |queue| queue.schedule_task(this)); - } - - pub(crate) fn run(&self) { +impl super::Task for Task { + fn run(&self) { let mut borrow = self.inner.borrow_mut(); // Same as `singlethread.rs`, handle spurious wakeups happening after we @@ -162,6 +144,27 @@ impl Task { } } +impl Task { + pub(crate) fn spawn(future: Pin + 'static>>) { + let atomic = AtomicWaker::new(); + let waker = unsafe { Waker::from_raw(AtomicWaker::into_raw_waker(atomic.clone())) }; + let this = Rc::new(Task { + atomic, + waker, + inner: RefCell::new(None), + }); + + let closure = { + let this = Rc::clone(&this); + Closure::new(move |_| this.run()) + }; + *this.inner.borrow_mut() = Some(Inner { future, closure }); + + // Queue up the Future's work to happen on the next microtask tick. + crate::queue::QUEUE.with(move |queue| queue.schedule_task(this)); + } +} + fn wait_async(ptr: &AtomicI32, current_value: i32) -> Option { // If `Atomics.waitAsync` isn't defined then we use our fallback, otherwise // we use the native function. diff --git a/crates/futures/src/task/singlethread.rs b/crates/futures/src/task/singlethread.rs index ad52f552400..3f561f6d8a3 100644 --- a/crates/futures/src/task/singlethread.rs +++ b/crates/futures/src/task/singlethread.rs @@ -21,6 +21,38 @@ pub(crate) struct Task { is_queued: Cell, } +impl super::Task for Task { + fn run(&self) { + let mut borrow = self.inner.borrow_mut(); + + // Wakeups can come in after a Future has finished and been destroyed, + // so handle this gracefully by just ignoring the request to run. + let inner = match borrow.as_mut() { + Some(inner) => inner, + None => return, + }; + + // Ensure that if poll calls `waker.wake()` we can get enqueued back on + // the run queue. + self.is_queued.set(false); + + let poll = { + let mut cx = Context::from_waker(&inner.waker); + inner.future.as_mut().poll(&mut cx) + }; + + // If a future has finished (`Ready`) then clean up resources associated + // with the future ASAP. This ensures that we don't keep anything extra + // alive in-memory by accident. Our own struct, `Rc` won't + // actually go away until all wakers referencing us go away, which may + // take quite some time, so ensure that the heaviest of resources are + // released early. + if poll.is_ready() { + *borrow = None; + } + } +} + impl Task { pub(crate) fn spawn(future: Pin + 'static>>) { let this = Rc::new(Self { @@ -97,34 +129,4 @@ impl Task { RawWaker::new(Rc::into_raw(this) as *const (), &VTABLE) } - - pub(crate) fn run(&self) { - let mut borrow = self.inner.borrow_mut(); - - // Wakeups can come in after a Future has finished and been destroyed, - // so handle this gracefully by just ignoring the request to run. - let inner = match borrow.as_mut() { - Some(inner) => inner, - None => return, - }; - - // Ensure that if poll calls `waker.wake()` we can get enqueued back on - // the run queue. - self.is_queued.set(false); - - let poll = { - let mut cx = Context::from_waker(&inner.waker); - inner.future.as_mut().poll(&mut cx) - }; - - // If a future has finished (`Ready`) then clean up resources associated - // with the future ASAP. This ensures that we don't keep anything extra - // alive in-memory by accident. Our own struct, `Rc` won't - // actually go away until all wakers referencing us go away, which may - // take quite some time, so ensure that the heaviest of resources are - // released early. - if poll.is_ready() { - *borrow = None; - } - } } From 6150e210ca4e39f32c7da53745eb496fb2fc1cf9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 20 Feb 2024 11:02:21 +0100 Subject: [PATCH 367/641] Revert "Use single-threaded impl when MT is impossible" This reverts commit 7ce38b42d32d897e2d90f52af5f58b9450f388bf. --- CHANGELOG.md | 5 -- crates/futures/src/lib.rs | 42 ++++------------- crates/futures/src/queue.rs | 6 +-- crates/futures/src/task/multithread.rs | 45 +++++++++--------- crates/futures/src/task/singlethread.rs | 62 ++++++++++++------------- 5 files changed, 64 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f449256e10..56fb600f0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,6 @@ * Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) -### Fixed - -* Allow `wasm-bindgen-futures` to run correctly when using the atomics target feature in an environment that has no support for `Atomics.waitAsync()` and without cross-origin isolation. - [#3848](https://github.com/rustwasm/wasm-bindgen/pull/3848) - -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 0e43314bf1a..a44ec7c6d27 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -50,40 +50,18 @@ pub use js_sys; pub use wasm_bindgen; mod task { - use std::future::Future; - use std::pin::Pin; - use cfg_if::cfg_if; - #[cfg(target_feature = "atomics")] - mod multithread; - mod singlethread; - #[cfg(target_feature = "atomics")] - mod wait_async_polyfill; - - pub(crate) fn spawn(future: Pin + 'static>>) { - cfg_if! { - if #[cfg(target_feature = "atomics")] { - #[wasm_bindgen::prelude::wasm_bindgen] - extern "C" { - /// Returns [`crossOriginIsolated`](https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated) global property. - #[wasm_bindgen(js_name = crossOriginIsolated)] - static CROSS_ORIGIN_ISOLATED: bool; - } - - if *CROSS_ORIGIN_ISOLATED { - multithread::Task::spawn(future) - } else { - singlethread::Task::spawn(future) - } - } else { - singlethread::Task::spawn(future) - } - } - } + cfg_if! { + if #[cfg(target_feature = "atomics")] { + mod wait_async_polyfill; + mod multithread; + pub(crate) use multithread::*; - pub(crate) trait Task { - fn run(&self); + } else { + mod singlethread; + pub(crate) use singlethread::*; + } } } @@ -103,7 +81,7 @@ pub fn spawn_local(future: F) where F: Future + 'static, { - task::spawn(Box::pin(future)); + task::Task::spawn(Box::pin(future)); } struct Inner { diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index f2162e60240..2e17eb5ecf1 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -19,7 +19,7 @@ struct QueueState { // The queue of Tasks which are to be run in order. In practice this is all the // synchronous work of futures, and each `Task` represents calling `poll` on // a future "at the right time". - tasks: RefCell>>, + tasks: RefCell>>, // This flag indicates whether we've scheduled `run_all` to run in the future. // This is used to ensure that it's only scheduled once. @@ -58,7 +58,7 @@ pub(crate) struct Queue { impl Queue { // Schedule a task to run on the next tick - pub(crate) fn schedule_task(&self, task: Rc) { + pub(crate) fn schedule_task(&self, task: Rc) { self.state.tasks.borrow_mut().push_back(task); // Use queueMicrotask to execute as soon as possible. If it does not exist // fall back to the promise resolution @@ -71,7 +71,7 @@ impl Queue { } } // Append a task to the currently running queue, or schedule it - pub(crate) fn push_task(&self, task: Rc) { + pub(crate) fn push_task(&self, task: Rc) { // It would make sense to run this task on the same tick. For now, we // make the simplifying choice of always scheduling tasks for a future tick. self.schedule_task(task) diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index 73bd2b723cc..6cfdfcb5437 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -1,4 +1,3 @@ -use super::Task as _; use std::cell::RefCell; use std::future::Future; use std::mem::ManuallyDrop; @@ -85,8 +84,27 @@ pub(crate) struct Task { inner: RefCell>, } -impl super::Task for Task { - fn run(&self) { +impl Task { + pub(crate) fn spawn(future: Pin + 'static>>) { + let atomic = AtomicWaker::new(); + let waker = unsafe { Waker::from_raw(AtomicWaker::into_raw_waker(atomic.clone())) }; + let this = Rc::new(Task { + atomic, + waker, + inner: RefCell::new(None), + }); + + let closure = { + let this = Rc::clone(&this); + Closure::new(move |_| this.run()) + }; + *this.inner.borrow_mut() = Some(Inner { future, closure }); + + // Queue up the Future's work to happen on the next microtask tick. + crate::queue::QUEUE.with(move |queue| queue.schedule_task(this)); + } + + pub(crate) fn run(&self) { let mut borrow = self.inner.borrow_mut(); // Same as `singlethread.rs`, handle spurious wakeups happening after we @@ -144,27 +162,6 @@ impl super::Task for Task { } } -impl Task { - pub(crate) fn spawn(future: Pin + 'static>>) { - let atomic = AtomicWaker::new(); - let waker = unsafe { Waker::from_raw(AtomicWaker::into_raw_waker(atomic.clone())) }; - let this = Rc::new(Task { - atomic, - waker, - inner: RefCell::new(None), - }); - - let closure = { - let this = Rc::clone(&this); - Closure::new(move |_| this.run()) - }; - *this.inner.borrow_mut() = Some(Inner { future, closure }); - - // Queue up the Future's work to happen on the next microtask tick. - crate::queue::QUEUE.with(move |queue| queue.schedule_task(this)); - } -} - fn wait_async(ptr: &AtomicI32, current_value: i32) -> Option { // If `Atomics.waitAsync` isn't defined then we use our fallback, otherwise // we use the native function. diff --git a/crates/futures/src/task/singlethread.rs b/crates/futures/src/task/singlethread.rs index 3f561f6d8a3..ad52f552400 100644 --- a/crates/futures/src/task/singlethread.rs +++ b/crates/futures/src/task/singlethread.rs @@ -21,38 +21,6 @@ pub(crate) struct Task { is_queued: Cell, } -impl super::Task for Task { - fn run(&self) { - let mut borrow = self.inner.borrow_mut(); - - // Wakeups can come in after a Future has finished and been destroyed, - // so handle this gracefully by just ignoring the request to run. - let inner = match borrow.as_mut() { - Some(inner) => inner, - None => return, - }; - - // Ensure that if poll calls `waker.wake()` we can get enqueued back on - // the run queue. - self.is_queued.set(false); - - let poll = { - let mut cx = Context::from_waker(&inner.waker); - inner.future.as_mut().poll(&mut cx) - }; - - // If a future has finished (`Ready`) then clean up resources associated - // with the future ASAP. This ensures that we don't keep anything extra - // alive in-memory by accident. Our own struct, `Rc` won't - // actually go away until all wakers referencing us go away, which may - // take quite some time, so ensure that the heaviest of resources are - // released early. - if poll.is_ready() { - *borrow = None; - } - } -} - impl Task { pub(crate) fn spawn(future: Pin + 'static>>) { let this = Rc::new(Self { @@ -129,4 +97,34 @@ impl Task { RawWaker::new(Rc::into_raw(this) as *const (), &VTABLE) } + + pub(crate) fn run(&self) { + let mut borrow = self.inner.borrow_mut(); + + // Wakeups can come in after a Future has finished and been destroyed, + // so handle this gracefully by just ignoring the request to run. + let inner = match borrow.as_mut() { + Some(inner) => inner, + None => return, + }; + + // Ensure that if poll calls `waker.wake()` we can get enqueued back on + // the run queue. + self.is_queued.set(false); + + let poll = { + let mut cx = Context::from_waker(&inner.waker); + inner.future.as_mut().poll(&mut cx) + }; + + // If a future has finished (`Ready`) then clean up resources associated + // with the future ASAP. This ensures that we don't keep anything extra + // alive in-memory by accident. Our own struct, `Rc` won't + // actually go away until all wakers referencing us go away, which may + // take quite some time, so ensure that the heaviest of resources are + // released early. + if poll.is_ready() { + *borrow = None; + } + } } From 00ab174fcc1509ce88287679f8d568a2a017d74f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 21 Feb 2024 23:17:19 +0100 Subject: [PATCH 368/641] Update Rust version for UI tests (#3850) --- .github/workflows/main.yml | 2 +- crates/macro/ui-tests/async-errors.stderr | 44 +++++++++---------- crates/macro/ui-tests/missing-catch.stderr | 16 +++---- crates/macro/ui-tests/start-function.stderr | 28 +++++------- crates/macro/ui-tests/struct-fields.stderr | 14 +++--- .../ui-tests/traits-not-implemented.stderr | 16 +++---- crates/macro/ui-tests/wasm-bindgen.stderr | 8 +++- crates/test-macro/ui-tests/crate.stderr | 5 +++ 8 files changed, 66 insertions(+), 67 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2851321610..0157c230edc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -246,7 +246,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup update --no-self-update 1.69.0 && rustup default 1.69.0 + - run: rustup update --no-self-update 1.76.0 && rustup default 1.76.0 - run: cargo test -p wasm-bindgen-macro - run: cargo test -p wasm-bindgen-test-macro diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index a128c73c090..5526851f1d3 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -1,52 +1,48 @@ error[E0277]: the trait bound `Result<(), ()>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:30:1 + --> ui-tests/async-errors.rs:31:24 | -30 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` +31 | pub async fn bad1() -> Result<(), ()> { loop {} } + | ^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), ()>` | = help: the following other types implement trait `IntoJsResult`: Result<(), E> Result - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result<(), BadType>: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:32:1 + --> ui-tests/async-errors.rs:33:24 | -32 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` +33 | pub async fn bad2() -> Result<(), BadType> { loop {} } + | ^^^^^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result<(), BadType>` | = help: the following other types implement trait `IntoJsResult`: Result<(), E> Result - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not satisfied - --> ui-tests/async-errors.rs:34:1 + --> ui-tests/async-errors.rs:35:24 | -34 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue` +35 | pub async fn bad3() -> BadType { loop {} } + | ^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue` | = help: the following other types implement trait `From`: - > - > - > - > - > - > - > - > + > + > + > + > + > + > + > + > and $N others = note: required for `BadType` to implement `Into` = note: required for `BadType` to implement `IntoJsResult` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: IntoJsResult` is not satisfied - --> ui-tests/async-errors.rs:36:1 + --> ui-tests/async-errors.rs:37:24 | -36 | #[wasm_bindgen] - | ^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result` +37 | pub async fn bad4() -> Result { loop {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoJsResult` is not implemented for `Result` | = help: the following other types implement trait `IntoJsResult`: Result<(), E> Result - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index 5e54e41e7f7..02a74e62f00 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -5,12 +5,12 @@ error[E0277]: the trait bound `Result` | = help: the following other types implement trait `FromWasmAbi`: - *const T - *mut T - Box<[T]> - Clamped - Option - Option - Option - Option + bool + char + isize + i8 + i16 + i32 + i64 + usize and $N others diff --git a/crates/macro/ui-tests/start-function.stderr b/crates/macro/ui-tests/start-function.stderr index 9cd11976118..cc25189ba49 100644 --- a/crates/macro/ui-tests/start-function.stderr +++ b/crates/macro/ui-tests/start-function.stderr @@ -11,37 +11,33 @@ error: the start function cannot have generics | ^^^ error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:15:1 + --> ui-tests/start-function.rs:16:14 | -15 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` +16 | fn foo5() -> Result { Err(()) } + | ^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` | = help: the trait `wasm_bindgen::__rt::Start` is implemented for `Result<(), E>` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:18:1 + --> ui-tests/start-function.rs:19:14 | -18 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` +19 | fn foo6() -> Result { Ok(JsValue::from(1u32)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` | = help: the trait `wasm_bindgen::__rt::Start` is implemented for `Result<(), E>` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:27:1 + --> ui-tests/start-function.rs:28:26 | -27 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` +28 | async fn foo_async3() -> Result { Err(()) } + | ^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` | = help: the trait `wasm_bindgen::__rt::Start` is implemented for `Result<(), E>` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Result: wasm_bindgen::__rt::Start` is not satisfied - --> ui-tests/start-function.rs:30:1 + --> ui-tests/start-function.rs:31:26 | -30 | #[wasm_bindgen(start)] - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` +31 | async fn foo_async4() -> Result { Ok(JsValue::from(1u32)) } + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `wasm_bindgen::__rt::Start` is not implemented for `Result` | = help: the trait `wasm_bindgen::__rt::Start` is implemented for `Result<(), E>` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/struct-fields.stderr b/crates/macro/ui-tests/struct-fields.stderr index ab17546955e..6e402b2d6ab 100644 --- a/crates/macro/ui-tests/struct-fields.stderr +++ b/crates/macro/ui-tests/struct-fields.stderr @@ -12,17 +12,13 @@ note: required by a bound in `__wbg_get_bar_a::assert_copy` = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Foo: Clone` is not satisfied - --> ui-tests/struct-fields.rs:11:20 + --> ui-tests/struct-fields.rs:12:12 | -11 | #[wasm_bindgen(getter_with_clone)] - | ^---------------- - | | - | ____________________required by a bound introduced by this call - | | -12 | | pub b: Foo, - | |_________^ the trait `Clone` is not implemented for `Foo` +12 | pub b: Foo, + | ^^^ the trait `Clone` is not implemented for `Foo` | help: consider annotating `Foo` with `#[derive(Clone)]` | -3 | #[derive(Clone)] +3 + #[derive(Clone)] +4 | #[wasm_bindgen] | diff --git a/crates/macro/ui-tests/traits-not-implemented.stderr b/crates/macro/ui-tests/traits-not-implemented.stderr index 714050a53b5..883648fae4c 100644 --- a/crates/macro/ui-tests/traits-not-implemented.stderr +++ b/crates/macro/ui-tests/traits-not-implemented.stderr @@ -5,13 +5,13 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied | ^^^^^^^^^^^^^^^ the trait `IntoWasmAbi` is not implemented for `A` | = help: the following other types implement trait `IntoWasmAbi`: - &'a (dyn Fn() -> R + 'b) - &'a (dyn Fn(A) -> R + 'b) - &'a (dyn Fn(A, B) -> R + 'b) - &'a (dyn Fn(A, B, C) -> R + 'b) - &'a (dyn Fn(A, B, C, D) -> R + 'b) - &'a (dyn Fn(A, B, C, D, E) -> R + 'b) - &'a (dyn Fn(A, B, C, D, E, F) -> R + 'b) - &'a (dyn Fn(A, B, C, D, E, F, G) -> R + 'b) + bool + char + isize + i8 + i16 + i32 + i64 + usize and $N others = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/wasm-bindgen.stderr b/crates/macro/ui-tests/wasm-bindgen.stderr index 7ed892ebb0a..2ec13836be6 100644 --- a/crates/macro/ui-tests/wasm-bindgen.stderr +++ b/crates/macro/ui-tests/wasm-bindgen.stderr @@ -5,6 +5,12 @@ error[E0433]: failed to resolve: could not find `convert` in `test` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `convert` in `test` | = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider importing one of these items + | +3 + use crate::test::test::convert; + | +3 + use wasm_bindgen::convert; + | error[E0425]: cannot find function `future_to_promise` in module `test` --> ui-tests/wasm-bindgen.rs:40:1 @@ -15,5 +21,5 @@ error[E0425]: cannot find function `future_to_promise` in module `test` = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this function | -3 | use wasm_bindgen_futures::future_to_promise; +3 + use wasm_bindgen_futures::future_to_promise; | diff --git a/crates/test-macro/ui-tests/crate.stderr b/crates/test-macro/ui-tests/crate.stderr index 2bace352ee4..e256cb3f4fe 100644 --- a/crates/test-macro/ui-tests/crate.stderr +++ b/crates/test-macro/ui-tests/crate.stderr @@ -3,3 +3,8 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo` | 17 | #[wasm_bindgen_test(crate = foo)] | ^^^ use of undeclared crate or module `foo` + | +help: consider importing this module + | +5 + use wasm_bindgen_test::__rt; + | From b5a74c85783963456cec0f00edcdeae6d69f1c62 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Thu, 22 Feb 2024 11:06:13 -0500 Subject: [PATCH 369/641] Add `sorted_iter_mut` for NonstandardWitSection.adapters for determinism (#3851) --- CHANGELOG.md | 5 +++++ crates/cli-support/src/externref.rs | 4 ++-- crates/cli-support/src/lib.rs | 10 ++++++++++ crates/cli-support/src/multivalue.rs | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56fb600f0c3..f35f358483b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ * Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) +### Fixed + +* Make .wasm output deterministic when using `--reference-types`. + [#3851](https://github.com/rustwasm/wasm-bindgen/pull/3851) + -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index 51b0db14b72..ef3a726ad9f 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -25,7 +25,7 @@ pub fn process(module: &mut Module) -> Result<()> { // Transform all exported functions in the module, using the bindings listed // for each exported function. - for (id, adapter) in section.adapters.iter_mut() { + for (id, adapter) in crate::sorted_iter_mut(&mut section.adapters) { let instructions = match &mut adapter.kind { AdapterKind::Local { instructions } => instructions, AdapterKind::Import { .. } => continue, @@ -77,7 +77,7 @@ pub fn process(module: &mut Module) -> Result<()> { // Additionally we may need to update some adapter instructions other than // those found for the externref pass. These are some general "fringe support" // things necessary to get absolutely everything working. - for (_, adapter) in section.adapters.iter_mut() { + for (_, adapter) in crate::sorted_iter_mut(&mut section.adapters) { let instrs = match &mut adapter.kind { AdapterKind::Local { instructions } => instructions, AdapterKind::Import { .. } => continue, diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index c3e24bd2ff1..bccba23459d 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -785,3 +785,13 @@ where pairs.sort_by_key(|(k, _)| *k); pairs.into_iter() } + +/// Like `sorted_iter`, but produces mutable references to the values +fn sorted_iter_mut(map: &mut HashMap) -> impl Iterator +where + K: Ord, +{ + let mut pairs = map.iter_mut().collect::>(); + pairs.sort_by_key(|(k, _)| *k); + pairs.into_iter() +} diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index 61a20878e63..9fd7071b483 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -14,7 +14,7 @@ pub fn run(module: &mut Module) -> Result<(), Error> { let mut to_xform = Vec::new(); let mut slots = Vec::new(); - for (_, adapter) in adapters.adapters.iter_mut() { + for (_, adapter) in crate::sorted_iter_mut(&mut adapters.adapters) { extract_xform(module, adapter, &mut to_xform, &mut slots); } if to_xform.is_empty() { From 557e2e65188470e578f19a8364d7e6b23eec12fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Fri, 23 Feb 2024 09:06:00 +0100 Subject: [PATCH 370/641] Introduce impl TryFrom for Number that succeeds iff the value is within the safe range (#3847) --- CHANGELOG.md | 3 +++ crates/js-sys/src/lib.rs | 31 ++++++++++++++++++++++++++++++ crates/js-sys/tests/wasm/Number.rs | 20 ++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f35f358483b..16e9e1d3963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) +* Add `TryFrom` implementations for `Number`, that allow losslessly converting from 64- and 128-bits numbers. + [#3847](https://github.com/rustwasm/wasm-bindgen/pull/3847) + ### Fixed * Make .wasm output deterministic when using `--reference-types`. diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index b18faf6cae0..a244b7b70a0 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -2793,6 +2793,37 @@ macro_rules! number_from { } number_from!(i8 u8 i16 u16 i32 u32 f32 f64); +/// The error type returned when a checked integral type conversion fails. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct TryFromIntError(()); + +impl fmt::Display for TryFromIntError { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt.write_str("out of range integral type conversion attempted") + } +} + +impl std::error::Error for TryFromIntError {} + +macro_rules! number_try_from { + ($($x:ident)*) => ($( + impl TryFrom<$x> for Number { + type Error = TryFromIntError; + + #[inline] + fn try_from(x: $x) -> Result { + let x_f64 = x as f64; + if x_f64 >= Number::MIN_SAFE_INTEGER && x_f64 <= Number::MAX_SAFE_INTEGER { + Ok(Number::from(x_f64)) + } else { + Err(TryFromIntError(())) + } + } + } + )*) +} +number_try_from!(i64 u64 i128 u128); + // TODO: add this on the next major version, when blanket impl is removed /* impl convert::TryFrom for Number { diff --git a/crates/js-sys/tests/wasm/Number.rs b/crates/js-sys/tests/wasm/Number.rs index 94fd551f33e..31f3f565fe8 100644 --- a/crates/js-sys/tests/wasm/Number.rs +++ b/crates/js-sys/tests/wasm/Number.rs @@ -1,4 +1,7 @@ -use std::f64::{INFINITY, NAN}; +use std::{ + convert::TryFrom, + f64::{INFINITY, NAN}, +}; use js_sys::*; use wasm_bindgen::prelude::*; @@ -71,6 +74,21 @@ fn new() { assert_eq!(Number::from(v).value_of(), 42.); } +#[wasm_bindgen_test] +fn try_from() { + assert_eq!(Number::try_from(42u128).unwrap(), 42.); + assert_eq!( + Number::try_from(Number::MAX_SAFE_INTEGER as u64).unwrap(), + Number::MAX_SAFE_INTEGER + ); + assert_eq!( + Number::try_from(Number::MIN_SAFE_INTEGER as i128).unwrap(), + Number::MIN_SAFE_INTEGER + ); + assert!(Number::try_from(Number::MAX_SAFE_INTEGER as u128 + 1).is_err()); + assert!(Number::try_from(Number::MIN_SAFE_INTEGER as i64 - 1).is_err()); +} + #[wasm_bindgen_test] fn parse_int_float() { assert_eq!(Number::parse_int("42", 10), 42.); From 0c09e154cf37b7e7f2308787d5186056cf85b533 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 23 Feb 2024 14:00:44 +0100 Subject: [PATCH 371/641] Fix CI (#3853) --- tests/wasm/classes.rs | 4 +--- tests/wasm/closures.rs | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/wasm/classes.rs b/tests/wasm/classes.rs index 6058c0a59da..e590cf7e2eb 100644 --- a/tests/wasm/classes.rs +++ b/tests/wasm/classes.rs @@ -451,9 +451,7 @@ impl RenamedExport { } pub fn foo(&self) {} - pub fn bar(&self, other: &RenamedExport) { - drop(other); - } + pub fn bar(&self, _: &RenamedExport) {} } #[wasm_bindgen_test] diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index 1061dab5ab9..a0247b5d1ca 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -432,7 +432,9 @@ fn drop_drops() { } } let a = A; - let x: Closure = Closure::new(move || drop(&a)); + let x: Closure = Closure::new(move || { + let _ = a; + }); drop(x); unsafe { assert!(HIT); @@ -605,25 +607,33 @@ fn call_destroyed_doesnt_segfault() { } let a = A(1, 1); - let a = Closure::wrap(Box::new(move || drop(&a)) as Box); + let a = Closure::wrap(Box::new(move || { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(2, 2); - let a = Closure::wrap(Box::new(move || drop(&a)) as Box); + let a = Closure::wrap(Box::new(move || { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(1, 1); - let a = Closure::wrap(Box::new(move |_: &JsValue| drop(&a)) as Box); + let a = Closure::wrap(Box::new(move |_: &JsValue| { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(2, 2); - let a = Closure::wrap(Box::new(move |_: &JsValue| drop(&a)) as Box); + let a = Closure::wrap(Box::new(move |_: &JsValue| { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); From c80bf9a3237a55ebffb9fd7559b7f8681ffa257f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 26 Feb 2024 11:49:55 +0100 Subject: [PATCH 372/641] Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull` (#3852) Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com> --- CHANGELOG.md | 3 + crates/cli-support/src/descriptor.rs | 3 + crates/cli-support/src/js/binding.rs | 17 ++++- crates/cli-support/src/wit/incoming.rs | 8 +++ crates/cli-support/src/wit/outgoing.rs | 11 +++- crates/cli-support/src/wit/standard.rs | 3 + crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- .../non_null.js | 12 ++++ .../src/non_null.rs | 13 ++++ guide/src/SUMMARY.md | 1 + guide/src/reference/types/non-null.md | 17 +++++ guide/src/reference/types/pointers.md | 2 +- src/convert/impls.rs | 62 +++++++++++++++++++ src/describe.rs | 9 +++ tests/wasm/simple.js | 36 +++++++++++ tests/wasm/simple.rs | 61 ++++++++++++++++++ 17 files changed, 256 insertions(+), 6 deletions(-) create mode 100644 examples/guide-supported-types-examples/non_null.js create mode 100644 examples/guide-supported-types-examples/src/non_null.rs create mode 100644 guide/src/reference/types/non-null.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 16e9e1d3963..7ebdefce452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Add `TryFrom` implementations for `Number`, that allow losslessly converting from 64- and 128-bits numbers. [#3847](https://github.com/rustwasm/wasm-bindgen/pull/3847) +* Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull`. + [#3852](https://github.com/rustwasm/wasm-bindgen/pull/3852) + ### Fixed * Make .wasm output deterministic when using `--reference-types`. diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index e21dae1ed29..62dd766ac7a 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -40,6 +40,7 @@ tys! { RESULT UNIT CLAMPED + NONNULL } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -72,6 +73,7 @@ pub enum Descriptor { Option(Box), Result(Box), Unit, + NonNull, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -165,6 +167,7 @@ impl Descriptor { CHAR => Descriptor::Char, UNIT => Descriptor::Unit, CLAMPED => Descriptor::_decode(data, true), + NONNULL => Descriptor::NonNull, other => panic!("unknown descriptor: {}", other), } } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 76b61b42f86..f186038bde9 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -652,7 +652,7 @@ fn instruction( Instruction::WasmToInt { output, .. } => { let val = js.pop(); match output { - AdapterType::U32 => js.push(format!("{} >>> 0", val)), + AdapterType::U32 | AdapterType::NonNull => js.push(format!("{} >>> 0", val)), AdapterType::U64 => js.push(format!("BigInt.asUintN(64, {val})")), _ => js.push(val), } @@ -1217,6 +1217,18 @@ fn instruction( let val = js.pop(); js.push(format!("{0} === {1} ? undefined : {0}", val, hole)); } + + Instruction::I32FromOptionNonNull => { + let val = js.pop(); + js.cx.expose_is_like_none(); + js.assert_optional_number(&val); + js.push(format!("isLikeNone({0}) ? 0 : {0}", val)); + } + + Instruction::OptionNonNullFromI32 => { + let val = js.pop(); + js.push(format!("{0} === 0 ? undefined : {0} >>> 0", val)); + } } Ok(()) } @@ -1324,7 +1336,8 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String) { | AdapterType::U16 | AdapterType::U32 | AdapterType::F32 - | AdapterType::F64 => dst.push_str("number"), + | AdapterType::F64 + | AdapterType::NonNull => dst.push_str("number"), AdapterType::I64 | AdapterType::S64 | AdapterType::U64 => dst.push_str("bigint"), AdapterType::String => dst.push_str("string"), AdapterType::Externref => dst.push_str("any"), diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index b42541791eb..084e939e624 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -155,6 +155,8 @@ impl InstructionBuilder<'_, '_> { // Largely synthetic and can't show up Descriptor::ClampedU8 => unreachable!(), + + Descriptor::NonNull => unimplemented!("converting `NonNull` from Wasm to Rust is not implemented"), } Ok(()) } @@ -331,6 +333,12 @@ impl InstructionBuilder<'_, '_> { ); } + Descriptor::NonNull => self.instruction( + &[AdapterType::NonNull.option()], + Instruction::I32FromOptionNonNull, + &[AdapterType::I32], + ), + _ => bail!( "unsupported optional argument type for calling Rust function from JS: {:?}", arg diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 41763bdbe00..2c0fceefbcd 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -156,6 +156,8 @@ impl InstructionBuilder<'_, '_> { // Largely synthetic and can't show up Descriptor::ClampedU8 => unreachable!(), + + Descriptor::NonNull => self.outgoing_i32(AdapterType::NonNull), } Ok(()) } @@ -319,6 +321,12 @@ impl InstructionBuilder<'_, '_> { ); } + Descriptor::NonNull => self.instruction( + &[AdapterType::I32], + Instruction::OptionNonNullFromI32, + &[AdapterType::NonNull.option()], + ), + _ => bail!( "unsupported optional argument type for calling JS function from Rust: {:?}", arg @@ -350,7 +358,8 @@ impl InstructionBuilder<'_, '_> { | Descriptor::CachedString | Descriptor::Option(_) | Descriptor::Vector(_) - | Descriptor::Unit => { + | Descriptor::Unit + | Descriptor::NonNull => { // We must throw before reading the Ok type, if there is an error. However, the // structure of ResultAbi is that the Err value + discriminant come last (for // alignment reasons). So the UnwrapResult instruction must come first, but the diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 95781a6131e..d9a86b81a9d 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -88,6 +88,7 @@ pub enum AdapterType { Enum(String), NamedExternref(String), Function, + NonNull, } #[derive(Debug, Clone)] @@ -308,6 +309,8 @@ pub enum Instruction { OptionEnumFromI32 { hole: u32, }, + I32FromOptionNonNull, + OptionNonNullFromI32, } impl AdapterType { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 991dc0c61c3..f8ad45c7cd3 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.88"; +pub const SCHEMA_VERSION: &str = "0.2.92"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 702277b74d0..471ccc9beac 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "2548486983363536439"; +const APPROVED_SCHEMA_FILE_HASH: &str = "11955579329744078753"; #[test] fn schema_version() { diff --git a/examples/guide-supported-types-examples/non_null.js b/examples/guide-supported-types-examples/non_null.js new file mode 100644 index 00000000000..59ff64d80d1 --- /dev/null +++ b/examples/guide-supported-types-examples/non_null.js @@ -0,0 +1,12 @@ +import { + take_pointer_by_value, + return_pointer, +} from './guide_supported_types_examples'; +import { memory } from './guide_supported_types_examples_bg'; + +let ptr = return_pointer(); +let buf = new Uint8Array(memory.buffer); +let value = buf[ptr]; +console.log(`The byte at the ${ptr} address is ${value}`); + +take_pointer_by_value(ptr); diff --git a/examples/guide-supported-types-examples/src/non_null.rs b/examples/guide-supported-types-examples/src/non_null.rs new file mode 100644 index 00000000000..0f524e0eda2 --- /dev/null +++ b/examples/guide-supported-types-examples/src/non_null.rs @@ -0,0 +1,13 @@ +use std::ptr; +use std::ptr::NonNull; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub unsafe fn take_pointer_by_value(x: Option>) { + Box::from_raw(x.unwrap().as_ptr()); +} + +#[wasm_bindgen] +pub fn return_pointer() -> Option> { + Some(NonNull::from(Box::leak(Box::new(42)))) +} diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 5d9c362902c..7ba50cd5042 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -54,6 +54,7 @@ - [`JsValue`](./reference/types/jsvalue.md) - [`Box<[T]>` and `Vec`](./reference/types/boxed-slices.md) - [`*const T` and `*mut T`](./reference/types/pointers.md) + - [`NonNull`](./reference/types/non-null.md) - [Numbers](./reference/types/numbers.md) - [`bool`](./reference/types/bool.md) - [`char`](./reference/types/char.md) diff --git a/guide/src/reference/types/non-null.md b/guide/src/reference/types/non-null.md new file mode 100644 index 00000000000..8e1b9d17f25 --- /dev/null +++ b/guide/src/reference/types/non-null.md @@ -0,0 +1,17 @@ +# `NonNull` + +| `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | +|:---:|:---:|:---:|:---:|:---:|:---:|:---:| +| No | No | No | Yes | Yes | Yes | A JavaScript number value | + +## Example Rust Usage + +```rust +{{#include ../../../../examples/guide-supported-types-examples/src/non_null.rs}} +``` + +## Example JavaScript Usage + +```js +{{#include ../../../../examples/guide-supported-types-examples/non_null.js}} +``` diff --git a/guide/src/reference/types/pointers.md b/guide/src/reference/types/pointers.md index 15ca4eb5c99..98c72194e3d 100644 --- a/guide/src/reference/types/pointers.md +++ b/guide/src/reference/types/pointers.md @@ -2,7 +2,7 @@ | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| Yes | No | No | Yes | No | No | A JavaScript number value | +| Yes | No | No | Yes | Yes | Yes | A JavaScript number value | ## Example Rust Usage diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 8f1e3798055..64a40925c84 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -1,5 +1,6 @@ use core::char; use core::mem::{self, ManuallyDrop}; +use core::ptr::NonNull; use crate::convert::traits::{WasmAbi, WasmPrimitive}; use crate::convert::TryFromJsValue; @@ -223,6 +224,24 @@ impl FromWasmAbi for *const T { } } +impl IntoWasmAbi for Option<*const T> { + type Abi = Option; + + #[inline] + fn into_abi(self) -> Option { + self.map(|ptr| ptr as u32) + } +} + +impl FromWasmAbi for Option<*const T> { + type Abi = Option; + + #[inline] + unsafe fn from_abi(js: Option) -> Option<*const T> { + js.map(|ptr| ptr as *const T) + } +} + impl IntoWasmAbi for *mut T { type Abi = u32; @@ -241,6 +260,49 @@ impl FromWasmAbi for *mut T { } } +impl IntoWasmAbi for Option<*mut T> { + type Abi = Option; + + #[inline] + fn into_abi(self) -> Option { + self.map(|ptr| ptr as u32) + } +} + +impl FromWasmAbi for Option<*mut T> { + type Abi = Option; + + #[inline] + unsafe fn from_abi(js: Option) -> Option<*mut T> { + js.map(|ptr| ptr as *mut T) + } +} + +impl IntoWasmAbi for NonNull { + type Abi = u32; + + #[inline] + fn into_abi(self) -> u32 { + self.as_ptr() as u32 + } +} + +impl OptionIntoWasmAbi for NonNull { + #[inline] + fn none() -> u32 { + 0 + } +} + +impl FromWasmAbi for Option> { + type Abi = u32; + + #[inline] + unsafe fn from_abi(js: Self::Abi) -> Self { + NonNull::new(js as *mut T) + } +} + impl IntoWasmAbi for JsValue { type Abi = u32; diff --git a/src/describe.rs b/src/describe.rs index d3b5fd0b546..23190f71987 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -3,6 +3,8 @@ #![doc(hidden)] +use core::ptr::NonNull; + use crate::{Clamped, JsError, JsObject, JsValue}; use cfg_if::cfg_if; @@ -46,6 +48,7 @@ tys! { RESULT UNIT CLAMPED + NONNULL } #[inline(always)] // see the wasm-interpreter crate @@ -114,6 +117,12 @@ impl WasmDescribe for *mut T { } } +impl WasmDescribe for NonNull { + fn describe() { + inform(NONNULL) + } +} + impl WasmDescribe for [T] { fn describe() { inform(SLICE); diff --git a/tests/wasm/simple.js b/tests/wasm/simple.js index bc3edce8c0a..bcac3262f49 100644 --- a/tests/wasm/simple.js +++ b/tests/wasm/simple.js @@ -110,3 +110,39 @@ exports.test_string_roundtrip = () => { test('a longer string'); test('a longer 💖 string'); }; + +exports.test_raw_pointers = function() { + const memory32 = new Uint32Array(wasm.__wasm.memory.buffer); + const memory8 = new Uint8Array(wasm.__wasm.memory.buffer); + + const ptr1 = wasm.simple_return_raw_pointer_u32(4294967295); + assert.strictEqual(memory32[ptr1 / 4], 4294967295); + const ptr2 = wasm.simple_return_raw_pointer_u8(42); + assert.strictEqual(memory8[ptr2], 42); + + wasm.simple_raw_pointers_work(ptr1, ptr2); + assert.strictEqual(memory32[ptr1 / 4], 42); + + const ptr3 = wasm.simple_return_raw_pointer_u32(4294967295); + wasm.simple_option_raw_pointers_work(ptr3, ptr2); + assert.strictEqual(memory32[ptr3 / 4], 42); + + assert.strictEqual(wasm.simple_option_raw_pointers_work(0, ptr2), undefined); + assert.strictEqual(wasm.simple_option_raw_pointers_work(null, ptr2), undefined); + assert.strictEqual(wasm.simple_option_raw_pointers_work(undefined, ptr2), undefined); + + assert.strictEqual(wasm.simple_option_raw_pointers_work(ptr1, 0), undefined); + assert.strictEqual(wasm.simple_option_raw_pointers_work(ptr1, null), undefined); + assert.strictEqual(wasm.simple_option_raw_pointers_work(ptr1, undefined), undefined); + + assert.strictEqual(wasm.simple_return_option_null_pointer(), 0) +}; + +exports.test_non_null = function() { + assert.strictEqual(wasm.simple_option_nonnull_work(0), undefined); + assert.strictEqual(wasm.simple_option_nonnull_work(null), undefined); + assert.strictEqual(wasm.simple_option_nonnull_work(undefined), undefined); + + assert.strictEqual(wasm.simple_option_nonnull_work(wasm.simple_return_non_null()), 42); + assert.strictEqual(wasm.simple_option_nonnull_work(wasm.simple_return_option_non_null(43)), 43); +}; diff --git a/tests/wasm/simple.rs b/tests/wasm/simple.rs index 94cad579c56..b6bab8c3874 100644 --- a/tests/wasm/simple.rs +++ b/tests/wasm/simple.rs @@ -1,3 +1,5 @@ +use std::ptr::{self, NonNull}; + use wasm_bindgen::prelude::*; use wasm_bindgen::{intern, unintern}; use wasm_bindgen_test::*; @@ -29,6 +31,9 @@ extern "C" { fn new_renamed() -> Renamed; fn test_string_roundtrip(); + + fn test_raw_pointers(); + fn test_non_null(); } #[wasm_bindgen_test] @@ -56,12 +61,68 @@ pub fn simple_return_and_take_bool(a: bool, b: bool) -> bool { a && b } +#[wasm_bindgen] +pub fn simple_return_raw_pointer_u32(value: u32) -> *mut u32 { + Box::into_raw(Box::new(value)) +} + +#[wasm_bindgen] +pub fn simple_return_raw_pointer_u8(value: u8) -> *const u8 { + Box::into_raw(Box::new(value)) +} + #[wasm_bindgen] pub unsafe fn simple_raw_pointers_work(a: *mut u32, b: *const u8) -> *const u32 { (*a) = (*b) as u32; a } +#[wasm_bindgen] +pub fn simple_return_option_null_pointer() -> Option<*const u32> { + Some(ptr::null()) +} + +#[wasm_bindgen] +pub unsafe fn simple_option_raw_pointers_work( + a: Option<*mut u32>, + b: Option<*const u8>, +) -> Option<*const u32> { + let a = a.and_then(|ptr| ptr.as_mut()); + let b = b.and_then(|ptr| ptr.as_ref()); + + if let (Some(a), Some(b)) = (a, b) { + *a = *b as u32; + Some(a) + } else { + None + } +} + +#[wasm_bindgen_test] +fn raw_pointers() { + test_raw_pointers(); +} + +#[wasm_bindgen] +pub fn simple_return_non_null() -> NonNull { + NonNull::from(Box::leak(Box::new(42))) +} + +#[wasm_bindgen] +pub fn simple_return_option_non_null(value: u32) -> Option> { + Some(NonNull::from(Box::leak(Box::new(value)))) +} + +#[wasm_bindgen] +pub unsafe fn simple_option_nonnull_work(a: Option>) -> Option { + a.map(|ptr| *Box::from_raw(ptr.as_ptr())) +} + +#[wasm_bindgen_test] +fn non_null() { + test_non_null(); +} + #[wasm_bindgen_test] fn string_arguments() { test_string_arguments(); From b9ccb8f3c5e0590ee9934e0a1a88dacde2c53453 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 27 Feb 2024 22:22:50 +0100 Subject: [PATCH 373/641] Allow using `'static` lifetimes in functions (#3856) Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com> --- CHANGELOG.md | 5 ++ crates/macro-support/src/parser.rs | 12 ++-- crates/macro/ui-tests/invalid-imports-1.rs | 41 ++++++++++++ .../macro/ui-tests/invalid-imports-1.stderr | 65 +++++++++++++++++++ crates/macro/ui-tests/invalid-imports-2.rs | 8 +++ .../macro/ui-tests/invalid-imports-2.stderr | 5 ++ crates/macro/ui-tests/invalid-imports.rs | 2 + crates/macro/ui-tests/invalid-imports.stderr | 6 -- 8 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 crates/macro/ui-tests/invalid-imports-1.rs create mode 100644 crates/macro/ui-tests/invalid-imports-1.stderr create mode 100644 crates/macro/ui-tests/invalid-imports-2.rs create mode 100644 crates/macro/ui-tests/invalid-imports-2.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ebdefce452..a0c5857479e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ * Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull`. [#3852](https://github.com/rustwasm/wasm-bindgen/pull/3852) +### Changed + +* Allow using `'static` lifetimes in functions marked with `#[wasm_bindgen]`. This does not allow references where they were not allowed before! + [#3856](https://github.com/rustwasm/wasm-bindgen/pull/3856) + ### Fixed * Make .wasm output deterministic when using `--reference-types`. diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index eee4f66e95d..5778eb50d41 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1652,12 +1652,14 @@ fn assert_no_lifetimes(sig: &syn::Signature) -> Result<(), Diagnostic> { } impl<'ast> syn::visit::Visit<'ast> for Walk { - fn visit_lifetime(&mut self, i: &'ast syn::Lifetime) { - self.diagnostics.push(err_span!( - i, - "it is currently not sound to use lifetimes in function \ + fn visit_lifetime(&mut self, lifetime: &'ast syn::Lifetime) { + if lifetime.ident != "static" { + self.diagnostics.push(err_span!( + lifetime, + "it is currently not sound to use lifetimes in function \ signatures" - )); + )); + } } } let mut walk = Walk { diff --git a/crates/macro/ui-tests/invalid-imports-1.rs b/crates/macro/ui-tests/invalid-imports-1.rs new file mode 100644 index 00000000000..e73ab2162d3 --- /dev/null +++ b/crates/macro/ui-tests/invalid-imports-1.rs @@ -0,0 +1,41 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + type A; + + #[wasm_bindgen(method)] + fn f1(); + #[wasm_bindgen(method)] + fn f2(x: u32); + #[wasm_bindgen(method)] + fn f3(x: &&u32); + #[wasm_bindgen(method)] + fn f4(x: &foo::Bar); + #[wasm_bindgen(method)] + fn f4(x: &::Bar); + #[wasm_bindgen(method)] + fn f4(x: &Bar); + #[wasm_bindgen(method)] + fn f4(x: &dyn Fn(T)); + + #[wasm_bindgen(constructor)] + fn f(); + #[wasm_bindgen(constructor)] + fn f() -> ::Bar; + #[wasm_bindgen(constructor)] + fn f() -> &Bar; + + #[wasm_bindgen(catch)] + fn f() -> u32; + #[wasm_bindgen(catch)] + fn f() -> &u32; + #[wasm_bindgen(catch)] + fn f() -> Result<>; + #[wasm_bindgen(catch)] + fn f() -> Result<'a>; + #[wasm_bindgen(catch)] + fn f() -> Result<&'static u32>; +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports-1.stderr b/crates/macro/ui-tests/invalid-imports-1.stderr new file mode 100644 index 00000000000..24367ed92a9 --- /dev/null +++ b/crates/macro/ui-tests/invalid-imports-1.stderr @@ -0,0 +1,65 @@ +error: imported methods must have at least one argument + --> ui-tests/invalid-imports-1.rs:8:5 + | +8 | fn f1(); + | ^^^^^^^^ + +error: first argument of method must be a shared reference + --> ui-tests/invalid-imports-1.rs:10:14 + | +10 | fn f2(x: u32); + | ^^^ + +error: first argument of method must be a path + --> ui-tests/invalid-imports-1.rs:12:15 + | +12 | fn f3(x: &&u32); + | ^^^^ + +error: paths with type parameters are not supported yet + --> ui-tests/invalid-imports-1.rs:18:15 + | +18 | fn f4(x: &Bar); + | ^^^^^^ + +error: first argument of method must be a path + --> ui-tests/invalid-imports-1.rs:20:15 + | +20 | fn f4(x: &dyn Fn(T)); + | ^^^^^^^^^ + +error: constructor returns must be bare types + --> ui-tests/invalid-imports-1.rs:23:5 + | +23 | fn f(); + | ^^^^^^^ + +error: return value of constructor must be a bare path + --> ui-tests/invalid-imports-1.rs:27:5 + | +27 | fn f() -> &Bar; + | ^^^^^^^^^^^^^^^ + +error: must be Result<...> + --> ui-tests/invalid-imports-1.rs:30:15 + | +30 | fn f() -> u32; + | ^^^ + +error: must be Result<...> + --> ui-tests/invalid-imports-1.rs:32:15 + | +32 | fn f() -> &u32; + | ^^^^ + +error: must have at least one generic parameter + --> ui-tests/invalid-imports-1.rs:34:15 + | +34 | fn f() -> Result<>; + | ^^^^^^^^ + +error: it is currently not sound to use lifetimes in function signatures + --> ui-tests/invalid-imports-1.rs:36:22 + | +36 | fn f() -> Result<'a>; + | ^^ diff --git a/crates/macro/ui-tests/invalid-imports-2.rs b/crates/macro/ui-tests/invalid-imports-2.rs new file mode 100644 index 00000000000..5cf461dec94 --- /dev/null +++ b/crates/macro/ui-tests/invalid-imports-2.rs @@ -0,0 +1,8 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + fn f() -> &'static u32; +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports-2.stderr b/crates/macro/ui-tests/invalid-imports-2.stderr new file mode 100644 index 00000000000..aee456ba278 --- /dev/null +++ b/crates/macro/ui-tests/invalid-imports-2.stderr @@ -0,0 +1,5 @@ +error: cannot return references in #[wasm_bindgen] imports yet + --> ui-tests/invalid-imports-2.rs:5:15 + | +5 | fn f() -> &'static u32; + | ^^^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-imports.rs b/crates/macro/ui-tests/invalid-imports.rs index ceb7d33bf81..7fc9e74510a 100644 --- a/crates/macro/ui-tests/invalid-imports.rs +++ b/crates/macro/ui-tests/invalid-imports.rs @@ -36,6 +36,8 @@ extern "C" { fn f() -> Result<>; #[wasm_bindgen(catch)] fn f() -> Result<'a>; + #[wasm_bindgen(catch)] + fn f() -> Result<&'static u32>; } fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports.stderr b/crates/macro/ui-tests/invalid-imports.stderr index c83c040e862..e1fbeb97ba2 100644 --- a/crates/macro/ui-tests/invalid-imports.stderr +++ b/crates/macro/ui-tests/invalid-imports.stderr @@ -1,9 +1,3 @@ -error: it is currently not sound to use lifetimes in function signatures - --> ui-tests/invalid-imports.rs:7:16 - | -7 | fn f() -> &'static u32; - | ^^^^^^^ - error: imported methods must have at least one argument --> ui-tests/invalid-imports.rs:10:5 | From 002307746ee2cbc35d9b904414c7fe6da6c78bbc Mon Sep 17 00:00:00 2001 From: Doug A Date: Wed, 28 Feb 2024 10:59:05 -0400 Subject: [PATCH 374/641] Update passing-rust-closures-to-js.md (#3859) --- guide/src/reference/passing-rust-closures-to-js.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/guide/src/reference/passing-rust-closures-to-js.md b/guide/src/reference/passing-rust-closures-to-js.md index f370154ab83..c44cfa8244e 100644 --- a/guide/src/reference/passing-rust-closures-to-js.md +++ b/guide/src/reference/passing-rust-closures-to-js.md @@ -63,12 +63,6 @@ return but the JavaScript closure still needs to be valid! For this scenario, you need the `Closure` type, which is defined in the `wasm_bindgen` crate, exported in `wasm_bindgen::prelude`, and represents a "long lived" closure. -The `Closure` type is currently behind a feature which needs to be enabled: - -```toml -[dependencies] -wasm-bindgen = {version = "^0.2", features = ["nightly"]} -``` The validity of the JavaScript closure is tied to the lifetime of the `Closure` in Rust. **Once a `Closure` is dropped, it will deallocate its internal memory From 0095fa73c9c6b38e12dcbea471a431c592b9c450 Mon Sep 17 00:00:00 2001 From: Lynn Date: Sat, 2 Mar 2024 08:58:19 +0100 Subject: [PATCH 375/641] Allow overriding headless test URL (#3861) --- CHANGELOG.md | 3 +++ crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c5857479e..ec4b9281313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull`. [#3852](https://github.com/rustwasm/wasm-bindgen/pull/3852) +* Allow overriding the URL used for headless tests by setting `WASM_BINDGEN_TEST_ADDRESS`. + [#3861](https://github.com/rustwasm/wasm-bindgen/pull/3861) + ### Changed * Allow using `'static` lifetimes in functions marked with `#[wasm_bindgen]`. This does not allow references where they were not allowed before! diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 7edff27648d..08d9b7fc85c 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -121,7 +121,8 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error // Visit our local server to open up the page that runs tests, and then get // some handles to objects on the page which we'll be scraping output from. - let url = format!("http://{}", server); + let url = + std::env::var("WASM_BINDGEN_TEST_ADDRESS").unwrap_or_else(|_| format!("http://{}", server)); shell.status(&format!("Visiting {}...", url)); client.goto(&id, &url)?; shell.status("Loading page elements..."); From 983ec579a3dfca7ccb4f63f1f1adaa48f8bb3bec Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 2 Mar 2024 09:11:13 +0100 Subject: [PATCH 376/641] Add `NonNull` as parameter (#3857) --- CHANGELOG.md | 1 + crates/cli-support/src/js/binding.rs | 11 +++++++++++ crates/cli-support/src/js/mod.rs | 13 +++++++++++++ crates/cli-support/src/wit/incoming.rs | 6 +++++- crates/cli-support/src/wit/standard.rs | 1 + guide/src/reference/types/non-null.md | 2 +- src/convert/impls.rs | 12 ++++++++++-- tests/wasm/simple.js | 3 +++ tests/wasm/simple.rs | 5 +++++ 9 files changed, 50 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4b9281313..b4c87dd8df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * Add support for `Option<*const T>`, `Option<*mut T>` and `NonNull`. [#3852](https://github.com/rustwasm/wasm-bindgen/pull/3852) + [#3857](https://github.com/rustwasm/wasm-bindgen/pull/3857) * Allow overriding the URL used for headless tests by setting `WASM_BINDGEN_TEST_ADDRESS`. [#3861](https://github.com/rustwasm/wasm-bindgen/pull/3861) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index f186038bde9..4c27d7584e4 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -497,6 +497,11 @@ impl<'a, 'b> JsBuilder<'a, 'b> { self.prelude("}"); } + fn assert_non_null(&mut self, arg: &str) { + self.cx.expose_assert_non_null(); + self.prelude(&format!("_assertNonNull({});", arg)); + } + fn assert_optional_bigint(&mut self, arg: &str) { if !self.cx.config.debug { return; @@ -1218,6 +1223,12 @@ fn instruction( js.push(format!("{0} === {1} ? undefined : {0}", val, hole)); } + Instruction::I32FromNonNull => { + let val = js.pop(); + js.assert_non_null(&val); + js.push(val); + } + Instruction::I32FromOptionNonNull => { let val = js.pop(); js.cx.expose_is_like_none(); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 2e7744874b4..9a3899c9266 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2103,6 +2103,19 @@ impl<'a> Context<'a> { ); } + fn expose_assert_non_null(&mut self) { + if !self.should_write_global("assert_non_null") { + return; + } + self.global( + " + function _assertNonNull(n) { + if (typeof(n) !== 'number' || n === 0) throw new Error(`expected a number argument that is not 0, found ${n}`); + } + ", + ); + } + fn expose_make_mut_closure(&mut self) -> Result<(), Error> { if !self.should_write_global("make_mut_closure") { return Ok(()); diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 084e939e624..83bd3b32b16 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -156,7 +156,11 @@ impl InstructionBuilder<'_, '_> { // Largely synthetic and can't show up Descriptor::ClampedU8 => unreachable!(), - Descriptor::NonNull => unimplemented!("converting `NonNull` from Wasm to Rust is not implemented"), + Descriptor::NonNull => self.instruction( + &[AdapterType::NonNull], + Instruction::I32FromNonNull, + &[AdapterType::I32], + ), } Ok(()) } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index d9a86b81a9d..104a297abfa 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -311,6 +311,7 @@ pub enum Instruction { }, I32FromOptionNonNull, OptionNonNullFromI32, + I32FromNonNull, } impl AdapterType { diff --git a/guide/src/reference/types/non-null.md b/guide/src/reference/types/non-null.md index 8e1b9d17f25..33c2e9b0f16 100644 --- a/guide/src/reference/types/non-null.md +++ b/guide/src/reference/types/non-null.md @@ -2,7 +2,7 @@ | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| No | No | No | Yes | Yes | Yes | A JavaScript number value | +| Yes | No | No | Yes | Yes | Yes | A JavaScript number value | ## Example Rust Usage diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 64a40925c84..8d2bf4baf6a 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -294,12 +294,20 @@ impl OptionIntoWasmAbi for NonNull { } } -impl FromWasmAbi for Option> { +impl FromWasmAbi for NonNull { type Abi = u32; #[inline] unsafe fn from_abi(js: Self::Abi) -> Self { - NonNull::new(js as *mut T) + // SAFETY: Checked in bindings. + NonNull::new_unchecked(js as *mut T) + } +} + +impl OptionFromWasmAbi for NonNull { + #[inline] + fn is_none(js: &u32) -> bool { + *js == 0 } } diff --git a/tests/wasm/simple.js b/tests/wasm/simple.js index bcac3262f49..f66c77479f7 100644 --- a/tests/wasm/simple.js +++ b/tests/wasm/simple.js @@ -139,6 +139,9 @@ exports.test_raw_pointers = function() { }; exports.test_non_null = function() { + assert.strictEqual(wasm.simple_nonnull_work(wasm.simple_return_non_null()), 42); + assert.throws(() => wasm.simple_nonnull_work(0), /expected a number argument that is not 0/); + assert.strictEqual(wasm.simple_option_nonnull_work(0), undefined); assert.strictEqual(wasm.simple_option_nonnull_work(null), undefined); assert.strictEqual(wasm.simple_option_nonnull_work(undefined), undefined); diff --git a/tests/wasm/simple.rs b/tests/wasm/simple.rs index b6bab8c3874..fdef34c68fd 100644 --- a/tests/wasm/simple.rs +++ b/tests/wasm/simple.rs @@ -113,6 +113,11 @@ pub fn simple_return_option_non_null(value: u32) -> Option> { Some(NonNull::from(Box::leak(Box::new(value)))) } +#[wasm_bindgen] +pub unsafe fn simple_nonnull_work(a: NonNull) -> u32 { + *Box::from_raw(a.as_ptr()) +} + #[wasm_bindgen] pub unsafe fn simple_option_nonnull_work(a: Option>) -> Option { a.map(|ptr| *Box::from_raw(ptr.as_ptr())) From 807bdb48e4d6af82fdb894c0b702e869458591a8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 2 Mar 2024 11:55:19 +0100 Subject: [PATCH 377/641] Revert "Allow using `'static` lifetimes in functions (#3856)" (#3865) --- CHANGELOG.md | 5 -- crates/macro-support/src/parser.rs | 12 ++-- crates/macro/ui-tests/invalid-imports-1.rs | 41 ------------ .../macro/ui-tests/invalid-imports-1.stderr | 65 ------------------- crates/macro/ui-tests/invalid-imports-2.rs | 8 --- .../macro/ui-tests/invalid-imports-2.stderr | 5 -- crates/macro/ui-tests/invalid-imports.rs | 2 - crates/macro/ui-tests/invalid-imports.stderr | 6 ++ 8 files changed, 11 insertions(+), 133 deletions(-) delete mode 100644 crates/macro/ui-tests/invalid-imports-1.rs delete mode 100644 crates/macro/ui-tests/invalid-imports-1.stderr delete mode 100644 crates/macro/ui-tests/invalid-imports-2.rs delete mode 100644 crates/macro/ui-tests/invalid-imports-2.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c87dd8df4..8004077535b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,11 +21,6 @@ * Allow overriding the URL used for headless tests by setting `WASM_BINDGEN_TEST_ADDRESS`. [#3861](https://github.com/rustwasm/wasm-bindgen/pull/3861) -### Changed - -* Allow using `'static` lifetimes in functions marked with `#[wasm_bindgen]`. This does not allow references where they were not allowed before! - [#3856](https://github.com/rustwasm/wasm-bindgen/pull/3856) - ### Fixed * Make .wasm output deterministic when using `--reference-types`. diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 5778eb50d41..eee4f66e95d 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1652,14 +1652,12 @@ fn assert_no_lifetimes(sig: &syn::Signature) -> Result<(), Diagnostic> { } impl<'ast> syn::visit::Visit<'ast> for Walk { - fn visit_lifetime(&mut self, lifetime: &'ast syn::Lifetime) { - if lifetime.ident != "static" { - self.diagnostics.push(err_span!( - lifetime, - "it is currently not sound to use lifetimes in function \ + fn visit_lifetime(&mut self, i: &'ast syn::Lifetime) { + self.diagnostics.push(err_span!( + i, + "it is currently not sound to use lifetimes in function \ signatures" - )); - } + )); } } let mut walk = Walk { diff --git a/crates/macro/ui-tests/invalid-imports-1.rs b/crates/macro/ui-tests/invalid-imports-1.rs deleted file mode 100644 index e73ab2162d3..00000000000 --- a/crates/macro/ui-tests/invalid-imports-1.rs +++ /dev/null @@ -1,41 +0,0 @@ -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -extern "C" { - type A; - - #[wasm_bindgen(method)] - fn f1(); - #[wasm_bindgen(method)] - fn f2(x: u32); - #[wasm_bindgen(method)] - fn f3(x: &&u32); - #[wasm_bindgen(method)] - fn f4(x: &foo::Bar); - #[wasm_bindgen(method)] - fn f4(x: &::Bar); - #[wasm_bindgen(method)] - fn f4(x: &Bar); - #[wasm_bindgen(method)] - fn f4(x: &dyn Fn(T)); - - #[wasm_bindgen(constructor)] - fn f(); - #[wasm_bindgen(constructor)] - fn f() -> ::Bar; - #[wasm_bindgen(constructor)] - fn f() -> &Bar; - - #[wasm_bindgen(catch)] - fn f() -> u32; - #[wasm_bindgen(catch)] - fn f() -> &u32; - #[wasm_bindgen(catch)] - fn f() -> Result<>; - #[wasm_bindgen(catch)] - fn f() -> Result<'a>; - #[wasm_bindgen(catch)] - fn f() -> Result<&'static u32>; -} - -fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports-1.stderr b/crates/macro/ui-tests/invalid-imports-1.stderr deleted file mode 100644 index 24367ed92a9..00000000000 --- a/crates/macro/ui-tests/invalid-imports-1.stderr +++ /dev/null @@ -1,65 +0,0 @@ -error: imported methods must have at least one argument - --> ui-tests/invalid-imports-1.rs:8:5 - | -8 | fn f1(); - | ^^^^^^^^ - -error: first argument of method must be a shared reference - --> ui-tests/invalid-imports-1.rs:10:14 - | -10 | fn f2(x: u32); - | ^^^ - -error: first argument of method must be a path - --> ui-tests/invalid-imports-1.rs:12:15 - | -12 | fn f3(x: &&u32); - | ^^^^ - -error: paths with type parameters are not supported yet - --> ui-tests/invalid-imports-1.rs:18:15 - | -18 | fn f4(x: &Bar); - | ^^^^^^ - -error: first argument of method must be a path - --> ui-tests/invalid-imports-1.rs:20:15 - | -20 | fn f4(x: &dyn Fn(T)); - | ^^^^^^^^^ - -error: constructor returns must be bare types - --> ui-tests/invalid-imports-1.rs:23:5 - | -23 | fn f(); - | ^^^^^^^ - -error: return value of constructor must be a bare path - --> ui-tests/invalid-imports-1.rs:27:5 - | -27 | fn f() -> &Bar; - | ^^^^^^^^^^^^^^^ - -error: must be Result<...> - --> ui-tests/invalid-imports-1.rs:30:15 - | -30 | fn f() -> u32; - | ^^^ - -error: must be Result<...> - --> ui-tests/invalid-imports-1.rs:32:15 - | -32 | fn f() -> &u32; - | ^^^^ - -error: must have at least one generic parameter - --> ui-tests/invalid-imports-1.rs:34:15 - | -34 | fn f() -> Result<>; - | ^^^^^^^^ - -error: it is currently not sound to use lifetimes in function signatures - --> ui-tests/invalid-imports-1.rs:36:22 - | -36 | fn f() -> Result<'a>; - | ^^ diff --git a/crates/macro/ui-tests/invalid-imports-2.rs b/crates/macro/ui-tests/invalid-imports-2.rs deleted file mode 100644 index 5cf461dec94..00000000000 --- a/crates/macro/ui-tests/invalid-imports-2.rs +++ /dev/null @@ -1,8 +0,0 @@ -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -extern "C" { - fn f() -> &'static u32; -} - -fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports-2.stderr b/crates/macro/ui-tests/invalid-imports-2.stderr deleted file mode 100644 index aee456ba278..00000000000 --- a/crates/macro/ui-tests/invalid-imports-2.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: cannot return references in #[wasm_bindgen] imports yet - --> ui-tests/invalid-imports-2.rs:5:15 - | -5 | fn f() -> &'static u32; - | ^^^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-imports.rs b/crates/macro/ui-tests/invalid-imports.rs index 7fc9e74510a..ceb7d33bf81 100644 --- a/crates/macro/ui-tests/invalid-imports.rs +++ b/crates/macro/ui-tests/invalid-imports.rs @@ -36,8 +36,6 @@ extern "C" { fn f() -> Result<>; #[wasm_bindgen(catch)] fn f() -> Result<'a>; - #[wasm_bindgen(catch)] - fn f() -> Result<&'static u32>; } fn main() {} diff --git a/crates/macro/ui-tests/invalid-imports.stderr b/crates/macro/ui-tests/invalid-imports.stderr index e1fbeb97ba2..c83c040e862 100644 --- a/crates/macro/ui-tests/invalid-imports.stderr +++ b/crates/macro/ui-tests/invalid-imports.stderr @@ -1,3 +1,9 @@ +error: it is currently not sound to use lifetimes in function signatures + --> ui-tests/invalid-imports.rs:7:16 + | +7 | fn f() -> &'static u32; + | ^^^^^^^ + error: imported methods must have at least one argument --> ui-tests/invalid-imports.rs:10:5 | From 8e992dc906f8cd5ef38479c22c64d4967d8399cf Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 4 Mar 2024 08:51:38 +0100 Subject: [PATCH 378/641] Don't allow invalid Unicode scalar values in `char` (#3866) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/binding.rs | 22 +++++++++++++++++++--- crates/cli-support/src/js/mod.rs | 13 +++++++++++++ src/convert/impls.rs | 1 + tests/wasm/char.js | 10 ++++++++++ tests/wasm/char.rs | 5 +++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8004077535b..324e8faaa4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ * Make .wasm output deterministic when using `--reference-types`. [#3851](https://github.com/rustwasm/wasm-bindgen/pull/3851) +* Don't allow invalid Unicode scalar values in `char`. + [#3866](https://github.com/rustwasm/wasm-bindgen/pull/3866) + -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 4c27d7584e4..ebe4e966c43 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -502,6 +502,11 @@ impl<'a, 'b> JsBuilder<'a, 'b> { self.prelude(&format!("_assertNonNull({});", arg)); } + fn assert_char(&mut self, arg: &str) { + self.cx.expose_assert_char(); + self.prelude(&format!("_assertChar({});", arg)); + } + fn assert_optional_bigint(&mut self, arg: &str) { if !self.cx.config.debug { return; @@ -739,7 +744,11 @@ fn instruction( Instruction::I32FromStringFirstChar => { let val = js.pop(); - js.push(format!("{}.codePointAt(0)", val)); + let i = js.tmp(); + js.prelude(&format!("const char{i} = {val}.codePointAt(0);")); + let val = format!("char{i}"); + js.assert_char(&val); + js.push(val); } Instruction::I32FromExternrefOwned => { @@ -816,11 +825,18 @@ fn instruction( Instruction::I32FromOptionChar => { let val = js.pop(); + let i = js.tmp(); js.cx.expose_is_like_none(); - js.push(format!( - "isLikeNone({0}) ? 0xFFFFFF : {0}.codePointAt(0)", + js.prelude(&format!( + "const char{i} = isLikeNone({0}) ? 0xFFFFFF : {0}.codePointAt(0);", val )); + let val = format!("char{i}"); + js.cx.expose_assert_char(); + js.prelude(&format!( + "if ({val} !== 0xFFFFFF) {{ _assertChar({val}); }}" + )); + js.push(val); } Instruction::I32FromOptionEnum { hole } => { diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 9a3899c9266..35bba115fdc 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2116,6 +2116,19 @@ impl<'a> Context<'a> { ); } + fn expose_assert_char(&mut self) { + if !self.should_write_global("assert_char") { + return; + } + self.global( + " + function _assertChar(c) { + if (typeof(c) === 'number' && (c >= 0x110000 || (c >= 0xD800 && c < 0xE000))) throw new Error(`expected a valid Unicode scalar value, found ${c}`); + } + ", + ); + } + fn expose_make_mut_closure(&mut self) -> Result<(), Error> { if !self.should_write_global("make_mut_closure") { return Ok(()); diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 8d2bf4baf6a..4ecef7821ef 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -188,6 +188,7 @@ impl FromWasmAbi for char { #[inline] unsafe fn from_abi(js: u32) -> char { + // SAFETY: Checked in bindings. char::from_u32_unchecked(js) } } diff --git a/tests/wasm/char.js b/tests/wasm/char.js index d145333e381..b1ee622808f 100644 --- a/tests/wasm/char.js +++ b/tests/wasm/char.js @@ -6,6 +6,7 @@ exports.js_identity = a => a; exports.js_works = () => { assert.strictEqual(wasm.letter(), 'a'); assert.strictEqual(wasm.face(), '😀'); + assert.strictEqual(wasm.rust_identity(''), '\u0000'); assert.strictEqual(wasm.rust_identity('Ղ'), 'Ղ'); assert.strictEqual(wasm.rust_identity('ҝ'), 'ҝ'); assert.strictEqual(wasm.rust_identity('Δ'), 'Δ'); @@ -14,4 +15,13 @@ exports.js_works = () => { assert.strictEqual(wasm.rust_js_identity('㊻'), '㊻'); wasm.rust_letter('a'); wasm.rust_face('😀'); + + assert.strictEqual(wasm.rust_option_identity(undefined), undefined); + assert.strictEqual(wasm.rust_option_identity(null), undefined); + assert.strictEqual(wasm.rust_option_identity(''), '\u0000'); + assert.strictEqual(wasm.rust_option_identity('\u0000'), '\u0000'); + + assert.throws(() => wasm.rust_identity(55357), /c.codePointAt is not a function/); + assert.throws(() => wasm.rust_identity('\uD83D'), /expected a valid Unicode scalar value, found 55357/); + assert.throws(() => wasm.rust_option_identity('\uD83D'), /expected a valid Unicode scalar value, found 55357/); }; diff --git a/tests/wasm/char.rs b/tests/wasm/char.rs index f852b8d8145..d680a1cae43 100644 --- a/tests/wasm/char.rs +++ b/tests/wasm/char.rs @@ -12,6 +12,11 @@ pub fn rust_identity(c: char) -> char { c } +#[wasm_bindgen] +pub fn rust_option_identity(c: Option) -> Option { + c +} + #[wasm_bindgen] pub fn rust_js_identity(c: char) -> char { js_identity(c) From 2a4a4936238cf11e863353e410f453c94e21c7dd Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 4 Mar 2024 11:25:46 +0100 Subject: [PATCH 379/641] Prepare v0.2.92 release (#3869) --- CHANGELOG.md | 4 +++- Cargo.toml | 10 +++++----- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 10 +++++----- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 10 +++++----- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 10 +++++----- crates/webidl/Cargo.toml | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 4 ++-- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 4 ++-- examples/console_log/Cargo.toml | 4 ++-- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 6 +++--- examples/guide-supported-types-examples/Cargo.toml | 4 ++-- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 4 ++-- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 6 +++--- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 ++-- examples/wasm-audio-worklet/Cargo.toml | 6 +++--- examples/wasm-in-wasm-imports/Cargo.toml | 6 +++--- examples/wasm-in-wasm/Cargo.toml | 6 +++--- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 4 ++-- examples/webrtc_datachannel/Cargo.toml | 4 ++-- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 6 +++--- examples/without-a-bundler/Cargo.toml | 2 +- 50 files changed, 108 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324e8faaa4f..b6c36b45dde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) + +Released 2024-03-04 ### Added diff --git a/Cargo.toml b/Cargo.toml index 08cd2dfaa8e..c06934617d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -42,15 +42,15 @@ xxx_debug_only_print_generated_code = [ ] [dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.91" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.92" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.68' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.41' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.41' } +js-sys = { path = 'crates/js-sys', version = '0.3.69' } +wasm-bindgen-test = { path = 'crates/test', version = '=0.3.42' } +wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.42' } serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index b2dccbbbc4a..3e8a4e5f563 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" @@ -23,4 +23,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index ec12dc3dbdc..48bb44f93f1 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli-support" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" @@ -20,10 +20,10 @@ rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" walrus = "0.20.2" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.91' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.91' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.91' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.91' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.91' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.91' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.92' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.92' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.92' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.92' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.92' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.92' } unicode-ident = "1.0.5" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 81f27693583..8872c8b2797 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-cli" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" @@ -34,8 +34,8 @@ ureq = { version = "2.7", default-features = false, features = [ "gzip", ] } walrus = { version = "0.20.2", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.91" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.92" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } [dev-dependencies] assert_cmd = "1.0" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 0b5f80f3779..eb09f087eca 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-externref-xform" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 860e6d741db..eb389cdba8c 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -7,14 +7,14 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.41" +version = "0.4.42" edition = "2018" rust-version = "1.57" [dependencies] cfg-if = "1.0.0" -js-sys = { path = "../js-sys", version = '0.3.68' } -wasm-bindgen = { path = "../..", version = '0.2.91' } +js-sys = { path = "../js-sys", version = '0.3.69' } +wasm-bindgen = { path = "../..", version = '0.2.92' } futures-core = { version = '0.3.8', default-features = false, optional = true } [features] @@ -29,6 +29,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.41' } +wasm-bindgen-test = { path = '../test', version = '0.3.42' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index ca5f849f85b..a8c476856bd 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "js-sys" -version = "0.3.68" +version = "0.3.69" authors = ["The wasm-bindgen Developers"] readme = "./README.md" categories = ["wasm"] @@ -20,9 +20,9 @@ test = false doctest = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.91" } +wasm-bindgen = { path = "../..", version = "0.2.92" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.41' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } -web-sys = { path = "../web-sys", version = "0.3.68", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test', version = '=0.3.42' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } +web-sys = { path = "../web-sys", version = "0.3.69", features = ["Headers", "Response", "ResponseInit"] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 6a13463b9be..e809478d699 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" @@ -21,5 +21,5 @@ strict-macro = [] syn = { version = '2.0', features = ['visit', 'full'] } quote = '1.0' proc-macro2 = "1.0" -wasm-bindgen-backend = { path = "../backend", version = "=0.2.91" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.91" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.92" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 46ceac29a36..5aead30add2 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" @@ -21,11 +21,11 @@ xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.91" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.92" } quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.91" } -wasm-bindgen-futures = { path = "../futures", version = "0.4.41" } -web-sys = { path = "../web-sys", version = "0.3.68", features = ["Worker"] } +wasm-bindgen = { path = "../..", version = "0.2.92" } +wasm-bindgen-futures = { path = "../futures", version = "0.4.42" } +web-sys = { path = "../web-sys", version = "0.3.69", features = ["Worker"] } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index dd6a7a0e6f4..a363d87760e 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-multi-value-xform" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index a5d90fcda60..ae438cf53a9 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 4dccf097327..99c62981876 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test-macro" -version = "0.3.41" +version = "0.3.42" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT OR Apache-2.0" diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index d7f5dc0794a..001e6814ea0 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-test" -version = "0.3.41" +version = "0.3.42" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT OR Apache-2.0" @@ -10,11 +10,11 @@ rust-version = "1.57" [dependencies] console_error_panic_hook = '0.1' -js-sys = { path = '../js-sys', version = '0.3.68' } +js-sys = { path = '../js-sys', version = '0.3.69' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.91' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.41' } +wasm-bindgen = { path = '../..', version = '0.2.92' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.42' } gg-alloc = { version = "1.0", optional = true } [lib] diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index e55df83bfdb..14edd58207e 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-threads-xform" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" @@ -15,7 +15,7 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" walrus = "0.20.2" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.91" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index aee55476b0c..02bfc3d762a 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-conventions" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 5f53464da0f..879602ec935 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.91" +version = "0.2.92" authors = ["The wasm-bindgen Developers"] license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" @@ -16,7 +16,7 @@ rust-version = "1.57" anyhow = "1.0" log = "0.4" walrus = "0.20.2" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.91" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.92" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 66ce7b01134..b1ef8a63c00 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-sys" -version = "0.3.68" +version = "0.3.69" authors = ["The wasm-bindgen Developers"] readme = "./README.md" homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" @@ -22,12 +22,12 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.91" } -js-sys = { path = '../js-sys', version = '0.3.68' } +wasm-bindgen = { path = "../..", version = "0.2.92" } +js-sys = { path = '../js-sys', version = '0.3.69' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.41' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.41' } +wasm-bindgen-test = { path = '../test', version = '0.3.42' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } # This list is auto-generated by the wasm-bindgen-webidl program [features] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index d004298a23f..3f3663ef2a6 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -21,7 +21,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-backend = { version = "=0.2.91", path = "../backend" } +wasm-bindgen-backend = { version = "=0.2.92", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.1" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index cdeabc31055..5cbc88d4e79 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index d0088cc344c..8fc55fc09b0 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index c848952902a..6378d2aab0e 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 1021f1a35cd..31f0d065a19 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -js-sys = "0.3.68" +wasm-bindgen = "0.2.92" +js-sys = "0.3.69" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 64f5939909e..e5aa71a73f2 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -9,5 +9,5 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -web-sys = { version = "0.3.68", features = ['console'] } +wasm-bindgen = "0.2.92" +web-sys = { version = "0.3.69", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index d2a17d0d6fe..c4f54a9f227 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 4556a2c7eb5..0ce8e8ac8da 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index c5f6b1d6108..e7835f2c866 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 0f6e74688f5..4e3e0221f0d 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -9,9 +9,9 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -js-sys = "0.3.68" -wasm-bindgen-futures = "0.4.41" +wasm-bindgen = "0.2.92" +js-sys = "0.3.69" +wasm-bindgen-futures = "0.4.42" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index c61262759d7..3d7c676ed75 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -9,5 +9,5 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -js-sys = "0.3.68" +wasm-bindgen = "0.2.92" +js-sys = "0.3.69" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 5ea4ba06bdc..af785ee9a0e 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index cd87a9b86dc..eec97f08e6b 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index e16590c3782..9ec7b105958 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index e4a108d5672..8bfe388ca65 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 46aa55a156e..6893b153ad1 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" humantime = "2" [dependencies.web-sys] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index ebdf77b6037..1120fab045a 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -10,14 +10,14 @@ crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.68" +js-sys = "0.3.69" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.4.3" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = "0.2.91" -wasm-bindgen-futures = "0.4.41" +wasm-bindgen = "0.2.92" +wasm-bindgen-futures = "0.4.42" [dependencies.web-sys] version = "0.3.23" diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 69a7ace580b..1497c24bbe8 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index bdf4115e491..900e06dca74 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index e8966679a0f..e5a030c5e60 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -12,8 +12,8 @@ crate-type = ["cdylib"] askama = "0.10.0" [dependencies] -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" askama = "0.10.0" console_error_panic_hook = "0.1.5" diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index 1bcbe841bae..9345765d1c0 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -9,9 +9,9 @@ crate-type = ["cdylib"] [dependencies] console_log = "0.2.0" -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" -wasm-bindgen-futures = "0.4.41" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" +wasm-bindgen-futures = "0.4.42" [dependencies.web-sys] version = "0.3.59" diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 5431abe2766..2083ce4bbd3 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -9,6 +9,6 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -js-sys = "0.3.68" -wasm-bindgen-futures = "0.4.41" +wasm-bindgen = "0.2.92" +js-sys = "0.3.69" +wasm-bindgen-futures = "0.4.42" diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index b2a8e4837d7..2556bb3d8ef 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -9,6 +9,6 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" -js-sys = "0.3.68" -wasm-bindgen-futures = "0.4.41" +wasm-bindgen = "0.2.92" +js-sys = "0.3.69" +wasm-bindgen-futures = "0.4.42" diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 8314c662b1e..3505c6264c1 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index d36f812dd9f..d1b32152293 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -9,4 +9,4 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 628c24be45a..a7e9d25c509 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -16,7 +16,7 @@ chrono = "0.4.11" reqwest = "0.10.6" wasm-bindgen-futures = "0.4.1" json= "*" -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" gloo = "0.2.1" [dependencies.web-sys] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index a49681852c9..628b967fbea 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index c1452b377f9..2cea61a990d 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -9,8 +9,8 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 32fcd5dd78d..aa7abf9a026 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -9,9 +9,9 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" js-sys = "0.3" -wasm-bindgen-futures = "0.4.41" +wasm-bindgen-futures = "0.4.42" [dependencies.web-sys] version = "0.3.22" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 97f537d4800..1a8f5b19904 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" js-sys = "0.3" [dependencies.web-sys] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 1ed18c404e5..d9f51321769 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -10,9 +10,9 @@ crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.68" -wasm-bindgen = "0.2.91" -wasm-bindgen-futures = "0.4.41" +js-sys = "0.3.69" +wasm-bindgen = "0.2.92" +wasm-bindgen-futures = "0.4.42" [dependencies.web-sys] version = "0.3.37" diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index b55ed46122c..3c5025647d6 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.57" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.91" +wasm-bindgen = "0.2.92" [dependencies.web-sys] version = "0.3.4" From f0f3a477164769c025a7d36e40211ab3e02d3a73 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 6 Mar 2024 09:09:00 +0100 Subject: [PATCH 380/641] Account for failure in publishing process (#3870) --- publish.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.rs b/publish.rs index d643fc63ddd..e3ea6728a30 100644 --- a/publish.rs +++ b/publish.rs @@ -216,6 +216,6 @@ fn publish(krate: &Crate) { .status() .expect("failed to run cargo"); if !status.success() { - println!("FAIL: failed to publish `{}`: {}", krate.name, status); + panic!("FAIL: failed to publish `{}`: {}", krate.name, status); } } From ac462d586a0e40371c140c6f4229546c0d652491 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 6 Mar 2024 22:04:28 +0100 Subject: [PATCH 381/641] Copy port from headless test server when using WASM_BINDGEN_TEST_ADDRESS (#3873) --- CHANGELOG.md | 9 ++++++++- crates/cli-support/src/js/mod.rs | 19 ------------------- .../bin/wasm-bindgen-test-runner/headless.rs | 16 ++++++++++++++-- crates/cli/src/bin/wasm-bindgen.rs | 1 + 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c36b45dde..4094197a859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Fixed + +* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. + [#3873](https://github.com/rustwasm/wasm-bindgen/pull/3873) + ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) Released 2024-03-04 @@ -249,7 +256,7 @@ Released 2023-11-01 It was also automatically changed for `IdbFileHandle`, which is deprecated. [#3537](https://github.com/rustwasm/wasm-bindgen/pull/3537) -* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and +* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and non-WASM targets, generating a stub that panics when called rather than a wasm- bindgen placeholder. [#3233](https://github.com/rustwasm/wasm-bindgen/pull/3233) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 35bba115fdc..738035e69f8 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1768,25 +1768,6 @@ impl<'a> Context<'a> { self.memview("Float64", memory) } - fn memview_function(&mut self, t: VectorKind, memory: MemoryId) -> MemView { - match t { - VectorKind::String => self.expose_uint8_memory(memory), - VectorKind::I8 => self.expose_int8_memory(memory), - VectorKind::U8 => self.expose_uint8_memory(memory), - VectorKind::ClampedU8 => self.expose_clamped_uint8_memory(memory), - VectorKind::I16 => self.expose_int16_memory(memory), - VectorKind::U16 => self.expose_uint16_memory(memory), - VectorKind::I32 => self.expose_int32_memory(memory), - VectorKind::U32 => self.expose_uint32_memory(memory), - VectorKind::I64 => self.expose_int64_memory(memory), - VectorKind::U64 => self.expose_uint64_memory(memory), - VectorKind::F32 => self.expose_f32_memory(memory), - VectorKind::F64 => self.expose_f64_memory(memory), - VectorKind::Externref => self.expose_uint32_memory(memory), - VectorKind::NamedExternref(_) => self.expose_uint32_memory(memory), - } - } - fn memview(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView { let view = self.memview_memory(kind, memory); if !self.should_write_global(view.name.clone()) { diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 08d9b7fc85c..c001344c602 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -121,8 +121,20 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error // Visit our local server to open up the page that runs tests, and then get // some handles to objects on the page which we'll be scraping output from. - let url = - std::env::var("WASM_BINDGEN_TEST_ADDRESS").unwrap_or_else(|_| format!("http://{}", server)); + // + // If WASM_BINDGEN_TEST_ADDRESS is set, use it as the local server URL, + // trying to inherit the port from the server if it isn't specified. + let url = match std::env::var("WASM_BINDGEN_TEST_ADDRESS") { + Ok(u) => { + let mut url = Url::parse(&u)?; + if url.port().is_none() { + url.set_port(Some(server.port())).unwrap(); + } + url.to_string() + } + Err(_) => format!("http://{}", server), + }; + shell.status(&format!("Visiting {}...", url)); client.goto(&id, &url)?; shell.status("Loading page elements..."); diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index 78d9e1bd6be..b62449392c9 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -63,6 +63,7 @@ struct Args { flag_no_modules_global: Option, flag_remove_name_section: bool, flag_remove_producers_section: bool, + #[allow(dead_code)] flag_weak_refs: Option, flag_reference_types: Option, flag_keep_lld_exports: bool, From e22f754e06398dd8eaa16e140bcc1136984968a8 Mon Sep 17 00:00:00 2001 From: battmdpkq <134909256+battmdpkq@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:16:05 +0800 Subject: [PATCH 382/641] fix some comments (#3875) --- crates/web-sys/tests/wasm/element.rs | 4 ++-- guide/src/examples/wasm-in-web-worker.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/web-sys/tests/wasm/element.rs b/crates/web-sys/tests/wasm/element.rs index fcb423715c8..3e54cdc9372 100644 --- a/crates/web-sys/tests/wasm/element.rs +++ b/crates/web-sys/tests/wasm/element.rs @@ -195,12 +195,12 @@ fn element() { */ assert!( - element.query_selector(".none-existant").unwrap().is_none(), + element.query_selector(".none-existent").unwrap().is_none(), "Should return no results" ); assert_eq!( element - .query_selector_all(".none-existant") + .query_selector_all(".none-existent") .unwrap() .length(), 0, diff --git a/guide/src/examples/wasm-in-web-worker.md b/guide/src/examples/wasm-in-web-worker.md index ef8fef92cbc..67dca9fe251 100644 --- a/guide/src/examples/wasm-in-web-worker.md +++ b/guide/src/examples/wasm-in-web-worker.md @@ -42,7 +42,7 @@ when the worker returns a message. Includes the input element `#inputNumber` to type a number into and a HTML element `#resultField` were the result of the evaluation even/odd is written to. Since we require to build with `--target no-modules` to be able to load Wasm -code in in the worker across browsers, the `index.html` also includes loading +code in the worker across browsers, the `index.html` also includes loading both `wasm_in_web_worker.js` and `index.js`. ```html From ad4e4435e310dcebe6a14be34ef027e916306fb1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 9 Mar 2024 01:16:36 +0100 Subject: [PATCH 383/641] Implement `From>` for `JsValue` (#3877) --- CHANGELOG.md | 5 +++++ src/lib.rs | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4094197a859..be9404e05f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Unreleased +### Added + +* Implement `From>` for `JsValue`. + [#3877](https://github.com/rustwasm/wasm-bindgen/pull/3877) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/src/lib.rs b/src/lib.rs index f38d6a3e2c4..2f9e48e6d77 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ use core::mem; use core::ops::{ Add, BitAnd, BitOr, BitXor, Deref, DerefMut, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub, }; +use core::ptr::NonNull; use core::u32; use crate::convert::{FromWasmAbi, TryFromJsValue, WasmRet, WasmSlice}; @@ -790,6 +791,13 @@ impl From<*const T> for JsValue { } } +impl From> for JsValue { + #[inline] + fn from(s: NonNull) -> JsValue { + JsValue::from(s.as_ptr() as usize) + } +} + if_std! { impl<'a> From<&'a String> for JsValue { #[inline] From 3f129ae5be3e13f9eca57742653525aa9103dc79 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 10 Mar 2024 22:32:17 +0100 Subject: [PATCH 384/641] Fix nits in multi-threaded futures implementation (#3880) --- crates/futures/src/task/multithread.rs | 6 +++--- crates/futures/src/task/wait_async_polyfill.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index 6cfdfcb5437..2f00fad81a5 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -36,7 +36,7 @@ impl AtomicWaker { // from SLEEPING to AWAKE. unsafe { core::arch::wasm32::memory_atomic_notify( - &self.state as *const AtomicI32 as *mut i32, + self.state.as_ptr(), 1, // Number of threads to notify ); } @@ -173,7 +173,7 @@ fn wait_async(ptr: &AtomicI32, current_value: i32) -> Option { } else { let mem = wasm_bindgen::memory().unchecked_into::(); let array = js_sys::Int32Array::new(&mem.buffer()); - let result = Atomics::wait_async(&array, ptr as *const AtomicI32 as i32 / 4, current_value); + let result = Atomics::wait_async(&array, ptr.as_ptr() as u32 / 4, current_value); if result.async_() { Some(result.value()) } else { @@ -187,7 +187,7 @@ fn wait_async(ptr: &AtomicI32, current_value: i32) -> Option { type WaitAsyncResult; #[wasm_bindgen(static_method_of = Atomics, js_name = waitAsync)] - fn wait_async(buf: &js_sys::Int32Array, index: i32, value: i32) -> WaitAsyncResult; + fn wait_async(buf: &js_sys::Int32Array, index: u32, value: i32) -> WaitAsyncResult; #[wasm_bindgen(static_method_of = Atomics, js_name = waitAsync, getter)] fn get_wait_async() -> JsValue; diff --git a/crates/futures/src/task/wait_async_polyfill.rs b/crates/futures/src/task/wait_async_polyfill.rs index 68332d91a57..ff0a8f5aa19 100644 --- a/crates/futures/src/task/wait_async_polyfill.rs +++ b/crates/futures/src/task/wait_async_polyfill.rs @@ -80,7 +80,7 @@ pub fn wait_async(ptr: &AtomicI32, value: i32) -> Promise { let data = Array::of3( &wasm_bindgen::memory(), - &JsValue::from(ptr as *const AtomicI32 as i32 / 4), + &JsValue::from(ptr.as_ptr() as u32 / 4), &JsValue::from(value), ); From 1317b34c099a4e09b5b28ff19a5c60afd2375f05 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 10 Mar 2024 23:49:22 +0100 Subject: [PATCH 385/641] Make `catch` thread safe (#3879) --- CHANGELOG.md | 5 +++++ .../tests/reference/anyref-import-catch.wat | 8 +++---- crates/cli/tests/reference/import-catch.wat | 4 ++-- src/lib.rs | 22 ++++++++++--------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be9404e05f6..580a0eed76e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. [#3873](https://github.com/rustwasm/wasm-bindgen/pull/3873) +* Fix `catch` not being thread-safe. + [#3879](https://github.com/rustwasm/wasm-bindgen/pull/3879) + +-------------------------------------------------------------------------------- + ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) Released 2024-03-04 diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 48071a315d7..16adbbe6783 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -4,10 +4,10 @@ (type (;2;) (func (param i32))) (type (;3;) (func (param i32) (result i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $__wbindgen_exn_store (;1;) (type 2) (param i32)) - (func $__externref_table_dealloc (;2;) (type 2) (param i32)) - (func $exported (;3;) (type 2) (param i32)) - (func $__externref_table_alloc (;4;) (type 1) (result i32)) + (func $__externref_table_dealloc (;1;) (type 2) (param i32)) + (func $exported (;2;) (type 2) (param i32)) + (func $__externref_table_alloc (;3;) (type 1) (result i32)) + (func $__wbindgen_exn_store (;4;) (type 2) (param i32)) (func $__wbindgen_add_to_stack_pointer (;5;) (type 3) (param i32) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import-catch.wat index f291a4a46a3..614e0b61b3c 100644 --- a/crates/cli/tests/reference/import-catch.wat +++ b/crates/cli/tests/reference/import-catch.wat @@ -1,8 +1,8 @@ (module (type (;0;) (func (param i32))) (type (;1;) (func (param i32) (result i32))) - (func $__wbindgen_exn_store (;0;) (type 0) (param i32)) - (func $exported (;1;) (type 0) (param i32)) + (func $exported (;0;) (type 0) (param i32)) + (func $__wbindgen_exn_store (;1;) (type 0) (param i32)) (func $__wbindgen_add_to_stack_pointer (;2;) (type 1) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) diff --git a/src/lib.rs b/src/lib.rs index 2f9e48e6d77..fdef0e8d39a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1687,26 +1687,28 @@ pub mod __rt { crate::externref::link_intrinsics(); } - static mut GLOBAL_EXNDATA: [u32; 2] = [0; 2]; + std::thread_local! { + static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + } #[no_mangle] pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { - debug_assert_eq!(GLOBAL_EXNDATA[0], 0); - GLOBAL_EXNDATA[0] = 1; - GLOBAL_EXNDATA[1] = idx; + GLOBAL_EXNDATA.with(|data| { + debug_assert_eq!(data.get()[0], 0); + data.set([1, idx]); + }); } pub fn take_last_exception() -> Result<(), super::JsValue> { - unsafe { - let ret = if GLOBAL_EXNDATA[0] == 1 { - Err(super::JsValue::_new(GLOBAL_EXNDATA[1])) + GLOBAL_EXNDATA.with(|data| { + let ret = if data.get()[0] == 1 { + Err(super::JsValue::_new(data.get()[1])) } else { Ok(()) }; - GLOBAL_EXNDATA[0] = 0; - GLOBAL_EXNDATA[1] = 0; + data.set([0, 0]); ret - } + }) } /// An internal helper trait for usage in `#[wasm_bindgen]` on `async` From 3e378a7bbfb4e3500ba100f109f433ffb2f178d6 Mon Sep 17 00:00:00 2001 From: burrscurr Date: Tue, 12 Mar 2024 23:30:32 +0100 Subject: [PATCH 386/641] Mark Web Share API as stable (#3882) --- CHANGELOG.md | 5 ++++ crates/web-sys/src/features/gen_Navigator.rs | 16 ------------ crates/web-sys/src/features/gen_ShareData.rs | 25 ------------------- .../{unstable => enabled}/Share.webidl | 3 +-- 4 files changed, 6 insertions(+), 43 deletions(-) rename crates/web-sys/webidls/{unstable => enabled}/Share.webidl (93%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 580a0eed76e..dbcd39a3d01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ * Implement `From>` for `JsValue`. [#3877](https://github.com/rustwasm/wasm-bindgen/pull/3877) +### Changed + +* Stabilize Web Share API. + [#3882](https://github.com/rustwasm/wasm-bindgen/pull/3882) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index a9b499e6d3e..e97839f9333 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -331,18 +331,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`, `StorageManager`*"] pub fn storage(this: &Navigator) -> StorageManager; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = canShare)] #[doc = "The `canShare()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/canShare)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn can_share(this: &Navigator) -> bool; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ShareData")] # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = canShare)] #[doc = "The `canShare()` method."] @@ -350,9 +345,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/canShare)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`, `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn can_share_with_data(this: &Navigator, data: &ShareData) -> bool; # [wasm_bindgen (catch , method , structural , js_class = "Navigator" , js_name = getGamepads)] #[doc = "The `getGamepads()` method."] @@ -501,18 +493,13 @@ extern "C" { url: &str, data: Option<&ReadableStream>, ) -> Result; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = share)] #[doc = "The `share()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn share(this: &Navigator) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ShareData")] # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = share)] #[doc = "The `share()` method."] @@ -520,9 +507,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`, `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn share_with_data(this: &Navigator, data: &ShareData) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = vibrate)] #[doc = "The `vibrate()` method."] diff --git a/crates/web-sys/src/features/gen_ShareData.rs b/crates/web-sys/src/features/gen_ShareData.rs index cc44f17d96d..04cb1e6ce4e 100644 --- a/crates/web-sys/src/features/gen_ShareData.rs +++ b/crates/web-sys/src/features/gen_ShareData.rs @@ -2,7 +2,6 @@ #![allow(clippy::all)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ShareData)] @@ -10,31 +9,20 @@ extern "C" { #[doc = "The `ShareData` dictionary."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ShareData; } -#[cfg(web_sys_unstable_apis)] impl ShareData { #[doc = "Construct a new `ShareData`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[cfg(web_sys_unstable_apis)] #[doc = "Change the `files` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn files(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("files"), &JsValue::from(val)); @@ -45,13 +33,9 @@ impl ShareData { let _ = r; self } - #[cfg(web_sys_unstable_apis)] #[doc = "Change the `text` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn text(&mut self, val: &str) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("text"), &JsValue::from(val)); @@ -62,13 +46,9 @@ impl ShareData { let _ = r; self } - #[cfg(web_sys_unstable_apis)] #[doc = "Change the `title` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn title(&mut self, val: &str) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val)); @@ -79,13 +59,9 @@ impl ShareData { let _ = r; self } - #[cfg(web_sys_unstable_apis)] #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn url(&mut self, val: &str) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); @@ -97,7 +73,6 @@ impl ShareData { self } } -#[cfg(web_sys_unstable_apis)] impl Default for ShareData { fn default() -> Self { Self::new() diff --git a/crates/web-sys/webidls/unstable/Share.webidl b/crates/web-sys/webidls/enabled/Share.webidl similarity index 93% rename from crates/web-sys/webidls/unstable/Share.webidl rename to crates/web-sys/webidls/enabled/Share.webidl index 570af69a84f..4738dd231c6 100644 --- a/crates/web-sys/webidls/unstable/Share.webidl +++ b/crates/web-sys/webidls/enabled/Share.webidl @@ -1,14 +1,13 @@ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * API for sharing text, links and other content to an arbitrary destination of the user's choice. - * W3C Working Draft, 22 November 2021 + * W3C Recommendation, 30 May 2023 * The origin of this IDL file is: * https://www.w3.org/TR/web-share */ partial interface Navigator { [SecureContext] Promise share(optional ShareData data = {}); - [SecureContext] boolean canShare(optional ShareData data = {}); }; From b3121a6d672447bed6a2f51abc60e5d3ac0b4761 Mon Sep 17 00:00:00 2001 From: ZGY <1786718956@qq.com> Date: Wed, 13 Mar 2024 23:53:50 +0800 Subject: [PATCH 387/641] Add methods for Typed Array and Array (#3888) --- CHANGELOG.md | 3 ++ crates/js-sys/src/lib.rs | 29 ++++++++++++++++++++ crates/js-sys/tests/wasm/Array.rs | 38 ++++++++++++++++++++++++++ crates/js-sys/tests/wasm/TypedArray.rs | 18 ++++++++++++ 4 files changed, 88 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbcd39a3d01..141143e0b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Implement `From>` for `JsValue`. [#3877](https://github.com/rustwasm/wasm-bindgen/pull/3877) +* Add method `copy_within` for TypedArray, add methods `find_last`,`find_last_index` for Array. + [#3888](https://github.com/rustwasm/wasm-bindgen/pull/3888) + ### Changed * Stabilize Web Share API. diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index a244b7b70a0..3c1196b7e51 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -381,6 +381,28 @@ extern "C" { #[wasm_bindgen(method, js_name = findIndex)] pub fn find_index(this: &Array, predicate: &mut dyn FnMut(JsValue, u32, Array) -> bool) -> i32; + /// The `findLast()` method of Array instances iterates the array in reverse order + /// and returns the value of the first element that satisfies the provided testing function. + /// If no elements satisfy the testing function, undefined is returned. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast) + #[wasm_bindgen(method, js_name = findLast)] + pub fn find_last( + this: &Array, + predicate: &mut dyn FnMut(JsValue, u32, Array) -> bool, + ) -> JsValue; + + /// The `findLastIndex()` method of Array instances iterates the array in reverse order + /// and returns the index of the first element that satisfies the provided testing function. + /// If no elements satisfy the testing function, -1 is returned. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex) + #[wasm_bindgen(method, js_name = findLastIndex)] + pub fn find_last_index( + this: &Array, + predicate: &mut dyn FnMut(JsValue, u32, Array) -> bool, + ) -> i32; + /// The `flat()` method creates a new array with all sub-array elements concatenated into it /// recursively up to the specified depth. /// @@ -6174,6 +6196,13 @@ macro_rules! arrays { #[wasm_bindgen(method)] pub fn at(this: &$name, idx: i32) -> Option<$ty>; + /// The `copyWithin()` method shallow copies part of a typed array to another + /// location in the same typed array and returns it, without modifying its size. + /// + /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/copyWithin) + #[wasm_bindgen(method, js_name = copyWithin)] + pub fn copy_within(this: &$name, target: i32, start: i32, end: i32) -> $name; + /// Gets the value at `idx`, equivalent to the javascript `my_var = arr[idx]`. #[wasm_bindgen(method, structural, indexing_getter)] pub fn get_index(this: &$name, idx: u32) -> $ty; diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index 3934389f077..b2ff7419d5f 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -463,6 +463,25 @@ fn find() { ); } +#[wasm_bindgen_test] +fn find_last() { + let even = js_array![2, 4, 6, 8]; + assert_eq!( + even.find_last(&mut |x, _, _| x.as_f64().unwrap() % 2.0 == 0.0), + 8 + ); + let odd = js_array![1, 3, 5, 7]; + assert_eq!( + odd.find_last(&mut |x, _, _| x.as_f64().unwrap() % 2.0 == 0.0), + JsValue::undefined(), + ); + let mixed = js_array![3, 5, 7, 10]; + assert_eq!( + mixed.find_last(&mut |x, _, _| x.as_f64().unwrap() % 2.0 != 0.0), + 7 + ); +} + #[wasm_bindgen_test] fn map() { let numbers = js_array![1, 4, 9]; @@ -511,6 +530,25 @@ fn find_index() { ); } +#[wasm_bindgen_test] +fn find_last_index() { + let even = js_array![2, 4, 6, 8]; + assert_eq!( + even.find_last_index(&mut |e, _, _| e.as_f64().unwrap() % 2. == 0.), + 3 + ); + let odd = js_array![1, 3, 5, 7]; + assert_eq!( + odd.find_last_index(&mut |e, _, _| e.as_f64().unwrap() % 2. == 0.), + -1 + ); + let mixed = js_array![3, 5, 7, 10]; + assert_eq!( + mixed.find_last_index(&mut |e, _, _| e.as_f64().unwrap() % 2. != 0.), + 2 + ); +} + #[wasm_bindgen_test] fn to_locale_string() { let output = js_array![1, "a", Date::new(&"21 Dec 1997 14:12:00 UTC".into())] diff --git a/crates/js-sys/tests/wasm/TypedArray.rs b/crates/js-sys/tests/wasm/TypedArray.rs index adb468313e6..36459696d68 100644 --- a/crates/js-sys/tests/wasm/TypedArray.rs +++ b/crates/js-sys/tests/wasm/TypedArray.rs @@ -100,6 +100,24 @@ fn new_at() { each!(test_at); } +macro_rules! test_copy_within { + ($arr:ident) => {{ + let x: Vec<_> = vec![8, 5, 4, 3, 1, 2]; + let array = $arr::from(x.into_iter().map(|v| v as _).collect::>().as_slice()); + array.copy_within(1, 4, 5); + + assert_eq!(array.get_index(1) as f64, 1f64); + + // if negatives were used + array.copy_within(-1, -3, -2); + assert_eq!(array.get_index(5) as f64, 3f64); + }}; +} +#[wasm_bindgen_test] +fn new_copy_within() { + each!(test_copy_within); +} + macro_rules! test_get_set { ($arr:ident) => {{ let arr = $arr::new(&1.into()); From 78463a2fd7ade4a975b2c4a28b508732173cd0a6 Mon Sep 17 00:00:00 2001 From: Thomas Etter Date: Thu, 14 Mar 2024 04:52:36 +0100 Subject: [PATCH 388/641] Add a crates/cli/tests/reference/enums.rs test to visualize the current (#3874) --- crates/cli/tests/reference/enums.d.ts | 19 ++++++++++ crates/cli/tests/reference/enums.js | 54 +++++++++++++++++++++++++++ crates/cli/tests/reference/enums.rs | 19 ++++++++++ crates/cli/tests/reference/enums.wat | 9 +++++ 4 files changed, 101 insertions(+) create mode 100644 crates/cli/tests/reference/enums.d.ts create mode 100644 crates/cli/tests/reference/enums.js create mode 100644 crates/cli/tests/reference/enums.rs create mode 100644 crates/cli/tests/reference/enums.wat diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts new file mode 100644 index 00000000000..14d117668b7 --- /dev/null +++ b/crates/cli/tests/reference/enums.d.ts @@ -0,0 +1,19 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +* @param {Color} color +* @returns {Color} +*/ +export function enum_echo(color: Color): Color; +/** +* @param {Color | undefined} [color] +* @returns {Color | undefined} +*/ +export function option_enum_echo(color?: Color): Color | undefined; +/** +*/ +export enum Color { + Green = 0, + Yellow = 1, + Red = 2, +} diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js new file mode 100644 index 00000000000..4a0ea680071 --- /dev/null +++ b/crates/cli/tests/reference/enums.js @@ -0,0 +1,54 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8Memory0 = null; + +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} +/** +* @param {Color} color +* @returns {Color} +*/ +export function enum_echo(color) { + const ret = wasm.enum_echo(color); + return ret; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} +/** +* @param {Color | undefined} [color] +* @returns {Color | undefined} +*/ +export function option_enum_echo(color) { + const ret = wasm.option_enum_echo(isLikeNone(color) ? 3 : color); + return ret === 3 ? undefined : ret; +} + +/** +*/ +export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs new file mode 100644 index 00000000000..48a58d455ca --- /dev/null +++ b/crates/cli/tests/reference/enums.rs @@ -0,0 +1,19 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +#[derive(PartialEq, Debug)] +pub enum Color { + Green, + Yellow, + Red, +} + +#[wasm_bindgen] +pub fn enum_echo(color: Color) -> Color { + color +} + +#[wasm_bindgen] +pub fn option_enum_echo(color: Option) -> Option { + color +} diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat new file mode 100644 index 00000000000..2cfcab3718b --- /dev/null +++ b/crates/cli/tests/reference/enums.wat @@ -0,0 +1,9 @@ +(module + (type (;0;) (func (param i32) (result i32))) + (func $enum_echo (;0;) (type 0) (param i32) (result i32)) + (func $option_enum_echo (;1;) (type 0) (param i32) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "enum_echo" (func $enum_echo)) + (export "option_enum_echo" (func $option_enum_echo)) +) From 88efe468e68cf4f0d8cee87ee3a01de5f5739656 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Mon, 25 Mar 2024 11:10:24 +1100 Subject: [PATCH 389/641] Implement `Into` for `Vec` (#3630) * Implement `Into` for `Vec` This means that `Vec`s can now be returned from `async` functions. Fixes #3155. I had to add a new `VectorIntoJsValue` trait, since similarly to `VectorIntoWasmAbi` the orphan rule won't let us directly implement `From>` for `JsValue` outside of `wasm-bindgen`. * Implement Into for boxed slices of numbers as well * Add changelog entry * Fix memory leak * Add missing if_std! * Move the changelog entry to the right spot --- CHANGELOG.md | 3 + crates/backend/src/codegen.rs | 12 +++ crates/cli-support/src/intrinsic.rs | 43 ++++++++++ crates/cli-support/src/js/mod.rs | 25 ++++++ src/lib.rs | 117 ++++++++++++++++++++++++++++ tests/wasm/async_vecs.js | 17 ++++ tests/wasm/async_vecs.rs | 66 ++++++++++++++++ tests/wasm/main.rs | 1 + 8 files changed, 284 insertions(+) create mode 100644 tests/wasm/async_vecs.js create mode 100644 tests/wasm/async_vecs.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 141143e0b6e..0add0955534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Add method `copy_within` for TypedArray, add methods `find_last`,`find_last_index` for Array. [#3888](https://github.com/rustwasm/wasm-bindgen/pull/3888) +* Added support for returning `Vec`s from async functions. + [#3630](https://github.com/rustwasm/wasm-bindgen/pull/3630) + ### Changed * Stabilize Web Share API. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index bbcbc9cea14..65c8cd08915 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -365,6 +365,12 @@ impl ToTokens for ast::Struct { #wasm_bindgen::convert::js_value_vector_from_abi(js) } } + + impl #wasm_bindgen::__rt::VectorIntoJsValue for #name { + fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::std::boxed::Box<[#name]>) -> #wasm_bindgen::JsValue { + #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) + } + } }) .to_tokens(tokens); @@ -1509,6 +1515,12 @@ impl ToTokens for ast::Enum { #wasm_bindgen::convert::js_value_vector_from_abi(js) } } + + impl #wasm_bindgen::__rt::VectorIntoJsValue for #enum_name { + fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]>) -> #wasm_bindgen::JsValue { + #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) + } + } }) .to_tokens(into); } diff --git a/crates/cli-support/src/intrinsic.rs b/crates/cli-support/src/intrinsic.rs index ea209a47fa4..6141fdb4a52 100644 --- a/crates/cli-support/src/intrinsic.rs +++ b/crates/cli-support/src/intrinsic.rs @@ -79,6 +79,10 @@ fn slice(contents: Descriptor) -> Descriptor { Descriptor::Ref(Box::new(Descriptor::Slice(Box::new(contents)))) } +fn vector(contents: Descriptor) -> Descriptor { + Descriptor::Vector(Box::new(contents)) +} + intrinsics! { pub enum Intrinsic { #[symbol = "__wbindgen_jsval_eq"] @@ -264,6 +268,45 @@ intrinsics! { #[symbol = "__wbindgen_copy_to_typed_array"] #[signature = fn(slice(U8), ref_externref()) -> Unit] CopyToTypedArray, + #[symbol = "__wbindgen_uint8_array_new"] + #[signature = fn(vector(U8)) -> Externref] + Uint8ArrayNew, + #[symbol = "__wbindgen_uint8_clamped_array_new"] + #[signature = fn(vector(ClampedU8)) -> Externref] + Uint8ClampedArrayNew, + #[symbol = "__wbindgen_uint16_array_new"] + #[signature = fn(vector(U16)) -> Externref] + Uint16ArrayNew, + #[symbol = "__wbindgen_uint32_array_new"] + #[signature = fn(vector(U32)) -> Externref] + Uint32ArrayNew, + #[symbol = "__wbindgen_biguint64_array_new"] + #[signature = fn(vector(U64)) -> Externref] + BigUint64ArrayNew, + #[symbol = "__wbindgen_int8_array_new"] + #[signature = fn(vector(I8)) -> Externref] + Int8ArrayNew, + #[symbol = "__wbindgen_int16_array_new"] + #[signature = fn(vector(I16)) -> Externref] + Int16ArrayNew, + #[symbol = "__wbindgen_int32_array_new"] + #[signature = fn(vector(I32)) -> Externref] + Int32ArrayNew, + #[symbol = "__wbindgen_bigint64_array_new"] + #[signature = fn(vector(I64)) -> Externref] + BigInt64ArrayNew, + #[symbol = "__wbindgen_float32_array_new"] + #[signature = fn(vector(F32)) -> Externref] + Float32ArrayNew, + #[symbol = "__wbindgen_float64_array_new"] + #[signature = fn(vector(F64)) -> Externref] + Float64ArrayNew, + #[symbol = "__wbindgen_array_new"] + #[signature = fn() -> Externref] + ArrayNew, + #[symbol = "__wbindgen_array_push"] + #[signature = fn(ref_externref(), Externref) -> Unit] + ArrayPush, #[symbol = "__wbindgen_externref_heap_live_count"] #[signature = fn() -> I32] ExternrefHeapLiveCount, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 738035e69f8..39c33c7803c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3577,6 +3577,31 @@ impl<'a> Context<'a> { ) } + Intrinsic::Uint8ArrayNew + | Intrinsic::Uint8ClampedArrayNew + | Intrinsic::Uint16ArrayNew + | Intrinsic::Uint32ArrayNew + | Intrinsic::BigUint64ArrayNew + | Intrinsic::Int8ArrayNew + | Intrinsic::Int16ArrayNew + | Intrinsic::Int32ArrayNew + | Intrinsic::BigInt64ArrayNew + | Intrinsic::Float32ArrayNew + | Intrinsic::Float64ArrayNew => { + assert_eq!(args.len(), 1); + args[0].clone() + } + + Intrinsic::ArrayNew => { + assert_eq!(args.len(), 0); + "[]".to_string() + } + + Intrinsic::ArrayPush => { + assert_eq!(args.len(), 2); + format!("{}.push({})", args[0], args[1]) + } + Intrinsic::ExternrefHeapLiveCount => { assert_eq!(args.len(), 0); self.expose_global_heap(); diff --git a/src/lib.rs b/src/lib.rs index fdef0e8d39a..accc371075c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1098,6 +1098,21 @@ externs! { fn __wbindgen_copy_to_typed_array(ptr: *const u8, len: usize, idx: u32) -> (); + fn __wbindgen_uint8_array_new(ptr: *mut u8, len: usize) -> u32; + fn __wbindgen_uint8_clamped_array_new(ptr: *mut u8, len: usize) -> u32; + fn __wbindgen_uint16_array_new(ptr: *mut u16, len: usize) -> u32; + fn __wbindgen_uint32_array_new(ptr: *mut u32, len: usize) -> u32; + fn __wbindgen_biguint64_array_new(ptr: *mut u64, len: usize) -> u32; + fn __wbindgen_int8_array_new(ptr: *mut i8, len: usize) -> u32; + fn __wbindgen_int16_array_new(ptr: *mut i16, len: usize) -> u32; + fn __wbindgen_int32_array_new(ptr: *mut i32, len: usize) -> u32; + fn __wbindgen_bigint64_array_new(ptr: *mut i64, len: usize) -> u32; + fn __wbindgen_float32_array_new(ptr: *mut f32, len: usize) -> u32; + fn __wbindgen_float64_array_new(ptr: *mut f64, len: usize) -> u32; + + fn __wbindgen_array_new() -> u32; + fn __wbindgen_array_push(array: u32, value: u32) -> (); + fn __wbindgen_not(idx: u32) -> u32; fn __wbindgen_exports() -> u32; @@ -1804,6 +1819,35 @@ pub mod __rt { } } } + + if_std! { + use core::mem; + use std::boxed::Box; + + /// Trait for element types to implement `Into` for vectors of + /// themselves, which isn't possible directly thanks to the orphan rule. + pub trait VectorIntoJsValue: Sized { + fn vector_into_jsvalue(vector: Box<[Self]>) -> JsValue; + } + + impl From> for JsValue { + fn from(vector: Box<[T]>) -> Self { + T::vector_into_jsvalue(vector) + } + } + + pub fn js_value_vector_into_jsvalue>(vector: Box<[T]>) -> JsValue { + let result = unsafe { JsValue::_new(super::__wbindgen_array_new()) }; + for value in vector.into_vec() { + let js: JsValue = value.into(); + unsafe { super::__wbindgen_array_push(result.idx, js.idx) } + // `__wbindgen_array_push` takes ownership over `js` and has already dropped it, + // so don't drop it again. + mem::forget(js); + } + result + } + } } /// A wrapper type around slices and vectors for binding the `Uint8ClampedArray` @@ -1922,3 +1966,76 @@ impl From for JsValue { error.value } } + +macro_rules! typed_arrays { + ($($ty:ident $ctor:ident $clamped_ctor:ident,)*) => { + $( + impl From> for JsValue { + fn from(mut vector: Box<[$ty]>) -> Self { + let result = unsafe { JsValue::_new($ctor(vector.as_mut_ptr(), vector.len())) }; + mem::forget(vector); + result + } + } + + impl From>> for JsValue { + fn from(mut vector: Clamped>) -> Self { + let result = unsafe { JsValue::_new($clamped_ctor(vector.as_mut_ptr(), vector.len())) }; + mem::forget(vector); + result + } + } + )* + }; +} + +if_std! { + typed_arrays! { + u8 __wbindgen_uint8_array_new __wbindgen_uint8_clamped_array_new, + u16 __wbindgen_uint16_array_new __wbindgen_uint16_array_new, + u32 __wbindgen_uint32_array_new __wbindgen_uint32_array_new, + u64 __wbindgen_biguint64_array_new __wbindgen_biguint64_array_new, + i8 __wbindgen_int8_array_new __wbindgen_int8_array_new, + i16 __wbindgen_int16_array_new __wbindgen_int16_array_new, + i32 __wbindgen_int32_array_new __wbindgen_int32_array_new, + i64 __wbindgen_bigint64_array_new __wbindgen_bigint64_array_new, + f32 __wbindgen_float32_array_new __wbindgen_float32_array_new, + f64 __wbindgen_float64_array_new __wbindgen_float64_array_new, + } + + impl __rt::VectorIntoJsValue for JsValue { + fn vector_into_jsvalue(vector: Box<[JsValue]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) + } + } + + impl __rt::VectorIntoJsValue for T { + fn vector_into_jsvalue(vector: Box<[T]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) + } + } + + impl __rt::VectorIntoJsValue for String { + fn vector_into_jsvalue(vector: Box<[String]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) + } + } + + impl From> for JsValue + where + JsValue: From>, + { + fn from(vector: Vec) -> Self { + JsValue::from(vector.into_boxed_slice()) + } + } + + impl From>> for JsValue + where + JsValue: From>>, + { + fn from(vector: Clamped>) -> Self { + JsValue::from(Clamped(vector.0.into_boxed_slice())) + } + } +} diff --git a/tests/wasm/async_vecs.js b/tests/wasm/async_vecs.js new file mode 100644 index 00000000000..5ff6550802c --- /dev/null +++ b/tests/wasm/async_vecs.js @@ -0,0 +1,17 @@ +const wasm = require('wasm-bindgen-test.js'); +const assert = require('assert'); + +exports.js_works = async () => { + assert.deepStrictEqual(await wasm.async_jsvalue_vec(), [1, "hi", new Float64Array(), null]); + assert.deepStrictEqual(await wasm.async_import_vec(), [/hi|bye/, /hello w[a-z]rld/]); + assert.deepStrictEqual(await wasm.async_string_vec(), ["a", "b", "c"]); + assert.strictEqual((await wasm.async_struct_vec()).length, 2); + assert.deepStrictEqual(await wasm.async_enum_vec(), [wasm.AnotherEnum.C, wasm.AnotherEnum.A, wasm.AnotherEnum.B]); + + const numberVec = await wasm.async_number_vec(); + assert.deepStrictEqual(numberVec, new Int32Array([1, -3, 7, 12])); + // Make sure `numberVec` is a fresh `Int32Array`, not a view into Wasm memory, + // so that it can be GC'd without the whole Wasm module having to be GC'd as + // well. + assert.strictEqual(numberVec.byteLength, numberVec.buffer.byteLength); +}; diff --git a/tests/wasm/async_vecs.rs b/tests/wasm/async_vecs.rs new file mode 100644 index 00000000000..d1705eb1695 --- /dev/null +++ b/tests/wasm/async_vecs.rs @@ -0,0 +1,66 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/async_vecs.js")] +extern "C" { + async fn js_works(); +} + +#[wasm_bindgen] +extern "C" { + pub type RegExp; + #[wasm_bindgen(constructor)] + fn new(re: &str) -> RegExp; +} + +#[wasm_bindgen] +pub async fn async_number_vec() -> Vec { + vec![1, -3, 7, 12] +} + +#[wasm_bindgen] +pub async fn async_jsvalue_vec() -> Vec { + vec![ + 1u32.into(), + "hi".into(), + Vec::::new().into(), + JsValue::NULL, + ] +} + +#[wasm_bindgen] +pub async fn async_import_vec() -> Vec { + vec![RegExp::new("hi|bye"), RegExp::new("hello w[a-z]rld")] +} + +#[wasm_bindgen] +pub async fn async_string_vec() -> Vec { + vec!["a".to_owned(), "b".to_owned(), "c".to_owned()] +} + +#[wasm_bindgen] +#[derive(Clone)] +pub struct AnotherStruct; + +#[wasm_bindgen] +pub async fn async_struct_vec() -> Vec { + vec![AnotherStruct; 2] +} + +#[wasm_bindgen] +#[derive(Clone)] +pub enum AnotherEnum { + A, + B, + C, +} + +#[wasm_bindgen] +pub async fn async_enum_vec() -> Vec { + vec![AnotherEnum::C, AnotherEnum::A, AnotherEnum::B] +} + +#[wasm_bindgen_test] +async fn works() { + js_works().await; +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 72bb5c414f4..00e58de56a6 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -16,6 +16,7 @@ use wasm_bindgen::prelude::*; pub mod api; pub mod arg_names; +pub mod async_vecs; pub mod bigint; pub mod char; pub mod classes; From a9f06701c78c9623772fe3f1a3e2cf0d60241114 Mon Sep 17 00:00:00 2001 From: Thierry Berger Date: Mon, 1 Apr 2024 08:53:46 +0200 Subject: [PATCH 390/641] add cargo config alternative to set unstable rustflags (#3905) --- guide/src/web-sys/unstable-apis.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guide/src/web-sys/unstable-apis.md b/guide/src/web-sys/unstable-apis.md index 974a4dd4f83..2c48d56cf6d 100644 --- a/guide/src/web-sys/unstable-apis.md +++ b/guide/src/web-sys/unstable-apis.md @@ -23,9 +23,20 @@ APIs. Specifically, these APIs do not follow semver and may break whenever the WebIDL changes. Crates can opt-in to unstable APIs at compile-time by passing the `cfg` flag -`web_sys_unstable_apis`. Typically the `RUSTFLAGS` environment variable is used +`web_sys_unstable_apis`. + +Typically the `RUSTFLAGS` environment variable is used to do this. For example: ```bash RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run ``` + +Alternatively, you can create a [cargo config file](https://doc.rust-lang.org/cargo/reference/config.html) +to set its [rustflags](https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags): + +Within `./.cargo/config.toml`: +```toml +[build] +rustflags = ["--cfg=web_sys_unstable_apis"] +``` From 9347af3b518e2a77139f01b56cc8c785cf184059 Mon Sep 17 00:00:00 2001 From: David Huculak Date: Tue, 2 Apr 2024 03:32:22 -0400 Subject: [PATCH 391/641] Add js import enum benchmark (#3906) --- .gitignore | 1 + benchmarks/Cargo.toml | 5 +++-- benchmarks/README.md | 11 ++--------- benchmarks/globals.js | 11 +++++++++++ benchmarks/index.html | 14 ++++++++++++++ benchmarks/index.js | 2 ++ benchmarks/src/lib.rs | 18 ++++++++++++++++++ 7 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 8cdf73b9e4f..01d711fac1a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ yarn.lock /publish.exe .vscode webdriver.json +benchmarks/pkg diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index ecb52e96ddd..cc526bd55db 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -5,8 +5,9 @@ authors = ["The wasm-bindgen Developers"] rust-version = "1.57" [dependencies] -wasm-bindgen = "0.2.43" -web-sys = { version = "0.3.20", features = ['Node'] } +wasm-bindgen = { path = '../' } +web-sys = { path = '../crates/web-sys', features = ['Node'] } +js-sys = { path = '../crates/js-sys' } [lib] crate-type = ['cdylib'] diff --git a/benchmarks/README.md b/benchmarks/README.md index 697074addfe..ca1619cd3cd 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -11,17 +11,10 @@ performance suite for WebAssembly for Rust. ## Building and Running -First, copy the benchmarks to a temporary directory: - -``` -$ cp ./benchmarks /some/other/directory -``` - -Next, `cd` into that directory and execute: - ``` +$ cd benchmarks $ cargo build --release --target wasm32-unknown-unknown -$ wasm-bindgen --out-dir pkg --target web ./target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm +$ cargo run --package wasm-bindgen-cli -- --out-dir pkg --target web ../target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm ``` Next, use your favorite static file server to host the current directory. For diff --git a/benchmarks/globals.js b/benchmarks/globals.js index 0412158e34a..13c8fe14b4a 100644 --- a/benchmarks/globals.js +++ b/benchmarks/globals.js @@ -1,5 +1,16 @@ export function jsthunk() {} export function add(a, b) { return a + b; } +export function use_baz(baz) { + if (baz !== Baz['variant-2']) { + throw new Error("Passed wrong variant"); + } + } export class Foo { bar() {} } + +export const Baz = { + 'variant-1': 'variant-1', + 'variant-2': 'variant-2', + 'variant-3': 'variant-3', +} diff --git a/benchmarks/index.html b/benchmarks/index.html index 7c3736e9da1..020839f85e8 100644 --- a/benchmarks/index.html +++ b/benchmarks/index.html @@ -275,6 +275,20 @@

wasm-bindgen benchmarks

+ + + Call a custom JS function with an enum value parameter + + (?) + +

+ Benchmarks the speed of passing enum values to javascript +

+ + + + + Pass to/from wasm-bindgen diff --git a/benchmarks/index.js b/benchmarks/index.js index ac603b63c76..e74d8781da5 100644 --- a/benchmarks/index.js +++ b/benchmarks/index.js @@ -16,6 +16,7 @@ import wbindgen_init, { call_first_child_final_n_times as wbindgen_call_first_child_final_n_times, call_first_child_structural_n_times as wbindgen_call_first_child_structural_n_times, call_foo_bar_final_n_times as wbindgen_call_foo_bar_final_n_times, + call_use_baz_n_times as wbindgen_call_use_baz_n_times, call_foo_bar_structural_n_times as wbindgen_call_foo_bar_structural_n_times, str_roundtrip as wbindgen_str_roundtrip, } from './pkg/wasm_bindgen_benchmark.js'; @@ -80,6 +81,7 @@ function makeBenchmarks() { const foo = new globals.Foo(); benchmarks.wbindgen_call_foo_bar_final_n_times = () => wbindgen_call_foo_bar_final_n_times(10000, foo); benchmarks.wbindgen_call_foo_bar_structural_n_times = () => wbindgen_call_foo_bar_structural_n_times(10000, foo); + benchmarks.wbindgen_call_use_baz_n_times = () => wbindgen_call_use_baz_n_times(10000); const strings = { diff --git a/benchmarks/src/lib.rs b/benchmarks/src/lib.rs index d5caa22b653..c5abf1c560c 100644 --- a/benchmarks/src/lib.rs +++ b/benchmarks/src/lib.rs @@ -11,6 +11,9 @@ extern "C" { #[wasm_bindgen(js_name = add)] fn js_add(a: i32, b: i32) -> i32; + #[wasm_bindgen(js_name = use_baz)] + fn js_use_baz(val: Baz); + pub type Foo; #[wasm_bindgen(method, final, js_name = bar)] fn bar_final(this: &Foo); @@ -23,6 +26,14 @@ extern "C" { fn doesnt_throw_catch() -> Result<(), JsValue>; } +#[wasm_bindgen] +#[derive(Copy, Clone)] +pub enum Baz { + Variant1 = "variant-1", + Variant2 = "variant-2", + Variant3 = "variant-3", +} + #[wasm_bindgen] pub fn call_js_thunk_n_times(n: usize) { for _ in 0..n { @@ -81,6 +92,13 @@ pub fn call_foo_bar_structural_n_times(n: usize, js_foo: &Foo) { } } +#[wasm_bindgen] +pub fn call_use_baz_n_times(n: usize) { + for _ in 0..n { + js_use_baz(Baz::Variant2); + } +} + #[wasm_bindgen] pub fn call_doesnt_throw_n_times(n: usize) { for _ in 0..n { From d25a68eaa778f339ea9deb147ddc76a1facfc625 Mon Sep 17 00:00:00 2001 From: David Huculak Date: Wed, 3 Apr 2024 02:33:51 -0400 Subject: [PATCH 392/641] Don't use reflect in webidl dictionary setters (#3898) --- CHANGELOG.md | 3 + crates/backend/src/ast.rs | 8 +- crates/backend/src/encode.rs | 4 +- crates/macro-support/src/parser.rs | 13 +- .../features/gen_AddEventListenerOptions.rs | 38 +- .../web-sys/src/features/gen_AesCbcParams.rs | 20 +- .../web-sys/src/features/gen_AesCtrParams.rs | 35 +- .../src/features/gen_AesDerivedKeyParams.rs | 21 +- .../web-sys/src/features/gen_AesGcmParams.rs | 48 +- .../src/features/gen_AesKeyAlgorithm.rs | 21 +- .../src/features/gen_AesKeyGenParams.rs | 21 +- crates/web-sys/src/features/gen_Algorithm.rs | 10 +- .../features/gen_AllowedBluetoothDevice.rs | 42 +- .../src/features/gen_AllowedUsbDevice.rs | 42 +- .../src/features/gen_AnalyserOptions.rs | 100 +--- .../src/features/gen_AnimationEventInit.rs | 84 +-- .../gen_AnimationPlaybackEventInit.rs | 70 +-- .../features/gen_AnimationPropertyDetails.rs | 53 +- .../gen_AnimationPropertyValueDetails.rs | 47 +- .../src/features/gen_AssignedNodesOptions.rs | 14 +- .../src/features/gen_AttributeNameValue.rs | 20 +- .../src/features/gen_AudioBufferOptions.rs | 39 +- .../features/gen_AudioBufferSourceOptions.rs | 75 +-- .../src/features/gen_AudioConfiguration.rs | 56 +- .../src/features/gen_AudioContextOptions.rs | 39 +- .../features/gen_AudioDataCopyToOptions.rs | 54 +- .../web-sys/src/features/gen_AudioDataInit.rs | 78 +-- .../src/features/gen_AudioDecoderConfig.rs | 52 +- .../src/features/gen_AudioDecoderInit.rs | 21 +- .../src/features/gen_AudioDecoderSupport.rs | 26 +- .../src/features/gen_AudioEncoderConfig.rs | 52 +- .../src/features/gen_AudioEncoderInit.rs | 21 +- .../src/features/gen_AudioEncoderSupport.rs | 26 +- .../src/features/gen_AudioNodeOptions.rs | 44 +- .../src/features/gen_AudioSinkOptions.rs | 11 +- .../features/gen_AudioWorkletNodeOptions.rs | 100 +--- ...en_AuthenticationExtensionsClientInputs.rs | 10 +- ...n_AuthenticationExtensionsClientOutputs.rs | 10 +- .../gen_AuthenticatorSelectionCriteria.rs | 50 +- .../src/features/gen_AutocompleteInfo.rs | 56 +- .../src/features/gen_BaseComputedKeyframe.rs | 65 +-- .../web-sys/src/features/gen_BaseKeyframe.rs | 51 +- .../gen_BasePropertyIndexedKeyframe.rs | 36 +- .../src/features/gen_BasicCardRequest.rs | 28 +- .../src/features/gen_BasicCardResponse.rs | 85 +-- .../src/features/gen_BiquadFilterOptions.rs | 100 +--- .../web-sys/src/features/gen_BlobEventInit.rs | 53 +- .../src/features/gen_BlobPropertyBag.rs | 25 +- .../src/features/gen_BlockParsingOptions.rs | 14 +- .../gen_BluetoothAdvertisingEventInit.rs | 145 ++--- .../features/gen_BluetoothDataFilterInit.rs | 24 +- .../features/gen_BluetoothLeScanFilterInit.rs | 66 +-- .../gen_BluetoothPermissionDescriptor.rs | 67 +-- .../gen_BluetoothPermissionStorage.rs | 14 +- .../src/features/gen_BoxQuadOptions.rs | 25 +- .../gen_BrowserElementDownloadOptions.rs | 28 +- .../gen_BrowserElementExecuteScriptOptions.rs | 21 +- .../src/features/gen_CacheBatchOperation.rs | 55 +- .../src/features/gen_CacheQueryOptions.rs | 56 +- .../gen_CaretStateChangedEventInit.rs | 153 ++--- .../src/features/gen_ChannelMergerOptions.rs | 58 +- .../features/gen_ChannelSplitterOptions.rs | 58 +- .../src/features/gen_CheckerboardReport.rs | 50 +- .../src/features/gen_ChromeFilePropertyBag.rs | 48 +- .../src/features/gen_ClientQueryOptions.rs | 25 +- .../src/features/gen_ClientRectsAndTexts.rs | 29 +- .../src/features/gen_ClipboardEventInit.rs | 57 +- .../src/features/gen_ClipboardItemOptions.rs | 15 +- .../gen_ClipboardPermissionDescriptor.rs | 25 +- .../src/features/gen_CloseEventInit.rs | 77 +-- .../src/features/gen_CollectedClientData.rs | 81 +-- .../src/features/gen_CompositionEventInit.rs | 74 +-- .../src/features/gen_ComputedEffectTiming.rs | 173 ++---- .../src/features/gen_ConnStatusDict.rs | 11 +- .../src/features/gen_ConsoleCounter.rs | 20 +- .../src/features/gen_ConsoleCounterError.rs | 20 +- .../web-sys/src/features/gen_ConsoleEvent.rs | 220 ++------ .../features/gen_ConsoleInstanceOptions.rs | 78 +-- .../src/features/gen_ConsoleProfileEvent.rs | 25 +- .../src/features/gen_ConsoleStackEntry.rs | 70 +-- .../src/features/gen_ConsoleTimerError.rs | 20 +- .../src/features/gen_ConsoleTimerLogOrEnd.rs | 24 +- .../src/features/gen_ConsoleTimerStart.rs | 10 +- .../src/features/gen_ConstantSourceOptions.rs | 11 +- .../gen_ConstrainBooleanParameters.rs | 20 +- .../gen_ConstrainDomStringParameters.rs | 20 +- .../src/features/gen_ConstrainDoubleRange.rs | 40 +- .../src/features/gen_ConstrainLongRange.rs | 40 +- .../src/features/gen_ContextAttributes2d.rs | 24 +- .../features/gen_ConvertCoordinateOptions.rs | 26 +- .../src/features/gen_ConvolverOptions.rs | 70 +-- .../features/gen_CredentialCreationOptions.rs | 27 +- .../features/gen_CredentialRequestOptions.rs | 27 +- .../web-sys/src/features/gen_CryptoKeyPair.rs | 30 +- .../src/features/gen_CustomEventInit.rs | 53 +- .../web-sys/src/features/gen_DateTimeValue.rs | 51 +- .../features/gen_DecoderDoctorNotification.rs | 92 +-- .../web-sys/src/features/gen_DelayOptions.rs | 72 +-- .../features/gen_DeviceAccelerationInit.rs | 30 +- .../src/features/gen_DeviceLightEventInit.rs | 52 +- .../src/features/gen_DeviceMotionEventInit.rs | 104 +--- .../gen_DeviceOrientationEventInit.rs | 86 +-- .../features/gen_DeviceProximityEventInit.rs | 72 +-- .../features/gen_DeviceRotationRateInit.rs | 30 +- .../src/features/gen_DhKeyDeriveParams.rs | 22 +- .../features/gen_DirectoryPickerOptions.rs | 35 +- .../gen_DisplayMediaStreamConstraints.rs | 20 +- .../src/features/gen_DisplayNameOptions.rs | 20 +- .../src/features/gen_DisplayNameResult.rs | 21 +- .../web-sys/src/features/gen_DnsCacheDict.rs | 14 +- .../web-sys/src/features/gen_DnsCacheEntry.rs | 63 +-- .../web-sys/src/features/gen_DnsLookupDict.rs | 35 +- .../features/gen_DocumentTimelineOptions.rs | 14 +- .../src/features/gen_DomMatrix2dInit.rs | 120 ++-- .../web-sys/src/features/gen_DomMatrixInit.rs | 230 +++----- .../web-sys/src/features/gen_DomPointInit.rs | 40 +- .../web-sys/src/features/gen_DomQuadInit.rs | 44 +- .../web-sys/src/features/gen_DomQuadJson.rs | 44 +- .../web-sys/src/features/gen_DomRectInit.rs | 41 +- .../gen_DomWindowResizeEventDetail.rs | 21 +- .../web-sys/src/features/gen_DragEventInit.rs | 382 +++---------- .../features/gen_DynamicsCompressorOptions.rs | 103 +--- .../src/features/gen_EcKeyAlgorithm.rs | 24 +- .../src/features/gen_EcKeyGenParams.rs | 24 +- .../src/features/gen_EcKeyImportParams.rs | 24 +- .../src/features/gen_EcdhKeyDeriveParams.rs | 22 +- .../web-sys/src/features/gen_EcdsaParams.rs | 20 +- .../web-sys/src/features/gen_EffectTiming.rs | 103 +--- .../features/gen_ElementCreationOptions.rs | 21 +- .../features/gen_ElementDefinitionOptions.rs | 14 +- .../src/features/gen_EncodedAudioChunkInit.rs | 49 +- .../features/gen_EncodedAudioChunkMetadata.rs | 15 +- .../src/features/gen_EncodedVideoChunkInit.rs | 49 +- .../features/gen_EncodedVideoChunkMetadata.rs | 40 +- .../web-sys/src/features/gen_ErrorCallback.rs | 14 +- .../src/features/gen_ErrorEventInit.rs | 101 +--- crates/web-sys/src/features/gen_EventInit.rs | 42 +- .../web-sys/src/features/gen_EventListener.rs | 14 +- .../src/features/gen_EventListenerOptions.rs | 14 +- .../src/features/gen_EventModifierInit.rs | 243 ++------ .../src/features/gen_EventSourceInit.rs | 14 +- .../src/features/gen_ExtendableEventInit.rs | 42 +- .../gen_ExtendableMessageEventInit.rs | 98 +--- .../src/features/gen_FakePluginMimeEntry.rs | 38 +- .../src/features/gen_FakePluginTagInit.rs | 122 +--- .../src/features/gen_FetchEventInit.rs | 85 +-- .../gen_FetchReadableStreamReadDataDone.rs | 10 +- .../web-sys/src/features/gen_FileCallback.rs | 14 +- .../src/features/gen_FilePickerAcceptType.rs | 14 +- .../src/features/gen_FilePickerOptions.rs | 48 +- .../src/features/gen_FilePropertyBag.rs | 24 +- .../gen_FileSystemCreateWritableOptions.rs | 14 +- .../features/gen_FileSystemEntriesCallback.rs | 14 +- .../features/gen_FileSystemEntryCallback.rs | 14 +- .../src/features/gen_FileSystemFlags.rs | 25 +- .../gen_FileSystemGetDirectoryOptions.rs | 11 +- .../features/gen_FileSystemGetFileOptions.rs | 11 +- ...en_FileSystemHandlePermissionDescriptor.rs | 11 +- .../gen_FileSystemPermissionDescriptor.rs | 34 +- .../gen_FileSystemReadWriteOptions.rs | 10 +- .../features/gen_FileSystemRemoveOptions.rs | 14 +- .../src/features/gen_FocusEventInit.rs | 79 +-- .../src/features/gen_FontFaceDescriptors.rs | 105 +--- .../features/gen_FontFaceSetIteratorResult.rs | 20 +- .../features/gen_FontFaceSetLoadEventInit.rs | 56 +- .../web-sys/src/features/gen_GainOptions.rs | 54 +- .../features/gen_GamepadAxisMoveEventInit.rs | 77 +-- .../features/gen_GamepadButtonEventInit.rs | 68 +-- .../src/features/gen_GamepadEventInit.rs | 57 +- .../src/features/gen_GetAnimationsOptions.rs | 14 +- .../src/features/gen_GetRootNodeOptions.rs | 14 +- .../features/gen_GpuBindGroupDescriptor.rs | 36 +- .../src/features/gen_GpuBindGroupEntry.rs | 28 +- .../gen_GpuBindGroupLayoutDescriptor.rs | 24 +- .../features/gen_GpuBindGroupLayoutEntry.rs | 100 +--- .../src/features/gen_GpuBlendComponent.rs | 45 +- .../web-sys/src/features/gen_GpuBlendState.rs | 22 +- .../src/features/gen_GpuBufferBinding.rs | 33 +- .../features/gen_GpuBufferBindingLayout.rs | 39 +- .../src/features/gen_GpuBufferDescriptor.rs | 44 +- .../features/gen_GpuCanvasConfiguration.rs | 63 +-- .../web-sys/src/features/gen_GpuColorDict.rs | 40 +- .../src/features/gen_GpuColorTargetState.rs | 37 +- .../gen_GpuCommandBufferDescriptor.rs | 10 +- .../gen_GpuCommandEncoderDescriptor.rs | 10 +- .../features/gen_GpuComputePassDescriptor.rs | 25 +- .../gen_GpuComputePassTimestampWrites.rs | 43 +- .../gen_GpuComputePipelineDescriptor.rs | 36 +- .../src/features/gen_GpuDepthStencilState.rs | 141 ++--- .../src/features/gen_GpuDeviceDescriptor.rs | 39 +- .../src/features/gen_GpuExtent3dDict.rs | 35 +- .../gen_GpuExternalTextureDescriptor.rs | 21 +- .../src/features/gen_GpuFragmentState.rs | 40 +- .../src/features/gen_GpuImageCopyBuffer.rs | 51 +- .../features/gen_GpuImageCopyExternalImage.rs | 32 +- .../src/features/gen_GpuImageCopyTexture.rs | 52 +- .../features/gen_GpuImageCopyTextureTagged.rs | 66 +-- .../src/features/gen_GpuImageDataLayout.rs | 39 +- .../src/features/gen_GpuMultisampleState.rs | 34 +- .../features/gen_GpuObjectDescriptorBase.rs | 10 +- .../src/features/gen_GpuOrigin2dDict.rs | 20 +- .../src/features/gen_GpuOrigin3dDict.rs | 30 +- .../features/gen_GpuPipelineDescriptorBase.rs | 21 +- .../src/features/gen_GpuPipelineErrorInit.rs | 12 +- .../gen_GpuPipelineLayoutDescriptor.rs | 24 +- .../src/features/gen_GpuPrimitiveState.rs | 74 +-- .../src/features/gen_GpuProgrammableStage.rs | 26 +- .../src/features/gen_GpuQuerySetDescriptor.rs | 31 +- .../src/features/gen_GpuQueueDescriptor.rs | 10 +- .../features/gen_GpuRenderBundleDescriptor.rs | 10 +- .../gen_GpuRenderBundleEncoderDescriptor.rs | 81 +-- .../gen_GpuRenderPassColorAttachment.rs | 81 +-- ...gen_GpuRenderPassDepthStencilAttachment.rs | 127 ++--- .../features/gen_GpuRenderPassDescriptor.rs | 86 +-- .../src/features/gen_GpuRenderPassLayout.rs | 53 +- .../gen_GpuRenderPassTimestampWrites.rs | 43 +- .../gen_GpuRenderPipelineDescriptor.rs | 93 +-- .../features/gen_GpuRequestAdapterOptions.rs | 29 +- .../features/gen_GpuSamplerBindingLayout.rs | 11 +- .../src/features/gen_GpuSamplerDescriptor.rs | 157 ++---- .../gen_GpuShaderModuleCompilationHint.rs | 25 +- .../features/gen_GpuShaderModuleDescriptor.rs | 48 +- .../src/features/gen_GpuStencilFaceState.rs | 54 +- .../gen_GpuStorageTextureBindingLayout.rs | 39 +- .../features/gen_GpuTextureBindingLayout.rs | 44 +- .../src/features/gen_GpuTextureDescriptor.rs | 99 +--- .../features/gen_GpuTextureViewDescriptor.rs | 105 +--- .../gen_GpuUncapturedErrorEventInit.rs | 53 +- .../src/features/gen_GpuVertexAttribute.rs | 37 +- .../src/features/gen_GpuVertexBufferLayout.rs | 43 +- .../src/features/gen_GpuVertexState.rs | 40 +- .../features/gen_GroupedHistoryEventInit.rs | 57 +- .../src/features/gen_HalfOpenInfoDict.rs | 14 +- .../src/features/gen_HashChangeEventInit.rs | 64 +-- .../src/features/gen_HidCollectionInfo.rs | 90 +-- .../features/gen_HidConnectionEventInit.rs | 54 +- .../src/features/gen_HidDeviceFilter.rs | 52 +- .../features/gen_HidDeviceRequestOptions.rs | 14 +- .../features/gen_HidInputReportEventInit.rs | 78 +-- .../web-sys/src/features/gen_HidReportInfo.rs | 24 +- .../web-sys/src/features/gen_HidReportItem.rs | 386 +++---------- .../src/features/gen_HiddenPluginEventInit.rs | 42 +- .../src/features/gen_HitRegionOptions.rs | 36 +- crates/web-sys/src/features/gen_HkdfParams.rs | 40 +- .../src/features/gen_HmacDerivedKeyParams.rs | 31 +- .../src/features/gen_HmacImportParams.rs | 20 +- .../src/features/gen_HmacKeyAlgorithm.rs | 32 +- .../src/features/gen_HmacKeyGenParams.rs | 31 +- .../web-sys/src/features/gen_HttpConnDict.rs | 14 +- .../web-sys/src/features/gen_HttpConnInfo.rs | 34 +- .../src/features/gen_HttpConnectionElement.rs | 75 +-- .../features/gen_IdbFileMetadataParameters.rs | 24 +- .../src/features/gen_IdbIndexParameters.rs | 36 +- .../features/gen_IdbObjectStoreParameters.rs | 28 +- .../src/features/gen_IdbOpenDbOptions.rs | 29 +- .../features/gen_IdbVersionChangeEventInit.rs | 70 +-- .../src/features/gen_IdleRequestOptions.rs | 14 +- .../src/features/gen_IirFilterOptions.rs | 72 +-- .../src/features/gen_ImageBitmapOptions.rs | 88 +-- .../gen_ImageCaptureErrorEventInit.rs | 57 +- .../src/features/gen_ImageDecodeOptions.rs | 28 +- .../src/features/gen_ImageDecodeResult.rs | 25 +- .../src/features/gen_ImageDecoderInit.rs | 92 +-- .../src/features/gen_ImageEncodeOptions.rs | 24 +- .../src/features/gen_InputEventInit.rs | 131 ++--- .../gen_IntersectionObserverEntryInit.rs | 67 +-- .../features/gen_IntersectionObserverInit.rs | 39 +- .../src/features/gen_IsInputPendingOptions.rs | 14 +- .../features/gen_IterableKeyAndValueResult.rs | 20 +- .../features/gen_IterableKeyOrValueResult.rs | 20 +- crates/web-sys/src/features/gen_JsonWebKey.rs | 184 ++---- .../web-sys/src/features/gen_KeyAlgorithm.rs | 10 +- .../src/features/gen_KeyIdsInitData.rs | 10 +- .../src/features/gen_KeyboardEventInit.rs | 340 +++-------- .../features/gen_KeyframeAnimationOptions.rs | 158 ++---- .../src/features/gen_KeyframeEffectOptions.rs | 133 ++--- .../web-sys/src/features/gen_L10nElement.rs | 77 +-- crates/web-sys/src/features/gen_L10nValue.rs | 24 +- .../src/features/gen_LifecycleCallbacks.rs | 56 +- crates/web-sys/src/features/gen_LocaleInfo.rs | 25 +- crates/web-sys/src/features/gen_LockInfo.rs | 35 +- .../src/features/gen_LockManagerSnapshot.rs | 24 +- .../web-sys/src/features/gen_LockOptions.rs | 47 +- .../src/features/gen_MediaConfiguration.rs | 22 +- .../gen_MediaDecodingConfiguration.rs | 33 +- .../gen_MediaElementAudioSourceOptions.rs | 15 +- .../gen_MediaEncodingConfiguration.rs | 33 +- crates/web-sys/src/features/gen_MediaImage.rs | 30 +- .../features/gen_MediaKeyMessageEventInit.rs | 71 +-- .../features/gen_MediaKeyNeededEventInit.rs | 70 +-- .../gen_MediaKeySystemConfiguration.rs | 96 +--- .../gen_MediaKeySystemMediaCapability.rs | 28 +- .../src/features/gen_MediaKeysPolicy.rs | 14 +- .../src/features/gen_MediaMetadataInit.rs | 45 +- .../src/features/gen_MediaPositionState.rs | 42 +- .../features/gen_MediaQueryListEventInit.rs | 66 +-- .../gen_MediaRecorderErrorEventInit.rs | 53 +- .../src/features/gen_MediaRecorderOptions.rs | 56 +- .../features/gen_MediaSessionActionDetails.rs | 54 +- .../gen_MediaStreamAudioSourceOptions.rs | 15 +- .../features/gen_MediaStreamConstraints.rs | 58 +- .../src/features/gen_MediaStreamEventInit.rs | 54 +- .../features/gen_MediaStreamTrackEventInit.rs | 53 +- .../gen_MediaStreamTrackGeneratorInit.rs | 10 +- .../gen_MediaStreamTrackProcessorInit.rs | 25 +- .../features/gen_MediaTrackConstraintSet.rs | 217 ++----- .../src/features/gen_MediaTrackConstraints.rs | 231 ++------ .../src/features/gen_MediaTrackSettings.rs | 119 +--- .../gen_MediaTrackSupportedConstraints.rs | 200 ++----- .../src/features/gen_MemoryAttribution.rs | 35 +- .../gen_MemoryAttributionContainer.rs | 20 +- .../src/features/gen_MemoryBreakdownEntry.rs | 34 +- .../src/features/gen_MemoryMeasurement.rs | 24 +- .../src/features/gen_MessageEventInit.rs | 98 +--- .../features/gen_MidiConnectionEventInit.rs | 53 +- .../src/features/gen_MidiMessageEventInit.rs | 42 +- .../web-sys/src/features/gen_MidiOptions.rs | 24 +- .../src/features/gen_MouseEventInit.rs | 367 +++--------- .../src/features/gen_MutationObserverInit.rs | 126 +---- .../src/features/gen_MutationObservingInfo.rs | 141 +---- .../features/gen_NativeOsFileReadOptions.rs | 24 +- .../gen_NativeOsFileWriteAtomicOptions.rs | 62 +- .../src/features/gen_NetworkCommandOptions.rs | 532 +++++------------- .../src/features/gen_NetworkResultOptions.rs | 424 ++++---------- crates/web-sys/src/features/gen_NodeFilter.rs | 14 +- .../src/features/gen_NotificationAction.rs | 31 +- .../src/features/gen_NotificationEventInit.rs | 57 +- .../src/features/gen_NotificationOptions.rs | 148 ++--- .../src/features/gen_ObserverCallback.rs | 14 +- .../gen_OfflineAudioCompletionEventInit.rs | 57 +- .../gen_OfflineAudioContextOptions.rs | 39 +- .../src/features/gen_OpenFilePickerOptions.rs | 62 +- .../src/features/gen_OpenWindowEventDetail.rs | 49 +- .../src/features/gen_OptionalEffectTiming.rs | 103 +--- .../src/features/gen_OscillatorOptions.rs | 95 +--- .../features/gen_PageTransitionEventInit.rs | 70 +-- .../web-sys/src/features/gen_PannerOptions.rs | 242 ++------ .../gen_PaymentMethodChangeEventInit.rs | 70 +-- .../gen_PaymentRequestUpdateEventInit.rs | 42 +- .../web-sys/src/features/gen_Pbkdf2Params.rs | 44 +- .../features/gen_PerformanceEntryEventInit.rs | 115 +--- .../gen_PerformanceEntryFilterOptions.rs | 38 +- .../features/gen_PerformanceObserverInit.rs | 28 +- .../features/gen_PeriodicWaveConstraints.rs | 14 +- .../src/features/gen_PeriodicWaveOptions.rs | 34 +- .../src/features/gen_PermissionDescriptor.rs | 11 +- .../web-sys/src/features/gen_PlaneLayout.rs | 22 +- .../features/gen_PluginCrashedEventInit.rs | 140 +---- .../src/features/gen_PointerEventInit.rs | 502 ++++------------- .../src/features/gen_PopStateEventInit.rs | 52 +- .../src/features/gen_PopupBlockedEventInit.rs | 85 +-- .../src/features/gen_PositionOptions.rs | 42 +- ...resentationConnectionAvailableEventInit.rs | 60 +- ...en_PresentationConnectionCloseEventInit.rs | 71 +-- .../features/gen_ProfileTimelineLayerRect.rs | 41 +- .../src/features/gen_ProfileTimelineMarker.rs | 195 ++----- .../features/gen_ProfileTimelineStackFrame.rs | 85 +-- .../src/features/gen_ProgressEventInit.rs | 77 +-- .../features/gen_PromiseRejectionEventInit.rs | 67 +-- .../gen_PublicKeyCredentialCreationOptions.rs | 138 ++--- .../gen_PublicKeyCredentialDescriptor.rs | 35 +- .../features/gen_PublicKeyCredentialEntity.rs | 20 +- .../gen_PublicKeyCredentialParameters.rs | 21 +- .../gen_PublicKeyCredentialRequestOptions.rs | 91 +-- .../gen_PublicKeyCredentialRpEntity.rs | 30 +- .../gen_PublicKeyCredentialUserEntity.rs | 44 +- .../web-sys/src/features/gen_PushEventInit.rs | 52 +- .../src/features/gen_PushSubscriptionInit.rs | 66 +-- .../src/features/gen_PushSubscriptionJson.rs | 25 +- .../src/features/gen_PushSubscriptionKeys.rs | 21 +- .../gen_PushSubscriptionOptionsInit.rs | 31 +- .../web-sys/src/features/gen_QueryOptions.rs | 14 +- .../src/features/gen_QueuingStrategy.rs | 24 +- .../src/features/gen_QueuingStrategyInit.rs | 14 +- .../web-sys/src/features/gen_RcwnPerfStats.rs | 42 +- crates/web-sys/src/features/gen_RcwnStatus.rs | 84 +-- .../gen_ReadableStreamGetReaderOptions.rs | 11 +- .../gen_ReadableStreamIteratorOptions.rs | 14 +- .../features/gen_ReadableStreamReadResult.rs | 20 +- .../src/features/gen_ReadableWritablePair.rs | 30 +- .../src/features/gen_RegisterRequest.rs | 28 +- .../src/features/gen_RegisterResponse.rs | 70 +-- .../web-sys/src/features/gen_RegisteredKey.rs | 52 +- .../src/features/gen_RegistrationOptions.rs | 35 +- .../src/features/gen_RequestDeviceOptions.rs | 42 +- .../web-sys/src/features/gen_RequestInit.rs | 157 ++---- ...RequestMediaKeySystemAccessNotification.rs | 26 +- .../src/features/gen_ResizeObserverOptions.rs | 11 +- .../web-sys/src/features/gen_ResponseInit.rs | 39 +- .../src/features/gen_RsaHashedImportParams.rs | 10 +- .../web-sys/src/features/gen_RsaOaepParams.rs | 20 +- .../src/features/gen_RsaOtherPrimesInfo.rs | 30 +- .../web-sys/src/features/gen_RsaPssParams.rs | 24 +- .../features/gen_RtcCertificateExpiration.rs | 14 +- .../web-sys/src/features/gen_RtcCodecStats.rs | 101 +--- .../src/features/gen_RtcConfiguration.rs | 72 +-- .../features/gen_RtcDataChannelEventInit.rs | 57 +- .../src/features/gen_RtcDataChannelInit.rs | 94 +--- .../src/features/gen_RtcFecParameters.rs | 10 +- .../src/features/gen_RtcIceCandidateInit.rs | 39 +- .../features/gen_RtcIceCandidatePairStats.rs | 228 ++------ .../src/features/gen_RtcIceCandidateStats.rs | 120 +--- .../src/features/gen_RtcIceComponentStats.rs | 105 +--- .../web-sys/src/features/gen_RtcIceServer.rs | 63 +-- .../src/features/gen_RtcIdentityAssertion.rs | 20 +- .../gen_RtcIdentityAssertionResult.rs | 25 +- .../src/features/gen_RtcIdentityProvider.rs | 28 +- .../gen_RtcIdentityProviderDetails.rs | 25 +- .../gen_RtcIdentityProviderOptions.rs | 42 +- .../gen_RtcIdentityValidationResult.rs | 28 +- .../features/gen_RtcInboundRtpStreamStats.rs | 322 +++-------- .../src/features/gen_RtcMediaStreamStats.rs | 63 +-- .../features/gen_RtcMediaStreamTrackStats.rs | 231 ++------ .../src/features/gen_RtcOfferOptions.rs | 42 +- .../features/gen_RtcOutboundRtpStreamStats.rs | 297 +++------- .../gen_RtcPeerConnectionIceEventInit.rs | 57 +- .../src/features/gen_RtcRtcpParameters.rs | 24 +- .../src/features/gen_RtcRtpCapabilities.rs | 25 +- .../src/features/gen_RtcRtpCodecCapability.rs | 56 +- .../src/features/gen_RtcRtpCodecParameters.rs | 70 +-- .../features/gen_RtcRtpContributingSource.rs | 39 +- .../features/gen_RtcRtpEncodingParameters.rs | 125 ++-- .../gen_RtcRtpHeaderExtensionCapability.rs | 10 +- .../gen_RtcRtpHeaderExtensionParameters.rs | 34 +- .../src/features/gen_RtcRtpParameters.rs | 50 +- .../src/features/gen_RtcRtpSourceEntry.rs | 68 +-- .../gen_RtcRtpSynchronizationSource.rs | 53 +- .../src/features/gen_RtcRtpTransceiverInit.rs | 43 +- .../src/features/gen_RtcRtxParameters.rs | 10 +- .../features/gen_RtcSessionDescriptionInit.rs | 21 +- crates/web-sys/src/features/gen_RtcStats.rs | 35 +- .../features/gen_RtcStatsReportInternal.rs | 293 +++------- .../src/features/gen_RtcTrackEventInit.rs | 97 +--- .../src/features/gen_RtcTransportStats.rs | 63 +-- .../gen_RtcdtmfToneChangeEventInit.rs | 52 +- .../gen_RtcrtpContributingSourceStats.rs | 63 +-- .../src/features/gen_RtcrtpStreamStats.rs | 227 ++------ .../src/features/gen_SaveFilePickerOptions.rs | 62 +- .../features/gen_SchedulerPostTaskOptions.rs | 37 +- .../src/features/gen_ScrollIntoViewOptions.rs | 38 +- .../web-sys/src/features/gen_ScrollOptions.rs | 15 +- .../src/features/gen_ScrollToOptions.rs | 35 +- .../features/gen_ScrollViewChangeEventInit.rs | 53 +- .../gen_SecurityPolicyViolationEventInit.rs | 211 ++----- .../src/features/gen_SerialInputSignals.rs | 56 +- .../web-sys/src/features/gen_SerialOptions.rs | 83 +-- .../src/features/gen_SerialOutputSignals.rs | 38 +- .../src/features/gen_SerialPortFilter.rs | 28 +- .../src/features/gen_SerialPortInfo.rs | 28 +- .../features/gen_SerialPortRequestOptions.rs | 14 +- .../src/features/gen_ServerSocketOptions.rs | 15 +- .../src/features/gen_ShadowRootInit.rs | 11 +- crates/web-sys/src/features/gen_ShareData.rs | 40 +- .../web-sys/src/features/gen_SignResponse.rs | 70 +-- .../web-sys/src/features/gen_SocketElement.rs | 65 +-- .../web-sys/src/features/gen_SocketOptions.rs | 29 +- .../web-sys/src/features/gen_SocketsDict.rs | 38 +- .../gen_SpeechRecognitionErrorInit.rs | 67 +-- .../gen_SpeechRecognitionEventInit.rs | 96 +--- .../gen_SpeechSynthesisErrorEventInit.rs | 120 +--- .../features/gen_SpeechSynthesisEventInit.rs | 109 +--- .../src/features/gen_StereoPannerOptions.rs | 54 +- .../src/features/gen_StorageEstimate.rs | 20 +- .../src/features/gen_StorageEventInit.rs | 105 +--- .../src/features/gen_StreamPipeOptions.rs | 54 +- .../features/gen_StyleRuleChangeEventInit.rs | 68 +-- ...tyleSheetApplicableStateChangeEventInit.rs | 74 +-- .../features/gen_StyleSheetChangeEventInit.rs | 71 +-- .../src/features/gen_SubmitEventInit.rs | 57 +- .../src/features/gen_SvcOutputMetadata.rs | 14 +- .../src/features/gen_SvgBoundingBoxOptions.rs | 49 +- .../src/features/gen_TaskControllerInit.rs | 15 +- .../gen_TaskPriorityChangeEventInit.rs | 57 +- .../src/features/gen_TaskSignalAnyInit.rs | 14 +- .../features/gen_TcpServerSocketEventInit.rs | 54 +- .../features/gen_TcpSocketErrorEventInit.rs | 66 +-- .../src/features/gen_TcpSocketEventInit.rs | 52 +- .../src/features/gen_TextDecodeOptions.rs | 11 +- .../src/features/gen_TextDecoderOptions.rs | 10 +- .../src/features/gen_TouchEventInit.rs | 285 +++------- crates/web-sys/src/features/gen_TouchInit.rs | 154 ++--- .../src/features/gen_TrackEventInit.rs | 52 +- .../web-sys/src/features/gen_Transformer.rs | 62 +- .../src/features/gen_TransitionEventInit.rs | 84 +-- .../web-sys/src/features/gen_TreeCellInfo.rs | 24 +- .../web-sys/src/features/gen_U2fClientData.rs | 35 +- .../src/features/gen_UdpMessageEventInit.rs | 80 +-- crates/web-sys/src/features/gen_UdpOptions.rs | 84 +-- .../web-sys/src/features/gen_UiEventInit.rs | 64 +-- .../src/features/gen_UnderlyingSink.rs | 50 +- .../src/features/gen_UnderlyingSource.rs | 56 +- .../features/gen_UsbConnectionEventInit.rs | 54 +- .../gen_UsbControlTransferParameters.rs | 64 +-- .../src/features/gen_UsbDeviceFilter.rs | 84 +-- .../features/gen_UsbDeviceRequestOptions.rs | 14 +- .../features/gen_UsbPermissionDescriptor.rs | 25 +- .../src/features/gen_UsbPermissionStorage.rs | 14 +- .../features/gen_UserProximityEventInit.rs | 52 +- .../src/features/gen_ValueEventInit.rs | 52 +- .../src/features/gen_VideoColorSpaceInit.rs | 56 +- .../src/features/gen_VideoConfiguration.rs | 63 +-- .../src/features/gen_VideoDecoderConfig.rs | 124 +--- .../src/features/gen_VideoDecoderInit.rs | 21 +- .../src/features/gen_VideoDecoderSupport.rs | 26 +- .../src/features/gen_VideoEncoderConfig.rs | 142 ++--- .../features/gen_VideoEncoderEncodeOptions.rs | 14 +- .../src/features/gen_VideoEncoderInit.rs | 21 +- .../src/features/gen_VideoEncoderSupport.rs | 26 +- .../src/features/gen_VideoFrameBufferInit.rs | 137 ++--- .../features/gen_VideoFrameCopyToOptions.rs | 22 +- .../src/features/gen_VideoFrameInit.rs | 82 +-- .../web-sys/src/features/gen_VoidCallback.rs | 14 +- crates/web-sys/src/features/gen_VrLayer.rs | 40 +- .../gen_WatchAdvertisementsOptions.rs | 12 +- .../src/features/gen_WaveShaperOptions.rs | 69 +-- .../features/gen_WebGlContextAttributes.rs | 119 +--- .../src/features/gen_WebGlContextEventInit.rs | 56 +- .../web-sys/src/features/gen_WebSocketDict.rs | 14 +- .../src/features/gen_WebSocketElement.rs | 84 +-- .../src/features/gen_WebTransportCloseInfo.rs | 25 +- .../features/gen_WebTransportDatagramStats.rs | 56 +- .../features/gen_WebTransportErrorOptions.rs | 26 +- .../src/features/gen_WebTransportHash.rs | 24 +- .../src/features/gen_WebTransportOptions.rs | 57 +- .../gen_WebTransportReceiveStreamStats.rs | 42 +- .../gen_WebTransportSendStreamOptions.rs | 14 +- .../gen_WebTransportSendStreamStats.rs | 56 +- .../src/features/gen_WebTransportStats.rs | 166 ++---- .../src/features/gen_WheelEventInit.rs | 414 ++++---------- .../src/features/gen_WidevineCdmManifest.rs | 94 +--- .../web-sys/src/features/gen_WorkerOptions.rs | 36 +- .../src/features/gen_WorkletOptions.rs | 15 +- .../web-sys/src/features/gen_WriteParams.rs | 45 +- .../src/features/gen_XPathNsResolver.rs | 14 +- .../features/gen_XrInputSourceEventInit.rs | 68 +-- .../gen_XrInputSourcesChangeEventInit.rs | 81 +-- .../features/gen_XrPermissionDescriptor.rs | 50 +- .../features/gen_XrReferenceSpaceEventInit.rs | 72 +-- .../src/features/gen_XrRenderStateInit.rs | 68 +-- .../src/features/gen_XrSessionEventInit.rs | 57 +- .../web-sys/src/features/gen_XrSessionInit.rs | 28 +- ..._XrSessionSupportedPermissionDescriptor.rs | 22 +- .../src/features/gen_XrWebGlLayerInit.rs | 76 +-- crates/webidl/src/generator.rs | 109 +++- crates/webidl/src/lib.rs | 21 +- 545 files changed, 8000 insertions(+), 24107 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0add0955534..f5cf57ea7e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * Stabilize Web Share API. [#3882](https://github.com/rustwasm/wasm-bindgen/pull/3882) +* Generate JS bindings for WebIDL dictionary setters instead of using `Reflect`. This increases the size of the Web API bindings but should be more performant. Also, importing getters/setters from JS now supports specifying the JS attribute name as a string, e.g. `#[wasm_bindgen(method, setter = "x-cdm-codecs")]`. + [#3898](https://github.com/rustwasm/wasm-bindgen/pull/3898) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 9cd8ebec140..95c62d63bd8 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -242,10 +242,10 @@ pub struct Operation { pub enum OperationKind { /// A standard method, nothing special Regular, - /// A method for getting the value of the provided Ident - Getter(Option), - /// A method for setting the value of the provided Ident - Setter(Option), + /// A method for getting the value of the provided Ident or String + Getter(Option), + /// A method for setting the value of the provided Ident or String + Setter(Option), /// A dynamically intercepted getter IndexingGetter, /// A dynamically intercepted setter diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index e7c7624e0ea..9341ac170dd 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -531,12 +531,12 @@ fn from_ast_method_kind<'a>( let is_static = *is_static; let kind = match kind { ast::OperationKind::Getter(g) => { - let g = g.as_ref().map(|g| intern.intern(g)); + let g = g.as_ref().map(|g| intern.intern_str(g)); OperationKind::Getter(g.unwrap_or_else(|| function.infer_getter_property())) } ast::OperationKind::Regular => OperationKind::Regular, ast::OperationKind::Setter(s) => { - let s = s.as_ref().map(|s| intern.intern(s)); + let s = s.as_ref().map(|s| intern.intern_str(s)); OperationKind::Setter(match s { Some(s) => s, None => intern.intern_str(&function.infer_setter_property()?), diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index eee4f66e95d..2b161c04c3b 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -65,8 +65,8 @@ macro_rules! attrgen { (module, Module(Span, String, Span)), (raw_module, RawModule(Span, String, Span)), (inline_js, InlineJs(Span, String, Span)), - (getter, Getter(Span, Option)), - (setter, Setter(Span, Option)), + (getter, Getter(Span, Option)), + (setter, Setter(Span, Option)), (indexing_getter, IndexingGetter(Span)), (indexing_setter, IndexingSetter(Span)), (indexing_deleter, IndexingDeleter(Span)), @@ -299,10 +299,15 @@ impl Parse for BindgenAttr { return Ok(BindgenAttr::$variant(attr_span, ident)) }); - (@parser $variant:ident(Span, Option)) => ({ + (@parser $variant:ident(Span, Option)) => ({ if input.parse::().is_ok() { + if input.peek(syn::LitStr) { + let litstr = input.parse::()?; + return Ok(BindgenAttr::$variant(attr_span, Some(litstr.value()))) + } + let ident = input.parse::()?.0; - return Ok(BindgenAttr::$variant(attr_span, Some(ident))) + return Ok(BindgenAttr::$variant(attr_span, Some(ident.to_string()))) } else { return Ok(BindgenAttr::$variant(attr_span, None)); } diff --git a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs index 11041cbb87f..b453ed0641c 100644 --- a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs +++ b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] pub type AddEventListenerOptions; + #[wasm_bindgen(method, setter = "capture")] + fn capture_shim(this: &AddEventListenerOptions, val: bool); + #[wasm_bindgen(method, setter = "once")] + fn once_shim(this: &AddEventListenerOptions, val: bool); + #[wasm_bindgen(method, setter = "passive")] + fn passive_shim(this: &AddEventListenerOptions, val: bool); } impl AddEventListenerOptions { #[doc = "Construct a new `AddEventListenerOptions`."] @@ -24,47 +30,21 @@ impl AddEventListenerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] pub fn capture(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("capture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.capture_shim(val); self } #[doc = "Change the `once` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] pub fn once(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("once"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.once_shim(val); self } #[doc = "Change the `passive` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] pub fn passive(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("passive"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.passive_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesCbcParams.rs b/crates/web-sys/src/features/gen_AesCbcParams.rs index 9fba20f28e5..a342b655e6a 100644 --- a/crates/web-sys/src/features/gen_AesCbcParams.rs +++ b/crates/web-sys/src/features/gen_AesCbcParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] pub type AesCbcParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesCbcParams, val: &str); + #[wasm_bindgen(method, setter = "iv")] + fn iv_shim(this: &AesCbcParams, val: &::js_sys::Object); } impl AesCbcParams { #[doc = "Construct a new `AesCbcParams`."] @@ -26,26 +30,14 @@ impl AesCbcParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `iv` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("iv"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iv_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesCtrParams.rs b/crates/web-sys/src/features/gen_AesCtrParams.rs index 0dbaad9e1ac..ce6270ad036 100644 --- a/crates/web-sys/src/features/gen_AesCtrParams.rs +++ b/crates/web-sys/src/features/gen_AesCtrParams.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] pub type AesCtrParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesCtrParams, val: &str); + #[wasm_bindgen(method, setter = "counter")] + fn counter_shim(this: &AesCtrParams, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &AesCtrParams, val: u8); } impl AesCtrParams { #[doc = "Construct a new `AesCtrParams`."] @@ -27,44 +33,21 @@ impl AesCtrParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `counter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] pub fn counter(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("counter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.counter_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] pub fn length(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs index 7212fc60328..f0dc4f1e939 100644 --- a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] pub type AesDerivedKeyParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesDerivedKeyParams, val: &str); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &AesDerivedKeyParams, val: u32); } impl AesDerivedKeyParams { #[doc = "Construct a new `AesDerivedKeyParams`."] @@ -26,27 +30,14 @@ impl AesDerivedKeyParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesGcmParams.rs b/crates/web-sys/src/features/gen_AesGcmParams.rs index 55199b0971e..13bac4af42c 100644 --- a/crates/web-sys/src/features/gen_AesGcmParams.rs +++ b/crates/web-sys/src/features/gen_AesGcmParams.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub type AesGcmParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesGcmParams, val: &str); + #[wasm_bindgen(method, setter = "additionalData")] + fn additional_data_shim(this: &AesGcmParams, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "iv")] + fn iv_shim(this: &AesGcmParams, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "tagLength")] + fn tag_length_shim(this: &AesGcmParams, val: u8); } impl AesGcmParams { #[doc = "Construct a new `AesGcmParams`."] @@ -26,60 +34,28 @@ impl AesGcmParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `additionalData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub fn additional_data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("additionalData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.additional_data_shim(val); self } #[doc = "Change the `iv` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("iv"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iv_shim(val); self } #[doc = "Change the `tagLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub fn tag_length(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("tagLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tag_length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs index fd55a3a4cfb..b525478f622 100644 --- a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] pub type AesKeyAlgorithm; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesKeyAlgorithm, val: &str); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &AesKeyAlgorithm, val: u16); } impl AesKeyAlgorithm { #[doc = "Construct a new `AesKeyAlgorithm`."] @@ -26,27 +30,14 @@ impl AesKeyAlgorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] pub fn length(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AesKeyGenParams.rs b/crates/web-sys/src/features/gen_AesKeyGenParams.rs index 829e6f5968b..266ae71921d 100644 --- a/crates/web-sys/src/features/gen_AesKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_AesKeyGenParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] pub type AesKeyGenParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AesKeyGenParams, val: &str); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &AesKeyGenParams, val: u16); } impl AesKeyGenParams { #[doc = "Construct a new `AesKeyGenParams`."] @@ -26,27 +30,14 @@ impl AesKeyGenParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] pub fn length(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_Algorithm.rs b/crates/web-sys/src/features/gen_Algorithm.rs index 93efed89e40..3a82cd9e61e 100644 --- a/crates/web-sys/src/features/gen_Algorithm.rs +++ b/crates/web-sys/src/features/gen_Algorithm.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] pub type Algorithm; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &Algorithm, val: &str); } impl Algorithm { #[doc = "Construct a new `Algorithm`."] @@ -25,13 +27,7 @@ impl Algorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs index c5d76814a25..ac016920b6f 100644 --- a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AllowedBluetoothDevice; + #[wasm_bindgen(method, setter = "allowedServices")] + fn allowed_services_shim(this: &AllowedBluetoothDevice, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &AllowedBluetoothDevice, val: &str); + #[wasm_bindgen(method, setter = "mayUseGATT")] + fn may_use_gatt_shim(this: &AllowedBluetoothDevice, val: bool); } #[cfg(web_sys_unstable_apis)] impl AllowedBluetoothDevice { @@ -43,17 +49,7 @@ impl AllowedBluetoothDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn allowed_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowedServices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allowed_services_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -64,17 +60,7 @@ impl AllowedBluetoothDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -85,17 +71,7 @@ impl AllowedBluetoothDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn may_use_gatt(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mayUseGATT"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.may_use_gatt_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs index bb47031df43..23070d3117d 100644 --- a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AllowedUsbDevice; + #[wasm_bindgen(method, setter = "productId")] + fn product_id_shim(this: &AllowedUsbDevice, val: u8); + #[wasm_bindgen(method, setter = "serialNumber")] + fn serial_number_shim(this: &AllowedUsbDevice, val: &str); + #[wasm_bindgen(method, setter = "vendorId")] + fn vendor_id_shim(this: &AllowedUsbDevice, val: u8); } #[cfg(web_sys_unstable_apis)] impl AllowedUsbDevice { @@ -38,17 +44,7 @@ impl AllowedUsbDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn product_id(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("productId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.product_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +55,7 @@ impl AllowedUsbDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn serial_number(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serialNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.serial_number_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +66,7 @@ impl AllowedUsbDevice { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn vendor_id(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("vendorId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.vendor_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AnalyserOptions.rs b/crates/web-sys/src/features/gen_AnalyserOptions.rs index 48a2bf15393..776ce399d63 100644 --- a/crates/web-sys/src/features/gen_AnalyserOptions.rs +++ b/crates/web-sys/src/features/gen_AnalyserOptions.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub type AnalyserOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &AnalyserOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &AnalyserOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &AnalyserOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "fftSize")] + fn fft_size_shim(this: &AnalyserOptions, val: u32); + #[wasm_bindgen(method, setter = "maxDecibels")] + fn max_decibels_shim(this: &AnalyserOptions, val: f64); + #[wasm_bindgen(method, setter = "minDecibels")] + fn min_decibels_shim(this: &AnalyserOptions, val: f64); + #[wasm_bindgen(method, setter = "smoothingTimeConstant")] + fn smoothing_time_constant_shim(this: &AnalyserOptions, val: f64); } impl AnalyserOptions { #[doc = "Construct a new `AnalyserOptions`."] @@ -24,17 +40,7 @@ impl AnalyserOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +48,7 @@ impl AnalyserOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelCountMode`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,85 +56,35 @@ impl AnalyserOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelInterpretation`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `fftSize` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub fn fft_size(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fftSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fft_size_shim(val); self } #[doc = "Change the `maxDecibels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub fn max_decibels(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxDecibels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_decibels_shim(val); self } #[doc = "Change the `minDecibels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub fn min_decibels(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("minDecibels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_decibels_shim(val); self } #[doc = "Change the `smoothingTimeConstant` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub fn smoothing_time_constant(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("smoothingTimeConstant"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.smoothing_time_constant_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationEventInit.rs b/crates/web-sys/src/features/gen_AnimationEventInit.rs index 2d83b6eec70..49910c05af7 100644 --- a/crates/web-sys/src/features/gen_AnimationEventInit.rs +++ b/crates/web-sys/src/features/gen_AnimationEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub type AnimationEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &AnimationEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &AnimationEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &AnimationEventInit, val: bool); + #[wasm_bindgen(method, setter = "animationName")] + fn animation_name_shim(this: &AnimationEventInit, val: &str); + #[wasm_bindgen(method, setter = "elapsedTime")] + fn elapsed_time_shim(this: &AnimationEventInit, val: f32); + #[wasm_bindgen(method, setter = "pseudoElement")] + fn pseudo_element_shim(this: &AnimationEventInit, val: &str); } impl AnimationEventInit { #[doc = "Construct a new `AnimationEventInit`."] @@ -24,102 +36,42 @@ impl AnimationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `animationName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn animation_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("animationName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.animation_name_shim(val); self } #[doc = "Change the `elapsedTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("elapsedTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.elapsed_time_shim(val); self } #[doc = "Change the `pseudoElement` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub fn pseudo_element(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pseudoElement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pseudo_element_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs b/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs index 4b6b8f99f04..de0898ed513 100644 --- a/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs +++ b/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub type AnimationPlaybackEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &AnimationPlaybackEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &AnimationPlaybackEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &AnimationPlaybackEventInit, val: bool); + #[wasm_bindgen(method, setter = "currentTime")] + fn current_time_shim(this: &AnimationPlaybackEventInit, val: Option); + #[wasm_bindgen(method, setter = "timelineTime")] + fn timeline_time_shim(this: &AnimationPlaybackEventInit, val: Option); } impl AnimationPlaybackEventInit { #[doc = "Construct a new `AnimationPlaybackEventInit`."] @@ -24,85 +34,35 @@ impl AnimationPlaybackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `currentTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub fn current_time(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("currentTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.current_time_shim(val); self } #[doc = "Change the `timelineTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub fn timeline_time(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timelineTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeline_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs index 05280ee164c..8b9e529af90 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub type AnimationPropertyDetails; + #[wasm_bindgen(method, setter = "property")] + fn property_shim(this: &AnimationPropertyDetails, val: &str); + #[wasm_bindgen(method, setter = "runningOnCompositor")] + fn running_on_compositor_shim(this: &AnimationPropertyDetails, val: bool); + #[wasm_bindgen(method, setter = "values")] + fn values_shim(this: &AnimationPropertyDetails, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "warning")] + fn warning_shim(this: &AnimationPropertyDetails, val: &str); } impl AnimationPropertyDetails { #[doc = "Construct a new `AnimationPropertyDetails`."] @@ -31,65 +39,28 @@ impl AnimationPropertyDetails { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub fn property(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("property"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.property_shim(val); self } #[doc = "Change the `runningOnCompositor` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub fn running_on_compositor(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("runningOnCompositor"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.running_on_compositor_shim(val); self } #[doc = "Change the `values` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub fn values(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("values"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.values_shim(val); self } #[doc = "Change the `warning` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub fn warning(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("warning"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.warning_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs index 6d96f622312..28ace13608c 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] pub type AnimationPropertyValueDetails; + #[cfg(feature = "CompositeOperation")] + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &AnimationPropertyValueDetails, val: CompositeOperation); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &AnimationPropertyValueDetails, val: &str); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &AnimationPropertyValueDetails, val: f64); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &AnimationPropertyValueDetails, val: &str); } impl AnimationPropertyValueDetails { #[cfg(feature = "CompositeOperation")] @@ -28,58 +37,28 @@ impl AnimationPropertyValueDetails { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`, `CompositeOperation`*"] pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `offset` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] pub fn offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] pub fn value(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AssignedNodesOptions.rs b/crates/web-sys/src/features/gen_AssignedNodesOptions.rs index 6c2b66d1e03..45eba715538 100644 --- a/crates/web-sys/src/features/gen_AssignedNodesOptions.rs +++ b/crates/web-sys/src/features/gen_AssignedNodesOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] pub type AssignedNodesOptions; + #[wasm_bindgen(method, setter = "flatten")] + fn flatten_shim(this: &AssignedNodesOptions, val: bool); } impl AssignedNodesOptions { #[doc = "Construct a new `AssignedNodesOptions`."] @@ -24,17 +26,7 @@ impl AssignedNodesOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] pub fn flatten(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("flatten"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flatten_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AttributeNameValue.rs b/crates/web-sys/src/features/gen_AttributeNameValue.rs index 1f614d1d64c..46535ab0223 100644 --- a/crates/web-sys/src/features/gen_AttributeNameValue.rs +++ b/crates/web-sys/src/features/gen_AttributeNameValue.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] pub type AttributeNameValue; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &AttributeNameValue, val: &str); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &AttributeNameValue, val: &str); } impl AttributeNameValue { #[doc = "Construct a new `AttributeNameValue`."] @@ -26,26 +30,14 @@ impl AttributeNameValue { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] pub fn value(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioBufferOptions.rs b/crates/web-sys/src/features/gen_AudioBufferOptions.rs index 7cb81321581..b3f905927bf 100644 --- a/crates/web-sys/src/features/gen_AudioBufferOptions.rs +++ b/crates/web-sys/src/features/gen_AudioBufferOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] pub type AudioBufferOptions; + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &AudioBufferOptions, val: u32); + #[wasm_bindgen(method, setter = "numberOfChannels")] + fn number_of_channels_shim(this: &AudioBufferOptions, val: u32); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &AudioBufferOptions, val: f32); } impl AudioBufferOptions { #[doc = "Construct a new `AudioBufferOptions`."] @@ -26,48 +32,21 @@ impl AudioBufferOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } #[doc = "Change the `numberOfChannels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfChannels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_channels_shim(val); self } #[doc = "Change the `sampleRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs b/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs index ff42b5066c0..5da87254d67 100644 --- a/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs +++ b/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub type AudioBufferSourceOptions; + #[cfg(feature = "AudioBuffer")] + #[wasm_bindgen(method, setter = "buffer")] + fn buffer_shim(this: &AudioBufferSourceOptions, val: Option<&AudioBuffer>); + #[wasm_bindgen(method, setter = "detune")] + fn detune_shim(this: &AudioBufferSourceOptions, val: f32); + #[wasm_bindgen(method, setter = "loop")] + fn loop__shim(this: &AudioBufferSourceOptions, val: bool); + #[wasm_bindgen(method, setter = "loopEnd")] + fn loop_end_shim(this: &AudioBufferSourceOptions, val: f64); + #[wasm_bindgen(method, setter = "loopStart")] + fn loop_start_shim(this: &AudioBufferSourceOptions, val: f64); + #[wasm_bindgen(method, setter = "playbackRate")] + fn playback_rate_shim(this: &AudioBufferSourceOptions, val: f32); } impl AudioBufferSourceOptions { #[doc = "Construct a new `AudioBufferSourceOptions`."] @@ -25,92 +38,42 @@ impl AudioBufferSourceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"] pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_shim(val); self } #[doc = "Change the `detune` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub fn detune(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detune"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detune_shim(val); self } #[doc = "Change the `loop` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub fn loop_(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loop"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.loop__shim(val); self } #[doc = "Change the `loopEnd` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub fn loop_end(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("loopEnd"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.loop_end_shim(val); self } #[doc = "Change the `loopStart` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub fn loop_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("loopStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.loop_start_shim(val); self } #[doc = "Change the `playbackRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub fn playback_rate(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("playbackRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.playback_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioConfiguration.rs b/crates/web-sys/src/features/gen_AudioConfiguration.rs index 9d6347dee31..058667594ce 100644 --- a/crates/web-sys/src/features/gen_AudioConfiguration.rs +++ b/crates/web-sys/src/features/gen_AudioConfiguration.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub type AudioConfiguration; + #[wasm_bindgen(method, setter = "bitrate")] + fn bitrate_shim(this: &AudioConfiguration, val: f64); + #[wasm_bindgen(method, setter = "channels")] + fn channels_shim(this: &AudioConfiguration, val: &str); + #[wasm_bindgen(method, setter = "contentType")] + fn content_type_shim(this: &AudioConfiguration, val: &str); + #[wasm_bindgen(method, setter = "samplerate")] + fn samplerate_shim(this: &AudioConfiguration, val: u32); } impl AudioConfiguration { #[doc = "Construct a new `AudioConfiguration`."] @@ -24,68 +32,28 @@ impl AudioConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub fn bitrate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_shim(val); self } #[doc = "Change the `channels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub fn channels(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channels_shim(val); self } #[doc = "Change the `contentType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub fn content_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contentType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.content_type_shim(val); self } #[doc = "Change the `samplerate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub fn samplerate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("samplerate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.samplerate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioContextOptions.rs b/crates/web-sys/src/features/gen_AudioContextOptions.rs index 56dbb0a4cae..85b9ffaa010 100644 --- a/crates/web-sys/src/features/gen_AudioContextOptions.rs +++ b/crates/web-sys/src/features/gen_AudioContextOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] pub type AudioContextOptions; + #[wasm_bindgen(method, setter = "latencyHint")] + fn latency_hint_shim(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &AudioContextOptions, val: f32); + #[wasm_bindgen(method, setter = "sinkId")] + fn sink_id_shim(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); } impl AudioContextOptions { #[doc = "Construct a new `AudioContextOptions`."] @@ -24,34 +30,14 @@ impl AudioContextOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] pub fn latency_hint(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("latencyHint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.latency_hint_shim(val); self } #[doc = "Change the `sampleRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -62,14 +48,7 @@ impl AudioContextOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sink_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sinkId"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sink_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs index 2d3132cbaac..b7fb5f2426a 100644 --- a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs +++ b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDataCopyToOptions; + #[cfg(feature = "AudioSampleFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &AudioDataCopyToOptions, val: AudioSampleFormat); + #[wasm_bindgen(method, setter = "frameCount")] + fn frame_count_shim(this: &AudioDataCopyToOptions, val: u32); + #[wasm_bindgen(method, setter = "frameOffset")] + fn frame_offset_shim(this: &AudioDataCopyToOptions, val: u32); + #[wasm_bindgen(method, setter = "planeIndex")] + fn plane_index_shim(this: &AudioDataCopyToOptions, val: u32); } #[cfg(web_sys_unstable_apis)] impl AudioDataCopyToOptions { @@ -38,14 +47,7 @@ impl AudioDataCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +58,7 @@ impl AudioDataCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn frame_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +69,7 @@ impl AudioDataCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn frame_offset(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameOffset"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +80,7 @@ impl AudioDataCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn plane_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("planeIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.plane_index_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDataInit.rs b/crates/web-sys/src/features/gen_AudioDataInit.rs index de51e8380a0..88afffc7932 100644 --- a/crates/web-sys/src/features/gen_AudioDataInit.rs +++ b/crates/web-sys/src/features/gen_AudioDataInit.rs @@ -14,6 +14,19 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDataInit; + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &AudioDataInit, val: &::js_sys::Object); + #[cfg(feature = "AudioSampleFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &AudioDataInit, val: AudioSampleFormat); + #[wasm_bindgen(method, setter = "numberOfChannels")] + fn number_of_channels_shim(this: &AudioDataInit, val: u32); + #[wasm_bindgen(method, setter = "numberOfFrames")] + fn number_of_frames_shim(this: &AudioDataInit, val: u32); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &AudioDataInit, val: f32); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &AudioDataInit, val: f64); } #[cfg(web_sys_unstable_apis)] impl AudioDataInit { @@ -50,13 +63,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -68,14 +75,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -86,17 +86,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfChannels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_channels_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -107,17 +97,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn number_of_frames(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfFrames"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_frames_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -128,17 +108,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -149,17 +119,7 @@ impl AudioDataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs index 83414175881..561f6c58664 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderConfig; + #[wasm_bindgen(method, setter = "codec")] + fn codec_shim(this: &AudioDecoderConfig, val: &str); + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &AudioDecoderConfig, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "numberOfChannels")] + fn number_of_channels_shim(this: &AudioDecoderConfig, val: u32); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &AudioDecoderConfig, val: u32); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderConfig { @@ -39,13 +47,7 @@ impl AudioDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn codec(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +58,7 @@ impl AudioDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +69,7 @@ impl AudioDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfChannels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_channels_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +80,7 @@ impl AudioDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderInit.rs b/crates/web-sys/src/features/gen_AudioDecoderInit.rs index f1ee1a6017b..927ec60a7f9 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderInit; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &AudioDecoderInit, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "output")] + fn output_shim(this: &AudioDecoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderInit { @@ -38,13 +42,7 @@ impl AudioDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,14 +53,7 @@ impl AudioDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("output"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderSupport.rs b/crates/web-sys/src/features/gen_AudioDecoderSupport.rs index 2f4b969fd10..ecbbc3eed95 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderSupport.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderSupport.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderSupport; + #[cfg(feature = "AudioDecoderConfig")] + #[wasm_bindgen(method, setter = "config")] + fn config_shim(this: &AudioDecoderSupport, val: &AudioDecoderConfig); + #[wasm_bindgen(method, setter = "supported")] + fn supported_shim(this: &AudioDecoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderSupport { @@ -37,14 +42,7 @@ impl AudioDecoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn config(&mut self, val: &AudioDecoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("config"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.config_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +53,7 @@ impl AudioDecoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn supported(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supported"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs index 5cc365558c2..a21f98ad4da 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderConfig; + #[wasm_bindgen(method, setter = "bitrate")] + fn bitrate_shim(this: &AudioEncoderConfig, val: f64); + #[wasm_bindgen(method, setter = "codec")] + fn codec_shim(this: &AudioEncoderConfig, val: &str); + #[wasm_bindgen(method, setter = "numberOfChannels")] + fn number_of_channels_shim(this: &AudioEncoderConfig, val: u32); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &AudioEncoderConfig, val: u32); } #[cfg(web_sys_unstable_apis)] impl AudioEncoderConfig { @@ -37,17 +45,7 @@ impl AudioEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bitrate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,13 +56,7 @@ impl AudioEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn codec(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +67,7 @@ impl AudioEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfChannels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_channels_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -96,17 +78,7 @@ impl AudioEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderInit.rs b/crates/web-sys/src/features/gen_AudioEncoderInit.rs index 074512257e3..52bae3763d0 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderInit; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &AudioEncoderInit, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "output")] + fn output_shim(this: &AudioEncoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl AudioEncoderInit { @@ -38,13 +42,7 @@ impl AudioEncoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,14 +53,7 @@ impl AudioEncoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("output"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderSupport.rs b/crates/web-sys/src/features/gen_AudioEncoderSupport.rs index 1ca54d133db..c19fad1e944 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderSupport.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderSupport.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderSupport; + #[cfg(feature = "AudioEncoderConfig")] + #[wasm_bindgen(method, setter = "config")] + fn config_shim(this: &AudioEncoderSupport, val: &AudioEncoderConfig); + #[wasm_bindgen(method, setter = "supported")] + fn supported_shim(this: &AudioEncoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl AudioEncoderSupport { @@ -37,14 +42,7 @@ impl AudioEncoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn config(&mut self, val: &AudioEncoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("config"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.config_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +53,7 @@ impl AudioEncoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn supported(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supported"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioNodeOptions.rs b/crates/web-sys/src/features/gen_AudioNodeOptions.rs index 369aba788f1..a5baf5de084 100644 --- a/crates/web-sys/src/features/gen_AudioNodeOptions.rs +++ b/crates/web-sys/src/features/gen_AudioNodeOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] pub type AudioNodeOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &AudioNodeOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &AudioNodeOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &AudioNodeOptions, val: ChannelInterpretation); } impl AudioNodeOptions { #[doc = "Construct a new `AudioNodeOptions`."] @@ -24,17 +32,7 @@ impl AudioNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +40,7 @@ impl AudioNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelCountMode`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,17 +48,7 @@ impl AudioNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelInterpretation`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioSinkOptions.rs b/crates/web-sys/src/features/gen_AudioSinkOptions.rs index 5e264767db0..666dd222b52 100644 --- a/crates/web-sys/src/features/gen_AudioSinkOptions.rs +++ b/crates/web-sys/src/features/gen_AudioSinkOptions.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioSinkOptions; + #[cfg(feature = "AudioSinkType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &AudioSinkOptions, val: AudioSinkType); } #[cfg(web_sys_unstable_apis)] impl AudioSinkOptions { @@ -39,13 +42,7 @@ impl AudioSinkOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: AudioSinkType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs index 99db4aa1d64..4d683ce3c00 100644 --- a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs +++ b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub type AudioWorkletNodeOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &AudioWorkletNodeOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &AudioWorkletNodeOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &AudioWorkletNodeOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "numberOfInputs")] + fn number_of_inputs_shim(this: &AudioWorkletNodeOptions, val: u32); + #[wasm_bindgen(method, setter = "numberOfOutputs")] + fn number_of_outputs_shim(this: &AudioWorkletNodeOptions, val: u32); + #[wasm_bindgen(method, setter = "outputChannelCount")] + fn output_channel_count_shim(this: &AudioWorkletNodeOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "processorOptions")] + fn processor_options_shim(this: &AudioWorkletNodeOptions, val: Option<&::js_sys::Object>); } impl AudioWorkletNodeOptions { #[doc = "Construct a new `AudioWorkletNodeOptions`."] @@ -24,17 +40,7 @@ impl AudioWorkletNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +48,7 @@ impl AudioWorkletNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelCountMode`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,85 +56,35 @@ impl AudioWorkletNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelInterpretation`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `numberOfInputs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub fn number_of_inputs(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfInputs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_inputs_shim(val); self } #[doc = "Change the `numberOfOutputs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub fn number_of_outputs(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfOutputs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_outputs_shim(val); self } #[doc = "Change the `outputChannelCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub fn output_channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("outputChannelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_channel_count_shim(val); self } #[doc = "Change the `processorOptions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub fn processor_options(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("processorOptions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.processor_options_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs index 24237c5bbf4..954af0d7237 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] pub type AuthenticationExtensionsClientInputs; + #[wasm_bindgen(method, setter = "appid")] + fn appid_shim(this: &AuthenticationExtensionsClientInputs, val: &str); } impl AuthenticationExtensionsClientInputs { #[doc = "Construct a new `AuthenticationExtensionsClientInputs`."] @@ -24,13 +26,7 @@ impl AuthenticationExtensionsClientInputs { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] pub fn appid(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("appid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.appid_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs index e2e038654fe..9b63b43d5df 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] pub type AuthenticationExtensionsClientOutputs; + #[wasm_bindgen(method, setter = "appid")] + fn appid_shim(this: &AuthenticationExtensionsClientOutputs, val: bool); } impl AuthenticationExtensionsClientOutputs { #[doc = "Construct a new `AuthenticationExtensionsClientOutputs`."] @@ -24,13 +26,7 @@ impl AuthenticationExtensionsClientOutputs { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] pub fn appid(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("appid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.appid_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs index a7bc5c5ab93..4ebf1beed46 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] pub type AuthenticatorSelectionCriteria; + #[cfg(feature = "AuthenticatorAttachment")] + #[wasm_bindgen(method, setter = "authenticatorAttachment")] + fn authenticator_attachment_shim( + this: &AuthenticatorSelectionCriteria, + val: AuthenticatorAttachment, + ); + #[wasm_bindgen(method, setter = "requireResidentKey")] + fn require_resident_key_shim(this: &AuthenticatorSelectionCriteria, val: bool); + #[cfg(feature = "UserVerificationRequirement")] + #[wasm_bindgen(method, setter = "userVerification")] + fn user_verification_shim( + this: &AuthenticatorSelectionCriteria, + val: UserVerificationRequirement, + ); } impl AuthenticatorSelectionCriteria { #[doc = "Construct a new `AuthenticatorSelectionCriteria`."] @@ -25,34 +39,14 @@ impl AuthenticatorSelectionCriteria { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttachment`, `AuthenticatorSelectionCriteria`*"] pub fn authenticator_attachment(&mut self, val: AuthenticatorAttachment) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("authenticatorAttachment"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.authenticator_attachment_shim(val); self } #[doc = "Change the `requireResidentKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] pub fn require_resident_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requireResidentKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.require_resident_key_shim(val); self } #[cfg(feature = "UserVerificationRequirement")] @@ -60,17 +54,7 @@ impl AuthenticatorSelectionCriteria { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `UserVerificationRequirement`*"] pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("userVerification"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.user_verification_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_AutocompleteInfo.rs b/crates/web-sys/src/features/gen_AutocompleteInfo.rs index a87e5213e96..fbc62528fb1 100644 --- a/crates/web-sys/src/features/gen_AutocompleteInfo.rs +++ b/crates/web-sys/src/features/gen_AutocompleteInfo.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub type AutocompleteInfo; + #[wasm_bindgen(method, setter = "addressType")] + fn address_type_shim(this: &AutocompleteInfo, val: &str); + #[wasm_bindgen(method, setter = "contactType")] + fn contact_type_shim(this: &AutocompleteInfo, val: &str); + #[wasm_bindgen(method, setter = "fieldName")] + fn field_name_shim(this: &AutocompleteInfo, val: &str); + #[wasm_bindgen(method, setter = "section")] + fn section_shim(this: &AutocompleteInfo, val: &str); } impl AutocompleteInfo { #[doc = "Construct a new `AutocompleteInfo`."] @@ -24,68 +32,28 @@ impl AutocompleteInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub fn address_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addressType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_type_shim(val); self } #[doc = "Change the `contactType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub fn contact_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contactType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.contact_type_shim(val); self } #[doc = "Change the `fieldName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub fn field_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fieldName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.field_name_shim(val); self } #[doc = "Change the `section` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub fn section(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("section"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.section_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs index 8a91e92ff24..073a7138836 100644 --- a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub type BaseComputedKeyframe; + #[cfg(feature = "CompositeOperation")] + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &BaseComputedKeyframe, val: Option); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &BaseComputedKeyframe, val: &str); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &BaseComputedKeyframe, val: Option); + #[wasm_bindgen(method, setter = "simulateComputeValuesFailure")] + fn simulate_compute_values_failure_shim(this: &BaseComputedKeyframe, val: bool); + #[wasm_bindgen(method, setter = "computedOffset")] + fn computed_offset_shim(this: &BaseComputedKeyframe, val: f64); } impl BaseComputedKeyframe { #[doc = "Construct a new `BaseComputedKeyframe`."] @@ -25,79 +36,35 @@ impl BaseComputedKeyframe { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`, `CompositeOperation`*"] pub fn composite(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `offset` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub fn offset(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[doc = "Change the `simulateComputeValuesFailure` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub fn simulate_compute_values_failure(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("simulateComputeValuesFailure"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.simulate_compute_values_failure_shim(val); self } #[doc = "Change the `computedOffset` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub fn computed_offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("computedOffset"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.computed_offset_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BaseKeyframe.rs b/crates/web-sys/src/features/gen_BaseKeyframe.rs index 692a8fc2863..0c2f97da2aa 100644 --- a/crates/web-sys/src/features/gen_BaseKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseKeyframe.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] pub type BaseKeyframe; + #[cfg(feature = "CompositeOperation")] + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &BaseKeyframe, val: Option); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &BaseKeyframe, val: &str); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &BaseKeyframe, val: Option); + #[wasm_bindgen(method, setter = "simulateComputeValuesFailure")] + fn simulate_compute_values_failure_shim(this: &BaseKeyframe, val: bool); } impl BaseKeyframe { #[doc = "Construct a new `BaseKeyframe`."] @@ -25,62 +34,28 @@ impl BaseKeyframe { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`, `CompositeOperation`*"] pub fn composite(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `offset` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] pub fn offset(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[doc = "Change the `simulateComputeValuesFailure` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] pub fn simulate_compute_values_failure(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("simulateComputeValuesFailure"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.simulate_compute_values_failure_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs b/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs index 38eebc98161..d2dfb18f80e 100644 --- a/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs +++ b/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] pub type BasePropertyIndexedKeyframe; + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); } impl BasePropertyIndexedKeyframe { #[doc = "Construct a new `BasePropertyIndexedKeyframe`."] @@ -24,45 +30,21 @@ impl BasePropertyIndexedKeyframe { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] pub fn composite(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] pub fn easing(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `offset` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] pub fn offset(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BasicCardRequest.rs b/crates/web-sys/src/features/gen_BasicCardRequest.rs index 6b029a46b90..4509a71d546 100644 --- a/crates/web-sys/src/features/gen_BasicCardRequest.rs +++ b/crates/web-sys/src/features/gen_BasicCardRequest.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] pub type BasicCardRequest; + #[wasm_bindgen(method, setter = "supportedNetworks")] + fn supported_networks_shim(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "supportedTypes")] + fn supported_types_shim(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); } impl BasicCardRequest { #[doc = "Construct a new `BasicCardRequest`."] @@ -24,34 +28,14 @@ impl BasicCardRequest { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] pub fn supported_networks(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supportedNetworks"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_networks_shim(val); self } #[doc = "Change the `supportedTypes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] pub fn supported_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supportedTypes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_types_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BasicCardResponse.rs b/crates/web-sys/src/features/gen_BasicCardResponse.rs index 1341341abab..bafff97512c 100644 --- a/crates/web-sys/src/features/gen_BasicCardResponse.rs +++ b/crates/web-sys/src/features/gen_BasicCardResponse.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub type BasicCardResponse; + #[cfg(feature = "PaymentAddress")] + #[wasm_bindgen(method, setter = "billingAddress")] + fn billing_address_shim(this: &BasicCardResponse, val: Option<&PaymentAddress>); + #[wasm_bindgen(method, setter = "cardNumber")] + fn card_number_shim(this: &BasicCardResponse, val: &str); + #[wasm_bindgen(method, setter = "cardSecurityCode")] + fn card_security_code_shim(this: &BasicCardResponse, val: &str); + #[wasm_bindgen(method, setter = "cardholderName")] + fn cardholder_name_shim(this: &BasicCardResponse, val: &str); + #[wasm_bindgen(method, setter = "expiryMonth")] + fn expiry_month_shim(this: &BasicCardResponse, val: &str); + #[wasm_bindgen(method, setter = "expiryYear")] + fn expiry_year_shim(this: &BasicCardResponse, val: &str); } impl BasicCardResponse { #[doc = "Construct a new `BasicCardResponse`."] @@ -26,102 +39,42 @@ impl BasicCardResponse { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`, `PaymentAddress`*"] pub fn billing_address(&mut self, val: Option<&PaymentAddress>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("billingAddress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.billing_address_shim(val); self } #[doc = "Change the `cardNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub fn card_number(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cardNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.card_number_shim(val); self } #[doc = "Change the `cardSecurityCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub fn card_security_code(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cardSecurityCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.card_security_code_shim(val); self } #[doc = "Change the `cardholderName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub fn cardholder_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cardholderName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cardholder_name_shim(val); self } #[doc = "Change the `expiryMonth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub fn expiry_month(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("expiryMonth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.expiry_month_shim(val); self } #[doc = "Change the `expiryYear` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub fn expiry_year(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("expiryYear"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.expiry_year_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BiquadFilterOptions.rs b/crates/web-sys/src/features/gen_BiquadFilterOptions.rs index d8a4af290f0..6a0863aa344 100644 --- a/crates/web-sys/src/features/gen_BiquadFilterOptions.rs +++ b/crates/web-sys/src/features/gen_BiquadFilterOptions.rs @@ -10,6 +10,25 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub type BiquadFilterOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &BiquadFilterOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &BiquadFilterOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &BiquadFilterOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "Q")] + fn q_shim(this: &BiquadFilterOptions, val: f32); + #[wasm_bindgen(method, setter = "detune")] + fn detune_shim(this: &BiquadFilterOptions, val: f32); + #[wasm_bindgen(method, setter = "frequency")] + fn frequency_shim(this: &BiquadFilterOptions, val: f32); + #[wasm_bindgen(method, setter = "gain")] + fn gain_shim(this: &BiquadFilterOptions, val: f32); + #[cfg(feature = "BiquadFilterType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &BiquadFilterOptions, val: BiquadFilterType); } impl BiquadFilterOptions { #[doc = "Construct a new `BiquadFilterOptions`."] @@ -24,17 +43,7 @@ impl BiquadFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +51,7 @@ impl BiquadFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelCountMode`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,74 +59,35 @@ impl BiquadFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelInterpretation`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `Q` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub fn q(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("Q"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.q_shim(val); self } #[doc = "Change the `detune` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub fn detune(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detune"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detune_shim(val); self } #[doc = "Change the `frequency` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub fn frequency(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frequency"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frequency_shim(val); self } #[doc = "Change the `gain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub fn gain(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("gain"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gain_shim(val); self } #[cfg(feature = "BiquadFilterType")] @@ -135,13 +95,7 @@ impl BiquadFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `BiquadFilterType`*"] pub fn type_(&mut self, val: BiquadFilterType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BlobEventInit.rs b/crates/web-sys/src/features/gen_BlobEventInit.rs index 5abb9a6fba5..0fa75a06fb3 100644 --- a/crates/web-sys/src/features/gen_BlobEventInit.rs +++ b/crates/web-sys/src/features/gen_BlobEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] pub type BlobEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &BlobEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &BlobEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &BlobEventInit, val: bool); + #[cfg(feature = "Blob")] + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &BlobEventInit, val: Option<&Blob>); } impl BlobEventInit { #[doc = "Construct a new `BlobEventInit`."] @@ -24,51 +33,21 @@ impl BlobEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Blob")] @@ -76,13 +55,7 @@ impl BlobEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobEventInit`*"] pub fn data(&mut self, val: Option<&Blob>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BlobPropertyBag.rs b/crates/web-sys/src/features/gen_BlobPropertyBag.rs index 80cf07ead92..0adf9be4ac0 100644 --- a/crates/web-sys/src/features/gen_BlobPropertyBag.rs +++ b/crates/web-sys/src/features/gen_BlobPropertyBag.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] pub type BlobPropertyBag; + #[cfg(feature = "EndingTypes")] + #[wasm_bindgen(method, setter = "endings")] + fn endings_shim(this: &BlobPropertyBag, val: EndingTypes); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &BlobPropertyBag, val: &str); } impl BlobPropertyBag { #[doc = "Construct a new `BlobPropertyBag`."] @@ -25,30 +30,14 @@ impl BlobPropertyBag { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`, `EndingTypes`*"] pub fn endings(&mut self, val: EndingTypes) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.endings_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BlockParsingOptions.rs b/crates/web-sys/src/features/gen_BlockParsingOptions.rs index f12f036962a..f46a8c184bc 100644 --- a/crates/web-sys/src/features/gen_BlockParsingOptions.rs +++ b/crates/web-sys/src/features/gen_BlockParsingOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] pub type BlockParsingOptions; + #[wasm_bindgen(method, setter = "blockScriptCreated")] + fn block_script_created_shim(this: &BlockParsingOptions, val: bool); } impl BlockParsingOptions { #[doc = "Construct a new `BlockParsingOptions`."] @@ -24,17 +26,7 @@ impl BlockParsingOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] pub fn block_script_created(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("blockScriptCreated"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.block_script_created_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs index 4a1bf8b5e24..3b357d47883 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs @@ -14,6 +14,34 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothAdvertisingEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &BluetoothAdvertisingEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &BluetoothAdvertisingEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &BluetoothAdvertisingEventInit, val: bool); + #[wasm_bindgen(method, setter = "appearance")] + fn appearance_shim(this: &BluetoothAdvertisingEventInit, val: u16); + #[cfg(feature = "BluetoothDevice")] + #[wasm_bindgen(method, setter = "device")] + fn device_shim(this: &BluetoothAdvertisingEventInit, val: &BluetoothDevice); + #[cfg(feature = "BluetoothManufacturerDataMap")] + #[wasm_bindgen(method, setter = "manufacturerData")] + fn manufacturer_data_shim( + this: &BluetoothAdvertisingEventInit, + val: &BluetoothManufacturerDataMap, + ); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &BluetoothAdvertisingEventInit, val: &str); + #[wasm_bindgen(method, setter = "rssi")] + fn rssi_shim(this: &BluetoothAdvertisingEventInit, val: i8); + #[cfg(feature = "BluetoothServiceDataMap")] + #[wasm_bindgen(method, setter = "serviceData")] + fn service_data_shim(this: &BluetoothAdvertisingEventInit, val: &BluetoothServiceDataMap); + #[wasm_bindgen(method, setter = "txPower")] + fn tx_power_shim(this: &BluetoothAdvertisingEventInit, val: i8); + #[wasm_bindgen(method, setter = "uuids")] + fn uuids_shim(this: &BluetoothAdvertisingEventInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl BluetoothAdvertisingEventInit { @@ -38,17 +66,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +77,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +88,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -101,17 +99,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn appearance(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("appearance"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.appearance_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -123,14 +111,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device(&mut self, val: &BluetoothDevice) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -142,17 +123,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn manufacturer_data(&mut self, val: &BluetoothManufacturerDataMap) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("manufacturerData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.manufacturer_data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -163,13 +134,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -180,13 +145,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn rssi(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rssi"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rssi_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -198,17 +157,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn service_data(&mut self, val: &BluetoothServiceDataMap) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serviceData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.service_data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -219,17 +168,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn tx_power(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("txPower"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tx_power_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -240,13 +179,7 @@ impl BluetoothAdvertisingEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn uuids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("uuids"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.uuids_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs b/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs index d9867246790..c5ced6819f6 100644 --- a/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothDataFilterInit; + #[wasm_bindgen(method, setter = "dataPrefix")] + fn data_prefix_shim(this: &BluetoothDataFilterInit, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "mask")] + fn mask_shim(this: &BluetoothDataFilterInit, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl BluetoothDataFilterInit { @@ -36,17 +40,7 @@ impl BluetoothDataFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data_prefix(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataPrefix"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_prefix_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +51,7 @@ impl BluetoothDataFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mask(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mask"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs index 7c75bbcdc8a..e70ea5d2c1c 100644 --- a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothLeScanFilterInit; + #[wasm_bindgen(method, setter = "manufacturerData")] + fn manufacturer_data_shim(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &BluetoothLeScanFilterInit, val: &str); + #[wasm_bindgen(method, setter = "namePrefix")] + fn name_prefix_shim(this: &BluetoothLeScanFilterInit, val: &str); + #[wasm_bindgen(method, setter = "serviceData")] + fn service_data_shim(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "services")] + fn services_shim(this: &BluetoothLeScanFilterInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl BluetoothLeScanFilterInit { @@ -36,17 +46,7 @@ impl BluetoothLeScanFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn manufacturer_data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("manufacturerData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.manufacturer_data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +57,7 @@ impl BluetoothLeScanFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +68,7 @@ impl BluetoothLeScanFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name_prefix(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("namePrefix"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_prefix_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,17 +79,7 @@ impl BluetoothLeScanFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn service_data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serviceData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.service_data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -116,17 +90,7 @@ impl BluetoothLeScanFilterInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("services"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.services_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs index 9ac1d174c72..3159b4567b3 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs @@ -14,6 +14,17 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &BluetoothPermissionDescriptor, val: PermissionName); + #[wasm_bindgen(method, setter = "acceptAllDevices")] + fn accept_all_devices_shim(this: &BluetoothPermissionDescriptor, val: bool); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &BluetoothPermissionDescriptor, val: &str); + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &BluetoothPermissionDescriptor, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "optionalServices")] + fn optional_services_shim(this: &BluetoothPermissionDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl BluetoothPermissionDescriptor { @@ -39,13 +50,7 @@ impl BluetoothPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +61,7 @@ impl BluetoothPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("acceptAllDevices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.accept_all_devices_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +72,7 @@ impl BluetoothPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +83,7 @@ impl BluetoothPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -119,17 +94,7 @@ impl BluetoothPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn optional_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("optionalServices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.optional_services_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs index 57190d3a914..0ef0d117cde 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothPermissionStorage; + #[wasm_bindgen(method, setter = "allowedDevices")] + fn allowed_devices_shim(this: &BluetoothPermissionStorage, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl BluetoothPermissionStorage { @@ -37,17 +39,7 @@ impl BluetoothPermissionStorage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn allowed_devices(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowedDevices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allowed_devices_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BoxQuadOptions.rs b/crates/web-sys/src/features/gen_BoxQuadOptions.rs index 3b54ddb7b4e..6000d877f7c 100644 --- a/crates/web-sys/src/features/gen_BoxQuadOptions.rs +++ b/crates/web-sys/src/features/gen_BoxQuadOptions.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] pub type BoxQuadOptions; + #[cfg(feature = "CssBoxType")] + #[wasm_bindgen(method, setter = "box")] + fn box__shim(this: &BoxQuadOptions, val: CssBoxType); + #[wasm_bindgen(method, setter = "relativeTo")] + fn relative_to_shim(this: &BoxQuadOptions, val: &::js_sys::Object); } impl BoxQuadOptions { #[doc = "Construct a new `BoxQuadOptions`."] @@ -25,30 +30,14 @@ impl BoxQuadOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`, `CssBoxType`*"] pub fn box_(&mut self, val: CssBoxType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("box"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.box__shim(val); self } #[doc = "Change the `relativeTo` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] pub fn relative_to(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relativeTo"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.relative_to_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs index 6f91e51e4e4..2b5f6f187b8 100644 --- a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] pub type BrowserElementDownloadOptions; + #[wasm_bindgen(method, setter = "filename")] + fn filename_shim(this: &BrowserElementDownloadOptions, val: Option<&str>); + #[wasm_bindgen(method, setter = "referrer")] + fn referrer_shim(this: &BrowserElementDownloadOptions, val: Option<&str>); } impl BrowserElementDownloadOptions { #[doc = "Construct a new `BrowserElementDownloadOptions`."] @@ -24,34 +28,14 @@ impl BrowserElementDownloadOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] pub fn filename(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filename_shim(val); self } #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] pub fn referrer(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("referrer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.referrer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs index 065a954ccab..8a63b96bae3 100644 --- a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] pub type BrowserElementExecuteScriptOptions; + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); } impl BrowserElementExecuteScriptOptions { #[doc = "Construct a new `BrowserElementExecuteScriptOptions`."] @@ -24,27 +28,14 @@ impl BrowserElementExecuteScriptOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] pub fn origin(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] pub fn url(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CacheBatchOperation.rs b/crates/web-sys/src/features/gen_CacheBatchOperation.rs index 8f5a31d021e..706019c1794 100644 --- a/crates/web-sys/src/features/gen_CacheBatchOperation.rs +++ b/crates/web-sys/src/features/gen_CacheBatchOperation.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] pub type CacheBatchOperation; + #[cfg(feature = "CacheQueryOptions")] + #[wasm_bindgen(method, setter = "options")] + fn options_shim(this: &CacheBatchOperation, val: &CacheQueryOptions); + #[cfg(feature = "Request")] + #[wasm_bindgen(method, setter = "request")] + fn request_shim(this: &CacheBatchOperation, val: &Request); + #[cfg(feature = "Response")] + #[wasm_bindgen(method, setter = "response")] + fn response_shim(this: &CacheBatchOperation, val: &Response); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &CacheBatchOperation, val: &str); } impl CacheBatchOperation { #[doc = "Construct a new `CacheBatchOperation`."] @@ -25,17 +36,7 @@ impl CacheBatchOperation { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `CacheQueryOptions`*"] pub fn options(&mut self, val: &CacheQueryOptions) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("options"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.options_shim(val); self } #[cfg(feature = "Request")] @@ -43,17 +44,7 @@ impl CacheBatchOperation { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Request`*"] pub fn request(&mut self, val: &Request) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("request"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.request_shim(val); self } #[cfg(feature = "Response")] @@ -61,30 +52,14 @@ impl CacheBatchOperation { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Response`*"] pub fn response(&mut self, val: &Response) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("response"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.response_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CacheQueryOptions.rs b/crates/web-sys/src/features/gen_CacheQueryOptions.rs index 527080eb2ad..f7b0bdf77e8 100644 --- a/crates/web-sys/src/features/gen_CacheQueryOptions.rs +++ b/crates/web-sys/src/features/gen_CacheQueryOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub type CacheQueryOptions; + #[wasm_bindgen(method, setter = "cacheName")] + fn cache_name_shim(this: &CacheQueryOptions, val: &str); + #[wasm_bindgen(method, setter = "ignoreMethod")] + fn ignore_method_shim(this: &CacheQueryOptions, val: bool); + #[wasm_bindgen(method, setter = "ignoreSearch")] + fn ignore_search_shim(this: &CacheQueryOptions, val: bool); + #[wasm_bindgen(method, setter = "ignoreVary")] + fn ignore_vary_shim(this: &CacheQueryOptions, val: bool); } impl CacheQueryOptions { #[doc = "Construct a new `CacheQueryOptions`."] @@ -24,68 +32,28 @@ impl CacheQueryOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub fn cache_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cacheName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cache_name_shim(val); self } #[doc = "Change the `ignoreMethod` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub fn ignore_method(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ignoreMethod"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ignore_method_shim(val); self } #[doc = "Change the `ignoreSearch` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub fn ignore_search(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ignoreSearch"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ignore_search_shim(val); self } #[doc = "Change the `ignoreVary` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub fn ignore_vary(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ignoreVary"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ignore_vary_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs index cea0ebcd8cb..1a7a53e1ea7 100644 --- a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs +++ b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs @@ -10,6 +10,30 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub type CaretStateChangedEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &CaretStateChangedEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &CaretStateChangedEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &CaretStateChangedEventInit, val: bool); + #[cfg(feature = "DomRectReadOnly")] + #[wasm_bindgen(method, setter = "boundingClientRect")] + fn bounding_client_rect_shim(this: &CaretStateChangedEventInit, val: Option<&DomRectReadOnly>); + #[wasm_bindgen(method, setter = "caretVisible")] + fn caret_visible_shim(this: &CaretStateChangedEventInit, val: bool); + #[wasm_bindgen(method, setter = "caretVisuallyVisible")] + fn caret_visually_visible_shim(this: &CaretStateChangedEventInit, val: bool); + #[wasm_bindgen(method, setter = "collapsed")] + fn collapsed_shim(this: &CaretStateChangedEventInit, val: bool); + #[cfg(feature = "CaretChangedReason")] + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &CaretStateChangedEventInit, val: CaretChangedReason); + #[wasm_bindgen(method, setter = "selectedTextContent")] + fn selected_text_content_shim(this: &CaretStateChangedEventInit, val: &str); + #[wasm_bindgen(method, setter = "selectionEditable")] + fn selection_editable_shim(this: &CaretStateChangedEventInit, val: bool); + #[wasm_bindgen(method, setter = "selectionVisible")] + fn selection_visible_shim(this: &CaretStateChangedEventInit, val: bool); } impl CaretStateChangedEventInit { #[doc = "Construct a new `CaretStateChangedEventInit`."] @@ -24,51 +48,21 @@ impl CaretStateChangedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "DomRectReadOnly")] @@ -76,68 +70,28 @@ impl CaretStateChangedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`, `DomRectReadOnly`*"] pub fn bounding_client_rect(&mut self, val: Option<&DomRectReadOnly>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("boundingClientRect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bounding_client_rect_shim(val); self } #[doc = "Change the `caretVisible` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn caret_visible(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("caretVisible"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.caret_visible_shim(val); self } #[doc = "Change the `caretVisuallyVisible` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn caret_visually_visible(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("caretVisuallyVisible"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.caret_visually_visible_shim(val); self } #[doc = "Change the `collapsed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn collapsed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("collapsed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.collapsed_shim(val); self } #[cfg(feature = "CaretChangedReason")] @@ -145,65 +99,28 @@ impl CaretStateChangedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretChangedReason`, `CaretStateChangedEventInit`*"] pub fn reason(&mut self, val: CaretChangedReason) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } #[doc = "Change the `selectedTextContent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn selected_text_content(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("selectedTextContent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.selected_text_content_shim(val); self } #[doc = "Change the `selectionEditable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn selection_editable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("selectionEditable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.selection_editable_shim(val); self } #[doc = "Change the `selectionVisible` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub fn selection_visible(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("selectionVisible"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.selection_visible_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ChannelMergerOptions.rs b/crates/web-sys/src/features/gen_ChannelMergerOptions.rs index 314a2c24cf6..2a0566f3bcc 100644 --- a/crates/web-sys/src/features/gen_ChannelMergerOptions.rs +++ b/crates/web-sys/src/features/gen_ChannelMergerOptions.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] pub type ChannelMergerOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &ChannelMergerOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &ChannelMergerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &ChannelMergerOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "numberOfInputs")] + fn number_of_inputs_shim(this: &ChannelMergerOptions, val: u32); } impl ChannelMergerOptions { #[doc = "Construct a new `ChannelMergerOptions`."] @@ -24,17 +34,7 @@ impl ChannelMergerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +42,7 @@ impl ChannelMergerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelMergerOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,34 +50,14 @@ impl ChannelMergerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelMergerOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `numberOfInputs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] pub fn number_of_inputs(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfInputs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_inputs_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs b/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs index 2dc888453b5..a70a522b224 100644 --- a/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs +++ b/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] pub type ChannelSplitterOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &ChannelSplitterOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &ChannelSplitterOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &ChannelSplitterOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "numberOfOutputs")] + fn number_of_outputs_shim(this: &ChannelSplitterOptions, val: u32); } impl ChannelSplitterOptions { #[doc = "Construct a new `ChannelSplitterOptions`."] @@ -24,17 +34,7 @@ impl ChannelSplitterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +42,7 @@ impl ChannelSplitterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelSplitterOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,34 +50,14 @@ impl ChannelSplitterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelSplitterOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `numberOfOutputs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] pub fn number_of_outputs(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfOutputs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_outputs_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CheckerboardReport.rs b/crates/web-sys/src/features/gen_CheckerboardReport.rs index 0e2f5c34112..636544b6152 100644 --- a/crates/web-sys/src/features/gen_CheckerboardReport.rs +++ b/crates/web-sys/src/features/gen_CheckerboardReport.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] pub type CheckerboardReport; + #[wasm_bindgen(method, setter = "log")] + fn log_shim(this: &CheckerboardReport, val: &str); + #[cfg(feature = "CheckerboardReason")] + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &CheckerboardReport, val: CheckerboardReason); + #[wasm_bindgen(method, setter = "severity")] + fn severity_shim(this: &CheckerboardReport, val: u32); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &CheckerboardReport, val: f64); } impl CheckerboardReport { #[doc = "Construct a new `CheckerboardReport`."] @@ -24,13 +33,7 @@ impl CheckerboardReport { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] pub fn log(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("log"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.log_shim(val); self } #[cfg(feature = "CheckerboardReason")] @@ -38,48 +41,21 @@ impl CheckerboardReport { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReason`, `CheckerboardReport`*"] pub fn reason(&mut self, val: CheckerboardReason) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } #[doc = "Change the `severity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] pub fn severity(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("severity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.severity_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs index 234090cfd2c..b7ec7502649 100644 --- a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub type ChromeFilePropertyBag; + #[wasm_bindgen(method, setter = "lastModified")] + fn last_modified_shim(this: &ChromeFilePropertyBag, val: f64); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &ChromeFilePropertyBag, val: &str); + #[wasm_bindgen(method, setter = "existenceCheck")] + fn existence_check_shim(this: &ChromeFilePropertyBag, val: bool); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ChromeFilePropertyBag, val: &str); } impl ChromeFilePropertyBag { #[doc = "Construct a new `ChromeFilePropertyBag`."] @@ -24,60 +32,28 @@ impl ChromeFilePropertyBag { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub fn last_modified(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastModified"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_modified_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `existenceCheck` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub fn existence_check(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("existenceCheck"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.existence_check_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ClientQueryOptions.rs b/crates/web-sys/src/features/gen_ClientQueryOptions.rs index fdbb30dc459..79f6f0913c6 100644 --- a/crates/web-sys/src/features/gen_ClientQueryOptions.rs +++ b/crates/web-sys/src/features/gen_ClientQueryOptions.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] pub type ClientQueryOptions; + #[wasm_bindgen(method, setter = "includeUncontrolled")] + fn include_uncontrolled_shim(this: &ClientQueryOptions, val: bool); + #[cfg(feature = "ClientType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &ClientQueryOptions, val: ClientType); } impl ClientQueryOptions { #[doc = "Construct a new `ClientQueryOptions`."] @@ -24,17 +29,7 @@ impl ClientQueryOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] pub fn include_uncontrolled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("includeUncontrolled"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.include_uncontrolled_shim(val); self } #[cfg(feature = "ClientType")] @@ -42,13 +37,7 @@ impl ClientQueryOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`, `ClientType`*"] pub fn type_(&mut self, val: ClientType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs index a063f0a56d4..151fd20d628 100644 --- a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs +++ b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] pub type ClientRectsAndTexts; + #[cfg(feature = "DomRectList")] + #[wasm_bindgen(method, setter = "rectList")] + fn rect_list_shim(this: &ClientRectsAndTexts, val: &DomRectList); + #[wasm_bindgen(method, setter = "textList")] + fn text_list_shim(this: &ClientRectsAndTexts, val: &::wasm_bindgen::JsValue); } impl ClientRectsAndTexts { #[cfg(feature = "DomRectList")] @@ -28,34 +33,14 @@ impl ClientRectsAndTexts { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`, `DomRectList`*"] pub fn rect_list(&mut self, val: &DomRectList) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rectList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rect_list_shim(val); self } #[doc = "Change the `textList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] pub fn text_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("textList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.text_list_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardEventInit.rs b/crates/web-sys/src/features/gen_ClipboardEventInit.rs index 6f0cb3acfef..57fae5e2914 100644 --- a/crates/web-sys/src/features/gen_ClipboardEventInit.rs +++ b/crates/web-sys/src/features/gen_ClipboardEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] pub type ClipboardEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ClipboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ClipboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ClipboardEventInit, val: bool); + #[cfg(feature = "DataTransfer")] + #[wasm_bindgen(method, setter = "clipboardData")] + fn clipboard_data_shim(this: &ClipboardEventInit, val: Option<&DataTransfer>); } impl ClipboardEventInit { #[doc = "Construct a new `ClipboardEventInit`."] @@ -24,51 +33,21 @@ impl ClipboardEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "DataTransfer")] @@ -76,17 +55,7 @@ impl ClipboardEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`, `DataTransfer`*"] pub fn clipboard_data(&mut self, val: Option<&DataTransfer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clipboardData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clipboard_data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs index c83e7ae1e62..5930f6d857a 100644 --- a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs +++ b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardItemOptions; + #[cfg(feature = "PresentationStyle")] + #[wasm_bindgen(method, setter = "presentationStyle")] + fn presentation_style_shim(this: &ClipboardItemOptions, val: PresentationStyle); } #[cfg(web_sys_unstable_apis)] impl ClipboardItemOptions { @@ -37,17 +40,7 @@ impl ClipboardItemOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn presentation_style(&mut self, val: PresentationStyle) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("presentationStyle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.presentation_style_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs index 8028a269f1d..5c8ac6e004d 100644 --- a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ClipboardPermissionDescriptor, val: PermissionName); + #[wasm_bindgen(method, setter = "allowWithoutGesture")] + fn allow_without_gesture_shim(this: &ClipboardPermissionDescriptor, val: bool); } #[cfg(web_sys_unstable_apis)] impl ClipboardPermissionDescriptor { @@ -39,13 +44,7 @@ impl ClipboardPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +55,7 @@ impl ClipboardPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn allow_without_gesture(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowWithoutGesture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allow_without_gesture_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CloseEventInit.rs b/crates/web-sys/src/features/gen_CloseEventInit.rs index f32e46ac065..16b73d6cd89 100644 --- a/crates/web-sys/src/features/gen_CloseEventInit.rs +++ b/crates/web-sys/src/features/gen_CloseEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub type CloseEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &CloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &CloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &CloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "code")] + fn code_shim(this: &CloseEventInit, val: u16); + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &CloseEventInit, val: &str); + #[wasm_bindgen(method, setter = "wasClean")] + fn was_clean_shim(this: &CloseEventInit, val: bool); } impl CloseEventInit { #[doc = "Construct a new `CloseEventInit`."] @@ -24,95 +36,42 @@ impl CloseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `code` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn code(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("code"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.code_shim(val); self } #[doc = "Change the `reason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn reason(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } #[doc = "Change the `wasClean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub fn was_clean(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("wasClean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.was_clean_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CollectedClientData.rs b/crates/web-sys/src/features/gen_CollectedClientData.rs index 19985910d9c..96b9b4a5d0e 100644 --- a/crates/web-sys/src/features/gen_CollectedClientData.rs +++ b/crates/web-sys/src/features/gen_CollectedClientData.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub type CollectedClientData; + #[wasm_bindgen(method, setter = "challenge")] + fn challenge_shim(this: &CollectedClientData, val: &str); + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[wasm_bindgen(method, setter = "clientExtensions")] + fn client_extensions_shim( + this: &CollectedClientData, + val: &AuthenticationExtensionsClientInputs, + ); + #[wasm_bindgen(method, setter = "hashAlgorithm")] + fn hash_algorithm_shim(this: &CollectedClientData, val: &str); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &CollectedClientData, val: &str); + #[wasm_bindgen(method, setter = "tokenBindingId")] + fn token_binding_id_shim(this: &CollectedClientData, val: &str); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &CollectedClientData, val: &str); } impl CollectedClientData { #[doc = "Construct a new `CollectedClientData`."] @@ -28,17 +44,7 @@ impl CollectedClientData { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub fn challenge(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("challenge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.challenge_shim(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] @@ -46,78 +52,35 @@ impl CollectedClientData { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] pub fn client_extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientExtensions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_extensions_shim(val); self } #[doc = "Change the `hashAlgorithm` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub fn hash_algorithm(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hashAlgorithm"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_algorithm_shim(val); self } #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub fn origin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `tokenBindingId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub fn token_binding_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("tokenBindingId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.token_binding_id_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CompositionEventInit.rs b/crates/web-sys/src/features/gen_CompositionEventInit.rs index d912089b042..8f2ec5a6b48 100644 --- a/crates/web-sys/src/features/gen_CompositionEventInit.rs +++ b/crates/web-sys/src/features/gen_CompositionEventInit.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub type CompositionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &CompositionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &CompositionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &CompositionEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &CompositionEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &CompositionEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &CompositionEventInit, val: &str); } impl CompositionEventInit { #[doc = "Construct a new `CompositionEventInit`."] @@ -24,65 +37,28 @@ impl CompositionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,26 +66,14 @@ impl CompositionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub fn data(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs index 85ab85a0060..8d55c2533ea 100644 --- a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs +++ b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs @@ -10,6 +10,34 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub type ComputedEffectTiming; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &ComputedEffectTiming, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &ComputedEffectTiming, val: PlaybackDirection); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &ComputedEffectTiming, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &ComputedEffectTiming, val: &str); + #[wasm_bindgen(method, setter = "endDelay")] + fn end_delay_shim(this: &ComputedEffectTiming, val: f64); + #[cfg(feature = "FillMode")] + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &ComputedEffectTiming, val: FillMode); + #[wasm_bindgen(method, setter = "iterationStart")] + fn iteration_start_shim(this: &ComputedEffectTiming, val: f64); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &ComputedEffectTiming, val: f64); + #[wasm_bindgen(method, setter = "activeDuration")] + fn active_duration_shim(this: &ComputedEffectTiming, val: f64); + #[wasm_bindgen(method, setter = "currentIteration")] + fn current_iteration_shim(this: &ComputedEffectTiming, val: Option); + #[wasm_bindgen(method, setter = "endTime")] + fn end_time_shim(this: &ComputedEffectTiming, val: f64); + #[wasm_bindgen(method, setter = "localTime")] + fn local_time_shim(this: &ComputedEffectTiming, val: Option); + #[wasm_bindgen(method, setter = "progress")] + fn progress_shim(this: &ComputedEffectTiming, val: Option); } impl ComputedEffectTiming { #[doc = "Construct a new `ComputedEffectTiming`."] @@ -24,13 +52,7 @@ impl ComputedEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(feature = "PlaybackDirection")] @@ -38,65 +60,28 @@ impl ComputedEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `PlaybackDirection`*"] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `endDelay` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn end_delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endDelay"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_delay_shim(val); self } #[cfg(feature = "FillMode")] @@ -104,132 +89,56 @@ impl ComputedEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `FillMode`*"] pub fn fill(&mut self, val: FillMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[doc = "Change the `iterationStart` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_start_shim(val); self } #[doc = "Change the `iterations` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn iterations(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } #[doc = "Change the `activeDuration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn active_duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("activeDuration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.active_duration_shim(val); self } #[doc = "Change the `currentIteration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn current_iteration(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("currentIteration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.current_iteration_shim(val); self } #[doc = "Change the `endTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn end_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_time_shim(val); self } #[doc = "Change the `localTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn local_time(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_time_shim(val); self } #[doc = "Change the `progress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub fn progress(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("progress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.progress_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConnStatusDict.rs b/crates/web-sys/src/features/gen_ConnStatusDict.rs index 0a488ebb8ea..be5540fc998 100644 --- a/crates/web-sys/src/features/gen_ConnStatusDict.rs +++ b/crates/web-sys/src/features/gen_ConnStatusDict.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] pub type ConnStatusDict; + #[wasm_bindgen(method, setter = "status")] + fn status_shim(this: &ConnStatusDict, val: &str); } impl ConnStatusDict { #[doc = "Construct a new `ConnStatusDict`."] @@ -24,14 +26,7 @@ impl ConnStatusDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] pub fn status(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("status"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleCounter.rs b/crates/web-sys/src/features/gen_ConsoleCounter.rs index e3a80a95ea9..be0416a4baf 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounter.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounter.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] pub type ConsoleCounter; + #[wasm_bindgen(method, setter = "count")] + fn count_shim(this: &ConsoleCounter, val: u32); + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &ConsoleCounter, val: &str); } impl ConsoleCounter { #[doc = "Construct a new `ConsoleCounter`."] @@ -24,26 +28,14 @@ impl ConsoleCounter { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] pub fn count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("count"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.count_shim(val); self } #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleCounterError.rs b/crates/web-sys/src/features/gen_ConsoleCounterError.rs index 91da438f714..69738146c54 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounterError.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounterError.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] pub type ConsoleCounterError; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &ConsoleCounterError, val: &str); + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &ConsoleCounterError, val: &str); } impl ConsoleCounterError { #[doc = "Construct a new `ConsoleCounterError`."] @@ -24,26 +28,14 @@ impl ConsoleCounterError { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] pub fn error(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleEvent.rs b/crates/web-sys/src/features/gen_ConsoleEvent.rs index 3f56778fcb3..d88d063f088 100644 --- a/crates/web-sys/src/features/gen_ConsoleEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleEvent.rs @@ -10,6 +10,40 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub type ConsoleEvent; + #[wasm_bindgen(method, setter = "ID")] + fn id_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "addonId")] + fn addon_id_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "arguments")] + fn arguments_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "columnNumber")] + fn column_number_shim(this: &ConsoleEvent, val: u32); + #[wasm_bindgen(method, setter = "consoleID")] + fn console_id_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "counter")] + fn counter_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "filename")] + fn filename_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "functionName")] + fn function_name_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "groupName")] + fn group_name_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "innerID")] + fn inner_id_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "level")] + fn level_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "lineNumber")] + fn line_number_shim(this: &ConsoleEvent, val: u32); + #[wasm_bindgen(method, setter = "prefix")] + fn prefix_shim(this: &ConsoleEvent, val: &str); + #[wasm_bindgen(method, setter = "private")] + fn private_shim(this: &ConsoleEvent, val: bool); + #[wasm_bindgen(method, setter = "styles")] + fn styles_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "timeStamp")] + fn time_stamp_shim(this: &ConsoleEvent, val: f64); + #[wasm_bindgen(method, setter = "timer")] + fn timer_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); } impl ConsoleEvent { #[doc = "Construct a new `ConsoleEvent`."] @@ -24,271 +58,119 @@ impl ConsoleEvent { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ID"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `addonId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn addon_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addonId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.addon_id_shim(val); self } #[doc = "Change the `arguments` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn arguments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("arguments"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.arguments_shim(val); self } #[doc = "Change the `columnNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn column_number(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("columnNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.column_number_shim(val); self } #[doc = "Change the `consoleID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn console_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("consoleID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.console_id_shim(val); self } #[doc = "Change the `counter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn counter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("counter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.counter_shim(val); self } #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn filename(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filename_shim(val); self } #[doc = "Change the `functionName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn function_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("functionName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.function_name_shim(val); self } #[doc = "Change the `groupName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn group_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("groupName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.group_name_shim(val); self } #[doc = "Change the `innerID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn inner_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("innerID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inner_id_shim(val); self } #[doc = "Change the `level` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn level(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("level"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.level_shim(val); self } #[doc = "Change the `lineNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn line_number(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lineNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.line_number_shim(val); self } #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn prefix(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("prefix"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefix_shim(val); self } #[doc = "Change the `private` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn private(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("private"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.private_shim(val); self } #[doc = "Change the `styles` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn styles(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("styles"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.styles_shim(val); self } #[doc = "Change the `timeStamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn time_stamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeStamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.time_stamp_shim(val); self } #[doc = "Change the `timer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub fn timer(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("timer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs index 80bdfc54dfd..2b807509ef7 100644 --- a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs +++ b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub type ConsoleInstanceOptions; + #[wasm_bindgen(method, setter = "consoleID")] + fn console_id_shim(this: &ConsoleInstanceOptions, val: &str); + #[wasm_bindgen(method, setter = "dump")] + fn dump_shim(this: &ConsoleInstanceOptions, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "innerID")] + fn inner_id_shim(this: &ConsoleInstanceOptions, val: &str); + #[cfg(feature = "ConsoleLogLevel")] + #[wasm_bindgen(method, setter = "maxLogLevel")] + fn max_log_level_shim(this: &ConsoleInstanceOptions, val: ConsoleLogLevel); + #[wasm_bindgen(method, setter = "maxLogLevelPref")] + fn max_log_level_pref_shim(this: &ConsoleInstanceOptions, val: &str); + #[wasm_bindgen(method, setter = "prefix")] + fn prefix_shim(this: &ConsoleInstanceOptions, val: &str); } impl ConsoleInstanceOptions { #[doc = "Construct a new `ConsoleInstanceOptions`."] @@ -24,47 +37,21 @@ impl ConsoleInstanceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub fn console_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("consoleID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.console_id_shim(val); self } #[doc = "Change the `dump` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub fn dump(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dump"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dump_shim(val); self } #[doc = "Change the `innerID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub fn inner_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("innerID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inner_id_shim(val); self } #[cfg(feature = "ConsoleLogLevel")] @@ -72,48 +59,21 @@ impl ConsoleInstanceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`, `ConsoleLogLevel`*"] pub fn max_log_level(&mut self, val: ConsoleLogLevel) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxLogLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_log_level_shim(val); self } #[doc = "Change the `maxLogLevelPref` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub fn max_log_level_pref(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxLogLevelPref"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_log_level_pref_shim(val); self } #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub fn prefix(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("prefix"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefix_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs index 684c2de3ed9..833b5be4d40 100644 --- a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] pub type ConsoleProfileEvent; + #[wasm_bindgen(method, setter = "action")] + fn action_shim(this: &ConsoleProfileEvent, val: &str); + #[wasm_bindgen(method, setter = "arguments")] + fn arguments_shim(this: &ConsoleProfileEvent, val: &::wasm_bindgen::JsValue); } impl ConsoleProfileEvent { #[doc = "Construct a new `ConsoleProfileEvent`."] @@ -24,31 +28,14 @@ impl ConsoleProfileEvent { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] pub fn action(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("action"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.action_shim(val); self } #[doc = "Change the `arguments` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] pub fn arguments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("arguments"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.arguments_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs index 65fef9ecff4..12555018b78 100644 --- a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs +++ b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub type ConsoleStackEntry; + #[wasm_bindgen(method, setter = "asyncCause")] + fn async_cause_shim(this: &ConsoleStackEntry, val: Option<&str>); + #[wasm_bindgen(method, setter = "columnNumber")] + fn column_number_shim(this: &ConsoleStackEntry, val: u32); + #[wasm_bindgen(method, setter = "filename")] + fn filename_shim(this: &ConsoleStackEntry, val: &str); + #[wasm_bindgen(method, setter = "functionName")] + fn function_name_shim(this: &ConsoleStackEntry, val: &str); + #[wasm_bindgen(method, setter = "lineNumber")] + fn line_number_shim(this: &ConsoleStackEntry, val: u32); } impl ConsoleStackEntry { #[doc = "Construct a new `ConsoleStackEntry`."] @@ -24,85 +34,35 @@ impl ConsoleStackEntry { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub fn async_cause(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("asyncCause"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.async_cause_shim(val); self } #[doc = "Change the `columnNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub fn column_number(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("columnNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.column_number_shim(val); self } #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub fn filename(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filename_shim(val); self } #[doc = "Change the `functionName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub fn function_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("functionName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.function_name_shim(val); self } #[doc = "Change the `lineNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub fn line_number(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lineNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.line_number_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerError.rs b/crates/web-sys/src/features/gen_ConsoleTimerError.rs index 2ad058bec3f..9455aff12d3 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerError.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerError.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] pub type ConsoleTimerError; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &ConsoleTimerError, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ConsoleTimerError, val: &str); } impl ConsoleTimerError { #[doc = "Construct a new `ConsoleTimerError`."] @@ -24,26 +28,14 @@ impl ConsoleTimerError { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] pub fn error(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs index 471a92f7caa..0d3b294a926 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] pub type ConsoleTimerLogOrEnd; + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &ConsoleTimerLogOrEnd, val: f64); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ConsoleTimerLogOrEnd, val: &str); } impl ConsoleTimerLogOrEnd { #[doc = "Construct a new `ConsoleTimerLogOrEnd`."] @@ -24,30 +28,14 @@ impl ConsoleTimerLogOrEnd { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs index f418961908d..d4e2a17d04c 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] pub type ConsoleTimerStart; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ConsoleTimerStart, val: &str); } impl ConsoleTimerStart { #[doc = "Construct a new `ConsoleTimerStart`."] @@ -24,13 +26,7 @@ impl ConsoleTimerStart { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstantSourceOptions.rs b/crates/web-sys/src/features/gen_ConstantSourceOptions.rs index 852e2dad925..206ed0a76af 100644 --- a/crates/web-sys/src/features/gen_ConstantSourceOptions.rs +++ b/crates/web-sys/src/features/gen_ConstantSourceOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] pub type ConstantSourceOptions; + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &ConstantSourceOptions, val: f32); } impl ConstantSourceOptions { #[doc = "Construct a new `ConstantSourceOptions`."] @@ -24,14 +26,7 @@ impl ConstantSourceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] pub fn offset(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs b/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs index 8bffa143882..6885925daa3 100644 --- a/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs +++ b/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] pub type ConstrainBooleanParameters; + #[wasm_bindgen(method, setter = "exact")] + fn exact_shim(this: &ConstrainBooleanParameters, val: bool); + #[wasm_bindgen(method, setter = "ideal")] + fn ideal_shim(this: &ConstrainBooleanParameters, val: bool); } impl ConstrainBooleanParameters { #[doc = "Construct a new `ConstrainBooleanParameters`."] @@ -24,26 +28,14 @@ impl ConstrainBooleanParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] pub fn exact(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("exact"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exact_shim(val); self } #[doc = "Change the `ideal` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] pub fn ideal(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ideal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ideal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs b/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs index e43df4782e9..71f3bf16b92 100644 --- a/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs +++ b/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] pub type ConstrainDomStringParameters; + #[wasm_bindgen(method, setter = "exact")] + fn exact_shim(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "ideal")] + fn ideal_shim(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); } impl ConstrainDomStringParameters { #[doc = "Construct a new `ConstrainDomStringParameters`."] @@ -24,26 +28,14 @@ impl ConstrainDomStringParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] pub fn exact(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("exact"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exact_shim(val); self } #[doc = "Change the `ideal` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] pub fn ideal(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ideal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ideal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs b/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs index 777a98149ce..ac4e0ccb31f 100644 --- a/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs +++ b/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub type ConstrainDoubleRange; + #[wasm_bindgen(method, setter = "exact")] + fn exact_shim(this: &ConstrainDoubleRange, val: f64); + #[wasm_bindgen(method, setter = "ideal")] + fn ideal_shim(this: &ConstrainDoubleRange, val: f64); + #[wasm_bindgen(method, setter = "max")] + fn max_shim(this: &ConstrainDoubleRange, val: f64); + #[wasm_bindgen(method, setter = "min")] + fn min_shim(this: &ConstrainDoubleRange, val: f64); } impl ConstrainDoubleRange { #[doc = "Construct a new `ConstrainDoubleRange`."] @@ -24,52 +32,28 @@ impl ConstrainDoubleRange { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub fn exact(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("exact"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exact_shim(val); self } #[doc = "Change the `ideal` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub fn ideal(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ideal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ideal_shim(val); self } #[doc = "Change the `max` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub fn max(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("max"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_shim(val); self } #[doc = "Change the `min` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub fn min(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("min"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainLongRange.rs b/crates/web-sys/src/features/gen_ConstrainLongRange.rs index c3a79853cd4..58deaf0f387 100644 --- a/crates/web-sys/src/features/gen_ConstrainLongRange.rs +++ b/crates/web-sys/src/features/gen_ConstrainLongRange.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub type ConstrainLongRange; + #[wasm_bindgen(method, setter = "exact")] + fn exact_shim(this: &ConstrainLongRange, val: i32); + #[wasm_bindgen(method, setter = "ideal")] + fn ideal_shim(this: &ConstrainLongRange, val: i32); + #[wasm_bindgen(method, setter = "max")] + fn max_shim(this: &ConstrainLongRange, val: i32); + #[wasm_bindgen(method, setter = "min")] + fn min_shim(this: &ConstrainLongRange, val: i32); } impl ConstrainLongRange { #[doc = "Construct a new `ConstrainLongRange`."] @@ -24,52 +32,28 @@ impl ConstrainLongRange { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub fn exact(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("exact"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exact_shim(val); self } #[doc = "Change the `ideal` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub fn ideal(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ideal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ideal_shim(val); self } #[doc = "Change the `max` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub fn max(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("max"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_shim(val); self } #[doc = "Change the `min` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub fn min(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("min"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ContextAttributes2d.rs b/crates/web-sys/src/features/gen_ContextAttributes2d.rs index 9bb0cf10749..6e46206dd2a 100644 --- a/crates/web-sys/src/features/gen_ContextAttributes2d.rs +++ b/crates/web-sys/src/features/gen_ContextAttributes2d.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] pub type ContextAttributes2d; + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &ContextAttributes2d, val: bool); + #[wasm_bindgen(method, setter = "willReadFrequently")] + fn will_read_frequently_shim(this: &ContextAttributes2d, val: bool); } impl ContextAttributes2d { #[doc = "Construct a new `ContextAttributes2d`."] @@ -24,30 +28,14 @@ impl ContextAttributes2d { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] pub fn alpha(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[doc = "Change the `willReadFrequently` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] pub fn will_read_frequently(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("willReadFrequently"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.will_read_frequently_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs b/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs index 8020dbabe7d..0e1493f0a85 100644 --- a/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs +++ b/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`*"] pub type ConvertCoordinateOptions; + #[cfg(feature = "CssBoxType")] + #[wasm_bindgen(method, setter = "fromBox")] + fn from_box_shim(this: &ConvertCoordinateOptions, val: CssBoxType); + #[cfg(feature = "CssBoxType")] + #[wasm_bindgen(method, setter = "toBox")] + fn to_box_shim(this: &ConvertCoordinateOptions, val: CssBoxType); } impl ConvertCoordinateOptions { #[doc = "Construct a new `ConvertCoordinateOptions`."] @@ -25,17 +31,7 @@ impl ConvertCoordinateOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] pub fn from_box(&mut self, val: CssBoxType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fromBox"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.from_box_shim(val); self } #[cfg(feature = "CssBoxType")] @@ -43,13 +39,7 @@ impl ConvertCoordinateOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] pub fn to_box(&mut self, val: CssBoxType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("toBox"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.to_box_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ConvolverOptions.rs b/crates/web-sys/src/features/gen_ConvolverOptions.rs index 77090404b45..db3fe68d2f5 100644 --- a/crates/web-sys/src/features/gen_ConvolverOptions.rs +++ b/crates/web-sys/src/features/gen_ConvolverOptions.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] pub type ConvolverOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &ConvolverOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &ConvolverOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &ConvolverOptions, val: ChannelInterpretation); + #[cfg(feature = "AudioBuffer")] + #[wasm_bindgen(method, setter = "buffer")] + fn buffer_shim(this: &ConvolverOptions, val: Option<&AudioBuffer>); + #[wasm_bindgen(method, setter = "disableNormalization")] + fn disable_normalization_shim(this: &ConvolverOptions, val: bool); } impl ConvolverOptions { #[doc = "Construct a new `ConvolverOptions`."] @@ -24,17 +37,7 @@ impl ConvolverOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +45,7 @@ impl ConvolverOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ConvolverOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,17 +53,7 @@ impl ConvolverOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ConvolverOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[cfg(feature = "AudioBuffer")] @@ -78,31 +61,14 @@ impl ConvolverOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `ConvolverOptions`*"] pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_shim(val); self } #[doc = "Change the `disableNormalization` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("disableNormalization"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.disable_normalization_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CredentialCreationOptions.rs b/crates/web-sys/src/features/gen_CredentialCreationOptions.rs index d57ebd3c66c..f9366322156 100644 --- a/crates/web-sys/src/features/gen_CredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_CredentialCreationOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`*"] pub type CredentialCreationOptions; + #[cfg(feature = "PublicKeyCredentialCreationOptions")] + #[wasm_bindgen(method, setter = "publicKey")] + fn public_key_shim(this: &CredentialCreationOptions, val: &PublicKeyCredentialCreationOptions); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &CredentialCreationOptions, val: &AbortSignal); } impl CredentialCreationOptions { #[doc = "Construct a new `CredentialCreationOptions`."] @@ -25,17 +31,7 @@ impl CredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`, `PublicKeyCredentialCreationOptions`*"] pub fn public_key(&mut self, val: &PublicKeyCredentialCreationOptions) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("publicKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.public_key_shim(val); self } #[cfg(feature = "AbortSignal")] @@ -43,14 +39,7 @@ impl CredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialCreationOptions`*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CredentialRequestOptions.rs b/crates/web-sys/src/features/gen_CredentialRequestOptions.rs index cf44865e70a..6df51ff0ab1 100644 --- a/crates/web-sys/src/features/gen_CredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_CredentialRequestOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`*"] pub type CredentialRequestOptions; + #[cfg(feature = "PublicKeyCredentialRequestOptions")] + #[wasm_bindgen(method, setter = "publicKey")] + fn public_key_shim(this: &CredentialRequestOptions, val: &PublicKeyCredentialRequestOptions); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &CredentialRequestOptions, val: &AbortSignal); } impl CredentialRequestOptions { #[doc = "Construct a new `CredentialRequestOptions`."] @@ -25,17 +31,7 @@ impl CredentialRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`, `PublicKeyCredentialRequestOptions`*"] pub fn public_key(&mut self, val: &PublicKeyCredentialRequestOptions) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("publicKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.public_key_shim(val); self } #[cfg(feature = "AbortSignal")] @@ -43,14 +39,7 @@ impl CredentialRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialRequestOptions`*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CryptoKeyPair.rs b/crates/web-sys/src/features/gen_CryptoKeyPair.rs index 9f04bd181fe..2edbf68355b 100644 --- a/crates/web-sys/src/features/gen_CryptoKeyPair.rs +++ b/crates/web-sys/src/features/gen_CryptoKeyPair.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKeyPair`*"] pub type CryptoKeyPair; + #[cfg(feature = "CryptoKey")] + #[wasm_bindgen(method, setter = "privateKey")] + fn private_key_shim(this: &CryptoKeyPair, val: &CryptoKey); + #[cfg(feature = "CryptoKey")] + #[wasm_bindgen(method, setter = "publicKey")] + fn public_key_shim(this: &CryptoKeyPair, val: &CryptoKey); } impl CryptoKeyPair { #[cfg(feature = "CryptoKey")] @@ -28,17 +34,7 @@ impl CryptoKeyPair { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] pub fn private_key(&mut self, val: &CryptoKey) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("privateKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.private_key_shim(val); self } #[cfg(feature = "CryptoKey")] @@ -46,17 +42,7 @@ impl CryptoKeyPair { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] pub fn public_key(&mut self, val: &CryptoKey) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("publicKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.public_key_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_CustomEventInit.rs b/crates/web-sys/src/features/gen_CustomEventInit.rs index ced880c09b7..aaeb6d7a4d7 100644 --- a/crates/web-sys/src/features/gen_CustomEventInit.rs +++ b/crates/web-sys/src/features/gen_CustomEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub type CustomEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &CustomEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &CustomEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &CustomEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &CustomEventInit, val: &::wasm_bindgen::JsValue); } impl CustomEventInit { #[doc = "Construct a new `CustomEventInit`."] @@ -24,65 +32,28 @@ impl CustomEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub fn detail(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DateTimeValue.rs b/crates/web-sys/src/features/gen_DateTimeValue.rs index 861d469e7ca..e156222ec16 100644 --- a/crates/web-sys/src/features/gen_DateTimeValue.rs +++ b/crates/web-sys/src/features/gen_DateTimeValue.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub type DateTimeValue; + #[wasm_bindgen(method, setter = "day")] + fn day_shim(this: &DateTimeValue, val: i32); + #[wasm_bindgen(method, setter = "hour")] + fn hour_shim(this: &DateTimeValue, val: i32); + #[wasm_bindgen(method, setter = "minute")] + fn minute_shim(this: &DateTimeValue, val: i32); + #[wasm_bindgen(method, setter = "month")] + fn month_shim(this: &DateTimeValue, val: i32); + #[wasm_bindgen(method, setter = "year")] + fn year_shim(this: &DateTimeValue, val: i32); } impl DateTimeValue { #[doc = "Construct a new `DateTimeValue`."] @@ -24,66 +34,35 @@ impl DateTimeValue { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub fn day(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("day"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.day_shim(val); self } #[doc = "Change the `hour` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub fn hour(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hour"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hour_shim(val); self } #[doc = "Change the `minute` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub fn minute(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("minute"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.minute_shim(val); self } #[doc = "Change the `month` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub fn month(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("month"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.month_shim(val); self } #[doc = "Change the `year` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub fn year(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("year"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.year_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs index c051c234892..ff00d5bc28a 100644 --- a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs +++ b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs @@ -10,6 +10,21 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub type DecoderDoctorNotification; + #[wasm_bindgen(method, setter = "decodeIssue")] + fn decode_issue_shim(this: &DecoderDoctorNotification, val: &str); + #[wasm_bindgen(method, setter = "decoderDoctorReportId")] + fn decoder_doctor_report_id_shim(this: &DecoderDoctorNotification, val: &str); + #[wasm_bindgen(method, setter = "docURL")] + fn doc_url_shim(this: &DecoderDoctorNotification, val: &str); + #[wasm_bindgen(method, setter = "formats")] + fn formats_shim(this: &DecoderDoctorNotification, val: &str); + #[wasm_bindgen(method, setter = "isSolved")] + fn is_solved_shim(this: &DecoderDoctorNotification, val: bool); + #[wasm_bindgen(method, setter = "resourceURL")] + fn resource_url_shim(this: &DecoderDoctorNotification, val: &str); + #[cfg(feature = "DecoderDoctorNotificationType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &DecoderDoctorNotification, val: DecoderDoctorNotificationType); } impl DecoderDoctorNotification { #[cfg(feature = "DecoderDoctorNotificationType")] @@ -32,99 +47,42 @@ impl DecoderDoctorNotification { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn decode_issue(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("decodeIssue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.decode_issue_shim(val); self } #[doc = "Change the `decoderDoctorReportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn decoder_doctor_report_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("decoderDoctorReportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.decoder_doctor_report_id_shim(val); self } #[doc = "Change the `docURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn doc_url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("docURL"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.doc_url_shim(val); self } #[doc = "Change the `formats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn formats(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("formats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.formats_shim(val); self } #[doc = "Change the `isSolved` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn is_solved(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isSolved"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_solved_shim(val); self } #[doc = "Change the `resourceURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub fn resource_url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resourceURL"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resource_url_shim(val); self } #[cfg(feature = "DecoderDoctorNotificationType")] @@ -132,13 +90,7 @@ impl DecoderDoctorNotification { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`, `DecoderDoctorNotificationType`*"] pub fn type_(&mut self, val: DecoderDoctorNotificationType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DelayOptions.rs b/crates/web-sys/src/features/gen_DelayOptions.rs index a7e31dcce88..02afb9d4bf3 100644 --- a/crates/web-sys/src/features/gen_DelayOptions.rs +++ b/crates/web-sys/src/features/gen_DelayOptions.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] pub type DelayOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &DelayOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &DelayOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &DelayOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "delayTime")] + fn delay_time_shim(this: &DelayOptions, val: f64); + #[wasm_bindgen(method, setter = "maxDelayTime")] + fn max_delay_time_shim(this: &DelayOptions, val: f64); } impl DelayOptions { #[doc = "Construct a new `DelayOptions`."] @@ -24,17 +36,7 @@ impl DelayOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +44,7 @@ impl DelayOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DelayOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,51 +52,21 @@ impl DelayOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DelayOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `delayTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] pub fn delay_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("delayTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_time_shim(val); self } #[doc = "Change the `maxDelayTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] pub fn max_delay_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxDelayTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_delay_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs b/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs index b28ecb1f0c0..f94475e8d2e 100644 --- a/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs +++ b/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] pub type DeviceAccelerationInit; + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &DeviceAccelerationInit, val: Option); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &DeviceAccelerationInit, val: Option); + #[wasm_bindgen(method, setter = "z")] + fn z_shim(this: &DeviceAccelerationInit, val: Option); } impl DeviceAccelerationInit { #[doc = "Construct a new `DeviceAccelerationInit`."] @@ -24,39 +30,21 @@ impl DeviceAccelerationInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] pub fn x(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] pub fn y(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } #[doc = "Change the `z` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] pub fn z(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("z"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.z_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceLightEventInit.rs b/crates/web-sys/src/features/gen_DeviceLightEventInit.rs index a72b40dd4b4..61ab42345bb 100644 --- a/crates/web-sys/src/features/gen_DeviceLightEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceLightEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub type DeviceLightEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &DeviceLightEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &DeviceLightEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &DeviceLightEventInit, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &DeviceLightEventInit, val: f64); } impl DeviceLightEventInit { #[doc = "Construct a new `DeviceLightEventInit`."] @@ -24,64 +32,28 @@ impl DeviceLightEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub fn value(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs b/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs index 38dc6b76f97..43ed16d21fe 100644 --- a/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs @@ -10,6 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub type DeviceMotionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &DeviceMotionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &DeviceMotionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &DeviceMotionEventInit, val: bool); + #[cfg(feature = "DeviceAccelerationInit")] + #[wasm_bindgen(method, setter = "acceleration")] + fn acceleration_shim(this: &DeviceMotionEventInit, val: &DeviceAccelerationInit); + #[cfg(feature = "DeviceAccelerationInit")] + #[wasm_bindgen(method, setter = "accelerationIncludingGravity")] + fn acceleration_including_gravity_shim( + this: &DeviceMotionEventInit, + val: &DeviceAccelerationInit, + ); + #[wasm_bindgen(method, setter = "interval")] + fn interval_shim(this: &DeviceMotionEventInit, val: Option); + #[cfg(feature = "DeviceRotationRateInit")] + #[wasm_bindgen(method, setter = "rotationRate")] + fn rotation_rate_shim(this: &DeviceMotionEventInit, val: &DeviceRotationRateInit); } impl DeviceMotionEventInit { #[doc = "Construct a new `DeviceMotionEventInit`."] @@ -24,51 +44,21 @@ impl DeviceMotionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "DeviceAccelerationInit")] @@ -76,17 +66,7 @@ impl DeviceMotionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] pub fn acceleration(&mut self, val: &DeviceAccelerationInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("acceleration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.acceleration_shim(val); self } #[cfg(feature = "DeviceAccelerationInit")] @@ -94,34 +74,14 @@ impl DeviceMotionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] pub fn acceleration_including_gravity(&mut self, val: &DeviceAccelerationInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("accelerationIncludingGravity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.acceleration_including_gravity_shim(val); self } #[doc = "Change the `interval` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub fn interval(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("interval"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.interval_shim(val); self } #[cfg(feature = "DeviceRotationRateInit")] @@ -129,17 +89,7 @@ impl DeviceMotionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`, `DeviceRotationRateInit`*"] pub fn rotation_rate(&mut self, val: &DeviceRotationRateInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rotationRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rotation_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs b/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs index 5aec65d23de..0baef9e2c32 100644 --- a/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub type DeviceOrientationEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &DeviceOrientationEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &DeviceOrientationEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &DeviceOrientationEventInit, val: bool); + #[wasm_bindgen(method, setter = "absolute")] + fn absolute_shim(this: &DeviceOrientationEventInit, val: bool); + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &DeviceOrientationEventInit, val: Option); + #[wasm_bindgen(method, setter = "beta")] + fn beta_shim(this: &DeviceOrientationEventInit, val: Option); + #[wasm_bindgen(method, setter = "gamma")] + fn gamma_shim(this: &DeviceOrientationEventInit, val: Option); } impl DeviceOrientationEventInit { #[doc = "Construct a new `DeviceOrientationEventInit`."] @@ -24,107 +38,49 @@ impl DeviceOrientationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `absolute` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn absolute(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("absolute"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.absolute_shim(val); self } #[doc = "Change the `alpha` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn alpha(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[doc = "Change the `beta` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn beta(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("beta"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.beta_shim(val); self } #[doc = "Change the `gamma` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub fn gamma(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("gamma"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gamma_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs b/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs index ab35b2e6a2e..f93f58341f8 100644 --- a/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub type DeviceProximityEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &DeviceProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &DeviceProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &DeviceProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "max")] + fn max_shim(this: &DeviceProximityEventInit, val: f64); + #[wasm_bindgen(method, setter = "min")] + fn min_shim(this: &DeviceProximityEventInit, val: f64); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &DeviceProximityEventInit, val: f64); } impl DeviceProximityEventInit { #[doc = "Construct a new `DeviceProximityEventInit`."] @@ -24,90 +36,42 @@ impl DeviceProximityEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `max` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn max(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("max"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_shim(val); self } #[doc = "Change the `min` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn min(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("min"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub fn value(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs b/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs index 7df806bca6a..5f8cf0a712a 100644 --- a/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs +++ b/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] pub type DeviceRotationRateInit; + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &DeviceRotationRateInit, val: Option); + #[wasm_bindgen(method, setter = "beta")] + fn beta_shim(this: &DeviceRotationRateInit, val: Option); + #[wasm_bindgen(method, setter = "gamma")] + fn gamma_shim(this: &DeviceRotationRateInit, val: Option); } impl DeviceRotationRateInit { #[doc = "Construct a new `DeviceRotationRateInit`."] @@ -24,39 +30,21 @@ impl DeviceRotationRateInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] pub fn alpha(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[doc = "Change the `beta` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] pub fn beta(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("beta"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.beta_shim(val); self } #[doc = "Change the `gamma` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] pub fn gamma(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("gamma"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gamma_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs index 8a0ba9da5ff..a72d6f55817 100644 --- a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] pub type DhKeyDeriveParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &DhKeyDeriveParams, val: &str); + #[cfg(feature = "CryptoKey")] + #[wasm_bindgen(method, setter = "public")] + fn public_shim(this: &DhKeyDeriveParams, val: &CryptoKey); } impl DhKeyDeriveParams { #[cfg(feature = "CryptoKey")] @@ -27,13 +32,7 @@ impl DhKeyDeriveParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "CryptoKey")] @@ -41,14 +40,7 @@ impl DhKeyDeriveParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `DhKeyDeriveParams`*"] pub fn public(&mut self, val: &CryptoKey) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("public"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.public_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs index a7886ebc0be..5abcb4cedb6 100644 --- a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs +++ b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type DirectoryPickerOptions; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &DirectoryPickerOptions, val: &str); + #[cfg(feature = "FileSystemPermissionMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &DirectoryPickerOptions, val: FileSystemPermissionMode); + #[wasm_bindgen(method, setter = "startIn")] + fn start_in_shim(this: &DirectoryPickerOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl DirectoryPickerOptions { @@ -36,13 +43,7 @@ impl DirectoryPickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,13 +55,7 @@ impl DirectoryPickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -71,17 +66,7 @@ impl DirectoryPickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startIn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_in_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs b/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs index 9f80d9a29f3..993d493b46d 100644 --- a/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs +++ b/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] pub type DisplayMediaStreamConstraints; + #[wasm_bindgen(method, setter = "audio")] + fn audio_shim(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "video")] + fn video_shim(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); } impl DisplayMediaStreamConstraints { #[doc = "Construct a new `DisplayMediaStreamConstraints`."] @@ -24,26 +28,14 @@ impl DisplayMediaStreamConstraints { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] pub fn audio(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("audio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_shim(val); self } #[doc = "Change the `video` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] pub fn video(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("video"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayNameOptions.rs b/crates/web-sys/src/features/gen_DisplayNameOptions.rs index 1dec81b9f82..bddb9923a34 100644 --- a/crates/web-sys/src/features/gen_DisplayNameOptions.rs +++ b/crates/web-sys/src/features/gen_DisplayNameOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] pub type DisplayNameOptions; + #[wasm_bindgen(method, setter = "keys")] + fn keys_shim(this: &DisplayNameOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "style")] + fn style_shim(this: &DisplayNameOptions, val: &str); } impl DisplayNameOptions { #[doc = "Construct a new `DisplayNameOptions`."] @@ -24,26 +28,14 @@ impl DisplayNameOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] pub fn keys(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("keys"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.keys_shim(val); self } #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] pub fn style(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("style"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.style_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayNameResult.rs b/crates/web-sys/src/features/gen_DisplayNameResult.rs index d13291047ab..fcee8ccffb2 100644 --- a/crates/web-sys/src/features/gen_DisplayNameResult.rs +++ b/crates/web-sys/src/features/gen_DisplayNameResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] pub type DisplayNameResult; + #[wasm_bindgen(method, setter = "locale")] + fn locale_shim(this: &DisplayNameResult, val: &str); + #[wasm_bindgen(method, setter = "style")] + fn style_shim(this: &DisplayNameResult, val: &str); } impl DisplayNameResult { #[doc = "Construct a new `DisplayNameResult`."] @@ -24,27 +28,14 @@ impl DisplayNameResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] pub fn locale(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("locale"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.locale_shim(val); self } #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] pub fn style(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("style"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.style_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsCacheDict.rs b/crates/web-sys/src/features/gen_DnsCacheDict.rs index 32cbbf5fbb9..e16b2c6b833 100644 --- a/crates/web-sys/src/features/gen_DnsCacheDict.rs +++ b/crates/web-sys/src/features/gen_DnsCacheDict.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] pub type DnsCacheDict; + #[wasm_bindgen(method, setter = "entries")] + fn entries_shim(this: &DnsCacheDict, val: &::wasm_bindgen::JsValue); } impl DnsCacheDict { #[doc = "Construct a new `DnsCacheDict`."] @@ -24,17 +26,7 @@ impl DnsCacheDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entries"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entries_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsCacheEntry.rs b/crates/web-sys/src/features/gen_DnsCacheEntry.rs index a368929bd4c..ad86c2a5b0e 100644 --- a/crates/web-sys/src/features/gen_DnsCacheEntry.rs +++ b/crates/web-sys/src/features/gen_DnsCacheEntry.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub type DnsCacheEntry; + #[wasm_bindgen(method, setter = "expiration")] + fn expiration_shim(this: &DnsCacheEntry, val: f64); + #[wasm_bindgen(method, setter = "family")] + fn family_shim(this: &DnsCacheEntry, val: &str); + #[wasm_bindgen(method, setter = "hostaddr")] + fn hostaddr_shim(this: &DnsCacheEntry, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "hostname")] + fn hostname_shim(this: &DnsCacheEntry, val: &str); + #[wasm_bindgen(method, setter = "trr")] + fn trr_shim(this: &DnsCacheEntry, val: bool); } impl DnsCacheEntry { #[doc = "Construct a new `DnsCacheEntry`."] @@ -24,78 +34,35 @@ impl DnsCacheEntry { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub fn expiration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("expiration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.expiration_shim(val); self } #[doc = "Change the `family` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub fn family(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("family"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.family_shim(val); self } #[doc = "Change the `hostaddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub fn hostaddr(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hostaddr"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hostaddr_shim(val); self } #[doc = "Change the `hostname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub fn hostname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hostname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hostname_shim(val); self } #[doc = "Change the `trr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub fn trr(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("trr"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.trr_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsLookupDict.rs b/crates/web-sys/src/features/gen_DnsLookupDict.rs index c9ecc81a091..22e646160e8 100644 --- a/crates/web-sys/src/features/gen_DnsLookupDict.rs +++ b/crates/web-sys/src/features/gen_DnsLookupDict.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] pub type DnsLookupDict; + #[wasm_bindgen(method, setter = "address")] + fn address_shim(this: &DnsLookupDict, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "answer")] + fn answer_shim(this: &DnsLookupDict, val: bool); + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &DnsLookupDict, val: &str); } impl DnsLookupDict { #[doc = "Construct a new `DnsLookupDict`."] @@ -24,44 +30,21 @@ impl DnsLookupDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] pub fn address(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("address"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_shim(val); self } #[doc = "Change the `answer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] pub fn answer(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("answer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.answer_shim(val); self } #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] pub fn error(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs b/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs index 7fa2dedc2ec..5cbf8c1a181 100644 --- a/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs +++ b/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] pub type DocumentTimelineOptions; + #[wasm_bindgen(method, setter = "originTime")] + fn origin_time_shim(this: &DocumentTimelineOptions, val: f64); } impl DocumentTimelineOptions { #[doc = "Construct a new `DocumentTimelineOptions`."] @@ -24,17 +26,7 @@ impl DocumentTimelineOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] pub fn origin_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("originTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs index f91b401cec6..d93e11a0eb9 100644 --- a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs +++ b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs @@ -10,6 +10,30 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub type DomMatrix2dInit; + #[wasm_bindgen(method, setter = "a")] + fn a_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "b")] + fn b_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "c")] + fn c_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "d")] + fn d_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "e")] + fn e_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "f")] + fn f_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m11")] + fn m11_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m12")] + fn m12_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m21")] + fn m21_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m22")] + fn m22_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m41")] + fn m41_shim(this: &DomMatrix2dInit, val: f64); + #[wasm_bindgen(method, setter = "m42")] + fn m42_shim(this: &DomMatrix2dInit, val: f64); } impl DomMatrix2dInit { #[doc = "Construct a new `DomMatrix2dInit`."] @@ -24,156 +48,84 @@ impl DomMatrix2dInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn a(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.a_shim(val); self } #[doc = "Change the `b` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn b(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.b_shim(val); self } #[doc = "Change the `c` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn c(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.c_shim(val); self } #[doc = "Change the `d` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn d(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.d_shim(val); self } #[doc = "Change the `e` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn e(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.e_shim(val); self } #[doc = "Change the `f` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn f(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.f_shim(val); self } #[doc = "Change the `m11` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m11(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m11_shim(val); self } #[doc = "Change the `m12` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m12(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m12_shim(val); self } #[doc = "Change the `m21` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m21(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m21_shim(val); self } #[doc = "Change the `m22` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m22(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m22_shim(val); self } #[doc = "Change the `m41` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m41(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m41_shim(val); self } #[doc = "Change the `m42` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub fn m42(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m42_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomMatrixInit.rs b/crates/web-sys/src/features/gen_DomMatrixInit.rs index 573a0c4d65e..f1dbe993864 100644 --- a/crates/web-sys/src/features/gen_DomMatrixInit.rs +++ b/crates/web-sys/src/features/gen_DomMatrixInit.rs @@ -10,6 +10,52 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub type DomMatrixInit; + #[wasm_bindgen(method, setter = "a")] + fn a_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "b")] + fn b_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "c")] + fn c_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "d")] + fn d_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "e")] + fn e_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "f")] + fn f_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m11")] + fn m11_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m12")] + fn m12_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m21")] + fn m21_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m22")] + fn m22_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m41")] + fn m41_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m42")] + fn m42_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "is2D")] + fn is_2d_shim(this: &DomMatrixInit, val: bool); + #[wasm_bindgen(method, setter = "m13")] + fn m13_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m14")] + fn m14_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m23")] + fn m23_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m24")] + fn m24_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m31")] + fn m31_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m32")] + fn m32_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m33")] + fn m33_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m34")] + fn m34_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m43")] + fn m43_shim(this: &DomMatrixInit, val: f64); + #[wasm_bindgen(method, setter = "m44")] + fn m44_shim(this: &DomMatrixInit, val: f64); } impl DomMatrixInit { #[doc = "Construct a new `DomMatrixInit`."] @@ -24,299 +70,161 @@ impl DomMatrixInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn a(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.a_shim(val); self } #[doc = "Change the `b` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn b(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.b_shim(val); self } #[doc = "Change the `c` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn c(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.c_shim(val); self } #[doc = "Change the `d` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn d(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.d_shim(val); self } #[doc = "Change the `e` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn e(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.e_shim(val); self } #[doc = "Change the `f` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn f(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.f_shim(val); self } #[doc = "Change the `m11` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m11(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m11_shim(val); self } #[doc = "Change the `m12` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m12(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m12_shim(val); self } #[doc = "Change the `m21` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m21(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m21_shim(val); self } #[doc = "Change the `m22` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m22(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m22_shim(val); self } #[doc = "Change the `m41` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m41(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m41_shim(val); self } #[doc = "Change the `m42` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m42(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m42_shim(val); self } #[doc = "Change the `is2D` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn is_2d(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("is2D"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_2d_shim(val); self } #[doc = "Change the `m13` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m13(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m13"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m13_shim(val); self } #[doc = "Change the `m14` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m14(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m14"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m14_shim(val); self } #[doc = "Change the `m23` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m23(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m23"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m23_shim(val); self } #[doc = "Change the `m24` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m24(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m24"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m24_shim(val); self } #[doc = "Change the `m31` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m31(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m31"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m31_shim(val); self } #[doc = "Change the `m32` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m32(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m32"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m32_shim(val); self } #[doc = "Change the `m33` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m33(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m33"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m33_shim(val); self } #[doc = "Change the `m34` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m34(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m34"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m34_shim(val); self } #[doc = "Change the `m43` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m43(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m43"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m43_shim(val); self } #[doc = "Change the `m44` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub fn m44(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m44"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.m44_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomPointInit.rs b/crates/web-sys/src/features/gen_DomPointInit.rs index b909aaf3981..37f3064eb47 100644 --- a/crates/web-sys/src/features/gen_DomPointInit.rs +++ b/crates/web-sys/src/features/gen_DomPointInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub type DomPointInit; + #[wasm_bindgen(method, setter = "w")] + fn w_shim(this: &DomPointInit, val: f64); + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &DomPointInit, val: f64); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &DomPointInit, val: f64); + #[wasm_bindgen(method, setter = "z")] + fn z_shim(this: &DomPointInit, val: f64); } impl DomPointInit { #[doc = "Construct a new `DomPointInit`."] @@ -24,52 +32,28 @@ impl DomPointInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub fn w(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("w"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.w_shim(val); self } #[doc = "Change the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub fn x(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub fn y(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } #[doc = "Change the `z` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub fn z(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("z"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.z_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomQuadInit.rs b/crates/web-sys/src/features/gen_DomQuadInit.rs index b85560d8491..b9af8996627 100644 --- a/crates/web-sys/src/features/gen_DomQuadInit.rs +++ b/crates/web-sys/src/features/gen_DomQuadInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomQuadInit`*"] pub type DomQuadInit; + #[cfg(feature = "DomPointInit")] + #[wasm_bindgen(method, setter = "p1")] + fn p1_shim(this: &DomQuadInit, val: &DomPointInit); + #[cfg(feature = "DomPointInit")] + #[wasm_bindgen(method, setter = "p2")] + fn p2_shim(this: &DomQuadInit, val: &DomPointInit); + #[cfg(feature = "DomPointInit")] + #[wasm_bindgen(method, setter = "p3")] + fn p3_shim(this: &DomQuadInit, val: &DomPointInit); + #[cfg(feature = "DomPointInit")] + #[wasm_bindgen(method, setter = "p4")] + fn p4_shim(this: &DomQuadInit, val: &DomPointInit); } impl DomQuadInit { #[doc = "Construct a new `DomQuadInit`."] @@ -25,13 +37,7 @@ impl DomQuadInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] pub fn p1(&mut self, val: &DomPointInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p1"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p1_shim(val); self } #[cfg(feature = "DomPointInit")] @@ -39,13 +45,7 @@ impl DomQuadInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] pub fn p2(&mut self, val: &DomPointInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p2"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p2_shim(val); self } #[cfg(feature = "DomPointInit")] @@ -53,13 +53,7 @@ impl DomQuadInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] pub fn p3(&mut self, val: &DomPointInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p3"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p3_shim(val); self } #[cfg(feature = "DomPointInit")] @@ -67,13 +61,7 @@ impl DomQuadInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] pub fn p4(&mut self, val: &DomPointInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p4"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p4_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomQuadJson.rs b/crates/web-sys/src/features/gen_DomQuadJson.rs index 95189b208db..d02f9daa85d 100644 --- a/crates/web-sys/src/features/gen_DomQuadJson.rs +++ b/crates/web-sys/src/features/gen_DomQuadJson.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomQuadJson`*"] pub type DomQuadJson; + #[cfg(feature = "DomPoint")] + #[wasm_bindgen(method, setter = "p1")] + fn p1_shim(this: &DomQuadJson, val: &DomPoint); + #[cfg(feature = "DomPoint")] + #[wasm_bindgen(method, setter = "p2")] + fn p2_shim(this: &DomQuadJson, val: &DomPoint); + #[cfg(feature = "DomPoint")] + #[wasm_bindgen(method, setter = "p3")] + fn p3_shim(this: &DomQuadJson, val: &DomPoint); + #[cfg(feature = "DomPoint")] + #[wasm_bindgen(method, setter = "p4")] + fn p4_shim(this: &DomQuadJson, val: &DomPoint); } impl DomQuadJson { #[doc = "Construct a new `DomQuadJson`."] @@ -25,13 +37,7 @@ impl DomQuadJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] pub fn p1(&mut self, val: &DomPoint) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p1"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p1_shim(val); self } #[cfg(feature = "DomPoint")] @@ -39,13 +45,7 @@ impl DomQuadJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] pub fn p2(&mut self, val: &DomPoint) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p2"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p2_shim(val); self } #[cfg(feature = "DomPoint")] @@ -53,13 +53,7 @@ impl DomQuadJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] pub fn p3(&mut self, val: &DomPoint) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p3"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p3_shim(val); self } #[cfg(feature = "DomPoint")] @@ -67,13 +61,7 @@ impl DomQuadJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] pub fn p4(&mut self, val: &DomPoint) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p4"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p4_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomRectInit.rs b/crates/web-sys/src/features/gen_DomRectInit.rs index ec514d0f6fb..2124c443bc8 100644 --- a/crates/web-sys/src/features/gen_DomRectInit.rs +++ b/crates/web-sys/src/features/gen_DomRectInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub type DomRectInit; + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &DomRectInit, val: f64); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &DomRectInit, val: f64); + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &DomRectInit, val: f64); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &DomRectInit, val: f64); } impl DomRectInit { #[doc = "Construct a new `DomRectInit`."] @@ -24,53 +32,28 @@ impl DomRectInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub fn height(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub fn width(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } #[doc = "Change the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub fn x(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub fn y(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs b/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs index 6e3ca630712..584b0f9acc1 100644 --- a/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs +++ b/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] pub type DomWindowResizeEventDetail; + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &DomWindowResizeEventDetail, val: i32); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &DomWindowResizeEventDetail, val: i32); } impl DomWindowResizeEventDetail { #[doc = "Construct a new `DomWindowResizeEventDetail`."] @@ -24,27 +28,14 @@ impl DomWindowResizeEventDetail { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] pub fn height(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] pub fn width(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DragEventInit.rs b/crates/web-sys/src/features/gen_DragEventInit.rs index 821a5f5ed51..0b50bf3a4b9 100644 --- a/crates/web-sys/src/features/gen_DragEventInit.rs +++ b/crates/web-sys/src/features/gen_DragEventInit.rs @@ -10,6 +10,65 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub type DragEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &DragEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &DragEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &DragEventInit, val: bool); + #[wasm_bindgen(method, setter = "button")] + fn button_shim(this: &DragEventInit, val: i16); + #[wasm_bindgen(method, setter = "buttons")] + fn buttons_shim(this: &DragEventInit, val: u16); + #[wasm_bindgen(method, setter = "clientX")] + fn client_x_shim(this: &DragEventInit, val: i32); + #[wasm_bindgen(method, setter = "clientY")] + fn client_y_shim(this: &DragEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementX")] + fn movement_x_shim(this: &DragEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementY")] + fn movement_y_shim(this: &DragEventInit, val: i32); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "relatedTarget")] + fn related_target_shim(this: &DragEventInit, val: Option<&EventTarget>); + #[wasm_bindgen(method, setter = "screenX")] + fn screen_x_shim(this: &DragEventInit, val: i32); + #[wasm_bindgen(method, setter = "screenY")] + fn screen_y_shim(this: &DragEventInit, val: i32); + #[cfg(feature = "DataTransfer")] + #[wasm_bindgen(method, setter = "dataTransfer")] + fn data_transfer_shim(this: &DragEventInit, val: Option<&DataTransfer>); } impl DragEventInit { #[doc = "Construct a new `DragEventInit`."] @@ -24,65 +83,28 @@ impl DragEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,330 +112,140 @@ impl DragEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `button` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn button(&mut self, val: i16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.button_shim(val); self } #[doc = "Change the `buttons` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn buttons(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buttons"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buttons_shim(val); self } #[doc = "Change the `clientX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn client_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_x_shim(val); self } #[doc = "Change the `clientY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn client_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_y_shim(val); self } #[doc = "Change the `movementX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn movement_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_x_shim(val); self } #[doc = "Change the `movementY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn movement_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_y_shim(val); self } #[cfg(feature = "EventTarget")] @@ -421,51 +253,21 @@ impl DragEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `EventTarget`*"] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relatedTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.related_target_shim(val); self } #[doc = "Change the `screenX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn screen_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_x_shim(val); self } #[doc = "Change the `screenY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub fn screen_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_y_shim(val); self } #[cfg(feature = "DataTransfer")] @@ -473,17 +275,7 @@ impl DragEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `DragEventInit`*"] pub fn data_transfer(&mut self, val: Option<&DataTransfer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataTransfer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_transfer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs b/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs index 788f593548e..494ed0224eb 100644 --- a/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs +++ b/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub type DynamicsCompressorOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &DynamicsCompressorOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &DynamicsCompressorOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &DynamicsCompressorOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "attack")] + fn attack_shim(this: &DynamicsCompressorOptions, val: f32); + #[wasm_bindgen(method, setter = "knee")] + fn knee_shim(this: &DynamicsCompressorOptions, val: f32); + #[wasm_bindgen(method, setter = "ratio")] + fn ratio_shim(this: &DynamicsCompressorOptions, val: f32); + #[wasm_bindgen(method, setter = "release")] + fn release_shim(this: &DynamicsCompressorOptions, val: f32); + #[wasm_bindgen(method, setter = "threshold")] + fn threshold_shim(this: &DynamicsCompressorOptions, val: f32); } impl DynamicsCompressorOptions { #[doc = "Construct a new `DynamicsCompressorOptions`."] @@ -24,17 +42,7 @@ impl DynamicsCompressorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +50,7 @@ impl DynamicsCompressorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DynamicsCompressorOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,91 +58,42 @@ impl DynamicsCompressorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DynamicsCompressorOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `attack` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn attack(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("attack"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attack_shim(val); self } #[doc = "Change the `knee` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn knee(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("knee"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.knee_shim(val); self } #[doc = "Change the `ratio` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn ratio(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ratio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ratio_shim(val); self } #[doc = "Change the `release` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn release(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("release"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.release_shim(val); self } #[doc = "Change the `threshold` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub fn threshold(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("threshold"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.threshold_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs index 42aad21d531..82ca2870a12 100644 --- a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] pub type EcKeyAlgorithm; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &EcKeyAlgorithm, val: &str); + #[wasm_bindgen(method, setter = "namedCurve")] + fn named_curve_shim(this: &EcKeyAlgorithm, val: &str); } impl EcKeyAlgorithm { #[doc = "Construct a new `EcKeyAlgorithm`."] @@ -26,30 +30,14 @@ impl EcKeyAlgorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] pub fn named_curve(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("namedCurve"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.named_curve_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyGenParams.rs b/crates/web-sys/src/features/gen_EcKeyGenParams.rs index 05c7d2378b5..08ffc99e257 100644 --- a/crates/web-sys/src/features/gen_EcKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyGenParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] pub type EcKeyGenParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &EcKeyGenParams, val: &str); + #[wasm_bindgen(method, setter = "namedCurve")] + fn named_curve_shim(this: &EcKeyGenParams, val: &str); } impl EcKeyGenParams { #[doc = "Construct a new `EcKeyGenParams`."] @@ -26,30 +30,14 @@ impl EcKeyGenParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] pub fn named_curve(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("namedCurve"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.named_curve_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyImportParams.rs b/crates/web-sys/src/features/gen_EcKeyImportParams.rs index 13615f0888f..512dee8819d 100644 --- a/crates/web-sys/src/features/gen_EcKeyImportParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyImportParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] pub type EcKeyImportParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &EcKeyImportParams, val: &str); + #[wasm_bindgen(method, setter = "namedCurve")] + fn named_curve_shim(this: &EcKeyImportParams, val: &str); } impl EcKeyImportParams { #[doc = "Construct a new `EcKeyImportParams`."] @@ -25,30 +29,14 @@ impl EcKeyImportParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] pub fn named_curve(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("namedCurve"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.named_curve_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs index 2f6c4d694b5..c01ec76a8e2 100644 --- a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] pub type EcdhKeyDeriveParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &EcdhKeyDeriveParams, val: &str); + #[cfg(feature = "CryptoKey")] + #[wasm_bindgen(method, setter = "public")] + fn public_shim(this: &EcdhKeyDeriveParams, val: &CryptoKey); } impl EcdhKeyDeriveParams { #[cfg(feature = "CryptoKey")] @@ -27,13 +32,7 @@ impl EcdhKeyDeriveParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "CryptoKey")] @@ -41,14 +40,7 @@ impl EcdhKeyDeriveParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `EcdhKeyDeriveParams`*"] pub fn public(&mut self, val: &CryptoKey) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("public"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.public_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EcdsaParams.rs b/crates/web-sys/src/features/gen_EcdsaParams.rs index 918c40523c5..bfc9fe093fc 100644 --- a/crates/web-sys/src/features/gen_EcdsaParams.rs +++ b/crates/web-sys/src/features/gen_EcdsaParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] pub type EcdsaParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &EcdsaParams, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &EcdsaParams, val: &::wasm_bindgen::JsValue); } impl EcdsaParams { #[doc = "Construct a new `EcdsaParams`."] @@ -26,26 +30,14 @@ impl EcdsaParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EffectTiming.rs b/crates/web-sys/src/features/gen_EffectTiming.rs index 4af14f8f347..cd1b84ecfb7 100644 --- a/crates/web-sys/src/features/gen_EffectTiming.rs +++ b/crates/web-sys/src/features/gen_EffectTiming.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub type EffectTiming; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &EffectTiming, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &EffectTiming, val: PlaybackDirection); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &EffectTiming, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &EffectTiming, val: &str); + #[wasm_bindgen(method, setter = "endDelay")] + fn end_delay_shim(this: &EffectTiming, val: f64); + #[cfg(feature = "FillMode")] + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &EffectTiming, val: FillMode); + #[wasm_bindgen(method, setter = "iterationStart")] + fn iteration_start_shim(this: &EffectTiming, val: f64); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &EffectTiming, val: f64); } impl EffectTiming { #[doc = "Construct a new `EffectTiming`."] @@ -24,13 +42,7 @@ impl EffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(feature = "PlaybackDirection")] @@ -38,65 +50,28 @@ impl EffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `PlaybackDirection`*"] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `endDelay` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn end_delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endDelay"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_delay_shim(val); self } #[cfg(feature = "FillMode")] @@ -104,47 +79,21 @@ impl EffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `FillMode`*"] pub fn fill(&mut self, val: FillMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[doc = "Change the `iterationStart` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_start_shim(val); self } #[doc = "Change the `iterations` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub fn iterations(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ElementCreationOptions.rs b/crates/web-sys/src/features/gen_ElementCreationOptions.rs index b5a76b5c074..59bd3c85d11 100644 --- a/crates/web-sys/src/features/gen_ElementCreationOptions.rs +++ b/crates/web-sys/src/features/gen_ElementCreationOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] pub type ElementCreationOptions; + #[wasm_bindgen(method, setter = "is")] + fn is_shim(this: &ElementCreationOptions, val: &str); + #[wasm_bindgen(method, setter = "pseudo")] + fn pseudo_shim(this: &ElementCreationOptions, val: &str); } impl ElementCreationOptions { #[doc = "Construct a new `ElementCreationOptions`."] @@ -24,27 +28,14 @@ impl ElementCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] pub fn is(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("is"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_shim(val); self } #[doc = "Change the `pseudo` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] pub fn pseudo(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pseudo"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pseudo_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs index e53766d8648..0c551a1c06f 100644 --- a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs +++ b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] pub type ElementDefinitionOptions; + #[wasm_bindgen(method, setter = "extends")] + fn extends_shim(this: &ElementDefinitionOptions, val: &str); } impl ElementDefinitionOptions { #[doc = "Construct a new `ElementDefinitionOptions`."] @@ -24,17 +26,7 @@ impl ElementDefinitionOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] pub fn extends(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("extends"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.extends_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs index d5496c324e2..089dd9bb426 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedAudioChunkInit; + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &EncodedAudioChunkInit, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &EncodedAudioChunkInit, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &EncodedAudioChunkInit, val: f64); + #[cfg(feature = "EncodedAudioChunkType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &EncodedAudioChunkInit, val: EncodedAudioChunkType); } #[cfg(web_sys_unstable_apis)] impl EncodedAudioChunkInit { @@ -40,13 +49,7 @@ impl EncodedAudioChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +60,7 @@ impl EncodedAudioChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +71,7 @@ impl EncodedAudioChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,13 +83,7 @@ impl EncodedAudioChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: EncodedAudioChunkType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs b/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs index aeb9cd53201..a5da12d42dd 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedAudioChunkMetadata; + #[cfg(feature = "AudioDecoderConfig")] + #[wasm_bindgen(method, setter = "decoderConfig")] + fn decoder_config_shim(this: &EncodedAudioChunkMetadata, val: &AudioDecoderConfig); } #[cfg(web_sys_unstable_apis)] impl EncodedAudioChunkMetadata { @@ -37,17 +40,7 @@ impl EncodedAudioChunkMetadata { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn decoder_config(&mut self, val: &AudioDecoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("decoderConfig"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.decoder_config_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs index 1699fbf104a..7d8da29fee1 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedVideoChunkInit; + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &EncodedVideoChunkInit, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &EncodedVideoChunkInit, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &EncodedVideoChunkInit, val: f64); + #[cfg(feature = "EncodedVideoChunkType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &EncodedVideoChunkInit, val: EncodedVideoChunkType); } #[cfg(web_sys_unstable_apis)] impl EncodedVideoChunkInit { @@ -40,13 +49,7 @@ impl EncodedVideoChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +60,7 @@ impl EncodedVideoChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +71,7 @@ impl EncodedVideoChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,13 +83,7 @@ impl EncodedVideoChunkInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: EncodedVideoChunkType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs b/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs index 6b81fe2e3e7..354fb8dc070 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedVideoChunkMetadata; + #[wasm_bindgen(method, setter = "alphaSideData")] + fn alpha_side_data_shim(this: &EncodedVideoChunkMetadata, val: &::js_sys::Object); + #[cfg(feature = "VideoDecoderConfig")] + #[wasm_bindgen(method, setter = "decoderConfig")] + fn decoder_config_shim(this: &EncodedVideoChunkMetadata, val: &VideoDecoderConfig); + #[cfg(feature = "SvcOutputMetadata")] + #[wasm_bindgen(method, setter = "svc")] + fn svc_shim(this: &EncodedVideoChunkMetadata, val: &SvcOutputMetadata); } #[cfg(web_sys_unstable_apis)] impl EncodedVideoChunkMetadata { @@ -36,17 +44,7 @@ impl EncodedVideoChunkMetadata { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha_side_data(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("alphaSideData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_side_data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +56,7 @@ impl EncodedVideoChunkMetadata { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn decoder_config(&mut self, val: &VideoDecoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("decoderConfig"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.decoder_config_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,13 +68,7 @@ impl EncodedVideoChunkMetadata { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn svc(&mut self, val: &SvcOutputMetadata) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("svc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.svc_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ErrorCallback.rs b/crates/web-sys/src/features/gen_ErrorCallback.rs index 4351dfc05eb..e14346d2eae 100644 --- a/crates/web-sys/src/features/gen_ErrorCallback.rs +++ b/crates/web-sys/src/features/gen_ErrorCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] pub type ErrorCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &ErrorCallback, val: &::js_sys::Function); } impl ErrorCallback { #[doc = "Construct a new `ErrorCallback`."] @@ -24,17 +26,7 @@ impl ErrorCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ErrorEventInit.rs b/crates/web-sys/src/features/gen_ErrorEventInit.rs index c483439e562..42369ecc8a4 100644 --- a/crates/web-sys/src/features/gen_ErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_ErrorEventInit.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub type ErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "colno")] + fn colno_shim(this: &ErrorEventInit, val: u32); + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &ErrorEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "filename")] + fn filename_shim(this: &ErrorEventInit, val: &str); + #[wasm_bindgen(method, setter = "lineno")] + fn lineno_shim(this: &ErrorEventInit, val: u32); + #[wasm_bindgen(method, setter = "message")] + fn message_shim(this: &ErrorEventInit, val: &str); } impl ErrorEventInit { #[doc = "Construct a new `ErrorEventInit`."] @@ -24,125 +40,56 @@ impl ErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `colno` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn colno(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("colno"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.colno_shim(val); self } #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn error(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn filename(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filename_shim(val); self } #[doc = "Change the `lineno` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn lineno(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("lineno"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lineno_shim(val); self } #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub fn message(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EventInit.rs b/crates/web-sys/src/features/gen_EventInit.rs index 0a6e9eb812c..de8e524324e 100644 --- a/crates/web-sys/src/features/gen_EventInit.rs +++ b/crates/web-sys/src/features/gen_EventInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] pub type EventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &EventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &EventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &EventInit, val: bool); } impl EventInit { #[doc = "Construct a new `EventInit`."] @@ -24,51 +30,21 @@ impl EventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EventListener.rs b/crates/web-sys/src/features/gen_EventListener.rs index ab47a427340..8a17381cb56 100644 --- a/crates/web-sys/src/features/gen_EventListener.rs +++ b/crates/web-sys/src/features/gen_EventListener.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] pub type EventListener; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &EventListener, val: &::js_sys::Function); } impl EventListener { #[doc = "Construct a new `EventListener`."] @@ -24,17 +26,7 @@ impl EventListener { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EventListenerOptions.rs b/crates/web-sys/src/features/gen_EventListenerOptions.rs index 4ac4ff613e5..05b771d7084 100644 --- a/crates/web-sys/src/features/gen_EventListenerOptions.rs +++ b/crates/web-sys/src/features/gen_EventListenerOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] pub type EventListenerOptions; + #[wasm_bindgen(method, setter = "capture")] + fn capture_shim(this: &EventListenerOptions, val: bool); } impl EventListenerOptions { #[doc = "Construct a new `EventListenerOptions`."] @@ -24,17 +26,7 @@ impl EventListenerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] pub fn capture(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("capture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.capture_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EventModifierInit.rs b/crates/web-sys/src/features/gen_EventModifierInit.rs index 21f7c2ceb81..373609a21ec 100644 --- a/crates/web-sys/src/features/gen_EventModifierInit.rs +++ b/crates/web-sys/src/features/gen_EventModifierInit.rs @@ -10,6 +10,43 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub type EventModifierInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &EventModifierInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &EventModifierInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &EventModifierInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &EventModifierInit, val: bool); } impl EventModifierInit { #[doc = "Construct a new `EventModifierInit`."] @@ -24,65 +61,28 @@ impl EventModifierInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,231 +90,98 @@ impl EventModifierInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_EventSourceInit.rs b/crates/web-sys/src/features/gen_EventSourceInit.rs index 7c0f3bce237..61761803dee 100644 --- a/crates/web-sys/src/features/gen_EventSourceInit.rs +++ b/crates/web-sys/src/features/gen_EventSourceInit.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] pub type EventSourceInit; + #[wasm_bindgen(method, setter = "withCredentials")] + fn with_credentials_shim(this: &EventSourceInit, val: bool); } impl EventSourceInit { #[doc = "Construct a new `EventSourceInit`."] @@ -24,17 +26,7 @@ impl EventSourceInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] pub fn with_credentials(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("withCredentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.with_credentials_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ExtendableEventInit.rs b/crates/web-sys/src/features/gen_ExtendableEventInit.rs index c990714268d..1dbc56a64f7 100644 --- a/crates/web-sys/src/features/gen_ExtendableEventInit.rs +++ b/crates/web-sys/src/features/gen_ExtendableEventInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] pub type ExtendableEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ExtendableEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ExtendableEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ExtendableEventInit, val: bool); } impl ExtendableEventInit { #[doc = "Construct a new `ExtendableEventInit`."] @@ -24,51 +30,21 @@ impl ExtendableEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs index 9be6c91c360..32c11651574 100644 --- a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub type ExtendableMessageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ExtendableMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ExtendableMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ExtendableMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "lastEventId")] + fn last_event_id_shim(this: &ExtendableMessageEventInit, val: &str); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &ExtendableMessageEventInit, val: &str); + #[wasm_bindgen(method, setter = "ports")] + fn ports_shim(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &ExtendableMessageEventInit, val: Option<&::js_sys::Object>); } impl ExtendableMessageEventInit { #[doc = "Construct a new `ExtendableMessageEventInit`."] @@ -24,122 +40,56 @@ impl ExtendableMessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[doc = "Change the `lastEventId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn last_event_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastEventId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_event_id_shim(val); self } #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn origin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `ports` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn ports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ports"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ports_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub fn source(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs index fbae627901c..2d3e8407ce1 100644 --- a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs +++ b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] pub type FakePluginMimeEntry; + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &FakePluginMimeEntry, val: &str); + #[wasm_bindgen(method, setter = "extension")] + fn extension_shim(this: &FakePluginMimeEntry, val: &str); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &FakePluginMimeEntry, val: &str); } impl FakePluginMimeEntry { #[doc = "Construct a new `FakePluginMimeEntry`."] @@ -25,47 +31,21 @@ impl FakePluginMimeEntry { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] pub fn description(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } #[doc = "Change the `extension` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] pub fn extension(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("extension"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.extension_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FakePluginTagInit.rs b/crates/web-sys/src/features/gen_FakePluginTagInit.rs index a1b4ac8a3f4..83d998c2dde 100644 --- a/crates/web-sys/src/features/gen_FakePluginTagInit.rs +++ b/crates/web-sys/src/features/gen_FakePluginTagInit.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub type FakePluginTagInit; + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "fileName")] + fn file_name_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "fullPath")] + fn full_path_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "handlerURI")] + fn handler_uri_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "mimeEntries")] + fn mime_entries_shim(this: &FakePluginTagInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "niceName")] + fn nice_name_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "sandboxScript")] + fn sandbox_script_shim(this: &FakePluginTagInit, val: &str); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &FakePluginTagInit, val: &str); } impl FakePluginTagInit { #[doc = "Construct a new `FakePluginTagInit`."] @@ -26,149 +44,63 @@ impl FakePluginTagInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn description(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } #[doc = "Change the `fileName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn file_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fileName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.file_name_shim(val); self } #[doc = "Change the `fullPath` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn full_path(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fullPath"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.full_path_shim(val); self } #[doc = "Change the `handlerURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn handler_uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handlerURI"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handler_uri_shim(val); self } #[doc = "Change the `mimeEntries` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn mime_entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mimeEntries"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mime_entries_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `niceName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn nice_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("niceName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.nice_name_shim(val); self } #[doc = "Change the `sandboxScript` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn sandbox_script(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sandboxScript"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sandbox_script_shim(val); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub fn version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FetchEventInit.rs b/crates/web-sys/src/features/gen_FetchEventInit.rs index d199cc656ab..4259035f3d0 100644 --- a/crates/web-sys/src/features/gen_FetchEventInit.rs +++ b/crates/web-sys/src/features/gen_FetchEventInit.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub type FetchEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &FetchEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &FetchEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &FetchEventInit, val: bool); + #[wasm_bindgen(method, setter = "clientId")] + fn client_id_shim(this: &FetchEventInit, val: Option<&str>); + #[wasm_bindgen(method, setter = "isReload")] + fn is_reload_shim(this: &FetchEventInit, val: bool); + #[cfg(feature = "Request")] + #[wasm_bindgen(method, setter = "request")] + fn request_shim(this: &FetchEventInit, val: &Request); } impl FetchEventInit { #[cfg(feature = "Request")] @@ -26,85 +39,35 @@ impl FetchEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `clientId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub fn client_id(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_id_shim(val); self } #[doc = "Change the `isReload` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub fn is_reload(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isReload"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_reload_shim(val); self } #[cfg(feature = "Request")] @@ -112,17 +75,7 @@ impl FetchEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`, `Request`*"] pub fn request(&mut self, val: &Request) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("request"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.request_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs index 2bbfebba908..3205e8c2b0b 100644 --- a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs +++ b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] pub type FetchReadableStreamReadDataDone; + #[wasm_bindgen(method, setter = "done")] + fn done_shim(this: &FetchReadableStreamReadDataDone, val: bool); } impl FetchReadableStreamReadDataDone { #[doc = "Construct a new `FetchReadableStreamReadDataDone`."] @@ -24,13 +26,7 @@ impl FetchReadableStreamReadDataDone { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.done_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileCallback.rs b/crates/web-sys/src/features/gen_FileCallback.rs index 46e03df228d..17beb74983c 100644 --- a/crates/web-sys/src/features/gen_FileCallback.rs +++ b/crates/web-sys/src/features/gen_FileCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] pub type FileCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &FileCallback, val: &::js_sys::Function); } impl FileCallback { #[doc = "Construct a new `FileCallback`."] @@ -24,17 +26,7 @@ impl FileCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs index cd2e41ab994..196fd6f0a79 100644 --- a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs +++ b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FilePickerAcceptType; + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &FilePickerAcceptType, val: &str); } #[cfg(web_sys_unstable_apis)] impl FilePickerAcceptType { @@ -36,17 +38,7 @@ impl FilePickerAcceptType { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn description(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePickerOptions.rs b/crates/web-sys/src/features/gen_FilePickerOptions.rs index 1548a514129..639ead2b1ea 100644 --- a/crates/web-sys/src/features/gen_FilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_FilePickerOptions.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FilePickerOptions; + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + fn exclude_accept_all_option_shim(this: &FilePickerOptions, val: bool); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &FilePickerOptions, val: &str); + #[wasm_bindgen(method, setter = "startIn")] + fn start_in_shim(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "types")] + fn types_shim(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl FilePickerOptions { @@ -36,17 +44,7 @@ impl FilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("excludeAcceptAllOption"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exclude_accept_all_option_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +55,7 @@ impl FilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +66,7 @@ impl FilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startIn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_in_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,13 +77,7 @@ impl FilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.types_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePropertyBag.rs b/crates/web-sys/src/features/gen_FilePropertyBag.rs index f98a68c4fc6..99ecc5bb920 100644 --- a/crates/web-sys/src/features/gen_FilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_FilePropertyBag.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] pub type FilePropertyBag; + #[wasm_bindgen(method, setter = "lastModified")] + fn last_modified_shim(this: &FilePropertyBag, val: f64); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &FilePropertyBag, val: &str); } impl FilePropertyBag { #[doc = "Construct a new `FilePropertyBag`."] @@ -24,30 +28,14 @@ impl FilePropertyBag { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] pub fn last_modified(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastModified"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_modified_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs index b8a1f135ebd..ae33bfeb6de 100644 --- a/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] pub type FileSystemCreateWritableOptions; + #[wasm_bindgen(method, setter = "keepExistingData")] + fn keep_existing_data_shim(this: &FileSystemCreateWritableOptions, val: bool); } impl FileSystemCreateWritableOptions { #[doc = "Construct a new `FileSystemCreateWritableOptions`."] @@ -24,17 +26,7 @@ impl FileSystemCreateWritableOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] pub fn keep_existing_data(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keepExistingData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.keep_existing_data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs b/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs index 1909296d864..6cb0cfb560d 100644 --- a/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs +++ b/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] pub type FileSystemEntriesCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &FileSystemEntriesCallback, val: &::js_sys::Function); } impl FileSystemEntriesCallback { #[doc = "Construct a new `FileSystemEntriesCallback`."] @@ -24,17 +26,7 @@ impl FileSystemEntriesCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs b/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs index c9162d911bf..4a5988ec2b8 100644 --- a/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs +++ b/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] pub type FileSystemEntryCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &FileSystemEntryCallback, val: &::js_sys::Function); } impl FileSystemEntryCallback { #[doc = "Construct a new `FileSystemEntryCallback`."] @@ -24,17 +26,7 @@ impl FileSystemEntryCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemFlags.rs b/crates/web-sys/src/features/gen_FileSystemFlags.rs index d71c57355fd..bb68735f21e 100644 --- a/crates/web-sys/src/features/gen_FileSystemFlags.rs +++ b/crates/web-sys/src/features/gen_FileSystemFlags.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] pub type FileSystemFlags; + #[wasm_bindgen(method, setter = "create")] + fn create_shim(this: &FileSystemFlags, val: bool); + #[wasm_bindgen(method, setter = "exclusive")] + fn exclusive_shim(this: &FileSystemFlags, val: bool); } impl FileSystemFlags { #[doc = "Construct a new `FileSystemFlags`."] @@ -24,31 +28,14 @@ impl FileSystemFlags { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] pub fn create(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("create"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.create_shim(val); self } #[doc = "Change the `exclusive` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] pub fn exclusive(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("exclusive"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exclusive_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs index e5f3e136a8c..b25b6429426 100644 --- a/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] pub type FileSystemGetDirectoryOptions; + #[wasm_bindgen(method, setter = "create")] + fn create_shim(this: &FileSystemGetDirectoryOptions, val: bool); } impl FileSystemGetDirectoryOptions { #[doc = "Construct a new `FileSystemGetDirectoryOptions`."] @@ -24,14 +26,7 @@ impl FileSystemGetDirectoryOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] pub fn create(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("create"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.create_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs index 8cc7a410c09..78004c0a807 100644 --- a/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] pub type FileSystemGetFileOptions; + #[wasm_bindgen(method, setter = "create")] + fn create_shim(this: &FileSystemGetFileOptions, val: bool); } impl FileSystemGetFileOptions { #[doc = "Construct a new `FileSystemGetFileOptions`."] @@ -24,14 +26,7 @@ impl FileSystemGetFileOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] pub fn create(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("create"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.create_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs index 00f6d96fe30..042392fed2a 100644 --- a/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FileSystemHandlePermissionDescriptor; + #[cfg(feature = "FileSystemPermissionMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &FileSystemHandlePermissionDescriptor, val: FileSystemPermissionMode); } #[cfg(web_sys_unstable_apis)] impl FileSystemHandlePermissionDescriptor { @@ -37,13 +40,7 @@ impl FileSystemHandlePermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs index b4a2a512c11..b777cfe64f3 100644 --- a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FileSystemPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &FileSystemPermissionDescriptor, val: PermissionName); + #[cfg(feature = "FileSystemHandle")] + #[wasm_bindgen(method, setter = "handle")] + fn handle_shim(this: &FileSystemPermissionDescriptor, val: &FileSystemHandle); + #[cfg(feature = "FileSystemPermissionMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &FileSystemPermissionDescriptor, val: FileSystemPermissionMode); } #[cfg(web_sys_unstable_apis)] impl FileSystemPermissionDescriptor { @@ -40,13 +49,7 @@ impl FileSystemPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,14 +61,7 @@ impl FileSystemPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn handle(&mut self, val: &FileSystemHandle) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("handle"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,13 +73,7 @@ impl FileSystemPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs index 209b2af448b..c54fb3a3284 100644 --- a/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] pub type FileSystemReadWriteOptions; + #[wasm_bindgen(method, setter = "at")] + fn at_shim(this: &FileSystemReadWriteOptions, val: f64); } impl FileSystemReadWriteOptions { #[doc = "Construct a new `FileSystemReadWriteOptions`."] @@ -24,13 +26,7 @@ impl FileSystemReadWriteOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] pub fn at(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("at"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.at_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs index 3f81a31cef0..fbc6e6fdbc7 100644 --- a/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] pub type FileSystemRemoveOptions; + #[wasm_bindgen(method, setter = "recursive")] + fn recursive_shim(this: &FileSystemRemoveOptions, val: bool); } impl FileSystemRemoveOptions { #[doc = "Construct a new `FileSystemRemoveOptions`."] @@ -24,17 +26,7 @@ impl FileSystemRemoveOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] pub fn recursive(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("recursive"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.recursive_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FocusEventInit.rs b/crates/web-sys/src/features/gen_FocusEventInit.rs index 04077403e79..80ec658083c 100644 --- a/crates/web-sys/src/features/gen_FocusEventInit.rs +++ b/crates/web-sys/src/features/gen_FocusEventInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub type FocusEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &FocusEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &FocusEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &FocusEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &FocusEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &FocusEventInit, val: Option<&Window>); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "relatedTarget")] + fn related_target_shim(this: &FocusEventInit, val: Option<&EventTarget>); } impl FocusEventInit { #[doc = "Construct a new `FocusEventInit`."] @@ -24,65 +38,28 @@ impl FocusEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,13 +67,7 @@ impl FocusEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[cfg(feature = "EventTarget")] @@ -104,17 +75,7 @@ impl FocusEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `FocusEventInit`*"] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relatedTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.related_target_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs index d83466e8533..1da0a315c1f 100644 --- a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs +++ b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub type FontFaceDescriptors; + #[wasm_bindgen(method, setter = "display")] + fn display_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "featureSettings")] + fn feature_settings_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "stretch")] + fn stretch_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "style")] + fn style_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "unicodeRange")] + fn unicode_range_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "variant")] + fn variant_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "variationSettings")] + fn variation_settings_shim(this: &FontFaceDescriptors, val: &str); + #[wasm_bindgen(method, setter = "weight")] + fn weight_shim(this: &FontFaceDescriptors, val: &str); } impl FontFaceDescriptors { #[doc = "Construct a new `FontFaceDescriptors`."] @@ -24,129 +40,56 @@ impl FontFaceDescriptors { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn display(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("display"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_shim(val); self } #[doc = "Change the `featureSettings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn feature_settings(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("featureSettings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.feature_settings_shim(val); self } #[doc = "Change the `stretch` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn stretch(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stretch"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stretch_shim(val); self } #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn style(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("style"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.style_shim(val); self } #[doc = "Change the `unicodeRange` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn unicode_range(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unicodeRange"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unicode_range_shim(val); self } #[doc = "Change the `variant` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn variant(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("variant"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.variant_shim(val); self } #[doc = "Change the `variationSettings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn variation_settings(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("variationSettings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.variation_settings_shim(val); self } #[doc = "Change the `weight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub fn weight(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("weight"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.weight_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs index 6046ac078a8..2cab9cdfe02 100644 --- a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs +++ b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] pub type FontFaceSetIteratorResult; + #[wasm_bindgen(method, setter = "done")] + fn done_shim(this: &FontFaceSetIteratorResult, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &FontFaceSetIteratorResult, val: &::wasm_bindgen::JsValue); } impl FontFaceSetIteratorResult { #[doc = "Construct a new `FontFaceSetIteratorResult`."] @@ -26,26 +30,14 @@ impl FontFaceSetIteratorResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.done_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs b/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs index 154e3a30cad..994c5e291e8 100644 --- a/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs +++ b/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub type FontFaceSetLoadEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &FontFaceSetLoadEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &FontFaceSetLoadEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &FontFaceSetLoadEventInit, val: bool); + #[wasm_bindgen(method, setter = "fontfaces")] + fn fontfaces_shim(this: &FontFaceSetLoadEventInit, val: &::wasm_bindgen::JsValue); } impl FontFaceSetLoadEventInit { #[doc = "Construct a new `FontFaceSetLoadEventInit`."] @@ -24,68 +32,28 @@ impl FontFaceSetLoadEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `fontfaces` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub fn fontfaces(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fontfaces"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fontfaces_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GainOptions.rs b/crates/web-sys/src/features/gen_GainOptions.rs index fdafdf807e1..a6f06048e20 100644 --- a/crates/web-sys/src/features/gen_GainOptions.rs +++ b/crates/web-sys/src/features/gen_GainOptions.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] pub type GainOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &GainOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &GainOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &GainOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "gain")] + fn gain_shim(this: &GainOptions, val: f32); } impl GainOptions { #[doc = "Construct a new `GainOptions`."] @@ -24,17 +34,7 @@ impl GainOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +42,7 @@ impl GainOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `GainOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,30 +50,14 @@ impl GainOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `GainOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `gain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] pub fn gain(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("gain"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gain_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs index 6f9b9995c64..039b25d0ea0 100644 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub type GamepadAxisMoveEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &GamepadAxisMoveEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &GamepadAxisMoveEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GamepadAxisMoveEventInit, val: bool); + #[cfg(feature = "Gamepad")] + #[wasm_bindgen(method, setter = "gamepad")] + fn gamepad_shim(this: &GamepadAxisMoveEventInit, val: Option<&Gamepad>); + #[wasm_bindgen(method, setter = "axis")] + fn axis_shim(this: &GamepadAxisMoveEventInit, val: u32); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &GamepadAxisMoveEventInit, val: f64); } impl GamepadAxisMoveEventInit { #[doc = "Construct a new `GamepadAxisMoveEventInit`."] @@ -24,51 +37,21 @@ impl GamepadAxisMoveEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Gamepad")] @@ -76,43 +59,21 @@ impl GamepadAxisMoveEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gamepad"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gamepad_shim(val); self } #[doc = "Change the `axis` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub fn axis(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("axis"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.axis_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub fn value(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs index 5714242483a..dfe076a66ba 100644 --- a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub type GamepadButtonEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &GamepadButtonEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &GamepadButtonEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GamepadButtonEventInit, val: bool); + #[cfg(feature = "Gamepad")] + #[wasm_bindgen(method, setter = "gamepad")] + fn gamepad_shim(this: &GamepadButtonEventInit, val: Option<&Gamepad>); + #[wasm_bindgen(method, setter = "button")] + fn button_shim(this: &GamepadButtonEventInit, val: u32); } impl GamepadButtonEventInit { #[doc = "Construct a new `GamepadButtonEventInit`."] @@ -24,51 +35,21 @@ impl GamepadButtonEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Gamepad")] @@ -76,31 +57,14 @@ impl GamepadButtonEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gamepad"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gamepad_shim(val); self } #[doc = "Change the `button` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub fn button(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.button_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadEventInit.rs b/crates/web-sys/src/features/gen_GamepadEventInit.rs index 8ffd29284dc..13ee954f335 100644 --- a/crates/web-sys/src/features/gen_GamepadEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] pub type GamepadEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &GamepadEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &GamepadEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GamepadEventInit, val: bool); + #[cfg(feature = "Gamepad")] + #[wasm_bindgen(method, setter = "gamepad")] + fn gamepad_shim(this: &GamepadEventInit, val: Option<&Gamepad>); } impl GamepadEventInit { #[doc = "Construct a new `GamepadEventInit`."] @@ -24,51 +33,21 @@ impl GamepadEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Gamepad")] @@ -76,17 +55,7 @@ impl GamepadEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadEventInit`*"] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gamepad"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gamepad_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GetAnimationsOptions.rs b/crates/web-sys/src/features/gen_GetAnimationsOptions.rs index ec5f36532fc..7f2774c308b 100644 --- a/crates/web-sys/src/features/gen_GetAnimationsOptions.rs +++ b/crates/web-sys/src/features/gen_GetAnimationsOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GetAnimationsOptions; + #[wasm_bindgen(method, setter = "subtree")] + fn subtree_shim(this: &GetAnimationsOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl GetAnimationsOptions { @@ -36,17 +38,7 @@ impl GetAnimationsOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn subtree(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("subtree"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.subtree_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GetRootNodeOptions.rs b/crates/web-sys/src/features/gen_GetRootNodeOptions.rs index 9539c52a7f7..ba387240e5d 100644 --- a/crates/web-sys/src/features/gen_GetRootNodeOptions.rs +++ b/crates/web-sys/src/features/gen_GetRootNodeOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] pub type GetRootNodeOptions; + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GetRootNodeOptions, val: bool); } impl GetRootNodeOptions { #[doc = "Construct a new `GetRootNodeOptions`."] @@ -24,17 +26,7 @@ impl GetRootNodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs index fa5a21d2c7b..c5594b85ad3 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuBindGroupDescriptor, val: &str); + #[wasm_bindgen(method, setter = "entries")] + fn entries_shim(this: &GpuBindGroupDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuBindGroupLayout")] + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &GpuBindGroupDescriptor, val: &GpuBindGroupLayout); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupDescriptor { @@ -39,13 +46,7 @@ impl GpuBindGroupDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +57,7 @@ impl GpuBindGroupDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entries"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entries_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,14 +69,7 @@ impl GpuBindGroupDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &GpuBindGroupLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs index e4dce4d2762..e41ab563eba 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupEntry; + #[wasm_bindgen(method, setter = "binding")] + fn binding_shim(this: &GpuBindGroupEntry, val: u32); + #[wasm_bindgen(method, setter = "resource")] + fn resource_shim(this: &GpuBindGroupEntry, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupEntry { @@ -38,17 +42,7 @@ impl GpuBindGroupEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn binding(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("binding"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.binding_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +53,7 @@ impl GpuBindGroupEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn resource(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resource"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resource_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs index 5faf64dc6d2..2ca1218a16e 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupLayoutDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuBindGroupLayoutDescriptor, val: &str); + #[wasm_bindgen(method, setter = "entries")] + fn entries_shim(this: &GpuBindGroupLayoutDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupLayoutDescriptor { @@ -37,13 +41,7 @@ impl GpuBindGroupLayoutDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +52,7 @@ impl GpuBindGroupLayoutDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entries"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entries_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs index b072d01e18d..87e1e46d5c9 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs @@ -14,6 +14,25 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupLayoutEntry; + #[wasm_bindgen(method, setter = "binding")] + fn binding_shim(this: &GpuBindGroupLayoutEntry, val: u32); + #[cfg(feature = "GpuBufferBindingLayout")] + #[wasm_bindgen(method, setter = "buffer")] + fn buffer_shim(this: &GpuBindGroupLayoutEntry, val: &GpuBufferBindingLayout); + #[cfg(feature = "GpuExternalTextureBindingLayout")] + #[wasm_bindgen(method, setter = "externalTexture")] + fn external_texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuExternalTextureBindingLayout); + #[cfg(feature = "GpuSamplerBindingLayout")] + #[wasm_bindgen(method, setter = "sampler")] + fn sampler_shim(this: &GpuBindGroupLayoutEntry, val: &GpuSamplerBindingLayout); + #[cfg(feature = "GpuStorageTextureBindingLayout")] + #[wasm_bindgen(method, setter = "storageTexture")] + fn storage_texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuStorageTextureBindingLayout); + #[cfg(feature = "GpuTextureBindingLayout")] + #[wasm_bindgen(method, setter = "texture")] + fn texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuTextureBindingLayout); + #[wasm_bindgen(method, setter = "visibility")] + fn visibility_shim(this: &GpuBindGroupLayoutEntry, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupLayoutEntry { @@ -38,17 +57,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn binding(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("binding"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.binding_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,14 +69,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn buffer(&mut self, val: &GpuBufferBindingLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +81,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn external_texture(&mut self, val: &GpuExternalTextureBindingLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("externalTexture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.external_texture_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -101,17 +93,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sampler(&mut self, val: &GpuSamplerBindingLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampler"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sampler_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -123,17 +105,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn storage_texture(&mut self, val: &GpuStorageTextureBindingLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("storageTexture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.storage_texture_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -145,17 +117,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn texture(&mut self, val: &GpuTextureBindingLayout) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("texture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.texture_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -166,17 +128,7 @@ impl GpuBindGroupLayoutEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn visibility(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("visibility"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.visibility_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBlendComponent.rs b/crates/web-sys/src/features/gen_GpuBlendComponent.rs index 6449482751d..03ed104e2f1 100644 --- a/crates/web-sys/src/features/gen_GpuBlendComponent.rs +++ b/crates/web-sys/src/features/gen_GpuBlendComponent.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBlendComponent; + #[cfg(feature = "GpuBlendFactor")] + #[wasm_bindgen(method, setter = "dstFactor")] + fn dst_factor_shim(this: &GpuBlendComponent, val: GpuBlendFactor); + #[cfg(feature = "GpuBlendOperation")] + #[wasm_bindgen(method, setter = "operation")] + fn operation_shim(this: &GpuBlendComponent, val: GpuBlendOperation); + #[cfg(feature = "GpuBlendFactor")] + #[wasm_bindgen(method, setter = "srcFactor")] + fn src_factor_shim(this: &GpuBlendComponent, val: GpuBlendFactor); } #[cfg(web_sys_unstable_apis)] impl GpuBlendComponent { @@ -37,17 +46,7 @@ impl GpuBlendComponent { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn dst_factor(&mut self, val: GpuBlendFactor) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dstFactor"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dst_factor_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl GpuBlendComponent { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn operation(&mut self, val: GpuBlendOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("operation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.operation_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +70,7 @@ impl GpuBlendComponent { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn src_factor(&mut self, val: GpuBlendFactor) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("srcFactor"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.src_factor_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBlendState.rs b/crates/web-sys/src/features/gen_GpuBlendState.rs index 70b2833a709..80b609acd5d 100644 --- a/crates/web-sys/src/features/gen_GpuBlendState.rs +++ b/crates/web-sys/src/features/gen_GpuBlendState.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBlendState; + #[cfg(feature = "GpuBlendComponent")] + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &GpuBlendState, val: &GpuBlendComponent); + #[cfg(feature = "GpuBlendComponent")] + #[wasm_bindgen(method, setter = "color")] + fn color_shim(this: &GpuBlendState, val: &GpuBlendComponent); } #[cfg(web_sys_unstable_apis)] impl GpuBlendState { @@ -40,13 +46,7 @@ impl GpuBlendState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha(&mut self, val: &GpuBlendComponent) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,13 +58,7 @@ impl GpuBlendState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color(&mut self, val: &GpuBlendComponent) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("color"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferBinding.rs b/crates/web-sys/src/features/gen_GpuBufferBinding.rs index 9181923a5f0..170abfdb707 100644 --- a/crates/web-sys/src/features/gen_GpuBufferBinding.rs +++ b/crates/web-sys/src/features/gen_GpuBufferBinding.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferBinding; + #[cfg(feature = "GpuBuffer")] + #[wasm_bindgen(method, setter = "buffer")] + fn buffer_shim(this: &GpuBufferBinding, val: &GpuBuffer); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &GpuBufferBinding, val: f64); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &GpuBufferBinding, val: f64); } #[cfg(web_sys_unstable_apis)] impl GpuBufferBinding { @@ -39,14 +46,7 @@ impl GpuBufferBinding { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn buffer(&mut self, val: &GpuBuffer) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,14 +57,7 @@ impl GpuBufferBinding { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,13 +68,7 @@ impl GpuBufferBinding { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn size(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs b/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs index 3ce28b46bc3..b78b7a4c753 100644 --- a/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferBindingLayout; + #[wasm_bindgen(method, setter = "hasDynamicOffset")] + fn has_dynamic_offset_shim(this: &GpuBufferBindingLayout, val: bool); + #[wasm_bindgen(method, setter = "minBindingSize")] + fn min_binding_size_shim(this: &GpuBufferBindingLayout, val: f64); + #[cfg(feature = "GpuBufferBindingType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &GpuBufferBindingLayout, val: GpuBufferBindingType); } #[cfg(web_sys_unstable_apis)] impl GpuBufferBindingLayout { @@ -36,17 +43,7 @@ impl GpuBufferBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn has_dynamic_offset(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hasDynamicOffset"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.has_dynamic_offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +54,7 @@ impl GpuBufferBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn min_binding_size(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("minBindingSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_binding_size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,13 +66,7 @@ impl GpuBufferBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: GpuBufferBindingType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs index adb1ae3160c..432a97950b9 100644 --- a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuBufferDescriptor, val: &str); + #[wasm_bindgen(method, setter = "mappedAtCreation")] + fn mapped_at_creation_shim(this: &GpuBufferDescriptor, val: bool); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &GpuBufferDescriptor, val: f64); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &GpuBufferDescriptor, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuBufferDescriptor { @@ -38,13 +46,7 @@ impl GpuBufferDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +57,7 @@ impl GpuBufferDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mapped_at_creation(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mappedAtCreation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mapped_at_creation_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,13 +68,7 @@ impl GpuBufferDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn size(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -93,13 +79,7 @@ impl GpuBufferDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index 84c5ca43738..151e60d979b 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -14,6 +14,19 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCanvasConfiguration; + #[cfg(feature = "GpuCanvasAlphaMode")] + #[wasm_bindgen(method, setter = "alphaMode")] + fn alpha_mode_shim(this: &GpuCanvasConfiguration, val: GpuCanvasAlphaMode); + #[cfg(feature = "GpuDevice")] + #[wasm_bindgen(method, setter = "device")] + fn device_shim(this: &GpuCanvasConfiguration, val: &GpuDevice); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuCanvasConfiguration, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &GpuCanvasConfiguration, val: u32); + #[wasm_bindgen(method, setter = "viewFormats")] + fn view_formats_shim(this: &GpuCanvasConfiguration, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuCanvasConfiguration { @@ -40,17 +53,7 @@ impl GpuCanvasConfiguration { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha_mode(&mut self, val: GpuCanvasAlphaMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("alphaMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -62,14 +65,7 @@ impl GpuCanvasConfiguration { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device(&mut self, val: &GpuDevice) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,14 +77,7 @@ impl GpuCanvasConfiguration { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,13 +88,7 @@ impl GpuCanvasConfiguration { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -116,17 +99,7 @@ impl GpuCanvasConfiguration { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewFormats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_formats_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuColorDict.rs b/crates/web-sys/src/features/gen_GpuColorDict.rs index 51d4be5888d..43041c4c8d6 100644 --- a/crates/web-sys/src/features/gen_GpuColorDict.rs +++ b/crates/web-sys/src/features/gen_GpuColorDict.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuColorDict; + #[wasm_bindgen(method, setter = "a")] + fn a_shim(this: &GpuColorDict, val: f64); + #[wasm_bindgen(method, setter = "b")] + fn b_shim(this: &GpuColorDict, val: f64); + #[wasm_bindgen(method, setter = "g")] + fn g_shim(this: &GpuColorDict, val: f64); + #[wasm_bindgen(method, setter = "r")] + fn r_shim(this: &GpuColorDict, val: f64); } #[cfg(web_sys_unstable_apis)] impl GpuColorDict { @@ -40,13 +48,7 @@ impl GpuColorDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn a(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.a_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +59,7 @@ impl GpuColorDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn b(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.b_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,13 +70,7 @@ impl GpuColorDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn g(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("g"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.g_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -91,13 +81,7 @@ impl GpuColorDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn r(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("r"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.r_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuColorTargetState.rs b/crates/web-sys/src/features/gen_GpuColorTargetState.rs index d239a268274..252c6c88da2 100644 --- a/crates/web-sys/src/features/gen_GpuColorTargetState.rs +++ b/crates/web-sys/src/features/gen_GpuColorTargetState.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuColorTargetState; + #[cfg(feature = "GpuBlendState")] + #[wasm_bindgen(method, setter = "blend")] + fn blend_shim(this: &GpuColorTargetState, val: &GpuBlendState); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuColorTargetState, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "writeMask")] + fn write_mask_shim(this: &GpuColorTargetState, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuColorTargetState { @@ -39,13 +47,7 @@ impl GpuColorTargetState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn blend(&mut self, val: &GpuBlendState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("blend"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.blend_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,14 +59,7 @@ impl GpuColorTargetState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +70,7 @@ impl GpuColorTargetState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_mask(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("writeMask"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.write_mask_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs index 34036b2c850..556718c1c69 100644 --- a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCommandBufferDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuCommandBufferDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuCommandBufferDescriptor { @@ -36,13 +38,7 @@ impl GpuCommandBufferDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs index 08a08d44f13..5e6cb5ae4d6 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCommandEncoderDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuCommandEncoderDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuCommandEncoderDescriptor { @@ -36,13 +38,7 @@ impl GpuCommandEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs index 18b414291e7..ba493a46692 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePassDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuComputePassDescriptor, val: &str); + #[cfg(feature = "GpuComputePassTimestampWrites")] + #[wasm_bindgen(method, setter = "timestampWrites")] + fn timestamp_writes_shim(this: &GpuComputePassDescriptor, val: &GpuComputePassTimestampWrites); } #[cfg(web_sys_unstable_apis)] impl GpuComputePassDescriptor { @@ -36,13 +41,7 @@ impl GpuComputePassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +53,7 @@ impl GpuComputePassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp_writes(&mut self, val: &GpuComputePassTimestampWrites) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestampWrites"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_writes_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs index 52a43c7e0a8..fec406f183f 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePassTimestampWrites; + #[wasm_bindgen(method, setter = "beginningOfPassWriteIndex")] + fn beginning_of_pass_write_index_shim(this: &GpuComputePassTimestampWrites, val: u32); + #[wasm_bindgen(method, setter = "endOfPassWriteIndex")] + fn end_of_pass_write_index_shim(this: &GpuComputePassTimestampWrites, val: u32); + #[cfg(feature = "GpuQuerySet")] + #[wasm_bindgen(method, setter = "querySet")] + fn query_set_shim(this: &GpuComputePassTimestampWrites, val: &GpuQuerySet); } #[cfg(web_sys_unstable_apis)] impl GpuComputePassTimestampWrites { @@ -38,17 +45,7 @@ impl GpuComputePassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn beginning_of_pass_write_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("beginningOfPassWriteIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.beginning_of_pass_write_index_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +56,7 @@ impl GpuComputePassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn end_of_pass_write_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endOfPassWriteIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_of_pass_write_index_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +68,7 @@ impl GpuComputePassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("querySet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.query_set_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs index 22a28382229..ad49e55c478 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePipelineDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuComputePipelineDescriptor, val: &str); + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &GpuComputePipelineDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuProgrammableStage")] + #[wasm_bindgen(method, setter = "compute")] + fn compute_shim(this: &GpuComputePipelineDescriptor, val: &GpuProgrammableStage); } #[cfg(web_sys_unstable_apis)] impl GpuComputePipelineDescriptor { @@ -39,13 +46,7 @@ impl GpuComputePipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,14 +57,7 @@ impl GpuComputePipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +69,7 @@ impl GpuComputePipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn compute(&mut self, val: &GpuProgrammableStage) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("compute"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.compute_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs index 8869e1ce387..f991cd4c9b4 100644 --- a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs +++ b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs @@ -14,6 +14,30 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuDepthStencilState; + #[wasm_bindgen(method, setter = "depthBias")] + fn depth_bias_shim(this: &GpuDepthStencilState, val: i32); + #[wasm_bindgen(method, setter = "depthBiasClamp")] + fn depth_bias_clamp_shim(this: &GpuDepthStencilState, val: f32); + #[wasm_bindgen(method, setter = "depthBiasSlopeScale")] + fn depth_bias_slope_scale_shim(this: &GpuDepthStencilState, val: f32); + #[cfg(feature = "GpuCompareFunction")] + #[wasm_bindgen(method, setter = "depthCompare")] + fn depth_compare_shim(this: &GpuDepthStencilState, val: GpuCompareFunction); + #[wasm_bindgen(method, setter = "depthWriteEnabled")] + fn depth_write_enabled_shim(this: &GpuDepthStencilState, val: bool); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuDepthStencilState, val: GpuTextureFormat); + #[cfg(feature = "GpuStencilFaceState")] + #[wasm_bindgen(method, setter = "stencilBack")] + fn stencil_back_shim(this: &GpuDepthStencilState, val: &GpuStencilFaceState); + #[cfg(feature = "GpuStencilFaceState")] + #[wasm_bindgen(method, setter = "stencilFront")] + fn stencil_front_shim(this: &GpuDepthStencilState, val: &GpuStencilFaceState); + #[wasm_bindgen(method, setter = "stencilReadMask")] + fn stencil_read_mask_shim(this: &GpuDepthStencilState, val: u32); + #[wasm_bindgen(method, setter = "stencilWriteMask")] + fn stencil_write_mask_shim(this: &GpuDepthStencilState, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuDepthStencilState { @@ -38,17 +62,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_bias(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthBias"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_bias_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +73,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_bias_clamp(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthBiasClamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_bias_clamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +84,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_bias_slope_scale(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthBiasSlopeScale"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_bias_slope_scale_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,17 +96,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_compare(&mut self, val: GpuCompareFunction) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthCompare"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_compare_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -123,17 +107,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_write_enabled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthWriteEnabled"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_write_enabled_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -145,14 +119,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -164,17 +131,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_back(&mut self, val: &GpuStencilFaceState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilBack"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_back_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -186,17 +143,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_front(&mut self, val: &GpuStencilFaceState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilFront"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_front_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -207,17 +154,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_read_mask(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilReadMask"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_read_mask_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -228,17 +165,7 @@ impl GpuDepthStencilState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_write_mask(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilWriteMask"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_write_mask_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index e414b2d649a..4507817ca89 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuDeviceDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuDeviceDescriptor, val: &str); + #[cfg(feature = "GpuQueueDescriptor")] + #[wasm_bindgen(method, setter = "defaultQueue")] + fn default_queue_shim(this: &GpuDeviceDescriptor, val: &GpuQueueDescriptor); + #[wasm_bindgen(method, setter = "requiredFeatures")] + fn required_features_shim(this: &GpuDeviceDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuDeviceDescriptor { @@ -36,13 +43,7 @@ impl GpuDeviceDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +55,7 @@ impl GpuDeviceDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn default_queue(&mut self, val: &GpuQueueDescriptor) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("defaultQueue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.default_queue_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +66,7 @@ impl GpuDeviceDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requiredFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.required_features_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs index b99cac13faa..b0c9f2338d1 100644 --- a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuExtent3dDict; + #[wasm_bindgen(method, setter = "depthOrArrayLayers")] + fn depth_or_array_layers_shim(this: &GpuExtent3dDict, val: u32); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &GpuExtent3dDict, val: u32); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &GpuExtent3dDict, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuExtent3dDict { @@ -37,17 +43,7 @@ impl GpuExtent3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_or_array_layers(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthOrArrayLayers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_or_array_layers_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,14 +54,7 @@ impl GpuExtent3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,13 +65,7 @@ impl GpuExtent3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs index 34ffa8f9195..13c397f5f3f 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuExternalTextureDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuExternalTextureDescriptor, val: &str); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &GpuExternalTextureDescriptor, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuExternalTextureDescriptor { @@ -37,13 +41,7 @@ impl GpuExternalTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,14 +52,7 @@ impl GpuExternalTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn source(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 4b2fe1e5080..e39fe9e57cb 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuFragmentState; + #[wasm_bindgen(method, setter = "entryPoint")] + fn entry_point_shim(this: &GpuFragmentState, val: &str); + #[cfg(feature = "GpuShaderModule")] + #[wasm_bindgen(method, setter = "module")] + fn module_shim(this: &GpuFragmentState, val: &GpuShaderModule); + #[wasm_bindgen(method, setter = "targets")] + fn targets_shim(this: &GpuFragmentState, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuFragmentState { @@ -39,17 +46,7 @@ impl GpuFragmentState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entry_point(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryPoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_point_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -61,14 +58,7 @@ impl GpuFragmentState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("module"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.module_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +69,7 @@ impl GpuFragmentState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn targets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("targets"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.targets_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs b/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs index 20ca5f341fe..fdfcc69a438 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyBuffer; + #[wasm_bindgen(method, setter = "bytesPerRow")] + fn bytes_per_row_shim(this: &GpuImageCopyBuffer, val: u32); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &GpuImageCopyBuffer, val: f64); + #[wasm_bindgen(method, setter = "rowsPerImage")] + fn rows_per_image_shim(this: &GpuImageCopyBuffer, val: u32); + #[cfg(feature = "GpuBuffer")] + #[wasm_bindgen(method, setter = "buffer")] + fn buffer_shim(this: &GpuImageCopyBuffer, val: &GpuBuffer); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyBuffer { @@ -38,17 +47,7 @@ impl GpuImageCopyBuffer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_per_row(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesPerRow"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_per_row_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,14 +58,7 @@ impl GpuImageCopyBuffer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +69,7 @@ impl GpuImageCopyBuffer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn rows_per_image(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rowsPerImage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rows_per_image_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,14 +81,7 @@ impl GpuImageCopyBuffer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn buffer(&mut self, val: &GpuBuffer) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs index acd0d531718..54c22ac9306 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyExternalImage; + #[wasm_bindgen(method, setter = "flipY")] + fn flip_y_shim(this: &GpuImageCopyExternalImage, val: bool); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &GpuImageCopyExternalImage, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &GpuImageCopyExternalImage, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyExternalImage { @@ -37,13 +43,7 @@ impl GpuImageCopyExternalImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn flip_y(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flipY"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flip_y_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,14 +54,7 @@ impl GpuImageCopyExternalImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -72,14 +65,7 @@ impl GpuImageCopyExternalImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn source(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs b/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs index 4b727effa12..c461d41a126 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyTexture; + #[cfg(feature = "GpuTextureAspect")] + #[wasm_bindgen(method, setter = "aspect")] + fn aspect_shim(this: &GpuImageCopyTexture, val: GpuTextureAspect); + #[wasm_bindgen(method, setter = "mipLevel")] + fn mip_level_shim(this: &GpuImageCopyTexture, val: u32); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &GpuImageCopyTexture, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuTexture")] + #[wasm_bindgen(method, setter = "texture")] + fn texture_shim(this: &GpuImageCopyTexture, val: &GpuTexture); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyTexture { @@ -39,14 +49,7 @@ impl GpuImageCopyTexture { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("aspect"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.aspect_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +60,7 @@ impl GpuImageCopyTexture { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mip_level(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mipLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mip_level_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,14 +71,7 @@ impl GpuImageCopyTexture { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +83,7 @@ impl GpuImageCopyTexture { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn texture(&mut self, val: &GpuTexture) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("texture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.texture_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs index 64d38a7c270..554f63396d4 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyTextureTagged; + #[cfg(feature = "GpuTextureAspect")] + #[wasm_bindgen(method, setter = "aspect")] + fn aspect_shim(this: &GpuImageCopyTextureTagged, val: GpuTextureAspect); + #[wasm_bindgen(method, setter = "mipLevel")] + fn mip_level_shim(this: &GpuImageCopyTextureTagged, val: u32); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &GpuImageCopyTextureTagged, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuTexture")] + #[wasm_bindgen(method, setter = "texture")] + fn texture_shim(this: &GpuImageCopyTextureTagged, val: &GpuTexture); + #[wasm_bindgen(method, setter = "premultipliedAlpha")] + fn premultiplied_alpha_shim(this: &GpuImageCopyTextureTagged, val: bool); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyTextureTagged { @@ -39,14 +51,7 @@ impl GpuImageCopyTextureTagged { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("aspect"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.aspect_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +62,7 @@ impl GpuImageCopyTextureTagged { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mip_level(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mipLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mip_level_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,14 +73,7 @@ impl GpuImageCopyTextureTagged { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +85,7 @@ impl GpuImageCopyTextureTagged { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn texture(&mut self, val: &GpuTexture) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("texture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.texture_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -118,17 +96,7 @@ impl GpuImageCopyTextureTagged { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("premultipliedAlpha"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.premultiplied_alpha_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs b/crates/web-sys/src/features/gen_GpuImageDataLayout.rs index 25895ed4ea3..cb267577615 100644 --- a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs +++ b/crates/web-sys/src/features/gen_GpuImageDataLayout.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageDataLayout; + #[wasm_bindgen(method, setter = "bytesPerRow")] + fn bytes_per_row_shim(this: &GpuImageDataLayout, val: u32); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &GpuImageDataLayout, val: f64); + #[wasm_bindgen(method, setter = "rowsPerImage")] + fn rows_per_image_shim(this: &GpuImageDataLayout, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuImageDataLayout { @@ -36,17 +42,7 @@ impl GpuImageDataLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_per_row(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesPerRow"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_per_row_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,14 +53,7 @@ impl GpuImageDataLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +64,7 @@ impl GpuImageDataLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn rows_per_image(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rowsPerImage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rows_per_image_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuMultisampleState.rs b/crates/web-sys/src/features/gen_GpuMultisampleState.rs index e9bf783dbfb..af9b5e2e8ec 100644 --- a/crates/web-sys/src/features/gen_GpuMultisampleState.rs +++ b/crates/web-sys/src/features/gen_GpuMultisampleState.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuMultisampleState; + #[wasm_bindgen(method, setter = "alphaToCoverageEnabled")] + fn alpha_to_coverage_enabled_shim(this: &GpuMultisampleState, val: bool); + #[wasm_bindgen(method, setter = "count")] + fn count_shim(this: &GpuMultisampleState, val: u32); + #[wasm_bindgen(method, setter = "mask")] + fn mask_shim(this: &GpuMultisampleState, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuMultisampleState { @@ -36,17 +42,7 @@ impl GpuMultisampleState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha_to_coverage_enabled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("alphaToCoverageEnabled"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_to_coverage_enabled_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +53,7 @@ impl GpuMultisampleState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("count"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,13 +64,7 @@ impl GpuMultisampleState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mask(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mask"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs index 5757b09e917..147e49b806a 100644 --- a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuObjectDescriptorBase; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuObjectDescriptorBase, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuObjectDescriptorBase { @@ -36,13 +38,7 @@ impl GpuObjectDescriptorBase { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs b/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs index 17076b5e186..da5d620d658 100644 --- a/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs +++ b/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOrigin2dDict; + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &GpuOrigin2dDict, val: u32); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &GpuOrigin2dDict, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuOrigin2dDict { @@ -36,13 +40,7 @@ impl GpuOrigin2dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn x(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,13 +51,7 @@ impl GpuOrigin2dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn y(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs b/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs index 046991140b8..ddca14f3aae 100644 --- a/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOrigin3dDict; + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &GpuOrigin3dDict, val: u32); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &GpuOrigin3dDict, val: u32); + #[wasm_bindgen(method, setter = "z")] + fn z_shim(this: &GpuOrigin3dDict, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuOrigin3dDict { @@ -36,13 +42,7 @@ impl GpuOrigin3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn x(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,13 +53,7 @@ impl GpuOrigin3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn y(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -70,13 +64,7 @@ impl GpuOrigin3dDict { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn z(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("z"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.z_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs index 6b09d65430f..8f94167a0c2 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineDescriptorBase; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuPipelineDescriptorBase, val: &str); + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &GpuPipelineDescriptorBase, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineDescriptorBase { @@ -37,13 +41,7 @@ impl GpuPipelineDescriptorBase { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,14 +52,7 @@ impl GpuPipelineDescriptorBase { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs index d56b6c4b4bf..4153f498d14 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineErrorInit; + #[cfg(feature = "GpuPipelineErrorReason")] + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &GpuPipelineErrorInit, val: GpuPipelineErrorReason); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineErrorInit { @@ -39,14 +42,7 @@ impl GpuPipelineErrorInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn reason(&mut self, val: GpuPipelineErrorReason) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs index 40fd2d3e603..a1113b81f2f 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineLayoutDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuPipelineLayoutDescriptor, val: &str); + #[wasm_bindgen(method, setter = "bindGroupLayouts")] + fn bind_group_layouts_shim(this: &GpuPipelineLayoutDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineLayoutDescriptor { @@ -37,13 +41,7 @@ impl GpuPipelineLayoutDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +52,7 @@ impl GpuPipelineLayoutDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bind_group_layouts(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bindGroupLayouts"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bind_group_layouts_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs index a7e63b3cc37..1c2c627c22a 100644 --- a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs +++ b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs @@ -14,6 +14,20 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPrimitiveState; + #[cfg(feature = "GpuCullMode")] + #[wasm_bindgen(method, setter = "cullMode")] + fn cull_mode_shim(this: &GpuPrimitiveState, val: GpuCullMode); + #[cfg(feature = "GpuFrontFace")] + #[wasm_bindgen(method, setter = "frontFace")] + fn front_face_shim(this: &GpuPrimitiveState, val: GpuFrontFace); + #[cfg(feature = "GpuIndexFormat")] + #[wasm_bindgen(method, setter = "stripIndexFormat")] + fn strip_index_format_shim(this: &GpuPrimitiveState, val: GpuIndexFormat); + #[cfg(feature = "GpuPrimitiveTopology")] + #[wasm_bindgen(method, setter = "topology")] + fn topology_shim(this: &GpuPrimitiveState, val: GpuPrimitiveTopology); + #[wasm_bindgen(method, setter = "unclippedDepth")] + fn unclipped_depth_shim(this: &GpuPrimitiveState, val: bool); } #[cfg(web_sys_unstable_apis)] impl GpuPrimitiveState { @@ -37,17 +51,7 @@ impl GpuPrimitiveState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cull_mode(&mut self, val: GpuCullMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cullMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cull_mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +63,7 @@ impl GpuPrimitiveState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn front_face(&mut self, val: GpuFrontFace) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frontFace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.front_face_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +75,7 @@ impl GpuPrimitiveState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn strip_index_format(&mut self, val: GpuIndexFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stripIndexFormat"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.strip_index_format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -103,17 +87,7 @@ impl GpuPrimitiveState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn topology(&mut self, val: GpuPrimitiveTopology) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("topology"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.topology_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -124,17 +98,7 @@ impl GpuPrimitiveState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unclipped_depth(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unclippedDepth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unclipped_depth_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index 7934d6afdc1..2cce8beb098 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuProgrammableStage; + #[wasm_bindgen(method, setter = "entryPoint")] + fn entry_point_shim(this: &GpuProgrammableStage, val: &str); + #[cfg(feature = "GpuShaderModule")] + #[wasm_bindgen(method, setter = "module")] + fn module_shim(this: &GpuProgrammableStage, val: &GpuShaderModule); } #[cfg(web_sys_unstable_apis)] impl GpuProgrammableStage { @@ -38,17 +43,7 @@ impl GpuProgrammableStage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entry_point(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryPoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_point_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,14 +55,7 @@ impl GpuProgrammableStage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("module"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.module_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs index 7dcddb12d6e..5fab281c1c3 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuQuerySetDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuQuerySetDescriptor, val: &str); + #[wasm_bindgen(method, setter = "count")] + fn count_shim(this: &GpuQuerySetDescriptor, val: u32); + #[cfg(feature = "GpuQueryType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &GpuQuerySetDescriptor, val: GpuQueryType); } #[cfg(web_sys_unstable_apis)] impl GpuQuerySetDescriptor { @@ -39,13 +46,7 @@ impl GpuQuerySetDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,13 +57,7 @@ impl GpuQuerySetDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("count"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,13 +69,7 @@ impl GpuQuerySetDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: GpuQueryType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs index 8f4412ccfde..e96c645e2bd 100644 --- a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuQueueDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuQueueDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuQueueDescriptor { @@ -36,13 +38,7 @@ impl GpuQueueDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs index df29fdacca4..3100a8cda05 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderBundleDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuRenderBundleDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuRenderBundleDescriptor { @@ -36,13 +38,7 @@ impl GpuRenderBundleDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs index c7857f88baa..82d76b71a56 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs @@ -14,6 +14,19 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderBundleEncoderDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuRenderBundleEncoderDescriptor, val: &str); + #[wasm_bindgen(method, setter = "colorFormats")] + fn color_formats_shim(this: &GpuRenderBundleEncoderDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "depthStencilFormat")] + fn depth_stencil_format_shim(this: &GpuRenderBundleEncoderDescriptor, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "sampleCount")] + fn sample_count_shim(this: &GpuRenderBundleEncoderDescriptor, val: u32); + #[wasm_bindgen(method, setter = "depthReadOnly")] + fn depth_read_only_shim(this: &GpuRenderBundleEncoderDescriptor, val: bool); + #[wasm_bindgen(method, setter = "stencilReadOnly")] + fn stencil_read_only_shim(this: &GpuRenderBundleEncoderDescriptor, val: bool); } #[cfg(web_sys_unstable_apis)] impl GpuRenderBundleEncoderDescriptor { @@ -37,13 +50,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +61,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorFormats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_formats_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,17 +73,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthStencilFormat"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_stencil_format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +84,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -118,17 +95,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_read_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthReadOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_read_only_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -139,17 +106,7 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_read_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilReadOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_read_only_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index 513ba98d251..d0506938272 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -14,6 +14,22 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassColorAttachment; + #[wasm_bindgen(method, setter = "clearValue")] + fn clear_value_shim(this: &GpuRenderPassColorAttachment, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "depthSlice")] + fn depth_slice_shim(this: &GpuRenderPassColorAttachment, val: u32); + #[cfg(feature = "GpuLoadOp")] + #[wasm_bindgen(method, setter = "loadOp")] + fn load_op_shim(this: &GpuRenderPassColorAttachment, val: GpuLoadOp); + #[cfg(feature = "GpuTextureView")] + #[wasm_bindgen(method, setter = "resolveTarget")] + fn resolve_target_shim(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); + #[cfg(feature = "GpuStoreOp")] + #[wasm_bindgen(method, setter = "storeOp")] + fn store_op_shim(this: &GpuRenderPassColorAttachment, val: GpuStoreOp); + #[cfg(feature = "GpuTextureView")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassColorAttachment { @@ -44,17 +60,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn clear_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clearValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clear_value_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -65,17 +71,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_slice(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthSlice"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_slice_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -87,14 +83,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn load_op(&mut self, val: GpuLoadOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loadOp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.load_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -106,17 +95,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn resolve_target(&mut self, val: &GpuTextureView) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resolveTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resolve_target_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -128,17 +107,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn store_op(&mut self, val: GpuStoreOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("storeOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.store_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -150,13 +119,7 @@ impl GpuRenderPassColorAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view(&mut self, val: &GpuTextureView) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs index f08e15ee644..86f32e884fc 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs @@ -14,6 +14,29 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassDepthStencilAttachment; + #[wasm_bindgen(method, setter = "depthClearValue")] + fn depth_clear_value_shim(this: &GpuRenderPassDepthStencilAttachment, val: f32); + #[cfg(feature = "GpuLoadOp")] + #[wasm_bindgen(method, setter = "depthLoadOp")] + fn depth_load_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); + #[wasm_bindgen(method, setter = "depthReadOnly")] + fn depth_read_only_shim(this: &GpuRenderPassDepthStencilAttachment, val: bool); + #[cfg(feature = "GpuStoreOp")] + #[wasm_bindgen(method, setter = "depthStoreOp")] + fn depth_store_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); + #[wasm_bindgen(method, setter = "stencilClearValue")] + fn stencil_clear_value_shim(this: &GpuRenderPassDepthStencilAttachment, val: u32); + #[cfg(feature = "GpuLoadOp")] + #[wasm_bindgen(method, setter = "stencilLoadOp")] + fn stencil_load_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); + #[wasm_bindgen(method, setter = "stencilReadOnly")] + fn stencil_read_only_shim(this: &GpuRenderPassDepthStencilAttachment, val: bool); + #[cfg(feature = "GpuStoreOp")] + #[wasm_bindgen(method, setter = "stencilStoreOp")] + fn stencil_store_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); + #[cfg(feature = "GpuTextureView")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &GpuRenderPassDepthStencilAttachment, val: &GpuTextureView); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassDepthStencilAttachment { @@ -38,17 +61,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_clear_value(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthClearValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_clear_value_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,17 +73,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_load_op(&mut self, val: GpuLoadOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthLoadOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_load_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +84,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_read_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthReadOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_read_only_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -103,17 +96,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_store_op(&mut self, val: GpuStoreOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthStoreOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_store_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -124,17 +107,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_clear_value(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilClearValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_clear_value_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -146,17 +119,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_load_op(&mut self, val: GpuLoadOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilLoadOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_load_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -167,17 +130,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_read_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilReadOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_read_only_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -189,17 +142,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil_store_op(&mut self, val: GpuStoreOp) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencilStoreOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_store_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -211,13 +154,7 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view(&mut self, val: &GpuTextureView) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 260f7fdaf2e..7ba69a91ec3 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -14,6 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuRenderPassDescriptor, val: &str); + #[wasm_bindgen(method, setter = "colorAttachments")] + fn color_attachments_shim(this: &GpuRenderPassDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuRenderPassDepthStencilAttachment")] + #[wasm_bindgen(method, setter = "depthStencilAttachment")] + fn depth_stencil_attachment_shim( + this: &GpuRenderPassDescriptor, + val: &GpuRenderPassDepthStencilAttachment, + ); + #[wasm_bindgen(method, setter = "maxDrawCount")] + fn max_draw_count_shim(this: &GpuRenderPassDescriptor, val: f64); + #[cfg(feature = "GpuQuerySet")] + #[wasm_bindgen(method, setter = "occlusionQuerySet")] + fn occlusion_query_set_shim(this: &GpuRenderPassDescriptor, val: &GpuQuerySet); + #[cfg(feature = "GpuRenderPassTimestampWrites")] + #[wasm_bindgen(method, setter = "timestampWrites")] + fn timestamp_writes_shim(this: &GpuRenderPassDescriptor, val: &GpuRenderPassTimestampWrites); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassDescriptor { @@ -37,13 +55,7 @@ impl GpuRenderPassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +66,7 @@ impl GpuRenderPassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_attachments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorAttachments"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_attachments_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +81,7 @@ impl GpuRenderPassDescriptor { &mut self, val: &GpuRenderPassDepthStencilAttachment, ) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthStencilAttachment"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_stencil_attachment_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,17 +92,7 @@ impl GpuRenderPassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_draw_count(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxDrawCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_draw_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -122,17 +104,7 @@ impl GpuRenderPassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn occlusion_query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("occlusionQuerySet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.occlusion_query_set_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -144,17 +116,7 @@ impl GpuRenderPassDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp_writes(&mut self, val: &GpuRenderPassTimestampWrites) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestampWrites"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_writes_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs index b056eb51cbf..8ae5c2d3616 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassLayout; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuRenderPassLayout, val: &str); + #[wasm_bindgen(method, setter = "colorFormats")] + fn color_formats_shim(this: &GpuRenderPassLayout, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "depthStencilFormat")] + fn depth_stencil_format_shim(this: &GpuRenderPassLayout, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "sampleCount")] + fn sample_count_shim(this: &GpuRenderPassLayout, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassLayout { @@ -37,13 +46,7 @@ impl GpuRenderPassLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +57,7 @@ impl GpuRenderPassLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorFormats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_formats_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,17 +69,7 @@ impl GpuRenderPassLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthStencilFormat"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_stencil_format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +80,7 @@ impl GpuRenderPassLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_count_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs index 4d72aa93b28..3a97f58b8c7 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassTimestampWrites; + #[wasm_bindgen(method, setter = "beginningOfPassWriteIndex")] + fn beginning_of_pass_write_index_shim(this: &GpuRenderPassTimestampWrites, val: u32); + #[wasm_bindgen(method, setter = "endOfPassWriteIndex")] + fn end_of_pass_write_index_shim(this: &GpuRenderPassTimestampWrites, val: u32); + #[cfg(feature = "GpuQuerySet")] + #[wasm_bindgen(method, setter = "querySet")] + fn query_set_shim(this: &GpuRenderPassTimestampWrites, val: &GpuQuerySet); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassTimestampWrites { @@ -38,17 +45,7 @@ impl GpuRenderPassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn beginning_of_pass_write_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("beginningOfPassWriteIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.beginning_of_pass_write_index_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +56,7 @@ impl GpuRenderPassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn end_of_pass_write_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endOfPassWriteIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_of_pass_write_index_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +68,7 @@ impl GpuRenderPassTimestampWrites { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("querySet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.query_set_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs index 13f705a5b28..02dc5eec076 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs @@ -14,6 +14,25 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPipelineDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuRenderPipelineDescriptor, val: &str); + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &GpuRenderPipelineDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuDepthStencilState")] + #[wasm_bindgen(method, setter = "depthStencil")] + fn depth_stencil_shim(this: &GpuRenderPipelineDescriptor, val: &GpuDepthStencilState); + #[cfg(feature = "GpuFragmentState")] + #[wasm_bindgen(method, setter = "fragment")] + fn fragment_shim(this: &GpuRenderPipelineDescriptor, val: &GpuFragmentState); + #[cfg(feature = "GpuMultisampleState")] + #[wasm_bindgen(method, setter = "multisample")] + fn multisample_shim(this: &GpuRenderPipelineDescriptor, val: &GpuMultisampleState); + #[cfg(feature = "GpuPrimitiveState")] + #[wasm_bindgen(method, setter = "primitive")] + fn primitive_shim(this: &GpuRenderPipelineDescriptor, val: &GpuPrimitiveState); + #[cfg(feature = "GpuVertexState")] + #[wasm_bindgen(method, setter = "vertex")] + fn vertex_shim(this: &GpuRenderPipelineDescriptor, val: &GpuVertexState); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPipelineDescriptor { @@ -39,13 +58,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,14 +69,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +81,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_stencil(&mut self, val: &GpuDepthStencilState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthStencil"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_stencil_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +93,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn fragment(&mut self, val: &GpuFragmentState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fragment"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fragment_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -119,17 +105,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn multisample(&mut self, val: &GpuMultisampleState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("multisample"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.multisample_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +117,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn primitive(&mut self, val: &GpuPrimitiveState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("primitive"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.primitive_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -163,14 +129,7 @@ impl GpuRenderPipelineDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn vertex(&mut self, val: &GpuVertexState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("vertex"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.vertex_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index 843122598e4..084385ffb36 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRequestAdapterOptions; + #[wasm_bindgen(method, setter = "forceFallbackAdapter")] + fn force_fallback_adapter_shim(this: &GpuRequestAdapterOptions, val: bool); + #[cfg(feature = "GpuPowerPreference")] + #[wasm_bindgen(method, setter = "powerPreference")] + fn power_preference_shim(this: &GpuRequestAdapterOptions, val: GpuPowerPreference); } #[cfg(web_sys_unstable_apis)] impl GpuRequestAdapterOptions { @@ -36,17 +41,7 @@ impl GpuRequestAdapterOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn force_fallback_adapter(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("forceFallbackAdapter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.force_fallback_adapter_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +53,7 @@ impl GpuRequestAdapterOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn power_preference(&mut self, val: GpuPowerPreference) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("powerPreference"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.power_preference_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs b/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs index 3112b75339a..87da31c0180 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuSamplerBindingLayout; + #[cfg(feature = "GpuSamplerBindingType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &GpuSamplerBindingLayout, val: GpuSamplerBindingType); } #[cfg(web_sys_unstable_apis)] impl GpuSamplerBindingLayout { @@ -37,13 +40,7 @@ impl GpuSamplerBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: GpuSamplerBindingType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs index 5ac008aee95..eecc6c14c96 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs @@ -14,6 +14,35 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuSamplerDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuSamplerDescriptor, val: &str); + #[cfg(feature = "GpuAddressMode")] + #[wasm_bindgen(method, setter = "addressModeU")] + fn address_mode_u_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(feature = "GpuAddressMode")] + #[wasm_bindgen(method, setter = "addressModeV")] + fn address_mode_v_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(feature = "GpuAddressMode")] + #[wasm_bindgen(method, setter = "addressModeW")] + fn address_mode_w_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(feature = "GpuCompareFunction")] + #[wasm_bindgen(method, setter = "compare")] + fn compare_shim(this: &GpuSamplerDescriptor, val: GpuCompareFunction); + #[wasm_bindgen(method, setter = "lodMaxClamp")] + fn lod_max_clamp_shim(this: &GpuSamplerDescriptor, val: f32); + #[wasm_bindgen(method, setter = "lodMinClamp")] + fn lod_min_clamp_shim(this: &GpuSamplerDescriptor, val: f32); + #[cfg(feature = "GpuFilterMode")] + #[wasm_bindgen(method, setter = "magFilter")] + fn mag_filter_shim(this: &GpuSamplerDescriptor, val: GpuFilterMode); + #[wasm_bindgen(method, setter = "maxAnisotropy")] + fn max_anisotropy_shim(this: &GpuSamplerDescriptor, val: u16); + #[cfg(feature = "GpuFilterMode")] + #[wasm_bindgen(method, setter = "minFilter")] + fn min_filter_shim(this: &GpuSamplerDescriptor, val: GpuFilterMode); + #[cfg(feature = "GpuMipmapFilterMode")] + #[wasm_bindgen(method, setter = "mipmapFilter")] + fn mipmap_filter_shim(this: &GpuSamplerDescriptor, val: GpuMipmapFilterMode); } #[cfg(web_sys_unstable_apis)] impl GpuSamplerDescriptor { @@ -36,13 +65,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +77,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn address_mode_u(&mut self, val: GpuAddressMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addressModeU"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_mode_u_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,17 +89,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn address_mode_v(&mut self, val: GpuAddressMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addressModeV"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_mode_v_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +101,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn address_mode_w(&mut self, val: GpuAddressMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addressModeW"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_mode_w_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -120,17 +113,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn compare(&mut self, val: GpuCompareFunction) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("compare"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.compare_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +124,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn lod_max_clamp(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lodMaxClamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lod_max_clamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -162,17 +135,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn lod_min_clamp(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lodMinClamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lod_min_clamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -184,17 +147,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mag_filter(&mut self, val: GpuFilterMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("magFilter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mag_filter_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -205,17 +158,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_anisotropy(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxAnisotropy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_anisotropy_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -227,17 +170,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn min_filter(&mut self, val: GpuFilterMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("minFilter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_filter_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -249,17 +182,7 @@ impl GpuSamplerDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mipmap_filter(&mut self, val: GpuMipmapFilterMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mipmapFilter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mipmap_filter_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index 1793d68dcbf..872f504ce07 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuShaderModuleCompilationHint; + #[wasm_bindgen(method, setter = "entryPoint")] + fn entry_point_shim(this: &GpuShaderModuleCompilationHint, val: &str); + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &GpuShaderModuleCompilationHint, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuShaderModuleCompilationHint { @@ -37,17 +41,7 @@ impl GpuShaderModuleCompilationHint { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entry_point(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryPoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_point_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,14 +52,7 @@ impl GpuShaderModuleCompilationHint { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index 74255136180..f8ed57202ac 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuShaderModuleDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuShaderModuleDescriptor, val: &str); + #[wasm_bindgen(method, setter = "code")] + fn code_shim(this: &GpuShaderModuleDescriptor, val: &str); + #[wasm_bindgen(method, setter = "compilationHints")] + fn compilation_hints_shim(this: &GpuShaderModuleDescriptor, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "sourceMap")] + fn source_map_shim(this: &GpuShaderModuleDescriptor, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuShaderModuleDescriptor { @@ -37,13 +45,7 @@ impl GpuShaderModuleDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,13 +56,7 @@ impl GpuShaderModuleDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn code(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("code"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.code_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -71,17 +67,7 @@ impl GpuShaderModuleDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("compilationHints"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.compilation_hints_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -92,17 +78,7 @@ impl GpuShaderModuleDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn source_map(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sourceMap"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_map_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuStencilFaceState.rs b/crates/web-sys/src/features/gen_GpuStencilFaceState.rs index 4c4eebc4704..aa72d7b9431 100644 --- a/crates/web-sys/src/features/gen_GpuStencilFaceState.rs +++ b/crates/web-sys/src/features/gen_GpuStencilFaceState.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuStencilFaceState; + #[cfg(feature = "GpuCompareFunction")] + #[wasm_bindgen(method, setter = "compare")] + fn compare_shim(this: &GpuStencilFaceState, val: GpuCompareFunction); + #[cfg(feature = "GpuStencilOperation")] + #[wasm_bindgen(method, setter = "depthFailOp")] + fn depth_fail_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); + #[cfg(feature = "GpuStencilOperation")] + #[wasm_bindgen(method, setter = "failOp")] + fn fail_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); + #[cfg(feature = "GpuStencilOperation")] + #[wasm_bindgen(method, setter = "passOp")] + fn pass_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); } #[cfg(web_sys_unstable_apis)] impl GpuStencilFaceState { @@ -37,17 +49,7 @@ impl GpuStencilFaceState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn compare(&mut self, val: GpuCompareFunction) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("compare"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.compare_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +61,7 @@ impl GpuStencilFaceState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_fail_op(&mut self, val: GpuStencilOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthFailOp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_fail_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,14 +73,7 @@ impl GpuStencilFaceState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn fail_op(&mut self, val: GpuStencilOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("failOp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fail_op_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,14 +85,7 @@ impl GpuStencilFaceState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pass_op(&mut self, val: GpuStencilOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("passOp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pass_op_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs index 1d3f5ff145a..36adc75a02f 100644 --- a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuStorageTextureBindingLayout; + #[cfg(feature = "GpuStorageTextureAccess")] + #[wasm_bindgen(method, setter = "access")] + fn access_shim(this: &GpuStorageTextureBindingLayout, val: GpuStorageTextureAccess); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuStorageTextureBindingLayout, val: GpuTextureFormat); + #[cfg(feature = "GpuTextureViewDimension")] + #[wasm_bindgen(method, setter = "viewDimension")] + fn view_dimension_shim(this: &GpuStorageTextureBindingLayout, val: GpuTextureViewDimension); } #[cfg(web_sys_unstable_apis)] impl GpuStorageTextureBindingLayout { @@ -39,14 +48,7 @@ impl GpuStorageTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn access(&mut self, val: GpuStorageTextureAccess) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("access"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.access_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,14 +60,7 @@ impl GpuStorageTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +72,7 @@ impl GpuStorageTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewDimension"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_dimension_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs b/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs index 65551e9ac13..ccd9bfc620c 100644 --- a/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureBindingLayout; + #[wasm_bindgen(method, setter = "multisampled")] + fn multisampled_shim(this: &GpuTextureBindingLayout, val: bool); + #[cfg(feature = "GpuTextureSampleType")] + #[wasm_bindgen(method, setter = "sampleType")] + fn sample_type_shim(this: &GpuTextureBindingLayout, val: GpuTextureSampleType); + #[cfg(feature = "GpuTextureViewDimension")] + #[wasm_bindgen(method, setter = "viewDimension")] + fn view_dimension_shim(this: &GpuTextureBindingLayout, val: GpuTextureViewDimension); } #[cfg(web_sys_unstable_apis)] impl GpuTextureBindingLayout { @@ -36,17 +44,7 @@ impl GpuTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn multisampled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("multisampled"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.multisampled_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +56,7 @@ impl GpuTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_type(&mut self, val: GpuTextureSampleType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_type_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +68,7 @@ impl GpuTextureBindingLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewDimension"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_dimension_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs index f7cb4f66849..b79eccc02d3 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs @@ -14,6 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuTextureDescriptor, val: &str); + #[cfg(feature = "GpuTextureDimension")] + #[wasm_bindgen(method, setter = "dimension")] + fn dimension_shim(this: &GpuTextureDescriptor, val: GpuTextureDimension); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuTextureDescriptor, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "mipLevelCount")] + fn mip_level_count_shim(this: &GpuTextureDescriptor, val: u32); + #[wasm_bindgen(method, setter = "sampleCount")] + fn sample_count_shim(this: &GpuTextureDescriptor, val: u32); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &GpuTextureDescriptor, val: u32); + #[wasm_bindgen(method, setter = "viewFormats")] + fn view_formats_shim(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuTextureDescriptor { @@ -40,13 +58,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +70,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn dimension(&mut self, val: GpuTextureDimension) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dimension"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dimension_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,14 +82,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +93,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mip_level_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mipLevelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mip_level_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -119,17 +104,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sample_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -140,13 +115,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn size(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -157,13 +126,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -174,17 +137,7 @@ impl GpuTextureDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewFormats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_formats_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs index 30b8fc31c76..e6b85aacd3f 100644 --- a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs @@ -14,6 +14,25 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureViewDescriptor; + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &GpuTextureViewDescriptor, val: &str); + #[wasm_bindgen(method, setter = "arrayLayerCount")] + fn array_layer_count_shim(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(feature = "GpuTextureAspect")] + #[wasm_bindgen(method, setter = "aspect")] + fn aspect_shim(this: &GpuTextureViewDescriptor, val: GpuTextureAspect); + #[wasm_bindgen(method, setter = "baseArrayLayer")] + fn base_array_layer_shim(this: &GpuTextureViewDescriptor, val: u32); + #[wasm_bindgen(method, setter = "baseMipLevel")] + fn base_mip_level_shim(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(feature = "GpuTextureViewDimension")] + #[wasm_bindgen(method, setter = "dimension")] + fn dimension_shim(this: &GpuTextureViewDescriptor, val: GpuTextureViewDimension); + #[cfg(feature = "GpuTextureFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuTextureViewDescriptor, val: GpuTextureFormat); + #[wasm_bindgen(method, setter = "mipLevelCount")] + fn mip_level_count_shim(this: &GpuTextureViewDescriptor, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuTextureViewDescriptor { @@ -36,13 +55,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,17 +66,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn array_layer_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("arrayLayerCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.array_layer_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,14 +78,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("aspect"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.aspect_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -93,17 +89,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn base_array_layer(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("baseArrayLayer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.base_array_layer_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -114,17 +100,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn base_mip_level(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("baseMipLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.base_mip_level_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -136,17 +112,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dimension"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dimension_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -158,14 +124,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -176,17 +135,7 @@ impl GpuTextureViewDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mip_level_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mipLevelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mip_level_count_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs index 8674ca879fd..276f6d2ddd5 100644 --- a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuUncapturedErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &GpuUncapturedErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &GpuUncapturedErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GpuUncapturedErrorEventInit, val: bool); + #[cfg(feature = "GpuError")] + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &GpuUncapturedErrorEventInit, val: &GpuError); } #[cfg(web_sys_unstable_apis)] impl GpuUncapturedErrorEventInit { @@ -38,17 +47,7 @@ impl GpuUncapturedErrorEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl GpuUncapturedErrorEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +69,7 @@ impl GpuUncapturedErrorEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,13 +81,7 @@ impl GpuUncapturedErrorEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn error(&mut self, val: &GpuError) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs index f70761628ac..630b6daa18f 100644 --- a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs +++ b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexAttribute; + #[cfg(feature = "GpuVertexFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &GpuVertexAttribute, val: GpuVertexFormat); + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &GpuVertexAttribute, val: f64); + #[wasm_bindgen(method, setter = "shaderLocation")] + fn shader_location_shim(this: &GpuVertexAttribute, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuVertexAttribute { @@ -41,14 +48,7 @@ impl GpuVertexAttribute { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: GpuVertexFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,14 +59,7 @@ impl GpuVertexAttribute { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn offset(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +70,7 @@ impl GpuVertexAttribute { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn shader_location(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shaderLocation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shader_location_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs index 18a3dc0f5ad..21594f7bab8 100644 --- a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs +++ b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexBufferLayout; + #[wasm_bindgen(method, setter = "arrayStride")] + fn array_stride_shim(this: &GpuVertexBufferLayout, val: f64); + #[wasm_bindgen(method, setter = "attributes")] + fn attributes_shim(this: &GpuVertexBufferLayout, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "GpuVertexStepMode")] + #[wasm_bindgen(method, setter = "stepMode")] + fn step_mode_shim(this: &GpuVertexBufferLayout, val: GpuVertexStepMode); } #[cfg(web_sys_unstable_apis)] impl GpuVertexBufferLayout { @@ -38,17 +45,7 @@ impl GpuVertexBufferLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn array_stride(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("arrayStride"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.array_stride_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +56,7 @@ impl GpuVertexBufferLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn attributes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attributes_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +68,7 @@ impl GpuVertexBufferLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn step_mode(&mut self, val: GpuVertexStepMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stepMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.step_mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index aa0259bd31d..6b841d11fdf 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexState; + #[wasm_bindgen(method, setter = "entryPoint")] + fn entry_point_shim(this: &GpuVertexState, val: &str); + #[cfg(feature = "GpuShaderModule")] + #[wasm_bindgen(method, setter = "module")] + fn module_shim(this: &GpuVertexState, val: &GpuShaderModule); + #[wasm_bindgen(method, setter = "buffers")] + fn buffers_shim(this: &GpuVertexState, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuVertexState { @@ -38,17 +45,7 @@ impl GpuVertexState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn entry_point(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryPoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_point_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,14 +57,7 @@ impl GpuVertexState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("module"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.module_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +68,7 @@ impl GpuVertexState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn buffers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buffers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffers_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs b/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs index b543871515e..73528f6bc37 100644 --- a/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs +++ b/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] pub type GroupedHistoryEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &GroupedHistoryEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &GroupedHistoryEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &GroupedHistoryEventInit, val: bool); + #[cfg(feature = "Element")] + #[wasm_bindgen(method, setter = "otherBrowser")] + fn other_browser_shim(this: &GroupedHistoryEventInit, val: Option<&Element>); } impl GroupedHistoryEventInit { #[doc = "Construct a new `GroupedHistoryEventInit`."] @@ -24,51 +33,21 @@ impl GroupedHistoryEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Element")] @@ -76,17 +55,7 @@ impl GroupedHistoryEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `GroupedHistoryEventInit`*"] pub fn other_browser(&mut self, val: Option<&Element>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("otherBrowser"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.other_browser_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs b/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs index e3c566c2b98..56caf74fac2 100644 --- a/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs +++ b/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] pub type HalfOpenInfoDict; + #[wasm_bindgen(method, setter = "speculative")] + fn speculative_shim(this: &HalfOpenInfoDict, val: bool); } impl HalfOpenInfoDict { #[doc = "Construct a new `HalfOpenInfoDict`."] @@ -24,17 +26,7 @@ impl HalfOpenInfoDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] pub fn speculative(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("speculative"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.speculative_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HashChangeEventInit.rs b/crates/web-sys/src/features/gen_HashChangeEventInit.rs index 879339a1321..784fbfc5dee 100644 --- a/crates/web-sys/src/features/gen_HashChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_HashChangeEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub type HashChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &HashChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &HashChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &HashChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "newURL")] + fn new_url_shim(this: &HashChangeEventInit, val: &str); + #[wasm_bindgen(method, setter = "oldURL")] + fn old_url_shim(this: &HashChangeEventInit, val: &str); } impl HashChangeEventInit { #[doc = "Construct a new `HashChangeEventInit`."] @@ -24,79 +34,35 @@ impl HashChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `newURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub fn new_url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("newURL"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.new_url_shim(val); self } #[doc = "Change the `oldURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub fn old_url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("oldURL"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.old_url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidCollectionInfo.rs b/crates/web-sys/src/features/gen_HidCollectionInfo.rs index 5bf395ad0c2..6a99d71e18c 100644 --- a/crates/web-sys/src/features/gen_HidCollectionInfo.rs +++ b/crates/web-sys/src/features/gen_HidCollectionInfo.rs @@ -14,6 +14,20 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidCollectionInfo; + #[wasm_bindgen(method, setter = "children")] + fn children_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "featureReports")] + fn feature_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "inputReports")] + fn input_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "outputReports")] + fn output_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &HidCollectionInfo, val: u8); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &HidCollectionInfo, val: u16); + #[wasm_bindgen(method, setter = "usagePage")] + fn usage_page_shim(this: &HidCollectionInfo, val: u16); } #[cfg(web_sys_unstable_apis)] impl HidCollectionInfo { @@ -36,17 +50,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn children(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("children"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.children_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +61,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn feature_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("featureReports"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.feature_reports_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +72,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn input_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inputReports"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.input_reports_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +83,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn output_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("outputReports"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_reports_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -120,13 +94,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -137,13 +105,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -154,17 +116,7 @@ impl HidCollectionInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage_page(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usagePage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_page_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs index 5b01844210a..29201bb43b2 100644 --- a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidConnectionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &HidConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &HidConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &HidConnectionEventInit, val: bool); + #[cfg(feature = "HidDevice")] + #[wasm_bindgen(method, setter = "device")] + fn device_shim(this: &HidConnectionEventInit, val: &HidDevice); } #[cfg(web_sys_unstable_apis)] impl HidConnectionEventInit { @@ -38,17 +47,7 @@ impl HidConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl HidConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +69,7 @@ impl HidConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,14 +81,7 @@ impl HidConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device(&mut self, val: &HidDevice) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidDeviceFilter.rs b/crates/web-sys/src/features/gen_HidDeviceFilter.rs index f82a205389f..88c21dbc771 100644 --- a/crates/web-sys/src/features/gen_HidDeviceFilter.rs +++ b/crates/web-sys/src/features/gen_HidDeviceFilter.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidDeviceFilter; + #[wasm_bindgen(method, setter = "productId")] + fn product_id_shim(this: &HidDeviceFilter, val: u16); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &HidDeviceFilter, val: u16); + #[wasm_bindgen(method, setter = "usagePage")] + fn usage_page_shim(this: &HidDeviceFilter, val: u16); + #[wasm_bindgen(method, setter = "vendorId")] + fn vendor_id_shim(this: &HidDeviceFilter, val: u32); } #[cfg(web_sys_unstable_apis)] impl HidDeviceFilter { @@ -36,17 +44,7 @@ impl HidDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn product_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("productId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.product_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +55,7 @@ impl HidDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +66,7 @@ impl HidDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage_page(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usagePage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_page_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,17 +77,7 @@ impl HidDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn vendor_id(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("vendorId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.vendor_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs index 2193db4d3bb..ad2ec1f3758 100644 --- a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidDeviceRequestOptions; + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &HidDeviceRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl HidDeviceRequestOptions { @@ -37,17 +39,7 @@ impl HidDeviceRequestOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs index c31c86886c2..6defeeec352 100644 --- a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs +++ b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs @@ -14,6 +14,19 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidInputReportEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &HidInputReportEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &HidInputReportEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &HidInputReportEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &HidInputReportEventInit, val: &::js_sys::DataView); + #[cfg(feature = "HidDevice")] + #[wasm_bindgen(method, setter = "device")] + fn device_shim(this: &HidInputReportEventInit, val: &HidDevice); + #[wasm_bindgen(method, setter = "reportId")] + fn report_id_shim(this: &HidInputReportEventInit, val: u8); } #[cfg(web_sys_unstable_apis)] impl HidInputReportEventInit { @@ -40,17 +53,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -61,17 +64,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -82,17 +75,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -103,13 +86,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data(&mut self, val: &::js_sys::DataView) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -121,14 +98,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device(&mut self, val: &HidDevice) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -139,17 +109,7 @@ impl HidInputReportEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn report_id(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("reportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.report_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidReportInfo.rs b/crates/web-sys/src/features/gen_HidReportInfo.rs index d68a9a07d09..9ed35faa805 100644 --- a/crates/web-sys/src/features/gen_HidReportInfo.rs +++ b/crates/web-sys/src/features/gen_HidReportInfo.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidReportInfo; + #[wasm_bindgen(method, setter = "items")] + fn items_shim(this: &HidReportInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "reportId")] + fn report_id_shim(this: &HidReportInfo, val: u8); } #[cfg(web_sys_unstable_apis)] impl HidReportInfo { @@ -36,13 +40,7 @@ impl HidReportInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn items(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("items"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.items_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,17 +51,7 @@ impl HidReportInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn report_id(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("reportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.report_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HidReportItem.rs b/crates/web-sys/src/features/gen_HidReportItem.rs index 72c07abb771..c4d98dd12fb 100644 --- a/crates/web-sys/src/features/gen_HidReportItem.rs +++ b/crates/web-sys/src/features/gen_HidReportItem.rs @@ -14,6 +14,63 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidReportItem; + #[wasm_bindgen(method, setter = "hasNull")] + fn has_null_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "hasPreferredState")] + fn has_preferred_state_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isAbsolute")] + fn is_absolute_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isArray")] + fn is_array_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isBufferedBytes")] + fn is_buffered_bytes_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isConstant")] + fn is_constant_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isLinear")] + fn is_linear_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isRange")] + fn is_range_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "isVolatile")] + fn is_volatile_shim(this: &HidReportItem, val: bool); + #[wasm_bindgen(method, setter = "logicalMaximum")] + fn logical_maximum_shim(this: &HidReportItem, val: i32); + #[wasm_bindgen(method, setter = "logicalMinimum")] + fn logical_minimum_shim(this: &HidReportItem, val: i32); + #[wasm_bindgen(method, setter = "physicalMaximum")] + fn physical_maximum_shim(this: &HidReportItem, val: i32); + #[wasm_bindgen(method, setter = "physicalMinimum")] + fn physical_minimum_shim(this: &HidReportItem, val: i32); + #[wasm_bindgen(method, setter = "reportCount")] + fn report_count_shim(this: &HidReportItem, val: u16); + #[wasm_bindgen(method, setter = "reportSize")] + fn report_size_shim(this: &HidReportItem, val: u16); + #[wasm_bindgen(method, setter = "strings")] + fn strings_shim(this: &HidReportItem, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "unitExponent")] + fn unit_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorCurrentExponent")] + fn unit_factor_current_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorLengthExponent")] + fn unit_factor_length_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorLuminousIntensityExponent")] + fn unit_factor_luminous_intensity_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorMassExponent")] + fn unit_factor_mass_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorTemperatureExponent")] + fn unit_factor_temperature_exponent_shim(this: &HidReportItem, val: i8); + #[wasm_bindgen(method, setter = "unitFactorTimeExponent")] + fn unit_factor_time_exponent_shim(this: &HidReportItem, val: i8); + #[cfg(feature = "HidUnitSystem")] + #[wasm_bindgen(method, setter = "unitSystem")] + fn unit_system_shim(this: &HidReportItem, val: HidUnitSystem); + #[wasm_bindgen(method, setter = "usageMaximum")] + fn usage_maximum_shim(this: &HidReportItem, val: u32); + #[wasm_bindgen(method, setter = "usageMinimum")] + fn usage_minimum_shim(this: &HidReportItem, val: u32); + #[wasm_bindgen(method, setter = "usages")] + fn usages_shim(this: &HidReportItem, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "wrap")] + fn wrap_shim(this: &HidReportItem, val: bool); } #[cfg(web_sys_unstable_apis)] impl HidReportItem { @@ -36,17 +93,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn has_null(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hasNull"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.has_null_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +104,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn has_preferred_state(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hasPreferredState"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.has_preferred_state_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +115,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_absolute(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isAbsolute"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_absolute_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +126,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_array(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isArray"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_array_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -120,17 +137,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_buffered_bytes(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isBufferedBytes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_buffered_bytes_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +148,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_constant(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isConstant"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_constant_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -162,17 +159,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_linear(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isLinear"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_linear_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -183,17 +170,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_range(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isRange"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_range_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -204,17 +181,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_volatile(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isVolatile"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_volatile_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -225,17 +192,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn logical_maximum(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("logicalMaximum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.logical_maximum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -246,17 +203,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn logical_minimum(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("logicalMinimum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.logical_minimum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -267,17 +214,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn physical_maximum(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("physicalMaximum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.physical_maximum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -288,17 +225,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn physical_minimum(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("physicalMinimum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.physical_minimum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -309,17 +236,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn report_count(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("reportCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.report_count_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -330,17 +247,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn report_size(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("reportSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.report_size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -351,17 +258,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn strings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("strings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.strings_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -372,17 +269,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -393,17 +280,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_current_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorCurrentExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_current_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -414,17 +291,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_length_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorLengthExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_length_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -435,17 +302,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_luminous_intensity_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorLuminousIntensityExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_luminous_intensity_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -456,17 +313,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_mass_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorMassExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_mass_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -477,17 +324,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_temperature_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorTemperatureExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_temperature_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -498,17 +335,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_factor_time_exponent(&mut self, val: i8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitFactorTimeExponent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_factor_time_exponent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -520,17 +347,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn unit_system(&mut self, val: HidUnitSystem) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unitSystem"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unit_system_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -541,17 +358,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage_maximum(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usageMaximum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_maximum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -562,17 +369,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usage_minimum(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usageMinimum"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_minimum_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -583,14 +380,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usages(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usages"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usages_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -601,13 +391,7 @@ impl HidReportItem { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn wrap(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("wrap"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.wrap_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs b/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs index c7f692f2cba..1052c037a47 100644 --- a/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs +++ b/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] pub type HiddenPluginEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &HiddenPluginEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &HiddenPluginEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &HiddenPluginEventInit, val: bool); } impl HiddenPluginEventInit { #[doc = "Construct a new `HiddenPluginEventInit`."] @@ -24,51 +30,21 @@ impl HiddenPluginEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HitRegionOptions.rs b/crates/web-sys/src/features/gen_HitRegionOptions.rs index 8a3a3aaee64..ebbfcefeb31 100644 --- a/crates/web-sys/src/features/gen_HitRegionOptions.rs +++ b/crates/web-sys/src/features/gen_HitRegionOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] pub type HitRegionOptions; + #[cfg(feature = "Element")] + #[wasm_bindgen(method, setter = "control")] + fn control_shim(this: &HitRegionOptions, val: Option<&Element>); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &HitRegionOptions, val: &str); + #[cfg(feature = "Path2d")] + #[wasm_bindgen(method, setter = "path")] + fn path_shim(this: &HitRegionOptions, val: Option<&Path2d>); } impl HitRegionOptions { #[doc = "Construct a new `HitRegionOptions`."] @@ -25,30 +33,14 @@ impl HitRegionOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `HitRegionOptions`*"] pub fn control(&mut self, val: Option<&Element>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("control"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.control_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(feature = "Path2d")] @@ -56,13 +48,7 @@ impl HitRegionOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`, `Path2d`*"] pub fn path(&mut self, val: Option<&Path2d>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("path"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.path_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HkdfParams.rs b/crates/web-sys/src/features/gen_HkdfParams.rs index 3354ef77697..ba49af7229d 100644 --- a/crates/web-sys/src/features/gen_HkdfParams.rs +++ b/crates/web-sys/src/features/gen_HkdfParams.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub type HkdfParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &HkdfParams, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &HkdfParams, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "info")] + fn info_shim(this: &HkdfParams, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "salt")] + fn salt_shim(this: &HkdfParams, val: &::js_sys::Object); } impl HkdfParams { #[doc = "Construct a new `HkdfParams`."] @@ -33,52 +41,28 @@ impl HkdfParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } #[doc = "Change the `info` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub fn info(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("info"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.info_shim(val); self } #[doc = "Change the `salt` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub fn salt(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("salt"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.salt_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs index 49e33e0e5fd..dd912acbd23 100644 --- a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] pub type HmacDerivedKeyParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &HmacDerivedKeyParams, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &HmacDerivedKeyParams, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &HmacDerivedKeyParams, val: u32); } impl HmacDerivedKeyParams { #[doc = "Construct a new `HmacDerivedKeyParams`."] @@ -26,40 +32,21 @@ impl HmacDerivedKeyParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacImportParams.rs b/crates/web-sys/src/features/gen_HmacImportParams.rs index 750c2ae51a4..1fbc6013647 100644 --- a/crates/web-sys/src/features/gen_HmacImportParams.rs +++ b/crates/web-sys/src/features/gen_HmacImportParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] pub type HmacImportParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &HmacImportParams, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &HmacImportParams, val: &::wasm_bindgen::JsValue); } impl HmacImportParams { #[doc = "Construct a new `HmacImportParams`."] @@ -26,26 +30,14 @@ impl HmacImportParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs index 86dcaeceab9..e45ef81f604 100644 --- a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] pub type HmacKeyAlgorithm; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &HmacKeyAlgorithm, val: &str); + #[cfg(feature = "KeyAlgorithm")] + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &HmacKeyAlgorithm, val: &KeyAlgorithm); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &HmacKeyAlgorithm, val: u32); } impl HmacKeyAlgorithm { #[cfg(feature = "KeyAlgorithm")] @@ -28,13 +35,7 @@ impl HmacKeyAlgorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "KeyAlgorithm")] @@ -42,27 +43,14 @@ impl HmacKeyAlgorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"] pub fn hash(&mut self, val: &KeyAlgorithm) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs index a443aa34283..0ccceb4973a 100644 --- a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] pub type HmacKeyGenParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &HmacKeyGenParams, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &HmacKeyGenParams, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &HmacKeyGenParams, val: u32); } impl HmacKeyGenParams { #[doc = "Construct a new `HmacKeyGenParams`."] @@ -26,40 +32,21 @@ impl HmacKeyGenParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } #[doc = "Change the `length` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnDict.rs b/crates/web-sys/src/features/gen_HttpConnDict.rs index 213a86caa21..04bbdd65a96 100644 --- a/crates/web-sys/src/features/gen_HttpConnDict.rs +++ b/crates/web-sys/src/features/gen_HttpConnDict.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] pub type HttpConnDict; + #[wasm_bindgen(method, setter = "connections")] + fn connections_shim(this: &HttpConnDict, val: &::wasm_bindgen::JsValue); } impl HttpConnDict { #[doc = "Construct a new `HttpConnDict`."] @@ -24,17 +26,7 @@ impl HttpConnDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] pub fn connections(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("connections"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.connections_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnInfo.rs b/crates/web-sys/src/features/gen_HttpConnInfo.rs index d914956024b..42ec871b2b8 100644 --- a/crates/web-sys/src/features/gen_HttpConnInfo.rs +++ b/crates/web-sys/src/features/gen_HttpConnInfo.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] pub type HttpConnInfo; + #[wasm_bindgen(method, setter = "protocolVersion")] + fn protocol_version_shim(this: &HttpConnInfo, val: &str); + #[wasm_bindgen(method, setter = "rtt")] + fn rtt_shim(this: &HttpConnInfo, val: u32); + #[wasm_bindgen(method, setter = "ttl")] + fn ttl_shim(this: &HttpConnInfo, val: u32); } impl HttpConnInfo { #[doc = "Construct a new `HttpConnInfo`."] @@ -24,43 +30,21 @@ impl HttpConnInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] pub fn protocol_version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("protocolVersion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.protocol_version_shim(val); self } #[doc = "Change the `rtt` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] pub fn rtt(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rtt"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rtt_shim(val); self } #[doc = "Change the `ttl` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] pub fn ttl(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ttl"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ttl_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnectionElement.rs b/crates/web-sys/src/features/gen_HttpConnectionElement.rs index ecb934db52f..fe702139824 100644 --- a/crates/web-sys/src/features/gen_HttpConnectionElement.rs +++ b/crates/web-sys/src/features/gen_HttpConnectionElement.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub type HttpConnectionElement; + #[wasm_bindgen(method, setter = "active")] + fn active_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "halfOpens")] + fn half_opens_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "host")] + fn host_shim(this: &HttpConnectionElement, val: &str); + #[wasm_bindgen(method, setter = "idle")] + fn idle_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "port")] + fn port_shim(this: &HttpConnectionElement, val: u32); + #[wasm_bindgen(method, setter = "spdy")] + fn spdy_shim(this: &HttpConnectionElement, val: bool); + #[wasm_bindgen(method, setter = "ssl")] + fn ssl_shim(this: &HttpConnectionElement, val: bool); } impl HttpConnectionElement { #[doc = "Construct a new `HttpConnectionElement`."] @@ -24,96 +38,49 @@ impl HttpConnectionElement { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn active(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("active"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.active_shim(val); self } #[doc = "Change the `halfOpens` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn half_opens(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("halfOpens"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.half_opens_shim(val); self } #[doc = "Change the `host` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn host(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("host"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.host_shim(val); self } #[doc = "Change the `idle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn idle(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("idle"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.idle_shim(val); self } #[doc = "Change the `port` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn port(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("port"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.port_shim(val); self } #[doc = "Change the `spdy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn spdy(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("spdy"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.spdy_shim(val); self } #[doc = "Change the `ssl` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub fn ssl(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssl"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssl_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs index bbaeb942487..fabebd3008f 100644 --- a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs +++ b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] pub type IdbFileMetadataParameters; + #[wasm_bindgen(method, setter = "lastModified")] + fn last_modified_shim(this: &IdbFileMetadataParameters, val: bool); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &IdbFileMetadataParameters, val: bool); } impl IdbFileMetadataParameters { #[doc = "Construct a new `IdbFileMetadataParameters`."] @@ -24,30 +28,14 @@ impl IdbFileMetadataParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] pub fn last_modified(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastModified"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_modified_shim(val); self } #[doc = "Change the `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] pub fn size(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbIndexParameters.rs b/crates/web-sys/src/features/gen_IdbIndexParameters.rs index 2162121cfa8..b4ac9086a39 100644 --- a/crates/web-sys/src/features/gen_IdbIndexParameters.rs +++ b/crates/web-sys/src/features/gen_IdbIndexParameters.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] pub type IdbIndexParameters; + #[wasm_bindgen(method, setter = "locale")] + fn locale_shim(this: &IdbIndexParameters, val: Option<&str>); + #[wasm_bindgen(method, setter = "multiEntry")] + fn multi_entry_shim(this: &IdbIndexParameters, val: bool); + #[wasm_bindgen(method, setter = "unique")] + fn unique_shim(this: &IdbIndexParameters, val: bool); } impl IdbIndexParameters { #[doc = "Construct a new `IdbIndexParameters`."] @@ -24,45 +30,21 @@ impl IdbIndexParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] pub fn locale(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("locale"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.locale_shim(val); self } #[doc = "Change the `multiEntry` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] pub fn multi_entry(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("multiEntry"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.multi_entry_shim(val); self } #[doc = "Change the `unique` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] pub fn unique(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("unique"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unique_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs b/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs index 71689ac147e..be0d078c977 100644 --- a/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs +++ b/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] pub type IdbObjectStoreParameters; + #[wasm_bindgen(method, setter = "autoIncrement")] + fn auto_increment_shim(this: &IdbObjectStoreParameters, val: bool); + #[wasm_bindgen(method, setter = "keyPath")] + fn key_path_shim(this: &IdbObjectStoreParameters, val: &::wasm_bindgen::JsValue); } impl IdbObjectStoreParameters { #[doc = "Construct a new `IdbObjectStoreParameters`."] @@ -24,34 +28,14 @@ impl IdbObjectStoreParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] pub fn auto_increment(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoIncrement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_increment_shim(val); self } #[doc = "Change the `keyPath` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] pub fn key_path(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keyPath"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_path_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } } diff --git a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs index 0a7caecc9f1..e5839a07b1c 100644 --- a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs +++ b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] pub type IdbOpenDbOptions; + #[cfg(feature = "StorageType")] + #[wasm_bindgen(method, setter = "storage")] + fn storage_shim(this: &IdbOpenDbOptions, val: StorageType); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &IdbOpenDbOptions, val: f64); } impl IdbOpenDbOptions { #[doc = "Construct a new `IdbOpenDbOptions`."] @@ -25,34 +30,14 @@ impl IdbOpenDbOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] pub fn storage(&mut self, val: StorageType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("storage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.storage_shim(val); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] pub fn version(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs b/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs index 8e2cdd7878a..65ae93c1d7e 100644 --- a/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub type IdbVersionChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &IdbVersionChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &IdbVersionChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &IdbVersionChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "newVersion")] + fn new_version_shim(this: &IdbVersionChangeEventInit, val: Option); + #[wasm_bindgen(method, setter = "oldVersion")] + fn old_version_shim(this: &IdbVersionChangeEventInit, val: f64); } impl IdbVersionChangeEventInit { #[doc = "Construct a new `IdbVersionChangeEventInit`."] @@ -24,85 +34,35 @@ impl IdbVersionChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `newVersion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub fn new_version(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("newVersion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.new_version_shim(val); self } #[doc = "Change the `oldVersion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub fn old_version(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("oldVersion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.old_version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IdleRequestOptions.rs b/crates/web-sys/src/features/gen_IdleRequestOptions.rs index 61dfe104384..b0b550ed8b4 100644 --- a/crates/web-sys/src/features/gen_IdleRequestOptions.rs +++ b/crates/web-sys/src/features/gen_IdleRequestOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] pub type IdleRequestOptions; + #[wasm_bindgen(method, setter = "timeout")] + fn timeout_shim(this: &IdleRequestOptions, val: u32); } impl IdleRequestOptions { #[doc = "Construct a new `IdleRequestOptions`."] @@ -24,17 +26,7 @@ impl IdleRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] pub fn timeout(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeout"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeout_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IirFilterOptions.rs b/crates/web-sys/src/features/gen_IirFilterOptions.rs index d21e80ccf4e..b88375ed03b 100644 --- a/crates/web-sys/src/features/gen_IirFilterOptions.rs +++ b/crates/web-sys/src/features/gen_IirFilterOptions.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] pub type IirFilterOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &IirFilterOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &IirFilterOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &IirFilterOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "feedback")] + fn feedback_shim(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "feedforward")] + fn feedforward_shim(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); } impl IirFilterOptions { #[doc = "Construct a new `IirFilterOptions`."] @@ -26,17 +38,7 @@ impl IirFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -44,17 +46,7 @@ impl IirFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `IirFilterOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -62,51 +54,21 @@ impl IirFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `IirFilterOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `feedback` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] pub fn feedback(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("feedback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.feedback_shim(val); self } #[doc = "Change the `feedforward` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] pub fn feedforward(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("feedforward"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.feedforward_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs index bda518acf21..865c2786fd3 100644 --- a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs +++ b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] pub type ImageBitmapOptions; + #[cfg(feature = "ColorSpaceConversion")] + #[wasm_bindgen(method, setter = "colorSpaceConversion")] + fn color_space_conversion_shim(this: &ImageBitmapOptions, val: ColorSpaceConversion); + #[cfg(feature = "ImageOrientation")] + #[wasm_bindgen(method, setter = "imageOrientation")] + fn image_orientation_shim(this: &ImageBitmapOptions, val: ImageOrientation); + #[cfg(feature = "PremultiplyAlpha")] + #[wasm_bindgen(method, setter = "premultiplyAlpha")] + fn premultiply_alpha_shim(this: &ImageBitmapOptions, val: PremultiplyAlpha); + #[wasm_bindgen(method, setter = "resizeHeight")] + fn resize_height_shim(this: &ImageBitmapOptions, val: u32); + #[cfg(feature = "ResizeQuality")] + #[wasm_bindgen(method, setter = "resizeQuality")] + fn resize_quality_shim(this: &ImageBitmapOptions, val: ResizeQuality); + #[wasm_bindgen(method, setter = "resizeWidth")] + fn resize_width_shim(this: &ImageBitmapOptions, val: u32); } impl ImageBitmapOptions { #[doc = "Construct a new `ImageBitmapOptions`."] @@ -25,17 +41,7 @@ impl ImageBitmapOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpaceConversion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_space_conversion_shim(val); self } #[cfg(feature = "ImageOrientation")] @@ -43,17 +49,7 @@ impl ImageBitmapOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] pub fn image_orientation(&mut self, val: ImageOrientation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("imageOrientation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.image_orientation_shim(val); self } #[cfg(feature = "PremultiplyAlpha")] @@ -61,34 +57,14 @@ impl ImageBitmapOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("premultiplyAlpha"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.premultiply_alpha_shim(val); self } #[doc = "Change the `resizeHeight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] pub fn resize_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resizeHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resize_height_shim(val); self } #[cfg(feature = "ResizeQuality")] @@ -96,34 +72,14 @@ impl ImageBitmapOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] pub fn resize_quality(&mut self, val: ResizeQuality) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resizeQuality"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resize_quality_shim(val); self } #[doc = "Change the `resizeWidth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] pub fn resize_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resizeWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.resize_width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs b/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs index b7299dc4149..093b78e3c67 100644 --- a/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] pub type ImageCaptureErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ImageCaptureErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ImageCaptureErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ImageCaptureErrorEventInit, val: bool); + #[cfg(feature = "ImageCaptureError")] + #[wasm_bindgen(method, setter = "imageCaptureError")] + fn image_capture_error_shim(this: &ImageCaptureErrorEventInit, val: Option<&ImageCaptureError>); } impl ImageCaptureErrorEventInit { #[doc = "Construct a new `ImageCaptureErrorEventInit`."] @@ -24,51 +33,21 @@ impl ImageCaptureErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "ImageCaptureError")] @@ -76,17 +55,7 @@ impl ImageCaptureErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureError`, `ImageCaptureErrorEventInit`*"] pub fn image_capture_error(&mut self, val: Option<&ImageCaptureError>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("imageCaptureError"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.image_capture_error_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecodeOptions.rs b/crates/web-sys/src/features/gen_ImageDecodeOptions.rs index b19a2ff5e60..35fae56cd7b 100644 --- a/crates/web-sys/src/features/gen_ImageDecodeOptions.rs +++ b/crates/web-sys/src/features/gen_ImageDecodeOptions.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecodeOptions; + #[wasm_bindgen(method, setter = "completeFramesOnly")] + fn complete_frames_only_shim(this: &ImageDecodeOptions, val: bool); + #[wasm_bindgen(method, setter = "frameIndex")] + fn frame_index_shim(this: &ImageDecodeOptions, val: u32); } #[cfg(web_sys_unstable_apis)] impl ImageDecodeOptions { @@ -36,17 +40,7 @@ impl ImageDecodeOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn complete_frames_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("completeFramesOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.complete_frames_only_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +51,7 @@ impl ImageDecodeOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn frame_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_index_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecodeResult.rs b/crates/web-sys/src/features/gen_ImageDecodeResult.rs index deccede5ab1..056f4f15364 100644 --- a/crates/web-sys/src/features/gen_ImageDecodeResult.rs +++ b/crates/web-sys/src/features/gen_ImageDecodeResult.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecodeResult; + #[wasm_bindgen(method, setter = "complete")] + fn complete_shim(this: &ImageDecodeResult, val: bool); + #[cfg(feature = "VideoFrame")] + #[wasm_bindgen(method, setter = "image")] + fn image_shim(this: &ImageDecodeResult, val: &VideoFrame); } #[cfg(web_sys_unstable_apis)] impl ImageDecodeResult { @@ -39,17 +44,7 @@ impl ImageDecodeResult { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn complete(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("complete"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.complete_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -61,13 +56,7 @@ impl ImageDecodeResult { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn image(&mut self, val: &VideoFrame) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("image"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.image_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index 165473031b8..416e83d64a3 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -14,6 +14,22 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecoderInit; + #[cfg(feature = "ColorSpaceConversion")] + #[wasm_bindgen(method, setter = "colorSpaceConversion")] + fn color_space_conversion_shim(this: &ImageDecoderInit, val: ColorSpaceConversion); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &ImageDecoderInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "desiredHeight")] + fn desired_height_shim(this: &ImageDecoderInit, val: u32); + #[wasm_bindgen(method, setter = "desiredWidth")] + fn desired_width_shim(this: &ImageDecoderInit, val: u32); + #[wasm_bindgen(method, setter = "preferAnimation")] + fn prefer_animation_shim(this: &ImageDecoderInit, val: bool); + #[cfg(feature = "PremultiplyAlpha")] + #[wasm_bindgen(method, setter = "premultiplyAlpha")] + fn premultiply_alpha_shim(this: &ImageDecoderInit, val: PremultiplyAlpha); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &ImageDecoderInit, val: &str); } #[cfg(web_sys_unstable_apis)] impl ImageDecoderInit { @@ -39,17 +55,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpaceConversion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_space_conversion_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,13 +66,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +77,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn desired_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("desiredHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.desired_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -98,17 +88,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn desired_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("desiredWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.desired_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -119,17 +99,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn prefer_animation(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preferAnimation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefer_animation_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +111,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("premultiplyAlpha"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.premultiply_alpha_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -162,13 +122,7 @@ impl ImageDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs index d3b492287d3..da0a6b82565 100644 --- a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs +++ b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] pub type ImageEncodeOptions; + #[wasm_bindgen(method, setter = "quality")] + fn quality_shim(this: &ImageEncodeOptions, val: f64); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &ImageEncodeOptions, val: &str); } impl ImageEncodeOptions { #[doc = "Construct a new `ImageEncodeOptions`."] @@ -24,30 +28,14 @@ impl ImageEncodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] pub fn quality(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("quality"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.quality_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_InputEventInit.rs b/crates/web-sys/src/features/gen_InputEventInit.rs index 58790f2b346..2b79bf4c57a 100644 --- a/crates/web-sys/src/features/gen_InputEventInit.rs +++ b/crates/web-sys/src/features/gen_InputEventInit.rs @@ -10,6 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub type InputEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &InputEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &InputEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &InputEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &InputEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &InputEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &InputEventInit, val: Option<&str>); + #[cfg(feature = "DataTransfer")] + #[wasm_bindgen(method, setter = "dataTransfer")] + fn data_transfer_shim(this: &InputEventInit, val: Option<&DataTransfer>); + #[wasm_bindgen(method, setter = "inputType")] + fn input_type_shim(this: &InputEventInit, val: &str); + #[wasm_bindgen(method, setter = "isComposing")] + fn is_composing_shim(this: &InputEventInit, val: bool); + #[wasm_bindgen(method, setter = "targetRanges")] + fn target_ranges_shim(this: &InputEventInit, val: &::wasm_bindgen::JsValue); } impl InputEventInit { #[doc = "Construct a new `InputEventInit`."] @@ -24,65 +46,28 @@ impl InputEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,26 +75,14 @@ impl InputEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn data(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(feature = "DataTransfer")] @@ -117,68 +90,28 @@ impl InputEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `InputEventInit`*"] pub fn data_transfer(&mut self, val: Option<&DataTransfer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataTransfer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_transfer_shim(val); self } #[doc = "Change the `inputType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn input_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inputType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.input_type_shim(val); self } #[doc = "Change the `isComposing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn is_composing(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isComposing"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_composing_shim(val); self } #[doc = "Change the `targetRanges` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub fn target_ranges(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("targetRanges"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.target_ranges_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs index b1f228792e4..caa9de343c9 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] pub type IntersectionObserverEntryInit; + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "boundingClientRect")] + fn bounding_client_rect_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "intersectionRect")] + fn intersection_rect_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "rootBounds")] + fn root_bounds_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + #[cfg(feature = "Element")] + #[wasm_bindgen(method, setter = "target")] + fn target_shim(this: &IntersectionObserverEntryInit, val: &Element); + #[wasm_bindgen(method, setter = "time")] + fn time_shim(this: &IntersectionObserverEntryInit, val: f64); } impl IntersectionObserverEntryInit { #[cfg(all(feature = "DomRectInit", feature = "Element",))] @@ -37,17 +51,7 @@ impl IntersectionObserverEntryInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] pub fn bounding_client_rect(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("boundingClientRect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bounding_client_rect_shim(val); self } #[cfg(feature = "DomRectInit")] @@ -55,17 +59,7 @@ impl IntersectionObserverEntryInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] pub fn intersection_rect(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("intersectionRect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.intersection_rect_shim(val); self } #[cfg(feature = "DomRectInit")] @@ -73,17 +67,7 @@ impl IntersectionObserverEntryInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] pub fn root_bounds(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rootBounds"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.root_bounds_shim(val); self } #[cfg(feature = "Element")] @@ -91,27 +75,14 @@ impl IntersectionObserverEntryInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverEntryInit`*"] pub fn target(&mut self, val: &Element) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("target"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.target_shim(val); self } #[doc = "Change the `time` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] pub fn time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("time"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs index b861cc013d3..13c7411b698 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] pub type IntersectionObserverInit; + #[cfg(feature = "Element")] + #[wasm_bindgen(method, setter = "root")] + fn root_shim(this: &IntersectionObserverInit, val: Option<&Element>); + #[wasm_bindgen(method, setter = "rootMargin")] + fn root_margin_shim(this: &IntersectionObserverInit, val: &str); + #[wasm_bindgen(method, setter = "threshold")] + fn threshold_shim(this: &IntersectionObserverInit, val: &::wasm_bindgen::JsValue); } impl IntersectionObserverInit { #[doc = "Construct a new `IntersectionObserverInit`."] @@ -25,47 +32,21 @@ impl IntersectionObserverInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"] pub fn root(&mut self, val: Option<&Element>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("root"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.root_shim(val); self } #[doc = "Change the `rootMargin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] pub fn root_margin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rootMargin"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.root_margin_shim(val); self } #[doc = "Change the `threshold` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] pub fn threshold(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("threshold"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.threshold_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs index 9820eb88b0f..2aba174f2da 100644 --- a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs +++ b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type IsInputPendingOptions; + #[wasm_bindgen(method, setter = "includeContinuous")] + fn include_continuous_shim(this: &IsInputPendingOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl IsInputPendingOptions { @@ -36,17 +38,7 @@ impl IsInputPendingOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn include_continuous(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("includeContinuous"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.include_continuous_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs b/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs index 03fb25fc633..85b0c3497f9 100644 --- a/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs +++ b/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] pub type IterableKeyAndValueResult; + #[wasm_bindgen(method, setter = "done")] + fn done_shim(this: &IterableKeyAndValueResult, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &IterableKeyAndValueResult, val: &::wasm_bindgen::JsValue); } impl IterableKeyAndValueResult { #[doc = "Construct a new `IterableKeyAndValueResult`."] @@ -24,26 +28,14 @@ impl IterableKeyAndValueResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.done_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs b/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs index eb0862894f6..7e76fde4bea 100644 --- a/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs +++ b/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] pub type IterableKeyOrValueResult; + #[wasm_bindgen(method, setter = "done")] + fn done_shim(this: &IterableKeyOrValueResult, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &IterableKeyOrValueResult, val: &::wasm_bindgen::JsValue); } impl IterableKeyOrValueResult { #[doc = "Construct a new `IterableKeyOrValueResult`."] @@ -24,26 +28,14 @@ impl IterableKeyOrValueResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.done_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_JsonWebKey.rs b/crates/web-sys/src/features/gen_JsonWebKey.rs index ac0a1d172e6..04e6cfb11a0 100644 --- a/crates/web-sys/src/features/gen_JsonWebKey.rs +++ b/crates/web-sys/src/features/gen_JsonWebKey.rs @@ -10,6 +10,42 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub type JsonWebKey; + #[wasm_bindgen(method, setter = "alg")] + fn alg_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "crv")] + fn crv_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "d")] + fn d_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "dp")] + fn dp_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "dq")] + fn dq_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "e")] + fn e_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "ext")] + fn ext_shim(this: &JsonWebKey, val: bool); + #[wasm_bindgen(method, setter = "k")] + fn k_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "key_ops")] + fn key_ops_shim(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "kty")] + fn kty_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "n")] + fn n_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "oth")] + fn oth_shim(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "p")] + fn p_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "q")] + fn q_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "qi")] + fn qi_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "use")] + fn use__shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &JsonWebKey, val: &str); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &JsonWebKey, val: &str); } impl JsonWebKey { #[doc = "Construct a new `JsonWebKey`."] @@ -25,238 +61,126 @@ impl JsonWebKey { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn alg(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alg"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alg_shim(val); self } #[doc = "Change the `crv` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn crv(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("crv"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.crv_shim(val); self } #[doc = "Change the `d` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn d(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.d_shim(val); self } #[doc = "Change the `dp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn dp(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dp_shim(val); self } #[doc = "Change the `dq` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn dq(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dq"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dq_shim(val); self } #[doc = "Change the `e` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn e(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.e_shim(val); self } #[doc = "Change the `ext` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn ext(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ext"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ext_shim(val); self } #[doc = "Change the `k` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn k(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("k"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.k_shim(val); self } #[doc = "Change the `key_ops` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn key_ops(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("key_ops"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_ops_shim(val); self } #[doc = "Change the `kty` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn kty(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("kty"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.kty_shim(val); self } #[doc = "Change the `n` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn n(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("n"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.n_shim(val); self } #[doc = "Change the `oth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn oth(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("oth"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.oth_shim(val); self } #[doc = "Change the `p` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn p(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p_shim(val); self } #[doc = "Change the `q` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn q(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("q"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.q_shim(val); self } #[doc = "Change the `qi` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn qi(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("qi"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.qi_shim(val); self } #[doc = "Change the `use` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn use_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("use"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.use__shim(val); self } #[doc = "Change the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn x(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub fn y(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyAlgorithm.rs b/crates/web-sys/src/features/gen_KeyAlgorithm.rs index ba180ae7d1f..101595bb222 100644 --- a/crates/web-sys/src/features/gen_KeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_KeyAlgorithm.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] pub type KeyAlgorithm; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &KeyAlgorithm, val: &str); } impl KeyAlgorithm { #[doc = "Construct a new `KeyAlgorithm`."] @@ -25,13 +27,7 @@ impl KeyAlgorithm { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyIdsInitData.rs b/crates/web-sys/src/features/gen_KeyIdsInitData.rs index 5076c6835e4..1f4d7767a4a 100644 --- a/crates/web-sys/src/features/gen_KeyIdsInitData.rs +++ b/crates/web-sys/src/features/gen_KeyIdsInitData.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] pub type KeyIdsInitData; + #[wasm_bindgen(method, setter = "kids")] + fn kids_shim(this: &KeyIdsInitData, val: &::wasm_bindgen::JsValue); } impl KeyIdsInitData { #[doc = "Construct a new `KeyIdsInitData`."] @@ -25,13 +27,7 @@ impl KeyIdsInitData { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] pub fn kids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("kids"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.kids_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyboardEventInit.rs b/crates/web-sys/src/features/gen_KeyboardEventInit.rs index f09608394a6..3d777d4d7fb 100644 --- a/crates/web-sys/src/features/gen_KeyboardEventInit.rs +++ b/crates/web-sys/src/features/gen_KeyboardEventInit.rs @@ -10,6 +10,59 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub type KeyboardEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &KeyboardEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &KeyboardEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "charCode")] + fn char_code_shim(this: &KeyboardEventInit, val: u32); + #[wasm_bindgen(method, setter = "code")] + fn code_shim(this: &KeyboardEventInit, val: &str); + #[wasm_bindgen(method, setter = "isComposing")] + fn is_composing_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "key")] + fn key_shim(this: &KeyboardEventInit, val: &str); + #[wasm_bindgen(method, setter = "keyCode")] + fn key_code_shim(this: &KeyboardEventInit, val: u32); + #[wasm_bindgen(method, setter = "location")] + fn location_shim(this: &KeyboardEventInit, val: u32); + #[wasm_bindgen(method, setter = "repeat")] + fn repeat_shim(this: &KeyboardEventInit, val: bool); + #[wasm_bindgen(method, setter = "which")] + fn which_shim(this: &KeyboardEventInit, val: u32); } impl KeyboardEventInit { #[doc = "Construct a new `KeyboardEventInit`."] @@ -24,65 +77,28 @@ impl KeyboardEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,352 +106,154 @@ impl KeyboardEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `charCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn char_code(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("charCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.char_code_shim(val); self } #[doc = "Change the `code` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn code(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("code"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.code_shim(val); self } #[doc = "Change the `isComposing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn is_composing(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isComposing"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_composing_shim(val); self } #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn key(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("key"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_shim(val); self } #[doc = "Change the `keyCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn key_code(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keyCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_code_shim(val); self } #[doc = "Change the `location` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn location(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("location"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.location_shim(val); self } #[doc = "Change the `repeat` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn repeat(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("repeat"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.repeat_shim(val); self } #[doc = "Change the `which` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub fn which(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("which"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.which_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs index 430b5e5865d..7685c6af482 100644 --- a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs @@ -14,6 +14,35 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type KeyframeAnimationOptions; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &KeyframeAnimationOptions, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &KeyframeAnimationOptions, val: PlaybackDirection); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &KeyframeAnimationOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &KeyframeAnimationOptions, val: &str); + #[wasm_bindgen(method, setter = "endDelay")] + fn end_delay_shim(this: &KeyframeAnimationOptions, val: f64); + #[cfg(feature = "FillMode")] + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &KeyframeAnimationOptions, val: FillMode); + #[wasm_bindgen(method, setter = "iterationStart")] + fn iteration_start_shim(this: &KeyframeAnimationOptions, val: f64); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &KeyframeAnimationOptions, val: f64); + #[cfg(feature = "CompositeOperation")] + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &KeyframeAnimationOptions, val: CompositeOperation); + #[cfg(feature = "IterationCompositeOperation")] + #[wasm_bindgen(method, setter = "iterationComposite")] + fn iteration_composite_shim(this: &KeyframeAnimationOptions, val: IterationCompositeOperation); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &KeyframeAnimationOptions, val: &str); + #[cfg(feature = "AnimationTimeline")] + #[wasm_bindgen(method, setter = "timeline")] + fn timeline_shim(this: &KeyframeAnimationOptions, val: Option<&AnimationTimeline>); } #[cfg(web_sys_unstable_apis)] impl KeyframeAnimationOptions { @@ -36,13 +65,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +77,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +88,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -96,14 +99,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -114,17 +110,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn end_delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endDelay"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_delay_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -136,13 +122,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn fill(&mut self, val: FillMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -153,17 +133,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_start_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -174,17 +144,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn iterations(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -196,17 +156,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -218,17 +168,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn iteration_composite(&mut self, val: IterationCompositeOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationComposite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_composite_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -239,13 +179,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -257,17 +191,7 @@ impl KeyframeAnimationOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timeline(&mut self, val: Option<&AnimationTimeline>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeline"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeline_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs index 222ba75f32f..94c35ecedd4 100644 --- a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs @@ -10,6 +10,30 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub type KeyframeEffectOptions; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &KeyframeEffectOptions, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &KeyframeEffectOptions, val: PlaybackDirection); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &KeyframeEffectOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &KeyframeEffectOptions, val: &str); + #[wasm_bindgen(method, setter = "endDelay")] + fn end_delay_shim(this: &KeyframeEffectOptions, val: f64); + #[cfg(feature = "FillMode")] + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &KeyframeEffectOptions, val: FillMode); + #[wasm_bindgen(method, setter = "iterationStart")] + fn iteration_start_shim(this: &KeyframeEffectOptions, val: f64); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &KeyframeEffectOptions, val: f64); + #[cfg(feature = "CompositeOperation")] + #[wasm_bindgen(method, setter = "composite")] + fn composite_shim(this: &KeyframeEffectOptions, val: CompositeOperation); + #[cfg(feature = "IterationCompositeOperation")] + #[wasm_bindgen(method, setter = "iterationComposite")] + fn iteration_composite_shim(this: &KeyframeEffectOptions, val: IterationCompositeOperation); } impl KeyframeEffectOptions { #[doc = "Construct a new `KeyframeEffectOptions`."] @@ -24,13 +48,7 @@ impl KeyframeEffectOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(feature = "PlaybackDirection")] @@ -38,65 +56,28 @@ impl KeyframeEffectOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`, `PlaybackDirection`*"] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `endDelay` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn end_delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endDelay"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_delay_shim(val); self } #[cfg(feature = "FillMode")] @@ -104,47 +85,21 @@ impl KeyframeEffectOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FillMode`, `KeyframeEffectOptions`*"] pub fn fill(&mut self, val: FillMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[doc = "Change the `iterationStart` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_start_shim(val); self } #[doc = "Change the `iterations` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub fn iterations(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } #[cfg(feature = "CompositeOperation")] @@ -152,17 +107,7 @@ impl KeyframeEffectOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositeOperation`, `KeyframeEffectOptions`*"] pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composite_shim(val); self } #[cfg(feature = "IterationCompositeOperation")] @@ -170,17 +115,7 @@ impl KeyframeEffectOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterationCompositeOperation`, `KeyframeEffectOptions`*"] pub fn iteration_composite(&mut self, val: IterationCompositeOperation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationComposite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_composite_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_L10nElement.rs b/crates/web-sys/src/features/gen_L10nElement.rs index 63b38292768..0fd76d28bc7 100644 --- a/crates/web-sys/src/features/gen_L10nElement.rs +++ b/crates/web-sys/src/features/gen_L10nElement.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub type L10nElement; + #[wasm_bindgen(method, setter = "l10nArgs")] + fn l10n_args_shim(this: &L10nElement, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "l10nAttrs")] + fn l10n_attrs_shim(this: &L10nElement, val: Option<&str>); + #[wasm_bindgen(method, setter = "l10nId")] + fn l10n_id_shim(this: &L10nElement, val: &str); + #[wasm_bindgen(method, setter = "localName")] + fn local_name_shim(this: &L10nElement, val: &str); + #[wasm_bindgen(method, setter = "namespaceURI")] + fn namespace_uri_shim(this: &L10nElement, val: &str); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &L10nElement, val: Option<&str>); } impl L10nElement { #[doc = "Construct a new `L10nElement`."] @@ -27,95 +39,42 @@ impl L10nElement { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn l10n_args(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("l10nArgs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.l10n_args_shim(val); self } #[doc = "Change the `l10nAttrs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn l10n_attrs(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("l10nAttrs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.l10n_attrs_shim(val); self } #[doc = "Change the `l10nId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn l10n_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("l10nId"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.l10n_id_shim(val); self } #[doc = "Change the `localName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn local_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_name_shim(val); self } #[doc = "Change the `namespaceURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn namespace_uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("namespaceURI"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.namespace_uri_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub fn type_(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_L10nValue.rs b/crates/web-sys/src/features/gen_L10nValue.rs index e5dc9f315f2..0dbf073485f 100644 --- a/crates/web-sys/src/features/gen_L10nValue.rs +++ b/crates/web-sys/src/features/gen_L10nValue.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] pub type L10nValue; + #[wasm_bindgen(method, setter = "attributes")] + fn attributes_shim(this: &L10nValue, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &L10nValue, val: Option<&str>); } impl L10nValue { #[doc = "Construct a new `L10nValue`."] @@ -24,30 +28,14 @@ impl L10nValue { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] pub fn attributes(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attributes_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] pub fn value(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_LifecycleCallbacks.rs b/crates/web-sys/src/features/gen_LifecycleCallbacks.rs index c6ce99e144e..82522003c88 100644 --- a/crates/web-sys/src/features/gen_LifecycleCallbacks.rs +++ b/crates/web-sys/src/features/gen_LifecycleCallbacks.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub type LifecycleCallbacks; + #[wasm_bindgen(method, setter = "adoptedCallback")] + fn adopted_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "attributeChangedCallback")] + fn attribute_changed_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "connectedCallback")] + fn connected_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "disconnectedCallback")] + fn disconnected_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); } impl LifecycleCallbacks { #[doc = "Construct a new `LifecycleCallbacks`."] @@ -24,68 +32,28 @@ impl LifecycleCallbacks { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub fn adopted_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("adoptedCallback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.adopted_callback_shim(val); self } #[doc = "Change the `attributeChangedCallback` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub fn attribute_changed_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributeChangedCallback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribute_changed_callback_shim(val); self } #[doc = "Change the `connectedCallback` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub fn connected_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("connectedCallback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.connected_callback_shim(val); self } #[doc = "Change the `disconnectedCallback` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub fn disconnected_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("disconnectedCallback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.disconnected_callback_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_LocaleInfo.rs b/crates/web-sys/src/features/gen_LocaleInfo.rs index f6debf39470..ba79aa77e67 100644 --- a/crates/web-sys/src/features/gen_LocaleInfo.rs +++ b/crates/web-sys/src/features/gen_LocaleInfo.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] pub type LocaleInfo; + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &LocaleInfo, val: &str); + #[wasm_bindgen(method, setter = "locale")] + fn locale_shim(this: &LocaleInfo, val: &str); } impl LocaleInfo { #[doc = "Construct a new `LocaleInfo`."] @@ -24,31 +28,14 @@ impl LocaleInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] pub fn direction(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] pub fn locale(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("locale"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.locale_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_LockInfo.rs b/crates/web-sys/src/features/gen_LockInfo.rs index d9ea0f7ec87..0c7112ddc24 100644 --- a/crates/web-sys/src/features/gen_LockInfo.rs +++ b/crates/web-sys/src/features/gen_LockInfo.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockInfo; + #[wasm_bindgen(method, setter = "clientId")] + fn client_id_shim(this: &LockInfo, val: &str); + #[cfg(feature = "LockMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &LockInfo, val: LockMode); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &LockInfo, val: &str); } #[cfg(web_sys_unstable_apis)] impl LockInfo { @@ -36,17 +43,7 @@ impl LockInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn client_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,13 +55,7 @@ impl LockInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: LockMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,13 +66,7 @@ impl LockInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_LockManagerSnapshot.rs b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs index 87d1eed1670..a6b6ed20ddc 100644 --- a/crates/web-sys/src/features/gen_LockManagerSnapshot.rs +++ b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockManagerSnapshot; + #[wasm_bindgen(method, setter = "held")] + fn held_shim(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "pending")] + fn pending_shim(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl LockManagerSnapshot { @@ -36,13 +40,7 @@ impl LockManagerSnapshot { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn held(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("held"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.held_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,17 +51,7 @@ impl LockManagerSnapshot { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn pending(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pending"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pending_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_LockOptions.rs b/crates/web-sys/src/features/gen_LockOptions.rs index 27131f050d3..8b450d2645c 100644 --- a/crates/web-sys/src/features/gen_LockOptions.rs +++ b/crates/web-sys/src/features/gen_LockOptions.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockOptions; + #[wasm_bindgen(method, setter = "ifAvailable")] + fn if_available_shim(this: &LockOptions, val: bool); + #[cfg(feature = "LockMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &LockOptions, val: LockMode); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &LockOptions, val: &AbortSignal); + #[wasm_bindgen(method, setter = "steal")] + fn steal_shim(this: &LockOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl LockOptions { @@ -36,17 +46,7 @@ impl LockOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn if_available(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ifAvailable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.if_available_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,13 +58,7 @@ impl LockOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: LockMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,14 +70,7 @@ impl LockOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -94,13 +81,7 @@ impl LockOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn steal(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("steal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.steal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaConfiguration.rs b/crates/web-sys/src/features/gen_MediaConfiguration.rs index 0f1170f28fc..5214880c65c 100644 --- a/crates/web-sys/src/features/gen_MediaConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaConfiguration.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`*"] pub type MediaConfiguration; + #[cfg(feature = "AudioConfiguration")] + #[wasm_bindgen(method, setter = "audio")] + fn audio_shim(this: &MediaConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[wasm_bindgen(method, setter = "video")] + fn video_shim(this: &MediaConfiguration, val: &VideoConfiguration); } impl MediaConfiguration { #[doc = "Construct a new `MediaConfiguration`."] @@ -25,13 +31,7 @@ impl MediaConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaConfiguration`*"] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("audio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_shim(val); self } #[cfg(feature = "VideoConfiguration")] @@ -39,13 +39,7 @@ impl MediaConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`, `VideoConfiguration`*"] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("video"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs index ffa9292dec5..056b56bda30 100644 --- a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`*"] pub type MediaDecodingConfiguration; + #[cfg(feature = "AudioConfiguration")] + #[wasm_bindgen(method, setter = "audio")] + fn audio_shim(this: &MediaDecodingConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[wasm_bindgen(method, setter = "video")] + fn video_shim(this: &MediaDecodingConfiguration, val: &VideoConfiguration); + #[cfg(feature = "MediaDecodingType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &MediaDecodingConfiguration, val: MediaDecodingType); } impl MediaDecodingConfiguration { #[cfg(feature = "MediaDecodingType")] @@ -27,13 +36,7 @@ impl MediaDecodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaDecodingConfiguration`*"] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("audio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_shim(val); self } #[cfg(feature = "VideoConfiguration")] @@ -41,13 +44,7 @@ impl MediaDecodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `VideoConfiguration`*"] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("video"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_shim(val); self } #[cfg(feature = "MediaDecodingType")] @@ -55,13 +52,7 @@ impl MediaDecodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `MediaDecodingType`*"] pub fn type_(&mut self, val: MediaDecodingType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs index 8a8bb78ab40..c13381b70d2 100644 --- a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaElementAudioSourceOptions`*"] pub type MediaElementAudioSourceOptions; + #[cfg(feature = "HtmlMediaElement")] + #[wasm_bindgen(method, setter = "mediaElement")] + fn media_element_shim(this: &MediaElementAudioSourceOptions, val: &HtmlMediaElement); } impl MediaElementAudioSourceOptions { #[cfg(feature = "HtmlMediaElement")] @@ -27,17 +30,7 @@ impl MediaElementAudioSourceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`, `MediaElementAudioSourceOptions`*"] pub fn media_element(&mut self, val: &HtmlMediaElement) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaElement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_element_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs index d08e4ef3b6f..eafa1733fc4 100644 --- a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`*"] pub type MediaEncodingConfiguration; + #[cfg(feature = "AudioConfiguration")] + #[wasm_bindgen(method, setter = "audio")] + fn audio_shim(this: &MediaEncodingConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[wasm_bindgen(method, setter = "video")] + fn video_shim(this: &MediaEncodingConfiguration, val: &VideoConfiguration); + #[cfg(feature = "MediaEncodingType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &MediaEncodingConfiguration, val: MediaEncodingType); } impl MediaEncodingConfiguration { #[cfg(feature = "MediaEncodingType")] @@ -27,13 +36,7 @@ impl MediaEncodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaEncodingConfiguration`*"] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("audio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_shim(val); self } #[cfg(feature = "VideoConfiguration")] @@ -41,13 +44,7 @@ impl MediaEncodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `VideoConfiguration`*"] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("video"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_shim(val); self } #[cfg(feature = "MediaEncodingType")] @@ -55,13 +52,7 @@ impl MediaEncodingConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `MediaEncodingType`*"] pub fn type_(&mut self, val: MediaEncodingType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaImage.rs b/crates/web-sys/src/features/gen_MediaImage.rs index 2eb3a955cb9..779f4419ecb 100644 --- a/crates/web-sys/src/features/gen_MediaImage.rs +++ b/crates/web-sys/src/features/gen_MediaImage.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaImage; + #[wasm_bindgen(method, setter = "sizes")] + fn sizes_shim(this: &MediaImage, val: &str); + #[wasm_bindgen(method, setter = "src")] + fn src_shim(this: &MediaImage, val: &str); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &MediaImage, val: &str); } #[cfg(web_sys_unstable_apis)] impl MediaImage { @@ -37,13 +43,7 @@ impl MediaImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn sizes(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sizes"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sizes_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,13 +54,7 @@ impl MediaImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn src(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("src"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.src_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -71,13 +65,7 @@ impl MediaImage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs index 9e48fad217d..b5d349fa116 100644 --- a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub type MediaKeyMessageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaKeyMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaKeyMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaKeyMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "message")] + fn message_shim(this: &MediaKeyMessageEventInit, val: &::js_sys::ArrayBuffer); + #[cfg(feature = "MediaKeyMessageType")] + #[wasm_bindgen(method, setter = "messageType")] + fn message_type_shim(this: &MediaKeyMessageEventInit, val: MediaKeyMessageType); } impl MediaKeyMessageEventInit { #[cfg(feature = "MediaKeyMessageType")] @@ -27,68 +38,28 @@ impl MediaKeyMessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub fn message(&mut self, val: &::js_sys::ArrayBuffer) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_shim(val); self } #[cfg(feature = "MediaKeyMessageType")] @@ -96,17 +67,7 @@ impl MediaKeyMessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`, `MediaKeyMessageType`*"] pub fn message_type(&mut self, val: MediaKeyMessageType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("messageType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs index 96041fcbb25..f723838a4c8 100644 --- a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub type MediaKeyNeededEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaKeyNeededEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaKeyNeededEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaKeyNeededEventInit, val: bool); + #[wasm_bindgen(method, setter = "initData")] + fn init_data_shim(this: &MediaKeyNeededEventInit, val: Option<&::js_sys::ArrayBuffer>); + #[wasm_bindgen(method, setter = "initDataType")] + fn init_data_type_shim(this: &MediaKeyNeededEventInit, val: &str); } impl MediaKeyNeededEventInit { #[doc = "Construct a new `MediaKeyNeededEventInit`."] @@ -24,85 +34,35 @@ impl MediaKeyNeededEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `initData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub fn init_data(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("initData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.init_data_shim(val); self } #[doc = "Change the `initDataType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub fn init_data_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("initDataType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.init_data_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs index 2491b941a97..189ffb73a60 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub type MediaKeySystemConfiguration; + #[wasm_bindgen(method, setter = "audioCapabilities")] + fn audio_capabilities_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "MediaKeysRequirement")] + #[wasm_bindgen(method, setter = "distinctiveIdentifier")] + fn distinctive_identifier_shim(this: &MediaKeySystemConfiguration, val: MediaKeysRequirement); + #[wasm_bindgen(method, setter = "initDataTypes")] + fn init_data_types_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &MediaKeySystemConfiguration, val: &str); + #[cfg(feature = "MediaKeysRequirement")] + #[wasm_bindgen(method, setter = "persistentState")] + fn persistent_state_shim(this: &MediaKeySystemConfiguration, val: MediaKeysRequirement); + #[wasm_bindgen(method, setter = "sessionTypes")] + fn session_types_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "videoCapabilities")] + fn video_capabilities_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); } impl MediaKeySystemConfiguration { #[doc = "Construct a new `MediaKeySystemConfiguration`."] @@ -24,17 +40,7 @@ impl MediaKeySystemConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub fn audio_capabilities(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioCapabilities"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_capabilities_shim(val); self } #[cfg(feature = "MediaKeysRequirement")] @@ -42,47 +48,21 @@ impl MediaKeySystemConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] pub fn distinctive_identifier(&mut self, val: MediaKeysRequirement) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("distinctiveIdentifier"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.distinctive_identifier_shim(val); self } #[doc = "Change the `initDataTypes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub fn init_data_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("initDataTypes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.init_data_types_shim(val); self } #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub fn label(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } #[cfg(feature = "MediaKeysRequirement")] @@ -90,51 +70,21 @@ impl MediaKeySystemConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] pub fn persistent_state(&mut self, val: MediaKeysRequirement) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("persistentState"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.persistent_state_shim(val); self } #[doc = "Change the `sessionTypes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub fn session_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sessionTypes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.session_types_shim(val); self } #[doc = "Change the `videoCapabilities` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub fn video_capabilities(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("videoCapabilities"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_capabilities_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs index fab91188935..6d4e840e0fb 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] pub type MediaKeySystemMediaCapability; + #[wasm_bindgen(method, setter = "contentType")] + fn content_type_shim(this: &MediaKeySystemMediaCapability, val: &str); + #[wasm_bindgen(method, setter = "robustness")] + fn robustness_shim(this: &MediaKeySystemMediaCapability, val: &str); } impl MediaKeySystemMediaCapability { #[doc = "Construct a new `MediaKeySystemMediaCapability`."] @@ -24,34 +28,14 @@ impl MediaKeySystemMediaCapability { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] pub fn content_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contentType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.content_type_shim(val); self } #[doc = "Change the `robustness` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] pub fn robustness(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("robustness"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.robustness_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs index 079ed456788..de6f010e296 100644 --- a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs +++ b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] pub type MediaKeysPolicy; + #[wasm_bindgen(method, setter = "minHdcpVersion")] + fn min_hdcp_version_shim(this: &MediaKeysPolicy, val: &str); } impl MediaKeysPolicy { #[doc = "Construct a new `MediaKeysPolicy`."] @@ -24,17 +26,7 @@ impl MediaKeysPolicy { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] pub fn min_hdcp_version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("minHdcpVersion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_hdcp_version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaMetadataInit.rs b/crates/web-sys/src/features/gen_MediaMetadataInit.rs index 7ec33aa1467..91fb637fb19 100644 --- a/crates/web-sys/src/features/gen_MediaMetadataInit.rs +++ b/crates/web-sys/src/features/gen_MediaMetadataInit.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaMetadataInit; + #[wasm_bindgen(method, setter = "album")] + fn album_shim(this: &MediaMetadataInit, val: &str); + #[wasm_bindgen(method, setter = "artist")] + fn artist_shim(this: &MediaMetadataInit, val: &str); + #[wasm_bindgen(method, setter = "artwork")] + fn artwork_shim(this: &MediaMetadataInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "title")] + fn title_shim(this: &MediaMetadataInit, val: &str); } #[cfg(web_sys_unstable_apis)] impl MediaMetadataInit { @@ -36,13 +44,7 @@ impl MediaMetadataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn album(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("album"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.album_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,14 +55,7 @@ impl MediaMetadataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn artist(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("artist"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.artist_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -71,17 +66,7 @@ impl MediaMetadataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn artwork(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("artwork"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.artwork_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -92,13 +77,7 @@ impl MediaMetadataInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn title(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.title_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaPositionState.rs b/crates/web-sys/src/features/gen_MediaPositionState.rs index b8ac6fa5f9b..2cb0437b6cd 100644 --- a/crates/web-sys/src/features/gen_MediaPositionState.rs +++ b/crates/web-sys/src/features/gen_MediaPositionState.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaPositionState; + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &MediaPositionState, val: f64); + #[wasm_bindgen(method, setter = "playbackRate")] + fn playback_rate_shim(this: &MediaPositionState, val: f64); + #[wasm_bindgen(method, setter = "position")] + fn position_shim(this: &MediaPositionState, val: f64); } #[cfg(web_sys_unstable_apis)] impl MediaPositionState { @@ -36,17 +42,7 @@ impl MediaPositionState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +53,7 @@ impl MediaPositionState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn playback_rate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("playbackRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.playback_rate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +64,7 @@ impl MediaPositionState { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn position(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("position"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.position_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs index b792f8ec247..842841ed7d9 100644 --- a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub type MediaQueryListEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaQueryListEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaQueryListEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaQueryListEventInit, val: bool); + #[wasm_bindgen(method, setter = "matches")] + fn matches_shim(this: &MediaQueryListEventInit, val: bool); + #[wasm_bindgen(method, setter = "media")] + fn media_shim(this: &MediaQueryListEventInit, val: &str); } impl MediaQueryListEventInit { #[doc = "Construct a new `MediaQueryListEventInit`."] @@ -24,81 +34,35 @@ impl MediaQueryListEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `matches` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub fn matches(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("matches"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.matches_shim(val); self } #[doc = "Change the `media` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub fn media(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("media"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs index 41ca06922ec..bd0cee69550 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] pub type MediaRecorderErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaRecorderErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaRecorderErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaRecorderErrorEventInit, val: bool); + #[cfg(feature = "DomException")] + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &MediaRecorderErrorEventInit, val: &DomException); } impl MediaRecorderErrorEventInit { #[cfg(feature = "DomException")] @@ -26,51 +35,21 @@ impl MediaRecorderErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "DomException")] @@ -78,13 +57,7 @@ impl MediaRecorderErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomException`, `MediaRecorderErrorEventInit`*"] pub fn error(&mut self, val: &DomException) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs index 8a5fc951d7a..c2b2d199293 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub type MediaRecorderOptions; + #[wasm_bindgen(method, setter = "audioBitsPerSecond")] + fn audio_bits_per_second_shim(this: &MediaRecorderOptions, val: u32); + #[wasm_bindgen(method, setter = "bitsPerSecond")] + fn bits_per_second_shim(this: &MediaRecorderOptions, val: u32); + #[wasm_bindgen(method, setter = "mimeType")] + fn mime_type_shim(this: &MediaRecorderOptions, val: &str); + #[wasm_bindgen(method, setter = "videoBitsPerSecond")] + fn video_bits_per_second_shim(this: &MediaRecorderOptions, val: u32); } impl MediaRecorderOptions { #[doc = "Construct a new `MediaRecorderOptions`."] @@ -24,68 +32,28 @@ impl MediaRecorderOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub fn audio_bits_per_second(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioBitsPerSecond"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_bits_per_second_shim(val); self } #[doc = "Change the `bitsPerSecond` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub fn bits_per_second(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitsPerSecond"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bits_per_second_shim(val); self } #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub fn mime_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mimeType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mime_type_shim(val); self } #[doc = "Change the `videoBitsPerSecond` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub fn video_bits_per_second(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("videoBitsPerSecond"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_bits_per_second_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs index a9803decfa1..45cde7e9664 100644 --- a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs +++ b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaSessionActionDetails; + #[cfg(feature = "MediaSessionAction")] + #[wasm_bindgen(method, setter = "action")] + fn action_shim(this: &MediaSessionActionDetails, val: MediaSessionAction); + #[wasm_bindgen(method, setter = "fastSeek")] + fn fast_seek_shim(this: &MediaSessionActionDetails, val: Option); + #[wasm_bindgen(method, setter = "seekOffset")] + fn seek_offset_shim(this: &MediaSessionActionDetails, val: Option); + #[wasm_bindgen(method, setter = "seekTime")] + fn seek_time_shim(this: &MediaSessionActionDetails, val: Option); } #[cfg(web_sys_unstable_apis)] impl MediaSessionActionDetails { @@ -39,14 +48,7 @@ impl MediaSessionActionDetails { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn action(&mut self, val: MediaSessionAction) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("action"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.action_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +59,7 @@ impl MediaSessionActionDetails { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn fast_seek(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fastSeek"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fast_seek_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +70,7 @@ impl MediaSessionActionDetails { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn seek_offset(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("seekOffset"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.seek_offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +81,7 @@ impl MediaSessionActionDetails { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn seek_time(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("seekTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.seek_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs index 215d5e0049b..633826b3f34 100644 --- a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamAudioSourceOptions`*"] pub type MediaStreamAudioSourceOptions; + #[cfg(feature = "MediaStream")] + #[wasm_bindgen(method, setter = "mediaStream")] + fn media_stream_shim(this: &MediaStreamAudioSourceOptions, val: &MediaStream); } impl MediaStreamAudioSourceOptions { #[cfg(feature = "MediaStream")] @@ -27,17 +30,7 @@ impl MediaStreamAudioSourceOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamAudioSourceOptions`*"] pub fn media_stream(&mut self, val: &MediaStream) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaStream"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_stream_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs index ef0d435e3d2..9533a444d03 100644 --- a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub type MediaStreamConstraints; + #[wasm_bindgen(method, setter = "audio")] + fn audio_shim(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "fake")] + fn fake_shim(this: &MediaStreamConstraints, val: bool); + #[wasm_bindgen(method, setter = "peerIdentity")] + fn peer_identity_shim(this: &MediaStreamConstraints, val: Option<&str>); + #[wasm_bindgen(method, setter = "picture")] + fn picture_shim(this: &MediaStreamConstraints, val: bool); + #[wasm_bindgen(method, setter = "video")] + fn video_shim(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); } impl MediaStreamConstraints { #[doc = "Construct a new `MediaStreamConstraints`."] @@ -24,73 +34,35 @@ impl MediaStreamConstraints { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub fn audio(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("audio"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_shim(val); self } #[doc = "Change the `fake` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub fn fake(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fake"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fake_shim(val); self } #[doc = "Change the `peerIdentity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub fn peer_identity(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("peerIdentity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.peer_identity_shim(val); self } #[doc = "Change the `picture` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub fn picture(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("picture"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.picture_shim(val); self } #[doc = "Change the `video` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub fn video(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("video"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.video_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamEventInit.rs b/crates/web-sys/src/features/gen_MediaStreamEventInit.rs index ee276698f7f..82458dfd60c 100644 --- a/crates/web-sys/src/features/gen_MediaStreamEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] pub type MediaStreamEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaStreamEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaStreamEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaStreamEventInit, val: bool); + #[cfg(feature = "MediaStream")] + #[wasm_bindgen(method, setter = "stream")] + fn stream_shim(this: &MediaStreamEventInit, val: Option<&MediaStream>); } impl MediaStreamEventInit { #[doc = "Construct a new `MediaStreamEventInit`."] @@ -24,51 +33,21 @@ impl MediaStreamEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "MediaStream")] @@ -76,14 +55,7 @@ impl MediaStreamEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamEventInit`*"] pub fn stream(&mut self, val: Option<&MediaStream>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stream"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stream_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs index 6f0d79afc89..d66b918fe20 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] pub type MediaStreamTrackEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MediaStreamTrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MediaStreamTrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MediaStreamTrackEventInit, val: bool); + #[cfg(feature = "MediaStreamTrack")] + #[wasm_bindgen(method, setter = "track")] + fn track_shim(this: &MediaStreamTrackEventInit, val: &MediaStreamTrack); } impl MediaStreamTrackEventInit { #[cfg(feature = "MediaStreamTrack")] @@ -26,51 +35,21 @@ impl MediaStreamTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "MediaStreamTrack")] @@ -78,13 +57,7 @@ impl MediaStreamTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackEventInit`*"] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("track"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs index 752f668854b..a85a9268d57 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaStreamTrackGeneratorInit; + #[wasm_bindgen(method, setter = "kind")] + fn kind_shim(this: &MediaStreamTrackGeneratorInit, val: &str); } #[cfg(web_sys_unstable_apis)] impl MediaStreamTrackGeneratorInit { @@ -37,13 +39,7 @@ impl MediaStreamTrackGeneratorInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn kind(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("kind"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.kind_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs index bbf2078e8bc..fabbd4a7418 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaStreamTrackProcessorInit; + #[wasm_bindgen(method, setter = "maxBufferSize")] + fn max_buffer_size_shim(this: &MediaStreamTrackProcessorInit, val: u16); + #[cfg(feature = "MediaStreamTrack")] + #[wasm_bindgen(method, setter = "track")] + fn track_shim(this: &MediaStreamTrackProcessorInit, val: &MediaStreamTrack); } #[cfg(web_sys_unstable_apis)] impl MediaStreamTrackProcessorInit { @@ -38,17 +43,7 @@ impl MediaStreamTrackProcessorInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_buffer_size(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxBufferSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_buffer_size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,13 +55,7 @@ impl MediaStreamTrackProcessorInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("track"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs index 3c5212071b0..866fad34359 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs @@ -10,6 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub type MediaTrackConstraintSet; + #[wasm_bindgen(method, setter = "autoGainControl")] + fn auto_gain_control_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "browserWindow")] + fn browser_window_shim(this: &MediaTrackConstraintSet, val: f64); + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "echoCancellation")] + fn echo_cancellation_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "facingMode")] + fn facing_mode_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "frameRate")] + fn frame_rate_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "mediaSource")] + fn media_source_shim(this: &MediaTrackConstraintSet, val: &str); + #[wasm_bindgen(method, setter = "noiseSuppression")] + fn noise_suppression_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "scrollWithPage")] + fn scroll_with_page_shim(this: &MediaTrackConstraintSet, val: bool); + #[wasm_bindgen(method, setter = "viewportHeight")] + fn viewport_height_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportOffsetX")] + fn viewport_offset_x_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportOffsetY")] + fn viewport_offset_y_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportWidth")] + fn viewport_width_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); } impl MediaTrackConstraintSet { #[doc = "Construct a new `MediaTrackConstraintSet`."] @@ -24,265 +56,112 @@ impl MediaTrackConstraintSet { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoGainControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_gain_control_shim(val); self } #[doc = "Change the `browserWindow` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn browser_window(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("browserWindow"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.browser_window_shim(val); self } #[doc = "Change the `channelCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[doc = "Change the `deviceId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn device_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[doc = "Change the `echoCancellation` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoCancellation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_cancellation_shim(val); self } #[doc = "Change the `facingMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("facingMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.facing_mode_shim(val); self } #[doc = "Change the `frameRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn frame_rate(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_rate_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `mediaSource` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn media_source(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaSource"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_source_shim(val); self } #[doc = "Change the `noiseSuppression` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("noiseSuppression"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.noise_suppression_shim(val); self } #[doc = "Change the `scrollWithPage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn scroll_with_page(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("scrollWithPage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scroll_with_page_shim(val); self } #[doc = "Change the `viewportHeight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn viewport_height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_height_shim(val); self } #[doc = "Change the `viewportOffsetX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn viewport_offset_x(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportOffsetX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_offset_x_shim(val); self } #[doc = "Change the `viewportOffsetY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn viewport_offset_y(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportOffsetY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_offset_y_shim(val); self } #[doc = "Change the `viewportWidth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn viewport_width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_width_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub fn width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs index dbd4cfd9af5..8b89c26eef7 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs @@ -10,6 +10,40 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub type MediaTrackConstraints; + #[wasm_bindgen(method, setter = "autoGainControl")] + fn auto_gain_control_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "browserWindow")] + fn browser_window_shim(this: &MediaTrackConstraints, val: f64); + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "echoCancellation")] + fn echo_cancellation_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "facingMode")] + fn facing_mode_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "frameRate")] + fn frame_rate_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "mediaSource")] + fn media_source_shim(this: &MediaTrackConstraints, val: &str); + #[wasm_bindgen(method, setter = "noiseSuppression")] + fn noise_suppression_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "scrollWithPage")] + fn scroll_with_page_shim(this: &MediaTrackConstraints, val: bool); + #[wasm_bindgen(method, setter = "viewportHeight")] + fn viewport_height_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportOffsetX")] + fn viewport_offset_x_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportOffsetY")] + fn viewport_offset_y_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "viewportWidth")] + fn viewport_width_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "advanced")] + fn advanced_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); } impl MediaTrackConstraints { #[doc = "Construct a new `MediaTrackConstraints`."] @@ -24,282 +58,119 @@ impl MediaTrackConstraints { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoGainControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_gain_control_shim(val); self } #[doc = "Change the `browserWindow` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn browser_window(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("browserWindow"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.browser_window_shim(val); self } #[doc = "Change the `channelCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[doc = "Change the `deviceId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn device_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[doc = "Change the `echoCancellation` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoCancellation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_cancellation_shim(val); self } #[doc = "Change the `facingMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("facingMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.facing_mode_shim(val); self } #[doc = "Change the `frameRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn frame_rate(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_rate_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `mediaSource` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn media_source(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaSource"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_source_shim(val); self } #[doc = "Change the `noiseSuppression` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("noiseSuppression"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.noise_suppression_shim(val); self } #[doc = "Change the `scrollWithPage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn scroll_with_page(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("scrollWithPage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scroll_with_page_shim(val); self } #[doc = "Change the `viewportHeight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn viewport_height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_height_shim(val); self } #[doc = "Change the `viewportOffsetX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn viewport_offset_x(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportOffsetX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_offset_x_shim(val); self } #[doc = "Change the `viewportOffsetY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn viewport_offset_y(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportOffsetY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_offset_y_shim(val); self } #[doc = "Change the `viewportWidth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn viewport_width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("viewportWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.viewport_width_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } #[doc = "Change the `advanced` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub fn advanced(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("advanced"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.advanced_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackSettings.rs b/crates/web-sys/src/features/gen_MediaTrackSettings.rs index 6a4493dccb2..3bd4e245aac 100644 --- a/crates/web-sys/src/features/gen_MediaTrackSettings.rs +++ b/crates/web-sys/src/features/gen_MediaTrackSettings.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub type MediaTrackSettings; + #[wasm_bindgen(method, setter = "autoGainControl")] + fn auto_gain_control_shim(this: &MediaTrackSettings, val: bool); + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &MediaTrackSettings, val: i32); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &MediaTrackSettings, val: &str); + #[wasm_bindgen(method, setter = "echoCancellation")] + fn echo_cancellation_shim(this: &MediaTrackSettings, val: bool); + #[wasm_bindgen(method, setter = "facingMode")] + fn facing_mode_shim(this: &MediaTrackSettings, val: &str); + #[wasm_bindgen(method, setter = "frameRate")] + fn frame_rate_shim(this: &MediaTrackSettings, val: f64); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &MediaTrackSettings, val: i32); + #[wasm_bindgen(method, setter = "noiseSuppression")] + fn noise_suppression_shim(this: &MediaTrackSettings, val: bool); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &MediaTrackSettings, val: i32); } impl MediaTrackSettings { #[doc = "Construct a new `MediaTrackSettings`."] @@ -24,146 +42,63 @@ impl MediaTrackSettings { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn auto_gain_control(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoGainControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_gain_control_shim(val); self } #[doc = "Change the `channelCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn channel_count(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[doc = "Change the `deviceId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn device_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[doc = "Change the `echoCancellation` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn echo_cancellation(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoCancellation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_cancellation_shim(val); self } #[doc = "Change the `facingMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn facing_mode(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("facingMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.facing_mode_shim(val); self } #[doc = "Change the `frameRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn frame_rate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_rate_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn height(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `noiseSuppression` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn noise_suppression(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("noiseSuppression"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.noise_suppression_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub fn width(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs b/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs index aa47b5f0218..1cf7fc77567 100644 --- a/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs @@ -10,6 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub type MediaTrackSupportedConstraints; + #[wasm_bindgen(method, setter = "aspectRatio")] + fn aspect_ratio_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "autoGainControl")] + fn auto_gain_control_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "echoCancellation")] + fn echo_cancellation_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "facingMode")] + fn facing_mode_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "frameRate")] + fn frame_rate_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "groupId")] + fn group_id_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "latency")] + fn latency_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "noiseSuppression")] + fn noise_suppression_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "sampleSize")] + fn sample_size_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "volume")] + fn volume_shim(this: &MediaTrackSupportedConstraints, val: bool); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &MediaTrackSupportedConstraints, val: bool); } impl MediaTrackSupportedConstraints { #[doc = "Construct a new `MediaTrackSupportedConstraints`."] @@ -24,245 +54,105 @@ impl MediaTrackSupportedConstraints { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn aspect_ratio(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("aspectRatio"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.aspect_ratio_shim(val); self } #[doc = "Change the `autoGainControl` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn auto_gain_control(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoGainControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_gain_control_shim(val); self } #[doc = "Change the `channelCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn channel_count(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[doc = "Change the `deviceId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn device_id(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deviceId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_id_shim(val); self } #[doc = "Change the `echoCancellation` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn echo_cancellation(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoCancellation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_cancellation_shim(val); self } #[doc = "Change the `facingMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn facing_mode(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("facingMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.facing_mode_shim(val); self } #[doc = "Change the `frameRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn frame_rate(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_rate_shim(val); self } #[doc = "Change the `groupId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn group_id(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("groupId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.group_id_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn height(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `latency` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn latency(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("latency"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.latency_shim(val); self } #[doc = "Change the `noiseSuppression` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn noise_suppression(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("noiseSuppression"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.noise_suppression_shim(val); self } #[doc = "Change the `sampleRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn sample_rate(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } #[doc = "Change the `sampleSize` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn sample_size(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_size_shim(val); self } #[doc = "Change the `volume` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn volume(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("volume"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.volume_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub fn width(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryAttribution.rs b/crates/web-sys/src/features/gen_MemoryAttribution.rs index 16d6c70567f..9fdedda1113 100644 --- a/crates/web-sys/src/features/gen_MemoryAttribution.rs +++ b/crates/web-sys/src/features/gen_MemoryAttribution.rs @@ -14,6 +14,13 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryAttribution; + #[cfg(feature = "MemoryAttributionContainer")] + #[wasm_bindgen(method, setter = "container")] + fn container_shim(this: &MemoryAttribution, val: &MemoryAttributionContainer); + #[wasm_bindgen(method, setter = "scope")] + fn scope_shim(this: &MemoryAttribution, val: &str); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &MemoryAttribution, val: &str); } #[cfg(web_sys_unstable_apis)] impl MemoryAttribution { @@ -37,17 +44,7 @@ impl MemoryAttribution { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn container(&mut self, val: &MemoryAttributionContainer) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("container"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.container_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,13 +55,7 @@ impl MemoryAttribution { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn scope(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("scope"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scope_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,13 +66,7 @@ impl MemoryAttribution { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs index 7365be8b9fe..0dfe8ce12ea 100644 --- a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs +++ b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryAttributionContainer; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &MemoryAttributionContainer, val: &str); + #[wasm_bindgen(method, setter = "src")] + fn src_shim(this: &MemoryAttributionContainer, val: &str); } #[cfg(web_sys_unstable_apis)] impl MemoryAttributionContainer { @@ -36,13 +40,7 @@ impl MemoryAttributionContainer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,13 +51,7 @@ impl MemoryAttributionContainer { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn src(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("src"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.src_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs b/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs index 0588e44af03..05592cc877c 100644 --- a/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs +++ b/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryBreakdownEntry; + #[wasm_bindgen(method, setter = "attribution")] + fn attribution_shim(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "bytes")] + fn bytes_shim(this: &MemoryBreakdownEntry, val: f64); + #[wasm_bindgen(method, setter = "types")] + fn types_shim(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl MemoryBreakdownEntry { @@ -36,17 +42,7 @@ impl MemoryBreakdownEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn attribution(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attribution"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribution_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +53,7 @@ impl MemoryBreakdownEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("bytes"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,13 +64,7 @@ impl MemoryBreakdownEntry { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.types_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryMeasurement.rs b/crates/web-sys/src/features/gen_MemoryMeasurement.rs index db9b2b695cc..b3bbfaca883 100644 --- a/crates/web-sys/src/features/gen_MemoryMeasurement.rs +++ b/crates/web-sys/src/features/gen_MemoryMeasurement.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryMeasurement; + #[wasm_bindgen(method, setter = "breakdown")] + fn breakdown_shim(this: &MemoryMeasurement, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "bytes")] + fn bytes_shim(this: &MemoryMeasurement, val: f64); } #[cfg(web_sys_unstable_apis)] impl MemoryMeasurement { @@ -36,17 +40,7 @@ impl MemoryMeasurement { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn breakdown(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("breakdown"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.breakdown_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +51,7 @@ impl MemoryMeasurement { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("bytes"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MessageEventInit.rs b/crates/web-sys/src/features/gen_MessageEventInit.rs index 2a098bee6dd..0e5381f8cc9 100644 --- a/crates/web-sys/src/features/gen_MessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MessageEventInit.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub type MessageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "lastEventId")] + fn last_event_id_shim(this: &MessageEventInit, val: &str); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &MessageEventInit, val: &str); + #[wasm_bindgen(method, setter = "ports")] + fn ports_shim(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &MessageEventInit, val: Option<&::js_sys::Object>); } impl MessageEventInit { #[doc = "Construct a new `MessageEventInit`."] @@ -24,122 +40,56 @@ impl MessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[doc = "Change the `lastEventId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn last_event_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastEventId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_event_id_shim(val); self } #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn origin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `ports` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn ports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ports"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ports_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub fn source(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs b/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs index 125b7476de2..77e2f4b71df 100644 --- a/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] pub type MidiConnectionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MidiConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MidiConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MidiConnectionEventInit, val: bool); + #[cfg(feature = "MidiPort")] + #[wasm_bindgen(method, setter = "port")] + fn port_shim(this: &MidiConnectionEventInit, val: Option<&MidiPort>); } impl MidiConnectionEventInit { #[doc = "Construct a new `MidiConnectionEventInit`."] @@ -24,51 +33,21 @@ impl MidiConnectionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "MidiPort")] @@ -76,13 +55,7 @@ impl MidiConnectionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`, `MidiPort`*"] pub fn port(&mut self, val: Option<&MidiPort>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("port"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.port_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs index 4002e71c68e..da581fa01f1 100644 --- a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] pub type MidiMessageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MidiMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MidiMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MidiMessageEventInit, val: bool); } impl MidiMessageEventInit { #[doc = "Construct a new `MidiMessageEventInit`."] @@ -24,51 +30,21 @@ impl MidiMessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiOptions.rs b/crates/web-sys/src/features/gen_MidiOptions.rs index 482e5427c57..bb9a50ece05 100644 --- a/crates/web-sys/src/features/gen_MidiOptions.rs +++ b/crates/web-sys/src/features/gen_MidiOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] pub type MidiOptions; + #[wasm_bindgen(method, setter = "software")] + fn software_shim(this: &MidiOptions, val: bool); + #[wasm_bindgen(method, setter = "sysex")] + fn sysex_shim(this: &MidiOptions, val: bool); } impl MidiOptions { #[doc = "Construct a new `MidiOptions`."] @@ -24,30 +28,14 @@ impl MidiOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] pub fn software(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("software"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.software_shim(val); self } #[doc = "Change the `sysex` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] pub fn sysex(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sysex"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sysex_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MouseEventInit.rs b/crates/web-sys/src/features/gen_MouseEventInit.rs index 61c5bb518c1..340e3bddebd 100644 --- a/crates/web-sys/src/features/gen_MouseEventInit.rs +++ b/crates/web-sys/src/features/gen_MouseEventInit.rs @@ -10,6 +10,62 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub type MouseEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &MouseEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &MouseEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &MouseEventInit, val: bool); + #[wasm_bindgen(method, setter = "button")] + fn button_shim(this: &MouseEventInit, val: i16); + #[wasm_bindgen(method, setter = "buttons")] + fn buttons_shim(this: &MouseEventInit, val: u16); + #[wasm_bindgen(method, setter = "clientX")] + fn client_x_shim(this: &MouseEventInit, val: i32); + #[wasm_bindgen(method, setter = "clientY")] + fn client_y_shim(this: &MouseEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementX")] + fn movement_x_shim(this: &MouseEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementY")] + fn movement_y_shim(this: &MouseEventInit, val: i32); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "relatedTarget")] + fn related_target_shim(this: &MouseEventInit, val: Option<&EventTarget>); + #[wasm_bindgen(method, setter = "screenX")] + fn screen_x_shim(this: &MouseEventInit, val: i32); + #[wasm_bindgen(method, setter = "screenY")] + fn screen_y_shim(this: &MouseEventInit, val: i32); } impl MouseEventInit { #[doc = "Construct a new `MouseEventInit`."] @@ -24,65 +80,28 @@ impl MouseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,330 +109,140 @@ impl MouseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `button` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn button(&mut self, val: i16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.button_shim(val); self } #[doc = "Change the `buttons` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn buttons(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buttons"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buttons_shim(val); self } #[doc = "Change the `clientX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn client_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_x_shim(val); self } #[doc = "Change the `clientY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn client_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_y_shim(val); self } #[doc = "Change the `movementX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn movement_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_x_shim(val); self } #[doc = "Change the `movementY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn movement_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_y_shim(val); self } #[cfg(feature = "EventTarget")] @@ -421,51 +250,21 @@ impl MouseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `MouseEventInit`*"] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relatedTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.related_target_shim(val); self } #[doc = "Change the `screenX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn screen_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_x_shim(val); self } #[doc = "Change the `screenY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub fn screen_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_y_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MutationObserverInit.rs b/crates/web-sys/src/features/gen_MutationObserverInit.rs index 736ea70929d..35251f2f6e8 100644 --- a/crates/web-sys/src/features/gen_MutationObserverInit.rs +++ b/crates/web-sys/src/features/gen_MutationObserverInit.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub type MutationObserverInit; + #[wasm_bindgen(method, setter = "animations")] + fn animations_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "attributeFilter")] + fn attribute_filter_shim(this: &MutationObserverInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "attributeOldValue")] + fn attribute_old_value_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "attributes")] + fn attributes_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "characterData")] + fn character_data_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "characterDataOldValue")] + fn character_data_old_value_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "childList")] + fn child_list_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "nativeAnonymousChildList")] + fn native_anonymous_child_list_shim(this: &MutationObserverInit, val: bool); + #[wasm_bindgen(method, setter = "subtree")] + fn subtree_shim(this: &MutationObserverInit, val: bool); } impl MutationObserverInit { #[doc = "Construct a new `MutationObserverInit`."] @@ -24,153 +42,63 @@ impl MutationObserverInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn animations(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("animations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.animations_shim(val); self } #[doc = "Change the `attributeFilter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn attribute_filter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributeFilter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribute_filter_shim(val); self } #[doc = "Change the `attributeOldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn attribute_old_value(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributeOldValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribute_old_value_shim(val); self } #[doc = "Change the `attributes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn attributes(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attributes_shim(val); self } #[doc = "Change the `characterData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn character_data(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("characterData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.character_data_shim(val); self } #[doc = "Change the `characterDataOldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn character_data_old_value(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("characterDataOldValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.character_data_old_value_shim(val); self } #[doc = "Change the `childList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn child_list(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("childList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.child_list_shim(val); self } #[doc = "Change the `nativeAnonymousChildList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn native_anonymous_child_list(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nativeAnonymousChildList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.native_anonymous_child_list_shim(val); self } #[doc = "Change the `subtree` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub fn subtree(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("subtree"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.subtree_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_MutationObservingInfo.rs b/crates/web-sys/src/features/gen_MutationObservingInfo.rs index 38d26e33323..ebe00cccdf0 100644 --- a/crates/web-sys/src/features/gen_MutationObservingInfo.rs +++ b/crates/web-sys/src/features/gen_MutationObservingInfo.rs @@ -10,6 +10,27 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub type MutationObservingInfo; + #[wasm_bindgen(method, setter = "animations")] + fn animations_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "attributeFilter")] + fn attribute_filter_shim(this: &MutationObservingInfo, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "attributeOldValue")] + fn attribute_old_value_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "attributes")] + fn attributes_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "characterData")] + fn character_data_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "characterDataOldValue")] + fn character_data_old_value_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "childList")] + fn child_list_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "nativeAnonymousChildList")] + fn native_anonymous_child_list_shim(this: &MutationObservingInfo, val: bool); + #[wasm_bindgen(method, setter = "subtree")] + fn subtree_shim(this: &MutationObservingInfo, val: bool); + #[cfg(feature = "Node")] + #[wasm_bindgen(method, setter = "observedNode")] + fn observed_node_shim(this: &MutationObservingInfo, val: Option<&Node>); } impl MutationObservingInfo { #[doc = "Construct a new `MutationObservingInfo`."] @@ -24,153 +45,63 @@ impl MutationObservingInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn animations(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("animations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.animations_shim(val); self } #[doc = "Change the `attributeFilter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn attribute_filter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributeFilter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribute_filter_shim(val); self } #[doc = "Change the `attributeOldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn attribute_old_value(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributeOldValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attribute_old_value_shim(val); self } #[doc = "Change the `attributes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn attributes(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attributes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attributes_shim(val); self } #[doc = "Change the `characterData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn character_data(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("characterData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.character_data_shim(val); self } #[doc = "Change the `characterDataOldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn character_data_old_value(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("characterDataOldValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.character_data_old_value_shim(val); self } #[doc = "Change the `childList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn child_list(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("childList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.child_list_shim(val); self } #[doc = "Change the `nativeAnonymousChildList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn native_anonymous_child_list(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nativeAnonymousChildList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.native_anonymous_child_list_shim(val); self } #[doc = "Change the `subtree` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub fn subtree(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("subtree"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.subtree_shim(val); self } #[cfg(feature = "Node")] @@ -178,17 +109,7 @@ impl MutationObservingInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`, `Node`*"] pub fn observed_node(&mut self, val: Option<&Node>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("observedNode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.observed_node_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs index d50a70e44b1..5245faddf78 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] pub type NativeOsFileReadOptions; + #[wasm_bindgen(method, setter = "bytes")] + fn bytes_shim(this: &NativeOsFileReadOptions, val: Option); + #[wasm_bindgen(method, setter = "encoding")] + fn encoding_shim(this: &NativeOsFileReadOptions, val: Option<&str>); } impl NativeOsFileReadOptions { #[doc = "Construct a new `NativeOsFileReadOptions`."] @@ -24,30 +28,14 @@ impl NativeOsFileReadOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] pub fn bytes(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("bytes"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_shim(val); self } #[doc = "Change the `encoding` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] pub fn encoding(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("encoding"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.encoding_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs index 3e3c2fd082b..7310b9a165b 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub type NativeOsFileWriteAtomicOptions; + #[wasm_bindgen(method, setter = "backupTo")] + fn backup_to_shim(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); + #[wasm_bindgen(method, setter = "bytes")] + fn bytes_shim(this: &NativeOsFileWriteAtomicOptions, val: Option); + #[wasm_bindgen(method, setter = "flush")] + fn flush_shim(this: &NativeOsFileWriteAtomicOptions, val: bool); + #[wasm_bindgen(method, setter = "noOverwrite")] + fn no_overwrite_shim(this: &NativeOsFileWriteAtomicOptions, val: bool); + #[wasm_bindgen(method, setter = "tmpPath")] + fn tmp_path_shim(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); } impl NativeOsFileWriteAtomicOptions { #[doc = "Construct a new `NativeOsFileWriteAtomicOptions`."] @@ -24,77 +34,35 @@ impl NativeOsFileWriteAtomicOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub fn backup_to(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("backupTo"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.backup_to_shim(val); self } #[doc = "Change the `bytes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub fn bytes(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("bytes"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_shim(val); self } #[doc = "Change the `flush` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub fn flush(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flush"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flush_shim(val); self } #[doc = "Change the `noOverwrite` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub fn no_overwrite(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("noOverwrite"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.no_overwrite_shim(val); self } #[doc = "Change the `tmpPath` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub fn tmp_path(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("tmpPath"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tmp_path_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs index a50203b5aae..d90b1a5fcd7 100644 --- a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs @@ -10,6 +10,92 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub type NetworkCommandOptions; + #[wasm_bindgen(method, setter = "cmd")] + fn cmd_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "curExternalIfname")] + fn cur_external_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "curInternalIfname")] + fn cur_internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "dns1")] + fn dns1_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "dns1_long")] + fn dns1_long_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "dns2")] + fn dns2_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "dns2_long")] + fn dns2_long_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "dnses")] + fn dnses_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "domain")] + fn domain_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "enable")] + fn enable_shim(this: &NetworkCommandOptions, val: bool); + #[wasm_bindgen(method, setter = "enabled")] + fn enabled_shim(this: &NetworkCommandOptions, val: bool); + #[wasm_bindgen(method, setter = "endIp")] + fn end_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "externalIfname")] + fn external_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "gateway")] + fn gateway_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "gateway_long")] + fn gateway_long_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "gateways")] + fn gateways_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "ifname")] + fn ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "interfaceList")] + fn interface_list_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "internalIfname")] + fn internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "ip")] + fn ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "ipaddr")] + fn ipaddr_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "key")] + fn key_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "link")] + fn link_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "mask")] + fn mask_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "maskLength")] + fn mask_length_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "mtu")] + fn mtu_shim(this: &NetworkCommandOptions, val: i32); + #[wasm_bindgen(method, setter = "preExternalIfname")] + fn pre_external_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "preInternalIfname")] + fn pre_internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "prefix")] + fn prefix_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "prefixLength")] + fn prefix_length_shim(this: &NetworkCommandOptions, val: u32); + #[wasm_bindgen(method, setter = "report")] + fn report_shim(this: &NetworkCommandOptions, val: bool); + #[wasm_bindgen(method, setter = "security")] + fn security_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "serverIp")] + fn server_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "ssid")] + fn ssid_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "startIp")] + fn start_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "threshold")] + fn threshold_shim(this: &NetworkCommandOptions, val: f64); + #[wasm_bindgen(method, setter = "usbEndIp")] + fn usb_end_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "usbStartIp")] + fn usb_start_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "wifiEndIp")] + fn wifi_end_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "wifiStartIp")] + fn wifi_start_ip_shim(this: &NetworkCommandOptions, val: &str); + #[wasm_bindgen(method, setter = "wifictrlinterfacename")] + fn wifictrlinterfacename_shim(this: &NetworkCommandOptions, val: &str); } impl NetworkCommandOptions { #[doc = "Construct a new `NetworkCommandOptions`."] @@ -24,661 +110,301 @@ impl NetworkCommandOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn cmd(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cmd"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cmd_shim(val); self } #[doc = "Change the `curExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn cur_external_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("curExternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cur_external_ifname_shim(val); self } #[doc = "Change the `curInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn cur_internal_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("curInternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cur_internal_ifname_shim(val); self } #[doc = "Change the `dns1` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn dns1(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dns1"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns1_shim(val); self } #[doc = "Change the `dns1_long` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn dns1_long(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dns1_long"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns1_long_shim(val); self } #[doc = "Change the `dns2` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn dns2(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dns2"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns2_shim(val); self } #[doc = "Change the `dns2_long` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn dns2_long(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dns2_long"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns2_long_shim(val); self } #[doc = "Change the `dnses` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn dnses(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dnses"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dnses_shim(val); self } #[doc = "Change the `domain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn domain(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("domain"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.domain_shim(val); self } #[doc = "Change the `enable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn enable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("enable"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.enable_shim(val); self } #[doc = "Change the `enabled` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn enabled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("enabled"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.enabled_shim(val); self } #[doc = "Change the `endIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn end_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("endIp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_ip_shim(val); self } #[doc = "Change the `externalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn external_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("externalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.external_ifname_shim(val); self } #[doc = "Change the `gateway` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn gateway(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gateway"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gateway_shim(val); self } #[doc = "Change the `gateway_long` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn gateway_long(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gateway_long"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gateway_long_shim(val); self } #[doc = "Change the `gateways` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn gateways(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gateways"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gateways_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn id(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `ifname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ifname"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ifname_shim(val); self } #[doc = "Change the `interfaceList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn interface_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("interfaceList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.interface_list_shim(val); self } #[doc = "Change the `internalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn internal_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("internalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.internal_ifname_shim(val); self } #[doc = "Change the `ip` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ip"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ip_shim(val); self } #[doc = "Change the `ipaddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn ipaddr(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ipaddr"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ipaddr_shim(val); self } #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn key(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("key"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_shim(val); self } #[doc = "Change the `link` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn link(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("link"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.link_shim(val); self } #[doc = "Change the `mask` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn mask(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mask"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_shim(val); self } #[doc = "Change the `maskLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn mask_length(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maskLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_length_shim(val); self } #[doc = "Change the `mode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn mode(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[doc = "Change the `mtu` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn mtu(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mtu"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mtu_shim(val); self } #[doc = "Change the `preExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn pre_external_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preExternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pre_external_ifname_shim(val); self } #[doc = "Change the `preInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn pre_internal_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preInternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pre_internal_ifname_shim(val); self } #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn prefix(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("prefix"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefix_shim(val); self } #[doc = "Change the `prefixLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn prefix_length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("prefixLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefix_length_shim(val); self } #[doc = "Change the `report` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn report(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("report"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.report_shim(val); self } #[doc = "Change the `security` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn security(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("security"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.security_shim(val); self } #[doc = "Change the `serverIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn server_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serverIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.server_ip_shim(val); self } #[doc = "Change the `ssid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn ssid(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssid_shim(val); self } #[doc = "Change the `startIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn start_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_ip_shim(val); self } #[doc = "Change the `threshold` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn threshold(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("threshold"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.threshold_shim(val); self } #[doc = "Change the `usbEndIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn usb_end_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbEndIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_end_ip_shim(val); self } #[doc = "Change the `usbStartIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn usb_start_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbStartIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_start_ip_shim(val); self } #[doc = "Change the `wifiEndIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn wifi_end_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("wifiEndIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.wifi_end_ip_shim(val); self } #[doc = "Change the `wifiStartIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn wifi_start_ip(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("wifiStartIp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.wifi_start_ip_shim(val); self } #[doc = "Change the `wifictrlinterfacename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub fn wifictrlinterfacename(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("wifictrlinterfacename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.wifictrlinterfacename_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NetworkResultOptions.rs b/crates/web-sys/src/features/gen_NetworkResultOptions.rs index 44acd57ae2e..10662e3b521 100644 --- a/crates/web-sys/src/features/gen_NetworkResultOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkResultOptions.rs @@ -10,6 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub type NetworkResultOptions; + #[wasm_bindgen(method, setter = "broadcast")] + fn broadcast_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "curExternalIfname")] + fn cur_external_ifname_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "curInternalIfname")] + fn cur_internal_ifname_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "dns1")] + fn dns1_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "dns1_str")] + fn dns1_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "dns2")] + fn dns2_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "dns2_str")] + fn dns2_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "enable")] + fn enable_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "flag")] + fn flag_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "gateway")] + fn gateway_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "gateway_str")] + fn gateway_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "interfaceList")] + fn interface_list_shim(this: &NetworkResultOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "ipAddr")] + fn ip_addr_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "ipaddr")] + fn ipaddr_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "ipaddr_str")] + fn ipaddr_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "lease")] + fn lease_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "macAddr")] + fn mac_addr_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "mask")] + fn mask_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "mask_str")] + fn mask_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "netId")] + fn net_id_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "prefixLength")] + fn prefix_length_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "reply")] + fn reply_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "result")] + fn result_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "resultCode")] + fn result_code_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "resultReason")] + fn result_reason_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "ret")] + fn ret_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "route")] + fn route_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "server")] + fn server_shim(this: &NetworkResultOptions, val: i32); + #[wasm_bindgen(method, setter = "server_str")] + fn server_str_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "success")] + fn success_shim(this: &NetworkResultOptions, val: bool); + #[wasm_bindgen(method, setter = "topic")] + fn topic_shim(this: &NetworkResultOptions, val: &str); + #[wasm_bindgen(method, setter = "vendor_str")] + fn vendor_str_shim(this: &NetworkResultOptions, val: &str); } impl NetworkResultOptions { #[doc = "Construct a new `NetworkResultOptions`."] @@ -24,529 +94,245 @@ impl NetworkResultOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn broadcast(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("broadcast"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.broadcast_shim(val); self } #[doc = "Change the `curExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn cur_external_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("curExternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cur_external_ifname_shim(val); self } #[doc = "Change the `curInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn cur_internal_ifname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("curInternalIfname"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cur_internal_ifname_shim(val); self } #[doc = "Change the `dns1` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn dns1(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dns1"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns1_shim(val); self } #[doc = "Change the `dns1_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn dns1_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dns1_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns1_str_shim(val); self } #[doc = "Change the `dns2` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn dns2(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dns2"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns2_shim(val); self } #[doc = "Change the `dns2_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn dns2_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dns2_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dns2_str_shim(val); self } #[doc = "Change the `enable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn enable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("enable"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.enable_shim(val); self } #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn error(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[doc = "Change the `flag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn flag(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flag"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flag_shim(val); self } #[doc = "Change the `gateway` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn gateway(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gateway"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gateway_shim(val); self } #[doc = "Change the `gateway_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn gateway_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gateway_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gateway_str_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn id(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `interfaceList` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn interface_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("interfaceList"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.interface_list_shim(val); self } #[doc = "Change the `ipAddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn ip_addr(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ipAddr"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ip_addr_shim(val); self } #[doc = "Change the `ipaddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn ipaddr(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ipaddr"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ipaddr_shim(val); self } #[doc = "Change the `ipaddr_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn ipaddr_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ipaddr_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ipaddr_str_shim(val); self } #[doc = "Change the `lease` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn lease(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("lease"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lease_shim(val); self } #[doc = "Change the `macAddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn mac_addr(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("macAddr"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mac_addr_shim(val); self } #[doc = "Change the `mask` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn mask(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mask"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_shim(val); self } #[doc = "Change the `mask_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn mask_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mask_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mask_str_shim(val); self } #[doc = "Change the `netId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn net_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("netId"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.net_id_shim(val); self } #[doc = "Change the `prefixLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn prefix_length(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("prefixLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prefix_length_shim(val); self } #[doc = "Change the `reason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn reason(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } #[doc = "Change the `reply` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn reply(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reply"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reply_shim(val); self } #[doc = "Change the `result` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn result(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("result"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.result_shim(val); self } #[doc = "Change the `resultCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn result_code(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resultCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.result_code_shim(val); self } #[doc = "Change the `resultReason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn result_reason(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resultReason"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.result_reason_shim(val); self } #[doc = "Change the `ret` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn ret(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ret"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ret_shim(val); self } #[doc = "Change the `route` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn route(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("route"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.route_shim(val); self } #[doc = "Change the `server` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn server(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("server"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.server_shim(val); self } #[doc = "Change the `server_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn server_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("server_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.server_str_shim(val); self } #[doc = "Change the `success` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn success(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("success"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.success_shim(val); self } #[doc = "Change the `topic` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn topic(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("topic"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.topic_shim(val); self } #[doc = "Change the `vendor_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub fn vendor_str(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("vendor_str"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.vendor_str_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NodeFilter.rs b/crates/web-sys/src/features/gen_NodeFilter.rs index f5838a15181..9f41f29e589 100644 --- a/crates/web-sys/src/features/gen_NodeFilter.rs +++ b/crates/web-sys/src/features/gen_NodeFilter.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] pub type NodeFilter; + #[wasm_bindgen(method, setter = "acceptNode")] + fn accept_node_shim(this: &NodeFilter, val: &::js_sys::Function); } impl NodeFilter { #[doc = "Construct a new `NodeFilter`."] @@ -24,17 +26,7 @@ impl NodeFilter { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] pub fn accept_node(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("acceptNode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.accept_node_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationAction.rs b/crates/web-sys/src/features/gen_NotificationAction.rs index 919e13c0f37..24bfb4d8b22 100644 --- a/crates/web-sys/src/features/gen_NotificationAction.rs +++ b/crates/web-sys/src/features/gen_NotificationAction.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] pub type NotificationAction; + #[wasm_bindgen(method, setter = "action")] + fn action_shim(this: &NotificationAction, val: &str); + #[wasm_bindgen(method, setter = "icon")] + fn icon_shim(this: &NotificationAction, val: &str); + #[wasm_bindgen(method, setter = "title")] + fn title_shim(this: &NotificationAction, val: &str); } impl NotificationAction { #[doc = "Construct a new `NotificationAction`."] @@ -26,40 +32,21 @@ impl NotificationAction { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] pub fn action(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("action"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.action_shim(val); self } #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] pub fn icon(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.icon_shim(val); self } #[doc = "Change the `title` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] pub fn title(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.title_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationEventInit.rs b/crates/web-sys/src/features/gen_NotificationEventInit.rs index 1f0e3f068c8..6e73ccc7bf2 100644 --- a/crates/web-sys/src/features/gen_NotificationEventInit.rs +++ b/crates/web-sys/src/features/gen_NotificationEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] pub type NotificationEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &NotificationEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &NotificationEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &NotificationEventInit, val: bool); + #[cfg(feature = "Notification")] + #[wasm_bindgen(method, setter = "notification")] + fn notification_shim(this: &NotificationEventInit, val: &Notification); } impl NotificationEventInit { #[cfg(feature = "Notification")] @@ -26,51 +35,21 @@ impl NotificationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Notification")] @@ -78,17 +57,7 @@ impl NotificationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationEventInit`*"] pub fn notification(&mut self, val: &Notification) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("notification"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.notification_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationOptions.rs b/crates/web-sys/src/features/gen_NotificationOptions.rs index ec01ac68a66..cd07eebe53a 100644 --- a/crates/web-sys/src/features/gen_NotificationOptions.rs +++ b/crates/web-sys/src/features/gen_NotificationOptions.rs @@ -10,6 +10,33 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub type NotificationOptions; + #[wasm_bindgen(method, setter = "actions")] + fn actions_shim(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "badge")] + fn badge_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "body")] + fn body_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "NotificationDirection")] + #[wasm_bindgen(method, setter = "dir")] + fn dir_shim(this: &NotificationOptions, val: NotificationDirection); + #[wasm_bindgen(method, setter = "icon")] + fn icon_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "image")] + fn image_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "lang")] + fn lang_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "renotify")] + fn renotify_shim(this: &NotificationOptions, val: bool); + #[wasm_bindgen(method, setter = "requireInteraction")] + fn require_interaction_shim(this: &NotificationOptions, val: bool); + #[wasm_bindgen(method, setter = "silent")] + fn silent_shim(this: &NotificationOptions, val: Option); + #[wasm_bindgen(method, setter = "tag")] + fn tag_shim(this: &NotificationOptions, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &NotificationOptions, val: f64); } impl NotificationOptions { #[doc = "Construct a new `NotificationOptions`."] @@ -24,56 +51,28 @@ impl NotificationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn actions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("actions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.actions_shim(val); self } #[doc = "Change the `badge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn badge(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("badge"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.badge_shim(val); self } #[doc = "Change the `body` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn body(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("body"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.body_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[cfg(feature = "NotificationDirection")] @@ -81,130 +80,63 @@ impl NotificationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationDirection`, `NotificationOptions`*"] pub fn dir(&mut self, val: NotificationDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("dir"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dir_shim(val); self } #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn icon(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.icon_shim(val); self } #[doc = "Change the `image` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn image(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("image"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.image_shim(val); self } #[doc = "Change the `lang` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn lang(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("lang"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lang_shim(val); self } #[doc = "Change the `renotify` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn renotify(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("renotify"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.renotify_shim(val); self } #[doc = "Change the `requireInteraction` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn require_interaction(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requireInteraction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.require_interaction_shim(val); self } #[doc = "Change the `silent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn silent(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("silent"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.silent_shim(val); self } #[doc = "Change the `tag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn tag(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tag"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tag_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ObserverCallback.rs b/crates/web-sys/src/features/gen_ObserverCallback.rs index 6845b0ffd6d..6136af2a956 100644 --- a/crates/web-sys/src/features/gen_ObserverCallback.rs +++ b/crates/web-sys/src/features/gen_ObserverCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] pub type ObserverCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &ObserverCallback, val: &::js_sys::Function); } impl ObserverCallback { #[doc = "Construct a new `ObserverCallback`."] @@ -24,17 +26,7 @@ impl ObserverCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs index b69f605943b..dc607168d11 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] pub type OfflineAudioCompletionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &OfflineAudioCompletionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &OfflineAudioCompletionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &OfflineAudioCompletionEventInit, val: bool); + #[cfg(feature = "AudioBuffer")] + #[wasm_bindgen(method, setter = "renderedBuffer")] + fn rendered_buffer_shim(this: &OfflineAudioCompletionEventInit, val: &AudioBuffer); } impl OfflineAudioCompletionEventInit { #[cfg(feature = "AudioBuffer")] @@ -26,51 +35,21 @@ impl OfflineAudioCompletionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "AudioBuffer")] @@ -78,17 +57,7 @@ impl OfflineAudioCompletionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `OfflineAudioCompletionEventInit`*"] pub fn rendered_buffer(&mut self, val: &AudioBuffer) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("renderedBuffer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rendered_buffer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs index 433659505c0..a60ff33bc11 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] pub type OfflineAudioContextOptions; + #[wasm_bindgen(method, setter = "length")] + fn length_shim(this: &OfflineAudioContextOptions, val: u32); + #[wasm_bindgen(method, setter = "numberOfChannels")] + fn number_of_channels_shim(this: &OfflineAudioContextOptions, val: u32); + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &OfflineAudioContextOptions, val: f32); } impl OfflineAudioContextOptions { #[doc = "Construct a new `OfflineAudioContextOptions`."] @@ -26,48 +32,21 @@ impl OfflineAudioContextOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] pub fn length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("length"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_shim(val); self } #[doc = "Change the `numberOfChannels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numberOfChannels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.number_of_channels_shim(val); self } #[doc = "Change the `sampleRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sampleRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_rate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs index 7662f05b2e2..533bef161de 100644 --- a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type OpenFilePickerOptions; + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + fn exclude_accept_all_option_shim(this: &OpenFilePickerOptions, val: bool); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &OpenFilePickerOptions, val: &str); + #[wasm_bindgen(method, setter = "startIn")] + fn start_in_shim(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "types")] + fn types_shim(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "multiple")] + fn multiple_shim(this: &OpenFilePickerOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl OpenFilePickerOptions { @@ -36,17 +46,7 @@ impl OpenFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("excludeAcceptAllOption"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exclude_accept_all_option_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +57,7 @@ impl OpenFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +68,7 @@ impl OpenFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startIn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_in_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,13 +79,7 @@ impl OpenFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.types_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -112,17 +90,7 @@ impl OpenFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn multiple(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("multiple"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.multiple_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs index 2c13e8bd999..326eedf30c9 100644 --- a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs +++ b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] pub type OpenWindowEventDetail; + #[wasm_bindgen(method, setter = "features")] + fn features_shim(this: &OpenWindowEventDetail, val: &str); + #[cfg(feature = "Node")] + #[wasm_bindgen(method, setter = "frameElement")] + fn frame_element_shim(this: &OpenWindowEventDetail, val: Option<&Node>); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &OpenWindowEventDetail, val: &str); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &OpenWindowEventDetail, val: &str); } impl OpenWindowEventDetail { #[doc = "Construct a new `OpenWindowEventDetail`."] @@ -24,17 +33,7 @@ impl OpenWindowEventDetail { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] pub fn features(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("features"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.features_shim(val); self } #[cfg(feature = "Node")] @@ -42,43 +41,21 @@ impl OpenWindowEventDetail { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`, `OpenWindowEventDetail`*"] pub fn frame_element(&mut self, val: Option<&Node>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameElement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_element_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] pub fn url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs index 6f751434162..a55b56f6bb6 100644 --- a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs +++ b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub type OptionalEffectTiming; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &OptionalEffectTiming, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &OptionalEffectTiming, val: PlaybackDirection); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &OptionalEffectTiming, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "easing")] + fn easing_shim(this: &OptionalEffectTiming, val: &str); + #[wasm_bindgen(method, setter = "endDelay")] + fn end_delay_shim(this: &OptionalEffectTiming, val: f64); + #[cfg(feature = "FillMode")] + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &OptionalEffectTiming, val: FillMode); + #[wasm_bindgen(method, setter = "iterationStart")] + fn iteration_start_shim(this: &OptionalEffectTiming, val: f64); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &OptionalEffectTiming, val: f64); } impl OptionalEffectTiming { #[doc = "Construct a new `OptionalEffectTiming`."] @@ -24,13 +42,7 @@ impl OptionalEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(feature = "PlaybackDirection")] @@ -38,65 +50,28 @@ impl OptionalEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`, `PlaybackDirection`*"] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn easing(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("easing"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.easing_shim(val); self } #[doc = "Change the `endDelay` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn end_delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endDelay"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_delay_shim(val); self } #[cfg(feature = "FillMode")] @@ -104,47 +79,21 @@ impl OptionalEffectTiming { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FillMode`, `OptionalEffectTiming`*"] pub fn fill(&mut self, val: FillMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[doc = "Change the `iterationStart` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterationStart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iteration_start_shim(val); self } #[doc = "Change the `iterations` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub fn iterations(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_OscillatorOptions.rs b/crates/web-sys/src/features/gen_OscillatorOptions.rs index b03f091503c..52a53e00595 100644 --- a/crates/web-sys/src/features/gen_OscillatorOptions.rs +++ b/crates/web-sys/src/features/gen_OscillatorOptions.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] pub type OscillatorOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &OscillatorOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &OscillatorOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &OscillatorOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "detune")] + fn detune_shim(this: &OscillatorOptions, val: f32); + #[wasm_bindgen(method, setter = "frequency")] + fn frequency_shim(this: &OscillatorOptions, val: f32); + #[cfg(feature = "PeriodicWave")] + #[wasm_bindgen(method, setter = "periodicWave")] + fn periodic_wave_shim(this: &OscillatorOptions, val: &PeriodicWave); + #[cfg(feature = "OscillatorType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &OscillatorOptions, val: OscillatorType); } impl OscillatorOptions { #[doc = "Construct a new `OscillatorOptions`."] @@ -24,17 +42,7 @@ impl OscillatorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +50,7 @@ impl OscillatorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `OscillatorOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,48 +58,21 @@ impl OscillatorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `OscillatorOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `detune` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] pub fn detune(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detune"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detune_shim(val); self } #[doc = "Change the `frequency` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] pub fn frequency(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frequency"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frequency_shim(val); self } #[cfg(feature = "PeriodicWave")] @@ -109,17 +80,7 @@ impl OscillatorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `PeriodicWave`*"] pub fn periodic_wave(&mut self, val: &PeriodicWave) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("periodicWave"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.periodic_wave_shim(val); self } #[cfg(feature = "OscillatorType")] @@ -127,13 +88,7 @@ impl OscillatorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `OscillatorType`*"] pub fn type_(&mut self, val: OscillatorType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PageTransitionEventInit.rs b/crates/web-sys/src/features/gen_PageTransitionEventInit.rs index bcee3d8362f..3474f5bcb49 100644 --- a/crates/web-sys/src/features/gen_PageTransitionEventInit.rs +++ b/crates/web-sys/src/features/gen_PageTransitionEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub type PageTransitionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PageTransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PageTransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PageTransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "inFrameSwap")] + fn in_frame_swap_shim(this: &PageTransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "persisted")] + fn persisted_shim(this: &PageTransitionEventInit, val: bool); } impl PageTransitionEventInit { #[doc = "Construct a new `PageTransitionEventInit`."] @@ -24,85 +34,35 @@ impl PageTransitionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `inFrameSwap` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub fn in_frame_swap(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inFrameSwap"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.in_frame_swap_shim(val); self } #[doc = "Change the `persisted` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub fn persisted(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("persisted"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.persisted_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PannerOptions.rs b/crates/web-sys/src/features/gen_PannerOptions.rs index 42aceaa07f3..357ea977eb0 100644 --- a/crates/web-sys/src/features/gen_PannerOptions.rs +++ b/crates/web-sys/src/features/gen_PannerOptions.rs @@ -10,6 +10,44 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub type PannerOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &PannerOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &PannerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &PannerOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "coneInnerAngle")] + fn cone_inner_angle_shim(this: &PannerOptions, val: f64); + #[wasm_bindgen(method, setter = "coneOuterAngle")] + fn cone_outer_angle_shim(this: &PannerOptions, val: f64); + #[wasm_bindgen(method, setter = "coneOuterGain")] + fn cone_outer_gain_shim(this: &PannerOptions, val: f64); + #[cfg(feature = "DistanceModelType")] + #[wasm_bindgen(method, setter = "distanceModel")] + fn distance_model_shim(this: &PannerOptions, val: DistanceModelType); + #[wasm_bindgen(method, setter = "maxDistance")] + fn max_distance_shim(this: &PannerOptions, val: f64); + #[wasm_bindgen(method, setter = "orientationX")] + fn orientation_x_shim(this: &PannerOptions, val: f32); + #[wasm_bindgen(method, setter = "orientationY")] + fn orientation_y_shim(this: &PannerOptions, val: f32); + #[wasm_bindgen(method, setter = "orientationZ")] + fn orientation_z_shim(this: &PannerOptions, val: f32); + #[cfg(feature = "PanningModelType")] + #[wasm_bindgen(method, setter = "panningModel")] + fn panning_model_shim(this: &PannerOptions, val: PanningModelType); + #[wasm_bindgen(method, setter = "positionX")] + fn position_x_shim(this: &PannerOptions, val: f32); + #[wasm_bindgen(method, setter = "positionY")] + fn position_y_shim(this: &PannerOptions, val: f32); + #[wasm_bindgen(method, setter = "positionZ")] + fn position_z_shim(this: &PannerOptions, val: f32); + #[wasm_bindgen(method, setter = "refDistance")] + fn ref_distance_shim(this: &PannerOptions, val: f64); + #[wasm_bindgen(method, setter = "rolloffFactor")] + fn rolloff_factor_shim(this: &PannerOptions, val: f64); } impl PannerOptions { #[doc = "Construct a new `PannerOptions`."] @@ -24,17 +62,7 @@ impl PannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +70,7 @@ impl PannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `PannerOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,68 +78,28 @@ impl PannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `PannerOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `coneInnerAngle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn cone_inner_angle(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("coneInnerAngle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cone_inner_angle_shim(val); self } #[doc = "Change the `coneOuterAngle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn cone_outer_angle(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("coneOuterAngle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cone_outer_angle_shim(val); self } #[doc = "Change the `coneOuterGain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn cone_outer_gain(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("coneOuterGain"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cone_outer_gain_shim(val); self } #[cfg(feature = "DistanceModelType")] @@ -129,85 +107,35 @@ impl PannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DistanceModelType`, `PannerOptions`*"] pub fn distance_model(&mut self, val: DistanceModelType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("distanceModel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.distance_model_shim(val); self } #[doc = "Change the `maxDistance` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn max_distance(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxDistance"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_distance_shim(val); self } #[doc = "Change the `orientationX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn orientation_x(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("orientationX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.orientation_x_shim(val); self } #[doc = "Change the `orientationY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn orientation_y(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("orientationY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.orientation_y_shim(val); self } #[doc = "Change the `orientationZ` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn orientation_z(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("orientationZ"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.orientation_z_shim(val); self } #[cfg(feature = "PanningModelType")] @@ -215,102 +143,42 @@ impl PannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`, `PanningModelType`*"] pub fn panning_model(&mut self, val: PanningModelType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("panningModel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.panning_model_shim(val); self } #[doc = "Change the `positionX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn position_x(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("positionX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.position_x_shim(val); self } #[doc = "Change the `positionY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn position_y(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("positionY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.position_y_shim(val); self } #[doc = "Change the `positionZ` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn position_z(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("positionZ"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.position_z_shim(val); self } #[doc = "Change the `refDistance` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn ref_distance(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("refDistance"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ref_distance_shim(val); self } #[doc = "Change the `rolloffFactor` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub fn rolloff_factor(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rolloffFactor"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rolloff_factor_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs index 0e442cb2b64..91144f4a6e6 100644 --- a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub type PaymentMethodChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PaymentMethodChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PaymentMethodChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PaymentMethodChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "methodDetails")] + fn method_details_shim(this: &PaymentMethodChangeEventInit, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "methodName")] + fn method_name_shim(this: &PaymentMethodChangeEventInit, val: &str); } impl PaymentMethodChangeEventInit { #[doc = "Construct a new `PaymentMethodChangeEventInit`."] @@ -25,85 +35,35 @@ impl PaymentMethodChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `methodDetails` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub fn method_details(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("methodDetails"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.method_details_shim(val); self } #[doc = "Change the `methodName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub fn method_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("methodName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.method_name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs b/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs index 5bf0fb7e3fd..0b096480b99 100644 --- a/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] pub type PaymentRequestUpdateEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PaymentRequestUpdateEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PaymentRequestUpdateEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PaymentRequestUpdateEventInit, val: bool); } impl PaymentRequestUpdateEventInit { #[doc = "Construct a new `PaymentRequestUpdateEventInit`."] @@ -24,51 +30,21 @@ impl PaymentRequestUpdateEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_Pbkdf2Params.rs b/crates/web-sys/src/features/gen_Pbkdf2Params.rs index 13aafec0ea1..744c157c142 100644 --- a/crates/web-sys/src/features/gen_Pbkdf2Params.rs +++ b/crates/web-sys/src/features/gen_Pbkdf2Params.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub type Pbkdf2Params; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &Pbkdf2Params, val: &str); + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &Pbkdf2Params, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iterations")] + fn iterations_shim(this: &Pbkdf2Params, val: u32); + #[wasm_bindgen(method, setter = "salt")] + fn salt_shim(this: &Pbkdf2Params, val: &::js_sys::Object); } impl Pbkdf2Params { #[doc = "Construct a new `Pbkdf2Params`."] @@ -33,56 +41,28 @@ impl Pbkdf2Params { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `hash` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } #[doc = "Change the `iterations` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub fn iterations(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iterations"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.iterations_shim(val); self } #[doc = "Change the `salt` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub fn salt(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("salt"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.salt_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs index ee66983790d..b83c1ba16a4 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs @@ -10,6 +10,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub type PerformanceEntryEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PerformanceEntryEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PerformanceEntryEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PerformanceEntryEventInit, val: bool); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &PerformanceEntryEventInit, val: f64); + #[wasm_bindgen(method, setter = "entryType")] + fn entry_type_shim(this: &PerformanceEntryEventInit, val: &str); + #[wasm_bindgen(method, setter = "epoch")] + fn epoch_shim(this: &PerformanceEntryEventInit, val: f64); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PerformanceEntryEventInit, val: &str); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &PerformanceEntryEventInit, val: &str); + #[wasm_bindgen(method, setter = "startTime")] + fn start_time_shim(this: &PerformanceEntryEventInit, val: f64); } impl PerformanceEntryEventInit { #[doc = "Construct a new `PerformanceEntryEventInit`."] @@ -24,142 +42,63 @@ impl PerformanceEntryEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[doc = "Change the `entryType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn entry_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_type_shim(val); self } #[doc = "Change the `epoch` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn epoch(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("epoch"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.epoch_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn origin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `startTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub fn start_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs index 052aac4d7e8..f126babe13d 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] pub type PerformanceEntryFilterOptions; + #[wasm_bindgen(method, setter = "entryType")] + fn entry_type_shim(this: &PerformanceEntryFilterOptions, val: &str); + #[wasm_bindgen(method, setter = "initiatorType")] + fn initiator_type_shim(this: &PerformanceEntryFilterOptions, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PerformanceEntryFilterOptions, val: &str); } impl PerformanceEntryFilterOptions { #[doc = "Construct a new `PerformanceEntryFilterOptions`."] @@ -24,47 +30,21 @@ impl PerformanceEntryFilterOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] pub fn entry_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_type_shim(val); self } #[doc = "Change the `initiatorType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] pub fn initiator_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("initiatorType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.initiator_type_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs index e6c559aa225..d7ab2ac72b8 100644 --- a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] pub type PerformanceObserverInit; + #[wasm_bindgen(method, setter = "buffered")] + fn buffered_shim(this: &PerformanceObserverInit, val: bool); + #[wasm_bindgen(method, setter = "entryTypes")] + fn entry_types_shim(this: &PerformanceObserverInit, val: &::wasm_bindgen::JsValue); } impl PerformanceObserverInit { #[doc = "Construct a new `PerformanceObserverInit`."] @@ -25,34 +29,14 @@ impl PerformanceObserverInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] pub fn buffered(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buffered"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffered_shim(val); self } #[doc = "Change the `entryTypes` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] pub fn entry_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("entryTypes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.entry_types_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs b/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs index 5c34222588c..66005726781 100644 --- a/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs +++ b/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] pub type PeriodicWaveConstraints; + #[wasm_bindgen(method, setter = "disableNormalization")] + fn disable_normalization_shim(this: &PeriodicWaveConstraints, val: bool); } impl PeriodicWaveConstraints { #[doc = "Construct a new `PeriodicWaveConstraints`."] @@ -24,17 +26,7 @@ impl PeriodicWaveConstraints { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("disableNormalization"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.disable_normalization_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs b/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs index bffe8632685..60a33a1061d 100644 --- a/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs +++ b/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] pub type PeriodicWaveOptions; + #[wasm_bindgen(method, setter = "disableNormalization")] + fn disable_normalization_shim(this: &PeriodicWaveOptions, val: bool); + #[wasm_bindgen(method, setter = "imag")] + fn imag_shim(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "real")] + fn real_shim(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); } impl PeriodicWaveOptions { #[doc = "Construct a new `PeriodicWaveOptions`."] @@ -24,43 +30,21 @@ impl PeriodicWaveOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("disableNormalization"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.disable_normalization_shim(val); self } #[doc = "Change the `imag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] pub fn imag(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("imag"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.imag_shim(val); self } #[doc = "Change the `real` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] pub fn real(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("real"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.real_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PermissionDescriptor.rs b/crates/web-sys/src/features/gen_PermissionDescriptor.rs index 596b50b43e4..5d5777773f3 100644 --- a/crates/web-sys/src/features/gen_PermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_PermissionDescriptor.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`*"] pub type PermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PermissionDescriptor, val: PermissionName); } impl PermissionDescriptor { #[cfg(feature = "PermissionName")] @@ -27,13 +30,7 @@ impl PermissionDescriptor { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`, `PermissionName`*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PlaneLayout.rs b/crates/web-sys/src/features/gen_PlaneLayout.rs index d472a1a6fc6..d5859a0db5a 100644 --- a/crates/web-sys/src/features/gen_PlaneLayout.rs +++ b/crates/web-sys/src/features/gen_PlaneLayout.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type PlaneLayout; + #[wasm_bindgen(method, setter = "offset")] + fn offset_shim(this: &PlaneLayout, val: u32); + #[wasm_bindgen(method, setter = "stride")] + fn stride_shim(this: &PlaneLayout, val: u32); } #[cfg(web_sys_unstable_apis)] impl PlaneLayout { @@ -38,14 +42,7 @@ impl PlaneLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn offset(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offset_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,14 +53,7 @@ impl PlaneLayout { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stride(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stride"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stride_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs index ccbf61ed92c..4a1f9c3f77d 100644 --- a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs +++ b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs @@ -10,6 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub type PluginCrashedEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PluginCrashedEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PluginCrashedEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PluginCrashedEventInit, val: bool); + #[wasm_bindgen(method, setter = "browserDumpID")] + fn browser_dump_id_shim(this: &PluginCrashedEventInit, val: Option<&str>); + #[wasm_bindgen(method, setter = "gmpPlugin")] + fn gmp_plugin_shim(this: &PluginCrashedEventInit, val: bool); + #[wasm_bindgen(method, setter = "pluginDumpID")] + fn plugin_dump_id_shim(this: &PluginCrashedEventInit, val: &str); + #[wasm_bindgen(method, setter = "pluginFilename")] + fn plugin_filename_shim(this: &PluginCrashedEventInit, val: Option<&str>); + #[wasm_bindgen(method, setter = "pluginID")] + fn plugin_id_shim(this: &PluginCrashedEventInit, val: u32); + #[wasm_bindgen(method, setter = "pluginName")] + fn plugin_name_shim(this: &PluginCrashedEventInit, val: &str); + #[wasm_bindgen(method, setter = "submittedCrashReport")] + fn submitted_crash_report_shim(this: &PluginCrashedEventInit, val: bool); } impl PluginCrashedEventInit { #[doc = "Construct a new `PluginCrashedEventInit`."] @@ -24,170 +44,70 @@ impl PluginCrashedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `browserDumpID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn browser_dump_id(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("browserDumpID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.browser_dump_id_shim(val); self } #[doc = "Change the `gmpPlugin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn gmp_plugin(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("gmpPlugin"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.gmp_plugin_shim(val); self } #[doc = "Change the `pluginDumpID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn plugin_dump_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pluginDumpID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.plugin_dump_id_shim(val); self } #[doc = "Change the `pluginFilename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn plugin_filename(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pluginFilename"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.plugin_filename_shim(val); self } #[doc = "Change the `pluginID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn plugin_id(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pluginID"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.plugin_id_shim(val); self } #[doc = "Change the `pluginName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn plugin_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pluginName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.plugin_name_shim(val); self } #[doc = "Change the `submittedCrashReport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub fn submitted_crash_report(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("submittedCrashReport"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.submitted_crash_report_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PointerEventInit.rs b/crates/web-sys/src/features/gen_PointerEventInit.rs index ba1339fbe3c..33a30240346 100644 --- a/crates/web-sys/src/features/gen_PointerEventInit.rs +++ b/crates/web-sys/src/features/gen_PointerEventInit.rs @@ -10,6 +10,84 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub type PointerEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &PointerEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &PointerEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "button")] + fn button_shim(this: &PointerEventInit, val: i16); + #[wasm_bindgen(method, setter = "buttons")] + fn buttons_shim(this: &PointerEventInit, val: u16); + #[wasm_bindgen(method, setter = "clientX")] + fn client_x_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "clientY")] + fn client_y_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementX")] + fn movement_x_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementY")] + fn movement_y_shim(this: &PointerEventInit, val: i32); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "relatedTarget")] + fn related_target_shim(this: &PointerEventInit, val: Option<&EventTarget>); + #[wasm_bindgen(method, setter = "screenX")] + fn screen_x_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "screenY")] + fn screen_y_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "coalescedEvents")] + fn coalesced_events_shim(this: &PointerEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "isPrimary")] + fn is_primary_shim(this: &PointerEventInit, val: bool); + #[wasm_bindgen(method, setter = "pointerId")] + fn pointer_id_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "pointerType")] + fn pointer_type_shim(this: &PointerEventInit, val: &str); + #[wasm_bindgen(method, setter = "pressure")] + fn pressure_shim(this: &PointerEventInit, val: f32); + #[wasm_bindgen(method, setter = "tangentialPressure")] + fn tangential_pressure_shim(this: &PointerEventInit, val: f32); + #[wasm_bindgen(method, setter = "tiltX")] + fn tilt_x_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "tiltY")] + fn tilt_y_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "twist")] + fn twist_shim(this: &PointerEventInit, val: i32); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &PointerEventInit, val: i32); } impl PointerEventInit { #[doc = "Construct a new `PointerEventInit`."] @@ -24,65 +102,28 @@ impl PointerEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,330 +131,140 @@ impl PointerEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `button` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn button(&mut self, val: i16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.button_shim(val); self } #[doc = "Change the `buttons` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn buttons(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buttons"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buttons_shim(val); self } #[doc = "Change the `clientX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn client_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_x_shim(val); self } #[doc = "Change the `clientY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn client_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_y_shim(val); self } #[doc = "Change the `movementX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn movement_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_x_shim(val); self } #[doc = "Change the `movementY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn movement_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_y_shim(val); self } #[cfg(feature = "EventTarget")] @@ -421,219 +272,98 @@ impl PointerEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `PointerEventInit`*"] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relatedTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.related_target_shim(val); self } #[doc = "Change the `screenX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn screen_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_x_shim(val); self } #[doc = "Change the `screenY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn screen_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_y_shim(val); self } #[doc = "Change the `coalescedEvents` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn coalesced_events(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("coalescedEvents"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.coalesced_events_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn height(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `isPrimary` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn is_primary(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isPrimary"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_primary_shim(val); self } #[doc = "Change the `pointerId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn pointer_id(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pointerId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pointer_id_shim(val); self } #[doc = "Change the `pointerType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn pointer_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pointerType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pointer_type_shim(val); self } #[doc = "Change the `pressure` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn pressure(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pressure"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pressure_shim(val); self } #[doc = "Change the `tangentialPressure` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn tangential_pressure(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("tangentialPressure"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tangential_pressure_shim(val); self } #[doc = "Change the `tiltX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn tilt_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tiltX"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tilt_x_shim(val); self } #[doc = "Change the `tiltY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn tilt_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tiltY"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tilt_y_shim(val); self } #[doc = "Change the `twist` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn twist(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("twist"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.twist_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub fn width(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PopStateEventInit.rs b/crates/web-sys/src/features/gen_PopStateEventInit.rs index 6249561086c..e00ea0f3eae 100644 --- a/crates/web-sys/src/features/gen_PopStateEventInit.rs +++ b/crates/web-sys/src/features/gen_PopStateEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub type PopStateEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PopStateEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PopStateEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PopStateEventInit, val: bool); + #[wasm_bindgen(method, setter = "state")] + fn state_shim(this: &PopStateEventInit, val: &::wasm_bindgen::JsValue); } impl PopStateEventInit { #[doc = "Construct a new `PopStateEventInit`."] @@ -24,64 +32,28 @@ impl PopStateEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `state` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub fn state(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("state"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.state_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs index ff9fc12cb62..3e1d3043190 100644 --- a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs +++ b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub type PopupBlockedEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PopupBlockedEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PopupBlockedEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PopupBlockedEventInit, val: bool); + #[wasm_bindgen(method, setter = "popupWindowFeatures")] + fn popup_window_features_shim(this: &PopupBlockedEventInit, val: &str); + #[wasm_bindgen(method, setter = "popupWindowName")] + fn popup_window_name_shim(this: &PopupBlockedEventInit, val: &str); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "requestingWindow")] + fn requesting_window_shim(this: &PopupBlockedEventInit, val: Option<&Window>); } impl PopupBlockedEventInit { #[doc = "Construct a new `PopupBlockedEventInit`."] @@ -24,85 +37,35 @@ impl PopupBlockedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `popupWindowFeatures` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub fn popup_window_features(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("popupWindowFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.popup_window_features_shim(val); self } #[doc = "Change the `popupWindowName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub fn popup_window_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("popupWindowName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.popup_window_name_shim(val); self } #[cfg(feature = "Window")] @@ -110,17 +73,7 @@ impl PopupBlockedEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`, `Window`*"] pub fn requesting_window(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requestingWindow"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.requesting_window_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PositionOptions.rs b/crates/web-sys/src/features/gen_PositionOptions.rs index c5d8789e3bc..2d5d5276299 100644 --- a/crates/web-sys/src/features/gen_PositionOptions.rs +++ b/crates/web-sys/src/features/gen_PositionOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] pub type PositionOptions; + #[wasm_bindgen(method, setter = "enableHighAccuracy")] + fn enable_high_accuracy_shim(this: &PositionOptions, val: bool); + #[wasm_bindgen(method, setter = "maximumAge")] + fn maximum_age_shim(this: &PositionOptions, val: u32); + #[wasm_bindgen(method, setter = "timeout")] + fn timeout_shim(this: &PositionOptions, val: u32); } impl PositionOptions { #[doc = "Construct a new `PositionOptions`."] @@ -24,51 +30,21 @@ impl PositionOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] pub fn enable_high_accuracy(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("enableHighAccuracy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.enable_high_accuracy_shim(val); self } #[doc = "Change the `maximumAge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] pub fn maximum_age(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maximumAge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.maximum_age_shim(val); self } #[doc = "Change the `timeout` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] pub fn timeout(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeout"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeout_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs index 91bc99d265f..146db924710 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] pub type PresentationConnectionAvailableEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + #[cfg(feature = "PresentationConnection")] + #[wasm_bindgen(method, setter = "connection")] + fn connection_shim( + this: &PresentationConnectionAvailableEventInit, + val: &PresentationConnection, + ); } impl PresentationConnectionAvailableEventInit { #[cfg(feature = "PresentationConnection")] @@ -26,51 +38,21 @@ impl PresentationConnectionAvailableEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "PresentationConnection")] @@ -78,17 +60,7 @@ impl PresentationConnectionAvailableEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`, `PresentationConnectionAvailableEventInit`*"] pub fn connection(&mut self, val: &PresentationConnection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("connection"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.connection_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs index 2fc2a1ba233..c7786dacd06 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub type PresentationConnectionCloseEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PresentationConnectionCloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PresentationConnectionCloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PresentationConnectionCloseEventInit, val: bool); + #[wasm_bindgen(method, setter = "message")] + fn message_shim(this: &PresentationConnectionCloseEventInit, val: &str); + #[cfg(feature = "PresentationConnectionClosedReason")] + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim( + this: &PresentationConnectionCloseEventInit, + val: PresentationConnectionClosedReason, + ); } impl PresentationConnectionCloseEventInit { #[cfg(feature = "PresentationConnectionClosedReason")] @@ -26,68 +40,28 @@ impl PresentationConnectionCloseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub fn message(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_shim(val); self } #[cfg(feature = "PresentationConnectionClosedReason")] @@ -95,14 +69,7 @@ impl PresentationConnectionCloseEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"] pub fn reason(&mut self, val: PresentationConnectionClosedReason) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs b/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs index 5d30196fc22..7ab50ae8bb7 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub type ProfileTimelineLayerRect; + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &ProfileTimelineLayerRect, val: i32); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &ProfileTimelineLayerRect, val: i32); + #[wasm_bindgen(method, setter = "x")] + fn x_shim(this: &ProfileTimelineLayerRect, val: i32); + #[wasm_bindgen(method, setter = "y")] + fn y_shim(this: &ProfileTimelineLayerRect, val: i32); } impl ProfileTimelineLayerRect { #[doc = "Construct a new `ProfileTimelineLayerRect`."] @@ -24,53 +32,28 @@ impl ProfileTimelineLayerRect { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub fn height(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub fn width(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } #[doc = "Change the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub fn x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("x"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_shim(val); self } #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub fn y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("y"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.y_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs index 18d9da0ac39..acd1885a31d 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs @@ -10,6 +10,41 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub type ProfileTimelineMarker; + #[wasm_bindgen(method, setter = "causeName")] + fn cause_name_shim(this: &ProfileTimelineMarker, val: &str); + #[wasm_bindgen(method, setter = "end")] + fn end_shim(this: &ProfileTimelineMarker, val: f64); + #[wasm_bindgen(method, setter = "endStack")] + fn end_stack_shim(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "eventPhase")] + fn event_phase_shim(this: &ProfileTimelineMarker, val: u16); + #[wasm_bindgen(method, setter = "isAnimationOnly")] + fn is_animation_only_shim(this: &ProfileTimelineMarker, val: bool); + #[wasm_bindgen(method, setter = "isOffMainThread")] + fn is_off_main_thread_shim(this: &ProfileTimelineMarker, val: bool); + #[cfg(feature = "ProfileTimelineMessagePortOperationType")] + #[wasm_bindgen(method, setter = "messagePortOperation")] + fn message_port_operation_shim( + this: &ProfileTimelineMarker, + val: ProfileTimelineMessagePortOperationType, + ); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &ProfileTimelineMarker, val: &str); + #[wasm_bindgen(method, setter = "processType")] + fn process_type_shim(this: &ProfileTimelineMarker, val: u16); + #[wasm_bindgen(method, setter = "rectangles")] + fn rectangles_shim(this: &ProfileTimelineMarker, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "stack")] + fn stack_shim(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "start")] + fn start_shim(this: &ProfileTimelineMarker, val: f64); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &ProfileTimelineMarker, val: &str); + #[wasm_bindgen(method, setter = "unixTime")] + fn unix_time_shim(this: &ProfileTimelineMarker, val: f64); + #[cfg(feature = "ProfileTimelineWorkerOperationType")] + #[wasm_bindgen(method, setter = "workerOperation")] + fn worker_operation_shim(this: &ProfileTimelineMarker, val: ProfileTimelineWorkerOperationType); } impl ProfileTimelineMarker { #[doc = "Construct a new `ProfileTimelineMarker`."] @@ -24,98 +59,42 @@ impl ProfileTimelineMarker { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn cause_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("causeName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cause_name_shim(val); self } #[doc = "Change the `end` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn end(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("end"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_shim(val); self } #[doc = "Change the `endStack` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn end_stack(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endStack"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.end_stack_shim(val); self } #[doc = "Change the `eventPhase` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn event_phase(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("eventPhase"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.event_phase_shim(val); self } #[doc = "Change the `isAnimationOnly` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn is_animation_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isAnimationOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_animation_only_shim(val); self } #[doc = "Change the `isOffMainThread` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn is_off_main_thread(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isOffMainThread"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_off_main_thread_shim(val); self } #[cfg(feature = "ProfileTimelineMessagePortOperationType")] @@ -126,120 +105,56 @@ impl ProfileTimelineMarker { &mut self, val: ProfileTimelineMessagePortOperationType, ) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("messagePortOperation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_port_operation_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `processType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn process_type(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("processType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.process_type_shim(val); self } #[doc = "Change the `rectangles` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn rectangles(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rectangles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rectangles_shim(val); self } #[doc = "Change the `stack` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn stack(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stack"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stack_shim(val); self } #[doc = "Change the `start` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn start(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `unixTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub fn unix_time(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("unixTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.unix_time_shim(val); self } #[cfg(feature = "ProfileTimelineWorkerOperationType")] @@ -247,17 +162,7 @@ impl ProfileTimelineMarker { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineWorkerOperationType`*"] pub fn worker_operation(&mut self, val: ProfileTimelineWorkerOperationType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("workerOperation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.worker_operation_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs index c03a914b288..33a4ac48f09 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub type ProfileTimelineStackFrame; + #[wasm_bindgen(method, setter = "asyncCause")] + fn async_cause_shim(this: &ProfileTimelineStackFrame, val: &str); + #[wasm_bindgen(method, setter = "asyncParent")] + fn async_parent_shim(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "column")] + fn column_shim(this: &ProfileTimelineStackFrame, val: i32); + #[wasm_bindgen(method, setter = "functionDisplayName")] + fn function_display_name_shim(this: &ProfileTimelineStackFrame, val: &str); + #[wasm_bindgen(method, setter = "line")] + fn line_shim(this: &ProfileTimelineStackFrame, val: i32); + #[wasm_bindgen(method, setter = "parent")] + fn parent_shim(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &ProfileTimelineStackFrame, val: &str); } impl ProfileTimelineStackFrame { #[doc = "Construct a new `ProfileTimelineStackFrame`."] @@ -24,106 +38,49 @@ impl ProfileTimelineStackFrame { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn async_cause(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("asyncCause"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.async_cause_shim(val); self } #[doc = "Change the `asyncParent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn async_parent(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("asyncParent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.async_parent_shim(val); self } #[doc = "Change the `column` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn column(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("column"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.column_shim(val); self } #[doc = "Change the `functionDisplayName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn function_display_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("functionDisplayName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.function_display_name_shim(val); self } #[doc = "Change the `line` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn line(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("line"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.line_shim(val); self } #[doc = "Change the `parent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn parent(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("parent"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.parent_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub fn source(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ProgressEventInit.rs b/crates/web-sys/src/features/gen_ProgressEventInit.rs index df10539b726..f638b1dcad2 100644 --- a/crates/web-sys/src/features/gen_ProgressEventInit.rs +++ b/crates/web-sys/src/features/gen_ProgressEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub type ProgressEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ProgressEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ProgressEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ProgressEventInit, val: bool); + #[wasm_bindgen(method, setter = "lengthComputable")] + fn length_computable_shim(this: &ProgressEventInit, val: bool); + #[wasm_bindgen(method, setter = "loaded")] + fn loaded_shim(this: &ProgressEventInit, val: f64); + #[wasm_bindgen(method, setter = "total")] + fn total_shim(this: &ProgressEventInit, val: f64); } impl ProgressEventInit { #[doc = "Construct a new `ProgressEventInit`."] @@ -24,95 +36,42 @@ impl ProgressEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `lengthComputable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn length_computable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lengthComputable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.length_computable_shim(val); self } #[doc = "Change the `loaded` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn loaded(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loaded"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.loaded_shim(val); self } #[doc = "Change the `total` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub fn total(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("total"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.total_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs index 42aa52ae16d..05effa91c6e 100644 --- a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs +++ b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub type PromiseRejectionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PromiseRejectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PromiseRejectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PromiseRejectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "promise")] + fn promise_shim(this: &PromiseRejectionEventInit, val: &::js_sys::Promise); + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &PromiseRejectionEventInit, val: &::wasm_bindgen::JsValue); } impl PromiseRejectionEventInit { #[doc = "Construct a new `PromiseRejectionEventInit`."] @@ -25,82 +35,35 @@ impl PromiseRejectionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `promise` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub fn promise(&mut self, val: &::js_sys::Promise) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("promise"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.promise_shim(val); self } #[doc = "Change the `reason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub fn reason(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs index d1f99e0ea19..bbd042e3033 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs @@ -10,6 +10,44 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub type PublicKeyCredentialCreationOptions; + #[cfg(feature = "AttestationConveyancePreference")] + #[wasm_bindgen(method, setter = "attestation")] + fn attestation_shim( + this: &PublicKeyCredentialCreationOptions, + val: AttestationConveyancePreference, + ); + #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[wasm_bindgen(method, setter = "authenticatorSelection")] + fn authenticator_selection_shim( + this: &PublicKeyCredentialCreationOptions, + val: &AuthenticatorSelectionCriteria, + ); + #[wasm_bindgen(method, setter = "challenge")] + fn challenge_shim(this: &PublicKeyCredentialCreationOptions, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "excludeCredentials")] + fn exclude_credentials_shim( + this: &PublicKeyCredentialCreationOptions, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[wasm_bindgen(method, setter = "extensions")] + fn extensions_shim( + this: &PublicKeyCredentialCreationOptions, + val: &AuthenticationExtensionsClientInputs, + ); + #[wasm_bindgen(method, setter = "pubKeyCredParams")] + fn pub_key_cred_params_shim( + this: &PublicKeyCredentialCreationOptions, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[wasm_bindgen(method, setter = "rp")] + fn rp_shim(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialRpEntity); + #[wasm_bindgen(method, setter = "timeout")] + fn timeout_shim(this: &PublicKeyCredentialCreationOptions, val: u32); + #[cfg(feature = "PublicKeyCredentialUserEntity")] + #[wasm_bindgen(method, setter = "user")] + fn user_shim(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialUserEntity); } impl PublicKeyCredentialCreationOptions { #[cfg(all( @@ -38,17 +76,7 @@ impl PublicKeyCredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"] pub fn attestation(&mut self, val: AttestationConveyancePreference) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("attestation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.attestation_shim(val); self } #[cfg(feature = "AuthenticatorSelectionCriteria")] @@ -56,51 +84,21 @@ impl PublicKeyCredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"] pub fn authenticator_selection(&mut self, val: &AuthenticatorSelectionCriteria) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("authenticatorSelection"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.authenticator_selection_shim(val); self } #[doc = "Change the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("challenge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.challenge_shim(val); self } #[doc = "Change the `excludeCredentials` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub fn exclude_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("excludeCredentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exclude_credentials_shim(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] @@ -108,34 +106,14 @@ impl PublicKeyCredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"] pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("extensions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.extensions_shim(val); self } #[doc = "Change the `pubKeyCredParams` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub fn pub_key_cred_params(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pubKeyCredParams"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pub_key_cred_params_shim(val); self } #[cfg(feature = "PublicKeyCredentialRpEntity")] @@ -143,30 +121,14 @@ impl PublicKeyCredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"] pub fn rp(&mut self, val: &PublicKeyCredentialRpEntity) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rp_shim(val); self } #[doc = "Change the `timeout` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub fn timeout(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeout"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeout_shim(val); self } #[cfg(feature = "PublicKeyCredentialUserEntity")] @@ -174,13 +136,7 @@ impl PublicKeyCredentialCreationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"] pub fn user(&mut self, val: &PublicKeyCredentialUserEntity) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("user"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.user_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs index 85e7c24ac6d..c2ca7cc04d7 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] pub type PublicKeyCredentialDescriptor; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "transports")] + fn transports_shim(this: &PublicKeyCredentialDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "PublicKeyCredentialType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &PublicKeyCredentialDescriptor, val: PublicKeyCredentialType); } impl PublicKeyCredentialDescriptor { #[cfg(feature = "PublicKeyCredentialType")] @@ -27,30 +34,14 @@ impl PublicKeyCredentialDescriptor { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] pub fn id(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `transports` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] pub fn transports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transports"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transports_shim(val); self } #[cfg(feature = "PublicKeyCredentialType")] @@ -58,13 +49,7 @@ impl PublicKeyCredentialDescriptor { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"] pub fn type_(&mut self, val: PublicKeyCredentialType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs index b1caf5c865b..6dc0e64c189 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] pub type PublicKeyCredentialEntity; + #[wasm_bindgen(method, setter = "icon")] + fn icon_shim(this: &PublicKeyCredentialEntity, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PublicKeyCredentialEntity, val: &str); } impl PublicKeyCredentialEntity { #[doc = "Construct a new `PublicKeyCredentialEntity`."] @@ -25,26 +29,14 @@ impl PublicKeyCredentialEntity { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] pub fn icon(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.icon_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs index bcf47f75c01..fd51859ddf6 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] pub type PublicKeyCredentialParameters; + #[wasm_bindgen(method, setter = "alg")] + fn alg_shim(this: &PublicKeyCredentialParameters, val: i32); + #[cfg(feature = "PublicKeyCredentialType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &PublicKeyCredentialParameters, val: PublicKeyCredentialType); } impl PublicKeyCredentialParameters { #[cfg(feature = "PublicKeyCredentialType")] @@ -27,13 +32,7 @@ impl PublicKeyCredentialParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] pub fn alg(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alg"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alg_shim(val); self } #[cfg(feature = "PublicKeyCredentialType")] @@ -41,13 +40,7 @@ impl PublicKeyCredentialParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`, `PublicKeyCredentialType`*"] pub fn type_(&mut self, val: PublicKeyCredentialType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs index 2c5fff91642..3528ea3d7db 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs @@ -10,6 +10,29 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub type PublicKeyCredentialRequestOptions; + #[wasm_bindgen(method, setter = "allowCredentials")] + fn allow_credentials_shim( + this: &PublicKeyCredentialRequestOptions, + val: &::wasm_bindgen::JsValue, + ); + #[wasm_bindgen(method, setter = "challenge")] + fn challenge_shim(this: &PublicKeyCredentialRequestOptions, val: &::js_sys::Object); + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[wasm_bindgen(method, setter = "extensions")] + fn extensions_shim( + this: &PublicKeyCredentialRequestOptions, + val: &AuthenticationExtensionsClientInputs, + ); + #[wasm_bindgen(method, setter = "rpId")] + fn rp_id_shim(this: &PublicKeyCredentialRequestOptions, val: &str); + #[wasm_bindgen(method, setter = "timeout")] + fn timeout_shim(this: &PublicKeyCredentialRequestOptions, val: u32); + #[cfg(feature = "UserVerificationRequirement")] + #[wasm_bindgen(method, setter = "userVerification")] + fn user_verification_shim( + this: &PublicKeyCredentialRequestOptions, + val: UserVerificationRequirement, + ); } impl PublicKeyCredentialRequestOptions { #[doc = "Construct a new `PublicKeyCredentialRequestOptions`."] @@ -25,34 +48,14 @@ impl PublicKeyCredentialRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub fn allow_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowCredentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allow_credentials_shim(val); self } #[doc = "Change the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("challenge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.challenge_shim(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] @@ -60,47 +63,21 @@ impl PublicKeyCredentialRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialRequestOptions`*"] pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("extensions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.extensions_shim(val); self } #[doc = "Change the `rpId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub fn rp_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rpId"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rp_id_shim(val); self } #[doc = "Change the `timeout` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub fn timeout(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timeout"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timeout_shim(val); self } #[cfg(feature = "UserVerificationRequirement")] @@ -108,17 +85,7 @@ impl PublicKeyCredentialRequestOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`, `UserVerificationRequirement`*"] pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("userVerification"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.user_verification_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs index 15dba930a17..ac8318357da 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] pub type PublicKeyCredentialRpEntity; + #[wasm_bindgen(method, setter = "icon")] + fn icon_shim(this: &PublicKeyCredentialRpEntity, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PublicKeyCredentialRpEntity, val: &str); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &PublicKeyCredentialRpEntity, val: &str); } impl PublicKeyCredentialRpEntity { #[doc = "Construct a new `PublicKeyCredentialRpEntity`."] @@ -25,39 +31,21 @@ impl PublicKeyCredentialRpEntity { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] pub fn icon(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.icon_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs index fad8c8454b6..a720e3a36e7 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub type PublicKeyCredentialUserEntity; + #[wasm_bindgen(method, setter = "icon")] + fn icon_shim(this: &PublicKeyCredentialUserEntity, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &PublicKeyCredentialUserEntity, val: &str); + #[wasm_bindgen(method, setter = "displayName")] + fn display_name_shim(this: &PublicKeyCredentialUserEntity, val: &str); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &PublicKeyCredentialUserEntity, val: &::js_sys::Object); } impl PublicKeyCredentialUserEntity { #[doc = "Construct a new `PublicKeyCredentialUserEntity`."] @@ -27,56 +35,28 @@ impl PublicKeyCredentialUserEntity { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub fn icon(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("icon"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.icon_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `displayName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub fn display_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_name_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub fn id(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PushEventInit.rs b/crates/web-sys/src/features/gen_PushEventInit.rs index 8d58c823577..5add3d2125d 100644 --- a/crates/web-sys/src/features/gen_PushEventInit.rs +++ b/crates/web-sys/src/features/gen_PushEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub type PushEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &PushEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &PushEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &PushEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &PushEventInit, val: &::wasm_bindgen::JsValue); } impl PushEventInit { #[doc = "Construct a new `PushEventInit`."] @@ -24,64 +32,28 @@ impl PushEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs index 60095c2e0f7..721c813742a 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub type PushSubscriptionInit; + #[wasm_bindgen(method, setter = "appServerKey")] + fn app_server_key_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::Object>); + #[wasm_bindgen(method, setter = "authSecret")] + fn auth_secret_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + #[wasm_bindgen(method, setter = "endpoint")] + fn endpoint_shim(this: &PushSubscriptionInit, val: &str); + #[wasm_bindgen(method, setter = "p256dhKey")] + fn p256dh_key_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + #[wasm_bindgen(method, setter = "scope")] + fn scope_shim(this: &PushSubscriptionInit, val: &str); } impl PushSubscriptionInit { #[doc = "Construct a new `PushSubscriptionInit`."] @@ -26,81 +36,35 @@ impl PushSubscriptionInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub fn app_server_key(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("appServerKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.app_server_key_shim(val); self } #[doc = "Change the `authSecret` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub fn auth_secret(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("authSecret"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auth_secret_shim(val); self } #[doc = "Change the `endpoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub fn endpoint(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endpoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.endpoint_shim(val); self } #[doc = "Change the `p256dhKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub fn p256dh_key(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("p256dhKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p256dh_key_shim(val); self } #[doc = "Change the `scope` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub fn scope(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("scope"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scope_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs index 834be13d1e3..1fdb21c22bc 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] pub type PushSubscriptionJson; + #[wasm_bindgen(method, setter = "endpoint")] + fn endpoint_shim(this: &PushSubscriptionJson, val: &str); + #[cfg(feature = "PushSubscriptionKeys")] + #[wasm_bindgen(method, setter = "keys")] + fn keys_shim(this: &PushSubscriptionJson, val: &PushSubscriptionKeys); } impl PushSubscriptionJson { #[doc = "Construct a new `PushSubscriptionJson`."] @@ -24,17 +29,7 @@ impl PushSubscriptionJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] pub fn endpoint(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("endpoint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.endpoint_shim(val); self } #[cfg(feature = "PushSubscriptionKeys")] @@ -42,13 +37,7 @@ impl PushSubscriptionJson { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`, `PushSubscriptionKeys`*"] pub fn keys(&mut self, val: &PushSubscriptionKeys) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("keys"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.keys_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs index 80df7078043..f4b03611fba 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] pub type PushSubscriptionKeys; + #[wasm_bindgen(method, setter = "auth")] + fn auth_shim(this: &PushSubscriptionKeys, val: &str); + #[wasm_bindgen(method, setter = "p256dh")] + fn p256dh_shim(this: &PushSubscriptionKeys, val: &str); } impl PushSubscriptionKeys { #[doc = "Construct a new `PushSubscriptionKeys`."] @@ -24,27 +28,14 @@ impl PushSubscriptionKeys { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] pub fn auth(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("auth"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auth_shim(val); self } #[doc = "Change the `p256dh` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] pub fn p256dh(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("p256dh"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.p256dh_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs index faa185a9580..ba2ce96b985 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] pub type PushSubscriptionOptionsInit; + #[wasm_bindgen(method, setter = "applicationServerKey")] + fn application_server_key_shim( + this: &PushSubscriptionOptionsInit, + val: &::wasm_bindgen::JsValue, + ); + #[wasm_bindgen(method, setter = "userVisibleOnly")] + fn user_visible_only_shim(this: &PushSubscriptionOptionsInit, val: bool); } impl PushSubscriptionOptionsInit { #[doc = "Construct a new `PushSubscriptionOptionsInit`."] @@ -24,34 +31,14 @@ impl PushSubscriptionOptionsInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] pub fn application_server_key(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("applicationServerKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.application_server_key_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[doc = "Change the `userVisibleOnly` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] pub fn user_visible_only(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("userVisibleOnly"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.user_visible_only_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_QueryOptions.rs b/crates/web-sys/src/features/gen_QueryOptions.rs index 85967a95a0b..6ef1d3ad6c0 100644 --- a/crates/web-sys/src/features/gen_QueryOptions.rs +++ b/crates/web-sys/src/features/gen_QueryOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type QueryOptions; + #[wasm_bindgen(method, setter = "postscriptNames")] + fn postscript_names_shim(this: &QueryOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl QueryOptions { @@ -36,17 +38,7 @@ impl QueryOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn postscript_names(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("postscriptNames"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.postscript_names_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_QueuingStrategy.rs b/crates/web-sys/src/features/gen_QueuingStrategy.rs index aec86360b88..9ecbfa23cd1 100644 --- a/crates/web-sys/src/features/gen_QueuingStrategy.rs +++ b/crates/web-sys/src/features/gen_QueuingStrategy.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] pub type QueuingStrategy; + #[wasm_bindgen(method, setter = "highWaterMark")] + fn high_water_mark_shim(this: &QueuingStrategy, val: f64); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &QueuingStrategy, val: &::js_sys::Function); } impl QueuingStrategy { #[doc = "Construct a new `QueuingStrategy`."] @@ -24,30 +28,14 @@ impl QueuingStrategy { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] pub fn high_water_mark(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("highWaterMark"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.high_water_mark_shim(val); self } #[doc = "Change the `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] pub fn size(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs index 253366ced8b..42523cd8b2f 100644 --- a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs +++ b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] pub type QueuingStrategyInit; + #[wasm_bindgen(method, setter = "highWaterMark")] + fn high_water_mark_shim(this: &QueuingStrategyInit, val: f64); } impl QueuingStrategyInit { #[doc = "Construct a new `QueuingStrategyInit`."] @@ -25,17 +27,7 @@ impl QueuingStrategyInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] pub fn high_water_mark(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("highWaterMark"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.high_water_mark_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RcwnPerfStats.rs b/crates/web-sys/src/features/gen_RcwnPerfStats.rs index 9a39f40cfc1..ee8fc7c302a 100644 --- a/crates/web-sys/src/features/gen_RcwnPerfStats.rs +++ b/crates/web-sys/src/features/gen_RcwnPerfStats.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] pub type RcwnPerfStats; + #[wasm_bindgen(method, setter = "avgLong")] + fn avg_long_shim(this: &RcwnPerfStats, val: u32); + #[wasm_bindgen(method, setter = "avgShort")] + fn avg_short_shim(this: &RcwnPerfStats, val: u32); + #[wasm_bindgen(method, setter = "stddevLong")] + fn stddev_long_shim(this: &RcwnPerfStats, val: u32); } impl RcwnPerfStats { #[doc = "Construct a new `RcwnPerfStats`."] @@ -24,51 +30,21 @@ impl RcwnPerfStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] pub fn avg_long(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("avgLong"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.avg_long_shim(val); self } #[doc = "Change the `avgShort` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] pub fn avg_short(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("avgShort"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.avg_short_shim(val); self } #[doc = "Change the `stddevLong` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] pub fn stddev_long(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stddevLong"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stddev_long_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RcwnStatus.rs b/crates/web-sys/src/features/gen_RcwnStatus.rs index 9994b6a9564..e29982da89e 100644 --- a/crates/web-sys/src/features/gen_RcwnStatus.rs +++ b/crates/web-sys/src/features/gen_RcwnStatus.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub type RcwnStatus; + #[wasm_bindgen(method, setter = "cacheNotSlowCount")] + fn cache_not_slow_count_shim(this: &RcwnStatus, val: u32); + #[wasm_bindgen(method, setter = "cacheSlowCount")] + fn cache_slow_count_shim(this: &RcwnStatus, val: u32); + #[wasm_bindgen(method, setter = "perfStats")] + fn perf_stats_shim(this: &RcwnStatus, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "rcwnCacheWonCount")] + fn rcwn_cache_won_count_shim(this: &RcwnStatus, val: u32); + #[wasm_bindgen(method, setter = "rcwnNetWonCount")] + fn rcwn_net_won_count_shim(this: &RcwnStatus, val: u32); + #[wasm_bindgen(method, setter = "totalNetworkRequests")] + fn total_network_requests_shim(this: &RcwnStatus, val: u32); } impl RcwnStatus { #[doc = "Construct a new `RcwnStatus`."] @@ -24,102 +36,42 @@ impl RcwnStatus { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn cache_not_slow_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cacheNotSlowCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cache_not_slow_count_shim(val); self } #[doc = "Change the `cacheSlowCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn cache_slow_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cacheSlowCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cache_slow_count_shim(val); self } #[doc = "Change the `perfStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn perf_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("perfStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.perf_stats_shim(val); self } #[doc = "Change the `rcwnCacheWonCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn rcwn_cache_won_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rcwnCacheWonCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rcwn_cache_won_count_shim(val); self } #[doc = "Change the `rcwnNetWonCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn rcwn_net_won_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rcwnNetWonCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rcwn_net_won_count_shim(val); self } #[doc = "Change the `totalNetworkRequests` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub fn total_network_requests(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("totalNetworkRequests"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.total_network_requests_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs b/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs index 6636768f3de..ba38a2a7cd6 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`*"] pub type ReadableStreamGetReaderOptions; + #[cfg(feature = "ReadableStreamReaderMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &ReadableStreamGetReaderOptions, val: ReadableStreamReaderMode); } impl ReadableStreamGetReaderOptions { #[doc = "Construct a new `ReadableStreamGetReaderOptions`."] @@ -25,13 +28,7 @@ impl ReadableStreamGetReaderOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`, `ReadableStreamReaderMode`*"] pub fn mode(&mut self, val: ReadableStreamReaderMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs b/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs index 6ecfe1e046a..bd432a43d33 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] pub type ReadableStreamIteratorOptions; + #[wasm_bindgen(method, setter = "preventCancel")] + fn prevent_cancel_shim(this: &ReadableStreamIteratorOptions, val: bool); } impl ReadableStreamIteratorOptions { #[doc = "Construct a new `ReadableStreamIteratorOptions`."] @@ -24,17 +26,7 @@ impl ReadableStreamIteratorOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] pub fn prevent_cancel(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preventCancel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prevent_cancel_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs index 7385e0043f4..1ee926ae577 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] pub type ReadableStreamReadResult; + #[wasm_bindgen(method, setter = "done")] + fn done_shim(this: &ReadableStreamReadResult, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &ReadableStreamReadResult, val: &::wasm_bindgen::JsValue); } impl ReadableStreamReadResult { #[doc = "Construct a new `ReadableStreamReadResult`."] @@ -24,26 +28,14 @@ impl ReadableStreamReadResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] pub fn done(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("done"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.done_shim(val); self } #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index fc98e0b9d26..3079c8805c3 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`*"] pub type ReadableWritablePair; + #[cfg(feature = "ReadableStream")] + #[wasm_bindgen(method, setter = "readable")] + fn readable_shim(this: &ReadableWritablePair, val: &ReadableStream); + #[cfg(feature = "WritableStream")] + #[wasm_bindgen(method, setter = "writable")] + fn writable_shim(this: &ReadableWritablePair, val: &WritableStream); } impl ReadableWritablePair { #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))] @@ -28,17 +34,7 @@ impl ReadableWritablePair { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"] pub fn readable(&mut self, val: &ReadableStream) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("readable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.readable_shim(val); self } #[cfg(feature = "WritableStream")] @@ -46,17 +42,7 @@ impl ReadableWritablePair { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] pub fn writable(&mut self, val: &WritableStream) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("writable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.writable_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisterRequest.rs b/crates/web-sys/src/features/gen_RegisterRequest.rs index 457433d5989..f35b3953389 100644 --- a/crates/web-sys/src/features/gen_RegisterRequest.rs +++ b/crates/web-sys/src/features/gen_RegisterRequest.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] pub type RegisterRequest; + #[wasm_bindgen(method, setter = "challenge")] + fn challenge_shim(this: &RegisterRequest, val: &str); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &RegisterRequest, val: &str); } impl RegisterRequest { #[doc = "Construct a new `RegisterRequest`."] @@ -24,34 +28,14 @@ impl RegisterRequest { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] pub fn challenge(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("challenge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.challenge_shim(val); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] pub fn version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisterResponse.rs b/crates/web-sys/src/features/gen_RegisterResponse.rs index ef6ee6dfbd5..eb73afa5f2c 100644 --- a/crates/web-sys/src/features/gen_RegisterResponse.rs +++ b/crates/web-sys/src/features/gen_RegisterResponse.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub type RegisterResponse; + #[wasm_bindgen(method, setter = "clientData")] + fn client_data_shim(this: &RegisterResponse, val: &str); + #[wasm_bindgen(method, setter = "errorCode")] + fn error_code_shim(this: &RegisterResponse, val: Option); + #[wasm_bindgen(method, setter = "errorMessage")] + fn error_message_shim(this: &RegisterResponse, val: Option<&str>); + #[wasm_bindgen(method, setter = "registrationData")] + fn registration_data_shim(this: &RegisterResponse, val: &str); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &RegisterResponse, val: &str); } impl RegisterResponse { #[doc = "Construct a new `RegisterResponse`."] @@ -24,85 +34,35 @@ impl RegisterResponse { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub fn client_data(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_data_shim(val); self } #[doc = "Change the `errorCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub fn error_code(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("errorCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_code_shim(val); self } #[doc = "Change the `errorMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub fn error_message(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("errorMessage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_message_shim(val); self } #[doc = "Change the `registrationData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub fn registration_data(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("registrationData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.registration_data_shim(val); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub fn version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisteredKey.rs b/crates/web-sys/src/features/gen_RegisteredKey.rs index 9a404b6ef52..34f727cbab4 100644 --- a/crates/web-sys/src/features/gen_RegisteredKey.rs +++ b/crates/web-sys/src/features/gen_RegisteredKey.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub type RegisteredKey; + #[wasm_bindgen(method, setter = "appId")] + fn app_id_shim(this: &RegisteredKey, val: Option<&str>); + #[wasm_bindgen(method, setter = "keyHandle")] + fn key_handle_shim(this: &RegisteredKey, val: &str); + #[wasm_bindgen(method, setter = "transports")] + fn transports_shim(this: &RegisteredKey, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &RegisteredKey, val: &str); } impl RegisteredKey { #[doc = "Construct a new `RegisteredKey`."] @@ -24,64 +32,28 @@ impl RegisteredKey { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub fn app_id(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("appId"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.app_id_shim(val); self } #[doc = "Change the `keyHandle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub fn key_handle(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keyHandle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_handle_shim(val); self } #[doc = "Change the `transports` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub fn transports(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transports"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transports_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub fn version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RegistrationOptions.rs b/crates/web-sys/src/features/gen_RegistrationOptions.rs index ebc9aa23702..8d635369a40 100644 --- a/crates/web-sys/src/features/gen_RegistrationOptions.rs +++ b/crates/web-sys/src/features/gen_RegistrationOptions.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] pub type RegistrationOptions; + #[wasm_bindgen(method, setter = "scope")] + fn scope_shim(this: &RegistrationOptions, val: &str); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RegistrationOptions, val: &str); + #[cfg(feature = "ServiceWorkerUpdateViaCache")] + #[wasm_bindgen(method, setter = "updateViaCache")] + fn update_via_cache_shim(this: &RegistrationOptions, val: ServiceWorkerUpdateViaCache); } impl RegistrationOptions { #[doc = "Construct a new `RegistrationOptions`."] @@ -24,26 +31,14 @@ impl RegistrationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] pub fn scope(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("scope"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scope_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] pub fn type_(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[cfg(feature = "ServiceWorkerUpdateViaCache")] @@ -51,17 +46,7 @@ impl RegistrationOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`, `ServiceWorkerUpdateViaCache`*"] pub fn update_via_cache(&mut self, val: ServiceWorkerUpdateViaCache) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("updateViaCache"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.update_via_cache_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestDeviceOptions.rs b/crates/web-sys/src/features/gen_RequestDeviceOptions.rs index 431ecfd15ef..85f4a2b5498 100644 --- a/crates/web-sys/src/features/gen_RequestDeviceOptions.rs +++ b/crates/web-sys/src/features/gen_RequestDeviceOptions.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type RequestDeviceOptions; + #[wasm_bindgen(method, setter = "acceptAllDevices")] + fn accept_all_devices_shim(this: &RequestDeviceOptions, val: bool); + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "optionalServices")] + fn optional_services_shim(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl RequestDeviceOptions { @@ -36,17 +42,7 @@ impl RequestDeviceOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("acceptAllDevices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.accept_all_devices_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +53,7 @@ impl RequestDeviceOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +64,7 @@ impl RequestDeviceOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn optional_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("optionalServices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.optional_services_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestInit.rs b/crates/web-sys/src/features/gen_RequestInit.rs index 820404406b7..532bdea1691 100644 --- a/crates/web-sys/src/features/gen_RequestInit.rs +++ b/crates/web-sys/src/features/gen_RequestInit.rs @@ -10,6 +10,37 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub type RequestInit; + #[wasm_bindgen(method, setter = "body")] + fn body_shim(this: &RequestInit, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "RequestCache")] + #[wasm_bindgen(method, setter = "cache")] + fn cache_shim(this: &RequestInit, val: RequestCache); + #[cfg(feature = "RequestCredentials")] + #[wasm_bindgen(method, setter = "credentials")] + fn credentials_shim(this: &RequestInit, val: RequestCredentials); + #[wasm_bindgen(method, setter = "headers")] + fn headers_shim(this: &RequestInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "integrity")] + fn integrity_shim(this: &RequestInit, val: &str); + #[wasm_bindgen(method, setter = "method")] + fn method_shim(this: &RequestInit, val: &str); + #[cfg(feature = "RequestMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &RequestInit, val: RequestMode); + #[cfg(feature = "ObserverCallback")] + #[wasm_bindgen(method, setter = "observe")] + fn observe_shim(this: &RequestInit, val: &ObserverCallback); + #[cfg(feature = "RequestRedirect")] + #[wasm_bindgen(method, setter = "redirect")] + fn redirect_shim(this: &RequestInit, val: RequestRedirect); + #[wasm_bindgen(method, setter = "referrer")] + fn referrer_shim(this: &RequestInit, val: &str); + #[cfg(feature = "ReferrerPolicy")] + #[wasm_bindgen(method, setter = "referrerPolicy")] + fn referrer_policy_shim(this: &RequestInit, val: ReferrerPolicy); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &RequestInit, val: Option<&AbortSignal>); } impl RequestInit { #[doc = "Construct a new `RequestInit`."] @@ -24,13 +55,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub fn body(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("body"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.body_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[cfg(feature = "RequestCache")] @@ -38,13 +63,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*"] pub fn cache(&mut self, val: RequestCache) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cache"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cache_shim(val); self } #[cfg(feature = "RequestCredentials")] @@ -52,65 +71,28 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*"] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("credentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.credentials_shim(val); self } #[doc = "Change the `headers` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("headers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.headers_shim(val); self } #[doc = "Change the `integrity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub fn integrity(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("integrity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.integrity_shim(val); self } #[doc = "Change the `method` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub fn method(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("method"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.method_shim(val); self } #[cfg(feature = "RequestMode")] @@ -118,13 +100,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*"] pub fn mode(&mut self, val: RequestMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[cfg(feature = "ObserverCallback")] @@ -132,17 +108,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*"] pub fn observe(&mut self, val: &ObserverCallback) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("observe"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.observe_shim(val); self } #[cfg(feature = "RequestRedirect")] @@ -150,34 +116,14 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*"] pub fn redirect(&mut self, val: RequestRedirect) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("redirect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.redirect_shim(val); self } #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub fn referrer(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("referrer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.referrer_shim(val); self } #[cfg(feature = "ReferrerPolicy")] @@ -185,17 +131,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*"] pub fn referrer_policy(&mut self, val: ReferrerPolicy) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("referrerPolicy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.referrer_policy_shim(val); self } #[cfg(feature = "AbortSignal")] @@ -203,14 +139,7 @@ impl RequestInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*"] pub fn signal(&mut self, val: Option<&AbortSignal>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs index 3ddb95ee930..ea79accc1ef 100644 --- a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs +++ b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] pub type RequestMediaKeySystemAccessNotification; + #[wasm_bindgen(method, setter = "keySystem")] + fn key_system_shim(this: &RequestMediaKeySystemAccessNotification, val: &str); + #[cfg(feature = "MediaKeySystemStatus")] + #[wasm_bindgen(method, setter = "status")] + fn status_shim(this: &RequestMediaKeySystemAccessNotification, val: MediaKeySystemStatus); } impl RequestMediaKeySystemAccessNotification { #[cfg(feature = "MediaKeySystemStatus")] @@ -27,17 +32,7 @@ impl RequestMediaKeySystemAccessNotification { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] pub fn key_system(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keySystem"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_system_shim(val); self } #[cfg(feature = "MediaKeySystemStatus")] @@ -45,14 +40,7 @@ impl RequestMediaKeySystemAccessNotification { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemStatus`, `RequestMediaKeySystemAccessNotification`*"] pub fn status(&mut self, val: MediaKeySystemStatus) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("status"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs index cbd81683fee..322f2fbd507 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] pub type ResizeObserverOptions; + #[cfg(feature = "ResizeObserverBoxOptions")] + #[wasm_bindgen(method, setter = "box")] + fn box__shim(this: &ResizeObserverOptions, val: ResizeObserverBoxOptions); } impl ResizeObserverOptions { #[doc = "Construct a new `ResizeObserverOptions`."] @@ -25,13 +28,7 @@ impl ResizeObserverOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] pub fn box_(&mut self, val: ResizeObserverBoxOptions) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("box"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.box__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ResponseInit.rs b/crates/web-sys/src/features/gen_ResponseInit.rs index d118a891da2..4466e72567d 100644 --- a/crates/web-sys/src/features/gen_ResponseInit.rs +++ b/crates/web-sys/src/features/gen_ResponseInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] pub type ResponseInit; + #[wasm_bindgen(method, setter = "headers")] + fn headers_shim(this: &ResponseInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "status")] + fn status_shim(this: &ResponseInit, val: u16); + #[wasm_bindgen(method, setter = "statusText")] + fn status_text_shim(this: &ResponseInit, val: &str); } impl ResponseInit { #[doc = "Construct a new `ResponseInit`."] @@ -24,48 +30,21 @@ impl ResponseInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("headers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.headers_shim(val); self } #[doc = "Change the `status` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] pub fn status(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("status"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_shim(val); self } #[doc = "Change the `statusText` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] pub fn status_text(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("statusText"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_text_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs index bb49bad7276..fd4c25042b3 100644 --- a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs +++ b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] pub type RsaHashedImportParams; + #[wasm_bindgen(method, setter = "hash")] + fn hash_shim(this: &RsaHashedImportParams, val: &::wasm_bindgen::JsValue); } impl RsaHashedImportParams { #[doc = "Construct a new `RsaHashedImportParams`."] @@ -25,13 +27,7 @@ impl RsaHashedImportParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("hash"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hash_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaOaepParams.rs b/crates/web-sys/src/features/gen_RsaOaepParams.rs index fc02fee01e7..a500ce24ee7 100644 --- a/crates/web-sys/src/features/gen_RsaOaepParams.rs +++ b/crates/web-sys/src/features/gen_RsaOaepParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] pub type RsaOaepParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &RsaOaepParams, val: &str); + #[wasm_bindgen(method, setter = "label")] + fn label_shim(this: &RsaOaepParams, val: &::js_sys::Object); } impl RsaOaepParams { #[doc = "Construct a new `RsaOaepParams`."] @@ -25,26 +29,14 @@ impl RsaOaepParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] pub fn label(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.label_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs index 2d864189611..4071e4cd036 100644 --- a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs +++ b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] pub type RsaOtherPrimesInfo; + #[wasm_bindgen(method, setter = "d")] + fn d_shim(this: &RsaOtherPrimesInfo, val: &str); + #[wasm_bindgen(method, setter = "r")] + fn r_shim(this: &RsaOtherPrimesInfo, val: &str); + #[wasm_bindgen(method, setter = "t")] + fn t_shim(this: &RsaOtherPrimesInfo, val: &str); } impl RsaOtherPrimesInfo { #[doc = "Construct a new `RsaOtherPrimesInfo`."] @@ -27,39 +33,21 @@ impl RsaOtherPrimesInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] pub fn d(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.d_shim(val); self } #[doc = "Change the `r` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] pub fn r(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("r"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.r_shim(val); self } #[doc = "Change the `t` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] pub fn t(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("t"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.t_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaPssParams.rs b/crates/web-sys/src/features/gen_RsaPssParams.rs index 676c927de50..49ece0023e9 100644 --- a/crates/web-sys/src/features/gen_RsaPssParams.rs +++ b/crates/web-sys/src/features/gen_RsaPssParams.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] pub type RsaPssParams; + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &RsaPssParams, val: &str); + #[wasm_bindgen(method, setter = "saltLength")] + fn salt_length_shim(this: &RsaPssParams, val: u32); } impl RsaPssParams { #[doc = "Construct a new `RsaPssParams`."] @@ -26,30 +30,14 @@ impl RsaPssParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `saltLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] pub fn salt_length(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("saltLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.salt_length_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs b/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs index c686a42b1da..7eab6969f61 100644 --- a/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs +++ b/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] pub type RtcCertificateExpiration; + #[wasm_bindgen(method, setter = "expires")] + fn expires_shim(this: &RtcCertificateExpiration, val: f64); } impl RtcCertificateExpiration { #[doc = "Construct a new `RtcCertificateExpiration`."] @@ -24,17 +26,7 @@ impl RtcCertificateExpiration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] pub fn expires(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("expires"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.expires_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcCodecStats.rs b/crates/web-sys/src/features/gen_RtcCodecStats.rs index da150394db5..3fbd0842d81 100644 --- a/crates/web-sys/src/features/gen_RtcCodecStats.rs +++ b/crates/web-sys/src/features/gen_RtcCodecStats.rs @@ -10,6 +10,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub type RtcCodecStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcCodecStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcCodecStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcCodecStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "channels")] + fn channels_shim(this: &RtcCodecStats, val: u32); + #[wasm_bindgen(method, setter = "clockRate")] + fn clock_rate_shim(this: &RtcCodecStats, val: u32); + #[wasm_bindgen(method, setter = "codec")] + fn codec_shim(this: &RtcCodecStats, val: &str); + #[wasm_bindgen(method, setter = "parameters")] + fn parameters_shim(this: &RtcCodecStats, val: &str); + #[wasm_bindgen(method, setter = "payloadType")] + fn payload_type_shim(this: &RtcCodecStats, val: u32); } impl RtcCodecStats { #[doc = "Construct a new `RtcCodecStats`."] @@ -24,30 +41,14 @@ impl RtcCodecStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,94 +56,42 @@ impl RtcCodecStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `channels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn channels(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channels_shim(val); self } #[doc = "Change the `clockRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clockRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clock_rate_shim(val); self } #[doc = "Change the `codec` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn codec(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_shim(val); self } #[doc = "Change the `parameters` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn parameters(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("parameters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.parameters_shim(val); self } #[doc = "Change the `payloadType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub fn payload_type(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("payloadType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.payload_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcConfiguration.rs b/crates/web-sys/src/features/gen_RtcConfiguration.rs index ab8a1ff7386..9d73017a32e 100644 --- a/crates/web-sys/src/features/gen_RtcConfiguration.rs +++ b/crates/web-sys/src/features/gen_RtcConfiguration.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] pub type RtcConfiguration; + #[cfg(feature = "RtcBundlePolicy")] + #[wasm_bindgen(method, setter = "bundlePolicy")] + fn bundle_policy_shim(this: &RtcConfiguration, val: RtcBundlePolicy); + #[wasm_bindgen(method, setter = "certificates")] + fn certificates_shim(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iceServers")] + fn ice_servers_shim(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "RtcIceTransportPolicy")] + #[wasm_bindgen(method, setter = "iceTransportPolicy")] + fn ice_transport_policy_shim(this: &RtcConfiguration, val: RtcIceTransportPolicy); + #[wasm_bindgen(method, setter = "peerIdentity")] + fn peer_identity_shim(this: &RtcConfiguration, val: Option<&str>); } impl RtcConfiguration { #[doc = "Construct a new `RtcConfiguration`."] @@ -25,51 +37,21 @@ impl RtcConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcBundlePolicy`, `RtcConfiguration`*"] pub fn bundle_policy(&mut self, val: RtcBundlePolicy) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bundlePolicy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bundle_policy_shim(val); self } #[doc = "Change the `certificates` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] pub fn certificates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("certificates"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.certificates_shim(val); self } #[doc = "Change the `iceServers` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] pub fn ice_servers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceServers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_servers_shim(val); self } #[cfg(feature = "RtcIceTransportPolicy")] @@ -77,34 +59,14 @@ impl RtcConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcIceTransportPolicy`*"] pub fn ice_transport_policy(&mut self, val: RtcIceTransportPolicy) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceTransportPolicy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_transport_policy_shim(val); self } #[doc = "Change the `peerIdentity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] pub fn peer_identity(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("peerIdentity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.peer_identity_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs index ca400a80ab2..bf64ac7bcd1 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] pub type RtcDataChannelEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &RtcDataChannelEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &RtcDataChannelEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &RtcDataChannelEventInit, val: bool); + #[cfg(feature = "RtcDataChannel")] + #[wasm_bindgen(method, setter = "channel")] + fn channel_shim(this: &RtcDataChannelEventInit, val: &RtcDataChannel); } impl RtcDataChannelEventInit { #[cfg(feature = "RtcDataChannel")] @@ -26,51 +35,21 @@ impl RtcDataChannelEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "RtcDataChannel")] @@ -78,17 +57,7 @@ impl RtcDataChannelEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`, `RtcDataChannelEventInit`*"] pub fn channel(&mut self, val: &RtcDataChannel) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs index 6e224f76ff2..915662ba9a1 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub type RtcDataChannelInit; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcDataChannelInit, val: u16); + #[wasm_bindgen(method, setter = "maxPacketLifeTime")] + fn max_packet_life_time_shim(this: &RtcDataChannelInit, val: u16); + #[wasm_bindgen(method, setter = "maxRetransmitTime")] + fn max_retransmit_time_shim(this: &RtcDataChannelInit, val: u16); + #[wasm_bindgen(method, setter = "maxRetransmits")] + fn max_retransmits_shim(this: &RtcDataChannelInit, val: u16); + #[wasm_bindgen(method, setter = "negotiated")] + fn negotiated_shim(this: &RtcDataChannelInit, val: bool); + #[wasm_bindgen(method, setter = "ordered")] + fn ordered_shim(this: &RtcDataChannelInit, val: bool); + #[wasm_bindgen(method, setter = "protocol")] + fn protocol_shim(this: &RtcDataChannelInit, val: &str); } impl RtcDataChannelInit { #[doc = "Construct a new `RtcDataChannelInit`."] @@ -24,115 +38,49 @@ impl RtcDataChannelInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `maxPacketLifeTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn max_packet_life_time(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxPacketLifeTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_packet_life_time_shim(val); self } #[doc = "Change the `maxRetransmitTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn max_retransmit_time(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxRetransmitTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_retransmit_time_shim(val); self } #[doc = "Change the `maxRetransmits` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn max_retransmits(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxRetransmits"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_retransmits_shim(val); self } #[doc = "Change the `negotiated` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn negotiated(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("negotiated"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.negotiated_shim(val); self } #[doc = "Change the `ordered` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn ordered(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ordered"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ordered_shim(val); self } #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub fn protocol(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("protocol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.protocol_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcFecParameters.rs b/crates/web-sys/src/features/gen_RtcFecParameters.rs index 6fe23c19cba..4ac685bf15c 100644 --- a/crates/web-sys/src/features/gen_RtcFecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcFecParameters.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] pub type RtcFecParameters; + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcFecParameters, val: u32); } impl RtcFecParameters { #[doc = "Construct a new `RtcFecParameters`."] @@ -24,13 +26,7 @@ impl RtcFecParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] pub fn ssrc(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs index 70e3db9d925..9b4637f86a8 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] pub type RtcIceCandidateInit; + #[wasm_bindgen(method, setter = "candidate")] + fn candidate_shim(this: &RtcIceCandidateInit, val: &str); + #[wasm_bindgen(method, setter = "sdpMLineIndex")] + fn sdp_m_line_index_shim(this: &RtcIceCandidateInit, val: Option); + #[wasm_bindgen(method, setter = "sdpMid")] + fn sdp_mid_shim(this: &RtcIceCandidateInit, val: Option<&str>); } impl RtcIceCandidateInit { #[doc = "Construct a new `RtcIceCandidateInit`."] @@ -25,48 +31,21 @@ impl RtcIceCandidateInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] pub fn candidate(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("candidate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.candidate_shim(val); self } #[doc = "Change the `sdpMLineIndex` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] pub fn sdp_m_line_index(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sdpMLineIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sdp_m_line_index_shim(val); self } #[doc = "Change the `sdpMid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] pub fn sdp_mid(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sdpMid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sdp_mid_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs index 19932febf74..d2a83611f77 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs @@ -10,6 +10,42 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub type RtcIceCandidatePairStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcIceCandidatePairStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcIceCandidatePairStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &RtcIceCandidatePairStats, val: f64); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &RtcIceCandidatePairStats, val: f64); + #[wasm_bindgen(method, setter = "componentId")] + fn component_id_shim(this: &RtcIceCandidatePairStats, val: u32); + #[wasm_bindgen(method, setter = "lastPacketReceivedTimestamp")] + fn last_packet_received_timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + #[wasm_bindgen(method, setter = "lastPacketSentTimestamp")] + fn last_packet_sent_timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + #[wasm_bindgen(method, setter = "localCandidateId")] + fn local_candidate_id_shim(this: &RtcIceCandidatePairStats, val: &str); + #[wasm_bindgen(method, setter = "nominated")] + fn nominated_shim(this: &RtcIceCandidatePairStats, val: bool); + #[wasm_bindgen(method, setter = "priority")] + fn priority_shim(this: &RtcIceCandidatePairStats, val: f64); + #[wasm_bindgen(method, setter = "readable")] + fn readable_shim(this: &RtcIceCandidatePairStats, val: bool); + #[wasm_bindgen(method, setter = "remoteCandidateId")] + fn remote_candidate_id_shim(this: &RtcIceCandidatePairStats, val: &str); + #[wasm_bindgen(method, setter = "selected")] + fn selected_shim(this: &RtcIceCandidatePairStats, val: bool); + #[cfg(feature = "RtcStatsIceCandidatePairState")] + #[wasm_bindgen(method, setter = "state")] + fn state_shim(this: &RtcIceCandidatePairStats, val: RtcStatsIceCandidatePairState); + #[wasm_bindgen(method, setter = "transportId")] + fn transport_id_shim(this: &RtcIceCandidatePairStats, val: &str); + #[wasm_bindgen(method, setter = "writable")] + fn writable_shim(this: &RtcIceCandidatePairStats, val: bool); } impl RtcIceCandidatePairStats { #[doc = "Construct a new `RtcIceCandidatePairStats`."] @@ -24,30 +60,14 @@ impl RtcIceCandidatePairStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,200 +75,84 @@ impl RtcIceCandidatePairStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } #[doc = "Change the `componentId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn component_id(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("componentId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.component_id_shim(val); self } #[doc = "Change the `lastPacketReceivedTimestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn last_packet_received_timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastPacketReceivedTimestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_packet_received_timestamp_shim(val); self } #[doc = "Change the `lastPacketSentTimestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn last_packet_sent_timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lastPacketSentTimestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.last_packet_sent_timestamp_shim(val); self } #[doc = "Change the `localCandidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn local_candidate_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localCandidateId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_candidate_id_shim(val); self } #[doc = "Change the `nominated` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn nominated(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nominated"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.nominated_shim(val); self } #[doc = "Change the `priority` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn priority(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("priority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.priority_shim(val); self } #[doc = "Change the `readable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn readable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("readable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.readable_shim(val); self } #[doc = "Change the `remoteCandidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn remote_candidate_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteCandidateId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_candidate_id_shim(val); self } #[doc = "Change the `selected` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn selected(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("selected"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.selected_shim(val); self } #[cfg(feature = "RtcStatsIceCandidatePairState")] @@ -256,47 +160,21 @@ impl RtcIceCandidatePairStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsIceCandidatePairState`*"] pub fn state(&mut self, val: RtcStatsIceCandidatePairState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("state"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.state_shim(val); self } #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn transport_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_id_shim(val); self } #[doc = "Change the `writable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub fn writable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("writable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.writable_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs index fb9c65d4469..1b0e279c135 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs @@ -10,6 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub type RtcIceCandidateStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcIceCandidateStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcIceCandidateStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcIceCandidateStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "candidateId")] + fn candidate_id_shim(this: &RtcIceCandidateStats, val: &str); + #[cfg(feature = "RtcStatsIceCandidateType")] + #[wasm_bindgen(method, setter = "candidateType")] + fn candidate_type_shim(this: &RtcIceCandidateStats, val: RtcStatsIceCandidateType); + #[wasm_bindgen(method, setter = "componentId")] + fn component_id_shim(this: &RtcIceCandidateStats, val: &str); + #[wasm_bindgen(method, setter = "ipAddress")] + fn ip_address_shim(this: &RtcIceCandidateStats, val: &str); + #[wasm_bindgen(method, setter = "portNumber")] + fn port_number_shim(this: &RtcIceCandidateStats, val: i32); + #[wasm_bindgen(method, setter = "transport")] + fn transport_shim(this: &RtcIceCandidateStats, val: &str); } impl RtcIceCandidateStats { #[doc = "Construct a new `RtcIceCandidateStats`."] @@ -24,30 +44,14 @@ impl RtcIceCandidateStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,30 +59,14 @@ impl RtcIceCandidateStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `candidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn candidate_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("candidateId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.candidate_id_shim(val); self } #[cfg(feature = "RtcStatsIceCandidateType")] @@ -86,85 +74,35 @@ impl RtcIceCandidateStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsIceCandidateType`*"] pub fn candidate_type(&mut self, val: RtcStatsIceCandidateType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("candidateType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.candidate_type_shim(val); self } #[doc = "Change the `componentId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn component_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("componentId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.component_id_shim(val); self } #[doc = "Change the `ipAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn ip_address(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ipAddress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ip_address_shim(val); self } #[doc = "Change the `portNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn port_number(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("portNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.port_number_shim(val); self } #[doc = "Change the `transport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub fn transport(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transport"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs index a4154fd63fa..b9d84119d9d 100644 --- a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs @@ -10,6 +10,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub type RtcIceComponentStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcIceComponentStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcIceComponentStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcIceComponentStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "activeConnection")] + fn active_connection_shim(this: &RtcIceComponentStats, val: bool); + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &RtcIceComponentStats, val: u32); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &RtcIceComponentStats, val: u32); + #[wasm_bindgen(method, setter = "component")] + fn component_shim(this: &RtcIceComponentStats, val: i32); + #[wasm_bindgen(method, setter = "transportId")] + fn transport_id_shim(this: &RtcIceComponentStats, val: &str); } impl RtcIceComponentStats { #[doc = "Construct a new `RtcIceComponentStats`."] @@ -24,30 +41,14 @@ impl RtcIceComponentStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,98 +56,42 @@ impl RtcIceComponentStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `activeConnection` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn active_connection(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("activeConnection"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.active_connection_shim(val); self } #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn bytes_received(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn bytes_sent(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } #[doc = "Change the `component` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn component(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("component"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.component_shim(val); self } #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub fn transport_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceServer.rs b/crates/web-sys/src/features/gen_RtcIceServer.rs index cde27056568..23937c63109 100644 --- a/crates/web-sys/src/features/gen_RtcIceServer.rs +++ b/crates/web-sys/src/features/gen_RtcIceServer.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub type RtcIceServer; + #[wasm_bindgen(method, setter = "credential")] + fn credential_shim(this: &RtcIceServer, val: &str); + #[cfg(feature = "RtcIceCredentialType")] + #[wasm_bindgen(method, setter = "credentialType")] + fn credential_type_shim(this: &RtcIceServer, val: RtcIceCredentialType); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &RtcIceServer, val: &str); + #[wasm_bindgen(method, setter = "urls")] + fn urls_shim(this: &RtcIceServer, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "username")] + fn username_shim(this: &RtcIceServer, val: &str); } impl RtcIceServer { #[doc = "Construct a new `RtcIceServer`."] @@ -24,17 +35,7 @@ impl RtcIceServer { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub fn credential(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("credential"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.credential_shim(val); self } #[cfg(feature = "RtcIceCredentialType")] @@ -42,60 +43,28 @@ impl RtcIceServer { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCredentialType`, `RtcIceServer`*"] pub fn credential_type(&mut self, val: RtcIceCredentialType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("credentialType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.credential_type_shim(val); self } #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub fn url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } #[doc = "Change the `urls` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub fn urls(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("urls"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.urls_shim(val); self } #[doc = "Change the `username` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub fn username(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("username"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.username_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs index 06a91917492..03e7922f9fc 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] pub type RtcIdentityAssertion; + #[wasm_bindgen(method, setter = "idp")] + fn idp_shim(this: &RtcIdentityAssertion, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &RtcIdentityAssertion, val: &str); } impl RtcIdentityAssertion { #[doc = "Construct a new `RtcIdentityAssertion`."] @@ -24,26 +28,14 @@ impl RtcIdentityAssertion { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] pub fn idp(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("idp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.idp_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs index 326412d987c..186af70aded 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] pub type RtcIdentityAssertionResult; + #[wasm_bindgen(method, setter = "assertion")] + fn assertion_shim(this: &RtcIdentityAssertionResult, val: &str); + #[cfg(feature = "RtcIdentityProviderDetails")] + #[wasm_bindgen(method, setter = "idp")] + fn idp_shim(this: &RtcIdentityAssertionResult, val: &RtcIdentityProviderDetails); } impl RtcIdentityAssertionResult { #[cfg(feature = "RtcIdentityProviderDetails")] @@ -27,17 +32,7 @@ impl RtcIdentityAssertionResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] pub fn assertion(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("assertion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.assertion_shim(val); self } #[cfg(feature = "RtcIdentityProviderDetails")] @@ -45,13 +40,7 @@ impl RtcIdentityAssertionResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`, `RtcIdentityProviderDetails`*"] pub fn idp(&mut self, val: &RtcIdentityProviderDetails) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("idp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.idp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs index 949a347273b..b2d6b76b5b0 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] pub type RtcIdentityProvider; + #[wasm_bindgen(method, setter = "generateAssertion")] + fn generate_assertion_shim(this: &RtcIdentityProvider, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "validateAssertion")] + fn validate_assertion_shim(this: &RtcIdentityProvider, val: &::js_sys::Function); } impl RtcIdentityProvider { #[doc = "Construct a new `RtcIdentityProvider`."] @@ -29,34 +33,14 @@ impl RtcIdentityProvider { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] pub fn generate_assertion(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("generateAssertion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.generate_assertion_shim(val); self } #[doc = "Change the `validateAssertion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] pub fn validate_assertion(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("validateAssertion"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.validate_assertion_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs index d3abd14f194..948c99eabda 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] pub type RtcIdentityProviderDetails; + #[wasm_bindgen(method, setter = "domain")] + fn domain_shim(this: &RtcIdentityProviderDetails, val: &str); + #[wasm_bindgen(method, setter = "protocol")] + fn protocol_shim(this: &RtcIdentityProviderDetails, val: &str); } impl RtcIdentityProviderDetails { #[doc = "Construct a new `RtcIdentityProviderDetails`."] @@ -25,31 +29,14 @@ impl RtcIdentityProviderDetails { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] pub fn domain(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("domain"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.domain_shim(val); self } #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] pub fn protocol(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("protocol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.protocol_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs index c73d05c27c6..b4ee75df20c 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] pub type RtcIdentityProviderOptions; + #[wasm_bindgen(method, setter = "peerIdentity")] + fn peer_identity_shim(this: &RtcIdentityProviderOptions, val: &str); + #[wasm_bindgen(method, setter = "protocol")] + fn protocol_shim(this: &RtcIdentityProviderOptions, val: &str); + #[wasm_bindgen(method, setter = "usernameHint")] + fn username_hint_shim(this: &RtcIdentityProviderOptions, val: &str); } impl RtcIdentityProviderOptions { #[doc = "Construct a new `RtcIdentityProviderOptions`."] @@ -24,51 +30,21 @@ impl RtcIdentityProviderOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] pub fn peer_identity(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("peerIdentity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.peer_identity_shim(val); self } #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] pub fn protocol(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("protocol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.protocol_shim(val); self } #[doc = "Change the `usernameHint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] pub fn username_hint(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usernameHint"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.username_hint_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs index f383349d7fb..3c86139a6e4 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] pub type RtcIdentityValidationResult; + #[wasm_bindgen(method, setter = "contents")] + fn contents_shim(this: &RtcIdentityValidationResult, val: &str); + #[wasm_bindgen(method, setter = "identity")] + fn identity_shim(this: &RtcIdentityValidationResult, val: &str); } impl RtcIdentityValidationResult { #[doc = "Construct a new `RtcIdentityValidationResult`."] @@ -26,34 +30,14 @@ impl RtcIdentityValidationResult { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] pub fn contents(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contents"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.contents_shim(val); self } #[doc = "Change the `identity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] pub fn identity(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("identity"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.identity_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs index c0d440f24cd..4d8ff7ecc6c 100644 --- a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs @@ -10,6 +10,55 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub type RtcInboundRtpStreamStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcInboundRtpStreamStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "bitrateMean")] + fn bitrate_mean_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bitrateStdDev")] + fn bitrate_std_dev_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "codecId")] + fn codec_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "firCount")] + fn fir_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "framerateMean")] + fn framerate_mean_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "framerateStdDev")] + fn framerate_std_dev_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "isRemote")] + fn is_remote_shim(this: &RtcInboundRtpStreamStats, val: bool); + #[wasm_bindgen(method, setter = "mediaTrackId")] + fn media_track_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "mediaType")] + fn media_type_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "nackCount")] + fn nack_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "pliCount")] + fn pli_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "remoteId")] + fn remote_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "transportId")] + fn transport_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "discardedPackets")] + fn discarded_packets_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "framesDecoded")] + fn frames_decoded_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "jitter")] + fn jitter_shim(this: &RtcInboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "packetsLost")] + fn packets_lost_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "packetsReceived")] + fn packets_received_shim(this: &RtcInboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "roundTripTime")] + fn round_trip_time_shim(this: &RtcInboundRtpStreamStats, val: i32); } impl RtcInboundRtpStreamStats { #[doc = "Construct a new `RtcInboundRtpStreamStats`."] @@ -24,30 +73,14 @@ impl RtcInboundRtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,363 +88,154 @@ impl RtcInboundRtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `bitrateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_mean_shim(val); self } #[doc = "Change the `bitrateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_std_dev_shim(val); self } #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn codec_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codecId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_id_shim(val); self } #[doc = "Change the `firCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn fir_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("firCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fir_count_shim(val); self } #[doc = "Change the `framerateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_mean_shim(val); self } #[doc = "Change the `framerateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_std_dev_shim(val); self } #[doc = "Change the `isRemote` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn is_remote(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isRemote"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_remote_shim(val); self } #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaTrackId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_track_id_shim(val); self } #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn media_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_type_shim(val); self } #[doc = "Change the `nackCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn nack_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nackCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.nack_count_shim(val); self } #[doc = "Change the `pliCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn pli_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pliCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pli_count_shim(val); self } #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn remote_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_id_shim(val); self } #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn ssrc(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn transport_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_id_shim(val); self } #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[doc = "Change the `discardedPackets` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn discarded_packets(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("discardedPackets"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.discarded_packets_shim(val); self } #[doc = "Change the `framesDecoded` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn frames_decoded(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesDecoded"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_decoded_shim(val); self } #[doc = "Change the `jitter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn jitter(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("jitter"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.jitter_shim(val); self } #[doc = "Change the `packetsLost` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn packets_lost(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsLost"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_lost_shim(val); self } #[doc = "Change the `packetsReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn packets_received(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_received_shim(val); self } #[doc = "Change the `roundTripTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub fn round_trip_time(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("roundTripTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.round_trip_time_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs index 2698c8a726a..3ee36c181b7 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub type RtcMediaStreamStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcMediaStreamStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcMediaStreamStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcMediaStreamStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "streamIdentifier")] + fn stream_identifier_shim(this: &RtcMediaStreamStats, val: &str); + #[wasm_bindgen(method, setter = "trackIds")] + fn track_ids_shim(this: &RtcMediaStreamStats, val: &::wasm_bindgen::JsValue); } impl RtcMediaStreamStats { #[doc = "Construct a new `RtcMediaStreamStats`."] @@ -24,30 +35,14 @@ impl RtcMediaStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,47 +50,21 @@ impl RtcMediaStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `streamIdentifier` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub fn stream_identifier(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("streamIdentifier"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stream_identifier_shim(val); self } #[doc = "Change the `trackIds` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub fn track_ids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("trackIds"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_ids_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs index 270dacf30ac..81b5fd0deda 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs @@ -10,6 +10,41 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub type RtcMediaStreamTrackStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcMediaStreamTrackStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcMediaStreamTrackStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcMediaStreamTrackStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "audioLevel")] + fn audio_level_shim(this: &RtcMediaStreamTrackStats, val: f64); + #[wasm_bindgen(method, setter = "echoReturnLoss")] + fn echo_return_loss_shim(this: &RtcMediaStreamTrackStats, val: f64); + #[wasm_bindgen(method, setter = "echoReturnLossEnhancement")] + fn echo_return_loss_enhancement_shim(this: &RtcMediaStreamTrackStats, val: f64); + #[wasm_bindgen(method, setter = "frameHeight")] + fn frame_height_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "frameWidth")] + fn frame_width_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "framesCorrupted")] + fn frames_corrupted_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "framesDecoded")] + fn frames_decoded_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "framesDropped")] + fn frames_dropped_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "framesPerSecond")] + fn frames_per_second_shim(this: &RtcMediaStreamTrackStats, val: f64); + #[wasm_bindgen(method, setter = "framesReceived")] + fn frames_received_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "framesSent")] + fn frames_sent_shim(this: &RtcMediaStreamTrackStats, val: u32); + #[wasm_bindgen(method, setter = "remoteSource")] + fn remote_source_shim(this: &RtcMediaStreamTrackStats, val: bool); + #[wasm_bindgen(method, setter = "ssrcIds")] + fn ssrc_ids_shim(this: &RtcMediaStreamTrackStats, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "trackIdentifier")] + fn track_identifier_shim(this: &RtcMediaStreamTrackStats, val: &str); } impl RtcMediaStreamTrackStats { #[doc = "Construct a new `RtcMediaStreamTrackStats`."] @@ -24,30 +59,14 @@ impl RtcMediaStreamTrackStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,251 +74,105 @@ impl RtcMediaStreamTrackStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `audioLevel` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn audio_level(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_level_shim(val); self } #[doc = "Change the `echoReturnLoss` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn echo_return_loss(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoReturnLoss"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_return_loss_shim(val); self } #[doc = "Change the `echoReturnLossEnhancement` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn echo_return_loss_enhancement(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("echoReturnLossEnhancement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.echo_return_loss_enhancement_shim(val); self } #[doc = "Change the `frameHeight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frame_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_height_shim(val); self } #[doc = "Change the `frameWidth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frame_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("frameWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_width_shim(val); self } #[doc = "Change the `framesCorrupted` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_corrupted(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesCorrupted"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_corrupted_shim(val); self } #[doc = "Change the `framesDecoded` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_decoded(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesDecoded"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_decoded_shim(val); self } #[doc = "Change the `framesDropped` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_dropped(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesDropped"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_dropped_shim(val); self } #[doc = "Change the `framesPerSecond` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_per_second(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesPerSecond"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_per_second_shim(val); self } #[doc = "Change the `framesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_received(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_received_shim(val); self } #[doc = "Change the `framesSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn frames_sent(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_sent_shim(val); self } #[doc = "Change the `remoteSource` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn remote_source(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteSource"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_source_shim(val); self } #[doc = "Change the `ssrcIds` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn ssrc_ids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ssrcIds"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_ids_shim(val); self } #[doc = "Change the `trackIdentifier` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub fn track_identifier(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("trackIdentifier"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_identifier_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcOfferOptions.rs b/crates/web-sys/src/features/gen_RtcOfferOptions.rs index 353f369851b..11082e23695 100644 --- a/crates/web-sys/src/features/gen_RtcOfferOptions.rs +++ b/crates/web-sys/src/features/gen_RtcOfferOptions.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] pub type RtcOfferOptions; + #[wasm_bindgen(method, setter = "iceRestart")] + fn ice_restart_shim(this: &RtcOfferOptions, val: bool); + #[wasm_bindgen(method, setter = "offerToReceiveAudio")] + fn offer_to_receive_audio_shim(this: &RtcOfferOptions, val: bool); + #[wasm_bindgen(method, setter = "offerToReceiveVideo")] + fn offer_to_receive_video_shim(this: &RtcOfferOptions, val: bool); } impl RtcOfferOptions { #[doc = "Construct a new `RtcOfferOptions`."] @@ -24,51 +30,21 @@ impl RtcOfferOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] pub fn ice_restart(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceRestart"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_restart_shim(val); self } #[doc = "Change the `offerToReceiveAudio` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] pub fn offer_to_receive_audio(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("offerToReceiveAudio"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offer_to_receive_audio_shim(val); self } #[doc = "Change the `offerToReceiveVideo` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] pub fn offer_to_receive_video(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("offerToReceiveVideo"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offer_to_receive_video_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs index 8e705281e44..34881d1b56f 100644 --- a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs @@ -10,6 +10,51 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub type RtcOutboundRtpStreamStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcOutboundRtpStreamStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "bitrateMean")] + fn bitrate_mean_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bitrateStdDev")] + fn bitrate_std_dev_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "codecId")] + fn codec_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "firCount")] + fn fir_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "framerateMean")] + fn framerate_mean_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "framerateStdDev")] + fn framerate_std_dev_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "isRemote")] + fn is_remote_shim(this: &RtcOutboundRtpStreamStats, val: bool); + #[wasm_bindgen(method, setter = "mediaTrackId")] + fn media_track_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "mediaType")] + fn media_type_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "nackCount")] + fn nack_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "pliCount")] + fn pli_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "remoteId")] + fn remote_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "transportId")] + fn transport_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &RtcOutboundRtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "droppedFrames")] + fn dropped_frames_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "framesEncoded")] + fn frames_encoded_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "packetsSent")] + fn packets_sent_shim(this: &RtcOutboundRtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "targetBitrate")] + fn target_bitrate_shim(this: &RtcOutboundRtpStreamStats, val: f64); } impl RtcOutboundRtpStreamStats { #[doc = "Construct a new `RtcOutboundRtpStreamStats`."] @@ -24,30 +69,14 @@ impl RtcOutboundRtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,332 +84,140 @@ impl RtcOutboundRtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `bitrateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_mean_shim(val); self } #[doc = "Change the `bitrateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_std_dev_shim(val); self } #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn codec_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codecId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_id_shim(val); self } #[doc = "Change the `firCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn fir_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("firCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fir_count_shim(val); self } #[doc = "Change the `framerateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_mean_shim(val); self } #[doc = "Change the `framerateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_std_dev_shim(val); self } #[doc = "Change the `isRemote` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn is_remote(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isRemote"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_remote_shim(val); self } #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaTrackId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_track_id_shim(val); self } #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn media_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_type_shim(val); self } #[doc = "Change the `nackCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn nack_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nackCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.nack_count_shim(val); self } #[doc = "Change the `pliCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn pli_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pliCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pli_count_shim(val); self } #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn remote_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_id_shim(val); self } #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn ssrc(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn transport_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_id_shim(val); self } #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } #[doc = "Change the `droppedFrames` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn dropped_frames(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("droppedFrames"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dropped_frames_shim(val); self } #[doc = "Change the `framesEncoded` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn frames_encoded(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framesEncoded"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frames_encoded_shim(val); self } #[doc = "Change the `packetsSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn packets_sent(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_sent_shim(val); self } #[doc = "Change the `targetBitrate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub fn target_bitrate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("targetBitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.target_bitrate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs index 26d98c9964c..b82a2c9e22e 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] pub type RtcPeerConnectionIceEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + #[cfg(feature = "RtcIceCandidate")] + #[wasm_bindgen(method, setter = "candidate")] + fn candidate_shim(this: &RtcPeerConnectionIceEventInit, val: Option<&RtcIceCandidate>); } impl RtcPeerConnectionIceEventInit { #[doc = "Construct a new `RtcPeerConnectionIceEventInit`."] @@ -24,51 +33,21 @@ impl RtcPeerConnectionIceEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "RtcIceCandidate")] @@ -76,17 +55,7 @@ impl RtcPeerConnectionIceEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`, `RtcPeerConnectionIceEventInit`*"] pub fn candidate(&mut self, val: Option<&RtcIceCandidate>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("candidate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.candidate_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs index 8a84dff0427..37fa913401f 100644 --- a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] pub type RtcRtcpParameters; + #[wasm_bindgen(method, setter = "cname")] + fn cname_shim(this: &RtcRtcpParameters, val: &str); + #[wasm_bindgen(method, setter = "reducedSize")] + fn reduced_size_shim(this: &RtcRtcpParameters, val: bool); } impl RtcRtcpParameters { #[doc = "Construct a new `RtcRtcpParameters`."] @@ -24,30 +28,14 @@ impl RtcRtcpParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] pub fn cname(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cname"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cname_shim(val); self } #[doc = "Change the `reducedSize` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] pub fn reduced_size(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("reducedSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reduced_size_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs index 872d90d0bd6..b0b0fa4f9de 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] pub type RtcRtpCapabilities; + #[wasm_bindgen(method, setter = "codecs")] + fn codecs_shim(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "headerExtensions")] + fn header_extensions_shim(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); } impl RtcRtpCapabilities { #[doc = "Construct a new `RtcRtpCapabilities`."] @@ -29,31 +33,14 @@ impl RtcRtpCapabilities { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] pub fn codecs(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codecs"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codecs_shim(val); self } #[doc = "Change the `headerExtensions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] pub fn header_extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("headerExtensions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.header_extensions_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs index 1b8730d70b9..1e229356986 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub type RtcRtpCodecCapability; + #[wasm_bindgen(method, setter = "channels")] + fn channels_shim(this: &RtcRtpCodecCapability, val: u16); + #[wasm_bindgen(method, setter = "clockRate")] + fn clock_rate_shim(this: &RtcRtpCodecCapability, val: u32); + #[wasm_bindgen(method, setter = "mimeType")] + fn mime_type_shim(this: &RtcRtpCodecCapability, val: &str); + #[wasm_bindgen(method, setter = "sdpFmtpLine")] + fn sdp_fmtp_line_shim(this: &RtcRtpCodecCapability, val: &str); } impl RtcRtpCodecCapability { #[doc = "Construct a new `RtcRtpCodecCapability`."] @@ -26,68 +34,28 @@ impl RtcRtpCodecCapability { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub fn channels(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channels_shim(val); self } #[doc = "Change the `clockRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clockRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clock_rate_shim(val); self } #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub fn mime_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mimeType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mime_type_shim(val); self } #[doc = "Change the `sdpFmtpLine` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sdpFmtpLine"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sdp_fmtp_line_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs index 35d31c23db6..0293a310175 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub type RtcRtpCodecParameters; + #[wasm_bindgen(method, setter = "channels")] + fn channels_shim(this: &RtcRtpCodecParameters, val: u16); + #[wasm_bindgen(method, setter = "clockRate")] + fn clock_rate_shim(this: &RtcRtpCodecParameters, val: u32); + #[wasm_bindgen(method, setter = "mimeType")] + fn mime_type_shim(this: &RtcRtpCodecParameters, val: &str); + #[wasm_bindgen(method, setter = "payloadType")] + fn payload_type_shim(this: &RtcRtpCodecParameters, val: u16); + #[wasm_bindgen(method, setter = "sdpFmtpLine")] + fn sdp_fmtp_line_shim(this: &RtcRtpCodecParameters, val: &str); } impl RtcRtpCodecParameters { #[doc = "Construct a new `RtcRtpCodecParameters`."] @@ -24,85 +34,35 @@ impl RtcRtpCodecParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub fn channels(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channels"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channels_shim(val); self } #[doc = "Change the `clockRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clockRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clock_rate_shim(val); self } #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub fn mime_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mimeType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mime_type_shim(val); self } #[doc = "Change the `payloadType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub fn payload_type(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("payloadType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.payload_type_shim(val); self } #[doc = "Change the `sdpFmtpLine` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sdpFmtpLine"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sdp_fmtp_line_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs index 77ee8c57050..5cec0c96708 100644 --- a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] pub type RtcRtpContributingSource; + #[wasm_bindgen(method, setter = "audioLevel")] + fn audio_level_shim(this: &RtcRtpContributingSource, val: f64); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &RtcRtpContributingSource, val: u32); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcRtpContributingSource, val: f64); } impl RtcRtpContributingSource { #[doc = "Construct a new `RtcRtpContributingSource`."] @@ -26,48 +32,21 @@ impl RtcRtpContributingSource { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] pub fn audio_level(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_level_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] pub fn source(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index 4bafe39090c..1c8e1ed3b00 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -10,6 +10,30 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub type RtcRtpEncodingParameters; + #[wasm_bindgen(method, setter = "active")] + fn active_shim(this: &RtcRtpEncodingParameters, val: bool); + #[cfg(feature = "RtcDegradationPreference")] + #[wasm_bindgen(method, setter = "degradationPreference")] + fn degradation_preference_shim(this: &RtcRtpEncodingParameters, val: RtcDegradationPreference); + #[cfg(feature = "RtcFecParameters")] + #[wasm_bindgen(method, setter = "fec")] + fn fec_shim(this: &RtcRtpEncodingParameters, val: &RtcFecParameters); + #[wasm_bindgen(method, setter = "maxBitrate")] + fn max_bitrate_shim(this: &RtcRtpEncodingParameters, val: u32); + #[cfg(feature = "RtcPriorityType")] + #[wasm_bindgen(method, setter = "priority")] + fn priority_shim(this: &RtcRtpEncodingParameters, val: RtcPriorityType); + #[wasm_bindgen(method, setter = "rid")] + fn rid_shim(this: &RtcRtpEncodingParameters, val: &str); + #[cfg(feature = "RtcRtxParameters")] + #[wasm_bindgen(method, setter = "rtx")] + fn rtx_shim(this: &RtcRtpEncodingParameters, val: &RtcRtxParameters); + #[wasm_bindgen(method, setter = "scalabilityMode")] + fn scalability_mode_shim(this: &RtcRtpEncodingParameters, val: &str); + #[wasm_bindgen(method, setter = "scaleResolutionDownBy")] + fn scale_resolution_down_by_shim(this: &RtcRtpEncodingParameters, val: f32); + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcRtpEncodingParameters, val: u32); } impl RtcRtpEncodingParameters { #[doc = "Construct a new `RtcRtpEncodingParameters`."] @@ -24,14 +48,7 @@ impl RtcRtpEncodingParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub fn active(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("active"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.active_shim(val); self } #[cfg(feature = "RtcDegradationPreference")] @@ -39,17 +56,7 @@ impl RtcRtpEncodingParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDegradationPreference`, `RtcRtpEncodingParameters`*"] pub fn degradation_preference(&mut self, val: RtcDegradationPreference) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("degradationPreference"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.degradation_preference_shim(val); self } #[cfg(feature = "RtcFecParameters")] @@ -57,30 +64,14 @@ impl RtcRtpEncodingParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`, `RtcRtpEncodingParameters`*"] pub fn fec(&mut self, val: &RtcFecParameters) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fec_shim(val); self } #[doc = "Change the `maxBitrate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub fn max_bitrate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("maxBitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.max_bitrate_shim(val); self } #[cfg(feature = "RtcPriorityType")] @@ -88,30 +79,14 @@ impl RtcRtpEncodingParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPriorityType`, `RtcRtpEncodingParameters`*"] pub fn priority(&mut self, val: RtcPriorityType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("priority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.priority_shim(val); self } #[doc = "Change the `rid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub fn rid(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rid_shim(val); self } #[cfg(feature = "RtcRtxParameters")] @@ -119,13 +94,7 @@ impl RtcRtpEncodingParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`, `RtcRtxParameters`*"] pub fn rtx(&mut self, val: &RtcRtxParameters) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rtx"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rtx_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -136,47 +105,21 @@ impl RtcRtpEncodingParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn scalability_mode(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("scalabilityMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scalability_mode_shim(val); self } #[doc = "Change the `scaleResolutionDownBy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub fn scale_resolution_down_by(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("scaleResolutionDownBy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scale_resolution_down_by_shim(val); self } #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub fn ssrc(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs index de9ec55990f..3a263a719e0 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] pub type RtcRtpHeaderExtensionCapability; + #[wasm_bindgen(method, setter = "uri")] + fn uri_shim(this: &RtcRtpHeaderExtensionCapability, val: &str); } impl RtcRtpHeaderExtensionCapability { #[doc = "Construct a new `RtcRtpHeaderExtensionCapability`."] @@ -25,13 +27,7 @@ impl RtcRtpHeaderExtensionCapability { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] pub fn uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("uri"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.uri_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs index bd1a3634ef1..bd09da10daf 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] pub type RtcRtpHeaderExtensionParameters; + #[wasm_bindgen(method, setter = "encrypted")] + fn encrypted_shim(this: &RtcRtpHeaderExtensionParameters, val: bool); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcRtpHeaderExtensionParameters, val: u16); + #[wasm_bindgen(method, setter = "uri")] + fn uri_shim(this: &RtcRtpHeaderExtensionParameters, val: &str); } impl RtcRtpHeaderExtensionParameters { #[doc = "Construct a new `RtcRtpHeaderExtensionParameters`."] @@ -24,43 +30,21 @@ impl RtcRtpHeaderExtensionParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] pub fn encrypted(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("encrypted"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.encrypted_shim(val); self } #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] pub fn id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `uri` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] pub fn uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("uri"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.uri_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpParameters.rs b/crates/web-sys/src/features/gen_RtcRtpParameters.rs index 65d7e31046d..1b260e0ea55 100644 --- a/crates/web-sys/src/features/gen_RtcRtpParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpParameters.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] pub type RtcRtpParameters; + #[wasm_bindgen(method, setter = "codecs")] + fn codecs_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "encodings")] + fn encodings_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "headerExtensions")] + fn header_extensions_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "RtcRtcpParameters")] + #[wasm_bindgen(method, setter = "rtcp")] + fn rtcp_shim(this: &RtcRtpParameters, val: &RtcRtcpParameters); } impl RtcRtpParameters { #[doc = "Construct a new `RtcRtpParameters`."] @@ -24,48 +33,21 @@ impl RtcRtpParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] pub fn codecs(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codecs"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codecs_shim(val); self } #[doc = "Change the `encodings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] pub fn encodings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("encodings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.encodings_shim(val); self } #[doc = "Change the `headerExtensions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] pub fn header_extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("headerExtensions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.header_extensions_shim(val); self } #[cfg(feature = "RtcRtcpParameters")] @@ -73,13 +55,7 @@ impl RtcRtpParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`, `RtcRtpParameters`*"] pub fn rtcp(&mut self, val: &RtcRtcpParameters) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rtcp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rtcp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs index 6c4082958a8..3983d4b3827 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub type RtcRtpSourceEntry; + #[wasm_bindgen(method, setter = "audioLevel")] + fn audio_level_shim(this: &RtcRtpSourceEntry, val: f64); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &RtcRtpSourceEntry, val: u32); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcRtpSourceEntry, val: f64); + #[wasm_bindgen(method, setter = "voiceActivityFlag")] + fn voice_activity_flag_shim(this: &RtcRtpSourceEntry, val: Option); + #[cfg(feature = "RtcRtpSourceEntryType")] + #[wasm_bindgen(method, setter = "sourceType")] + fn source_type_shim(this: &RtcRtpSourceEntry, val: RtcRtpSourceEntryType); } impl RtcRtpSourceEntry { #[cfg(feature = "RtcRtpSourceEntryType")] @@ -28,65 +39,28 @@ impl RtcRtpSourceEntry { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub fn audio_level(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_level_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub fn source(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[doc = "Change the `voiceActivityFlag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub fn voice_activity_flag(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("voiceActivityFlag"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.voice_activity_flag_shim(val); self } #[cfg(feature = "RtcRtpSourceEntryType")] @@ -94,17 +68,7 @@ impl RtcRtpSourceEntry { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`, `RtcRtpSourceEntryType`*"] pub fn source_type(&mut self, val: RtcRtpSourceEntryType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sourceType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs index caf4d6e34fa..3b58feee346 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub type RtcRtpSynchronizationSource; + #[wasm_bindgen(method, setter = "audioLevel")] + fn audio_level_shim(this: &RtcRtpSynchronizationSource, val: f64); + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &RtcRtpSynchronizationSource, val: u32); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcRtpSynchronizationSource, val: f64); + #[wasm_bindgen(method, setter = "voiceActivityFlag")] + fn voice_activity_flag_shim(this: &RtcRtpSynchronizationSource, val: Option); } impl RtcRtpSynchronizationSource { #[doc = "Construct a new `RtcRtpSynchronizationSource`."] @@ -26,65 +34,28 @@ impl RtcRtpSynchronizationSource { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub fn audio_level(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("audioLevel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.audio_level_shim(val); self } #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub fn source(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[doc = "Change the `voiceActivityFlag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub fn voice_activity_flag(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("voiceActivityFlag"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.voice_activity_flag_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs index f54384bb0df..47fbc05961d 100644 --- a/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs +++ b/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] pub type RtcRtpTransceiverInit; + #[cfg(feature = "RtcRtpTransceiverDirection")] + #[wasm_bindgen(method, setter = "direction")] + fn direction_shim(this: &RtcRtpTransceiverInit, val: RtcRtpTransceiverDirection); + #[wasm_bindgen(method, setter = "sendEncodings")] + fn send_encodings_shim(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "streams")] + fn streams_shim(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); } impl RtcRtpTransceiverInit { #[doc = "Construct a new `RtcRtpTransceiverInit`."] @@ -25,51 +32,21 @@ impl RtcRtpTransceiverInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverDirection`, `RtcRtpTransceiverInit`*"] pub fn direction(&mut self, val: RtcRtpTransceiverDirection) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("direction"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.direction_shim(val); self } #[doc = "Change the `sendEncodings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] pub fn send_encodings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sendEncodings"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.send_encodings_shim(val); self } #[doc = "Change the `streams` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] pub fn streams(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("streams"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.streams_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtxParameters.rs b/crates/web-sys/src/features/gen_RtcRtxParameters.rs index fd184ac827a..29aba89a545 100644 --- a/crates/web-sys/src/features/gen_RtcRtxParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtxParameters.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] pub type RtcRtxParameters; + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcRtxParameters, val: u32); } impl RtcRtxParameters { #[doc = "Construct a new `RtcRtxParameters`."] @@ -24,13 +26,7 @@ impl RtcRtxParameters { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] pub fn ssrc(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs index 5b2af20278c..e0b20763b49 100644 --- a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs +++ b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] pub type RtcSessionDescriptionInit; + #[wasm_bindgen(method, setter = "sdp")] + fn sdp_shim(this: &RtcSessionDescriptionInit, val: &str); + #[cfg(feature = "RtcSdpType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcSessionDescriptionInit, val: RtcSdpType); } impl RtcSessionDescriptionInit { #[cfg(feature = "RtcSdpType")] @@ -26,13 +31,7 @@ impl RtcSessionDescriptionInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] pub fn sdp(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sdp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sdp_shim(val); self } #[cfg(feature = "RtcSdpType")] @@ -40,13 +39,7 @@ impl RtcSessionDescriptionInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"] pub fn type_(&mut self, val: RtcSdpType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcStats.rs b/crates/web-sys/src/features/gen_RtcStats.rs index 2a3435a2edf..ecbb178de3f 100644 --- a/crates/web-sys/src/features/gen_RtcStats.rs +++ b/crates/web-sys/src/features/gen_RtcStats.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] pub type RtcStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcStats, val: RtcStatsType); } impl RtcStats { #[doc = "Construct a new `RtcStats`."] @@ -24,30 +31,14 @@ impl RtcStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,13 +46,7 @@ impl RtcStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`, `RtcStatsType`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs index 8bdb3b8e931..a08365bf1a0 100644 --- a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs +++ b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs @@ -10,6 +10,54 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub type RtcStatsReportInternal; + #[wasm_bindgen(method, setter = "closed")] + fn closed_shim(this: &RtcStatsReportInternal, val: bool); + #[wasm_bindgen(method, setter = "codecStats")] + fn codec_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iceCandidatePairStats")] + fn ice_candidate_pair_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iceCandidateStats")] + fn ice_candidate_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iceComponentStats")] + fn ice_component_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "iceRestarts")] + fn ice_restarts_shim(this: &RtcStatsReportInternal, val: u32); + #[wasm_bindgen(method, setter = "iceRollbacks")] + fn ice_rollbacks_shim(this: &RtcStatsReportInternal, val: u32); + #[wasm_bindgen(method, setter = "inboundRTPStreamStats")] + fn inbound_rtp_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "localSdp")] + fn local_sdp_shim(this: &RtcStatsReportInternal, val: &str); + #[wasm_bindgen(method, setter = "mediaStreamStats")] + fn media_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "mediaStreamTrackStats")] + fn media_stream_track_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "offerer")] + fn offerer_shim(this: &RtcStatsReportInternal, val: bool); + #[wasm_bindgen(method, setter = "outboundRTPStreamStats")] + fn outbound_rtp_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "pcid")] + fn pcid_shim(this: &RtcStatsReportInternal, val: &str); + #[wasm_bindgen(method, setter = "rawLocalCandidates")] + fn raw_local_candidates_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "rawRemoteCandidates")] + fn raw_remote_candidates_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "remoteSdp")] + fn remote_sdp_shim(this: &RtcStatsReportInternal, val: &str); + #[wasm_bindgen(method, setter = "rtpContributingSourceStats")] + fn rtp_contributing_source_stats_shim( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcStatsReportInternal, val: f64); + #[wasm_bindgen(method, setter = "transportStats")] + fn transport_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "trickledIceCandidateStats")] + fn trickled_ice_candidate_stats_shim( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); } impl RtcStatsReportInternal { #[doc = "Construct a new `RtcStatsReportInternal`."] @@ -24,350 +72,147 @@ impl RtcStatsReportInternal { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn closed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("closed"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.closed_shim(val); self } #[doc = "Change the `codecStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn codec_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codecStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_stats_shim(val); self } #[doc = "Change the `iceCandidatePairStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn ice_candidate_pair_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceCandidatePairStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_candidate_pair_stats_shim(val); self } #[doc = "Change the `iceCandidateStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn ice_candidate_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceCandidateStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_candidate_stats_shim(val); self } #[doc = "Change the `iceComponentStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn ice_component_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceComponentStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_component_stats_shim(val); self } #[doc = "Change the `iceRestarts` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn ice_restarts(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceRestarts"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_restarts_shim(val); self } #[doc = "Change the `iceRollbacks` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn ice_rollbacks(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("iceRollbacks"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ice_rollbacks_shim(val); self } #[doc = "Change the `inboundRTPStreamStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn inbound_rtp_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inboundRTPStreamStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inbound_rtp_stream_stats_shim(val); self } #[doc = "Change the `localSdp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn local_sdp(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localSdp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_sdp_shim(val); self } #[doc = "Change the `mediaStreamStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn media_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaStreamStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_stream_stats_shim(val); self } #[doc = "Change the `mediaStreamTrackStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn media_stream_track_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaStreamTrackStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_stream_track_stats_shim(val); self } #[doc = "Change the `offerer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn offerer(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("offerer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.offerer_shim(val); self } #[doc = "Change the `outboundRTPStreamStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn outbound_rtp_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("outboundRTPStreamStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.outbound_rtp_stream_stats_shim(val); self } #[doc = "Change the `pcid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn pcid(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pcid"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pcid_shim(val); self } #[doc = "Change the `rawLocalCandidates` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn raw_local_candidates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rawLocalCandidates"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.raw_local_candidates_shim(val); self } #[doc = "Change the `rawRemoteCandidates` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn raw_remote_candidates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rawRemoteCandidates"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.raw_remote_candidates_shim(val); self } #[doc = "Change the `remoteSdp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn remote_sdp(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteSdp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_sdp_shim(val); self } #[doc = "Change the `rtpContributingSourceStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn rtp_contributing_source_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rtpContributingSourceStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rtp_contributing_source_stats_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[doc = "Change the `transportStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn transport_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_stats_shim(val); self } #[doc = "Change the `trickledIceCandidateStats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub fn trickled_ice_candidate_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("trickledIceCandidateStats"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.trickled_ice_candidate_stats_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs index 7bc6ce67d01..03ef80243d1 100644 --- a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs @@ -10,6 +10,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub type RtcTrackEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &RtcTrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &RtcTrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &RtcTrackEventInit, val: bool); + #[cfg(feature = "RtcRtpReceiver")] + #[wasm_bindgen(method, setter = "receiver")] + fn receiver_shim(this: &RtcTrackEventInit, val: &RtcRtpReceiver); + #[wasm_bindgen(method, setter = "streams")] + fn streams_shim(this: &RtcTrackEventInit, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "MediaStreamTrack")] + #[wasm_bindgen(method, setter = "track")] + fn track_shim(this: &RtcTrackEventInit, val: &MediaStreamTrack); + #[cfg(feature = "RtcRtpTransceiver")] + #[wasm_bindgen(method, setter = "transceiver")] + fn transceiver_shim(this: &RtcTrackEventInit, val: &RtcRtpTransceiver); } impl RtcTrackEventInit { #[cfg(all( @@ -36,51 +53,21 @@ impl RtcTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "RtcRtpReceiver")] @@ -88,34 +75,14 @@ impl RtcTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcTrackEventInit`*"] pub fn receiver(&mut self, val: &RtcRtpReceiver) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("receiver"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.receiver_shim(val); self } #[doc = "Change the `streams` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub fn streams(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("streams"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.streams_shim(val); self } #[cfg(feature = "MediaStreamTrack")] @@ -123,13 +90,7 @@ impl RtcTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcTrackEventInit`*"] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("track"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_shim(val); self } #[cfg(feature = "RtcRtpTransceiver")] @@ -137,17 +98,7 @@ impl RtcTrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`, `RtcTrackEventInit`*"] pub fn transceiver(&mut self, val: &RtcRtpTransceiver) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transceiver"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transceiver_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcTransportStats.rs b/crates/web-sys/src/features/gen_RtcTransportStats.rs index 93f9a818c63..d76e5bb3220 100644 --- a/crates/web-sys/src/features/gen_RtcTransportStats.rs +++ b/crates/web-sys/src/features/gen_RtcTransportStats.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub type RtcTransportStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcTransportStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcTransportStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcTransportStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &RtcTransportStats, val: u32); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &RtcTransportStats, val: u32); } impl RtcTransportStats { #[doc = "Construct a new `RtcTransportStats`."] @@ -24,30 +35,14 @@ impl RtcTransportStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,47 +50,21 @@ impl RtcTransportStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcTransportStats`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub fn bytes_received(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub fn bytes_sent(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs index cd7ee92775f..5232911bd6a 100644 --- a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub type RtcdtmfToneChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "tone")] + fn tone_shim(this: &RtcdtmfToneChangeEventInit, val: &str); } impl RtcdtmfToneChangeEventInit { #[doc = "Construct a new `RtcdtmfToneChangeEventInit`."] @@ -24,64 +32,28 @@ impl RtcdtmfToneChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `tone` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub fn tone(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tone"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tone_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs index 637fcd06fdb..76ba0860223 100644 --- a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub type RtcrtpContributingSourceStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcrtpContributingSourceStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcrtpContributingSourceStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcrtpContributingSourceStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "contributorSsrc")] + fn contributor_ssrc_shim(this: &RtcrtpContributingSourceStats, val: u32); + #[wasm_bindgen(method, setter = "inboundRtpStreamId")] + fn inbound_rtp_stream_id_shim(this: &RtcrtpContributingSourceStats, val: &str); } impl RtcrtpContributingSourceStats { #[doc = "Construct a new `RtcrtpContributingSourceStats`."] @@ -24,30 +35,14 @@ impl RtcrtpContributingSourceStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,47 +50,21 @@ impl RtcrtpContributingSourceStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpContributingSourceStats`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `contributorSsrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub fn contributor_ssrc(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contributorSsrc"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.contributor_ssrc_shim(val); self } #[doc = "Change the `inboundRtpStreamId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub fn inbound_rtp_stream_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inboundRtpStreamId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inbound_rtp_stream_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs index 5d7650e0306..f33e1127499 100644 --- a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs @@ -10,6 +10,41 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub type RtcrtpStreamStats; + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &RtcrtpStreamStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &RtcrtpStreamStats, val: RtcStatsType); + #[wasm_bindgen(method, setter = "bitrateMean")] + fn bitrate_mean_shim(this: &RtcrtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bitrateStdDev")] + fn bitrate_std_dev_shim(this: &RtcrtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "codecId")] + fn codec_id_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "firCount")] + fn fir_count_shim(this: &RtcrtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "framerateMean")] + fn framerate_mean_shim(this: &RtcrtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "framerateStdDev")] + fn framerate_std_dev_shim(this: &RtcrtpStreamStats, val: f64); + #[wasm_bindgen(method, setter = "isRemote")] + fn is_remote_shim(this: &RtcrtpStreamStats, val: bool); + #[wasm_bindgen(method, setter = "mediaTrackId")] + fn media_track_id_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "mediaType")] + fn media_type_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "nackCount")] + fn nack_count_shim(this: &RtcrtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "pliCount")] + fn pli_count_shim(this: &RtcrtpStreamStats, val: u32); + #[wasm_bindgen(method, setter = "remoteId")] + fn remote_id_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "ssrc")] + fn ssrc_shim(this: &RtcrtpStreamStats, val: &str); + #[wasm_bindgen(method, setter = "transportId")] + fn transport_id_shim(this: &RtcrtpStreamStats, val: &str); } impl RtcrtpStreamStats { #[doc = "Construct a new `RtcrtpStreamStats`."] @@ -24,30 +59,14 @@ impl RtcrtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[doc = "Change the `timestamp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(feature = "RtcStatsType")] @@ -55,247 +74,105 @@ impl RtcrtpStreamStats { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpStreamStats`*"] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `bitrateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_mean_shim(val); self } #[doc = "Change the `bitrateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_std_dev_shim(val); self } #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn codec_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codecId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_id_shim(val); self } #[doc = "Change the `firCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn fir_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("firCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fir_count_shim(val); self } #[doc = "Change the `framerateMean` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateMean"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_mean_shim(val); self } #[doc = "Change the `framerateStdDev` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerateStdDev"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_std_dev_shim(val); self } #[doc = "Change the `isRemote` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn is_remote(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("isRemote"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.is_remote_shim(val); self } #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaTrackId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_track_id_shim(val); self } #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn media_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("mediaType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.media_type_shim(val); self } #[doc = "Change the `nackCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn nack_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("nackCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.nack_count_shim(val); self } #[doc = "Change the `pliCount` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn pli_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pliCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pli_count_shim(val); self } #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn remote_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_id_shim(val); self } #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn ssrc(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ssrc"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ssrc_shim(val); self } #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub fn transport_id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transportId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transport_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs index 46530763c59..9502619bfac 100644 --- a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SaveFilePickerOptions; + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + fn exclude_accept_all_option_shim(this: &SaveFilePickerOptions, val: bool); + #[wasm_bindgen(method, setter = "id")] + fn id_shim(this: &SaveFilePickerOptions, val: &str); + #[wasm_bindgen(method, setter = "startIn")] + fn start_in_shim(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "types")] + fn types_shim(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "suggestedName")] + fn suggested_name_shim(this: &SaveFilePickerOptions, val: Option<&str>); } #[cfg(web_sys_unstable_apis)] impl SaveFilePickerOptions { @@ -36,17 +46,7 @@ impl SaveFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("excludeAcceptAllOption"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.exclude_accept_all_option_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +57,7 @@ impl SaveFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn id(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +68,7 @@ impl SaveFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("startIn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_in_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,13 +79,7 @@ impl SaveFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("types"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.types_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -112,17 +90,7 @@ impl SaveFilePickerOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn suggested_name(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("suggestedName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.suggested_name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs index d1e8818cb04..a913bd85edc 100644 --- a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs +++ b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SchedulerPostTaskOptions; + #[wasm_bindgen(method, setter = "delay")] + fn delay_shim(this: &SchedulerPostTaskOptions, val: f64); + #[cfg(feature = "TaskPriority")] + #[wasm_bindgen(method, setter = "priority")] + fn priority_shim(this: &SchedulerPostTaskOptions, val: TaskPriority); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &SchedulerPostTaskOptions, val: &AbortSignal); } #[cfg(web_sys_unstable_apis)] impl SchedulerPostTaskOptions { @@ -36,13 +44,7 @@ impl SchedulerPostTaskOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn delay(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("delay"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delay_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +56,7 @@ impl SchedulerPostTaskOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn priority(&mut self, val: TaskPriority) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("priority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.priority_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -76,14 +68,7 @@ impl SchedulerPostTaskOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs b/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs index c5a65fa67c6..b412d88ad14 100644 --- a/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`*"] pub type ScrollIntoViewOptions; + #[cfg(feature = "ScrollBehavior")] + #[wasm_bindgen(method, setter = "behavior")] + fn behavior_shim(this: &ScrollIntoViewOptions, val: ScrollBehavior); + #[cfg(feature = "ScrollLogicalPosition")] + #[wasm_bindgen(method, setter = "block")] + fn block_shim(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); + #[cfg(feature = "ScrollLogicalPosition")] + #[wasm_bindgen(method, setter = "inline")] + fn inline_shim(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); } impl ScrollIntoViewOptions { #[doc = "Construct a new `ScrollIntoViewOptions`."] @@ -25,17 +34,7 @@ impl ScrollIntoViewOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollIntoViewOptions`*"] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("behavior"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.behavior_shim(val); self } #[cfg(feature = "ScrollLogicalPosition")] @@ -43,13 +42,7 @@ impl ScrollIntoViewOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] pub fn block(&mut self, val: ScrollLogicalPosition) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("block"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.block_shim(val); self } #[cfg(feature = "ScrollLogicalPosition")] @@ -57,14 +50,7 @@ impl ScrollIntoViewOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] pub fn inline(&mut self, val: ScrollLogicalPosition) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("inline"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inline_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollOptions.rs b/crates/web-sys/src/features/gen_ScrollOptions.rs index 3f7a7443164..2357199aa50 100644 --- a/crates/web-sys/src/features/gen_ScrollOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollOptions`*"] pub type ScrollOptions; + #[cfg(feature = "ScrollBehavior")] + #[wasm_bindgen(method, setter = "behavior")] + fn behavior_shim(this: &ScrollOptions, val: ScrollBehavior); } impl ScrollOptions { #[doc = "Construct a new `ScrollOptions`."] @@ -25,17 +28,7 @@ impl ScrollOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollOptions`*"] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("behavior"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.behavior_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollToOptions.rs b/crates/web-sys/src/features/gen_ScrollToOptions.rs index b42cac636e0..d529c5913a8 100644 --- a/crates/web-sys/src/features/gen_ScrollToOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollToOptions.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] pub type ScrollToOptions; + #[cfg(feature = "ScrollBehavior")] + #[wasm_bindgen(method, setter = "behavior")] + fn behavior_shim(this: &ScrollToOptions, val: ScrollBehavior); + #[wasm_bindgen(method, setter = "left")] + fn left_shim(this: &ScrollToOptions, val: f64); + #[wasm_bindgen(method, setter = "top")] + fn top_shim(this: &ScrollToOptions, val: f64); } impl ScrollToOptions { #[doc = "Construct a new `ScrollToOptions`."] @@ -25,43 +32,21 @@ impl ScrollToOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("behavior"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.behavior_shim(val); self } #[doc = "Change the `left` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] pub fn left(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("left"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.left_shim(val); self } #[doc = "Change the `top` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] pub fn top(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("top"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.top_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs b/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs index 26b1f09c22e..79eb87f27ec 100644 --- a/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] pub type ScrollViewChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ScrollViewChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ScrollViewChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ScrollViewChangeEventInit, val: bool); + #[cfg(feature = "ScrollState")] + #[wasm_bindgen(method, setter = "state")] + fn state_shim(this: &ScrollViewChangeEventInit, val: ScrollState); } impl ScrollViewChangeEventInit { #[doc = "Construct a new `ScrollViewChangeEventInit`."] @@ -24,51 +33,21 @@ impl ScrollViewChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "ScrollState")] @@ -76,13 +55,7 @@ impl ScrollViewChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollState`, `ScrollViewChangeEventInit`*"] pub fn state(&mut self, val: ScrollState) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("state"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.state_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs index a51d4da0d5c..2f86bc879fb 100644 --- a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs +++ b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs @@ -10,6 +10,40 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub type SecurityPolicyViolationEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SecurityPolicyViolationEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SecurityPolicyViolationEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SecurityPolicyViolationEventInit, val: bool); + #[wasm_bindgen(method, setter = "blockedURI")] + fn blocked_uri_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "columnNumber")] + fn column_number_shim(this: &SecurityPolicyViolationEventInit, val: i32); + #[cfg(feature = "SecurityPolicyViolationEventDisposition")] + #[wasm_bindgen(method, setter = "disposition")] + fn disposition_shim( + this: &SecurityPolicyViolationEventInit, + val: SecurityPolicyViolationEventDisposition, + ); + #[wasm_bindgen(method, setter = "documentURI")] + fn document_uri_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "effectiveDirective")] + fn effective_directive_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "lineNumber")] + fn line_number_shim(this: &SecurityPolicyViolationEventInit, val: i32); + #[wasm_bindgen(method, setter = "originalPolicy")] + fn original_policy_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "referrer")] + fn referrer_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "sample")] + fn sample_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "sourceFile")] + fn source_file_shim(this: &SecurityPolicyViolationEventInit, val: &str); + #[wasm_bindgen(method, setter = "statusCode")] + fn status_code_shim(this: &SecurityPolicyViolationEventInit, val: u16); + #[wasm_bindgen(method, setter = "violatedDirective")] + fn violated_directive_shim(this: &SecurityPolicyViolationEventInit, val: &str); } impl SecurityPolicyViolationEventInit { #[doc = "Construct a new `SecurityPolicyViolationEventInit`."] @@ -24,85 +58,35 @@ impl SecurityPolicyViolationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `blockedURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn blocked_uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("blockedURI"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.blocked_uri_shim(val); self } #[doc = "Change the `columnNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn column_number(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("columnNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.column_number_shim(val); self } #[cfg(feature = "SecurityPolicyViolationEventDisposition")] @@ -110,167 +94,70 @@ impl SecurityPolicyViolationEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventDisposition`, `SecurityPolicyViolationEventInit`*"] pub fn disposition(&mut self, val: SecurityPolicyViolationEventDisposition) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("disposition"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.disposition_shim(val); self } #[doc = "Change the `documentURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn document_uri(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("documentURI"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.document_uri_shim(val); self } #[doc = "Change the `effectiveDirective` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn effective_directive(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("effectiveDirective"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.effective_directive_shim(val); self } #[doc = "Change the `lineNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn line_number(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lineNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.line_number_shim(val); self } #[doc = "Change the `originalPolicy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn original_policy(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("originalPolicy"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.original_policy_shim(val); self } #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn referrer(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("referrer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.referrer_shim(val); self } #[doc = "Change the `sample` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn sample(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sample"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sample_shim(val); self } #[doc = "Change the `sourceFile` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn source_file(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sourceFile"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_file_shim(val); self } #[doc = "Change the `statusCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn status_code(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("statusCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_code_shim(val); self } #[doc = "Change the `violatedDirective` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub fn violated_directive(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("violatedDirective"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.violated_directive_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialInputSignals.rs b/crates/web-sys/src/features/gen_SerialInputSignals.rs index dce79b531ef..bac6b8f7679 100644 --- a/crates/web-sys/src/features/gen_SerialInputSignals.rs +++ b/crates/web-sys/src/features/gen_SerialInputSignals.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialInputSignals; + #[wasm_bindgen(method, setter = "clearToSend")] + fn clear_to_send_shim(this: &SerialInputSignals, val: bool); + #[wasm_bindgen(method, setter = "dataCarrierDetect")] + fn data_carrier_detect_shim(this: &SerialInputSignals, val: bool); + #[wasm_bindgen(method, setter = "dataSetReady")] + fn data_set_ready_shim(this: &SerialInputSignals, val: bool); + #[wasm_bindgen(method, setter = "ringIndicator")] + fn ring_indicator_shim(this: &SerialInputSignals, val: bool); } #[cfg(web_sys_unstable_apis)] impl SerialInputSignals { @@ -45,17 +53,7 @@ impl SerialInputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn clear_to_send(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clearToSend"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clear_to_send_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -66,17 +64,7 @@ impl SerialInputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data_carrier_detect(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataCarrierDetect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_carrier_detect_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -87,17 +75,7 @@ impl SerialInputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data_set_ready(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataSetReady"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_set_ready_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -108,17 +86,7 @@ impl SerialInputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ring_indicator(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ringIndicator"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ring_indicator_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialOptions.rs b/crates/web-sys/src/features/gen_SerialOptions.rs index 4f9f2b8e7d9..02b78361511 100644 --- a/crates/web-sys/src/features/gen_SerialOptions.rs +++ b/crates/web-sys/src/features/gen_SerialOptions.rs @@ -14,6 +14,20 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialOptions; + #[wasm_bindgen(method, setter = "baudRate")] + fn baud_rate_shim(this: &SerialOptions, val: u32); + #[wasm_bindgen(method, setter = "bufferSize")] + fn buffer_size_shim(this: &SerialOptions, val: u32); + #[wasm_bindgen(method, setter = "dataBits")] + fn data_bits_shim(this: &SerialOptions, val: u8); + #[cfg(feature = "FlowControlType")] + #[wasm_bindgen(method, setter = "flowControl")] + fn flow_control_shim(this: &SerialOptions, val: FlowControlType); + #[cfg(feature = "ParityType")] + #[wasm_bindgen(method, setter = "parity")] + fn parity_shim(this: &SerialOptions, val: ParityType); + #[wasm_bindgen(method, setter = "stopBits")] + fn stop_bits_shim(this: &SerialOptions, val: u8); } #[cfg(web_sys_unstable_apis)] impl SerialOptions { @@ -37,17 +51,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn baud_rate(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("baudRate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.baud_rate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +62,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn buffer_size(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bufferSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buffer_size_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +73,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data_bits(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataBits"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_bits_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -101,17 +85,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn flow_control(&mut self, val: FlowControlType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("flowControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flow_control_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -123,14 +97,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn parity(&mut self, val: ParityType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("parity"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.parity_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +108,7 @@ impl SerialOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stop_bits(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stopBits"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stop_bits_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialOutputSignals.rs b/crates/web-sys/src/features/gen_SerialOutputSignals.rs index 367e446ddaa..73b3fb9764a 100644 --- a/crates/web-sys/src/features/gen_SerialOutputSignals.rs +++ b/crates/web-sys/src/features/gen_SerialOutputSignals.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialOutputSignals; + #[wasm_bindgen(method, setter = "break")] + fn break__shim(this: &SerialOutputSignals, val: bool); + #[wasm_bindgen(method, setter = "dataTerminalReady")] + fn data_terminal_ready_shim(this: &SerialOutputSignals, val: bool); + #[wasm_bindgen(method, setter = "requestToSend")] + fn request_to_send_shim(this: &SerialOutputSignals, val: bool); } #[cfg(web_sys_unstable_apis)] impl SerialOutputSignals { @@ -36,13 +42,7 @@ impl SerialOutputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn break_(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("break"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.break__shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,17 +53,7 @@ impl SerialOutputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn data_terminal_ready(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("dataTerminalReady"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_terminal_ready_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +64,7 @@ impl SerialOutputSignals { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn request_to_send(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requestToSend"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.request_to_send_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortFilter.rs b/crates/web-sys/src/features/gen_SerialPortFilter.rs index c323a35186e..e1f876619bf 100644 --- a/crates/web-sys/src/features/gen_SerialPortFilter.rs +++ b/crates/web-sys/src/features/gen_SerialPortFilter.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortFilter; + #[wasm_bindgen(method, setter = "usbProductId")] + fn usb_product_id_shim(this: &SerialPortFilter, val: u16); + #[wasm_bindgen(method, setter = "usbVendorId")] + fn usb_vendor_id_shim(this: &SerialPortFilter, val: u16); } #[cfg(web_sys_unstable_apis)] impl SerialPortFilter { @@ -36,17 +40,7 @@ impl SerialPortFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usb_product_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbProductId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_product_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +51,7 @@ impl SerialPortFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbVendorId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_vendor_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortInfo.rs b/crates/web-sys/src/features/gen_SerialPortInfo.rs index 0ddd9ac77a6..90953d2923b 100644 --- a/crates/web-sys/src/features/gen_SerialPortInfo.rs +++ b/crates/web-sys/src/features/gen_SerialPortInfo.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortInfo; + #[wasm_bindgen(method, setter = "usbProductId")] + fn usb_product_id_shim(this: &SerialPortInfo, val: u16); + #[wasm_bindgen(method, setter = "usbVendorId")] + fn usb_vendor_id_shim(this: &SerialPortInfo, val: u16); } #[cfg(web_sys_unstable_apis)] impl SerialPortInfo { @@ -36,17 +40,7 @@ impl SerialPortInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usb_product_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbProductId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_product_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +51,7 @@ impl SerialPortInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("usbVendorId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usb_vendor_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs index f87307fa5bf..34238c807e0 100644 --- a/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs +++ b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortRequestOptions; + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &SerialPortRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl SerialPortRequestOptions { @@ -36,17 +38,7 @@ impl SerialPortRequestOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ServerSocketOptions.rs b/crates/web-sys/src/features/gen_ServerSocketOptions.rs index 3db678f2efb..95133d8c0ef 100644 --- a/crates/web-sys/src/features/gen_ServerSocketOptions.rs +++ b/crates/web-sys/src/features/gen_ServerSocketOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`*"] pub type ServerSocketOptions; + #[cfg(feature = "TcpSocketBinaryType")] + #[wasm_bindgen(method, setter = "binaryType")] + fn binary_type_shim(this: &ServerSocketOptions, val: TcpSocketBinaryType); } impl ServerSocketOptions { #[doc = "Construct a new `ServerSocketOptions`."] @@ -25,17 +28,7 @@ impl ServerSocketOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`, `TcpSocketBinaryType`*"] pub fn binary_type(&mut self, val: TcpSocketBinaryType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("binaryType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.binary_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ShadowRootInit.rs b/crates/web-sys/src/features/gen_ShadowRootInit.rs index 50a7111064a..e86cf54eebb 100644 --- a/crates/web-sys/src/features/gen_ShadowRootInit.rs +++ b/crates/web-sys/src/features/gen_ShadowRootInit.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`*"] pub type ShadowRootInit; + #[cfg(feature = "ShadowRootMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &ShadowRootInit, val: ShadowRootMode); } impl ShadowRootInit { #[cfg(feature = "ShadowRootMode")] @@ -27,13 +30,7 @@ impl ShadowRootInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"] pub fn mode(&mut self, val: ShadowRootMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ShareData.rs b/crates/web-sys/src/features/gen_ShareData.rs index 04cb1e6ce4e..5a8110527a4 100644 --- a/crates/web-sys/src/features/gen_ShareData.rs +++ b/crates/web-sys/src/features/gen_ShareData.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub type ShareData; + #[wasm_bindgen(method, setter = "files")] + fn files_shim(this: &ShareData, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "text")] + fn text_shim(this: &ShareData, val: &str); + #[wasm_bindgen(method, setter = "title")] + fn title_shim(this: &ShareData, val: &str); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &ShareData, val: &str); } impl ShareData { #[doc = "Construct a new `ShareData`."] @@ -24,52 +32,28 @@ impl ShareData { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub fn files(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("files"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.files_shim(val); self } #[doc = "Change the `text` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub fn text(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("text"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.text_shim(val); self } #[doc = "Change the `title` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub fn title(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("title"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.title_shim(val); self } #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub fn url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SignResponse.rs b/crates/web-sys/src/features/gen_SignResponse.rs index 9d066b7423b..22a21bb2d05 100644 --- a/crates/web-sys/src/features/gen_SignResponse.rs +++ b/crates/web-sys/src/features/gen_SignResponse.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub type SignResponse; + #[wasm_bindgen(method, setter = "clientData")] + fn client_data_shim(this: &SignResponse, val: &str); + #[wasm_bindgen(method, setter = "errorCode")] + fn error_code_shim(this: &SignResponse, val: Option); + #[wasm_bindgen(method, setter = "errorMessage")] + fn error_message_shim(this: &SignResponse, val: Option<&str>); + #[wasm_bindgen(method, setter = "keyHandle")] + fn key_handle_shim(this: &SignResponse, val: &str); + #[wasm_bindgen(method, setter = "signatureData")] + fn signature_data_shim(this: &SignResponse, val: &str); } impl SignResponse { #[doc = "Construct a new `SignResponse`."] @@ -24,85 +34,35 @@ impl SignResponse { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub fn client_data(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_data_shim(val); self } #[doc = "Change the `errorCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub fn error_code(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("errorCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_code_shim(val); self } #[doc = "Change the `errorMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub fn error_message(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("errorMessage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_message_shim(val); self } #[doc = "Change the `keyHandle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub fn key_handle(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keyHandle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_handle_shim(val); self } #[doc = "Change the `signatureData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub fn signature_data(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("signatureData"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signature_data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketElement.rs b/crates/web-sys/src/features/gen_SocketElement.rs index 56269e3e4ab..cb535c7c6d2 100644 --- a/crates/web-sys/src/features/gen_SocketElement.rs +++ b/crates/web-sys/src/features/gen_SocketElement.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub type SocketElement; + #[wasm_bindgen(method, setter = "active")] + fn active_shim(this: &SocketElement, val: bool); + #[wasm_bindgen(method, setter = "host")] + fn host_shim(this: &SocketElement, val: &str); + #[wasm_bindgen(method, setter = "port")] + fn port_shim(this: &SocketElement, val: u32); + #[wasm_bindgen(method, setter = "received")] + fn received_shim(this: &SocketElement, val: f64); + #[wasm_bindgen(method, setter = "sent")] + fn sent_shim(this: &SocketElement, val: f64); + #[wasm_bindgen(method, setter = "tcp")] + fn tcp_shim(this: &SocketElement, val: bool); } impl SocketElement { #[doc = "Construct a new `SocketElement`."] @@ -24,83 +36,42 @@ impl SocketElement { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn active(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("active"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.active_shim(val); self } #[doc = "Change the `host` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn host(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("host"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.host_shim(val); self } #[doc = "Change the `port` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn port(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("port"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.port_shim(val); self } #[doc = "Change the `received` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("received"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.received_shim(val); self } #[doc = "Change the `sent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sent"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sent_shim(val); self } #[doc = "Change the `tcp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub fn tcp(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("tcp"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.tcp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketOptions.rs b/crates/web-sys/src/features/gen_SocketOptions.rs index 6754c536101..18c27e4f0d5 100644 --- a/crates/web-sys/src/features/gen_SocketOptions.rs +++ b/crates/web-sys/src/features/gen_SocketOptions.rs @@ -10,6 +10,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] pub type SocketOptions; + #[cfg(feature = "TcpSocketBinaryType")] + #[wasm_bindgen(method, setter = "binaryType")] + fn binary_type_shim(this: &SocketOptions, val: TcpSocketBinaryType); + #[wasm_bindgen(method, setter = "useSecureTransport")] + fn use_secure_transport_shim(this: &SocketOptions, val: bool); } impl SocketOptions { #[doc = "Construct a new `SocketOptions`."] @@ -25,34 +30,14 @@ impl SocketOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"] pub fn binary_type(&mut self, val: TcpSocketBinaryType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("binaryType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.binary_type_shim(val); self } #[doc = "Change the `useSecureTransport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] pub fn use_secure_transport(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("useSecureTransport"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.use_secure_transport_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketsDict.rs b/crates/web-sys/src/features/gen_SocketsDict.rs index f760fdf071e..8623ebb50a4 100644 --- a/crates/web-sys/src/features/gen_SocketsDict.rs +++ b/crates/web-sys/src/features/gen_SocketsDict.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] pub type SocketsDict; + #[wasm_bindgen(method, setter = "received")] + fn received_shim(this: &SocketsDict, val: f64); + #[wasm_bindgen(method, setter = "sent")] + fn sent_shim(this: &SocketsDict, val: f64); + #[wasm_bindgen(method, setter = "sockets")] + fn sockets_shim(this: &SocketsDict, val: &::wasm_bindgen::JsValue); } impl SocketsDict { #[doc = "Construct a new `SocketsDict`."] @@ -24,47 +30,21 @@ impl SocketsDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] pub fn received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("received"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.received_shim(val); self } #[doc = "Change the `sent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] pub fn sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sent"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sent_shim(val); self } #[doc = "Change the `sockets` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] pub fn sockets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sockets"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sockets_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs index 96677fa0d02..6781c3939d3 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub type SpeechRecognitionErrorInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SpeechRecognitionErrorInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SpeechRecognitionErrorInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SpeechRecognitionErrorInit, val: bool); + #[cfg(feature = "SpeechRecognitionErrorCode")] + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &SpeechRecognitionErrorInit, val: SpeechRecognitionErrorCode); + #[wasm_bindgen(method, setter = "message")] + fn message_shim(this: &SpeechRecognitionErrorInit, val: &str); } impl SpeechRecognitionErrorInit { #[doc = "Construct a new `SpeechRecognitionErrorInit`."] @@ -24,51 +35,21 @@ impl SpeechRecognitionErrorInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "SpeechRecognitionErrorCode")] @@ -76,30 +57,14 @@ impl SpeechRecognitionErrorInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorCode`, `SpeechRecognitionErrorInit`*"] pub fn error(&mut self, val: SpeechRecognitionErrorCode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub fn message(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs b/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs index 75e71fd7bc6..8db88b7b80f 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs @@ -10,6 +10,22 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub type SpeechRecognitionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SpeechRecognitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SpeechRecognitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SpeechRecognitionEventInit, val: bool); + #[cfg(feature = "Document")] + #[wasm_bindgen(method, setter = "emma")] + fn emma_shim(this: &SpeechRecognitionEventInit, val: Option<&Document>); + #[wasm_bindgen(method, setter = "interpretation")] + fn interpretation_shim(this: &SpeechRecognitionEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "resultIndex")] + fn result_index_shim(this: &SpeechRecognitionEventInit, val: u32); + #[cfg(feature = "SpeechRecognitionResultList")] + #[wasm_bindgen(method, setter = "results")] + fn results_shim(this: &SpeechRecognitionEventInit, val: Option<&SpeechRecognitionResultList>); } impl SpeechRecognitionEventInit { #[doc = "Construct a new `SpeechRecognitionEventInit`."] @@ -24,51 +40,21 @@ impl SpeechRecognitionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "Document")] @@ -76,47 +62,21 @@ impl SpeechRecognitionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`, `SpeechRecognitionEventInit`*"] pub fn emma(&mut self, val: Option<&Document>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("emma"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.emma_shim(val); self } #[doc = "Change the `interpretation` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub fn interpretation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("interpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.interpretation_shim(val); self } #[doc = "Change the `resultIndex` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub fn result_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("resultIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.result_index_shim(val); self } #[cfg(feature = "SpeechRecognitionResultList")] @@ -124,17 +84,7 @@ impl SpeechRecognitionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`, `SpeechRecognitionResultList`*"] pub fn results(&mut self, val: Option<&SpeechRecognitionResultList>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("results"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.results_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs index e53c1f0871a..54fe4337561 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs @@ -10,6 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub type SpeechSynthesisErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "charIndex")] + fn char_index_shim(this: &SpeechSynthesisErrorEventInit, val: u32); + #[wasm_bindgen(method, setter = "charLength")] + fn char_length_shim(this: &SpeechSynthesisErrorEventInit, val: Option); + #[wasm_bindgen(method, setter = "elapsedTime")] + fn elapsed_time_shim(this: &SpeechSynthesisErrorEventInit, val: f32); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &SpeechSynthesisErrorEventInit, val: &str); + #[cfg(feature = "SpeechSynthesisUtterance")] + #[wasm_bindgen(method, setter = "utterance")] + fn utterance_shim(this: &SpeechSynthesisErrorEventInit, val: &SpeechSynthesisUtterance); + #[cfg(feature = "SpeechSynthesisErrorCode")] + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &SpeechSynthesisErrorEventInit, val: SpeechSynthesisErrorCode); } impl SpeechSynthesisErrorEventInit { #[cfg(all( @@ -30,115 +50,49 @@ impl SpeechSynthesisErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `charIndex` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn char_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("charIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.char_index_shim(val); self } #[doc = "Change the `charLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn char_length(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("charLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.char_length_shim(val); self } #[doc = "Change the `elapsedTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("elapsedTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.elapsed_time_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "SpeechSynthesisUtterance")] @@ -146,17 +100,7 @@ impl SpeechSynthesisErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"] pub fn utterance(&mut self, val: &SpeechSynthesisUtterance) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("utterance"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.utterance_shim(val); self } #[cfg(feature = "SpeechSynthesisErrorCode")] @@ -164,13 +108,7 @@ impl SpeechSynthesisErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`*"] pub fn error(&mut self, val: SpeechSynthesisErrorCode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs index be45a338d84..3726366ad20 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs @@ -10,6 +10,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub type SpeechSynthesisEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SpeechSynthesisEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SpeechSynthesisEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SpeechSynthesisEventInit, val: bool); + #[wasm_bindgen(method, setter = "charIndex")] + fn char_index_shim(this: &SpeechSynthesisEventInit, val: u32); + #[wasm_bindgen(method, setter = "charLength")] + fn char_length_shim(this: &SpeechSynthesisEventInit, val: Option); + #[wasm_bindgen(method, setter = "elapsedTime")] + fn elapsed_time_shim(this: &SpeechSynthesisEventInit, val: f32); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &SpeechSynthesisEventInit, val: &str); + #[cfg(feature = "SpeechSynthesisUtterance")] + #[wasm_bindgen(method, setter = "utterance")] + fn utterance_shim(this: &SpeechSynthesisEventInit, val: &SpeechSynthesisUtterance); } impl SpeechSynthesisEventInit { #[cfg(feature = "SpeechSynthesisUtterance")] @@ -26,115 +43,49 @@ impl SpeechSynthesisEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `charIndex` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn char_index(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("charIndex"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.char_index_shim(val); self } #[doc = "Change the `charLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn char_length(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("charLength"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.char_length_shim(val); self } #[doc = "Change the `elapsedTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("elapsedTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.elapsed_time_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "SpeechSynthesisUtterance")] @@ -142,17 +93,7 @@ impl SpeechSynthesisEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`, `SpeechSynthesisUtterance`*"] pub fn utterance(&mut self, val: &SpeechSynthesisUtterance) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("utterance"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.utterance_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StereoPannerOptions.rs b/crates/web-sys/src/features/gen_StereoPannerOptions.rs index 460ac46aa8d..792a024f70c 100644 --- a/crates/web-sys/src/features/gen_StereoPannerOptions.rs +++ b/crates/web-sys/src/features/gen_StereoPannerOptions.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] pub type StereoPannerOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &StereoPannerOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &StereoPannerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &StereoPannerOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "pan")] + fn pan_shim(this: &StereoPannerOptions, val: f32); } impl StereoPannerOptions { #[doc = "Construct a new `StereoPannerOptions`."] @@ -24,17 +34,7 @@ impl StereoPannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +42,7 @@ impl StereoPannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `StereoPannerOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,30 +50,14 @@ impl StereoPannerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `StereoPannerOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `pan` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] pub fn pan(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pan"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pan_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StorageEstimate.rs b/crates/web-sys/src/features/gen_StorageEstimate.rs index e36eae6d6d7..242dc68778c 100644 --- a/crates/web-sys/src/features/gen_StorageEstimate.rs +++ b/crates/web-sys/src/features/gen_StorageEstimate.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] pub type StorageEstimate; + #[wasm_bindgen(method, setter = "quota")] + fn quota_shim(this: &StorageEstimate, val: f64); + #[wasm_bindgen(method, setter = "usage")] + fn usage_shim(this: &StorageEstimate, val: f64); } impl StorageEstimate { #[doc = "Construct a new `StorageEstimate`."] @@ -24,26 +28,14 @@ impl StorageEstimate { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] pub fn quota(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("quota"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.quota_shim(val); self } #[doc = "Change the `usage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] pub fn usage(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.usage_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StorageEventInit.rs b/crates/web-sys/src/features/gen_StorageEventInit.rs index 39544044472..5c42540d6d6 100644 --- a/crates/web-sys/src/features/gen_StorageEventInit.rs +++ b/crates/web-sys/src/features/gen_StorageEventInit.rs @@ -10,6 +10,23 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub type StorageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &StorageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &StorageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &StorageEventInit, val: bool); + #[wasm_bindgen(method, setter = "key")] + fn key_shim(this: &StorageEventInit, val: Option<&str>); + #[wasm_bindgen(method, setter = "newValue")] + fn new_value_shim(this: &StorageEventInit, val: Option<&str>); + #[wasm_bindgen(method, setter = "oldValue")] + fn old_value_shim(this: &StorageEventInit, val: Option<&str>); + #[cfg(feature = "Storage")] + #[wasm_bindgen(method, setter = "storageArea")] + fn storage_area_shim(this: &StorageEventInit, val: Option<&Storage>); + #[wasm_bindgen(method, setter = "url")] + fn url_shim(this: &StorageEventInit, val: &str); } impl StorageEventInit { #[doc = "Construct a new `StorageEventInit`."] @@ -24,98 +41,42 @@ impl StorageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn key(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("key"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_shim(val); self } #[doc = "Change the `newValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn new_value(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("newValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.new_value_shim(val); self } #[doc = "Change the `oldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn old_value(&mut self, val: Option<&str>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("oldValue"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.old_value_shim(val); self } #[cfg(feature = "Storage")] @@ -123,30 +84,14 @@ impl StorageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`, `StorageEventInit`*"] pub fn storage_area(&mut self, val: Option<&Storage>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("storageArea"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.storage_area_shim(val); self } #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub fn url(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("url"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.url_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StreamPipeOptions.rs b/crates/web-sys/src/features/gen_StreamPipeOptions.rs index 924c0366f33..d9c02acc745 100644 --- a/crates/web-sys/src/features/gen_StreamPipeOptions.rs +++ b/crates/web-sys/src/features/gen_StreamPipeOptions.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] pub type StreamPipeOptions; + #[wasm_bindgen(method, setter = "preventAbort")] + fn prevent_abort_shim(this: &StreamPipeOptions, val: bool); + #[wasm_bindgen(method, setter = "preventCancel")] + fn prevent_cancel_shim(this: &StreamPipeOptions, val: bool); + #[wasm_bindgen(method, setter = "preventClose")] + fn prevent_close_shim(this: &StreamPipeOptions, val: bool); + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &StreamPipeOptions, val: &AbortSignal); } impl StreamPipeOptions { #[doc = "Construct a new `StreamPipeOptions`."] @@ -24,51 +33,21 @@ impl StreamPipeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] pub fn prevent_abort(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preventAbort"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prevent_abort_shim(val); self } #[doc = "Change the `preventCancel` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] pub fn prevent_cancel(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preventCancel"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prevent_cancel_shim(val); self } #[doc = "Change the `preventClose` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] pub fn prevent_close(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preventClose"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.prevent_close_shim(val); self } #[cfg(feature = "AbortSignal")] @@ -76,14 +55,7 @@ impl StreamPipeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `StreamPipeOptions`*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs index b2fe9406464..cf84e4807e9 100644 --- a/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] pub type StyleRuleChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &StyleRuleChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &StyleRuleChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &StyleRuleChangeEventInit, val: bool); + #[cfg(feature = "CssRule")] + #[wasm_bindgen(method, setter = "rule")] + fn rule_shim(this: &StyleRuleChangeEventInit, val: Option<&CssRule>); + #[cfg(feature = "CssStyleSheet")] + #[wasm_bindgen(method, setter = "stylesheet")] + fn stylesheet_shim(this: &StyleRuleChangeEventInit, val: Option<&CssStyleSheet>); } impl StyleRuleChangeEventInit { #[doc = "Construct a new `StyleRuleChangeEventInit`."] @@ -24,51 +36,21 @@ impl StyleRuleChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "CssRule")] @@ -76,13 +58,7 @@ impl StyleRuleChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssRule`, `StyleRuleChangeEventInit`*"] pub fn rule(&mut self, val: Option<&CssRule>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rule"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rule_shim(val); self } #[cfg(feature = "CssStyleSheet")] @@ -90,17 +66,7 @@ impl StyleRuleChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleRuleChangeEventInit`*"] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stylesheet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stylesheet_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs index 42a98841ea3..547d1124cb7 100644 --- a/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub type StyleSheetApplicableStateChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "applicable")] + fn applicable_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[cfg(feature = "CssStyleSheet")] + #[wasm_bindgen(method, setter = "stylesheet")] + fn stylesheet_shim( + this: &StyleSheetApplicableStateChangeEventInit, + val: Option<&CssStyleSheet>, + ); } impl StyleSheetApplicableStateChangeEventInit { #[doc = "Construct a new `StyleSheetApplicableStateChangeEventInit`."] @@ -24,68 +38,28 @@ impl StyleSheetApplicableStateChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `applicable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub fn applicable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("applicable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.applicable_shim(val); self } #[cfg(feature = "CssStyleSheet")] @@ -93,17 +67,7 @@ impl StyleSheetApplicableStateChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetApplicableStateChangeEventInit`*"] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stylesheet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stylesheet_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs index 0a38714b51c..4aeb6e4fc4a 100644 --- a/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub type StyleSheetChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &StyleSheetChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &StyleSheetChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &StyleSheetChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "documentSheet")] + fn document_sheet_shim(this: &StyleSheetChangeEventInit, val: bool); + #[cfg(feature = "CssStyleSheet")] + #[wasm_bindgen(method, setter = "stylesheet")] + fn stylesheet_shim(this: &StyleSheetChangeEventInit, val: Option<&CssStyleSheet>); } impl StyleSheetChangeEventInit { #[doc = "Construct a new `StyleSheetChangeEventInit`."] @@ -24,68 +35,28 @@ impl StyleSheetChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `documentSheet` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub fn document_sheet(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("documentSheet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.document_sheet_shim(val); self } #[cfg(feature = "CssStyleSheet")] @@ -93,17 +64,7 @@ impl StyleSheetChangeEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetChangeEventInit`*"] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stylesheet"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stylesheet_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SubmitEventInit.rs b/crates/web-sys/src/features/gen_SubmitEventInit.rs index ede5704d2a9..1fa2555e874 100644 --- a/crates/web-sys/src/features/gen_SubmitEventInit.rs +++ b/crates/web-sys/src/features/gen_SubmitEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] pub type SubmitEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &SubmitEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &SubmitEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &SubmitEventInit, val: bool); + #[cfg(feature = "HtmlElement")] + #[wasm_bindgen(method, setter = "submitter")] + fn submitter_shim(this: &SubmitEventInit, val: Option<&HtmlElement>); } impl SubmitEventInit { #[doc = "Construct a new `SubmitEventInit`."] @@ -24,51 +33,21 @@ impl SubmitEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "HtmlElement")] @@ -76,17 +55,7 @@ impl SubmitEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEventInit`*"] pub fn submitter(&mut self, val: Option<&HtmlElement>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("submitter"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.submitter_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SvcOutputMetadata.rs b/crates/web-sys/src/features/gen_SvcOutputMetadata.rs index 16e9251da19..f48c035565d 100644 --- a/crates/web-sys/src/features/gen_SvcOutputMetadata.rs +++ b/crates/web-sys/src/features/gen_SvcOutputMetadata.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SvcOutputMetadata; + #[wasm_bindgen(method, setter = "temporalLayerId")] + fn temporal_layer_id_shim(this: &SvcOutputMetadata, val: u32); } #[cfg(web_sys_unstable_apis)] impl SvcOutputMetadata { @@ -36,17 +38,7 @@ impl SvcOutputMetadata { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn temporal_layer_id(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("temporalLayerId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.temporal_layer_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs b/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs index c141da7b2cd..4d83aa30982 100644 --- a/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs +++ b/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub type SvgBoundingBoxOptions; + #[wasm_bindgen(method, setter = "clipped")] + fn clipped_shim(this: &SvgBoundingBoxOptions, val: bool); + #[wasm_bindgen(method, setter = "fill")] + fn fill_shim(this: &SvgBoundingBoxOptions, val: bool); + #[wasm_bindgen(method, setter = "markers")] + fn markers_shim(this: &SvgBoundingBoxOptions, val: bool); + #[wasm_bindgen(method, setter = "stroke")] + fn stroke_shim(this: &SvgBoundingBoxOptions, val: bool); } impl SvgBoundingBoxOptions { #[doc = "Construct a new `SvgBoundingBoxOptions`."] @@ -24,61 +32,28 @@ impl SvgBoundingBoxOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub fn clipped(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clipped"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.clipped_shim(val); self } #[doc = "Change the `fill` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub fn fill(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fill"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fill_shim(val); self } #[doc = "Change the `markers` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub fn markers(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("markers"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.markers_shim(val); self } #[doc = "Change the `stroke` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub fn stroke(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stroke"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stroke_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskControllerInit.rs b/crates/web-sys/src/features/gen_TaskControllerInit.rs index e66e8663d71..87fb5cbf035 100644 --- a/crates/web-sys/src/features/gen_TaskControllerInit.rs +++ b/crates/web-sys/src/features/gen_TaskControllerInit.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskControllerInit; + #[cfg(feature = "TaskPriority")] + #[wasm_bindgen(method, setter = "priority")] + fn priority_shim(this: &TaskControllerInit, val: TaskPriority); } #[cfg(web_sys_unstable_apis)] impl TaskControllerInit { @@ -37,17 +40,7 @@ impl TaskControllerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn priority(&mut self, val: TaskPriority) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("priority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.priority_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs index 9992965d1cc..c2fc50429fa 100644 --- a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskPriorityChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TaskPriorityChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TaskPriorityChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TaskPriorityChangeEventInit, val: bool); + #[cfg(feature = "TaskPriority")] + #[wasm_bindgen(method, setter = "previousPriority")] + fn previous_priority_shim(this: &TaskPriorityChangeEventInit, val: TaskPriority); } #[cfg(web_sys_unstable_apis)] impl TaskPriorityChangeEventInit { @@ -38,17 +47,7 @@ impl TaskPriorityChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl TaskPriorityChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +69,7 @@ impl TaskPriorityChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,17 +81,7 @@ impl TaskPriorityChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn previous_priority(&mut self, val: TaskPriority) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("previousPriority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.previous_priority_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs index 3a81c9682d8..99b837c6d73 100644 --- a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs +++ b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskSignalAnyInit; + #[wasm_bindgen(method, setter = "priority")] + fn priority_shim(this: &TaskSignalAnyInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl TaskSignalAnyInit { @@ -36,17 +38,7 @@ impl TaskSignalAnyInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn priority(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("priority"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.priority_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs b/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs index ecea5b069b4..480782339ae 100644 --- a/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] pub type TcpServerSocketEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TcpServerSocketEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TcpServerSocketEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TcpServerSocketEventInit, val: bool); + #[cfg(feature = "TcpSocket")] + #[wasm_bindgen(method, setter = "socket")] + fn socket_shim(this: &TcpServerSocketEventInit, val: Option<&TcpSocket>); } impl TcpServerSocketEventInit { #[doc = "Construct a new `TcpServerSocketEventInit`."] @@ -24,51 +33,21 @@ impl TcpServerSocketEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(feature = "TcpSocket")] @@ -76,14 +55,7 @@ impl TcpServerSocketEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`, `TcpSocket`*"] pub fn socket(&mut self, val: Option<&TcpSocket>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("socket"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.socket_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs index 2da5e7e06a7..8ce673d4787 100644 --- a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub type TcpSocketErrorEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TcpSocketErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TcpSocketErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TcpSocketErrorEventInit, val: bool); + #[wasm_bindgen(method, setter = "message")] + fn message_shim(this: &TcpSocketErrorEventInit, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &TcpSocketErrorEventInit, val: &str); } impl TcpSocketErrorEventInit { #[doc = "Construct a new `TcpSocketErrorEventInit`."] @@ -24,81 +34,35 @@ impl TcpSocketErrorEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub fn message(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("message"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.message_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpSocketEventInit.rs b/crates/web-sys/src/features/gen_TcpSocketEventInit.rs index e98db7882e0..c73323b4dde 100644 --- a/crates/web-sys/src/features/gen_TcpSocketEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpSocketEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub type TcpSocketEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TcpSocketEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TcpSocketEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TcpSocketEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &TcpSocketEventInit, val: &::wasm_bindgen::JsValue); } impl TcpSocketEventInit { #[doc = "Construct a new `TcpSocketEventInit`."] @@ -24,64 +32,28 @@ impl TcpSocketEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TextDecodeOptions.rs b/crates/web-sys/src/features/gen_TextDecodeOptions.rs index 47a0df21387..ad37701b64f 100644 --- a/crates/web-sys/src/features/gen_TextDecodeOptions.rs +++ b/crates/web-sys/src/features/gen_TextDecodeOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] pub type TextDecodeOptions; + #[wasm_bindgen(method, setter = "stream")] + fn stream_shim(this: &TextDecodeOptions, val: bool); } impl TextDecodeOptions { #[doc = "Construct a new `TextDecodeOptions`."] @@ -24,14 +26,7 @@ impl TextDecodeOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] pub fn stream(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stream"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stream_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TextDecoderOptions.rs b/crates/web-sys/src/features/gen_TextDecoderOptions.rs index 1ec3b8f9478..ece2e78e5df 100644 --- a/crates/web-sys/src/features/gen_TextDecoderOptions.rs +++ b/crates/web-sys/src/features/gen_TextDecoderOptions.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] pub type TextDecoderOptions; + #[wasm_bindgen(method, setter = "fatal")] + fn fatal_shim(this: &TextDecoderOptions, val: bool); } impl TextDecoderOptions { #[doc = "Construct a new `TextDecoderOptions`."] @@ -24,13 +26,7 @@ impl TextDecoderOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] pub fn fatal(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("fatal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fatal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TouchEventInit.rs b/crates/web-sys/src/features/gen_TouchEventInit.rs index 41523570b79..4cec29ce0b4 100644 --- a/crates/web-sys/src/features/gen_TouchEventInit.rs +++ b/crates/web-sys/src/features/gen_TouchEventInit.rs @@ -10,6 +10,49 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub type TouchEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &TouchEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &TouchEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &TouchEventInit, val: bool); + #[wasm_bindgen(method, setter = "changedTouches")] + fn changed_touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "targetTouches")] + fn target_touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "touches")] + fn touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); } impl TouchEventInit { #[doc = "Construct a new `TouchEventInit`."] @@ -24,65 +67,28 @@ impl TouchEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,282 +96,119 @@ impl TouchEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `changedTouches` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn changed_touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("changedTouches"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.changed_touches_shim(val); self } #[doc = "Change the `targetTouches` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn target_touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("targetTouches"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.target_touches_shim(val); self } #[doc = "Change the `touches` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub fn touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("touches"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.touches_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TouchInit.rs b/crates/web-sys/src/features/gen_TouchInit.rs index 1defc3fdda7..a9c5cc1745a 100644 --- a/crates/web-sys/src/features/gen_TouchInit.rs +++ b/crates/web-sys/src/features/gen_TouchInit.rs @@ -10,6 +10,31 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub type TouchInit; + #[wasm_bindgen(method, setter = "clientX")] + fn client_x_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "clientY")] + fn client_y_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "force")] + fn force_shim(this: &TouchInit, val: f32); + #[wasm_bindgen(method, setter = "identifier")] + fn identifier_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "pageX")] + fn page_x_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "pageY")] + fn page_y_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "radiusX")] + fn radius_x_shim(this: &TouchInit, val: f32); + #[wasm_bindgen(method, setter = "radiusY")] + fn radius_y_shim(this: &TouchInit, val: f32); + #[wasm_bindgen(method, setter = "rotationAngle")] + fn rotation_angle_shim(this: &TouchInit, val: f32); + #[wasm_bindgen(method, setter = "screenX")] + fn screen_x_shim(this: &TouchInit, val: i32); + #[wasm_bindgen(method, setter = "screenY")] + fn screen_y_shim(this: &TouchInit, val: i32); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "target")] + fn target_shim(this: &TouchInit, val: &EventTarget); } impl TouchInit { #[cfg(feature = "EventTarget")] @@ -27,175 +52,77 @@ impl TouchInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn client_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_x_shim(val); self } #[doc = "Change the `clientY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn client_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_y_shim(val); self } #[doc = "Change the `force` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn force(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("force"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.force_shim(val); self } #[doc = "Change the `identifier` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn identifier(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("identifier"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.identifier_shim(val); self } #[doc = "Change the `pageX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn page_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pageX"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.page_x_shim(val); self } #[doc = "Change the `pageY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn page_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pageY"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.page_y_shim(val); self } #[doc = "Change the `radiusX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn radius_x(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("radiusX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.radius_x_shim(val); self } #[doc = "Change the `radiusY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn radius_y(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("radiusY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.radius_y_shim(val); self } #[doc = "Change the `rotationAngle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn rotation_angle(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rotationAngle"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rotation_angle_shim(val); self } #[doc = "Change the `screenX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn screen_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_x_shim(val); self } #[doc = "Change the `screenY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub fn screen_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_y_shim(val); self } #[cfg(feature = "EventTarget")] @@ -203,14 +130,7 @@ impl TouchInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"] pub fn target(&mut self, val: &EventTarget) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("target"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.target_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TrackEventInit.rs b/crates/web-sys/src/features/gen_TrackEventInit.rs index 23ea70c99b9..18ede672b91 100644 --- a/crates/web-sys/src/features/gen_TrackEventInit.rs +++ b/crates/web-sys/src/features/gen_TrackEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub type TrackEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TrackEventInit, val: bool); + #[wasm_bindgen(method, setter = "track")] + fn track_shim(this: &TrackEventInit, val: Option<&::js_sys::Object>); } impl TrackEventInit { #[doc = "Construct a new `TrackEventInit`."] @@ -24,64 +32,28 @@ impl TrackEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `track` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub fn track(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("track"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.track_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_Transformer.rs b/crates/web-sys/src/features/gen_Transformer.rs index c53825cd3b4..02cb29200b1 100644 --- a/crates/web-sys/src/features/gen_Transformer.rs +++ b/crates/web-sys/src/features/gen_Transformer.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub type Transformer; + #[wasm_bindgen(method, setter = "flush")] + fn flush_shim(this: &Transformer, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "readableType")] + fn readable_type_shim(this: &Transformer, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "start")] + fn start_shim(this: &Transformer, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "transform")] + fn transform_shim(this: &Transformer, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "writableType")] + fn writable_type_shim(this: &Transformer, val: &::wasm_bindgen::JsValue); } impl Transformer { #[doc = "Construct a new `Transformer`."] @@ -24,77 +34,35 @@ impl Transformer { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub fn flush(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("flush"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.flush_shim(val); self } #[doc = "Change the `readableType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub fn readable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("readableType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.readable_type_shim(val); self } #[doc = "Change the `start` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_shim(val); self } #[doc = "Change the `transform` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub fn transform(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transform"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transform_shim(val); self } #[doc = "Change the `writableType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub fn writable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("writableType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.writable_type_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TransitionEventInit.rs b/crates/web-sys/src/features/gen_TransitionEventInit.rs index fb65a019b1a..a6d000fd7b6 100644 --- a/crates/web-sys/src/features/gen_TransitionEventInit.rs +++ b/crates/web-sys/src/features/gen_TransitionEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub type TransitionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &TransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &TransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &TransitionEventInit, val: bool); + #[wasm_bindgen(method, setter = "elapsedTime")] + fn elapsed_time_shim(this: &TransitionEventInit, val: f32); + #[wasm_bindgen(method, setter = "propertyName")] + fn property_name_shim(this: &TransitionEventInit, val: &str); + #[wasm_bindgen(method, setter = "pseudoElement")] + fn pseudo_element_shim(this: &TransitionEventInit, val: &str); } impl TransitionEventInit { #[doc = "Construct a new `TransitionEventInit`."] @@ -24,102 +36,42 @@ impl TransitionEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `elapsedTime` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("elapsedTime"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.elapsed_time_shim(val); self } #[doc = "Change the `propertyName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn property_name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("propertyName"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.property_name_shim(val); self } #[doc = "Change the `pseudoElement` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub fn pseudo_element(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("pseudoElement"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pseudo_element_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_TreeCellInfo.rs b/crates/web-sys/src/features/gen_TreeCellInfo.rs index a38c1d7f33a..6d46b866721 100644 --- a/crates/web-sys/src/features/gen_TreeCellInfo.rs +++ b/crates/web-sys/src/features/gen_TreeCellInfo.rs @@ -10,6 +10,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] pub type TreeCellInfo; + #[wasm_bindgen(method, setter = "childElt")] + fn child_elt_shim(this: &TreeCellInfo, val: &str); + #[wasm_bindgen(method, setter = "row")] + fn row_shim(this: &TreeCellInfo, val: i32); } impl TreeCellInfo { #[doc = "Construct a new `TreeCellInfo`."] @@ -24,30 +28,14 @@ impl TreeCellInfo { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] pub fn child_elt(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("childElt"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.child_elt_shim(val); self } #[doc = "Change the `row` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] pub fn row(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("row"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.row_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_U2fClientData.rs b/crates/web-sys/src/features/gen_U2fClientData.rs index f20f2f79b34..e633e97f4d6 100644 --- a/crates/web-sys/src/features/gen_U2fClientData.rs +++ b/crates/web-sys/src/features/gen_U2fClientData.rs @@ -10,6 +10,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] pub type U2fClientData; + #[wasm_bindgen(method, setter = "challenge")] + fn challenge_shim(this: &U2fClientData, val: &str); + #[wasm_bindgen(method, setter = "origin")] + fn origin_shim(this: &U2fClientData, val: &str); + #[wasm_bindgen(method, setter = "typ")] + fn typ_shim(this: &U2fClientData, val: &str); } impl U2fClientData { #[doc = "Construct a new `U2fClientData`."] @@ -24,44 +30,21 @@ impl U2fClientData { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] pub fn challenge(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("challenge"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.challenge_shim(val); self } #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] pub fn origin(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("origin"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.origin_shim(val); self } #[doc = "Change the `typ` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] pub fn typ(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("typ"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.typ_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs index dcbe8702083..201113bd26f 100644 --- a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub type UdpMessageEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &UdpMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &UdpMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &UdpMessageEventInit, val: bool); + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &UdpMessageEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "remoteAddress")] + fn remote_address_shim(this: &UdpMessageEventInit, val: &str); + #[wasm_bindgen(method, setter = "remotePort")] + fn remote_port_shim(this: &UdpMessageEventInit, val: u16); } impl UdpMessageEventInit { #[doc = "Construct a new `UdpMessageEventInit`."] @@ -24,98 +36,42 @@ impl UdpMessageEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val); self } #[doc = "Change the `remoteAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn remote_address(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteAddress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_address_shim(val); self } #[doc = "Change the `remotePort` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub fn remote_port(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remotePort"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_port_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UdpOptions.rs b/crates/web-sys/src/features/gen_UdpOptions.rs index 74f4904f810..f890c614629 100644 --- a/crates/web-sys/src/features/gen_UdpOptions.rs +++ b/crates/web-sys/src/features/gen_UdpOptions.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub type UdpOptions; + #[wasm_bindgen(method, setter = "addressReuse")] + fn address_reuse_shim(this: &UdpOptions, val: bool); + #[wasm_bindgen(method, setter = "localAddress")] + fn local_address_shim(this: &UdpOptions, val: &str); + #[wasm_bindgen(method, setter = "localPort")] + fn local_port_shim(this: &UdpOptions, val: u16); + #[wasm_bindgen(method, setter = "loopback")] + fn loopback_shim(this: &UdpOptions, val: bool); + #[wasm_bindgen(method, setter = "remoteAddress")] + fn remote_address_shim(this: &UdpOptions, val: &str); + #[wasm_bindgen(method, setter = "remotePort")] + fn remote_port_shim(this: &UdpOptions, val: u16); } impl UdpOptions { #[doc = "Construct a new `UdpOptions`."] @@ -24,102 +36,42 @@ impl UdpOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn address_reuse(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("addressReuse"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.address_reuse_shim(val); self } #[doc = "Change the `localAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn local_address(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localAddress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_address_shim(val); self } #[doc = "Change the `localPort` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn local_port(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("localPort"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.local_port_shim(val); self } #[doc = "Change the `loopback` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn loopback(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("loopback"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.loopback_shim(val); self } #[doc = "Change the `remoteAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn remote_address(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remoteAddress"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_address_shim(val); self } #[doc = "Change the `remotePort` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub fn remote_port(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("remotePort"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.remote_port_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UiEventInit.rs b/crates/web-sys/src/features/gen_UiEventInit.rs index bb56110784a..de144f4ed4d 100644 --- a/crates/web-sys/src/features/gen_UiEventInit.rs +++ b/crates/web-sys/src/features/gen_UiEventInit.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub type UiEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &UiEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &UiEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &UiEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &UiEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &UiEventInit, val: Option<&Window>); } impl UiEventInit { #[doc = "Construct a new `UiEventInit`."] @@ -24,65 +35,28 @@ impl UiEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,13 +64,7 @@ impl UiEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UnderlyingSink.rs b/crates/web-sys/src/features/gen_UnderlyingSink.rs index 3c2f8a8a79f..458fc583361 100644 --- a/crates/web-sys/src/features/gen_UnderlyingSink.rs +++ b/crates/web-sys/src/features/gen_UnderlyingSink.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub type UnderlyingSink; + #[wasm_bindgen(method, setter = "abort")] + fn abort_shim(this: &UnderlyingSink, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "close")] + fn close_shim(this: &UnderlyingSink, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "start")] + fn start_shim(this: &UnderlyingSink, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &UnderlyingSink, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "write")] + fn write_shim(this: &UnderlyingSink, val: &::js_sys::Function); } impl UnderlyingSink { #[doc = "Construct a new `UnderlyingSink`."] @@ -24,65 +34,35 @@ impl UnderlyingSink { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub fn abort(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("abort"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.abort_shim(val); self } #[doc = "Change the `close` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub fn close(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("close"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.close_shim(val); self } #[doc = "Change the `start` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_shim(val); self } #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub fn type_(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } #[doc = "Change the `write` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub fn write(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("write"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.write_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UnderlyingSource.rs b/crates/web-sys/src/features/gen_UnderlyingSource.rs index 1794bcc86e5..99efecb0e14 100644 --- a/crates/web-sys/src/features/gen_UnderlyingSource.rs +++ b/crates/web-sys/src/features/gen_UnderlyingSource.rs @@ -10,6 +10,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub type UnderlyingSource; + #[wasm_bindgen(method, setter = "autoAllocateChunkSize")] + fn auto_allocate_chunk_size_shim(this: &UnderlyingSource, val: f64); + #[wasm_bindgen(method, setter = "cancel")] + fn cancel_shim(this: &UnderlyingSource, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "pull")] + fn pull_shim(this: &UnderlyingSource, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "start")] + fn start_shim(this: &UnderlyingSource, val: &::js_sys::Function); + #[cfg(feature = "ReadableStreamType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &UnderlyingSource, val: ReadableStreamType); } impl UnderlyingSource { #[doc = "Construct a new `UnderlyingSource`."] @@ -24,57 +35,28 @@ impl UnderlyingSource { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub fn auto_allocate_chunk_size(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("autoAllocateChunkSize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.auto_allocate_chunk_size_shim(val); self } #[doc = "Change the `cancel` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub fn cancel(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("cancel"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancel_shim(val); self } #[doc = "Change the `pull` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub fn pull(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("pull"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.pull_shim(val); self } #[doc = "Change the `start` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("start"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.start_shim(val); self } #[cfg(feature = "ReadableStreamType")] @@ -82,13 +64,7 @@ impl UnderlyingSource { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] pub fn type_(&mut self, val: ReadableStreamType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs index 745d869af4d..5bcbff99c6d 100644 --- a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbConnectionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &UsbConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &UsbConnectionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &UsbConnectionEventInit, val: bool); + #[cfg(feature = "UsbDevice")] + #[wasm_bindgen(method, setter = "device")] + fn device_shim(this: &UsbConnectionEventInit, val: &UsbDevice); } #[cfg(web_sys_unstable_apis)] impl UsbConnectionEventInit { @@ -38,17 +47,7 @@ impl UsbConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl UsbConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +69,7 @@ impl UsbConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,14 +81,7 @@ impl UsbConnectionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn device(&mut self, val: &UsbDevice) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.device_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs index a6a72f736a0..99a413d2354 100644 --- a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs +++ b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbControlTransferParameters; + #[wasm_bindgen(method, setter = "index")] + fn index_shim(this: &UsbControlTransferParameters, val: u16); + #[cfg(feature = "UsbRecipient")] + #[wasm_bindgen(method, setter = "recipient")] + fn recipient_shim(this: &UsbControlTransferParameters, val: UsbRecipient); + #[wasm_bindgen(method, setter = "request")] + fn request_shim(this: &UsbControlTransferParameters, val: u8); + #[cfg(feature = "UsbRequestType")] + #[wasm_bindgen(method, setter = "requestType")] + fn request_type_shim(this: &UsbControlTransferParameters, val: UsbRequestType); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &UsbControlTransferParameters, val: u16); } #[cfg(web_sys_unstable_apis)] impl UsbControlTransferParameters { @@ -48,13 +60,7 @@ impl UsbControlTransferParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn index(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("index"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.index_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -66,17 +72,7 @@ impl UsbControlTransferParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn recipient(&mut self, val: UsbRecipient) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("recipient"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.recipient_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -87,17 +83,7 @@ impl UsbControlTransferParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn request(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("request"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.request_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -109,17 +95,7 @@ impl UsbControlTransferParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn request_type(&mut self, val: UsbRequestType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requestType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.request_type_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -130,13 +106,7 @@ impl UsbControlTransferParameters { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn value(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs index 61fd2c90bca..1dcc503db30 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbDeviceFilter; + #[wasm_bindgen(method, setter = "classCode")] + fn class_code_shim(this: &UsbDeviceFilter, val: u8); + #[wasm_bindgen(method, setter = "productId")] + fn product_id_shim(this: &UsbDeviceFilter, val: u16); + #[wasm_bindgen(method, setter = "protocolCode")] + fn protocol_code_shim(this: &UsbDeviceFilter, val: u8); + #[wasm_bindgen(method, setter = "serialNumber")] + fn serial_number_shim(this: &UsbDeviceFilter, val: &str); + #[wasm_bindgen(method, setter = "subclassCode")] + fn subclass_code_shim(this: &UsbDeviceFilter, val: u8); + #[wasm_bindgen(method, setter = "vendorId")] + fn vendor_id_shim(this: &UsbDeviceFilter, val: u16); } #[cfg(web_sys_unstable_apis)] impl UsbDeviceFilter { @@ -36,17 +48,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn class_code(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("classCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.class_code_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +59,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn product_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("productId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.product_id_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +70,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn protocol_code(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("protocolCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.protocol_code_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +81,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn serial_number(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serialNumber"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.serial_number_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -120,17 +92,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn subclass_code(&mut self, val: u8) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("subclassCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.subclass_code_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -141,17 +103,7 @@ impl UsbDeviceFilter { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn vendor_id(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("vendorId"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.vendor_id_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs index a6c7b87cff8..7d05fe0b907 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbDeviceRequestOptions; + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &UsbDeviceRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbDeviceRequestOptions { @@ -37,17 +39,7 @@ impl UsbDeviceRequestOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs index 0def022717d..5688bc47d1f 100644 --- a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &UsbPermissionDescriptor, val: PermissionName); + #[wasm_bindgen(method, setter = "filters")] + fn filters_shim(this: &UsbPermissionDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbPermissionDescriptor { @@ -39,13 +44,7 @@ impl UsbPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -56,17 +55,7 @@ impl UsbPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("filters"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.filters_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbPermissionStorage.rs b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs index 13bfc7d6d40..7fee5379ed9 100644 --- a/crates/web-sys/src/features/gen_UsbPermissionStorage.rs +++ b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbPermissionStorage; + #[wasm_bindgen(method, setter = "allowedDevices")] + fn allowed_devices_shim(this: &UsbPermissionStorage, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbPermissionStorage { @@ -36,17 +38,7 @@ impl UsbPermissionStorage { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn allowed_devices(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowedDevices"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allowed_devices_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_UserProximityEventInit.rs b/crates/web-sys/src/features/gen_UserProximityEventInit.rs index 64e63f42986..7ab52a377c8 100644 --- a/crates/web-sys/src/features/gen_UserProximityEventInit.rs +++ b/crates/web-sys/src/features/gen_UserProximityEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub type UserProximityEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &UserProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &UserProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &UserProximityEventInit, val: bool); + #[wasm_bindgen(method, setter = "near")] + fn near_shim(this: &UserProximityEventInit, val: bool); } impl UserProximityEventInit { #[doc = "Construct a new `UserProximityEventInit`."] @@ -24,64 +32,28 @@ impl UserProximityEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `near` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub fn near(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("near"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.near_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_ValueEventInit.rs b/crates/web-sys/src/features/gen_ValueEventInit.rs index 5de054e0ded..0e095a187a1 100644 --- a/crates/web-sys/src/features/gen_ValueEventInit.rs +++ b/crates/web-sys/src/features/gen_ValueEventInit.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ValueEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &ValueEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &ValueEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &ValueEventInit, val: bool); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &ValueEventInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl ValueEventInit { @@ -36,17 +44,7 @@ impl ValueEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +55,7 @@ impl ValueEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +66,7 @@ impl ValueEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,13 +77,7 @@ impl ValueEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs b/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs index df749ddbd98..e2615680a89 100644 --- a/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs +++ b/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs @@ -14,6 +14,17 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoColorSpaceInit; + #[wasm_bindgen(method, setter = "fullRange")] + fn full_range_shim(this: &VideoColorSpaceInit, val: bool); + #[cfg(feature = "VideoMatrixCoefficients")] + #[wasm_bindgen(method, setter = "matrix")] + fn matrix_shim(this: &VideoColorSpaceInit, val: VideoMatrixCoefficients); + #[cfg(feature = "VideoColorPrimaries")] + #[wasm_bindgen(method, setter = "primaries")] + fn primaries_shim(this: &VideoColorSpaceInit, val: VideoColorPrimaries); + #[cfg(feature = "VideoTransferCharacteristics")] + #[wasm_bindgen(method, setter = "transfer")] + fn transfer_shim(this: &VideoColorSpaceInit, val: VideoTransferCharacteristics); } #[cfg(web_sys_unstable_apis)] impl VideoColorSpaceInit { @@ -36,17 +47,7 @@ impl VideoColorSpaceInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn full_range(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("fullRange"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.full_range_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,14 +59,7 @@ impl VideoColorSpaceInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn matrix(&mut self, val: VideoMatrixCoefficients) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("matrix"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.matrix_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -77,17 +71,7 @@ impl VideoColorSpaceInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn primaries(&mut self, val: VideoColorPrimaries) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("primaries"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.primaries_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +83,7 @@ impl VideoColorSpaceInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transfer(&mut self, val: VideoTransferCharacteristics) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transfer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transfer_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoConfiguration.rs b/crates/web-sys/src/features/gen_VideoConfiguration.rs index 3b195f32897..e3ec5697201 100644 --- a/crates/web-sys/src/features/gen_VideoConfiguration.rs +++ b/crates/web-sys/src/features/gen_VideoConfiguration.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub type VideoConfiguration; + #[wasm_bindgen(method, setter = "bitrate")] + fn bitrate_shim(this: &VideoConfiguration, val: f64); + #[wasm_bindgen(method, setter = "contentType")] + fn content_type_shim(this: &VideoConfiguration, val: &str); + #[wasm_bindgen(method, setter = "framerate")] + fn framerate_shim(this: &VideoConfiguration, val: &str); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &VideoConfiguration, val: u32); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &VideoConfiguration, val: u32); } impl VideoConfiguration { #[doc = "Construct a new `VideoConfiguration`."] @@ -24,78 +34,35 @@ impl VideoConfiguration { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub fn bitrate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_shim(val); self } #[doc = "Change the `contentType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub fn content_type(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("contentType"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.content_type_shim(val); self } #[doc = "Change the `framerate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub fn framerate(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_shim(val); self } #[doc = "Change the `height` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub fn height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[doc = "Change the `width` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub fn width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs index dad94139949..6dba5389dd5 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs @@ -14,6 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderConfig; + #[wasm_bindgen(method, setter = "codec")] + fn codec_shim(this: &VideoDecoderConfig, val: &str); + #[wasm_bindgen(method, setter = "codedHeight")] + fn coded_height_shim(this: &VideoDecoderConfig, val: u32); + #[wasm_bindgen(method, setter = "codedWidth")] + fn coded_width_shim(this: &VideoDecoderConfig, val: u32); + #[cfg(feature = "VideoColorSpaceInit")] + #[wasm_bindgen(method, setter = "colorSpace")] + fn color_space_shim(this: &VideoDecoderConfig, val: &VideoColorSpaceInit); + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &VideoDecoderConfig, val: &::js_sys::Object); + #[wasm_bindgen(method, setter = "displayAspectHeight")] + fn display_aspect_height_shim(this: &VideoDecoderConfig, val: u32); + #[wasm_bindgen(method, setter = "displayAspectWidth")] + fn display_aspect_width_shim(this: &VideoDecoderConfig, val: u32); + #[cfg(feature = "HardwareAcceleration")] + #[wasm_bindgen(method, setter = "hardwareAcceleration")] + fn hardware_acceleration_shim(this: &VideoDecoderConfig, val: HardwareAcceleration); + #[wasm_bindgen(method, setter = "optimizeForLatency")] + fn optimize_for_latency_shim(this: &VideoDecoderConfig, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoDecoderConfig { @@ -37,13 +57,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn codec(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +68,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn coded_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codedHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.coded_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +79,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn coded_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codedWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.coded_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -97,17 +91,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_space_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -118,17 +102,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -139,17 +113,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_aspect_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayAspectHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_aspect_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -160,17 +124,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_aspect_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayAspectWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_aspect_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -182,17 +136,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hardwareAcceleration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hardware_acceleration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -203,17 +147,7 @@ impl VideoDecoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn optimize_for_latency(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("optimizeForLatency"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.optimize_for_latency_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderInit.rs b/crates/web-sys/src/features/gen_VideoDecoderInit.rs index e0821b156d0..a4b15fb60ba 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderInit; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &VideoDecoderInit, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "output")] + fn output_shim(this: &VideoDecoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl VideoDecoderInit { @@ -38,13 +42,7 @@ impl VideoDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,14 +53,7 @@ impl VideoDecoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("output"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderSupport.rs b/crates/web-sys/src/features/gen_VideoDecoderSupport.rs index 6954b2feefb..25c91ef0900 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderSupport.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderSupport.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderSupport; + #[cfg(feature = "VideoDecoderConfig")] + #[wasm_bindgen(method, setter = "config")] + fn config_shim(this: &VideoDecoderSupport, val: &VideoDecoderConfig); + #[wasm_bindgen(method, setter = "supported")] + fn supported_shim(this: &VideoDecoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoDecoderSupport { @@ -37,14 +42,7 @@ impl VideoDecoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn config(&mut self, val: &VideoDecoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("config"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.config_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +53,7 @@ impl VideoDecoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn supported(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supported"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs index e125dfed944..e546329b66e 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs @@ -14,6 +14,31 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderConfig; + #[cfg(feature = "AlphaOption")] + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &VideoEncoderConfig, val: AlphaOption); + #[wasm_bindgen(method, setter = "bitrate")] + fn bitrate_shim(this: &VideoEncoderConfig, val: f64); + #[wasm_bindgen(method, setter = "codec")] + fn codec_shim(this: &VideoEncoderConfig, val: &str); + #[wasm_bindgen(method, setter = "displayHeight")] + fn display_height_shim(this: &VideoEncoderConfig, val: u32); + #[wasm_bindgen(method, setter = "displayWidth")] + fn display_width_shim(this: &VideoEncoderConfig, val: u32); + #[wasm_bindgen(method, setter = "framerate")] + fn framerate_shim(this: &VideoEncoderConfig, val: f64); + #[cfg(feature = "HardwareAcceleration")] + #[wasm_bindgen(method, setter = "hardwareAcceleration")] + fn hardware_acceleration_shim(this: &VideoEncoderConfig, val: HardwareAcceleration); + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &VideoEncoderConfig, val: u32); + #[cfg(feature = "LatencyMode")] + #[wasm_bindgen(method, setter = "latencyMode")] + fn latency_mode_shim(this: &VideoEncoderConfig, val: LatencyMode); + #[wasm_bindgen(method, setter = "scalabilityMode")] + fn scalability_mode_shim(this: &VideoEncoderConfig, val: &str); + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &VideoEncoderConfig, val: u32); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderConfig { @@ -40,13 +65,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +76,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bitrate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bitrate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bitrate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,13 +87,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn codec(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.codec_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,17 +98,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -116,17 +109,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -137,17 +120,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn framerate(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framerate"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framerate_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -159,17 +132,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hardwareAcceleration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hardware_acceleration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -180,14 +143,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -199,17 +155,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn latency_mode(&mut self, val: LatencyMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("latencyMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.latency_mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -220,17 +166,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn scalability_mode(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("scalabilityMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.scalability_mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -241,13 +177,7 @@ impl VideoEncoderConfig { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.width_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs b/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs index 76e81c9df34..f95a89936ee 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderEncodeOptions; + #[wasm_bindgen(method, setter = "keyFrame")] + fn key_frame_shim(this: &VideoEncoderEncodeOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderEncodeOptions { @@ -36,17 +38,7 @@ impl VideoEncoderEncodeOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn key_frame(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("keyFrame"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.key_frame_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderInit.rs b/crates/web-sys/src/features/gen_VideoEncoderInit.rs index 68c17f5590c..cbded7262e9 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderInit; + #[wasm_bindgen(method, setter = "error")] + fn error_shim(this: &VideoEncoderInit, val: &::js_sys::Function); + #[wasm_bindgen(method, setter = "output")] + fn output_shim(this: &VideoEncoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderInit { @@ -38,13 +42,7 @@ impl VideoEncoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("error"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.error_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,14 +53,7 @@ impl VideoEncoderInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("output"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.output_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderSupport.rs b/crates/web-sys/src/features/gen_VideoEncoderSupport.rs index 88a602b0a78..eb438851292 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderSupport.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderSupport.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderSupport; + #[cfg(feature = "VideoEncoderConfig")] + #[wasm_bindgen(method, setter = "config")] + fn config_shim(this: &VideoEncoderSupport, val: &VideoEncoderConfig); + #[wasm_bindgen(method, setter = "supported")] + fn supported_shim(this: &VideoEncoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderSupport { @@ -37,14 +42,7 @@ impl VideoEncoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn config(&mut self, val: &VideoEncoderConfig) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("config"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.config_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +53,7 @@ impl VideoEncoderSupport { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn supported(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("supported"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.supported_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs index 339b4be9386..f86531d6092 100644 --- a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs +++ b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs @@ -14,6 +14,29 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameBufferInit; + #[wasm_bindgen(method, setter = "codedHeight")] + fn coded_height_shim(this: &VideoFrameBufferInit, val: u32); + #[wasm_bindgen(method, setter = "codedWidth")] + fn coded_width_shim(this: &VideoFrameBufferInit, val: u32); + #[cfg(feature = "VideoColorSpaceInit")] + #[wasm_bindgen(method, setter = "colorSpace")] + fn color_space_shim(this: &VideoFrameBufferInit, val: &VideoColorSpaceInit); + #[wasm_bindgen(method, setter = "displayHeight")] + fn display_height_shim(this: &VideoFrameBufferInit, val: u32); + #[wasm_bindgen(method, setter = "displayWidth")] + fn display_width_shim(this: &VideoFrameBufferInit, val: u32); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &VideoFrameBufferInit, val: f64); + #[cfg(feature = "VideoPixelFormat")] + #[wasm_bindgen(method, setter = "format")] + fn format_shim(this: &VideoFrameBufferInit, val: VideoPixelFormat); + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &VideoFrameBufferInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &VideoFrameBufferInit, val: f64); + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "visibleRect")] + fn visible_rect_shim(this: &VideoFrameBufferInit, val: &DomRectInit); } #[cfg(web_sys_unstable_apis)] impl VideoFrameBufferInit { @@ -46,17 +69,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn coded_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codedHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.coded_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -67,17 +80,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn coded_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("codedWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.coded_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -89,17 +92,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("colorSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.color_space_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -110,17 +103,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -131,17 +114,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -152,17 +125,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -174,14 +137,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn format(&mut self, val: VideoPixelFormat) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("format"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.format_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -192,14 +148,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -210,17 +159,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -232,17 +171,7 @@ impl VideoFrameBufferInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn visible_rect(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("visibleRect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.visible_rect_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs b/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs index 6278988f6a3..b4daba7283d 100644 --- a/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs +++ b/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameCopyToOptions; + #[wasm_bindgen(method, setter = "layout")] + fn layout_shim(this: &VideoFrameCopyToOptions, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "rect")] + fn rect_shim(this: &VideoFrameCopyToOptions, val: &DomRectInit); } #[cfg(web_sys_unstable_apis)] impl VideoFrameCopyToOptions { @@ -36,14 +41,7 @@ impl VideoFrameCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layout"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layout_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,13 +53,7 @@ impl VideoFrameCopyToOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn rect(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rect"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rect_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameInit.rs b/crates/web-sys/src/features/gen_VideoFrameInit.rs index 53224cb93ed..41ece8b8c55 100644 --- a/crates/web-sys/src/features/gen_VideoFrameInit.rs +++ b/crates/web-sys/src/features/gen_VideoFrameInit.rs @@ -14,6 +14,20 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameInit; + #[cfg(feature = "AlphaOption")] + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &VideoFrameInit, val: AlphaOption); + #[wasm_bindgen(method, setter = "displayHeight")] + fn display_height_shim(this: &VideoFrameInit, val: u32); + #[wasm_bindgen(method, setter = "displayWidth")] + fn display_width_shim(this: &VideoFrameInit, val: u32); + #[wasm_bindgen(method, setter = "duration")] + fn duration_shim(this: &VideoFrameInit, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &VideoFrameInit, val: f64); + #[cfg(feature = "DomRectInit")] + #[wasm_bindgen(method, setter = "visibleRect")] + fn visible_rect_shim(this: &VideoFrameInit, val: &DomRectInit); } #[cfg(web_sys_unstable_apis)] impl VideoFrameInit { @@ -37,13 +51,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -54,17 +62,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_height(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayHeight"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_height_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -75,17 +73,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn display_width(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("displayWidth"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.display_width_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -96,17 +84,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn duration(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("duration"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.duration_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -117,17 +95,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -139,17 +107,7 @@ impl VideoFrameInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn visible_rect(&mut self, val: &DomRectInit) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("visibleRect"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.visible_rect_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VoidCallback.rs b/crates/web-sys/src/features/gen_VoidCallback.rs index 16e8d5120ca..08d9643e49c 100644 --- a/crates/web-sys/src/features/gen_VoidCallback.rs +++ b/crates/web-sys/src/features/gen_VoidCallback.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] pub type VoidCallback; + #[wasm_bindgen(method, setter = "handleEvent")] + fn handle_event_shim(this: &VoidCallback, val: &::js_sys::Function); } impl VoidCallback { #[doc = "Construct a new `VoidCallback`."] @@ -24,17 +26,7 @@ impl VoidCallback { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("handleEvent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.handle_event_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_VrLayer.rs b/crates/web-sys/src/features/gen_VrLayer.rs index 514ab0a6cf7..fef6d7169ab 100644 --- a/crates/web-sys/src/features/gen_VrLayer.rs +++ b/crates/web-sys/src/features/gen_VrLayer.rs @@ -10,6 +10,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] pub type VrLayer; + #[wasm_bindgen(method, setter = "leftBounds")] + fn left_bounds_shim(this: &VrLayer, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "rightBounds")] + fn right_bounds_shim(this: &VrLayer, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "HtmlCanvasElement")] + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &VrLayer, val: Option<&HtmlCanvasElement>); } impl VrLayer { #[doc = "Construct a new `VrLayer`."] @@ -24,34 +31,14 @@ impl VrLayer { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] pub fn left_bounds(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("leftBounds"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.left_bounds_shim(val); self } #[doc = "Change the `rightBounds` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] pub fn right_bounds(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rightBounds"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.right_bounds_shim(val); self } #[cfg(feature = "HtmlCanvasElement")] @@ -59,14 +46,7 @@ impl VrLayer { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `VrLayer`*"] pub fn source(&mut self, val: Option<&HtmlCanvasElement>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs b/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs index 741ed6b4f4d..910cb67592b 100644 --- a/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs +++ b/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs @@ -14,6 +14,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WatchAdvertisementsOptions; + #[cfg(feature = "AbortSignal")] + #[wasm_bindgen(method, setter = "signal")] + fn signal_shim(this: &WatchAdvertisementsOptions, val: &AbortSignal); } #[cfg(web_sys_unstable_apis)] impl WatchAdvertisementsOptions { @@ -37,14 +40,7 @@ impl WatchAdvertisementsOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("signal"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.signal_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WaveShaperOptions.rs b/crates/web-sys/src/features/gen_WaveShaperOptions.rs index 95f3a66e966..73eae9c0dc8 100644 --- a/crates/web-sys/src/features/gen_WaveShaperOptions.rs +++ b/crates/web-sys/src/features/gen_WaveShaperOptions.rs @@ -10,6 +10,19 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] pub type WaveShaperOptions; + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &WaveShaperOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[wasm_bindgen(method, setter = "channelCountMode")] + fn channel_count_mode_shim(this: &WaveShaperOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[wasm_bindgen(method, setter = "channelInterpretation")] + fn channel_interpretation_shim(this: &WaveShaperOptions, val: ChannelInterpretation); + #[wasm_bindgen(method, setter = "curve")] + fn curve_shim(this: &WaveShaperOptions, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "OverSampleType")] + #[wasm_bindgen(method, setter = "oversample")] + fn oversample_shim(this: &WaveShaperOptions, val: OverSampleType); } impl WaveShaperOptions { #[doc = "Construct a new `WaveShaperOptions`."] @@ -24,17 +37,7 @@ impl WaveShaperOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] pub fn channel_count(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCount"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_shim(val); self } #[cfg(feature = "ChannelCountMode")] @@ -42,17 +45,7 @@ impl WaveShaperOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `WaveShaperOptions`*"] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelCountMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_count_mode_shim(val); self } #[cfg(feature = "ChannelInterpretation")] @@ -60,30 +53,14 @@ impl WaveShaperOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `WaveShaperOptions`*"] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("channelInterpretation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.channel_interpretation_shim(val); self } #[doc = "Change the `curve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] pub fn curve(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("curve"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.curve_shim(val); self } #[cfg(feature = "OverSampleType")] @@ -91,17 +68,7 @@ impl WaveShaperOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OverSampleType`, `WaveShaperOptions`*"] pub fn oversample(&mut self, val: OverSampleType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("oversample"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.oversample_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs index 71ce35e80ba..d939df42117 100644 --- a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs +++ b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs @@ -10,6 +10,25 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub type WebGlContextAttributes; + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "antialias")] + fn antialias_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "depth")] + fn depth_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "failIfMajorPerformanceCaveat")] + fn fail_if_major_performance_caveat_shim(this: &WebGlContextAttributes, val: bool); + #[cfg(feature = "WebGlPowerPreference")] + #[wasm_bindgen(method, setter = "powerPreference")] + fn power_preference_shim(this: &WebGlContextAttributes, val: WebGlPowerPreference); + #[wasm_bindgen(method, setter = "premultipliedAlpha")] + fn premultiplied_alpha_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "preserveDrawingBuffer")] + fn preserve_drawing_buffer_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "stencil")] + fn stencil_shim(this: &WebGlContextAttributes, val: bool); + #[wasm_bindgen(method, setter = "xrCompatible")] + fn xr_compatible_shim(this: &WebGlContextAttributes, val: bool); } impl WebGlContextAttributes { #[doc = "Construct a new `WebGlContextAttributes`."] @@ -24,60 +43,28 @@ impl WebGlContextAttributes { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn alpha(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[doc = "Change the `antialias` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn antialias(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("antialias"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.antialias_shim(val); self } #[doc = "Change the `depth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn depth(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("depth"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_shim(val); self } #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("failIfMajorPerformanceCaveat"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.fail_if_major_performance_caveat_shim(val); self } #[cfg(feature = "WebGlPowerPreference")] @@ -85,68 +72,28 @@ impl WebGlContextAttributes { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"] pub fn power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("powerPreference"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.power_preference_shim(val); self } #[doc = "Change the `premultipliedAlpha` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("premultipliedAlpha"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.premultiplied_alpha_shim(val); self } #[doc = "Change the `preserveDrawingBuffer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn preserve_drawing_buffer(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("preserveDrawingBuffer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.preserve_drawing_buffer_shim(val); self } #[doc = "Change the `stencil` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub fn stencil(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencil"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -157,17 +104,7 @@ impl WebGlContextAttributes { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn xr_compatible(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("xrCompatible"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.xr_compatible_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs index 9be6bce33cf..870603872a7 100644 --- a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs +++ b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub type WebGlContextEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &WebGlContextEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &WebGlContextEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &WebGlContextEventInit, val: bool); + #[wasm_bindgen(method, setter = "statusMessage")] + fn status_message_shim(this: &WebGlContextEventInit, val: &str); } impl WebGlContextEventInit { #[doc = "Construct a new `WebGlContextEventInit`."] @@ -24,68 +32,28 @@ impl WebGlContextEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `statusMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub fn status_message(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("statusMessage"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.status_message_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebSocketDict.rs b/crates/web-sys/src/features/gen_WebSocketDict.rs index c9a67c34c4c..1586581b065 100644 --- a/crates/web-sys/src/features/gen_WebSocketDict.rs +++ b/crates/web-sys/src/features/gen_WebSocketDict.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] pub type WebSocketDict; + #[wasm_bindgen(method, setter = "websockets")] + fn websockets_shim(this: &WebSocketDict, val: &::wasm_bindgen::JsValue); } impl WebSocketDict { #[doc = "Construct a new `WebSocketDict`."] @@ -24,17 +26,7 @@ impl WebSocketDict { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] pub fn websockets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("websockets"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.websockets_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebSocketElement.rs b/crates/web-sys/src/features/gen_WebSocketElement.rs index 99746cd6e70..ebe600ee7b1 100644 --- a/crates/web-sys/src/features/gen_WebSocketElement.rs +++ b/crates/web-sys/src/features/gen_WebSocketElement.rs @@ -10,6 +10,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub type WebSocketElement; + #[wasm_bindgen(method, setter = "encrypted")] + fn encrypted_shim(this: &WebSocketElement, val: bool); + #[wasm_bindgen(method, setter = "hostport")] + fn hostport_shim(this: &WebSocketElement, val: &str); + #[wasm_bindgen(method, setter = "msgreceived")] + fn msgreceived_shim(this: &WebSocketElement, val: u32); + #[wasm_bindgen(method, setter = "msgsent")] + fn msgsent_shim(this: &WebSocketElement, val: u32); + #[wasm_bindgen(method, setter = "receivedsize")] + fn receivedsize_shim(this: &WebSocketElement, val: f64); + #[wasm_bindgen(method, setter = "sentsize")] + fn sentsize_shim(this: &WebSocketElement, val: f64); } impl WebSocketElement { #[doc = "Construct a new `WebSocketElement`."] @@ -24,102 +36,42 @@ impl WebSocketElement { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn encrypted(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("encrypted"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.encrypted_shim(val); self } #[doc = "Change the `hostport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn hostport(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("hostport"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.hostport_shim(val); self } #[doc = "Change the `msgreceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn msgreceived(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("msgreceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.msgreceived_shim(val); self } #[doc = "Change the `msgsent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn msgsent(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("msgsent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.msgsent_shim(val); self } #[doc = "Change the `receivedsize` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn receivedsize(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("receivedsize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.receivedsize_shim(val); self } #[doc = "Change the `sentsize` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub fn sentsize(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sentsize"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.sentsize_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs index 1ecd401b83d..28ef40240d5 100644 --- a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs +++ b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportCloseInfo; + #[wasm_bindgen(method, setter = "closeCode")] + fn close_code_shim(this: &WebTransportCloseInfo, val: u32); + #[wasm_bindgen(method, setter = "reason")] + fn reason_shim(this: &WebTransportCloseInfo, val: &str); } #[cfg(web_sys_unstable_apis)] impl WebTransportCloseInfo { @@ -36,17 +40,7 @@ impl WebTransportCloseInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn close_code(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("closeCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.close_code_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,14 +51,7 @@ impl WebTransportCloseInfo { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn reason(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reason_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs index 8817e6b206e..70def34726b 100644 --- a/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportDatagramStats; + #[wasm_bindgen(method, setter = "droppedIncoming")] + fn dropped_incoming_shim(this: &WebTransportDatagramStats, val: f64); + #[wasm_bindgen(method, setter = "expiredOutgoing")] + fn expired_outgoing_shim(this: &WebTransportDatagramStats, val: f64); + #[wasm_bindgen(method, setter = "lostOutgoing")] + fn lost_outgoing_shim(this: &WebTransportDatagramStats, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &WebTransportDatagramStats, val: f64); } #[cfg(web_sys_unstable_apis)] impl WebTransportDatagramStats { @@ -36,17 +44,7 @@ impl WebTransportDatagramStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn dropped_incoming(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("droppedIncoming"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.dropped_incoming_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +55,7 @@ impl WebTransportDatagramStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn expired_outgoing(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("expiredOutgoing"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.expired_outgoing_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +66,7 @@ impl WebTransportDatagramStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn lost_outgoing(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lostOutgoing"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lost_outgoing_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +77,7 @@ impl WebTransportDatagramStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs index e643b6207fa..05069e0a71c 100644 --- a/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs @@ -14,6 +14,11 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportErrorOptions; + #[cfg(feature = "WebTransportErrorSource")] + #[wasm_bindgen(method, setter = "source")] + fn source_shim(this: &WebTransportErrorOptions, val: WebTransportErrorSource); + #[wasm_bindgen(method, setter = "streamErrorCode")] + fn stream_error_code_shim(this: &WebTransportErrorOptions, val: Option); } #[cfg(web_sys_unstable_apis)] impl WebTransportErrorOptions { @@ -37,14 +42,7 @@ impl WebTransportErrorOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn source(&mut self, val: WebTransportErrorSource) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.source_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -55,17 +53,7 @@ impl WebTransportErrorOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stream_error_code(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("streamErrorCode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stream_error_code_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportHash.rs b/crates/web-sys/src/features/gen_WebTransportHash.rs index 1ec62f4a843..46c4052620a 100644 --- a/crates/web-sys/src/features/gen_WebTransportHash.rs +++ b/crates/web-sys/src/features/gen_WebTransportHash.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportHash; + #[wasm_bindgen(method, setter = "algorithm")] + fn algorithm_shim(this: &WebTransportHash, val: &str); + #[wasm_bindgen(method, setter = "value")] + fn value_shim(this: &WebTransportHash, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl WebTransportHash { @@ -36,17 +40,7 @@ impl WebTransportHash { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn algorithm(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("algorithm"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.algorithm_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +51,7 @@ impl WebTransportHash { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.value_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportOptions.rs b/crates/web-sys/src/features/gen_WebTransportOptions.rs index 178e32110aa..bd20cadbb79 100644 --- a/crates/web-sys/src/features/gen_WebTransportOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportOptions.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportOptions; + #[wasm_bindgen(method, setter = "allowPooling")] + fn allow_pooling_shim(this: &WebTransportOptions, val: bool); + #[cfg(feature = "WebTransportCongestionControl")] + #[wasm_bindgen(method, setter = "congestionControl")] + fn congestion_control_shim(this: &WebTransportOptions, val: WebTransportCongestionControl); + #[wasm_bindgen(method, setter = "requireUnreliable")] + fn require_unreliable_shim(this: &WebTransportOptions, val: bool); + #[wasm_bindgen(method, setter = "serverCertificateHashes")] + fn server_certificate_hashes_shim(this: &WebTransportOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl WebTransportOptions { @@ -36,17 +45,7 @@ impl WebTransportOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn allow_pooling(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("allowPooling"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.allow_pooling_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +57,7 @@ impl WebTransportOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn congestion_control(&mut self, val: WebTransportCongestionControl) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("congestionControl"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.congestion_control_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +68,7 @@ impl WebTransportOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn require_unreliable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requireUnreliable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.require_unreliable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,17 +79,7 @@ impl WebTransportOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn server_certificate_hashes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("serverCertificateHashes"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.server_certificate_hashes_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs index 635908f98d8..61a4c3d60c6 100644 --- a/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportReceiveStreamStats; + #[wasm_bindgen(method, setter = "bytesRead")] + fn bytes_read_shim(this: &WebTransportReceiveStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &WebTransportReceiveStreamStats, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &WebTransportReceiveStreamStats, val: f64); } #[cfg(web_sys_unstable_apis)] impl WebTransportReceiveStreamStats { @@ -36,17 +42,7 @@ impl WebTransportReceiveStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_read(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesRead"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_read_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +53,7 @@ impl WebTransportReceiveStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +64,7 @@ impl WebTransportReceiveStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs index 61d694c8e49..d4b1ee2cd93 100644 --- a/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs @@ -14,6 +14,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportSendStreamOptions; + #[wasm_bindgen(method, setter = "sendOrder")] + fn send_order_shim(this: &WebTransportSendStreamOptions, val: Option); } #[cfg(web_sys_unstable_apis)] impl WebTransportSendStreamOptions { @@ -36,17 +38,7 @@ impl WebTransportSendStreamOptions { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn send_order(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("sendOrder"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.send_order_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs index 524a1bcfc46..373f9a7bc13 100644 --- a/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs @@ -14,6 +14,14 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportSendStreamStats; + #[wasm_bindgen(method, setter = "bytesAcknowledged")] + fn bytes_acknowledged_shim(this: &WebTransportSendStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &WebTransportSendStreamStats, val: f64); + #[wasm_bindgen(method, setter = "bytesWritten")] + fn bytes_written_shim(this: &WebTransportSendStreamStats, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &WebTransportSendStreamStats, val: f64); } #[cfg(web_sys_unstable_apis)] impl WebTransportSendStreamStats { @@ -36,17 +44,7 @@ impl WebTransportSendStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_acknowledged(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesAcknowledged"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_acknowledged_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +55,7 @@ impl WebTransportSendStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -78,17 +66,7 @@ impl WebTransportSendStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_written(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesWritten"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_written_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -99,17 +77,7 @@ impl WebTransportSendStreamStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportStats.rs b/crates/web-sys/src/features/gen_WebTransportStats.rs index d28d35440f7..bc2b8fd4347 100644 --- a/crates/web-sys/src/features/gen_WebTransportStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportStats.rs @@ -14,6 +14,31 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportStats; + #[wasm_bindgen(method, setter = "bytesReceived")] + fn bytes_received_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "bytesSent")] + fn bytes_sent_shim(this: &WebTransportStats, val: f64); + #[cfg(feature = "WebTransportDatagramStats")] + #[wasm_bindgen(method, setter = "datagrams")] + fn datagrams_shim(this: &WebTransportStats, val: &WebTransportDatagramStats); + #[wasm_bindgen(method, setter = "minRtt")] + fn min_rtt_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "numIncomingStreamsCreated")] + fn num_incoming_streams_created_shim(this: &WebTransportStats, val: u32); + #[wasm_bindgen(method, setter = "numOutgoingStreamsCreated")] + fn num_outgoing_streams_created_shim(this: &WebTransportStats, val: u32); + #[wasm_bindgen(method, setter = "packetsLost")] + fn packets_lost_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "packetsReceived")] + fn packets_received_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "packetsSent")] + fn packets_sent_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "rttVariation")] + fn rtt_variation_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "smoothedRtt")] + fn smoothed_rtt_shim(this: &WebTransportStats, val: f64); + #[wasm_bindgen(method, setter = "timestamp")] + fn timestamp_shim(this: &WebTransportStats, val: f64); } #[cfg(web_sys_unstable_apis)] impl WebTransportStats { @@ -36,17 +61,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_received_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +72,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bytesSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bytes_sent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +84,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn datagrams(&mut self, val: &WebTransportDatagramStats) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("datagrams"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.datagrams_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,14 +95,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn min_rtt(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("minRtt"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.min_rtt_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -118,17 +106,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn num_incoming_streams_created(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numIncomingStreamsCreated"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.num_incoming_streams_created_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -139,17 +117,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn num_outgoing_streams_created(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("numOutgoingStreamsCreated"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.num_outgoing_streams_created_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -160,17 +128,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn packets_lost(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsLost"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_lost_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -181,17 +139,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn packets_received(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsReceived"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_received_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -202,17 +150,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn packets_sent(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("packetsSent"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.packets_sent_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -223,17 +161,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn rtt_variation(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("rttVariation"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.rtt_variation_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -244,17 +172,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn smoothed_rtt(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("smoothedRtt"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.smoothed_rtt_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -265,17 +183,7 @@ impl WebTransportStats { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn timestamp(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("timestamp"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.timestamp_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WheelEventInit.rs b/crates/web-sys/src/features/gen_WheelEventInit.rs index c29db30d089..26a815349b6 100644 --- a/crates/web-sys/src/features/gen_WheelEventInit.rs +++ b/crates/web-sys/src/features/gen_WheelEventInit.rs @@ -10,6 +10,70 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub type WheelEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "detail")] + fn detail_shim(this: &WheelEventInit, val: i32); + #[cfg(feature = "Window")] + #[wasm_bindgen(method, setter = "view")] + fn view_shim(this: &WheelEventInit, val: Option<&Window>); + #[wasm_bindgen(method, setter = "altKey")] + fn alt_key_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "ctrlKey")] + fn ctrl_key_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "metaKey")] + fn meta_key_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierAltGraph")] + fn modifier_alt_graph_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierCapsLock")] + fn modifier_caps_lock_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFn")] + fn modifier_fn_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierFnLock")] + fn modifier_fn_lock_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierNumLock")] + fn modifier_num_lock_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierOS")] + fn modifier_os_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierScrollLock")] + fn modifier_scroll_lock_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbol")] + fn modifier_symbol_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "modifierSymbolLock")] + fn modifier_symbol_lock_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "shiftKey")] + fn shift_key_shim(this: &WheelEventInit, val: bool); + #[wasm_bindgen(method, setter = "button")] + fn button_shim(this: &WheelEventInit, val: i16); + #[wasm_bindgen(method, setter = "buttons")] + fn buttons_shim(this: &WheelEventInit, val: u16); + #[wasm_bindgen(method, setter = "clientX")] + fn client_x_shim(this: &WheelEventInit, val: i32); + #[wasm_bindgen(method, setter = "clientY")] + fn client_y_shim(this: &WheelEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementX")] + fn movement_x_shim(this: &WheelEventInit, val: i32); + #[wasm_bindgen(method, setter = "movementY")] + fn movement_y_shim(this: &WheelEventInit, val: i32); + #[cfg(feature = "EventTarget")] + #[wasm_bindgen(method, setter = "relatedTarget")] + fn related_target_shim(this: &WheelEventInit, val: Option<&EventTarget>); + #[wasm_bindgen(method, setter = "screenX")] + fn screen_x_shim(this: &WheelEventInit, val: i32); + #[wasm_bindgen(method, setter = "screenY")] + fn screen_y_shim(this: &WheelEventInit, val: i32); + #[wasm_bindgen(method, setter = "deltaMode")] + fn delta_mode_shim(this: &WheelEventInit, val: u32); + #[wasm_bindgen(method, setter = "deltaX")] + fn delta_x_shim(this: &WheelEventInit, val: f64); + #[wasm_bindgen(method, setter = "deltaY")] + fn delta_y_shim(this: &WheelEventInit, val: f64); + #[wasm_bindgen(method, setter = "deltaZ")] + fn delta_z_shim(this: &WheelEventInit, val: f64); } impl WheelEventInit { #[doc = "Construct a new `WheelEventInit`."] @@ -24,65 +88,28 @@ impl WheelEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[doc = "Change the `cancelable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[doc = "Change the `composed` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[doc = "Change the `detail` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn detail(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.detail_shim(val); self } #[cfg(feature = "Window")] @@ -90,330 +117,140 @@ impl WheelEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`, `Window`*"] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.view_shim(val); self } #[doc = "Change the `altKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn alt_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alt_key_shim(val); self } #[doc = "Change the `ctrlKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ctrlKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ctrl_key_shim(val); self } #[doc = "Change the `metaKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn meta_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("metaKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.meta_key_shim(val); self } #[doc = "Change the `modifierAltGraph` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierAltGraph"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_alt_graph_shim(val); self } #[doc = "Change the `modifierCapsLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierCapsLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_caps_lock_shim(val); self } #[doc = "Change the `modifierFn` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFn"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_shim(val); self } #[doc = "Change the `modifierFnLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierFnLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_fn_lock_shim(val); self } #[doc = "Change the `modifierNumLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierNumLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_num_lock_shim(val); self } #[doc = "Change the `modifierOS` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierOS"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_os_shim(val); self } #[doc = "Change the `modifierScrollLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierScrollLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_scroll_lock_shim(val); self } #[doc = "Change the `modifierSymbol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbol"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_shim(val); self } #[doc = "Change the `modifierSymbolLock` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("modifierSymbolLock"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.modifier_symbol_lock_shim(val); self } #[doc = "Change the `shiftKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn shift_key(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("shiftKey"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.shift_key_shim(val); self } #[doc = "Change the `button` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn button(&mut self, val: i16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.button_shim(val); self } #[doc = "Change the `buttons` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn buttons(&mut self, val: u16) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("buttons"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.buttons_shim(val); self } #[doc = "Change the `clientX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn client_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_x_shim(val); self } #[doc = "Change the `clientY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn client_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("clientY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.client_y_shim(val); self } #[doc = "Change the `movementX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn movement_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_x_shim(val); self } #[doc = "Change the `movementY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn movement_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("movementY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.movement_y_shim(val); self } #[cfg(feature = "EventTarget")] @@ -421,110 +258,49 @@ impl WheelEventInit { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `WheelEventInit`*"] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("relatedTarget"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.related_target_shim(val); self } #[doc = "Change the `screenX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn screen_x(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenX"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_x_shim(val); self } #[doc = "Change the `screenY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn screen_y(&mut self, val: i32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("screenY"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.screen_y_shim(val); self } #[doc = "Change the `deltaMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn delta_mode(&mut self, val: u32) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("deltaMode"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delta_mode_shim(val); self } #[doc = "Change the `deltaX` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn delta_x(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaX"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delta_x_shim(val); self } #[doc = "Change the `deltaY` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn delta_y(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaY"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delta_y_shim(val); self } #[doc = "Change the `deltaZ` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub fn delta_z(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaZ"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.delta_z_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs index 3d8ba3f4bf2..18a7300b0a1 100644 --- a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs +++ b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs @@ -10,6 +10,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub type WidevineCdmManifest; + #[wasm_bindgen(method, setter = "description")] + fn description_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "x-cdm-codecs")] + fn x_cdm_codecs_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "x-cdm-host-versions")] + fn x_cdm_host_versions_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "x-cdm-interface-versions")] + fn x_cdm_interface_versions_shim(this: &WidevineCdmManifest, val: &str); + #[wasm_bindgen(method, setter = "x-cdm-module-versions")] + fn x_cdm_module_versions_shim(this: &WidevineCdmManifest, val: &str); } impl WidevineCdmManifest { #[doc = "Construct a new `WidevineCdmManifest`."] @@ -39,115 +53,49 @@ impl WidevineCdmManifest { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn description(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("description"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.description_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn version(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("version"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.version_shim(val); self } #[doc = "Change the `x-cdm-codecs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn x_cdm_codecs(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("x-cdm-codecs"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_cdm_codecs_shim(val); self } #[doc = "Change the `x-cdm-host-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn x_cdm_host_versions(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("x-cdm-host-versions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_cdm_host_versions_shim(val); self } #[doc = "Change the `x-cdm-interface-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn x_cdm_interface_versions(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("x-cdm-interface-versions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_cdm_interface_versions_shim(val); self } #[doc = "Change the `x-cdm-module-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub fn x_cdm_module_versions(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("x-cdm-module-versions"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.x_cdm_module_versions_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WorkerOptions.rs b/crates/web-sys/src/features/gen_WorkerOptions.rs index a63503637b6..e3f9b1edee3 100644 --- a/crates/web-sys/src/features/gen_WorkerOptions.rs +++ b/crates/web-sys/src/features/gen_WorkerOptions.rs @@ -10,6 +10,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] pub type WorkerOptions; + #[cfg(feature = "RequestCredentials")] + #[wasm_bindgen(method, setter = "credentials")] + fn credentials_shim(this: &WorkerOptions, val: RequestCredentials); + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &WorkerOptions, val: &str); + #[cfg(feature = "WorkerType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &WorkerOptions, val: WorkerType); } impl WorkerOptions { #[doc = "Construct a new `WorkerOptions`."] @@ -25,30 +33,14 @@ impl WorkerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("credentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.credentials_shim(val); self } #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] pub fn name(&mut self, val: &str) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(feature = "WorkerType")] @@ -56,13 +48,7 @@ impl WorkerOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"] pub fn type_(&mut self, val: WorkerType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WorkletOptions.rs b/crates/web-sys/src/features/gen_WorkletOptions.rs index 12ce913b304..94b0e62f7ab 100644 --- a/crates/web-sys/src/features/gen_WorkletOptions.rs +++ b/crates/web-sys/src/features/gen_WorkletOptions.rs @@ -10,6 +10,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkletOptions`*"] pub type WorkletOptions; + #[cfg(feature = "RequestCredentials")] + #[wasm_bindgen(method, setter = "credentials")] + fn credentials_shim(this: &WorkletOptions, val: RequestCredentials); } impl WorkletOptions { #[doc = "Construct a new `WorkletOptions`."] @@ -25,17 +28,7 @@ impl WorkletOptions { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkletOptions`*"] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("credentials"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.credentials_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_WriteParams.rs b/crates/web-sys/src/features/gen_WriteParams.rs index 06af78da20c..13223458c74 100644 --- a/crates/web-sys/src/features/gen_WriteParams.rs +++ b/crates/web-sys/src/features/gen_WriteParams.rs @@ -10,6 +10,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] pub type WriteParams; + #[wasm_bindgen(method, setter = "data")] + fn data_shim(this: &WriteParams, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "position")] + fn position_shim(this: &WriteParams, val: Option); + #[wasm_bindgen(method, setter = "size")] + fn size_shim(this: &WriteParams, val: Option); + #[cfg(feature = "WriteCommandType")] + #[wasm_bindgen(method, setter = "type")] + fn type__shim(this: &WriteParams, val: WriteCommandType); } impl WriteParams { #[cfg(feature = "WriteCommandType")] @@ -26,43 +35,21 @@ impl WriteParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] pub fn data(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.data_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[doc = "Change the `position` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] pub fn position(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("position"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.position_shim(val); self } #[doc = "Change the `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] pub fn size(&mut self, val: Option) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.size_shim(val); self } #[cfg(feature = "WriteCommandType")] @@ -70,13 +57,7 @@ impl WriteParams { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] pub fn type_(&mut self, val: WriteCommandType) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.type__shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XPathNsResolver.rs b/crates/web-sys/src/features/gen_XPathNsResolver.rs index 89ec857a336..4601c9df1fc 100644 --- a/crates/web-sys/src/features/gen_XPathNsResolver.rs +++ b/crates/web-sys/src/features/gen_XPathNsResolver.rs @@ -10,6 +10,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] pub type XPathNsResolver; + #[wasm_bindgen(method, setter = "lookupNamespaceURI")] + fn lookup_namespace_uri_shim(this: &XPathNsResolver, val: &::js_sys::Function); } impl XPathNsResolver { #[doc = "Construct a new `XPathNsResolver`."] @@ -24,17 +26,7 @@ impl XPathNsResolver { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] pub fn lookup_namespace_uri(&mut self, val: &::js_sys::Function) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("lookupNamespaceURI"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.lookup_namespace_uri_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs index 945817409c5..6f6712be78c 100644 --- a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrInputSourceEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &XrInputSourceEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &XrInputSourceEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &XrInputSourceEventInit, val: bool); + #[cfg(feature = "XrFrame")] + #[wasm_bindgen(method, setter = "frame")] + fn frame_shim(this: &XrInputSourceEventInit, val: &XrFrame); + #[cfg(feature = "XrInputSource")] + #[wasm_bindgen(method, setter = "inputSource")] + fn input_source_shim(this: &XrInputSourceEventInit, val: &XrInputSource); } #[cfg(web_sys_unstable_apis)] impl XrInputSourceEventInit { @@ -39,17 +51,7 @@ impl XrInputSourceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -60,17 +62,7 @@ impl XrInputSourceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -81,17 +73,7 @@ impl XrInputSourceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -103,13 +85,7 @@ impl XrInputSourceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn frame(&mut self, val: &XrFrame) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("frame"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.frame_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -121,17 +97,7 @@ impl XrInputSourceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn input_source(&mut self, val: &XrInputSource) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inputSource"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.input_source_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs index e72dfe27583..849c940a1ad 100644 --- a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs @@ -14,6 +14,19 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrInputSourcesChangeEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &XrInputSourcesChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &XrInputSourcesChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &XrInputSourcesChangeEventInit, val: bool); + #[wasm_bindgen(method, setter = "added")] + fn added_shim(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "removed")] + fn removed_shim(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "XrSession")] + #[wasm_bindgen(method, setter = "session")] + fn session_shim(this: &XrInputSourcesChangeEventInit, val: &XrSession); } #[cfg(web_sys_unstable_apis)] impl XrInputSourcesChangeEventInit { @@ -44,17 +57,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -65,17 +68,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -86,17 +79,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -107,13 +90,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn added(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("added"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.added_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -124,17 +101,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn removed(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("removed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.removed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -146,17 +113,7 @@ impl XrInputSourcesChangeEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn session(&mut self, val: &XrSession) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("session"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.session_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs index 8c494ca0a62..51d4adbfe9e 100644 --- a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs @@ -14,6 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &XrPermissionDescriptor, val: PermissionName); + #[cfg(feature = "XrSessionMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &XrPermissionDescriptor, val: XrSessionMode); + #[wasm_bindgen(method, setter = "optionalFeatures")] + fn optional_features_shim(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "requiredFeatures")] + fn required_features_shim(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl XrPermissionDescriptor { @@ -39,13 +49,7 @@ impl XrPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +61,7 @@ impl XrPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,17 +72,7 @@ impl XrPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("optionalFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.optional_features_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -95,17 +83,7 @@ impl XrPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requiredFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.required_features_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs index 46aa10bac48..4dbfb69ea22 100644 --- a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrReferenceSpaceEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &XrReferenceSpaceEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &XrReferenceSpaceEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &XrReferenceSpaceEventInit, val: bool); + #[cfg(feature = "XrReferenceSpace")] + #[wasm_bindgen(method, setter = "referenceSpace")] + fn reference_space_shim(this: &XrReferenceSpaceEventInit, val: &XrReferenceSpace); + #[cfg(feature = "XrRigidTransform")] + #[wasm_bindgen(method, setter = "transform")] + fn transform_shim(this: &XrReferenceSpaceEventInit, val: Option<&XrRigidTransform>); } #[cfg(web_sys_unstable_apis)] impl XrReferenceSpaceEventInit { @@ -38,17 +50,7 @@ impl XrReferenceSpaceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +61,7 @@ impl XrReferenceSpaceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +72,7 @@ impl XrReferenceSpaceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,17 +84,7 @@ impl XrReferenceSpaceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn reference_space(&mut self, val: &XrReferenceSpace) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("referenceSpace"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.reference_space_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -124,17 +96,7 @@ impl XrReferenceSpaceEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transform(&mut self, val: Option<&XrRigidTransform>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("transform"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.transform_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrRenderStateInit.rs b/crates/web-sys/src/features/gen_XrRenderStateInit.rs index df8f9b82fb9..7b982dfa1dc 100644 --- a/crates/web-sys/src/features/gen_XrRenderStateInit.rs +++ b/crates/web-sys/src/features/gen_XrRenderStateInit.rs @@ -14,6 +14,17 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrRenderStateInit; + #[cfg(feature = "XrWebGlLayer")] + #[wasm_bindgen(method, setter = "baseLayer")] + fn base_layer_shim(this: &XrRenderStateInit, val: Option<&XrWebGlLayer>); + #[wasm_bindgen(method, setter = "depthFar")] + fn depth_far_shim(this: &XrRenderStateInit, val: f64); + #[wasm_bindgen(method, setter = "depthNear")] + fn depth_near_shim(this: &XrRenderStateInit, val: f64); + #[wasm_bindgen(method, setter = "inlineVerticalFieldOfView")] + fn inline_vertical_field_of_view_shim(this: &XrRenderStateInit, val: f64); + #[wasm_bindgen(method, setter = "layers")] + fn layers_shim(this: &XrRenderStateInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl XrRenderStateInit { @@ -37,17 +48,7 @@ impl XrRenderStateInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn base_layer(&mut self, val: Option<&XrWebGlLayer>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("baseLayer"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.base_layer_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -58,17 +59,7 @@ impl XrRenderStateInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_far(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthFar"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_far_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -79,17 +70,7 @@ impl XrRenderStateInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth_near(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("depthNear"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_near_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -100,17 +81,7 @@ impl XrRenderStateInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn inline_vertical_field_of_view(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("inlineVerticalFieldOfView"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.inline_vertical_field_of_view_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -121,14 +92,7 @@ impl XrRenderStateInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn layers(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - use wasm_bindgen::JsValue; - let r = - ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("layers"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.layers_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionEventInit.rs b/crates/web-sys/src/features/gen_XrSessionEventInit.rs index 4a44c494526..56caaf616cf 100644 --- a/crates/web-sys/src/features/gen_XrSessionEventInit.rs +++ b/crates/web-sys/src/features/gen_XrSessionEventInit.rs @@ -14,6 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionEventInit; + #[wasm_bindgen(method, setter = "bubbles")] + fn bubbles_shim(this: &XrSessionEventInit, val: bool); + #[wasm_bindgen(method, setter = "cancelable")] + fn cancelable_shim(this: &XrSessionEventInit, val: bool); + #[wasm_bindgen(method, setter = "composed")] + fn composed_shim(this: &XrSessionEventInit, val: bool); + #[cfg(feature = "XrSession")] + #[wasm_bindgen(method, setter = "session")] + fn session_shim(this: &XrSessionEventInit, val: &XrSession); } #[cfg(web_sys_unstable_apis)] impl XrSessionEventInit { @@ -38,17 +47,7 @@ impl XrSessionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bubbles(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("bubbles"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.bubbles_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -59,17 +58,7 @@ impl XrSessionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn cancelable(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("cancelable"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.cancelable_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -80,17 +69,7 @@ impl XrSessionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn composed(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("composed"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.composed_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -102,17 +81,7 @@ impl XrSessionEventInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn session(&mut self, val: &XrSession) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("session"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.session_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionInit.rs b/crates/web-sys/src/features/gen_XrSessionInit.rs index 39cbbd43be3..8bc078da63c 100644 --- a/crates/web-sys/src/features/gen_XrSessionInit.rs +++ b/crates/web-sys/src/features/gen_XrSessionInit.rs @@ -14,6 +14,10 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionInit; + #[wasm_bindgen(method, setter = "optionalFeatures")] + fn optional_features_shim(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "requiredFeatures")] + fn required_features_shim(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl XrSessionInit { @@ -36,17 +40,7 @@ impl XrSessionInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("optionalFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.optional_features_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,17 +51,7 @@ impl XrSessionInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("requiredFeatures"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.required_features_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs index 8d354b79069..dc221e82d24 100644 --- a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs @@ -14,6 +14,12 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionSupportedPermissionDescriptor; + #[cfg(feature = "PermissionName")] + #[wasm_bindgen(method, setter = "name")] + fn name_shim(this: &XrSessionSupportedPermissionDescriptor, val: PermissionName); + #[cfg(feature = "XrSessionMode")] + #[wasm_bindgen(method, setter = "mode")] + fn mode_shim(this: &XrSessionSupportedPermissionDescriptor, val: XrSessionMode); } #[cfg(web_sys_unstable_apis)] impl XrSessionSupportedPermissionDescriptor { @@ -39,13 +45,7 @@ impl XrSessionSupportedPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(&mut self, val: PermissionName) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("name"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.name_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -57,13 +57,7 @@ impl XrSessionSupportedPermissionDescriptor { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("mode"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.mode_shim(val); self } } diff --git a/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs b/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs index 6de05291636..9fe4ef7a073 100644 --- a/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs +++ b/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs @@ -14,6 +14,18 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrWebGlLayerInit; + #[wasm_bindgen(method, setter = "alpha")] + fn alpha_shim(this: &XrWebGlLayerInit, val: bool); + #[wasm_bindgen(method, setter = "antialias")] + fn antialias_shim(this: &XrWebGlLayerInit, val: bool); + #[wasm_bindgen(method, setter = "depth")] + fn depth_shim(this: &XrWebGlLayerInit, val: bool); + #[wasm_bindgen(method, setter = "framebufferScaleFactor")] + fn framebuffer_scale_factor_shim(this: &XrWebGlLayerInit, val: f64); + #[wasm_bindgen(method, setter = "ignoreDepthValues")] + fn ignore_depth_values_shim(this: &XrWebGlLayerInit, val: bool); + #[wasm_bindgen(method, setter = "stencil")] + fn stencil_shim(this: &XrWebGlLayerInit, val: bool); } #[cfg(web_sys_unstable_apis)] impl XrWebGlLayerInit { @@ -36,13 +48,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn alpha(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.alpha_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -53,17 +59,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn antialias(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("antialias"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.antialias_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -74,13 +70,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn depth(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("depth"), &JsValue::from(val)); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.depth_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -91,17 +81,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn framebuffer_scale_factor(&mut self, val: f64) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("framebufferScaleFactor"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.framebuffer_scale_factor_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -112,17 +92,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ignore_depth_values(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("ignoreDepthValues"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.ignore_depth_values_shim(val); self } #[cfg(web_sys_unstable_apis)] @@ -133,17 +103,7 @@ impl XrWebGlLayerInit { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stencil(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("stencil"), - &JsValue::from(val), - ); - debug_assert!( - r.is_ok(), - "setting properties should never fail on our dictionary objects" - ); - let _ = r; + self.stencil_shim(val); self } } diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index cf7e942cdc8..db8cff532ac 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -1,12 +1,15 @@ use proc_macro2::Literal; use proc_macro2::TokenStream; +use quote::format_ident; use quote::quote; use std::collections::BTreeSet; use syn::{Ident, Type}; +use wasm_bindgen_backend::util::leading_colon_path_ty; use wasm_bindgen_backend::util::{raw_ident, rust_ident}; use crate::constants::{BUILTIN_IDENTS, POLYFILL_INTERFACES}; use crate::traverse::TraverseType; +use crate::util::shared_ref; use crate::util::{get_cfg_features, mdn_doc, required_doc_string, snake_case_ident}; use crate::Options; @@ -625,16 +628,50 @@ pub struct DictionaryField { pub name: Ident, pub js_name: String, pub ty: Type, + pub is_js_value_ref_option_type: bool, pub required: bool, pub unstable: bool, } impl DictionaryField { - fn generate_rust(&self, options: &Options, parent_name: String) -> TokenStream { + fn generate_rust_shim( + &self, + parent_ident: &Ident, + cfg_features: &Option, + ) -> TokenStream { + let ty = &self.ty; + let shim_name = self.shim_name(); + let js_name = &self.js_name; + + let js_value_ref_type = shared_ref( + leading_colon_path_ty(vec![rust_ident("wasm_bindgen"), rust_ident("JsValue")]), + false, + ); + + let ty = if self.is_js_value_ref_option_type { + js_value_ref_type + } else { + ty.clone() + }; + + quote! { + #cfg_features + #[wasm_bindgen(method, setter = #js_name)] + fn #shim_name(this: &#parent_ident, val: #ty); + } + } + + fn generate_rust_setter( + &self, + options: &Options, + features: &BTreeSet, + cfg_features: &Option, + ) -> TokenStream { let DictionaryField { name, js_name, ty, + is_js_value_ref_option_type: _, required: _, unstable, } = self; @@ -642,39 +679,52 @@ impl DictionaryField { let unstable_attr = maybe_unstable_attr(*unstable); let unstable_docs = maybe_unstable_docs(*unstable); - let mut features = BTreeSet::new(); - - add_features(&mut features, ty); - - features.remove(&parent_name); - - let cfg_features = get_cfg_features(options, &features); - - features.insert(parent_name); - let doc_comment = comment( format!("Change the `{}` field of this object.", js_name), - &required_doc_string(options, &features), + &required_doc_string(options, features), ); + let shim_name = self.shim_name(); + + let shim_args = if self.is_js_value_ref_option_type { + quote! { val.unwrap_or(&::wasm_bindgen::JsValue::NULL) } + } else { + quote! { val } + }; + quote! { #unstable_attr #cfg_features #doc_comment #unstable_docs pub fn #name(&mut self, val: #ty) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from(#js_name), - &JsValue::from(val), - ); - debug_assert!(r.is_ok(), "setting properties should never fail on our dictionary objects"); - let _ = r; + self.#shim_name(#shim_args); self } } } + + fn features( + &self, + options: &Options, + parent_name: String, + ) -> (BTreeSet, Option) { + let mut features = BTreeSet::new(); + + add_features(&mut features, &self.ty); + + features.remove(&parent_name); + + let cfg_features = get_cfg_features(options, &features); + + features.insert(parent_name); + + (features, cfg_features) + } + + fn shim_name(&self) -> Ident { + format_ident!("{}_shim", self.name) + } } pub struct Dictionary { @@ -727,9 +777,24 @@ impl Dictionary { &required_doc_string(options, &required_features), ); + let (field_features, field_cfg_features): (Vec<_>, Vec<_>) = fields + .iter() + .map(|field| field.features(options, name.to_string())) + .unzip(); + + let field_shims = fields + .iter() + .zip(field_cfg_features.iter()) + .map(|(field, cfg_features)| field.generate_rust_shim(name, cfg_features)) + .collect::>(); + let fields = fields .iter() - .map(|field| field.generate_rust(options, name.to_string())) + .zip(field_features.iter()) + .zip(field_cfg_features.iter()) + .map(|((field, features), cfg_features)| { + field.generate_rust_setter(options, features, cfg_features) + }) .collect::>(); let mut base_stream = quote! { @@ -746,6 +811,8 @@ impl Dictionary { #doc_comment #unstable_docs pub type #name; + + #(#field_shims)* } #unstable_attr diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 21c93f32eec..6bd02dfcdee 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -30,6 +30,7 @@ use crate::util::{ }; use anyhow::Context; use anyhow::Result; +use idl_type::IdlType; use proc_macro2::{Ident, TokenStream}; use quote::ToTokens; use sourcefile::SourceFile; @@ -376,10 +377,22 @@ impl<'src> FirstPassRecord<'src> { false => is_type_unstable(&field.type_, unstable_types), }; + let idl_type = field.type_.to_idl_type(self); + + let is_js_value_ref_option_type = match &idl_type { + idl_type::IdlType::Nullable(ty) => match **ty { + idl_type::IdlType::Any => true, + IdlType::FrozenArray(ref _idl_type) | IdlType::Sequence(ref _idl_type) => true, + idl_type::IdlType::Union(ref types) => !types + .iter() + .all(|idl_type| matches!(idl_type, IdlType::Interface(..))), + _ => false, + }, + _ => false, + }; + // use argument position now as we're just binding setters - let ty = field - .type_ - .to_idl_type(self) + let ty = idl_type .to_syn_type(TypePosition::Argument) .unwrap_or(None)?; @@ -424,6 +437,7 @@ impl<'src> FirstPassRecord<'src> { name: rust_ident(&snake_case_ident(field.identifier.0)), js_name: field.identifier.0.to_string(), ty, + is_js_value_ref_option_type, unstable: unstable_override, }) } @@ -767,6 +781,7 @@ impl<'src> FirstPassRecord<'src> { .to_syn_type(pos) .unwrap() .unwrap(), + is_js_value_ref_option_type: false, unstable: false, }) } From 7d0b11c80e35f9ba94187e2033647d226ef0bfa8 Mon Sep 17 00:00:00 2001 From: ZGY Date: Wed, 10 Apr 2024 14:43:15 +0800 Subject: [PATCH 393/641] Support expr when use `typescript_custom_section` attribute (#3901) * feat: support expr when use `typescript_custom_section` attribute * test: update typescript-tests * chore: update "APPROVED_SCHEMA_FILE_HASH" of shared lib * chore: cargo fmt * Apply suggestions from code review include fix typo and adding whitespace to ensure consistent code style. Co-authored-by: Liam Murphy * chore(backend): fix typo * chore(typescript-tests): rename custom_section_type to custom_section_type.d.ts * fix(backend/codegen): change method flat_slices to flat_byte_slices in order to avoid unsafe code * fix(backend/codegen): use dynamic wasm_bindgen path as import entry * chore(typescript-tests): ignore *.d.ts file when test * chore(shared/program): rename CustomSection to LitOrExpr * doc(shared/lib): add doc for program[typescript_custom_sections], explain why there are different types of LitOrExpr when encoding and decoding * chore(shared): update "APPROVED_SCHEMA_FILE_HASH" of shared lib * doc: add docs for method encode_u32_to_fixed_len_bytes * refactor(backend/encode): rename method shared_typescript_custom_section to shared_lit_or_expr * refactor(__rt): extract methods from nested mod directly into `__rt` * chore: cargo fmt * chore(__rt): remove unnecessary TODO * chore(changelog): update change log Support Expressions when using the `typescript_custom_section` attribute[#3901] * Update CHANGELOG.md --- CHANGELOG.md | 3 + crates/backend/src/ast.rs | 12 +++- crates/backend/src/codegen.rs | 68 ++++++++++++++++--- crates/backend/src/encode.rs | 60 +++++++++++++--- crates/cli-support/src/decode.rs | 20 +++++- crates/cli-support/src/wit/mod.rs | 6 +- crates/macro-support/src/parser.rs | 16 ++--- crates/shared/src/lib.rs | 6 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/typescript-tests/jest.config.cjs | 2 +- crates/typescript-tests/src/custom_section.rs | 7 ++ crates/typescript-tests/src/custom_section.ts | 8 ++- .../src/custom_section_types.d.ts | 3 + src/lib.rs | 46 +++++++++++++ 14 files changed, 219 insertions(+), 40 deletions(-) create mode 100644 crates/typescript-tests/src/custom_section_types.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f5cf57ea7e0..677a338c0ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Added support for arbitrary expressions when using `#[wasm_bindgen(typescript_custom_section)]`. + [#3901](https://github.com/rustwasm/wasm-bindgen/pull/3901) + * Implement `From>` for `JsValue`. [#3877](https://github.com/rustwasm/wasm-bindgen/pull/3877) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 95c62d63bd8..5c6555315c4 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -24,7 +24,7 @@ pub struct Program { /// rust structs pub structs: Vec, /// custom typescript sections to be included in the definition file - pub typescript_custom_sections: Vec, + pub typescript_custom_sections: Vec, /// Inline JS snippets pub inline_js: Vec, /// Path to wasm_bindgen @@ -460,6 +460,16 @@ pub enum TypeLocation { ExportRet, } +/// An enum representing either a literal value (`Lit`) or an expression (`syn::Expr`). +#[cfg_attr(feature = "extra-traits", derive(Debug))] +#[derive(Clone)] +pub enum LitOrExpr { + /// Represents an expression that needs to be evaluated before it can be encoded + Expr(syn::Expr), + /// Represents a literal string that can be directly encoded. + Lit(String), +} + impl Export { /// Mangles a rust -> javascript export, so that the created Ident will be unique over function /// name and class name, if the function belongs to a javascript class. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 65c8cd08915..bae386fc476 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1,5 +1,6 @@ use crate::ast; use crate::encode; +use crate::encode::EncodeChunk; use crate::Diagnostic; use once_cell::sync::Lazy; use proc_macro2::{Ident, Literal, Span, TokenStream}; @@ -94,17 +95,51 @@ impl TryToTokens for ast::Program { shared::SCHEMA_VERSION, shared::version() ); + + let wasm_bindgen = &self.wasm_bindgen; + let encoded = encode::encode(self)?; - let len = prefix_json.len() as u32; - let bytes = [ - &len.to_le_bytes()[..], - prefix_json.as_bytes(), - &encoded.custom_section, - ] - .concat(); - let generated_static_length = bytes.len(); - let generated_static_value = syn::LitByteStr::new(&bytes, Span::call_site()); + let encoded_chunks: Vec<_> = encoded + .custom_section + .iter() + .map(|chunk| match chunk { + EncodeChunk::EncodedBuf(buf) => { + let buf = syn::LitByteStr::new(buf.as_slice(), Span::call_site()); + quote!(#buf) + } + EncodeChunk::StrExpr(expr) => { + // encode expr as str + quote!({ + use #wasm_bindgen::__rt::{encode_u32_to_fixed_len_bytes}; + const _STR_EXPR: &str = #expr; + const _STR_EXPR_BYTES: &[u8] = _STR_EXPR.as_bytes(); + const _STR_EXPR_BYTES_LEN: usize = _STR_EXPR_BYTES.len() + 5; + const _ENCODED_BYTES: [u8; _STR_EXPR_BYTES_LEN] = flat_byte_slices([ + &encode_u32_to_fixed_len_bytes(_STR_EXPR_BYTES.len() as u32), + _STR_EXPR_BYTES, + ]); + &_ENCODED_BYTES + }) + } + }) + .collect(); + + let chunk_len = encoded_chunks.len(); + + // concatenate all encoded chunks and write the length in front of the chunk; + let encode_bytes = quote!({ + const _CHUNK_SLICES: [&[u8]; #chunk_len] = [ + #(#encoded_chunks,)* + ]; + const _CHUNK_LEN: usize = flat_len(_CHUNK_SLICES); + const _CHUNKS: [u8; _CHUNK_LEN] = flat_byte_slices(_CHUNK_SLICES); + + const _LEN_BYTES: [u8; 4] = (_CHUNK_LEN as u32).to_le_bytes(); + const _ENCODED_BYTES_LEN: usize = _CHUNK_LEN + 4; + const _ENCODED_BYTES: [u8; _ENCODED_BYTES_LEN] = flat_byte_slices([&_LEN_BYTES, &_CHUNKS]); + &_ENCODED_BYTES + }); // We already consumed the contents of included files when generating // the custom section, but we want to make sure that updates to the @@ -119,15 +154,26 @@ impl TryToTokens for ast::Program { quote! { include_str!(#file) } }); + let len = prefix_json.len() as u32; + let prefix_json_bytes = [&len.to_le_bytes()[..], prefix_json.as_bytes()].concat(); + let prefix_json_bytes = syn::LitByteStr::new(&prefix_json_bytes, Span::call_site()); + (quote! { #[cfg(target_arch = "wasm32")] #[automatically_derived] const _: () = { + use #wasm_bindgen::__rt::{flat_len, flat_byte_slices}; + static _INCLUDED_FILES: &[&str] = &[#(#file_dependencies),*]; + const _ENCODED_BYTES: &[u8] = #encode_bytes; + const _PREFIX_JSON_BYTES: &[u8] = #prefix_json_bytes; + const _ENCODED_BYTES_LEN: usize = _ENCODED_BYTES.len(); + const _PREFIX_JSON_BYTES_LEN: usize = _PREFIX_JSON_BYTES.len(); + const _LEN: usize = _PREFIX_JSON_BYTES_LEN + _ENCODED_BYTES_LEN; + #[link_section = "__wasm_bindgen_unstable"] - pub static _GENERATED: [u8; #generated_static_length] = - *#generated_static_value; + static _GENERATED: [u8; _LEN] = flat_byte_slices([_PREFIX_JSON_BYTES, _ENCODED_BYTES]); }; }) .to_tokens(tokens); diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 9341ac170dd..9c06aedb168 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -9,8 +9,15 @@ use std::path::PathBuf; use crate::ast; use crate::Diagnostic; +#[derive(Clone)] +pub enum EncodeChunk { + EncodedBuf(Vec), + StrExpr(syn::Expr), + // TODO: support more expr type; +} + pub struct EncodeResult { - pub custom_section: Vec, + pub custom_section: Vec, pub included_files: Vec, } @@ -144,7 +151,7 @@ fn shared_program<'a>( typescript_custom_sections: prog .typescript_custom_sections .iter() - .map(|x| -> &'a str { x }) + .map(|x| shared_lit_or_expr(x, intern)) .collect(), linked_modules: prog .linked_modules @@ -253,6 +260,13 @@ fn shared_import<'a>(i: &'a ast::Import, intern: &'a Interner) -> Result(i: &'a ast::LitOrExpr, _intern: &'a Interner) -> LitOrExpr<'a> { + match i { + ast::LitOrExpr::Lit(lit) => LitOrExpr::Lit(lit), + ast::LitOrExpr::Expr(expr) => LitOrExpr::Expr(expr), + } +} + fn shared_linked_module<'a>( name: &str, i: &'a ast::ImportModule, @@ -358,24 +372,48 @@ trait Encode { } struct Encoder { - dst: Vec, + dst: Vec, +} + +enum LitOrExpr<'a> { + Expr(&'a syn::Expr), + Lit(&'a str), +} + +impl<'a> Encode for LitOrExpr<'a> { + fn encode(&self, dst: &mut Encoder) { + match self { + LitOrExpr::Expr(expr) => { + dst.dst.push(EncodeChunk::StrExpr((*expr).clone())); + } + LitOrExpr::Lit(s) => s.encode(dst), + } + } } impl Encoder { fn new() -> Encoder { - Encoder { - dst: vec![0, 0, 0, 0], - } + Encoder { dst: vec![] } } - fn finish(mut self) -> Vec { - let len = (self.dst.len() - 4) as u32; - self.dst[..4].copy_from_slice(&len.to_le_bytes()[..]); + fn finish(self) -> Vec { self.dst } fn byte(&mut self, byte: u8) { - self.dst.push(byte); + if let Some(EncodeChunk::EncodedBuf(buf)) = self.dst.last_mut() { + buf.push(byte); + } else { + self.dst.push(EncodeChunk::EncodedBuf(vec![byte])); + } + } + + fn extend_from_slice(&mut self, slice: &[u8]) { + if let Some(EncodeChunk::EncodedBuf(buf)) = self.dst.last_mut() { + buf.extend_from_slice(slice); + } else { + self.dst.push(EncodeChunk::EncodedBuf(slice.to_owned())); + } } } @@ -407,7 +445,7 @@ impl Encode for usize { impl<'a> Encode for &'a [u8] { fn encode(&self, dst: &mut Encoder) { self.len().encode(dst); - dst.dst.extend_from_slice(self); + dst.extend_from_slice(self); } } diff --git a/crates/cli-support/src/decode.rs b/crates/cli-support/src/decode.rs index a212147d3fd..4264939f5c4 100644 --- a/crates/cli-support/src/decode.rs +++ b/crates/cli-support/src/decode.rs @@ -1,4 +1,4 @@ -use std::str; +use std::{ops::Deref, str}; pub trait Decode<'src>: Sized { fn decode(data: &mut &'src [u8]) -> Self; @@ -10,12 +10,30 @@ pub trait Decode<'src>: Sized { } } +pub struct LitOrExpr<'src> { + str: &'src str, +} + fn get(b: &mut &[u8]) -> u8 { let r = b[0]; *b = &b[1..]; r } +impl<'src> Deref for LitOrExpr<'src> { + type Target = str; + fn deref(&self) -> &Self::Target { + self.str + } +} + +impl<'src> Decode<'src> for LitOrExpr<'src> { + fn decode(data: &mut &'src [u8]) -> Self { + let str = <&'src str>::decode(data); + Self { str } + } +} + impl<'src> Decode<'src> for bool { fn decode(data: &mut &'src [u8]) -> Self { get(data) != 0 diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index ca0211478b8..45333858f33 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -455,7 +455,7 @@ impl<'a> Context<'a> { self.struct_(struct_)?; } for section in typescript_custom_sections { - self.aux.extra_typescript.push_str(section); + self.aux.extra_typescript.push_str(§ion); self.aux.extra_typescript.push_str("\n\n"); } self.aux @@ -1536,14 +1536,14 @@ version of wasm-bindgen that uses a different bindgen format than this binary: this binary schema version: {my_version} Currently the bindgen format is unstable enough that these two schema versions -must exactly match. You can accomplish this by either updating this binary or +must exactly match. You can accomplish this by either updating this binary or the wasm-bindgen dependency in the Rust project. You should be able to update the wasm-bindgen dependency with: cargo update -p wasm-bindgen --precise {my_version} -don't forget to recompile your wasm file! Alternatively, you can update the +don't forget to recompile your wasm file! Alternatively, you can update the binary with: cargo install -f wasm-bindgen-cli --version {their_version} diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 2b161c04c3b..af9b38cf1a7 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1404,17 +1404,17 @@ impl MacroParse for syn::ItemConst { bail_span!(self, "#[wasm_bindgen] will not work on constants unless you are defining a #[wasm_bindgen(typescript_custom_section)]."); } - match get_expr(&self.expr) { + let typescript_custom_section = match get_expr(&self.expr) { syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(litstr), .. - }) => { - program.typescript_custom_sections.push(litstr.value()); - } - expr => { - bail_span!(expr, "Expected a string literal to be used with #[wasm_bindgen(typescript_custom_section)]."); - } - } + }) => ast::LitOrExpr::Lit(litstr.value()), + expr => ast::LitOrExpr::Expr(expr.clone()), + }; + + program + .typescript_custom_sections + .push(typescript_custom_section); opts.check_used(); diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index f8ad45c7cd3..eeadecbfec5 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -17,7 +17,11 @@ macro_rules! shared_api { enums: Vec>, imports: Vec>, structs: Vec>, - typescript_custom_sections: Vec<&'a str>, + // NOTE: Originally typescript_custom_sections are just some strings + // But the expression type can only be parsed into a string during compilation + // So when encoding, LitOrExpr contains two types, one is that expressions are parsed into strings during compilation, and the other is can be parsed directly. + // When decoding, LitOrExpr can be decoded as a string. + typescript_custom_sections: Vec>, local_modules: Vec>, inline_js: Vec<&'a str>, unique_crate_identifier: &'a str, diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 471ccc9beac..143f8483c7b 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "11955579329744078753"; +const APPROVED_SCHEMA_FILE_HASH: &str = "10197913343580353876"; #[test] fn schema_version() { diff --git a/crates/typescript-tests/jest.config.cjs b/crates/typescript-tests/jest.config.cjs index 2db7cd7178d..31ee1910442 100644 --- a/crates/typescript-tests/jest.config.cjs +++ b/crates/typescript-tests/jest.config.cjs @@ -4,7 +4,7 @@ module.exports = { testEnvironment: 'node', extensionsToTreatAsEsm: [".ts"], verbose: true, - testMatch: ['**/src/*.ts'], + testMatch: ['**/src/*.ts', '!**/src/*.d.ts'], // TODO: migrate all test files and remove this testPathIgnorePatterns: [ ".*/src/custom_section.ts$", diff --git a/crates/typescript-tests/src/custom_section.rs b/crates/typescript-tests/src/custom_section.rs index d4b602677f7..68c748c89c7 100644 --- a/crates/typescript-tests/src/custom_section.rs +++ b/crates/typescript-tests/src/custom_section.rs @@ -5,6 +5,13 @@ const TS_INTERFACE_EXPORT: &'static str = r" interface Height { height: number; } "; +#[wasm_bindgen(typescript_custom_section)] +const TS_INTERFACE_EXPORT1: &'static str = include_str!("./custom_section_types.d.ts"); + +const TS_INTERFACE_EXPORT2: &str = "interface Person2 { height: number; }"; +#[wasm_bindgen(typescript_custom_section)] +const _: &str = TS_INTERFACE_EXPORT2; + #[wasm_bindgen] pub struct Person { pub height: u32, diff --git a/crates/typescript-tests/src/custom_section.ts b/crates/typescript-tests/src/custom_section.ts index 6420ea6dd59..cb3c826a80d 100644 --- a/crates/typescript-tests/src/custom_section.ts +++ b/crates/typescript-tests/src/custom_section.ts @@ -1,3 +1,7 @@ -import * as wbg from '../pkg/typescript_tests'; +import * as wbg from "../pkg/typescript_tests" -const height: wbg.Height = new wbg.Person(); \ No newline at end of file +const height: wbg.Height = new wbg.Person() + +const height1: wbg.Person1 = new wbg.Person() + +const height2: wbg.Person2 = new wbg.Person() diff --git a/crates/typescript-tests/src/custom_section_types.d.ts b/crates/typescript-tests/src/custom_section_types.d.ts new file mode 100644 index 00000000000..b3552d07ce1 --- /dev/null +++ b/crates/typescript-tests/src/custom_section_types.d.ts @@ -0,0 +1,3 @@ +interface Person1 { + height: number +} diff --git a/src/lib.rs b/src/lib.rs index accc371075c..c4f41d0e357 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1820,6 +1820,52 @@ pub mod __rt { } } + pub const fn flat_len(slices: [&[T]; SIZE]) -> usize { + let mut len = 0; + let mut i = 0; + while i < slices.len() { + len += slices[i].len(); + i += 1; + } + len + } + + pub const fn flat_byte_slices( + slices: [&[u8]; SIZE], + ) -> [u8; RESULT_LEN] { + let mut result = [0; RESULT_LEN]; + + let mut slice_index = 0; + let mut result_offset = 0; + + while slice_index < slices.len() { + let mut i = 0; + let slice = slices[slice_index]; + while i < slice.len() { + result[result_offset] = slice[i]; + i += 1; + result_offset += 1; + } + slice_index += 1; + } + + result + } + + // NOTE: This method is used to encode u32 into a variable-length-integer during the compile-time . + // Generally speaking, the length of the encoded variable-length-integer depends on the size of the integer + // but the maximum capacity can be used here to simplify the amount of code during the compile-time . + pub const fn encode_u32_to_fixed_len_bytes(value: u32) -> [u8; 5] { + let mut result: [u8; 5] = [0; 5]; + let mut i = 0; + while i < 4 { + result[i] = ((value >> (7 * i)) | 0x80) as u8; + i += 1; + } + result[4] = (value >> (7 * 4)) as u8; + result + } + if_std! { use core::mem; use std::boxed::Box; From 134fdda8079e5c3c5d58d84dd4bc2397350174bb Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 18 Apr 2024 23:57:02 +0200 Subject: [PATCH 394/641] Fix MSRV compilation (#3927) --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 6 +++--- src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 677a338c0ff..4b5cb92a78e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ * Fix `catch` not being thread-safe. [#3879](https://github.com/rustwasm/wasm-bindgen/pull/3879) +* Fix MSRV compilation. + [#3927](https://github.com/rustwasm/wasm-bindgen/pull/3927) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index bae386fc476..0749a4f69ed 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1716,9 +1716,9 @@ fn splat( let mut args = Vec::new(); let mut names = Vec::new(); - for n in 1..=4 { - let arg_name = format_ident!("{name}_{n}"); - let prim_name = format_ident!("Prim{n}"); + for n in 1_u32..=4 { + let arg_name = format_ident!("{}_{}", name, n); + let prim_name = format_ident!("Prim{}", n); args.push(quote! { #arg_name: <#abi as #wasm_bindgen::convert::WasmAbi>::#prim_name }); diff --git a/src/lib.rs b/src/lib.rs index c4f41d0e357..f09bec2d213 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1820,7 +1820,7 @@ pub mod __rt { } } - pub const fn flat_len(slices: [&[T]; SIZE]) -> usize { + pub const fn flat_len(slices: [&[T]; SIZE]) -> usize { let mut len = 0; let mut i = 0; while i < slices.len() { From e78db23553e70a48767a9bafaac3a4ffb4cba08d Mon Sep 17 00:00:00 2001 From: redismongo <166003694+redismongo@users.noreply.github.com> Date: Fri, 19 Apr 2024 05:57:16 +0800 Subject: [PATCH 395/641] chore: fix some comments (#3913) Signed-off-by: redismongo --- crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs | 2 +- crates/web-sys/webidls/enabled/Navigator.webidl | 2 +- examples/raytrace-parallel/src/pool.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index c001344c602..f111902f73f 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -343,7 +343,7 @@ enum Method<'a> { } // Below here is a bunch of details of the WebDriver protocol implementation. -// I'm not too too familiar with them myself, but these seem to work! I mostly +// I'm not too familiar with them myself, but these seem to work! I mostly // copied the `webdriver-client` crate when writing the below bindings. impl Client { diff --git a/crates/web-sys/webidls/enabled/Navigator.webidl b/crates/web-sys/webidls/enabled/Navigator.webidl index 61c5b019e2e..e06c383b848 100644 --- a/crates/web-sys/webidls/enabled/Navigator.webidl +++ b/crates/web-sys/webidls/enabled/Navigator.webidl @@ -106,7 +106,7 @@ partial interface Navigator { readonly attribute Permissions permissions; }; -// Things that definitely need to be in the spec and and are not for some +// Things that definitely need to be in the spec and are not for some // reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406 partial interface Navigator { [Throws] diff --git a/examples/raytrace-parallel/src/pool.rs b/examples/raytrace-parallel/src/pool.rs index 37ef4518c00..7c7118d771c 100644 --- a/examples/raytrace-parallel/src/pool.rs +++ b/examples/raytrace-parallel/src/pool.rs @@ -67,7 +67,7 @@ impl WorkerPool { /// message is sent to it. fn spawn(&self) -> Result { console_log!("spawning new worker"); - // TODO: what do do about `./worker.js`: + // TODO: what to do about `./worker.js`: // // * the path is only known by the bundler. How can we, as a // library, know what's going on? From ad251c06a6672ae94ece611d120c44981eec7864 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 7 May 2024 20:30:12 +1000 Subject: [PATCH 396/641] Fix CI failures introduced by Rust 1.78 (except `clippy::empty_docs`) (#3949) * Fix clippy/cargo warnings introduced by Rust 1.78 * Update reference tests --- .cargo/{config => config.toml} | 2 -- benchmarks/Cargo.toml | 1 + crates/cli-support/src/js/mod.rs | 9 +++++---- crates/cli/tests/reference/add.wat | 2 +- crates/cli/tests/reference/anyref-empty.wat | 2 +- crates/cli/tests/reference/anyref-import-catch.wat | 2 +- crates/cli/tests/reference/anyref-nop.wat | 2 +- crates/cli/tests/reference/builder.wat | 2 +- crates/cli/tests/reference/constructor.wat | 2 +- crates/cli/tests/reference/empty.wat | 2 +- crates/cli/tests/reference/enums.wat | 2 +- crates/cli/tests/reference/import-catch.wat | 2 +- crates/cli/tests/reference/nop.wat | 2 +- crates/cli/tests/reference/pointers.wat | 2 +- crates/cli/tests/reference/result-string.wat | 2 +- crates/cli/tests/reference/skip-jsdoc.wat | 2 +- crates/cli/tests/reference/string-arg.wat | 2 +- tests/wasm/slice.rs | 1 + 18 files changed, 21 insertions(+), 20 deletions(-) rename .cargo/{config => config.toml} (83%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 83% rename from .cargo/config rename to .cargo/config.toml index 84246cbfb1a..cf1995cbc32 100644 --- a/.cargo/config +++ b/.cargo/config.toml @@ -1,5 +1,3 @@ -# TODO: we shouldn't check this in to git, need to figure out how to avoid doing -# that. [target.wasm32-unknown-unknown] runner = 'cargo run -p wasm-bindgen-cli --bin wasm-bindgen-test-runner --' diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index cc526bd55db..1321bf7e38a 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -2,6 +2,7 @@ name = "wasm-bindgen-benchmark" version = "0.1.0" authors = ["The wasm-bindgen Developers"] +edition = "2018" rust-version = "1.57" [dependencies] diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 39c33c7803c..8c270186bf7 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2797,15 +2797,15 @@ impl<'a> Context<'a> { match &js.name { JsImportName::Module { module, name } => { let import = self.module.imports.get_mut(id); - import.module = module.clone(); - import.name = name.clone(); + import.module.clone_from(module); + import.name.clone_from(name); return Ok(true); } JsImportName::LocalModule { module, name } => { let module = self.config.local_module_name(module); let import = self.module.imports.get_mut(id); import.module = module; - import.name = name.clone(); + import.name.clone_from(name); return Ok(true); } JsImportName::InlineJs { @@ -2818,7 +2818,7 @@ impl<'a> Context<'a> { .inline_js_module_name(unique_crate_identifier, *snippet_idx_in_crate); let import = self.module.imports.get_mut(id); import.module = module; - import.name = name.clone(); + import.name.clone_from(name); return Ok(true); } @@ -4133,6 +4133,7 @@ impl ExportedClass { } } + #[allow(clippy::assigning_clones)] // Clippy's suggested fix doesn't work at MSRV. fn push_accessor_ts( &mut self, docs: &str, diff --git a/crates/cli/tests/reference/add.wat b/crates/cli/tests/reference/add.wat index 63ac9eaee5b..b285488bd1a 100644 --- a/crates/cli/tests/reference/add.wat +++ b/crates/cli/tests/reference/add.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32 i32) (result i32))) (func $add_u32 (;0;) (type 0) (param i32 i32) (result i32)) (func $add_i32 (;1;) (type 0) (param i32 i32) (result i32)) diff --git a/crates/cli/tests/reference/anyref-empty.wat b/crates/cli/tests/reference/anyref-empty.wat index cbea17aa06d..d8de8796570 100644 --- a/crates/cli/tests/reference/anyref-empty.wat +++ b/crates/cli/tests/reference/anyref-empty.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func)) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (table (;0;) 128 externref) diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 16adbbe6783..725fd35ef88 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32))) diff --git a/crates/cli/tests/reference/anyref-nop.wat b/crates/cli/tests/reference/anyref-nop.wat index eb547fdf02f..a410ecd9aac 100644 --- a/crates/cli/tests/reference/anyref-nop.wat +++ b/crates/cli/tests/reference/anyref-nop.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func)) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $foo (;1;) (type 0)) diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index c6761d480fd..0e9d738dcda 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (func $classbuilder_builder (;0;) (type 0) (result i32)) diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index bad14a1de88..f6d7e3badc2 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (func $classconstructor_new (;0;) (type 0) (result i32)) diff --git a/crates/cli/tests/reference/empty.wat b/crates/cli/tests/reference/empty.wat index 887f8cfa07c..78e5118949a 100644 --- a/crates/cli/tests/reference/empty.wat +++ b/crates/cli/tests/reference/empty.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (memory (;0;) 16) (export "memory" (memory 0)) ) diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index 2cfcab3718b..4928e4e4338 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32) (result i32))) (func $enum_echo (;0;) (type 0) (param i32) (result i32)) (func $option_enum_echo (;1;) (type 0) (param i32) (result i32)) diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import-catch.wat index 614e0b61b3c..2c00b9253d0 100644 --- a/crates/cli/tests/reference/import-catch.wat +++ b/crates/cli/tests/reference/import-catch.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32))) (type (;1;) (func (param i32) (result i32))) (func $exported (;0;) (type 0) (param i32)) diff --git a/crates/cli/tests/reference/nop.wat b/crates/cli/tests/reference/nop.wat index 82c51874819..27e6124af3b 100644 --- a/crates/cli/tests/reference/nop.wat +++ b/crates/cli/tests/reference/nop.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func)) (func $nop (;0;) (type 0)) (memory (;0;) 17) diff --git a/crates/cli/tests/reference/pointers.wat b/crates/cli/tests/reference/pointers.wat index e624bd832fc..a011881f11f 100644 --- a/crates/cli/tests/reference/pointers.wat +++ b/crates/cli/tests/reference/pointers.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32) (result i32))) (func $const_pointer (;0;) (type 0) (param i32) (result i32)) (func $mut_pointer (;1;) (type 0) (param i32) (result i32)) diff --git a/crates/cli/tests/reference/result-string.wat b/crates/cli/tests/reference/result-string.wat index ff21a91d969..c887f70d2c4 100644 --- a/crates/cli/tests/reference/result-string.wat +++ b/crates/cli/tests/reference/result-string.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32))) (type (;1;) (func (param i32) (result i32))) (type (;2;) (func (param i32 i32 i32))) diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index 31d66a20de3..c4e8b32b131 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32) (result i32))) (func $docme (;0;) (type 0) (param i32) (result i32)) (memory (;0;) 17) diff --git a/crates/cli/tests/reference/string-arg.wat b/crates/cli/tests/reference/string-arg.wat index 120d0f15af4..759fe869e0b 100644 --- a/crates/cli/tests/reference/string-arg.wat +++ b/crates/cli/tests/reference/string-arg.wat @@ -1,4 +1,4 @@ -(module +(module $reference_test.wasm (type (;0;) (func (param i32 i32))) (type (;1;) (func (param i32 i32) (result i32))) (type (;2;) (func (param i32 i32 i32 i32) (result i32))) diff --git a/tests/wasm/slice.rs b/tests/wasm/slice.rs index 9f9066fe720..15e9a9ac2e9 100644 --- a/tests/wasm/slice.rs +++ b/tests/wasm/slice.rs @@ -233,6 +233,7 @@ impl ReturnVecApplication { ReturnVecApplication { thing } } + #[allow(clippy::assigning_clones)] // false positive, should be fixed by https://github.com/rust-lang/rust-clippy/pull/12756 pub fn tick(&mut self) { self.thing = self.thing.clone(); } From 73e5a8c482e030c735610e3d2f4baca04fa9c274 Mon Sep 17 00:00:00 2001 From: Kevin Flansburg Date: Tue, 7 May 2024 23:59:11 -0400 Subject: [PATCH 397/641] Fix `clippy` lint `empty_docs` (#3946) * Do not include docstring if empty Closes #3945 * Move changelog entry to correct section --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5cb92a78e..6d9bee5f624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Fix MSRV compilation. [#3927](https://github.com/rustwasm/wasm-bindgen/pull/3927) +* Fixed `clippy::empty_docs` lint. + [#3946](https://github.com/rustwasm/wasm-bindgen/pull/3946) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 0749a4f69ed..cbf52c5fc24 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -867,10 +867,18 @@ impl ToTokens for ast::ImportType { let no_deref = self.no_deref; + let doc = if doc_comment.is_empty() { + quote! {} + } else { + quote! { + #[doc = #doc_comment] + } + }; + (quote! { #[automatically_derived] #(#attrs)* - #[doc = #doc_comment] + #doc #[repr(transparent)] #vis struct #rust_name { obj: #internal_obj @@ -1319,7 +1327,12 @@ impl TryToTokens for ast::ImportFunction { let abi_arguments = &abi_arguments[..]; let abi_argument_names = &abi_argument_names[..]; - let doc_comment = &self.doc_comment; + let doc = if self.doc_comment.is_empty() { + quote! {} + } else { + let doc_comment = &self.doc_comment; + quote! { #[doc = #doc_comment] } + }; let me = if is_method { quote! { &self, } } else { @@ -1368,7 +1381,7 @@ impl TryToTokens for ast::ImportFunction { #[allow(nonstandard_style)] #[allow(clippy::all, clippy::nursery, clippy::pedantic, clippy::restriction)] #(#attrs)* - #[doc = #doc_comment] + #doc #vis #maybe_async #maybe_unsafe fn #rust_name(#me #(#arguments),*) #ret { #extern_fn From 7ad4c3f931281a2b114b7e0e86ae46c38d1a548d Mon Sep 17 00:00:00 2001 From: Pablo Sichert Date: Tue, 14 May 2024 10:58:59 +0200 Subject: [PATCH 398/641] Add WebIDL definitions for `InputDeviceInfo` and `MediaTrackCapabilities` (#3935) * Add WebIDL definitions for `InputDeviceInfo` and `MediaTrackCapabilities` * Regenerate WebIDL bindings * Add changelog entry for `InputDeviceInfo` and `MediaTrackCapabilities` --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 4 + .../web-sys/src/features/gen_DoubleRange.rs | 63 +++++ .../src/features/gen_InputDeviceInfo.rs | 31 +++ .../features/gen_MediaTrackCapabilities.rs | 248 ++++++++++++++++++ crates/web-sys/src/features/gen_ULongRange.rs | 63 +++++ crates/web-sys/src/features/mod.rs | 28 ++ .../webidls/unstable/InputDeviceInfo.webidl | 13 + .../unstable/MediaTrackCapabilities.webidl | 36 +++ 9 files changed, 489 insertions(+) create mode 100644 crates/web-sys/src/features/gen_DoubleRange.rs create mode 100644 crates/web-sys/src/features/gen_InputDeviceInfo.rs create mode 100644 crates/web-sys/src/features/gen_MediaTrackCapabilities.rs create mode 100644 crates/web-sys/src/features/gen_ULongRange.rs create mode 100644 crates/web-sys/webidls/unstable/InputDeviceInfo.webidl create mode 100644 crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9bee5f624..51dd319e5b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Added support for returning `Vec`s from async functions. [#3630](https://github.com/rustwasm/wasm-bindgen/pull/3630) +* Added bindings for `InputDeviceInfo` and `MediaTrackCapabilities`. + [#3935](https://github.com/rustwasm/wasm-bindgen/pull/3935) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b1ef8a63c00..665c750b07c 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -326,6 +326,7 @@ DomStringList = [] DomStringMap = [] DomTokenList = [] DomWindowResizeEventDetail = [] +DoubleRange = [] DragEvent = ["Event", "MouseEvent", "UiEvent"] DragEventInit = [] DynamicsCompressorNode = ["AudioNode", "EventTarget"] @@ -728,6 +729,7 @@ ImageEncodeOptions = [] ImageOrientation = [] ImageTrack = ["EventTarget"] ImageTrackList = [] +InputDeviceInfo = ["MediaDeviceInfo"] InputEvent = ["Event", "UiEvent"] InputEventInit = [] IntersectionObserver = [] @@ -829,6 +831,7 @@ MediaStreamTrackGeneratorInit = [] MediaStreamTrackProcessor = [] MediaStreamTrackProcessorInit = [] MediaStreamTrackState = [] +MediaTrackCapabilities = [] MediaTrackConstraintSet = [] MediaTrackConstraints = [] MediaTrackSettings = [] @@ -1405,6 +1408,7 @@ TreeView = [] TreeWalker = [] U2f = [] U2fClientData = [] +ULongRange = [] UdpMessageEventInit = [] UdpOptions = [] UiEvent = ["Event"] diff --git a/crates/web-sys/src/features/gen_DoubleRange.rs b/crates/web-sys/src/features/gen_DoubleRange.rs new file mode 100644 index 00000000000..692ef41deff --- /dev/null +++ b/crates/web-sys/src/features/gen_DoubleRange.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DoubleRange)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DoubleRange` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type DoubleRange; + #[wasm_bindgen(method, setter = "max")] + fn max_shim(this: &DoubleRange, val: f64); + #[wasm_bindgen(method, setter = "min")] + fn min_shim(this: &DoubleRange, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl DoubleRange { + #[doc = "Construct a new `DoubleRange`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max(&mut self, val: f64) -> &mut Self { + self.max_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn min(&mut self, val: f64) -> &mut Self { + self.min_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for DoubleRange { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_InputDeviceInfo.rs b/crates/web-sys/src/features/gen_InputDeviceInfo.rs new file mode 100644 index 00000000000..65048ff536d --- /dev/null +++ b/crates/web-sys/src/features/gen_InputDeviceInfo.rs @@ -0,0 +1,31 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = MediaDeviceInfo , extends = :: js_sys :: Object , js_name = InputDeviceInfo , typescript_type = "InputDeviceInfo")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `InputDeviceInfo` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputDeviceInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type InputDeviceInfo; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaTrackCapabilities")] + # [wasm_bindgen (method , structural , js_class = "InputDeviceInfo" , js_name = getCapabilities)] + #[doc = "The `getCapabilities()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputDeviceInfo`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_capabilities(this: &InputDeviceInfo) -> MediaTrackCapabilities; +} diff --git a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs new file mode 100644 index 00000000000..76373c3967e --- /dev/null +++ b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs @@ -0,0 +1,248 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = MediaTrackCapabilities)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MediaTrackCapabilities` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type MediaTrackCapabilities; + #[cfg(feature = "DoubleRange")] + #[wasm_bindgen(method, setter = "aspectRatio")] + fn aspect_ratio_shim(this: &MediaTrackCapabilities, val: &DoubleRange); + #[wasm_bindgen(method, setter = "autoGainControl")] + fn auto_gain_control_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "ULongRange")] + #[wasm_bindgen(method, setter = "channelCount")] + fn channel_count_shim(this: &MediaTrackCapabilities, val: &ULongRange); + #[wasm_bindgen(method, setter = "deviceId")] + fn device_id_shim(this: &MediaTrackCapabilities, val: &str); + #[wasm_bindgen(method, setter = "echoCancellation")] + fn echo_cancellation_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "facingMode")] + fn facing_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "DoubleRange")] + #[wasm_bindgen(method, setter = "frameRate")] + fn frame_rate_shim(this: &MediaTrackCapabilities, val: &DoubleRange); + #[wasm_bindgen(method, setter = "groupId")] + fn group_id_shim(this: &MediaTrackCapabilities, val: &str); + #[cfg(feature = "ULongRange")] + #[wasm_bindgen(method, setter = "height")] + fn height_shim(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(feature = "DoubleRange")] + #[wasm_bindgen(method, setter = "latency")] + fn latency_shim(this: &MediaTrackCapabilities, val: &DoubleRange); + #[wasm_bindgen(method, setter = "noiseSuppression")] + fn noise_suppression_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "resizeMode")] + fn resize_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "ULongRange")] + #[wasm_bindgen(method, setter = "sampleRate")] + fn sample_rate_shim(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(feature = "ULongRange")] + #[wasm_bindgen(method, setter = "sampleSize")] + fn sample_size_shim(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(feature = "ULongRange")] + #[wasm_bindgen(method, setter = "width")] + fn width_shim(this: &MediaTrackCapabilities, val: &ULongRange); +} +#[cfg(web_sys_unstable_apis)] +impl MediaTrackCapabilities { + #[doc = "Construct a new `MediaTrackCapabilities`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[doc = "Change the `aspectRatio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn aspect_ratio(&mut self, val: &DoubleRange) -> &mut Self { + self.aspect_ratio_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.auto_gain_control_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn channel_count(&mut self, val: &ULongRange) -> &mut Self { + self.channel_count_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn device_id(&mut self, val: &str) -> &mut Self { + self.device_id_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.echo_cancellation_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.facing_mode_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[doc = "Change the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn frame_rate(&mut self, val: &DoubleRange) -> &mut Self { + self.frame_rate_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `groupId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn group_id(&mut self, val: &str) -> &mut Self { + self.group_id_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn height(&mut self, val: &ULongRange) -> &mut Self { + self.height_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[doc = "Change the `latency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn latency(&mut self, val: &DoubleRange) -> &mut Self { + self.latency_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.noise_suppression_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `resizeMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn resize_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.resize_mode_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn sample_rate(&mut self, val: &ULongRange) -> &mut Self { + self.sample_rate_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Change the `sampleSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn sample_size(&mut self, val: &ULongRange) -> &mut Self { + self.sample_size_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn width(&mut self, val: &ULongRange) -> &mut Self { + self.width_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for MediaTrackCapabilities { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ULongRange.rs b/crates/web-sys/src/features/gen_ULongRange.rs new file mode 100644 index 00000000000..f365b9378f1 --- /dev/null +++ b/crates/web-sys/src/features/gen_ULongRange.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ULongRange)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ULongRange` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type ULongRange; + #[wasm_bindgen(method, setter = "max")] + fn max_shim(this: &ULongRange, val: u32); + #[wasm_bindgen(method, setter = "min")] + fn min_shim(this: &ULongRange, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl ULongRange { + #[doc = "Construct a new `ULongRange`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn max(&mut self, val: u32) -> &mut Self { + self.max_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn min(&mut self, val: u32) -> &mut Self { + self.min_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for ULongRange { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 9e5d51569e5..0b801d54fd8 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2063,6 +2063,13 @@ mod gen_DomWindowResizeEventDetail; #[allow(unused_imports)] pub use gen_DomWindowResizeEventDetail::*; +#[cfg(feature = "DoubleRange")] +#[allow(non_snake_case)] +mod gen_DoubleRange; +#[cfg(feature = "DoubleRange")] +#[allow(unused_imports)] +pub use gen_DoubleRange::*; + #[cfg(feature = "DragEvent")] #[allow(non_snake_case)] mod gen_DragEvent; @@ -4877,6 +4884,13 @@ mod gen_ImageTrackList; #[allow(unused_imports)] pub use gen_ImageTrackList::*; +#[cfg(feature = "InputDeviceInfo")] +#[allow(non_snake_case)] +mod gen_InputDeviceInfo; +#[cfg(feature = "InputDeviceInfo")] +#[allow(unused_imports)] +pub use gen_InputDeviceInfo::*; + #[cfg(feature = "InputEvent")] #[allow(non_snake_case)] mod gen_InputEvent; @@ -5584,6 +5598,13 @@ mod gen_MediaStreamTrackState; #[allow(unused_imports)] pub use gen_MediaStreamTrackState::*; +#[cfg(feature = "MediaTrackCapabilities")] +#[allow(non_snake_case)] +mod gen_MediaTrackCapabilities; +#[cfg(feature = "MediaTrackCapabilities")] +#[allow(unused_imports)] +pub use gen_MediaTrackCapabilities::*; + #[cfg(feature = "MediaTrackConstraintSet")] #[allow(non_snake_case)] mod gen_MediaTrackConstraintSet; @@ -9616,6 +9637,13 @@ mod gen_U2fClientData; #[allow(unused_imports)] pub use gen_U2fClientData::*; +#[cfg(feature = "ULongRange")] +#[allow(non_snake_case)] +mod gen_ULongRange; +#[cfg(feature = "ULongRange")] +#[allow(unused_imports)] +pub use gen_ULongRange::*; + #[cfg(feature = "UdpMessageEventInit")] #[allow(non_snake_case)] mod gen_UdpMessageEventInit; diff --git a/crates/web-sys/webidls/unstable/InputDeviceInfo.webidl b/crates/web-sys/webidls/unstable/InputDeviceInfo.webidl new file mode 100644 index 00000000000..d562442dad8 --- /dev/null +++ b/crates/web-sys/webidls/unstable/InputDeviceInfo.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-main/#dom-inputdeviceinfo + */ + +[Exposed=Window, SecureContext] +interface InputDeviceInfo : MediaDeviceInfo { + MediaTrackCapabilities getCapabilities(); +}; diff --git a/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl b/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl new file mode 100644 index 00000000000..ba6bd9c4607 --- /dev/null +++ b/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-main/#dom-mediatrackcapabilities + */ + +dictionary ULongRange { + [Clamp] unsigned long max; + [Clamp] unsigned long min; +}; + +dictionary DoubleRange { + double max; + double min; +}; + +dictionary MediaTrackCapabilities { + ULongRange width; + ULongRange height; + DoubleRange aspectRatio; + DoubleRange frameRate; + sequence facingMode; + sequence resizeMode; + ULongRange sampleRate; + ULongRange sampleSize; + sequence echoCancellation; + sequence autoGainControl; + sequence noiseSuppression; + DoubleRange latency; + ULongRange channelCount; + DOMString deviceId; + DOMString groupId; +}; From fa6d2bc726813c9f5370f07c64a4b60f0ac1edd5 Mon Sep 17 00:00:00 2001 From: Erik Moqvist Date: Tue, 14 May 2024 12:01:08 +0200 Subject: [PATCH 399/641] Added getCapabilities() to RtcRtpReceiver (#3941) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_RtcRtpReceiver.rs | 8 ++++++++ crates/web-sys/webidls/enabled/RTCRtpReceiver.webidl | 1 + 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51dd319e5b2..b8118f98ecf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ * Added bindings for `InputDeviceInfo` and `MediaTrackCapabilities`. [#3935](https://github.com/rustwasm/wasm-bindgen/pull/3935) +* Add bindings for `RTCRtpReceiver.getCapabilities(DOMString)` method. + [#3941](https://github.com/rustwasm/wasm-bindgen/pull/3941) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 7c50486cd69..1491ae29373 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -20,6 +20,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcRtpReceiver`*"] pub fn track(this: &RtcRtpReceiver) -> MediaStreamTrack; + #[cfg(feature = "RtcRtpCapabilities")] + # [wasm_bindgen (static_method_of = RtcRtpReceiver , js_class = "RTCRtpReceiver" , js_name = getCapabilities)] + #[doc = "The `getCapabilities()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/getCapabilities)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpReceiver`*"] + pub fn get_capabilities(kind: &str) -> Option; # [wasm_bindgen (method , structural , js_class = "RTCRtpReceiver" , js_name = getContributingSources)] #[doc = "The `getContributingSources()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/RTCRtpReceiver.webidl b/crates/web-sys/webidls/enabled/RTCRtpReceiver.webidl index 4af399d67e6..db9434cff48 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpReceiver.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpReceiver.webidl @@ -11,6 +11,7 @@ JSImplementation="@mozilla.org/dom/rtpreceiver;1"] interface RTCRtpReceiver { readonly attribute MediaStreamTrack track; + static RTCRtpCapabilities? getCapabilities(DOMString kind); Promise getStats(); [Pref="media.peerconnection.rtpsourcesapi.enabled"] sequence getContributingSources(); From 9b37613bbab0cd71f55dcc782d59dd00c1d4d200 Mon Sep 17 00:00:00 2001 From: David Huculak Date: Tue, 21 May 2024 04:04:15 -0400 Subject: [PATCH 400/641] Improve the performance of 'string enums' (#3915) --- CHANGELOG.md | 3 + benchmarks/index.html | 4 +- crates/backend/src/ast.rs | 8 +- crates/backend/src/codegen.rs | 123 +++++++++++++--------- crates/backend/src/encode.rs | 4 +- crates/cli-support/src/descriptor.rs | 25 ++++- crates/cli-support/src/js/binding.rs | 91 ++++++++++++++++ crates/cli-support/src/wit/incoming.rs | 26 +++++ crates/cli-support/src/wit/outgoing.rs | 32 ++++++ crates/cli-support/src/wit/standard.rs | 23 ++++ crates/macro-support/src/parser.rs | 6 +- crates/shared/src/lib.rs | 6 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/wasm-interpreter/src/lib.rs | 16 ++- crates/wasm-interpreter/tests/smoke.rs | 2 +- src/describe.rs | 1 + 16 files changed, 298 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8118f98ecf..47e952f69d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ * Generate JS bindings for WebIDL dictionary setters instead of using `Reflect`. This increases the size of the Web API bindings but should be more performant. Also, importing getters/setters from JS now supports specifying the JS attribute name as a string, e.g. `#[wasm_bindgen(method, setter = "x-cdm-codecs")]`. [#3898](https://github.com/rustwasm/wasm-bindgen/pull/3898) +* Greatly improve the performance of sending WebIDL 'string enums' across the JavaScript boundary by converting the enum variant string to/from an int. + [#3915](https://github.com/rustwasm/wasm-bindgen/pull/3915) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/benchmarks/index.html b/benchmarks/index.html index 020839f85e8..49cf021333a 100644 --- a/benchmarks/index.html +++ b/benchmarks/index.html @@ -277,12 +277,12 @@

wasm-bindgen benchmarks

- Call a custom JS function with an enum value parameter + Call a custom JS function with a string enum value parameter (?)

- Benchmarks the speed of passing enum values to javascript + Benchmarks the speed of passing string enums to javascript

diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 5c6555315c4..123c4ea9036 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -163,7 +163,7 @@ pub enum ImportKind { /// Importing a type/class Type(ImportType), /// Importing a JS enum - Enum(ImportEnum), + Enum(StringEnum), } /// A function being imported from JS @@ -302,10 +302,10 @@ pub struct ImportType { pub wasm_bindgen: Path, } -/// The metadata for an Enum being imported +/// The metadata for a String Enum #[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))] #[derive(Clone)] -pub struct ImportEnum { +pub struct StringEnum { /// The Rust enum's visibility pub vis: syn::Visibility, /// The Rust enum's identifiers @@ -404,7 +404,7 @@ pub struct StructField { pub wasm_bindgen: Path, } -/// Information about an Enum being exported +/// The metadata for an Enum #[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))] #[derive(Clone)] pub struct Enum { diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index cbf52c5fc24..330ffba6626 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -3,7 +3,7 @@ use crate::encode; use crate::encode::EncodeChunk; use crate::Diagnostic; use once_cell::sync::Lazy; -use proc_macro2::{Ident, Literal, Span, TokenStream}; +use proc_macro2::{Ident, Span, TokenStream}; use quote::format_ident; use quote::quote_spanned; use quote::{quote, ToTokens}; @@ -1075,33 +1075,31 @@ impl ToTokens for ast::ImportType { } } -impl ToTokens for ast::ImportEnum { +impl ToTokens for ast::StringEnum { fn to_tokens(&self, tokens: &mut TokenStream) { let vis = &self.vis; - let name = &self.name; - let expect_string = format!("attempted to convert invalid {} into JSValue", name); + let enum_name = &self.name; + let name_str = enum_name.to_string(); + let name_len = name_str.len() as u32; + let name_chars = name_str.chars().map(u32::from); let variants = &self.variants; - let variant_strings = &self.variant_values; + let variant_count = self.variant_values.len() as u32; + let variant_values = &self.variant_values; + let variant_indices = (0..variant_count).collect::>(); + let invalid = variant_count; + let hole = variant_count + 1; let attrs = &self.rust_attrs; - let mut current_idx: usize = 0; - let variant_indexes: Vec = variants - .iter() - .map(|_| { - let this_index = current_idx; - current_idx += 1; - Literal::usize_unsuffixed(this_index) - }) - .collect(); - - // Borrow variant_indexes because we need to use it multiple times inside the quote! macro - let variant_indexes_ref = &variant_indexes; + let invalid_to_str_msg = format!( + "Converting an invalid string enum ({}) back to a string is currently not supported", + enum_name + ); // A vector of EnumName::VariantName tokens for this enum let variant_paths: Vec = self .variants .iter() - .map(|v| quote!(#name::#v).into_token_stream()) + .map(|v| quote!(#enum_name::#v).into_token_stream()) .collect(); // Borrow variant_paths because we need to use it multiple times inside the quote! macro @@ -1109,83 +1107,104 @@ impl ToTokens for ast::ImportEnum { let wasm_bindgen = &self.wasm_bindgen; + let describe_variants = self.variant_values.iter().map(|variant_value| { + let length = variant_value.len() as u32; + let chars = variant_value.chars().map(u32::from); + quote! { + inform(#length); + #(inform(#chars);)* + } + }); + (quote! { #(#attrs)* - #vis enum #name { - #(#variants = #variant_indexes_ref,)* + #[non_exhaustive] + #[repr(u32)] + #vis enum #enum_name { + #(#variants = #variant_indices,)* #[automatically_derived] #[doc(hidden)] - __Nonexhaustive, + __Invalid } #[automatically_derived] - impl #name { - fn from_str(s: &str) -> Option<#name> { + impl #enum_name { + fn from_str(s: &str) -> Option<#enum_name> { match s { - #(#variant_strings => Some(#variant_paths_ref),)* + #(#variant_values => Some(#variant_paths_ref),)* _ => None, } } fn to_str(&self) -> &'static str { match self { - #(#variant_paths_ref => #variant_strings,)* - #name::__Nonexhaustive => panic!(#expect_string), + #(#variant_paths_ref => #variant_values,)* + #enum_name::__Invalid => panic!(#invalid_to_str_msg), } } - #vis fn from_js_value(obj: &#wasm_bindgen::JsValue) -> Option<#name> { + #vis fn from_js_value(obj: &#wasm_bindgen::JsValue) -> Option<#enum_name> { obj.as_string().and_then(|obj_str| Self::from_str(obj_str.as_str())) } } - // It should really be using &str for all of these, but that requires some major changes to cli-support #[automatically_derived] - impl #wasm_bindgen::describe::WasmDescribe for #name { - fn describe() { - <#wasm_bindgen::JsValue as #wasm_bindgen::describe::WasmDescribe>::describe() - } - } - - #[automatically_derived] - impl #wasm_bindgen::convert::IntoWasmAbi for #name { - type Abi = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::IntoWasmAbi>::Abi; + impl #wasm_bindgen::convert::IntoWasmAbi for #enum_name { + type Abi = u32; #[inline] - fn into_abi(self) -> Self::Abi { - <#wasm_bindgen::JsValue as #wasm_bindgen::convert::IntoWasmAbi>::into_abi(self.into()) + fn into_abi(self) -> u32 { + self as u32 } } #[automatically_derived] - impl #wasm_bindgen::convert::FromWasmAbi for #name { - type Abi = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::FromWasmAbi>::Abi; + impl #wasm_bindgen::convert::FromWasmAbi for #enum_name { + type Abi = u32; - unsafe fn from_abi(js: Self::Abi) -> Self { - let s = <#wasm_bindgen::JsValue as #wasm_bindgen::convert::FromWasmAbi>::from_abi(js); - #name::from_js_value(&s).unwrap_or(#name::__Nonexhaustive) + unsafe fn from_abi(val: u32) -> Self { + match val { + #(#variant_indices => #variant_paths_ref,)* + #invalid => #enum_name::__Invalid, + _ => unreachable!("The JS binding should only ever produce a valid value or the specific 'invalid' value"), + } } } #[automatically_derived] - impl #wasm_bindgen::convert::OptionIntoWasmAbi for #name { + impl #wasm_bindgen::convert::OptionFromWasmAbi for #enum_name { #[inline] - fn none() -> Self::Abi { <::js_sys::Object as #wasm_bindgen::convert::OptionIntoWasmAbi>::none() } + fn is_none(val: &u32) -> bool { *val == #hole } } #[automatically_derived] - impl #wasm_bindgen::convert::OptionFromWasmAbi for #name { + impl #wasm_bindgen::convert::OptionIntoWasmAbi for #enum_name { #[inline] - fn is_none(abi: &Self::Abi) -> bool { <::js_sys::Object as #wasm_bindgen::convert::OptionFromWasmAbi>::is_none(abi) } + fn none() -> Self::Abi { #hole } + } + + #[automatically_derived] + impl #wasm_bindgen::describe::WasmDescribe for #enum_name { + fn describe() { + use #wasm_bindgen::describe::*; + inform(STRING_ENUM); + inform(#name_len); + #(inform(#name_chars);)* + inform(#variant_count); + #(#describe_variants)* + } } #[automatically_derived] - impl From<#name> for #wasm_bindgen::JsValue { - fn from(obj: #name) -> #wasm_bindgen::JsValue { - #wasm_bindgen::JsValue::from(obj.to_str()) + impl #wasm_bindgen::__rt::core::convert::From<#enum_name> for + #wasm_bindgen::JsValue + { + fn from(val: #enum_name) -> Self { + #wasm_bindgen::JsValue::from_str(val.to_str()) } } - }).to_tokens(tokens); + }) + .to_tokens(tokens); } } diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 9c06aedb168..529edb0dc88 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -339,8 +339,8 @@ fn shared_import_type<'a>(i: &'a ast::ImportType, intern: &'a Interner) -> Impor } } -fn shared_import_enum<'a>(_i: &'a ast::ImportEnum, _intern: &'a Interner) -> ImportEnum { - ImportEnum {} +fn shared_import_enum<'a>(_i: &'a ast::StringEnum, _intern: &'a Interner) -> StringEnum { + StringEnum {} } fn shared_struct<'a>(s: &'a ast::Struct, intern: &'a Interner) -> Struct<'a> { diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index 62dd766ac7a..6a35786eba5 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -34,6 +34,7 @@ tys! { EXTERNREF NAMED_EXTERNREF ENUM + STRING_ENUM RUST_STRUCT CHAR OPTIONAL @@ -67,7 +68,16 @@ pub enum Descriptor { String, Externref, NamedExternref(String), - Enum { name: String, hole: u32 }, + Enum { + name: String, + hole: u32, + }, + StringEnum { + name: String, + invalid: u32, + hole: u32, + variant_values: Vec, + }, RustStruct(String), Char, Option(Box), @@ -156,6 +166,19 @@ impl Descriptor { let hole = get(data); Descriptor::Enum { name, hole } } + STRING_ENUM => { + let name = get_string(data); + let variant_count = get(data); + let invalid = variant_count; + let hole = variant_count + 1; + let variant_values = (0..variant_count).map(|_| get_string(data)).collect(); + Descriptor::StringEnum { + name, + invalid, + hole, + variant_values, + } + } RUST_STRUCT => { let name = get_string(data); Descriptor::RustStruct(name) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index ebe4e966c43..31863da50ab 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -668,6 +668,96 @@ fn instruction( } } + Instruction::WasmToStringEnum { variant_values } => { + let index = js.pop(); + + // e.g. ["a","b","c"][someIndex] + let mut enum_val_expr = String::new(); + enum_val_expr.push('['); + for variant in variant_values { + enum_val_expr.push_str(&format!("\"{variant}\",")); + } + enum_val_expr.push(']'); + enum_val_expr.push('['); + enum_val_expr.push_str(&index); + enum_val_expr.push(']'); + + js.push(enum_val_expr) + } + + Instruction::OptionWasmToStringEnum { + variant_values, + hole, + } => { + let index = js.pop(); + + let mut enum_val_expr = String::new(); + enum_val_expr.push('['); + for variant in variant_values { + enum_val_expr.push_str(&format!("\"{variant}\",")); + } + enum_val_expr.push(']'); + enum_val_expr.push('['); + enum_val_expr.push_str(&index); + enum_val_expr.push(']'); + + // e.g. someIndex === 4 ? undefined : (["a","b","c"][someIndex]) + // | + // currently, hole = variant_count + 1 + js.push(format!( + "{index} === {hole} ? undefined : ({enum_val_expr})" + )) + } + + Instruction::StringEnumToWasm { + variant_values, + invalid, + } => { + let enum_val = js.pop(); + + // e.g. {"a":0,"b":1,"c":2}[someEnumVal] ?? 3 + // | + // currently, invalid = variant_count + let mut enum_val_expr = String::new(); + enum_val_expr.push('{'); + for (i, variant) in variant_values.iter().enumerate() { + enum_val_expr.push_str(&format!("\"{variant}\":{i},")); + } + enum_val_expr.push('}'); + enum_val_expr.push('['); + enum_val_expr.push_str(&enum_val); + enum_val_expr.push(']'); + enum_val_expr.push_str(&format!(" ?? {invalid}")); + + js.push(enum_val_expr) + } + + Instruction::OptionStringEnumToWasm { + variant_values, + invalid, + hole, + } => { + let enum_val = js.pop(); + + let mut enum_val_expr = String::new(); + enum_val_expr.push('{'); + for (i, variant) in variant_values.iter().enumerate() { + enum_val_expr.push_str(&format!("\"{variant}\":{i},")); + } + enum_val_expr.push('}'); + enum_val_expr.push('['); + enum_val_expr.push_str(&enum_val); + enum_val_expr.push(']'); + enum_val_expr.push_str(&format!(" ?? {invalid}")); + + // e.g. someEnumVal == undefined ? 4 : ({"a":0,"b":1,"c":2}[someEnumVal] ?? 3) + // | + // double equals here in case it's null + js.push(format!( + "{enum_val} == undefined ? {hole} : ({enum_val_expr})" + )) + } + Instruction::MemoryToString(mem) => { let len = js.pop(); let ptr = js.pop(); @@ -1377,6 +1467,7 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String) { AdapterType::NamedExternref(name) => dst.push_str(name), AdapterType::Struct(name) => dst.push_str(name), AdapterType::Enum(name) => dst.push_str(name), + AdapterType::StringEnum(name) => dst.push_str(name), AdapterType::Function => dst.push_str("any"), } } diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 83bd3b32b16..583c1c34378 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -108,6 +108,16 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); }, + Descriptor::StringEnum { name, variant_values, invalid, .. } => { + self.instruction( + &[AdapterType::StringEnum(name.clone())], + Instruction::StringEnumToWasm { + variant_values: variant_values.clone(), + invalid: *invalid, + }, + &[AdapterType::I32], + ); + }, Descriptor::Ref(d) => self.incoming_ref(false, d)?, Descriptor::RefMut(d) => self.incoming_ref(true, d)?, Descriptor::Option(d) => self.incoming_option(d)?, @@ -296,6 +306,22 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); } + Descriptor::StringEnum { + name, + variant_values, + invalid, + hole, + } => { + self.instruction( + &[AdapterType::StringEnum(name.clone()).option()], + Instruction::OptionStringEnumToWasm { + variant_values: variant_values.clone(), + invalid: *invalid, + hole: *hole, + }, + &[AdapterType::I32], + ); + } Descriptor::RustStruct(name) => { self.instruction( &[AdapterType::Struct(name.clone()).option()], diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 2c0fceefbcd..033217f61ad 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -74,6 +74,12 @@ impl InstructionBuilder<'_, '_> { self.output.push(AdapterType::F64); } Descriptor::Enum { name, .. } => self.outgoing_i32(AdapterType::Enum(name.clone())), + Descriptor::StringEnum { + name, + variant_values, + invalid: _, + hole: _, + } => self.outgoing_string_enum(name, variant_values), Descriptor::Char => { self.instruction( @@ -287,6 +293,21 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::Enum(name.clone()).option()], ); } + Descriptor::StringEnum { + name, + invalid: _, + hole, + variant_values, + } => { + self.instruction( + &[AdapterType::I32], + Instruction::OptionWasmToStringEnum { + variant_values: variant_values.to_vec(), + hole: *hole, + }, + &[AdapterType::StringEnum(String::from(name))], + ); + } Descriptor::RustStruct(name) => { self.instruction( &[AdapterType::I32], @@ -352,6 +373,7 @@ impl InstructionBuilder<'_, '_> { | Descriptor::Boolean | Descriptor::Char | Descriptor::Enum { .. } + | Descriptor::StringEnum { .. } | Descriptor::RustStruct(_) | Descriptor::Ref(_) | Descriptor::RefMut(_) @@ -520,6 +542,16 @@ impl InstructionBuilder<'_, '_> { self.instruction(&[AdapterType::I32], instr, &[output]); } + fn outgoing_string_enum(&mut self, name: &str, variant_values: &[String]) { + self.instruction( + &[AdapterType::I32], + Instruction::WasmToStringEnum { + variant_values: variant_values.to_vec(), + }, + &[AdapterType::StringEnum(String::from(name))], + ); + } + fn outgoing_i64(&mut self, output: AdapterType) { let instr = Instruction::WasmToInt { input: walrus::ValType::I64, diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 104a297abfa..e4d7aa745c1 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -86,6 +86,7 @@ pub enum AdapterType { Option(Box), Struct(String), Enum(String), + StringEnum(String), NamedExternref(String), Function, NonNull, @@ -140,6 +141,28 @@ pub enum Instruction { output: AdapterType, }, + /// Pops a wasm `i32` and pushes the enum variant as a string + WasmToStringEnum { + variant_values: Vec, + }, + + OptionWasmToStringEnum { + variant_values: Vec, + hole: u32, + }, + + /// pops a string and pushes the enum variant as an `i32` + StringEnumToWasm { + variant_values: Vec, + invalid: u32, + }, + + OptionStringEnumToWasm { + variant_values: Vec, + invalid: u32, + hole: u32, + }, + /// Pops a `bool` from the stack and pushes an `i32` equivalent I32FromBool, /// Pops a `string` from the stack and pushes the first character as `i32` diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index af9b38cf1a7..9ad14c6fce2 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1229,7 +1229,7 @@ impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn { } } -fn import_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), Diagnostic> { +fn string_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), Diagnostic> { let mut variants = vec![]; let mut variant_values = vec![]; @@ -1263,7 +1263,7 @@ fn import_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), D program.imports.push(ast::Import { module: None, js_namespace: None, - kind: ast::ImportKind::Enum(ast::ImportEnum { + kind: ast::ImportKind::Enum(ast::StringEnum { vis: enum_.vis, name: enum_.ident, variants, @@ -1295,7 +1295,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { }) = get_expr(expr) { opts.check_used(); - return import_enum(self, program); + return string_enum(self, program); } } let js_name = opts diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index eeadecbfec5..0c3af022dbf 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.92"; +pub const SCHEMA_VERSION: &str = "0.2.93"; #[macro_export] macro_rules! shared_api { @@ -50,7 +50,7 @@ macro_rules! shared_api { Function(ImportFunction<'a>), Static(ImportStatic<'a>), Type(ImportType<'a>), - Enum(ImportEnum), + Enum(StringEnum), } struct ImportFunction<'a> { @@ -98,7 +98,7 @@ macro_rules! shared_api { vendor_prefixes: Vec<&'a str>, } - struct ImportEnum {} + struct StringEnum {} struct Export<'a> { class: Option<&'a str>, diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 143f8483c7b..0ba79b8eefb 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "10197913343580353876"; +const APPROVED_SCHEMA_FILE_HASH: &str = "6362870592255096957"; #[test] fn schema_version() { diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index b5fda3b8172..359eb197a94 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -68,11 +68,9 @@ impl Interpreter { pub fn new(module: &Module) -> Result { let mut ret = Interpreter::default(); - // The descriptor functions shouldn't really use all that much memory - // (the LLVM call stack, now the wasm stack). To handle that let's give - // our selves a little bit of memory and set the stack pointer (global - // 0) to the top. - ret.mem = vec![0; 0x400]; + // Give ourselves some memory and set the stack pointer + // (the LLVM call stack, now the wasm stack, global 0) to the top. + ret.mem = vec![0; 0x8000]; ret.sp = ret.mem.len() as i32; // Figure out where the `__wbindgen_describe` imported function is, if @@ -299,6 +297,10 @@ impl Frame<'_> { // theory there doesn't need to be. Instr::Load(e) => { let address = stack.pop().unwrap(); + assert!( + address > 0, + "Read a negative address value from the stack. Did we run out of memory?" + ); let address = address as u32 + e.arg.offset; assert!(address % 4 == 0); stack.push(self.interp.mem[address as usize / 4]) @@ -306,6 +308,10 @@ impl Frame<'_> { Instr::Store(e) => { let value = stack.pop().unwrap(); let address = stack.pop().unwrap(); + assert!( + address > 0, + "Read a negative address value from the stack. Did we run out of memory?" + ); let address = address as u32 + e.arg.offset; assert!(address % 4 == 0); self.interp.mem[address as usize / 4] = value; diff --git a/crates/wasm-interpreter/tests/smoke.rs b/crates/wasm-interpreter/tests/smoke.rs index c14545c2ffa..6848d003932 100644 --- a/crates/wasm-interpreter/tests/smoke.rs +++ b/crates/wasm-interpreter/tests/smoke.rs @@ -91,7 +91,7 @@ fn globals() { ) "#; // __wbindgen_describe is called with a global - in Frame.eval we assume all access to globals is the stack pointer - interpret(wat, "foo", Some(&[1024])); + interpret(wat, "foo", Some(&[32768])); } #[test] diff --git a/src/describe.rs b/src/describe.rs index 23190f71987..140018a8097 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -42,6 +42,7 @@ tys! { EXTERNREF NAMED_EXTERNREF ENUM + STRING_ENUM RUST_STRUCT CHAR OPTIONAL From b4da51c4b1f7b80bf3baddd2badc30f813436d06 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 27 May 2024 09:41:57 +0200 Subject: [PATCH 401/641] Register target features in custom section when using xforms (#3967) --- CHANGELOG.md | 5 +- crates/externref-xform/Cargo.toml | 1 + crates/externref-xform/src/lib.rs | 6 ++- crates/multi-value-xform/Cargo.toml | 1 + crates/multi-value-xform/src/lib.rs | 6 +++ crates/wasm-conventions/Cargo.toml | 3 ++ crates/wasm-conventions/src/lib.rs | 76 ++++++++++++++++++++++++++++- 7 files changed, 94 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e952f69d0..ba338a203f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,9 +45,12 @@ * Fix MSRV compilation. [#3927](https://github.com/rustwasm/wasm-bindgen/pull/3927) -* Fixed `clippy::empty_docs` lint. +* Fix `clippy::empty_docs` lint. [#3946](https://github.com/rustwasm/wasm-bindgen/pull/3946) +* Fix missing target features in module when enabling reference types or multi-value transformation. + [#3967](https://github.com/rustwasm/wasm-bindgen/pull/3967) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index eb09f087eca..173967be1ee 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -15,6 +15,7 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" walrus = "0.20.2" +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index f861f366f0c..ab9ee589173 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -15,7 +15,7 @@ //! goal at least is to have valid wasm modules coming in that don't use //! `externref` and valid wasm modules going out which use `externref` at the fringes. -use anyhow::{anyhow, bail, Error}; +use anyhow::{anyhow, bail, Context as _, Error}; use std::cmp; use std::collections::{BTreeMap, HashMap, HashSet}; use std::mem; @@ -101,6 +101,10 @@ impl Context { /// large the function table is so we know what indexes to hand out when /// we're appending entries. pub fn prepare(&mut self, module: &mut Module) -> Result<(), Error> { + // Insert reference types to the target features section. + wasm_bindgen_wasm_conventions::insert_target_feature(module, "reference-types") + .context("failed to parse `target_features` custom section")?; + // Figure out what the maximum index of functions pointers are. We'll // be adding new entries to the function table later (maybe) so // precalculate this ahead of time. diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index a363d87760e..6f2a807ff21 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -15,6 +15,7 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" walrus = "0.20.2" +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" diff --git a/crates/multi-value-xform/src/lib.rs b/crates/multi-value-xform/src/lib.rs index 2bfb5bea374..510aef3553c 100644 --- a/crates/multi-value-xform/src/lib.rs +++ b/crates/multi-value-xform/src/lib.rs @@ -92,6 +92,8 @@ #![deny(missing_docs, missing_debug_implementations)] +use anyhow::Context; + /// Run the transformation. /// /// See the module-level docs for details on the transformation. @@ -117,6 +119,10 @@ pub fn run( shadow_stack_pointer: walrus::GlobalId, to_xform: &[(walrus::FunctionId, usize, Vec)], ) -> Result, anyhow::Error> { + // Insert multi-value to the target features section. + wasm_bindgen_wasm_conventions::insert_target_feature(module, "multivalue") + .context("failed to parse `target_features` custom section")?; + let mut wrappers = Vec::new(); for (func, return_pointer_index, results) in to_xform { wrappers.push(xform_one( diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 02bfc3d762a..cd2b474032a 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -11,5 +11,8 @@ edition = "2018" rust-version = "1.57" [dependencies] +leb128 = "0.2" walrus = "0.20.2" +# Matching the version `walrus` depends on. +wasmparser = "0.80" anyhow = "1.0" diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index d906e0dec63..2161a0d3b43 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -6,11 +6,14 @@ //! * The shadow stack pointer //! * The canonical linear memory that contains the shadow stack -use anyhow::{anyhow, bail, Result}; +use std::io::Cursor; + +use anyhow::{anyhow, bail, Context, Result}; use walrus::{ ir::Value, ElementId, FunctionBuilder, FunctionId, FunctionKind, GlobalId, GlobalKind, - InitExpr, MemoryId, Module, ValType, + InitExpr, MemoryId, Module, RawCustomSection, ValType, }; +use wasmparser::BinaryReader; /// Get a Wasm module's canonical linear memory. pub fn get_memory(module: &Module) -> Result { @@ -148,3 +151,72 @@ pub fn get_or_insert_start_builder(module: &mut Module) -> &mut FunctionBuilder .unwrap_local_mut() .builder_mut() } + +pub fn insert_target_feature(module: &mut Module, new_feature: &str) -> Result<()> { + // Taken from . + anyhow::ensure!(new_feature.len() <= 100_000, "feature name too long"); + + // Try to find an existing section. + let section = module + .customs + .iter_mut() + .find(|(_, custom)| custom.name() == "target_features"); + + // If one exists, check if the target feature is already present. + let section = if let Some((_, section)) = section { + let section: &mut RawCustomSection = section + .as_any_mut() + .downcast_mut() + .context("failed to read section")?; + let mut reader = BinaryReader::new(§ion.data); + // The first integer contains the target feature count. + let count = reader.read_var_u32()?; + + // Try to find if the target feature is already present. + for _ in 0..count { + // First byte is the prefix. + let prefix_index = reader.current_position(); + let prefix = reader.read_u8()? as u8; + // Read the feature. + let length = reader.read_var_u32()?; + let feature = reader.read_bytes(length as usize)?; + + // If we found the target feature, we are done here. + if feature == new_feature.as_bytes() { + // Make sure we set any existing prefix to "enabled". + if prefix == b'-' { + section.data[prefix_index] = b'+'; + } + + return Ok(()); + } + } + + section + } else { + let mut data = Vec::new(); + leb128::write::unsigned(&mut data, 0).unwrap(); + let id = module.customs.add(RawCustomSection { + name: String::from("target_features"), + data, + }); + module.customs.get_mut(id).unwrap() + }; + + // If we couldn't find the target feature, insert it. + + // The first byte contains an integer describing the target feature count, which we increase by one. + let mut data = Cursor::new(§ion.data); + let count = leb128::read::unsigned(&mut data).unwrap(); + let mut new_count = Vec::new(); + leb128::write::unsigned(&mut new_count, count + 1).unwrap(); + section.data.splice(0..data.position() as usize, new_count); + // Then we insert the "enabled" prefix at the end. + section.data.push(b'+'); + // The next byte contains the length of the target feature string. + leb128::write::unsigned(&mut section.data, new_feature.len() as u64).unwrap(); + // Lastly the target feature string is inserted. + section.data.extend(new_feature.as_bytes()); + + Ok(()) +} From 5767be9ea036097657ba3a5916d60aa7f40e5fa8 Mon Sep 17 00:00:00 2001 From: Nicklas Warming Jacobsen Date: Mon, 27 May 2024 22:38:45 +0200 Subject: [PATCH 402/641] Fixes #3929 Allow exporting functions named "default". (#3930) --- CHANGELOG.md | 4 ++++ crates/cli-support/src/lib.rs | 7 +++++++ crates/macro-support/src/parser.rs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba338a203f7..8e18609b7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ ### Added +* Allow exporting functions named `default`. Throw error in wasm-bindgen-cli if --target web and + an exported symbol is named `default`. + [#3930](https://github.com/rustwasm/wasm-bindgen/pull/3930) + * Added support for arbitrary expressions when using `#[wasm_bindgen(typescript_custom_section)]`. [#3901](https://github.com/rustwasm/wasm-bindgen/pull/3901) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index bccba23459d..37428bd20fd 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -327,6 +327,13 @@ impl Bindgen { .context("failed getting Wasm module")?, }; + // Check that no exported symbol is called "default" if we target web. + if matches!(self.mode, OutputMode::Web) + && module.exports.iter().any(|export| export.name == "default") + { + bail!("exported symbol \"default\" not allowed for --target web") + } + let thread_count = self .threads .run(&mut module) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 9ad14c6fce2..dd581b2700d 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -799,7 +799,7 @@ impl ConvertToAst for syn::ItemFn { false, None, false, - None, + Some(&["default"]), )?; attrs.check_used(); Ok(ret.0) From 88f8917efbc644c75582cf63075b01f254b1e1cc Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 1 Jun 2024 22:18:14 +1000 Subject: [PATCH 403/641] Fix Rust values getting GC'd while still borrowed and not getting GC'd if created via. constructor (#3940) * Add a failing test * Force tests to run sequentially At first I tried fixing them so that they didn't need to (giving each of them their own `dropCount`), but running multiple GCs in parallel seems to be flaky. * Add objects created via. constructors to the FinalizationRegistry * Add a failing test * Fix exported Rust types being GC'd while still borrowed I also discovered and fixed an extra bug while working on this, which was that `LongRefFromWasmAbi` wasn't getting used for `self`: this bug didn't cause any problems before, because the only type that had a different `LongRefFromWasmAbi` impl than its `RefFromWasmAbi` impl was `JsValue` which can't be the type of `self`. It became a problem here because I made the new `LongRefFromWasmAbi` impl for exported Rust types clone the `Rc`, whereas the `RefFromWasmAbi` impl doesn't because garbage collection can't occur during the synchronous call that the value has to live for. I might actually change it so that both of the impls behave like the current `LongRefFromWasmAbi` impl, though: cloning an `Rc` isn't expensive and so having the second different impl just makes things more complicated for no good reason. I just left it in this commit as explanation for how I discovered the `LongRefFromWasmAbi` issue. * Unify RefFromWasmAbi and LongRefFromWasmAbi impls * Get rid of needless looping * Get rid of outdated `borrow_mut` Now that borrowing a Rust value always clones its `Rc`, `Rc::into_inner` is a sufficient check that the value isn't borrowed. * Get rid of needless `mut` For some reason I was getting errors before without it, but that seems to be fixed now. (It's probably something to do with having removed the `borrow_mut`, but that only takes `&self`, so I still don't get it.) * Update reference tests * Add changelog entry * Update schema hash * Use Rc::try_unwrap instead of Rc::into_inner * Skip GC tests They seem to be far flakier in CI than locally for some reason, and I don't see any way to solve it; so just turn them off. :( I also got rid of the weird GC warmup hack because it doesn't do anything anymore; I could've sworn it was a reproducible effect before, but it seems to make no difference now. --- CHANGELOG.md | 6 ++ crates/backend/src/ast.rs | 2 +- crates/backend/src/codegen.rs | 72 +++++++++++++---- crates/cli-support/src/js/binding.rs | 7 +- crates/cli-support/src/js/mod.rs | 4 +- crates/cli/tests/reference/builder.js | 4 +- crates/cli/tests/reference/builder.wat | 6 +- crates/cli/tests/reference/constructor.js | 5 +- crates/cli/tests/reference/constructor.wat | 6 +- src/lib.rs | 92 ++++++++++++++++++++++ tests/wasm/classes.js | 2 +- tests/wasm/gc.js | 88 +++++++++++++++++++++ tests/wasm/gc.rs | 68 ++++++++++++++++ tests/wasm/main.rs | 2 +- tests/wasm/owned.js | 13 --- tests/wasm/owned.rs | 36 --------- 16 files changed, 332 insertions(+), 81 deletions(-) create mode 100644 tests/wasm/gc.js create mode 100644 tests/wasm/gc.rs delete mode 100644 tests/wasm/owned.js delete mode 100644 tests/wasm/owned.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e18609b7d7..2b528788265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,12 @@ * Fix missing target features in module when enabling reference types or multi-value transformation. [#3967](https://github.com/rustwasm/wasm-bindgen/pull/3967) +* Fixed Rust values getting GC'd while still borrowed. + [#3940](https://github.com/rustwasm/wasm-bindgen/pull/3940) + +* Fixed Rust values not getting GC'd if they were created via. a constructor. + [#3940](https://github.com/rustwasm/wasm-bindgen/pull/3940) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 123c4ea9036..91aa23040e6 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -108,7 +108,7 @@ pub struct Export { /// The 3 types variations of `self`. #[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))] -#[derive(Clone)] +#[derive(Copy, Clone)] pub enum MethodSelf { /// `self` ByValue, diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 330ffba6626..268d74fc42c 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -239,9 +239,9 @@ impl ToTokens for ast::Struct { type Abi = u32; fn into_abi(self) -> u32 { - use #wasm_bindgen::__rt::std::boxed::Box; + use #wasm_bindgen::__rt::std::rc::Rc; use #wasm_bindgen::__rt::WasmRefCell; - Box::into_raw(Box::new(WasmRefCell::new(self))) as u32 + Rc::into_raw(Rc::new(WasmRefCell::new(self))) as u32 } } @@ -250,14 +250,19 @@ impl ToTokens for ast::Struct { type Abi = u32; unsafe fn from_abi(js: u32) -> Self { - use #wasm_bindgen::__rt::std::boxed::Box; + use #wasm_bindgen::__rt::std::rc::Rc; + use #wasm_bindgen::__rt::std::result::Result::{Ok, Err}; use #wasm_bindgen::__rt::{assert_not_null, WasmRefCell}; let ptr = js as *mut WasmRefCell<#name>; assert_not_null(ptr); - let js = Box::from_raw(ptr); - (*js).borrow_mut(); // make sure no one's borrowing - js.into_inner() + let rc = Rc::from_raw(ptr); + match Rc::try_unwrap(rc) { + Ok(cell) => cell.into_inner(), + Err(_) => #wasm_bindgen::throw_str( + "attempted to take ownership of Rust value while it was borrowed" + ), + } } } @@ -291,39 +296,62 @@ impl ToTokens for ast::Struct { const _: () = { #[no_mangle] #[doc(hidden)] - pub unsafe extern "C" fn #free_fn(ptr: u32) { - let _ = <#name as #wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); //implicit `drop()` + // `allow_delayed` is whether it's ok to not actually free the `ptr` immediately + // if it's still borrowed. + pub unsafe extern "C" fn #free_fn(ptr: u32, allow_delayed: u32) { + use #wasm_bindgen::__rt::std::rc::Rc; + + if allow_delayed != 0 { + // Just drop the implicit `Rc` owned by JS, and then if the value is still + // referenced it'll be kept alive by its other `Rc`s. + let ptr = ptr as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; + #wasm_bindgen::__rt::assert_not_null(ptr); + drop(Rc::from_raw(ptr)); + } else { + // Claim ownership of the value, which will panic if it's borrowed. + let _ = <#name as #wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); + } } }; #[automatically_derived] impl #wasm_bindgen::convert::RefFromWasmAbi for #name { type Abi = u32; - type Anchor = #wasm_bindgen::__rt::Ref<'static, #name>; + type Anchor = #wasm_bindgen::__rt::RcRef<#name>; unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor { + use #wasm_bindgen::__rt::std::rc::Rc; + let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; #wasm_bindgen::__rt::assert_not_null(js); - (*js).borrow() + + Rc::increment_strong_count(js); + let rc = Rc::from_raw(js); + #wasm_bindgen::__rt::RcRef::new(rc) } } #[automatically_derived] impl #wasm_bindgen::convert::RefMutFromWasmAbi for #name { type Abi = u32; - type Anchor = #wasm_bindgen::__rt::RefMut<'static, #name>; + type Anchor = #wasm_bindgen::__rt::RcRefMut<#name>; unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor { + use #wasm_bindgen::__rt::std::rc::Rc; + let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; #wasm_bindgen::__rt::assert_not_null(js); - (*js).borrow_mut() + + Rc::increment_strong_count(js); + let rc = Rc::from_raw(js); + #wasm_bindgen::__rt::RcRefMut::new(rc) } } #[automatically_derived] impl #wasm_bindgen::convert::LongRefFromWasmAbi for #name { type Abi = u32; - type Anchor = #wasm_bindgen::__rt::Ref<'static, #name>; + type Anchor = #wasm_bindgen::__rt::RcRef<#name>; unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor { ::ref_from_abi(js) @@ -562,12 +590,24 @@ impl TryToTokens for ast::Export { } Some(ast::MethodSelf::RefShared) => { let class = self.rust_class.as_ref().unwrap(); + let (trait_, func, borrow) = if self.function.r#async { + ( + quote!(LongRefFromWasmAbi), + quote!(long_ref_from_abi), + quote!( + <<#class as #wasm_bindgen::convert::LongRefFromWasmAbi> + ::Anchor as #wasm_bindgen::__rt::std::borrow::Borrow<#class>> + ::borrow(&me) + ), + ) + } else { + (quote!(RefFromWasmAbi), quote!(ref_from_abi), quote!(&*me)) + }; arg_conversions.push(quote! { let me = unsafe { - <#class as #wasm_bindgen::convert::RefFromWasmAbi> - ::ref_from_abi(me) + <#class as #wasm_bindgen::convert::#trait_>::#func(me) }; - let me = &*me; + let me = #borrow; }); quote! { me.#name } } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 31863da50ab..dfbd28b8b2f 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -1129,7 +1129,12 @@ fn instruction( let val = js.pop(); match constructor { Some(name) if name == class => { - js.prelude(&format!("this.__wbg_ptr = {} >>> 0;", val)); + js.prelude(&format!( + " + this.__wbg_ptr = {val} >>> 0; + {name}Finalization.register(this, this.__wbg_ptr, this); + " + )); js.push(String::from("this")); } Some(_) | None => { diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8c270186bf7..97a7cbd8044 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -948,7 +948,7 @@ impl<'a> Context<'a> { " const {name}Finalization = (typeof FinalizationRegistry === 'undefined') ? {{ register: () => {{}}, unregister: () => {{}} }} - : new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0));", + : new FinalizationRegistry(ptr => wasm.{}(ptr >>> 0, 1));", wasm_bindgen_shared::free_function(name), )); @@ -1021,7 +1021,7 @@ impl<'a> Context<'a> { free() {{ const ptr = this.__destroy_into_raw(); - wasm.{}(ptr); + wasm.{}(ptr, 0); }} ", wasm_bindgen_shared::free_function(name), diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js index 6db7eb3fbf0..f31735af193 100644 --- a/crates/cli/tests/reference/builder.js +++ b/crates/cli/tests/reference/builder.js @@ -26,7 +26,7 @@ function getStringFromWasm0(ptr, len) { const ClassBuilderFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_classbuilder_free(ptr >>> 0)); + : new FinalizationRegistry(ptr => wasm.__wbg_classbuilder_free(ptr >>> 0, 1)); /** */ export class ClassBuilder { @@ -48,7 +48,7 @@ export class ClassBuilder { free() { const ptr = this.__destroy_into_raw(); - wasm.__wbg_classbuilder_free(ptr); + wasm.__wbg_classbuilder_free(ptr, 0); } /** * @returns {ClassBuilder} diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index 0e9d738dcda..16a39fa1d49 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -1,8 +1,8 @@ (module $reference_test.wasm (type (;0;) (func (result i32))) - (type (;1;) (func (param i32))) - (func $classbuilder_builder (;0;) (type 0) (result i32)) - (func $__wbg_classbuilder_free (;1;) (type 1) (param i32)) + (type (;1;) (func (param i32 i32))) + (func $__wbg_classbuilder_free (;0;) (type 1) (param i32 i32)) + (func $classbuilder_builder (;1;) (type 0) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js index a485efbe747..3f096f76657 100644 --- a/crates/cli/tests/reference/constructor.js +++ b/crates/cli/tests/reference/constructor.js @@ -26,7 +26,7 @@ function getStringFromWasm0(ptr, len) { const ClassConstructorFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_classconstructor_free(ptr >>> 0)); + : new FinalizationRegistry(ptr => wasm.__wbg_classconstructor_free(ptr >>> 0, 1)); /** */ export class ClassConstructor { @@ -40,13 +40,14 @@ export class ClassConstructor { free() { const ptr = this.__destroy_into_raw(); - wasm.__wbg_classconstructor_free(ptr); + wasm.__wbg_classconstructor_free(ptr, 0); } /** */ constructor() { const ret = wasm.classconstructor_new(); this.__wbg_ptr = ret >>> 0; + ClassConstructorFinalization.register(this, this.__wbg_ptr, this); return this; } } diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index f6d7e3badc2..8bc0fdcb4f6 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -1,8 +1,8 @@ (module $reference_test.wasm (type (;0;) (func (result i32))) - (type (;1;) (func (param i32))) - (func $classconstructor_new (;0;) (type 0) (result i32)) - (func $__wbg_classconstructor_free (;1;) (type 1) (param i32)) + (type (;1;) (func (param i32 i32))) + (func $__wbg_classconstructor_free (;0;) (type 1) (param i32 i32)) + (func $classconstructor_new (;1;) (type 0) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) diff --git a/src/lib.rs b/src/lib.rs index f09bec2d213..d0cee09c6b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1610,6 +1610,98 @@ pub mod __rt { ); } + if_std! { + use std::rc::Rc; + + /// A type that encapsulates an `Rc>` as well as a `Ref` + /// to the contents of that `WasmRefCell`. + /// + /// The `'static` requirement is an unfortunate consequence of how this + /// is implemented. + pub struct RcRef { + // The 'static is a lie. + // + // We could get away without storing this, since we're in the same module as + // `WasmRefCell` and can directly manipulate its `borrow`, but I'm considering + // turning it into a wrapper around `std`'s `RefCell` to reduce `unsafe` in + // which case that would stop working. This also requires less `unsafe` as is. + // + // It's important that this goes before `Rc` so that it gets dropped first. + ref_: Ref<'static, T>, + _rc: Rc>, + } + + impl RcRef { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow() }; + Self { _rc: rc, ref_ } + } + } + + impl Deref for RcRef { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + &self.ref_ + } + } + + impl Borrow for RcRef { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ + } + } + + /// A type that encapsulates an `Rc>` as well as a + /// `RefMut` to the contents of that `WasmRefCell`. + /// + /// The `'static` requirement is an unfortunate consequence of how this + /// is implemented. + pub struct RcRefMut { + ref_: RefMut<'static, T>, + _rc: Rc>, + } + + impl RcRefMut { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow_mut() }; + Self { _rc: rc, ref_ } + } + } + + impl Deref for RcRefMut { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + &self.ref_ + } + } + + impl DerefMut for RcRefMut { + #[inline] + fn deref_mut(&mut self) -> &mut T { + &mut self.ref_ + } + } + + impl Borrow for RcRefMut { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ + } + } + + impl BorrowMut for RcRefMut { + #[inline] + fn borrow_mut(&mut self) -> &mut T { + &mut self.ref_ + } + } + } + if_std! { use std::alloc::{alloc, dealloc, realloc, Layout}; diff --git a/tests/wasm/classes.js b/tests/wasm/classes.js index 49bd4472210..5317dbb0137 100644 --- a/tests/wasm/classes.js +++ b/tests/wasm/classes.js @@ -46,7 +46,7 @@ exports.js_exceptions = () => { // TODO: throws because it tries to borrow_mut, but the throw_str from the previous line doesn't clean up the // RefMut so the object is left in a broken state. // We still try to call free here so the object is removed from the FinalizationRegistry when weak refs are enabled. - assert.throws(() => b.free(), /recursive use of an object/); + assert.throws(() => b.free(), /attempted to take ownership/); let c = wasm.ClassesExceptions1.new(); let d = wasm.ClassesExceptions2.new(); diff --git a/tests/wasm/gc.js b/tests/wasm/gc.js new file mode 100644 index 00000000000..8a143e7c581 --- /dev/null +++ b/tests/wasm/gc.js @@ -0,0 +1,88 @@ +const wasm = require("wasm-bindgen-test.js"); +const assert = require("assert"); + +async function gc() { + if ("gc" in global) { + global.gc(); + // Give the `FinalizationRegistry` callbacks a chance to run. + await new Promise((resolve) => setTimeout(resolve, 0)); + } else { + console.warn("test runner doesn't expose GC function"); + } +} + +let dropCount = 0; +exports.drop_callback = () => dropCount += 1; + +exports.owned_methods = async () => { + dropCount = 0; + new wasm.OwnedValue(1).add(new wasm.OwnedValue(2)).n(); + + // The `OwnedValue`s should have been dropped as a result of `add` and `n` + // taking ownership of `self`... + assert.strictEqual(dropCount, 3); + await gc(); + // ... and GCing shouldn't double-free them. + assert.strictEqual(dropCount, 3); +}; + +// Make sure that objects created via. builders get GC'd properly. +exports.gc_builder = async () => { + dropCount = 0; + wasm.OwnedValue.build(1); + + await gc(); + assert.strictEqual(dropCount, 1); +}; + +// Make sure that objects created via. constructors get GC'd properly. +exports.gc_constructor = async () => { + dropCount = 0; + new wasm.OwnedValue(1); + + await gc(); + assert.strictEqual(dropCount, 1); +}; + +// Make sure that exported Rust types don't get GC'd while they're still in use +// by an async function. +exports.no_gc_fn_argument = async () => { + dropCount = 0; + let resolve; + + // It seems like we have to create the `OwnedValue` inside another function in + // order for the GC to see it as unused. + const createPromise = () => + wasm.borrow_and_wait( + new wasm.OwnedValue(1), + new Promise((x) => resolve = x), + ); + const promise = createPromise(); + + await gc(); + assert.strictEqual(dropCount, 0); + + resolve(); + await promise; + await gc(); + assert.strictEqual(dropCount, 1); +}; + +exports.no_gc_method_receiver = async () => { + dropCount = 0; + let resolve; + + const createPromise = () => + new wasm.OwnedValue(1).borrow_and_wait( + new Promise((x) => resolve = x), + ); + const promise = createPromise(); + + await gc(); + assert.strictEqual(dropCount, 0); + + resolve(); + await promise; + await gc(); + assert.strictEqual(dropCount, 1); +}; diff --git a/tests/wasm/gc.rs b/tests/wasm/gc.rs new file mode 100644 index 00000000000..bda2065c5c3 --- /dev/null +++ b/tests/wasm/gc.rs @@ -0,0 +1,68 @@ +use js_sys::Promise; +use wasm_bindgen::prelude::*; +use wasm_bindgen_futures::JsFuture; +use wasm_bindgen_test::*; + +#[wasm_bindgen(module = "tests/wasm/gc.js")] +extern "C" { + fn drop_callback(); + + async fn owned_methods(); + async fn gc_builder(); + async fn gc_constructor(); + async fn no_gc_fn_argument(); + async fn no_gc_method_receiver(); +} + +#[wasm_bindgen] +pub struct OwnedValue { + pub n: f64, +} + +#[wasm_bindgen] +impl OwnedValue { + #[wasm_bindgen(constructor)] + pub fn new(n: f64) -> Self { + Self { n } + } + + pub fn build(n: f64) -> Self { + Self::new(n) + } + + #[allow(clippy::should_implement_trait)] // traits unsupported by wasm_bindgen + pub fn add(self, other: OwnedValue) -> Self { + Self { + n: self.n + other.n, + } + } + + pub fn n(self) -> f64 { + self.n + } + + pub async fn borrow_and_wait(&self, promise: Promise) { + let _ = JsFuture::from(promise).await; + } +} + +impl Drop for OwnedValue { + fn drop(&mut self) { + drop_callback(); + } +} + +#[wasm_bindgen] +pub async fn borrow_and_wait(_: &OwnedValue, promise: Promise) { + let _ = JsFuture::from(promise).await; +} + +#[wasm_bindgen_test] +#[ignore = "flaky"] +async fn test_all() { + owned_methods().await; + gc_builder().await; + gc_constructor().await; + no_gc_fn_argument().await; + no_gc_method_receiver().await; +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 00e58de56a6..6272352c2e9 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -29,6 +29,7 @@ pub mod enums; #[path = "final.rs"] pub mod final_; pub mod futures; +pub mod gc; pub mod getters_and_setters; pub mod import_class; pub mod imports; @@ -43,7 +44,6 @@ pub mod no_shims; pub mod node; pub mod option; pub mod optional_primitives; -pub mod owned; pub mod result; pub mod result_jserror; pub mod rethrow; diff --git a/tests/wasm/owned.js b/tests/wasm/owned.js deleted file mode 100644 index e1d5dfbe1a5..00000000000 --- a/tests/wasm/owned.js +++ /dev/null @@ -1,13 +0,0 @@ -const wasm = require("wasm-bindgen-test.js"); - -exports.create_garbage = async function () { - for (let i = 0; i < 100; i++) { - new wasm.OwnedValue(1).add(new wasm.OwnedValue(2)).n(); - } - - if ("gc" in global) { - global.gc(); - } else { - console.warn("test runner doesn't expose GC function"); - } -}; diff --git a/tests/wasm/owned.rs b/tests/wasm/owned.rs deleted file mode 100644 index 97e7d6fda3c..00000000000 --- a/tests/wasm/owned.rs +++ /dev/null @@ -1,36 +0,0 @@ -use wasm_bindgen::prelude::*; -use wasm_bindgen_test::*; - -#[wasm_bindgen] -pub struct OwnedValue { - pub n: f64, -} - -#[wasm_bindgen] -impl OwnedValue { - #[wasm_bindgen(constructor)] - pub fn new(n: f64) -> Self { - Self { n } - } - - #[allow(clippy::should_implement_trait)] // traits unsupported by wasm_bindgen - pub fn add(self, other: OwnedValue) -> Self { - Self { - n: self.n + other.n, - } - } - - pub fn n(self) -> f64 { - self.n - } -} - -#[wasm_bindgen(module = "tests/wasm/owned.js")] -extern "C" { - fn create_garbage(); -} - -#[wasm_bindgen_test] -fn test_create_garbage() { - create_garbage() -} From c108c7520a13fa124038b28db6fb759b35576dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Sun, 2 Jun 2024 00:18:21 +0200 Subject: [PATCH 404/641] Add bindings for `VisualViewport` (#3931) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 1 + .../src/features/gen_VisualViewport.rs | 106 ++++++++++++++++++ crates/web-sys/src/features/gen_Window.rs | 8 ++ crates/web-sys/src/features/mod.rs | 7 ++ .../webidls/enabled/VisualViewport.webidl | 26 +++++ crates/web-sys/webidls/enabled/Window.webidl | 1 + 7 files changed, 152 insertions(+) create mode 100644 crates/web-sys/src/features/gen_VisualViewport.rs create mode 100644 crates/web-sys/webidls/enabled/VisualViewport.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b528788265..608fc227f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ * Add bindings for `RTCRtpReceiver.getCapabilities(DOMString)` method. [#3941](https://github.com/rustwasm/wasm-bindgen/pull/3941) +* Add bindings for `VisualViewport`. + [#3931](https://github.com/rustwasm/wasm-bindgen/pull/3931) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 665c750b07c..3ddd4511d29 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1476,6 +1476,7 @@ VideoTrackList = ["EventTarget"] VideoTransferCharacteristics = [] ViewTransition = [] VisibilityState = [] +VisualViewport = ["EventTarget"] VoidCallback = [] VrDisplay = ["EventTarget"] VrDisplayCapabilities = [] diff --git a/crates/web-sys/src/features/gen_VisualViewport.rs b/crates/web-sys/src/features/gen_VisualViewport.rs new file mode 100644 index 00000000000..946ee459368 --- /dev/null +++ b/crates/web-sys/src/features/gen_VisualViewport.rs @@ -0,0 +1,106 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = VisualViewport , typescript_type = "VisualViewport")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `VisualViewport` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub type VisualViewport; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = offsetLeft)] + #[doc = "Getter for the `offsetLeft` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/offsetLeft)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn offset_left(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = offsetTop)] + #[doc = "Getter for the `offsetTop` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/offsetTop)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn offset_top(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = pageLeft)] + #[doc = "Getter for the `pageLeft` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/pageLeft)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn page_left(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = pageTop)] + #[doc = "Getter for the `pageTop` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/pageTop)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn page_top(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = width)] + #[doc = "Getter for the `width` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/width)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn width(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = height)] + #[doc = "Getter for the `height` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/height)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn height(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = scale)] + #[doc = "Getter for the `scale` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/scale)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn scale(this: &VisualViewport) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onresize)] + #[doc = "Getter for the `onresize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onresize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn onresize(this: &VisualViewport) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onresize)] + #[doc = "Setter for the `onresize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onresize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn set_onresize(this: &VisualViewport, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onscroll)] + #[doc = "Getter for the `onscroll` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscroll)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn onscroll(this: &VisualViewport) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onscroll)] + #[doc = "Setter for the `onscroll` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscroll)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn set_onscroll(this: &VisualViewport, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onscrollend)] + #[doc = "Getter for the `onscrollend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscrollend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn onscrollend(this: &VisualViewport) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onscrollend)] + #[doc = "Setter for the `onscrollend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscrollend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"] + pub fn set_onscrollend(this: &VisualViewport, value: Option<&::js_sys::Function>); +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 9d4d08354c8..42273a69712 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -236,6 +236,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Screen`, `Window`*"] pub fn screen(this: &Window) -> Result; + #[cfg(feature = "VisualViewport")] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = visualViewport)] + #[doc = "Getter for the `visualViewport` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/visualViewport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VisualViewport`, `Window`*"] + pub fn visual_viewport(this: &Window) -> Option; # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = innerWidth)] #[doc = "Getter for the `innerWidth` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 0b801d54fd8..098735ffc14 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -10113,6 +10113,13 @@ mod gen_VisibilityState; #[allow(unused_imports)] pub use gen_VisibilityState::*; +#[cfg(feature = "VisualViewport")] +#[allow(non_snake_case)] +mod gen_VisualViewport; +#[cfg(feature = "VisualViewport")] +#[allow(unused_imports)] +pub use gen_VisualViewport::*; + #[cfg(feature = "VoidCallback")] #[allow(non_snake_case)] mod gen_VoidCallback; diff --git a/crates/web-sys/webidls/enabled/VisualViewport.webidl b/crates/web-sys/webidls/enabled/VisualViewport.webidl new file mode 100644 index 00000000000..2e213bd5eeb --- /dev/null +++ b/crates/web-sys/webidls/enabled/VisualViewport.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom-view/#visualViewport + */ + +[Exposed=Window] +interface VisualViewport : EventTarget { + readonly attribute double offsetLeft; + readonly attribute double offsetTop; + + readonly attribute double pageLeft; + readonly attribute double pageTop; + + readonly attribute double width; + readonly attribute double height; + + readonly attribute double scale; + + attribute EventHandler onresize; + attribute EventHandler onscroll; + attribute EventHandler onscrollend; +}; diff --git a/crates/web-sys/webidls/enabled/Window.webidl b/crates/web-sys/webidls/enabled/Window.webidl index e17490e5dda..a393ddb569e 100644 --- a/crates/web-sys/webidls/enabled/Window.webidl +++ b/crates/web-sys/webidls/enabled/Window.webidl @@ -146,6 +146,7 @@ partial interface Window { // nsGlobalWindow::Cleanup. :( //[SameObject, Replaceable, Throws] readonly attribute Screen screen; [Replaceable, Throws] readonly attribute Screen screen; + [SameObject, Replaceable] readonly attribute VisualViewport? visualViewport; // browsing context //[Throws] undefined moveTo(double x, double y); From f1c840fd1c8e74af22a5cf08c2940099bb2d9ae0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 12 Jun 2024 10:56:17 +0200 Subject: [PATCH 405/641] Add bindings for `queueMicrotask` (#3981) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_Window.rs | 7 +++++++ crates/web-sys/src/features/gen_WorkerGlobalScope.rs | 7 +++++++ .../webidls/enabled/WindowOrWorkerGlobalScope.webidl | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608fc227f42..bcc66f5c606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ * Add bindings for `VisualViewport`. [#3931](https://github.com/rustwasm/wasm-bindgen/pull/3931) +* Add bindings for `queueMicrotask`. + [#3981](https://github.com/rustwasm/wasm-bindgen/pull/3981) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 42273a69712..f0d74ecb39d 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -3001,6 +3001,13 @@ extern "C" { input: &str, init: &RequestInit, ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "Window" , js_name = queueMicrotask)] + #[doc = "The `queueMicrotask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/queueMicrotask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + pub fn queue_microtask(this: &Window, callback: &::js_sys::Function); # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = setInterval)] #[doc = "The `setInterval()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index df08803f585..d46c62d8211 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -820,6 +820,13 @@ extern "C" { input: &str, init: &RequestInit, ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = queueMicrotask)] + #[doc = "The `queueMicrotask()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/queueMicrotask)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] + pub fn queue_microtask(this: &WorkerGlobalScope, callback: &::js_sys::Function); # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = setInterval)] #[doc = "The `setInterval()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl index 89b818c4b63..3c06b1bf716 100644 --- a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl +++ b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl @@ -68,3 +68,8 @@ partial interface mixin WindowOrWorkerGlobalScope { [Throws, Func="mozilla::dom::DOMPrefs::DOMCachesEnabled", SameObject] readonly attribute CacheStorage caches; }; + +// https://html.spec.whatwg.org/#microtask-queuing +partial interface mixin WindowOrWorkerGlobalScope { + undefined queueMicrotask(VoidFunction callback); +}; From 3f6c7c6e3d763e1ee06ce4b3ac286018c75f2ea1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 16 Jun 2024 09:38:35 +0200 Subject: [PATCH 406/641] Fix triggering `clippy::mem_forget` lint (#3985) --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 1 + tests/wasm/3944.rs | 6 ++++++ tests/wasm/closures.rs | 2 +- tests/wasm/ignore.rs | 2 ++ tests/wasm/main.rs | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/wasm/3944.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc66f5c606..4d18964b1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,9 @@ * Fixed Rust values not getting GC'd if they were created via. a constructor. [#3940](https://github.com/rustwasm/wasm-bindgen/pull/3940) +* Fix triggering `clippy::mem_forget` lint in exported structs. + [#3985](https://github.com/rustwasm/wasm-bindgen/pull/3985) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 268d74fc42c..0dc8ee3d00f 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -394,6 +394,7 @@ impl ToTokens for ast::Struct { #wasm_bindgen::__rt::std::result::Result::Err(value) } else { // Don't run `JsValue`'s destructor, `unwrap_fn` already did that for us. + #[allow(clippy::mem_forget)] #wasm_bindgen::__rt::std::mem::forget(value); unsafe { #wasm_bindgen::__rt::std::result::Result::Ok( diff --git a/tests/wasm/3944.rs b/tests/wasm/3944.rs new file mode 100644 index 00000000000..8a22b3d4ac3 --- /dev/null +++ b/tests/wasm/3944.rs @@ -0,0 +1,6 @@ +#![deny(clippy::mem_forget)] + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +struct Foo2; diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index a0247b5d1ca..c36b5720559 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -473,7 +473,7 @@ fn drop_during_call_ok() { assert_eq!(x, 3); // make sure `A` is bound to our closure environment. - drop(&a); + let _a = &a; unsafe { assert!(!HIT); } diff --git a/tests/wasm/ignore.rs b/tests/wasm/ignore.rs index 39897e31b49..3e0cf927df6 100644 --- a/tests/wasm/ignore.rs +++ b/tests/wasm/ignore.rs @@ -1,3 +1,5 @@ +use wasm_bindgen_test::wasm_bindgen_test; + #[wasm_bindgen_test] #[ignore] fn should_panic() { diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index 6272352c2e9..fdef95f23d7 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -14,6 +14,8 @@ extern crate serde_derive; use wasm_bindgen::prelude::*; +#[path = "3944.rs"] +pub mod _3944; pub mod api; pub mod arg_names; pub mod async_vecs; @@ -31,6 +33,7 @@ pub mod final_; pub mod futures; pub mod gc; pub mod getters_and_setters; +pub mod ignore; pub mod import_class; pub mod imports; pub mod intrinsics; From dd504330637becd0bfb98e4e3e35f66572f26fe3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 16 Jun 2024 11:18:52 +0200 Subject: [PATCH 407/641] Update Clippy to Rust v1.79 (#3987) --- crates/backend/src/encode.rs | 2 +- crates/webidl/src/util.rs | 10 ++++---- examples/webaudio/src/lib.rs | 7 +----- src/lib.rs | 5 ++-- tests/wasm/bigint.rs | 12 +++++----- tests/wasm/math.rs | 24 +++++++++---------- tests/wasm/optional_primitives.rs | 40 +++++++++++++++---------------- tests/wasm/usize.rs | 8 +++---- 8 files changed, 50 insertions(+), 58 deletions(-) diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 529edb0dc88..4bf9047300c 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -437,7 +437,7 @@ impl Encode for u32 { impl Encode for usize { fn encode(&self, dst: &mut Encoder) { - assert!(*self <= u32::max_value() as usize); + assert!(*self <= u32::MAX as usize); (*self as u32).encode(dst); } } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index db53f7f5846..3e8cce3e4fb 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -103,13 +103,11 @@ pub(crate) fn array(base_ty: &str, pos: TypePosition, immutable: bool) -> syn::T /// Map a webidl const value to the correct wasm-bindgen const value pub fn webidl_const_v_to_backend_const_v(v: &ConstValueLit) -> ConstValue { - use std::f64::{INFINITY, NAN, NEG_INFINITY}; - match *v { ConstValueLit::Boolean(b) => ConstValue::Boolean(b.0), - ConstValueLit::Float(FloatLit::NegInfinity(_)) => ConstValue::Float(NEG_INFINITY), - ConstValueLit::Float(FloatLit::Infinity(_)) => ConstValue::Float(INFINITY), - ConstValueLit::Float(FloatLit::NaN(_)) => ConstValue::Float(NAN), + ConstValueLit::Float(FloatLit::NegInfinity(_)) => ConstValue::Float(f64::NEG_INFINITY), + ConstValueLit::Float(FloatLit::Infinity(_)) => ConstValue::Float(f64::INFINITY), + ConstValueLit::Float(FloatLit::NaN(_)) => ConstValue::Float(f64::NAN), ConstValueLit::Float(FloatLit::Value(s)) => ConstValue::Float(s.0.parse().unwrap()), ConstValueLit::Integer(lit) => { let mklit = |orig_text: &str, base: u32, offset: usize| { @@ -125,7 +123,7 @@ pub fn webidl_const_v_to_backend_const_v(v: &ConstValueLit) -> ConstValue { let n = u64::from_str_radix(text, base) .unwrap_or_else(|_| panic!("literal too big: {}", orig_text)); if negative { - let n = if n > (i64::min_value() as u64).wrapping_neg() { + let n = if n > (i64::MIN as u64).wrapping_neg() { panic!("literal too big: {}", orig_text) } else { n.wrapping_neg() as i64 diff --git a/examples/webaudio/src/lib.rs b/examples/webaudio/src/lib.rs index c4f847944ef..995b6504520 100644 --- a/examples/webaudio/src/lib.rs +++ b/examples/webaudio/src/lib.rs @@ -93,12 +93,7 @@ impl FmOsc { /// Sets the gain for this oscillator, between 0.0 and 1.0. #[wasm_bindgen] pub fn set_gain(&self, mut gain: f32) { - if gain > 1.0 { - gain = 1.0; - } - if gain < 0.0 { - gain = 0.0; - } + gain = gain.clamp(0.0, 1.0); self.gain.gain().set_value(gain); } diff --git a/src/lib.rs b/src/lib.rs index d0cee09c6b0..babb913bf4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,6 @@ use core::ops::{ Add, BitAnd, BitOr, BitXor, Deref, DerefMut, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub, }; use core::ptr::NonNull; -use core::u32; use crate::convert::{FromWasmAbi, TryFromJsValue, WasmRet, WasmSlice}; @@ -1503,7 +1502,7 @@ pub mod __rt { pub fn borrow(&self) -> Ref { unsafe { - if self.borrow.get() == usize::max_value() { + if self.borrow.get() == usize::MAX { borrow_fail(); } self.borrow.set(self.borrow.get() + 1); @@ -1519,7 +1518,7 @@ pub mod __rt { if self.borrow.get() != 0 { borrow_fail(); } - self.borrow.set(usize::max_value()); + self.borrow.set(usize::MAX); RefMut { value: &mut *self.value.get(), borrow: &self.borrow, diff --git a/tests/wasm/bigint.rs b/tests/wasm/bigint.rs index 30eb5c5cf7d..6d179d396d1 100644 --- a/tests/wasm/bigint.rs +++ b/tests/wasm/bigint.rs @@ -25,22 +25,22 @@ pub fn neg_one() -> i64 { #[wasm_bindgen] pub fn i32_min() -> i64 { - i32::min_value() as i64 + i32::MIN as i64 } #[wasm_bindgen] pub fn u32_max() -> u64 { - u32::max_value() as u64 + u32::MAX as u64 } #[wasm_bindgen] pub fn i64_min() -> i64 { - i64::min_value() + i64::MIN } #[wasm_bindgen] pub fn u64_max() -> u64 { - u64::max_value() + u64::MAX } #[wasm_bindgen] @@ -65,12 +65,12 @@ pub fn u64_jsvalue_identity(a: u64) -> JsValue { #[wasm_bindgen] pub fn i128_min_jsvalue() -> JsValue { - JsValue::from(i128::min_value()) + JsValue::from(i128::MIN) } #[wasm_bindgen] pub fn u128_max_jsvalue() -> JsValue { - JsValue::from(u128::max_value()) + JsValue::from(u128::MAX) } #[wasm_bindgen] diff --git a/tests/wasm/math.rs b/tests/wasm/math.rs index 5462cc2d475..7b1e92a47cf 100644 --- a/tests/wasm/math.rs +++ b/tests/wasm/math.rs @@ -94,24 +94,24 @@ macro_rules! t_roundtrip { #[wasm_bindgen_test] fn limits_correct() { - t_roundtrip!(roundtrip_i8(i8::min_value())); + t_roundtrip!(roundtrip_i8(i8::MIN)); t_roundtrip!(roundtrip_i8(0)); - t_roundtrip!(roundtrip_i8(i8::max_value())); - t_roundtrip!(roundtrip_i16(i16::min_value())); + t_roundtrip!(roundtrip_i8(i8::MAX)); + t_roundtrip!(roundtrip_i16(i16::MIN)); t_roundtrip!(roundtrip_i16(0)); - t_roundtrip!(roundtrip_i16(i16::max_value())); - t_roundtrip!(roundtrip_i32(i32::min_value())); + t_roundtrip!(roundtrip_i16(i16::MAX)); + t_roundtrip!(roundtrip_i32(i32::MIN)); t_roundtrip!(roundtrip_i32(0)); - t_roundtrip!(roundtrip_i32(i32::max_value())); - t_roundtrip!(roundtrip_u8(u8::min_value())); + t_roundtrip!(roundtrip_i32(i32::MAX)); + t_roundtrip!(roundtrip_u8(u8::MIN)); t_roundtrip!(roundtrip_u8(0)); - t_roundtrip!(roundtrip_u8(u8::max_value())); - t_roundtrip!(roundtrip_u16(u16::min_value())); + t_roundtrip!(roundtrip_u8(u8::MAX)); + t_roundtrip!(roundtrip_u16(u16::MIN)); t_roundtrip!(roundtrip_u16(0)); - t_roundtrip!(roundtrip_u16(u16::max_value())); - t_roundtrip!(roundtrip_u32(u32::min_value())); + t_roundtrip!(roundtrip_u16(u16::MAX)); + t_roundtrip!(roundtrip_u32(u32::MIN)); t_roundtrip!(roundtrip_u32(0)); - t_roundtrip!(roundtrip_u32(u32::max_value())); + t_roundtrip!(roundtrip_u32(u32::MAX)); test_js_roundtrip(); diff --git a/tests/wasm/optional_primitives.rs b/tests/wasm/optional_primitives.rs index b314ae5ce29..027bc18c99f 100644 --- a/tests/wasm/optional_primitives.rs +++ b/tests/wasm/optional_primitives.rs @@ -43,12 +43,12 @@ pub fn optional_i32_neg_one() -> Option { #[wasm_bindgen] pub fn optional_i32_min() -> Option { - Some(i32::min_value()) + Some(i32::MIN) } #[wasm_bindgen] pub fn optional_i32_max() -> Option { - Some(i32::max_value()) + Some(i32::MAX) } #[wasm_bindgen] @@ -73,12 +73,12 @@ pub fn optional_u32_one() -> Option { #[wasm_bindgen] pub fn optional_u32_min() -> Option { - Some(u32::min_value()) + Some(u32::MIN) } #[wasm_bindgen] pub fn optional_u32_max() -> Option { - Some(u32::max_value()) + Some(u32::MAX) } #[wasm_bindgen] @@ -108,12 +108,12 @@ pub fn optional_isize_neg_one() -> Option { #[wasm_bindgen] pub fn optional_isize_min() -> Option { - Some(isize::min_value()) + Some(isize::MIN) } #[wasm_bindgen] pub fn optional_isize_max() -> Option { - Some(isize::max_value()) + Some(isize::MAX) } #[wasm_bindgen] @@ -138,12 +138,12 @@ pub fn optional_usize_one() -> Option { #[wasm_bindgen] pub fn optional_usize_min() -> Option { - Some(usize::min_value()) + Some(usize::MIN) } #[wasm_bindgen] pub fn optional_usize_max() -> Option { - Some(usize::max_value()) + Some(usize::MAX) } #[wasm_bindgen] @@ -223,12 +223,12 @@ pub fn optional_i8_neg_one() -> Option { #[wasm_bindgen] pub fn optional_i8_min() -> Option { - Some(i8::min_value()) + Some(i8::MIN) } #[wasm_bindgen] pub fn optional_i8_max() -> Option { - Some(i8::max_value()) + Some(i8::MAX) } #[wasm_bindgen] @@ -253,12 +253,12 @@ pub fn optional_u8_one() -> Option { #[wasm_bindgen] pub fn optional_u8_min() -> Option { - Some(u8::min_value()) + Some(u8::MIN) } #[wasm_bindgen] pub fn optional_u8_max() -> Option { - Some(u8::max_value()) + Some(u8::MAX) } #[wasm_bindgen] @@ -288,12 +288,12 @@ pub fn optional_i16_neg_one() -> Option { #[wasm_bindgen] pub fn optional_i16_min() -> Option { - Some(i16::min_value()) + Some(i16::MIN) } #[wasm_bindgen] pub fn optional_i16_max() -> Option { - Some(i16::max_value()) + Some(i16::MAX) } #[wasm_bindgen] @@ -318,12 +318,12 @@ pub fn optional_u16_one() -> Option { #[wasm_bindgen] pub fn optional_u16_min() -> Option { - Some(u16::min_value()) + Some(u16::MIN) } #[wasm_bindgen] pub fn optional_u16_max() -> Option { - Some(u16::max_value()) + Some(u16::MAX) } #[wasm_bindgen] @@ -353,12 +353,12 @@ pub fn optional_i64_neg_one() -> Option { #[wasm_bindgen] pub fn optional_i64_min() -> Option { - Some(i64::min_value()) + Some(i64::MIN) } #[wasm_bindgen] pub fn optional_i64_max() -> Option { - Some(i64::max_value()) + Some(i64::MAX) } #[wasm_bindgen] @@ -383,12 +383,12 @@ pub fn optional_u64_one() -> Option { #[wasm_bindgen] pub fn optional_u64_min() -> Option { - Some(u64::min_value()) + Some(u64::MIN) } #[wasm_bindgen] pub fn optional_u64_max() -> Option { - Some(u64::max_value()) + Some(u64::MAX) } #[wasm_bindgen] diff --git a/tests/wasm/usize.rs b/tests/wasm/usize.rs index 80395d21e91..b6178b0eb20 100644 --- a/tests/wasm/usize.rs +++ b/tests/wasm/usize.rs @@ -25,22 +25,22 @@ pub fn isize_neg_one() -> isize { #[wasm_bindgen] pub fn isize_i32_min() -> isize { - i32::min_value() as isize + i32::MIN as isize } #[wasm_bindgen] pub fn usize_u32_max() -> usize { - u32::max_value() as usize + u32::MAX as usize } #[wasm_bindgen] pub fn isize_min() -> isize { - isize::min_value() + isize::MIN } #[wasm_bindgen] pub fn usize_max() -> usize { - usize::max_value() + usize::MAX } #[wasm_bindgen] From 617167fbee7b49e40a0ed290ca00f79fff2f59f3 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Wed, 19 Jun 2024 20:39:08 +0200 Subject: [PATCH 408/641] Use `table.fill` in externref-xform (`TODO`) (#3446) --- crates/externref-xform/src/lib.rs | 15 ++++----------- crates/externref-xform/tests/anyref-param.wat | 3 ++- crates/externref-xform/tests/mixed-export.wat | 3 ++- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index ab9ee589173..faa2b1ac1ca 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -652,19 +652,12 @@ impl Transform<'_> { // Note that we pave over all our stack slots with `ref.null` to ensure // that the table doesn't accidentally hold a strong reference to items // no longer in use by our wasm instance. - // - // TODO: use `table.fill` once that's spec'd if externref_stack > 0 { - for i in 0..externref_stack { - body.local_get(fp); - if i > 0 { - body.i32_const(i).binop(BinaryOp::I32Add); - } - body.ref_null(ValType::Externref); - body.table_set(self.table); - } - body.local_get(fp) + .ref_null(ValType::Externref) + .i32_const(externref_stack) + .table_fill(self.table) + .local_get(fp) .i32_const(externref_stack) .binop(BinaryOp::I32Add) .global_set(self.stack_pointer); diff --git a/crates/externref-xform/tests/anyref-param.wat b/crates/externref-xform/tests/anyref-param.wat index 02e1eb4c050..715d908e892 100644 --- a/crates/externref-xform/tests/anyref-param.wat +++ b/crates/externref-xform/tests/anyref-param.wat @@ -25,7 +25,8 @@ call $foo local.get 1 ref.null extern - table.set 0 + i32.const 1 + table.fill 0 local.get 1 i32.const 1 i32.add diff --git a/crates/externref-xform/tests/mixed-export.wat b/crates/externref-xform/tests/mixed-export.wat index e1ed4014c42..02327414562 100644 --- a/crates/externref-xform/tests/mixed-export.wat +++ b/crates/externref-xform/tests/mixed-export.wat @@ -34,7 +34,8 @@ call $a local.get 5 ref.null extern - table.set 0 + i32.const 1 + table.fill 0 local.get 5 i32.const 1 i32.add From 9aa86a6ecbcc5d6f47e335f7bcae3e2b62ff852a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 19 Jun 2024 21:10:02 +0200 Subject: [PATCH 409/641] Missing changelog entry for `table.fill` (#3994) --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d18964b1ee..14ed67d1e22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ * Greatly improve the performance of sending WebIDL 'string enums' across the JavaScript boundary by converting the enum variant string to/from an int. [#3915](https://github.com/rustwasm/wasm-bindgen/pull/3915) +* Use `table.fill` when appropriate. + [#3446](https://github.com/rustwasm/wasm-bindgen/pull/3446) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. From 6c02450a83865124b267fa08f114cede7ae15bf3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 24 Jun 2024 09:09:40 +0200 Subject: [PATCH 410/641] Implement WebIDL `(Getter|Setter)Throws` (#3998) --- crates/webidl/src/constants.rs | 554 +++++++++++++++++++++++++++++++++ crates/webidl/src/lib.rs | 12 +- crates/webidl/src/util.rs | 34 +- 3 files changed, 595 insertions(+), 5 deletions(-) diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 56e13a8b9b4..de9129f96a0 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -153,3 +153,557 @@ pub(crate) static FIXED_INTERFACES: Lazy< ), ]) }); + +pub(crate) static BREAKING_GETTER_THROWS: Lazy>> = + Lazy::new(|| { + BTreeMap::from_iter([ + ("Blob", vec!["size"]), + ("CanvasRenderingContext2D", vec!["lineJoin"]), + ("ExtendableMessageEvent", vec!["data"]), + ("File", vec!["lastModified"]), + ("FileSystemEntry", vec!["name", "fullPath"]), + ("HTMLElement", vec!["innerText"]), + ("MessageEvent", vec!["data"]), + ("OffscreenCanvasRenderingContext2D", vec!["lineJoin"]), + ("URL", vec!["origin"]), + ]) + }); + +pub(crate) static BREAKING_SETTER_THROWS: Lazy>> = + Lazy::new(|| { + BTreeMap::from_iter([ + ( + "AnalyserNode", + vec![ + "fftSize", + "minDecibels", + "maxDecibels", + "smoothingTimeConstant", + ], + ), + ("Animation", vec!["currentTime"]), + ("Attr", vec!["value"]), + ( + "AudioNode", + vec!["channelCount", "channelCountMode", "channelInterpretation"], + ), + ("CSSConditionRule", vec!["conditionText"]), + ("CSSFontFeatureValuesRule", vec!["fontFamily", "valueText"]), + ("CSSStyleDeclaration", vec!["cssText"]), + ("CanvasRenderingContext2D", vec!["filter", "font"]), + ("CharacterData", vec!["data"]), + ("ConvolverNode", vec!["buffer"]), + ("DOMTokenList", vec!["value"]), + ("Document", vec!["title", "body"]), + ("Element", vec!["innerHTML", "outerHTML", "slot"]), + ( + "FontFace", + vec![ + "family", + "style", + "weight", + "stretch", + "unicodeRange", + "variant", + "featureSettings", + "variationSettings", + "display", + ], + ), + ( + "HTMLAnchorElement", + vec![ + "target", + "download", + "ping", + "rel", + "referrerPolicy", + "hreflang", + "type", + "coords", + "charset", + "name", + "rev", + "shape", + "href", + ], + ), + ( + "HTMLAreaElement", + vec![ + "alt", + "coords", + "shape", + "target", + "download", + "ping", + "rel", + "referrerPolicy", + "noHref", + "href", + ], + ), + ("HTMLBRElement", vec!["clear"]), + ("HTMLBaseElement", vec!["href", "target"]), + ( + "HTMLBodyElement", + vec!["text", "link", "vLink", "aLink", "bgColor", "background"], + ), + ( + "HTMLButtonElement", + vec![ + "autofocus", + "disabled", + "formAction", + "formEnctype", + "formMethod", + "formNoValidate", + "formTarget", + "name", + "type", + "value", + ], + ), + ("HTMLCanvasElement", vec!["width", "height"]), + ("HTMLDListElement", vec!["compact"]), + ("HTMLDataElement", vec!["value"]), + ("HTMLDetailsElement", vec!["open"]), + ("HTMLDialogElement", vec!["open"]), + ("HTMLDirectoryElement", vec!["compact"]), + ("HTMLDivElement", vec!["align"]), + ("HTMLDocument", vec!["domain", "designMode"]), + ( + "HTMLElement", + vec![ + "dir", + "hidden", + "tabIndex", + "accessKey", + "draggable", + "contentEditable", + "spellcheck", + ], + ), + ( + "HTMLEmbedElement", + vec!["src", "type", "width", "height", "align", "name"], + ), + ("HTMLFieldSetElement", vec!["disabled", "name"]), + ("HTMLFontElement", vec!["color", "face", "size"]), + ( + "HTMLFormElement", + vec![ + "acceptCharset", + "action", + "autocomplete", + "enctype", + "encoding", + "method", + "name", + "noValidate", + "target", + ], + ), + ( + "HTMLFrameElement", + vec![ + "name", + "scrolling", + "src", + "frameBorder", + "longDesc", + "noResize", + "marginHeight", + "marginWidth", + ], + ), + ("HTMLFrameSetElement", vec!["cols", "rows"]), + ( + "HTMLHRElement", + vec!["align", "color", "noShade", "size", "width"], + ), + ("HTMLHeadingElement", vec!["align"]), + ("HTMLHtmlElement", vec!["version"]), + ( + "HTMLIFrameElement", + vec![ + "src", + "srcdoc", + "name", + "allowFullscreen", + "allowPaymentRequest", + "width", + "height", + "referrerPolicy", + "align", + "scrolling", + "frameBorder", + "longDesc", + "marginHeight", + "marginWidth", + ], + ), + ( + "HTMLImageElement", + vec![ + "alt", + "src", + "srcset", + "crossOrigin", + "useMap", + "referrerPolicy", + "isMap", + "width", + "height", + "decoding", + "name", + "align", + "hspace", + "vspace", + "longDesc", + "border", + "sizes", + ], + ), + ( + "HTMLInputElement", + vec![ + "accept", + "alt", + "autocomplete", + "autofocus", + "defaultChecked", + "disabled", + "formAction", + "formEnctype", + "formMethod", + "formNoValidate", + "formTarget", + "height", + "inputMode", + "max", + "maxLength", + "min", + "minLength", + "multiple", + "name", + "pattern", + "placeholder", + "readOnly", + "required", + "size", + "src", + "step", + "type", + "defaultValue", + "value", + "valueAsNumber", + "width", + "align", + "useMap", + "webkitdirectory", + ], + ), + ("HTMLLIElement", vec!["value", "type"]), + ("HTMLLegendElement", vec!["align"]), + ( + "HTMLLinkElement", + vec![ + "href", + "crossOrigin", + "rel", + "media", + "hreflang", + "type", + "referrerPolicy", + "charset", + "rev", + "target", + "integrity", + "as", + ], + ), + ("HTMLMapElement", vec!["name"]), + ( + "HTMLMediaElement", + vec![ + "src", + "crossOrigin", + "preload", + "currentTime", + "defaultPlaybackRate", + "playbackRate", + "autoplay", + "loop", + "controls", + "volume", + "defaultMuted", + ], + ), + ("HTMLMenuElement", vec!["type", "label", "compact"]), + ( + "HTMLMenuItemElement", + vec![ + "type", + "label", + "icon", + "disabled", + "radiogroup", + "defaultChecked", + ], + ), + ( + "HTMLMetaElement", + vec!["name", "httpEquiv", "content", "scheme"], + ), + ( + "HTMLMeterElement", + vec!["value", "min", "max", "low", "high", "optimum"], + ), + ("HTMLModElement", vec!["cite", "dateTime"]), + ( + "HTMLOListElement", + vec!["reversed", "start", "type", "compact"], + ), + ( + "HTMLObjectElement", + vec![ + "data", + "type", + "typeMustMatch", + "name", + "useMap", + "width", + "height", + "align", + "archive", + "code", + "declare", + "hspace", + "standby", + "vspace", + "codeBase", + "codeType", + "border", + ], + ), + ("HTMLOptGroupElement", vec!["disabled", "label"]), + ( + "HTMLOptionElement", + vec!["disabled", "label", "defaultSelected", "value", "text"], + ), + ("HTMLOptionsCollection", vec!["length"]), + ("HTMLOutputElement", vec!["name", "defaultValue", "value"]), + ("HTMLParagraphElement", vec!["align"]), + ( + "HTMLParamElement", + vec!["name", "value", "type", "valueType"], + ), + ("HTMLPreElement", vec!["width"]), + ("HTMLProgressElement", vec!["value", "max"]), + ("HTMLQuoteElement", vec!["cite"]), + ( + "HTMLScriptElement", + vec![ + "src", + "type", + "noModule", + "charset", + "async", + "defer", + "crossOrigin", + "event", + "htmlFor", + "integrity", + ], + ), + ( + "HTMLSelectElement", + vec![ + "autofocus", + "autocomplete", + "disabled", + "multiple", + "name", + "required", + "size", + "length", + "selectedIndex", + ], + ), + ("HTMLSlotElement", vec!["name"]), + ( + "HTMLSourceElement", + vec!["src", "type", "srcset", "sizes", "media"], + ), + ("HTMLStyleElement", vec!["media", "type"]), + ("HTMLTableCaptionElement", vec!["align"]), + ( + "HTMLTableCellElement", + vec![ + "colSpan", "rowSpan", "headers", "align", "axis", "height", "width", "ch", + "chOff", "noWrap", "vAlign", "bgColor", + ], + ), + ( + "HTMLTableColElement", + vec!["span", "align", "ch", "chOff", "vAlign", "width"], + ), + ( + "HTMLTableElement", + vec![ + "caption", + "tHead", + "tFoot", + "align", + "border", + "frame", + "rules", + "summary", + "width", + "bgColor", + "cellPadding", + "cellSpacing", + ], + ), + ( + "HTMLTableRowElement", + vec!["align", "ch", "chOff", "vAlign", "bgColor"], + ), + ( + "HTMLTableSectionElement", + vec!["align", "ch", "chOff", "vAlign"], + ), + ( + "HTMLTextAreaElement", + vec![ + "autocomplete", + "autofocus", + "cols", + "disabled", + "maxLength", + "minLength", + "name", + "placeholder", + "readOnly", + "required", + "rows", + "wrap", + "value", + ], + ), + ("HTMLTimeElement", vec!["dateTime"]), + ( + "HTMLTrackElement", + vec!["kind", "src", "srclang", "label", "default"], + ), + ("HTMLUListElement", vec!["compact", "type"]), + ("HTMLVideoElement", vec!["width", "height", "poster"]), + ("IDBIndex", vec!["name"]), + ("IDBObjectStore", vec!["name"]), + ("MediaSource", vec!["duration"]), + ("Node", vec!["nodeValue", "textContent"]), + ("OffscreenCanvas", vec!["width", "height"]), + ("OffscreenCanvasRenderingContext2D", vec!["filter", "font"]), + ("OscillatorNode", vec!["type"]), + ( + "SVGAElement", + vec![ + "download", + "ping", + "rel", + "referrerPolicy", + "hreflang", + "type", + ], + ), + ( + "SVGAngle", + vec!["value", "valueInSpecifiedUnits", "valueAsString"], + ), + ("SVGAnimatedEnumeration", vec!["baseVal"]), + ("SVGElement", vec!["tabIndex"]), + ("SVGLength", vec!["valueInSpecifiedUnits", "valueAsString"]), + ("SVGMatrix", vec!["a", "b", "c", "d", "e", "f"]), + ("SVGNumber", vec!["value"]), + ( + "SVGPathSegArcAbs", + vec!["x", "y", "r1", "r2", "angle", "largeArcFlag", "sweepFlag"], + ), + ( + "SVGPathSegArcRel", + vec!["x", "y", "r1", "r2", "angle", "largeArcFlag", "sweepFlag"], + ), + ( + "SVGPathSegCurvetoCubicAbs", + vec!["x", "y", "x1", "y1", "x2", "y2"], + ), + ( + "SVGPathSegCurvetoCubicRel", + vec!["x", "y", "x1", "y1", "x2", "y2"], + ), + ( + "SVGPathSegCurvetoCubicSmoothAbs", + vec!["x", "y", "x2", "y2"], + ), + ( + "SVGPathSegCurvetoCubicSmoothRel", + vec!["x", "y", "x2", "y2"], + ), + ("SVGPathSegCurvetoQuadraticAbs", vec!["x", "y", "x1", "y1"]), + ("SVGPathSegCurvetoQuadraticRel", vec!["x", "y", "x1", "y1"]), + ("SVGPathSegCurvetoQuadraticSmoothAbs", vec!["x", "y"]), + ("SVGPathSegCurvetoQuadraticSmoothRel", vec!["x", "y"]), + ("SVGPathSegLinetoAbs", vec!["x", "y"]), + ("SVGPathSegLinetoHorizontalAbs", vec!["x"]), + ("SVGPathSegLinetoHorizontalRel", vec!["x"]), + ("SVGPathSegLinetoRel", vec!["x", "y"]), + ("SVGPathSegLinetoVerticalAbs", vec!["y"]), + ("SVGPathSegLinetoVerticalRel", vec!["y"]), + ("SVGPathSegMovetoAbs", vec!["x", "y"]), + ("SVGPathSegMovetoRel", vec!["x", "y"]), + ("SVGPoint", vec!["x", "y"]), + ("SVGPreserveAspectRatio", vec!["align", "meetOrSlice"]), + ("SVGRect", vec!["x", "y", "width", "height"]), + ("SVGSVGElement", vec!["zoomAndPan"]), + ("SVGScriptElement", vec!["type", "crossOrigin"]), + ( + "SVGStyleElement", + vec!["xmlspace", "type", "media", "title"], + ), + ("SVGViewElement", vec!["zoomAndPan"]), + ("SVGZoomAndPan", vec!["zoomAndPan"]), + ("ShadowRoot", vec!["innerHTML"]), + ( + "SourceBuffer", + vec![ + "mode", + "timestampOffset", + "appendWindowStart", + "appendWindowEnd", + ], + ), + ("TreeWalker", vec!["currentNode"]), + ("URL", vec!["href", "protocol"]), + ( + "VTTCue", + vec!["lineAlign", "position", "positionAlign", "size"], + ), + ( + "VTTRegion", + vec![ + "width", + "lines", + "regionAnchorX", + "regionAnchorY", + "viewportAnchorX", + "viewportAnchorY", + ], + ), + ("WaveShaperNode", vec!["curve"]), + ( + "XMLHttpRequest", + vec!["timeout", "withCredentials", "responseType"], + ), + ]) + }); diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 6bd02dfcdee..f011fe98006 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -25,8 +25,9 @@ use crate::generator::{ use crate::idl_type::ToIdlType; use crate::traverse::TraverseType; use crate::util::{ - camel_case_ident, is_structural, is_type_unstable, read_dir, shouty_snake_case_ident, - snake_case_ident, throws, webidl_const_v_to_backend_const_v, TypePosition, + camel_case_ident, getter_throws, is_structural, is_type_unstable, read_dir, setter_throws, + shouty_snake_case_ident, snake_case_ident, throws, webidl_const_v_to_backend_const_v, + TypePosition, }; use anyhow::Context; use anyhow::Result; @@ -597,6 +598,7 @@ impl<'src> FirstPassRecord<'src> { member.identifier.0.to_string(), &member.attributes, data.definition_attributes, + &js_name, unstable, ); } @@ -630,6 +632,7 @@ impl<'src> FirstPassRecord<'src> { member.identifier.0.to_string(), &member.attributes, data.definition_attributes, + &js_name, unstable, ); } @@ -670,6 +673,7 @@ impl<'src> FirstPassRecord<'src> { js_name: String, attrs: &'src Option>, container_attrs: Option<&'src ExtendedAttributeList<'src>>, + parent_js_name: &str, unstable: bool, ) { use weedle::interface::StringifierOrInheritOrStatic::*; @@ -697,7 +701,7 @@ impl<'src> FirstPassRecord<'src> { attributes.push(InterfaceAttribute { is_static, structural, - catch, + catch: catch || getter_throws(parent_js_name, &js_name, attrs), ty, js_name: js_name.clone(), kind, @@ -718,7 +722,7 @@ impl<'src> FirstPassRecord<'src> { attributes.push(InterfaceAttribute { is_static, structural, - catch, + catch: catch || setter_throws(parent_js_name, &js_name, attrs), ty, js_name, kind, diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 3e8cce3e4fb..44dffb0af70 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -13,7 +13,9 @@ use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{MayBeNull, NonAnyType, SingleType}; -use crate::constants::{FIXED_INTERFACES, IMMUTABLE_SLICE_WHITELIST}; +use crate::constants::{ + BREAKING_GETTER_THROWS, BREAKING_SETTER_THROWS, FIXED_INTERFACES, IMMUTABLE_SLICE_WHITELIST, +}; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; use crate::idl_type::{IdlType, ToIdlType}; @@ -625,6 +627,36 @@ pub fn throws(attrs: &Option) -> bool { has_named_attribute(attrs.as_ref(), "Throws") } +/// Whether a getter is marked as throwing. +pub fn getter_throws( + parent_js_name: &str, + js_name: &str, + attrs: &Option, +) -> bool { + if let Some(parent) = BREAKING_GETTER_THROWS.get(parent_js_name) { + if parent.contains(&js_name) { + return false; + } + } + + has_named_attribute(attrs.as_ref(), "GetterThrows") +} + +/// Whether a setter is marked as throwing. +pub fn setter_throws( + parent_js_name: &str, + js_name: &str, + attrs: &Option, +) -> bool { + if let Some(parent) = BREAKING_SETTER_THROWS.get(parent_js_name) { + if parent.contains(&js_name) { + return false; + } + } + + has_named_attribute(attrs.as_ref(), "SetterThrows") +} + fn flag_slices_immutable(ty: &mut IdlType) { match ty { IdlType::Int8Array { immutable } From ad05eccd597680e4f70c0c8cf1419ecf63fb479e Mon Sep 17 00:00:00 2001 From: Marc-Stefan Cassola Date: Mon, 24 Jun 2024 16:06:40 +0100 Subject: [PATCH 411/641] Added changelog entry instruction to web-sys readme (#3999) --- crates/web-sys/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index 965f41ede0c..ab0cf1a2c63 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -32,3 +32,17 @@ If you don't see a particular web API in `web-sys`, here is how to add it. 2. Annotate the functions that can throw with `[Throws]` 3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml` 4. Run `git add .` to add all the generated files into git. +5. Add an entry in CHANGELOG.md like the following + ```md + ... + + ## Unreleased + + ### Added + + ... + + * Added + [#1234](https://github.com/rustwasm/wasm-bindgen/pull/1234) # <- link to your PR + ``` + From 9beb4c3ff0605f5588314a177c3be4387d2cf4e9 Mon Sep 17 00:00:00 2001 From: Marc-Stefan Cassola Date: Mon, 24 Jun 2024 16:09:54 +0100 Subject: [PATCH 412/641] Added experimental User-Agent Client Hints (#3989) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 4 + crates/web-sys/src/features/gen_Navigator.rs | 12 ++ .../features/gen_NavigatorUaBrandVersion.rs | 63 +++++++ .../src/features/gen_NavigatorUaData.rs | 78 ++++++++ .../web-sys/src/features/gen_UaDataValues.rs | 167 ++++++++++++++++++ .../src/features/gen_UaLowEntropyJson.rs | 76 ++++++++ .../src/features/gen_WorkerNavigator.rs | 12 ++ crates/web-sys/src/features/mod.rs | 28 +++ .../webidls/unstable/NavigatorUAData.webidl | 41 +++++ 10 files changed, 484 insertions(+) create mode 100644 crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs create mode 100644 crates/web-sys/src/features/gen_NavigatorUaData.rs create mode 100644 crates/web-sys/src/features/gen_UaDataValues.rs create mode 100644 crates/web-sys/src/features/gen_UaLowEntropyJson.rs create mode 100644 crates/web-sys/webidls/unstable/NavigatorUAData.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 14ed67d1e22..e44c6af0754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ * Add bindings for `queueMicrotask`. [#3981](https://github.com/rustwasm/wasm-bindgen/pull/3981) +* Add experimental bindings for User Agent Client Hints API + [#3989](https://github.com/rustwasm/wasm-bindgen/pull/3989) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 3ddd4511d29..83c2b115efd 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -875,6 +875,8 @@ NativeOsFileWriteAtomicOptions = [] NavigationType = [] Navigator = [] NavigatorAutomationInformation = [] +NavigatorUaBrandVersion = [] +NavigatorUaData = [] NetworkCommandOptions = [] NetworkInformation = ["EventTarget"] NetworkResultOptions = [] @@ -1409,6 +1411,8 @@ TreeWalker = [] U2f = [] U2fClientData = [] ULongRange = [] +UaDataValues = [] +UaLowEntropyJson = [] UdpMessageEventInit = [] UdpOptions = [] UiEvent = ["Event"] diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index e97839f9333..e148cd27fc5 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -331,6 +331,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`, `StorageManager`*"] pub fn storage(this: &Navigator) -> StorageManager; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "NavigatorUaData")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = userAgentData)] + #[doc = "Getter for the `userAgentData` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`, `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn user_agent_data(this: &Navigator) -> NavigatorUaData; # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = canShare)] #[doc = "The `canShare()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs new file mode 100644 index 00000000000..49e7ae06847 --- /dev/null +++ b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = NavigatorUABrandVersion)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `NavigatorUaBrandVersion` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type NavigatorUaBrandVersion; + #[wasm_bindgen(method, setter = "brand")] + fn brand_shim(this: &NavigatorUaBrandVersion, val: &str); + #[wasm_bindgen(method, setter = "version")] + fn version_shim(this: &NavigatorUaBrandVersion, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl NavigatorUaBrandVersion { + #[doc = "Construct a new `NavigatorUaBrandVersion`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `brand` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn brand(&mut self, val: &str) -> &mut Self { + self.brand_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn version(&mut self, val: &str) -> &mut Self { + self.version_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for NavigatorUaBrandVersion { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_NavigatorUaData.rs b/crates/web-sys/src/features/gen_NavigatorUaData.rs new file mode 100644 index 00000000000..8dc54746be6 --- /dev/null +++ b/crates/web-sys/src/features/gen_NavigatorUaData.rs @@ -0,0 +1,78 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = NavigatorUAData , typescript_type = "NavigatorUAData")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `NavigatorUaData` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type NavigatorUaData; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "NavigatorUAData" , js_name = brands)] + #[doc = "Getter for the `brands` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/brands)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn brands(this: &NavigatorUaData) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "NavigatorUAData" , js_name = mobile)] + #[doc = "Getter for the `mobile` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/mobile)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mobile(this: &NavigatorUaData) -> bool; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "NavigatorUAData" , js_name = platform)] + #[doc = "Getter for the `platform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn platform(this: &NavigatorUaData) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "NavigatorUAData" , js_name = getHighEntropyValues)] + #[doc = "The `getHighEntropyValues()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_high_entropy_values( + this: &NavigatorUaData, + hints: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UaLowEntropyJson")] + # [wasm_bindgen (method , structural , js_class = "NavigatorUAData" , js_name = toJSON)] + #[doc = "The `toJSON()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/toJSON)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`, `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn to_json(this: &NavigatorUaData) -> UaLowEntropyJson; +} diff --git a/crates/web-sys/src/features/gen_UaDataValues.rs b/crates/web-sys/src/features/gen_UaDataValues.rs new file mode 100644 index 00000000000..bf16447c90d --- /dev/null +++ b/crates/web-sys/src/features/gen_UaDataValues.rs @@ -0,0 +1,167 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UADataValues)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UaDataValues` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UaDataValues; + #[wasm_bindgen(method, setter = "architecture")] + fn architecture_shim(this: &UaDataValues, val: &str); + #[wasm_bindgen(method, setter = "bitness")] + fn bitness_shim(this: &UaDataValues, val: &str); + #[wasm_bindgen(method, setter = "brands")] + fn brands_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "formFactors")] + fn form_factors_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "fullVersionList")] + fn full_version_list_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "mobile")] + fn mobile_shim(this: &UaDataValues, val: bool); + #[wasm_bindgen(method, setter = "model")] + fn model_shim(this: &UaDataValues, val: &str); + #[wasm_bindgen(method, setter = "platform")] + fn platform_shim(this: &UaDataValues, val: &str); + #[wasm_bindgen(method, setter = "platformVersion")] + fn platform_version_shim(this: &UaDataValues, val: &str); + #[wasm_bindgen(method, setter = "wow64")] + fn wow64_shim(this: &UaDataValues, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl UaDataValues { + #[doc = "Construct a new `UaDataValues`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `architecture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn architecture(&mut self, val: &str) -> &mut Self { + self.architecture_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bitness` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn bitness(&mut self, val: &str) -> &mut Self { + self.bitness_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `brands` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.brands_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `formFactors` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn form_factors(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.form_factors_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `fullVersionList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn full_version_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.full_version_list_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mobile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mobile(&mut self, val: bool) -> &mut Self { + self.mobile_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `model` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn model(&mut self, val: &str) -> &mut Self { + self.model_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `platform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn platform(&mut self, val: &str) -> &mut Self { + self.platform_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `platformVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn platform_version(&mut self, val: &str) -> &mut Self { + self.platform_version_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `wow64` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn wow64(&mut self, val: bool) -> &mut Self { + self.wow64_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for UaDataValues { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_UaLowEntropyJson.rs b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs new file mode 100644 index 00000000000..d6c1363ff14 --- /dev/null +++ b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs @@ -0,0 +1,76 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = UALowEntropyJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `UaLowEntropyJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type UaLowEntropyJson; + #[wasm_bindgen(method, setter = "brands")] + fn brands_shim(this: &UaLowEntropyJson, val: &::wasm_bindgen::JsValue); + #[wasm_bindgen(method, setter = "mobile")] + fn mobile_shim(this: &UaLowEntropyJson, val: bool); + #[wasm_bindgen(method, setter = "platform")] + fn platform_shim(this: &UaLowEntropyJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl UaLowEntropyJson { + #[doc = "Construct a new `UaLowEntropyJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `brands` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.brands_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mobile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn mobile(&mut self, val: bool) -> &mut Self { + self.mobile_shim(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `platform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn platform(&mut self, val: &str) -> &mut Self { + self.platform_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for UaLowEntropyJson { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index dc9fdf19315..aacffd95736 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -154,6 +154,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageManager`, `WorkerNavigator`*"] pub fn storage(this: &WorkerNavigator) -> StorageManager; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "NavigatorUaData")] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = userAgentData)] + #[doc = "Getter for the `userAgentData` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/userAgentData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaData`, `WorkerNavigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn user_agent_data(this: &WorkerNavigator) -> NavigatorUaData; # [wasm_bindgen (method , structural , js_class = "WorkerNavigator" , js_name = taintEnabled)] #[doc = "The `taintEnabled()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 098735ffc14..c2bd69f4d40 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -5906,6 +5906,20 @@ mod gen_NavigatorAutomationInformation; #[allow(unused_imports)] pub use gen_NavigatorAutomationInformation::*; +#[cfg(feature = "NavigatorUaBrandVersion")] +#[allow(non_snake_case)] +mod gen_NavigatorUaBrandVersion; +#[cfg(feature = "NavigatorUaBrandVersion")] +#[allow(unused_imports)] +pub use gen_NavigatorUaBrandVersion::*; + +#[cfg(feature = "NavigatorUaData")] +#[allow(non_snake_case)] +mod gen_NavigatorUaData; +#[cfg(feature = "NavigatorUaData")] +#[allow(unused_imports)] +pub use gen_NavigatorUaData::*; + #[cfg(feature = "NetworkCommandOptions")] #[allow(non_snake_case)] mod gen_NetworkCommandOptions; @@ -9644,6 +9658,20 @@ mod gen_ULongRange; #[allow(unused_imports)] pub use gen_ULongRange::*; +#[cfg(feature = "UaDataValues")] +#[allow(non_snake_case)] +mod gen_UaDataValues; +#[cfg(feature = "UaDataValues")] +#[allow(unused_imports)] +pub use gen_UaDataValues::*; + +#[cfg(feature = "UaLowEntropyJson")] +#[allow(non_snake_case)] +mod gen_UaLowEntropyJson; +#[cfg(feature = "UaLowEntropyJson")] +#[allow(unused_imports)] +pub use gen_UaLowEntropyJson::*; + #[cfg(feature = "UdpMessageEventInit")] #[allow(non_snake_case)] mod gen_UdpMessageEventInit; diff --git a/crates/web-sys/webidls/unstable/NavigatorUAData.webidl b/crates/web-sys/webidls/unstable/NavigatorUAData.webidl new file mode 100644 index 00000000000..d19a9ab08f9 --- /dev/null +++ b/crates/web-sys/webidls/unstable/NavigatorUAData.webidl @@ -0,0 +1,41 @@ +dictionary NavigatorUABrandVersion { + DOMString brand; + DOMString version; +}; + +dictionary UADataValues { + DOMString architecture; + DOMString bitness; + sequence brands; + sequence formFactors; + sequence fullVersionList; + DOMString model; + boolean mobile; + DOMString platform; + DOMString platformVersion; + // DOMString uaFullVersion; // deprecated in favor of fullVersionList + boolean wow64; +}; + +dictionary UALowEntropyJSON { + sequence brands; + boolean mobile; + DOMString platform; +}; + +[Exposed=(Window,Worker)] +interface NavigatorUAData { + readonly attribute FrozenArray brands; + readonly attribute boolean mobile; + readonly attribute DOMString platform; + Promise getHighEntropyValues(sequence hints); + UALowEntropyJSON toJSON(); +}; + +interface mixin NavigatorUA { + [SecureContext] readonly attribute NavigatorUAData userAgentData; +}; + +Navigator includes NavigatorUA; +WorkerNavigator includes NavigatorUA; + From 71bd366cf4f5f48a6992e6b5b7a7ced5151346cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Tue, 25 Jun 2024 00:28:33 +0200 Subject: [PATCH 413/641] Add bindings for `FocusOptions` (#3996) --- CHANGELOG.md | 3 ++ crates/web-sys/Cargo.toml | 1 + .../web-sys/src/features/gen_FocusOptions.rs | 46 +++++++++++++++++++ .../web-sys/src/features/gen_HtmlElement.rs | 8 ++++ crates/web-sys/src/features/mod.rs | 7 +++ .../webidls/enabled/FocusOptions.webidl | 13 ++++++ .../webidls/enabled/HTMLElement.webidl | 2 +- 7 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 crates/web-sys/src/features/gen_FocusOptions.rs create mode 100644 crates/web-sys/webidls/enabled/FocusOptions.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index e44c6af0754..455e089d9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Add experimental bindings for User Agent Client Hints API [#3989](https://github.com/rustwasm/wasm-bindgen/pull/3989) +* Add bindings for `FocusOptions`. + [#3996](https://github.com/rustwasm/wasm-bindgen/pull/3996) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 83c2b115efd..edb9ff187f0 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -418,6 +418,7 @@ FlashClassification = [] FlowControlType = [] FocusEvent = ["Event", "UiEvent"] FocusEventInit = [] +FocusOptions = [] FontData = [] FontFace = [] FontFaceDescriptors = [] diff --git a/crates/web-sys/src/features/gen_FocusOptions.rs b/crates/web-sys/src/features/gen_FocusOptions.rs new file mode 100644 index 00000000000..0efdeef5c81 --- /dev/null +++ b/crates/web-sys/src/features/gen_FocusOptions.rs @@ -0,0 +1,46 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FocusOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FocusOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + pub type FocusOptions; + #[wasm_bindgen(method, setter = "focusVisible")] + fn focus_visible_shim(this: &FocusOptions, val: bool); + #[wasm_bindgen(method, setter = "preventScroll")] + fn prevent_scroll_shim(this: &FocusOptions, val: bool); +} +impl FocusOptions { + #[doc = "Construct a new `FocusOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `focusVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + pub fn focus_visible(&mut self, val: bool) -> &mut Self { + self.focus_visible_shim(val); + self + } + #[doc = "Change the `preventScroll` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + pub fn prevent_scroll(&mut self, val: bool) -> &mut Self { + self.prevent_scroll_shim(val); + self + } +} +impl Default for FocusOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_HtmlElement.rs b/crates/web-sys/src/features/gen_HtmlElement.rs index e3259400231..24149ad9587 100644 --- a/crates/web-sys/src/features/gen_HtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlElement.rs @@ -1540,4 +1540,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn focus(this: &HtmlElement) -> Result<(), JsValue>; + #[cfg(feature = "FocusOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = focus)] + #[doc = "The `focus()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`, `HtmlElement`*"] + pub fn focus_with_options(this: &HtmlElement, options: &FocusOptions) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index c2bd69f4d40..486e99e0b18 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2707,6 +2707,13 @@ mod gen_FocusEventInit; #[allow(unused_imports)] pub use gen_FocusEventInit::*; +#[cfg(feature = "FocusOptions")] +#[allow(non_snake_case)] +mod gen_FocusOptions; +#[cfg(feature = "FocusOptions")] +#[allow(unused_imports)] +pub use gen_FocusOptions::*; + #[cfg(feature = "FontData")] #[allow(non_snake_case)] mod gen_FontData; diff --git a/crates/web-sys/webidls/enabled/FocusOptions.webidl b/crates/web-sys/webidls/enabled/FocusOptions.webidl new file mode 100644 index 00000000000..2a6725dfd77 --- /dev/null +++ b/crates/web-sys/webidls/enabled/FocusOptions.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/interaction.html#focusoptions + */ + +dictionary FocusOptions { + boolean preventScroll = false; + boolean focusVisible; +}; diff --git a/crates/web-sys/webidls/enabled/HTMLElement.webidl b/crates/web-sys/webidls/enabled/HTMLElement.webidl index 196638e71fb..f6516c3ad88 100644 --- a/crates/web-sys/webidls/enabled/HTMLElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLElement.webidl @@ -42,7 +42,7 @@ interface HTMLElement : Element { [CEReactions, SetterThrows, Pure] attribute long tabIndex; [Throws] - undefined focus(); + undefined focus(optional FocusOptions options = {}); [Throws] undefined blur(); [CEReactions, SetterThrows, Pure] From ad826519586351e1cafbd203e74e8db5b46a89a0 Mon Sep 17 00:00:00 2001 From: Pablo Sichert Date: Wed, 26 Jun 2024 17:53:53 +0200 Subject: [PATCH 414/641] Annotate methods in WebCodecs that throw (#3970) --- CHANGELOG.md | 3 + crates/web-sys/src/features/gen_AudioData.rs | 19 +++--- .../web-sys/src/features/gen_AudioDecoder.rs | 16 ++--- .../web-sys/src/features/gen_AudioEncoder.rs | 16 ++--- .../src/features/gen_EncodedAudioChunk.rs | 14 +++-- .../src/features/gen_EncodedVideoChunk.rs | 14 +++-- .../web-sys/src/features/gen_VideoDecoder.rs | 16 ++--- .../web-sys/src/features/gen_VideoEncoder.rs | 20 +++---- crates/web-sys/src/features/gen_VideoFrame.rs | 12 ++-- .../web-sys/webidls/unstable/WebCodecs.webidl | 58 +++++++++---------- 10 files changed, 103 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 455e089d9d6..c1c2ef677d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,9 @@ * Use `table.fill` when appropriate. [#3446](https://github.com/rustwasm/wasm-bindgen/pull/3446) +* Annotated methods in WebCodecs that throw. + [#3970](https://github.com/rustwasm/wasm-bindgen/pull/3970) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/src/features/gen_AudioData.rs b/crates/web-sys/src/features/gen_AudioData.rs index 08875c779de..91a1e8bc534 100644 --- a/crates/web-sys/src/features/gen_AudioData.rs +++ b/crates/web-sys/src/features/gen_AudioData.rs @@ -97,7 +97,7 @@ extern "C" { pub fn new(init: &AudioDataInit) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDataCopyToOptions")] - # [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = allocationSize)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = allocationSize)] #[doc = "The `allocationSize()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/allocationSize)"] @@ -106,9 +106,12 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn allocation_size(this: &AudioData, options: &AudioDataCopyToOptions) -> u32; + pub fn allocation_size( + this: &AudioData, + options: &AudioDataCopyToOptions, + ) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = clone)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = clone)] #[doc = "The `clone()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/clone)"] @@ -117,7 +120,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn clone(this: &AudioData) -> AudioData; + pub fn clone(this: &AudioData) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = close)] #[doc = "The `close()` method."] @@ -131,7 +134,7 @@ extern "C" { pub fn close(this: &AudioData); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDataCopyToOptions")] - # [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo)"] @@ -144,10 +147,10 @@ extern "C" { this: &AudioData, destination: &::js_sys::Object, options: &AudioDataCopyToOptions, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDataCopyToOptions")] - # [wasm_bindgen (method , structural , js_class = "AudioData" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo)"] @@ -160,5 +163,5 @@ extern "C" { this: &AudioData, destination: &mut [u8], options: &AudioDataCopyToOptions, - ); + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_AudioDecoder.rs b/crates/web-sys/src/features/gen_AudioDecoder.rs index 709d0d1d004..880a9c11a05 100644 --- a/crates/web-sys/src/features/gen_AudioDecoder.rs +++ b/crates/web-sys/src/features/gen_AudioDecoder.rs @@ -52,7 +52,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &AudioDecoderInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = close)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/close)"] @@ -61,10 +61,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn close(this: &AudioDecoder); + pub fn close(this: &AudioDecoder) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDecoderConfig")] - # [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = configure)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = configure)] #[doc = "The `configure()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/configure)"] @@ -73,10 +73,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configure(this: &AudioDecoder, config: &AudioDecoderConfig); + pub fn configure(this: &AudioDecoder, config: &AudioDecoderConfig) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedAudioChunk")] - # [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = decode)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = decode)] #[doc = "The `decode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/decode)"] @@ -85,7 +85,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn decode(this: &AudioDecoder, chunk: &EncodedAudioChunk); + pub fn decode(this: &AudioDecoder, chunk: &EncodedAudioChunk) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = flush)] #[doc = "The `flush()` method."] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_config_supported(config: &AudioDecoderConfig) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "AudioDecoder" , js_name = reset)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioDecoder" , js_name = reset)] #[doc = "The `reset()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/reset)"] @@ -119,5 +119,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn reset(this: &AudioDecoder); + pub fn reset(this: &AudioDecoder) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_AudioEncoder.rs b/crates/web-sys/src/features/gen_AudioEncoder.rs index 9bd90317d7e..5c51b28e541 100644 --- a/crates/web-sys/src/features/gen_AudioEncoder.rs +++ b/crates/web-sys/src/features/gen_AudioEncoder.rs @@ -52,7 +52,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &AudioEncoderInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = close)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/close)"] @@ -61,10 +61,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn close(this: &AudioEncoder); + pub fn close(this: &AudioEncoder) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioEncoderConfig")] - # [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = configure)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = configure)] #[doc = "The `configure()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/configure)"] @@ -73,10 +73,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configure(this: &AudioEncoder, config: &AudioEncoderConfig); + pub fn configure(this: &AudioEncoder, config: &AudioEncoderConfig) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioData")] - # [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = encode)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = encode)] #[doc = "The `encode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/encode)"] @@ -85,7 +85,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn encode(this: &AudioEncoder, data: &AudioData); + pub fn encode(this: &AudioEncoder, data: &AudioData) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = flush)] #[doc = "The `flush()` method."] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_config_supported(config: &AudioEncoderConfig) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "AudioEncoder" , js_name = reset)] + # [wasm_bindgen (catch , method , structural , js_class = "AudioEncoder" , js_name = reset)] #[doc = "The `reset()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/reset)"] @@ -119,5 +119,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn reset(this: &AudioEncoder); + pub fn reset(this: &AudioEncoder) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunk.rs b/crates/web-sys/src/features/gen_EncodedAudioChunk.rs index 17aed5aacfa..5947f9de091 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunk.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunk.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &EncodedAudioChunkInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk/copyTo)"] @@ -83,9 +83,12 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_buffer_source(this: &EncodedAudioChunk, destination: &::js_sys::Object); + pub fn copy_to_with_buffer_source( + this: &EncodedAudioChunk, + destination: &::js_sys::Object, + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk/copyTo)"] @@ -94,5 +97,8 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array(this: &EncodedAudioChunk, destination: &mut [u8]); + pub fn copy_to_with_u8_array( + this: &EncodedAudioChunk, + destination: &mut [u8], + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunk.rs b/crates/web-sys/src/features/gen_EncodedVideoChunk.rs index 808af2cf307..735112f30d6 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunk.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunk.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &EncodedVideoChunkInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk/copyTo)"] @@ -83,9 +83,12 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_buffer_source(this: &EncodedVideoChunk, destination: &::js_sys::Object); + pub fn copy_to_with_buffer_source( + this: &EncodedVideoChunk, + destination: &::js_sys::Object, + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)] #[doc = "The `copyTo()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk/copyTo)"] @@ -94,5 +97,8 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array(this: &EncodedVideoChunk, destination: &mut [u8]); + pub fn copy_to_with_u8_array( + this: &EncodedVideoChunk, + destination: &mut [u8], + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_VideoDecoder.rs b/crates/web-sys/src/features/gen_VideoDecoder.rs index 391b80719b6..606bf71ea6d 100644 --- a/crates/web-sys/src/features/gen_VideoDecoder.rs +++ b/crates/web-sys/src/features/gen_VideoDecoder.rs @@ -52,7 +52,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &VideoDecoderInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = close)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/close)"] @@ -61,10 +61,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn close(this: &VideoDecoder); + pub fn close(this: &VideoDecoder) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoDecoderConfig")] - # [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = configure)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = configure)] #[doc = "The `configure()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/configure)"] @@ -73,10 +73,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configure(this: &VideoDecoder, config: &VideoDecoderConfig); + pub fn configure(this: &VideoDecoder, config: &VideoDecoderConfig) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedVideoChunk")] - # [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = decode)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = decode)] #[doc = "The `decode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/decode)"] @@ -85,7 +85,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn decode(this: &VideoDecoder, chunk: &EncodedVideoChunk); + pub fn decode(this: &VideoDecoder, chunk: &EncodedVideoChunk) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = flush)] #[doc = "The `flush()` method."] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_config_supported(config: &VideoDecoderConfig) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoDecoder" , js_name = reset)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoDecoder" , js_name = reset)] #[doc = "The `reset()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/reset)"] @@ -119,5 +119,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn reset(this: &VideoDecoder); + pub fn reset(this: &VideoDecoder) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_VideoEncoder.rs b/crates/web-sys/src/features/gen_VideoEncoder.rs index 6144ce26b68..7f25a6ddf6a 100644 --- a/crates/web-sys/src/features/gen_VideoEncoder.rs +++ b/crates/web-sys/src/features/gen_VideoEncoder.rs @@ -52,7 +52,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new(init: &VideoEncoderInit) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = close)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoEncoder" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/close)"] @@ -61,10 +61,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn close(this: &VideoEncoder); + pub fn close(this: &VideoEncoder) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoEncoderConfig")] - # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = configure)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoEncoder" , js_name = configure)] #[doc = "The `configure()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/configure)"] @@ -73,10 +73,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configure(this: &VideoEncoder, config: &VideoEncoderConfig); + pub fn configure(this: &VideoEncoder, config: &VideoEncoderConfig) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrame")] - # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = encode)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoEncoder" , js_name = encode)] #[doc = "The `encode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/encode)"] @@ -85,10 +85,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn encode(this: &VideoEncoder, frame: &VideoFrame); + pub fn encode(this: &VideoEncoder, frame: &VideoFrame) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "VideoEncoderEncodeOptions", feature = "VideoFrame",))] - # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = encode)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoEncoder" , js_name = encode)] #[doc = "The `encode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/encode)"] @@ -101,7 +101,7 @@ extern "C" { this: &VideoEncoder, frame: &VideoFrame, options: &VideoEncoderEncodeOptions, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = flush)] #[doc = "The `flush()` method."] @@ -126,7 +126,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_config_supported(config: &VideoEncoderConfig) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoEncoder" , js_name = reset)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoEncoder" , js_name = reset)] #[doc = "The `reset()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/reset)"] @@ -135,5 +135,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn reset(this: &VideoEncoder); + pub fn reset(this: &VideoEncoder) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_VideoFrame.rs b/crates/web-sys/src/features/gen_VideoFrame.rs index 11302950911..7ae9be362f7 100644 --- a/crates/web-sys/src/features/gen_VideoFrame.rs +++ b/crates/web-sys/src/features/gen_VideoFrame.rs @@ -349,7 +349,7 @@ extern "C" { init: &VideoFrameBufferInit, ) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = allocationSize)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoFrame" , js_name = allocationSize)] #[doc = "The `allocationSize()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/allocationSize)"] @@ -358,10 +358,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn allocation_size(this: &VideoFrame) -> u32; + pub fn allocation_size(this: &VideoFrame) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrameCopyToOptions")] - # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = allocationSize)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoFrame" , js_name = allocationSize)] #[doc = "The `allocationSize()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/allocationSize)"] @@ -373,9 +373,9 @@ extern "C" { pub fn allocation_size_with_options( this: &VideoFrame, options: &VideoFrameCopyToOptions, - ) -> u32; + ) -> Result; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = clone)] + # [wasm_bindgen (catch , method , structural , js_class = "VideoFrame" , js_name = clone)] #[doc = "The `clone()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/clone)"] @@ -384,7 +384,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn clone(this: &VideoFrame) -> VideoFrame; + pub fn clone(this: &VideoFrame) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = close)] #[doc = "The `close()` method."] diff --git a/crates/web-sys/webidls/unstable/WebCodecs.webidl b/crates/web-sys/webidls/unstable/WebCodecs.webidl index 62c8618ab38..880323e1b43 100644 --- a/crates/web-sys/webidls/unstable/WebCodecs.webidl +++ b/crates/web-sys/webidls/unstable/WebCodecs.webidl @@ -5,11 +5,11 @@ interface AudioDecoder { readonly attribute CodecState state; readonly attribute unsigned long decodeQueueSize; - undefined configure(AudioDecoderConfig config); - undefined decode(EncodedAudioChunk chunk); + [Throws] undefined configure(AudioDecoderConfig config); + [Throws] undefined decode(EncodedAudioChunk chunk); Promise flush(); - undefined reset(); - undefined close(); + [Throws] undefined reset(); + [Throws] undefined close(); static Promise isConfigSupported(AudioDecoderConfig config); }; @@ -28,11 +28,11 @@ interface VideoDecoder { readonly attribute CodecState state; readonly attribute unsigned long decodeQueueSize; - undefined configure(VideoDecoderConfig config); - undefined decode(EncodedVideoChunk chunk); + [Throws] undefined configure(VideoDecoderConfig config); + [Throws] undefined decode(EncodedVideoChunk chunk); Promise flush(); - undefined reset(); - undefined close(); + [Throws] undefined reset(); + [Throws] undefined close(); static Promise isConfigSupported(VideoDecoderConfig config); }; @@ -51,11 +51,11 @@ interface AudioEncoder { readonly attribute CodecState state; readonly attribute unsigned long encodeQueueSize; - undefined configure(AudioEncoderConfig config); - undefined encode(AudioData data); + [Throws] undefined configure(AudioEncoderConfig config); + [Throws] undefined encode(AudioData data); Promise flush(); - undefined reset(); - undefined close(); + [Throws] undefined reset(); + [Throws] undefined close(); static Promise isConfigSupported(AudioEncoderConfig config); }; @@ -80,11 +80,11 @@ interface VideoEncoder { readonly attribute CodecState state; readonly attribute unsigned long encodeQueueSize; - undefined configure(VideoEncoderConfig config); - undefined encode(VideoFrame frame, optional VideoEncoderEncodeOptions options = {}); + [Throws] undefined configure(VideoEncoderConfig config); + [Throws] undefined encode(VideoFrame frame, optional VideoEncoderEncodeOptions options = {}); Promise flush(); - undefined reset(); - undefined close(); + [Throws] undefined reset(); + [Throws] undefined close(); static Promise isConfigSupported(VideoEncoderConfig config); }; @@ -199,13 +199,13 @@ callback WebCodecsErrorCallback = undefined(DOMException error); [Exposed=(Window,DedicatedWorker)] interface EncodedAudioChunk { - constructor(EncodedAudioChunkInit init); + [Throws] constructor(EncodedAudioChunkInit init); readonly attribute EncodedAudioChunkType type; readonly attribute long long timestamp; // microseconds readonly attribute unsigned long long? duration; // microseconds readonly attribute unsigned long byteLength; - undefined copyTo([AllowShared] BufferSource destination); + [Throws] undefined copyTo([AllowShared] BufferSource destination); }; dictionary EncodedAudioChunkInit { @@ -222,13 +222,13 @@ enum EncodedAudioChunkType { [Exposed=(Window,DedicatedWorker)] interface EncodedVideoChunk { - constructor(EncodedVideoChunkInit init); + [Throws] constructor(EncodedVideoChunkInit init); readonly attribute EncodedVideoChunkType type; readonly attribute long long timestamp; // microseconds readonly attribute unsigned long long? duration; // microseconds readonly attribute unsigned long byteLength; - undefined copyTo([AllowShared] BufferSource destination); + [Throws] undefined copyTo([AllowShared] BufferSource destination); }; dictionary EncodedVideoChunkInit { @@ -245,7 +245,7 @@ enum EncodedVideoChunkType { [Exposed=(Window,DedicatedWorker), Serializable, Transferable] interface AudioData { - constructor(AudioDataInit init); + [Throws] constructor(AudioDataInit init); readonly attribute AudioSampleFormat? format; readonly attribute float sampleRate; @@ -254,9 +254,9 @@ interface AudioData { readonly attribute unsigned long long duration; // microseconds readonly attribute long long timestamp; // microseconds - unsigned long allocationSize(AudioDataCopyToOptions options); - undefined copyTo([AllowShared] BufferSource destination, AudioDataCopyToOptions options); - AudioData clone(); + [Throws] unsigned long allocationSize(AudioDataCopyToOptions options); + [Throws] undefined copyTo([AllowShared] BufferSource destination, AudioDataCopyToOptions options); + [Throws] AudioData clone(); undefined close(); }; @@ -289,8 +289,8 @@ enum AudioSampleFormat { [Exposed=(Window,DedicatedWorker), Serializable, Transferable] interface VideoFrame { - constructor(CanvasImageSource image, optional VideoFrameInit init = {}); - constructor([AllowShared] BufferSource data, VideoFrameBufferInit init); + [Throws] constructor(CanvasImageSource image, optional VideoFrameInit init = {}); + [Throws] constructor([AllowShared] BufferSource data, VideoFrameBufferInit init); readonly attribute VideoPixelFormat? format; readonly attribute unsigned long codedWidth; @@ -303,12 +303,12 @@ interface VideoFrame { readonly attribute long long? timestamp; // microseconds readonly attribute VideoColorSpace colorSpace; - unsigned long allocationSize( + [Throws] unsigned long allocationSize( optional VideoFrameCopyToOptions options = {}); Promise> copyTo( [AllowShared] BufferSource destination, optional VideoFrameCopyToOptions options = {}); - VideoFrame clone(); + [Throws] VideoFrame clone(); undefined close(); }; @@ -418,7 +418,7 @@ enum VideoMatrixCoefficients { [Exposed=(Window,DedicatedWorker), SecureContext] interface ImageDecoder { - constructor(ImageDecoderInit init); + [Throws] constructor(ImageDecoderInit init); readonly attribute DOMString type; readonly attribute boolean complete; From 10fd870ca04edd2b9ab9d83aaa041312ab345251 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 8 Jul 2024 02:21:42 +0200 Subject: [PATCH 415/641] Fix nightly CI (#4008) --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0157c230edc..c30297270de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -103,7 +103,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup default nightly-2024-02-06 + - run: rustup default nightly-2024-07-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. @@ -283,7 +283,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup default nightly-2024-02-06 + - run: rustup default nightly-2024-07-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - run: | From 32ae42cdaf38280e96b0f91404b285c478b739e6 Mon Sep 17 00:00:00 2001 From: Erik Moqvist Date: Tue, 9 Jul 2024 14:54:30 +0200 Subject: [PATCH 416/641] Added jitterBufferTarget to RtcRtpReceiver. (#3968) --- CHANGELOG.md | 3 +++ .../src/features/gen_RtcRtpReceiver.rs | 25 +++++++++++++++++++ .../webidls/unstable/RTCRtpReceiver.webidl | 4 +++ 3 files changed, 32 insertions(+) create mode 100644 crates/web-sys/webidls/unstable/RTCRtpReceiver.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index c1c2ef677d7..a2c9163c417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,9 @@ * Add bindings for `FocusOptions`. [#3996](https://github.com/rustwasm/wasm-bindgen/pull/3996) +* Add bindings for `RTCRtpReceiver.jitterBufferTarget`. + [#3968](https://github.com/rustwasm/wasm-bindgen/pull/3968) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 1491ae29373..06feea5dd50 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -20,6 +20,31 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcRtpReceiver`*"] pub fn track(this: &RtcRtpReceiver) -> MediaStreamTrack; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpReceiver" , js_name = jitterBufferTarget)] + #[doc = "Getter for the `jitterBufferTarget` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/jitterBufferTarget)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn jitter_buffer_target(this: &RtcRtpReceiver) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , catch , method , setter , js_class = "RTCRtpReceiver" , js_name = jitterBufferTarget)] + #[doc = "Setter for the `jitterBufferTarget` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/jitterBufferTarget)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_jitter_buffer_target( + this: &RtcRtpReceiver, + value: Option, + ) -> Result<(), JsValue>; #[cfg(feature = "RtcRtpCapabilities")] # [wasm_bindgen (static_method_of = RtcRtpReceiver , js_class = "RTCRtpReceiver" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] diff --git a/crates/web-sys/webidls/unstable/RTCRtpReceiver.webidl b/crates/web-sys/webidls/unstable/RTCRtpReceiver.webidl new file mode 100644 index 00000000000..abd55fbce3a --- /dev/null +++ b/crates/web-sys/webidls/unstable/RTCRtpReceiver.webidl @@ -0,0 +1,4 @@ +partial interface RTCRtpReceiver { + [SetterThrows] + attribute DOMHighResTimeStamp? jitterBufferTarget; +}; From d79801508bdc13e698cdc7db8ecc8284ae328f7b Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Tue, 9 Jul 2024 23:13:13 +0200 Subject: [PATCH 417/641] Update and stablize the Clipboard API (#3992) --- CHANGELOG.md | 3 ++ crates/web-sys/Cargo.toml | 1 + crates/web-sys/src/features/gen_Clipboard.rs | 31 +++++------ .../web-sys/src/features/gen_ClipboardItem.rs | 45 +++------------- .../src/features/gen_ClipboardItemOptions.rs | 13 ----- .../gen_ClipboardUnsanitizedFormats.rs | 50 +++++++++++++++++ crates/web-sys/src/features/gen_Navigator.rs | 20 +++---- .../src/features/gen_PresentationStyle.rs | 4 -- crates/web-sys/src/features/mod.rs | 7 +++ .../web-sys/webidls/enabled/Clipboard.webidl | 54 +++++++++++++++++++ .../webidls/enabled/ClipboardEvent.webidl | 18 ------- .../web-sys/webidls/unstable/Clipboard.webidl | 48 +++-------------- crates/webidl/src/util.rs | 11 ++-- 13 files changed, 155 insertions(+), 150 deletions(-) create mode 100644 crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs create mode 100644 crates/web-sys/webidls/enabled/Clipboard.webidl delete mode 100644 crates/web-sys/webidls/enabled/ClipboardEvent.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index a2c9163c417..57201e39c54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,9 @@ * Annotated methods in WebCodecs that throw. [#3970](https://github.com/rustwasm/wasm-bindgen/pull/3970) +* Update and stabilize the Clipboard API. + [#3992](https://github.com/rustwasm/wasm-bindgen/pull/3992) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index edb9ff187f0..59db9b49587 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -194,6 +194,7 @@ ClipboardEventInit = [] ClipboardItem = [] ClipboardItemOptions = [] ClipboardPermissionDescriptor = [] +ClipboardUnsanitizedFormats = [] CloseEvent = ["Event"] CloseEventInit = [] CodecState = [] diff --git a/crates/web-sys/src/features/gen_Clipboard.rs b/crates/web-sys/src/features/gen_Clipboard.rs index 66c456dda80..420f5389fc9 100644 --- a/crates/web-sys/src/features/gen_Clipboard.rs +++ b/crates/web-sys/src/features/gen_Clipboard.rs @@ -2,7 +2,6 @@ #![allow(clippy::all)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = Clipboard , typescript_type = "Clipboard")] @@ -12,52 +11,48 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Clipboard`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type Clipboard; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "Clipboard" , js_name = read)] #[doc = "The `read()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Clipboard`*"] + pub fn read(this: &Clipboard) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ClipboardUnsanitizedFormats")] + # [wasm_bindgen (method , structural , js_class = "Clipboard" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Clipboard`, `ClipboardUnsanitizedFormats`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn read(this: &Clipboard) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] + pub fn read_with_formats( + this: &Clipboard, + formats: &ClipboardUnsanitizedFormats, + ) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "Clipboard" , js_name = readText)] #[doc = "The `readText()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Clipboard`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_text(this: &Clipboard) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "Clipboard" , js_name = write)] #[doc = "The `write()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Clipboard`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write(this: &Clipboard, data: &::wasm_bindgen::JsValue) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "Clipboard" , js_name = writeText)] #[doc = "The `writeText()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Clipboard`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_text(this: &Clipboard, data: &str) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_ClipboardItem.rs b/crates/web-sys/src/features/gen_ClipboardItem.rs index 435f1a474b3..879c6308b5e 100644 --- a/crates/web-sys/src/features/gen_ClipboardItem.rs +++ b/crates/web-sys/src/features/gen_ClipboardItem.rs @@ -2,7 +2,6 @@ #![allow(clippy::all)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ClipboardItem , typescript_type = "ClipboardItem")] @@ -12,11 +11,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardItem; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PresentationStyle")] # [wasm_bindgen (structural , method , getter , js_class = "ClipboardItem" , js_name = presentationStyle)] #[doc = "Getter for the `presentationStyle` field of this object."] @@ -24,52 +19,26 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/presentationStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`, `PresentationStyle`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn presentation_style(this: &ClipboardItem) -> PresentationStyle; - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "ClipboardItem" , js_name = lastModified)] - #[doc = "Getter for the `lastModified` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/lastModified)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn last_modified(this: &ClipboardItem) -> f64; - #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "ClipboardItem" , js_name = delayed)] - #[doc = "Getter for the `delayed` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/delayed)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn delayed(this: &ClipboardItem) -> bool; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ClipboardItem" , js_name = types)] #[doc = "Getter for the `types` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/types)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn types(this: &ClipboardItem) -> ::js_sys::Array; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ClipboardItem" , js_name = getType)] #[doc = "The `getType()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/getType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_type(this: &ClipboardItem, type_: &str) -> ::js_sys::Promise; + # [wasm_bindgen (static_method_of = ClipboardItem , js_class = "ClipboardItem" , js_name = supports)] + #[doc = "The `supports()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/supports)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] + pub fn supports(type_: &str) -> bool; } diff --git a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs index 5930f6d857a..0f8b5121183 100644 --- a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs +++ b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs @@ -2,7 +2,6 @@ #![allow(clippy::all)] use super::*; use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ClipboardItemOptions)] @@ -10,41 +9,29 @@ extern "C" { #[doc = "The `ClipboardItemOptions` dictionary."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardItemOptions; #[cfg(feature = "PresentationStyle")] #[wasm_bindgen(method, setter = "presentationStyle")] fn presentation_style_shim(this: &ClipboardItemOptions, val: PresentationStyle); } -#[cfg(web_sys_unstable_apis)] impl ClipboardItemOptions { #[doc = "Construct a new `ClipboardItemOptions`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PresentationStyle")] #[doc = "Change the `presentationStyle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`, `PresentationStyle`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn presentation_style(&mut self, val: PresentationStyle) -> &mut Self { self.presentation_style_shim(val); self } } -#[cfg(web_sys_unstable_apis)] impl Default for ClipboardItemOptions { fn default() -> Self { Self::new() diff --git a/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs b/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs new file mode 100644 index 00000000000..a4e5fa3251e --- /dev/null +++ b/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs @@ -0,0 +1,50 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ClipboardUnsanitizedFormats)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ClipboardUnsanitizedFormats` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type ClipboardUnsanitizedFormats; + #[wasm_bindgen(method, setter = "unsanitized")] + fn unsanitized_shim(this: &ClipboardUnsanitizedFormats, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl ClipboardUnsanitizedFormats { + #[doc = "Construct a new `ClipboardUnsanitizedFormats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `unsanitized` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn unsanitized(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.unsanitized_shim(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for ClipboardUnsanitizedFormats { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index e148cd27fc5..8b28f73df54 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -12,6 +12,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] pub type Navigator; + #[cfg(feature = "Clipboard")] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = clipboard)] + #[doc = "Getter for the `clipboard` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Clipboard`, `Navigator`*"] + pub fn clipboard(this: &Navigator) -> Clipboard; #[cfg(feature = "Permissions")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Navigator" , js_name = permissions)] #[doc = "Getter for the `permissions` field of this object."] @@ -126,18 +134,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn bluetooth(this: &Navigator) -> Option; #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "Clipboard")] - # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = clipboard)] - #[doc = "Getter for the `clipboard` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Clipboard`, `Navigator`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn clipboard(this: &Navigator) -> Option; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MediaSession")] # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = mediaSession)] #[doc = "Getter for the `mediaSession` field of this object."] diff --git a/crates/web-sys/src/features/gen_PresentationStyle.rs b/crates/web-sys/src/features/gen_PresentationStyle.rs index 1c1b92cf56c..2c0573d8553 100644 --- a/crates/web-sys/src/features/gen_PresentationStyle.rs +++ b/crates/web-sys/src/features/gen_PresentationStyle.rs @@ -1,14 +1,10 @@ #![allow(unused_imports)] #![allow(clippy::all)] use wasm_bindgen::prelude::*; -#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] #[doc = "The `PresentationStyle` enum."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationStyle`*"] -#[doc = ""] -#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] -#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PresentationStyle { Unspecified = "unspecified", diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 486e99e0b18..593a3f5e0de 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -1139,6 +1139,13 @@ mod gen_ClipboardPermissionDescriptor; #[allow(unused_imports)] pub use gen_ClipboardPermissionDescriptor::*; +#[cfg(feature = "ClipboardUnsanitizedFormats")] +#[allow(non_snake_case)] +mod gen_ClipboardUnsanitizedFormats; +#[cfg(feature = "ClipboardUnsanitizedFormats")] +#[allow(unused_imports)] +pub use gen_ClipboardUnsanitizedFormats::*; + #[cfg(feature = "CloseEvent")] #[allow(non_snake_case)] mod gen_CloseEvent; diff --git a/crates/web-sys/webidls/enabled/Clipboard.webidl b/crates/web-sys/webidls/enabled/Clipboard.webidl new file mode 100644 index 00000000000..fbf98a2f379 --- /dev/null +++ b/crates/web-sys/webidls/enabled/Clipboard.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Clipboard API and events + * Editor’s Draft, 4 June 2024 + * + * The origin of this IDL file is: + * https://w3c.github.io/clipboard-apis/#idl-index + */ + +dictionary ClipboardEventInit : EventInit { + DataTransfer? clipboardData = null; +}; + +[Exposed=Window] +interface ClipboardEvent : Event { + constructor(DOMString type, optional ClipboardEventInit eventInitDict = {}); + readonly attribute DataTransfer? clipboardData; +}; + +partial interface Navigator { + [SecureContext, SameObject] readonly attribute Clipboard clipboard; +}; + +typedef Promise<(DOMString or Blob)> ClipboardItemData; + +[SecureContext, Exposed=Window] +interface ClipboardItem { + [Throws] + constructor(record items, + optional ClipboardItemOptions options = {}); + + readonly attribute PresentationStyle presentationStyle; + readonly attribute FrozenArray types; + + Promise getType(DOMString type); + + static boolean supports(DOMString type); +}; + +enum PresentationStyle { "unspecified", "inline", "attachment" }; + +dictionary ClipboardItemOptions { + PresentationStyle presentationStyle = "unspecified"; +}; + +typedef sequence ClipboardItems; + +[SecureContext, Exposed=Window] +interface Clipboard : EventTarget { + Promise read(optional ClipboardUnsanitizedFormats formats = {}); + Promise readText(); + Promise write(ClipboardItems data); + Promise writeText(DOMString data); +}; diff --git a/crates/web-sys/webidls/enabled/ClipboardEvent.webidl b/crates/web-sys/webidls/enabled/ClipboardEvent.webidl deleted file mode 100644 index 51ceebfb2e9..00000000000 --- a/crates/web-sys/webidls/enabled/ClipboardEvent.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * Clipboard API and events - * Editor’s Draft, 21 November 2023 - * - * The origin of this IDL file is: - * https://w3c.github.io/clipboard-apis/#clipboard-event-interfaces - */ - -dictionary ClipboardEventInit : EventInit { - DataTransfer? clipboardData = null; -}; - -[Exposed=Window] -interface ClipboardEvent : Event { - constructor(DOMString type, optional ClipboardEventInit eventInitDict = {}); - readonly attribute DataTransfer? clipboardData; -}; diff --git a/crates/web-sys/webidls/unstable/Clipboard.webidl b/crates/web-sys/webidls/unstable/Clipboard.webidl index c32a6556a06..91ecc637a45 100644 --- a/crates/web-sys/webidls/unstable/Clipboard.webidl +++ b/crates/web-sys/webidls/unstable/Clipboard.webidl @@ -1,51 +1,19 @@ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Clipboard API and events - * W3C Working Draft, 4 June 2021 + * Editor’s Draft, 4 June 2024 + * * The origin of this IDL file is: - * https://www.w3.org/TR/2021/WD-clipboard-apis-20210604/ + * https://w3c.github.io/clipboard-apis/#idl-index */ -partial interface Navigator { - [SecureContext, SameObject] readonly attribute Clipboard? clipboard; -}; - -typedef sequence ClipboardItems; - -[SecureContext, Exposed=Window] interface Clipboard : EventTarget { - Promise read(); - Promise readText(); - Promise write(ClipboardItems data); - Promise writeText(DOMString data); -}; - -typedef (DOMString or Blob) ClipboardItemDataType; -typedef Promise ClipboardItemData; - -callback ClipboardItemDelayedCallback = ClipboardItemData (); - -[Exposed=Window] interface ClipboardItem { - constructor(record items, - optional ClipboardItemOptions options = {}); - static ClipboardItem createDelayed( - record items, - optional ClipboardItemOptions options = {}); - - readonly attribute PresentationStyle presentationStyle; - readonly attribute long long lastModified; - readonly attribute boolean delayed; - - readonly attribute FrozenArray types; - - Promise getType(DOMString type); -}; - -enum PresentationStyle { "unspecified", "inline", "attachment" }; - -dictionary ClipboardItemOptions { - PresentationStyle presentationStyle = "unspecified"; +// There is no consensus by browsers to implement this API. +// See https://github.com/w3c/clipboard-apis/pull/197. +dictionary ClipboardUnsanitizedFormats { + sequence unsanitized; }; +// Also Chrome-only. dictionary ClipboardPermissionDescriptor : PermissionDescriptor { boolean allowWithoutGesture = false; }; diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 44dffb0af70..0f663978fd3 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -443,14 +443,9 @@ impl<'src> FirstPassRecord<'src> { // If any of the arguments types are `unstable` then this method is downgraded // to be unstable. let has_unstable_args = signature - .orig .args .iter() - .any(|arg| is_type_unstable(arg.ty, unstable_types)) - | signature - .args - .iter() - .any(|arg| is_idl_type_unstable(arg, unstable_types)); + .any(|arg| is_idl_type_unstable(arg, unstable_types)); let unstable = unstable || data.stability.is_unstable() || has_unstable_args; @@ -552,7 +547,9 @@ pub fn is_type_unstable(ty: &weedle::types::Type, unstable_types: &HashSet) -> bool { match ty { - IdlType::Interface(name) => unstable_types.contains(&Identifier(name)), + IdlType::Dictionary(name) | IdlType::Interface(name) => { + unstable_types.contains(&Identifier(name)) + } _ => false, } } From 6536e60ef41f29dfb383321ec0f070a91bd74781 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 9 Jul 2024 23:33:05 +0200 Subject: [PATCH 418/641] Fix MDN links to static interface methods (#4010) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_AudioDecoder.rs | 2 +- crates/web-sys/src/features/gen_AudioEncoder.rs | 2 +- crates/web-sys/src/features/gen_BluetoothUuid.rs | 14 +++++++------- crates/web-sys/src/features/gen_ClipboardItem.rs | 2 +- crates/web-sys/src/features/gen_DomPoint.rs | 4 ++-- .../web-sys/src/features/gen_DomPointReadOnly.rs | 4 ++-- .../web-sys/src/features/gen_FuzzingFunctions.rs | 6 +++--- crates/web-sys/src/features/gen_IdbKeyRange.rs | 16 ++++++++-------- .../src/features/gen_IdbLocaleAwareKeyRange.rs | 6 +++--- crates/web-sys/src/features/gen_ImageDecoder.rs | 2 +- crates/web-sys/src/features/gen_MediaRecorder.rs | 2 +- crates/web-sys/src/features/gen_MediaSource.rs | 2 +- crates/web-sys/src/features/gen_Notification.rs | 4 ++-- .../src/features/gen_PublicKeyCredential.rs | 2 +- crates/web-sys/src/features/gen_Response.rs | 6 +++--- .../src/features/gen_RtcPeerConnection.rs | 4 ++-- .../web-sys/src/features/gen_RtcRtpReceiver.rs | 2 +- crates/web-sys/src/features/gen_RtcRtpSender.rs | 2 +- crates/web-sys/src/features/gen_TaskSignal.rs | 4 ++-- crates/web-sys/src/features/gen_Url.rs | 6 +++--- crates/web-sys/src/features/gen_VideoDecoder.rs | 2 +- crates/web-sys/src/features/gen_VideoEncoder.rs | 2 +- crates/web-sys/src/features/gen_XrWebGlLayer.rs | 2 +- crates/webidl/src/generator.rs | 7 ++++++- 25 files changed, 58 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57201e39c54..1da50a845ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,9 @@ * Fix triggering `clippy::mem_forget` lint in exported structs. [#3985](https://github.com/rustwasm/wasm-bindgen/pull/3985) +* Fix MDN links to static interface methods. + [#4010](https://github.com/rustwasm/wasm-bindgen/pull/4010) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/web-sys/src/features/gen_AudioDecoder.rs b/crates/web-sys/src/features/gen_AudioDecoder.rs index 880a9c11a05..5482b063269 100644 --- a/crates/web-sys/src/features/gen_AudioDecoder.rs +++ b/crates/web-sys/src/features/gen_AudioDecoder.rs @@ -102,7 +102,7 @@ extern "C" { # [wasm_bindgen (static_method_of = AudioDecoder , js_class = "AudioDecoder" , js_name = isConfigSupported)] #[doc = "The `isConfigSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/isConfigSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/isConfigSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioDecoder`, `AudioDecoderConfig`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AudioEncoder.rs b/crates/web-sys/src/features/gen_AudioEncoder.rs index 5c51b28e541..5d00c15abab 100644 --- a/crates/web-sys/src/features/gen_AudioEncoder.rs +++ b/crates/web-sys/src/features/gen_AudioEncoder.rs @@ -102,7 +102,7 @@ extern "C" { # [wasm_bindgen (static_method_of = AudioEncoder , js_class = "AudioEncoder" , js_name = isConfigSupported)] #[doc = "The `isConfigSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/isConfigSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder/isConfigSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioEncoder`, `AudioEncoderConfig`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BluetoothUuid.rs b/crates/web-sys/src/features/gen_BluetoothUuid.rs index 49e450141d9..7e2d6310f54 100644 --- a/crates/web-sys/src/features/gen_BluetoothUuid.rs +++ b/crates/web-sys/src/features/gen_BluetoothUuid.rs @@ -20,7 +20,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = canonicalUUID)] #[doc = "The `canonicalUUID()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/canonicalUUID)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/canonicalUUID_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -31,7 +31,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getCharacteristic)] #[doc = "The `getCharacteristic()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getCharacteristic)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getCharacteristic_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -42,7 +42,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getCharacteristic)] #[doc = "The `getCharacteristic()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getCharacteristic)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getCharacteristic_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -53,7 +53,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getDescriptor)] #[doc = "The `getDescriptor()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getDescriptor)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getDescriptor_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -64,7 +64,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getDescriptor)] #[doc = "The `getDescriptor()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getDescriptor)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getDescriptor_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -75,7 +75,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getService)] #[doc = "The `getService()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getService)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getService_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] @@ -86,7 +86,7 @@ extern "C" { # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getService)] #[doc = "The `getService()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getService)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothUUID/getService_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothUuid`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ClipboardItem.rs b/crates/web-sys/src/features/gen_ClipboardItem.rs index 879c6308b5e..558d4561fad 100644 --- a/crates/web-sys/src/features/gen_ClipboardItem.rs +++ b/crates/web-sys/src/features/gen_ClipboardItem.rs @@ -37,7 +37,7 @@ extern "C" { # [wasm_bindgen (static_method_of = ClipboardItem , js_class = "ClipboardItem" , js_name = supports)] #[doc = "The `supports()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/supports)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/supports_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] pub fn supports(type_: &str) -> bool; diff --git a/crates/web-sys/src/features/gen_DomPoint.rs b/crates/web-sys/src/features/gen_DomPoint.rs index 7e2bde1f062..305e57be868 100644 --- a/crates/web-sys/src/features/gen_DomPoint.rs +++ b/crates/web-sys/src/features/gen_DomPoint.rs @@ -111,7 +111,7 @@ extern "C" { # [wasm_bindgen (static_method_of = DomPoint , js_class = "DOMPoint" , js_name = fromPoint)] #[doc = "The `fromPoint()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint/fromPoint)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint/fromPoint_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`*"] pub fn from_point() -> DomPoint; @@ -119,7 +119,7 @@ extern "C" { # [wasm_bindgen (static_method_of = DomPoint , js_class = "DOMPoint" , js_name = fromPoint)] #[doc = "The `fromPoint()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint/fromPoint)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint/fromPoint_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomPointInit`*"] pub fn from_point_with_other(other: &DomPointInit) -> DomPoint; diff --git a/crates/web-sys/src/features/gen_DomPointReadOnly.rs b/crates/web-sys/src/features/gen_DomPointReadOnly.rs index 1e3e76fae32..b3f52f271fe 100644 --- a/crates/web-sys/src/features/gen_DomPointReadOnly.rs +++ b/crates/web-sys/src/features/gen_DomPointReadOnly.rs @@ -83,7 +83,7 @@ extern "C" { # [wasm_bindgen (static_method_of = DomPointReadOnly , js_class = "DOMPointReadOnly" , js_name = fromPoint)] #[doc = "The `fromPoint()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly/fromPoint)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly/fromPoint_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointReadOnly`*"] pub fn from_point() -> DomPointReadOnly; @@ -91,7 +91,7 @@ extern "C" { # [wasm_bindgen (static_method_of = DomPointReadOnly , js_class = "DOMPointReadOnly" , js_name = fromPoint)] #[doc = "The `fromPoint()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly/fromPoint)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly/fromPoint_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomPointReadOnly`*"] pub fn from_point_with_other(other: &DomPointInit) -> DomPointReadOnly; diff --git a/crates/web-sys/src/features/gen_FuzzingFunctions.rs b/crates/web-sys/src/features/gen_FuzzingFunctions.rs index 76505ea380e..d1001cac9c8 100644 --- a/crates/web-sys/src/features/gen_FuzzingFunctions.rs +++ b/crates/web-sys/src/features/gen_FuzzingFunctions.rs @@ -15,21 +15,21 @@ extern "C" { # [wasm_bindgen (static_method_of = FuzzingFunctions , js_class = "FuzzingFunctions" , js_name = cycleCollect)] #[doc = "The `cycleCollect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/cycleCollect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/cycleCollect_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FuzzingFunctions`*"] pub fn cycle_collect(); # [wasm_bindgen (catch , static_method_of = FuzzingFunctions , js_class = "FuzzingFunctions" , js_name = enableAccessibility)] #[doc = "The `enableAccessibility()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/enableAccessibility)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/enableAccessibility_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FuzzingFunctions`*"] pub fn enable_accessibility() -> Result<(), JsValue>; # [wasm_bindgen (static_method_of = FuzzingFunctions , js_class = "FuzzingFunctions" , js_name = garbageCollect)] #[doc = "The `garbageCollect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/garbageCollect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FuzzingFunctions/garbageCollect_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FuzzingFunctions`*"] pub fn garbage_collect(); diff --git a/crates/web-sys/src/features/gen_IdbKeyRange.rs b/crates/web-sys/src/features/gen_IdbKeyRange.rs index c24650ba916..b37d5b243ab 100644 --- a/crates/web-sys/src/features/gen_IdbKeyRange.rs +++ b/crates/web-sys/src/features/gen_IdbKeyRange.rs @@ -43,7 +43,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn bound( @@ -53,7 +53,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn bound_with_lower_open( @@ -64,7 +64,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn bound_with_lower_open_and_upper_open( @@ -83,14 +83,14 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = lowerBound)] #[doc = "The `lowerBound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/lowerBound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/lowerBound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn lower_bound(lower: &::wasm_bindgen::JsValue) -> Result; # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = lowerBound)] #[doc = "The `lowerBound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/lowerBound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/lowerBound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn lower_bound_with_open( @@ -100,21 +100,21 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = only)] #[doc = "The `only()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/only)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/only_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn only(value: &::wasm_bindgen::JsValue) -> Result; # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = upperBound)] #[doc = "The `upperBound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/upperBound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/upperBound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn upper_bound(upper: &::wasm_bindgen::JsValue) -> Result; # [wasm_bindgen (catch , static_method_of = IdbKeyRange , js_class = "IDBKeyRange" , js_name = upperBound)] #[doc = "The `upperBound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/upperBound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange/upperBound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbKeyRange`*"] pub fn upper_bound_with_open( diff --git a/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs b/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs index 6e23edbe073..ab1695a3fcb 100644 --- a/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs +++ b/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs @@ -15,7 +15,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbLocaleAwareKeyRange , js_class = "IDBLocaleAwareKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] pub fn bound( @@ -25,7 +25,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbLocaleAwareKeyRange , js_class = "IDBLocaleAwareKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] pub fn bound_with_lower_open( @@ -36,7 +36,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = IdbLocaleAwareKeyRange , js_class = "IDBLocaleAwareKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] pub fn bound_with_lower_open_and_upper_open( diff --git a/crates/web-sys/src/features/gen_ImageDecoder.rs b/crates/web-sys/src/features/gen_ImageDecoder.rs index 39eab52545b..a0ffcac1111 100644 --- a/crates/web-sys/src/features/gen_ImageDecoder.rs +++ b/crates/web-sys/src/features/gen_ImageDecoder.rs @@ -114,7 +114,7 @@ extern "C" { # [wasm_bindgen (static_method_of = ImageDecoder , js_class = "ImageDecoder" , js_name = isTypeSupported)] #[doc = "The `isTypeSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder/isTypeSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder/isTypeSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageDecoder`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaRecorder.rs b/crates/web-sys/src/features/gen_MediaRecorder.rs index acd57cb2766..af36d2e65f7 100644 --- a/crates/web-sys/src/features/gen_MediaRecorder.rs +++ b/crates/web-sys/src/features/gen_MediaRecorder.rs @@ -158,7 +158,7 @@ extern "C" { # [wasm_bindgen (static_method_of = MediaRecorder , js_class = "MediaRecorder" , js_name = isTypeSupported)] #[doc = "The `isTypeSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorder`*"] pub fn is_type_supported(type_: &str) -> bool; diff --git a/crates/web-sys/src/features/gen_MediaSource.rs b/crates/web-sys/src/features/gen_MediaSource.rs index d2eea445d00..a243a7fb2f8 100644 --- a/crates/web-sys/src/features/gen_MediaSource.rs +++ b/crates/web-sys/src/features/gen_MediaSource.rs @@ -135,7 +135,7 @@ extern "C" { # [wasm_bindgen (static_method_of = MediaSource , js_class = "MediaSource" , js_name = isTypeSupported)] #[doc = "The `isTypeSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/isTypeSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/isTypeSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"] pub fn is_type_supported(type_: &str) -> bool; diff --git a/crates/web-sys/src/features/gen_Notification.rs b/crates/web-sys/src/features/gen_Notification.rs index b0eaed5e807..e5f9024a5a4 100644 --- a/crates/web-sys/src/features/gen_Notification.rs +++ b/crates/web-sys/src/features/gen_Notification.rs @@ -217,14 +217,14 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = Notification , js_class = "Notification" , js_name = requestPermission)] #[doc = "The `requestPermission()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] pub fn request_permission() -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , static_method_of = Notification , js_class = "Notification" , js_name = requestPermission)] #[doc = "The `requestPermission()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] pub fn request_permission_with_permission_callback( diff --git a/crates/web-sys/src/features/gen_PublicKeyCredential.rs b/crates/web-sys/src/features/gen_PublicKeyCredential.rs index dc0ddbce9de..9a383cb8590 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredential.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredential.rs @@ -40,7 +40,7 @@ extern "C" { # [wasm_bindgen (static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = isUserVerifyingPlatformAuthenticatorAvailable)] #[doc = "The `isUserVerifyingPlatformAuthenticatorAvailable()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/isUserVerifyingPlatformAuthenticatorAvailable)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/isUserVerifyingPlatformAuthenticatorAvailable_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] pub fn is_user_verifying_platform_authenticator_available() -> ::js_sys::Promise; diff --git a/crates/web-sys/src/features/gen_Response.rs b/crates/web-sys/src/features/gen_Response.rs index 682c2d3f151..90f0fcb5d58 100644 --- a/crates/web-sys/src/features/gen_Response.rs +++ b/crates/web-sys/src/features/gen_Response.rs @@ -229,21 +229,21 @@ extern "C" { # [wasm_bindgen (static_method_of = Response , js_class = "Response" , js_name = error)] #[doc = "The `error()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/error)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/error_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] pub fn error() -> Response; # [wasm_bindgen (catch , static_method_of = Response , js_class = "Response" , js_name = redirect)] #[doc = "The `redirect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] pub fn redirect(url: &str) -> Result; # [wasm_bindgen (catch , static_method_of = Response , js_class = "Response" , js_name = redirect)] #[doc = "The `redirect()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] pub fn redirect_with_status(url: &str, status: u16) -> Result; diff --git a/crates/web-sys/src/features/gen_RtcPeerConnection.rs b/crates/web-sys/src/features/gen_RtcPeerConnection.rs index 93412c63d8a..89396ac4560 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnection.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnection.rs @@ -671,7 +671,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = RtcPeerConnection , js_class = "RTCPeerConnection" , js_name = generateCertificate)] #[doc = "The `generateCertificate()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] pub fn generate_certificate_with_object( @@ -680,7 +680,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = RtcPeerConnection , js_class = "RTCPeerConnection" , js_name = generateCertificate)] #[doc = "The `generateCertificate()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] pub fn generate_certificate_with_str( diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 06feea5dd50..4e65f620aa5 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -49,7 +49,7 @@ extern "C" { # [wasm_bindgen (static_method_of = RtcRtpReceiver , js_class = "RTCRtpReceiver" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/getCapabilities)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/getCapabilities_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpReceiver`*"] pub fn get_capabilities(kind: &str) -> Option; diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 8cdd9d5d66b..74ecf498d8f 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -32,7 +32,7 @@ extern "C" { # [wasm_bindgen (static_method_of = RtcRtpSender , js_class = "RTCRtpSender" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpSender`*"] pub fn get_capabilities(kind: &str) -> Option; diff --git a/crates/web-sys/src/features/gen_TaskSignal.rs b/crates/web-sys/src/features/gen_TaskSignal.rs index be9a5564545..62044bcf932 100644 --- a/crates/web-sys/src/features/gen_TaskSignal.rs +++ b/crates/web-sys/src/features/gen_TaskSignal.rs @@ -54,7 +54,7 @@ extern "C" { # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] #[doc = "The `any()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TaskSignal`*"] #[doc = ""] @@ -66,7 +66,7 @@ extern "C" { # [wasm_bindgen (static_method_of = TaskSignal , js_class = "TaskSignal" , js_name = any)] #[doc = "The `any()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TaskSignal/any_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TaskSignal`, `TaskSignalAnyInit`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Url.rs b/crates/web-sys/src/features/gen_Url.rs index a905b852541..7665809b137 100644 --- a/crates/web-sys/src/features/gen_Url.rs +++ b/crates/web-sys/src/features/gen_Url.rs @@ -185,7 +185,7 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = Url , js_class = "URL" , js_name = createObjectURL)] #[doc = "The `createObjectURL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `Url`*"] pub fn create_object_url_with_blob(blob: &Blob) -> Result; @@ -193,14 +193,14 @@ extern "C" { # [wasm_bindgen (catch , static_method_of = Url , js_class = "URL" , js_name = createObjectURL)] #[doc = "The `createObjectURL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `Url`*"] pub fn create_object_url_with_source(source: &MediaSource) -> Result; # [wasm_bindgen (catch , static_method_of = Url , js_class = "URL" , js_name = revokeObjectURL)] #[doc = "The `revokeObjectURL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] pub fn revoke_object_url(url: &str) -> Result<(), JsValue>; diff --git a/crates/web-sys/src/features/gen_VideoDecoder.rs b/crates/web-sys/src/features/gen_VideoDecoder.rs index 606bf71ea6d..1002aca6be2 100644 --- a/crates/web-sys/src/features/gen_VideoDecoder.rs +++ b/crates/web-sys/src/features/gen_VideoDecoder.rs @@ -102,7 +102,7 @@ extern "C" { # [wasm_bindgen (static_method_of = VideoDecoder , js_class = "VideoDecoder" , js_name = isConfigSupported)] #[doc = "The `isConfigSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/isConfigSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/isConfigSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoDecoder`, `VideoDecoderConfig`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VideoEncoder.rs b/crates/web-sys/src/features/gen_VideoEncoder.rs index 7f25a6ddf6a..84d74ae01a4 100644 --- a/crates/web-sys/src/features/gen_VideoEncoder.rs +++ b/crates/web-sys/src/features/gen_VideoEncoder.rs @@ -118,7 +118,7 @@ extern "C" { # [wasm_bindgen (static_method_of = VideoEncoder , js_class = "VideoEncoder" , js_name = isConfigSupported)] #[doc = "The `isConfigSupported()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/isConfigSupported)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/isConfigSupported_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoEncoder`, `VideoEncoderConfig`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_XrWebGlLayer.rs b/crates/web-sys/src/features/gen_XrWebGlLayer.rs index 42cc02aec7e..4344b044d52 100644 --- a/crates/web-sys/src/features/gen_XrWebGlLayer.rs +++ b/crates/web-sys/src/features/gen_XrWebGlLayer.rs @@ -169,7 +169,7 @@ extern "C" { # [wasm_bindgen (static_method_of = XrWebGlLayer , js_class = "XRWebGLLayer" , js_name = getNativeFramebufferScaleFactor)] #[doc = "The `getNativeFramebufferScaleFactor()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getNativeFramebufferScaleFactor)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getNativeFramebufferScaleFactor_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`, `XrWebGlLayer`*"] #[doc = ""] diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index db8cff532ac..f65d5759318 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -416,10 +416,15 @@ impl InterfaceMethod { let js_name = raw_ident(js_name); extra_args.push(quote!( js_name = #js_name )); } + let method = if *is_static { + &format!("{js_name}_static") + } else { + js_name + }; format!( "The `{}()` method.\n\n{}", js_name, - mdn_doc(&parent_js_name, Some(js_name)) + mdn_doc(&parent_js_name, Some(method)) ) } InterfaceMethodKind::IndexingGetter => { From ee015483671f78d7310404343db561ba32af2f9f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 22 Jul 2024 00:16:36 +0200 Subject: [PATCH 419/641] Fix TS tests (#4016) --- crates/typescript-tests/jest.config.cjs | 12 ++++++------ crates/typescript-tests/package.json | 2 +- crates/typescript-tests/tsconfig.json | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/typescript-tests/jest.config.cjs b/crates/typescript-tests/jest.config.cjs index 31ee1910442..490df9f0a7e 100644 --- a/crates/typescript-tests/jest.config.cjs +++ b/crates/typescript-tests/jest.config.cjs @@ -20,11 +20,11 @@ module.exports = { ".*/src/usize.ts$" ], injectGlobals: false, - globals: { - 'ts-jest': - { - useESM: true, - isolatedModules: true - } + transform: { + '^.+.tsx?$': ['ts-jest', + { + useESM: true, + isolatedModules: true + }] } }; diff --git a/crates/typescript-tests/package.json b/crates/typescript-tests/package.json index 017eca094a6..21effd76575 100644 --- a/crates/typescript-tests/package.json +++ b/crates/typescript-tests/package.json @@ -5,7 +5,7 @@ }, "devDependencies": { "@types/jest": "^29.5.8", - "ts-jest": "^29.1.1", + "ts-jest": "=29.2.0", "typescript": "^5.2.2" }, "type": "module" diff --git a/crates/typescript-tests/tsconfig.json b/crates/typescript-tests/tsconfig.json index 3032c028f84..5d009f462b6 100644 --- a/crates/typescript-tests/tsconfig.json +++ b/crates/typescript-tests/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "esModuleInterop": true, + "allowSyntheticDefaultImports": true, "target": "es6", "noImplicitAny": true, "sourceMap": true, From e8b023cf6a1759ab7deffc2ffb82172cd48d2d48 Mon Sep 17 00:00:00 2001 From: Alexandre Faria Date: Mon, 22 Jul 2024 10:04:40 +0100 Subject: [PATCH 420/641] Fixed deno support. (#3990) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 3 ++- crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs | 12 +++++++----- .../cli/src/bin/wasm-bindgen-test-runner/headless.rs | 2 +- crates/cli/src/bin/wasm-bindgen-test-runner/node.rs | 7 +++++-- crates/test/src/rt/detect.rs | 10 +++++++++- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da50a845ef..8020b205688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,9 @@ * Fix MDN links to static interface methods. [#4010](https://github.com/rustwasm/wasm-bindgen/pull/4010) + +* Fixed Deno support. + [#3990](https://github.com/rustwasm/wasm-bindgen/pull/3990) -------------------------------------------------------------------------------- diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 97a7cbd8044..8604d6f2a9c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -345,7 +345,8 @@ impl<'a> Context<'a> { }} const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)).instance; - const wasm = wasmInstance.exports;", + const wasm = wasmInstance.exports; + export const __wasm = wasm;", module_name = module_name ) } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index a0b05cdbd5b..390b2761512 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -18,16 +18,13 @@ pub fn execute( {console_override} - // global.__wbg_test_invoke = f => f(); + window.__wbg_test_invoke = f => f(); // Forward runtime arguments. These arguments are also arguments to the // `wasm-bindgen-test-runner` which forwards them to deno which we // forward to the test harness. this is basically only used for test // filters for now. - cx.args(Deno.args.slice(1)); - - const ok = await cx.run(tests.map(n => wasm.__wasm[n])); - if (!ok) Deno.exit(1); + cx.args(Deno.args); const tests = []; "#, @@ -39,6 +36,11 @@ pub fn execute( js_to_execute.push_str(&format!("tests.push('{}')\n", test)); } + js_to_execute.push_str( + r#"const ok = await cx.run(tests.map(n => wasm.__wasm[n])); +if (!ok) Deno.exit(1);"#, + ); + let js_path = tmpdir.join("run.js"); fs::write(&js_path, js_to_execute).context("failed to write JS file")?; diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index f111902f73f..a4886800260 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -3,7 +3,7 @@ use anyhow::{bail, format_err, Context, Error}; use log::{debug, warn}; use rouille::url::Url; use serde::{Deserialize, Serialize}; -use serde_json::{self, json, Map, Value as Json}; +use serde_json::{json, Map, Value as Json}; use std::env; use std::fs::File; use std::io::{self, Read}; diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index c90d00251ba..0e1718119ae 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -30,7 +30,7 @@ wrap("info"); wrap("warn"); wrap("error"); -cx = new wasm.WasmBindgenTestContext(); +const cx = new wasm.WasmBindgenTestContext(); handlers.on_console_debug = wasm.__wbgtest_console_debug; handlers.on_console_log = wasm.__wbgtest_console_log; handlers.on_console_info = wasm.__wbgtest_console_info; @@ -117,7 +117,10 @@ pub fn execute( #[cfg(unix)] pub fn exec(cmd: &mut Command) -> Result<(), Error> { use std::os::unix::prelude::*; - Err(Error::from(cmd.exec()).context("failed to execute `node`")) + Err(Error::from(cmd.exec()).context(format!( + "failed to execute `{}`", + cmd.get_program().to_string_lossy() + ))) } #[cfg(windows)] diff --git a/crates/test/src/rt/detect.rs b/crates/test/src/rt/detect.rs index 235b14c67d6..f4cdd988d59 100644 --- a/crates/test/src/rt/detect.rs +++ b/crates/test/src/rt/detect.rs @@ -12,6 +12,11 @@ extern "C" { #[wasm_bindgen(method, getter, structural)] fn constructor(me: &Scope) -> Constructor; + #[wasm_bindgen(method, getter, structural, js_name = Deno)] + fn deno(me: &Scope) -> Option; + + type Deno; + type Constructor; #[wasm_bindgen(method, getter, structural)] fn name(me: &Constructor) -> String; @@ -27,7 +32,10 @@ pub fn detect() -> Runtime { "DedicatedWorkerGlobalScope" | "SharedWorkerGlobalScope" | "ServiceWorkerGlobalScope" => Runtime::Worker, - _ => Runtime::Browser, + _ => match scope.deno() { + Some(_) => Runtime::Node, + _ => Runtime::Browser, + }, }, None => Runtime::Node, } From 869562cc65b2b00248b14e115f00c001fc8b1713 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 28 Jul 2024 20:20:25 +0200 Subject: [PATCH 421/641] Fix CI for Rust v1.80 (#4019) --- crates/cli/tests/reference/anyref-import-catch.wat | 4 ++-- crates/js-sys/Cargo.toml | 3 +++ crates/macro/src/lib.rs | 2 +- crates/web-sys/Cargo.toml | 3 +++ examples/webxr/Cargo.toml | 3 +++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 725fd35ef88..42867acbf63 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -4,8 +4,8 @@ (type (;2;) (func (param i32))) (type (;3;) (func (param i32) (result i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $__externref_table_dealloc (;1;) (type 2) (param i32)) - (func $exported (;2;) (type 2) (param i32)) + (func $exported (;1;) (type 2) (param i32)) + (func $__externref_table_dealloc (;2;) (type 2) (param i32)) (func $__externref_table_alloc (;3;) (type 1) (result i32)) (func $__wbindgen_exn_store (;4;) (type 2) (param i32)) (func $__wbindgen_add_to_stack_pointer (;5;) (type 3) (param i32) (result i32)) diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index a8c476856bd..5bb63a5ac4d 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -26,3 +26,6 @@ wasm-bindgen = { path = "../..", version = "0.2.92" } wasm-bindgen-test = { path = '../test', version = '=0.3.42' } wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } web-sys = { path = "../web-sys", version = "0.3.69", features = ["Headers", "Response", "ResponseInit"] } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(js_sys_unstable_apis)'] } diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index fbae818750e..aa4ab3f066b 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -24,7 +24,7 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { /// The module can be specified in a few ways: /// - You can use `inline_js = "..."` to create an inline JS file. /// - You can use `module = "/foo/bar"` to reference a file relative to the -/// root of the crate the macro is invoked in. +/// root of the crate the macro is invoked in. /// /// The returned URL can be used for things like creating workers/worklets: /// ```no_run diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 59db9b49587..77ef42d3353 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -29,6 +29,9 @@ js-sys = { path = '../js-sys', version = '0.3.69' } wasm-bindgen-test = { path = '../test', version = '0.3.42' } wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } + # This list is auto-generated by the wasm-bindgen-webidl program [features] AbortController = [] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index d9f51321769..48aeae2c1f7 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -64,3 +64,6 @@ features = [ 'XrSystem', 'console' ] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } From 7bdec187162265a73472e9cd2832ade1272959ad Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 28 Jul 2024 20:30:20 +0200 Subject: [PATCH 422/641] Generate getters for all WebIDL dictionary types and deprecate builder-pattern style setters (#3993) --- CHANGELOG.md | 6 + .../features/gen_AddEventListenerOptions.rs | 48 +- .../web-sys/src/features/gen_AesCbcParams.rs | 32 +- .../web-sys/src/features/gen_AesCtrParams.rs | 48 +- .../src/features/gen_AesDerivedKeyParams.rs | 32 +- .../web-sys/src/features/gen_AesGcmParams.rs | 64 +- .../src/features/gen_AesKeyAlgorithm.rs | 32 +- .../src/features/gen_AesKeyGenParams.rs | 32 +- crates/web-sys/src/features/gen_Algorithm.rs | 16 +- .../features/gen_AllowedBluetoothDevice.rs | 81 ++- .../src/features/gen_AllowedUsbDevice.rs | 81 ++- .../src/features/gen_AnalyserOptions.rs | 114 ++- .../src/features/gen_AnimationEventInit.rs | 96 ++- .../gen_AnimationPlaybackEventInit.rs | 80 +- .../features/gen_AnimationPropertyDetails.rs | 64 +- .../gen_AnimationPropertyValueDetails.rs | 65 +- .../src/features/gen_AssignedNodesOptions.rs | 16 +- .../src/features/gen_AttributeNameValue.rs | 32 +- .../src/features/gen_AudioBufferOptions.rs | 48 +- .../features/gen_AudioBufferSourceOptions.rs | 97 ++- .../src/features/gen_AudioConfiguration.rs | 64 +- .../src/features/gen_AudioContextOptions.rs | 59 +- .../features/gen_AudioDataCopyToOptions.rs | 109 ++- .../web-sys/src/features/gen_AudioDataInit.rs | 163 +++-- .../src/features/gen_AudioDecoderConfig.rs | 108 ++- .../src/features/gen_AudioDecoderInit.rs | 54 +- .../src/features/gen_AudioDecoderSupport.rs | 55 +- .../src/features/gen_AudioEncoderConfig.rs | 106 ++- .../src/features/gen_AudioEncoderInit.rs | 54 +- .../src/features/gen_AudioEncoderSupport.rs | 55 +- .../src/features/gen_AudioNodeOptions.rs | 50 +- .../src/features/gen_AudioSinkOptions.rs | 28 +- .../features/gen_AudioWorkletNodeOptions.rs | 116 ++- ...en_AuthenticationExtensionsClientInputs.rs | 16 +- ...n_AuthenticationExtensionsClientOutputs.rs | 16 +- .../gen_AuthenticatorSelectionCriteria.rs | 54 +- .../src/features/gen_AutocompleteInfo.rs | 64 +- .../src/features/gen_BaseComputedKeyframe.rs | 81 ++- .../web-sys/src/features/gen_BaseKeyframe.rs | 65 +- .../gen_BasePropertyIndexedKeyframe.rs | 48 +- .../src/features/gen_BasicCardRequest.rs | 32 +- .../src/features/gen_BasicCardResponse.rs | 97 ++- .../src/features/gen_BiquadFilterOptions.rs | 131 +++- .../web-sys/src/features/gen_BlobEventInit.rs | 65 +- .../src/features/gen_BlobPropertyBag.rs | 33 +- .../src/features/gen_BlockParsingOptions.rs | 16 +- .../gen_BluetoothAdvertisingEventInit.rs | 290 +++++--- .../features/gen_BluetoothDataFilterInit.rs | 54 +- .../features/gen_BluetoothLeScanFilterInit.rs | 127 +++- .../gen_BluetoothPermissionDescriptor.rs | 135 +++- .../gen_BluetoothPermissionStorage.rs | 27 +- .../src/features/gen_BoxQuadOptions.rs | 33 +- .../gen_BrowserElementDownloadOptions.rs | 32 +- .../gen_BrowserElementExecuteScriptOptions.rs | 32 +- .../src/features/gen_CacheBatchOperation.rs | 67 +- .../src/features/gen_CacheQueryOptions.rs | 64 +- .../gen_CaretStateChangedEventInit.rs | 181 +++-- .../src/features/gen_ChannelMergerOptions.rs | 67 +- .../features/gen_ChannelSplitterOptions.rs | 68 +- .../src/features/gen_CheckerboardReport.rs | 65 +- .../src/features/gen_ChromeFilePropertyBag.rs | 64 +- .../src/features/gen_ClientQueryOptions.rs | 33 +- .../src/features/gen_ClientRectsAndTexts.rs | 33 +- .../src/features/gen_ClipboardEventInit.rs | 65 +- .../src/features/gen_ClipboardItemOptions.rs | 17 +- .../gen_ClipboardPermissionDescriptor.rs | 55 +- .../gen_ClipboardUnsanitizedFormats.rs | 27 +- .../src/features/gen_CloseEventInit.rs | 96 ++- .../src/features/gen_CollectedClientData.rs | 99 ++- .../src/features/gen_CompositionEventInit.rs | 97 ++- .../src/features/gen_ComputedEffectTiming.rs | 210 ++++-- .../src/features/gen_ConnStatusDict.rs | 16 +- .../src/features/gen_ConsoleCounter.rs | 32 +- .../src/features/gen_ConsoleCounterError.rs | 32 +- .../web-sys/src/features/gen_ConsoleEvent.rs | 272 ++++--- .../features/gen_ConsoleInstanceOptions.rs | 97 ++- .../src/features/gen_ConsoleProfileEvent.rs | 32 +- .../src/features/gen_ConsoleStackEntry.rs | 80 +- .../src/features/gen_ConsoleTimerError.rs | 32 +- .../src/features/gen_ConsoleTimerLogOrEnd.rs | 32 +- .../src/features/gen_ConsoleTimerStart.rs | 16 +- .../src/features/gen_ConstantSourceOptions.rs | 16 +- .../gen_ConstrainBooleanParameters.rs | 32 +- .../gen_ConstrainDomStringParameters.rs | 32 +- .../src/features/gen_ConstrainDoubleRange.rs | 64 +- .../src/features/gen_ConstrainLongRange.rs | 64 +- .../src/features/gen_ContextAttributes2d.rs | 32 +- .../features/gen_ConvertCoordinateOptions.rs | 34 +- .../src/features/gen_ConvolverOptions.rs | 83 ++- .../features/gen_CredentialCreationOptions.rs | 39 +- .../features/gen_CredentialRequestOptions.rs | 36 +- .../web-sys/src/features/gen_CryptoKeyPair.rs | 34 +- .../src/features/gen_CustomEventInit.rs | 64 +- .../web-sys/src/features/gen_DateTimeValue.rs | 80 +- .../features/gen_DecoderDoctorNotification.rs | 113 ++- .../web-sys/src/features/gen_DelayOptions.rs | 82 ++- .../features/gen_DeviceAccelerationInit.rs | 48 +- .../src/features/gen_DeviceLightEventInit.rs | 64 +- .../src/features/gen_DeviceMotionEventInit.rs | 117 ++- .../gen_DeviceOrientationEventInit.rs | 112 ++- .../features/gen_DeviceProximityEventInit.rs | 96 ++- .../features/gen_DeviceRotationRateInit.rs | 48 +- .../src/features/gen_DhKeyDeriveParams.rs | 33 +- .../features/gen_DirectoryPickerOptions.rs | 82 ++- .../gen_DisplayMediaStreamConstraints.rs | 32 +- .../src/features/gen_DisplayNameOptions.rs | 32 +- .../src/features/gen_DisplayNameResult.rs | 32 +- .../web-sys/src/features/gen_DnsCacheDict.rs | 16 +- .../web-sys/src/features/gen_DnsCacheEntry.rs | 80 +- .../web-sys/src/features/gen_DnsLookupDict.rs | 48 +- .../features/gen_DocumentTimelineOptions.rs | 16 +- .../src/features/gen_DomMatrix2dInit.rs | 192 +++-- .../web-sys/src/features/gen_DomMatrixInit.rs | 368 +++++++--- .../web-sys/src/features/gen_DomPointInit.rs | 64 +- .../web-sys/src/features/gen_DomQuadInit.rs | 68 +- .../web-sys/src/features/gen_DomQuadJson.rs | 68 +- .../web-sys/src/features/gen_DomRectInit.rs | 64 +- .../gen_DomWindowResizeEventDetail.rs | 32 +- .../web-sys/src/features/gen_DoubleRange.rs | 54 +- .../web-sys/src/features/gen_DragEventInit.rs | 451 ++++++++---- .../features/gen_DynamicsCompressorOptions.rs | 132 +++- .../src/features/gen_EcKeyAlgorithm.rs | 32 +- .../src/features/gen_EcKeyGenParams.rs | 32 +- .../src/features/gen_EcKeyImportParams.rs | 32 +- .../src/features/gen_EcdhKeyDeriveParams.rs | 33 +- .../web-sys/src/features/gen_EcdsaParams.rs | 32 +- .../web-sys/src/features/gen_EffectTiming.rs | 130 +++- .../features/gen_ElementCreationOptions.rs | 32 +- .../features/gen_ElementDefinitionOptions.rs | 16 +- .../src/features/gen_EncodedAudioChunkInit.rs | 109 ++- .../features/gen_EncodedAudioChunkMetadata.rs | 28 +- .../src/features/gen_EncodedVideoChunkInit.rs | 109 ++- .../features/gen_EncodedVideoChunkMetadata.rs | 83 ++- .../web-sys/src/features/gen_ErrorCallback.rs | 16 +- .../src/features/gen_ErrorEventInit.rs | 128 +++- crates/web-sys/src/features/gen_EventInit.rs | 48 +- .../web-sys/src/features/gen_EventListener.rs | 16 +- .../src/features/gen_EventListenerOptions.rs | 16 +- .../src/features/gen_EventModifierInit.rs | 289 +++++--- .../src/features/gen_EventSourceInit.rs | 16 +- .../src/features/gen_ExtendableEventInit.rs | 48 +- .../gen_ExtendableMessageEventInit.rs | 128 +++- .../src/features/gen_FakePluginMimeEntry.rs | 48 +- .../src/features/gen_FakePluginTagInit.rs | 144 ++-- .../src/features/gen_FetchEventInit.rs | 97 ++- .../gen_FetchReadableStreamReadDataDone.rs | 16 +- .../web-sys/src/features/gen_FileCallback.rs | 16 +- .../src/features/gen_FilePickerAcceptType.rs | 27 +- .../src/features/gen_FilePickerOptions.rs | 104 ++- .../src/features/gen_FilePropertyBag.rs | 32 +- .../gen_FileSystemCreateWritableOptions.rs | 16 +- .../features/gen_FileSystemEntriesCallback.rs | 16 +- .../features/gen_FileSystemEntryCallback.rs | 16 +- .../src/features/gen_FileSystemFlags.rs | 32 +- .../gen_FileSystemGetDirectoryOptions.rs | 16 +- .../features/gen_FileSystemGetFileOptions.rs | 16 +- ...en_FileSystemHandlePermissionDescriptor.rs | 30 +- .../gen_FileSystemPermissionDescriptor.rs | 84 ++- .../gen_FileSystemReadWriteOptions.rs | 16 +- .../features/gen_FileSystemRemoveOptions.rs | 16 +- .../src/features/gen_FocusEventInit.rs | 98 ++- .../web-sys/src/features/gen_FocusOptions.rs | 32 +- .../src/features/gen_FontFaceDescriptors.rs | 128 +++- .../features/gen_FontFaceSetIteratorResult.rs | 32 +- .../features/gen_FontFaceSetLoadEventInit.rs | 64 +- .../web-sys/src/features/gen_GainOptions.rs | 66 +- .../features/gen_GamepadAxisMoveEventInit.rs | 97 ++- .../features/gen_GamepadButtonEventInit.rs | 81 ++- .../src/features/gen_GamepadEventInit.rs | 65 +- .../src/features/gen_GetAnimationsOptions.rs | 27 +- .../src/features/gen_GetRootNodeOptions.rs | 16 +- .../features/gen_GpuBindGroupDescriptor.rs | 82 ++- .../src/features/gen_GpuBindGroupEntry.rs | 54 +- .../gen_GpuBindGroupLayoutDescriptor.rs | 54 +- .../features/gen_GpuBindGroupLayoutEntry.rs | 202 +++-- .../src/features/gen_GpuBlendComponent.rs | 84 ++- .../web-sys/src/features/gen_GpuBlendState.rs | 56 +- .../src/features/gen_GpuBufferBinding.rs | 82 ++- .../features/gen_GpuBufferBindingLayout.rs | 82 ++- .../src/features/gen_GpuBufferDescriptor.rs | 108 ++- .../features/gen_GpuCanvasConfiguration.rs | 138 +++- .../web-sys/src/features/gen_GpuColorDict.rs | 108 ++- .../src/features/gen_GpuColorTargetState.rs | 83 ++- .../gen_GpuCommandBufferDescriptor.rs | 27 +- .../gen_GpuCommandEncoderDescriptor.rs | 27 +- .../features/gen_GpuComputePassDescriptor.rs | 60 +- .../gen_GpuComputePassTimestampWrites.rs | 82 ++- .../gen_GpuComputePipelineDescriptor.rs | 82 ++- .../src/features/gen_GpuDepthStencilState.rs | 260 +++++-- .../src/features/gen_GpuDeviceDescriptor.rs | 82 ++- .../src/features/gen_GpuExtent3dDict.rs | 81 ++- .../gen_GpuExternalTextureDescriptor.rs | 54 +- .../src/features/gen_GpuFragmentState.rs | 82 ++- .../src/features/gen_GpuImageCopyBuffer.rs | 109 ++- .../features/gen_GpuImageCopyExternalImage.rs | 81 ++- .../src/features/gen_GpuImageCopyTexture.rs | 110 ++- .../features/gen_GpuImageCopyTextureTagged.rs | 137 +++- .../src/features/gen_GpuImageDataLayout.rs | 81 ++- .../src/features/gen_GpuMultisampleState.rs | 81 ++- .../features/gen_GpuObjectDescriptorBase.rs | 27 +- .../src/features/gen_GpuOrigin2dDict.rs | 54 +- .../src/features/gen_GpuOrigin3dDict.rs | 81 ++- .../features/gen_GpuPipelineDescriptorBase.rs | 54 +- .../src/features/gen_GpuPipelineErrorInit.rs | 28 +- .../gen_GpuPipelineLayoutDescriptor.rs | 57 +- .../src/features/gen_GpuPrimitiveState.rs | 139 +++- .../src/features/gen_GpuProgrammableStage.rs | 55 +- .../src/features/gen_GpuQuerySetDescriptor.rs | 82 ++- .../src/features/gen_GpuQueueDescriptor.rs | 27 +- .../features/gen_GpuRenderBundleDescriptor.rs | 27 +- .../gen_GpuRenderBundleEncoderDescriptor.rs | 160 ++-- .../gen_GpuRenderPassColorAttachment.rs | 166 +++-- ...gen_GpuRenderPassDepthStencilAttachment.rs | 240 ++++-- .../features/gen_GpuRenderPassDescriptor.rs | 169 +++-- .../src/features/gen_GpuRenderPassLayout.rs | 109 ++- .../gen_GpuRenderPassTimestampWrites.rs | 82 ++- .../gen_GpuRenderPipelineDescriptor.rs | 194 +++-- .../features/gen_GpuRequestAdapterOptions.rs | 55 +- .../features/gen_GpuSamplerBindingLayout.rs | 28 +- .../src/features/gen_GpuSamplerDescriptor.rs | 286 ++++++-- .../gen_GpuShaderModuleCompilationHint.rs | 54 +- .../features/gen_GpuShaderModuleDescriptor.rs | 106 ++- .../src/features/gen_GpuStencilFaceState.rs | 112 ++- .../gen_GpuStorageTextureBindingLayout.rs | 86 ++- .../features/gen_GpuTextureBindingLayout.rs | 83 ++- .../src/features/gen_GpuTextureDescriptor.rs | 212 ++++-- .../features/gen_GpuTextureViewDescriptor.rs | 205 ++++-- .../gen_GpuUncapturedErrorEventInit.rs | 109 ++- .../src/features/gen_GpuVertexAttribute.rs | 82 ++- .../src/features/gen_GpuVertexBufferLayout.rs | 82 ++- .../src/features/gen_GpuVertexState.rs | 82 ++- .../features/gen_GroupedHistoryEventInit.rs | 65 +- .../src/features/gen_HalfOpenInfoDict.rs | 16 +- .../src/features/gen_HashChangeEventInit.rs | 80 +- .../src/features/gen_HidCollectionInfo.rs | 173 +++-- .../features/gen_HidConnectionEventInit.rs | 109 ++- .../src/features/gen_HidDeviceFilter.rs | 104 ++- .../features/gen_HidDeviceRequestOptions.rs | 27 +- .../features/gen_HidInputReportEventInit.rs | 163 +++-- .../web-sys/src/features/gen_HidReportInfo.rs | 54 +- .../web-sys/src/features/gen_HidReportItem.rs | 659 ++++++++++++----- .../src/features/gen_HiddenPluginEventInit.rs | 48 +- .../src/features/gen_HitRegionOptions.rs | 50 +- crates/web-sys/src/features/gen_HkdfParams.rs | 64 +- .../src/features/gen_HmacDerivedKeyParams.rs | 48 +- .../src/features/gen_HmacImportParams.rs | 32 +- .../src/features/gen_HmacKeyAlgorithm.rs | 49 +- .../src/features/gen_HmacKeyGenParams.rs | 48 +- .../web-sys/src/features/gen_HttpConnDict.rs | 16 +- .../web-sys/src/features/gen_HttpConnInfo.rs | 48 +- .../src/features/gen_HttpConnectionElement.rs | 112 ++- .../features/gen_IdbFileMetadataParameters.rs | 32 +- .../src/features/gen_IdbIndexParameters.rs | 48 +- .../features/gen_IdbObjectStoreParameters.rs | 32 +- .../src/features/gen_IdbOpenDbOptions.rs | 33 +- .../features/gen_IdbVersionChangeEventInit.rs | 80 +- .../src/features/gen_IdleRequestOptions.rs | 16 +- .../src/features/gen_IirFilterOptions.rs | 82 ++- .../src/features/gen_ImageBitmapOptions.rs | 100 ++- .../gen_ImageCaptureErrorEventInit.rs | 68 +- .../src/features/gen_ImageDecodeOptions.rs | 54 +- .../src/features/gen_ImageDecodeResult.rs | 55 +- .../src/features/gen_ImageDecoderInit.rs | 183 +++-- .../src/features/gen_ImageEncodeOptions.rs | 32 +- .../src/features/gen_InputEventInit.rs | 162 +++-- .../gen_IntersectionObserverEntryInit.rs | 84 ++- .../features/gen_IntersectionObserverInit.rs | 49 +- .../src/features/gen_IsInputPendingOptions.rs | 27 +- .../features/gen_IterableKeyAndValueResult.rs | 32 +- .../features/gen_IterableKeyOrValueResult.rs | 32 +- crates/web-sys/src/features/gen_JsonWebKey.rs | 288 +++++--- .../web-sys/src/features/gen_KeyAlgorithm.rs | 16 +- .../src/features/gen_KeyIdsInitData.rs | 16 +- .../src/features/gen_KeyboardEventInit.rs | 417 +++++++---- .../features/gen_KeyframeAnimationOptions.rs | 308 +++++--- .../src/features/gen_KeyframeEffectOptions.rs | 166 +++-- .../web-sys/src/features/gen_L10nElement.rs | 96 ++- crates/web-sys/src/features/gen_L10nValue.rs | 32 +- .../src/features/gen_LifecycleCallbacks.rs | 64 +- crates/web-sys/src/features/gen_LocaleInfo.rs | 32 +- crates/web-sys/src/features/gen_LockInfo.rs | 82 ++- .../src/features/gen_LockManagerSnapshot.rs | 54 +- .../web-sys/src/features/gen_LockOptions.rs | 110 ++- .../src/features/gen_MediaConfiguration.rs | 34 +- .../gen_MediaDecodingConfiguration.rs | 51 +- .../gen_MediaElementAudioSourceOptions.rs | 17 +- .../gen_MediaEncodingConfiguration.rs | 51 +- crates/web-sys/src/features/gen_MediaImage.rs | 81 ++- .../features/gen_MediaKeyMessageEventInit.rs | 81 ++- .../features/gen_MediaKeyNeededEventInit.rs | 80 +- .../gen_MediaKeySystemConfiguration.rs | 126 +++- .../gen_MediaKeySystemMediaCapability.rs | 32 +- .../src/features/gen_MediaKeysPolicy.rs | 16 +- .../src/features/gen_MediaMetadataInit.rs | 104 ++- .../src/features/gen_MediaPositionState.rs | 81 ++- .../features/gen_MediaQueryListEventInit.rs | 80 +- .../gen_MediaRecorderErrorEventInit.rs | 65 +- .../src/features/gen_MediaRecorderOptions.rs | 64 +- .../features/gen_MediaSessionActionDetails.rs | 109 ++- .../gen_MediaStreamAudioSourceOptions.rs | 17 +- .../features/gen_MediaStreamConstraints.rs | 80 +- .../src/features/gen_MediaStreamEventInit.rs | 65 +- .../features/gen_MediaStreamTrackEventInit.rs | 65 +- .../gen_MediaStreamTrackGeneratorInit.rs | 27 +- .../gen_MediaStreamTrackProcessorInit.rs | 55 +- .../features/gen_MediaTrackCapabilities.rs | 381 +++++++--- .../features/gen_MediaTrackConstraintSet.rs | 256 +++++-- .../src/features/gen_MediaTrackConstraints.rs | 272 ++++--- .../src/features/gen_MediaTrackSettings.rs | 144 ++-- .../gen_MediaTrackSupportedConstraints.rs | 240 ++++-- .../src/features/gen_MemoryAttribution.rs | 82 ++- .../gen_MemoryAttributionContainer.rs | 54 +- .../src/features/gen_MemoryBreakdownEntry.rs | 81 ++- .../src/features/gen_MemoryMeasurement.rs | 54 +- .../src/features/gen_MessageEventInit.rs | 128 +++- .../features/gen_MidiConnectionEventInit.rs | 65 +- .../src/features/gen_MidiMessageEventInit.rs | 48 +- .../web-sys/src/features/gen_MidiOptions.rs | 32 +- .../src/features/gen_MouseEventInit.rs | 434 +++++++---- .../src/features/gen_MutationObserverInit.rs | 144 ++-- .../src/features/gen_MutationObservingInfo.rs | 161 ++-- .../features/gen_NativeOsFileReadOptions.rs | 32 +- .../gen_NativeOsFileWriteAtomicOptions.rs | 80 +- .../features/gen_NavigatorUaBrandVersion.rs | 54 +- .../src/features/gen_NetworkCommandOptions.rs | 688 ++++++++++++------ .../src/features/gen_NetworkResultOptions.rs | 560 +++++++++----- crates/web-sys/src/features/gen_NodeFilter.rs | 16 +- .../src/features/gen_NotificationAction.rs | 48 +- .../src/features/gen_NotificationEventInit.rs | 65 +- .../src/features/gen_NotificationOptions.rs | 209 ++++-- .../src/features/gen_ObserverCallback.rs | 16 +- .../gen_OfflineAudioCompletionEventInit.rs | 65 +- .../gen_OfflineAudioContextOptions.rs | 48 +- .../src/features/gen_OpenFilePickerOptions.rs | 127 +++- .../src/features/gen_OpenWindowEventDetail.rs | 65 +- .../src/features/gen_OptionalEffectTiming.rs | 130 +++- .../src/features/gen_OscillatorOptions.rs | 116 ++- .../features/gen_PageTransitionEventInit.rs | 80 +- .../web-sys/src/features/gen_PannerOptions.rs | 276 ++++--- .../gen_PaymentMethodChangeEventInit.rs | 80 +- .../gen_PaymentRequestUpdateEventInit.rs | 48 +- .../web-sys/src/features/gen_Pbkdf2Params.rs | 64 +- .../features/gen_PerformanceEntryEventInit.rs | 144 ++-- .../gen_PerformanceEntryFilterOptions.rs | 48 +- .../features/gen_PerformanceObserverInit.rs | 32 +- .../features/gen_PeriodicWaveConstraints.rs | 16 +- .../src/features/gen_PeriodicWaveOptions.rs | 48 +- .../src/features/gen_PermissionDescriptor.rs | 17 +- .../web-sys/src/features/gen_PlaneLayout.rs | 54 +- .../features/gen_PluginCrashedEventInit.rs | 160 ++-- .../src/features/gen_PointerEventInit.rs | 610 +++++++++++----- .../src/features/gen_PopStateEventInit.rs | 64 +- .../src/features/gen_PopupBlockedEventInit.rs | 97 ++- .../src/features/gen_PositionOptions.rs | 48 +- ...resentationConnectionAvailableEventInit.rs | 67 +- ...en_PresentationConnectionCloseEventInit.rs | 83 ++- .../features/gen_ProfileTimelineLayerRect.rs | 64 +- .../src/features/gen_ProfileTimelineMarker.rs | 249 +++++-- .../features/gen_ProfileTimelineStackFrame.rs | 112 ++- .../src/features/gen_ProgressEventInit.rs | 96 ++- .../features/gen_PromiseRejectionEventInit.rs | 80 +- .../gen_PublicKeyCredentialCreationOptions.rs | 157 ++-- .../gen_PublicKeyCredentialDescriptor.rs | 49 +- .../features/gen_PublicKeyCredentialEntity.rs | 32 +- .../gen_PublicKeyCredentialParameters.rs | 33 +- .../gen_PublicKeyCredentialRequestOptions.rs | 104 ++- .../gen_PublicKeyCredentialRpEntity.rs | 48 +- .../gen_PublicKeyCredentialUserEntity.rs | 64 +- .../web-sys/src/features/gen_PushEventInit.rs | 64 +- .../src/features/gen_PushSubscriptionInit.rs | 80 +- .../src/features/gen_PushSubscriptionJson.rs | 33 +- .../src/features/gen_PushSubscriptionKeys.rs | 32 +- .../gen_PushSubscriptionOptionsInit.rs | 34 +- .../web-sys/src/features/gen_QueryOptions.rs | 27 +- .../src/features/gen_QueuingStrategy.rs | 32 +- .../src/features/gen_QueuingStrategyInit.rs | 16 +- .../web-sys/src/features/gen_RcwnPerfStats.rs | 48 +- crates/web-sys/src/features/gen_RcwnStatus.rs | 96 ++- .../gen_ReadableStreamGetReaderOptions.rs | 17 +- .../gen_ReadableStreamIteratorOptions.rs | 16 +- .../features/gen_ReadableStreamReadResult.rs | 32 +- .../src/features/gen_ReadableWritablePair.rs | 34 +- .../src/features/gen_RegisterRequest.rs | 32 +- .../src/features/gen_RegisterResponse.rs | 80 +- .../web-sys/src/features/gen_RegisteredKey.rs | 64 +- .../src/features/gen_RegistrationOptions.rs | 49 +- .../src/features/gen_RequestDeviceOptions.rs | 81 ++- .../web-sys/src/features/gen_RequestInit.rs | 199 +++-- ...RequestMediaKeySystemAccessNotification.rs | 33 +- .../src/features/gen_ResizeObserverOptions.rs | 17 +- .../web-sys/src/features/gen_ResponseInit.rs | 48 +- .../src/features/gen_RsaHashedImportParams.rs | 16 +- .../web-sys/src/features/gen_RsaOaepParams.rs | 32 +- .../src/features/gen_RsaOtherPrimesInfo.rs | 48 +- .../web-sys/src/features/gen_RsaPssParams.rs | 32 +- .../features/gen_RtcCertificateExpiration.rs | 16 +- .../web-sys/src/features/gen_RtcCodecStats.rs | 129 +++- .../src/features/gen_RtcConfiguration.rs | 82 ++- .../features/gen_RtcDataChannelEventInit.rs | 65 +- .../src/features/gen_RtcDataChannelInit.rs | 112 ++- .../src/features/gen_RtcFecParameters.rs | 16 +- .../src/features/gen_RtcIceCandidateInit.rs | 48 +- .../features/gen_RtcIceCandidatePairStats.rs | 274 ++++--- .../src/features/gen_RtcIceCandidateStats.rs | 146 ++-- .../src/features/gen_RtcIceComponentStats.rs | 129 +++- .../web-sys/src/features/gen_RtcIceServer.rs | 81 ++- .../src/features/gen_RtcIdentityAssertion.rs | 32 +- .../gen_RtcIdentityAssertionResult.rs | 33 +- .../src/features/gen_RtcIdentityProvider.rs | 32 +- .../gen_RtcIdentityProviderDetails.rs | 32 +- .../gen_RtcIdentityProviderOptions.rs | 48 +- .../gen_RtcIdentityValidationResult.rs | 32 +- .../features/gen_RtcInboundRtpStreamStats.rs | 385 +++++++--- .../src/features/gen_RtcMediaStreamStats.rs | 81 ++- .../features/gen_RtcMediaStreamTrackStats.rs | 273 ++++--- .../src/features/gen_RtcOfferOptions.rs | 48 +- .../features/gen_RtcOutboundRtpStreamStats.rs | 353 ++++++--- .../gen_RtcPeerConnectionIceEventInit.rs | 65 +- .../src/features/gen_RtcRtcpParameters.rs | 32 +- .../src/features/gen_RtcRtpCapabilities.rs | 32 +- .../src/features/gen_RtcRtpCodecCapability.rs | 64 +- .../src/features/gen_RtcRtpCodecParameters.rs | 80 +- .../features/gen_RtcRtpContributingSource.rs | 48 +- .../features/gen_RtcRtpEncodingParameters.rs | 180 +++-- .../gen_RtcRtpHeaderExtensionCapability.rs | 16 +- .../gen_RtcRtpHeaderExtensionParameters.rs | 48 +- .../src/features/gen_RtcRtpParameters.rs | 65 +- .../src/features/gen_RtcRtpSourceEntry.rs | 81 ++- .../gen_RtcRtpSynchronizationSource.rs | 64 +- .../src/features/gen_RtcRtpTransceiverInit.rs | 49 +- .../src/features/gen_RtcRtxParameters.rs | 16 +- .../features/gen_RtcSessionDescriptionInit.rs | 33 +- crates/web-sys/src/features/gen_RtcStats.rs | 49 +- .../features/gen_RtcStatsReportInternal.rs | 352 ++++++--- .../src/features/gen_RtcTrackEventInit.rs | 115 ++- .../src/features/gen_RtcTransportStats.rs | 81 ++- .../gen_RtcdtmfToneChangeEventInit.rs | 64 +- .../gen_RtcrtpContributingSourceStats.rs | 81 ++- .../src/features/gen_RtcrtpStreamStats.rs | 273 ++++--- .../src/features/gen_SaveFilePickerOptions.rs | 127 +++- .../features/gen_SchedulerPostTaskOptions.rs | 83 ++- .../src/features/gen_ScrollIntoViewOptions.rs | 51 +- .../web-sys/src/features/gen_ScrollOptions.rs | 17 +- .../src/features/gen_ScrollToOptions.rs | 49 +- .../features/gen_ScrollViewChangeEventInit.rs | 65 +- .../gen_SecurityPolicyViolationEventInit.rs | 243 +++++-- .../src/features/gen_SerialInputSignals.rs | 108 ++- .../web-sys/src/features/gen_SerialOptions.rs | 158 ++-- .../src/features/gen_SerialOutputSignals.rs | 81 ++- .../src/features/gen_SerialPortFilter.rs | 54 +- .../src/features/gen_SerialPortInfo.rs | 54 +- .../features/gen_SerialPortRequestOptions.rs | 27 +- .../src/features/gen_ServerSocketOptions.rs | 17 +- .../src/features/gen_ShadowRootInit.rs | 17 +- crates/web-sys/src/features/gen_ShareData.rs | 64 +- .../web-sys/src/features/gen_SignResponse.rs | 80 +- .../web-sys/src/features/gen_SocketElement.rs | 96 ++- .../web-sys/src/features/gen_SocketOptions.rs | 33 +- .../web-sys/src/features/gen_SocketsDict.rs | 48 +- .../gen_SpeechRecognitionErrorInit.rs | 81 ++- .../gen_SpeechRecognitionEventInit.rs | 117 ++- .../gen_SpeechSynthesisErrorEventInit.rs | 146 ++-- .../features/gen_SpeechSynthesisEventInit.rs | 129 +++- .../src/features/gen_StereoPannerOptions.rs | 66 +- .../src/features/gen_StorageEstimate.rs | 32 +- .../src/features/gen_StorageEventInit.rs | 129 +++- .../src/features/gen_StreamPipeOptions.rs | 65 +- .../features/gen_StyleRuleChangeEventInit.rs | 82 ++- ...tyleSheetApplicableStateChangeEventInit.rs | 82 ++- .../features/gen_StyleSheetChangeEventInit.rs | 81 ++- .../src/features/gen_SubmitEventInit.rs | 65 +- .../src/features/gen_SvcOutputMetadata.rs | 27 +- .../src/features/gen_SvgBoundingBoxOptions.rs | 64 +- .../src/features/gen_TaskControllerInit.rs | 28 +- .../gen_TaskPriorityChangeEventInit.rs | 109 ++- .../src/features/gen_TaskSignalAnyInit.rs | 27 +- .../features/gen_TcpServerSocketEventInit.rs | 65 +- .../features/gen_TcpSocketErrorEventInit.rs | 80 +- .../src/features/gen_TcpSocketEventInit.rs | 64 +- .../src/features/gen_TextDecodeOptions.rs | 16 +- .../src/features/gen_TextDecoderOptions.rs | 16 +- .../src/features/gen_TouchEventInit.rs | 337 ++++++--- crates/web-sys/src/features/gen_TouchInit.rs | 193 +++-- .../src/features/gen_TrackEventInit.rs | 64 +- .../web-sys/src/features/gen_Transformer.rs | 80 +- .../src/features/gen_TransitionEventInit.rs | 96 ++- .../web-sys/src/features/gen_TreeCellInfo.rs | 32 +- .../web-sys/src/features/gen_U2fClientData.rs | 48 +- crates/web-sys/src/features/gen_ULongRange.rs | 54 +- .../web-sys/src/features/gen_UaDataValues.rs | 242 ++++-- .../src/features/gen_UaLowEntropyJson.rs | 81 ++- .../src/features/gen_UdpMessageEventInit.rs | 96 ++- crates/web-sys/src/features/gen_UdpOptions.rs | 96 ++- .../web-sys/src/features/gen_UiEventInit.rs | 81 ++- .../src/features/gen_UnderlyingSink.rs | 80 +- .../src/features/gen_UnderlyingSource.rs | 81 ++- .../features/gen_UsbConnectionEventInit.rs | 109 ++- .../gen_UsbControlTransferParameters.rs | 137 +++- .../src/features/gen_UsbDeviceFilter.rs | 150 ++-- .../features/gen_UsbDeviceRequestOptions.rs | 27 +- .../features/gen_UsbPermissionDescriptor.rs | 55 +- .../src/features/gen_UsbPermissionStorage.rs | 27 +- .../features/gen_UserProximityEventInit.rs | 64 +- .../src/features/gen_ValueEventInit.rs | 104 ++- .../src/features/gen_VideoColorSpaceInit.rs | 111 ++- .../src/features/gen_VideoConfiguration.rs | 80 +- .../src/features/gen_VideoDecoderConfig.rs | 227 ++++-- .../src/features/gen_VideoDecoderInit.rs | 54 +- .../src/features/gen_VideoDecoderSupport.rs | 55 +- .../src/features/gen_VideoEncoderConfig.rs | 280 +++++-- .../features/gen_VideoEncoderEncodeOptions.rs | 27 +- .../src/features/gen_VideoEncoderInit.rs | 54 +- .../src/features/gen_VideoEncoderSupport.rs | 55 +- .../src/features/gen_VideoFrameBufferInit.rs | 273 +++++-- .../features/gen_VideoFrameCopyToOptions.rs | 55 +- .../src/features/gen_VideoFrameInit.rs | 156 ++-- .../web-sys/src/features/gen_VoidCallback.rs | 16 +- crates/web-sys/src/features/gen_VrLayer.rs | 49 +- .../gen_WatchAdvertisementsOptions.rs | 28 +- .../src/features/gen_WaveShaperOptions.rs | 83 ++- .../features/gen_WebGlContextAttributes.rs | 156 ++-- .../src/features/gen_WebGlContextEventInit.rs | 64 +- .../web-sys/src/features/gen_WebSocketDict.rs | 16 +- .../src/features/gen_WebSocketElement.rs | 96 ++- .../src/features/gen_WebTransportCloseInfo.rs | 54 +- .../features/gen_WebTransportDatagramStats.rs | 104 ++- .../features/gen_WebTransportErrorOptions.rs | 55 +- .../src/features/gen_WebTransportHash.rs | 54 +- .../src/features/gen_WebTransportOptions.rs | 109 ++- .../gen_WebTransportReceiveStreamStats.rs | 81 ++- .../gen_WebTransportSendStreamOptions.rs | 27 +- .../gen_WebTransportSendStreamStats.rs | 104 ++- .../src/features/gen_WebTransportStats.rs | 291 ++++++-- .../src/features/gen_WheelEventInit.rs | 498 +++++++++---- .../src/features/gen_WidevineCdmManifest.rs | 112 ++- .../web-sys/src/features/gen_WorkerOptions.rs | 50 +- .../src/features/gen_WorkletOptions.rs | 17 +- .../web-sys/src/features/gen_WriteParams.rs | 65 +- .../src/features/gen_XPathNsResolver.rs | 16 +- .../features/gen_XrInputSourceEventInit.rs | 137 +++- .../gen_XrInputSourcesChangeEventInit.rs | 163 +++-- .../features/gen_XrPermissionDescriptor.rs | 110 ++- .../features/gen_XrReferenceSpaceEventInit.rs | 137 +++- .../src/features/gen_XrRenderStateInit.rs | 130 +++- .../src/features/gen_XrSessionEventInit.rs | 109 ++- .../web-sys/src/features/gen_XrSessionInit.rs | 54 +- ..._XrSessionSupportedPermissionDescriptor.rs | 56 +- .../src/features/gen_XrWebGlLayerInit.rs | 150 ++-- crates/webidl/src/generator.rs | 75 +- crates/webidl/src/lib.rs | 23 +- crates/webidl/src/util.rs | 19 + examples/fetch/src/lib.rs | 6 +- .../src/dependent_module.rs | 4 +- examples/wasm-audio-worklet/src/wasm_audio.rs | 16 +- examples/webrtc_datachannel/src/lib.rs | 16 +- 555 files changed, 33132 insertions(+), 14275 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8020b205688..5959339c425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,9 @@ * Add bindings for `RTCRtpReceiver.jitterBufferTarget`. [#3968](https://github.com/rustwasm/wasm-bindgen/pull/3968) +* Generate getters for all WebIDL dictionary types. + [#3993](https://github.com/rustwasm/wasm-bindgen/pull/3993) + ### Changed * Stabilize Web Share API. @@ -62,6 +65,9 @@ * Update and stabilize the Clipboard API. [#3992](https://github.com/rustwasm/wasm-bindgen/pull/3992) +* Deprecate builder-pattern type setters for WebIDL dictionary types and introduce non-mutable setters instead. + [#3993](https://github.com/rustwasm/wasm-bindgen/pull/3993) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs index b453ed0641c..3a600c0442e 100644 --- a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs +++ b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] pub type AddEventListenerOptions; + #[doc = "Get the `capture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[wasm_bindgen(method, getter = "capture")] + pub fn get_capture(this: &AddEventListenerOptions) -> Option; + #[doc = "Change the `capture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] #[wasm_bindgen(method, setter = "capture")] - fn capture_shim(this: &AddEventListenerOptions, val: bool); + pub fn set_capture(this: &AddEventListenerOptions, val: bool); + #[doc = "Get the `once` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[wasm_bindgen(method, getter = "once")] + pub fn get_once(this: &AddEventListenerOptions) -> Option; + #[doc = "Change the `once` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] #[wasm_bindgen(method, setter = "once")] - fn once_shim(this: &AddEventListenerOptions, val: bool); + pub fn set_once(this: &AddEventListenerOptions, val: bool); + #[doc = "Get the `passive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[wasm_bindgen(method, getter = "passive")] + pub fn get_passive(this: &AddEventListenerOptions) -> Option; + #[doc = "Change the `passive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] #[wasm_bindgen(method, setter = "passive")] - fn passive_shim(this: &AddEventListenerOptions, val: bool); + pub fn set_passive(this: &AddEventListenerOptions, val: bool); } impl AddEventListenerOptions { #[doc = "Construct a new `AddEventListenerOptions`."] @@ -26,25 +50,19 @@ impl AddEventListenerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `capture` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[deprecated = "Use `set_capture()` instead."] pub fn capture(&mut self, val: bool) -> &mut Self { - self.capture_shim(val); + self.set_capture(val); self } - #[doc = "Change the `once` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[deprecated = "Use `set_once()` instead."] pub fn once(&mut self, val: bool) -> &mut Self { - self.once_shim(val); + self.set_once(val); self } - #[doc = "Change the `passive` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] + #[deprecated = "Use `set_passive()` instead."] pub fn passive(&mut self, val: bool) -> &mut Self { - self.passive_shim(val); + self.set_passive(val); self } } diff --git a/crates/web-sys/src/features/gen_AesCbcParams.rs b/crates/web-sys/src/features/gen_AesCbcParams.rs index a342b655e6a..d4bcce9127e 100644 --- a/crates/web-sys/src/features/gen_AesCbcParams.rs +++ b/crates/web-sys/src/features/gen_AesCbcParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] pub type AesCbcParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesCbcParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesCbcParams, val: &str); + pub fn set_name(this: &AesCbcParams, val: &str); + #[doc = "Get the `iv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] + #[wasm_bindgen(method, getter = "iv")] + pub fn get_iv(this: &AesCbcParams) -> ::js_sys::Object; + #[doc = "Change the `iv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] #[wasm_bindgen(method, setter = "iv")] - fn iv_shim(this: &AesCbcParams, val: &::js_sys::Object); + pub fn set_iv(this: &AesCbcParams, val: &::js_sys::Object); } impl AesCbcParams { #[doc = "Construct a new `AesCbcParams`."] @@ -26,18 +42,14 @@ impl AesCbcParams { ret.iv(iv); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `iv` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] + #[deprecated = "Use `set_iv()` instead."] pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self { - self.iv_shim(val); + self.set_iv(val); self } } diff --git a/crates/web-sys/src/features/gen_AesCtrParams.rs b/crates/web-sys/src/features/gen_AesCtrParams.rs index ce6270ad036..6a8e17f3bb7 100644 --- a/crates/web-sys/src/features/gen_AesCtrParams.rs +++ b/crates/web-sys/src/features/gen_AesCtrParams.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] pub type AesCtrParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesCtrParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesCtrParams, val: &str); + pub fn set_name(this: &AesCtrParams, val: &str); + #[doc = "Get the `counter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[wasm_bindgen(method, getter = "counter")] + pub fn get_counter(this: &AesCtrParams) -> ::js_sys::Object; + #[doc = "Change the `counter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] #[wasm_bindgen(method, setter = "counter")] - fn counter_shim(this: &AesCtrParams, val: &::js_sys::Object); + pub fn set_counter(this: &AesCtrParams, val: &::js_sys::Object); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &AesCtrParams) -> u8; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &AesCtrParams, val: u8); + pub fn set_length(this: &AesCtrParams, val: u8); } impl AesCtrParams { #[doc = "Construct a new `AesCtrParams`."] @@ -29,25 +53,19 @@ impl AesCtrParams { ret.length(length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `counter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[deprecated = "Use `set_counter()` instead."] pub fn counter(&mut self, val: &::js_sys::Object) -> &mut Self { - self.counter_shim(val); + self.set_counter(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u8) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs index f0dc4f1e939..e36567f1bc1 100644 --- a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] pub type AesDerivedKeyParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesDerivedKeyParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesDerivedKeyParams, val: &str); + pub fn set_name(this: &AesDerivedKeyParams, val: &str); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &AesDerivedKeyParams) -> u32; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &AesDerivedKeyParams, val: u32); + pub fn set_length(this: &AesDerivedKeyParams, val: u32); } impl AesDerivedKeyParams { #[doc = "Construct a new `AesDerivedKeyParams`."] @@ -26,18 +42,14 @@ impl AesDerivedKeyParams { ret.length(length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_AesGcmParams.rs b/crates/web-sys/src/features/gen_AesGcmParams.rs index 13bac4af42c..94918a67623 100644 --- a/crates/web-sys/src/features/gen_AesGcmParams.rs +++ b/crates/web-sys/src/features/gen_AesGcmParams.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] pub type AesGcmParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesGcmParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesGcmParams, val: &str); + pub fn set_name(this: &AesGcmParams, val: &str); + #[doc = "Get the `additionalData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[wasm_bindgen(method, getter = "additionalData")] + pub fn get_additional_data(this: &AesGcmParams) -> Option<::js_sys::Object>; + #[doc = "Change the `additionalData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] #[wasm_bindgen(method, setter = "additionalData")] - fn additional_data_shim(this: &AesGcmParams, val: &::js_sys::Object); + pub fn set_additional_data(this: &AesGcmParams, val: &::js_sys::Object); + #[doc = "Get the `iv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[wasm_bindgen(method, getter = "iv")] + pub fn get_iv(this: &AesGcmParams) -> ::js_sys::Object; + #[doc = "Change the `iv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] #[wasm_bindgen(method, setter = "iv")] - fn iv_shim(this: &AesGcmParams, val: &::js_sys::Object); + pub fn set_iv(this: &AesGcmParams, val: &::js_sys::Object); + #[doc = "Get the `tagLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[wasm_bindgen(method, getter = "tagLength")] + pub fn get_tag_length(this: &AesGcmParams) -> Option; + #[doc = "Change the `tagLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] #[wasm_bindgen(method, setter = "tagLength")] - fn tag_length_shim(this: &AesGcmParams, val: u8); + pub fn set_tag_length(this: &AesGcmParams, val: u8); } impl AesGcmParams { #[doc = "Construct a new `AesGcmParams`."] @@ -30,32 +62,24 @@ impl AesGcmParams { ret.iv(iv); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `additionalData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[deprecated = "Use `set_additional_data()` instead."] pub fn additional_data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.additional_data_shim(val); + self.set_additional_data(val); self } - #[doc = "Change the `iv` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[deprecated = "Use `set_iv()` instead."] pub fn iv(&mut self, val: &::js_sys::Object) -> &mut Self { - self.iv_shim(val); + self.set_iv(val); self } - #[doc = "Change the `tagLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] + #[deprecated = "Use `set_tag_length()` instead."] pub fn tag_length(&mut self, val: u8) -> &mut Self { - self.tag_length_shim(val); + self.set_tag_length(val); self } } diff --git a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs index b525478f622..d202b081c0c 100644 --- a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] pub type AesKeyAlgorithm; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesKeyAlgorithm) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesKeyAlgorithm, val: &str); + pub fn set_name(this: &AesKeyAlgorithm, val: &str); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &AesKeyAlgorithm) -> u16; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &AesKeyAlgorithm, val: u16); + pub fn set_length(this: &AesKeyAlgorithm, val: u16); } impl AesKeyAlgorithm { #[doc = "Construct a new `AesKeyAlgorithm`."] @@ -26,18 +42,14 @@ impl AesKeyAlgorithm { ret.length(length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u16) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_AesKeyGenParams.rs b/crates/web-sys/src/features/gen_AesKeyGenParams.rs index 266ae71921d..9b9debe146c 100644 --- a/crates/web-sys/src/features/gen_AesKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_AesKeyGenParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] pub type AesKeyGenParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AesKeyGenParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AesKeyGenParams, val: &str); + pub fn set_name(this: &AesKeyGenParams, val: &str); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &AesKeyGenParams) -> u16; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &AesKeyGenParams, val: u16); + pub fn set_length(this: &AesKeyGenParams, val: u16); } impl AesKeyGenParams { #[doc = "Construct a new `AesKeyGenParams`."] @@ -26,18 +42,14 @@ impl AesKeyGenParams { ret.length(length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u16) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_Algorithm.rs b/crates/web-sys/src/features/gen_Algorithm.rs index 3a82cd9e61e..18164738e02 100644 --- a/crates/web-sys/src/features/gen_Algorithm.rs +++ b/crates/web-sys/src/features/gen_Algorithm.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] pub type Algorithm; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &Algorithm) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &Algorithm, val: &str); + pub fn set_name(this: &Algorithm, val: &str); } impl Algorithm { #[doc = "Construct a new `Algorithm`."] @@ -23,11 +31,9 @@ impl Algorithm { ret.name(name); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs index ac016920b6f..c04735b5385 100644 --- a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs @@ -14,12 +14,60 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AllowedBluetoothDevice; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowedServices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "allowedServices")] + pub fn get_allowed_services(this: &AllowedBluetoothDevice) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowedServices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "allowedServices")] - fn allowed_services_shim(this: &AllowedBluetoothDevice, val: &::wasm_bindgen::JsValue); + pub fn set_allowed_services(this: &AllowedBluetoothDevice, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &AllowedBluetoothDevice) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &AllowedBluetoothDevice, val: &str); + pub fn set_device_id(this: &AllowedBluetoothDevice, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mayUseGATT` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mayUseGATT")] + pub fn get_may_use_gatt(this: &AllowedBluetoothDevice) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mayUseGATT` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mayUseGATT")] - fn may_use_gatt_shim(this: &AllowedBluetoothDevice, val: bool); + pub fn set_may_use_gatt(this: &AllowedBluetoothDevice, val: bool); } #[cfg(web_sys_unstable_apis)] impl AllowedBluetoothDevice { @@ -42,36 +90,21 @@ impl AllowedBluetoothDevice { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `allowedServices` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_allowed_services()` instead."] pub fn allowed_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.allowed_services_shim(val); + self.set_allowed_services(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `deviceId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_device_id()` instead."] pub fn device_id(&mut self, val: &str) -> &mut Self { - self.device_id_shim(val); + self.set_device_id(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `mayUseGATT` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_may_use_gatt()` instead."] pub fn may_use_gatt(&mut self, val: bool) -> &mut Self { - self.may_use_gatt_shim(val); + self.set_may_use_gatt(val); self } } diff --git a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs index 23070d3117d..24c4c4c2db0 100644 --- a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs @@ -14,12 +14,60 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AllowedUsbDevice; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `productId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "productId")] + pub fn get_product_id(this: &AllowedUsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `productId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "productId")] - fn product_id_shim(this: &AllowedUsbDevice, val: u8); + pub fn set_product_id(this: &AllowedUsbDevice, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `serialNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "serialNumber")] + pub fn get_serial_number(this: &AllowedUsbDevice) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `serialNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "serialNumber")] - fn serial_number_shim(this: &AllowedUsbDevice, val: &str); + pub fn set_serial_number(this: &AllowedUsbDevice, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `vendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "vendorId")] + pub fn get_vendor_id(this: &AllowedUsbDevice) -> u8; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `vendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "vendorId")] - fn vendor_id_shim(this: &AllowedUsbDevice, val: u8); + pub fn set_vendor_id(this: &AllowedUsbDevice, val: u8); } #[cfg(web_sys_unstable_apis)] impl AllowedUsbDevice { @@ -37,36 +85,21 @@ impl AllowedUsbDevice { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `productId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_product_id()` instead."] pub fn product_id(&mut self, val: u8) -> &mut Self { - self.product_id_shim(val); + self.set_product_id(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `serialNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_serial_number()` instead."] pub fn serial_number(&mut self, val: &str) -> &mut Self { - self.serial_number_shim(val); + self.set_serial_number(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `vendorId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_vendor_id()` instead."] pub fn vendor_id(&mut self, val: u8) -> &mut Self { - self.vendor_id_shim(val); + self.set_vendor_id(val); self } } diff --git a/crates/web-sys/src/features/gen_AnalyserOptions.rs b/crates/web-sys/src/features/gen_AnalyserOptions.rs index 776ce399d63..e5ff28832c3 100644 --- a/crates/web-sys/src/features/gen_AnalyserOptions.rs +++ b/crates/web-sys/src/features/gen_AnalyserOptions.rs @@ -10,22 +10,80 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] pub type AnalyserOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &AnalyserOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &AnalyserOptions, val: u32); + pub fn set_channel_count(this: &AnalyserOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelCountMode`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &AnalyserOptions) -> Option; #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelCountMode`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &AnalyserOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &AnalyserOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelInterpretation`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &AnalyserOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelInterpretation`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &AnalyserOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &AnalyserOptions, val: ChannelInterpretation); + #[doc = "Get the `fftSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[wasm_bindgen(method, getter = "fftSize")] + pub fn get_fft_size(this: &AnalyserOptions) -> Option; + #[doc = "Change the `fftSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] #[wasm_bindgen(method, setter = "fftSize")] - fn fft_size_shim(this: &AnalyserOptions, val: u32); + pub fn set_fft_size(this: &AnalyserOptions, val: u32); + #[doc = "Get the `maxDecibels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[wasm_bindgen(method, getter = "maxDecibels")] + pub fn get_max_decibels(this: &AnalyserOptions) -> Option; + #[doc = "Change the `maxDecibels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] #[wasm_bindgen(method, setter = "maxDecibels")] - fn max_decibels_shim(this: &AnalyserOptions, val: f64); + pub fn set_max_decibels(this: &AnalyserOptions, val: f64); + #[doc = "Get the `minDecibels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[wasm_bindgen(method, getter = "minDecibels")] + pub fn get_min_decibels(this: &AnalyserOptions) -> Option; + #[doc = "Change the `minDecibels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] #[wasm_bindgen(method, setter = "minDecibels")] - fn min_decibels_shim(this: &AnalyserOptions, val: f64); + pub fn set_min_decibels(this: &AnalyserOptions, val: f64); + #[doc = "Get the `smoothingTimeConstant` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[wasm_bindgen(method, getter = "smoothingTimeConstant")] + pub fn get_smoothing_time_constant(this: &AnalyserOptions) -> Option; + #[doc = "Change the `smoothingTimeConstant` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] #[wasm_bindgen(method, setter = "smoothingTimeConstant")] - fn smoothing_time_constant_shim(this: &AnalyserOptions, val: f64); + pub fn set_smoothing_time_constant(this: &AnalyserOptions, val: f64); } impl AnalyserOptions { #[doc = "Construct a new `AnalyserOptions`."] @@ -36,55 +94,41 @@ impl AnalyserOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelCountMode`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`, `ChannelInterpretation`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `fftSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[deprecated = "Use `set_fft_size()` instead."] pub fn fft_size(&mut self, val: u32) -> &mut Self { - self.fft_size_shim(val); + self.set_fft_size(val); self } - #[doc = "Change the `maxDecibels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[deprecated = "Use `set_max_decibels()` instead."] pub fn max_decibels(&mut self, val: f64) -> &mut Self { - self.max_decibels_shim(val); + self.set_max_decibels(val); self } - #[doc = "Change the `minDecibels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[deprecated = "Use `set_min_decibels()` instead."] pub fn min_decibels(&mut self, val: f64) -> &mut Self { - self.min_decibels_shim(val); + self.set_min_decibels(val); self } - #[doc = "Change the `smoothingTimeConstant` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnalyserOptions`*"] + #[deprecated = "Use `set_smoothing_time_constant()` instead."] pub fn smoothing_time_constant(&mut self, val: f64) -> &mut Self { - self.smoothing_time_constant_shim(val); + self.set_smoothing_time_constant(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationEventInit.rs b/crates/web-sys/src/features/gen_AnimationEventInit.rs index 49910c05af7..23b8e75af68 100644 --- a/crates/web-sys/src/features/gen_AnimationEventInit.rs +++ b/crates/web-sys/src/features/gen_AnimationEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] pub type AnimationEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &AnimationEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &AnimationEventInit, val: bool); + pub fn set_bubbles(this: &AnimationEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &AnimationEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &AnimationEventInit, val: bool); + pub fn set_cancelable(this: &AnimationEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &AnimationEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &AnimationEventInit, val: bool); + pub fn set_composed(this: &AnimationEventInit, val: bool); + #[doc = "Get the `animationName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "animationName")] + pub fn get_animation_name(this: &AnimationEventInit) -> Option; + #[doc = "Change the `animationName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "animationName")] - fn animation_name_shim(this: &AnimationEventInit, val: &str); + pub fn set_animation_name(this: &AnimationEventInit, val: &str); + #[doc = "Get the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "elapsedTime")] + pub fn get_elapsed_time(this: &AnimationEventInit) -> Option; + #[doc = "Change the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "elapsedTime")] - fn elapsed_time_shim(this: &AnimationEventInit, val: f32); + pub fn set_elapsed_time(this: &AnimationEventInit, val: f32); + #[doc = "Get the `pseudoElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[wasm_bindgen(method, getter = "pseudoElement")] + pub fn get_pseudo_element(this: &AnimationEventInit) -> Option; + #[doc = "Change the `pseudoElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, setter = "pseudoElement")] - fn pseudo_element_shim(this: &AnimationEventInit, val: &str); + pub fn set_pseudo_element(this: &AnimationEventInit, val: &str); } impl AnimationEventInit { #[doc = "Construct a new `AnimationEventInit`."] @@ -32,46 +80,34 @@ impl AnimationEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `animationName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_animation_name()` instead."] pub fn animation_name(&mut self, val: &str) -> &mut Self { - self.animation_name_shim(val); + self.set_animation_name(val); self } - #[doc = "Change the `elapsedTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_elapsed_time()` instead."] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - self.elapsed_time_shim(val); + self.set_elapsed_time(val); self } - #[doc = "Change the `pseudoElement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] + #[deprecated = "Use `set_pseudo_element()` instead."] pub fn pseudo_element(&mut self, val: &str) -> &mut Self { - self.pseudo_element_shim(val); + self.set_pseudo_element(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs b/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs index de0898ed513..921cefc6136 100644 --- a/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs +++ b/crates/web-sys/src/features/gen_AnimationPlaybackEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] pub type AnimationPlaybackEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &AnimationPlaybackEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &AnimationPlaybackEventInit, val: bool); + pub fn set_bubbles(this: &AnimationPlaybackEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &AnimationPlaybackEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &AnimationPlaybackEventInit, val: bool); + pub fn set_cancelable(this: &AnimationPlaybackEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &AnimationPlaybackEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &AnimationPlaybackEventInit, val: bool); + pub fn set_composed(this: &AnimationPlaybackEventInit, val: bool); + #[doc = "Get the `currentTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[wasm_bindgen(method, getter = "currentTime")] + pub fn get_current_time(this: &AnimationPlaybackEventInit) -> Option; + #[doc = "Change the `currentTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] #[wasm_bindgen(method, setter = "currentTime")] - fn current_time_shim(this: &AnimationPlaybackEventInit, val: Option); + pub fn set_current_time(this: &AnimationPlaybackEventInit, val: Option); + #[doc = "Get the `timelineTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[wasm_bindgen(method, getter = "timelineTime")] + pub fn get_timeline_time(this: &AnimationPlaybackEventInit) -> Option; + #[doc = "Change the `timelineTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] #[wasm_bindgen(method, setter = "timelineTime")] - fn timeline_time_shim(this: &AnimationPlaybackEventInit, val: Option); + pub fn set_timeline_time(this: &AnimationPlaybackEventInit, val: Option); } impl AnimationPlaybackEventInit { #[doc = "Construct a new `AnimationPlaybackEventInit`."] @@ -30,39 +70,29 @@ impl AnimationPlaybackEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `currentTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[deprecated = "Use `set_current_time()` instead."] pub fn current_time(&mut self, val: Option) -> &mut Self { - self.current_time_shim(val); + self.set_current_time(val); self } - #[doc = "Change the `timelineTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPlaybackEventInit`*"] + #[deprecated = "Use `set_timeline_time()` instead."] pub fn timeline_time(&mut self, val: Option) -> &mut Self { - self.timeline_time_shim(val); + self.set_timeline_time(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs index 8b9e529af90..5ce5566996d 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] pub type AnimationPropertyDetails; + #[doc = "Get the `property` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[wasm_bindgen(method, getter = "property")] + pub fn get_property(this: &AnimationPropertyDetails) -> String; + #[doc = "Change the `property` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, setter = "property")] - fn property_shim(this: &AnimationPropertyDetails, val: &str); + pub fn set_property(this: &AnimationPropertyDetails, val: &str); + #[doc = "Get the `runningOnCompositor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[wasm_bindgen(method, getter = "runningOnCompositor")] + pub fn get_running_on_compositor(this: &AnimationPropertyDetails) -> bool; + #[doc = "Change the `runningOnCompositor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, setter = "runningOnCompositor")] - fn running_on_compositor_shim(this: &AnimationPropertyDetails, val: bool); + pub fn set_running_on_compositor(this: &AnimationPropertyDetails, val: bool); + #[doc = "Get the `values` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[wasm_bindgen(method, getter = "values")] + pub fn get_values(this: &AnimationPropertyDetails) -> ::js_sys::Array; + #[doc = "Change the `values` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, setter = "values")] - fn values_shim(this: &AnimationPropertyDetails, val: &::wasm_bindgen::JsValue); + pub fn set_values(this: &AnimationPropertyDetails, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `warning` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[wasm_bindgen(method, getter = "warning")] + pub fn get_warning(this: &AnimationPropertyDetails) -> Option; + #[doc = "Change the `warning` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, setter = "warning")] - fn warning_shim(this: &AnimationPropertyDetails, val: &str); + pub fn set_warning(this: &AnimationPropertyDetails, val: &str); } impl AnimationPropertyDetails { #[doc = "Construct a new `AnimationPropertyDetails`."] @@ -35,32 +67,24 @@ impl AnimationPropertyDetails { ret.values(values); ret } - #[doc = "Change the `property` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[deprecated = "Use `set_property()` instead."] pub fn property(&mut self, val: &str) -> &mut Self { - self.property_shim(val); + self.set_property(val); self } - #[doc = "Change the `runningOnCompositor` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[deprecated = "Use `set_running_on_compositor()` instead."] pub fn running_on_compositor(&mut self, val: bool) -> &mut Self { - self.running_on_compositor_shim(val); + self.set_running_on_compositor(val); self } - #[doc = "Change the `values` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[deprecated = "Use `set_values()` instead."] pub fn values(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.values_shim(val); + self.set_values(val); self } - #[doc = "Change the `warning` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] + #[deprecated = "Use `set_warning()` instead."] pub fn warning(&mut self, val: &str) -> &mut Self { - self.warning_shim(val); + self.set_warning(val); self } } diff --git a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs index 28ace13608c..acb03d52d82 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs @@ -11,14 +11,47 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] pub type AnimationPropertyValueDetails; #[cfg(feature = "CompositeOperation")] + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`, `CompositeOperation`*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &AnimationPropertyValueDetails) -> CompositeOperation; + #[cfg(feature = "CompositeOperation")] + #[doc = "Change the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`, `CompositeOperation`*"] #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &AnimationPropertyValueDetails, val: CompositeOperation); + pub fn set_composite(this: &AnimationPropertyValueDetails, val: CompositeOperation); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &AnimationPropertyValueDetails) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &AnimationPropertyValueDetails, val: &str); + pub fn set_easing(this: &AnimationPropertyValueDetails, val: &str); + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &AnimationPropertyValueDetails) -> f64; + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &AnimationPropertyValueDetails, val: f64); + pub fn set_offset(this: &AnimationPropertyValueDetails, val: f64); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &AnimationPropertyValueDetails) -> Option; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &AnimationPropertyValueDetails, val: &str); + pub fn set_value(this: &AnimationPropertyValueDetails, val: &str); } impl AnimationPropertyValueDetails { #[cfg(feature = "CompositeOperation")] @@ -33,32 +66,24 @@ impl AnimationPropertyValueDetails { ret } #[cfg(feature = "CompositeOperation")] - #[doc = "Change the `composite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`, `CompositeOperation`*"] + #[deprecated = "Use `set_composite()` instead."] pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - self.composite_shim(val); + self.set_composite(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: f64) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &str) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_AssignedNodesOptions.rs b/crates/web-sys/src/features/gen_AssignedNodesOptions.rs index 45eba715538..c09dbaeefc1 100644 --- a/crates/web-sys/src/features/gen_AssignedNodesOptions.rs +++ b/crates/web-sys/src/features/gen_AssignedNodesOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] pub type AssignedNodesOptions; + #[doc = "Get the `flatten` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] + #[wasm_bindgen(method, getter = "flatten")] + pub fn get_flatten(this: &AssignedNodesOptions) -> Option; + #[doc = "Change the `flatten` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] #[wasm_bindgen(method, setter = "flatten")] - fn flatten_shim(this: &AssignedNodesOptions, val: bool); + pub fn set_flatten(this: &AssignedNodesOptions, val: bool); } impl AssignedNodesOptions { #[doc = "Construct a new `AssignedNodesOptions`."] @@ -22,11 +30,9 @@ impl AssignedNodesOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `flatten` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AssignedNodesOptions`*"] + #[deprecated = "Use `set_flatten()` instead."] pub fn flatten(&mut self, val: bool) -> &mut Self { - self.flatten_shim(val); + self.set_flatten(val); self } } diff --git a/crates/web-sys/src/features/gen_AttributeNameValue.rs b/crates/web-sys/src/features/gen_AttributeNameValue.rs index 46535ab0223..9d4cff6cd3b 100644 --- a/crates/web-sys/src/features/gen_AttributeNameValue.rs +++ b/crates/web-sys/src/features/gen_AttributeNameValue.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] pub type AttributeNameValue; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &AttributeNameValue) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &AttributeNameValue, val: &str); + pub fn set_name(this: &AttributeNameValue, val: &str); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &AttributeNameValue) -> String; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &AttributeNameValue, val: &str); + pub fn set_value(this: &AttributeNameValue, val: &str); } impl AttributeNameValue { #[doc = "Construct a new `AttributeNameValue`."] @@ -26,18 +42,14 @@ impl AttributeNameValue { ret.value(value); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &str) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioBufferOptions.rs b/crates/web-sys/src/features/gen_AudioBufferOptions.rs index b3f905927bf..d5bbd45fca8 100644 --- a/crates/web-sys/src/features/gen_AudioBufferOptions.rs +++ b/crates/web-sys/src/features/gen_AudioBufferOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] pub type AudioBufferOptions; + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &AudioBufferOptions) -> u32; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &AudioBufferOptions, val: u32); + pub fn set_length(this: &AudioBufferOptions, val: u32); + #[doc = "Get the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[wasm_bindgen(method, getter = "numberOfChannels")] + pub fn get_number_of_channels(this: &AudioBufferOptions) -> Option; + #[doc = "Change the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] #[wasm_bindgen(method, setter = "numberOfChannels")] - fn number_of_channels_shim(this: &AudioBufferOptions, val: u32); + pub fn set_number_of_channels(this: &AudioBufferOptions, val: u32); + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &AudioBufferOptions) -> f32; + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &AudioBufferOptions, val: f32); + pub fn set_sample_rate(this: &AudioBufferOptions, val: f32); } impl AudioBufferOptions { #[doc = "Construct a new `AudioBufferOptions`."] @@ -28,25 +52,19 @@ impl AudioBufferOptions { ret.sample_rate(sample_rate); ret } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } - #[doc = "Change the `numberOfChannels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[deprecated = "Use `set_number_of_channels()` instead."] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - self.number_of_channels_shim(val); + self.set_number_of_channels(val); self } - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferOptions`*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs b/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs index 5da87254d67..7c470f0b5de 100644 --- a/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs +++ b/crates/web-sys/src/features/gen_AudioBufferSourceOptions.rs @@ -11,18 +11,67 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] pub type AudioBufferSourceOptions; #[cfg(feature = "AudioBuffer")] + #[doc = "Get the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "buffer")] + pub fn get_buffer(this: &AudioBufferSourceOptions) -> Option; + #[cfg(feature = "AudioBuffer")] + #[doc = "Change the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "buffer")] - fn buffer_shim(this: &AudioBufferSourceOptions, val: Option<&AudioBuffer>); + pub fn set_buffer(this: &AudioBufferSourceOptions, val: Option<&AudioBuffer>); + #[doc = "Get the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "detune")] + pub fn get_detune(this: &AudioBufferSourceOptions) -> Option; + #[doc = "Change the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "detune")] - fn detune_shim(this: &AudioBufferSourceOptions, val: f32); + pub fn set_detune(this: &AudioBufferSourceOptions, val: f32); + #[doc = "Get the `loop` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "loop")] + pub fn get_loop(this: &AudioBufferSourceOptions) -> Option; + #[doc = "Change the `loop` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "loop")] - fn loop__shim(this: &AudioBufferSourceOptions, val: bool); + pub fn set_loop(this: &AudioBufferSourceOptions, val: bool); + #[doc = "Get the `loopEnd` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "loopEnd")] + pub fn get_loop_end(this: &AudioBufferSourceOptions) -> Option; + #[doc = "Change the `loopEnd` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "loopEnd")] - fn loop_end_shim(this: &AudioBufferSourceOptions, val: f64); + pub fn set_loop_end(this: &AudioBufferSourceOptions, val: f64); + #[doc = "Get the `loopStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "loopStart")] + pub fn get_loop_start(this: &AudioBufferSourceOptions) -> Option; + #[doc = "Change the `loopStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "loopStart")] - fn loop_start_shim(this: &AudioBufferSourceOptions, val: f64); + pub fn set_loop_start(this: &AudioBufferSourceOptions, val: f64); + #[doc = "Get the `playbackRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[wasm_bindgen(method, getter = "playbackRate")] + pub fn get_playback_rate(this: &AudioBufferSourceOptions) -> Option; + #[doc = "Change the `playbackRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] #[wasm_bindgen(method, setter = "playbackRate")] - fn playback_rate_shim(this: &AudioBufferSourceOptions, val: f32); + pub fn set_playback_rate(this: &AudioBufferSourceOptions, val: f32); } impl AudioBufferSourceOptions { #[doc = "Construct a new `AudioBufferSourceOptions`."] @@ -34,46 +83,34 @@ impl AudioBufferSourceOptions { ret } #[cfg(feature = "AudioBuffer")] - #[doc = "Change the `buffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_buffer()` instead."] pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self { - self.buffer_shim(val); + self.set_buffer(val); self } - #[doc = "Change the `detune` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_detune()` instead."] pub fn detune(&mut self, val: f32) -> &mut Self { - self.detune_shim(val); + self.set_detune(val); self } - #[doc = "Change the `loop` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_loop()` instead."] pub fn loop_(&mut self, val: bool) -> &mut Self { - self.loop__shim(val); + self.set_loop(val); self } - #[doc = "Change the `loopEnd` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_loop_end()` instead."] pub fn loop_end(&mut self, val: f64) -> &mut Self { - self.loop_end_shim(val); + self.set_loop_end(val); self } - #[doc = "Change the `loopStart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_loop_start()` instead."] pub fn loop_start(&mut self, val: f64) -> &mut Self { - self.loop_start_shim(val); + self.set_loop_start(val); self } - #[doc = "Change the `playbackRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"] + #[deprecated = "Use `set_playback_rate()` instead."] pub fn playback_rate(&mut self, val: f32) -> &mut Self { - self.playback_rate_shim(val); + self.set_playback_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioConfiguration.rs b/crates/web-sys/src/features/gen_AudioConfiguration.rs index 058667594ce..decab4a0fef 100644 --- a/crates/web-sys/src/features/gen_AudioConfiguration.rs +++ b/crates/web-sys/src/features/gen_AudioConfiguration.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] pub type AudioConfiguration; + #[doc = "Get the `bitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[wasm_bindgen(method, getter = "bitrate")] + pub fn get_bitrate(this: &AudioConfiguration) -> Option; + #[doc = "Change the `bitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, setter = "bitrate")] - fn bitrate_shim(this: &AudioConfiguration, val: f64); + pub fn set_bitrate(this: &AudioConfiguration, val: f64); + #[doc = "Get the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[wasm_bindgen(method, getter = "channels")] + pub fn get_channels(this: &AudioConfiguration) -> Option; + #[doc = "Change the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, setter = "channels")] - fn channels_shim(this: &AudioConfiguration, val: &str); + pub fn set_channels(this: &AudioConfiguration, val: &str); + #[doc = "Get the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[wasm_bindgen(method, getter = "contentType")] + pub fn get_content_type(this: &AudioConfiguration) -> Option; + #[doc = "Change the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, setter = "contentType")] - fn content_type_shim(this: &AudioConfiguration, val: &str); + pub fn set_content_type(this: &AudioConfiguration, val: &str); + #[doc = "Get the `samplerate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[wasm_bindgen(method, getter = "samplerate")] + pub fn get_samplerate(this: &AudioConfiguration) -> Option; + #[doc = "Change the `samplerate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, setter = "samplerate")] - fn samplerate_shim(this: &AudioConfiguration, val: u32); + pub fn set_samplerate(this: &AudioConfiguration, val: u32); } impl AudioConfiguration { #[doc = "Construct a new `AudioConfiguration`."] @@ -28,32 +60,24 @@ impl AudioConfiguration { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bitrate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[deprecated = "Use `set_bitrate()` instead."] pub fn bitrate(&mut self, val: f64) -> &mut Self { - self.bitrate_shim(val); + self.set_bitrate(val); self } - #[doc = "Change the `channels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[deprecated = "Use `set_channels()` instead."] pub fn channels(&mut self, val: &str) -> &mut Self { - self.channels_shim(val); + self.set_channels(val); self } - #[doc = "Change the `contentType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[deprecated = "Use `set_content_type()` instead."] pub fn content_type(&mut self, val: &str) -> &mut Self { - self.content_type_shim(val); + self.set_content_type(val); self } - #[doc = "Change the `samplerate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] + #[deprecated = "Use `set_samplerate()` instead."] pub fn samplerate(&mut self, val: u32) -> &mut Self { - self.samplerate_shim(val); + self.set_samplerate(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioContextOptions.rs b/crates/web-sys/src/features/gen_AudioContextOptions.rs index 85b9ffaa010..1ca0ae1e9f8 100644 --- a/crates/web-sys/src/features/gen_AudioContextOptions.rs +++ b/crates/web-sys/src/features/gen_AudioContextOptions.rs @@ -10,12 +10,44 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] pub type AudioContextOptions; + #[doc = "Get the `latencyHint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[wasm_bindgen(method, getter = "latencyHint")] + pub fn get_latency_hint(this: &AudioContextOptions) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `latencyHint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] #[wasm_bindgen(method, setter = "latencyHint")] - fn latency_hint_shim(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); + pub fn set_latency_hint(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &AudioContextOptions) -> Option; + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &AudioContextOptions, val: f32); + pub fn set_sample_rate(this: &AudioContextOptions, val: f32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sinkId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sinkId")] + pub fn get_sink_id(this: &AudioContextOptions) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sinkId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sinkId")] - fn sink_id_shim(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); + pub fn set_sink_id(this: &AudioContextOptions, val: &::wasm_bindgen::JsValue); } impl AudioContextOptions { #[doc = "Construct a new `AudioContextOptions`."] @@ -26,29 +58,20 @@ impl AudioContextOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `latencyHint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[deprecated = "Use `set_latency_hint()` instead."] pub fn latency_hint(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.latency_hint_shim(val); + self.set_latency_hint(val); self } - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sinkId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioContextOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_sink_id()` instead."] pub fn sink_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.sink_id_shim(val); + self.set_sink_id(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs index b7fb5f2426a..bf135f78eb8 100644 --- a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs +++ b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs @@ -14,30 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDataCopyToOptions; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSampleFormat")] - #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &AudioDataCopyToOptions, val: AudioSampleFormat); - #[wasm_bindgen(method, setter = "frameCount")] - fn frame_count_shim(this: &AudioDataCopyToOptions, val: u32); - #[wasm_bindgen(method, setter = "frameOffset")] - fn frame_offset_shim(this: &AudioDataCopyToOptions, val: u32); - #[wasm_bindgen(method, setter = "planeIndex")] - fn plane_index_shim(this: &AudioDataCopyToOptions, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl AudioDataCopyToOptions { - #[doc = "Construct a new `AudioDataCopyToOptions`."] + #[doc = "Get the `format` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`*"] + #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`, `AudioSampleFormat`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(plane_index: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.plane_index(plane_index); - ret - } + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &AudioDataCopyToOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSampleFormat")] #[doc = "Change the `format` field of this object."] @@ -46,10 +32,17 @@ impl AudioDataCopyToOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self { - self.format_shim(val); - self - } + #[wasm_bindgen(method, setter = "format")] + pub fn set_format(this: &AudioDataCopyToOptions, val: AudioSampleFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `frameCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frameCount")] + pub fn get_frame_count(this: &AudioDataCopyToOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `frameCount` field of this object."] #[doc = ""] @@ -57,10 +50,17 @@ impl AudioDataCopyToOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn frame_count(&mut self, val: u32) -> &mut Self { - self.frame_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "frameCount")] + pub fn set_frame_count(this: &AudioDataCopyToOptions, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `frameOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frameOffset")] + pub fn get_frame_offset(this: &AudioDataCopyToOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `frameOffset` field of this object."] #[doc = ""] @@ -68,10 +68,17 @@ impl AudioDataCopyToOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn frame_offset(&mut self, val: u32) -> &mut Self { - self.frame_offset_shim(val); - self - } + #[wasm_bindgen(method, setter = "frameOffset")] + pub fn set_frame_offset(this: &AudioDataCopyToOptions, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `planeIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "planeIndex")] + pub fn get_plane_index(this: &AudioDataCopyToOptions) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `planeIndex` field of this object."] #[doc = ""] @@ -79,8 +86,46 @@ impl AudioDataCopyToOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "planeIndex")] + pub fn set_plane_index(this: &AudioDataCopyToOptions, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl AudioDataCopyToOptions { + #[doc = "Construct a new `AudioDataCopyToOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(plane_index: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.plane_index(plane_index); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioSampleFormat")] + #[deprecated = "Use `set_format()` instead."] + pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self { + self.set_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_frame_count()` instead."] + pub fn frame_count(&mut self, val: u32) -> &mut Self { + self.set_frame_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_frame_offset()` instead."] + pub fn frame_offset(&mut self, val: u32) -> &mut Self { + self.set_frame_offset(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_plane_index()` instead."] pub fn plane_index(&mut self, val: u32) -> &mut Self { - self.plane_index_shim(val); + self.set_plane_index(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDataInit.rs b/crates/web-sys/src/features/gen_AudioDataInit.rs index 88afffc7932..29ea0c0183d 100644 --- a/crates/web-sys/src/features/gen_AudioDataInit.rs +++ b/crates/web-sys/src/features/gen_AudioDataInit.rs @@ -14,19 +14,116 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDataInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &AudioDataInit) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &AudioDataInit, val: &::js_sys::Object); + pub fn set_data(this: &AudioDataInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSampleFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &AudioDataInit) -> AudioSampleFormat; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioSampleFormat")] + #[doc = "Change the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &AudioDataInit, val: AudioSampleFormat); + pub fn set_format(this: &AudioDataInit, val: AudioSampleFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numberOfChannels")] + pub fn get_number_of_channels(this: &AudioDataInit) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "numberOfChannels")] - fn number_of_channels_shim(this: &AudioDataInit, val: u32); + pub fn set_number_of_channels(this: &AudioDataInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numberOfFrames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numberOfFrames")] + pub fn get_number_of_frames(this: &AudioDataInit) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `numberOfFrames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "numberOfFrames")] - fn number_of_frames_shim(this: &AudioDataInit, val: u32); + pub fn set_number_of_frames(this: &AudioDataInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &AudioDataInit) -> f32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &AudioDataInit, val: f32); + pub fn set_sample_rate(this: &AudioDataInit, val: f32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &AudioDataInit) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &AudioDataInit, val: f64); + pub fn set_timestamp(this: &AudioDataInit, val: f64); } #[cfg(web_sys_unstable_apis)] impl AudioDataInit { @@ -56,70 +153,40 @@ impl AudioDataInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSampleFormat")] - #[doc = "Change the `format` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`, `AudioSampleFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_format()` instead."] pub fn format(&mut self, val: AudioSampleFormat) -> &mut Self { - self.format_shim(val); + self.set_format(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `numberOfChannels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_number_of_channels()` instead."] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - self.number_of_channels_shim(val); + self.set_number_of_channels(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `numberOfFrames` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_number_of_frames()` instead."] pub fn number_of_frames(&mut self, val: u32) -> &mut Self { - self.number_of_frames_shim(val); + self.set_number_of_frames(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDataInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs index 561f6c58664..7b4c8eddb02 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs @@ -14,14 +14,78 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderConfig; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codec")] + pub fn get_codec(this: &AudioDecoderConfig) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "codec")] - fn codec_shim(this: &AudioDecoderConfig, val: &str); + pub fn set_codec(this: &AudioDecoderConfig, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &AudioDecoderConfig) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &AudioDecoderConfig, val: &::js_sys::Object); + pub fn set_description(this: &AudioDecoderConfig, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numberOfChannels")] + pub fn get_number_of_channels(this: &AudioDecoderConfig) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "numberOfChannels")] - fn number_of_channels_shim(this: &AudioDecoderConfig, val: u32); + pub fn set_number_of_channels(this: &AudioDecoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &AudioDecoderConfig) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &AudioDecoderConfig, val: u32); + pub fn set_sample_rate(this: &AudioDecoderConfig, val: u32); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderConfig { @@ -40,47 +104,27 @@ impl AudioDecoderConfig { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `codec` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_codec()` instead."] pub fn codec(&mut self, val: &str) -> &mut Self { - self.codec_shim(val); + self.set_codec(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `description` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self { - self.description_shim(val); + self.set_description(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `numberOfChannels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_number_of_channels()` instead."] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - self.number_of_channels_shim(val); + self.set_number_of_channels(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: u32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderInit.rs b/crates/web-sys/src/features/gen_AudioDecoderInit.rs index 927ec60a7f9..54a467b8bf4 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &AudioDecoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &AudioDecoderInit, val: &::js_sys::Function); + pub fn set_error(this: &AudioDecoderInit, val: &::js_sys::Function); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "output")] + pub fn get_output(this: &AudioDecoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "output")] - fn output_shim(this: &AudioDecoderInit, val: &::js_sys::Function); + pub fn set_output(this: &AudioDecoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderInit { @@ -35,25 +67,15 @@ impl AudioDecoderInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `output` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_output()` instead."] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - self.output_shim(val); + self.set_output(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioDecoderSupport.rs b/crates/web-sys/src/features/gen_AudioDecoderSupport.rs index ecbbc3eed95..eb1a3fa72cc 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderSupport.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderSupport.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioDecoderSupport; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioDecoderConfig")] + #[doc = "Get the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `AudioDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "config")] + pub fn get_config(this: &AudioDecoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDecoderConfig")] + #[doc = "Change the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `AudioDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "config")] - fn config_shim(this: &AudioDecoderSupport, val: &AudioDecoderConfig); + pub fn set_config(this: &AudioDecoderSupport, val: &AudioDecoderConfig); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "supported")] + pub fn get_supported(this: &AudioDecoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "supported")] - fn supported_shim(this: &AudioDecoderSupport, val: bool); + pub fn set_supported(this: &AudioDecoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl AudioDecoderSupport { @@ -35,25 +68,15 @@ impl AudioDecoderSupport { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDecoderConfig")] - #[doc = "Change the `config` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `AudioDecoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_config()` instead."] pub fn config(&mut self, val: &AudioDecoderConfig) -> &mut Self { - self.config_shim(val); + self.set_config(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `supported` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_supported()` instead."] pub fn supported(&mut self, val: bool) -> &mut Self { - self.supported_shim(val); + self.set_supported(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs index a21f98ad4da..4e15edfcb1a 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs @@ -14,29 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderConfig; - #[wasm_bindgen(method, setter = "bitrate")] - fn bitrate_shim(this: &AudioEncoderConfig, val: f64); - #[wasm_bindgen(method, setter = "codec")] - fn codec_shim(this: &AudioEncoderConfig, val: &str); - #[wasm_bindgen(method, setter = "numberOfChannels")] - fn number_of_channels_shim(this: &AudioEncoderConfig, val: u32); - #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &AudioEncoderConfig, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl AudioEncoderConfig { - #[doc = "Construct a new `AudioEncoderConfig`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bitrate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(codec: &str) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); - ret - } + #[wasm_bindgen(method, getter = "bitrate")] + pub fn get_bitrate(this: &AudioEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bitrate` field of this object."] #[doc = ""] @@ -44,10 +30,17 @@ impl AudioEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bitrate(&mut self, val: f64) -> &mut Self { - self.bitrate_shim(val); - self - } + #[wasm_bindgen(method, setter = "bitrate")] + pub fn set_bitrate(this: &AudioEncoderConfig, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codec")] + pub fn get_codec(this: &AudioEncoderConfig) -> String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] @@ -55,10 +48,17 @@ impl AudioEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn codec(&mut self, val: &str) -> &mut Self { - self.codec_shim(val); - self - } + #[wasm_bindgen(method, setter = "codec")] + pub fn set_codec(this: &AudioEncoderConfig, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numberOfChannels")] + pub fn get_number_of_channels(this: &AudioEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `numberOfChannels` field of this object."] #[doc = ""] @@ -66,10 +66,17 @@ impl AudioEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - self.number_of_channels_shim(val); - self - } + #[wasm_bindgen(method, setter = "numberOfChannels")] + pub fn set_number_of_channels(this: &AudioEncoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &AudioEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sampleRate` field of this object."] #[doc = ""] @@ -77,8 +84,45 @@ impl AudioEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "sampleRate")] + pub fn set_sample_rate(this: &AudioEncoderConfig, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl AudioEncoderConfig { + #[doc = "Construct a new `AudioEncoderConfig`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(codec: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.codec(codec); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bitrate()` instead."] + pub fn bitrate(&mut self, val: f64) -> &mut Self { + self.set_bitrate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_codec()` instead."] + pub fn codec(&mut self, val: &str) -> &mut Self { + self.set_codec(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_number_of_channels()` instead."] + pub fn number_of_channels(&mut self, val: u32) -> &mut Self { + self.set_number_of_channels(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: u32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderInit.rs b/crates/web-sys/src/features/gen_AudioEncoderInit.rs index 52bae3763d0..95ee7e292c9 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &AudioEncoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &AudioEncoderInit, val: &::js_sys::Function); + pub fn set_error(this: &AudioEncoderInit, val: &::js_sys::Function); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "output")] + pub fn get_output(this: &AudioEncoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "output")] - fn output_shim(this: &AudioEncoderInit, val: &::js_sys::Function); + pub fn set_output(this: &AudioEncoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl AudioEncoderInit { @@ -35,25 +67,15 @@ impl AudioEncoderInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `output` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioEncoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_output()` instead."] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - self.output_shim(val); + self.set_output(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioEncoderSupport.rs b/crates/web-sys/src/features/gen_AudioEncoderSupport.rs index c19fad1e944..20399d86524 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderSupport.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderSupport.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioEncoderSupport; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioEncoderConfig")] + #[doc = "Get the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`, `AudioEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "config")] + pub fn get_config(this: &AudioEncoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioEncoderConfig")] + #[doc = "Change the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`, `AudioEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "config")] - fn config_shim(this: &AudioEncoderSupport, val: &AudioEncoderConfig); + pub fn set_config(this: &AudioEncoderSupport, val: &AudioEncoderConfig); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "supported")] + pub fn get_supported(this: &AudioEncoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "supported")] - fn supported_shim(this: &AudioEncoderSupport, val: bool); + pub fn set_supported(this: &AudioEncoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl AudioEncoderSupport { @@ -35,25 +68,15 @@ impl AudioEncoderSupport { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioEncoderConfig")] - #[doc = "Change the `config` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioEncoderConfig`, `AudioEncoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_config()` instead."] pub fn config(&mut self, val: &AudioEncoderConfig) -> &mut Self { - self.config_shim(val); + self.set_config(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `supported` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioEncoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_supported()` instead."] pub fn supported(&mut self, val: bool) -> &mut Self { - self.supported_shim(val); + self.set_supported(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioNodeOptions.rs b/crates/web-sys/src/features/gen_AudioNodeOptions.rs index a5baf5de084..84c6ab32872 100644 --- a/crates/web-sys/src/features/gen_AudioNodeOptions.rs +++ b/crates/web-sys/src/features/gen_AudioNodeOptions.rs @@ -10,14 +10,40 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] pub type AudioNodeOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &AudioNodeOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &AudioNodeOptions, val: u32); + pub fn set_channel_count(this: &AudioNodeOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelCountMode`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &AudioNodeOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelCountMode`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &AudioNodeOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &AudioNodeOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelInterpretation`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &AudioNodeOptions) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelInterpretation`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &AudioNodeOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &AudioNodeOptions, val: ChannelInterpretation); } impl AudioNodeOptions { #[doc = "Construct a new `AudioNodeOptions`."] @@ -28,27 +54,21 @@ impl AudioNodeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelCountMode`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioNodeOptions`, `ChannelInterpretation`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioSinkOptions.rs b/crates/web-sys/src/features/gen_AudioSinkOptions.rs index 666dd222b52..6918a4c0587 100644 --- a/crates/web-sys/src/features/gen_AudioSinkOptions.rs +++ b/crates/web-sys/src/features/gen_AudioSinkOptions.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type AudioSinkOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioSinkType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`, `AudioSinkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &AudioSinkOptions) -> AudioSinkType; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSinkType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`, `AudioSinkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &AudioSinkOptions, val: AudioSinkType); + pub fn set_type(this: &AudioSinkOptions, val: AudioSinkType); } #[cfg(web_sys_unstable_apis)] impl AudioSinkOptions { @@ -35,14 +52,9 @@ impl AudioSinkOptions { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioSinkType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioSinkOptions`, `AudioSinkType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: AudioSinkType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs index 4d683ce3c00..82c717bde6b 100644 --- a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs +++ b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs @@ -10,22 +10,82 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] pub type AudioWorkletNodeOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &AudioWorkletNodeOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &AudioWorkletNodeOptions, val: u32); + pub fn set_channel_count(this: &AudioWorkletNodeOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelCountMode`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &AudioWorkletNodeOptions) -> Option; #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelCountMode`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &AudioWorkletNodeOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &AudioWorkletNodeOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelInterpretation`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation( + this: &AudioWorkletNodeOptions, + ) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelInterpretation`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &AudioWorkletNodeOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &AudioWorkletNodeOptions, val: ChannelInterpretation); + #[doc = "Get the `numberOfInputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "numberOfInputs")] + pub fn get_number_of_inputs(this: &AudioWorkletNodeOptions) -> Option; + #[doc = "Change the `numberOfInputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "numberOfInputs")] - fn number_of_inputs_shim(this: &AudioWorkletNodeOptions, val: u32); + pub fn set_number_of_inputs(this: &AudioWorkletNodeOptions, val: u32); + #[doc = "Get the `numberOfOutputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "numberOfOutputs")] + pub fn get_number_of_outputs(this: &AudioWorkletNodeOptions) -> Option; + #[doc = "Change the `numberOfOutputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "numberOfOutputs")] - fn number_of_outputs_shim(this: &AudioWorkletNodeOptions, val: u32); + pub fn set_number_of_outputs(this: &AudioWorkletNodeOptions, val: u32); + #[doc = "Get the `outputChannelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "outputChannelCount")] + pub fn get_output_channel_count(this: &AudioWorkletNodeOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `outputChannelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "outputChannelCount")] - fn output_channel_count_shim(this: &AudioWorkletNodeOptions, val: &::wasm_bindgen::JsValue); + pub fn set_output_channel_count(this: &AudioWorkletNodeOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `processorOptions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "processorOptions")] + pub fn get_processor_options(this: &AudioWorkletNodeOptions) -> Option<::js_sys::Object>; + #[doc = "Change the `processorOptions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "processorOptions")] - fn processor_options_shim(this: &AudioWorkletNodeOptions, val: Option<&::js_sys::Object>); + pub fn set_processor_options(this: &AudioWorkletNodeOptions, val: Option<&::js_sys::Object>); } impl AudioWorkletNodeOptions { #[doc = "Construct a new `AudioWorkletNodeOptions`."] @@ -36,55 +96,41 @@ impl AudioWorkletNodeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelCountMode`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`, `ChannelInterpretation`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `numberOfInputs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[deprecated = "Use `set_number_of_inputs()` instead."] pub fn number_of_inputs(&mut self, val: u32) -> &mut Self { - self.number_of_inputs_shim(val); + self.set_number_of_inputs(val); self } - #[doc = "Change the `numberOfOutputs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[deprecated = "Use `set_number_of_outputs()` instead."] pub fn number_of_outputs(&mut self, val: u32) -> &mut Self { - self.number_of_outputs_shim(val); + self.set_number_of_outputs(val); self } - #[doc = "Change the `outputChannelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[deprecated = "Use `set_output_channel_count()` instead."] pub fn output_channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.output_channel_count_shim(val); + self.set_output_channel_count(val); self } - #[doc = "Change the `processorOptions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[deprecated = "Use `set_processor_options()` instead."] pub fn processor_options(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.processor_options_shim(val); + self.set_processor_options(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs index 954af0d7237..1439f6b4d5d 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] pub type AuthenticationExtensionsClientInputs; + #[doc = "Get the `appid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, getter = "appid")] + pub fn get_appid(this: &AuthenticationExtensionsClientInputs) -> Option; + #[doc = "Change the `appid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] #[wasm_bindgen(method, setter = "appid")] - fn appid_shim(this: &AuthenticationExtensionsClientInputs, val: &str); + pub fn set_appid(this: &AuthenticationExtensionsClientInputs, val: &str); } impl AuthenticationExtensionsClientInputs { #[doc = "Construct a new `AuthenticationExtensionsClientInputs`."] @@ -22,11 +30,9 @@ impl AuthenticationExtensionsClientInputs { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `appid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[deprecated = "Use `set_appid()` instead."] pub fn appid(&mut self, val: &str) -> &mut Self { - self.appid_shim(val); + self.set_appid(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs index 9b63b43d5df..46cfeb952c9 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] pub type AuthenticationExtensionsClientOutputs; + #[doc = "Get the `appid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[wasm_bindgen(method, getter = "appid")] + pub fn get_appid(this: &AuthenticationExtensionsClientOutputs) -> Option; + #[doc = "Change the `appid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] #[wasm_bindgen(method, setter = "appid")] - fn appid_shim(this: &AuthenticationExtensionsClientOutputs, val: bool); + pub fn set_appid(this: &AuthenticationExtensionsClientOutputs, val: bool); } impl AuthenticationExtensionsClientOutputs { #[doc = "Construct a new `AuthenticationExtensionsClientOutputs`."] @@ -22,11 +30,9 @@ impl AuthenticationExtensionsClientOutputs { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `appid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[deprecated = "Use `set_appid()` instead."] pub fn appid(&mut self, val: bool) -> &mut Self { - self.appid_shim(val); + self.set_appid(val); self } } diff --git a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs index 4ebf1beed46..cd8f0e36453 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs @@ -11,16 +11,46 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] pub type AuthenticatorSelectionCriteria; #[cfg(feature = "AuthenticatorAttachment")] + #[doc = "Get the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttachment`, `AuthenticatorSelectionCriteria`*"] + #[wasm_bindgen(method, getter = "authenticatorAttachment")] + pub fn get_authenticator_attachment( + this: &AuthenticatorSelectionCriteria, + ) -> Option; + #[cfg(feature = "AuthenticatorAttachment")] + #[doc = "Change the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttachment`, `AuthenticatorSelectionCriteria`*"] #[wasm_bindgen(method, setter = "authenticatorAttachment")] - fn authenticator_attachment_shim( + pub fn set_authenticator_attachment( this: &AuthenticatorSelectionCriteria, val: AuthenticatorAttachment, ); + #[doc = "Get the `requireResidentKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] + #[wasm_bindgen(method, getter = "requireResidentKey")] + pub fn get_require_resident_key(this: &AuthenticatorSelectionCriteria) -> Option; + #[doc = "Change the `requireResidentKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] #[wasm_bindgen(method, setter = "requireResidentKey")] - fn require_resident_key_shim(this: &AuthenticatorSelectionCriteria, val: bool); + pub fn set_require_resident_key(this: &AuthenticatorSelectionCriteria, val: bool); + #[cfg(feature = "UserVerificationRequirement")] + #[doc = "Get the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `UserVerificationRequirement`*"] + #[wasm_bindgen(method, getter = "userVerification")] + pub fn get_user_verification( + this: &AuthenticatorSelectionCriteria, + ) -> Option; #[cfg(feature = "UserVerificationRequirement")] + #[doc = "Change the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `UserVerificationRequirement`*"] #[wasm_bindgen(method, setter = "userVerification")] - fn user_verification_shim( + pub fn set_user_verification( this: &AuthenticatorSelectionCriteria, val: UserVerificationRequirement, ); @@ -35,26 +65,20 @@ impl AuthenticatorSelectionCriteria { ret } #[cfg(feature = "AuthenticatorAttachment")] - #[doc = "Change the `authenticatorAttachment` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttachment`, `AuthenticatorSelectionCriteria`*"] + #[deprecated = "Use `set_authenticator_attachment()` instead."] pub fn authenticator_attachment(&mut self, val: AuthenticatorAttachment) -> &mut Self { - self.authenticator_attachment_shim(val); + self.set_authenticator_attachment(val); self } - #[doc = "Change the `requireResidentKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] + #[deprecated = "Use `set_require_resident_key()` instead."] pub fn require_resident_key(&mut self, val: bool) -> &mut Self { - self.require_resident_key_shim(val); + self.set_require_resident_key(val); self } #[cfg(feature = "UserVerificationRequirement")] - #[doc = "Change the `userVerification` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `UserVerificationRequirement`*"] + #[deprecated = "Use `set_user_verification()` instead."] pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self { - self.user_verification_shim(val); + self.set_user_verification(val); self } } diff --git a/crates/web-sys/src/features/gen_AutocompleteInfo.rs b/crates/web-sys/src/features/gen_AutocompleteInfo.rs index fbc62528fb1..a1da9bb5b11 100644 --- a/crates/web-sys/src/features/gen_AutocompleteInfo.rs +++ b/crates/web-sys/src/features/gen_AutocompleteInfo.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] pub type AutocompleteInfo; + #[doc = "Get the `addressType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[wasm_bindgen(method, getter = "addressType")] + pub fn get_address_type(this: &AutocompleteInfo) -> Option; + #[doc = "Change the `addressType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, setter = "addressType")] - fn address_type_shim(this: &AutocompleteInfo, val: &str); + pub fn set_address_type(this: &AutocompleteInfo, val: &str); + #[doc = "Get the `contactType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[wasm_bindgen(method, getter = "contactType")] + pub fn get_contact_type(this: &AutocompleteInfo) -> Option; + #[doc = "Change the `contactType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, setter = "contactType")] - fn contact_type_shim(this: &AutocompleteInfo, val: &str); + pub fn set_contact_type(this: &AutocompleteInfo, val: &str); + #[doc = "Get the `fieldName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[wasm_bindgen(method, getter = "fieldName")] + pub fn get_field_name(this: &AutocompleteInfo) -> Option; + #[doc = "Change the `fieldName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, setter = "fieldName")] - fn field_name_shim(this: &AutocompleteInfo, val: &str); + pub fn set_field_name(this: &AutocompleteInfo, val: &str); + #[doc = "Get the `section` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[wasm_bindgen(method, getter = "section")] + pub fn get_section(this: &AutocompleteInfo) -> Option; + #[doc = "Change the `section` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, setter = "section")] - fn section_shim(this: &AutocompleteInfo, val: &str); + pub fn set_section(this: &AutocompleteInfo, val: &str); } impl AutocompleteInfo { #[doc = "Construct a new `AutocompleteInfo`."] @@ -28,32 +60,24 @@ impl AutocompleteInfo { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `addressType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[deprecated = "Use `set_address_type()` instead."] pub fn address_type(&mut self, val: &str) -> &mut Self { - self.address_type_shim(val); + self.set_address_type(val); self } - #[doc = "Change the `contactType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[deprecated = "Use `set_contact_type()` instead."] pub fn contact_type(&mut self, val: &str) -> &mut Self { - self.contact_type_shim(val); + self.set_contact_type(val); self } - #[doc = "Change the `fieldName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[deprecated = "Use `set_field_name()` instead."] pub fn field_name(&mut self, val: &str) -> &mut Self { - self.field_name_shim(val); + self.set_field_name(val); self } - #[doc = "Change the `section` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] + #[deprecated = "Use `set_section()` instead."] pub fn section(&mut self, val: &str) -> &mut Self { - self.section_shim(val); + self.set_section(val); self } } diff --git a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs index 073a7138836..8626547052e 100644 --- a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs @@ -11,16 +11,57 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] pub type BaseComputedKeyframe; #[cfg(feature = "CompositeOperation")] + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`, `CompositeOperation`*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &BaseComputedKeyframe) -> Option; + #[cfg(feature = "CompositeOperation")] + #[doc = "Change the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`, `CompositeOperation`*"] #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &BaseComputedKeyframe, val: Option); + pub fn set_composite(this: &BaseComputedKeyframe, val: Option); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &BaseComputedKeyframe) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &BaseComputedKeyframe, val: &str); + pub fn set_easing(this: &BaseComputedKeyframe, val: &str); + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &BaseComputedKeyframe) -> Option; + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &BaseComputedKeyframe, val: Option); + pub fn set_offset(this: &BaseComputedKeyframe, val: Option); + #[doc = "Get the `simulateComputeValuesFailure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[wasm_bindgen(method, getter = "simulateComputeValuesFailure")] + pub fn get_simulate_compute_values_failure(this: &BaseComputedKeyframe) -> Option; + #[doc = "Change the `simulateComputeValuesFailure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] #[wasm_bindgen(method, setter = "simulateComputeValuesFailure")] - fn simulate_compute_values_failure_shim(this: &BaseComputedKeyframe, val: bool); + pub fn set_simulate_compute_values_failure(this: &BaseComputedKeyframe, val: bool); + #[doc = "Get the `computedOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[wasm_bindgen(method, getter = "computedOffset")] + pub fn get_computed_offset(this: &BaseComputedKeyframe) -> Option; + #[doc = "Change the `computedOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] #[wasm_bindgen(method, setter = "computedOffset")] - fn computed_offset_shim(this: &BaseComputedKeyframe, val: f64); + pub fn set_computed_offset(this: &BaseComputedKeyframe, val: f64); } impl BaseComputedKeyframe { #[doc = "Construct a new `BaseComputedKeyframe`."] @@ -32,39 +73,29 @@ impl BaseComputedKeyframe { ret } #[cfg(feature = "CompositeOperation")] - #[doc = "Change the `composite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`, `CompositeOperation`*"] + #[deprecated = "Use `set_composite()` instead."] pub fn composite(&mut self, val: Option) -> &mut Self { - self.composite_shim(val); + self.set_composite(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: Option) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } - #[doc = "Change the `simulateComputeValuesFailure` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[deprecated = "Use `set_simulate_compute_values_failure()` instead."] pub fn simulate_compute_values_failure(&mut self, val: bool) -> &mut Self { - self.simulate_compute_values_failure_shim(val); + self.set_simulate_compute_values_failure(val); self } - #[doc = "Change the `computedOffset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] + #[deprecated = "Use `set_computed_offset()` instead."] pub fn computed_offset(&mut self, val: f64) -> &mut Self { - self.computed_offset_shim(val); + self.set_computed_offset(val); self } } diff --git a/crates/web-sys/src/features/gen_BaseKeyframe.rs b/crates/web-sys/src/features/gen_BaseKeyframe.rs index 0c2f97da2aa..1c37af7631c 100644 --- a/crates/web-sys/src/features/gen_BaseKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseKeyframe.rs @@ -11,14 +11,47 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] pub type BaseKeyframe; #[cfg(feature = "CompositeOperation")] + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`, `CompositeOperation`*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &BaseKeyframe) -> Option; + #[cfg(feature = "CompositeOperation")] + #[doc = "Change the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`, `CompositeOperation`*"] #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &BaseKeyframe, val: Option); + pub fn set_composite(this: &BaseKeyframe, val: Option); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &BaseKeyframe) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &BaseKeyframe, val: &str); + pub fn set_easing(this: &BaseKeyframe, val: &str); + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &BaseKeyframe) -> Option; + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &BaseKeyframe, val: Option); + pub fn set_offset(this: &BaseKeyframe, val: Option); + #[doc = "Get the `simulateComputeValuesFailure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[wasm_bindgen(method, getter = "simulateComputeValuesFailure")] + pub fn get_simulate_compute_values_failure(this: &BaseKeyframe) -> Option; + #[doc = "Change the `simulateComputeValuesFailure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] #[wasm_bindgen(method, setter = "simulateComputeValuesFailure")] - fn simulate_compute_values_failure_shim(this: &BaseKeyframe, val: bool); + pub fn set_simulate_compute_values_failure(this: &BaseKeyframe, val: bool); } impl BaseKeyframe { #[doc = "Construct a new `BaseKeyframe`."] @@ -30,32 +63,24 @@ impl BaseKeyframe { ret } #[cfg(feature = "CompositeOperation")] - #[doc = "Change the `composite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`, `CompositeOperation`*"] + #[deprecated = "Use `set_composite()` instead."] pub fn composite(&mut self, val: Option) -> &mut Self { - self.composite_shim(val); + self.set_composite(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: Option) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } - #[doc = "Change the `simulateComputeValuesFailure` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] + #[deprecated = "Use `set_simulate_compute_values_failure()` instead."] pub fn simulate_compute_values_failure(&mut self, val: bool) -> &mut Self { - self.simulate_compute_values_failure_shim(val); + self.set_simulate_compute_values_failure(val); self } } diff --git a/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs b/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs index d2dfb18f80e..fa9aa466833 100644 --- a/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs +++ b/crates/web-sys/src/features/gen_BasePropertyIndexedKeyframe.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] pub type BasePropertyIndexedKeyframe; + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &BasePropertyIndexedKeyframe) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + pub fn set_composite(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &BasePropertyIndexedKeyframe) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + pub fn set_easing(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &BasePropertyIndexedKeyframe) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); + pub fn set_offset(this: &BasePropertyIndexedKeyframe, val: &::wasm_bindgen::JsValue); } impl BasePropertyIndexedKeyframe { #[doc = "Construct a new `BasePropertyIndexedKeyframe`."] @@ -26,25 +50,19 @@ impl BasePropertyIndexedKeyframe { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `composite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[deprecated = "Use `set_composite()` instead."] pub fn composite(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.composite_shim(val); + self.set_composite(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasePropertyIndexedKeyframe`*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } } diff --git a/crates/web-sys/src/features/gen_BasicCardRequest.rs b/crates/web-sys/src/features/gen_BasicCardRequest.rs index 4509a71d546..ad2ad22c758 100644 --- a/crates/web-sys/src/features/gen_BasicCardRequest.rs +++ b/crates/web-sys/src/features/gen_BasicCardRequest.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] pub type BasicCardRequest; + #[doc = "Get the `supportedNetworks` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] + #[wasm_bindgen(method, getter = "supportedNetworks")] + pub fn get_supported_networks(this: &BasicCardRequest) -> Option<::js_sys::Array>; + #[doc = "Change the `supportedNetworks` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] #[wasm_bindgen(method, setter = "supportedNetworks")] - fn supported_networks_shim(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); + pub fn set_supported_networks(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `supportedTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] + #[wasm_bindgen(method, getter = "supportedTypes")] + pub fn get_supported_types(this: &BasicCardRequest) -> Option<::js_sys::Array>; + #[doc = "Change the `supportedTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] #[wasm_bindgen(method, setter = "supportedTypes")] - fn supported_types_shim(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); + pub fn set_supported_types(this: &BasicCardRequest, val: &::wasm_bindgen::JsValue); } impl BasicCardRequest { #[doc = "Construct a new `BasicCardRequest`."] @@ -24,18 +40,14 @@ impl BasicCardRequest { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `supportedNetworks` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] + #[deprecated = "Use `set_supported_networks()` instead."] pub fn supported_networks(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.supported_networks_shim(val); + self.set_supported_networks(val); self } - #[doc = "Change the `supportedTypes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardRequest`*"] + #[deprecated = "Use `set_supported_types()` instead."] pub fn supported_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.supported_types_shim(val); + self.set_supported_types(val); self } } diff --git a/crates/web-sys/src/features/gen_BasicCardResponse.rs b/crates/web-sys/src/features/gen_BasicCardResponse.rs index bafff97512c..b5fff5306b0 100644 --- a/crates/web-sys/src/features/gen_BasicCardResponse.rs +++ b/crates/web-sys/src/features/gen_BasicCardResponse.rs @@ -11,18 +11,67 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] pub type BasicCardResponse; #[cfg(feature = "PaymentAddress")] + #[doc = "Get the `billingAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`, `PaymentAddress`*"] + #[wasm_bindgen(method, getter = "billingAddress")] + pub fn get_billing_address(this: &BasicCardResponse) -> Option; + #[cfg(feature = "PaymentAddress")] + #[doc = "Change the `billingAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`, `PaymentAddress`*"] #[wasm_bindgen(method, setter = "billingAddress")] - fn billing_address_shim(this: &BasicCardResponse, val: Option<&PaymentAddress>); + pub fn set_billing_address(this: &BasicCardResponse, val: Option<&PaymentAddress>); + #[doc = "Get the `cardNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[wasm_bindgen(method, getter = "cardNumber")] + pub fn get_card_number(this: &BasicCardResponse) -> String; + #[doc = "Change the `cardNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, setter = "cardNumber")] - fn card_number_shim(this: &BasicCardResponse, val: &str); + pub fn set_card_number(this: &BasicCardResponse, val: &str); + #[doc = "Get the `cardSecurityCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[wasm_bindgen(method, getter = "cardSecurityCode")] + pub fn get_card_security_code(this: &BasicCardResponse) -> Option; + #[doc = "Change the `cardSecurityCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, setter = "cardSecurityCode")] - fn card_security_code_shim(this: &BasicCardResponse, val: &str); + pub fn set_card_security_code(this: &BasicCardResponse, val: &str); + #[doc = "Get the `cardholderName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[wasm_bindgen(method, getter = "cardholderName")] + pub fn get_cardholder_name(this: &BasicCardResponse) -> Option; + #[doc = "Change the `cardholderName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, setter = "cardholderName")] - fn cardholder_name_shim(this: &BasicCardResponse, val: &str); + pub fn set_cardholder_name(this: &BasicCardResponse, val: &str); + #[doc = "Get the `expiryMonth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[wasm_bindgen(method, getter = "expiryMonth")] + pub fn get_expiry_month(this: &BasicCardResponse) -> Option; + #[doc = "Change the `expiryMonth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, setter = "expiryMonth")] - fn expiry_month_shim(this: &BasicCardResponse, val: &str); + pub fn set_expiry_month(this: &BasicCardResponse, val: &str); + #[doc = "Get the `expiryYear` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[wasm_bindgen(method, getter = "expiryYear")] + pub fn get_expiry_year(this: &BasicCardResponse) -> Option; + #[doc = "Change the `expiryYear` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, setter = "expiryYear")] - fn expiry_year_shim(this: &BasicCardResponse, val: &str); + pub fn set_expiry_year(this: &BasicCardResponse, val: &str); } impl BasicCardResponse { #[doc = "Construct a new `BasicCardResponse`."] @@ -35,46 +84,34 @@ impl BasicCardResponse { ret } #[cfg(feature = "PaymentAddress")] - #[doc = "Change the `billingAddress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`, `PaymentAddress`*"] + #[deprecated = "Use `set_billing_address()` instead."] pub fn billing_address(&mut self, val: Option<&PaymentAddress>) -> &mut Self { - self.billing_address_shim(val); + self.set_billing_address(val); self } - #[doc = "Change the `cardNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[deprecated = "Use `set_card_number()` instead."] pub fn card_number(&mut self, val: &str) -> &mut Self { - self.card_number_shim(val); + self.set_card_number(val); self } - #[doc = "Change the `cardSecurityCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[deprecated = "Use `set_card_security_code()` instead."] pub fn card_security_code(&mut self, val: &str) -> &mut Self { - self.card_security_code_shim(val); + self.set_card_security_code(val); self } - #[doc = "Change the `cardholderName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[deprecated = "Use `set_cardholder_name()` instead."] pub fn cardholder_name(&mut self, val: &str) -> &mut Self { - self.cardholder_name_shim(val); + self.set_cardholder_name(val); self } - #[doc = "Change the `expiryMonth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[deprecated = "Use `set_expiry_month()` instead."] pub fn expiry_month(&mut self, val: &str) -> &mut Self { - self.expiry_month_shim(val); + self.set_expiry_month(val); self } - #[doc = "Change the `expiryYear` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] + #[deprecated = "Use `set_expiry_year()` instead."] pub fn expiry_year(&mut self, val: &str) -> &mut Self { - self.expiry_year_shim(val); + self.set_expiry_year(val); self } } diff --git a/crates/web-sys/src/features/gen_BiquadFilterOptions.rs b/crates/web-sys/src/features/gen_BiquadFilterOptions.rs index 6a0863aa344..a1dedd02340 100644 --- a/crates/web-sys/src/features/gen_BiquadFilterOptions.rs +++ b/crates/web-sys/src/features/gen_BiquadFilterOptions.rs @@ -10,25 +10,92 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] pub type BiquadFilterOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &BiquadFilterOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &BiquadFilterOptions, val: u32); + pub fn set_channel_count(this: &BiquadFilterOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelCountMode`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &BiquadFilterOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelCountMode`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &BiquadFilterOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &BiquadFilterOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelInterpretation`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &BiquadFilterOptions) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelInterpretation`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &BiquadFilterOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &BiquadFilterOptions, val: ChannelInterpretation); + #[doc = "Get the `Q` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[wasm_bindgen(method, getter = "Q")] + pub fn get_q(this: &BiquadFilterOptions) -> Option; + #[doc = "Change the `Q` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] #[wasm_bindgen(method, setter = "Q")] - fn q_shim(this: &BiquadFilterOptions, val: f32); + pub fn set_q(this: &BiquadFilterOptions, val: f32); + #[doc = "Get the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[wasm_bindgen(method, getter = "detune")] + pub fn get_detune(this: &BiquadFilterOptions) -> Option; + #[doc = "Change the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] #[wasm_bindgen(method, setter = "detune")] - fn detune_shim(this: &BiquadFilterOptions, val: f32); + pub fn set_detune(this: &BiquadFilterOptions, val: f32); + #[doc = "Get the `frequency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[wasm_bindgen(method, getter = "frequency")] + pub fn get_frequency(this: &BiquadFilterOptions) -> Option; + #[doc = "Change the `frequency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] #[wasm_bindgen(method, setter = "frequency")] - fn frequency_shim(this: &BiquadFilterOptions, val: f32); + pub fn set_frequency(this: &BiquadFilterOptions, val: f32); + #[doc = "Get the `gain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[wasm_bindgen(method, getter = "gain")] + pub fn get_gain(this: &BiquadFilterOptions) -> Option; + #[doc = "Change the `gain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] #[wasm_bindgen(method, setter = "gain")] - fn gain_shim(this: &BiquadFilterOptions, val: f32); + pub fn set_gain(this: &BiquadFilterOptions, val: f32); #[cfg(feature = "BiquadFilterType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `BiquadFilterType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &BiquadFilterOptions) -> Option; + #[cfg(feature = "BiquadFilterType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `BiquadFilterType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &BiquadFilterOptions, val: BiquadFilterType); + pub fn set_type(this: &BiquadFilterOptions, val: BiquadFilterType); } impl BiquadFilterOptions { #[doc = "Construct a new `BiquadFilterOptions`."] @@ -39,63 +106,47 @@ impl BiquadFilterOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelCountMode`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `ChannelInterpretation`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `Q` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[deprecated = "Use `set_q()` instead."] pub fn q(&mut self, val: f32) -> &mut Self { - self.q_shim(val); + self.set_q(val); self } - #[doc = "Change the `detune` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[deprecated = "Use `set_detune()` instead."] pub fn detune(&mut self, val: f32) -> &mut Self { - self.detune_shim(val); + self.set_detune(val); self } - #[doc = "Change the `frequency` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[deprecated = "Use `set_frequency()` instead."] pub fn frequency(&mut self, val: f32) -> &mut Self { - self.frequency_shim(val); + self.set_frequency(val); self } - #[doc = "Change the `gain` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`*"] + #[deprecated = "Use `set_gain()` instead."] pub fn gain(&mut self, val: f32) -> &mut Self { - self.gain_shim(val); + self.set_gain(val); self } #[cfg(feature = "BiquadFilterType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BiquadFilterOptions`, `BiquadFilterType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: BiquadFilterType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_BlobEventInit.rs b/crates/web-sys/src/features/gen_BlobEventInit.rs index 0fa75a06fb3..fea2a8ed6a5 100644 --- a/crates/web-sys/src/features/gen_BlobEventInit.rs +++ b/crates/web-sys/src/features/gen_BlobEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] pub type BlobEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &BlobEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &BlobEventInit, val: bool); + pub fn set_bubbles(this: &BlobEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &BlobEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &BlobEventInit, val: bool); + pub fn set_cancelable(this: &BlobEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &BlobEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &BlobEventInit, val: bool); + pub fn set_composed(this: &BlobEventInit, val: bool); #[cfg(feature = "Blob")] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &BlobEventInit) -> Option; + #[cfg(feature = "Blob")] + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &BlobEventInit, val: Option<&Blob>); + pub fn set_data(this: &BlobEventInit, val: Option<&Blob>); } impl BlobEventInit { #[doc = "Construct a new `BlobEventInit`."] @@ -29,33 +62,25 @@ impl BlobEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlobEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Blob")] - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: Option<&Blob>) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } } diff --git a/crates/web-sys/src/features/gen_BlobPropertyBag.rs b/crates/web-sys/src/features/gen_BlobPropertyBag.rs index 0adf9be4ac0..c9f3853f33e 100644 --- a/crates/web-sys/src/features/gen_BlobPropertyBag.rs +++ b/crates/web-sys/src/features/gen_BlobPropertyBag.rs @@ -11,10 +11,27 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] pub type BlobPropertyBag; #[cfg(feature = "EndingTypes")] + #[doc = "Get the `endings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`, `EndingTypes`*"] + #[wasm_bindgen(method, getter = "endings")] + pub fn get_endings(this: &BlobPropertyBag) -> Option; + #[cfg(feature = "EndingTypes")] + #[doc = "Change the `endings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`, `EndingTypes`*"] #[wasm_bindgen(method, setter = "endings")] - fn endings_shim(this: &BlobPropertyBag, val: EndingTypes); + pub fn set_endings(this: &BlobPropertyBag, val: EndingTypes); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &BlobPropertyBag) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &BlobPropertyBag, val: &str); + pub fn set_type(this: &BlobPropertyBag, val: &str); } impl BlobPropertyBag { #[doc = "Construct a new `BlobPropertyBag`."] @@ -26,18 +43,14 @@ impl BlobPropertyBag { ret } #[cfg(feature = "EndingTypes")] - #[doc = "Change the `endings` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`, `EndingTypes`*"] + #[deprecated = "Use `set_endings()` instead."] pub fn endings(&mut self, val: EndingTypes) -> &mut Self { - self.endings_shim(val); + self.set_endings(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_BlockParsingOptions.rs b/crates/web-sys/src/features/gen_BlockParsingOptions.rs index f46a8c184bc..6990d64bded 100644 --- a/crates/web-sys/src/features/gen_BlockParsingOptions.rs +++ b/crates/web-sys/src/features/gen_BlockParsingOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] pub type BlockParsingOptions; + #[doc = "Get the `blockScriptCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] + #[wasm_bindgen(method, getter = "blockScriptCreated")] + pub fn get_block_script_created(this: &BlockParsingOptions) -> Option; + #[doc = "Change the `blockScriptCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] #[wasm_bindgen(method, setter = "blockScriptCreated")] - fn block_script_created_shim(this: &BlockParsingOptions, val: bool); + pub fn set_block_script_created(this: &BlockParsingOptions, val: bool); } impl BlockParsingOptions { #[doc = "Construct a new `BlockParsingOptions`."] @@ -22,11 +30,9 @@ impl BlockParsingOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `blockScriptCreated` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BlockParsingOptions`*"] + #[deprecated = "Use `set_block_script_created()` instead."] pub fn block_script_created(&mut self, val: bool) -> &mut Self { - self.block_script_created_shim(val); + self.set_block_script_created(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs index 3b357d47883..38c8e66dc5c 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs @@ -14,50 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothAdvertisingEventInit; - #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &BluetoothAdvertisingEventInit, val: bool); - #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &BluetoothAdvertisingEventInit, val: bool); - #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &BluetoothAdvertisingEventInit, val: bool); - #[wasm_bindgen(method, setter = "appearance")] - fn appearance_shim(this: &BluetoothAdvertisingEventInit, val: u16); - #[cfg(feature = "BluetoothDevice")] - #[wasm_bindgen(method, setter = "device")] - fn device_shim(this: &BluetoothAdvertisingEventInit, val: &BluetoothDevice); - #[cfg(feature = "BluetoothManufacturerDataMap")] - #[wasm_bindgen(method, setter = "manufacturerData")] - fn manufacturer_data_shim( - this: &BluetoothAdvertisingEventInit, - val: &BluetoothManufacturerDataMap, - ); - #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &BluetoothAdvertisingEventInit, val: &str); - #[wasm_bindgen(method, setter = "rssi")] - fn rssi_shim(this: &BluetoothAdvertisingEventInit, val: i8); - #[cfg(feature = "BluetoothServiceDataMap")] - #[wasm_bindgen(method, setter = "serviceData")] - fn service_data_shim(this: &BluetoothAdvertisingEventInit, val: &BluetoothServiceDataMap); - #[wasm_bindgen(method, setter = "txPower")] - fn tx_power_shim(this: &BluetoothAdvertisingEventInit, val: i8); - #[wasm_bindgen(method, setter = "uuids")] - fn uuids_shim(this: &BluetoothAdvertisingEventInit, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl BluetoothAdvertisingEventInit { - #[cfg(feature = "BluetoothDevice")] - #[doc = "Construct a new `BluetoothAdvertisingEventInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`, `BluetoothDevice`*"] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(device: &BluetoothDevice) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.device(device); - ret - } + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bubbles` field of this object."] #[doc = ""] @@ -65,10 +30,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); - self - } + #[wasm_bindgen(method, setter = "bubbles")] + pub fn set_bubbles(this: &BluetoothAdvertisingEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `cancelable` field of this object."] #[doc = ""] @@ -76,10 +48,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); - self - } + #[wasm_bindgen(method, setter = "cancelable")] + pub fn set_cancelable(this: &BluetoothAdvertisingEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `composed` field of this object."] #[doc = ""] @@ -87,10 +66,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); - self - } + #[wasm_bindgen(method, setter = "composed")] + pub fn set_composed(this: &BluetoothAdvertisingEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `appearance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "appearance")] + pub fn get_appearance(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `appearance` field of this object."] #[doc = ""] @@ -98,10 +84,18 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn appearance(&mut self, val: u16) -> &mut Self { - self.appearance_shim(val); - self - } + #[wasm_bindgen(method, setter = "appearance")] + pub fn set_appearance(this: &BluetoothAdvertisingEventInit, val: u16); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothDevice")] + #[doc = "Get the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`, `BluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "device")] + pub fn get_device(this: &BluetoothAdvertisingEventInit) -> BluetoothDevice; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "BluetoothDevice")] #[doc = "Change the `device` field of this object."] @@ -110,10 +104,20 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn device(&mut self, val: &BluetoothDevice) -> &mut Self { - self.device_shim(val); - self - } + #[wasm_bindgen(method, setter = "device")] + pub fn set_device(this: &BluetoothAdvertisingEventInit, val: &BluetoothDevice); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothManufacturerDataMap")] + #[doc = "Get the `manufacturerData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`, `BluetoothManufacturerDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "manufacturerData")] + pub fn get_manufacturer_data( + this: &BluetoothAdvertisingEventInit, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "BluetoothManufacturerDataMap")] #[doc = "Change the `manufacturerData` field of this object."] @@ -122,10 +126,20 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn manufacturer_data(&mut self, val: &BluetoothManufacturerDataMap) -> &mut Self { - self.manufacturer_data_shim(val); - self - } + #[wasm_bindgen(method, setter = "manufacturerData")] + pub fn set_manufacturer_data( + this: &BluetoothAdvertisingEventInit, + val: &BluetoothManufacturerDataMap, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] @@ -133,10 +147,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); - self - } + #[wasm_bindgen(method, setter = "name")] + pub fn set_name(this: &BluetoothAdvertisingEventInit, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rssi` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rssi")] + pub fn get_rssi(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rssi` field of this object."] #[doc = ""] @@ -144,10 +165,20 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn rssi(&mut self, val: i8) -> &mut Self { - self.rssi_shim(val); - self - } + #[wasm_bindgen(method, setter = "rssi")] + pub fn set_rssi(this: &BluetoothAdvertisingEventInit, val: i8); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothServiceDataMap")] + #[doc = "Get the `serviceData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`, `BluetoothServiceDataMap`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "serviceData")] + pub fn get_service_data( + this: &BluetoothAdvertisingEventInit, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "BluetoothServiceDataMap")] #[doc = "Change the `serviceData` field of this object."] @@ -156,10 +187,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn service_data(&mut self, val: &BluetoothServiceDataMap) -> &mut Self { - self.service_data_shim(val); - self - } + #[wasm_bindgen(method, setter = "serviceData")] + pub fn set_service_data(this: &BluetoothAdvertisingEventInit, val: &BluetoothServiceDataMap); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `txPower` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "txPower")] + pub fn get_tx_power(this: &BluetoothAdvertisingEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `txPower` field of this object."] #[doc = ""] @@ -167,10 +205,17 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn tx_power(&mut self, val: i8) -> &mut Self { - self.tx_power_shim(val); - self - } + #[wasm_bindgen(method, setter = "txPower")] + pub fn set_tx_power(this: &BluetoothAdvertisingEventInit, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `uuids` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "uuids")] + pub fn get_uuids(this: &BluetoothAdvertisingEventInit) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `uuids` field of this object."] #[doc = ""] @@ -178,8 +223,91 @@ impl BluetoothAdvertisingEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "uuids")] + pub fn set_uuids(this: &BluetoothAdvertisingEventInit, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl BluetoothAdvertisingEventInit { + #[cfg(feature = "BluetoothDevice")] + #[doc = "Construct a new `BluetoothAdvertisingEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEventInit`, `BluetoothDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(device: &BluetoothDevice) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.device(device); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bubbles()` instead."] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + self.set_bubbles(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_cancelable()` instead."] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + self.set_cancelable(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_composed()` instead."] + pub fn composed(&mut self, val: bool) -> &mut Self { + self.set_composed(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_appearance()` instead."] + pub fn appearance(&mut self, val: u16) -> &mut Self { + self.set_appearance(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothDevice")] + #[deprecated = "Use `set_device()` instead."] + pub fn device(&mut self, val: &BluetoothDevice) -> &mut Self { + self.set_device(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothManufacturerDataMap")] + #[deprecated = "Use `set_manufacturer_data()` instead."] + pub fn manufacturer_data(&mut self, val: &BluetoothManufacturerDataMap) -> &mut Self { + self.set_manufacturer_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_name()` instead."] + pub fn name(&mut self, val: &str) -> &mut Self { + self.set_name(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rssi()` instead."] + pub fn rssi(&mut self, val: i8) -> &mut Self { + self.set_rssi(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "BluetoothServiceDataMap")] + #[deprecated = "Use `set_service_data()` instead."] + pub fn service_data(&mut self, val: &BluetoothServiceDataMap) -> &mut Self { + self.set_service_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_tx_power()` instead."] + pub fn tx_power(&mut self, val: i8) -> &mut Self { + self.set_tx_power(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_uuids()` instead."] pub fn uuids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.uuids_shim(val); + self.set_uuids(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs b/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs index c5ced6819f6..d7ec6784356 100644 --- a/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothDataFilterInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothDataFilterInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dataPrefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dataPrefix")] + pub fn get_data_prefix(this: &BluetoothDataFilterInit) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataPrefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "dataPrefix")] - fn data_prefix_shim(this: &BluetoothDataFilterInit, val: &::js_sys::Object); + pub fn set_data_prefix(this: &BluetoothDataFilterInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mask")] + pub fn get_mask(this: &BluetoothDataFilterInit) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mask")] - fn mask_shim(this: &BluetoothDataFilterInit, val: &::js_sys::Object); + pub fn set_mask(this: &BluetoothDataFilterInit, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl BluetoothDataFilterInit { @@ -33,25 +65,15 @@ impl BluetoothDataFilterInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `dataPrefix` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data_prefix()` instead."] pub fn data_prefix(&mut self, val: &::js_sys::Object) -> &mut Self { - self.data_prefix_shim(val); + self.set_data_prefix(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `mask` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BluetoothDataFilterInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mask()` instead."] pub fn mask(&mut self, val: &::js_sys::Object) -> &mut Self { - self.mask_shim(val); + self.set_mask(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs index e70ea5d2c1c..8f7db520c1e 100644 --- a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothLeScanFilterInit; - #[wasm_bindgen(method, setter = "manufacturerData")] - fn manufacturer_data_shim(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); - #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &BluetoothLeScanFilterInit, val: &str); - #[wasm_bindgen(method, setter = "namePrefix")] - fn name_prefix_shim(this: &BluetoothLeScanFilterInit, val: &str); - #[wasm_bindgen(method, setter = "serviceData")] - fn service_data_shim(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); - #[wasm_bindgen(method, setter = "services")] - fn services_shim(this: &BluetoothLeScanFilterInit, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl BluetoothLeScanFilterInit { - #[doc = "Construct a new `BluetoothLeScanFilterInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `manufacturerData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "manufacturerData")] + pub fn get_manufacturer_data(this: &BluetoothLeScanFilterInit) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `manufacturerData` field of this object."] #[doc = ""] @@ -45,10 +30,17 @@ impl BluetoothLeScanFilterInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn manufacturer_data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.manufacturer_data_shim(val); - self - } + #[wasm_bindgen(method, setter = "manufacturerData")] + pub fn set_manufacturer_data(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &BluetoothLeScanFilterInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] @@ -56,10 +48,17 @@ impl BluetoothLeScanFilterInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); - self - } + #[wasm_bindgen(method, setter = "name")] + pub fn set_name(this: &BluetoothLeScanFilterInit, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `namePrefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "namePrefix")] + pub fn get_name_prefix(this: &BluetoothLeScanFilterInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `namePrefix` field of this object."] #[doc = ""] @@ -67,10 +66,17 @@ impl BluetoothLeScanFilterInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name_prefix(&mut self, val: &str) -> &mut Self { - self.name_prefix_shim(val); - self - } + #[wasm_bindgen(method, setter = "namePrefix")] + pub fn set_name_prefix(this: &BluetoothLeScanFilterInit, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `serviceData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "serviceData")] + pub fn get_service_data(this: &BluetoothLeScanFilterInit) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `serviceData` field of this object."] #[doc = ""] @@ -78,10 +84,17 @@ impl BluetoothLeScanFilterInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn service_data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.service_data_shim(val); - self - } + #[wasm_bindgen(method, setter = "serviceData")] + pub fn set_service_data(this: &BluetoothLeScanFilterInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `services` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "services")] + pub fn get_services(this: &BluetoothLeScanFilterInit) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `services` field of this object."] #[doc = ""] @@ -89,8 +102,50 @@ impl BluetoothLeScanFilterInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "services")] + pub fn set_services(this: &BluetoothLeScanFilterInit, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl BluetoothLeScanFilterInit { + #[doc = "Construct a new `BluetoothLeScanFilterInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_manufacturer_data()` instead."] + pub fn manufacturer_data(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_manufacturer_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_name()` instead."] + pub fn name(&mut self, val: &str) -> &mut Self { + self.set_name(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_name_prefix()` instead."] + pub fn name_prefix(&mut self, val: &str) -> &mut Self { + self.set_name_prefix(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_service_data()` instead."] + pub fn service_data(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_service_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_services()` instead."] pub fn services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.services_shim(val); + self.set_services(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs index 3159b4567b3..61715c45bf0 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs @@ -14,33 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &BluetoothPermissionDescriptor, val: PermissionName); - #[wasm_bindgen(method, setter = "acceptAllDevices")] - fn accept_all_devices_shim(this: &BluetoothPermissionDescriptor, val: bool); - #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &BluetoothPermissionDescriptor, val: &str); - #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &BluetoothPermissionDescriptor, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "optionalServices")] - fn optional_services_shim(this: &BluetoothPermissionDescriptor, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl BluetoothPermissionDescriptor { - #[cfg(feature = "PermissionName")] - #[doc = "Construct a new `BluetoothPermissionDescriptor`."] + #[doc = "Get the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`, `PermissionName`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(name: PermissionName) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret - } + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &BluetoothPermissionDescriptor) -> PermissionName; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] #[doc = "Change the `name` field of this object."] @@ -49,10 +32,17 @@ impl BluetoothPermissionDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); - self - } + #[wasm_bindgen(method, setter = "name")] + pub fn set_name(this: &BluetoothPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `acceptAllDevices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "acceptAllDevices")] + pub fn get_accept_all_devices(this: &BluetoothPermissionDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `acceptAllDevices` field of this object."] #[doc = ""] @@ -60,10 +50,17 @@ impl BluetoothPermissionDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { - self.accept_all_devices_shim(val); - self - } + #[wasm_bindgen(method, setter = "acceptAllDevices")] + pub fn set_accept_all_devices(this: &BluetoothPermissionDescriptor, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &BluetoothPermissionDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `deviceId` field of this object."] #[doc = ""] @@ -71,10 +68,17 @@ impl BluetoothPermissionDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn device_id(&mut self, val: &str) -> &mut Self { - self.device_id_shim(val); - self - } + #[wasm_bindgen(method, setter = "deviceId")] + pub fn set_device_id(this: &BluetoothPermissionDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &BluetoothPermissionDescriptor) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `filters` field of this object."] #[doc = ""] @@ -82,10 +86,17 @@ impl BluetoothPermissionDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); - self - } + #[wasm_bindgen(method, setter = "filters")] + pub fn set_filters(this: &BluetoothPermissionDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `optionalServices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "optionalServices")] + pub fn get_optional_services(this: &BluetoothPermissionDescriptor) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `optionalServices` field of this object."] #[doc = ""] @@ -93,8 +104,56 @@ impl BluetoothPermissionDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "optionalServices")] + pub fn set_optional_services( + this: &BluetoothPermissionDescriptor, + val: &::wasm_bindgen::JsValue, + ); +} +#[cfg(web_sys_unstable_apis)] +impl BluetoothPermissionDescriptor { + #[cfg(feature = "PermissionName")] + #[doc = "Construct a new `BluetoothPermissionDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(name: PermissionName) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.name(name); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[deprecated = "Use `set_name()` instead."] + pub fn name(&mut self, val: PermissionName) -> &mut Self { + self.set_name(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_accept_all_devices()` instead."] + pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { + self.set_accept_all_devices(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_device_id()` instead."] + pub fn device_id(&mut self, val: &str) -> &mut Self { + self.set_device_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_filters()` instead."] + pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_filters(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_optional_services()` instead."] pub fn optional_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.optional_services_shim(val); + self.set_optional_services(val); self } } diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs index 0ef0d117cde..ba65406810e 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type BluetoothPermissionStorage; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowedDevices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionStorage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "allowedDevices")] + pub fn get_allowed_devices(this: &BluetoothPermissionStorage) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowedDevices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionStorage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "allowedDevices")] - fn allowed_devices_shim(this: &BluetoothPermissionStorage, val: &::wasm_bindgen::JsValue); + pub fn set_allowed_devices(this: &BluetoothPermissionStorage, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl BluetoothPermissionStorage { @@ -32,14 +48,9 @@ impl BluetoothPermissionStorage { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `allowedDevices` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BluetoothPermissionStorage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_allowed_devices()` instead."] pub fn allowed_devices(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.allowed_devices_shim(val); + self.set_allowed_devices(val); self } } diff --git a/crates/web-sys/src/features/gen_BoxQuadOptions.rs b/crates/web-sys/src/features/gen_BoxQuadOptions.rs index 6000d877f7c..0a117e15c03 100644 --- a/crates/web-sys/src/features/gen_BoxQuadOptions.rs +++ b/crates/web-sys/src/features/gen_BoxQuadOptions.rs @@ -11,10 +11,27 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] pub type BoxQuadOptions; #[cfg(feature = "CssBoxType")] + #[doc = "Get the `box` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`, `CssBoxType`*"] + #[wasm_bindgen(method, getter = "box")] + pub fn get_box(this: &BoxQuadOptions) -> Option; + #[cfg(feature = "CssBoxType")] + #[doc = "Change the `box` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`, `CssBoxType`*"] #[wasm_bindgen(method, setter = "box")] - fn box__shim(this: &BoxQuadOptions, val: CssBoxType); + pub fn set_box(this: &BoxQuadOptions, val: CssBoxType); + #[doc = "Get the `relativeTo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] + #[wasm_bindgen(method, getter = "relativeTo")] + pub fn get_relative_to(this: &BoxQuadOptions) -> Option<::js_sys::Object>; + #[doc = "Change the `relativeTo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] #[wasm_bindgen(method, setter = "relativeTo")] - fn relative_to_shim(this: &BoxQuadOptions, val: &::js_sys::Object); + pub fn set_relative_to(this: &BoxQuadOptions, val: &::js_sys::Object); } impl BoxQuadOptions { #[doc = "Construct a new `BoxQuadOptions`."] @@ -26,18 +43,14 @@ impl BoxQuadOptions { ret } #[cfg(feature = "CssBoxType")] - #[doc = "Change the `box` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`, `CssBoxType`*"] + #[deprecated = "Use `set_box()` instead."] pub fn box_(&mut self, val: CssBoxType) -> &mut Self { - self.box__shim(val); + self.set_box(val); self } - #[doc = "Change the `relativeTo` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BoxQuadOptions`*"] + #[deprecated = "Use `set_relative_to()` instead."] pub fn relative_to(&mut self, val: &::js_sys::Object) -> &mut Self { - self.relative_to_shim(val); + self.set_relative_to(val); self } } diff --git a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs index 2b5f6f187b8..d41ec3553ef 100644 --- a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] pub type BrowserElementDownloadOptions; + #[doc = "Get the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] + #[wasm_bindgen(method, getter = "filename")] + pub fn get_filename(this: &BrowserElementDownloadOptions) -> Option; + #[doc = "Change the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] #[wasm_bindgen(method, setter = "filename")] - fn filename_shim(this: &BrowserElementDownloadOptions, val: Option<&str>); + pub fn set_filename(this: &BrowserElementDownloadOptions, val: Option<&str>); + #[doc = "Get the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] + #[wasm_bindgen(method, getter = "referrer")] + pub fn get_referrer(this: &BrowserElementDownloadOptions) -> Option; + #[doc = "Change the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] #[wasm_bindgen(method, setter = "referrer")] - fn referrer_shim(this: &BrowserElementDownloadOptions, val: Option<&str>); + pub fn set_referrer(this: &BrowserElementDownloadOptions, val: Option<&str>); } impl BrowserElementDownloadOptions { #[doc = "Construct a new `BrowserElementDownloadOptions`."] @@ -24,18 +40,14 @@ impl BrowserElementDownloadOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `filename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] + #[deprecated = "Use `set_filename()` instead."] pub fn filename(&mut self, val: Option<&str>) -> &mut Self { - self.filename_shim(val); + self.set_filename(val); self } - #[doc = "Change the `referrer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] + #[deprecated = "Use `set_referrer()` instead."] pub fn referrer(&mut self, val: Option<&str>) -> &mut Self { - self.referrer_shim(val); + self.set_referrer(val); self } } diff --git a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs index 8a63b96bae3..d5cb2dbd650 100644 --- a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] pub type BrowserElementExecuteScriptOptions; + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &BrowserElementExecuteScriptOptions) -> Option; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); + pub fn set_origin(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &BrowserElementExecuteScriptOptions) -> Option; + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); + pub fn set_url(this: &BrowserElementExecuteScriptOptions, val: Option<&str>); } impl BrowserElementExecuteScriptOptions { #[doc = "Construct a new `BrowserElementExecuteScriptOptions`."] @@ -24,18 +40,14 @@ impl BrowserElementExecuteScriptOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: Option<&str>) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: Option<&str>) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } } diff --git a/crates/web-sys/src/features/gen_CacheBatchOperation.rs b/crates/web-sys/src/features/gen_CacheBatchOperation.rs index 706019c1794..3712535a7b8 100644 --- a/crates/web-sys/src/features/gen_CacheBatchOperation.rs +++ b/crates/web-sys/src/features/gen_CacheBatchOperation.rs @@ -11,16 +11,51 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] pub type CacheBatchOperation; #[cfg(feature = "CacheQueryOptions")] + #[doc = "Get the `options` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `CacheQueryOptions`*"] + #[wasm_bindgen(method, getter = "options")] + pub fn get_options(this: &CacheBatchOperation) -> Option; + #[cfg(feature = "CacheQueryOptions")] + #[doc = "Change the `options` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `CacheQueryOptions`*"] #[wasm_bindgen(method, setter = "options")] - fn options_shim(this: &CacheBatchOperation, val: &CacheQueryOptions); + pub fn set_options(this: &CacheBatchOperation, val: &CacheQueryOptions); + #[cfg(feature = "Request")] + #[doc = "Get the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Request`*"] + #[wasm_bindgen(method, getter = "request")] + pub fn get_request(this: &CacheBatchOperation) -> Option; #[cfg(feature = "Request")] + #[doc = "Change the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Request`*"] #[wasm_bindgen(method, setter = "request")] - fn request_shim(this: &CacheBatchOperation, val: &Request); + pub fn set_request(this: &CacheBatchOperation, val: &Request); #[cfg(feature = "Response")] + #[doc = "Get the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Response`*"] + #[wasm_bindgen(method, getter = "response")] + pub fn get_response(this: &CacheBatchOperation) -> Option; + #[cfg(feature = "Response")] + #[doc = "Change the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Response`*"] #[wasm_bindgen(method, setter = "response")] - fn response_shim(this: &CacheBatchOperation, val: &Response); + pub fn set_response(this: &CacheBatchOperation, val: &Response); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &CacheBatchOperation) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &CacheBatchOperation, val: &str); + pub fn set_type(this: &CacheBatchOperation, val: &str); } impl CacheBatchOperation { #[doc = "Construct a new `CacheBatchOperation`."] @@ -32,34 +67,26 @@ impl CacheBatchOperation { ret } #[cfg(feature = "CacheQueryOptions")] - #[doc = "Change the `options` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `CacheQueryOptions`*"] + #[deprecated = "Use `set_options()` instead."] pub fn options(&mut self, val: &CacheQueryOptions) -> &mut Self { - self.options_shim(val); + self.set_options(val); self } #[cfg(feature = "Request")] - #[doc = "Change the `request` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Request`*"] + #[deprecated = "Use `set_request()` instead."] pub fn request(&mut self, val: &Request) -> &mut Self { - self.request_shim(val); + self.set_request(val); self } #[cfg(feature = "Response")] - #[doc = "Change the `response` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`, `Response`*"] + #[deprecated = "Use `set_response()` instead."] pub fn response(&mut self, val: &Response) -> &mut Self { - self.response_shim(val); + self.set_response(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_CacheQueryOptions.rs b/crates/web-sys/src/features/gen_CacheQueryOptions.rs index f7b0bdf77e8..3497a49e5f8 100644 --- a/crates/web-sys/src/features/gen_CacheQueryOptions.rs +++ b/crates/web-sys/src/features/gen_CacheQueryOptions.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] pub type CacheQueryOptions; + #[doc = "Get the `cacheName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[wasm_bindgen(method, getter = "cacheName")] + pub fn get_cache_name(this: &CacheQueryOptions) -> Option; + #[doc = "Change the `cacheName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] #[wasm_bindgen(method, setter = "cacheName")] - fn cache_name_shim(this: &CacheQueryOptions, val: &str); + pub fn set_cache_name(this: &CacheQueryOptions, val: &str); + #[doc = "Get the `ignoreMethod` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[wasm_bindgen(method, getter = "ignoreMethod")] + pub fn get_ignore_method(this: &CacheQueryOptions) -> Option; + #[doc = "Change the `ignoreMethod` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] #[wasm_bindgen(method, setter = "ignoreMethod")] - fn ignore_method_shim(this: &CacheQueryOptions, val: bool); + pub fn set_ignore_method(this: &CacheQueryOptions, val: bool); + #[doc = "Get the `ignoreSearch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[wasm_bindgen(method, getter = "ignoreSearch")] + pub fn get_ignore_search(this: &CacheQueryOptions) -> Option; + #[doc = "Change the `ignoreSearch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] #[wasm_bindgen(method, setter = "ignoreSearch")] - fn ignore_search_shim(this: &CacheQueryOptions, val: bool); + pub fn set_ignore_search(this: &CacheQueryOptions, val: bool); + #[doc = "Get the `ignoreVary` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[wasm_bindgen(method, getter = "ignoreVary")] + pub fn get_ignore_vary(this: &CacheQueryOptions) -> Option; + #[doc = "Change the `ignoreVary` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] #[wasm_bindgen(method, setter = "ignoreVary")] - fn ignore_vary_shim(this: &CacheQueryOptions, val: bool); + pub fn set_ignore_vary(this: &CacheQueryOptions, val: bool); } impl CacheQueryOptions { #[doc = "Construct a new `CacheQueryOptions`."] @@ -28,32 +60,24 @@ impl CacheQueryOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `cacheName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[deprecated = "Use `set_cache_name()` instead."] pub fn cache_name(&mut self, val: &str) -> &mut Self { - self.cache_name_shim(val); + self.set_cache_name(val); self } - #[doc = "Change the `ignoreMethod` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[deprecated = "Use `set_ignore_method()` instead."] pub fn ignore_method(&mut self, val: bool) -> &mut Self { - self.ignore_method_shim(val); + self.set_ignore_method(val); self } - #[doc = "Change the `ignoreSearch` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[deprecated = "Use `set_ignore_search()` instead."] pub fn ignore_search(&mut self, val: bool) -> &mut Self { - self.ignore_search_shim(val); + self.set_ignore_search(val); self } - #[doc = "Change the `ignoreVary` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] + #[deprecated = "Use `set_ignore_vary()` instead."] pub fn ignore_vary(&mut self, val: bool) -> &mut Self { - self.ignore_vary_shim(val); + self.set_ignore_vary(val); self } } diff --git a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs index 1a7a53e1ea7..093dd71087f 100644 --- a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs +++ b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs @@ -10,30 +10,123 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] pub type CaretStateChangedEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_bubbles(this: &CaretStateChangedEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_cancelable(this: &CaretStateChangedEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_composed(this: &CaretStateChangedEventInit, val: bool); + #[cfg(feature = "DomRectReadOnly")] + #[doc = "Get the `boundingClientRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`, `DomRectReadOnly`*"] + #[wasm_bindgen(method, getter = "boundingClientRect")] + pub fn get_bounding_client_rect(this: &CaretStateChangedEventInit) -> Option; #[cfg(feature = "DomRectReadOnly")] + #[doc = "Change the `boundingClientRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`, `DomRectReadOnly`*"] #[wasm_bindgen(method, setter = "boundingClientRect")] - fn bounding_client_rect_shim(this: &CaretStateChangedEventInit, val: Option<&DomRectReadOnly>); + pub fn set_bounding_client_rect( + this: &CaretStateChangedEventInit, + val: Option<&DomRectReadOnly>, + ); + #[doc = "Get the `caretVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "caretVisible")] + pub fn get_caret_visible(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `caretVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "caretVisible")] - fn caret_visible_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_caret_visible(this: &CaretStateChangedEventInit, val: bool); + #[doc = "Get the `caretVisuallyVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "caretVisuallyVisible")] + pub fn get_caret_visually_visible(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `caretVisuallyVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "caretVisuallyVisible")] - fn caret_visually_visible_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_caret_visually_visible(this: &CaretStateChangedEventInit, val: bool); + #[doc = "Get the `collapsed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "collapsed")] + pub fn get_collapsed(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `collapsed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "collapsed")] - fn collapsed_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_collapsed(this: &CaretStateChangedEventInit, val: bool); + #[cfg(feature = "CaretChangedReason")] + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretChangedReason`, `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &CaretStateChangedEventInit) -> Option; #[cfg(feature = "CaretChangedReason")] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretChangedReason`, `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &CaretStateChangedEventInit, val: CaretChangedReason); + pub fn set_reason(this: &CaretStateChangedEventInit, val: CaretChangedReason); + #[doc = "Get the `selectedTextContent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "selectedTextContent")] + pub fn get_selected_text_content(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `selectedTextContent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "selectedTextContent")] - fn selected_text_content_shim(this: &CaretStateChangedEventInit, val: &str); + pub fn set_selected_text_content(this: &CaretStateChangedEventInit, val: &str); + #[doc = "Get the `selectionEditable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "selectionEditable")] + pub fn get_selection_editable(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `selectionEditable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "selectionEditable")] - fn selection_editable_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_selection_editable(this: &CaretStateChangedEventInit, val: bool); + #[doc = "Get the `selectionVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[wasm_bindgen(method, getter = "selectionVisible")] + pub fn get_selection_visible(this: &CaretStateChangedEventInit) -> Option; + #[doc = "Change the `selectionVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, setter = "selectionVisible")] - fn selection_visible_shim(this: &CaretStateChangedEventInit, val: bool); + pub fn set_selection_visible(this: &CaretStateChangedEventInit, val: bool); } impl CaretStateChangedEventInit { #[doc = "Construct a new `CaretStateChangedEventInit`."] @@ -44,83 +137,61 @@ impl CaretStateChangedEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "DomRectReadOnly")] - #[doc = "Change the `boundingClientRect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`, `DomRectReadOnly`*"] + #[deprecated = "Use `set_bounding_client_rect()` instead."] pub fn bounding_client_rect(&mut self, val: Option<&DomRectReadOnly>) -> &mut Self { - self.bounding_client_rect_shim(val); + self.set_bounding_client_rect(val); self } - #[doc = "Change the `caretVisible` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_caret_visible()` instead."] pub fn caret_visible(&mut self, val: bool) -> &mut Self { - self.caret_visible_shim(val); + self.set_caret_visible(val); self } - #[doc = "Change the `caretVisuallyVisible` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_caret_visually_visible()` instead."] pub fn caret_visually_visible(&mut self, val: bool) -> &mut Self { - self.caret_visually_visible_shim(val); + self.set_caret_visually_visible(val); self } - #[doc = "Change the `collapsed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_collapsed()` instead."] pub fn collapsed(&mut self, val: bool) -> &mut Self { - self.collapsed_shim(val); + self.set_collapsed(val); self } #[cfg(feature = "CaretChangedReason")] - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretChangedReason`, `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: CaretChangedReason) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } - #[doc = "Change the `selectedTextContent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_selected_text_content()` instead."] pub fn selected_text_content(&mut self, val: &str) -> &mut Self { - self.selected_text_content_shim(val); + self.set_selected_text_content(val); self } - #[doc = "Change the `selectionEditable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_selection_editable()` instead."] pub fn selection_editable(&mut self, val: bool) -> &mut Self { - self.selection_editable_shim(val); + self.set_selection_editable(val); self } - #[doc = "Change the `selectionVisible` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] + #[deprecated = "Use `set_selection_visible()` instead."] pub fn selection_visible(&mut self, val: bool) -> &mut Self { - self.selection_visible_shim(val); + self.set_selection_visible(val); self } } diff --git a/crates/web-sys/src/features/gen_ChannelMergerOptions.rs b/crates/web-sys/src/features/gen_ChannelMergerOptions.rs index 2a0566f3bcc..81bdc7379f9 100644 --- a/crates/web-sys/src/features/gen_ChannelMergerOptions.rs +++ b/crates/web-sys/src/features/gen_ChannelMergerOptions.rs @@ -10,16 +10,51 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] pub type ChannelMergerOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &ChannelMergerOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &ChannelMergerOptions, val: u32); + pub fn set_channel_count(this: &ChannelMergerOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelMergerOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &ChannelMergerOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelMergerOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &ChannelMergerOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &ChannelMergerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelMergerOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &ChannelMergerOptions) + -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelMergerOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &ChannelMergerOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &ChannelMergerOptions, val: ChannelInterpretation); + #[doc = "Get the `numberOfInputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] + #[wasm_bindgen(method, getter = "numberOfInputs")] + pub fn get_number_of_inputs(this: &ChannelMergerOptions) -> Option; + #[doc = "Change the `numberOfInputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] #[wasm_bindgen(method, setter = "numberOfInputs")] - fn number_of_inputs_shim(this: &ChannelMergerOptions, val: u32); + pub fn set_number_of_inputs(this: &ChannelMergerOptions, val: u32); } impl ChannelMergerOptions { #[doc = "Construct a new `ChannelMergerOptions`."] @@ -30,34 +65,26 @@ impl ChannelMergerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelMergerOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelMergerOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `numberOfInputs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelMergerOptions`*"] + #[deprecated = "Use `set_number_of_inputs()` instead."] pub fn number_of_inputs(&mut self, val: u32) -> &mut Self { - self.number_of_inputs_shim(val); + self.set_number_of_inputs(val); self } } diff --git a/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs b/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs index a70a522b224..582198555b0 100644 --- a/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs +++ b/crates/web-sys/src/features/gen_ChannelSplitterOptions.rs @@ -10,16 +10,52 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] pub type ChannelSplitterOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &ChannelSplitterOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &ChannelSplitterOptions, val: u32); + pub fn set_channel_count(this: &ChannelSplitterOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelSplitterOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &ChannelSplitterOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelSplitterOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &ChannelSplitterOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &ChannelSplitterOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelSplitterOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation( + this: &ChannelSplitterOptions, + ) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelSplitterOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &ChannelSplitterOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &ChannelSplitterOptions, val: ChannelInterpretation); + #[doc = "Get the `numberOfOutputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] + #[wasm_bindgen(method, getter = "numberOfOutputs")] + pub fn get_number_of_outputs(this: &ChannelSplitterOptions) -> Option; + #[doc = "Change the `numberOfOutputs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] #[wasm_bindgen(method, setter = "numberOfOutputs")] - fn number_of_outputs_shim(this: &ChannelSplitterOptions, val: u32); + pub fn set_number_of_outputs(this: &ChannelSplitterOptions, val: u32); } impl ChannelSplitterOptions { #[doc = "Construct a new `ChannelSplitterOptions`."] @@ -30,34 +66,26 @@ impl ChannelSplitterOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ChannelSplitterOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ChannelSplitterOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `numberOfOutputs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelSplitterOptions`*"] + #[deprecated = "Use `set_number_of_outputs()` instead."] pub fn number_of_outputs(&mut self, val: u32) -> &mut Self { - self.number_of_outputs_shim(val); + self.set_number_of_outputs(val); self } } diff --git a/crates/web-sys/src/features/gen_CheckerboardReport.rs b/crates/web-sys/src/features/gen_CheckerboardReport.rs index 636544b6152..68840404323 100644 --- a/crates/web-sys/src/features/gen_CheckerboardReport.rs +++ b/crates/web-sys/src/features/gen_CheckerboardReport.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] pub type CheckerboardReport; + #[doc = "Get the `log` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[wasm_bindgen(method, getter = "log")] + pub fn get_log(this: &CheckerboardReport) -> Option; + #[doc = "Change the `log` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] #[wasm_bindgen(method, setter = "log")] - fn log_shim(this: &CheckerboardReport, val: &str); + pub fn set_log(this: &CheckerboardReport, val: &str); #[cfg(feature = "CheckerboardReason")] + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReason`, `CheckerboardReport`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &CheckerboardReport) -> Option; + #[cfg(feature = "CheckerboardReason")] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReason`, `CheckerboardReport`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &CheckerboardReport, val: CheckerboardReason); + pub fn set_reason(this: &CheckerboardReport, val: CheckerboardReason); + #[doc = "Get the `severity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[wasm_bindgen(method, getter = "severity")] + pub fn get_severity(this: &CheckerboardReport) -> Option; + #[doc = "Change the `severity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] #[wasm_bindgen(method, setter = "severity")] - fn severity_shim(this: &CheckerboardReport, val: u32); + pub fn set_severity(this: &CheckerboardReport, val: u32); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &CheckerboardReport) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &CheckerboardReport, val: f64); + pub fn set_timestamp(this: &CheckerboardReport, val: f64); } impl CheckerboardReport { #[doc = "Construct a new `CheckerboardReport`."] @@ -29,33 +62,25 @@ impl CheckerboardReport { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `log` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[deprecated = "Use `set_log()` instead."] pub fn log(&mut self, val: &str) -> &mut Self { - self.log_shim(val); + self.set_log(val); self } #[cfg(feature = "CheckerboardReason")] - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CheckerboardReason`, `CheckerboardReport`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: CheckerboardReason) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } - #[doc = "Change the `severity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[deprecated = "Use `set_severity()` instead."] pub fn severity(&mut self, val: u32) -> &mut Self { - self.severity_shim(val); + self.set_severity(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs index b7ec7502649..7ab4711ab1c 100644 --- a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] pub type ChromeFilePropertyBag; + #[doc = "Get the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[wasm_bindgen(method, getter = "lastModified")] + pub fn get_last_modified(this: &ChromeFilePropertyBag) -> Option; + #[doc = "Change the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, setter = "lastModified")] - fn last_modified_shim(this: &ChromeFilePropertyBag, val: f64); + pub fn set_last_modified(this: &ChromeFilePropertyBag, val: f64); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &ChromeFilePropertyBag) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &ChromeFilePropertyBag, val: &str); + pub fn set_type(this: &ChromeFilePropertyBag, val: &str); + #[doc = "Get the `existenceCheck` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[wasm_bindgen(method, getter = "existenceCheck")] + pub fn get_existence_check(this: &ChromeFilePropertyBag) -> Option; + #[doc = "Change the `existenceCheck` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, setter = "existenceCheck")] - fn existence_check_shim(this: &ChromeFilePropertyBag, val: bool); + pub fn set_existence_check(this: &ChromeFilePropertyBag, val: bool); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ChromeFilePropertyBag) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ChromeFilePropertyBag, val: &str); + pub fn set_name(this: &ChromeFilePropertyBag, val: &str); } impl ChromeFilePropertyBag { #[doc = "Construct a new `ChromeFilePropertyBag`."] @@ -28,32 +60,24 @@ impl ChromeFilePropertyBag { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `lastModified` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[deprecated = "Use `set_last_modified()` instead."] pub fn last_modified(&mut self, val: f64) -> &mut Self { - self.last_modified_shim(val); + self.set_last_modified(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `existenceCheck` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[deprecated = "Use `set_existence_check()` instead."] pub fn existence_check(&mut self, val: bool) -> &mut Self { - self.existence_check_shim(val); + self.set_existence_check(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_ClientQueryOptions.rs b/crates/web-sys/src/features/gen_ClientQueryOptions.rs index 79f6f0913c6..941af010e59 100644 --- a/crates/web-sys/src/features/gen_ClientQueryOptions.rs +++ b/crates/web-sys/src/features/gen_ClientQueryOptions.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] pub type ClientQueryOptions; + #[doc = "Get the `includeUncontrolled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] + #[wasm_bindgen(method, getter = "includeUncontrolled")] + pub fn get_include_uncontrolled(this: &ClientQueryOptions) -> Option; + #[doc = "Change the `includeUncontrolled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] #[wasm_bindgen(method, setter = "includeUncontrolled")] - fn include_uncontrolled_shim(this: &ClientQueryOptions, val: bool); + pub fn set_include_uncontrolled(this: &ClientQueryOptions, val: bool); #[cfg(feature = "ClientType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`, `ClientType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &ClientQueryOptions) -> Option; + #[cfg(feature = "ClientType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`, `ClientType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &ClientQueryOptions, val: ClientType); + pub fn set_type(this: &ClientQueryOptions, val: ClientType); } impl ClientQueryOptions { #[doc = "Construct a new `ClientQueryOptions`."] @@ -25,19 +42,15 @@ impl ClientQueryOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `includeUncontrolled` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`*"] + #[deprecated = "Use `set_include_uncontrolled()` instead."] pub fn include_uncontrolled(&mut self, val: bool) -> &mut Self { - self.include_uncontrolled_shim(val); + self.set_include_uncontrolled(val); self } #[cfg(feature = "ClientType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClientQueryOptions`, `ClientType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: ClientType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs index 151fd20d628..0aa0cf48871 100644 --- a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs +++ b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs @@ -11,10 +11,27 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] pub type ClientRectsAndTexts; #[cfg(feature = "DomRectList")] + #[doc = "Get the `rectList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`, `DomRectList`*"] + #[wasm_bindgen(method, getter = "rectList")] + pub fn get_rect_list(this: &ClientRectsAndTexts) -> DomRectList; + #[cfg(feature = "DomRectList")] + #[doc = "Change the `rectList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`, `DomRectList`*"] #[wasm_bindgen(method, setter = "rectList")] - fn rect_list_shim(this: &ClientRectsAndTexts, val: &DomRectList); + pub fn set_rect_list(this: &ClientRectsAndTexts, val: &DomRectList); + #[doc = "Get the `textList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] + #[wasm_bindgen(method, getter = "textList")] + pub fn get_text_list(this: &ClientRectsAndTexts) -> ::js_sys::Array; + #[doc = "Change the `textList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] #[wasm_bindgen(method, setter = "textList")] - fn text_list_shim(this: &ClientRectsAndTexts, val: &::wasm_bindgen::JsValue); + pub fn set_text_list(this: &ClientRectsAndTexts, val: &::wasm_bindgen::JsValue); } impl ClientRectsAndTexts { #[cfg(feature = "DomRectList")] @@ -29,18 +46,14 @@ impl ClientRectsAndTexts { ret } #[cfg(feature = "DomRectList")] - #[doc = "Change the `rectList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`, `DomRectList`*"] + #[deprecated = "Use `set_rect_list()` instead."] pub fn rect_list(&mut self, val: &DomRectList) -> &mut Self { - self.rect_list_shim(val); + self.set_rect_list(val); self } - #[doc = "Change the `textList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClientRectsAndTexts`*"] + #[deprecated = "Use `set_text_list()` instead."] pub fn text_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.text_list_shim(val); + self.set_text_list(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardEventInit.rs b/crates/web-sys/src/features/gen_ClipboardEventInit.rs index 57fae5e2914..c0f0c649583 100644 --- a/crates/web-sys/src/features/gen_ClipboardEventInit.rs +++ b/crates/web-sys/src/features/gen_ClipboardEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] pub type ClipboardEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ClipboardEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ClipboardEventInit, val: bool); + pub fn set_bubbles(this: &ClipboardEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ClipboardEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ClipboardEventInit, val: bool); + pub fn set_cancelable(this: &ClipboardEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ClipboardEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ClipboardEventInit, val: bool); + pub fn set_composed(this: &ClipboardEventInit, val: bool); #[cfg(feature = "DataTransfer")] + #[doc = "Get the `clipboardData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`, `DataTransfer`*"] + #[wasm_bindgen(method, getter = "clipboardData")] + pub fn get_clipboard_data(this: &ClipboardEventInit) -> Option; + #[cfg(feature = "DataTransfer")] + #[doc = "Change the `clipboardData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`, `DataTransfer`*"] #[wasm_bindgen(method, setter = "clipboardData")] - fn clipboard_data_shim(this: &ClipboardEventInit, val: Option<&DataTransfer>); + pub fn set_clipboard_data(this: &ClipboardEventInit, val: Option<&DataTransfer>); } impl ClipboardEventInit { #[doc = "Construct a new `ClipboardEventInit`."] @@ -29,33 +62,25 @@ impl ClipboardEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "DataTransfer")] - #[doc = "Change the `clipboardData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardEventInit`, `DataTransfer`*"] + #[deprecated = "Use `set_clipboard_data()` instead."] pub fn clipboard_data(&mut self, val: Option<&DataTransfer>) -> &mut Self { - self.clipboard_data_shim(val); + self.set_clipboard_data(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs index 0f8b5121183..13c368ab976 100644 --- a/crates/web-sys/src/features/gen_ClipboardItemOptions.rs +++ b/crates/web-sys/src/features/gen_ClipboardItemOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`*"] pub type ClipboardItemOptions; #[cfg(feature = "PresentationStyle")] + #[doc = "Get the `presentationStyle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`, `PresentationStyle`*"] + #[wasm_bindgen(method, getter = "presentationStyle")] + pub fn get_presentation_style(this: &ClipboardItemOptions) -> Option; + #[cfg(feature = "PresentationStyle")] + #[doc = "Change the `presentationStyle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`, `PresentationStyle`*"] #[wasm_bindgen(method, setter = "presentationStyle")] - fn presentation_style_shim(this: &ClipboardItemOptions, val: PresentationStyle); + pub fn set_presentation_style(this: &ClipboardItemOptions, val: PresentationStyle); } impl ClipboardItemOptions { #[doc = "Construct a new `ClipboardItemOptions`."] @@ -24,11 +33,9 @@ impl ClipboardItemOptions { ret } #[cfg(feature = "PresentationStyle")] - #[doc = "Change the `presentationStyle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardItemOptions`, `PresentationStyle`*"] + #[deprecated = "Use `set_presentation_style()` instead."] pub fn presentation_style(&mut self, val: PresentationStyle) -> &mut Self { - self.presentation_style_shim(val); + self.set_presentation_style(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs index 5c8ac6e004d..541b0a317e6 100644 --- a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ClipboardPermissionDescriptor) -> PermissionName; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ClipboardPermissionDescriptor, val: PermissionName); + pub fn set_name(this: &ClipboardPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowWithoutGesture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "allowWithoutGesture")] + pub fn get_allow_without_gesture(this: &ClipboardPermissionDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowWithoutGesture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "allowWithoutGesture")] - fn allow_without_gesture_shim(this: &ClipboardPermissionDescriptor, val: bool); + pub fn set_allow_without_gesture(this: &ClipboardPermissionDescriptor, val: bool); } #[cfg(web_sys_unstable_apis)] impl ClipboardPermissionDescriptor { @@ -37,25 +70,15 @@ impl ClipboardPermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`, `PermissionName`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `allowWithoutGesture` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_allow_without_gesture()` instead."] pub fn allow_without_gesture(&mut self, val: bool) -> &mut Self { - self.allow_without_gesture_shim(val); + self.set_allow_without_gesture(val); self } } diff --git a/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs b/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs index a4e5fa3251e..f1606f53923 100644 --- a/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs +++ b/crates/web-sys/src/features/gen_ClipboardUnsanitizedFormats.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ClipboardUnsanitizedFormats; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unsanitized` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unsanitized")] + pub fn get_unsanitized(this: &ClipboardUnsanitizedFormats) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `unsanitized` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "unsanitized")] - fn unsanitized_shim(this: &ClipboardUnsanitizedFormats, val: &::wasm_bindgen::JsValue); + pub fn set_unsanitized(this: &ClipboardUnsanitizedFormats, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl ClipboardUnsanitizedFormats { @@ -31,14 +47,9 @@ impl ClipboardUnsanitizedFormats { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `unsanitized` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ClipboardUnsanitizedFormats`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_unsanitized()` instead."] pub fn unsanitized(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.unsanitized_shim(val); + self.set_unsanitized(val); self } } diff --git a/crates/web-sys/src/features/gen_CloseEventInit.rs b/crates/web-sys/src/features/gen_CloseEventInit.rs index 16b73d6cd89..841376c6536 100644 --- a/crates/web-sys/src/features/gen_CloseEventInit.rs +++ b/crates/web-sys/src/features/gen_CloseEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] pub type CloseEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &CloseEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &CloseEventInit, val: bool); + pub fn set_bubbles(this: &CloseEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &CloseEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &CloseEventInit, val: bool); + pub fn set_cancelable(this: &CloseEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &CloseEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &CloseEventInit, val: bool); + pub fn set_composed(this: &CloseEventInit, val: bool); + #[doc = "Get the `code` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "code")] + pub fn get_code(this: &CloseEventInit) -> Option; + #[doc = "Change the `code` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "code")] - fn code_shim(this: &CloseEventInit, val: u16); + pub fn set_code(this: &CloseEventInit, val: u16); + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &CloseEventInit) -> Option; + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &CloseEventInit, val: &str); + pub fn set_reason(this: &CloseEventInit, val: &str); + #[doc = "Get the `wasClean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[wasm_bindgen(method, getter = "wasClean")] + pub fn get_was_clean(this: &CloseEventInit) -> Option; + #[doc = "Change the `wasClean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, setter = "wasClean")] - fn was_clean_shim(this: &CloseEventInit, val: bool); + pub fn set_was_clean(this: &CloseEventInit, val: bool); } impl CloseEventInit { #[doc = "Construct a new `CloseEventInit`."] @@ -32,46 +80,34 @@ impl CloseEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `code` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_code()` instead."] pub fn code(&mut self, val: u16) -> &mut Self { - self.code_shim(val); + self.set_code(val); self } - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: &str) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } - #[doc = "Change the `wasClean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] + #[deprecated = "Use `set_was_clean()` instead."] pub fn was_clean(&mut self, val: bool) -> &mut Self { - self.was_clean_shim(val); + self.set_was_clean(val); self } } diff --git a/crates/web-sys/src/features/gen_CollectedClientData.rs b/crates/web-sys/src/features/gen_CollectedClientData.rs index 96b9b4a5d0e..e483aed9ae7 100644 --- a/crates/web-sys/src/features/gen_CollectedClientData.rs +++ b/crates/web-sys/src/features/gen_CollectedClientData.rs @@ -10,22 +10,73 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] pub type CollectedClientData; + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &CollectedClientData) -> String; + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "challenge")] - fn challenge_shim(this: &CollectedClientData, val: &str); + pub fn set_challenge(this: &CollectedClientData, val: &str); #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Get the `clientExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "clientExtensions")] + pub fn get_client_extensions( + this: &CollectedClientData, + ) -> Option; + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Change the `clientExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] #[wasm_bindgen(method, setter = "clientExtensions")] - fn client_extensions_shim( + pub fn set_client_extensions( this: &CollectedClientData, val: &AuthenticationExtensionsClientInputs, ); + #[doc = "Get the `hashAlgorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "hashAlgorithm")] + pub fn get_hash_algorithm(this: &CollectedClientData) -> String; + #[doc = "Change the `hashAlgorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "hashAlgorithm")] - fn hash_algorithm_shim(this: &CollectedClientData, val: &str); + pub fn set_hash_algorithm(this: &CollectedClientData, val: &str); + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &CollectedClientData) -> String; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &CollectedClientData, val: &str); + pub fn set_origin(this: &CollectedClientData, val: &str); + #[doc = "Get the `tokenBindingId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "tokenBindingId")] + pub fn get_token_binding_id(this: &CollectedClientData) -> Option; + #[doc = "Change the `tokenBindingId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "tokenBindingId")] - fn token_binding_id_shim(this: &CollectedClientData, val: &str); + pub fn set_token_binding_id(this: &CollectedClientData, val: &str); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &CollectedClientData) -> String; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &CollectedClientData, val: &str); + pub fn set_type(this: &CollectedClientData, val: &str); } impl CollectedClientData { #[doc = "Construct a new `CollectedClientData`."] @@ -40,47 +91,35 @@ impl CollectedClientData { ret.type_(type_); ret } - #[doc = "Change the `challenge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &str) -> &mut Self { - self.challenge_shim(val); + self.set_challenge(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] - #[doc = "Change the `clientExtensions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] + #[deprecated = "Use `set_client_extensions()` instead."] pub fn client_extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - self.client_extensions_shim(val); + self.set_client_extensions(val); self } - #[doc = "Change the `hashAlgorithm` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated = "Use `set_hash_algorithm()` instead."] pub fn hash_algorithm(&mut self, val: &str) -> &mut Self { - self.hash_algorithm_shim(val); + self.set_hash_algorithm(val); self } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &str) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `tokenBindingId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated = "Use `set_token_binding_id()` instead."] pub fn token_binding_id(&mut self, val: &str) -> &mut Self { - self.token_binding_id_shim(val); + self.set_token_binding_id(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_CompositionEventInit.rs b/crates/web-sys/src/features/gen_CompositionEventInit.rs index 8f2ec5a6b48..79acc2f4d53 100644 --- a/crates/web-sys/src/features/gen_CompositionEventInit.rs +++ b/crates/web-sys/src/features/gen_CompositionEventInit.rs @@ -10,19 +10,68 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] pub type CompositionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &CompositionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &CompositionEventInit, val: bool); + pub fn set_bubbles(this: &CompositionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &CompositionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &CompositionEventInit, val: bool); + pub fn set_cancelable(this: &CompositionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &CompositionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &CompositionEventInit, val: bool); + pub fn set_composed(this: &CompositionEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &CompositionEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &CompositionEventInit, val: i32); + pub fn set_detail(this: &CompositionEventInit, val: i32); + #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &CompositionEventInit) -> Option; #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &CompositionEventInit, val: Option<&Window>); + pub fn set_view(this: &CompositionEventInit, val: Option<&Window>); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &CompositionEventInit) -> Option; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &CompositionEventInit, val: &str); + pub fn set_data(this: &CompositionEventInit, val: &str); } impl CompositionEventInit { #[doc = "Construct a new `CompositionEventInit`."] @@ -33,47 +82,35 @@ impl CompositionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &str) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } } diff --git a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs index 8d55c2533ea..a079e830f73 100644 --- a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs +++ b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs @@ -10,34 +10,140 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] pub type ComputedEffectTiming; + #[doc = "Get the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_delay(this: &ComputedEffectTiming, val: f64); + #[cfg(feature = "PlaybackDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `PlaybackDirection`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &ComputedEffectTiming) -> Option; #[cfg(feature = "PlaybackDirection")] + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `PlaybackDirection`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &ComputedEffectTiming, val: PlaybackDirection); + pub fn set_direction(this: &ComputedEffectTiming, val: PlaybackDirection); + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &ComputedEffectTiming) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &ComputedEffectTiming, val: &::wasm_bindgen::JsValue); + pub fn set_duration(this: &ComputedEffectTiming, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &ComputedEffectTiming, val: &str); + pub fn set_easing(this: &ComputedEffectTiming, val: &str); + #[doc = "Get the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "endDelay")] + pub fn get_end_delay(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "endDelay")] - fn end_delay_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_end_delay(this: &ComputedEffectTiming, val: f64); #[cfg(feature = "FillMode")] + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `FillMode`*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &ComputedEffectTiming) -> Option; + #[cfg(feature = "FillMode")] + #[doc = "Change the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `FillMode`*"] #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &ComputedEffectTiming, val: FillMode); + pub fn set_fill(this: &ComputedEffectTiming, val: FillMode); + #[doc = "Get the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "iterationStart")] + pub fn get_iteration_start(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "iterationStart")] - fn iteration_start_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_iteration_start(this: &ComputedEffectTiming, val: f64); + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_iterations(this: &ComputedEffectTiming, val: f64); + #[doc = "Get the `activeDuration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "activeDuration")] + pub fn get_active_duration(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `activeDuration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "activeDuration")] - fn active_duration_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_active_duration(this: &ComputedEffectTiming, val: f64); + #[doc = "Get the `currentIteration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "currentIteration")] + pub fn get_current_iteration(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `currentIteration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "currentIteration")] - fn current_iteration_shim(this: &ComputedEffectTiming, val: Option); + pub fn set_current_iteration(this: &ComputedEffectTiming, val: Option); + #[doc = "Get the `endTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "endTime")] + pub fn get_end_time(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `endTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "endTime")] - fn end_time_shim(this: &ComputedEffectTiming, val: f64); + pub fn set_end_time(this: &ComputedEffectTiming, val: f64); + #[doc = "Get the `localTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "localTime")] + pub fn get_local_time(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `localTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "localTime")] - fn local_time_shim(this: &ComputedEffectTiming, val: Option); + pub fn set_local_time(this: &ComputedEffectTiming, val: Option); + #[doc = "Get the `progress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[wasm_bindgen(method, getter = "progress")] + pub fn get_progress(this: &ComputedEffectTiming) -> Option; + #[doc = "Change the `progress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, setter = "progress")] - fn progress_shim(this: &ComputedEffectTiming, val: Option); + pub fn set_progress(this: &ComputedEffectTiming, val: Option); } impl ComputedEffectTiming { #[doc = "Construct a new `ComputedEffectTiming`."] @@ -48,97 +154,71 @@ impl ComputedEffectTiming { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `delay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_delay()` instead."] pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); + self.set_delay(val); self } #[cfg(feature = "PlaybackDirection")] - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `PlaybackDirection`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `endDelay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_end_delay()` instead."] pub fn end_delay(&mut self, val: f64) -> &mut Self { - self.end_delay_shim(val); + self.set_end_delay(val); self } #[cfg(feature = "FillMode")] - #[doc = "Change the `fill` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`, `FillMode`*"] + #[deprecated = "Use `set_fill()` instead."] pub fn fill(&mut self, val: FillMode) -> &mut Self { - self.fill_shim(val); + self.set_fill(val); self } - #[doc = "Change the `iterationStart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_iteration_start()` instead."] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - self.iteration_start_shim(val); + self.set_iteration_start(val); self } - #[doc = "Change the `iterations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_iterations()` instead."] pub fn iterations(&mut self, val: f64) -> &mut Self { - self.iterations_shim(val); + self.set_iterations(val); self } - #[doc = "Change the `activeDuration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_active_duration()` instead."] pub fn active_duration(&mut self, val: f64) -> &mut Self { - self.active_duration_shim(val); + self.set_active_duration(val); self } - #[doc = "Change the `currentIteration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_current_iteration()` instead."] pub fn current_iteration(&mut self, val: Option) -> &mut Self { - self.current_iteration_shim(val); + self.set_current_iteration(val); self } - #[doc = "Change the `endTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_end_time()` instead."] pub fn end_time(&mut self, val: f64) -> &mut Self { - self.end_time_shim(val); + self.set_end_time(val); self } - #[doc = "Change the `localTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_local_time()` instead."] pub fn local_time(&mut self, val: Option) -> &mut Self { - self.local_time_shim(val); + self.set_local_time(val); self } - #[doc = "Change the `progress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] + #[deprecated = "Use `set_progress()` instead."] pub fn progress(&mut self, val: Option) -> &mut Self { - self.progress_shim(val); + self.set_progress(val); self } } diff --git a/crates/web-sys/src/features/gen_ConnStatusDict.rs b/crates/web-sys/src/features/gen_ConnStatusDict.rs index be5540fc998..e30dac419c1 100644 --- a/crates/web-sys/src/features/gen_ConnStatusDict.rs +++ b/crates/web-sys/src/features/gen_ConnStatusDict.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] pub type ConnStatusDict; + #[doc = "Get the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] + #[wasm_bindgen(method, getter = "status")] + pub fn get_status(this: &ConnStatusDict) -> Option; + #[doc = "Change the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] #[wasm_bindgen(method, setter = "status")] - fn status_shim(this: &ConnStatusDict, val: &str); + pub fn set_status(this: &ConnStatusDict, val: &str); } impl ConnStatusDict { #[doc = "Construct a new `ConnStatusDict`."] @@ -22,11 +30,9 @@ impl ConnStatusDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `status` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] + #[deprecated = "Use `set_status()` instead."] pub fn status(&mut self, val: &str) -> &mut Self { - self.status_shim(val); + self.set_status(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleCounter.rs b/crates/web-sys/src/features/gen_ConsoleCounter.rs index be0416a4baf..324e055fd0f 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounter.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounter.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] pub type ConsoleCounter; + #[doc = "Get the `count` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] + #[wasm_bindgen(method, getter = "count")] + pub fn get_count(this: &ConsoleCounter) -> Option; + #[doc = "Change the `count` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] #[wasm_bindgen(method, setter = "count")] - fn count_shim(this: &ConsoleCounter, val: u32); + pub fn set_count(this: &ConsoleCounter, val: u32); + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &ConsoleCounter) -> Option; + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &ConsoleCounter, val: &str); + pub fn set_label(this: &ConsoleCounter, val: &str); } impl ConsoleCounter { #[doc = "Construct a new `ConsoleCounter`."] @@ -24,18 +40,14 @@ impl ConsoleCounter { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `count` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] + #[deprecated = "Use `set_count()` instead."] pub fn count(&mut self, val: u32) -> &mut Self { - self.count_shim(val); + self.set_count(val); self } - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleCounterError.rs b/crates/web-sys/src/features/gen_ConsoleCounterError.rs index 69738146c54..bbc0a56a2f8 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounterError.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounterError.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] pub type ConsoleCounterError; + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &ConsoleCounterError) -> Option; + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &ConsoleCounterError, val: &str); + pub fn set_error(this: &ConsoleCounterError, val: &str); + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &ConsoleCounterError) -> Option; + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &ConsoleCounterError, val: &str); + pub fn set_label(this: &ConsoleCounterError, val: &str); } impl ConsoleCounterError { #[doc = "Construct a new `ConsoleCounterError`."] @@ -24,18 +40,14 @@ impl ConsoleCounterError { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &str) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleEvent.rs b/crates/web-sys/src/features/gen_ConsoleEvent.rs index d88d063f088..1ab9de14dd2 100644 --- a/crates/web-sys/src/features/gen_ConsoleEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleEvent.rs @@ -10,40 +10,176 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] pub type ConsoleEvent; + #[doc = "Get the `ID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "ID")] + pub fn get_id(this: &ConsoleEvent) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `ID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "ID")] - fn id_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_id(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `addonId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "addonId")] + pub fn get_addon_id(this: &ConsoleEvent) -> Option; + #[doc = "Change the `addonId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "addonId")] - fn addon_id_shim(this: &ConsoleEvent, val: &str); + pub fn set_addon_id(this: &ConsoleEvent, val: &str); + #[doc = "Get the `arguments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "arguments")] + pub fn get_arguments(this: &ConsoleEvent) -> Option<::js_sys::Array>; + #[doc = "Change the `arguments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "arguments")] - fn arguments_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_arguments(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "columnNumber")] + pub fn get_column_number(this: &ConsoleEvent) -> Option; + #[doc = "Change the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "columnNumber")] - fn column_number_shim(this: &ConsoleEvent, val: u32); + pub fn set_column_number(this: &ConsoleEvent, val: u32); + #[doc = "Get the `consoleID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "consoleID")] + pub fn get_console_id(this: &ConsoleEvent) -> Option; + #[doc = "Change the `consoleID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "consoleID")] - fn console_id_shim(this: &ConsoleEvent, val: &str); + pub fn set_console_id(this: &ConsoleEvent, val: &str); + #[doc = "Get the `counter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "counter")] + pub fn get_counter(this: &ConsoleEvent) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `counter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "counter")] - fn counter_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_counter(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "filename")] + pub fn get_filename(this: &ConsoleEvent) -> Option; + #[doc = "Change the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "filename")] - fn filename_shim(this: &ConsoleEvent, val: &str); + pub fn set_filename(this: &ConsoleEvent, val: &str); + #[doc = "Get the `functionName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "functionName")] + pub fn get_function_name(this: &ConsoleEvent) -> Option; + #[doc = "Change the `functionName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "functionName")] - fn function_name_shim(this: &ConsoleEvent, val: &str); + pub fn set_function_name(this: &ConsoleEvent, val: &str); + #[doc = "Get the `groupName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "groupName")] + pub fn get_group_name(this: &ConsoleEvent) -> Option; + #[doc = "Change the `groupName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "groupName")] - fn group_name_shim(this: &ConsoleEvent, val: &str); + pub fn set_group_name(this: &ConsoleEvent, val: &str); + #[doc = "Get the `innerID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "innerID")] + pub fn get_inner_id(this: &ConsoleEvent) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `innerID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "innerID")] - fn inner_id_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_inner_id(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `level` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "level")] + pub fn get_level(this: &ConsoleEvent) -> Option; + #[doc = "Change the `level` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "level")] - fn level_shim(this: &ConsoleEvent, val: &str); + pub fn set_level(this: &ConsoleEvent, val: &str); + #[doc = "Get the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "lineNumber")] + pub fn get_line_number(this: &ConsoleEvent) -> Option; + #[doc = "Change the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "lineNumber")] - fn line_number_shim(this: &ConsoleEvent, val: u32); + pub fn set_line_number(this: &ConsoleEvent, val: u32); + #[doc = "Get the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "prefix")] + pub fn get_prefix(this: &ConsoleEvent) -> Option; + #[doc = "Change the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "prefix")] - fn prefix_shim(this: &ConsoleEvent, val: &str); + pub fn set_prefix(this: &ConsoleEvent, val: &str); + #[doc = "Get the `private` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "private")] + pub fn get_private(this: &ConsoleEvent) -> Option; + #[doc = "Change the `private` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "private")] - fn private_shim(this: &ConsoleEvent, val: bool); + pub fn set_private(this: &ConsoleEvent, val: bool); + #[doc = "Get the `styles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "styles")] + pub fn get_styles(this: &ConsoleEvent) -> Option<::js_sys::Array>; + #[doc = "Change the `styles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "styles")] - fn styles_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_styles(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `timeStamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "timeStamp")] + pub fn get_time_stamp(this: &ConsoleEvent) -> Option; + #[doc = "Change the `timeStamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "timeStamp")] - fn time_stamp_shim(this: &ConsoleEvent, val: f64); + pub fn set_time_stamp(this: &ConsoleEvent, val: f64); + #[doc = "Get the `timer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[wasm_bindgen(method, getter = "timer")] + pub fn get_timer(this: &ConsoleEvent) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `timer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, setter = "timer")] - fn timer_shim(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); + pub fn set_timer(this: &ConsoleEvent, val: &::wasm_bindgen::JsValue); } impl ConsoleEvent { #[doc = "Construct a new `ConsoleEvent`."] @@ -54,123 +190,89 @@ impl ConsoleEvent { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `ID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `addonId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_addon_id()` instead."] pub fn addon_id(&mut self, val: &str) -> &mut Self { - self.addon_id_shim(val); + self.set_addon_id(val); self } - #[doc = "Change the `arguments` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_arguments()` instead."] pub fn arguments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.arguments_shim(val); + self.set_arguments(val); self } - #[doc = "Change the `columnNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_column_number()` instead."] pub fn column_number(&mut self, val: u32) -> &mut Self { - self.column_number_shim(val); + self.set_column_number(val); self } - #[doc = "Change the `consoleID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_console_id()` instead."] pub fn console_id(&mut self, val: &str) -> &mut Self { - self.console_id_shim(val); + self.set_console_id(val); self } - #[doc = "Change the `counter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_counter()` instead."] pub fn counter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.counter_shim(val); + self.set_counter(val); self } - #[doc = "Change the `filename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_filename()` instead."] pub fn filename(&mut self, val: &str) -> &mut Self { - self.filename_shim(val); + self.set_filename(val); self } - #[doc = "Change the `functionName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_function_name()` instead."] pub fn function_name(&mut self, val: &str) -> &mut Self { - self.function_name_shim(val); + self.set_function_name(val); self } - #[doc = "Change the `groupName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_group_name()` instead."] pub fn group_name(&mut self, val: &str) -> &mut Self { - self.group_name_shim(val); + self.set_group_name(val); self } - #[doc = "Change the `innerID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_inner_id()` instead."] pub fn inner_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.inner_id_shim(val); + self.set_inner_id(val); self } - #[doc = "Change the `level` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_level()` instead."] pub fn level(&mut self, val: &str) -> &mut Self { - self.level_shim(val); + self.set_level(val); self } - #[doc = "Change the `lineNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_line_number()` instead."] pub fn line_number(&mut self, val: u32) -> &mut Self { - self.line_number_shim(val); + self.set_line_number(val); self } - #[doc = "Change the `prefix` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_prefix()` instead."] pub fn prefix(&mut self, val: &str) -> &mut Self { - self.prefix_shim(val); + self.set_prefix(val); self } - #[doc = "Change the `private` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_private()` instead."] pub fn private(&mut self, val: bool) -> &mut Self { - self.private_shim(val); + self.set_private(val); self } - #[doc = "Change the `styles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_styles()` instead."] pub fn styles(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.styles_shim(val); + self.set_styles(val); self } - #[doc = "Change the `timeStamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_time_stamp()` instead."] pub fn time_stamp(&mut self, val: f64) -> &mut Self { - self.time_stamp_shim(val); + self.set_time_stamp(val); self } - #[doc = "Change the `timer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] + #[deprecated = "Use `set_timer()` instead."] pub fn timer(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.timer_shim(val); + self.set_timer(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs index 2b807509ef7..49f01a0f33e 100644 --- a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs +++ b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs @@ -10,19 +10,68 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] pub type ConsoleInstanceOptions; + #[doc = "Get the `consoleID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[wasm_bindgen(method, getter = "consoleID")] + pub fn get_console_id(this: &ConsoleInstanceOptions) -> Option; + #[doc = "Change the `consoleID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, setter = "consoleID")] - fn console_id_shim(this: &ConsoleInstanceOptions, val: &str); + pub fn set_console_id(this: &ConsoleInstanceOptions, val: &str); + #[doc = "Get the `dump` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[wasm_bindgen(method, getter = "dump")] + pub fn get_dump(this: &ConsoleInstanceOptions) -> Option<::js_sys::Function>; + #[doc = "Change the `dump` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, setter = "dump")] - fn dump_shim(this: &ConsoleInstanceOptions, val: &::js_sys::Function); + pub fn set_dump(this: &ConsoleInstanceOptions, val: &::js_sys::Function); + #[doc = "Get the `innerID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[wasm_bindgen(method, getter = "innerID")] + pub fn get_inner_id(this: &ConsoleInstanceOptions) -> Option; + #[doc = "Change the `innerID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, setter = "innerID")] - fn inner_id_shim(this: &ConsoleInstanceOptions, val: &str); + pub fn set_inner_id(this: &ConsoleInstanceOptions, val: &str); + #[cfg(feature = "ConsoleLogLevel")] + #[doc = "Get the `maxLogLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`, `ConsoleLogLevel`*"] + #[wasm_bindgen(method, getter = "maxLogLevel")] + pub fn get_max_log_level(this: &ConsoleInstanceOptions) -> Option; #[cfg(feature = "ConsoleLogLevel")] + #[doc = "Change the `maxLogLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`, `ConsoleLogLevel`*"] #[wasm_bindgen(method, setter = "maxLogLevel")] - fn max_log_level_shim(this: &ConsoleInstanceOptions, val: ConsoleLogLevel); + pub fn set_max_log_level(this: &ConsoleInstanceOptions, val: ConsoleLogLevel); + #[doc = "Get the `maxLogLevelPref` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[wasm_bindgen(method, getter = "maxLogLevelPref")] + pub fn get_max_log_level_pref(this: &ConsoleInstanceOptions) -> Option; + #[doc = "Change the `maxLogLevelPref` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, setter = "maxLogLevelPref")] - fn max_log_level_pref_shim(this: &ConsoleInstanceOptions, val: &str); + pub fn set_max_log_level_pref(this: &ConsoleInstanceOptions, val: &str); + #[doc = "Get the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[wasm_bindgen(method, getter = "prefix")] + pub fn get_prefix(this: &ConsoleInstanceOptions) -> Option; + #[doc = "Change the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, setter = "prefix")] - fn prefix_shim(this: &ConsoleInstanceOptions, val: &str); + pub fn set_prefix(this: &ConsoleInstanceOptions, val: &str); } impl ConsoleInstanceOptions { #[doc = "Construct a new `ConsoleInstanceOptions`."] @@ -33,47 +82,35 @@ impl ConsoleInstanceOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `consoleID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[deprecated = "Use `set_console_id()` instead."] pub fn console_id(&mut self, val: &str) -> &mut Self { - self.console_id_shim(val); + self.set_console_id(val); self } - #[doc = "Change the `dump` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[deprecated = "Use `set_dump()` instead."] pub fn dump(&mut self, val: &::js_sys::Function) -> &mut Self { - self.dump_shim(val); + self.set_dump(val); self } - #[doc = "Change the `innerID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[deprecated = "Use `set_inner_id()` instead."] pub fn inner_id(&mut self, val: &str) -> &mut Self { - self.inner_id_shim(val); + self.set_inner_id(val); self } #[cfg(feature = "ConsoleLogLevel")] - #[doc = "Change the `maxLogLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`, `ConsoleLogLevel`*"] + #[deprecated = "Use `set_max_log_level()` instead."] pub fn max_log_level(&mut self, val: ConsoleLogLevel) -> &mut Self { - self.max_log_level_shim(val); + self.set_max_log_level(val); self } - #[doc = "Change the `maxLogLevelPref` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[deprecated = "Use `set_max_log_level_pref()` instead."] pub fn max_log_level_pref(&mut self, val: &str) -> &mut Self { - self.max_log_level_pref_shim(val); + self.set_max_log_level_pref(val); self } - #[doc = "Change the `prefix` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] + #[deprecated = "Use `set_prefix()` instead."] pub fn prefix(&mut self, val: &str) -> &mut Self { - self.prefix_shim(val); + self.set_prefix(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs index 833b5be4d40..a845e746dc1 100644 --- a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] pub type ConsoleProfileEvent; + #[doc = "Get the `action` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] + #[wasm_bindgen(method, getter = "action")] + pub fn get_action(this: &ConsoleProfileEvent) -> Option; + #[doc = "Change the `action` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] #[wasm_bindgen(method, setter = "action")] - fn action_shim(this: &ConsoleProfileEvent, val: &str); + pub fn set_action(this: &ConsoleProfileEvent, val: &str); + #[doc = "Get the `arguments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] + #[wasm_bindgen(method, getter = "arguments")] + pub fn get_arguments(this: &ConsoleProfileEvent) -> Option<::js_sys::Array>; + #[doc = "Change the `arguments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] #[wasm_bindgen(method, setter = "arguments")] - fn arguments_shim(this: &ConsoleProfileEvent, val: &::wasm_bindgen::JsValue); + pub fn set_arguments(this: &ConsoleProfileEvent, val: &::wasm_bindgen::JsValue); } impl ConsoleProfileEvent { #[doc = "Construct a new `ConsoleProfileEvent`."] @@ -24,18 +40,14 @@ impl ConsoleProfileEvent { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `action` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] + #[deprecated = "Use `set_action()` instead."] pub fn action(&mut self, val: &str) -> &mut Self { - self.action_shim(val); + self.set_action(val); self } - #[doc = "Change the `arguments` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] + #[deprecated = "Use `set_arguments()` instead."] pub fn arguments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.arguments_shim(val); + self.set_arguments(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs index 12555018b78..b1ffa84f6de 100644 --- a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs +++ b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] pub type ConsoleStackEntry; + #[doc = "Get the `asyncCause` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[wasm_bindgen(method, getter = "asyncCause")] + pub fn get_async_cause(this: &ConsoleStackEntry) -> Option; + #[doc = "Change the `asyncCause` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, setter = "asyncCause")] - fn async_cause_shim(this: &ConsoleStackEntry, val: Option<&str>); + pub fn set_async_cause(this: &ConsoleStackEntry, val: Option<&str>); + #[doc = "Get the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[wasm_bindgen(method, getter = "columnNumber")] + pub fn get_column_number(this: &ConsoleStackEntry) -> Option; + #[doc = "Change the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, setter = "columnNumber")] - fn column_number_shim(this: &ConsoleStackEntry, val: u32); + pub fn set_column_number(this: &ConsoleStackEntry, val: u32); + #[doc = "Get the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[wasm_bindgen(method, getter = "filename")] + pub fn get_filename(this: &ConsoleStackEntry) -> Option; + #[doc = "Change the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, setter = "filename")] - fn filename_shim(this: &ConsoleStackEntry, val: &str); + pub fn set_filename(this: &ConsoleStackEntry, val: &str); + #[doc = "Get the `functionName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[wasm_bindgen(method, getter = "functionName")] + pub fn get_function_name(this: &ConsoleStackEntry) -> Option; + #[doc = "Change the `functionName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, setter = "functionName")] - fn function_name_shim(this: &ConsoleStackEntry, val: &str); + pub fn set_function_name(this: &ConsoleStackEntry, val: &str); + #[doc = "Get the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[wasm_bindgen(method, getter = "lineNumber")] + pub fn get_line_number(this: &ConsoleStackEntry) -> Option; + #[doc = "Change the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, setter = "lineNumber")] - fn line_number_shim(this: &ConsoleStackEntry, val: u32); + pub fn set_line_number(this: &ConsoleStackEntry, val: u32); } impl ConsoleStackEntry { #[doc = "Construct a new `ConsoleStackEntry`."] @@ -30,39 +70,29 @@ impl ConsoleStackEntry { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `asyncCause` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[deprecated = "Use `set_async_cause()` instead."] pub fn async_cause(&mut self, val: Option<&str>) -> &mut Self { - self.async_cause_shim(val); + self.set_async_cause(val); self } - #[doc = "Change the `columnNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[deprecated = "Use `set_column_number()` instead."] pub fn column_number(&mut self, val: u32) -> &mut Self { - self.column_number_shim(val); + self.set_column_number(val); self } - #[doc = "Change the `filename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[deprecated = "Use `set_filename()` instead."] pub fn filename(&mut self, val: &str) -> &mut Self { - self.filename_shim(val); + self.set_filename(val); self } - #[doc = "Change the `functionName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[deprecated = "Use `set_function_name()` instead."] pub fn function_name(&mut self, val: &str) -> &mut Self { - self.function_name_shim(val); + self.set_function_name(val); self } - #[doc = "Change the `lineNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] + #[deprecated = "Use `set_line_number()` instead."] pub fn line_number(&mut self, val: u32) -> &mut Self { - self.line_number_shim(val); + self.set_line_number(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerError.rs b/crates/web-sys/src/features/gen_ConsoleTimerError.rs index 9455aff12d3..b23bcbf3963 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerError.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerError.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] pub type ConsoleTimerError; + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &ConsoleTimerError) -> Option; + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &ConsoleTimerError, val: &str); + pub fn set_error(this: &ConsoleTimerError, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ConsoleTimerError) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ConsoleTimerError, val: &str); + pub fn set_name(this: &ConsoleTimerError, val: &str); } impl ConsoleTimerError { #[doc = "Construct a new `ConsoleTimerError`."] @@ -24,18 +40,14 @@ impl ConsoleTimerError { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &str) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs index 0d3b294a926..7e74b760b0a 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] pub type ConsoleTimerLogOrEnd; + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &ConsoleTimerLogOrEnd) -> Option; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &ConsoleTimerLogOrEnd, val: f64); + pub fn set_duration(this: &ConsoleTimerLogOrEnd, val: f64); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ConsoleTimerLogOrEnd) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ConsoleTimerLogOrEnd, val: &str); + pub fn set_name(this: &ConsoleTimerLogOrEnd, val: &str); } impl ConsoleTimerLogOrEnd { #[doc = "Construct a new `ConsoleTimerLogOrEnd`."] @@ -24,18 +40,14 @@ impl ConsoleTimerLogOrEnd { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs index d4e2a17d04c..5d3bd715226 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] pub type ConsoleTimerStart; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ConsoleTimerStart) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ConsoleTimerStart, val: &str); + pub fn set_name(this: &ConsoleTimerStart, val: &str); } impl ConsoleTimerStart { #[doc = "Construct a new `ConsoleTimerStart`."] @@ -22,11 +30,9 @@ impl ConsoleTimerStart { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstantSourceOptions.rs b/crates/web-sys/src/features/gen_ConstantSourceOptions.rs index 206ed0a76af..7b96a490b75 100644 --- a/crates/web-sys/src/features/gen_ConstantSourceOptions.rs +++ b/crates/web-sys/src/features/gen_ConstantSourceOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] pub type ConstantSourceOptions; + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &ConstantSourceOptions) -> Option; + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &ConstantSourceOptions, val: f32); + pub fn set_offset(this: &ConstantSourceOptions, val: f32); } impl ConstantSourceOptions { #[doc = "Construct a new `ConstantSourceOptions`."] @@ -22,11 +30,9 @@ impl ConstantSourceOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstantSourceOptions`*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: f32) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs b/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs index 6885925daa3..51b890c87e3 100644 --- a/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs +++ b/crates/web-sys/src/features/gen_ConstrainBooleanParameters.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] pub type ConstrainBooleanParameters; + #[doc = "Get the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] + #[wasm_bindgen(method, getter = "exact")] + pub fn get_exact(this: &ConstrainBooleanParameters) -> Option; + #[doc = "Change the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] #[wasm_bindgen(method, setter = "exact")] - fn exact_shim(this: &ConstrainBooleanParameters, val: bool); + pub fn set_exact(this: &ConstrainBooleanParameters, val: bool); + #[doc = "Get the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] + #[wasm_bindgen(method, getter = "ideal")] + pub fn get_ideal(this: &ConstrainBooleanParameters) -> Option; + #[doc = "Change the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] #[wasm_bindgen(method, setter = "ideal")] - fn ideal_shim(this: &ConstrainBooleanParameters, val: bool); + pub fn set_ideal(this: &ConstrainBooleanParameters, val: bool); } impl ConstrainBooleanParameters { #[doc = "Construct a new `ConstrainBooleanParameters`."] @@ -24,18 +40,14 @@ impl ConstrainBooleanParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `exact` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] + #[deprecated = "Use `set_exact()` instead."] pub fn exact(&mut self, val: bool) -> &mut Self { - self.exact_shim(val); + self.set_exact(val); self } - #[doc = "Change the `ideal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainBooleanParameters`*"] + #[deprecated = "Use `set_ideal()` instead."] pub fn ideal(&mut self, val: bool) -> &mut Self { - self.ideal_shim(val); + self.set_ideal(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs b/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs index 71f3bf16b92..b2827f2f132 100644 --- a/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs +++ b/crates/web-sys/src/features/gen_ConstrainDomStringParameters.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] pub type ConstrainDomStringParameters; + #[doc = "Get the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] + #[wasm_bindgen(method, getter = "exact")] + pub fn get_exact(this: &ConstrainDomStringParameters) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] #[wasm_bindgen(method, setter = "exact")] - fn exact_shim(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); + pub fn set_exact(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] + #[wasm_bindgen(method, getter = "ideal")] + pub fn get_ideal(this: &ConstrainDomStringParameters) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] #[wasm_bindgen(method, setter = "ideal")] - fn ideal_shim(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); + pub fn set_ideal(this: &ConstrainDomStringParameters, val: &::wasm_bindgen::JsValue); } impl ConstrainDomStringParameters { #[doc = "Construct a new `ConstrainDomStringParameters`."] @@ -24,18 +40,14 @@ impl ConstrainDomStringParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `exact` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] + #[deprecated = "Use `set_exact()` instead."] pub fn exact(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.exact_shim(val); + self.set_exact(val); self } - #[doc = "Change the `ideal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDomStringParameters`*"] + #[deprecated = "Use `set_ideal()` instead."] pub fn ideal(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ideal_shim(val); + self.set_ideal(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs b/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs index ac4e0ccb31f..2a543032019 100644 --- a/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs +++ b/crates/web-sys/src/features/gen_ConstrainDoubleRange.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] pub type ConstrainDoubleRange; + #[doc = "Get the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[wasm_bindgen(method, getter = "exact")] + pub fn get_exact(this: &ConstrainDoubleRange) -> Option; + #[doc = "Change the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] #[wasm_bindgen(method, setter = "exact")] - fn exact_shim(this: &ConstrainDoubleRange, val: f64); + pub fn set_exact(this: &ConstrainDoubleRange, val: f64); + #[doc = "Get the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[wasm_bindgen(method, getter = "ideal")] + pub fn get_ideal(this: &ConstrainDoubleRange) -> Option; + #[doc = "Change the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] #[wasm_bindgen(method, setter = "ideal")] - fn ideal_shim(this: &ConstrainDoubleRange, val: f64); + pub fn set_ideal(this: &ConstrainDoubleRange, val: f64); + #[doc = "Get the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[wasm_bindgen(method, getter = "max")] + pub fn get_max(this: &ConstrainDoubleRange) -> Option; + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] #[wasm_bindgen(method, setter = "max")] - fn max_shim(this: &ConstrainDoubleRange, val: f64); + pub fn set_max(this: &ConstrainDoubleRange, val: f64); + #[doc = "Get the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[wasm_bindgen(method, getter = "min")] + pub fn get_min(this: &ConstrainDoubleRange) -> Option; + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] #[wasm_bindgen(method, setter = "min")] - fn min_shim(this: &ConstrainDoubleRange, val: f64); + pub fn set_min(this: &ConstrainDoubleRange, val: f64); } impl ConstrainDoubleRange { #[doc = "Construct a new `ConstrainDoubleRange`."] @@ -28,32 +60,24 @@ impl ConstrainDoubleRange { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `exact` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[deprecated = "Use `set_exact()` instead."] pub fn exact(&mut self, val: f64) -> &mut Self { - self.exact_shim(val); + self.set_exact(val); self } - #[doc = "Change the `ideal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[deprecated = "Use `set_ideal()` instead."] pub fn ideal(&mut self, val: f64) -> &mut Self { - self.ideal_shim(val); + self.set_ideal(val); self } - #[doc = "Change the `max` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[deprecated = "Use `set_max()` instead."] pub fn max(&mut self, val: f64) -> &mut Self { - self.max_shim(val); + self.set_max(val); self } - #[doc = "Change the `min` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainDoubleRange`*"] + #[deprecated = "Use `set_min()` instead."] pub fn min(&mut self, val: f64) -> &mut Self { - self.min_shim(val); + self.set_min(val); self } } diff --git a/crates/web-sys/src/features/gen_ConstrainLongRange.rs b/crates/web-sys/src/features/gen_ConstrainLongRange.rs index 58deaf0f387..9a284100e08 100644 --- a/crates/web-sys/src/features/gen_ConstrainLongRange.rs +++ b/crates/web-sys/src/features/gen_ConstrainLongRange.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] pub type ConstrainLongRange; + #[doc = "Get the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[wasm_bindgen(method, getter = "exact")] + pub fn get_exact(this: &ConstrainLongRange) -> Option; + #[doc = "Change the `exact` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] #[wasm_bindgen(method, setter = "exact")] - fn exact_shim(this: &ConstrainLongRange, val: i32); + pub fn set_exact(this: &ConstrainLongRange, val: i32); + #[doc = "Get the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[wasm_bindgen(method, getter = "ideal")] + pub fn get_ideal(this: &ConstrainLongRange) -> Option; + #[doc = "Change the `ideal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] #[wasm_bindgen(method, setter = "ideal")] - fn ideal_shim(this: &ConstrainLongRange, val: i32); + pub fn set_ideal(this: &ConstrainLongRange, val: i32); + #[doc = "Get the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[wasm_bindgen(method, getter = "max")] + pub fn get_max(this: &ConstrainLongRange) -> Option; + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] #[wasm_bindgen(method, setter = "max")] - fn max_shim(this: &ConstrainLongRange, val: i32); + pub fn set_max(this: &ConstrainLongRange, val: i32); + #[doc = "Get the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[wasm_bindgen(method, getter = "min")] + pub fn get_min(this: &ConstrainLongRange) -> Option; + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] #[wasm_bindgen(method, setter = "min")] - fn min_shim(this: &ConstrainLongRange, val: i32); + pub fn set_min(this: &ConstrainLongRange, val: i32); } impl ConstrainLongRange { #[doc = "Construct a new `ConstrainLongRange`."] @@ -28,32 +60,24 @@ impl ConstrainLongRange { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `exact` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[deprecated = "Use `set_exact()` instead."] pub fn exact(&mut self, val: i32) -> &mut Self { - self.exact_shim(val); + self.set_exact(val); self } - #[doc = "Change the `ideal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[deprecated = "Use `set_ideal()` instead."] pub fn ideal(&mut self, val: i32) -> &mut Self { - self.ideal_shim(val); + self.set_ideal(val); self } - #[doc = "Change the `max` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[deprecated = "Use `set_max()` instead."] pub fn max(&mut self, val: i32) -> &mut Self { - self.max_shim(val); + self.set_max(val); self } - #[doc = "Change the `min` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConstrainLongRange`*"] + #[deprecated = "Use `set_min()` instead."] pub fn min(&mut self, val: i32) -> &mut Self { - self.min_shim(val); + self.set_min(val); self } } diff --git a/crates/web-sys/src/features/gen_ContextAttributes2d.rs b/crates/web-sys/src/features/gen_ContextAttributes2d.rs index 6e46206dd2a..570c3aca543 100644 --- a/crates/web-sys/src/features/gen_ContextAttributes2d.rs +++ b/crates/web-sys/src/features/gen_ContextAttributes2d.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] pub type ContextAttributes2d; + #[doc = "Get the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &ContextAttributes2d) -> Option; + #[doc = "Change the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &ContextAttributes2d, val: bool); + pub fn set_alpha(this: &ContextAttributes2d, val: bool); + #[doc = "Get the `willReadFrequently` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] + #[wasm_bindgen(method, getter = "willReadFrequently")] + pub fn get_will_read_frequently(this: &ContextAttributes2d) -> Option; + #[doc = "Change the `willReadFrequently` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] #[wasm_bindgen(method, setter = "willReadFrequently")] - fn will_read_frequently_shim(this: &ContextAttributes2d, val: bool); + pub fn set_will_read_frequently(this: &ContextAttributes2d, val: bool); } impl ContextAttributes2d { #[doc = "Construct a new `ContextAttributes2d`."] @@ -24,18 +40,14 @@ impl ContextAttributes2d { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `alpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] + #[deprecated = "Use `set_alpha()` instead."] pub fn alpha(&mut self, val: bool) -> &mut Self { - self.alpha_shim(val); + self.set_alpha(val); self } - #[doc = "Change the `willReadFrequently` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ContextAttributes2d`*"] + #[deprecated = "Use `set_will_read_frequently()` instead."] pub fn will_read_frequently(&mut self, val: bool) -> &mut Self { - self.will_read_frequently_shim(val); + self.set_will_read_frequently(val); self } } diff --git a/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs b/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs index 0e1493f0a85..9d31410e431 100644 --- a/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs +++ b/crates/web-sys/src/features/gen_ConvertCoordinateOptions.rs @@ -11,11 +11,29 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`*"] pub type ConvertCoordinateOptions; #[cfg(feature = "CssBoxType")] + #[doc = "Get the `fromBox` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] + #[wasm_bindgen(method, getter = "fromBox")] + pub fn get_from_box(this: &ConvertCoordinateOptions) -> Option; + #[cfg(feature = "CssBoxType")] + #[doc = "Change the `fromBox` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] #[wasm_bindgen(method, setter = "fromBox")] - fn from_box_shim(this: &ConvertCoordinateOptions, val: CssBoxType); + pub fn set_from_box(this: &ConvertCoordinateOptions, val: CssBoxType); + #[cfg(feature = "CssBoxType")] + #[doc = "Get the `toBox` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] + #[wasm_bindgen(method, getter = "toBox")] + pub fn get_to_box(this: &ConvertCoordinateOptions) -> Option; #[cfg(feature = "CssBoxType")] + #[doc = "Change the `toBox` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] #[wasm_bindgen(method, setter = "toBox")] - fn to_box_shim(this: &ConvertCoordinateOptions, val: CssBoxType); + pub fn set_to_box(this: &ConvertCoordinateOptions, val: CssBoxType); } impl ConvertCoordinateOptions { #[doc = "Construct a new `ConvertCoordinateOptions`."] @@ -27,19 +45,15 @@ impl ConvertCoordinateOptions { ret } #[cfg(feature = "CssBoxType")] - #[doc = "Change the `fromBox` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] + #[deprecated = "Use `set_from_box()` instead."] pub fn from_box(&mut self, val: CssBoxType) -> &mut Self { - self.from_box_shim(val); + self.set_from_box(val); self } #[cfg(feature = "CssBoxType")] - #[doc = "Change the `toBox` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConvertCoordinateOptions`, `CssBoxType`*"] + #[deprecated = "Use `set_to_box()` instead."] pub fn to_box(&mut self, val: CssBoxType) -> &mut Self { - self.to_box_shim(val); + self.set_to_box(val); self } } diff --git a/crates/web-sys/src/features/gen_ConvolverOptions.rs b/crates/web-sys/src/features/gen_ConvolverOptions.rs index db3fe68d2f5..e53480644c4 100644 --- a/crates/web-sys/src/features/gen_ConvolverOptions.rs +++ b/crates/web-sys/src/features/gen_ConvolverOptions.rs @@ -10,19 +10,62 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] pub type ConvolverOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &ConvolverOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &ConvolverOptions, val: u32); + pub fn set_channel_count(this: &ConvolverOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ConvolverOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &ConvolverOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ConvolverOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &ConvolverOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &ConvolverOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ConvolverOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &ConvolverOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ConvolverOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &ConvolverOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &ConvolverOptions, val: ChannelInterpretation); #[cfg(feature = "AudioBuffer")] + #[doc = "Get the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `ConvolverOptions`*"] + #[wasm_bindgen(method, getter = "buffer")] + pub fn get_buffer(this: &ConvolverOptions) -> Option; + #[cfg(feature = "AudioBuffer")] + #[doc = "Change the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `ConvolverOptions`*"] #[wasm_bindgen(method, setter = "buffer")] - fn buffer_shim(this: &ConvolverOptions, val: Option<&AudioBuffer>); + pub fn set_buffer(this: &ConvolverOptions, val: Option<&AudioBuffer>); + #[doc = "Get the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] + #[wasm_bindgen(method, getter = "disableNormalization")] + pub fn get_disable_normalization(this: &ConvolverOptions) -> Option; + #[doc = "Change the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] #[wasm_bindgen(method, setter = "disableNormalization")] - fn disable_normalization_shim(this: &ConvolverOptions, val: bool); + pub fn set_disable_normalization(this: &ConvolverOptions, val: bool); } impl ConvolverOptions { #[doc = "Construct a new `ConvolverOptions`."] @@ -33,42 +76,32 @@ impl ConvolverOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `ConvolverOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `ConvolverOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } #[cfg(feature = "AudioBuffer")] - #[doc = "Change the `buffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `ConvolverOptions`*"] + #[deprecated = "Use `set_buffer()` instead."] pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self { - self.buffer_shim(val); + self.set_buffer(val); self } - #[doc = "Change the `disableNormalization` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ConvolverOptions`*"] + #[deprecated = "Use `set_disable_normalization()` instead."] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - self.disable_normalization_shim(val); + self.set_disable_normalization(val); self } } diff --git a/crates/web-sys/src/features/gen_CredentialCreationOptions.rs b/crates/web-sys/src/features/gen_CredentialCreationOptions.rs index f9366322156..67aadd91e6f 100644 --- a/crates/web-sys/src/features/gen_CredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_CredentialCreationOptions.rs @@ -11,11 +11,34 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`*"] pub type CredentialCreationOptions; #[cfg(feature = "PublicKeyCredentialCreationOptions")] + #[doc = "Get the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`, `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "publicKey")] + pub fn get_public_key( + this: &CredentialCreationOptions, + ) -> Option; + #[cfg(feature = "PublicKeyCredentialCreationOptions")] + #[doc = "Change the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`, `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "publicKey")] - fn public_key_shim(this: &CredentialCreationOptions, val: &PublicKeyCredentialCreationOptions); + pub fn set_public_key( + this: &CredentialCreationOptions, + val: &PublicKeyCredentialCreationOptions, + ); + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &CredentialCreationOptions) -> Option; #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &CredentialCreationOptions, val: &AbortSignal); + pub fn set_signal(this: &CredentialCreationOptions, val: &AbortSignal); } impl CredentialCreationOptions { #[doc = "Construct a new `CredentialCreationOptions`."] @@ -27,19 +50,15 @@ impl CredentialCreationOptions { ret } #[cfg(feature = "PublicKeyCredentialCreationOptions")] - #[doc = "Change the `publicKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CredentialCreationOptions`, `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_public_key()` instead."] pub fn public_key(&mut self, val: &PublicKeyCredentialCreationOptions) -> &mut Self { - self.public_key_shim(val); + self.set_public_key(val); self } #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialCreationOptions`*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_CredentialRequestOptions.rs b/crates/web-sys/src/features/gen_CredentialRequestOptions.rs index 6df51ff0ab1..2d2d0e18711 100644 --- a/crates/web-sys/src/features/gen_CredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_CredentialRequestOptions.rs @@ -11,11 +11,31 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`*"] pub type CredentialRequestOptions; #[cfg(feature = "PublicKeyCredentialRequestOptions")] + #[doc = "Get the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`, `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "publicKey")] + pub fn get_public_key( + this: &CredentialRequestOptions, + ) -> Option; + #[cfg(feature = "PublicKeyCredentialRequestOptions")] + #[doc = "Change the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`, `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "publicKey")] - fn public_key_shim(this: &CredentialRequestOptions, val: &PublicKeyCredentialRequestOptions); + pub fn set_public_key(this: &CredentialRequestOptions, val: &PublicKeyCredentialRequestOptions); + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &CredentialRequestOptions) -> Option; #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &CredentialRequestOptions, val: &AbortSignal); + pub fn set_signal(this: &CredentialRequestOptions, val: &AbortSignal); } impl CredentialRequestOptions { #[doc = "Construct a new `CredentialRequestOptions`."] @@ -27,19 +47,15 @@ impl CredentialRequestOptions { ret } #[cfg(feature = "PublicKeyCredentialRequestOptions")] - #[doc = "Change the `publicKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CredentialRequestOptions`, `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_public_key()` instead."] pub fn public_key(&mut self, val: &PublicKeyCredentialRequestOptions) -> &mut Self { - self.public_key_shim(val); + self.set_public_key(val); self } #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `CredentialRequestOptions`*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_CryptoKeyPair.rs b/crates/web-sys/src/features/gen_CryptoKeyPair.rs index 2edbf68355b..fdd078a2e64 100644 --- a/crates/web-sys/src/features/gen_CryptoKeyPair.rs +++ b/crates/web-sys/src/features/gen_CryptoKeyPair.rs @@ -11,11 +11,29 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CryptoKeyPair`*"] pub type CryptoKeyPair; #[cfg(feature = "CryptoKey")] + #[doc = "Get the `privateKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] + #[wasm_bindgen(method, getter = "privateKey")] + pub fn get_private_key(this: &CryptoKeyPair) -> CryptoKey; + #[cfg(feature = "CryptoKey")] + #[doc = "Change the `privateKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] #[wasm_bindgen(method, setter = "privateKey")] - fn private_key_shim(this: &CryptoKeyPair, val: &CryptoKey); + pub fn set_private_key(this: &CryptoKeyPair, val: &CryptoKey); + #[cfg(feature = "CryptoKey")] + #[doc = "Get the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] + #[wasm_bindgen(method, getter = "publicKey")] + pub fn get_public_key(this: &CryptoKeyPair) -> CryptoKey; #[cfg(feature = "CryptoKey")] + #[doc = "Change the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] #[wasm_bindgen(method, setter = "publicKey")] - fn public_key_shim(this: &CryptoKeyPair, val: &CryptoKey); + pub fn set_public_key(this: &CryptoKeyPair, val: &CryptoKey); } impl CryptoKeyPair { #[cfg(feature = "CryptoKey")] @@ -30,19 +48,15 @@ impl CryptoKeyPair { ret } #[cfg(feature = "CryptoKey")] - #[doc = "Change the `privateKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] + #[deprecated = "Use `set_private_key()` instead."] pub fn private_key(&mut self, val: &CryptoKey) -> &mut Self { - self.private_key_shim(val); + self.set_private_key(val); self } #[cfg(feature = "CryptoKey")] - #[doc = "Change the `publicKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `CryptoKeyPair`*"] + #[deprecated = "Use `set_public_key()` instead."] pub fn public_key(&mut self, val: &CryptoKey) -> &mut Self { - self.public_key_shim(val); + self.set_public_key(val); self } } diff --git a/crates/web-sys/src/features/gen_CustomEventInit.rs b/crates/web-sys/src/features/gen_CustomEventInit.rs index aaeb6d7a4d7..b9f8dc37f6d 100644 --- a/crates/web-sys/src/features/gen_CustomEventInit.rs +++ b/crates/web-sys/src/features/gen_CustomEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] pub type CustomEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &CustomEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &CustomEventInit, val: bool); + pub fn set_bubbles(this: &CustomEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &CustomEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &CustomEventInit, val: bool); + pub fn set_cancelable(this: &CustomEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &CustomEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &CustomEventInit, val: bool); + pub fn set_composed(this: &CustomEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &CustomEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &CustomEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_detail(this: &CustomEventInit, val: &::wasm_bindgen::JsValue); } impl CustomEventInit { #[doc = "Construct a new `CustomEventInit`."] @@ -28,32 +60,24 @@ impl CustomEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CustomEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } } diff --git a/crates/web-sys/src/features/gen_DateTimeValue.rs b/crates/web-sys/src/features/gen_DateTimeValue.rs index e156222ec16..2d374919524 100644 --- a/crates/web-sys/src/features/gen_DateTimeValue.rs +++ b/crates/web-sys/src/features/gen_DateTimeValue.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] pub type DateTimeValue; + #[doc = "Get the `day` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[wasm_bindgen(method, getter = "day")] + pub fn get_day(this: &DateTimeValue) -> Option; + #[doc = "Change the `day` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] #[wasm_bindgen(method, setter = "day")] - fn day_shim(this: &DateTimeValue, val: i32); + pub fn set_day(this: &DateTimeValue, val: i32); + #[doc = "Get the `hour` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[wasm_bindgen(method, getter = "hour")] + pub fn get_hour(this: &DateTimeValue) -> Option; + #[doc = "Change the `hour` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] #[wasm_bindgen(method, setter = "hour")] - fn hour_shim(this: &DateTimeValue, val: i32); + pub fn set_hour(this: &DateTimeValue, val: i32); + #[doc = "Get the `minute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[wasm_bindgen(method, getter = "minute")] + pub fn get_minute(this: &DateTimeValue) -> Option; + #[doc = "Change the `minute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] #[wasm_bindgen(method, setter = "minute")] - fn minute_shim(this: &DateTimeValue, val: i32); + pub fn set_minute(this: &DateTimeValue, val: i32); + #[doc = "Get the `month` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[wasm_bindgen(method, getter = "month")] + pub fn get_month(this: &DateTimeValue) -> Option; + #[doc = "Change the `month` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] #[wasm_bindgen(method, setter = "month")] - fn month_shim(this: &DateTimeValue, val: i32); + pub fn set_month(this: &DateTimeValue, val: i32); + #[doc = "Get the `year` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[wasm_bindgen(method, getter = "year")] + pub fn get_year(this: &DateTimeValue) -> Option; + #[doc = "Change the `year` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] #[wasm_bindgen(method, setter = "year")] - fn year_shim(this: &DateTimeValue, val: i32); + pub fn set_year(this: &DateTimeValue, val: i32); } impl DateTimeValue { #[doc = "Construct a new `DateTimeValue`."] @@ -30,39 +70,29 @@ impl DateTimeValue { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `day` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[deprecated = "Use `set_day()` instead."] pub fn day(&mut self, val: i32) -> &mut Self { - self.day_shim(val); + self.set_day(val); self } - #[doc = "Change the `hour` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[deprecated = "Use `set_hour()` instead."] pub fn hour(&mut self, val: i32) -> &mut Self { - self.hour_shim(val); + self.set_hour(val); self } - #[doc = "Change the `minute` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[deprecated = "Use `set_minute()` instead."] pub fn minute(&mut self, val: i32) -> &mut Self { - self.minute_shim(val); + self.set_minute(val); self } - #[doc = "Change the `month` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[deprecated = "Use `set_month()` instead."] pub fn month(&mut self, val: i32) -> &mut Self { - self.month_shim(val); + self.set_month(val); self } - #[doc = "Change the `year` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DateTimeValue`*"] + #[deprecated = "Use `set_year()` instead."] pub fn year(&mut self, val: i32) -> &mut Self { - self.year_shim(val); + self.set_year(val); self } } diff --git a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs index ff00d5bc28a..bbd77e5cfeb 100644 --- a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs +++ b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs @@ -10,21 +10,78 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] pub type DecoderDoctorNotification; + #[doc = "Get the `decodeIssue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "decodeIssue")] + pub fn get_decode_issue(this: &DecoderDoctorNotification) -> Option; + #[doc = "Change the `decodeIssue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "decodeIssue")] - fn decode_issue_shim(this: &DecoderDoctorNotification, val: &str); + pub fn set_decode_issue(this: &DecoderDoctorNotification, val: &str); + #[doc = "Get the `decoderDoctorReportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "decoderDoctorReportId")] + pub fn get_decoder_doctor_report_id(this: &DecoderDoctorNotification) -> String; + #[doc = "Change the `decoderDoctorReportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "decoderDoctorReportId")] - fn decoder_doctor_report_id_shim(this: &DecoderDoctorNotification, val: &str); + pub fn set_decoder_doctor_report_id(this: &DecoderDoctorNotification, val: &str); + #[doc = "Get the `docURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "docURL")] + pub fn get_doc_url(this: &DecoderDoctorNotification) -> Option; + #[doc = "Change the `docURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "docURL")] - fn doc_url_shim(this: &DecoderDoctorNotification, val: &str); + pub fn set_doc_url(this: &DecoderDoctorNotification, val: &str); + #[doc = "Get the `formats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "formats")] + pub fn get_formats(this: &DecoderDoctorNotification) -> Option; + #[doc = "Change the `formats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "formats")] - fn formats_shim(this: &DecoderDoctorNotification, val: &str); + pub fn set_formats(this: &DecoderDoctorNotification, val: &str); + #[doc = "Get the `isSolved` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "isSolved")] + pub fn get_is_solved(this: &DecoderDoctorNotification) -> bool; + #[doc = "Change the `isSolved` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "isSolved")] - fn is_solved_shim(this: &DecoderDoctorNotification, val: bool); + pub fn set_is_solved(this: &DecoderDoctorNotification, val: bool); + #[doc = "Get the `resourceURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[wasm_bindgen(method, getter = "resourceURL")] + pub fn get_resource_url(this: &DecoderDoctorNotification) -> Option; + #[doc = "Change the `resourceURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, setter = "resourceURL")] - fn resource_url_shim(this: &DecoderDoctorNotification, val: &str); + pub fn set_resource_url(this: &DecoderDoctorNotification, val: &str); + #[cfg(feature = "DecoderDoctorNotificationType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`, `DecoderDoctorNotificationType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &DecoderDoctorNotification) -> DecoderDoctorNotificationType; #[cfg(feature = "DecoderDoctorNotificationType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`, `DecoderDoctorNotificationType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &DecoderDoctorNotification, val: DecoderDoctorNotificationType); + pub fn set_type(this: &DecoderDoctorNotification, val: DecoderDoctorNotificationType); } impl DecoderDoctorNotification { #[cfg(feature = "DecoderDoctorNotificationType")] @@ -43,54 +100,40 @@ impl DecoderDoctorNotification { ret.type_(type_); ret } - #[doc = "Change the `decodeIssue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_decode_issue()` instead."] pub fn decode_issue(&mut self, val: &str) -> &mut Self { - self.decode_issue_shim(val); + self.set_decode_issue(val); self } - #[doc = "Change the `decoderDoctorReportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_decoder_doctor_report_id()` instead."] pub fn decoder_doctor_report_id(&mut self, val: &str) -> &mut Self { - self.decoder_doctor_report_id_shim(val); + self.set_decoder_doctor_report_id(val); self } - #[doc = "Change the `docURL` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_doc_url()` instead."] pub fn doc_url(&mut self, val: &str) -> &mut Self { - self.doc_url_shim(val); + self.set_doc_url(val); self } - #[doc = "Change the `formats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_formats()` instead."] pub fn formats(&mut self, val: &str) -> &mut Self { - self.formats_shim(val); + self.set_formats(val); self } - #[doc = "Change the `isSolved` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_is_solved()` instead."] pub fn is_solved(&mut self, val: bool) -> &mut Self { - self.is_solved_shim(val); + self.set_is_solved(val); self } - #[doc = "Change the `resourceURL` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] + #[deprecated = "Use `set_resource_url()` instead."] pub fn resource_url(&mut self, val: &str) -> &mut Self { - self.resource_url_shim(val); + self.set_resource_url(val); self } #[cfg(feature = "DecoderDoctorNotificationType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`, `DecoderDoctorNotificationType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: DecoderDoctorNotificationType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_DelayOptions.rs b/crates/web-sys/src/features/gen_DelayOptions.rs index 02afb9d4bf3..2228e7e529b 100644 --- a/crates/web-sys/src/features/gen_DelayOptions.rs +++ b/crates/web-sys/src/features/gen_DelayOptions.rs @@ -10,18 +10,60 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] pub type DelayOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &DelayOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &DelayOptions, val: u32); + pub fn set_channel_count(this: &DelayOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DelayOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &DelayOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DelayOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &DelayOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &DelayOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DelayOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &DelayOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DelayOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &DelayOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &DelayOptions, val: ChannelInterpretation); + #[doc = "Get the `delayTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[wasm_bindgen(method, getter = "delayTime")] + pub fn get_delay_time(this: &DelayOptions) -> Option; + #[doc = "Change the `delayTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] #[wasm_bindgen(method, setter = "delayTime")] - fn delay_time_shim(this: &DelayOptions, val: f64); + pub fn set_delay_time(this: &DelayOptions, val: f64); + #[doc = "Get the `maxDelayTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[wasm_bindgen(method, getter = "maxDelayTime")] + pub fn get_max_delay_time(this: &DelayOptions) -> Option; + #[doc = "Change the `maxDelayTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] #[wasm_bindgen(method, setter = "maxDelayTime")] - fn max_delay_time_shim(this: &DelayOptions, val: f64); + pub fn set_max_delay_time(this: &DelayOptions, val: f64); } impl DelayOptions { #[doc = "Construct a new `DelayOptions`."] @@ -32,41 +74,31 @@ impl DelayOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DelayOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DelayOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `delayTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[deprecated = "Use `set_delay_time()` instead."] pub fn delay_time(&mut self, val: f64) -> &mut Self { - self.delay_time_shim(val); + self.set_delay_time(val); self } - #[doc = "Change the `maxDelayTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DelayOptions`*"] + #[deprecated = "Use `set_max_delay_time()` instead."] pub fn max_delay_time(&mut self, val: f64) -> &mut Self { - self.max_delay_time_shim(val); + self.set_max_delay_time(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs b/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs index f94475e8d2e..ca98e86bb70 100644 --- a/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs +++ b/crates/web-sys/src/features/gen_DeviceAccelerationInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] pub type DeviceAccelerationInit; + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &DeviceAccelerationInit) -> Option; + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &DeviceAccelerationInit, val: Option); + pub fn set_x(this: &DeviceAccelerationInit, val: Option); + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &DeviceAccelerationInit) -> Option; + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &DeviceAccelerationInit, val: Option); + pub fn set_y(this: &DeviceAccelerationInit, val: Option); + #[doc = "Get the `z` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[wasm_bindgen(method, getter = "z")] + pub fn get_z(this: &DeviceAccelerationInit) -> Option; + #[doc = "Change the `z` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] #[wasm_bindgen(method, setter = "z")] - fn z_shim(this: &DeviceAccelerationInit, val: Option); + pub fn set_z(this: &DeviceAccelerationInit, val: Option); } impl DeviceAccelerationInit { #[doc = "Construct a new `DeviceAccelerationInit`."] @@ -26,25 +50,19 @@ impl DeviceAccelerationInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: Option) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: Option) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } - #[doc = "Change the `z` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`*"] + #[deprecated = "Use `set_z()` instead."] pub fn z(&mut self, val: Option) -> &mut Self { - self.z_shim(val); + self.set_z(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceLightEventInit.rs b/crates/web-sys/src/features/gen_DeviceLightEventInit.rs index 61ab42345bb..8aa438238e0 100644 --- a/crates/web-sys/src/features/gen_DeviceLightEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceLightEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] pub type DeviceLightEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &DeviceLightEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &DeviceLightEventInit, val: bool); + pub fn set_bubbles(this: &DeviceLightEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &DeviceLightEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &DeviceLightEventInit, val: bool); + pub fn set_cancelable(this: &DeviceLightEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &DeviceLightEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &DeviceLightEventInit, val: bool); + pub fn set_composed(this: &DeviceLightEventInit, val: bool); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &DeviceLightEventInit) -> Option; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &DeviceLightEventInit, val: f64); + pub fn set_value(this: &DeviceLightEventInit, val: f64); } impl DeviceLightEventInit { #[doc = "Construct a new `DeviceLightEventInit`."] @@ -28,32 +60,24 @@ impl DeviceLightEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceLightEventInit`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: f64) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs b/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs index 43ed16d21fe..6f46ea20a4d 100644 --- a/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceMotionEventInit.rs @@ -10,26 +10,87 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] pub type DeviceMotionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &DeviceMotionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &DeviceMotionEventInit, val: bool); + pub fn set_bubbles(this: &DeviceMotionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &DeviceMotionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &DeviceMotionEventInit, val: bool); + pub fn set_cancelable(this: &DeviceMotionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &DeviceMotionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &DeviceMotionEventInit, val: bool); + pub fn set_composed(this: &DeviceMotionEventInit, val: bool); #[cfg(feature = "DeviceAccelerationInit")] + #[doc = "Get the `acceleration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "acceleration")] + pub fn get_acceleration(this: &DeviceMotionEventInit) -> Option; + #[cfg(feature = "DeviceAccelerationInit")] + #[doc = "Change the `acceleration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "acceleration")] - fn acceleration_shim(this: &DeviceMotionEventInit, val: &DeviceAccelerationInit); + pub fn set_acceleration(this: &DeviceMotionEventInit, val: &DeviceAccelerationInit); #[cfg(feature = "DeviceAccelerationInit")] + #[doc = "Get the `accelerationIncludingGravity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "accelerationIncludingGravity")] + pub fn get_acceleration_including_gravity( + this: &DeviceMotionEventInit, + ) -> Option; + #[cfg(feature = "DeviceAccelerationInit")] + #[doc = "Change the `accelerationIncludingGravity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "accelerationIncludingGravity")] - fn acceleration_including_gravity_shim( + pub fn set_acceleration_including_gravity( this: &DeviceMotionEventInit, val: &DeviceAccelerationInit, ); + #[doc = "Get the `interval` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[wasm_bindgen(method, getter = "interval")] + pub fn get_interval(this: &DeviceMotionEventInit) -> Option; + #[doc = "Change the `interval` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] #[wasm_bindgen(method, setter = "interval")] - fn interval_shim(this: &DeviceMotionEventInit, val: Option); + pub fn set_interval(this: &DeviceMotionEventInit, val: Option); + #[cfg(feature = "DeviceRotationRateInit")] + #[doc = "Get the `rotationRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`, `DeviceRotationRateInit`*"] + #[wasm_bindgen(method, getter = "rotationRate")] + pub fn get_rotation_rate(this: &DeviceMotionEventInit) -> Option; #[cfg(feature = "DeviceRotationRateInit")] + #[doc = "Change the `rotationRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`, `DeviceRotationRateInit`*"] #[wasm_bindgen(method, setter = "rotationRate")] - fn rotation_rate_shim(this: &DeviceMotionEventInit, val: &DeviceRotationRateInit); + pub fn set_rotation_rate(this: &DeviceMotionEventInit, val: &DeviceRotationRateInit); } impl DeviceMotionEventInit { #[doc = "Construct a new `DeviceMotionEventInit`."] @@ -40,56 +101,42 @@ impl DeviceMotionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "DeviceAccelerationInit")] - #[doc = "Change the `acceleration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_acceleration()` instead."] pub fn acceleration(&mut self, val: &DeviceAccelerationInit) -> &mut Self { - self.acceleration_shim(val); + self.set_acceleration(val); self } #[cfg(feature = "DeviceAccelerationInit")] - #[doc = "Change the `accelerationIncludingGravity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_acceleration_including_gravity()` instead."] pub fn acceleration_including_gravity(&mut self, val: &DeviceAccelerationInit) -> &mut Self { - self.acceleration_including_gravity_shim(val); + self.set_acceleration_including_gravity(val); self } - #[doc = "Change the `interval` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"] + #[deprecated = "Use `set_interval()` instead."] pub fn interval(&mut self, val: Option) -> &mut Self { - self.interval_shim(val); + self.set_interval(val); self } #[cfg(feature = "DeviceRotationRateInit")] - #[doc = "Change the `rotationRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`, `DeviceRotationRateInit`*"] + #[deprecated = "Use `set_rotation_rate()` instead."] pub fn rotation_rate(&mut self, val: &DeviceRotationRateInit) -> &mut Self { - self.rotation_rate_shim(val); + self.set_rotation_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs b/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs index 0baef9e2c32..5570bf982a0 100644 --- a/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceOrientationEventInit.rs @@ -10,20 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] pub type DeviceOrientationEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &DeviceOrientationEventInit, val: bool); + pub fn set_bubbles(this: &DeviceOrientationEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &DeviceOrientationEventInit, val: bool); + pub fn set_cancelable(this: &DeviceOrientationEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &DeviceOrientationEventInit, val: bool); + pub fn set_composed(this: &DeviceOrientationEventInit, val: bool); + #[doc = "Get the `absolute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "absolute")] + pub fn get_absolute(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `absolute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "absolute")] - fn absolute_shim(this: &DeviceOrientationEventInit, val: bool); + pub fn set_absolute(this: &DeviceOrientationEventInit, val: bool); + #[doc = "Get the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &DeviceOrientationEventInit, val: Option); + pub fn set_alpha(this: &DeviceOrientationEventInit, val: Option); + #[doc = "Get the `beta` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "beta")] + pub fn get_beta(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `beta` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "beta")] - fn beta_shim(this: &DeviceOrientationEventInit, val: Option); + pub fn set_beta(this: &DeviceOrientationEventInit, val: Option); + #[doc = "Get the `gamma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[wasm_bindgen(method, getter = "gamma")] + pub fn get_gamma(this: &DeviceOrientationEventInit) -> Option; + #[doc = "Change the `gamma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] #[wasm_bindgen(method, setter = "gamma")] - fn gamma_shim(this: &DeviceOrientationEventInit, val: Option); + pub fn set_gamma(this: &DeviceOrientationEventInit, val: Option); } impl DeviceOrientationEventInit { #[doc = "Construct a new `DeviceOrientationEventInit`."] @@ -34,53 +90,39 @@ impl DeviceOrientationEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `absolute` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_absolute()` instead."] pub fn absolute(&mut self, val: bool) -> &mut Self { - self.absolute_shim(val); + self.set_absolute(val); self } - #[doc = "Change the `alpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_alpha()` instead."] pub fn alpha(&mut self, val: Option) -> &mut Self { - self.alpha_shim(val); + self.set_alpha(val); self } - #[doc = "Change the `beta` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_beta()` instead."] pub fn beta(&mut self, val: Option) -> &mut Self { - self.beta_shim(val); + self.set_beta(val); self } - #[doc = "Change the `gamma` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceOrientationEventInit`*"] + #[deprecated = "Use `set_gamma()` instead."] pub fn gamma(&mut self, val: Option) -> &mut Self { - self.gamma_shim(val); + self.set_gamma(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs b/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs index f93f58341f8..d63d3350759 100644 --- a/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs +++ b/crates/web-sys/src/features/gen_DeviceProximityEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] pub type DeviceProximityEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &DeviceProximityEventInit, val: bool); + pub fn set_bubbles(this: &DeviceProximityEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &DeviceProximityEventInit, val: bool); + pub fn set_cancelable(this: &DeviceProximityEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &DeviceProximityEventInit, val: bool); + pub fn set_composed(this: &DeviceProximityEventInit, val: bool); + #[doc = "Get the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "max")] + pub fn get_max(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "max")] - fn max_shim(this: &DeviceProximityEventInit, val: f64); + pub fn set_max(this: &DeviceProximityEventInit, val: f64); + #[doc = "Get the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "min")] + pub fn get_min(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "min")] - fn min_shim(this: &DeviceProximityEventInit, val: f64); + pub fn set_min(this: &DeviceProximityEventInit, val: f64); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &DeviceProximityEventInit) -> Option; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &DeviceProximityEventInit, val: f64); + pub fn set_value(this: &DeviceProximityEventInit, val: f64); } impl DeviceProximityEventInit { #[doc = "Construct a new `DeviceProximityEventInit`."] @@ -32,46 +80,34 @@ impl DeviceProximityEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `max` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_max()` instead."] pub fn max(&mut self, val: f64) -> &mut Self { - self.max_shim(val); + self.set_max(val); self } - #[doc = "Change the `min` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_min()` instead."] pub fn min(&mut self, val: f64) -> &mut Self { - self.min_shim(val); + self.set_min(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceProximityEventInit`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: f64) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs b/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs index 5f8cf0a712a..84272777672 100644 --- a/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs +++ b/crates/web-sys/src/features/gen_DeviceRotationRateInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] pub type DeviceRotationRateInit; + #[doc = "Get the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &DeviceRotationRateInit) -> Option; + #[doc = "Change the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &DeviceRotationRateInit, val: Option); + pub fn set_alpha(this: &DeviceRotationRateInit, val: Option); + #[doc = "Get the `beta` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[wasm_bindgen(method, getter = "beta")] + pub fn get_beta(this: &DeviceRotationRateInit) -> Option; + #[doc = "Change the `beta` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] #[wasm_bindgen(method, setter = "beta")] - fn beta_shim(this: &DeviceRotationRateInit, val: Option); + pub fn set_beta(this: &DeviceRotationRateInit, val: Option); + #[doc = "Get the `gamma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[wasm_bindgen(method, getter = "gamma")] + pub fn get_gamma(this: &DeviceRotationRateInit) -> Option; + #[doc = "Change the `gamma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] #[wasm_bindgen(method, setter = "gamma")] - fn gamma_shim(this: &DeviceRotationRateInit, val: Option); + pub fn set_gamma(this: &DeviceRotationRateInit, val: Option); } impl DeviceRotationRateInit { #[doc = "Construct a new `DeviceRotationRateInit`."] @@ -26,25 +50,19 @@ impl DeviceRotationRateInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `alpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[deprecated = "Use `set_alpha()` instead."] pub fn alpha(&mut self, val: Option) -> &mut Self { - self.alpha_shim(val); + self.set_alpha(val); self } - #[doc = "Change the `beta` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[deprecated = "Use `set_beta()` instead."] pub fn beta(&mut self, val: Option) -> &mut Self { - self.beta_shim(val); + self.set_beta(val); self } - #[doc = "Change the `gamma` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DeviceRotationRateInit`*"] + #[deprecated = "Use `set_gamma()` instead."] pub fn gamma(&mut self, val: Option) -> &mut Self { - self.gamma_shim(val); + self.set_gamma(val); self } } diff --git a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs index a72d6f55817..323ac4159d7 100644 --- a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] pub type DhKeyDeriveParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &DhKeyDeriveParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &DhKeyDeriveParams, val: &str); + pub fn set_name(this: &DhKeyDeriveParams, val: &str); #[cfg(feature = "CryptoKey")] + #[doc = "Get the `public` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `DhKeyDeriveParams`*"] + #[wasm_bindgen(method, getter = "public")] + pub fn get_public(this: &DhKeyDeriveParams) -> CryptoKey; + #[cfg(feature = "CryptoKey")] + #[doc = "Change the `public` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `DhKeyDeriveParams`*"] #[wasm_bindgen(method, setter = "public")] - fn public_shim(this: &DhKeyDeriveParams, val: &CryptoKey); + pub fn set_public(this: &DhKeyDeriveParams, val: &CryptoKey); } impl DhKeyDeriveParams { #[cfg(feature = "CryptoKey")] @@ -28,19 +45,15 @@ impl DhKeyDeriveParams { ret.public(public); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "CryptoKey")] - #[doc = "Change the `public` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `DhKeyDeriveParams`*"] + #[deprecated = "Use `set_public()` instead."] pub fn public(&mut self, val: &CryptoKey) -> &mut Self { - self.public_shim(val); + self.set_public(val); self } } diff --git a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs index 5abcb4cedb6..ba0c9ee0569 100644 --- a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs +++ b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type DirectoryPickerOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &DirectoryPickerOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &DirectoryPickerOptions, val: &str); + pub fn set_id(this: &DirectoryPickerOptions, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &DirectoryPickerOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &DirectoryPickerOptions, val: FileSystemPermissionMode); + pub fn set_mode(this: &DirectoryPickerOptions, val: FileSystemPermissionMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startIn")] + pub fn get_start_in(this: &DirectoryPickerOptions) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "startIn")] - fn start_in_shim(this: &DirectoryPickerOptions, val: &::wasm_bindgen::JsValue); + pub fn set_start_in(this: &DirectoryPickerOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl DirectoryPickerOptions { @@ -36,37 +85,22 @@ impl DirectoryPickerOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`, `FileSystemPermissionMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `startIn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DirectoryPickerOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_start_in()` instead."] pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.start_in_shim(val); + self.set_start_in(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs b/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs index 993d493b46d..814a1279c88 100644 --- a/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs +++ b/crates/web-sys/src/features/gen_DisplayMediaStreamConstraints.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] pub type DisplayMediaStreamConstraints; + #[doc = "Get the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "audio")] + pub fn get_audio(this: &DisplayMediaStreamConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "audio")] - fn audio_shim(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_audio(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "video")] + pub fn get_video(this: &DisplayMediaStreamConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "video")] - fn video_shim(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_video(this: &DisplayMediaStreamConstraints, val: &::wasm_bindgen::JsValue); } impl DisplayMediaStreamConstraints { #[doc = "Construct a new `DisplayMediaStreamConstraints`."] @@ -24,18 +40,14 @@ impl DisplayMediaStreamConstraints { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `audio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] + #[deprecated = "Use `set_audio()` instead."] pub fn audio(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.audio_shim(val); + self.set_audio(val); self } - #[doc = "Change the `video` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayMediaStreamConstraints`*"] + #[deprecated = "Use `set_video()` instead."] pub fn video(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.video_shim(val); + self.set_video(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayNameOptions.rs b/crates/web-sys/src/features/gen_DisplayNameOptions.rs index bddb9923a34..837d9ecad1a 100644 --- a/crates/web-sys/src/features/gen_DisplayNameOptions.rs +++ b/crates/web-sys/src/features/gen_DisplayNameOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] pub type DisplayNameOptions; + #[doc = "Get the `keys` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] + #[wasm_bindgen(method, getter = "keys")] + pub fn get_keys(this: &DisplayNameOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `keys` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] #[wasm_bindgen(method, setter = "keys")] - fn keys_shim(this: &DisplayNameOptions, val: &::wasm_bindgen::JsValue); + pub fn set_keys(this: &DisplayNameOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] + #[wasm_bindgen(method, getter = "style")] + pub fn get_style(this: &DisplayNameOptions) -> Option; + #[doc = "Change the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] #[wasm_bindgen(method, setter = "style")] - fn style_shim(this: &DisplayNameOptions, val: &str); + pub fn set_style(this: &DisplayNameOptions, val: &str); } impl DisplayNameOptions { #[doc = "Construct a new `DisplayNameOptions`."] @@ -24,18 +40,14 @@ impl DisplayNameOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `keys` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] + #[deprecated = "Use `set_keys()` instead."] pub fn keys(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.keys_shim(val); + self.set_keys(val); self } - #[doc = "Change the `style` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] + #[deprecated = "Use `set_style()` instead."] pub fn style(&mut self, val: &str) -> &mut Self { - self.style_shim(val); + self.set_style(val); self } } diff --git a/crates/web-sys/src/features/gen_DisplayNameResult.rs b/crates/web-sys/src/features/gen_DisplayNameResult.rs index fcee8ccffb2..bfb8507ddd5 100644 --- a/crates/web-sys/src/features/gen_DisplayNameResult.rs +++ b/crates/web-sys/src/features/gen_DisplayNameResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] pub type DisplayNameResult; + #[doc = "Get the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[wasm_bindgen(method, getter = "locale")] + pub fn get_locale(this: &DisplayNameResult) -> Option; + #[doc = "Change the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] #[wasm_bindgen(method, setter = "locale")] - fn locale_shim(this: &DisplayNameResult, val: &str); + pub fn set_locale(this: &DisplayNameResult, val: &str); + #[doc = "Get the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[wasm_bindgen(method, getter = "style")] + pub fn get_style(this: &DisplayNameResult) -> Option; + #[doc = "Change the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] #[wasm_bindgen(method, setter = "style")] - fn style_shim(this: &DisplayNameResult, val: &str); + pub fn set_style(this: &DisplayNameResult, val: &str); } impl DisplayNameResult { #[doc = "Construct a new `DisplayNameResult`."] @@ -24,18 +40,14 @@ impl DisplayNameResult { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `locale` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[deprecated = "Use `set_locale()` instead."] pub fn locale(&mut self, val: &str) -> &mut Self { - self.locale_shim(val); + self.set_locale(val); self } - #[doc = "Change the `style` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[deprecated = "Use `set_style()` instead."] pub fn style(&mut self, val: &str) -> &mut Self { - self.style_shim(val); + self.set_style(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsCacheDict.rs b/crates/web-sys/src/features/gen_DnsCacheDict.rs index e16b2c6b833..a6467078f67 100644 --- a/crates/web-sys/src/features/gen_DnsCacheDict.rs +++ b/crates/web-sys/src/features/gen_DnsCacheDict.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] pub type DnsCacheDict; + #[doc = "Get the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] + #[wasm_bindgen(method, getter = "entries")] + pub fn get_entries(this: &DnsCacheDict) -> Option<::js_sys::Array>; + #[doc = "Change the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] #[wasm_bindgen(method, setter = "entries")] - fn entries_shim(this: &DnsCacheDict, val: &::wasm_bindgen::JsValue); + pub fn set_entries(this: &DnsCacheDict, val: &::wasm_bindgen::JsValue); } impl DnsCacheDict { #[doc = "Construct a new `DnsCacheDict`."] @@ -22,11 +30,9 @@ impl DnsCacheDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `entries` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheDict`*"] + #[deprecated = "Use `set_entries()` instead."] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.entries_shim(val); + self.set_entries(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsCacheEntry.rs b/crates/web-sys/src/features/gen_DnsCacheEntry.rs index ad86c2a5b0e..54d837685fc 100644 --- a/crates/web-sys/src/features/gen_DnsCacheEntry.rs +++ b/crates/web-sys/src/features/gen_DnsCacheEntry.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] pub type DnsCacheEntry; + #[doc = "Get the `expiration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[wasm_bindgen(method, getter = "expiration")] + pub fn get_expiration(this: &DnsCacheEntry) -> Option; + #[doc = "Change the `expiration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, setter = "expiration")] - fn expiration_shim(this: &DnsCacheEntry, val: f64); + pub fn set_expiration(this: &DnsCacheEntry, val: f64); + #[doc = "Get the `family` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[wasm_bindgen(method, getter = "family")] + pub fn get_family(this: &DnsCacheEntry) -> Option; + #[doc = "Change the `family` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, setter = "family")] - fn family_shim(this: &DnsCacheEntry, val: &str); + pub fn set_family(this: &DnsCacheEntry, val: &str); + #[doc = "Get the `hostaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[wasm_bindgen(method, getter = "hostaddr")] + pub fn get_hostaddr(this: &DnsCacheEntry) -> Option<::js_sys::Array>; + #[doc = "Change the `hostaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, setter = "hostaddr")] - fn hostaddr_shim(this: &DnsCacheEntry, val: &::wasm_bindgen::JsValue); + pub fn set_hostaddr(this: &DnsCacheEntry, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `hostname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[wasm_bindgen(method, getter = "hostname")] + pub fn get_hostname(this: &DnsCacheEntry) -> Option; + #[doc = "Change the `hostname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, setter = "hostname")] - fn hostname_shim(this: &DnsCacheEntry, val: &str); + pub fn set_hostname(this: &DnsCacheEntry, val: &str); + #[doc = "Get the `trr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[wasm_bindgen(method, getter = "trr")] + pub fn get_trr(this: &DnsCacheEntry) -> Option; + #[doc = "Change the `trr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, setter = "trr")] - fn trr_shim(this: &DnsCacheEntry, val: bool); + pub fn set_trr(this: &DnsCacheEntry, val: bool); } impl DnsCacheEntry { #[doc = "Construct a new `DnsCacheEntry`."] @@ -30,39 +70,29 @@ impl DnsCacheEntry { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `expiration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[deprecated = "Use `set_expiration()` instead."] pub fn expiration(&mut self, val: f64) -> &mut Self { - self.expiration_shim(val); + self.set_expiration(val); self } - #[doc = "Change the `family` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[deprecated = "Use `set_family()` instead."] pub fn family(&mut self, val: &str) -> &mut Self { - self.family_shim(val); + self.set_family(val); self } - #[doc = "Change the `hostaddr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[deprecated = "Use `set_hostaddr()` instead."] pub fn hostaddr(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hostaddr_shim(val); + self.set_hostaddr(val); self } - #[doc = "Change the `hostname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[deprecated = "Use `set_hostname()` instead."] pub fn hostname(&mut self, val: &str) -> &mut Self { - self.hostname_shim(val); + self.set_hostname(val); self } - #[doc = "Change the `trr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] + #[deprecated = "Use `set_trr()` instead."] pub fn trr(&mut self, val: bool) -> &mut Self { - self.trr_shim(val); + self.set_trr(val); self } } diff --git a/crates/web-sys/src/features/gen_DnsLookupDict.rs b/crates/web-sys/src/features/gen_DnsLookupDict.rs index 22e646160e8..3a40b3dac60 100644 --- a/crates/web-sys/src/features/gen_DnsLookupDict.rs +++ b/crates/web-sys/src/features/gen_DnsLookupDict.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] pub type DnsLookupDict; + #[doc = "Get the `address` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[wasm_bindgen(method, getter = "address")] + pub fn get_address(this: &DnsLookupDict) -> Option<::js_sys::Array>; + #[doc = "Change the `address` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] #[wasm_bindgen(method, setter = "address")] - fn address_shim(this: &DnsLookupDict, val: &::wasm_bindgen::JsValue); + pub fn set_address(this: &DnsLookupDict, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `answer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[wasm_bindgen(method, getter = "answer")] + pub fn get_answer(this: &DnsLookupDict) -> Option; + #[doc = "Change the `answer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] #[wasm_bindgen(method, setter = "answer")] - fn answer_shim(this: &DnsLookupDict, val: bool); + pub fn set_answer(this: &DnsLookupDict, val: bool); + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &DnsLookupDict) -> Option; + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &DnsLookupDict, val: &str); + pub fn set_error(this: &DnsLookupDict, val: &str); } impl DnsLookupDict { #[doc = "Construct a new `DnsLookupDict`."] @@ -26,25 +50,19 @@ impl DnsLookupDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `address` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[deprecated = "Use `set_address()` instead."] pub fn address(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.address_shim(val); + self.set_address(val); self } - #[doc = "Change the `answer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[deprecated = "Use `set_answer()` instead."] pub fn answer(&mut self, val: bool) -> &mut Self { - self.answer_shim(val); + self.set_answer(val); self } - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &str) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } } diff --git a/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs b/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs index 5cbf8c1a181..116bf1075b7 100644 --- a/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs +++ b/crates/web-sys/src/features/gen_DocumentTimelineOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] pub type DocumentTimelineOptions; + #[doc = "Get the `originTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] + #[wasm_bindgen(method, getter = "originTime")] + pub fn get_origin_time(this: &DocumentTimelineOptions) -> Option; + #[doc = "Change the `originTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] #[wasm_bindgen(method, setter = "originTime")] - fn origin_time_shim(this: &DocumentTimelineOptions, val: f64); + pub fn set_origin_time(this: &DocumentTimelineOptions, val: f64); } impl DocumentTimelineOptions { #[doc = "Construct a new `DocumentTimelineOptions`."] @@ -22,11 +30,9 @@ impl DocumentTimelineOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `originTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DocumentTimelineOptions`*"] + #[deprecated = "Use `set_origin_time()` instead."] pub fn origin_time(&mut self, val: f64) -> &mut Self { - self.origin_time_shim(val); + self.set_origin_time(val); self } } diff --git a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs index d93e11a0eb9..b3ca99c9931 100644 --- a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs +++ b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs @@ -10,30 +10,126 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] pub type DomMatrix2dInit; + #[doc = "Get the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "a")] + pub fn get_a(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "a")] - fn a_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_a(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "b")] + pub fn get_b(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "b")] - fn b_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_b(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "c")] + pub fn get_c(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "c")] - fn c_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_c(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "d")] + pub fn get_d(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "d")] - fn d_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_d(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "e")] + pub fn get_e(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "e")] - fn e_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_e(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "f")] + pub fn get_f(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "f")] - fn f_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_f(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m11")] + pub fn get_m11(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m11")] - fn m11_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m11(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m12")] + pub fn get_m12(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m12")] - fn m12_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m12(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m21")] + pub fn get_m21(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m21")] - fn m21_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m21(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m22")] + pub fn get_m22(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m22")] - fn m22_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m22(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m41")] + pub fn get_m41(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m41")] - fn m41_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m41(this: &DomMatrix2dInit, val: f64); + #[doc = "Get the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[wasm_bindgen(method, getter = "m42")] + pub fn get_m42(this: &DomMatrix2dInit) -> Option; + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] #[wasm_bindgen(method, setter = "m42")] - fn m42_shim(this: &DomMatrix2dInit, val: f64); + pub fn set_m42(this: &DomMatrix2dInit, val: f64); } impl DomMatrix2dInit { #[doc = "Construct a new `DomMatrix2dInit`."] @@ -44,88 +140,64 @@ impl DomMatrix2dInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `a` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_a()` instead."] pub fn a(&mut self, val: f64) -> &mut Self { - self.a_shim(val); + self.set_a(val); self } - #[doc = "Change the `b` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_b()` instead."] pub fn b(&mut self, val: f64) -> &mut Self { - self.b_shim(val); + self.set_b(val); self } - #[doc = "Change the `c` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_c()` instead."] pub fn c(&mut self, val: f64) -> &mut Self { - self.c_shim(val); + self.set_c(val); self } - #[doc = "Change the `d` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_d()` instead."] pub fn d(&mut self, val: f64) -> &mut Self { - self.d_shim(val); + self.set_d(val); self } - #[doc = "Change the `e` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_e()` instead."] pub fn e(&mut self, val: f64) -> &mut Self { - self.e_shim(val); + self.set_e(val); self } - #[doc = "Change the `f` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_f()` instead."] pub fn f(&mut self, val: f64) -> &mut Self { - self.f_shim(val); + self.set_f(val); self } - #[doc = "Change the `m11` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m11()` instead."] pub fn m11(&mut self, val: f64) -> &mut Self { - self.m11_shim(val); + self.set_m11(val); self } - #[doc = "Change the `m12` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m12()` instead."] pub fn m12(&mut self, val: f64) -> &mut Self { - self.m12_shim(val); + self.set_m12(val); self } - #[doc = "Change the `m21` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m21()` instead."] pub fn m21(&mut self, val: f64) -> &mut Self { - self.m21_shim(val); + self.set_m21(val); self } - #[doc = "Change the `m22` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m22()` instead."] pub fn m22(&mut self, val: f64) -> &mut Self { - self.m22_shim(val); + self.set_m22(val); self } - #[doc = "Change the `m41` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m41()` instead."] pub fn m41(&mut self, val: f64) -> &mut Self { - self.m41_shim(val); + self.set_m41(val); self } - #[doc = "Change the `m42` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + #[deprecated = "Use `set_m42()` instead."] pub fn m42(&mut self, val: f64) -> &mut Self { - self.m42_shim(val); + self.set_m42(val); self } } diff --git a/crates/web-sys/src/features/gen_DomMatrixInit.rs b/crates/web-sys/src/features/gen_DomMatrixInit.rs index f1dbe993864..15809896dd0 100644 --- a/crates/web-sys/src/features/gen_DomMatrixInit.rs +++ b/crates/web-sys/src/features/gen_DomMatrixInit.rs @@ -10,52 +10,236 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] pub type DomMatrixInit; + #[doc = "Get the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "a")] + pub fn get_a(this: &DomMatrixInit) -> Option; + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "a")] - fn a_shim(this: &DomMatrixInit, val: f64); + pub fn set_a(this: &DomMatrixInit, val: f64); + #[doc = "Get the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "b")] + pub fn get_b(this: &DomMatrixInit) -> Option; + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "b")] - fn b_shim(this: &DomMatrixInit, val: f64); + pub fn set_b(this: &DomMatrixInit, val: f64); + #[doc = "Get the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "c")] + pub fn get_c(this: &DomMatrixInit) -> Option; + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "c")] - fn c_shim(this: &DomMatrixInit, val: f64); + pub fn set_c(this: &DomMatrixInit, val: f64); + #[doc = "Get the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "d")] + pub fn get_d(this: &DomMatrixInit) -> Option; + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "d")] - fn d_shim(this: &DomMatrixInit, val: f64); + pub fn set_d(this: &DomMatrixInit, val: f64); + #[doc = "Get the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "e")] + pub fn get_e(this: &DomMatrixInit) -> Option; + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "e")] - fn e_shim(this: &DomMatrixInit, val: f64); + pub fn set_e(this: &DomMatrixInit, val: f64); + #[doc = "Get the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "f")] + pub fn get_f(this: &DomMatrixInit) -> Option; + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "f")] - fn f_shim(this: &DomMatrixInit, val: f64); + pub fn set_f(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m11")] + pub fn get_m11(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m11")] - fn m11_shim(this: &DomMatrixInit, val: f64); + pub fn set_m11(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m12")] + pub fn get_m12(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m12")] - fn m12_shim(this: &DomMatrixInit, val: f64); + pub fn set_m12(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m21")] + pub fn get_m21(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m21")] - fn m21_shim(this: &DomMatrixInit, val: f64); + pub fn set_m21(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m22")] + pub fn get_m22(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m22")] - fn m22_shim(this: &DomMatrixInit, val: f64); + pub fn set_m22(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m41")] + pub fn get_m41(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m41")] - fn m41_shim(this: &DomMatrixInit, val: f64); + pub fn set_m41(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m42")] + pub fn get_m42(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m42")] - fn m42_shim(this: &DomMatrixInit, val: f64); + pub fn set_m42(this: &DomMatrixInit, val: f64); + #[doc = "Get the `is2D` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "is2D")] + pub fn get_is_2d(this: &DomMatrixInit) -> Option; + #[doc = "Change the `is2D` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "is2D")] - fn is_2d_shim(this: &DomMatrixInit, val: bool); + pub fn set_is_2d(this: &DomMatrixInit, val: bool); + #[doc = "Get the `m13` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m13")] + pub fn get_m13(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m13` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m13")] - fn m13_shim(this: &DomMatrixInit, val: f64); + pub fn set_m13(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m14` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m14")] + pub fn get_m14(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m14` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m14")] - fn m14_shim(this: &DomMatrixInit, val: f64); + pub fn set_m14(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m23` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m23")] + pub fn get_m23(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m23` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m23")] - fn m23_shim(this: &DomMatrixInit, val: f64); + pub fn set_m23(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m24` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m24")] + pub fn get_m24(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m24` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m24")] - fn m24_shim(this: &DomMatrixInit, val: f64); + pub fn set_m24(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m31` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m31")] + pub fn get_m31(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m31` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m31")] - fn m31_shim(this: &DomMatrixInit, val: f64); + pub fn set_m31(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m32` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m32")] + pub fn get_m32(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m32` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m32")] - fn m32_shim(this: &DomMatrixInit, val: f64); + pub fn set_m32(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m33` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m33")] + pub fn get_m33(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m33` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m33")] - fn m33_shim(this: &DomMatrixInit, val: f64); + pub fn set_m33(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m34` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m34")] + pub fn get_m34(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m34` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m34")] - fn m34_shim(this: &DomMatrixInit, val: f64); + pub fn set_m34(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m43` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m43")] + pub fn get_m43(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m43` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m43")] - fn m43_shim(this: &DomMatrixInit, val: f64); + pub fn set_m43(this: &DomMatrixInit, val: f64); + #[doc = "Get the `m44` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[wasm_bindgen(method, getter = "m44")] + pub fn get_m44(this: &DomMatrixInit) -> Option; + #[doc = "Change the `m44` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] #[wasm_bindgen(method, setter = "m44")] - fn m44_shim(this: &DomMatrixInit, val: f64); + pub fn set_m44(this: &DomMatrixInit, val: f64); } impl DomMatrixInit { #[doc = "Construct a new `DomMatrixInit`."] @@ -66,165 +250,119 @@ impl DomMatrixInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `a` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_a()` instead."] pub fn a(&mut self, val: f64) -> &mut Self { - self.a_shim(val); + self.set_a(val); self } - #[doc = "Change the `b` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_b()` instead."] pub fn b(&mut self, val: f64) -> &mut Self { - self.b_shim(val); + self.set_b(val); self } - #[doc = "Change the `c` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_c()` instead."] pub fn c(&mut self, val: f64) -> &mut Self { - self.c_shim(val); + self.set_c(val); self } - #[doc = "Change the `d` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_d()` instead."] pub fn d(&mut self, val: f64) -> &mut Self { - self.d_shim(val); + self.set_d(val); self } - #[doc = "Change the `e` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_e()` instead."] pub fn e(&mut self, val: f64) -> &mut Self { - self.e_shim(val); + self.set_e(val); self } - #[doc = "Change the `f` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_f()` instead."] pub fn f(&mut self, val: f64) -> &mut Self { - self.f_shim(val); + self.set_f(val); self } - #[doc = "Change the `m11` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m11()` instead."] pub fn m11(&mut self, val: f64) -> &mut Self { - self.m11_shim(val); + self.set_m11(val); self } - #[doc = "Change the `m12` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m12()` instead."] pub fn m12(&mut self, val: f64) -> &mut Self { - self.m12_shim(val); + self.set_m12(val); self } - #[doc = "Change the `m21` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m21()` instead."] pub fn m21(&mut self, val: f64) -> &mut Self { - self.m21_shim(val); + self.set_m21(val); self } - #[doc = "Change the `m22` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m22()` instead."] pub fn m22(&mut self, val: f64) -> &mut Self { - self.m22_shim(val); + self.set_m22(val); self } - #[doc = "Change the `m41` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m41()` instead."] pub fn m41(&mut self, val: f64) -> &mut Self { - self.m41_shim(val); + self.set_m41(val); self } - #[doc = "Change the `m42` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m42()` instead."] pub fn m42(&mut self, val: f64) -> &mut Self { - self.m42_shim(val); + self.set_m42(val); self } - #[doc = "Change the `is2D` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_is_2d()` instead."] pub fn is_2d(&mut self, val: bool) -> &mut Self { - self.is_2d_shim(val); + self.set_is_2d(val); self } - #[doc = "Change the `m13` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m13()` instead."] pub fn m13(&mut self, val: f64) -> &mut Self { - self.m13_shim(val); + self.set_m13(val); self } - #[doc = "Change the `m14` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m14()` instead."] pub fn m14(&mut self, val: f64) -> &mut Self { - self.m14_shim(val); + self.set_m14(val); self } - #[doc = "Change the `m23` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m23()` instead."] pub fn m23(&mut self, val: f64) -> &mut Self { - self.m23_shim(val); + self.set_m23(val); self } - #[doc = "Change the `m24` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m24()` instead."] pub fn m24(&mut self, val: f64) -> &mut Self { - self.m24_shim(val); + self.set_m24(val); self } - #[doc = "Change the `m31` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m31()` instead."] pub fn m31(&mut self, val: f64) -> &mut Self { - self.m31_shim(val); + self.set_m31(val); self } - #[doc = "Change the `m32` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m32()` instead."] pub fn m32(&mut self, val: f64) -> &mut Self { - self.m32_shim(val); + self.set_m32(val); self } - #[doc = "Change the `m33` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m33()` instead."] pub fn m33(&mut self, val: f64) -> &mut Self { - self.m33_shim(val); + self.set_m33(val); self } - #[doc = "Change the `m34` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m34()` instead."] pub fn m34(&mut self, val: f64) -> &mut Self { - self.m34_shim(val); + self.set_m34(val); self } - #[doc = "Change the `m43` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m43()` instead."] pub fn m43(&mut self, val: f64) -> &mut Self { - self.m43_shim(val); + self.set_m43(val); self } - #[doc = "Change the `m44` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + #[deprecated = "Use `set_m44()` instead."] pub fn m44(&mut self, val: f64) -> &mut Self { - self.m44_shim(val); + self.set_m44(val); self } } diff --git a/crates/web-sys/src/features/gen_DomPointInit.rs b/crates/web-sys/src/features/gen_DomPointInit.rs index 37f3064eb47..b5f58ae1fb0 100644 --- a/crates/web-sys/src/features/gen_DomPointInit.rs +++ b/crates/web-sys/src/features/gen_DomPointInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] pub type DomPointInit; + #[doc = "Get the `w` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[wasm_bindgen(method, getter = "w")] + pub fn get_w(this: &DomPointInit) -> Option; + #[doc = "Change the `w` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] #[wasm_bindgen(method, setter = "w")] - fn w_shim(this: &DomPointInit, val: f64); + pub fn set_w(this: &DomPointInit, val: f64); + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &DomPointInit) -> Option; + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &DomPointInit, val: f64); + pub fn set_x(this: &DomPointInit, val: f64); + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &DomPointInit) -> Option; + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &DomPointInit, val: f64); + pub fn set_y(this: &DomPointInit, val: f64); + #[doc = "Get the `z` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[wasm_bindgen(method, getter = "z")] + pub fn get_z(this: &DomPointInit) -> Option; + #[doc = "Change the `z` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] #[wasm_bindgen(method, setter = "z")] - fn z_shim(this: &DomPointInit, val: f64); + pub fn set_z(this: &DomPointInit, val: f64); } impl DomPointInit { #[doc = "Construct a new `DomPointInit`."] @@ -28,32 +60,24 @@ impl DomPointInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `w` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[deprecated = "Use `set_w()` instead."] pub fn w(&mut self, val: f64) -> &mut Self { - self.w_shim(val); + self.set_w(val); self } - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: f64) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: f64) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } - #[doc = "Change the `z` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`*"] + #[deprecated = "Use `set_z()` instead."] pub fn z(&mut self, val: f64) -> &mut Self { - self.z_shim(val); + self.set_z(val); self } } diff --git a/crates/web-sys/src/features/gen_DomQuadInit.rs b/crates/web-sys/src/features/gen_DomQuadInit.rs index b9af8996627..113f80350e0 100644 --- a/crates/web-sys/src/features/gen_DomQuadInit.rs +++ b/crates/web-sys/src/features/gen_DomQuadInit.rs @@ -11,17 +11,53 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `DomQuadInit`*"] pub type DomQuadInit; #[cfg(feature = "DomPointInit")] + #[doc = "Get the `p1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[wasm_bindgen(method, getter = "p1")] + pub fn get_p1(this: &DomQuadInit) -> Option; + #[cfg(feature = "DomPointInit")] + #[doc = "Change the `p1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] #[wasm_bindgen(method, setter = "p1")] - fn p1_shim(this: &DomQuadInit, val: &DomPointInit); + pub fn set_p1(this: &DomQuadInit, val: &DomPointInit); + #[cfg(feature = "DomPointInit")] + #[doc = "Get the `p2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[wasm_bindgen(method, getter = "p2")] + pub fn get_p2(this: &DomQuadInit) -> Option; #[cfg(feature = "DomPointInit")] + #[doc = "Change the `p2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] #[wasm_bindgen(method, setter = "p2")] - fn p2_shim(this: &DomQuadInit, val: &DomPointInit); + pub fn set_p2(this: &DomQuadInit, val: &DomPointInit); #[cfg(feature = "DomPointInit")] + #[doc = "Get the `p3` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[wasm_bindgen(method, getter = "p3")] + pub fn get_p3(this: &DomQuadInit) -> Option; + #[cfg(feature = "DomPointInit")] + #[doc = "Change the `p3` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] #[wasm_bindgen(method, setter = "p3")] - fn p3_shim(this: &DomQuadInit, val: &DomPointInit); + pub fn set_p3(this: &DomQuadInit, val: &DomPointInit); #[cfg(feature = "DomPointInit")] + #[doc = "Get the `p4` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[wasm_bindgen(method, getter = "p4")] + pub fn get_p4(this: &DomQuadInit) -> Option; + #[cfg(feature = "DomPointInit")] + #[doc = "Change the `p4` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] #[wasm_bindgen(method, setter = "p4")] - fn p4_shim(this: &DomQuadInit, val: &DomPointInit); + pub fn set_p4(this: &DomQuadInit, val: &DomPointInit); } impl DomQuadInit { #[doc = "Construct a new `DomQuadInit`."] @@ -33,35 +69,27 @@ impl DomQuadInit { ret } #[cfg(feature = "DomPointInit")] - #[doc = "Change the `p1` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[deprecated = "Use `set_p1()` instead."] pub fn p1(&mut self, val: &DomPointInit) -> &mut Self { - self.p1_shim(val); + self.set_p1(val); self } #[cfg(feature = "DomPointInit")] - #[doc = "Change the `p2` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[deprecated = "Use `set_p2()` instead."] pub fn p2(&mut self, val: &DomPointInit) -> &mut Self { - self.p2_shim(val); + self.set_p2(val); self } #[cfg(feature = "DomPointInit")] - #[doc = "Change the `p3` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[deprecated = "Use `set_p3()` instead."] pub fn p3(&mut self, val: &DomPointInit) -> &mut Self { - self.p3_shim(val); + self.set_p3(val); self } #[cfg(feature = "DomPointInit")] - #[doc = "Change the `p4` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPointInit`, `DomQuadInit`*"] + #[deprecated = "Use `set_p4()` instead."] pub fn p4(&mut self, val: &DomPointInit) -> &mut Self { - self.p4_shim(val); + self.set_p4(val); self } } diff --git a/crates/web-sys/src/features/gen_DomQuadJson.rs b/crates/web-sys/src/features/gen_DomQuadJson.rs index d02f9daa85d..2bba1e24bd7 100644 --- a/crates/web-sys/src/features/gen_DomQuadJson.rs +++ b/crates/web-sys/src/features/gen_DomQuadJson.rs @@ -11,17 +11,53 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `DomQuadJson`*"] pub type DomQuadJson; #[cfg(feature = "DomPoint")] + #[doc = "Get the `p1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[wasm_bindgen(method, getter = "p1")] + pub fn get_p1(this: &DomQuadJson) -> Option; + #[cfg(feature = "DomPoint")] + #[doc = "Change the `p1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] #[wasm_bindgen(method, setter = "p1")] - fn p1_shim(this: &DomQuadJson, val: &DomPoint); + pub fn set_p1(this: &DomQuadJson, val: &DomPoint); + #[cfg(feature = "DomPoint")] + #[doc = "Get the `p2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[wasm_bindgen(method, getter = "p2")] + pub fn get_p2(this: &DomQuadJson) -> Option; #[cfg(feature = "DomPoint")] + #[doc = "Change the `p2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] #[wasm_bindgen(method, setter = "p2")] - fn p2_shim(this: &DomQuadJson, val: &DomPoint); + pub fn set_p2(this: &DomQuadJson, val: &DomPoint); #[cfg(feature = "DomPoint")] + #[doc = "Get the `p3` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[wasm_bindgen(method, getter = "p3")] + pub fn get_p3(this: &DomQuadJson) -> Option; + #[cfg(feature = "DomPoint")] + #[doc = "Change the `p3` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] #[wasm_bindgen(method, setter = "p3")] - fn p3_shim(this: &DomQuadJson, val: &DomPoint); + pub fn set_p3(this: &DomQuadJson, val: &DomPoint); #[cfg(feature = "DomPoint")] + #[doc = "Get the `p4` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[wasm_bindgen(method, getter = "p4")] + pub fn get_p4(this: &DomQuadJson) -> Option; + #[cfg(feature = "DomPoint")] + #[doc = "Change the `p4` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] #[wasm_bindgen(method, setter = "p4")] - fn p4_shim(this: &DomQuadJson, val: &DomPoint); + pub fn set_p4(this: &DomQuadJson, val: &DomPoint); } impl DomQuadJson { #[doc = "Construct a new `DomQuadJson`."] @@ -33,35 +69,27 @@ impl DomQuadJson { ret } #[cfg(feature = "DomPoint")] - #[doc = "Change the `p1` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[deprecated = "Use `set_p1()` instead."] pub fn p1(&mut self, val: &DomPoint) -> &mut Self { - self.p1_shim(val); + self.set_p1(val); self } #[cfg(feature = "DomPoint")] - #[doc = "Change the `p2` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[deprecated = "Use `set_p2()` instead."] pub fn p2(&mut self, val: &DomPoint) -> &mut Self { - self.p2_shim(val); + self.set_p2(val); self } #[cfg(feature = "DomPoint")] - #[doc = "Change the `p3` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[deprecated = "Use `set_p3()` instead."] pub fn p3(&mut self, val: &DomPoint) -> &mut Self { - self.p3_shim(val); + self.set_p3(val); self } #[cfg(feature = "DomPoint")] - #[doc = "Change the `p4` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomPoint`, `DomQuadJson`*"] + #[deprecated = "Use `set_p4()` instead."] pub fn p4(&mut self, val: &DomPoint) -> &mut Self { - self.p4_shim(val); + self.set_p4(val); self } } diff --git a/crates/web-sys/src/features/gen_DomRectInit.rs b/crates/web-sys/src/features/gen_DomRectInit.rs index 2124c443bc8..d02056c5ce2 100644 --- a/crates/web-sys/src/features/gen_DomRectInit.rs +++ b/crates/web-sys/src/features/gen_DomRectInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] pub type DomRectInit; + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &DomRectInit) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &DomRectInit, val: f64); + pub fn set_height(this: &DomRectInit, val: f64); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &DomRectInit) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &DomRectInit, val: f64); + pub fn set_width(this: &DomRectInit, val: f64); + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &DomRectInit) -> Option; + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &DomRectInit, val: f64); + pub fn set_x(this: &DomRectInit, val: f64); + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &DomRectInit) -> Option; + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &DomRectInit, val: f64); + pub fn set_y(this: &DomRectInit, val: f64); } impl DomRectInit { #[doc = "Construct a new `DomRectInit`."] @@ -28,32 +60,24 @@ impl DomRectInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: f64) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: f64) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: f64) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: f64) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } } diff --git a/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs b/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs index 584b0f9acc1..79560ef04a7 100644 --- a/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs +++ b/crates/web-sys/src/features/gen_DomWindowResizeEventDetail.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] pub type DomWindowResizeEventDetail; + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &DomWindowResizeEventDetail) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &DomWindowResizeEventDetail, val: i32); + pub fn set_height(this: &DomWindowResizeEventDetail, val: i32); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &DomWindowResizeEventDetail) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &DomWindowResizeEventDetail, val: i32); + pub fn set_width(this: &DomWindowResizeEventDetail, val: i32); } impl DomWindowResizeEventDetail { #[doc = "Construct a new `DomWindowResizeEventDetail`."] @@ -24,18 +40,14 @@ impl DomWindowResizeEventDetail { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: i32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomWindowResizeEventDetail`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: i32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_DoubleRange.rs b/crates/web-sys/src/features/gen_DoubleRange.rs index 692ef41deff..86a427e7df0 100644 --- a/crates/web-sys/src/features/gen_DoubleRange.rs +++ b/crates/web-sys/src/features/gen_DoubleRange.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type DoubleRange; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "max")] + pub fn get_max(this: &DoubleRange) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "max")] - fn max_shim(this: &DoubleRange, val: f64); + pub fn set_max(this: &DoubleRange, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "min")] + pub fn get_min(this: &DoubleRange) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "min")] - fn min_shim(this: &DoubleRange, val: f64); + pub fn set_min(this: &DoubleRange, val: f64); } #[cfg(web_sys_unstable_apis)] impl DoubleRange { @@ -33,25 +65,15 @@ impl DoubleRange { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `max` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_max()` instead."] pub fn max(&mut self, val: f64) -> &mut Self { - self.max_shim(val); + self.set_max(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `min` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DoubleRange`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_min()` instead."] pub fn min(&mut self, val: f64) -> &mut Self { - self.min_shim(val); + self.set_min(val); self } } diff --git a/crates/web-sys/src/features/gen_DragEventInit.rs b/crates/web-sys/src/features/gen_DragEventInit.rs index 0b50bf3a4b9..0781bdf1322 100644 --- a/crates/web-sys/src/features/gen_DragEventInit.rs +++ b/crates/web-sys/src/features/gen_DragEventInit.rs @@ -10,65 +10,292 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] pub type DragEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &DragEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &DragEventInit, val: bool); + pub fn set_bubbles(this: &DragEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &DragEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &DragEventInit, val: bool); + pub fn set_cancelable(this: &DragEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &DragEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &DragEventInit, val: bool); + pub fn set_composed(this: &DragEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &DragEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &DragEventInit, val: i32); + pub fn set_detail(this: &DragEventInit, val: i32); + #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &DragEventInit) -> Option; #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &DragEventInit, val: Option<&Window>); + pub fn set_view(this: &DragEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &DragEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &DragEventInit, val: bool); + pub fn set_alt_key(this: &DragEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &DragEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &DragEventInit, val: bool); + pub fn set_ctrl_key(this: &DragEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &DragEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &DragEventInit, val: bool); + pub fn set_meta_key(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_fn(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_num_lock(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_os(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_symbol(this: &DragEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &DragEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &DragEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &DragEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &DragEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &DragEventInit, val: bool); + pub fn set_shift_key(this: &DragEventInit, val: bool); + #[doc = "Get the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "button")] + pub fn get_button(this: &DragEventInit) -> Option; + #[doc = "Change the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "button")] - fn button_shim(this: &DragEventInit, val: i16); + pub fn set_button(this: &DragEventInit, val: i16); + #[doc = "Get the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "buttons")] + pub fn get_buttons(this: &DragEventInit) -> Option; + #[doc = "Change the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "buttons")] - fn buttons_shim(this: &DragEventInit, val: u16); + pub fn set_buttons(this: &DragEventInit, val: u16); + #[doc = "Get the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "clientX")] + pub fn get_client_x(this: &DragEventInit) -> Option; + #[doc = "Change the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "clientX")] - fn client_x_shim(this: &DragEventInit, val: i32); + pub fn set_client_x(this: &DragEventInit, val: i32); + #[doc = "Get the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "clientY")] + pub fn get_client_y(this: &DragEventInit) -> Option; + #[doc = "Change the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "clientY")] - fn client_y_shim(this: &DragEventInit, val: i32); + pub fn set_client_y(this: &DragEventInit, val: i32); + #[doc = "Get the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "movementX")] + pub fn get_movement_x(this: &DragEventInit) -> Option; + #[doc = "Change the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "movementX")] - fn movement_x_shim(this: &DragEventInit, val: i32); + pub fn set_movement_x(this: &DragEventInit, val: i32); + #[doc = "Get the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "movementY")] + pub fn get_movement_y(this: &DragEventInit) -> Option; + #[doc = "Change the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "movementY")] - fn movement_y_shim(this: &DragEventInit, val: i32); + pub fn set_movement_y(this: &DragEventInit, val: i32); #[cfg(feature = "EventTarget")] + #[doc = "Get the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `EventTarget`*"] + #[wasm_bindgen(method, getter = "relatedTarget")] + pub fn get_related_target(this: &DragEventInit) -> Option; + #[cfg(feature = "EventTarget")] + #[doc = "Change the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `EventTarget`*"] #[wasm_bindgen(method, setter = "relatedTarget")] - fn related_target_shim(this: &DragEventInit, val: Option<&EventTarget>); + pub fn set_related_target(this: &DragEventInit, val: Option<&EventTarget>); + #[doc = "Get the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "screenX")] + pub fn get_screen_x(this: &DragEventInit) -> Option; + #[doc = "Change the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "screenX")] - fn screen_x_shim(this: &DragEventInit, val: i32); + pub fn set_screen_x(this: &DragEventInit, val: i32); + #[doc = "Get the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[wasm_bindgen(method, getter = "screenY")] + pub fn get_screen_y(this: &DragEventInit) -> Option; + #[doc = "Change the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] #[wasm_bindgen(method, setter = "screenY")] - fn screen_y_shim(this: &DragEventInit, val: i32); + pub fn set_screen_y(this: &DragEventInit, val: i32); + #[cfg(feature = "DataTransfer")] + #[doc = "Get the `dataTransfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `DragEventInit`*"] + #[wasm_bindgen(method, getter = "dataTransfer")] + pub fn get_data_transfer(this: &DragEventInit) -> Option; #[cfg(feature = "DataTransfer")] + #[doc = "Change the `dataTransfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `DragEventInit`*"] #[wasm_bindgen(method, setter = "dataTransfer")] - fn data_transfer_shim(this: &DragEventInit, val: Option<&DataTransfer>); + pub fn set_data_transfer(this: &DragEventInit, val: Option<&DataTransfer>); } impl DragEventInit { #[doc = "Construct a new `DragEventInit`."] @@ -79,203 +306,147 @@ impl DragEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_button()` instead."] pub fn button(&mut self, val: i16) -> &mut Self { - self.button_shim(val); + self.set_button(val); self } - #[doc = "Change the `buttons` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_buttons()` instead."] pub fn buttons(&mut self, val: u16) -> &mut Self { - self.buttons_shim(val); + self.set_buttons(val); self } - #[doc = "Change the `clientX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_client_x()` instead."] pub fn client_x(&mut self, val: i32) -> &mut Self { - self.client_x_shim(val); + self.set_client_x(val); self } - #[doc = "Change the `clientY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_client_y()` instead."] pub fn client_y(&mut self, val: i32) -> &mut Self { - self.client_y_shim(val); + self.set_client_y(val); self } - #[doc = "Change the `movementX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_movement_x()` instead."] pub fn movement_x(&mut self, val: i32) -> &mut Self { - self.movement_x_shim(val); + self.set_movement_x(val); self } - #[doc = "Change the `movementY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_movement_y()` instead."] pub fn movement_y(&mut self, val: i32) -> &mut Self { - self.movement_y_shim(val); + self.set_movement_y(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `relatedTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`, `EventTarget`*"] + #[deprecated = "Use `set_related_target()` instead."] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - self.related_target_shim(val); + self.set_related_target(val); self } - #[doc = "Change the `screenX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_screen_x()` instead."] pub fn screen_x(&mut self, val: i32) -> &mut Self { - self.screen_x_shim(val); + self.set_screen_x(val); self } - #[doc = "Change the `screenY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DragEventInit`*"] + #[deprecated = "Use `set_screen_y()` instead."] pub fn screen_y(&mut self, val: i32) -> &mut Self { - self.screen_y_shim(val); + self.set_screen_y(val); self } #[cfg(feature = "DataTransfer")] - #[doc = "Change the `dataTransfer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `DragEventInit`*"] + #[deprecated = "Use `set_data_transfer()` instead."] pub fn data_transfer(&mut self, val: Option<&DataTransfer>) -> &mut Self { - self.data_transfer_shim(val); + self.set_data_transfer(val); self } } diff --git a/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs b/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs index 494ed0224eb..dfd8201207c 100644 --- a/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs +++ b/crates/web-sys/src/features/gen_DynamicsCompressorOptions.rs @@ -10,24 +10,92 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] pub type DynamicsCompressorOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &DynamicsCompressorOptions, val: u32); + pub fn set_channel_count(this: &DynamicsCompressorOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &DynamicsCompressorOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &DynamicsCompressorOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &DynamicsCompressorOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation( + this: &DynamicsCompressorOptions, + ) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &DynamicsCompressorOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &DynamicsCompressorOptions, val: ChannelInterpretation); + #[doc = "Get the `attack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "attack")] + pub fn get_attack(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `attack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "attack")] - fn attack_shim(this: &DynamicsCompressorOptions, val: f32); + pub fn set_attack(this: &DynamicsCompressorOptions, val: f32); + #[doc = "Get the `knee` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "knee")] + pub fn get_knee(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `knee` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "knee")] - fn knee_shim(this: &DynamicsCompressorOptions, val: f32); + pub fn set_knee(this: &DynamicsCompressorOptions, val: f32); + #[doc = "Get the `ratio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "ratio")] + pub fn get_ratio(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `ratio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "ratio")] - fn ratio_shim(this: &DynamicsCompressorOptions, val: f32); + pub fn set_ratio(this: &DynamicsCompressorOptions, val: f32); + #[doc = "Get the `release` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "release")] + pub fn get_release(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `release` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "release")] - fn release_shim(this: &DynamicsCompressorOptions, val: f32); + pub fn set_release(this: &DynamicsCompressorOptions, val: f32); + #[doc = "Get the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[wasm_bindgen(method, getter = "threshold")] + pub fn get_threshold(this: &DynamicsCompressorOptions) -> Option; + #[doc = "Change the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] #[wasm_bindgen(method, setter = "threshold")] - fn threshold_shim(this: &DynamicsCompressorOptions, val: f32); + pub fn set_threshold(this: &DynamicsCompressorOptions, val: f32); } impl DynamicsCompressorOptions { #[doc = "Construct a new `DynamicsCompressorOptions`."] @@ -38,62 +106,46 @@ impl DynamicsCompressorOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `attack` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_attack()` instead."] pub fn attack(&mut self, val: f32) -> &mut Self { - self.attack_shim(val); + self.set_attack(val); self } - #[doc = "Change the `knee` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_knee()` instead."] pub fn knee(&mut self, val: f32) -> &mut Self { - self.knee_shim(val); + self.set_knee(val); self } - #[doc = "Change the `ratio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_ratio()` instead."] pub fn ratio(&mut self, val: f32) -> &mut Self { - self.ratio_shim(val); + self.set_ratio(val); self } - #[doc = "Change the `release` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_release()` instead."] pub fn release(&mut self, val: f32) -> &mut Self { - self.release_shim(val); + self.set_release(val); self } - #[doc = "Change the `threshold` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DynamicsCompressorOptions`*"] + #[deprecated = "Use `set_threshold()` instead."] pub fn threshold(&mut self, val: f32) -> &mut Self { - self.threshold_shim(val); + self.set_threshold(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs index 82ca2870a12..e45951c04b1 100644 --- a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] pub type EcKeyAlgorithm; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &EcKeyAlgorithm) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &EcKeyAlgorithm, val: &str); + pub fn set_name(this: &EcKeyAlgorithm, val: &str); + #[doc = "Get the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "namedCurve")] + pub fn get_named_curve(this: &EcKeyAlgorithm) -> String; + #[doc = "Change the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "namedCurve")] - fn named_curve_shim(this: &EcKeyAlgorithm, val: &str); + pub fn set_named_curve(this: &EcKeyAlgorithm, val: &str); } impl EcKeyAlgorithm { #[doc = "Construct a new `EcKeyAlgorithm`."] @@ -26,18 +42,14 @@ impl EcKeyAlgorithm { ret.named_curve(named_curve); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `namedCurve` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] + #[deprecated = "Use `set_named_curve()` instead."] pub fn named_curve(&mut self, val: &str) -> &mut Self { - self.named_curve_shim(val); + self.set_named_curve(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyGenParams.rs b/crates/web-sys/src/features/gen_EcKeyGenParams.rs index 08ffc99e257..8992f7851b3 100644 --- a/crates/web-sys/src/features/gen_EcKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyGenParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] pub type EcKeyGenParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &EcKeyGenParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &EcKeyGenParams, val: &str); + pub fn set_name(this: &EcKeyGenParams, val: &str); + #[doc = "Get the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] + #[wasm_bindgen(method, getter = "namedCurve")] + pub fn get_named_curve(this: &EcKeyGenParams) -> String; + #[doc = "Change the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] #[wasm_bindgen(method, setter = "namedCurve")] - fn named_curve_shim(this: &EcKeyGenParams, val: &str); + pub fn set_named_curve(this: &EcKeyGenParams, val: &str); } impl EcKeyGenParams { #[doc = "Construct a new `EcKeyGenParams`."] @@ -26,18 +42,14 @@ impl EcKeyGenParams { ret.named_curve(named_curve); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `namedCurve` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] + #[deprecated = "Use `set_named_curve()` instead."] pub fn named_curve(&mut self, val: &str) -> &mut Self { - self.named_curve_shim(val); + self.set_named_curve(val); self } } diff --git a/crates/web-sys/src/features/gen_EcKeyImportParams.rs b/crates/web-sys/src/features/gen_EcKeyImportParams.rs index 512dee8819d..ed789023459 100644 --- a/crates/web-sys/src/features/gen_EcKeyImportParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyImportParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] pub type EcKeyImportParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &EcKeyImportParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &EcKeyImportParams, val: &str); + pub fn set_name(this: &EcKeyImportParams, val: &str); + #[doc = "Get the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] + #[wasm_bindgen(method, getter = "namedCurve")] + pub fn get_named_curve(this: &EcKeyImportParams) -> Option; + #[doc = "Change the `namedCurve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] #[wasm_bindgen(method, setter = "namedCurve")] - fn named_curve_shim(this: &EcKeyImportParams, val: &str); + pub fn set_named_curve(this: &EcKeyImportParams, val: &str); } impl EcKeyImportParams { #[doc = "Construct a new `EcKeyImportParams`."] @@ -25,18 +41,14 @@ impl EcKeyImportParams { ret.name(name); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `namedCurve` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] + #[deprecated = "Use `set_named_curve()` instead."] pub fn named_curve(&mut self, val: &str) -> &mut Self { - self.named_curve_shim(val); + self.set_named_curve(val); self } } diff --git a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs index c01ec76a8e2..a061a19b0ec 100644 --- a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] pub type EcdhKeyDeriveParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &EcdhKeyDeriveParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &EcdhKeyDeriveParams, val: &str); + pub fn set_name(this: &EcdhKeyDeriveParams, val: &str); #[cfg(feature = "CryptoKey")] + #[doc = "Get the `public` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `EcdhKeyDeriveParams`*"] + #[wasm_bindgen(method, getter = "public")] + pub fn get_public(this: &EcdhKeyDeriveParams) -> CryptoKey; + #[cfg(feature = "CryptoKey")] + #[doc = "Change the `public` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `EcdhKeyDeriveParams`*"] #[wasm_bindgen(method, setter = "public")] - fn public_shim(this: &EcdhKeyDeriveParams, val: &CryptoKey); + pub fn set_public(this: &EcdhKeyDeriveParams, val: &CryptoKey); } impl EcdhKeyDeriveParams { #[cfg(feature = "CryptoKey")] @@ -28,19 +45,15 @@ impl EcdhKeyDeriveParams { ret.public(public); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "CryptoKey")] - #[doc = "Change the `public` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `EcdhKeyDeriveParams`*"] + #[deprecated = "Use `set_public()` instead."] pub fn public(&mut self, val: &CryptoKey) -> &mut Self { - self.public_shim(val); + self.set_public(val); self } } diff --git a/crates/web-sys/src/features/gen_EcdsaParams.rs b/crates/web-sys/src/features/gen_EcdsaParams.rs index bfc9fe093fc..14fe80e857b 100644 --- a/crates/web-sys/src/features/gen_EcdsaParams.rs +++ b/crates/web-sys/src/features/gen_EcdsaParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] pub type EcdsaParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &EcdsaParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &EcdsaParams, val: &str); + pub fn set_name(this: &EcdsaParams, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &EcdsaParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &EcdsaParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &EcdsaParams, val: &::wasm_bindgen::JsValue); } impl EcdsaParams { #[doc = "Construct a new `EcdsaParams`."] @@ -26,18 +42,14 @@ impl EcdsaParams { ret.hash(hash); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } } diff --git a/crates/web-sys/src/features/gen_EffectTiming.rs b/crates/web-sys/src/features/gen_EffectTiming.rs index cd1b84ecfb7..7a43b7a75c0 100644 --- a/crates/web-sys/src/features/gen_EffectTiming.rs +++ b/crates/web-sys/src/features/gen_EffectTiming.rs @@ -10,24 +10,90 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] pub type EffectTiming; + #[doc = "Get the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &EffectTiming) -> Option; + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &EffectTiming, val: f64); + pub fn set_delay(this: &EffectTiming, val: f64); #[cfg(feature = "PlaybackDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `PlaybackDirection`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &EffectTiming) -> Option; + #[cfg(feature = "PlaybackDirection")] + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `PlaybackDirection`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &EffectTiming, val: PlaybackDirection); + pub fn set_direction(this: &EffectTiming, val: PlaybackDirection); + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &EffectTiming) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &EffectTiming, val: &::wasm_bindgen::JsValue); + pub fn set_duration(this: &EffectTiming, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &EffectTiming) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &EffectTiming, val: &str); + pub fn set_easing(this: &EffectTiming, val: &str); + #[doc = "Get the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "endDelay")] + pub fn get_end_delay(this: &EffectTiming) -> Option; + #[doc = "Change the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "endDelay")] - fn end_delay_shim(this: &EffectTiming, val: f64); + pub fn set_end_delay(this: &EffectTiming, val: f64); + #[cfg(feature = "FillMode")] + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `FillMode`*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &EffectTiming) -> Option; #[cfg(feature = "FillMode")] + #[doc = "Change the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `FillMode`*"] #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &EffectTiming, val: FillMode); + pub fn set_fill(this: &EffectTiming, val: FillMode); + #[doc = "Get the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "iterationStart")] + pub fn get_iteration_start(this: &EffectTiming) -> Option; + #[doc = "Change the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "iterationStart")] - fn iteration_start_shim(this: &EffectTiming, val: f64); + pub fn set_iteration_start(this: &EffectTiming, val: f64); + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &EffectTiming) -> Option; + #[doc = "Change the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &EffectTiming, val: f64); + pub fn set_iterations(this: &EffectTiming, val: f64); } impl EffectTiming { #[doc = "Construct a new `EffectTiming`."] @@ -38,62 +104,46 @@ impl EffectTiming { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `delay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_delay()` instead."] pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); + self.set_delay(val); self } #[cfg(feature = "PlaybackDirection")] - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `PlaybackDirection`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `endDelay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_end_delay()` instead."] pub fn end_delay(&mut self, val: f64) -> &mut Self { - self.end_delay_shim(val); + self.set_end_delay(val); self } #[cfg(feature = "FillMode")] - #[doc = "Change the `fill` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`, `FillMode`*"] + #[deprecated = "Use `set_fill()` instead."] pub fn fill(&mut self, val: FillMode) -> &mut Self { - self.fill_shim(val); + self.set_fill(val); self } - #[doc = "Change the `iterationStart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_iteration_start()` instead."] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - self.iteration_start_shim(val); + self.set_iteration_start(val); self } - #[doc = "Change the `iterations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] + #[deprecated = "Use `set_iterations()` instead."] pub fn iterations(&mut self, val: f64) -> &mut Self { - self.iterations_shim(val); + self.set_iterations(val); self } } diff --git a/crates/web-sys/src/features/gen_ElementCreationOptions.rs b/crates/web-sys/src/features/gen_ElementCreationOptions.rs index 59bd3c85d11..d9d29bca20d 100644 --- a/crates/web-sys/src/features/gen_ElementCreationOptions.rs +++ b/crates/web-sys/src/features/gen_ElementCreationOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] pub type ElementCreationOptions; + #[doc = "Get the `is` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] + #[wasm_bindgen(method, getter = "is")] + pub fn get_is(this: &ElementCreationOptions) -> Option; + #[doc = "Change the `is` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] #[wasm_bindgen(method, setter = "is")] - fn is_shim(this: &ElementCreationOptions, val: &str); + pub fn set_is(this: &ElementCreationOptions, val: &str); + #[doc = "Get the `pseudo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] + #[wasm_bindgen(method, getter = "pseudo")] + pub fn get_pseudo(this: &ElementCreationOptions) -> Option; + #[doc = "Change the `pseudo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] #[wasm_bindgen(method, setter = "pseudo")] - fn pseudo_shim(this: &ElementCreationOptions, val: &str); + pub fn set_pseudo(this: &ElementCreationOptions, val: &str); } impl ElementCreationOptions { #[doc = "Construct a new `ElementCreationOptions`."] @@ -24,18 +40,14 @@ impl ElementCreationOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `is` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] + #[deprecated = "Use `set_is()` instead."] pub fn is(&mut self, val: &str) -> &mut Self { - self.is_shim(val); + self.set_is(val); self } - #[doc = "Change the `pseudo` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] + #[deprecated = "Use `set_pseudo()` instead."] pub fn pseudo(&mut self, val: &str) -> &mut Self { - self.pseudo_shim(val); + self.set_pseudo(val); self } } diff --git a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs index 0c551a1c06f..086ab7bc6d3 100644 --- a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs +++ b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] pub type ElementDefinitionOptions; + #[doc = "Get the `extends` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] + #[wasm_bindgen(method, getter = "extends")] + pub fn get_extends(this: &ElementDefinitionOptions) -> Option; + #[doc = "Change the `extends` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] #[wasm_bindgen(method, setter = "extends")] - fn extends_shim(this: &ElementDefinitionOptions, val: &str); + pub fn set_extends(this: &ElementDefinitionOptions, val: &str); } impl ElementDefinitionOptions { #[doc = "Construct a new `ElementDefinitionOptions`."] @@ -22,11 +30,9 @@ impl ElementDefinitionOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `extends` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] + #[deprecated = "Use `set_extends()` instead."] pub fn extends(&mut self, val: &str) -> &mut Self { - self.extends_shim(val); + self.set_extends(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs index 089dd9bb426..76b491edc45 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedAudioChunkInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &EncodedAudioChunkInit) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &EncodedAudioChunkInit, val: &::js_sys::Object); + pub fn set_data(this: &EncodedAudioChunkInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &EncodedAudioChunkInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &EncodedAudioChunkInit, val: f64); + pub fn set_duration(this: &EncodedAudioChunkInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &EncodedAudioChunkInit) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &EncodedAudioChunkInit, val: f64); + pub fn set_timestamp(this: &EncodedAudioChunkInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "EncodedAudioChunkType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &EncodedAudioChunkInit) -> EncodedAudioChunkType; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedAudioChunkType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &EncodedAudioChunkInit, val: EncodedAudioChunkType); + pub fn set_type(this: &EncodedAudioChunkInit, val: EncodedAudioChunkType); } #[cfg(web_sys_unstable_apis)] impl EncodedAudioChunkInit { @@ -42,48 +107,28 @@ impl EncodedAudioChunkInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedAudioChunkType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: EncodedAudioChunkType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs b/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs index a5da12d42dd..b90551f9051 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunkMetadata.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedAudioChunkMetadata; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioDecoderConfig")] + #[doc = "Get the `decoderConfig` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `EncodedAudioChunkMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "decoderConfig")] + pub fn get_decoder_config(this: &EncodedAudioChunkMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDecoderConfig")] + #[doc = "Change the `decoderConfig` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `EncodedAudioChunkMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "decoderConfig")] - fn decoder_config_shim(this: &EncodedAudioChunkMetadata, val: &AudioDecoderConfig); + pub fn set_decoder_config(this: &EncodedAudioChunkMetadata, val: &AudioDecoderConfig); } #[cfg(web_sys_unstable_apis)] impl EncodedAudioChunkMetadata { @@ -33,14 +50,9 @@ impl EncodedAudioChunkMetadata { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AudioDecoderConfig")] - #[doc = "Change the `decoderConfig` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`, `EncodedAudioChunkMetadata`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_decoder_config()` instead."] pub fn decoder_config(&mut self, val: &AudioDecoderConfig) -> &mut Self { - self.decoder_config_shim(val); + self.set_decoder_config(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs index 7d8da29fee1..1e523952822 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedVideoChunkInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &EncodedVideoChunkInit) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &EncodedVideoChunkInit, val: &::js_sys::Object); + pub fn set_data(this: &EncodedVideoChunkInit, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &EncodedVideoChunkInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &EncodedVideoChunkInit, val: f64); + pub fn set_duration(this: &EncodedVideoChunkInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &EncodedVideoChunkInit) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &EncodedVideoChunkInit, val: f64); + pub fn set_timestamp(this: &EncodedVideoChunkInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "EncodedVideoChunkType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`, `EncodedVideoChunkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &EncodedVideoChunkInit) -> EncodedVideoChunkType; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedVideoChunkType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`, `EncodedVideoChunkType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &EncodedVideoChunkInit, val: EncodedVideoChunkType); + pub fn set_type(this: &EncodedVideoChunkInit, val: EncodedVideoChunkType); } #[cfg(web_sys_unstable_apis)] impl EncodedVideoChunkInit { @@ -42,48 +107,28 @@ impl EncodedVideoChunkInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "EncodedVideoChunkType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkInit`, `EncodedVideoChunkType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: EncodedVideoChunkType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs b/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs index 354fb8dc070..640832b426b 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunkMetadata.rs @@ -14,14 +14,64 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type EncodedVideoChunkMetadata; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `alphaSideData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "alphaSideData")] + pub fn get_alpha_side_data(this: &EncodedVideoChunkMetadata) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `alphaSideData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "alphaSideData")] - fn alpha_side_data_shim(this: &EncodedVideoChunkMetadata, val: &::js_sys::Object); + pub fn set_alpha_side_data(this: &EncodedVideoChunkMetadata, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoDecoderConfig")] + #[doc = "Get the `decoderConfig` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "decoderConfig")] + pub fn get_decoder_config(this: &EncodedVideoChunkMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoDecoderConfig")] + #[doc = "Change the `decoderConfig` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "decoderConfig")] - fn decoder_config_shim(this: &EncodedVideoChunkMetadata, val: &VideoDecoderConfig); + pub fn set_decoder_config(this: &EncodedVideoChunkMetadata, val: &VideoDecoderConfig); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "SvcOutputMetadata")] + #[doc = "Get the `svc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `SvcOutputMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "svc")] + pub fn get_svc(this: &EncodedVideoChunkMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SvcOutputMetadata")] + #[doc = "Change the `svc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `SvcOutputMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "svc")] - fn svc_shim(this: &EncodedVideoChunkMetadata, val: &SvcOutputMetadata); + pub fn set_svc(this: &EncodedVideoChunkMetadata, val: &SvcOutputMetadata); } #[cfg(web_sys_unstable_apis)] impl EncodedVideoChunkMetadata { @@ -37,38 +87,23 @@ impl EncodedVideoChunkMetadata { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `alphaSideData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_alpha_side_data()` instead."] pub fn alpha_side_data(&mut self, val: &::js_sys::Object) -> &mut Self { - self.alpha_side_data_shim(val); + self.set_alpha_side_data(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoDecoderConfig")] - #[doc = "Change the `decoderConfig` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `VideoDecoderConfig`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_decoder_config()` instead."] pub fn decoder_config(&mut self, val: &VideoDecoderConfig) -> &mut Self { - self.decoder_config_shim(val); + self.set_decoder_config(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "SvcOutputMetadata")] - #[doc = "Change the `svc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunkMetadata`, `SvcOutputMetadata`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_svc()` instead."] pub fn svc(&mut self, val: &SvcOutputMetadata) -> &mut Self { - self.svc_shim(val); + self.set_svc(val); self } } diff --git a/crates/web-sys/src/features/gen_ErrorCallback.rs b/crates/web-sys/src/features/gen_ErrorCallback.rs index e14346d2eae..7ca32ff496f 100644 --- a/crates/web-sys/src/features/gen_ErrorCallback.rs +++ b/crates/web-sys/src/features/gen_ErrorCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] pub type ErrorCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &ErrorCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &ErrorCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &ErrorCallback, val: &::js_sys::Function); } impl ErrorCallback { #[doc = "Construct a new `ErrorCallback`."] @@ -22,11 +30,9 @@ impl ErrorCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_ErrorEventInit.rs b/crates/web-sys/src/features/gen_ErrorEventInit.rs index 42369ecc8a4..da240ac4c11 100644 --- a/crates/web-sys/src/features/gen_ErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_ErrorEventInit.rs @@ -10,22 +10,86 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] pub type ErrorEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ErrorEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ErrorEventInit, val: bool); + pub fn set_bubbles(this: &ErrorEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ErrorEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ErrorEventInit, val: bool); + pub fn set_cancelable(this: &ErrorEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ErrorEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ErrorEventInit, val: bool); + pub fn set_composed(this: &ErrorEventInit, val: bool); + #[doc = "Get the `colno` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "colno")] + pub fn get_colno(this: &ErrorEventInit) -> Option; + #[doc = "Change the `colno` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "colno")] - fn colno_shim(this: &ErrorEventInit, val: u32); + pub fn set_colno(this: &ErrorEventInit, val: u32); + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &ErrorEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &ErrorEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_error(this: &ErrorEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "filename")] + pub fn get_filename(this: &ErrorEventInit) -> Option; + #[doc = "Change the `filename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "filename")] - fn filename_shim(this: &ErrorEventInit, val: &str); + pub fn set_filename(this: &ErrorEventInit, val: &str); + #[doc = "Get the `lineno` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "lineno")] + pub fn get_lineno(this: &ErrorEventInit) -> Option; + #[doc = "Change the `lineno` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "lineno")] - fn lineno_shim(this: &ErrorEventInit, val: u32); + pub fn set_lineno(this: &ErrorEventInit, val: u32); + #[doc = "Get the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[wasm_bindgen(method, getter = "message")] + pub fn get_message(this: &ErrorEventInit) -> Option; + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, setter = "message")] - fn message_shim(this: &ErrorEventInit, val: &str); + pub fn set_message(this: &ErrorEventInit, val: &str); } impl ErrorEventInit { #[doc = "Construct a new `ErrorEventInit`."] @@ -36,60 +100,44 @@ impl ErrorEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `colno` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_colno()` instead."] pub fn colno(&mut self, val: u32) -> &mut Self { - self.colno_shim(val); + self.set_colno(val); self } - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } - #[doc = "Change the `filename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_filename()` instead."] pub fn filename(&mut self, val: &str) -> &mut Self { - self.filename_shim(val); + self.set_filename(val); self } - #[doc = "Change the `lineno` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_lineno()` instead."] pub fn lineno(&mut self, val: u32) -> &mut Self { - self.lineno_shim(val); + self.set_lineno(val); self } - #[doc = "Change the `message` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] + #[deprecated = "Use `set_message()` instead."] pub fn message(&mut self, val: &str) -> &mut Self { - self.message_shim(val); + self.set_message(val); self } } diff --git a/crates/web-sys/src/features/gen_EventInit.rs b/crates/web-sys/src/features/gen_EventInit.rs index de8e524324e..218f4c21e47 100644 --- a/crates/web-sys/src/features/gen_EventInit.rs +++ b/crates/web-sys/src/features/gen_EventInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] pub type EventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &EventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &EventInit, val: bool); + pub fn set_bubbles(this: &EventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &EventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &EventInit, val: bool); + pub fn set_cancelable(this: &EventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &EventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &EventInit, val: bool); + pub fn set_composed(this: &EventInit, val: bool); } impl EventInit { #[doc = "Construct a new `EventInit`."] @@ -26,25 +50,19 @@ impl EventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_EventListener.rs b/crates/web-sys/src/features/gen_EventListener.rs index 8a17381cb56..20b2ba07407 100644 --- a/crates/web-sys/src/features/gen_EventListener.rs +++ b/crates/web-sys/src/features/gen_EventListener.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] pub type EventListener; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &EventListener) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &EventListener, val: &::js_sys::Function); + pub fn set_handle_event(this: &EventListener, val: &::js_sys::Function); } impl EventListener { #[doc = "Construct a new `EventListener`."] @@ -22,11 +30,9 @@ impl EventListener { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventListener`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_EventListenerOptions.rs b/crates/web-sys/src/features/gen_EventListenerOptions.rs index 05b771d7084..521069c5617 100644 --- a/crates/web-sys/src/features/gen_EventListenerOptions.rs +++ b/crates/web-sys/src/features/gen_EventListenerOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] pub type EventListenerOptions; + #[doc = "Get the `capture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] + #[wasm_bindgen(method, getter = "capture")] + pub fn get_capture(this: &EventListenerOptions) -> Option; + #[doc = "Change the `capture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] #[wasm_bindgen(method, setter = "capture")] - fn capture_shim(this: &EventListenerOptions, val: bool); + pub fn set_capture(this: &EventListenerOptions, val: bool); } impl EventListenerOptions { #[doc = "Construct a new `EventListenerOptions`."] @@ -22,11 +30,9 @@ impl EventListenerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `capture` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventListenerOptions`*"] + #[deprecated = "Use `set_capture()` instead."] pub fn capture(&mut self, val: bool) -> &mut Self { - self.capture_shim(val); + self.set_capture(val); self } } diff --git a/crates/web-sys/src/features/gen_EventModifierInit.rs b/crates/web-sys/src/features/gen_EventModifierInit.rs index 373609a21ec..1e19e648c12 100644 --- a/crates/web-sys/src/features/gen_EventModifierInit.rs +++ b/crates/web-sys/src/features/gen_EventModifierInit.rs @@ -10,43 +10,188 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] pub type EventModifierInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &EventModifierInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &EventModifierInit, val: bool); + pub fn set_bubbles(this: &EventModifierInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &EventModifierInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &EventModifierInit, val: bool); + pub fn set_cancelable(this: &EventModifierInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &EventModifierInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &EventModifierInit, val: bool); + pub fn set_composed(this: &EventModifierInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &EventModifierInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &EventModifierInit, val: i32); + pub fn set_detail(this: &EventModifierInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &EventModifierInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &EventModifierInit, val: Option<&Window>); + pub fn set_view(this: &EventModifierInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &EventModifierInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &EventModifierInit, val: bool); + pub fn set_alt_key(this: &EventModifierInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &EventModifierInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &EventModifierInit, val: bool); + pub fn set_ctrl_key(this: &EventModifierInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &EventModifierInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &EventModifierInit, val: bool); + pub fn set_meta_key(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_alt_graph(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_caps_lock(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_fn(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_fn_lock(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_num_lock(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_os(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_scroll_lock(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_symbol(this: &EventModifierInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &EventModifierInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &EventModifierInit, val: bool); + pub fn set_modifier_symbol_lock(this: &EventModifierInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &EventModifierInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &EventModifierInit, val: bool); + pub fn set_shift_key(this: &EventModifierInit, val: bool); } impl EventModifierInit { #[doc = "Construct a new `EventModifierInit`."] @@ -57,131 +202,95 @@ impl EventModifierInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventModifierInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } } diff --git a/crates/web-sys/src/features/gen_EventSourceInit.rs b/crates/web-sys/src/features/gen_EventSourceInit.rs index 61761803dee..24afbe7a88b 100644 --- a/crates/web-sys/src/features/gen_EventSourceInit.rs +++ b/crates/web-sys/src/features/gen_EventSourceInit.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] pub type EventSourceInit; + #[doc = "Get the `withCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] + #[wasm_bindgen(method, getter = "withCredentials")] + pub fn get_with_credentials(this: &EventSourceInit) -> Option; + #[doc = "Change the `withCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] #[wasm_bindgen(method, setter = "withCredentials")] - fn with_credentials_shim(this: &EventSourceInit, val: bool); + pub fn set_with_credentials(this: &EventSourceInit, val: bool); } impl EventSourceInit { #[doc = "Construct a new `EventSourceInit`."] @@ -22,11 +30,9 @@ impl EventSourceInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `withCredentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventSourceInit`*"] + #[deprecated = "Use `set_with_credentials()` instead."] pub fn with_credentials(&mut self, val: bool) -> &mut Self { - self.with_credentials_shim(val); + self.set_with_credentials(val); self } } diff --git a/crates/web-sys/src/features/gen_ExtendableEventInit.rs b/crates/web-sys/src/features/gen_ExtendableEventInit.rs index 1dbc56a64f7..5d701d27c82 100644 --- a/crates/web-sys/src/features/gen_ExtendableEventInit.rs +++ b/crates/web-sys/src/features/gen_ExtendableEventInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] pub type ExtendableEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ExtendableEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ExtendableEventInit, val: bool); + pub fn set_bubbles(this: &ExtendableEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ExtendableEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ExtendableEventInit, val: bool); + pub fn set_cancelable(this: &ExtendableEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ExtendableEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ExtendableEventInit, val: bool); + pub fn set_composed(this: &ExtendableEventInit, val: bool); } impl ExtendableEventInit { #[doc = "Construct a new `ExtendableEventInit`."] @@ -26,25 +50,19 @@ impl ExtendableEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs index 32c11651574..745d1f041f8 100644 --- a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs @@ -10,22 +10,86 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] pub type ExtendableMessageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ExtendableMessageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ExtendableMessageEventInit, val: bool); + pub fn set_bubbles(this: &ExtendableMessageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ExtendableMessageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ExtendableMessageEventInit, val: bool); + pub fn set_cancelable(this: &ExtendableMessageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ExtendableMessageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ExtendableMessageEventInit, val: bool); + pub fn set_composed(this: &ExtendableMessageEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &ExtendableMessageEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `lastEventId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "lastEventId")] + pub fn get_last_event_id(this: &ExtendableMessageEventInit) -> Option; + #[doc = "Change the `lastEventId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "lastEventId")] - fn last_event_id_shim(this: &ExtendableMessageEventInit, val: &str); + pub fn set_last_event_id(this: &ExtendableMessageEventInit, val: &str); + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &ExtendableMessageEventInit) -> Option; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &ExtendableMessageEventInit, val: &str); + pub fn set_origin(this: &ExtendableMessageEventInit, val: &str); + #[doc = "Get the `ports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "ports")] + pub fn get_ports(this: &ExtendableMessageEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `ports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "ports")] - fn ports_shim(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_ports(this: &ExtendableMessageEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &ExtendableMessageEventInit) -> Option<::js_sys::Object>; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &ExtendableMessageEventInit, val: Option<&::js_sys::Object>); + pub fn set_source(this: &ExtendableMessageEventInit, val: Option<&::js_sys::Object>); } impl ExtendableMessageEventInit { #[doc = "Construct a new `ExtendableMessageEventInit`."] @@ -36,60 +100,44 @@ impl ExtendableMessageEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } - #[doc = "Change the `lastEventId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_last_event_id()` instead."] pub fn last_event_id(&mut self, val: &str) -> &mut Self { - self.last_event_id_shim(val); + self.set_last_event_id(val); self } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &str) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `ports` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_ports()` instead."] pub fn ports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ports_shim(val); + self.set_ports(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs index 2d3e8407ce1..f1209b12a9e 100644 --- a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs +++ b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] pub type FakePluginMimeEntry; + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &FakePluginMimeEntry) -> Option; + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &FakePluginMimeEntry, val: &str); + pub fn set_description(this: &FakePluginMimeEntry, val: &str); + #[doc = "Get the `extension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[wasm_bindgen(method, getter = "extension")] + pub fn get_extension(this: &FakePluginMimeEntry) -> Option; + #[doc = "Change the `extension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, setter = "extension")] - fn extension_shim(this: &FakePluginMimeEntry, val: &str); + pub fn set_extension(this: &FakePluginMimeEntry, val: &str); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &FakePluginMimeEntry) -> String; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &FakePluginMimeEntry, val: &str); + pub fn set_type(this: &FakePluginMimeEntry, val: &str); } impl FakePluginMimeEntry { #[doc = "Construct a new `FakePluginMimeEntry`."] @@ -27,25 +51,19 @@ impl FakePluginMimeEntry { ret.type_(type_); ret } - #[doc = "Change the `description` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &str) -> &mut Self { - self.description_shim(val); + self.set_description(val); self } - #[doc = "Change the `extension` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[deprecated = "Use `set_extension()` instead."] pub fn extension(&mut self, val: &str) -> &mut Self { - self.extension_shim(val); + self.set_extension(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_FakePluginTagInit.rs b/crates/web-sys/src/features/gen_FakePluginTagInit.rs index 83d998c2dde..43ab5067c1a 100644 --- a/crates/web-sys/src/features/gen_FakePluginTagInit.rs +++ b/crates/web-sys/src/features/gen_FakePluginTagInit.rs @@ -10,24 +10,96 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] pub type FakePluginTagInit; + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &FakePluginTagInit, val: &str); + pub fn set_description(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `fileName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "fileName")] + pub fn get_file_name(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `fileName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "fileName")] - fn file_name_shim(this: &FakePluginTagInit, val: &str); + pub fn set_file_name(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `fullPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "fullPath")] + pub fn get_full_path(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `fullPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "fullPath")] - fn full_path_shim(this: &FakePluginTagInit, val: &str); + pub fn set_full_path(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `handlerURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "handlerURI")] + pub fn get_handler_uri(this: &FakePluginTagInit) -> String; + #[doc = "Change the `handlerURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "handlerURI")] - fn handler_uri_shim(this: &FakePluginTagInit, val: &str); + pub fn set_handler_uri(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `mimeEntries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "mimeEntries")] + pub fn get_mime_entries(this: &FakePluginTagInit) -> ::js_sys::Array; + #[doc = "Change the `mimeEntries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "mimeEntries")] - fn mime_entries_shim(this: &FakePluginTagInit, val: &::wasm_bindgen::JsValue); + pub fn set_mime_entries(this: &FakePluginTagInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &FakePluginTagInit, val: &str); + pub fn set_name(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `niceName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "niceName")] + pub fn get_nice_name(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `niceName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "niceName")] - fn nice_name_shim(this: &FakePluginTagInit, val: &str); + pub fn set_nice_name(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `sandboxScript` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "sandboxScript")] + pub fn get_sandbox_script(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `sandboxScript` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "sandboxScript")] - fn sandbox_script_shim(this: &FakePluginTagInit, val: &str); + pub fn set_sandbox_script(this: &FakePluginTagInit, val: &str); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &FakePluginTagInit) -> Option; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &FakePluginTagInit, val: &str); + pub fn set_version(this: &FakePluginTagInit, val: &str); } impl FakePluginTagInit { #[doc = "Construct a new `FakePluginTagInit`."] @@ -40,67 +112,49 @@ impl FakePluginTagInit { ret.mime_entries(mime_entries); ret } - #[doc = "Change the `description` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &str) -> &mut Self { - self.description_shim(val); + self.set_description(val); self } - #[doc = "Change the `fileName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_file_name()` instead."] pub fn file_name(&mut self, val: &str) -> &mut Self { - self.file_name_shim(val); + self.set_file_name(val); self } - #[doc = "Change the `fullPath` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_full_path()` instead."] pub fn full_path(&mut self, val: &str) -> &mut Self { - self.full_path_shim(val); + self.set_full_path(val); self } - #[doc = "Change the `handlerURI` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_handler_uri()` instead."] pub fn handler_uri(&mut self, val: &str) -> &mut Self { - self.handler_uri_shim(val); + self.set_handler_uri(val); self } - #[doc = "Change the `mimeEntries` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_mime_entries()` instead."] pub fn mime_entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.mime_entries_shim(val); + self.set_mime_entries(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `niceName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_nice_name()` instead."] pub fn nice_name(&mut self, val: &str) -> &mut Self { - self.nice_name_shim(val); + self.set_nice_name(val); self } - #[doc = "Change the `sandboxScript` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_sandbox_script()` instead."] pub fn sandbox_script(&mut self, val: &str) -> &mut Self { - self.sandbox_script_shim(val); + self.set_sandbox_script(val); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_FetchEventInit.rs b/crates/web-sys/src/features/gen_FetchEventInit.rs index 4259035f3d0..0041cb59450 100644 --- a/crates/web-sys/src/features/gen_FetchEventInit.rs +++ b/crates/web-sys/src/features/gen_FetchEventInit.rs @@ -10,19 +10,68 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] pub type FetchEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &FetchEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &FetchEventInit, val: bool); + pub fn set_bubbles(this: &FetchEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &FetchEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &FetchEventInit, val: bool); + pub fn set_cancelable(this: &FetchEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &FetchEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &FetchEventInit, val: bool); + pub fn set_composed(this: &FetchEventInit, val: bool); + #[doc = "Get the `clientId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[wasm_bindgen(method, getter = "clientId")] + pub fn get_client_id(this: &FetchEventInit) -> Option; + #[doc = "Change the `clientId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, setter = "clientId")] - fn client_id_shim(this: &FetchEventInit, val: Option<&str>); + pub fn set_client_id(this: &FetchEventInit, val: Option<&str>); + #[doc = "Get the `isReload` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[wasm_bindgen(method, getter = "isReload")] + pub fn get_is_reload(this: &FetchEventInit) -> Option; + #[doc = "Change the `isReload` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, setter = "isReload")] - fn is_reload_shim(this: &FetchEventInit, val: bool); + pub fn set_is_reload(this: &FetchEventInit, val: bool); #[cfg(feature = "Request")] + #[doc = "Get the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`, `Request`*"] + #[wasm_bindgen(method, getter = "request")] + pub fn get_request(this: &FetchEventInit) -> Request; + #[cfg(feature = "Request")] + #[doc = "Change the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`, `Request`*"] #[wasm_bindgen(method, setter = "request")] - fn request_shim(this: &FetchEventInit, val: &Request); + pub fn set_request(this: &FetchEventInit, val: &Request); } impl FetchEventInit { #[cfg(feature = "Request")] @@ -35,47 +84,35 @@ impl FetchEventInit { ret.request(request); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `clientId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[deprecated = "Use `set_client_id()` instead."] pub fn client_id(&mut self, val: Option<&str>) -> &mut Self { - self.client_id_shim(val); + self.set_client_id(val); self } - #[doc = "Change the `isReload` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] + #[deprecated = "Use `set_is_reload()` instead."] pub fn is_reload(&mut self, val: bool) -> &mut Self { - self.is_reload_shim(val); + self.set_is_reload(val); self } #[cfg(feature = "Request")] - #[doc = "Change the `request` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`, `Request`*"] + #[deprecated = "Use `set_request()` instead."] pub fn request(&mut self, val: &Request) -> &mut Self { - self.request_shim(val); + self.set_request(val); self } } diff --git a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs index 3205e8c2b0b..04e2c6e4040 100644 --- a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs +++ b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataDone.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] pub type FetchReadableStreamReadDataDone; + #[doc = "Get the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] + #[wasm_bindgen(method, getter = "done")] + pub fn get_done(this: &FetchReadableStreamReadDataDone) -> Option; + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] #[wasm_bindgen(method, setter = "done")] - fn done_shim(this: &FetchReadableStreamReadDataDone, val: bool); + pub fn set_done(this: &FetchReadableStreamReadDataDone, val: bool); } impl FetchReadableStreamReadDataDone { #[doc = "Construct a new `FetchReadableStreamReadDataDone`."] @@ -22,11 +30,9 @@ impl FetchReadableStreamReadDataDone { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataDone`*"] + #[deprecated = "Use `set_done()` instead."] pub fn done(&mut self, val: bool) -> &mut Self { - self.done_shim(val); + self.set_done(val); self } } diff --git a/crates/web-sys/src/features/gen_FileCallback.rs b/crates/web-sys/src/features/gen_FileCallback.rs index 17beb74983c..3aa94c60949 100644 --- a/crates/web-sys/src/features/gen_FileCallback.rs +++ b/crates/web-sys/src/features/gen_FileCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] pub type FileCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &FileCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &FileCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &FileCallback, val: &::js_sys::Function); } impl FileCallback { #[doc = "Construct a new `FileCallback`."] @@ -22,11 +30,9 @@ impl FileCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs index 196fd6f0a79..f969507a01c 100644 --- a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs +++ b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FilePickerAcceptType; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &FilePickerAcceptType) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &FilePickerAcceptType, val: &str); + pub fn set_description(this: &FilePickerAcceptType, val: &str); } #[cfg(web_sys_unstable_apis)] impl FilePickerAcceptType { @@ -31,14 +47,9 @@ impl FilePickerAcceptType { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `description` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &str) -> &mut Self { - self.description_shim(val); + self.set_description(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePickerOptions.rs b/crates/web-sys/src/features/gen_FilePickerOptions.rs index 639ead2b1ea..deb857f4ce4 100644 --- a/crates/web-sys/src/features/gen_FilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_FilePickerOptions.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FilePickerOptions; - #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] - fn exclude_accept_all_option_shim(this: &FilePickerOptions, val: bool); - #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &FilePickerOptions, val: &str); - #[wasm_bindgen(method, setter = "startIn")] - fn start_in_shim(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "types")] - fn types_shim(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl FilePickerOptions { - #[doc = "Construct a new `FilePickerOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `excludeAcceptAllOption` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "excludeAcceptAllOption")] + pub fn get_exclude_accept_all_option(this: &FilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `excludeAcceptAllOption` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl FilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - self.exclude_accept_all_option_shim(val); - self - } + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + pub fn set_exclude_accept_all_option(this: &FilePickerOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &FilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl FilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); - self - } + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &FilePickerOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startIn")] + pub fn get_start_in(this: &FilePickerOptions) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `startIn` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl FilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.start_in_shim(val); - self - } + #[wasm_bindgen(method, setter = "startIn")] + pub fn set_start_in(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "types")] + pub fn get_types(this: &FilePickerOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `types` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl FilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "types")] + pub fn set_types(this: &FilePickerOptions, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl FilePickerOptions { + #[doc = "Construct a new `FilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_exclude_accept_all_option()` instead."] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + self.set_exclude_accept_all_option(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_start_in()` instead."] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_start_in(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_types()` instead."] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.types_shim(val); + self.set_types(val); self } } diff --git a/crates/web-sys/src/features/gen_FilePropertyBag.rs b/crates/web-sys/src/features/gen_FilePropertyBag.rs index 99ecc5bb920..0b5c3ad8751 100644 --- a/crates/web-sys/src/features/gen_FilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_FilePropertyBag.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] pub type FilePropertyBag; + #[doc = "Get the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] + #[wasm_bindgen(method, getter = "lastModified")] + pub fn get_last_modified(this: &FilePropertyBag) -> Option; + #[doc = "Change the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] #[wasm_bindgen(method, setter = "lastModified")] - fn last_modified_shim(this: &FilePropertyBag, val: f64); + pub fn set_last_modified(this: &FilePropertyBag, val: f64); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &FilePropertyBag) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &FilePropertyBag, val: &str); + pub fn set_type(this: &FilePropertyBag, val: &str); } impl FilePropertyBag { #[doc = "Construct a new `FilePropertyBag`."] @@ -24,18 +40,14 @@ impl FilePropertyBag { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `lastModified` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] + #[deprecated = "Use `set_last_modified()` instead."] pub fn last_modified(&mut self, val: f64) -> &mut Self { - self.last_modified_shim(val); + self.set_last_modified(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs index ae33bfeb6de..3d03f2adf65 100644 --- a/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] pub type FileSystemCreateWritableOptions; + #[doc = "Get the `keepExistingData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] + #[wasm_bindgen(method, getter = "keepExistingData")] + pub fn get_keep_existing_data(this: &FileSystemCreateWritableOptions) -> Option; + #[doc = "Change the `keepExistingData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] #[wasm_bindgen(method, setter = "keepExistingData")] - fn keep_existing_data_shim(this: &FileSystemCreateWritableOptions, val: bool); + pub fn set_keep_existing_data(this: &FileSystemCreateWritableOptions, val: bool); } impl FileSystemCreateWritableOptions { #[doc = "Construct a new `FileSystemCreateWritableOptions`."] @@ -22,11 +30,9 @@ impl FileSystemCreateWritableOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `keepExistingData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] + #[deprecated = "Use `set_keep_existing_data()` instead."] pub fn keep_existing_data(&mut self, val: bool) -> &mut Self { - self.keep_existing_data_shim(val); + self.set_keep_existing_data(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs b/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs index 6cb0cfb560d..581452a8fda 100644 --- a/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs +++ b/crates/web-sys/src/features/gen_FileSystemEntriesCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] pub type FileSystemEntriesCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &FileSystemEntriesCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &FileSystemEntriesCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &FileSystemEntriesCallback, val: &::js_sys::Function); } impl FileSystemEntriesCallback { #[doc = "Construct a new `FileSystemEntriesCallback`."] @@ -22,11 +30,9 @@ impl FileSystemEntriesCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemEntriesCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs b/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs index 4a5988ec2b8..ef3d86cf1b6 100644 --- a/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs +++ b/crates/web-sys/src/features/gen_FileSystemEntryCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] pub type FileSystemEntryCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &FileSystemEntryCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &FileSystemEntryCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &FileSystemEntryCallback, val: &::js_sys::Function); } impl FileSystemEntryCallback { #[doc = "Construct a new `FileSystemEntryCallback`."] @@ -22,11 +30,9 @@ impl FileSystemEntryCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemEntryCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemFlags.rs b/crates/web-sys/src/features/gen_FileSystemFlags.rs index bb68735f21e..62be51dd863 100644 --- a/crates/web-sys/src/features/gen_FileSystemFlags.rs +++ b/crates/web-sys/src/features/gen_FileSystemFlags.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] pub type FileSystemFlags; + #[doc = "Get the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] + #[wasm_bindgen(method, getter = "create")] + pub fn get_create(this: &FileSystemFlags) -> Option; + #[doc = "Change the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] #[wasm_bindgen(method, setter = "create")] - fn create_shim(this: &FileSystemFlags, val: bool); + pub fn set_create(this: &FileSystemFlags, val: bool); + #[doc = "Get the `exclusive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] + #[wasm_bindgen(method, getter = "exclusive")] + pub fn get_exclusive(this: &FileSystemFlags) -> Option; + #[doc = "Change the `exclusive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] #[wasm_bindgen(method, setter = "exclusive")] - fn exclusive_shim(this: &FileSystemFlags, val: bool); + pub fn set_exclusive(this: &FileSystemFlags, val: bool); } impl FileSystemFlags { #[doc = "Construct a new `FileSystemFlags`."] @@ -24,18 +40,14 @@ impl FileSystemFlags { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `create` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] + #[deprecated = "Use `set_create()` instead."] pub fn create(&mut self, val: bool) -> &mut Self { - self.create_shim(val); + self.set_create(val); self } - #[doc = "Change the `exclusive` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemFlags`*"] + #[deprecated = "Use `set_exclusive()` instead."] pub fn exclusive(&mut self, val: bool) -> &mut Self { - self.exclusive_shim(val); + self.set_exclusive(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs index b25b6429426..1d5c1d52131 100644 --- a/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] pub type FileSystemGetDirectoryOptions; + #[doc = "Get the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] + #[wasm_bindgen(method, getter = "create")] + pub fn get_create(this: &FileSystemGetDirectoryOptions) -> Option; + #[doc = "Change the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] #[wasm_bindgen(method, setter = "create")] - fn create_shim(this: &FileSystemGetDirectoryOptions, val: bool); + pub fn set_create(this: &FileSystemGetDirectoryOptions, val: bool); } impl FileSystemGetDirectoryOptions { #[doc = "Construct a new `FileSystemGetDirectoryOptions`."] @@ -22,11 +30,9 @@ impl FileSystemGetDirectoryOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `create` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] + #[deprecated = "Use `set_create()` instead."] pub fn create(&mut self, val: bool) -> &mut Self { - self.create_shim(val); + self.set_create(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs index 78004c0a807..2aebf3b23ea 100644 --- a/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] pub type FileSystemGetFileOptions; + #[doc = "Get the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] + #[wasm_bindgen(method, getter = "create")] + pub fn get_create(this: &FileSystemGetFileOptions) -> Option; + #[doc = "Change the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] #[wasm_bindgen(method, setter = "create")] - fn create_shim(this: &FileSystemGetFileOptions, val: bool); + pub fn set_create(this: &FileSystemGetFileOptions, val: bool); } impl FileSystemGetFileOptions { #[doc = "Construct a new `FileSystemGetFileOptions`."] @@ -22,11 +30,9 @@ impl FileSystemGetFileOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `create` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] + #[deprecated = "Use `set_create()` instead."] pub fn create(&mut self, val: bool) -> &mut Self { - self.create_shim(val); + self.set_create(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs index 042392fed2a..8f8aaa1c0ed 100644 --- a/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_FileSystemHandlePermissionDescriptor.rs @@ -14,9 +14,28 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FileSystemHandlePermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode( + this: &FileSystemHandlePermissionDescriptor, + ) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &FileSystemHandlePermissionDescriptor, val: FileSystemPermissionMode); + pub fn set_mode(this: &FileSystemHandlePermissionDescriptor, val: FileSystemPermissionMode); } #[cfg(web_sys_unstable_apis)] impl FileSystemHandlePermissionDescriptor { @@ -33,14 +52,9 @@ impl FileSystemHandlePermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemHandlePermissionDescriptor`, `FileSystemPermissionMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs index b777cfe64f3..4a8c7df1f12 100644 --- a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs @@ -14,15 +14,66 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FileSystemPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &FileSystemPermissionDescriptor) -> PermissionName; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `PermissionName`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &FileSystemPermissionDescriptor, val: PermissionName); + pub fn set_name(this: &FileSystemPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemHandle")] + #[doc = "Get the `handle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "handle")] + pub fn get_handle(this: &FileSystemPermissionDescriptor) -> FileSystemHandle; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemHandle")] + #[doc = "Change the `handle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "handle")] - fn handle_shim(this: &FileSystemPermissionDescriptor, val: &FileSystemHandle); + pub fn set_handle(this: &FileSystemPermissionDescriptor, val: &FileSystemHandle); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &FileSystemPermissionDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `FileSystemPermissionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &FileSystemPermissionDescriptor, val: FileSystemPermissionMode); + pub fn set_mode(this: &FileSystemPermissionDescriptor, val: FileSystemPermissionMode); } #[cfg(web_sys_unstable_apis)] impl FileSystemPermissionDescriptor { @@ -42,38 +93,23 @@ impl FileSystemPermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `PermissionName`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemHandle")] - #[doc = "Change the `handle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_handle()` instead."] pub fn handle(&mut self, val: &FileSystemHandle) -> &mut Self { - self.handle_shim(val); + self.set_handle(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FileSystemPermissionMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemPermissionDescriptor`, `FileSystemPermissionMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: FileSystemPermissionMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs index c54fb3a3284..2cdd030a0ee 100644 --- a/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] pub type FileSystemReadWriteOptions; + #[doc = "Get the `at` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] + #[wasm_bindgen(method, getter = "at")] + pub fn get_at(this: &FileSystemReadWriteOptions) -> Option; + #[doc = "Change the `at` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] #[wasm_bindgen(method, setter = "at")] - fn at_shim(this: &FileSystemReadWriteOptions, val: f64); + pub fn set_at(this: &FileSystemReadWriteOptions, val: f64); } impl FileSystemReadWriteOptions { #[doc = "Construct a new `FileSystemReadWriteOptions`."] @@ -22,11 +30,9 @@ impl FileSystemReadWriteOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `at` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] + #[deprecated = "Use `set_at()` instead."] pub fn at(&mut self, val: f64) -> &mut Self { - self.at_shim(val); + self.set_at(val); self } } diff --git a/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs index fbc6e6fdbc7..e1ec6700ef1 100644 --- a/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs +++ b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] pub type FileSystemRemoveOptions; + #[doc = "Get the `recursive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] + #[wasm_bindgen(method, getter = "recursive")] + pub fn get_recursive(this: &FileSystemRemoveOptions) -> Option; + #[doc = "Change the `recursive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] #[wasm_bindgen(method, setter = "recursive")] - fn recursive_shim(this: &FileSystemRemoveOptions, val: bool); + pub fn set_recursive(this: &FileSystemRemoveOptions, val: bool); } impl FileSystemRemoveOptions { #[doc = "Construct a new `FileSystemRemoveOptions`."] @@ -22,11 +30,9 @@ impl FileSystemRemoveOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `recursive` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] + #[deprecated = "Use `set_recursive()` instead."] pub fn recursive(&mut self, val: bool) -> &mut Self { - self.recursive_shim(val); + self.set_recursive(val); self } } diff --git a/crates/web-sys/src/features/gen_FocusEventInit.rs b/crates/web-sys/src/features/gen_FocusEventInit.rs index 80ec658083c..a7a84b2eb99 100644 --- a/crates/web-sys/src/features/gen_FocusEventInit.rs +++ b/crates/web-sys/src/features/gen_FocusEventInit.rs @@ -10,20 +10,70 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] pub type FocusEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &FocusEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &FocusEventInit, val: bool); + pub fn set_bubbles(this: &FocusEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &FocusEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &FocusEventInit, val: bool); + pub fn set_cancelable(this: &FocusEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &FocusEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &FocusEventInit, val: bool); + pub fn set_composed(this: &FocusEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &FocusEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &FocusEventInit, val: i32); + pub fn set_detail(this: &FocusEventInit, val: i32); + #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &FocusEventInit) -> Option; #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &FocusEventInit, val: Option<&Window>); + pub fn set_view(this: &FocusEventInit, val: Option<&Window>); + #[cfg(feature = "EventTarget")] + #[doc = "Get the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `FocusEventInit`*"] + #[wasm_bindgen(method, getter = "relatedTarget")] + pub fn get_related_target(this: &FocusEventInit) -> Option; #[cfg(feature = "EventTarget")] + #[doc = "Change the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `FocusEventInit`*"] #[wasm_bindgen(method, setter = "relatedTarget")] - fn related_target_shim(this: &FocusEventInit, val: Option<&EventTarget>); + pub fn set_related_target(this: &FocusEventInit, val: Option<&EventTarget>); } impl FocusEventInit { #[doc = "Construct a new `FocusEventInit`."] @@ -34,48 +84,36 @@ impl FocusEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `relatedTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `FocusEventInit`*"] + #[deprecated = "Use `set_related_target()` instead."] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - self.related_target_shim(val); + self.set_related_target(val); self } } diff --git a/crates/web-sys/src/features/gen_FocusOptions.rs b/crates/web-sys/src/features/gen_FocusOptions.rs index 0efdeef5c81..d1ae31c1dab 100644 --- a/crates/web-sys/src/features/gen_FocusOptions.rs +++ b/crates/web-sys/src/features/gen_FocusOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] pub type FocusOptions; + #[doc = "Get the `focusVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + #[wasm_bindgen(method, getter = "focusVisible")] + pub fn get_focus_visible(this: &FocusOptions) -> Option; + #[doc = "Change the `focusVisible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] #[wasm_bindgen(method, setter = "focusVisible")] - fn focus_visible_shim(this: &FocusOptions, val: bool); + pub fn set_focus_visible(this: &FocusOptions, val: bool); + #[doc = "Get the `preventScroll` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + #[wasm_bindgen(method, getter = "preventScroll")] + pub fn get_prevent_scroll(this: &FocusOptions) -> Option; + #[doc = "Change the `preventScroll` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] #[wasm_bindgen(method, setter = "preventScroll")] - fn prevent_scroll_shim(this: &FocusOptions, val: bool); + pub fn set_prevent_scroll(this: &FocusOptions, val: bool); } impl FocusOptions { #[doc = "Construct a new `FocusOptions`."] @@ -24,18 +40,14 @@ impl FocusOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `focusVisible` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + #[deprecated = "Use `set_focus_visible()` instead."] pub fn focus_visible(&mut self, val: bool) -> &mut Self { - self.focus_visible_shim(val); + self.set_focus_visible(val); self } - #[doc = "Change the `preventScroll` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FocusOptions`*"] + #[deprecated = "Use `set_prevent_scroll()` instead."] pub fn prevent_scroll(&mut self, val: bool) -> &mut Self { - self.prevent_scroll_shim(val); + self.set_prevent_scroll(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs index 1da0a315c1f..3598c4f11dd 100644 --- a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs +++ b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs @@ -10,22 +10,86 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] pub type FontFaceDescriptors; + #[doc = "Get the `display` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "display")] + pub fn get_display(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `display` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "display")] - fn display_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_display(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `featureSettings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "featureSettings")] + pub fn get_feature_settings(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `featureSettings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "featureSettings")] - fn feature_settings_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_feature_settings(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `stretch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "stretch")] + pub fn get_stretch(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `stretch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "stretch")] - fn stretch_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_stretch(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "style")] + pub fn get_style(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `style` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "style")] - fn style_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_style(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `unicodeRange` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "unicodeRange")] + pub fn get_unicode_range(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `unicodeRange` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "unicodeRange")] - fn unicode_range_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_unicode_range(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `variant` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "variant")] + pub fn get_variant(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `variant` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "variant")] - fn variant_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_variant(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `variationSettings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "variationSettings")] + pub fn get_variation_settings(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `variationSettings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "variationSettings")] - fn variation_settings_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_variation_settings(this: &FontFaceDescriptors, val: &str); + #[doc = "Get the `weight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[wasm_bindgen(method, getter = "weight")] + pub fn get_weight(this: &FontFaceDescriptors) -> Option; + #[doc = "Change the `weight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, setter = "weight")] - fn weight_shim(this: &FontFaceDescriptors, val: &str); + pub fn set_weight(this: &FontFaceDescriptors, val: &str); } impl FontFaceDescriptors { #[doc = "Construct a new `FontFaceDescriptors`."] @@ -36,60 +100,44 @@ impl FontFaceDescriptors { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `display` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_display()` instead."] pub fn display(&mut self, val: &str) -> &mut Self { - self.display_shim(val); + self.set_display(val); self } - #[doc = "Change the `featureSettings` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_feature_settings()` instead."] pub fn feature_settings(&mut self, val: &str) -> &mut Self { - self.feature_settings_shim(val); + self.set_feature_settings(val); self } - #[doc = "Change the `stretch` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_stretch()` instead."] pub fn stretch(&mut self, val: &str) -> &mut Self { - self.stretch_shim(val); + self.set_stretch(val); self } - #[doc = "Change the `style` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_style()` instead."] pub fn style(&mut self, val: &str) -> &mut Self { - self.style_shim(val); + self.set_style(val); self } - #[doc = "Change the `unicodeRange` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_unicode_range()` instead."] pub fn unicode_range(&mut self, val: &str) -> &mut Self { - self.unicode_range_shim(val); + self.set_unicode_range(val); self } - #[doc = "Change the `variant` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_variant()` instead."] pub fn variant(&mut self, val: &str) -> &mut Self { - self.variant_shim(val); + self.set_variant(val); self } - #[doc = "Change the `variationSettings` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_variation_settings()` instead."] pub fn variation_settings(&mut self, val: &str) -> &mut Self { - self.variation_settings_shim(val); + self.set_variation_settings(val); self } - #[doc = "Change the `weight` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] + #[deprecated = "Use `set_weight()` instead."] pub fn weight(&mut self, val: &str) -> &mut Self { - self.weight_shim(val); + self.set_weight(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs index 2cab9cdfe02..469670809fb 100644 --- a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs +++ b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] pub type FontFaceSetIteratorResult; + #[doc = "Get the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] + #[wasm_bindgen(method, getter = "done")] + pub fn get_done(this: &FontFaceSetIteratorResult) -> bool; + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] #[wasm_bindgen(method, setter = "done")] - fn done_shim(this: &FontFaceSetIteratorResult, val: bool); + pub fn set_done(this: &FontFaceSetIteratorResult, val: bool); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &FontFaceSetIteratorResult) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &FontFaceSetIteratorResult, val: &::wasm_bindgen::JsValue); + pub fn set_value(this: &FontFaceSetIteratorResult, val: &::wasm_bindgen::JsValue); } impl FontFaceSetIteratorResult { #[doc = "Construct a new `FontFaceSetIteratorResult`."] @@ -26,18 +42,14 @@ impl FontFaceSetIteratorResult { ret.value(value); ret } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] + #[deprecated = "Use `set_done()` instead."] pub fn done(&mut self, val: bool) -> &mut Self { - self.done_shim(val); + self.set_done(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetIteratorResult`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs b/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs index 994c5e291e8..147a3316581 100644 --- a/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs +++ b/crates/web-sys/src/features/gen_FontFaceSetLoadEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] pub type FontFaceSetLoadEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &FontFaceSetLoadEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &FontFaceSetLoadEventInit, val: bool); + pub fn set_bubbles(this: &FontFaceSetLoadEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &FontFaceSetLoadEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &FontFaceSetLoadEventInit, val: bool); + pub fn set_cancelable(this: &FontFaceSetLoadEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &FontFaceSetLoadEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &FontFaceSetLoadEventInit, val: bool); + pub fn set_composed(this: &FontFaceSetLoadEventInit, val: bool); + #[doc = "Get the `fontfaces` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[wasm_bindgen(method, getter = "fontfaces")] + pub fn get_fontfaces(this: &FontFaceSetLoadEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `fontfaces` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] #[wasm_bindgen(method, setter = "fontfaces")] - fn fontfaces_shim(this: &FontFaceSetLoadEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_fontfaces(this: &FontFaceSetLoadEventInit, val: &::wasm_bindgen::JsValue); } impl FontFaceSetLoadEventInit { #[doc = "Construct a new `FontFaceSetLoadEventInit`."] @@ -28,32 +60,24 @@ impl FontFaceSetLoadEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `fontfaces` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FontFaceSetLoadEventInit`*"] + #[deprecated = "Use `set_fontfaces()` instead."] pub fn fontfaces(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.fontfaces_shim(val); + self.set_fontfaces(val); self } } diff --git a/crates/web-sys/src/features/gen_GainOptions.rs b/crates/web-sys/src/features/gen_GainOptions.rs index a6f06048e20..11dbccc476b 100644 --- a/crates/web-sys/src/features/gen_GainOptions.rs +++ b/crates/web-sys/src/features/gen_GainOptions.rs @@ -10,16 +10,50 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] pub type GainOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &GainOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &GainOptions, val: u32); + pub fn set_channel_count(this: &GainOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `GainOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &GainOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `GainOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &GainOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &GainOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `GainOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &GainOptions) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `GainOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &GainOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &GainOptions, val: ChannelInterpretation); + #[doc = "Get the `gain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] + #[wasm_bindgen(method, getter = "gain")] + pub fn get_gain(this: &GainOptions) -> Option; + #[doc = "Change the `gain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] #[wasm_bindgen(method, setter = "gain")] - fn gain_shim(this: &GainOptions, val: f32); + pub fn set_gain(this: &GainOptions, val: f32); } impl GainOptions { #[doc = "Construct a new `GainOptions`."] @@ -30,34 +64,26 @@ impl GainOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `GainOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `GainOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `gain` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GainOptions`*"] + #[deprecated = "Use `set_gain()` instead."] pub fn gain(&mut self, val: f32) -> &mut Self { - self.gain_shim(val); + self.set_gain(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs index 039b25d0ea0..885cee25eca 100644 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs @@ -10,19 +10,68 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] pub type GamepadAxisMoveEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &GamepadAxisMoveEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &GamepadAxisMoveEventInit, val: bool); + pub fn set_bubbles(this: &GamepadAxisMoveEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &GamepadAxisMoveEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &GamepadAxisMoveEventInit, val: bool); + pub fn set_cancelable(this: &GamepadAxisMoveEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GamepadAxisMoveEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GamepadAxisMoveEventInit, val: bool); + pub fn set_composed(this: &GamepadAxisMoveEventInit, val: bool); + #[cfg(feature = "Gamepad")] + #[doc = "Get the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "gamepad")] + pub fn get_gamepad(this: &GamepadAxisMoveEventInit) -> Option; #[cfg(feature = "Gamepad")] + #[doc = "Change the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "gamepad")] - fn gamepad_shim(this: &GamepadAxisMoveEventInit, val: Option<&Gamepad>); + pub fn set_gamepad(this: &GamepadAxisMoveEventInit, val: Option<&Gamepad>); + #[doc = "Get the `axis` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "axis")] + pub fn get_axis(this: &GamepadAxisMoveEventInit) -> Option; + #[doc = "Change the `axis` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "axis")] - fn axis_shim(this: &GamepadAxisMoveEventInit, val: u32); + pub fn set_axis(this: &GamepadAxisMoveEventInit, val: u32); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &GamepadAxisMoveEventInit) -> Option; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &GamepadAxisMoveEventInit, val: f64); + pub fn set_value(this: &GamepadAxisMoveEventInit, val: f64); } impl GamepadAxisMoveEventInit { #[doc = "Construct a new `GamepadAxisMoveEventInit`."] @@ -33,47 +82,35 @@ impl GamepadAxisMoveEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_gamepad()` instead."] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.gamepad_shim(val); + self.set_gamepad(val); self } - #[doc = "Change the `axis` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_axis()` instead."] pub fn axis(&mut self, val: u32) -> &mut Self { - self.axis_shim(val); + self.set_axis(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: f64) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs index dfe076a66ba..9cd13854ed9 100644 --- a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] pub type GamepadButtonEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &GamepadButtonEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &GamepadButtonEventInit, val: bool); + pub fn set_bubbles(this: &GamepadButtonEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &GamepadButtonEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &GamepadButtonEventInit, val: bool); + pub fn set_cancelable(this: &GamepadButtonEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GamepadButtonEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GamepadButtonEventInit, val: bool); + pub fn set_composed(this: &GamepadButtonEventInit, val: bool); + #[cfg(feature = "Gamepad")] + #[doc = "Get the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] + #[wasm_bindgen(method, getter = "gamepad")] + pub fn get_gamepad(this: &GamepadButtonEventInit) -> Option; #[cfg(feature = "Gamepad")] + #[doc = "Change the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] #[wasm_bindgen(method, setter = "gamepad")] - fn gamepad_shim(this: &GamepadButtonEventInit, val: Option<&Gamepad>); + pub fn set_gamepad(this: &GamepadButtonEventInit, val: Option<&Gamepad>); + #[doc = "Get the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[wasm_bindgen(method, getter = "button")] + pub fn get_button(this: &GamepadButtonEventInit) -> Option; + #[doc = "Change the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] #[wasm_bindgen(method, setter = "button")] - fn button_shim(this: &GamepadButtonEventInit, val: u32); + pub fn set_button(this: &GamepadButtonEventInit, val: u32); } impl GamepadButtonEventInit { #[doc = "Construct a new `GamepadButtonEventInit`."] @@ -31,40 +72,30 @@ impl GamepadButtonEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] + #[deprecated = "Use `set_gamepad()` instead."] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.gamepad_shim(val); + self.set_gamepad(val); self } - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] + #[deprecated = "Use `set_button()` instead."] pub fn button(&mut self, val: u32) -> &mut Self { - self.button_shim(val); + self.set_button(val); self } } diff --git a/crates/web-sys/src/features/gen_GamepadEventInit.rs b/crates/web-sys/src/features/gen_GamepadEventInit.rs index 13ee954f335..de166b1d735 100644 --- a/crates/web-sys/src/features/gen_GamepadEventInit.rs +++ b/crates/web-sys/src/features/gen_GamepadEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] pub type GamepadEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &GamepadEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &GamepadEventInit, val: bool); + pub fn set_bubbles(this: &GamepadEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &GamepadEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &GamepadEventInit, val: bool); + pub fn set_cancelable(this: &GamepadEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GamepadEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GamepadEventInit, val: bool); + pub fn set_composed(this: &GamepadEventInit, val: bool); #[cfg(feature = "Gamepad")] + #[doc = "Get the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadEventInit`*"] + #[wasm_bindgen(method, getter = "gamepad")] + pub fn get_gamepad(this: &GamepadEventInit) -> Option; + #[cfg(feature = "Gamepad")] + #[doc = "Change the `gamepad` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadEventInit`*"] #[wasm_bindgen(method, setter = "gamepad")] - fn gamepad_shim(this: &GamepadEventInit, val: Option<&Gamepad>); + pub fn set_gamepad(this: &GamepadEventInit, val: Option<&Gamepad>); } impl GamepadEventInit { #[doc = "Construct a new `GamepadEventInit`."] @@ -29,33 +62,25 @@ impl GamepadEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadEventInit`*"] + #[deprecated = "Use `set_gamepad()` instead."] pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.gamepad_shim(val); + self.set_gamepad(val); self } } diff --git a/crates/web-sys/src/features/gen_GetAnimationsOptions.rs b/crates/web-sys/src/features/gen_GetAnimationsOptions.rs index 7f2774c308b..3781d6ebc90 100644 --- a/crates/web-sys/src/features/gen_GetAnimationsOptions.rs +++ b/crates/web-sys/src/features/gen_GetAnimationsOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GetAnimationsOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GetAnimationsOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "subtree")] + pub fn get_subtree(this: &GetAnimationsOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GetAnimationsOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "subtree")] - fn subtree_shim(this: &GetAnimationsOptions, val: bool); + pub fn set_subtree(this: &GetAnimationsOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl GetAnimationsOptions { @@ -31,14 +47,9 @@ impl GetAnimationsOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `subtree` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GetAnimationsOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_subtree()` instead."] pub fn subtree(&mut self, val: bool) -> &mut Self { - self.subtree_shim(val); + self.set_subtree(val); self } } diff --git a/crates/web-sys/src/features/gen_GetRootNodeOptions.rs b/crates/web-sys/src/features/gen_GetRootNodeOptions.rs index ba387240e5d..616cfaa611e 100644 --- a/crates/web-sys/src/features/gen_GetRootNodeOptions.rs +++ b/crates/web-sys/src/features/gen_GetRootNodeOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] pub type GetRootNodeOptions; + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GetRootNodeOptions) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GetRootNodeOptions, val: bool); + pub fn set_composed(this: &GetRootNodeOptions, val: bool); } impl GetRootNodeOptions { #[doc = "Construct a new `GetRootNodeOptions`."] @@ -22,11 +30,9 @@ impl GetRootNodeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs index c5594b85ad3..9f1ad18daf3 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuBindGroupDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuBindGroupDescriptor, val: &str); + pub fn set_label(this: &GpuBindGroupDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entries")] + pub fn get_entries(this: &GpuBindGroupDescriptor) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entries")] - fn entries_shim(this: &GpuBindGroupDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_entries(this: &GpuBindGroupDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroupLayout")] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`, `GpuBindGroupLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &GpuBindGroupDescriptor) -> GpuBindGroupLayout; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroupLayout")] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`, `GpuBindGroupLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &GpuBindGroupDescriptor, val: &GpuBindGroupLayout); + pub fn set_layout(this: &GpuBindGroupDescriptor, val: &GpuBindGroupLayout); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupDescriptor { @@ -39,37 +88,22 @@ impl GpuBindGroupDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entries` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entries()` instead."] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.entries_shim(val); + self.set_entries(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroupLayout")] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`, `GpuBindGroupLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &GpuBindGroupLayout) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs index e41ab563eba..dff39885718 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupEntry; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `binding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "binding")] + pub fn get_binding(this: &GpuBindGroupEntry) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `binding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "binding")] - fn binding_shim(this: &GpuBindGroupEntry, val: u32); + pub fn set_binding(this: &GpuBindGroupEntry, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `resource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "resource")] + pub fn get_resource(this: &GpuBindGroupEntry) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `resource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "resource")] - fn resource_shim(this: &GpuBindGroupEntry, val: &::wasm_bindgen::JsValue); + pub fn set_resource(this: &GpuBindGroupEntry, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupEntry { @@ -35,25 +67,15 @@ impl GpuBindGroupEntry { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `binding` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_binding()` instead."] pub fn binding(&mut self, val: u32) -> &mut Self { - self.binding_shim(val); + self.set_binding(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `resource` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_resource()` instead."] pub fn resource(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.resource_shim(val); + self.set_resource(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs index 2ca1218a16e..b7747d5d756 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupLayoutDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuBindGroupLayoutDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuBindGroupLayoutDescriptor, val: &str); + pub fn set_label(this: &GpuBindGroupLayoutDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entries")] + pub fn get_entries(this: &GpuBindGroupLayoutDescriptor) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entries")] - fn entries_shim(this: &GpuBindGroupLayoutDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_entries(this: &GpuBindGroupLayoutDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuBindGroupLayoutDescriptor { @@ -34,25 +66,15 @@ impl GpuBindGroupLayoutDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entries` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entries()` instead."] pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.entries_shim(val); + self.set_entries(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs index 87e1e46d5c9..6472b43a32e 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs @@ -14,41 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBindGroupLayoutEntry; - #[wasm_bindgen(method, setter = "binding")] - fn binding_shim(this: &GpuBindGroupLayoutEntry, val: u32); - #[cfg(feature = "GpuBufferBindingLayout")] - #[wasm_bindgen(method, setter = "buffer")] - fn buffer_shim(this: &GpuBindGroupLayoutEntry, val: &GpuBufferBindingLayout); - #[cfg(feature = "GpuExternalTextureBindingLayout")] - #[wasm_bindgen(method, setter = "externalTexture")] - fn external_texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuExternalTextureBindingLayout); - #[cfg(feature = "GpuSamplerBindingLayout")] - #[wasm_bindgen(method, setter = "sampler")] - fn sampler_shim(this: &GpuBindGroupLayoutEntry, val: &GpuSamplerBindingLayout); - #[cfg(feature = "GpuStorageTextureBindingLayout")] - #[wasm_bindgen(method, setter = "storageTexture")] - fn storage_texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuStorageTextureBindingLayout); - #[cfg(feature = "GpuTextureBindingLayout")] - #[wasm_bindgen(method, setter = "texture")] - fn texture_shim(this: &GpuBindGroupLayoutEntry, val: &GpuTextureBindingLayout); - #[wasm_bindgen(method, setter = "visibility")] - fn visibility_shim(this: &GpuBindGroupLayoutEntry, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuBindGroupLayoutEntry { - #[doc = "Construct a new `GpuBindGroupLayoutEntry`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `binding` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(binding: u32, visibility: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.binding(binding); - ret.visibility(visibility); - ret - } + #[wasm_bindgen(method, getter = "binding")] + pub fn get_binding(this: &GpuBindGroupLayoutEntry) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `binding` field of this object."] #[doc = ""] @@ -56,10 +30,18 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn binding(&mut self, val: u32) -> &mut Self { - self.binding_shim(val); - self - } + #[wasm_bindgen(method, setter = "binding")] + pub fn set_binding(this: &GpuBindGroupLayoutEntry, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBufferBindingLayout")] + #[doc = "Get the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuBufferBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "buffer")] + pub fn get_buffer(this: &GpuBindGroupLayoutEntry) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBufferBindingLayout")] #[doc = "Change the `buffer` field of this object."] @@ -68,10 +50,20 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn buffer(&mut self, val: &GpuBufferBindingLayout) -> &mut Self { - self.buffer_shim(val); - self - } + #[wasm_bindgen(method, setter = "buffer")] + pub fn set_buffer(this: &GpuBindGroupLayoutEntry, val: &GpuBufferBindingLayout); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuExternalTextureBindingLayout")] + #[doc = "Get the `externalTexture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuExternalTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "externalTexture")] + pub fn get_external_texture( + this: &GpuBindGroupLayoutEntry, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuExternalTextureBindingLayout")] #[doc = "Change the `externalTexture` field of this object."] @@ -80,10 +72,21 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn external_texture(&mut self, val: &GpuExternalTextureBindingLayout) -> &mut Self { - self.external_texture_shim(val); - self - } + #[wasm_bindgen(method, setter = "externalTexture")] + pub fn set_external_texture( + this: &GpuBindGroupLayoutEntry, + val: &GpuExternalTextureBindingLayout, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuSamplerBindingLayout")] + #[doc = "Get the `sampler` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuSamplerBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampler")] + pub fn get_sampler(this: &GpuBindGroupLayoutEntry) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuSamplerBindingLayout")] #[doc = "Change the `sampler` field of this object."] @@ -92,10 +95,20 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn sampler(&mut self, val: &GpuSamplerBindingLayout) -> &mut Self { - self.sampler_shim(val); - self - } + #[wasm_bindgen(method, setter = "sampler")] + pub fn set_sampler(this: &GpuBindGroupLayoutEntry, val: &GpuSamplerBindingLayout); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStorageTextureBindingLayout")] + #[doc = "Get the `storageTexture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuStorageTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "storageTexture")] + pub fn get_storage_texture( + this: &GpuBindGroupLayoutEntry, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStorageTextureBindingLayout")] #[doc = "Change the `storageTexture` field of this object."] @@ -104,10 +117,21 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn storage_texture(&mut self, val: &GpuStorageTextureBindingLayout) -> &mut Self { - self.storage_texture_shim(val); - self - } + #[wasm_bindgen(method, setter = "storageTexture")] + pub fn set_storage_texture( + this: &GpuBindGroupLayoutEntry, + val: &GpuStorageTextureBindingLayout, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureBindingLayout")] + #[doc = "Get the `texture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "texture")] + pub fn get_texture(this: &GpuBindGroupLayoutEntry) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureBindingLayout")] #[doc = "Change the `texture` field of this object."] @@ -116,10 +140,17 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn texture(&mut self, val: &GpuTextureBindingLayout) -> &mut Self { - self.texture_shim(val); - self - } + #[wasm_bindgen(method, setter = "texture")] + pub fn set_texture(this: &GpuBindGroupLayoutEntry, val: &GpuTextureBindingLayout); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `visibility` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "visibility")] + pub fn get_visibility(this: &GpuBindGroupLayoutEntry) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `visibility` field of this object."] #[doc = ""] @@ -127,8 +158,69 @@ impl GpuBindGroupLayoutEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "visibility")] + pub fn set_visibility(this: &GpuBindGroupLayoutEntry, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuBindGroupLayoutEntry { + #[doc = "Construct a new `GpuBindGroupLayoutEntry`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(binding: u32, visibility: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.binding(binding); + ret.visibility(visibility); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_binding()` instead."] + pub fn binding(&mut self, val: u32) -> &mut Self { + self.set_binding(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBufferBindingLayout")] + #[deprecated = "Use `set_buffer()` instead."] + pub fn buffer(&mut self, val: &GpuBufferBindingLayout) -> &mut Self { + self.set_buffer(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuExternalTextureBindingLayout")] + #[deprecated = "Use `set_external_texture()` instead."] + pub fn external_texture(&mut self, val: &GpuExternalTextureBindingLayout) -> &mut Self { + self.set_external_texture(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuSamplerBindingLayout")] + #[deprecated = "Use `set_sampler()` instead."] + pub fn sampler(&mut self, val: &GpuSamplerBindingLayout) -> &mut Self { + self.set_sampler(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStorageTextureBindingLayout")] + #[deprecated = "Use `set_storage_texture()` instead."] + pub fn storage_texture(&mut self, val: &GpuStorageTextureBindingLayout) -> &mut Self { + self.set_storage_texture(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureBindingLayout")] + #[deprecated = "Use `set_texture()` instead."] + pub fn texture(&mut self, val: &GpuTextureBindingLayout) -> &mut Self { + self.set_texture(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_visibility()` instead."] pub fn visibility(&mut self, val: u32) -> &mut Self { - self.visibility_shim(val); + self.set_visibility(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBlendComponent.rs b/crates/web-sys/src/features/gen_GpuBlendComponent.rs index 03ed104e2f1..10f53d345f4 100644 --- a/crates/web-sys/src/features/gen_GpuBlendComponent.rs +++ b/crates/web-sys/src/features/gen_GpuBlendComponent.rs @@ -14,15 +14,66 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBlendComponent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendFactor")] + #[doc = "Get the `dstFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dstFactor")] + pub fn get_dst_factor(this: &GpuBlendComponent) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendFactor")] + #[doc = "Change the `dstFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "dstFactor")] - fn dst_factor_shim(this: &GpuBlendComponent, val: GpuBlendFactor); + pub fn set_dst_factor(this: &GpuBlendComponent, val: GpuBlendFactor); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendOperation")] + #[doc = "Get the `operation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "operation")] + pub fn get_operation(this: &GpuBlendComponent) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendOperation")] + #[doc = "Change the `operation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "operation")] - fn operation_shim(this: &GpuBlendComponent, val: GpuBlendOperation); + pub fn set_operation(this: &GpuBlendComponent, val: GpuBlendOperation); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendFactor")] + #[doc = "Get the `srcFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "srcFactor")] + pub fn get_src_factor(this: &GpuBlendComponent) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendFactor")] + #[doc = "Change the `srcFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "srcFactor")] - fn src_factor_shim(this: &GpuBlendComponent, val: GpuBlendFactor); + pub fn set_src_factor(this: &GpuBlendComponent, val: GpuBlendFactor); } #[cfg(web_sys_unstable_apis)] impl GpuBlendComponent { @@ -39,38 +90,23 @@ impl GpuBlendComponent { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendFactor")] - #[doc = "Change the `dstFactor` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_dst_factor()` instead."] pub fn dst_factor(&mut self, val: GpuBlendFactor) -> &mut Self { - self.dst_factor_shim(val); + self.set_dst_factor(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendOperation")] - #[doc = "Change the `operation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendOperation`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_operation()` instead."] pub fn operation(&mut self, val: GpuBlendOperation) -> &mut Self { - self.operation_shim(val); + self.set_operation(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendFactor")] - #[doc = "Change the `srcFactor` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendFactor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_src_factor()` instead."] pub fn src_factor(&mut self, val: GpuBlendFactor) -> &mut Self { - self.src_factor_shim(val); + self.set_src_factor(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBlendState.rs b/crates/web-sys/src/features/gen_GpuBlendState.rs index 80b609acd5d..cdb7dc9f043 100644 --- a/crates/web-sys/src/features/gen_GpuBlendState.rs +++ b/crates/web-sys/src/features/gen_GpuBlendState.rs @@ -14,12 +14,46 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBlendState; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendComponent")] + #[doc = "Get the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &GpuBlendState) -> GpuBlendComponent; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendComponent")] + #[doc = "Change the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &GpuBlendState, val: &GpuBlendComponent); + pub fn set_alpha(this: &GpuBlendState, val: &GpuBlendComponent); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendComponent")] + #[doc = "Get the `color` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "color")] + pub fn get_color(this: &GpuBlendState) -> GpuBlendComponent; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendComponent")] + #[doc = "Change the `color` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "color")] - fn color_shim(this: &GpuBlendState, val: &GpuBlendComponent); + pub fn set_color(this: &GpuBlendState, val: &GpuBlendComponent); } #[cfg(web_sys_unstable_apis)] impl GpuBlendState { @@ -39,26 +73,16 @@ impl GpuBlendState { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendComponent")] - #[doc = "Change the `alpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_alpha()` instead."] pub fn alpha(&mut self, val: &GpuBlendComponent) -> &mut Self { - self.alpha_shim(val); + self.set_alpha(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendComponent")] - #[doc = "Change the `color` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendComponent`, `GpuBlendState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_color()` instead."] pub fn color(&mut self, val: &GpuBlendComponent) -> &mut Self { - self.color_shim(val); + self.set_color(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferBinding.rs b/crates/web-sys/src/features/gen_GpuBufferBinding.rs index 170abfdb707..312055ad44f 100644 --- a/crates/web-sys/src/features/gen_GpuBufferBinding.rs +++ b/crates/web-sys/src/features/gen_GpuBufferBinding.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferBinding; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + #[doc = "Get the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "buffer")] + pub fn get_buffer(this: &GpuBufferBinding) -> GpuBuffer; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] + #[doc = "Change the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "buffer")] - fn buffer_shim(this: &GpuBufferBinding, val: &GpuBuffer); + pub fn set_buffer(this: &GpuBufferBinding, val: &GpuBuffer); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &GpuBufferBinding) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &GpuBufferBinding, val: f64); + pub fn set_offset(this: &GpuBufferBinding, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &GpuBufferBinding) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &GpuBufferBinding, val: f64); + pub fn set_size(this: &GpuBufferBinding, val: f64); } #[cfg(web_sys_unstable_apis)] impl GpuBufferBinding { @@ -39,36 +88,21 @@ impl GpuBufferBinding { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - #[doc = "Change the `buffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuBufferBinding`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_buffer()` instead."] pub fn buffer(&mut self, val: &GpuBuffer) -> &mut Self { - self.buffer_shim(val); + self.set_buffer(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: f64) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `size` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferBinding`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_size()` instead."] pub fn size(&mut self, val: f64) -> &mut Self { - self.size_shim(val); + self.set_size(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs b/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs index b78b7a4c753..47def45064b 100644 --- a/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuBufferBindingLayout.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferBindingLayout; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hasDynamicOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hasDynamicOffset")] + pub fn get_has_dynamic_offset(this: &GpuBufferBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `hasDynamicOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "hasDynamicOffset")] - fn has_dynamic_offset_shim(this: &GpuBufferBindingLayout, val: bool); + pub fn set_has_dynamic_offset(this: &GpuBufferBindingLayout, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `minBindingSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "minBindingSize")] + pub fn get_min_binding_size(this: &GpuBufferBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `minBindingSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "minBindingSize")] - fn min_binding_size_shim(this: &GpuBufferBindingLayout, val: f64); + pub fn set_min_binding_size(this: &GpuBufferBindingLayout, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBufferBindingType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`, `GpuBufferBindingType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &GpuBufferBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBufferBindingType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`, `GpuBufferBindingType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &GpuBufferBindingLayout, val: GpuBufferBindingType); + pub fn set_type(this: &GpuBufferBindingLayout, val: GpuBufferBindingType); } #[cfg(web_sys_unstable_apis)] impl GpuBufferBindingLayout { @@ -36,37 +85,22 @@ impl GpuBufferBindingLayout { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `hasDynamicOffset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_has_dynamic_offset()` instead."] pub fn has_dynamic_offset(&mut self, val: bool) -> &mut Self { - self.has_dynamic_offset_shim(val); + self.set_has_dynamic_offset(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `minBindingSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_min_binding_size()` instead."] pub fn min_binding_size(&mut self, val: f64) -> &mut Self { - self.min_binding_size_shim(val); + self.set_min_binding_size(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBufferBindingType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferBindingLayout`, `GpuBufferBindingType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: GpuBufferBindingType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs index 432a97950b9..536aa9c409d 100644 --- a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuBufferDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuBufferDescriptor, val: &str); - #[wasm_bindgen(method, setter = "mappedAtCreation")] - fn mapped_at_creation_shim(this: &GpuBufferDescriptor, val: bool); - #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &GpuBufferDescriptor, val: f64); - #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &GpuBufferDescriptor, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuBufferDescriptor { - #[doc = "Construct a new `GpuBufferDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(size: f64, usage: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.size(size); - ret.usage(usage); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuBufferDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -45,10 +30,17 @@ impl GpuBufferDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuBufferDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mappedAtCreation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mappedAtCreation")] + pub fn get_mapped_at_creation(this: &GpuBufferDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mappedAtCreation` field of this object."] #[doc = ""] @@ -56,10 +48,17 @@ impl GpuBufferDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mapped_at_creation(&mut self, val: bool) -> &mut Self { - self.mapped_at_creation_shim(val); - self - } + #[wasm_bindgen(method, setter = "mappedAtCreation")] + pub fn set_mapped_at_creation(this: &GpuBufferDescriptor, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &GpuBufferDescriptor) -> f64; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `size` field of this object."] #[doc = ""] @@ -67,10 +66,17 @@ impl GpuBufferDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn size(&mut self, val: f64) -> &mut Self { - self.size_shim(val); - self - } + #[wasm_bindgen(method, setter = "size")] + pub fn set_size(this: &GpuBufferDescriptor, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &GpuBufferDescriptor) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usage` field of this object."] #[doc = ""] @@ -78,8 +84,46 @@ impl GpuBufferDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "usage")] + pub fn set_usage(this: &GpuBufferDescriptor, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuBufferDescriptor { + #[doc = "Construct a new `GpuBufferDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(size: f64, usage: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.size(size); + ret.usage(usage); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mapped_at_creation()` instead."] + pub fn mapped_at_creation(&mut self, val: bool) -> &mut Self { + self.set_mapped_at_creation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_size()` instead."] + pub fn size(&mut self, val: f64) -> &mut Self { + self.set_size(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage()` instead."] pub fn usage(&mut self, val: u32) -> &mut Self { - self.usage_shim(val); + self.set_usage(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index 151e60d979b..220fcebe4d7 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -14,19 +14,102 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCanvasConfiguration; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCanvasAlphaMode")] + #[doc = "Get the `alphaMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "alphaMode")] + pub fn get_alpha_mode(this: &GpuCanvasConfiguration) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasAlphaMode")] + #[doc = "Change the `alphaMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "alphaMode")] - fn alpha_mode_shim(this: &GpuCanvasConfiguration, val: GpuCanvasAlphaMode); + pub fn set_alpha_mode(this: &GpuCanvasConfiguration, val: GpuCanvasAlphaMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuDevice")] + #[doc = "Get the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "device")] + pub fn get_device(this: &GpuCanvasConfiguration) -> GpuDevice; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuDevice")] + #[doc = "Change the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "device")] - fn device_shim(this: &GpuCanvasConfiguration, val: &GpuDevice); + pub fn set_device(this: &GpuCanvasConfiguration, val: &GpuDevice); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuCanvasConfiguration) -> GpuTextureFormat; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] + #[doc = "Change the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuCanvasConfiguration, val: GpuTextureFormat); + pub fn set_format(this: &GpuCanvasConfiguration, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &GpuCanvasConfiguration) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &GpuCanvasConfiguration, val: u32); + pub fn set_usage(this: &GpuCanvasConfiguration, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `viewFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "viewFormats")] + pub fn get_view_formats(this: &GpuCanvasConfiguration) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `viewFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "viewFormats")] - fn view_formats_shim(this: &GpuCanvasConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_view_formats(this: &GpuCanvasConfiguration, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuCanvasConfiguration { @@ -46,60 +129,35 @@ impl GpuCanvasConfiguration { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCanvasAlphaMode")] - #[doc = "Change the `alphaMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_alpha_mode()` instead."] pub fn alpha_mode(&mut self, val: GpuCanvasAlphaMode) -> &mut Self { - self.alpha_mode_shim(val); + self.set_alpha_mode(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuDevice")] - #[doc = "Change the `device` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_device()` instead."] pub fn device(&mut self, val: &GpuDevice) -> &mut Self { - self.device_shim(val); + self.set_device(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] - #[doc = "Change the `format` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_format()` instead."] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); + self.set_format(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_usage()` instead."] pub fn usage(&mut self, val: u32) -> &mut Self { - self.usage_shim(val); + self.set_usage(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `viewFormats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_view_formats()` instead."] pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.view_formats_shim(val); + self.set_view_formats(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuColorDict.rs b/crates/web-sys/src/features/gen_GpuColorDict.rs index 43041c4c8d6..38af75d3cb3 100644 --- a/crates/web-sys/src/features/gen_GpuColorDict.rs +++ b/crates/web-sys/src/features/gen_GpuColorDict.rs @@ -14,14 +14,78 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuColorDict; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "a")] + pub fn get_a(this: &GpuColorDict) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "a")] - fn a_shim(this: &GpuColorDict, val: f64); + pub fn set_a(this: &GpuColorDict, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "b")] + pub fn get_b(this: &GpuColorDict) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "b")] - fn b_shim(this: &GpuColorDict, val: f64); + pub fn set_b(this: &GpuColorDict, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `g` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "g")] + pub fn get_g(this: &GpuColorDict) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `g` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "g")] - fn g_shim(this: &GpuColorDict, val: f64); + pub fn set_g(this: &GpuColorDict, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `r` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "r")] + pub fn get_r(this: &GpuColorDict) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `r` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "r")] - fn r_shim(this: &GpuColorDict, val: f64); + pub fn set_r(this: &GpuColorDict, val: f64); } #[cfg(web_sys_unstable_apis)] impl GpuColorDict { @@ -41,47 +105,27 @@ impl GpuColorDict { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `a` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_a()` instead."] pub fn a(&mut self, val: f64) -> &mut Self { - self.a_shim(val); + self.set_a(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `b` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_b()` instead."] pub fn b(&mut self, val: f64) -> &mut Self { - self.b_shim(val); + self.set_b(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `g` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_g()` instead."] pub fn g(&mut self, val: f64) -> &mut Self { - self.g_shim(val); + self.set_g(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `r` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_r()` instead."] pub fn r(&mut self, val: f64) -> &mut Self { - self.r_shim(val); + self.set_r(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuColorTargetState.rs b/crates/web-sys/src/features/gen_GpuColorTargetState.rs index 252c6c88da2..e4b651285fd 100644 --- a/crates/web-sys/src/features/gen_GpuColorTargetState.rs +++ b/crates/web-sys/src/features/gen_GpuColorTargetState.rs @@ -14,14 +14,64 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuColorTargetState; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBlendState")] + #[doc = "Get the `blend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendState`, `GpuColorTargetState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "blend")] + pub fn get_blend(this: &GpuColorTargetState) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendState")] + #[doc = "Change the `blend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBlendState`, `GpuColorTargetState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "blend")] - fn blend_shim(this: &GpuColorTargetState, val: &GpuBlendState); + pub fn set_blend(this: &GpuColorTargetState, val: &GpuBlendState); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuColorTargetState) -> GpuTextureFormat; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Change the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuColorTargetState, val: GpuTextureFormat); + pub fn set_format(this: &GpuColorTargetState, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `writeMask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "writeMask")] + pub fn get_write_mask(this: &GpuColorTargetState) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `writeMask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "writeMask")] - fn write_mask_shim(this: &GpuColorTargetState, val: u32); + pub fn set_write_mask(this: &GpuColorTargetState, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuColorTargetState { @@ -40,37 +90,22 @@ impl GpuColorTargetState { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBlendState")] - #[doc = "Change the `blend` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBlendState`, `GpuColorTargetState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_blend()` instead."] pub fn blend(&mut self, val: &GpuBlendState) -> &mut Self { - self.blend_shim(val); + self.set_blend(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] - #[doc = "Change the `format` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`, `GpuTextureFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_format()` instead."] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); + self.set_format(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `writeMask` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuColorTargetState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_write_mask()` instead."] pub fn write_mask(&mut self, val: u32) -> &mut Self { - self.write_mask_shim(val); + self.set_write_mask(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs index 556718c1c69..af0d4b1455b 100644 --- a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCommandBufferDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuCommandBufferDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandBufferDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuCommandBufferDescriptor, val: &str); + pub fn set_label(this: &GpuCommandBufferDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuCommandBufferDescriptor { @@ -31,14 +47,9 @@ impl GpuCommandBufferDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandBufferDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs index 5e6cb5ae4d6..e883bd9c31e 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuCommandEncoderDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuCommandEncoderDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuCommandEncoderDescriptor, val: &str); + pub fn set_label(this: &GpuCommandEncoderDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuCommandEncoderDescriptor { @@ -31,14 +47,9 @@ impl GpuCommandEncoderDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoderDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs index ba493a46692..0da84742aa8 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs @@ -14,11 +14,49 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePassDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuComputePassDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuComputePassDescriptor, val: &str); + pub fn set_label(this: &GpuComputePassDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuComputePassTimestampWrites")] + #[doc = "Get the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`, `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestampWrites")] + pub fn get_timestamp_writes( + this: &GpuComputePassDescriptor, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuComputePassTimestampWrites")] + #[doc = "Change the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`, `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "timestampWrites")] - fn timestamp_writes_shim(this: &GpuComputePassDescriptor, val: &GpuComputePassTimestampWrites); + pub fn set_timestamp_writes( + this: &GpuComputePassDescriptor, + val: &GpuComputePassTimestampWrites, + ); } #[cfg(web_sys_unstable_apis)] impl GpuComputePassDescriptor { @@ -34,26 +72,16 @@ impl GpuComputePassDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuComputePassTimestampWrites")] - #[doc = "Change the `timestampWrites` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`, `GpuComputePassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_timestamp_writes()` instead."] pub fn timestamp_writes(&mut self, val: &GpuComputePassTimestampWrites) -> &mut Self { - self.timestamp_writes_shim(val); + self.set_timestamp_writes(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs index fec406f183f..5ff73d7fd3c 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePassTimestampWrites; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `beginningOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "beginningOfPassWriteIndex")] + pub fn get_beginning_of_pass_write_index(this: &GpuComputePassTimestampWrites) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `beginningOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "beginningOfPassWriteIndex")] - fn beginning_of_pass_write_index_shim(this: &GpuComputePassTimestampWrites, val: u32); + pub fn set_beginning_of_pass_write_index(this: &GpuComputePassTimestampWrites, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `endOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "endOfPassWriteIndex")] + pub fn get_end_of_pass_write_index(this: &GpuComputePassTimestampWrites) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `endOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "endOfPassWriteIndex")] - fn end_of_pass_write_index_shim(this: &GpuComputePassTimestampWrites, val: u32); + pub fn set_end_of_pass_write_index(this: &GpuComputePassTimestampWrites, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQuerySet")] + #[doc = "Get the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`, `GpuQuerySet`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "querySet")] + pub fn get_query_set(this: &GpuComputePassTimestampWrites) -> GpuQuerySet; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] + #[doc = "Change the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`, `GpuQuerySet`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "querySet")] - fn query_set_shim(this: &GpuComputePassTimestampWrites, val: &GpuQuerySet); + pub fn set_query_set(this: &GpuComputePassTimestampWrites, val: &GpuQuerySet); } #[cfg(web_sys_unstable_apis)] impl GpuComputePassTimestampWrites { @@ -38,37 +87,22 @@ impl GpuComputePassTimestampWrites { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `beginningOfPassWriteIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_beginning_of_pass_write_index()` instead."] pub fn beginning_of_pass_write_index(&mut self, val: u32) -> &mut Self { - self.beginning_of_pass_write_index_shim(val); + self.set_beginning_of_pass_write_index(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `endOfPassWriteIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_end_of_pass_write_index()` instead."] pub fn end_of_pass_write_index(&mut self, val: u32) -> &mut Self { - self.end_of_pass_write_index_shim(val); + self.set_end_of_pass_write_index(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] - #[doc = "Change the `querySet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`, `GpuQuerySet`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_query_set()` instead."] pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - self.query_set_shim(val); + self.set_query_set(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs index ad49e55c478..0dc1e1a0423 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuComputePipelineDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuComputePipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuComputePipelineDescriptor, val: &str); + pub fn set_label(this: &GpuComputePipelineDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &GpuComputePipelineDescriptor) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &GpuComputePipelineDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_layout(this: &GpuComputePipelineDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuProgrammableStage")] + #[doc = "Get the `compute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`, `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "compute")] + pub fn get_compute(this: &GpuComputePipelineDescriptor) -> GpuProgrammableStage; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuProgrammableStage")] + #[doc = "Change the `compute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`, `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "compute")] - fn compute_shim(this: &GpuComputePipelineDescriptor, val: &GpuProgrammableStage); + pub fn set_compute(this: &GpuComputePipelineDescriptor, val: &GpuProgrammableStage); } #[cfg(web_sys_unstable_apis)] impl GpuComputePipelineDescriptor { @@ -39,37 +88,22 @@ impl GpuComputePipelineDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuProgrammableStage")] - #[doc = "Change the `compute` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuComputePipelineDescriptor`, `GpuProgrammableStage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_compute()` instead."] pub fn compute(&mut self, val: &GpuProgrammableStage) -> &mut Self { - self.compute_shim(val); + self.set_compute(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs index f991cd4c9b4..0c9a964b7f2 100644 --- a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs +++ b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs @@ -14,46 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuDepthStencilState; - #[wasm_bindgen(method, setter = "depthBias")] - fn depth_bias_shim(this: &GpuDepthStencilState, val: i32); - #[wasm_bindgen(method, setter = "depthBiasClamp")] - fn depth_bias_clamp_shim(this: &GpuDepthStencilState, val: f32); - #[wasm_bindgen(method, setter = "depthBiasSlopeScale")] - fn depth_bias_slope_scale_shim(this: &GpuDepthStencilState, val: f32); - #[cfg(feature = "GpuCompareFunction")] - #[wasm_bindgen(method, setter = "depthCompare")] - fn depth_compare_shim(this: &GpuDepthStencilState, val: GpuCompareFunction); - #[wasm_bindgen(method, setter = "depthWriteEnabled")] - fn depth_write_enabled_shim(this: &GpuDepthStencilState, val: bool); - #[cfg(feature = "GpuTextureFormat")] - #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuDepthStencilState, val: GpuTextureFormat); - #[cfg(feature = "GpuStencilFaceState")] - #[wasm_bindgen(method, setter = "stencilBack")] - fn stencil_back_shim(this: &GpuDepthStencilState, val: &GpuStencilFaceState); - #[cfg(feature = "GpuStencilFaceState")] - #[wasm_bindgen(method, setter = "stencilFront")] - fn stencil_front_shim(this: &GpuDepthStencilState, val: &GpuStencilFaceState); - #[wasm_bindgen(method, setter = "stencilReadMask")] - fn stencil_read_mask_shim(this: &GpuDepthStencilState, val: u32); - #[wasm_bindgen(method, setter = "stencilWriteMask")] - fn stencil_write_mask_shim(this: &GpuDepthStencilState, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuDepthStencilState { - #[cfg(feature = "GpuTextureFormat")] - #[doc = "Construct a new `GpuDepthStencilState`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthBias` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuTextureFormat`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(format: GpuTextureFormat) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); - ret - } + #[wasm_bindgen(method, getter = "depthBias")] + pub fn get_depth_bias(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthBias` field of this object."] #[doc = ""] @@ -61,10 +30,17 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_bias(&mut self, val: i32) -> &mut Self { - self.depth_bias_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthBias")] + pub fn set_depth_bias(this: &GpuDepthStencilState, val: i32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthBiasClamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthBiasClamp")] + pub fn get_depth_bias_clamp(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthBiasClamp` field of this object."] #[doc = ""] @@ -72,10 +48,17 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_bias_clamp(&mut self, val: f32) -> &mut Self { - self.depth_bias_clamp_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthBiasClamp")] + pub fn set_depth_bias_clamp(this: &GpuDepthStencilState, val: f32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthBiasSlopeScale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthBiasSlopeScale")] + pub fn get_depth_bias_slope_scale(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthBiasSlopeScale` field of this object."] #[doc = ""] @@ -83,10 +66,18 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_bias_slope_scale(&mut self, val: f32) -> &mut Self { - self.depth_bias_slope_scale_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthBiasSlopeScale")] + pub fn set_depth_bias_slope_scale(this: &GpuDepthStencilState, val: f32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCompareFunction")] + #[doc = "Get the `depthCompare` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthCompare")] + pub fn get_depth_compare(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCompareFunction")] #[doc = "Change the `depthCompare` field of this object."] @@ -95,10 +86,17 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_compare(&mut self, val: GpuCompareFunction) -> &mut Self { - self.depth_compare_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthCompare")] + pub fn set_depth_compare(this: &GpuDepthStencilState, val: GpuCompareFunction); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthWriteEnabled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthWriteEnabled")] + pub fn get_depth_write_enabled(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthWriteEnabled` field of this object."] #[doc = ""] @@ -106,10 +104,18 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_write_enabled(&mut self, val: bool) -> &mut Self { - self.depth_write_enabled_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthWriteEnabled")] + pub fn set_depth_write_enabled(this: &GpuDepthStencilState, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuDepthStencilState) -> GpuTextureFormat; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] #[doc = "Change the `format` field of this object."] @@ -118,10 +124,18 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); - self - } + #[wasm_bindgen(method, setter = "format")] + pub fn set_format(this: &GpuDepthStencilState, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilFaceState")] + #[doc = "Get the `stencilBack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuStencilFaceState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilBack")] + pub fn get_stencil_back(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilFaceState")] #[doc = "Change the `stencilBack` field of this object."] @@ -130,10 +144,18 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_back(&mut self, val: &GpuStencilFaceState) -> &mut Self { - self.stencil_back_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilBack")] + pub fn set_stencil_back(this: &GpuDepthStencilState, val: &GpuStencilFaceState); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilFaceState")] + #[doc = "Get the `stencilFront` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuStencilFaceState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilFront")] + pub fn get_stencil_front(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilFaceState")] #[doc = "Change the `stencilFront` field of this object."] @@ -142,10 +164,17 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_front(&mut self, val: &GpuStencilFaceState) -> &mut Self { - self.stencil_front_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilFront")] + pub fn set_stencil_front(this: &GpuDepthStencilState, val: &GpuStencilFaceState); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencilReadMask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilReadMask")] + pub fn get_stencil_read_mask(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencilReadMask` field of this object."] #[doc = ""] @@ -153,10 +182,17 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_read_mask(&mut self, val: u32) -> &mut Self { - self.stencil_read_mask_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilReadMask")] + pub fn set_stencil_read_mask(this: &GpuDepthStencilState, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencilWriteMask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilWriteMask")] + pub fn get_stencil_write_mask(this: &GpuDepthStencilState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencilWriteMask` field of this object."] #[doc = ""] @@ -164,8 +200,86 @@ impl GpuDepthStencilState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "stencilWriteMask")] + pub fn set_stencil_write_mask(this: &GpuDepthStencilState, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuDepthStencilState { + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Construct a new `GpuDepthStencilState`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(format: GpuTextureFormat) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.format(format); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_bias()` instead."] + pub fn depth_bias(&mut self, val: i32) -> &mut Self { + self.set_depth_bias(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_bias_clamp()` instead."] + pub fn depth_bias_clamp(&mut self, val: f32) -> &mut Self { + self.set_depth_bias_clamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_bias_slope_scale()` instead."] + pub fn depth_bias_slope_scale(&mut self, val: f32) -> &mut Self { + self.set_depth_bias_slope_scale(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCompareFunction")] + #[deprecated = "Use `set_depth_compare()` instead."] + pub fn depth_compare(&mut self, val: GpuCompareFunction) -> &mut Self { + self.set_depth_compare(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_write_enabled()` instead."] + pub fn depth_write_enabled(&mut self, val: bool) -> &mut Self { + self.set_depth_write_enabled(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[deprecated = "Use `set_format()` instead."] + pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { + self.set_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilFaceState")] + #[deprecated = "Use `set_stencil_back()` instead."] + pub fn stencil_back(&mut self, val: &GpuStencilFaceState) -> &mut Self { + self.set_stencil_back(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilFaceState")] + #[deprecated = "Use `set_stencil_front()` instead."] + pub fn stencil_front(&mut self, val: &GpuStencilFaceState) -> &mut Self { + self.set_stencil_front(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil_read_mask()` instead."] + pub fn stencil_read_mask(&mut self, val: u32) -> &mut Self { + self.set_stencil_read_mask(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil_write_mask()` instead."] pub fn stencil_write_mask(&mut self, val: u32) -> &mut Self { - self.stencil_write_mask_shim(val); + self.set_stencil_write_mask(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index 4507817ca89..02166f68a81 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuDeviceDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuDeviceDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuDeviceDescriptor, val: &str); + pub fn set_label(this: &GpuDeviceDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueueDescriptor")] + #[doc = "Get the `defaultQueue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`, `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "defaultQueue")] + pub fn get_default_queue(this: &GpuDeviceDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQueueDescriptor")] + #[doc = "Change the `defaultQueue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`, `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "defaultQueue")] - fn default_queue_shim(this: &GpuDeviceDescriptor, val: &GpuQueueDescriptor); + pub fn set_default_queue(this: &GpuDeviceDescriptor, val: &GpuQueueDescriptor); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requiredFeatures")] + pub fn get_required_features(this: &GpuDeviceDescriptor) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "requiredFeatures")] - fn required_features_shim(this: &GpuDeviceDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_required_features(this: &GpuDeviceDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuDeviceDescriptor { @@ -36,37 +85,22 @@ impl GpuDeviceDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueueDescriptor")] - #[doc = "Change the `defaultQueue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`, `GpuQueueDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_default_queue()` instead."] pub fn default_queue(&mut self, val: &GpuQueueDescriptor) -> &mut Self { - self.default_queue_shim(val); + self.set_default_queue(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `requiredFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_required_features()` instead."] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.required_features_shim(val); + self.set_required_features(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs index b0c9f2338d1..afe482f277c 100644 --- a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs @@ -14,12 +14,60 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuExtent3dDict; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthOrArrayLayers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthOrArrayLayers")] + pub fn get_depth_or_array_layers(this: &GpuExtent3dDict) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `depthOrArrayLayers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "depthOrArrayLayers")] - fn depth_or_array_layers_shim(this: &GpuExtent3dDict, val: u32); + pub fn set_depth_or_array_layers(this: &GpuExtent3dDict, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &GpuExtent3dDict) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &GpuExtent3dDict, val: u32); + pub fn set_height(this: &GpuExtent3dDict, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &GpuExtent3dDict) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &GpuExtent3dDict, val: u32); + pub fn set_width(this: &GpuExtent3dDict, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuExtent3dDict { @@ -36,36 +84,21 @@ impl GpuExtent3dDict { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `depthOrArrayLayers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_depth_or_array_layers()` instead."] pub fn depth_or_array_layers(&mut self, val: u32) -> &mut Self { - self.depth_or_array_layers_shim(val); + self.set_depth_or_array_layers(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: u32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: u32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs index 13c397f5f3f..913093af5c6 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuExternalTextureDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuExternalTextureDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuExternalTextureDescriptor, val: &str); + pub fn set_label(this: &GpuExternalTextureDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &GpuExternalTextureDescriptor) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &GpuExternalTextureDescriptor, val: &::js_sys::Object); + pub fn set_source(this: &GpuExternalTextureDescriptor, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuExternalTextureDescriptor { @@ -34,25 +66,15 @@ impl GpuExternalTextureDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: &::js_sys::Object) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index e39fe9e57cb..33c1059e584 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuFragmentState; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entryPoint")] + pub fn get_entry_point(this: &GpuFragmentState) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entryPoint")] - fn entry_point_shim(this: &GpuFragmentState, val: &str); + pub fn set_entry_point(this: &GpuFragmentState, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] + #[doc = "Get the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuShaderModule`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "module")] + pub fn get_module(this: &GpuFragmentState) -> GpuShaderModule; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuShaderModule")] + #[doc = "Change the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuShaderModule`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "module")] - fn module_shim(this: &GpuFragmentState, val: &GpuShaderModule); + pub fn set_module(this: &GpuFragmentState, val: &GpuShaderModule); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `targets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "targets")] + pub fn get_targets(this: &GpuFragmentState) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `targets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "targets")] - fn targets_shim(this: &GpuFragmentState, val: &::wasm_bindgen::JsValue); + pub fn set_targets(this: &GpuFragmentState, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuFragmentState { @@ -39,37 +88,22 @@ impl GpuFragmentState { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entryPoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { - self.entry_point_shim(val); + self.set_entry_point(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] - #[doc = "Change the `module` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuShaderModule`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_module()` instead."] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - self.module_shim(val); + self.set_module(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `targets` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_targets()` instead."] pub fn targets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.targets_shim(val); + self.set_targets(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs b/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs index fdfcc69a438..153b4004980 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyBuffer; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesPerRow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytesPerRow")] + pub fn get_bytes_per_row(this: &GpuImageCopyBuffer) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytesPerRow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bytesPerRow")] - fn bytes_per_row_shim(this: &GpuImageCopyBuffer, val: u32); + pub fn set_bytes_per_row(this: &GpuImageCopyBuffer, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &GpuImageCopyBuffer) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &GpuImageCopyBuffer, val: f64); + pub fn set_offset(this: &GpuImageCopyBuffer, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rowsPerImage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rowsPerImage")] + pub fn get_rows_per_image(this: &GpuImageCopyBuffer) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rowsPerImage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "rowsPerImage")] - fn rows_per_image_shim(this: &GpuImageCopyBuffer, val: u32); + pub fn set_rows_per_image(this: &GpuImageCopyBuffer, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + #[doc = "Get the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "buffer")] + pub fn get_buffer(this: &GpuImageCopyBuffer) -> GpuBuffer; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] + #[doc = "Change the `buffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "buffer")] - fn buffer_shim(this: &GpuImageCopyBuffer, val: &GpuBuffer); + pub fn set_buffer(this: &GpuImageCopyBuffer, val: &GpuBuffer); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyBuffer { @@ -40,48 +105,28 @@ impl GpuImageCopyBuffer { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bytesPerRow` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bytes_per_row()` instead."] pub fn bytes_per_row(&mut self, val: u32) -> &mut Self { - self.bytes_per_row_shim(val); + self.set_bytes_per_row(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: f64) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `rowsPerImage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_rows_per_image()` instead."] pub fn rows_per_image(&mut self, val: u32) -> &mut Self { - self.rows_per_image_shim(val); + self.set_rows_per_image(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - #[doc = "Change the `buffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_buffer()` instead."] pub fn buffer(&mut self, val: &GpuBuffer) -> &mut Self { - self.buffer_shim(val); + self.set_buffer(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs index 54c22ac9306..c471c154757 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs @@ -14,12 +14,60 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyExternalImage; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `flipY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "flipY")] + pub fn get_flip_y(this: &GpuImageCopyExternalImage) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `flipY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "flipY")] - fn flip_y_shim(this: &GpuImageCopyExternalImage, val: bool); + pub fn set_flip_y(this: &GpuImageCopyExternalImage, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &GpuImageCopyExternalImage) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &GpuImageCopyExternalImage, val: &::wasm_bindgen::JsValue); + pub fn set_origin(this: &GpuImageCopyExternalImage, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &GpuImageCopyExternalImage) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &GpuImageCopyExternalImage, val: &::js_sys::Object); + pub fn set_source(this: &GpuImageCopyExternalImage, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyExternalImage { @@ -36,36 +84,21 @@ impl GpuImageCopyExternalImage { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `flipY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_flip_y()` instead."] pub fn flip_y(&mut self, val: bool) -> &mut Self { - self.flip_y_shim(val); + self.set_flip_y(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: &::js_sys::Object) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs b/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs index c461d41a126..96b81683bf3 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs @@ -14,16 +14,82 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyTexture; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureAspect")] + #[doc = "Get the `aspect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTextureAspect`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "aspect")] + pub fn get_aspect(this: &GpuImageCopyTexture) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] + #[doc = "Change the `aspect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTextureAspect`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "aspect")] - fn aspect_shim(this: &GpuImageCopyTexture, val: GpuTextureAspect); + pub fn set_aspect(this: &GpuImageCopyTexture, val: GpuTextureAspect); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mipLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mipLevel")] + pub fn get_mip_level(this: &GpuImageCopyTexture) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mipLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mipLevel")] - fn mip_level_shim(this: &GpuImageCopyTexture, val: u32); + pub fn set_mip_level(this: &GpuImageCopyTexture, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &GpuImageCopyTexture) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &GpuImageCopyTexture, val: &::wasm_bindgen::JsValue); + pub fn set_origin(this: &GpuImageCopyTexture, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTexture")] + #[doc = "Get the `texture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "texture")] + pub fn get_texture(this: &GpuImageCopyTexture) -> GpuTexture; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] + #[doc = "Change the `texture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "texture")] - fn texture_shim(this: &GpuImageCopyTexture, val: &GpuTexture); + pub fn set_texture(this: &GpuImageCopyTexture, val: &GpuTexture); } #[cfg(web_sys_unstable_apis)] impl GpuImageCopyTexture { @@ -42,48 +108,28 @@ impl GpuImageCopyTexture { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] - #[doc = "Change the `aspect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTextureAspect`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_aspect()` instead."] pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - self.aspect_shim(val); + self.set_aspect(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `mipLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mip_level()` instead."] pub fn mip_level(&mut self, val: u32) -> &mut Self { - self.mip_level_shim(val); + self.set_mip_level(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] - #[doc = "Change the `texture` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_texture()` instead."] pub fn texture(&mut self, val: &GpuTexture) -> &mut Self { - self.texture_shim(val); + self.set_texture(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs index 554f63396d4..d0cc4179b3b 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs +++ b/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs @@ -14,34 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageCopyTextureTagged; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] - #[wasm_bindgen(method, setter = "aspect")] - fn aspect_shim(this: &GpuImageCopyTextureTagged, val: GpuTextureAspect); - #[wasm_bindgen(method, setter = "mipLevel")] - fn mip_level_shim(this: &GpuImageCopyTextureTagged, val: u32); - #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &GpuImageCopyTextureTagged, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "GpuTexture")] - #[wasm_bindgen(method, setter = "texture")] - fn texture_shim(this: &GpuImageCopyTextureTagged, val: &GpuTexture); - #[wasm_bindgen(method, setter = "premultipliedAlpha")] - fn premultiplied_alpha_shim(this: &GpuImageCopyTextureTagged, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl GpuImageCopyTextureTagged { - #[cfg(feature = "GpuTexture")] - #[doc = "Construct a new `GpuImageCopyTextureTagged`."] + #[doc = "Get the `aspect` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTextureAspect`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(texture: &GpuTexture) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.texture(texture); - ret - } + #[wasm_bindgen(method, getter = "aspect")] + pub fn get_aspect(this: &GpuImageCopyTextureTagged) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Change the `aspect` field of this object."] @@ -50,10 +32,17 @@ impl GpuImageCopyTextureTagged { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - self.aspect_shim(val); - self - } + #[wasm_bindgen(method, setter = "aspect")] + pub fn set_aspect(this: &GpuImageCopyTextureTagged, val: GpuTextureAspect); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mipLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mipLevel")] + pub fn get_mip_level(this: &GpuImageCopyTextureTagged) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mipLevel` field of this object."] #[doc = ""] @@ -61,10 +50,17 @@ impl GpuImageCopyTextureTagged { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mip_level(&mut self, val: u32) -> &mut Self { - self.mip_level_shim(val); - self - } + #[wasm_bindgen(method, setter = "mipLevel")] + pub fn set_mip_level(this: &GpuImageCopyTextureTagged, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &GpuImageCopyTextureTagged) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `origin` field of this object."] #[doc = ""] @@ -72,10 +68,18 @@ impl GpuImageCopyTextureTagged { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.origin_shim(val); - self - } + #[wasm_bindgen(method, setter = "origin")] + pub fn set_origin(this: &GpuImageCopyTextureTagged, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTexture")] + #[doc = "Get the `texture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "texture")] + pub fn get_texture(this: &GpuImageCopyTextureTagged) -> GpuTexture; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] #[doc = "Change the `texture` field of this object."] @@ -84,10 +88,17 @@ impl GpuImageCopyTextureTagged { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn texture(&mut self, val: &GpuTexture) -> &mut Self { - self.texture_shim(val); - self - } + #[wasm_bindgen(method, setter = "texture")] + pub fn set_texture(this: &GpuImageCopyTextureTagged, val: &GpuTexture); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `premultipliedAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "premultipliedAlpha")] + pub fn get_premultiplied_alpha(this: &GpuImageCopyTextureTagged) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `premultipliedAlpha` field of this object."] #[doc = ""] @@ -95,8 +106,54 @@ impl GpuImageCopyTextureTagged { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "premultipliedAlpha")] + pub fn set_premultiplied_alpha(this: &GpuImageCopyTextureTagged, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl GpuImageCopyTextureTagged { + #[cfg(feature = "GpuTexture")] + #[doc = "Construct a new `GpuImageCopyTextureTagged`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(texture: &GpuTexture) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.texture(texture); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureAspect")] + #[deprecated = "Use `set_aspect()` instead."] + pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { + self.set_aspect(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mip_level()` instead."] + pub fn mip_level(&mut self, val: u32) -> &mut Self { + self.set_mip_level(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_origin()` instead."] + pub fn origin(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_origin(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTexture")] + #[deprecated = "Use `set_texture()` instead."] + pub fn texture(&mut self, val: &GpuTexture) -> &mut Self { + self.set_texture(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_premultiplied_alpha()` instead."] pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self { - self.premultiplied_alpha_shim(val); + self.set_premultiplied_alpha(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs b/crates/web-sys/src/features/gen_GpuImageDataLayout.rs index cb267577615..c0ecc701835 100644 --- a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs +++ b/crates/web-sys/src/features/gen_GpuImageDataLayout.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuImageDataLayout; - #[wasm_bindgen(method, setter = "bytesPerRow")] - fn bytes_per_row_shim(this: &GpuImageDataLayout, val: u32); - #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &GpuImageDataLayout, val: f64); - #[wasm_bindgen(method, setter = "rowsPerImage")] - fn rows_per_image_shim(this: &GpuImageDataLayout, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuImageDataLayout { - #[doc = "Construct a new `GpuImageDataLayout`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesPerRow` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "bytesPerRow")] + pub fn get_bytes_per_row(this: &GpuImageDataLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesPerRow` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl GpuImageDataLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_per_row(&mut self, val: u32) -> &mut Self { - self.bytes_per_row_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesPerRow")] + pub fn set_bytes_per_row(this: &GpuImageDataLayout, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &GpuImageDataLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `offset` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl GpuImageDataLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn offset(&mut self, val: f64) -> &mut Self { - self.offset_shim(val); - self - } + #[wasm_bindgen(method, setter = "offset")] + pub fn set_offset(this: &GpuImageDataLayout, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rowsPerImage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rowsPerImage")] + pub fn get_rows_per_image(this: &GpuImageDataLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rowsPerImage` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl GpuImageDataLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rowsPerImage")] + pub fn set_rows_per_image(this: &GpuImageDataLayout, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuImageDataLayout { + #[doc = "Construct a new `GpuImageDataLayout`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_per_row()` instead."] + pub fn bytes_per_row(&mut self, val: u32) -> &mut Self { + self.set_bytes_per_row(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_offset()` instead."] + pub fn offset(&mut self, val: f64) -> &mut Self { + self.set_offset(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rows_per_image()` instead."] pub fn rows_per_image(&mut self, val: u32) -> &mut Self { - self.rows_per_image_shim(val); + self.set_rows_per_image(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuMultisampleState.rs b/crates/web-sys/src/features/gen_GpuMultisampleState.rs index af9b5e2e8ec..7c969efbd9e 100644 --- a/crates/web-sys/src/features/gen_GpuMultisampleState.rs +++ b/crates/web-sys/src/features/gen_GpuMultisampleState.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuMultisampleState; - #[wasm_bindgen(method, setter = "alphaToCoverageEnabled")] - fn alpha_to_coverage_enabled_shim(this: &GpuMultisampleState, val: bool); - #[wasm_bindgen(method, setter = "count")] - fn count_shim(this: &GpuMultisampleState, val: u32); - #[wasm_bindgen(method, setter = "mask")] - fn mask_shim(this: &GpuMultisampleState, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuMultisampleState { - #[doc = "Construct a new `GpuMultisampleState`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `alphaToCoverageEnabled` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "alphaToCoverageEnabled")] + pub fn get_alpha_to_coverage_enabled(this: &GpuMultisampleState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `alphaToCoverageEnabled` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl GpuMultisampleState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn alpha_to_coverage_enabled(&mut self, val: bool) -> &mut Self { - self.alpha_to_coverage_enabled_shim(val); - self - } + #[wasm_bindgen(method, setter = "alphaToCoverageEnabled")] + pub fn set_alpha_to_coverage_enabled(this: &GpuMultisampleState, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `count` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "count")] + pub fn get_count(this: &GpuMultisampleState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `count` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl GpuMultisampleState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn count(&mut self, val: u32) -> &mut Self { - self.count_shim(val); - self - } + #[wasm_bindgen(method, setter = "count")] + pub fn set_count(this: &GpuMultisampleState, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mask")] + pub fn get_mask(this: &GpuMultisampleState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mask` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl GpuMultisampleState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mask")] + pub fn set_mask(this: &GpuMultisampleState, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuMultisampleState { + #[doc = "Construct a new `GpuMultisampleState`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_alpha_to_coverage_enabled()` instead."] + pub fn alpha_to_coverage_enabled(&mut self, val: bool) -> &mut Self { + self.set_alpha_to_coverage_enabled(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_count()` instead."] + pub fn count(&mut self, val: u32) -> &mut Self { + self.set_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mask()` instead."] pub fn mask(&mut self, val: u32) -> &mut Self { - self.mask_shim(val); + self.set_mask(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs index 147e49b806a..37e3d9fa7b0 100644 --- a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuObjectDescriptorBase; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuObjectDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuObjectDescriptorBase) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuObjectDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuObjectDescriptorBase, val: &str); + pub fn set_label(this: &GpuObjectDescriptorBase, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuObjectDescriptorBase { @@ -31,14 +47,9 @@ impl GpuObjectDescriptorBase { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuObjectDescriptorBase`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs b/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs index da5d620d658..a0732ec3fb6 100644 --- a/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs +++ b/crates/web-sys/src/features/gen_GpuOrigin2dDict.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOrigin2dDict; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &GpuOrigin2dDict) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &GpuOrigin2dDict, val: u32); + pub fn set_x(this: &GpuOrigin2dDict, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &GpuOrigin2dDict) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &GpuOrigin2dDict, val: u32); + pub fn set_y(this: &GpuOrigin2dDict, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuOrigin2dDict { @@ -33,25 +65,15 @@ impl GpuOrigin2dDict { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: u32) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuOrigin2dDict`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: u32) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs b/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs index ddca14f3aae..a14679d2d60 100644 --- a/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuOrigin3dDict.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuOrigin3dDict; - #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &GpuOrigin3dDict, val: u32); - #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &GpuOrigin3dDict, val: u32); - #[wasm_bindgen(method, setter = "z")] - fn z_shim(this: &GpuOrigin3dDict, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuOrigin3dDict { - #[doc = "Construct a new `GpuOrigin3dDict`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuOrigin3dDict`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &GpuOrigin3dDict) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `x` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl GpuOrigin3dDict { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn x(&mut self, val: u32) -> &mut Self { - self.x_shim(val); - self - } + #[wasm_bindgen(method, setter = "x")] + pub fn set_x(this: &GpuOrigin3dDict, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &GpuOrigin3dDict) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `y` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl GpuOrigin3dDict { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn y(&mut self, val: u32) -> &mut Self { - self.y_shim(val); - self - } + #[wasm_bindgen(method, setter = "y")] + pub fn set_y(this: &GpuOrigin3dDict, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `z` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "z")] + pub fn get_z(this: &GpuOrigin3dDict) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `z` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl GpuOrigin3dDict { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "z")] + pub fn set_z(this: &GpuOrigin3dDict, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuOrigin3dDict { + #[doc = "Construct a new `GpuOrigin3dDict`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuOrigin3dDict`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_x()` instead."] + pub fn x(&mut self, val: u32) -> &mut Self { + self.set_x(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_y()` instead."] + pub fn y(&mut self, val: u32) -> &mut Self { + self.set_y(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_z()` instead."] pub fn z(&mut self, val: u32) -> &mut Self { - self.z_shim(val); + self.set_z(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs index 8f94167a0c2..05a2206a33c 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineDescriptorBase; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuPipelineDescriptorBase) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuPipelineDescriptorBase, val: &str); + pub fn set_label(this: &GpuPipelineDescriptorBase, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &GpuPipelineDescriptorBase) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &GpuPipelineDescriptorBase, val: &::wasm_bindgen::JsValue); + pub fn set_layout(this: &GpuPipelineDescriptorBase, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineDescriptorBase { @@ -34,25 +66,15 @@ impl GpuPipelineDescriptorBase { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineDescriptorBase`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs index 4153f498d14..cc70a2d1386 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineErrorInit; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPipelineErrorReason")] + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineErrorInit`, `GpuPipelineErrorReason`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &GpuPipelineErrorInit) -> GpuPipelineErrorReason; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPipelineErrorReason")] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineErrorInit`, `GpuPipelineErrorReason`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &GpuPipelineErrorInit, val: GpuPipelineErrorReason); + pub fn set_reason(this: &GpuPipelineErrorInit, val: GpuPipelineErrorReason); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineErrorInit { @@ -35,14 +52,9 @@ impl GpuPipelineErrorInit { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPipelineErrorReason")] - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineErrorInit`, `GpuPipelineErrorReason`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: GpuPipelineErrorReason) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs index a1113b81f2f..cff6b220139 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs @@ -14,10 +14,45 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPipelineLayoutDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuPipelineLayoutDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuPipelineLayoutDescriptor, val: &str); + pub fn set_label(this: &GpuPipelineLayoutDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bindGroupLayouts` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bindGroupLayouts")] + pub fn get_bind_group_layouts(this: &GpuPipelineLayoutDescriptor) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bindGroupLayouts` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bindGroupLayouts")] - fn bind_group_layouts_shim(this: &GpuPipelineLayoutDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_bind_group_layouts( + this: &GpuPipelineLayoutDescriptor, + val: &::wasm_bindgen::JsValue, + ); } #[cfg(web_sys_unstable_apis)] impl GpuPipelineLayoutDescriptor { @@ -34,25 +69,15 @@ impl GpuPipelineLayoutDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bindGroupLayouts` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPipelineLayoutDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bind_group_layouts()` instead."] pub fn bind_group_layouts(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.bind_group_layouts_shim(val); + self.set_bind_group_layouts(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs index 1c2c627c22a..aae66b1cde7 100644 --- a/crates/web-sys/src/features/gen_GpuPrimitiveState.rs +++ b/crates/web-sys/src/features/gen_GpuPrimitiveState.rs @@ -14,34 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuPrimitiveState; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCullMode")] - #[wasm_bindgen(method, setter = "cullMode")] - fn cull_mode_shim(this: &GpuPrimitiveState, val: GpuCullMode); - #[cfg(feature = "GpuFrontFace")] - #[wasm_bindgen(method, setter = "frontFace")] - fn front_face_shim(this: &GpuPrimitiveState, val: GpuFrontFace); - #[cfg(feature = "GpuIndexFormat")] - #[wasm_bindgen(method, setter = "stripIndexFormat")] - fn strip_index_format_shim(this: &GpuPrimitiveState, val: GpuIndexFormat); - #[cfg(feature = "GpuPrimitiveTopology")] - #[wasm_bindgen(method, setter = "topology")] - fn topology_shim(this: &GpuPrimitiveState, val: GpuPrimitiveTopology); - #[wasm_bindgen(method, setter = "unclippedDepth")] - fn unclipped_depth_shim(this: &GpuPrimitiveState, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl GpuPrimitiveState { - #[doc = "Construct a new `GpuPrimitiveState`."] + #[doc = "Get the `cullMode` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCullMode`, `GpuPrimitiveState`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "cullMode")] + pub fn get_cull_mode(this: &GpuPrimitiveState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCullMode")] #[doc = "Change the `cullMode` field of this object."] @@ -50,10 +32,18 @@ impl GpuPrimitiveState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn cull_mode(&mut self, val: GpuCullMode) -> &mut Self { - self.cull_mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "cullMode")] + pub fn set_cull_mode(this: &GpuPrimitiveState, val: GpuCullMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFrontFace")] + #[doc = "Get the `frontFace` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFrontFace`, `GpuPrimitiveState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frontFace")] + pub fn get_front_face(this: &GpuPrimitiveState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuFrontFace")] #[doc = "Change the `frontFace` field of this object."] @@ -62,10 +52,18 @@ impl GpuPrimitiveState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn front_face(&mut self, val: GpuFrontFace) -> &mut Self { - self.front_face_shim(val); - self - } + #[wasm_bindgen(method, setter = "frontFace")] + pub fn set_front_face(this: &GpuPrimitiveState, val: GpuFrontFace); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuIndexFormat")] + #[doc = "Get the `stripIndexFormat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuIndexFormat`, `GpuPrimitiveState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stripIndexFormat")] + pub fn get_strip_index_format(this: &GpuPrimitiveState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuIndexFormat")] #[doc = "Change the `stripIndexFormat` field of this object."] @@ -74,10 +72,18 @@ impl GpuPrimitiveState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn strip_index_format(&mut self, val: GpuIndexFormat) -> &mut Self { - self.strip_index_format_shim(val); - self - } + #[wasm_bindgen(method, setter = "stripIndexFormat")] + pub fn set_strip_index_format(this: &GpuPrimitiveState, val: GpuIndexFormat); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPrimitiveTopology")] + #[doc = "Get the `topology` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`, `GpuPrimitiveTopology`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "topology")] + pub fn get_topology(this: &GpuPrimitiveState) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPrimitiveTopology")] #[doc = "Change the `topology` field of this object."] @@ -86,10 +92,17 @@ impl GpuPrimitiveState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn topology(&mut self, val: GpuPrimitiveTopology) -> &mut Self { - self.topology_shim(val); - self - } + #[wasm_bindgen(method, setter = "topology")] + pub fn set_topology(this: &GpuPrimitiveState, val: GpuPrimitiveTopology); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unclippedDepth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unclippedDepth")] + pub fn get_unclipped_depth(this: &GpuPrimitiveState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unclippedDepth` field of this object."] #[doc = ""] @@ -97,8 +110,54 @@ impl GpuPrimitiveState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "unclippedDepth")] + pub fn set_unclipped_depth(this: &GpuPrimitiveState, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl GpuPrimitiveState { + #[doc = "Construct a new `GpuPrimitiveState`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCullMode")] + #[deprecated = "Use `set_cull_mode()` instead."] + pub fn cull_mode(&mut self, val: GpuCullMode) -> &mut Self { + self.set_cull_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFrontFace")] + #[deprecated = "Use `set_front_face()` instead."] + pub fn front_face(&mut self, val: GpuFrontFace) -> &mut Self { + self.set_front_face(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuIndexFormat")] + #[deprecated = "Use `set_strip_index_format()` instead."] + pub fn strip_index_format(&mut self, val: GpuIndexFormat) -> &mut Self { + self.set_strip_index_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPrimitiveTopology")] + #[deprecated = "Use `set_topology()` instead."] + pub fn topology(&mut self, val: GpuPrimitiveTopology) -> &mut Self { + self.set_topology(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unclipped_depth()` instead."] pub fn unclipped_depth(&mut self, val: bool) -> &mut Self { - self.unclipped_depth_shim(val); + self.set_unclipped_depth(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index 2cce8beb098..3f929264764 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuProgrammableStage; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entryPoint")] + pub fn get_entry_point(this: &GpuProgrammableStage) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entryPoint")] - fn entry_point_shim(this: &GpuProgrammableStage, val: &str); + pub fn set_entry_point(this: &GpuProgrammableStage, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] + #[doc = "Get the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`, `GpuShaderModule`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "module")] + pub fn get_module(this: &GpuProgrammableStage) -> GpuShaderModule; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuShaderModule")] + #[doc = "Change the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`, `GpuShaderModule`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "module")] - fn module_shim(this: &GpuProgrammableStage, val: &GpuShaderModule); + pub fn set_module(this: &GpuProgrammableStage, val: &GpuShaderModule); } #[cfg(web_sys_unstable_apis)] impl GpuProgrammableStage { @@ -36,26 +69,16 @@ impl GpuProgrammableStage { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entryPoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { - self.entry_point_shim(val); + self.set_entry_point(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] - #[doc = "Change the `module` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`, `GpuShaderModule`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_module()` instead."] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - self.module_shim(val); + self.set_module(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs index 5fab281c1c3..36f3383a7e8 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuQuerySetDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuQuerySetDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuQuerySetDescriptor, val: &str); + pub fn set_label(this: &GpuQuerySetDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `count` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "count")] + pub fn get_count(this: &GpuQuerySetDescriptor) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `count` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "count")] - fn count_shim(this: &GpuQuerySetDescriptor, val: u32); + pub fn set_count(this: &GpuQuerySetDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQueryType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`, `GpuQueryType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &GpuQuerySetDescriptor) -> GpuQueryType; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueryType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`, `GpuQueryType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &GpuQuerySetDescriptor, val: GpuQueryType); + pub fn set_type(this: &GpuQuerySetDescriptor, val: GpuQueryType); } #[cfg(web_sys_unstable_apis)] impl GpuQuerySetDescriptor { @@ -39,37 +88,22 @@ impl GpuQuerySetDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `count` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_count()` instead."] pub fn count(&mut self, val: u32) -> &mut Self { - self.count_shim(val); + self.set_count(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueryType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`, `GpuQueryType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: GpuQueryType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs index e96c645e2bd..e07e624f8a5 100644 --- a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuQueueDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuQueueDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuQueueDescriptor, val: &str); + pub fn set_label(this: &GpuQueueDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuQueueDescriptor { @@ -31,14 +47,9 @@ impl GpuQueueDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQueueDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs index 3100a8cda05..a250f0fe19f 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderBundleDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuRenderBundleDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuRenderBundleDescriptor, val: &str); + pub fn set_label(this: &GpuRenderBundleDescriptor, val: &str); } #[cfg(web_sys_unstable_apis)] impl GpuRenderBundleDescriptor { @@ -31,14 +47,9 @@ impl GpuRenderBundleDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs index 82d76b71a56..895ff703e51 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs @@ -14,34 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderBundleEncoderDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuRenderBundleEncoderDescriptor, val: &str); - #[wasm_bindgen(method, setter = "colorFormats")] - fn color_formats_shim(this: &GpuRenderBundleEncoderDescriptor, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "GpuTextureFormat")] - #[wasm_bindgen(method, setter = "depthStencilFormat")] - fn depth_stencil_format_shim(this: &GpuRenderBundleEncoderDescriptor, val: GpuTextureFormat); - #[wasm_bindgen(method, setter = "sampleCount")] - fn sample_count_shim(this: &GpuRenderBundleEncoderDescriptor, val: u32); - #[wasm_bindgen(method, setter = "depthReadOnly")] - fn depth_read_only_shim(this: &GpuRenderBundleEncoderDescriptor, val: bool); - #[wasm_bindgen(method, setter = "stencilReadOnly")] - fn stencil_read_only_shim(this: &GpuRenderBundleEncoderDescriptor, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl GpuRenderBundleEncoderDescriptor { - #[doc = "Construct a new `GpuRenderBundleEncoderDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.color_formats(color_formats); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuRenderBundleEncoderDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -49,10 +30,17 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuRenderBundleEncoderDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `colorFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "colorFormats")] + pub fn get_color_formats(this: &GpuRenderBundleEncoderDescriptor) -> ::js_sys::Array; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `colorFormats` field of this object."] #[doc = ""] @@ -60,10 +48,23 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.color_formats_shim(val); - self - } + #[wasm_bindgen(method, setter = "colorFormats")] + pub fn set_color_formats( + this: &GpuRenderBundleEncoderDescriptor, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `depthStencilFormat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthStencilFormat")] + pub fn get_depth_stencil_format( + this: &GpuRenderBundleEncoderDescriptor, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] #[doc = "Change the `depthStencilFormat` field of this object."] @@ -72,10 +73,17 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.depth_stencil_format_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthStencilFormat")] + pub fn set_depth_stencil_format(this: &GpuRenderBundleEncoderDescriptor, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleCount")] + pub fn get_sample_count(this: &GpuRenderBundleEncoderDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sampleCount` field of this object."] #[doc = ""] @@ -83,10 +91,17 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn sample_count(&mut self, val: u32) -> &mut Self { - self.sample_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "sampleCount")] + pub fn set_sample_count(this: &GpuRenderBundleEncoderDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthReadOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthReadOnly")] + pub fn get_depth_read_only(this: &GpuRenderBundleEncoderDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthReadOnly` field of this object."] #[doc = ""] @@ -94,10 +109,17 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_read_only(&mut self, val: bool) -> &mut Self { - self.depth_read_only_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthReadOnly")] + pub fn set_depth_read_only(this: &GpuRenderBundleEncoderDescriptor, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencilReadOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilReadOnly")] + pub fn get_stencil_read_only(this: &GpuRenderBundleEncoderDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencilReadOnly` field of this object."] #[doc = ""] @@ -105,8 +127,58 @@ impl GpuRenderBundleEncoderDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "stencilReadOnly")] + pub fn set_stencil_read_only(this: &GpuRenderBundleEncoderDescriptor, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl GpuRenderBundleEncoderDescriptor { + #[doc = "Construct a new `GpuRenderBundleEncoderDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.color_formats(color_formats); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_color_formats()` instead."] + pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_color_formats(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[deprecated = "Use `set_depth_stencil_format()` instead."] + pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { + self.set_depth_stencil_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_sample_count()` instead."] + pub fn sample_count(&mut self, val: u32) -> &mut Self { + self.set_sample_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_read_only()` instead."] + pub fn depth_read_only(&mut self, val: bool) -> &mut Self { + self.set_depth_read_only(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil_read_only()` instead."] pub fn stencil_read_only(&mut self, val: bool) -> &mut Self { - self.stencil_read_only_shim(val); + self.set_stencil_read_only(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index d0506938272..7df6be14024 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -14,22 +14,122 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassColorAttachment; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `clearValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clearValue")] + pub fn get_clear_value(this: &GpuRenderPassColorAttachment) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clearValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "clearValue")] - fn clear_value_shim(this: &GpuRenderPassColorAttachment, val: &::wasm_bindgen::JsValue); + pub fn set_clear_value(this: &GpuRenderPassColorAttachment, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthSlice` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthSlice")] + pub fn get_depth_slice(this: &GpuRenderPassColorAttachment) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `depthSlice` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "depthSlice")] - fn depth_slice_shim(this: &GpuRenderPassColorAttachment, val: u32); + pub fn set_depth_slice(this: &GpuRenderPassColorAttachment, val: u32); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuLoadOp")] + #[doc = "Get the `loadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "loadOp")] + pub fn get_load_op(this: &GpuRenderPassColorAttachment) -> GpuLoadOp; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Change the `loadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassColorAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "loadOp")] - fn load_op_shim(this: &GpuRenderPassColorAttachment, val: GpuLoadOp); + pub fn set_load_op(this: &GpuRenderPassColorAttachment, val: GpuLoadOp); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] + #[doc = "Get the `resolveTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "resolveTarget")] + pub fn get_resolve_target(this: &GpuRenderPassColorAttachment) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureView")] + #[doc = "Change the `resolveTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "resolveTarget")] - fn resolve_target_shim(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); + pub fn set_resolve_target(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStoreOp")] + #[doc = "Get the `storeOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuStoreOp`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "storeOp")] + pub fn get_store_op(this: &GpuRenderPassColorAttachment) -> GpuStoreOp; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStoreOp")] + #[doc = "Change the `storeOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuStoreOp`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "storeOp")] - fn store_op_shim(this: &GpuRenderPassColorAttachment, val: GpuStoreOp); + pub fn set_store_op(this: &GpuRenderPassColorAttachment, val: GpuStoreOp); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureView")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &GpuRenderPassColorAttachment) -> GpuTextureView; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); + pub fn set_view(this: &GpuRenderPassColorAttachment, val: &GpuTextureView); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassColorAttachment { @@ -53,73 +153,43 @@ impl GpuRenderPassColorAttachment { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `clearValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_clear_value()` instead."] pub fn clear_value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.clear_value_shim(val); + self.set_clear_value(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `depthSlice` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_depth_slice()` instead."] pub fn depth_slice(&mut self, val: u32) -> &mut Self { - self.depth_slice_shim(val); + self.set_depth_slice(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuLoadOp")] - #[doc = "Change the `loadOp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassColorAttachment`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_load_op()` instead."] pub fn load_op(&mut self, val: GpuLoadOp) -> &mut Self { - self.load_op_shim(val); + self.set_load_op(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] - #[doc = "Change the `resolveTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_resolve_target()` instead."] pub fn resolve_target(&mut self, val: &GpuTextureView) -> &mut Self { - self.resolve_target_shim(val); + self.set_resolve_target(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStoreOp")] - #[doc = "Change the `storeOp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuStoreOp`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_store_op()` instead."] pub fn store_op(&mut self, val: GpuStoreOp) -> &mut Self { - self.store_op_shim(val); + self.set_store_op(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`, `GpuTextureView`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: &GpuTextureView) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs index 86f32e884fc..b7748828b22 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs @@ -14,45 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassDepthStencilAttachment; - #[wasm_bindgen(method, setter = "depthClearValue")] - fn depth_clear_value_shim(this: &GpuRenderPassDepthStencilAttachment, val: f32); - #[cfg(feature = "GpuLoadOp")] - #[wasm_bindgen(method, setter = "depthLoadOp")] - fn depth_load_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); - #[wasm_bindgen(method, setter = "depthReadOnly")] - fn depth_read_only_shim(this: &GpuRenderPassDepthStencilAttachment, val: bool); - #[cfg(feature = "GpuStoreOp")] - #[wasm_bindgen(method, setter = "depthStoreOp")] - fn depth_store_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); - #[wasm_bindgen(method, setter = "stencilClearValue")] - fn stencil_clear_value_shim(this: &GpuRenderPassDepthStencilAttachment, val: u32); - #[cfg(feature = "GpuLoadOp")] - #[wasm_bindgen(method, setter = "stencilLoadOp")] - fn stencil_load_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); - #[wasm_bindgen(method, setter = "stencilReadOnly")] - fn stencil_read_only_shim(this: &GpuRenderPassDepthStencilAttachment, val: bool); - #[cfg(feature = "GpuStoreOp")] - #[wasm_bindgen(method, setter = "stencilStoreOp")] - fn stencil_store_op_shim(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); - #[cfg(feature = "GpuTextureView")] - #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &GpuRenderPassDepthStencilAttachment, val: &GpuTextureView); -} -#[cfg(web_sys_unstable_apis)] -impl GpuRenderPassDepthStencilAttachment { - #[cfg(feature = "GpuTextureView")] - #[doc = "Construct a new `GpuRenderPassDepthStencilAttachment`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthClearValue` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuTextureView`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(view: &GpuTextureView) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.view(view); - ret - } + #[wasm_bindgen(method, getter = "depthClearValue")] + pub fn get_depth_clear_value(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthClearValue` field of this object."] #[doc = ""] @@ -60,10 +30,18 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_clear_value(&mut self, val: f32) -> &mut Self { - self.depth_clear_value_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthClearValue")] + pub fn set_depth_clear_value(this: &GpuRenderPassDepthStencilAttachment, val: f32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Get the `depthLoadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthLoadOp")] + pub fn get_depth_load_op(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuLoadOp")] #[doc = "Change the `depthLoadOp` field of this object."] @@ -72,10 +50,17 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_load_op(&mut self, val: GpuLoadOp) -> &mut Self { - self.depth_load_op_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthLoadOp")] + pub fn set_depth_load_op(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthReadOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthReadOnly")] + pub fn get_depth_read_only(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthReadOnly` field of this object."] #[doc = ""] @@ -83,10 +68,18 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_read_only(&mut self, val: bool) -> &mut Self { - self.depth_read_only_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthReadOnly")] + pub fn set_depth_read_only(this: &GpuRenderPassDepthStencilAttachment, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStoreOp")] + #[doc = "Get the `depthStoreOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuStoreOp`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthStoreOp")] + pub fn get_depth_store_op(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStoreOp")] #[doc = "Change the `depthStoreOp` field of this object."] @@ -95,10 +88,17 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_store_op(&mut self, val: GpuStoreOp) -> &mut Self { - self.depth_store_op_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthStoreOp")] + pub fn set_depth_store_op(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencilClearValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilClearValue")] + pub fn get_stencil_clear_value(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencilClearValue` field of this object."] #[doc = ""] @@ -106,10 +106,18 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_clear_value(&mut self, val: u32) -> &mut Self { - self.stencil_clear_value_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilClearValue")] + pub fn set_stencil_clear_value(this: &GpuRenderPassDepthStencilAttachment, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[doc = "Get the `stencilLoadOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLoadOp`, `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilLoadOp")] + pub fn get_stencil_load_op(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuLoadOp")] #[doc = "Change the `stencilLoadOp` field of this object."] @@ -118,10 +126,17 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_load_op(&mut self, val: GpuLoadOp) -> &mut Self { - self.stencil_load_op_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilLoadOp")] + pub fn set_stencil_load_op(this: &GpuRenderPassDepthStencilAttachment, val: GpuLoadOp); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencilReadOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilReadOnly")] + pub fn get_stencil_read_only(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencilReadOnly` field of this object."] #[doc = ""] @@ -129,10 +144,18 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_read_only(&mut self, val: bool) -> &mut Self { - self.stencil_read_only_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilReadOnly")] + pub fn set_stencil_read_only(this: &GpuRenderPassDepthStencilAttachment, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStoreOp")] + #[doc = "Get the `stencilStoreOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuStoreOp`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencilStoreOp")] + pub fn get_stencil_store_op(this: &GpuRenderPassDepthStencilAttachment) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStoreOp")] #[doc = "Change the `stencilStoreOp` field of this object."] @@ -141,10 +164,18 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn stencil_store_op(&mut self, val: GpuStoreOp) -> &mut Self { - self.stencil_store_op_shim(val); - self - } + #[wasm_bindgen(method, setter = "stencilStoreOp")] + pub fn set_stencil_store_op(this: &GpuRenderPassDepthStencilAttachment, val: GpuStoreOp); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureView")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &GpuRenderPassDepthStencilAttachment) -> GpuTextureView; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] #[doc = "Change the `view` field of this object."] @@ -153,8 +184,81 @@ impl GpuRenderPassDepthStencilAttachment { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "view")] + pub fn set_view(this: &GpuRenderPassDepthStencilAttachment, val: &GpuTextureView); +} +#[cfg(web_sys_unstable_apis)] +impl GpuRenderPassDepthStencilAttachment { + #[cfg(feature = "GpuTextureView")] + #[doc = "Construct a new `GpuRenderPassDepthStencilAttachment`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuTextureView`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(view: &GpuTextureView) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.view(view); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_clear_value()` instead."] + pub fn depth_clear_value(&mut self, val: f32) -> &mut Self { + self.set_depth_clear_value(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[deprecated = "Use `set_depth_load_op()` instead."] + pub fn depth_load_op(&mut self, val: GpuLoadOp) -> &mut Self { + self.set_depth_load_op(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_read_only()` instead."] + pub fn depth_read_only(&mut self, val: bool) -> &mut Self { + self.set_depth_read_only(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStoreOp")] + #[deprecated = "Use `set_depth_store_op()` instead."] + pub fn depth_store_op(&mut self, val: GpuStoreOp) -> &mut Self { + self.set_depth_store_op(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil_clear_value()` instead."] + pub fn stencil_clear_value(&mut self, val: u32) -> &mut Self { + self.set_stencil_clear_value(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuLoadOp")] + #[deprecated = "Use `set_stencil_load_op()` instead."] + pub fn stencil_load_op(&mut self, val: GpuLoadOp) -> &mut Self { + self.set_stencil_load_op(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil_read_only()` instead."] + pub fn stencil_read_only(&mut self, val: bool) -> &mut Self { + self.set_stencil_read_only(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStoreOp")] + #[deprecated = "Use `set_stencil_store_op()` instead."] + pub fn stencil_store_op(&mut self, val: GpuStoreOp) -> &mut Self { + self.set_stencil_store_op(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureView")] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: &GpuTextureView) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 7ba69a91ec3..4d388ca356e 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -14,24 +14,127 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuRenderPassDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuRenderPassDescriptor, val: &str); + pub fn set_label(this: &GpuRenderPassDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `colorAttachments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "colorAttachments")] + pub fn get_color_attachments(this: &GpuRenderPassDescriptor) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `colorAttachments` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "colorAttachments")] - fn color_attachments_shim(this: &GpuRenderPassDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_color_attachments(this: &GpuRenderPassDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuRenderPassDepthStencilAttachment")] + #[doc = "Get the `depthStencilAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthStencilAttachment")] + pub fn get_depth_stencil_attachment( + this: &GpuRenderPassDescriptor, + ) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderPassDepthStencilAttachment")] + #[doc = "Change the `depthStencilAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "depthStencilAttachment")] - fn depth_stencil_attachment_shim( + pub fn set_depth_stencil_attachment( this: &GpuRenderPassDescriptor, val: &GpuRenderPassDepthStencilAttachment, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `maxDrawCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "maxDrawCount")] + pub fn get_max_draw_count(this: &GpuRenderPassDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `maxDrawCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "maxDrawCount")] - fn max_draw_count_shim(this: &GpuRenderPassDescriptor, val: f64); + pub fn set_max_draw_count(this: &GpuRenderPassDescriptor, val: f64); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] + #[doc = "Get the `occlusionQuerySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "occlusionQuerySet")] + pub fn get_occlusion_query_set(this: &GpuRenderPassDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQuerySet")] + #[doc = "Change the `occlusionQuerySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "occlusionQuerySet")] - fn occlusion_query_set_shim(this: &GpuRenderPassDescriptor, val: &GpuQuerySet); + pub fn set_occlusion_query_set(this: &GpuRenderPassDescriptor, val: &GpuQuerySet); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuRenderPassTimestampWrites")] + #[doc = "Get the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`, `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestampWrites")] + pub fn get_timestamp_writes( + this: &GpuRenderPassDescriptor, + ) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderPassTimestampWrites")] + #[doc = "Change the `timestampWrites` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`, `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "timestampWrites")] - fn timestamp_writes_shim(this: &GpuRenderPassDescriptor, val: &GpuRenderPassTimestampWrites); + pub fn set_timestamp_writes(this: &GpuRenderPassDescriptor, val: &GpuRenderPassTimestampWrites); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassDescriptor { @@ -48,75 +151,45 @@ impl GpuRenderPassDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `colorAttachments` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_color_attachments()` instead."] pub fn color_attachments(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.color_attachments_shim(val); + self.set_color_attachments(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderPassDepthStencilAttachment")] - #[doc = "Change the `depthStencilAttachment` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDepthStencilAttachment`, `GpuRenderPassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_depth_stencil_attachment()` instead."] pub fn depth_stencil_attachment( &mut self, val: &GpuRenderPassDepthStencilAttachment, ) -> &mut Self { - self.depth_stencil_attachment_shim(val); + self.set_depth_stencil_attachment(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `maxDrawCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_max_draw_count()` instead."] pub fn max_draw_count(&mut self, val: f64) -> &mut Self { - self.max_draw_count_shim(val); + self.set_max_draw_count(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] - #[doc = "Change the `occlusionQuerySet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_occlusion_query_set()` instead."] pub fn occlusion_query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - self.occlusion_query_set_shim(val); + self.set_occlusion_query_set(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderPassTimestampWrites")] - #[doc = "Change the `timestampWrites` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassDescriptor`, `GpuRenderPassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_timestamp_writes()` instead."] pub fn timestamp_writes(&mut self, val: &GpuRenderPassTimestampWrites) -> &mut Self { - self.timestamp_writes_shim(val); + self.set_timestamp_writes(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs index 8ae5c2d3616..7977ece02ea 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassLayout; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuRenderPassLayout, val: &str); - #[wasm_bindgen(method, setter = "colorFormats")] - fn color_formats_shim(this: &GpuRenderPassLayout, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "GpuTextureFormat")] - #[wasm_bindgen(method, setter = "depthStencilFormat")] - fn depth_stencil_format_shim(this: &GpuRenderPassLayout, val: GpuTextureFormat); - #[wasm_bindgen(method, setter = "sampleCount")] - fn sample_count_shim(this: &GpuRenderPassLayout, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuRenderPassLayout { - #[doc = "Construct a new `GpuRenderPassLayout`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.color_formats(color_formats); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuRenderPassLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -45,10 +30,17 @@ impl GpuRenderPassLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuRenderPassLayout, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `colorFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "colorFormats")] + pub fn get_color_formats(this: &GpuRenderPassLayout) -> ::js_sys::Array; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `colorFormats` field of this object."] #[doc = ""] @@ -56,10 +48,18 @@ impl GpuRenderPassLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.color_formats_shim(val); - self - } + #[wasm_bindgen(method, setter = "colorFormats")] + pub fn set_color_formats(this: &GpuRenderPassLayout, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `depthStencilFormat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassLayout`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthStencilFormat")] + pub fn get_depth_stencil_format(this: &GpuRenderPassLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] #[doc = "Change the `depthStencilFormat` field of this object."] @@ -68,10 +68,17 @@ impl GpuRenderPassLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.depth_stencil_format_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthStencilFormat")] + pub fn set_depth_stencil_format(this: &GpuRenderPassLayout, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleCount")] + pub fn get_sample_count(this: &GpuRenderPassLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sampleCount` field of this object."] #[doc = ""] @@ -79,8 +86,46 @@ impl GpuRenderPassLayout { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "sampleCount")] + pub fn set_sample_count(this: &GpuRenderPassLayout, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuRenderPassLayout { + #[doc = "Construct a new `GpuRenderPassLayout`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.color_formats(color_formats); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_color_formats()` instead."] + pub fn color_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_color_formats(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[deprecated = "Use `set_depth_stencil_format()` instead."] + pub fn depth_stencil_format(&mut self, val: GpuTextureFormat) -> &mut Self { + self.set_depth_stencil_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_sample_count()` instead."] pub fn sample_count(&mut self, val: u32) -> &mut Self { - self.sample_count_shim(val); + self.set_sample_count(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs index 3a97f58b8c7..20f9342c498 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPassTimestampWrites; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `beginningOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "beginningOfPassWriteIndex")] + pub fn get_beginning_of_pass_write_index(this: &GpuRenderPassTimestampWrites) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `beginningOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "beginningOfPassWriteIndex")] - fn beginning_of_pass_write_index_shim(this: &GpuRenderPassTimestampWrites, val: u32); + pub fn set_beginning_of_pass_write_index(this: &GpuRenderPassTimestampWrites, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `endOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "endOfPassWriteIndex")] + pub fn get_end_of_pass_write_index(this: &GpuRenderPassTimestampWrites) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `endOfPassWriteIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "endOfPassWriteIndex")] - fn end_of_pass_write_index_shim(this: &GpuRenderPassTimestampWrites, val: u32); + pub fn set_end_of_pass_write_index(this: &GpuRenderPassTimestampWrites, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuQuerySet")] + #[doc = "Get the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "querySet")] + pub fn get_query_set(this: &GpuRenderPassTimestampWrites) -> GpuQuerySet; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] + #[doc = "Change the `querySet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampWrites`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "querySet")] - fn query_set_shim(this: &GpuRenderPassTimestampWrites, val: &GpuQuerySet); + pub fn set_query_set(this: &GpuRenderPassTimestampWrites, val: &GpuQuerySet); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPassTimestampWrites { @@ -38,37 +87,22 @@ impl GpuRenderPassTimestampWrites { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `beginningOfPassWriteIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_beginning_of_pass_write_index()` instead."] pub fn beginning_of_pass_write_index(&mut self, val: u32) -> &mut Self { - self.beginning_of_pass_write_index_shim(val); + self.set_beginning_of_pass_write_index(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `endOfPassWriteIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_end_of_pass_write_index()` instead."] pub fn end_of_pass_write_index(&mut self, val: u32) -> &mut Self { - self.end_of_pass_write_index_shim(val); + self.set_end_of_pass_write_index(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQuerySet")] - #[doc = "Change the `querySet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampWrites`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_query_set()` instead."] pub fn query_set(&mut self, val: &GpuQuerySet) -> &mut Self { - self.query_set_shim(val); + self.set_query_set(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs index 02dc5eec076..5db5163d669 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs @@ -14,25 +14,142 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRenderPipelineDescriptor; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuRenderPipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuRenderPipelineDescriptor, val: &str); + pub fn set_label(this: &GpuRenderPipelineDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &GpuRenderPipelineDescriptor) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &GpuRenderPipelineDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_layout(this: &GpuRenderPipelineDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuDepthStencilState")] + #[doc = "Get the `depthStencil` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthStencil")] + pub fn get_depth_stencil(this: &GpuRenderPipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuDepthStencilState")] + #[doc = "Change the `depthStencil` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "depthStencil")] - fn depth_stencil_shim(this: &GpuRenderPipelineDescriptor, val: &GpuDepthStencilState); + pub fn set_depth_stencil(this: &GpuRenderPipelineDescriptor, val: &GpuDepthStencilState); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuFragmentState")] + #[doc = "Get the `fragment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "fragment")] + pub fn get_fragment(this: &GpuRenderPipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFragmentState")] + #[doc = "Change the `fragment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "fragment")] - fn fragment_shim(this: &GpuRenderPipelineDescriptor, val: &GpuFragmentState); + pub fn set_fragment(this: &GpuRenderPipelineDescriptor, val: &GpuFragmentState); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuMultisampleState")] + #[doc = "Get the `multisample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "multisample")] + pub fn get_multisample(this: &GpuRenderPipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuMultisampleState")] + #[doc = "Change the `multisample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "multisample")] - fn multisample_shim(this: &GpuRenderPipelineDescriptor, val: &GpuMultisampleState); + pub fn set_multisample(this: &GpuRenderPipelineDescriptor, val: &GpuMultisampleState); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPrimitiveState")] + #[doc = "Get the `primitive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "primitive")] + pub fn get_primitive(this: &GpuRenderPipelineDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPrimitiveState")] + #[doc = "Change the `primitive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`, `GpuRenderPipelineDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "primitive")] - fn primitive_shim(this: &GpuRenderPipelineDescriptor, val: &GpuPrimitiveState); + pub fn set_primitive(this: &GpuRenderPipelineDescriptor, val: &GpuPrimitiveState); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexState")] + #[doc = "Get the `vertex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`, `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "vertex")] + pub fn get_vertex(this: &GpuRenderPipelineDescriptor) -> GpuVertexState; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuVertexState")] + #[doc = "Change the `vertex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`, `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "vertex")] - fn vertex_shim(this: &GpuRenderPipelineDescriptor, val: &GpuVertexState); + pub fn set_vertex(this: &GpuRenderPipelineDescriptor, val: &GpuVertexState); } #[cfg(web_sys_unstable_apis)] impl GpuRenderPipelineDescriptor { @@ -51,85 +168,50 @@ impl GpuRenderPipelineDescriptor { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuDepthStencilState")] - #[doc = "Change the `depthStencil` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_depth_stencil()` instead."] pub fn depth_stencil(&mut self, val: &GpuDepthStencilState) -> &mut Self { - self.depth_stencil_shim(val); + self.set_depth_stencil(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuFragmentState")] - #[doc = "Change the `fragment` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`, `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_fragment()` instead."] pub fn fragment(&mut self, val: &GpuFragmentState) -> &mut Self { - self.fragment_shim(val); + self.set_fragment(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuMultisampleState")] - #[doc = "Change the `multisample` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuMultisampleState`, `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_multisample()` instead."] pub fn multisample(&mut self, val: &GpuMultisampleState) -> &mut Self { - self.multisample_shim(val); + self.set_multisample(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPrimitiveState")] - #[doc = "Change the `primitive` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPrimitiveState`, `GpuRenderPipelineDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_primitive()` instead."] pub fn primitive(&mut self, val: &GpuPrimitiveState) -> &mut Self { - self.primitive_shim(val); + self.set_primitive(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexState")] - #[doc = "Change the `vertex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRenderPipelineDescriptor`, `GpuVertexState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_vertex()` instead."] pub fn vertex(&mut self, val: &GpuVertexState) -> &mut Self { - self.vertex_shim(val); + self.set_vertex(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index 084385ffb36..6fe27f97fb8 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRequestAdapterOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `forceFallbackAdapter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "forceFallbackAdapter")] + pub fn get_force_fallback_adapter(this: &GpuRequestAdapterOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `forceFallbackAdapter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "forceFallbackAdapter")] - fn force_fallback_adapter_shim(this: &GpuRequestAdapterOptions, val: bool); + pub fn set_force_fallback_adapter(this: &GpuRequestAdapterOptions, val: bool); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPowerPreference")] + #[doc = "Get the `powerPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "powerPreference")] + pub fn get_power_preference(this: &GpuRequestAdapterOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPowerPreference")] + #[doc = "Change the `powerPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "powerPreference")] - fn power_preference_shim(this: &GpuRequestAdapterOptions, val: GpuPowerPreference); + pub fn set_power_preference(this: &GpuRequestAdapterOptions, val: GpuPowerPreference); } #[cfg(web_sys_unstable_apis)] impl GpuRequestAdapterOptions { @@ -34,26 +67,16 @@ impl GpuRequestAdapterOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `forceFallbackAdapter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_force_fallback_adapter()` instead."] pub fn force_fallback_adapter(&mut self, val: bool) -> &mut Self { - self.force_fallback_adapter_shim(val); + self.set_force_fallback_adapter(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuPowerPreference")] - #[doc = "Change the `powerPreference` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_power_preference()` instead."] pub fn power_preference(&mut self, val: GpuPowerPreference) -> &mut Self { - self.power_preference_shim(val); + self.set_power_preference(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs b/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs index 87da31c0180..bfce5d945ee 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerBindingLayout.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuSamplerBindingLayout; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuSamplerBindingType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerBindingLayout`, `GpuSamplerBindingType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &GpuSamplerBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuSamplerBindingType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerBindingLayout`, `GpuSamplerBindingType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &GpuSamplerBindingLayout, val: GpuSamplerBindingType); + pub fn set_type(this: &GpuSamplerBindingLayout, val: GpuSamplerBindingType); } #[cfg(web_sys_unstable_apis)] impl GpuSamplerBindingLayout { @@ -33,14 +50,9 @@ impl GpuSamplerBindingLayout { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuSamplerBindingType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuSamplerBindingLayout`, `GpuSamplerBindingType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: GpuSamplerBindingType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs index eecc6c14c96..c8dcfc7f50f 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs @@ -14,49 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuSamplerDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuSamplerDescriptor, val: &str); - #[cfg(feature = "GpuAddressMode")] - #[wasm_bindgen(method, setter = "addressModeU")] - fn address_mode_u_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); - #[cfg(feature = "GpuAddressMode")] - #[wasm_bindgen(method, setter = "addressModeV")] - fn address_mode_v_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); - #[cfg(feature = "GpuAddressMode")] - #[wasm_bindgen(method, setter = "addressModeW")] - fn address_mode_w_shim(this: &GpuSamplerDescriptor, val: GpuAddressMode); - #[cfg(feature = "GpuCompareFunction")] - #[wasm_bindgen(method, setter = "compare")] - fn compare_shim(this: &GpuSamplerDescriptor, val: GpuCompareFunction); - #[wasm_bindgen(method, setter = "lodMaxClamp")] - fn lod_max_clamp_shim(this: &GpuSamplerDescriptor, val: f32); - #[wasm_bindgen(method, setter = "lodMinClamp")] - fn lod_min_clamp_shim(this: &GpuSamplerDescriptor, val: f32); - #[cfg(feature = "GpuFilterMode")] - #[wasm_bindgen(method, setter = "magFilter")] - fn mag_filter_shim(this: &GpuSamplerDescriptor, val: GpuFilterMode); - #[wasm_bindgen(method, setter = "maxAnisotropy")] - fn max_anisotropy_shim(this: &GpuSamplerDescriptor, val: u16); - #[cfg(feature = "GpuFilterMode")] - #[wasm_bindgen(method, setter = "minFilter")] - fn min_filter_shim(this: &GpuSamplerDescriptor, val: GpuFilterMode); - #[cfg(feature = "GpuMipmapFilterMode")] - #[wasm_bindgen(method, setter = "mipmapFilter")] - fn mipmap_filter_shim(this: &GpuSamplerDescriptor, val: GpuMipmapFilterMode); -} -#[cfg(web_sys_unstable_apis)] -impl GpuSamplerDescriptor { - #[doc = "Construct a new `GpuSamplerDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuSamplerDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -64,10 +30,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuSamplerDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[doc = "Get the `addressModeU` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAddressMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "addressModeU")] + pub fn get_address_mode_u(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuAddressMode")] #[doc = "Change the `addressModeU` field of this object."] @@ -76,10 +50,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn address_mode_u(&mut self, val: GpuAddressMode) -> &mut Self { - self.address_mode_u_shim(val); - self - } + #[wasm_bindgen(method, setter = "addressModeU")] + pub fn set_address_mode_u(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[doc = "Get the `addressModeV` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAddressMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "addressModeV")] + pub fn get_address_mode_v(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuAddressMode")] #[doc = "Change the `addressModeV` field of this object."] @@ -88,10 +70,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn address_mode_v(&mut self, val: GpuAddressMode) -> &mut Self { - self.address_mode_v_shim(val); - self - } + #[wasm_bindgen(method, setter = "addressModeV")] + pub fn set_address_mode_v(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[doc = "Get the `addressModeW` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAddressMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "addressModeW")] + pub fn get_address_mode_w(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuAddressMode")] #[doc = "Change the `addressModeW` field of this object."] @@ -100,10 +90,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn address_mode_w(&mut self, val: GpuAddressMode) -> &mut Self { - self.address_mode_w_shim(val); - self - } + #[wasm_bindgen(method, setter = "addressModeW")] + pub fn set_address_mode_w(this: &GpuSamplerDescriptor, val: GpuAddressMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCompareFunction")] + #[doc = "Get the `compare` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "compare")] + pub fn get_compare(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCompareFunction")] #[doc = "Change the `compare` field of this object."] @@ -112,10 +110,17 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn compare(&mut self, val: GpuCompareFunction) -> &mut Self { - self.compare_shim(val); - self - } + #[wasm_bindgen(method, setter = "compare")] + pub fn set_compare(this: &GpuSamplerDescriptor, val: GpuCompareFunction); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `lodMaxClamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "lodMaxClamp")] + pub fn get_lod_max_clamp(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `lodMaxClamp` field of this object."] #[doc = ""] @@ -123,10 +128,17 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn lod_max_clamp(&mut self, val: f32) -> &mut Self { - self.lod_max_clamp_shim(val); - self - } + #[wasm_bindgen(method, setter = "lodMaxClamp")] + pub fn set_lod_max_clamp(this: &GpuSamplerDescriptor, val: f32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `lodMinClamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "lodMinClamp")] + pub fn get_lod_min_clamp(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `lodMinClamp` field of this object."] #[doc = ""] @@ -134,10 +146,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn lod_min_clamp(&mut self, val: f32) -> &mut Self { - self.lod_min_clamp_shim(val); - self - } + #[wasm_bindgen(method, setter = "lodMinClamp")] + pub fn set_lod_min_clamp(this: &GpuSamplerDescriptor, val: f32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFilterMode")] + #[doc = "Get the `magFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFilterMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "magFilter")] + pub fn get_mag_filter(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuFilterMode")] #[doc = "Change the `magFilter` field of this object."] @@ -146,10 +166,17 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mag_filter(&mut self, val: GpuFilterMode) -> &mut Self { - self.mag_filter_shim(val); - self - } + #[wasm_bindgen(method, setter = "magFilter")] + pub fn set_mag_filter(this: &GpuSamplerDescriptor, val: GpuFilterMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `maxAnisotropy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "maxAnisotropy")] + pub fn get_max_anisotropy(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `maxAnisotropy` field of this object."] #[doc = ""] @@ -157,10 +184,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn max_anisotropy(&mut self, val: u16) -> &mut Self { - self.max_anisotropy_shim(val); - self - } + #[wasm_bindgen(method, setter = "maxAnisotropy")] + pub fn set_max_anisotropy(this: &GpuSamplerDescriptor, val: u16); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFilterMode")] + #[doc = "Get the `minFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFilterMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "minFilter")] + pub fn get_min_filter(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuFilterMode")] #[doc = "Change the `minFilter` field of this object."] @@ -169,10 +204,18 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn min_filter(&mut self, val: GpuFilterMode) -> &mut Self { - self.min_filter_shim(val); - self - } + #[wasm_bindgen(method, setter = "minFilter")] + pub fn set_min_filter(this: &GpuSamplerDescriptor, val: GpuFilterMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuMipmapFilterMode")] + #[doc = "Get the `mipmapFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMipmapFilterMode`, `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mipmapFilter")] + pub fn get_mipmap_filter(this: &GpuSamplerDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuMipmapFilterMode")] #[doc = "Change the `mipmapFilter` field of this object."] @@ -181,8 +224,93 @@ impl GpuSamplerDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mipmapFilter")] + pub fn set_mipmap_filter(this: &GpuSamplerDescriptor, val: GpuMipmapFilterMode); +} +#[cfg(web_sys_unstable_apis)] +impl GpuSamplerDescriptor { + #[doc = "Construct a new `GpuSamplerDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuSamplerDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[deprecated = "Use `set_address_mode_u()` instead."] + pub fn address_mode_u(&mut self, val: GpuAddressMode) -> &mut Self { + self.set_address_mode_u(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[deprecated = "Use `set_address_mode_v()` instead."] + pub fn address_mode_v(&mut self, val: GpuAddressMode) -> &mut Self { + self.set_address_mode_v(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAddressMode")] + #[deprecated = "Use `set_address_mode_w()` instead."] + pub fn address_mode_w(&mut self, val: GpuAddressMode) -> &mut Self { + self.set_address_mode_w(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCompareFunction")] + #[deprecated = "Use `set_compare()` instead."] + pub fn compare(&mut self, val: GpuCompareFunction) -> &mut Self { + self.set_compare(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_lod_max_clamp()` instead."] + pub fn lod_max_clamp(&mut self, val: f32) -> &mut Self { + self.set_lod_max_clamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_lod_min_clamp()` instead."] + pub fn lod_min_clamp(&mut self, val: f32) -> &mut Self { + self.set_lod_min_clamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFilterMode")] + #[deprecated = "Use `set_mag_filter()` instead."] + pub fn mag_filter(&mut self, val: GpuFilterMode) -> &mut Self { + self.set_mag_filter(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_max_anisotropy()` instead."] + pub fn max_anisotropy(&mut self, val: u16) -> &mut Self { + self.set_max_anisotropy(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuFilterMode")] + #[deprecated = "Use `set_min_filter()` instead."] + pub fn min_filter(&mut self, val: GpuFilterMode) -> &mut Self { + self.set_min_filter(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuMipmapFilterMode")] + #[deprecated = "Use `set_mipmap_filter()` instead."] pub fn mipmap_filter(&mut self, val: GpuMipmapFilterMode) -> &mut Self { - self.mipmap_filter_shim(val); + self.set_mipmap_filter(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index 872f504ce07..f2c1369207e 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuShaderModuleCompilationHint; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entryPoint")] + pub fn get_entry_point(this: &GpuShaderModuleCompilationHint) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entryPoint")] - fn entry_point_shim(this: &GpuShaderModuleCompilationHint, val: &str); + pub fn set_entry_point(this: &GpuShaderModuleCompilationHint, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &GpuShaderModuleCompilationHint) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &GpuShaderModuleCompilationHint, val: &::wasm_bindgen::JsValue); + pub fn set_layout(this: &GpuShaderModuleCompilationHint, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuShaderModuleCompilationHint { @@ -34,25 +66,15 @@ impl GpuShaderModuleCompilationHint { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entryPoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { - self.entry_point_shim(val); + self.set_entry_point(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index f8ed57202ac..69c2204e7a9 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -14,29 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuShaderModuleDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuShaderModuleDescriptor, val: &str); - #[wasm_bindgen(method, setter = "code")] - fn code_shim(this: &GpuShaderModuleDescriptor, val: &str); - #[wasm_bindgen(method, setter = "compilationHints")] - fn compilation_hints_shim(this: &GpuShaderModuleDescriptor, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "sourceMap")] - fn source_map_shim(this: &GpuShaderModuleDescriptor, val: &::js_sys::Object); -} -#[cfg(web_sys_unstable_apis)] -impl GpuShaderModuleDescriptor { - #[doc = "Construct a new `GpuShaderModuleDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(code: &str) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.code(code); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuShaderModuleDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -44,10 +30,17 @@ impl GpuShaderModuleDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuShaderModuleDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `code` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "code")] + pub fn get_code(this: &GpuShaderModuleDescriptor) -> String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `code` field of this object."] #[doc = ""] @@ -55,10 +48,17 @@ impl GpuShaderModuleDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn code(&mut self, val: &str) -> &mut Self { - self.code_shim(val); - self - } + #[wasm_bindgen(method, setter = "code")] + pub fn set_code(this: &GpuShaderModuleDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `compilationHints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "compilationHints")] + pub fn get_compilation_hints(this: &GpuShaderModuleDescriptor) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `compilationHints` field of this object."] #[doc = ""] @@ -66,10 +66,17 @@ impl GpuShaderModuleDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.compilation_hints_shim(val); - self - } + #[wasm_bindgen(method, setter = "compilationHints")] + pub fn set_compilation_hints(this: &GpuShaderModuleDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sourceMap` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sourceMap")] + pub fn get_source_map(this: &GpuShaderModuleDescriptor) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sourceMap` field of this object."] #[doc = ""] @@ -77,8 +84,45 @@ impl GpuShaderModuleDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "sourceMap")] + pub fn set_source_map(this: &GpuShaderModuleDescriptor, val: &::js_sys::Object); +} +#[cfg(web_sys_unstable_apis)] +impl GpuShaderModuleDescriptor { + #[doc = "Construct a new `GpuShaderModuleDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(code: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.code(code); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_code()` instead."] + pub fn code(&mut self, val: &str) -> &mut Self { + self.set_code(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_compilation_hints()` instead."] + pub fn compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_compilation_hints(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_source_map()` instead."] pub fn source_map(&mut self, val: &::js_sys::Object) -> &mut Self { - self.source_map_shim(val); + self.set_source_map(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuStencilFaceState.rs b/crates/web-sys/src/features/gen_GpuStencilFaceState.rs index aa72d7b9431..8aba11bb319 100644 --- a/crates/web-sys/src/features/gen_GpuStencilFaceState.rs +++ b/crates/web-sys/src/features/gen_GpuStencilFaceState.rs @@ -14,18 +14,86 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuStencilFaceState; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCompareFunction")] + #[doc = "Get the `compare` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuStencilFaceState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "compare")] + pub fn get_compare(this: &GpuStencilFaceState) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCompareFunction")] + #[doc = "Change the `compare` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuStencilFaceState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "compare")] - fn compare_shim(this: &GpuStencilFaceState, val: GpuCompareFunction); + pub fn set_compare(this: &GpuStencilFaceState, val: GpuCompareFunction); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilOperation")] + #[doc = "Get the `depthFailOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthFailOp")] + pub fn get_depth_fail_op(this: &GpuStencilFaceState) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] + #[doc = "Change the `depthFailOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "depthFailOp")] - fn depth_fail_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); + pub fn set_depth_fail_op(this: &GpuStencilFaceState, val: GpuStencilOperation); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilOperation")] + #[doc = "Get the `failOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "failOp")] + pub fn get_fail_op(this: &GpuStencilFaceState) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] + #[doc = "Change the `failOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "failOp")] - fn fail_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); + pub fn set_fail_op(this: &GpuStencilFaceState, val: GpuStencilOperation); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStencilOperation")] + #[doc = "Get the `passOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "passOp")] + pub fn get_pass_op(this: &GpuStencilFaceState) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] + #[doc = "Change the `passOp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "passOp")] - fn pass_op_shim(this: &GpuStencilFaceState, val: GpuStencilOperation); + pub fn set_pass_op(this: &GpuStencilFaceState, val: GpuStencilOperation); } #[cfg(web_sys_unstable_apis)] impl GpuStencilFaceState { @@ -42,50 +110,30 @@ impl GpuStencilFaceState { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCompareFunction")] - #[doc = "Change the `compare` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuStencilFaceState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_compare()` instead."] pub fn compare(&mut self, val: GpuCompareFunction) -> &mut Self { - self.compare_shim(val); + self.set_compare(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] - #[doc = "Change the `depthFailOp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_depth_fail_op()` instead."] pub fn depth_fail_op(&mut self, val: GpuStencilOperation) -> &mut Self { - self.depth_fail_op_shim(val); + self.set_depth_fail_op(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] - #[doc = "Change the `failOp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_fail_op()` instead."] pub fn fail_op(&mut self, val: GpuStencilOperation) -> &mut Self { - self.fail_op_shim(val); + self.set_fail_op(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStencilOperation")] - #[doc = "Change the `passOp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStencilFaceState`, `GpuStencilOperation`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_pass_op()` instead."] pub fn pass_op(&mut self, val: GpuStencilOperation) -> &mut Self { - self.pass_op_shim(val); + self.set_pass_op(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs index 36adc75a02f..dfba66d770f 100644 --- a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs @@ -14,15 +14,68 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuStorageTextureBindingLayout; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuStorageTextureAccess")] + #[doc = "Get the `access` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureAccess`, `GpuStorageTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "access")] + pub fn get_access(this: &GpuStorageTextureBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStorageTextureAccess")] + #[doc = "Change the `access` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureAccess`, `GpuStorageTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "access")] - fn access_shim(this: &GpuStorageTextureBindingLayout, val: GpuStorageTextureAccess); + pub fn set_access(this: &GpuStorageTextureBindingLayout, val: GpuStorageTextureAccess); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuStorageTextureBindingLayout) -> GpuTextureFormat; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Change the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuStorageTextureBindingLayout, val: GpuTextureFormat); + pub fn set_format(this: &GpuStorageTextureBindingLayout, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureViewDimension")] + #[doc = "Get the `viewDimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureViewDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "viewDimension")] + pub fn get_view_dimension( + this: &GpuStorageTextureBindingLayout, + ) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureViewDimension")] + #[doc = "Change the `viewDimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureViewDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "viewDimension")] - fn view_dimension_shim(this: &GpuStorageTextureBindingLayout, val: GpuTextureViewDimension); + pub fn set_view_dimension(this: &GpuStorageTextureBindingLayout, val: GpuTextureViewDimension); } #[cfg(web_sys_unstable_apis)] impl GpuStorageTextureBindingLayout { @@ -41,38 +94,23 @@ impl GpuStorageTextureBindingLayout { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuStorageTextureAccess")] - #[doc = "Change the `access` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureAccess`, `GpuStorageTextureBindingLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_access()` instead."] pub fn access(&mut self, val: GpuStorageTextureAccess) -> &mut Self { - self.access_shim(val); + self.set_access(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] - #[doc = "Change the `format` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_format()` instead."] pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); + self.set_format(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureViewDimension")] - #[doc = "Change the `viewDimension` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuStorageTextureBindingLayout`, `GpuTextureViewDimension`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_view_dimension()` instead."] pub fn view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - self.view_dimension_shim(val); + self.set_view_dimension(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs b/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs index ccd9bfc620c..1fd1ad710fb 100644 --- a/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuTextureBindingLayout.rs @@ -14,14 +14,64 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureBindingLayout; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `multisampled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "multisampled")] + pub fn get_multisampled(this: &GpuTextureBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `multisampled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "multisampled")] - fn multisampled_shim(this: &GpuTextureBindingLayout, val: bool); + pub fn set_multisampled(this: &GpuTextureBindingLayout, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureSampleType")] + #[doc = "Get the `sampleType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureSampleType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleType")] + pub fn get_sample_type(this: &GpuTextureBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureSampleType")] + #[doc = "Change the `sampleType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureSampleType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sampleType")] - fn sample_type_shim(this: &GpuTextureBindingLayout, val: GpuTextureSampleType); + pub fn set_sample_type(this: &GpuTextureBindingLayout, val: GpuTextureSampleType); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureViewDimension")] + #[doc = "Get the `viewDimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureViewDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "viewDimension")] + pub fn get_view_dimension(this: &GpuTextureBindingLayout) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureViewDimension")] + #[doc = "Change the `viewDimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureViewDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "viewDimension")] - fn view_dimension_shim(this: &GpuTextureBindingLayout, val: GpuTextureViewDimension); + pub fn set_view_dimension(this: &GpuTextureBindingLayout, val: GpuTextureViewDimension); } #[cfg(web_sys_unstable_apis)] impl GpuTextureBindingLayout { @@ -37,38 +87,23 @@ impl GpuTextureBindingLayout { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `multisampled` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_multisampled()` instead."] pub fn multisampled(&mut self, val: bool) -> &mut Self { - self.multisampled_shim(val); + self.set_multisampled(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureSampleType")] - #[doc = "Change the `sampleType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureSampleType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_sample_type()` instead."] pub fn sample_type(&mut self, val: GpuTextureSampleType) -> &mut Self { - self.sample_type_shim(val); + self.set_sample_type(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureViewDimension")] - #[doc = "Change the `viewDimension` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureBindingLayout`, `GpuTextureViewDimension`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_view_dimension()` instead."] pub fn view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - self.view_dimension_shim(val); + self.set_view_dimension(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs index b79eccc02d3..ff3a096540f 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs @@ -14,42 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuTextureDescriptor, val: &str); - #[cfg(feature = "GpuTextureDimension")] - #[wasm_bindgen(method, setter = "dimension")] - fn dimension_shim(this: &GpuTextureDescriptor, val: GpuTextureDimension); - #[cfg(feature = "GpuTextureFormat")] - #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuTextureDescriptor, val: GpuTextureFormat); - #[wasm_bindgen(method, setter = "mipLevelCount")] - fn mip_level_count_shim(this: &GpuTextureDescriptor, val: u32); - #[wasm_bindgen(method, setter = "sampleCount")] - fn sample_count_shim(this: &GpuTextureDescriptor, val: u32); - #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &GpuTextureDescriptor, val: u32); - #[wasm_bindgen(method, setter = "viewFormats")] - fn view_formats_shim(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl GpuTextureDescriptor { - #[cfg(feature = "GpuTextureFormat")] - #[doc = "Construct a new `GpuTextureDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(format: GpuTextureFormat, size: &::wasm_bindgen::JsValue, usage: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); - ret.size(size); - ret.usage(usage); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuTextureDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -57,10 +30,18 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuTextureDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureDimension")] + #[doc = "Get the `dimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dimension")] + pub fn get_dimension(this: &GpuTextureDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureDimension")] #[doc = "Change the `dimension` field of this object."] @@ -69,10 +50,18 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dimension(&mut self, val: GpuTextureDimension) -> &mut Self { - self.dimension_shim(val); - self - } + #[wasm_bindgen(method, setter = "dimension")] + pub fn set_dimension(this: &GpuTextureDescriptor, val: GpuTextureDimension); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuTextureDescriptor) -> GpuTextureFormat; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] #[doc = "Change the `format` field of this object."] @@ -81,10 +70,17 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); - self - } + #[wasm_bindgen(method, setter = "format")] + pub fn set_format(this: &GpuTextureDescriptor, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mipLevelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mipLevelCount")] + pub fn get_mip_level_count(this: &GpuTextureDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mipLevelCount` field of this object."] #[doc = ""] @@ -92,10 +88,17 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mip_level_count(&mut self, val: u32) -> &mut Self { - self.mip_level_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "mipLevelCount")] + pub fn set_mip_level_count(this: &GpuTextureDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sampleCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleCount")] + pub fn get_sample_count(this: &GpuTextureDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sampleCount` field of this object."] #[doc = ""] @@ -103,10 +106,17 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn sample_count(&mut self, val: u32) -> &mut Self { - self.sample_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "sampleCount")] + pub fn set_sample_count(this: &GpuTextureDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &GpuTextureDescriptor) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `size` field of this object."] #[doc = ""] @@ -114,10 +124,17 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn size(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.size_shim(val); - self - } + #[wasm_bindgen(method, setter = "size")] + pub fn set_size(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &GpuTextureDescriptor) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usage` field of this object."] #[doc = ""] @@ -125,10 +142,17 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage(&mut self, val: u32) -> &mut Self { - self.usage_shim(val); - self - } + #[wasm_bindgen(method, setter = "usage")] + pub fn set_usage(this: &GpuTextureDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `viewFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "viewFormats")] + pub fn get_view_formats(this: &GpuTextureDescriptor) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `viewFormats` field of this object."] #[doc = ""] @@ -136,8 +160,74 @@ impl GpuTextureDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "viewFormats")] + pub fn set_view_formats(this: &GpuTextureDescriptor, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl GpuTextureDescriptor { + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Construct a new `GpuTextureDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureDescriptor`, `GpuTextureFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(format: GpuTextureFormat, size: &::wasm_bindgen::JsValue, usage: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.format(format); + ret.size(size); + ret.usage(usage); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureDimension")] + #[deprecated = "Use `set_dimension()` instead."] + pub fn dimension(&mut self, val: GpuTextureDimension) -> &mut Self { + self.set_dimension(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[deprecated = "Use `set_format()` instead."] + pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { + self.set_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mip_level_count()` instead."] + pub fn mip_level_count(&mut self, val: u32) -> &mut Self { + self.set_mip_level_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_sample_count()` instead."] + pub fn sample_count(&mut self, val: u32) -> &mut Self { + self.set_sample_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_size()` instead."] + pub fn size(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_size(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage()` instead."] + pub fn usage(&mut self, val: u32) -> &mut Self { + self.set_usage(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_view_formats()` instead."] pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.view_formats_shim(val); + self.set_view_formats(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs index e6b85aacd3f..2a2b4014f45 100644 --- a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs @@ -14,39 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuTextureViewDescriptor; - #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &GpuTextureViewDescriptor, val: &str); - #[wasm_bindgen(method, setter = "arrayLayerCount")] - fn array_layer_count_shim(this: &GpuTextureViewDescriptor, val: u32); - #[cfg(feature = "GpuTextureAspect")] - #[wasm_bindgen(method, setter = "aspect")] - fn aspect_shim(this: &GpuTextureViewDescriptor, val: GpuTextureAspect); - #[wasm_bindgen(method, setter = "baseArrayLayer")] - fn base_array_layer_shim(this: &GpuTextureViewDescriptor, val: u32); - #[wasm_bindgen(method, setter = "baseMipLevel")] - fn base_mip_level_shim(this: &GpuTextureViewDescriptor, val: u32); - #[cfg(feature = "GpuTextureViewDimension")] - #[wasm_bindgen(method, setter = "dimension")] - fn dimension_shim(this: &GpuTextureViewDescriptor, val: GpuTextureViewDimension); - #[cfg(feature = "GpuTextureFormat")] - #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuTextureViewDescriptor, val: GpuTextureFormat); - #[wasm_bindgen(method, setter = "mipLevelCount")] - fn mip_level_count_shim(this: &GpuTextureViewDescriptor, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl GpuTextureViewDescriptor { - #[doc = "Construct a new `GpuTextureViewDescriptor`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -54,10 +30,17 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); - self - } + #[wasm_bindgen(method, setter = "label")] + pub fn set_label(this: &GpuTextureViewDescriptor, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `arrayLayerCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "arrayLayerCount")] + pub fn get_array_layer_count(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `arrayLayerCount` field of this object."] #[doc = ""] @@ -65,10 +48,18 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn array_layer_count(&mut self, val: u32) -> &mut Self { - self.array_layer_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "arrayLayerCount")] + pub fn set_array_layer_count(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureAspect")] + #[doc = "Get the `aspect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureAspect`, `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "aspect")] + pub fn get_aspect(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Change the `aspect` field of this object."] @@ -77,10 +68,17 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { - self.aspect_shim(val); - self - } + #[wasm_bindgen(method, setter = "aspect")] + pub fn set_aspect(this: &GpuTextureViewDescriptor, val: GpuTextureAspect); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `baseArrayLayer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "baseArrayLayer")] + pub fn get_base_array_layer(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `baseArrayLayer` field of this object."] #[doc = ""] @@ -88,10 +86,17 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn base_array_layer(&mut self, val: u32) -> &mut Self { - self.base_array_layer_shim(val); - self - } + #[wasm_bindgen(method, setter = "baseArrayLayer")] + pub fn set_base_array_layer(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `baseMipLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "baseMipLevel")] + pub fn get_base_mip_level(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `baseMipLevel` field of this object."] #[doc = ""] @@ -99,10 +104,18 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn base_mip_level(&mut self, val: u32) -> &mut Self { - self.base_mip_level_shim(val); - self - } + #[wasm_bindgen(method, setter = "baseMipLevel")] + pub fn set_base_mip_level(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureViewDimension")] + #[doc = "Get the `dimension` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`, `GpuTextureViewDimension`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dimension")] + pub fn get_dimension(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureViewDimension")] #[doc = "Change the `dimension` field of this object."] @@ -111,10 +124,18 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { - self.dimension_shim(val); - self - } + #[wasm_bindgen(method, setter = "dimension")] + pub fn set_dimension(this: &GpuTextureViewDescriptor, val: GpuTextureViewDimension); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureFormat`, `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureFormat")] #[doc = "Change the `format` field of this object."] @@ -123,10 +144,17 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { - self.format_shim(val); - self - } + #[wasm_bindgen(method, setter = "format")] + pub fn set_format(this: &GpuTextureViewDescriptor, val: GpuTextureFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mipLevelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mipLevelCount")] + pub fn get_mip_level_count(this: &GpuTextureViewDescriptor) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mipLevelCount` field of this object."] #[doc = ""] @@ -134,8 +162,71 @@ impl GpuTextureViewDescriptor { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mipLevelCount")] + pub fn set_mip_level_count(this: &GpuTextureViewDescriptor, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl GpuTextureViewDescriptor { + #[doc = "Construct a new `GpuTextureViewDescriptor`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_label()` instead."] + pub fn label(&mut self, val: &str) -> &mut Self { + self.set_label(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_array_layer_count()` instead."] + pub fn array_layer_count(&mut self, val: u32) -> &mut Self { + self.set_array_layer_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureAspect")] + #[deprecated = "Use `set_aspect()` instead."] + pub fn aspect(&mut self, val: GpuTextureAspect) -> &mut Self { + self.set_aspect(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_base_array_layer()` instead."] + pub fn base_array_layer(&mut self, val: u32) -> &mut Self { + self.set_base_array_layer(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_base_mip_level()` instead."] + pub fn base_mip_level(&mut self, val: u32) -> &mut Self { + self.set_base_mip_level(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureViewDimension")] + #[deprecated = "Use `set_dimension()` instead."] + pub fn dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self { + self.set_dimension(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureFormat")] + #[deprecated = "Use `set_format()` instead."] + pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self { + self.set_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mip_level_count()` instead."] pub fn mip_level_count(&mut self, val: u32) -> &mut Self { - self.mip_level_count_shim(val); + self.set_mip_level_count(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs index 276f6d2ddd5..ad6aeef6943 100644 --- a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuUncapturedErrorEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &GpuUncapturedErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &GpuUncapturedErrorEventInit, val: bool); + pub fn set_bubbles(this: &GpuUncapturedErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &GpuUncapturedErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &GpuUncapturedErrorEventInit, val: bool); + pub fn set_cancelable(this: &GpuUncapturedErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GpuUncapturedErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GpuUncapturedErrorEventInit, val: bool); + pub fn set_composed(this: &GpuUncapturedErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuError")] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &GpuUncapturedErrorEventInit) -> GpuError; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuError")] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &GpuUncapturedErrorEventInit, val: &GpuError); + pub fn set_error(this: &GpuUncapturedErrorEventInit, val: &GpuError); } #[cfg(web_sys_unstable_apis)] impl GpuUncapturedErrorEventInit { @@ -40,48 +105,28 @@ impl GpuUncapturedErrorEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuUncapturedErrorEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuError")] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuError`, `GpuUncapturedErrorEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &GpuError) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs index 630b6daa18f..b2dba6dc8c4 100644 --- a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs +++ b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexAttribute; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuVertexFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`, `GpuVertexFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &GpuVertexAttribute) -> GpuVertexFormat; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexFormat")] + #[doc = "Change the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`, `GpuVertexFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &GpuVertexAttribute, val: GpuVertexFormat); + pub fn set_format(this: &GpuVertexAttribute, val: GpuVertexFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &GpuVertexAttribute) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &GpuVertexAttribute, val: f64); + pub fn set_offset(this: &GpuVertexAttribute, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `shaderLocation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "shaderLocation")] + pub fn get_shader_location(this: &GpuVertexAttribute) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `shaderLocation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "shaderLocation")] - fn shader_location_shim(this: &GpuVertexAttribute, val: u32); + pub fn set_shader_location(this: &GpuVertexAttribute, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuVertexAttribute { @@ -41,36 +90,21 @@ impl GpuVertexAttribute { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexFormat")] - #[doc = "Change the `format` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`, `GpuVertexFormat`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_format()` instead."] pub fn format(&mut self, val: GpuVertexFormat) -> &mut Self { - self.format_shim(val); + self.set_format(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: f64) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `shaderLocation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexAttribute`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_shader_location()` instead."] pub fn shader_location(&mut self, val: u32) -> &mut Self { - self.shader_location_shim(val); + self.set_shader_location(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs index 21594f7bab8..267152e982c 100644 --- a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs +++ b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexBufferLayout; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `arrayStride` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "arrayStride")] + pub fn get_array_stride(this: &GpuVertexBufferLayout) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `arrayStride` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "arrayStride")] - fn array_stride_shim(this: &GpuVertexBufferLayout, val: f64); + pub fn set_array_stride(this: &GpuVertexBufferLayout, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attributes")] + pub fn get_attributes(this: &GpuVertexBufferLayout) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "attributes")] - fn attributes_shim(this: &GpuVertexBufferLayout, val: &::wasm_bindgen::JsValue); + pub fn set_attributes(this: &GpuVertexBufferLayout, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuVertexStepMode")] + #[doc = "Get the `stepMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`, `GpuVertexStepMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stepMode")] + pub fn get_step_mode(this: &GpuVertexBufferLayout) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexStepMode")] + #[doc = "Change the `stepMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`, `GpuVertexStepMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "stepMode")] - fn step_mode_shim(this: &GpuVertexBufferLayout, val: GpuVertexStepMode); + pub fn set_step_mode(this: &GpuVertexBufferLayout, val: GpuVertexStepMode); } #[cfg(web_sys_unstable_apis)] impl GpuVertexBufferLayout { @@ -38,37 +87,22 @@ impl GpuVertexBufferLayout { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `arrayStride` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_array_stride()` instead."] pub fn array_stride(&mut self, val: f64) -> &mut Self { - self.array_stride_shim(val); + self.set_array_stride(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `attributes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_attributes()` instead."] pub fn attributes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.attributes_shim(val); + self.set_attributes(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuVertexStepMode")] - #[doc = "Change the `stepMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexBufferLayout`, `GpuVertexStepMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_step_mode()` instead."] pub fn step_mode(&mut self, val: GpuVertexStepMode) -> &mut Self { - self.step_mode_shim(val); + self.set_step_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index 6b841d11fdf..29bc317bd66 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexState; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "entryPoint")] + pub fn get_entry_point(this: &GpuVertexState) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "entryPoint")] - fn entry_point_shim(this: &GpuVertexState, val: &str); + pub fn set_entry_point(this: &GpuVertexState, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] + #[doc = "Get the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModule`, `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "module")] + pub fn get_module(this: &GpuVertexState) -> GpuShaderModule; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuShaderModule")] + #[doc = "Change the `module` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModule`, `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "module")] - fn module_shim(this: &GpuVertexState, val: &GpuShaderModule); + pub fn set_module(this: &GpuVertexState, val: &GpuShaderModule); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `buffers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "buffers")] + pub fn get_buffers(this: &GpuVertexState) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `buffers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "buffers")] - fn buffers_shim(this: &GpuVertexState, val: &::wasm_bindgen::JsValue); + pub fn set_buffers(this: &GpuVertexState, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl GpuVertexState { @@ -38,37 +87,22 @@ impl GpuVertexState { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `entryPoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { - self.entry_point_shim(val); + self.set_entry_point(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuShaderModule")] - #[doc = "Change the `module` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderModule`, `GpuVertexState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_module()` instead."] pub fn module(&mut self, val: &GpuShaderModule) -> &mut Self { - self.module_shim(val); + self.set_module(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `buffers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_buffers()` instead."] pub fn buffers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.buffers_shim(val); + self.set_buffers(val); self } } diff --git a/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs b/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs index 73528f6bc37..42286df8af1 100644 --- a/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs +++ b/crates/web-sys/src/features/gen_GroupedHistoryEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] pub type GroupedHistoryEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &GroupedHistoryEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &GroupedHistoryEventInit, val: bool); + pub fn set_bubbles(this: &GroupedHistoryEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &GroupedHistoryEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &GroupedHistoryEventInit, val: bool); + pub fn set_cancelable(this: &GroupedHistoryEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &GroupedHistoryEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &GroupedHistoryEventInit, val: bool); + pub fn set_composed(this: &GroupedHistoryEventInit, val: bool); #[cfg(feature = "Element")] + #[doc = "Get the `otherBrowser` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `GroupedHistoryEventInit`*"] + #[wasm_bindgen(method, getter = "otherBrowser")] + pub fn get_other_browser(this: &GroupedHistoryEventInit) -> Option; + #[cfg(feature = "Element")] + #[doc = "Change the `otherBrowser` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `GroupedHistoryEventInit`*"] #[wasm_bindgen(method, setter = "otherBrowser")] - fn other_browser_shim(this: &GroupedHistoryEventInit, val: Option<&Element>); + pub fn set_other_browser(this: &GroupedHistoryEventInit, val: Option<&Element>); } impl GroupedHistoryEventInit { #[doc = "Construct a new `GroupedHistoryEventInit`."] @@ -29,33 +62,25 @@ impl GroupedHistoryEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GroupedHistoryEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Element")] - #[doc = "Change the `otherBrowser` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Element`, `GroupedHistoryEventInit`*"] + #[deprecated = "Use `set_other_browser()` instead."] pub fn other_browser(&mut self, val: Option<&Element>) -> &mut Self { - self.other_browser_shim(val); + self.set_other_browser(val); self } } diff --git a/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs b/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs index 56caf74fac2..bd9cdb24c04 100644 --- a/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs +++ b/crates/web-sys/src/features/gen_HalfOpenInfoDict.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] pub type HalfOpenInfoDict; + #[doc = "Get the `speculative` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] + #[wasm_bindgen(method, getter = "speculative")] + pub fn get_speculative(this: &HalfOpenInfoDict) -> Option; + #[doc = "Change the `speculative` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] #[wasm_bindgen(method, setter = "speculative")] - fn speculative_shim(this: &HalfOpenInfoDict, val: bool); + pub fn set_speculative(this: &HalfOpenInfoDict, val: bool); } impl HalfOpenInfoDict { #[doc = "Construct a new `HalfOpenInfoDict`."] @@ -22,11 +30,9 @@ impl HalfOpenInfoDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `speculative` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HalfOpenInfoDict`*"] + #[deprecated = "Use `set_speculative()` instead."] pub fn speculative(&mut self, val: bool) -> &mut Self { - self.speculative_shim(val); + self.set_speculative(val); self } } diff --git a/crates/web-sys/src/features/gen_HashChangeEventInit.rs b/crates/web-sys/src/features/gen_HashChangeEventInit.rs index 784fbfc5dee..a4b951d4c92 100644 --- a/crates/web-sys/src/features/gen_HashChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_HashChangeEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] pub type HashChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &HashChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &HashChangeEventInit, val: bool); + pub fn set_bubbles(this: &HashChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &HashChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &HashChangeEventInit, val: bool); + pub fn set_cancelable(this: &HashChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &HashChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &HashChangeEventInit, val: bool); + pub fn set_composed(this: &HashChangeEventInit, val: bool); + #[doc = "Get the `newURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[wasm_bindgen(method, getter = "newURL")] + pub fn get_new_url(this: &HashChangeEventInit) -> Option; + #[doc = "Change the `newURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, setter = "newURL")] - fn new_url_shim(this: &HashChangeEventInit, val: &str); + pub fn set_new_url(this: &HashChangeEventInit, val: &str); + #[doc = "Get the `oldURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[wasm_bindgen(method, getter = "oldURL")] + pub fn get_old_url(this: &HashChangeEventInit) -> Option; + #[doc = "Change the `oldURL` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, setter = "oldURL")] - fn old_url_shim(this: &HashChangeEventInit, val: &str); + pub fn set_old_url(this: &HashChangeEventInit, val: &str); } impl HashChangeEventInit { #[doc = "Construct a new `HashChangeEventInit`."] @@ -30,39 +70,29 @@ impl HashChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `newURL` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[deprecated = "Use `set_new_url()` instead."] pub fn new_url(&mut self, val: &str) -> &mut Self { - self.new_url_shim(val); + self.set_new_url(val); self } - #[doc = "Change the `oldURL` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] + #[deprecated = "Use `set_old_url()` instead."] pub fn old_url(&mut self, val: &str) -> &mut Self { - self.old_url_shim(val); + self.set_old_url(val); self } } diff --git a/crates/web-sys/src/features/gen_HidCollectionInfo.rs b/crates/web-sys/src/features/gen_HidCollectionInfo.rs index 6a99d71e18c..e151d69409d 100644 --- a/crates/web-sys/src/features/gen_HidCollectionInfo.rs +++ b/crates/web-sys/src/features/gen_HidCollectionInfo.rs @@ -14,34 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidCollectionInfo; - #[wasm_bindgen(method, setter = "children")] - fn children_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "featureReports")] - fn feature_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "inputReports")] - fn input_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "outputReports")] - fn output_reports_shim(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &HidCollectionInfo, val: u8); - #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &HidCollectionInfo, val: u16); - #[wasm_bindgen(method, setter = "usagePage")] - fn usage_page_shim(this: &HidCollectionInfo, val: u16); -} -#[cfg(web_sys_unstable_apis)] -impl HidCollectionInfo { - #[doc = "Construct a new `HidCollectionInfo`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `children` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "children")] + pub fn get_children(this: &HidCollectionInfo) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `children` field of this object."] #[doc = ""] @@ -49,10 +30,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn children(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.children_shim(val); - self - } + #[wasm_bindgen(method, setter = "children")] + pub fn set_children(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `featureReports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "featureReports")] + pub fn get_feature_reports(this: &HidCollectionInfo) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `featureReports` field of this object."] #[doc = ""] @@ -60,10 +48,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn feature_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.feature_reports_shim(val); - self - } + #[wasm_bindgen(method, setter = "featureReports")] + pub fn set_feature_reports(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `inputReports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "inputReports")] + pub fn get_input_reports(this: &HidCollectionInfo) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `inputReports` field of this object."] #[doc = ""] @@ -71,10 +66,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn input_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.input_reports_shim(val); - self - } + #[wasm_bindgen(method, setter = "inputReports")] + pub fn set_input_reports(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `outputReports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "outputReports")] + pub fn get_output_reports(this: &HidCollectionInfo) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `outputReports` field of this object."] #[doc = ""] @@ -82,10 +84,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn output_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.output_reports_shim(val); - self - } + #[wasm_bindgen(method, setter = "outputReports")] + pub fn set_output_reports(this: &HidCollectionInfo, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &HidCollectionInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] @@ -93,10 +102,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn type_(&mut self, val: u8) -> &mut Self { - self.type__shim(val); - self - } + #[wasm_bindgen(method, setter = "type")] + pub fn set_type(this: &HidCollectionInfo, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &HidCollectionInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usage` field of this object."] #[doc = ""] @@ -104,10 +120,17 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage(&mut self, val: u16) -> &mut Self { - self.usage_shim(val); - self - } + #[wasm_bindgen(method, setter = "usage")] + pub fn set_usage(this: &HidCollectionInfo, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usagePage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usagePage")] + pub fn get_usage_page(this: &HidCollectionInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usagePage` field of this object."] #[doc = ""] @@ -115,8 +138,62 @@ impl HidCollectionInfo { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "usagePage")] + pub fn set_usage_page(this: &HidCollectionInfo, val: u16); +} +#[cfg(web_sys_unstable_apis)] +impl HidCollectionInfo { + #[doc = "Construct a new `HidCollectionInfo`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_children()` instead."] + pub fn children(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_children(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_feature_reports()` instead."] + pub fn feature_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_feature_reports(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_input_reports()` instead."] + pub fn input_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_input_reports(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_output_reports()` instead."] + pub fn output_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_output_reports(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_type()` instead."] + pub fn type_(&mut self, val: u8) -> &mut Self { + self.set_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage()` instead."] + pub fn usage(&mut self, val: u16) -> &mut Self { + self.set_usage(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage_page()` instead."] pub fn usage_page(&mut self, val: u16) -> &mut Self { - self.usage_page_shim(val); + self.set_usage_page(val); self } } diff --git a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs index 29201bb43b2..3faf25b8854 100644 --- a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidConnectionEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &HidConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &HidConnectionEventInit, val: bool); + pub fn set_bubbles(this: &HidConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &HidConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &HidConnectionEventInit, val: bool); + pub fn set_cancelable(this: &HidConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &HidConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &HidConnectionEventInit, val: bool); + pub fn set_composed(this: &HidConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HidDevice")] + #[doc = "Get the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`, `HidDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "device")] + pub fn get_device(this: &HidConnectionEventInit) -> HidDevice; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HidDevice")] + #[doc = "Change the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`, `HidDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "device")] - fn device_shim(this: &HidConnectionEventInit, val: &HidDevice); + pub fn set_device(this: &HidConnectionEventInit, val: &HidDevice); } #[cfg(web_sys_unstable_apis)] impl HidConnectionEventInit { @@ -40,48 +105,28 @@ impl HidConnectionEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HidDevice")] - #[doc = "Change the `device` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidConnectionEventInit`, `HidDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_device()` instead."] pub fn device(&mut self, val: &HidDevice) -> &mut Self { - self.device_shim(val); + self.set_device(val); self } } diff --git a/crates/web-sys/src/features/gen_HidDeviceFilter.rs b/crates/web-sys/src/features/gen_HidDeviceFilter.rs index 88c21dbc771..d7fd6c7e389 100644 --- a/crates/web-sys/src/features/gen_HidDeviceFilter.rs +++ b/crates/web-sys/src/features/gen_HidDeviceFilter.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidDeviceFilter; - #[wasm_bindgen(method, setter = "productId")] - fn product_id_shim(this: &HidDeviceFilter, val: u16); - #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &HidDeviceFilter, val: u16); - #[wasm_bindgen(method, setter = "usagePage")] - fn usage_page_shim(this: &HidDeviceFilter, val: u16); - #[wasm_bindgen(method, setter = "vendorId")] - fn vendor_id_shim(this: &HidDeviceFilter, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl HidDeviceFilter { - #[doc = "Construct a new `HidDeviceFilter`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `productId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HidDeviceFilter`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "productId")] + pub fn get_product_id(this: &HidDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `productId` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl HidDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn product_id(&mut self, val: u16) -> &mut Self { - self.product_id_shim(val); - self - } + #[wasm_bindgen(method, setter = "productId")] + pub fn set_product_id(this: &HidDeviceFilter, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &HidDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usage` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl HidDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage(&mut self, val: u16) -> &mut Self { - self.usage_shim(val); - self - } + #[wasm_bindgen(method, setter = "usage")] + pub fn set_usage(this: &HidDeviceFilter, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usagePage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usagePage")] + pub fn get_usage_page(this: &HidDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usagePage` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl HidDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage_page(&mut self, val: u16) -> &mut Self { - self.usage_page_shim(val); - self - } + #[wasm_bindgen(method, setter = "usagePage")] + pub fn set_usage_page(this: &HidDeviceFilter, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `vendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "vendorId")] + pub fn get_vendor_id(this: &HidDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `vendorId` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl HidDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "vendorId")] + pub fn set_vendor_id(this: &HidDeviceFilter, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl HidDeviceFilter { + #[doc = "Construct a new `HidDeviceFilter`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_product_id()` instead."] + pub fn product_id(&mut self, val: u16) -> &mut Self { + self.set_product_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage()` instead."] + pub fn usage(&mut self, val: u16) -> &mut Self { + self.set_usage(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage_page()` instead."] + pub fn usage_page(&mut self, val: u16) -> &mut Self { + self.set_usage_page(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_vendor_id()` instead."] pub fn vendor_id(&mut self, val: u32) -> &mut Self { - self.vendor_id_shim(val); + self.set_vendor_id(val); self } } diff --git a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs index ad2ec1f3758..81faf1780ef 100644 --- a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidDeviceRequestOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &HidDeviceRequestOptions) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDeviceRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &HidDeviceRequestOptions, val: &::wasm_bindgen::JsValue); + pub fn set_filters(this: &HidDeviceRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl HidDeviceRequestOptions { @@ -32,14 +48,9 @@ impl HidDeviceRequestOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `filters` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidDeviceRequestOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_filters()` instead."] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); + self.set_filters(val); self } } diff --git a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs index 6defeeec352..b13704deac9 100644 --- a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs +++ b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs @@ -14,37 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidInputReportEventInit; - #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &HidInputReportEventInit, val: bool); - #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &HidInputReportEventInit, val: bool); - #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &HidInputReportEventInit, val: bool); - #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &HidInputReportEventInit, val: &::js_sys::DataView); - #[cfg(feature = "HidDevice")] - #[wasm_bindgen(method, setter = "device")] - fn device_shim(this: &HidInputReportEventInit, val: &HidDevice); - #[wasm_bindgen(method, setter = "reportId")] - fn report_id_shim(this: &HidInputReportEventInit, val: u8); -} -#[cfg(web_sys_unstable_apis)] -impl HidInputReportEventInit { - #[cfg(feature = "HidDevice")] - #[doc = "Construct a new `HidInputReportEventInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidDevice`, `HidInputReportEventInit`*"] + #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(data: &::js_sys::DataView, device: &HidDevice, report_id: u8) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.device(device); - ret.report_id(report_id); - ret - } + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &HidInputReportEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bubbles` field of this object."] #[doc = ""] @@ -52,10 +30,17 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); - self - } + #[wasm_bindgen(method, setter = "bubbles")] + pub fn set_bubbles(this: &HidInputReportEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &HidInputReportEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `cancelable` field of this object."] #[doc = ""] @@ -63,10 +48,17 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); - self - } + #[wasm_bindgen(method, setter = "cancelable")] + pub fn set_cancelable(this: &HidInputReportEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &HidInputReportEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `composed` field of this object."] #[doc = ""] @@ -74,10 +66,17 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); - self - } + #[wasm_bindgen(method, setter = "composed")] + pub fn set_composed(this: &HidInputReportEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &HidInputReportEventInit) -> ::js_sys::DataView; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `data` field of this object."] #[doc = ""] @@ -85,10 +84,18 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn data(&mut self, val: &::js_sys::DataView) -> &mut Self { - self.data_shim(val); - self - } + #[wasm_bindgen(method, setter = "data")] + pub fn set_data(this: &HidInputReportEventInit, val: &::js_sys::DataView); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HidDevice")] + #[doc = "Get the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDevice`, `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "device")] + pub fn get_device(this: &HidInputReportEventInit) -> HidDevice; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HidDevice")] #[doc = "Change the `device` field of this object."] @@ -97,10 +104,17 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn device(&mut self, val: &HidDevice) -> &mut Self { - self.device_shim(val); - self - } + #[wasm_bindgen(method, setter = "device")] + pub fn set_device(this: &HidInputReportEventInit, val: &HidDevice); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `reportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reportId")] + pub fn get_report_id(this: &HidInputReportEventInit) -> u8; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `reportId` field of this object."] #[doc = ""] @@ -108,8 +122,61 @@ impl HidInputReportEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "reportId")] + pub fn set_report_id(this: &HidInputReportEventInit, val: u8); +} +#[cfg(web_sys_unstable_apis)] +impl HidInputReportEventInit { + #[cfg(feature = "HidDevice")] + #[doc = "Construct a new `HidInputReportEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDevice`, `HidInputReportEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(data: &::js_sys::DataView, device: &HidDevice, report_id: u8) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.data(data); + ret.device(device); + ret.report_id(report_id); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bubbles()` instead."] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + self.set_bubbles(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_cancelable()` instead."] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + self.set_cancelable(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_composed()` instead."] + pub fn composed(&mut self, val: bool) -> &mut Self { + self.set_composed(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_data()` instead."] + pub fn data(&mut self, val: &::js_sys::DataView) -> &mut Self { + self.set_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HidDevice")] + #[deprecated = "Use `set_device()` instead."] + pub fn device(&mut self, val: &HidDevice) -> &mut Self { + self.set_device(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_report_id()` instead."] pub fn report_id(&mut self, val: u8) -> &mut Self { - self.report_id_shim(val); + self.set_report_id(val); self } } diff --git a/crates/web-sys/src/features/gen_HidReportInfo.rs b/crates/web-sys/src/features/gen_HidReportInfo.rs index 9ed35faa805..4da0d00dbcc 100644 --- a/crates/web-sys/src/features/gen_HidReportInfo.rs +++ b/crates/web-sys/src/features/gen_HidReportInfo.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidReportInfo; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `items` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "items")] + pub fn get_items(this: &HidReportInfo) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `items` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "items")] - fn items_shim(this: &HidReportInfo, val: &::wasm_bindgen::JsValue); + pub fn set_items(this: &HidReportInfo, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `reportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reportId")] + pub fn get_report_id(this: &HidReportInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `reportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "reportId")] - fn report_id_shim(this: &HidReportInfo, val: u8); + pub fn set_report_id(this: &HidReportInfo, val: u8); } #[cfg(web_sys_unstable_apis)] impl HidReportInfo { @@ -33,25 +65,15 @@ impl HidReportInfo { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `items` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_items()` instead."] pub fn items(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.items_shim(val); + self.set_items(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `reportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HidReportInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_report_id()` instead."] pub fn report_id(&mut self, val: u8) -> &mut Self { - self.report_id_shim(val); + self.set_report_id(val); self } } diff --git a/crates/web-sys/src/features/gen_HidReportItem.rs b/crates/web-sys/src/features/gen_HidReportItem.rs index c4d98dd12fb..c483ecd5598 100644 --- a/crates/web-sys/src/features/gen_HidReportItem.rs +++ b/crates/web-sys/src/features/gen_HidReportItem.rs @@ -14,77 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type HidReportItem; - #[wasm_bindgen(method, setter = "hasNull")] - fn has_null_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "hasPreferredState")] - fn has_preferred_state_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isAbsolute")] - fn is_absolute_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isArray")] - fn is_array_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isBufferedBytes")] - fn is_buffered_bytes_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isConstant")] - fn is_constant_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isLinear")] - fn is_linear_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isRange")] - fn is_range_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "isVolatile")] - fn is_volatile_shim(this: &HidReportItem, val: bool); - #[wasm_bindgen(method, setter = "logicalMaximum")] - fn logical_maximum_shim(this: &HidReportItem, val: i32); - #[wasm_bindgen(method, setter = "logicalMinimum")] - fn logical_minimum_shim(this: &HidReportItem, val: i32); - #[wasm_bindgen(method, setter = "physicalMaximum")] - fn physical_maximum_shim(this: &HidReportItem, val: i32); - #[wasm_bindgen(method, setter = "physicalMinimum")] - fn physical_minimum_shim(this: &HidReportItem, val: i32); - #[wasm_bindgen(method, setter = "reportCount")] - fn report_count_shim(this: &HidReportItem, val: u16); - #[wasm_bindgen(method, setter = "reportSize")] - fn report_size_shim(this: &HidReportItem, val: u16); - #[wasm_bindgen(method, setter = "strings")] - fn strings_shim(this: &HidReportItem, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "unitExponent")] - fn unit_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorCurrentExponent")] - fn unit_factor_current_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorLengthExponent")] - fn unit_factor_length_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorLuminousIntensityExponent")] - fn unit_factor_luminous_intensity_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorMassExponent")] - fn unit_factor_mass_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorTemperatureExponent")] - fn unit_factor_temperature_exponent_shim(this: &HidReportItem, val: i8); - #[wasm_bindgen(method, setter = "unitFactorTimeExponent")] - fn unit_factor_time_exponent_shim(this: &HidReportItem, val: i8); - #[cfg(feature = "HidUnitSystem")] - #[wasm_bindgen(method, setter = "unitSystem")] - fn unit_system_shim(this: &HidReportItem, val: HidUnitSystem); - #[wasm_bindgen(method, setter = "usageMaximum")] - fn usage_maximum_shim(this: &HidReportItem, val: u32); - #[wasm_bindgen(method, setter = "usageMinimum")] - fn usage_minimum_shim(this: &HidReportItem, val: u32); - #[wasm_bindgen(method, setter = "usages")] - fn usages_shim(this: &HidReportItem, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "wrap")] - fn wrap_shim(this: &HidReportItem, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl HidReportItem { - #[doc = "Construct a new `HidReportItem`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hasNull` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "hasNull")] + pub fn get_has_null(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `hasNull` field of this object."] #[doc = ""] @@ -92,10 +30,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn has_null(&mut self, val: bool) -> &mut Self { - self.has_null_shim(val); - self - } + #[wasm_bindgen(method, setter = "hasNull")] + pub fn set_has_null(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hasPreferredState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hasPreferredState")] + pub fn get_has_preferred_state(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `hasPreferredState` field of this object."] #[doc = ""] @@ -103,10 +48,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn has_preferred_state(&mut self, val: bool) -> &mut Self { - self.has_preferred_state_shim(val); - self - } + #[wasm_bindgen(method, setter = "hasPreferredState")] + pub fn set_has_preferred_state(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isAbsolute` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isAbsolute")] + pub fn get_is_absolute(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isAbsolute` field of this object."] #[doc = ""] @@ -114,10 +66,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_absolute(&mut self, val: bool) -> &mut Self { - self.is_absolute_shim(val); - self - } + #[wasm_bindgen(method, setter = "isAbsolute")] + pub fn set_is_absolute(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isArray` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isArray")] + pub fn get_is_array(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isArray` field of this object."] #[doc = ""] @@ -125,10 +84,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_array(&mut self, val: bool) -> &mut Self { - self.is_array_shim(val); - self - } + #[wasm_bindgen(method, setter = "isArray")] + pub fn set_is_array(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isBufferedBytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isBufferedBytes")] + pub fn get_is_buffered_bytes(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isBufferedBytes` field of this object."] #[doc = ""] @@ -136,10 +102,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_buffered_bytes(&mut self, val: bool) -> &mut Self { - self.is_buffered_bytes_shim(val); - self - } + #[wasm_bindgen(method, setter = "isBufferedBytes")] + pub fn set_is_buffered_bytes(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isConstant` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isConstant")] + pub fn get_is_constant(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isConstant` field of this object."] #[doc = ""] @@ -147,10 +120,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_constant(&mut self, val: bool) -> &mut Self { - self.is_constant_shim(val); - self - } + #[wasm_bindgen(method, setter = "isConstant")] + pub fn set_is_constant(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isLinear` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isLinear")] + pub fn get_is_linear(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isLinear` field of this object."] #[doc = ""] @@ -158,10 +138,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_linear(&mut self, val: bool) -> &mut Self { - self.is_linear_shim(val); - self - } + #[wasm_bindgen(method, setter = "isLinear")] + pub fn set_is_linear(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isRange` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isRange")] + pub fn get_is_range(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isRange` field of this object."] #[doc = ""] @@ -169,10 +156,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_range(&mut self, val: bool) -> &mut Self { - self.is_range_shim(val); - self - } + #[wasm_bindgen(method, setter = "isRange")] + pub fn set_is_range(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `isVolatile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "isVolatile")] + pub fn get_is_volatile(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `isVolatile` field of this object."] #[doc = ""] @@ -180,10 +174,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn is_volatile(&mut self, val: bool) -> &mut Self { - self.is_volatile_shim(val); - self - } + #[wasm_bindgen(method, setter = "isVolatile")] + pub fn set_is_volatile(this: &HidReportItem, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `logicalMaximum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "logicalMaximum")] + pub fn get_logical_maximum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `logicalMaximum` field of this object."] #[doc = ""] @@ -191,10 +192,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn logical_maximum(&mut self, val: i32) -> &mut Self { - self.logical_maximum_shim(val); - self - } + #[wasm_bindgen(method, setter = "logicalMaximum")] + pub fn set_logical_maximum(this: &HidReportItem, val: i32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `logicalMinimum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "logicalMinimum")] + pub fn get_logical_minimum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `logicalMinimum` field of this object."] #[doc = ""] @@ -202,10 +210,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn logical_minimum(&mut self, val: i32) -> &mut Self { - self.logical_minimum_shim(val); - self - } + #[wasm_bindgen(method, setter = "logicalMinimum")] + pub fn set_logical_minimum(this: &HidReportItem, val: i32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `physicalMaximum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "physicalMaximum")] + pub fn get_physical_maximum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `physicalMaximum` field of this object."] #[doc = ""] @@ -213,10 +228,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn physical_maximum(&mut self, val: i32) -> &mut Self { - self.physical_maximum_shim(val); - self - } + #[wasm_bindgen(method, setter = "physicalMaximum")] + pub fn set_physical_maximum(this: &HidReportItem, val: i32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `physicalMinimum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "physicalMinimum")] + pub fn get_physical_minimum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `physicalMinimum` field of this object."] #[doc = ""] @@ -224,10 +246,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn physical_minimum(&mut self, val: i32) -> &mut Self { - self.physical_minimum_shim(val); - self - } + #[wasm_bindgen(method, setter = "physicalMinimum")] + pub fn set_physical_minimum(this: &HidReportItem, val: i32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `reportCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reportCount")] + pub fn get_report_count(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `reportCount` field of this object."] #[doc = ""] @@ -235,10 +264,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn report_count(&mut self, val: u16) -> &mut Self { - self.report_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "reportCount")] + pub fn set_report_count(this: &HidReportItem, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `reportSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reportSize")] + pub fn get_report_size(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `reportSize` field of this object."] #[doc = ""] @@ -246,10 +282,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn report_size(&mut self, val: u16) -> &mut Self { - self.report_size_shim(val); - self - } + #[wasm_bindgen(method, setter = "reportSize")] + pub fn set_report_size(this: &HidReportItem, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `strings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "strings")] + pub fn get_strings(this: &HidReportItem) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `strings` field of this object."] #[doc = ""] @@ -257,10 +300,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn strings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.strings_shim(val); - self - } + #[wasm_bindgen(method, setter = "strings")] + pub fn set_strings(this: &HidReportItem, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitExponent")] + pub fn get_unit_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitExponent` field of this object."] #[doc = ""] @@ -268,10 +318,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_exponent(&mut self, val: i8) -> &mut Self { - self.unit_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitExponent")] + pub fn set_unit_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorCurrentExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorCurrentExponent")] + pub fn get_unit_factor_current_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorCurrentExponent` field of this object."] #[doc = ""] @@ -279,10 +336,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_current_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_current_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorCurrentExponent")] + pub fn set_unit_factor_current_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorLengthExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorLengthExponent")] + pub fn get_unit_factor_length_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorLengthExponent` field of this object."] #[doc = ""] @@ -290,10 +354,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_length_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_length_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorLengthExponent")] + pub fn set_unit_factor_length_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorLuminousIntensityExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorLuminousIntensityExponent")] + pub fn get_unit_factor_luminous_intensity_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorLuminousIntensityExponent` field of this object."] #[doc = ""] @@ -301,10 +372,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_luminous_intensity_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_luminous_intensity_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorLuminousIntensityExponent")] + pub fn set_unit_factor_luminous_intensity_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorMassExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorMassExponent")] + pub fn get_unit_factor_mass_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorMassExponent` field of this object."] #[doc = ""] @@ -312,10 +390,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_mass_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_mass_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorMassExponent")] + pub fn set_unit_factor_mass_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorTemperatureExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorTemperatureExponent")] + pub fn get_unit_factor_temperature_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorTemperatureExponent` field of this object."] #[doc = ""] @@ -323,10 +408,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_temperature_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_temperature_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorTemperatureExponent")] + pub fn set_unit_factor_temperature_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `unitFactorTimeExponent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitFactorTimeExponent")] + pub fn get_unit_factor_time_exponent(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `unitFactorTimeExponent` field of this object."] #[doc = ""] @@ -334,10 +426,18 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_factor_time_exponent(&mut self, val: i8) -> &mut Self { - self.unit_factor_time_exponent_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitFactorTimeExponent")] + pub fn set_unit_factor_time_exponent(this: &HidReportItem, val: i8); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HidUnitSystem")] + #[doc = "Get the `unitSystem` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`, `HidUnitSystem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "unitSystem")] + pub fn get_unit_system(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HidUnitSystem")] #[doc = "Change the `unitSystem` field of this object."] @@ -346,10 +446,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn unit_system(&mut self, val: HidUnitSystem) -> &mut Self { - self.unit_system_shim(val); - self - } + #[wasm_bindgen(method, setter = "unitSystem")] + pub fn set_unit_system(this: &HidReportItem, val: HidUnitSystem); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usageMaximum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usageMaximum")] + pub fn get_usage_maximum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usageMaximum` field of this object."] #[doc = ""] @@ -357,10 +464,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage_maximum(&mut self, val: u32) -> &mut Self { - self.usage_maximum_shim(val); - self - } + #[wasm_bindgen(method, setter = "usageMaximum")] + pub fn set_usage_maximum(this: &HidReportItem, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usageMinimum` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usageMinimum")] + pub fn get_usage_minimum(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usageMinimum` field of this object."] #[doc = ""] @@ -368,10 +482,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usage_minimum(&mut self, val: u32) -> &mut Self { - self.usage_minimum_shim(val); - self - } + #[wasm_bindgen(method, setter = "usageMinimum")] + pub fn set_usage_minimum(this: &HidReportItem, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usages` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usages")] + pub fn get_usages(this: &HidReportItem) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `usages` field of this object."] #[doc = ""] @@ -379,10 +500,17 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn usages(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.usages_shim(val); - self - } + #[wasm_bindgen(method, setter = "usages")] + pub fn set_usages(this: &HidReportItem, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `wrap` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "wrap")] + pub fn get_wrap(this: &HidReportItem) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `wrap` field of this object."] #[doc = ""] @@ -390,8 +518,189 @@ impl HidReportItem { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "wrap")] + pub fn set_wrap(this: &HidReportItem, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl HidReportItem { + #[doc = "Construct a new `HidReportItem`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidReportItem`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_has_null()` instead."] + pub fn has_null(&mut self, val: bool) -> &mut Self { + self.set_has_null(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_has_preferred_state()` instead."] + pub fn has_preferred_state(&mut self, val: bool) -> &mut Self { + self.set_has_preferred_state(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_absolute()` instead."] + pub fn is_absolute(&mut self, val: bool) -> &mut Self { + self.set_is_absolute(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_array()` instead."] + pub fn is_array(&mut self, val: bool) -> &mut Self { + self.set_is_array(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_buffered_bytes()` instead."] + pub fn is_buffered_bytes(&mut self, val: bool) -> &mut Self { + self.set_is_buffered_bytes(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_constant()` instead."] + pub fn is_constant(&mut self, val: bool) -> &mut Self { + self.set_is_constant(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_linear()` instead."] + pub fn is_linear(&mut self, val: bool) -> &mut Self { + self.set_is_linear(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_range()` instead."] + pub fn is_range(&mut self, val: bool) -> &mut Self { + self.set_is_range(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_is_volatile()` instead."] + pub fn is_volatile(&mut self, val: bool) -> &mut Self { + self.set_is_volatile(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_logical_maximum()` instead."] + pub fn logical_maximum(&mut self, val: i32) -> &mut Self { + self.set_logical_maximum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_logical_minimum()` instead."] + pub fn logical_minimum(&mut self, val: i32) -> &mut Self { + self.set_logical_minimum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_physical_maximum()` instead."] + pub fn physical_maximum(&mut self, val: i32) -> &mut Self { + self.set_physical_maximum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_physical_minimum()` instead."] + pub fn physical_minimum(&mut self, val: i32) -> &mut Self { + self.set_physical_minimum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_report_count()` instead."] + pub fn report_count(&mut self, val: u16) -> &mut Self { + self.set_report_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_report_size()` instead."] + pub fn report_size(&mut self, val: u16) -> &mut Self { + self.set_report_size(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_strings()` instead."] + pub fn strings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_strings(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_exponent()` instead."] + pub fn unit_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_current_exponent()` instead."] + pub fn unit_factor_current_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_current_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_length_exponent()` instead."] + pub fn unit_factor_length_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_length_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_luminous_intensity_exponent()` instead."] + pub fn unit_factor_luminous_intensity_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_luminous_intensity_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_mass_exponent()` instead."] + pub fn unit_factor_mass_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_mass_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_temperature_exponent()` instead."] + pub fn unit_factor_temperature_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_temperature_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_unit_factor_time_exponent()` instead."] + pub fn unit_factor_time_exponent(&mut self, val: i8) -> &mut Self { + self.set_unit_factor_time_exponent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HidUnitSystem")] + #[deprecated = "Use `set_unit_system()` instead."] + pub fn unit_system(&mut self, val: HidUnitSystem) -> &mut Self { + self.set_unit_system(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage_maximum()` instead."] + pub fn usage_maximum(&mut self, val: u32) -> &mut Self { + self.set_usage_maximum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage_minimum()` instead."] + pub fn usage_minimum(&mut self, val: u32) -> &mut Self { + self.set_usage_minimum(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usages()` instead."] + pub fn usages(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_usages(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_wrap()` instead."] pub fn wrap(&mut self, val: bool) -> &mut Self { - self.wrap_shim(val); + self.set_wrap(val); self } } diff --git a/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs b/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs index 1052c037a47..07fcd66658b 100644 --- a/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs +++ b/crates/web-sys/src/features/gen_HiddenPluginEventInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] pub type HiddenPluginEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &HiddenPluginEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &HiddenPluginEventInit, val: bool); + pub fn set_bubbles(this: &HiddenPluginEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &HiddenPluginEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &HiddenPluginEventInit, val: bool); + pub fn set_cancelable(this: &HiddenPluginEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &HiddenPluginEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &HiddenPluginEventInit, val: bool); + pub fn set_composed(this: &HiddenPluginEventInit, val: bool); } impl HiddenPluginEventInit { #[doc = "Construct a new `HiddenPluginEventInit`."] @@ -26,25 +50,19 @@ impl HiddenPluginEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HiddenPluginEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_HitRegionOptions.rs b/crates/web-sys/src/features/gen_HitRegionOptions.rs index ebbfcefeb31..fa0ea9ed78e 100644 --- a/crates/web-sys/src/features/gen_HitRegionOptions.rs +++ b/crates/web-sys/src/features/gen_HitRegionOptions.rs @@ -11,13 +11,39 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] pub type HitRegionOptions; #[cfg(feature = "Element")] + #[doc = "Get the `control` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `HitRegionOptions`*"] + #[wasm_bindgen(method, getter = "control")] + pub fn get_control(this: &HitRegionOptions) -> Option; + #[cfg(feature = "Element")] + #[doc = "Change the `control` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `HitRegionOptions`*"] #[wasm_bindgen(method, setter = "control")] - fn control_shim(this: &HitRegionOptions, val: Option<&Element>); + pub fn set_control(this: &HitRegionOptions, val: Option<&Element>); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &HitRegionOptions) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &HitRegionOptions, val: &str); + pub fn set_id(this: &HitRegionOptions, val: &str); + #[cfg(feature = "Path2d")] + #[doc = "Get the `path` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`, `Path2d`*"] + #[wasm_bindgen(method, getter = "path")] + pub fn get_path(this: &HitRegionOptions) -> Option; #[cfg(feature = "Path2d")] + #[doc = "Change the `path` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`, `Path2d`*"] #[wasm_bindgen(method, setter = "path")] - fn path_shim(this: &HitRegionOptions, val: Option<&Path2d>); + pub fn set_path(this: &HitRegionOptions, val: Option<&Path2d>); } impl HitRegionOptions { #[doc = "Construct a new `HitRegionOptions`."] @@ -29,26 +55,20 @@ impl HitRegionOptions { ret } #[cfg(feature = "Element")] - #[doc = "Change the `control` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Element`, `HitRegionOptions`*"] + #[deprecated = "Use `set_control()` instead."] pub fn control(&mut self, val: Option<&Element>) -> &mut Self { - self.control_shim(val); + self.set_control(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } #[cfg(feature = "Path2d")] - #[doc = "Change the `path` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`, `Path2d`*"] + #[deprecated = "Use `set_path()` instead."] pub fn path(&mut self, val: Option<&Path2d>) -> &mut Self { - self.path_shim(val); + self.set_path(val); self } } diff --git a/crates/web-sys/src/features/gen_HkdfParams.rs b/crates/web-sys/src/features/gen_HkdfParams.rs index ba49af7229d..e0b6f86a332 100644 --- a/crates/web-sys/src/features/gen_HkdfParams.rs +++ b/crates/web-sys/src/features/gen_HkdfParams.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] pub type HkdfParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &HkdfParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &HkdfParams, val: &str); + pub fn set_name(this: &HkdfParams, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &HkdfParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &HkdfParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &HkdfParams, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `info` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[wasm_bindgen(method, getter = "info")] + pub fn get_info(this: &HkdfParams) -> ::js_sys::Object; + #[doc = "Change the `info` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] #[wasm_bindgen(method, setter = "info")] - fn info_shim(this: &HkdfParams, val: &::js_sys::Object); + pub fn set_info(this: &HkdfParams, val: &::js_sys::Object); + #[doc = "Get the `salt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[wasm_bindgen(method, getter = "salt")] + pub fn get_salt(this: &HkdfParams) -> ::js_sys::Object; + #[doc = "Change the `salt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] #[wasm_bindgen(method, setter = "salt")] - fn salt_shim(this: &HkdfParams, val: &::js_sys::Object); + pub fn set_salt(this: &HkdfParams, val: &::js_sys::Object); } impl HkdfParams { #[doc = "Construct a new `HkdfParams`."] @@ -37,32 +69,24 @@ impl HkdfParams { ret.salt(salt); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } - #[doc = "Change the `info` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[deprecated = "Use `set_info()` instead."] pub fn info(&mut self, val: &::js_sys::Object) -> &mut Self { - self.info_shim(val); + self.set_info(val); self } - #[doc = "Change the `salt` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] + #[deprecated = "Use `set_salt()` instead."] pub fn salt(&mut self, val: &::js_sys::Object) -> &mut Self { - self.salt_shim(val); + self.set_salt(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs index dd912acbd23..40047b3e4a9 100644 --- a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] pub type HmacDerivedKeyParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &HmacDerivedKeyParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &HmacDerivedKeyParams, val: &str); + pub fn set_name(this: &HmacDerivedKeyParams, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &HmacDerivedKeyParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &HmacDerivedKeyParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &HmacDerivedKeyParams, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &HmacDerivedKeyParams) -> Option; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &HmacDerivedKeyParams, val: u32); + pub fn set_length(this: &HmacDerivedKeyParams, val: u32); } impl HmacDerivedKeyParams { #[doc = "Construct a new `HmacDerivedKeyParams`."] @@ -28,25 +52,19 @@ impl HmacDerivedKeyParams { ret.hash(hash); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacImportParams.rs b/crates/web-sys/src/features/gen_HmacImportParams.rs index 1fbc6013647..685b5ff5e7a 100644 --- a/crates/web-sys/src/features/gen_HmacImportParams.rs +++ b/crates/web-sys/src/features/gen_HmacImportParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] pub type HmacImportParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &HmacImportParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &HmacImportParams, val: &str); + pub fn set_name(this: &HmacImportParams, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &HmacImportParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &HmacImportParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &HmacImportParams, val: &::wasm_bindgen::JsValue); } impl HmacImportParams { #[doc = "Construct a new `HmacImportParams`."] @@ -26,18 +42,14 @@ impl HmacImportParams { ret.hash(hash); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs index e45ef81f604..de8a8cac708 100644 --- a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs @@ -10,13 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] pub type HmacKeyAlgorithm; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &HmacKeyAlgorithm) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &HmacKeyAlgorithm, val: &str); + pub fn set_name(this: &HmacKeyAlgorithm, val: &str); #[cfg(feature = "KeyAlgorithm")] + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &HmacKeyAlgorithm) -> KeyAlgorithm; + #[cfg(feature = "KeyAlgorithm")] + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &HmacKeyAlgorithm, val: &KeyAlgorithm); + pub fn set_hash(this: &HmacKeyAlgorithm, val: &KeyAlgorithm); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &HmacKeyAlgorithm) -> u32; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &HmacKeyAlgorithm, val: u32); + pub fn set_length(this: &HmacKeyAlgorithm, val: u32); } impl HmacKeyAlgorithm { #[cfg(feature = "KeyAlgorithm")] @@ -31,26 +56,20 @@ impl HmacKeyAlgorithm { ret.length(length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "KeyAlgorithm")] - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`, `KeyAlgorithm`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &KeyAlgorithm) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs index 0ccceb4973a..7363659e1de 100644 --- a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] pub type HmacKeyGenParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &HmacKeyGenParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &HmacKeyGenParams, val: &str); + pub fn set_name(this: &HmacKeyGenParams, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &HmacKeyGenParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &HmacKeyGenParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &HmacKeyGenParams, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &HmacKeyGenParams) -> Option; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &HmacKeyGenParams, val: u32); + pub fn set_length(this: &HmacKeyGenParams, val: u32); } impl HmacKeyGenParams { #[doc = "Construct a new `HmacKeyGenParams`."] @@ -28,25 +52,19 @@ impl HmacKeyGenParams { ret.hash(hash); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnDict.rs b/crates/web-sys/src/features/gen_HttpConnDict.rs index 04bbdd65a96..754d2fe96e0 100644 --- a/crates/web-sys/src/features/gen_HttpConnDict.rs +++ b/crates/web-sys/src/features/gen_HttpConnDict.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] pub type HttpConnDict; + #[doc = "Get the `connections` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] + #[wasm_bindgen(method, getter = "connections")] + pub fn get_connections(this: &HttpConnDict) -> Option<::js_sys::Array>; + #[doc = "Change the `connections` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] #[wasm_bindgen(method, setter = "connections")] - fn connections_shim(this: &HttpConnDict, val: &::wasm_bindgen::JsValue); + pub fn set_connections(this: &HttpConnDict, val: &::wasm_bindgen::JsValue); } impl HttpConnDict { #[doc = "Construct a new `HttpConnDict`."] @@ -22,11 +30,9 @@ impl HttpConnDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `connections` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnDict`*"] + #[deprecated = "Use `set_connections()` instead."] pub fn connections(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.connections_shim(val); + self.set_connections(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnInfo.rs b/crates/web-sys/src/features/gen_HttpConnInfo.rs index 42ec871b2b8..21819e6a530 100644 --- a/crates/web-sys/src/features/gen_HttpConnInfo.rs +++ b/crates/web-sys/src/features/gen_HttpConnInfo.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] pub type HttpConnInfo; + #[doc = "Get the `protocolVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[wasm_bindgen(method, getter = "protocolVersion")] + pub fn get_protocol_version(this: &HttpConnInfo) -> Option; + #[doc = "Change the `protocolVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] #[wasm_bindgen(method, setter = "protocolVersion")] - fn protocol_version_shim(this: &HttpConnInfo, val: &str); + pub fn set_protocol_version(this: &HttpConnInfo, val: &str); + #[doc = "Get the `rtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[wasm_bindgen(method, getter = "rtt")] + pub fn get_rtt(this: &HttpConnInfo) -> Option; + #[doc = "Change the `rtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] #[wasm_bindgen(method, setter = "rtt")] - fn rtt_shim(this: &HttpConnInfo, val: u32); + pub fn set_rtt(this: &HttpConnInfo, val: u32); + #[doc = "Get the `ttl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[wasm_bindgen(method, getter = "ttl")] + pub fn get_ttl(this: &HttpConnInfo) -> Option; + #[doc = "Change the `ttl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] #[wasm_bindgen(method, setter = "ttl")] - fn ttl_shim(this: &HttpConnInfo, val: u32); + pub fn set_ttl(this: &HttpConnInfo, val: u32); } impl HttpConnInfo { #[doc = "Construct a new `HttpConnInfo`."] @@ -26,25 +50,19 @@ impl HttpConnInfo { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `protocolVersion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[deprecated = "Use `set_protocol_version()` instead."] pub fn protocol_version(&mut self, val: &str) -> &mut Self { - self.protocol_version_shim(val); + self.set_protocol_version(val); self } - #[doc = "Change the `rtt` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[deprecated = "Use `set_rtt()` instead."] pub fn rtt(&mut self, val: u32) -> &mut Self { - self.rtt_shim(val); + self.set_rtt(val); self } - #[doc = "Change the `ttl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] + #[deprecated = "Use `set_ttl()` instead."] pub fn ttl(&mut self, val: u32) -> &mut Self { - self.ttl_shim(val); + self.set_ttl(val); self } } diff --git a/crates/web-sys/src/features/gen_HttpConnectionElement.rs b/crates/web-sys/src/features/gen_HttpConnectionElement.rs index fe702139824..8488fc9d2bc 100644 --- a/crates/web-sys/src/features/gen_HttpConnectionElement.rs +++ b/crates/web-sys/src/features/gen_HttpConnectionElement.rs @@ -10,20 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] pub type HttpConnectionElement; + #[doc = "Get the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "active")] + pub fn get_active(this: &HttpConnectionElement) -> Option<::js_sys::Array>; + #[doc = "Change the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "active")] - fn active_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + pub fn set_active(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `halfOpens` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "halfOpens")] + pub fn get_half_opens(this: &HttpConnectionElement) -> Option<::js_sys::Array>; + #[doc = "Change the `halfOpens` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "halfOpens")] - fn half_opens_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + pub fn set_half_opens(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `host` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "host")] + pub fn get_host(this: &HttpConnectionElement) -> Option; + #[doc = "Change the `host` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "host")] - fn host_shim(this: &HttpConnectionElement, val: &str); + pub fn set_host(this: &HttpConnectionElement, val: &str); + #[doc = "Get the `idle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "idle")] + pub fn get_idle(this: &HttpConnectionElement) -> Option<::js_sys::Array>; + #[doc = "Change the `idle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "idle")] - fn idle_shim(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + pub fn set_idle(this: &HttpConnectionElement, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "port")] + pub fn get_port(this: &HttpConnectionElement) -> Option; + #[doc = "Change the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "port")] - fn port_shim(this: &HttpConnectionElement, val: u32); + pub fn set_port(this: &HttpConnectionElement, val: u32); + #[doc = "Get the `spdy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "spdy")] + pub fn get_spdy(this: &HttpConnectionElement) -> Option; + #[doc = "Change the `spdy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "spdy")] - fn spdy_shim(this: &HttpConnectionElement, val: bool); + pub fn set_spdy(this: &HttpConnectionElement, val: bool); + #[doc = "Get the `ssl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[wasm_bindgen(method, getter = "ssl")] + pub fn get_ssl(this: &HttpConnectionElement) -> Option; + #[doc = "Change the `ssl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, setter = "ssl")] - fn ssl_shim(this: &HttpConnectionElement, val: bool); + pub fn set_ssl(this: &HttpConnectionElement, val: bool); } impl HttpConnectionElement { #[doc = "Construct a new `HttpConnectionElement`."] @@ -34,53 +90,39 @@ impl HttpConnectionElement { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `active` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_active()` instead."] pub fn active(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.active_shim(val); + self.set_active(val); self } - #[doc = "Change the `halfOpens` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_half_opens()` instead."] pub fn half_opens(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.half_opens_shim(val); + self.set_half_opens(val); self } - #[doc = "Change the `host` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_host()` instead."] pub fn host(&mut self, val: &str) -> &mut Self { - self.host_shim(val); + self.set_host(val); self } - #[doc = "Change the `idle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_idle()` instead."] pub fn idle(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.idle_shim(val); + self.set_idle(val); self } - #[doc = "Change the `port` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_port()` instead."] pub fn port(&mut self, val: u32) -> &mut Self { - self.port_shim(val); + self.set_port(val); self } - #[doc = "Change the `spdy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_spdy()` instead."] pub fn spdy(&mut self, val: bool) -> &mut Self { - self.spdy_shim(val); + self.set_spdy(val); self } - #[doc = "Change the `ssl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] + #[deprecated = "Use `set_ssl()` instead."] pub fn ssl(&mut self, val: bool) -> &mut Self { - self.ssl_shim(val); + self.set_ssl(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs index fabebd3008f..2ec009b1338 100644 --- a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs +++ b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] pub type IdbFileMetadataParameters; + #[doc = "Get the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[wasm_bindgen(method, getter = "lastModified")] + pub fn get_last_modified(this: &IdbFileMetadataParameters) -> Option; + #[doc = "Change the `lastModified` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] #[wasm_bindgen(method, setter = "lastModified")] - fn last_modified_shim(this: &IdbFileMetadataParameters, val: bool); + pub fn set_last_modified(this: &IdbFileMetadataParameters, val: bool); + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &IdbFileMetadataParameters) -> Option; + #[doc = "Change the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &IdbFileMetadataParameters, val: bool); + pub fn set_size(this: &IdbFileMetadataParameters, val: bool); } impl IdbFileMetadataParameters { #[doc = "Construct a new `IdbFileMetadataParameters`."] @@ -24,18 +40,14 @@ impl IdbFileMetadataParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `lastModified` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated = "Use `set_last_modified()` instead."] pub fn last_modified(&mut self, val: bool) -> &mut Self { - self.last_modified_shim(val); + self.set_last_modified(val); self } - #[doc = "Change the `size` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated = "Use `set_size()` instead."] pub fn size(&mut self, val: bool) -> &mut Self { - self.size_shim(val); + self.set_size(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbIndexParameters.rs b/crates/web-sys/src/features/gen_IdbIndexParameters.rs index b4ac9086a39..9238e85f6ff 100644 --- a/crates/web-sys/src/features/gen_IdbIndexParameters.rs +++ b/crates/web-sys/src/features/gen_IdbIndexParameters.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] pub type IdbIndexParameters; + #[doc = "Get the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[wasm_bindgen(method, getter = "locale")] + pub fn get_locale(this: &IdbIndexParameters) -> Option; + #[doc = "Change the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] #[wasm_bindgen(method, setter = "locale")] - fn locale_shim(this: &IdbIndexParameters, val: Option<&str>); + pub fn set_locale(this: &IdbIndexParameters, val: Option<&str>); + #[doc = "Get the `multiEntry` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[wasm_bindgen(method, getter = "multiEntry")] + pub fn get_multi_entry(this: &IdbIndexParameters) -> Option; + #[doc = "Change the `multiEntry` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] #[wasm_bindgen(method, setter = "multiEntry")] - fn multi_entry_shim(this: &IdbIndexParameters, val: bool); + pub fn set_multi_entry(this: &IdbIndexParameters, val: bool); + #[doc = "Get the `unique` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[wasm_bindgen(method, getter = "unique")] + pub fn get_unique(this: &IdbIndexParameters) -> Option; + #[doc = "Change the `unique` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] #[wasm_bindgen(method, setter = "unique")] - fn unique_shim(this: &IdbIndexParameters, val: bool); + pub fn set_unique(this: &IdbIndexParameters, val: bool); } impl IdbIndexParameters { #[doc = "Construct a new `IdbIndexParameters`."] @@ -26,25 +50,19 @@ impl IdbIndexParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `locale` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[deprecated = "Use `set_locale()` instead."] pub fn locale(&mut self, val: Option<&str>) -> &mut Self { - self.locale_shim(val); + self.set_locale(val); self } - #[doc = "Change the `multiEntry` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[deprecated = "Use `set_multi_entry()` instead."] pub fn multi_entry(&mut self, val: bool) -> &mut Self { - self.multi_entry_shim(val); + self.set_multi_entry(val); self } - #[doc = "Change the `unique` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[deprecated = "Use `set_unique()` instead."] pub fn unique(&mut self, val: bool) -> &mut Self { - self.unique_shim(val); + self.set_unique(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs b/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs index be0d078c977..03ce907e3c8 100644 --- a/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs +++ b/crates/web-sys/src/features/gen_IdbObjectStoreParameters.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] pub type IdbObjectStoreParameters; + #[doc = "Get the `autoIncrement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] + #[wasm_bindgen(method, getter = "autoIncrement")] + pub fn get_auto_increment(this: &IdbObjectStoreParameters) -> Option; + #[doc = "Change the `autoIncrement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] #[wasm_bindgen(method, setter = "autoIncrement")] - fn auto_increment_shim(this: &IdbObjectStoreParameters, val: bool); + pub fn set_auto_increment(this: &IdbObjectStoreParameters, val: bool); + #[doc = "Get the `keyPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] + #[wasm_bindgen(method, getter = "keyPath")] + pub fn get_key_path(this: &IdbObjectStoreParameters) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `keyPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] #[wasm_bindgen(method, setter = "keyPath")] - fn key_path_shim(this: &IdbObjectStoreParameters, val: &::wasm_bindgen::JsValue); + pub fn set_key_path(this: &IdbObjectStoreParameters, val: &::wasm_bindgen::JsValue); } impl IdbObjectStoreParameters { #[doc = "Construct a new `IdbObjectStoreParameters`."] @@ -24,18 +40,14 @@ impl IdbObjectStoreParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `autoIncrement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] + #[deprecated = "Use `set_auto_increment()` instead."] pub fn auto_increment(&mut self, val: bool) -> &mut Self { - self.auto_increment_shim(val); + self.set_auto_increment(val); self } - #[doc = "Change the `keyPath` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbObjectStoreParameters`*"] + #[deprecated = "Use `set_key_path()` instead."] pub fn key_path(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.key_path_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_key_path(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } } diff --git a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs index e5839a07b1c..162108e06b4 100644 --- a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs +++ b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs @@ -11,10 +11,27 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] pub type IdbOpenDbOptions; #[cfg(feature = "StorageType")] + #[doc = "Get the `storage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] + #[wasm_bindgen(method, getter = "storage")] + pub fn get_storage(this: &IdbOpenDbOptions) -> Option; + #[cfg(feature = "StorageType")] + #[doc = "Change the `storage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] #[wasm_bindgen(method, setter = "storage")] - fn storage_shim(this: &IdbOpenDbOptions, val: StorageType); + pub fn set_storage(this: &IdbOpenDbOptions, val: StorageType); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &IdbOpenDbOptions) -> Option; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &IdbOpenDbOptions, val: f64); + pub fn set_version(this: &IdbOpenDbOptions, val: f64); } impl IdbOpenDbOptions { #[doc = "Construct a new `IdbOpenDbOptions`."] @@ -26,18 +43,14 @@ impl IdbOpenDbOptions { ret } #[cfg(feature = "StorageType")] - #[doc = "Change the `storage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] + #[deprecated = "Use `set_storage()` instead."] pub fn storage(&mut self, val: StorageType) -> &mut Self { - self.storage_shim(val); + self.set_storage(val); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: f64) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs b/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs index 65ae93c1d7e..ccd13f69620 100644 --- a/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_IdbVersionChangeEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] pub type IdbVersionChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &IdbVersionChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &IdbVersionChangeEventInit, val: bool); + pub fn set_bubbles(this: &IdbVersionChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &IdbVersionChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &IdbVersionChangeEventInit, val: bool); + pub fn set_cancelable(this: &IdbVersionChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &IdbVersionChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &IdbVersionChangeEventInit, val: bool); + pub fn set_composed(this: &IdbVersionChangeEventInit, val: bool); + #[doc = "Get the `newVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[wasm_bindgen(method, getter = "newVersion")] + pub fn get_new_version(this: &IdbVersionChangeEventInit) -> Option; + #[doc = "Change the `newVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] #[wasm_bindgen(method, setter = "newVersion")] - fn new_version_shim(this: &IdbVersionChangeEventInit, val: Option); + pub fn set_new_version(this: &IdbVersionChangeEventInit, val: Option); + #[doc = "Get the `oldVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[wasm_bindgen(method, getter = "oldVersion")] + pub fn get_old_version(this: &IdbVersionChangeEventInit) -> Option; + #[doc = "Change the `oldVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] #[wasm_bindgen(method, setter = "oldVersion")] - fn old_version_shim(this: &IdbVersionChangeEventInit, val: f64); + pub fn set_old_version(this: &IdbVersionChangeEventInit, val: f64); } impl IdbVersionChangeEventInit { #[doc = "Construct a new `IdbVersionChangeEventInit`."] @@ -30,39 +70,29 @@ impl IdbVersionChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `newVersion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[deprecated = "Use `set_new_version()` instead."] pub fn new_version(&mut self, val: Option) -> &mut Self { - self.new_version_shim(val); + self.set_new_version(val); self } - #[doc = "Change the `oldVersion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbVersionChangeEventInit`*"] + #[deprecated = "Use `set_old_version()` instead."] pub fn old_version(&mut self, val: f64) -> &mut Self { - self.old_version_shim(val); + self.set_old_version(val); self } } diff --git a/crates/web-sys/src/features/gen_IdleRequestOptions.rs b/crates/web-sys/src/features/gen_IdleRequestOptions.rs index b0b550ed8b4..cd5e78a4b18 100644 --- a/crates/web-sys/src/features/gen_IdleRequestOptions.rs +++ b/crates/web-sys/src/features/gen_IdleRequestOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] pub type IdleRequestOptions; + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &IdleRequestOptions) -> Option; + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] #[wasm_bindgen(method, setter = "timeout")] - fn timeout_shim(this: &IdleRequestOptions, val: u32); + pub fn set_timeout(this: &IdleRequestOptions, val: u32); } impl IdleRequestOptions { #[doc = "Construct a new `IdleRequestOptions`."] @@ -22,11 +30,9 @@ impl IdleRequestOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `timeout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdleRequestOptions`*"] + #[deprecated = "Use `set_timeout()` instead."] pub fn timeout(&mut self, val: u32) -> &mut Self { - self.timeout_shim(val); + self.set_timeout(val); self } } diff --git a/crates/web-sys/src/features/gen_IirFilterOptions.rs b/crates/web-sys/src/features/gen_IirFilterOptions.rs index b88375ed03b..60c8530fbdb 100644 --- a/crates/web-sys/src/features/gen_IirFilterOptions.rs +++ b/crates/web-sys/src/features/gen_IirFilterOptions.rs @@ -10,18 +10,60 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] pub type IirFilterOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &IirFilterOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &IirFilterOptions, val: u32); + pub fn set_channel_count(this: &IirFilterOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `IirFilterOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &IirFilterOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `IirFilterOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &IirFilterOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &IirFilterOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `IirFilterOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &IirFilterOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `IirFilterOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &IirFilterOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &IirFilterOptions, val: ChannelInterpretation); + #[doc = "Get the `feedback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[wasm_bindgen(method, getter = "feedback")] + pub fn get_feedback(this: &IirFilterOptions) -> ::js_sys::Array; + #[doc = "Change the `feedback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] #[wasm_bindgen(method, setter = "feedback")] - fn feedback_shim(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); + pub fn set_feedback(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `feedforward` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[wasm_bindgen(method, getter = "feedforward")] + pub fn get_feedforward(this: &IirFilterOptions) -> ::js_sys::Array; + #[doc = "Change the `feedforward` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] #[wasm_bindgen(method, setter = "feedforward")] - fn feedforward_shim(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); + pub fn set_feedforward(this: &IirFilterOptions, val: &::wasm_bindgen::JsValue); } impl IirFilterOptions { #[doc = "Construct a new `IirFilterOptions`."] @@ -34,41 +76,31 @@ impl IirFilterOptions { ret.feedforward(feedforward); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `IirFilterOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `IirFilterOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `feedback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[deprecated = "Use `set_feedback()` instead."] pub fn feedback(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.feedback_shim(val); + self.set_feedback(val); self } - #[doc = "Change the `feedforward` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IirFilterOptions`*"] + #[deprecated = "Use `set_feedforward()` instead."] pub fn feedforward(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.feedforward_shim(val); + self.set_feedforward(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs index 865c2786fd3..2c641c50b29 100644 --- a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs +++ b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs @@ -11,21 +11,73 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] pub type ImageBitmapOptions; #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Get the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] + #[wasm_bindgen(method, getter = "colorSpaceConversion")] + pub fn get_color_space_conversion(this: &ImageBitmapOptions) -> Option; + #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Change the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] #[wasm_bindgen(method, setter = "colorSpaceConversion")] - fn color_space_conversion_shim(this: &ImageBitmapOptions, val: ColorSpaceConversion); + pub fn set_color_space_conversion(this: &ImageBitmapOptions, val: ColorSpaceConversion); #[cfg(feature = "ImageOrientation")] + #[doc = "Get the `imageOrientation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] + #[wasm_bindgen(method, getter = "imageOrientation")] + pub fn get_image_orientation(this: &ImageBitmapOptions) -> Option; + #[cfg(feature = "ImageOrientation")] + #[doc = "Change the `imageOrientation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] #[wasm_bindgen(method, setter = "imageOrientation")] - fn image_orientation_shim(this: &ImageBitmapOptions, val: ImageOrientation); + pub fn set_image_orientation(this: &ImageBitmapOptions, val: ImageOrientation); + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Get the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] + #[wasm_bindgen(method, getter = "premultiplyAlpha")] + pub fn get_premultiply_alpha(this: &ImageBitmapOptions) -> Option; #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Change the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] #[wasm_bindgen(method, setter = "premultiplyAlpha")] - fn premultiply_alpha_shim(this: &ImageBitmapOptions, val: PremultiplyAlpha); + pub fn set_premultiply_alpha(this: &ImageBitmapOptions, val: PremultiplyAlpha); + #[doc = "Get the `resizeHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + #[wasm_bindgen(method, getter = "resizeHeight")] + pub fn get_resize_height(this: &ImageBitmapOptions) -> Option; + #[doc = "Change the `resizeHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] #[wasm_bindgen(method, setter = "resizeHeight")] - fn resize_height_shim(this: &ImageBitmapOptions, val: u32); + pub fn set_resize_height(this: &ImageBitmapOptions, val: u32); + #[cfg(feature = "ResizeQuality")] + #[doc = "Get the `resizeQuality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] + #[wasm_bindgen(method, getter = "resizeQuality")] + pub fn get_resize_quality(this: &ImageBitmapOptions) -> Option; #[cfg(feature = "ResizeQuality")] + #[doc = "Change the `resizeQuality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] #[wasm_bindgen(method, setter = "resizeQuality")] - fn resize_quality_shim(this: &ImageBitmapOptions, val: ResizeQuality); + pub fn set_resize_quality(this: &ImageBitmapOptions, val: ResizeQuality); + #[doc = "Get the `resizeWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + #[wasm_bindgen(method, getter = "resizeWidth")] + pub fn get_resize_width(this: &ImageBitmapOptions) -> Option; + #[doc = "Change the `resizeWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] #[wasm_bindgen(method, setter = "resizeWidth")] - fn resize_width_shim(this: &ImageBitmapOptions, val: u32); + pub fn set_resize_width(this: &ImageBitmapOptions, val: u32); } impl ImageBitmapOptions { #[doc = "Construct a new `ImageBitmapOptions`."] @@ -37,49 +89,37 @@ impl ImageBitmapOptions { ret } #[cfg(feature = "ColorSpaceConversion")] - #[doc = "Change the `colorSpaceConversion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] + #[deprecated = "Use `set_color_space_conversion()` instead."] pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { - self.color_space_conversion_shim(val); + self.set_color_space_conversion(val); self } #[cfg(feature = "ImageOrientation")] - #[doc = "Change the `imageOrientation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] + #[deprecated = "Use `set_image_orientation()` instead."] pub fn image_orientation(&mut self, val: ImageOrientation) -> &mut Self { - self.image_orientation_shim(val); + self.set_image_orientation(val); self } #[cfg(feature = "PremultiplyAlpha")] - #[doc = "Change the `premultiplyAlpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] + #[deprecated = "Use `set_premultiply_alpha()` instead."] pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { - self.premultiply_alpha_shim(val); + self.set_premultiply_alpha(val); self } - #[doc = "Change the `resizeHeight` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + #[deprecated = "Use `set_resize_height()` instead."] pub fn resize_height(&mut self, val: u32) -> &mut Self { - self.resize_height_shim(val); + self.set_resize_height(val); self } #[cfg(feature = "ResizeQuality")] - #[doc = "Change the `resizeQuality` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] + #[deprecated = "Use `set_resize_quality()` instead."] pub fn resize_quality(&mut self, val: ResizeQuality) -> &mut Self { - self.resize_quality_shim(val); + self.set_resize_quality(val); self } - #[doc = "Change the `resizeWidth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + #[deprecated = "Use `set_resize_width()` instead."] pub fn resize_width(&mut self, val: u32) -> &mut Self { - self.resize_width_shim(val); + self.set_resize_width(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs b/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs index 093b78e3c67..9edf1b2a999 100644 --- a/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_ImageCaptureErrorEventInit.rs @@ -10,15 +10,51 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] pub type ImageCaptureErrorEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ImageCaptureErrorEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ImageCaptureErrorEventInit, val: bool); + pub fn set_bubbles(this: &ImageCaptureErrorEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ImageCaptureErrorEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ImageCaptureErrorEventInit, val: bool); + pub fn set_cancelable(this: &ImageCaptureErrorEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ImageCaptureErrorEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ImageCaptureErrorEventInit, val: bool); + pub fn set_composed(this: &ImageCaptureErrorEventInit, val: bool); #[cfg(feature = "ImageCaptureError")] + #[doc = "Get the `imageCaptureError` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureError`, `ImageCaptureErrorEventInit`*"] + #[wasm_bindgen(method, getter = "imageCaptureError")] + pub fn get_image_capture_error(this: &ImageCaptureErrorEventInit) -> Option; + #[cfg(feature = "ImageCaptureError")] + #[doc = "Change the `imageCaptureError` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageCaptureError`, `ImageCaptureErrorEventInit`*"] #[wasm_bindgen(method, setter = "imageCaptureError")] - fn image_capture_error_shim(this: &ImageCaptureErrorEventInit, val: Option<&ImageCaptureError>); + pub fn set_image_capture_error( + this: &ImageCaptureErrorEventInit, + val: Option<&ImageCaptureError>, + ); } impl ImageCaptureErrorEventInit { #[doc = "Construct a new `ImageCaptureErrorEventInit`."] @@ -29,33 +65,25 @@ impl ImageCaptureErrorEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageCaptureErrorEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "ImageCaptureError")] - #[doc = "Change the `imageCaptureError` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageCaptureError`, `ImageCaptureErrorEventInit`*"] + #[deprecated = "Use `set_image_capture_error()` instead."] pub fn image_capture_error(&mut self, val: Option<&ImageCaptureError>) -> &mut Self { - self.image_capture_error_shim(val); + self.set_image_capture_error(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecodeOptions.rs b/crates/web-sys/src/features/gen_ImageDecodeOptions.rs index 35fae56cd7b..3b4893ec923 100644 --- a/crates/web-sys/src/features/gen_ImageDecodeOptions.rs +++ b/crates/web-sys/src/features/gen_ImageDecodeOptions.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecodeOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `completeFramesOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "completeFramesOnly")] + pub fn get_complete_frames_only(this: &ImageDecodeOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `completeFramesOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "completeFramesOnly")] - fn complete_frames_only_shim(this: &ImageDecodeOptions, val: bool); + pub fn set_complete_frames_only(this: &ImageDecodeOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `frameIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frameIndex")] + pub fn get_frame_index(this: &ImageDecodeOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `frameIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "frameIndex")] - fn frame_index_shim(this: &ImageDecodeOptions, val: u32); + pub fn set_frame_index(this: &ImageDecodeOptions, val: u32); } #[cfg(web_sys_unstable_apis)] impl ImageDecodeOptions { @@ -33,25 +65,15 @@ impl ImageDecodeOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `completeFramesOnly` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_complete_frames_only()` instead."] pub fn complete_frames_only(&mut self, val: bool) -> &mut Self { - self.complete_frames_only_shim(val); + self.set_complete_frames_only(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `frameIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageDecodeOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_frame_index()` instead."] pub fn frame_index(&mut self, val: u32) -> &mut Self { - self.frame_index_shim(val); + self.set_frame_index(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecodeResult.rs b/crates/web-sys/src/features/gen_ImageDecodeResult.rs index 056f4f15364..8810025886c 100644 --- a/crates/web-sys/src/features/gen_ImageDecodeResult.rs +++ b/crates/web-sys/src/features/gen_ImageDecodeResult.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecodeResult; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `complete` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "complete")] + pub fn get_complete(this: &ImageDecodeResult) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `complete` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "complete")] - fn complete_shim(this: &ImageDecodeResult, val: bool); + pub fn set_complete(this: &ImageDecodeResult, val: bool); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrame")] + #[doc = "Get the `image` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "image")] + pub fn get_image(this: &ImageDecodeResult) -> VideoFrame; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrame")] + #[doc = "Change the `image` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`, `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "image")] - fn image_shim(this: &ImageDecodeResult, val: &VideoFrame); + pub fn set_image(this: &ImageDecodeResult, val: &VideoFrame); } #[cfg(web_sys_unstable_apis)] impl ImageDecodeResult { @@ -37,26 +70,16 @@ impl ImageDecodeResult { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `complete` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_complete()` instead."] pub fn complete(&mut self, val: bool) -> &mut Self { - self.complete_shim(val); + self.set_complete(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrame")] - #[doc = "Change the `image` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageDecodeResult`, `VideoFrame`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_image()` instead."] pub fn image(&mut self, val: &VideoFrame) -> &mut Self { - self.image_shim(val); + self.set_image(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index 416e83d64a3..af6e189d3a0 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -14,38 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ImageDecoderInit; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ColorSpaceConversion")] - #[wasm_bindgen(method, setter = "colorSpaceConversion")] - fn color_space_conversion_shim(this: &ImageDecoderInit, val: ColorSpaceConversion); - #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &ImageDecoderInit, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "desiredHeight")] - fn desired_height_shim(this: &ImageDecoderInit, val: u32); - #[wasm_bindgen(method, setter = "desiredWidth")] - fn desired_width_shim(this: &ImageDecoderInit, val: u32); - #[wasm_bindgen(method, setter = "preferAnimation")] - fn prefer_animation_shim(this: &ImageDecoderInit, val: bool); - #[cfg(feature = "PremultiplyAlpha")] - #[wasm_bindgen(method, setter = "premultiplyAlpha")] - fn premultiply_alpha_shim(this: &ImageDecoderInit, val: PremultiplyAlpha); - #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &ImageDecoderInit, val: &str); -} -#[cfg(web_sys_unstable_apis)] -impl ImageDecoderInit { - #[doc = "Construct a new `ImageDecoderInit`."] + #[doc = "Get the `colorSpaceConversion` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageDecoderInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(data: &::wasm_bindgen::JsValue, type_: &str) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.type_(type_); - ret - } + #[wasm_bindgen(method, getter = "colorSpaceConversion")] + pub fn get_color_space_conversion(this: &ImageDecoderInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ColorSpaceConversion")] #[doc = "Change the `colorSpaceConversion` field of this object."] @@ -54,10 +32,17 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { - self.color_space_conversion_shim(val); - self - } + #[wasm_bindgen(method, setter = "colorSpaceConversion")] + pub fn set_color_space_conversion(this: &ImageDecoderInit, val: ColorSpaceConversion); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &ImageDecoderInit) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `data` field of this object."] #[doc = ""] @@ -65,10 +50,17 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); - self - } + #[wasm_bindgen(method, setter = "data")] + pub fn set_data(this: &ImageDecoderInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `desiredHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "desiredHeight")] + pub fn get_desired_height(this: &ImageDecoderInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `desiredHeight` field of this object."] #[doc = ""] @@ -76,10 +68,17 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn desired_height(&mut self, val: u32) -> &mut Self { - self.desired_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "desiredHeight")] + pub fn set_desired_height(this: &ImageDecoderInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `desiredWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "desiredWidth")] + pub fn get_desired_width(this: &ImageDecoderInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `desiredWidth` field of this object."] #[doc = ""] @@ -87,10 +86,17 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn desired_width(&mut self, val: u32) -> &mut Self { - self.desired_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "desiredWidth")] + pub fn set_desired_width(this: &ImageDecoderInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `preferAnimation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "preferAnimation")] + pub fn get_prefer_animation(this: &ImageDecoderInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `preferAnimation` field of this object."] #[doc = ""] @@ -98,10 +104,18 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn prefer_animation(&mut self, val: bool) -> &mut Self { - self.prefer_animation_shim(val); - self - } + #[wasm_bindgen(method, setter = "preferAnimation")] + pub fn set_prefer_animation(this: &ImageDecoderInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Get the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `PremultiplyAlpha`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "premultiplyAlpha")] + pub fn get_premultiply_alpha(this: &ImageDecoderInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PremultiplyAlpha")] #[doc = "Change the `premultiplyAlpha` field of this object."] @@ -110,10 +124,17 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { - self.premultiply_alpha_shim(val); - self - } + #[wasm_bindgen(method, setter = "premultiplyAlpha")] + pub fn set_premultiply_alpha(this: &ImageDecoderInit, val: PremultiplyAlpha); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &ImageDecoderInit) -> String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] @@ -121,8 +142,66 @@ impl ImageDecoderInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "type")] + pub fn set_type(this: &ImageDecoderInit, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl ImageDecoderInit { + #[doc = "Construct a new `ImageDecoderInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(data: &::wasm_bindgen::JsValue, type_: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.data(data); + ret.type_(type_); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ColorSpaceConversion")] + #[deprecated = "Use `set_color_space_conversion()` instead."] + pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { + self.set_color_space_conversion(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_data()` instead."] + pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_desired_height()` instead."] + pub fn desired_height(&mut self, val: u32) -> &mut Self { + self.set_desired_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_desired_width()` instead."] + pub fn desired_width(&mut self, val: u32) -> &mut Self { + self.set_desired_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_prefer_animation()` instead."] + pub fn prefer_animation(&mut self, val: bool) -> &mut Self { + self.set_prefer_animation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PremultiplyAlpha")] + #[deprecated = "Use `set_premultiply_alpha()` instead."] + pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { + self.set_premultiply_alpha(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs index da0a6b82565..acc724aa9b9 100644 --- a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs +++ b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] pub type ImageEncodeOptions; + #[doc = "Get the `quality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] + #[wasm_bindgen(method, getter = "quality")] + pub fn get_quality(this: &ImageEncodeOptions) -> Option; + #[doc = "Change the `quality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] #[wasm_bindgen(method, setter = "quality")] - fn quality_shim(this: &ImageEncodeOptions, val: f64); + pub fn set_quality(this: &ImageEncodeOptions, val: f64); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &ImageEncodeOptions) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &ImageEncodeOptions, val: &str); + pub fn set_type(this: &ImageEncodeOptions, val: &str); } impl ImageEncodeOptions { #[doc = "Construct a new `ImageEncodeOptions`."] @@ -24,18 +40,14 @@ impl ImageEncodeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `quality` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] + #[deprecated = "Use `set_quality()` instead."] pub fn quality(&mut self, val: f64) -> &mut Self { - self.quality_shim(val); + self.set_quality(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_InputEventInit.rs b/crates/web-sys/src/features/gen_InputEventInit.rs index 2b79bf4c57a..0c0423a1461 100644 --- a/crates/web-sys/src/features/gen_InputEventInit.rs +++ b/crates/web-sys/src/features/gen_InputEventInit.rs @@ -10,28 +10,110 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] pub type InputEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &InputEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &InputEventInit, val: bool); + pub fn set_bubbles(this: &InputEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &InputEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &InputEventInit, val: bool); + pub fn set_cancelable(this: &InputEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &InputEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &InputEventInit, val: bool); + pub fn set_composed(this: &InputEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &InputEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &InputEventInit, val: i32); + pub fn set_detail(this: &InputEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &InputEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &InputEventInit, val: Option<&Window>); + pub fn set_view(this: &InputEventInit, val: Option<&Window>); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &InputEventInit) -> Option; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &InputEventInit, val: Option<&str>); + pub fn set_data(this: &InputEventInit, val: Option<&str>); #[cfg(feature = "DataTransfer")] + #[doc = "Get the `dataTransfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `InputEventInit`*"] + #[wasm_bindgen(method, getter = "dataTransfer")] + pub fn get_data_transfer(this: &InputEventInit) -> Option; + #[cfg(feature = "DataTransfer")] + #[doc = "Change the `dataTransfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `InputEventInit`*"] #[wasm_bindgen(method, setter = "dataTransfer")] - fn data_transfer_shim(this: &InputEventInit, val: Option<&DataTransfer>); + pub fn set_data_transfer(this: &InputEventInit, val: Option<&DataTransfer>); + #[doc = "Get the `inputType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "inputType")] + pub fn get_input_type(this: &InputEventInit) -> Option; + #[doc = "Change the `inputType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "inputType")] - fn input_type_shim(this: &InputEventInit, val: &str); + pub fn set_input_type(this: &InputEventInit, val: &str); + #[doc = "Get the `isComposing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "isComposing")] + pub fn get_is_composing(this: &InputEventInit) -> Option; + #[doc = "Change the `isComposing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "isComposing")] - fn is_composing_shim(this: &InputEventInit, val: bool); + pub fn set_is_composing(this: &InputEventInit, val: bool); + #[doc = "Get the `targetRanges` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[wasm_bindgen(method, getter = "targetRanges")] + pub fn get_target_ranges(this: &InputEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `targetRanges` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, setter = "targetRanges")] - fn target_ranges_shim(this: &InputEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_target_ranges(this: &InputEventInit, val: &::wasm_bindgen::JsValue); } impl InputEventInit { #[doc = "Construct a new `InputEventInit`."] @@ -42,76 +124,56 @@ impl InputEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: Option<&str>) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } #[cfg(feature = "DataTransfer")] - #[doc = "Change the `dataTransfer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DataTransfer`, `InputEventInit`*"] + #[deprecated = "Use `set_data_transfer()` instead."] pub fn data_transfer(&mut self, val: Option<&DataTransfer>) -> &mut Self { - self.data_transfer_shim(val); + self.set_data_transfer(val); self } - #[doc = "Change the `inputType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_input_type()` instead."] pub fn input_type(&mut self, val: &str) -> &mut Self { - self.input_type_shim(val); + self.set_input_type(val); self } - #[doc = "Change the `isComposing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_is_composing()` instead."] pub fn is_composing(&mut self, val: bool) -> &mut Self { - self.is_composing_shim(val); + self.set_is_composing(val); self } - #[doc = "Change the `targetRanges` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] + #[deprecated = "Use `set_target_ranges()` instead."] pub fn target_ranges(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.target_ranges_shim(val); + self.set_target_ranges(val); self } } diff --git a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs index caa9de343c9..e9588ef123a 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs @@ -11,19 +11,63 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] pub type IntersectionObserverEntryInit; #[cfg(feature = "DomRectInit")] + #[doc = "Get the `boundingClientRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[wasm_bindgen(method, getter = "boundingClientRect")] + pub fn get_bounding_client_rect(this: &IntersectionObserverEntryInit) -> DomRectInit; + #[cfg(feature = "DomRectInit")] + #[doc = "Change the `boundingClientRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] #[wasm_bindgen(method, setter = "boundingClientRect")] - fn bounding_client_rect_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + pub fn set_bounding_client_rect(this: &IntersectionObserverEntryInit, val: &DomRectInit); #[cfg(feature = "DomRectInit")] + #[doc = "Get the `intersectionRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[wasm_bindgen(method, getter = "intersectionRect")] + pub fn get_intersection_rect(this: &IntersectionObserverEntryInit) -> DomRectInit; + #[cfg(feature = "DomRectInit")] + #[doc = "Change the `intersectionRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] #[wasm_bindgen(method, setter = "intersectionRect")] - fn intersection_rect_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + pub fn set_intersection_rect(this: &IntersectionObserverEntryInit, val: &DomRectInit); + #[cfg(feature = "DomRectInit")] + #[doc = "Get the `rootBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[wasm_bindgen(method, getter = "rootBounds")] + pub fn get_root_bounds(this: &IntersectionObserverEntryInit) -> DomRectInit; #[cfg(feature = "DomRectInit")] + #[doc = "Change the `rootBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] #[wasm_bindgen(method, setter = "rootBounds")] - fn root_bounds_shim(this: &IntersectionObserverEntryInit, val: &DomRectInit); + pub fn set_root_bounds(this: &IntersectionObserverEntryInit, val: &DomRectInit); #[cfg(feature = "Element")] + #[doc = "Get the `target` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverEntryInit`*"] + #[wasm_bindgen(method, getter = "target")] + pub fn get_target(this: &IntersectionObserverEntryInit) -> Element; + #[cfg(feature = "Element")] + #[doc = "Change the `target` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverEntryInit`*"] #[wasm_bindgen(method, setter = "target")] - fn target_shim(this: &IntersectionObserverEntryInit, val: &Element); + pub fn set_target(this: &IntersectionObserverEntryInit, val: &Element); + #[doc = "Get the `time` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] + #[wasm_bindgen(method, getter = "time")] + pub fn get_time(this: &IntersectionObserverEntryInit) -> f64; + #[doc = "Change the `time` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] #[wasm_bindgen(method, setter = "time")] - fn time_shim(this: &IntersectionObserverEntryInit, val: f64); + pub fn set_time(this: &IntersectionObserverEntryInit, val: f64); } impl IntersectionObserverEntryInit { #[cfg(all(feature = "DomRectInit", feature = "Element",))] @@ -47,42 +91,32 @@ impl IntersectionObserverEntryInit { ret } #[cfg(feature = "DomRectInit")] - #[doc = "Change the `boundingClientRect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[deprecated = "Use `set_bounding_client_rect()` instead."] pub fn bounding_client_rect(&mut self, val: &DomRectInit) -> &mut Self { - self.bounding_client_rect_shim(val); + self.set_bounding_client_rect(val); self } #[cfg(feature = "DomRectInit")] - #[doc = "Change the `intersectionRect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[deprecated = "Use `set_intersection_rect()` instead."] pub fn intersection_rect(&mut self, val: &DomRectInit) -> &mut Self { - self.intersection_rect_shim(val); + self.set_intersection_rect(val); self } #[cfg(feature = "DomRectInit")] - #[doc = "Change the `rootBounds` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `IntersectionObserverEntryInit`*"] + #[deprecated = "Use `set_root_bounds()` instead."] pub fn root_bounds(&mut self, val: &DomRectInit) -> &mut Self { - self.root_bounds_shim(val); + self.set_root_bounds(val); self } #[cfg(feature = "Element")] - #[doc = "Change the `target` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverEntryInit`*"] + #[deprecated = "Use `set_target()` instead."] pub fn target(&mut self, val: &Element) -> &mut Self { - self.target_shim(val); + self.set_target(val); self } - #[doc = "Change the `time` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverEntryInit`*"] + #[deprecated = "Use `set_time()` instead."] pub fn time(&mut self, val: f64) -> &mut Self { - self.time_shim(val); + self.set_time(val); self } } diff --git a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs index 13c7411b698..115d8359ff6 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs @@ -11,12 +11,37 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] pub type IntersectionObserverInit; #[cfg(feature = "Element")] + #[doc = "Get the `root` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"] + #[wasm_bindgen(method, getter = "root")] + pub fn get_root(this: &IntersectionObserverInit) -> Option; + #[cfg(feature = "Element")] + #[doc = "Change the `root` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"] #[wasm_bindgen(method, setter = "root")] - fn root_shim(this: &IntersectionObserverInit, val: Option<&Element>); + pub fn set_root(this: &IntersectionObserverInit, val: Option<&Element>); + #[doc = "Get the `rootMargin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] + #[wasm_bindgen(method, getter = "rootMargin")] + pub fn get_root_margin(this: &IntersectionObserverInit) -> Option; + #[doc = "Change the `rootMargin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] #[wasm_bindgen(method, setter = "rootMargin")] - fn root_margin_shim(this: &IntersectionObserverInit, val: &str); + pub fn set_root_margin(this: &IntersectionObserverInit, val: &str); + #[doc = "Get the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] + #[wasm_bindgen(method, getter = "threshold")] + pub fn get_threshold(this: &IntersectionObserverInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] #[wasm_bindgen(method, setter = "threshold")] - fn threshold_shim(this: &IntersectionObserverInit, val: &::wasm_bindgen::JsValue); + pub fn set_threshold(this: &IntersectionObserverInit, val: &::wasm_bindgen::JsValue); } impl IntersectionObserverInit { #[doc = "Construct a new `IntersectionObserverInit`."] @@ -28,25 +53,19 @@ impl IntersectionObserverInit { ret } #[cfg(feature = "Element")] - #[doc = "Change the `root` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Element`, `IntersectionObserverInit`*"] + #[deprecated = "Use `set_root()` instead."] pub fn root(&mut self, val: Option<&Element>) -> &mut Self { - self.root_shim(val); + self.set_root(val); self } - #[doc = "Change the `rootMargin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] + #[deprecated = "Use `set_root_margin()` instead."] pub fn root_margin(&mut self, val: &str) -> &mut Self { - self.root_margin_shim(val); + self.set_root_margin(val); self } - #[doc = "Change the `threshold` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] + #[deprecated = "Use `set_threshold()` instead."] pub fn threshold(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.threshold_shim(val); + self.set_threshold(val); self } } diff --git a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs index 2aba174f2da..b627894cb70 100644 --- a/crates/web-sys/src/features/gen_IsInputPendingOptions.rs +++ b/crates/web-sys/src/features/gen_IsInputPendingOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type IsInputPendingOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `includeContinuous` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "includeContinuous")] + pub fn get_include_continuous(this: &IsInputPendingOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `includeContinuous` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "includeContinuous")] - fn include_continuous_shim(this: &IsInputPendingOptions, val: bool); + pub fn set_include_continuous(this: &IsInputPendingOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl IsInputPendingOptions { @@ -31,14 +47,9 @@ impl IsInputPendingOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `includeContinuous` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IsInputPendingOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_include_continuous()` instead."] pub fn include_continuous(&mut self, val: bool) -> &mut Self { - self.include_continuous_shim(val); + self.set_include_continuous(val); self } } diff --git a/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs b/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs index 85b0c3497f9..d6c2c0b81fc 100644 --- a/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs +++ b/crates/web-sys/src/features/gen_IterableKeyAndValueResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] pub type IterableKeyAndValueResult; + #[doc = "Get the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] + #[wasm_bindgen(method, getter = "done")] + pub fn get_done(this: &IterableKeyAndValueResult) -> Option; + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] #[wasm_bindgen(method, setter = "done")] - fn done_shim(this: &IterableKeyAndValueResult, val: bool); + pub fn set_done(this: &IterableKeyAndValueResult, val: bool); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &IterableKeyAndValueResult) -> Option<::js_sys::Array>; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &IterableKeyAndValueResult, val: &::wasm_bindgen::JsValue); + pub fn set_value(this: &IterableKeyAndValueResult, val: &::wasm_bindgen::JsValue); } impl IterableKeyAndValueResult { #[doc = "Construct a new `IterableKeyAndValueResult`."] @@ -24,18 +40,14 @@ impl IterableKeyAndValueResult { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] + #[deprecated = "Use `set_done()` instead."] pub fn done(&mut self, val: bool) -> &mut Self { - self.done_shim(val); + self.set_done(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IterableKeyAndValueResult`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs b/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs index 7e76fde4bea..366d7aaae76 100644 --- a/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs +++ b/crates/web-sys/src/features/gen_IterableKeyOrValueResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] pub type IterableKeyOrValueResult; + #[doc = "Get the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] + #[wasm_bindgen(method, getter = "done")] + pub fn get_done(this: &IterableKeyOrValueResult) -> Option; + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] #[wasm_bindgen(method, setter = "done")] - fn done_shim(this: &IterableKeyOrValueResult, val: bool); + pub fn set_done(this: &IterableKeyOrValueResult, val: bool); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &IterableKeyOrValueResult) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &IterableKeyOrValueResult, val: &::wasm_bindgen::JsValue); + pub fn set_value(this: &IterableKeyOrValueResult, val: &::wasm_bindgen::JsValue); } impl IterableKeyOrValueResult { #[doc = "Construct a new `IterableKeyOrValueResult`."] @@ -24,18 +40,14 @@ impl IterableKeyOrValueResult { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] + #[deprecated = "Use `set_done()` instead."] pub fn done(&mut self, val: bool) -> &mut Self { - self.done_shim(val); + self.set_done(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IterableKeyOrValueResult`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_JsonWebKey.rs b/crates/web-sys/src/features/gen_JsonWebKey.rs index 04e6cfb11a0..7969e461a34 100644 --- a/crates/web-sys/src/features/gen_JsonWebKey.rs +++ b/crates/web-sys/src/features/gen_JsonWebKey.rs @@ -10,42 +10,186 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] pub type JsonWebKey; + #[doc = "Get the `alg` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "alg")] + pub fn get_alg(this: &JsonWebKey) -> Option; + #[doc = "Change the `alg` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "alg")] - fn alg_shim(this: &JsonWebKey, val: &str); + pub fn set_alg(this: &JsonWebKey, val: &str); + #[doc = "Get the `crv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "crv")] + pub fn get_crv(this: &JsonWebKey) -> Option; + #[doc = "Change the `crv` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "crv")] - fn crv_shim(this: &JsonWebKey, val: &str); + pub fn set_crv(this: &JsonWebKey, val: &str); + #[doc = "Get the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "d")] + pub fn get_d(this: &JsonWebKey) -> Option; + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "d")] - fn d_shim(this: &JsonWebKey, val: &str); + pub fn set_d(this: &JsonWebKey, val: &str); + #[doc = "Get the `dp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "dp")] + pub fn get_dp(this: &JsonWebKey) -> Option; + #[doc = "Change the `dp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "dp")] - fn dp_shim(this: &JsonWebKey, val: &str); + pub fn set_dp(this: &JsonWebKey, val: &str); + #[doc = "Get the `dq` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "dq")] + pub fn get_dq(this: &JsonWebKey) -> Option; + #[doc = "Change the `dq` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "dq")] - fn dq_shim(this: &JsonWebKey, val: &str); + pub fn set_dq(this: &JsonWebKey, val: &str); + #[doc = "Get the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "e")] + pub fn get_e(this: &JsonWebKey) -> Option; + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "e")] - fn e_shim(this: &JsonWebKey, val: &str); + pub fn set_e(this: &JsonWebKey, val: &str); + #[doc = "Get the `ext` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "ext")] + pub fn get_ext(this: &JsonWebKey) -> Option; + #[doc = "Change the `ext` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "ext")] - fn ext_shim(this: &JsonWebKey, val: bool); + pub fn set_ext(this: &JsonWebKey, val: bool); + #[doc = "Get the `k` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "k")] + pub fn get_k(this: &JsonWebKey) -> Option; + #[doc = "Change the `k` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "k")] - fn k_shim(this: &JsonWebKey, val: &str); + pub fn set_k(this: &JsonWebKey, val: &str); + #[doc = "Get the `key_ops` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "key_ops")] + pub fn get_key_ops(this: &JsonWebKey) -> Option<::js_sys::Array>; + #[doc = "Change the `key_ops` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "key_ops")] - fn key_ops_shim(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + pub fn set_key_ops(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `kty` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "kty")] + pub fn get_kty(this: &JsonWebKey) -> String; + #[doc = "Change the `kty` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "kty")] - fn kty_shim(this: &JsonWebKey, val: &str); + pub fn set_kty(this: &JsonWebKey, val: &str); + #[doc = "Get the `n` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "n")] + pub fn get_n(this: &JsonWebKey) -> Option; + #[doc = "Change the `n` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "n")] - fn n_shim(this: &JsonWebKey, val: &str); + pub fn set_n(this: &JsonWebKey, val: &str); + #[doc = "Get the `oth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "oth")] + pub fn get_oth(this: &JsonWebKey) -> Option<::js_sys::Array>; + #[doc = "Change the `oth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "oth")] - fn oth_shim(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + pub fn set_oth(this: &JsonWebKey, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `p` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "p")] + pub fn get_p(this: &JsonWebKey) -> Option; + #[doc = "Change the `p` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "p")] - fn p_shim(this: &JsonWebKey, val: &str); + pub fn set_p(this: &JsonWebKey, val: &str); + #[doc = "Get the `q` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "q")] + pub fn get_q(this: &JsonWebKey) -> Option; + #[doc = "Change the `q` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "q")] - fn q_shim(this: &JsonWebKey, val: &str); + pub fn set_q(this: &JsonWebKey, val: &str); + #[doc = "Get the `qi` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "qi")] + pub fn get_qi(this: &JsonWebKey) -> Option; + #[doc = "Change the `qi` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "qi")] - fn qi_shim(this: &JsonWebKey, val: &str); + pub fn set_qi(this: &JsonWebKey, val: &str); + #[doc = "Get the `use` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "use")] + pub fn get_use(this: &JsonWebKey) -> Option; + #[doc = "Change the `use` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "use")] - fn use__shim(this: &JsonWebKey, val: &str); + pub fn set_use(this: &JsonWebKey, val: &str); + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &JsonWebKey) -> Option; + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &JsonWebKey, val: &str); + pub fn set_x(this: &JsonWebKey, val: &str); + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &JsonWebKey) -> Option; + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &JsonWebKey, val: &str); + pub fn set_y(this: &JsonWebKey, val: &str); } impl JsonWebKey { #[doc = "Construct a new `JsonWebKey`."] @@ -57,130 +201,94 @@ impl JsonWebKey { ret.kty(kty); ret } - #[doc = "Change the `alg` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_alg()` instead."] pub fn alg(&mut self, val: &str) -> &mut Self { - self.alg_shim(val); + self.set_alg(val); self } - #[doc = "Change the `crv` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_crv()` instead."] pub fn crv(&mut self, val: &str) -> &mut Self { - self.crv_shim(val); + self.set_crv(val); self } - #[doc = "Change the `d` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_d()` instead."] pub fn d(&mut self, val: &str) -> &mut Self { - self.d_shim(val); + self.set_d(val); self } - #[doc = "Change the `dp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_dp()` instead."] pub fn dp(&mut self, val: &str) -> &mut Self { - self.dp_shim(val); + self.set_dp(val); self } - #[doc = "Change the `dq` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_dq()` instead."] pub fn dq(&mut self, val: &str) -> &mut Self { - self.dq_shim(val); + self.set_dq(val); self } - #[doc = "Change the `e` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_e()` instead."] pub fn e(&mut self, val: &str) -> &mut Self { - self.e_shim(val); + self.set_e(val); self } - #[doc = "Change the `ext` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_ext()` instead."] pub fn ext(&mut self, val: bool) -> &mut Self { - self.ext_shim(val); + self.set_ext(val); self } - #[doc = "Change the `k` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_k()` instead."] pub fn k(&mut self, val: &str) -> &mut Self { - self.k_shim(val); + self.set_k(val); self } - #[doc = "Change the `key_ops` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_key_ops()` instead."] pub fn key_ops(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.key_ops_shim(val); + self.set_key_ops(val); self } - #[doc = "Change the `kty` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_kty()` instead."] pub fn kty(&mut self, val: &str) -> &mut Self { - self.kty_shim(val); + self.set_kty(val); self } - #[doc = "Change the `n` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_n()` instead."] pub fn n(&mut self, val: &str) -> &mut Self { - self.n_shim(val); + self.set_n(val); self } - #[doc = "Change the `oth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_oth()` instead."] pub fn oth(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.oth_shim(val); + self.set_oth(val); self } - #[doc = "Change the `p` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_p()` instead."] pub fn p(&mut self, val: &str) -> &mut Self { - self.p_shim(val); + self.set_p(val); self } - #[doc = "Change the `q` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_q()` instead."] pub fn q(&mut self, val: &str) -> &mut Self { - self.q_shim(val); + self.set_q(val); self } - #[doc = "Change the `qi` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_qi()` instead."] pub fn qi(&mut self, val: &str) -> &mut Self { - self.qi_shim(val); + self.set_qi(val); self } - #[doc = "Change the `use` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_use()` instead."] pub fn use_(&mut self, val: &str) -> &mut Self { - self.use__shim(val); + self.set_use(val); self } - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: &str) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: &str) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyAlgorithm.rs b/crates/web-sys/src/features/gen_KeyAlgorithm.rs index 101595bb222..d7523f2da73 100644 --- a/crates/web-sys/src/features/gen_KeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_KeyAlgorithm.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] pub type KeyAlgorithm; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &KeyAlgorithm) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &KeyAlgorithm, val: &str); + pub fn set_name(this: &KeyAlgorithm, val: &str); } impl KeyAlgorithm { #[doc = "Construct a new `KeyAlgorithm`."] @@ -23,11 +31,9 @@ impl KeyAlgorithm { ret.name(name); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyIdsInitData.rs b/crates/web-sys/src/features/gen_KeyIdsInitData.rs index 1f4d7767a4a..c05623d59d3 100644 --- a/crates/web-sys/src/features/gen_KeyIdsInitData.rs +++ b/crates/web-sys/src/features/gen_KeyIdsInitData.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] pub type KeyIdsInitData; + #[doc = "Get the `kids` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] + #[wasm_bindgen(method, getter = "kids")] + pub fn get_kids(this: &KeyIdsInitData) -> ::js_sys::Array; + #[doc = "Change the `kids` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] #[wasm_bindgen(method, setter = "kids")] - fn kids_shim(this: &KeyIdsInitData, val: &::wasm_bindgen::JsValue); + pub fn set_kids(this: &KeyIdsInitData, val: &::wasm_bindgen::JsValue); } impl KeyIdsInitData { #[doc = "Construct a new `KeyIdsInitData`."] @@ -23,11 +31,9 @@ impl KeyIdsInitData { ret.kids(kids); ret } - #[doc = "Change the `kids` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyIdsInitData`*"] + #[deprecated = "Use `set_kids()` instead."] pub fn kids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.kids_shim(val); + self.set_kids(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyboardEventInit.rs b/crates/web-sys/src/features/gen_KeyboardEventInit.rs index 3d777d4d7fb..a7701695929 100644 --- a/crates/web-sys/src/features/gen_KeyboardEventInit.rs +++ b/crates/web-sys/src/features/gen_KeyboardEventInit.rs @@ -10,59 +10,268 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] pub type KeyboardEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &KeyboardEventInit, val: bool); + pub fn set_bubbles(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &KeyboardEventInit, val: bool); + pub fn set_cancelable(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &KeyboardEventInit, val: bool); + pub fn set_composed(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &KeyboardEventInit, val: i32); + pub fn set_detail(this: &KeyboardEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &KeyboardEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &KeyboardEventInit, val: Option<&Window>); + pub fn set_view(this: &KeyboardEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &KeyboardEventInit, val: bool); + pub fn set_alt_key(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &KeyboardEventInit, val: bool); + pub fn set_ctrl_key(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &KeyboardEventInit, val: bool); + pub fn set_meta_key(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_fn(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_num_lock(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_os(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_symbol(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &KeyboardEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &KeyboardEventInit, val: bool); + pub fn set_shift_key(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `charCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "charCode")] + pub fn get_char_code(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `charCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "charCode")] - fn char_code_shim(this: &KeyboardEventInit, val: u32); + pub fn set_char_code(this: &KeyboardEventInit, val: u32); + #[doc = "Get the `code` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "code")] + pub fn get_code(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `code` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "code")] - fn code_shim(this: &KeyboardEventInit, val: &str); + pub fn set_code(this: &KeyboardEventInit, val: &str); + #[doc = "Get the `isComposing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "isComposing")] + pub fn get_is_composing(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `isComposing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "isComposing")] - fn is_composing_shim(this: &KeyboardEventInit, val: bool); + pub fn set_is_composing(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "key")] + pub fn get_key(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "key")] - fn key_shim(this: &KeyboardEventInit, val: &str); + pub fn set_key(this: &KeyboardEventInit, val: &str); + #[doc = "Get the `keyCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "keyCode")] + pub fn get_key_code(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `keyCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "keyCode")] - fn key_code_shim(this: &KeyboardEventInit, val: u32); + pub fn set_key_code(this: &KeyboardEventInit, val: u32); + #[doc = "Get the `location` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "location")] + pub fn get_location(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `location` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "location")] - fn location_shim(this: &KeyboardEventInit, val: u32); + pub fn set_location(this: &KeyboardEventInit, val: u32); + #[doc = "Get the `repeat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "repeat")] + pub fn get_repeat(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `repeat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "repeat")] - fn repeat_shim(this: &KeyboardEventInit, val: bool); + pub fn set_repeat(this: &KeyboardEventInit, val: bool); + #[doc = "Get the `which` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[wasm_bindgen(method, getter = "which")] + pub fn get_which(this: &KeyboardEventInit) -> Option; + #[doc = "Change the `which` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, setter = "which")] - fn which_shim(this: &KeyboardEventInit, val: u32); + pub fn set_which(this: &KeyboardEventInit, val: u32); } impl KeyboardEventInit { #[doc = "Construct a new `KeyboardEventInit`."] @@ -73,187 +282,135 @@ impl KeyboardEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `charCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_char_code()` instead."] pub fn char_code(&mut self, val: u32) -> &mut Self { - self.char_code_shim(val); + self.set_char_code(val); self } - #[doc = "Change the `code` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_code()` instead."] pub fn code(&mut self, val: &str) -> &mut Self { - self.code_shim(val); + self.set_code(val); self } - #[doc = "Change the `isComposing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_is_composing()` instead."] pub fn is_composing(&mut self, val: bool) -> &mut Self { - self.is_composing_shim(val); + self.set_is_composing(val); self } - #[doc = "Change the `key` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_key()` instead."] pub fn key(&mut self, val: &str) -> &mut Self { - self.key_shim(val); + self.set_key(val); self } - #[doc = "Change the `keyCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_key_code()` instead."] pub fn key_code(&mut self, val: u32) -> &mut Self { - self.key_code_shim(val); + self.set_key_code(val); self } - #[doc = "Change the `location` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_location()` instead."] pub fn location(&mut self, val: u32) -> &mut Self { - self.location_shim(val); + self.set_location(val); self } - #[doc = "Change the `repeat` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_repeat()` instead."] pub fn repeat(&mut self, val: bool) -> &mut Self { - self.repeat_shim(val); + self.set_repeat(val); self } - #[doc = "Change the `which` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] + #[deprecated = "Use `set_which()` instead."] pub fn which(&mut self, val: u32) -> &mut Self { - self.which_shim(val); + self.set_which(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs index 7685c6af482..8777d27a77b 100644 --- a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs @@ -14,49 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type KeyframeAnimationOptions; - #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &KeyframeAnimationOptions, val: f64); - #[cfg(feature = "PlaybackDirection")] - #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &KeyframeAnimationOptions, val: PlaybackDirection); - #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &KeyframeAnimationOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &KeyframeAnimationOptions, val: &str); - #[wasm_bindgen(method, setter = "endDelay")] - fn end_delay_shim(this: &KeyframeAnimationOptions, val: f64); - #[cfg(feature = "FillMode")] - #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &KeyframeAnimationOptions, val: FillMode); - #[wasm_bindgen(method, setter = "iterationStart")] - fn iteration_start_shim(this: &KeyframeAnimationOptions, val: f64); - #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &KeyframeAnimationOptions, val: f64); - #[cfg(feature = "CompositeOperation")] - #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &KeyframeAnimationOptions, val: CompositeOperation); - #[cfg(feature = "IterationCompositeOperation")] - #[wasm_bindgen(method, setter = "iterationComposite")] - fn iteration_composite_shim(this: &KeyframeAnimationOptions, val: IterationCompositeOperation); - #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &KeyframeAnimationOptions, val: &str); - #[cfg(feature = "AnimationTimeline")] - #[wasm_bindgen(method, setter = "timeline")] - fn timeline_shim(this: &KeyframeAnimationOptions, val: Option<&AnimationTimeline>); -} -#[cfg(web_sys_unstable_apis)] -impl KeyframeAnimationOptions { - #[doc = "Construct a new `KeyframeAnimationOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `delay` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `delay` field of this object."] #[doc = ""] @@ -64,10 +30,18 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); - self - } + #[wasm_bindgen(method, setter = "delay")] + pub fn set_delay(this: &KeyframeAnimationOptions, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PlaybackDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`, `PlaybackDirection`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PlaybackDirection")] #[doc = "Change the `direction` field of this object."] @@ -76,10 +50,17 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - self.direction_shim(val); - self - } + #[wasm_bindgen(method, setter = "direction")] + pub fn set_direction(this: &KeyframeAnimationOptions, val: PlaybackDirection); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &KeyframeAnimationOptions) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `duration` field of this object."] #[doc = ""] @@ -87,10 +68,17 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.duration_shim(val); - self - } + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &KeyframeAnimationOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `easing` field of this object."] #[doc = ""] @@ -98,10 +86,17 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); - self - } + #[wasm_bindgen(method, setter = "easing")] + pub fn set_easing(this: &KeyframeAnimationOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "endDelay")] + pub fn get_end_delay(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `endDelay` field of this object."] #[doc = ""] @@ -109,10 +104,18 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn end_delay(&mut self, val: f64) -> &mut Self { - self.end_delay_shim(val); - self - } + #[wasm_bindgen(method, setter = "endDelay")] + pub fn set_end_delay(this: &KeyframeAnimationOptions, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FillMode")] + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FillMode`, `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FillMode")] #[doc = "Change the `fill` field of this object."] @@ -121,10 +124,17 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn fill(&mut self, val: FillMode) -> &mut Self { - self.fill_shim(val); - self - } + #[wasm_bindgen(method, setter = "fill")] + pub fn set_fill(this: &KeyframeAnimationOptions, val: FillMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "iterationStart")] + pub fn get_iteration_start(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `iterationStart` field of this object."] #[doc = ""] @@ -132,10 +142,17 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn iteration_start(&mut self, val: f64) -> &mut Self { - self.iteration_start_shim(val); - self - } + #[wasm_bindgen(method, setter = "iterationStart")] + pub fn set_iteration_start(this: &KeyframeAnimationOptions, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `iterations` field of this object."] #[doc = ""] @@ -143,10 +160,18 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn iterations(&mut self, val: f64) -> &mut Self { - self.iterations_shim(val); - self - } + #[wasm_bindgen(method, setter = "iterations")] + pub fn set_iterations(this: &KeyframeAnimationOptions, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CompositeOperation")] + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositeOperation`, `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "CompositeOperation")] #[doc = "Change the `composite` field of this object."] @@ -155,10 +180,20 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - self.composite_shim(val); - self - } + #[wasm_bindgen(method, setter = "composite")] + pub fn set_composite(this: &KeyframeAnimationOptions, val: CompositeOperation); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IterationCompositeOperation")] + #[doc = "Get the `iterationComposite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterationCompositeOperation`, `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "iterationComposite")] + pub fn get_iteration_composite( + this: &KeyframeAnimationOptions, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "IterationCompositeOperation")] #[doc = "Change the `iterationComposite` field of this object."] @@ -167,10 +202,20 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn iteration_composite(&mut self, val: IterationCompositeOperation) -> &mut Self { - self.iteration_composite_shim(val); - self - } + #[wasm_bindgen(method, setter = "iterationComposite")] + pub fn set_iteration_composite( + this: &KeyframeAnimationOptions, + val: IterationCompositeOperation, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -178,10 +223,18 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); - self - } + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &KeyframeAnimationOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AnimationTimeline")] + #[doc = "Get the `timeline` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnimationTimeline`, `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timeline")] + pub fn get_timeline(this: &KeyframeAnimationOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AnimationTimeline")] #[doc = "Change the `timeline` field of this object."] @@ -190,8 +243,97 @@ impl KeyframeAnimationOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timeline")] + pub fn set_timeline(this: &KeyframeAnimationOptions, val: Option<&AnimationTimeline>); +} +#[cfg(web_sys_unstable_apis)] +impl KeyframeAnimationOptions { + #[doc = "Construct a new `KeyframeAnimationOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeAnimationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_delay()` instead."] + pub fn delay(&mut self, val: f64) -> &mut Self { + self.set_delay(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PlaybackDirection")] + #[deprecated = "Use `set_direction()` instead."] + pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { + self.set_direction(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_easing()` instead."] + pub fn easing(&mut self, val: &str) -> &mut Self { + self.set_easing(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_end_delay()` instead."] + pub fn end_delay(&mut self, val: f64) -> &mut Self { + self.set_end_delay(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FillMode")] + #[deprecated = "Use `set_fill()` instead."] + pub fn fill(&mut self, val: FillMode) -> &mut Self { + self.set_fill(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_iteration_start()` instead."] + pub fn iteration_start(&mut self, val: f64) -> &mut Self { + self.set_iteration_start(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_iterations()` instead."] + pub fn iterations(&mut self, val: f64) -> &mut Self { + self.set_iterations(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CompositeOperation")] + #[deprecated = "Use `set_composite()` instead."] + pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { + self.set_composite(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IterationCompositeOperation")] + #[deprecated = "Use `set_iteration_composite()` instead."] + pub fn iteration_composite(&mut self, val: IterationCompositeOperation) -> &mut Self { + self.set_iteration_composite(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AnimationTimeline")] + #[deprecated = "Use `set_timeline()` instead."] pub fn timeline(&mut self, val: Option<&AnimationTimeline>) -> &mut Self { - self.timeline_shim(val); + self.set_timeline(val); self } } diff --git a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs index 94c35ecedd4..4424b0391e4 100644 --- a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs @@ -10,30 +10,116 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] pub type KeyframeEffectOptions; + #[doc = "Get the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &KeyframeEffectOptions) -> Option; + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &KeyframeEffectOptions, val: f64); + pub fn set_delay(this: &KeyframeEffectOptions, val: f64); #[cfg(feature = "PlaybackDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`, `PlaybackDirection`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &KeyframeEffectOptions) -> Option; + #[cfg(feature = "PlaybackDirection")] + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`, `PlaybackDirection`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &KeyframeEffectOptions, val: PlaybackDirection); + pub fn set_direction(this: &KeyframeEffectOptions, val: PlaybackDirection); + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &KeyframeEffectOptions) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &KeyframeEffectOptions, val: &::wasm_bindgen::JsValue); + pub fn set_duration(this: &KeyframeEffectOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &KeyframeEffectOptions) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &KeyframeEffectOptions, val: &str); + pub fn set_easing(this: &KeyframeEffectOptions, val: &str); + #[doc = "Get the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "endDelay")] + pub fn get_end_delay(this: &KeyframeEffectOptions) -> Option; + #[doc = "Change the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "endDelay")] - fn end_delay_shim(this: &KeyframeEffectOptions, val: f64); + pub fn set_end_delay(this: &KeyframeEffectOptions, val: f64); #[cfg(feature = "FillMode")] + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FillMode`, `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &KeyframeEffectOptions) -> Option; + #[cfg(feature = "FillMode")] + #[doc = "Change the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FillMode`, `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &KeyframeEffectOptions, val: FillMode); + pub fn set_fill(this: &KeyframeEffectOptions, val: FillMode); + #[doc = "Get the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "iterationStart")] + pub fn get_iteration_start(this: &KeyframeEffectOptions) -> Option; + #[doc = "Change the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "iterationStart")] - fn iteration_start_shim(this: &KeyframeEffectOptions, val: f64); + pub fn set_iteration_start(this: &KeyframeEffectOptions, val: f64); + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &KeyframeEffectOptions) -> Option; + #[doc = "Change the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &KeyframeEffectOptions, val: f64); + pub fn set_iterations(this: &KeyframeEffectOptions, val: f64); #[cfg(feature = "CompositeOperation")] + #[doc = "Get the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositeOperation`, `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "composite")] + pub fn get_composite(this: &KeyframeEffectOptions) -> Option; + #[cfg(feature = "CompositeOperation")] + #[doc = "Change the `composite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CompositeOperation`, `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "composite")] - fn composite_shim(this: &KeyframeEffectOptions, val: CompositeOperation); + pub fn set_composite(this: &KeyframeEffectOptions, val: CompositeOperation); #[cfg(feature = "IterationCompositeOperation")] + #[doc = "Get the `iterationComposite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterationCompositeOperation`, `KeyframeEffectOptions`*"] + #[wasm_bindgen(method, getter = "iterationComposite")] + pub fn get_iteration_composite( + this: &KeyframeEffectOptions, + ) -> Option; + #[cfg(feature = "IterationCompositeOperation")] + #[doc = "Change the `iterationComposite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IterationCompositeOperation`, `KeyframeEffectOptions`*"] #[wasm_bindgen(method, setter = "iterationComposite")] - fn iteration_composite_shim(this: &KeyframeEffectOptions, val: IterationCompositeOperation); + pub fn set_iteration_composite(this: &KeyframeEffectOptions, val: IterationCompositeOperation); } impl KeyframeEffectOptions { #[doc = "Construct a new `KeyframeEffectOptions`."] @@ -44,78 +130,58 @@ impl KeyframeEffectOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `delay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_delay()` instead."] pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); + self.set_delay(val); self } #[cfg(feature = "PlaybackDirection")] - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`, `PlaybackDirection`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `endDelay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_end_delay()` instead."] pub fn end_delay(&mut self, val: f64) -> &mut Self { - self.end_delay_shim(val); + self.set_end_delay(val); self } #[cfg(feature = "FillMode")] - #[doc = "Change the `fill` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FillMode`, `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_fill()` instead."] pub fn fill(&mut self, val: FillMode) -> &mut Self { - self.fill_shim(val); + self.set_fill(val); self } - #[doc = "Change the `iterationStart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_iteration_start()` instead."] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - self.iteration_start_shim(val); + self.set_iteration_start(val); self } - #[doc = "Change the `iterations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_iterations()` instead."] pub fn iterations(&mut self, val: f64) -> &mut Self { - self.iterations_shim(val); + self.set_iterations(val); self } #[cfg(feature = "CompositeOperation")] - #[doc = "Change the `composite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CompositeOperation`, `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_composite()` instead."] pub fn composite(&mut self, val: CompositeOperation) -> &mut Self { - self.composite_shim(val); + self.set_composite(val); self } #[cfg(feature = "IterationCompositeOperation")] - #[doc = "Change the `iterationComposite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IterationCompositeOperation`, `KeyframeEffectOptions`*"] + #[deprecated = "Use `set_iteration_composite()` instead."] pub fn iteration_composite(&mut self, val: IterationCompositeOperation) -> &mut Self { - self.iteration_composite_shim(val); + self.set_iteration_composite(val); self } } diff --git a/crates/web-sys/src/features/gen_L10nElement.rs b/crates/web-sys/src/features/gen_L10nElement.rs index 0fd76d28bc7..38942a7baef 100644 --- a/crates/web-sys/src/features/gen_L10nElement.rs +++ b/crates/web-sys/src/features/gen_L10nElement.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] pub type L10nElement; + #[doc = "Get the `l10nArgs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "l10nArgs")] + pub fn get_l10n_args(this: &L10nElement) -> Option<::js_sys::Object>; + #[doc = "Change the `l10nArgs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "l10nArgs")] - fn l10n_args_shim(this: &L10nElement, val: Option<&::js_sys::Object>); + pub fn set_l10n_args(this: &L10nElement, val: Option<&::js_sys::Object>); + #[doc = "Get the `l10nAttrs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "l10nAttrs")] + pub fn get_l10n_attrs(this: &L10nElement) -> Option; + #[doc = "Change the `l10nAttrs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "l10nAttrs")] - fn l10n_attrs_shim(this: &L10nElement, val: Option<&str>); + pub fn set_l10n_attrs(this: &L10nElement, val: Option<&str>); + #[doc = "Get the `l10nId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "l10nId")] + pub fn get_l10n_id(this: &L10nElement) -> String; + #[doc = "Change the `l10nId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "l10nId")] - fn l10n_id_shim(this: &L10nElement, val: &str); + pub fn set_l10n_id(this: &L10nElement, val: &str); + #[doc = "Get the `localName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "localName")] + pub fn get_local_name(this: &L10nElement) -> String; + #[doc = "Change the `localName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "localName")] - fn local_name_shim(this: &L10nElement, val: &str); + pub fn set_local_name(this: &L10nElement, val: &str); + #[doc = "Get the `namespaceURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "namespaceURI")] + pub fn get_namespace_uri(this: &L10nElement) -> String; + #[doc = "Change the `namespaceURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "namespaceURI")] - fn namespace_uri_shim(this: &L10nElement, val: &str); + pub fn set_namespace_uri(this: &L10nElement, val: &str); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &L10nElement) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &L10nElement, val: Option<&str>); + pub fn set_type(this: &L10nElement, val: Option<&str>); } impl L10nElement { #[doc = "Construct a new `L10nElement`."] @@ -35,46 +83,34 @@ impl L10nElement { ret.namespace_uri(namespace_uri); ret } - #[doc = "Change the `l10nArgs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_l10n_args()` instead."] pub fn l10n_args(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.l10n_args_shim(val); + self.set_l10n_args(val); self } - #[doc = "Change the `l10nAttrs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_l10n_attrs()` instead."] pub fn l10n_attrs(&mut self, val: Option<&str>) -> &mut Self { - self.l10n_attrs_shim(val); + self.set_l10n_attrs(val); self } - #[doc = "Change the `l10nId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_l10n_id()` instead."] pub fn l10n_id(&mut self, val: &str) -> &mut Self { - self.l10n_id_shim(val); + self.set_l10n_id(val); self } - #[doc = "Change the `localName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_local_name()` instead."] pub fn local_name(&mut self, val: &str) -> &mut Self { - self.local_name_shim(val); + self.set_local_name(val); self } - #[doc = "Change the `namespaceURI` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_namespace_uri()` instead."] pub fn namespace_uri(&mut self, val: &str) -> &mut Self { - self.namespace_uri_shim(val); + self.set_namespace_uri(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: Option<&str>) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_L10nValue.rs b/crates/web-sys/src/features/gen_L10nValue.rs index 0dbf073485f..9c09c9aa438 100644 --- a/crates/web-sys/src/features/gen_L10nValue.rs +++ b/crates/web-sys/src/features/gen_L10nValue.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] pub type L10nValue; + #[doc = "Get the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] + #[wasm_bindgen(method, getter = "attributes")] + pub fn get_attributes(this: &L10nValue) -> Option<::js_sys::Array>; + #[doc = "Change the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] #[wasm_bindgen(method, setter = "attributes")] - fn attributes_shim(this: &L10nValue, val: &::wasm_bindgen::JsValue); + pub fn set_attributes(this: &L10nValue, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &L10nValue) -> Option; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &L10nValue, val: Option<&str>); + pub fn set_value(this: &L10nValue, val: Option<&str>); } impl L10nValue { #[doc = "Construct a new `L10nValue`."] @@ -24,18 +40,14 @@ impl L10nValue { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `attributes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] + #[deprecated = "Use `set_attributes()` instead."] pub fn attributes(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.attributes_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_attributes(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: Option<&str>) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_LifecycleCallbacks.rs b/crates/web-sys/src/features/gen_LifecycleCallbacks.rs index 82522003c88..2628c289394 100644 --- a/crates/web-sys/src/features/gen_LifecycleCallbacks.rs +++ b/crates/web-sys/src/features/gen_LifecycleCallbacks.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] pub type LifecycleCallbacks; + #[doc = "Get the `adoptedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[wasm_bindgen(method, getter = "adoptedCallback")] + pub fn get_adopted_callback(this: &LifecycleCallbacks) -> Option<::js_sys::Function>; + #[doc = "Change the `adoptedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] #[wasm_bindgen(method, setter = "adoptedCallback")] - fn adopted_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + pub fn set_adopted_callback(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[doc = "Get the `attributeChangedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[wasm_bindgen(method, getter = "attributeChangedCallback")] + pub fn get_attribute_changed_callback(this: &LifecycleCallbacks) -> Option<::js_sys::Function>; + #[doc = "Change the `attributeChangedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] #[wasm_bindgen(method, setter = "attributeChangedCallback")] - fn attribute_changed_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + pub fn set_attribute_changed_callback(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[doc = "Get the `connectedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[wasm_bindgen(method, getter = "connectedCallback")] + pub fn get_connected_callback(this: &LifecycleCallbacks) -> Option<::js_sys::Function>; + #[doc = "Change the `connectedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] #[wasm_bindgen(method, setter = "connectedCallback")] - fn connected_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + pub fn set_connected_callback(this: &LifecycleCallbacks, val: &::js_sys::Function); + #[doc = "Get the `disconnectedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[wasm_bindgen(method, getter = "disconnectedCallback")] + pub fn get_disconnected_callback(this: &LifecycleCallbacks) -> Option<::js_sys::Function>; + #[doc = "Change the `disconnectedCallback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] #[wasm_bindgen(method, setter = "disconnectedCallback")] - fn disconnected_callback_shim(this: &LifecycleCallbacks, val: &::js_sys::Function); + pub fn set_disconnected_callback(this: &LifecycleCallbacks, val: &::js_sys::Function); } impl LifecycleCallbacks { #[doc = "Construct a new `LifecycleCallbacks`."] @@ -28,32 +60,24 @@ impl LifecycleCallbacks { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `adoptedCallback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[deprecated = "Use `set_adopted_callback()` instead."] pub fn adopted_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - self.adopted_callback_shim(val); + self.set_adopted_callback(val); self } - #[doc = "Change the `attributeChangedCallback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[deprecated = "Use `set_attribute_changed_callback()` instead."] pub fn attribute_changed_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - self.attribute_changed_callback_shim(val); + self.set_attribute_changed_callback(val); self } - #[doc = "Change the `connectedCallback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[deprecated = "Use `set_connected_callback()` instead."] pub fn connected_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - self.connected_callback_shim(val); + self.set_connected_callback(val); self } - #[doc = "Change the `disconnectedCallback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LifecycleCallbacks`*"] + #[deprecated = "Use `set_disconnected_callback()` instead."] pub fn disconnected_callback(&mut self, val: &::js_sys::Function) -> &mut Self { - self.disconnected_callback_shim(val); + self.set_disconnected_callback(val); self } } diff --git a/crates/web-sys/src/features/gen_LocaleInfo.rs b/crates/web-sys/src/features/gen_LocaleInfo.rs index ba79aa77e67..b7c86104dd5 100644 --- a/crates/web-sys/src/features/gen_LocaleInfo.rs +++ b/crates/web-sys/src/features/gen_LocaleInfo.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] pub type LocaleInfo; + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &LocaleInfo) -> Option; + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &LocaleInfo, val: &str); + pub fn set_direction(this: &LocaleInfo, val: &str); + #[doc = "Get the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] + #[wasm_bindgen(method, getter = "locale")] + pub fn get_locale(this: &LocaleInfo) -> Option; + #[doc = "Change the `locale` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] #[wasm_bindgen(method, setter = "locale")] - fn locale_shim(this: &LocaleInfo, val: &str); + pub fn set_locale(this: &LocaleInfo, val: &str); } impl LocaleInfo { #[doc = "Construct a new `LocaleInfo`."] @@ -24,18 +40,14 @@ impl LocaleInfo { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: &str) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `locale` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] + #[deprecated = "Use `set_locale()` instead."] pub fn locale(&mut self, val: &str) -> &mut Self { - self.locale_shim(val); + self.set_locale(val); self } } diff --git a/crates/web-sys/src/features/gen_LockInfo.rs b/crates/web-sys/src/features/gen_LockInfo.rs index 0c7112ddc24..aa37143fa48 100644 --- a/crates/web-sys/src/features/gen_LockInfo.rs +++ b/crates/web-sys/src/features/gen_LockInfo.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockInfo; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `clientId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clientId")] + pub fn get_client_id(this: &LockInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clientId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "clientId")] - fn client_id_shim(this: &LockInfo, val: &str); + pub fn set_client_id(this: &LockInfo, val: &str); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "LockMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`, `LockMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &LockInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`, `LockMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &LockInfo, val: LockMode); + pub fn set_mode(this: &LockInfo, val: LockMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &LockInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &LockInfo, val: &str); + pub fn set_name(this: &LockInfo, val: &str); } #[cfg(web_sys_unstable_apis)] impl LockInfo { @@ -36,37 +85,22 @@ impl LockInfo { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `clientId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_client_id()` instead."] pub fn client_id(&mut self, val: &str) -> &mut Self { - self.client_id_shim(val); + self.set_client_id(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "LockMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LockInfo`, `LockMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: LockMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LockInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_LockManagerSnapshot.rs b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs index a6b6ed20ddc..eaf27c0dbbe 100644 --- a/crates/web-sys/src/features/gen_LockManagerSnapshot.rs +++ b/crates/web-sys/src/features/gen_LockManagerSnapshot.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockManagerSnapshot; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `held` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "held")] + pub fn get_held(this: &LockManagerSnapshot) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `held` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "held")] - fn held_shim(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); + pub fn set_held(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `pending` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "pending")] + pub fn get_pending(this: &LockManagerSnapshot) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `pending` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "pending")] - fn pending_shim(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); + pub fn set_pending(this: &LockManagerSnapshot, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl LockManagerSnapshot { @@ -33,25 +65,15 @@ impl LockManagerSnapshot { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `held` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_held()` instead."] pub fn held(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.held_shim(val); + self.set_held(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `pending` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `LockManagerSnapshot`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_pending()` instead."] pub fn pending(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.pending_shim(val); + self.set_pending(val); self } } diff --git a/crates/web-sys/src/features/gen_LockOptions.rs b/crates/web-sys/src/features/gen_LockOptions.rs index 8b450d2645c..3f023869c94 100644 --- a/crates/web-sys/src/features/gen_LockOptions.rs +++ b/crates/web-sys/src/features/gen_LockOptions.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type LockOptions; - #[wasm_bindgen(method, setter = "ifAvailable")] - fn if_available_shim(this: &LockOptions, val: bool); - #[cfg(feature = "LockMode")] - #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &LockOptions, val: LockMode); - #[cfg(feature = "AbortSignal")] - #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &LockOptions, val: &AbortSignal); - #[wasm_bindgen(method, setter = "steal")] - fn steal_shim(this: &LockOptions, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl LockOptions { - #[doc = "Construct a new `LockOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `ifAvailable` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "ifAvailable")] + pub fn get_if_available(this: &LockOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `ifAvailable` field of this object."] #[doc = ""] @@ -45,10 +30,18 @@ impl LockOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn if_available(&mut self, val: bool) -> &mut Self { - self.if_available_shim(val); - self - } + #[wasm_bindgen(method, setter = "ifAvailable")] + pub fn set_if_available(this: &LockOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockMode`, `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &LockOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "LockMode")] #[doc = "Change the `mode` field of this object."] @@ -57,10 +50,18 @@ impl LockOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mode(&mut self, val: LockMode) -> &mut Self { - self.mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "mode")] + pub fn set_mode(this: &LockOptions, val: LockMode); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &LockOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AbortSignal")] #[doc = "Change the `signal` field of this object."] @@ -69,10 +70,17 @@ impl LockOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); - self - } + #[wasm_bindgen(method, setter = "signal")] + pub fn set_signal(this: &LockOptions, val: &AbortSignal); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `steal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "steal")] + pub fn get_steal(this: &LockOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `steal` field of this object."] #[doc = ""] @@ -80,8 +88,46 @@ impl LockOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "steal")] + pub fn set_steal(this: &LockOptions, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl LockOptions { + #[doc = "Construct a new `LockOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LockOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_if_available()` instead."] + pub fn if_available(&mut self, val: bool) -> &mut Self { + self.set_if_available(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LockMode")] + #[deprecated = "Use `set_mode()` instead."] + pub fn mode(&mut self, val: LockMode) -> &mut Self { + self.set_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[deprecated = "Use `set_signal()` instead."] + pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { + self.set_signal(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_steal()` instead."] pub fn steal(&mut self, val: bool) -> &mut Self { - self.steal_shim(val); + self.set_steal(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaConfiguration.rs b/crates/web-sys/src/features/gen_MediaConfiguration.rs index 5214880c65c..57c9d39f59f 100644 --- a/crates/web-sys/src/features/gen_MediaConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaConfiguration.rs @@ -11,11 +11,29 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`*"] pub type MediaConfiguration; #[cfg(feature = "AudioConfiguration")] + #[doc = "Get the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaConfiguration`*"] + #[wasm_bindgen(method, getter = "audio")] + pub fn get_audio(this: &MediaConfiguration) -> Option; + #[cfg(feature = "AudioConfiguration")] + #[doc = "Change the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaConfiguration`*"] #[wasm_bindgen(method, setter = "audio")] - fn audio_shim(this: &MediaConfiguration, val: &AudioConfiguration); + pub fn set_audio(this: &MediaConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[doc = "Get the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`, `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "video")] + pub fn get_video(this: &MediaConfiguration) -> Option; #[cfg(feature = "VideoConfiguration")] + #[doc = "Change the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`, `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "video")] - fn video_shim(this: &MediaConfiguration, val: &VideoConfiguration); + pub fn set_video(this: &MediaConfiguration, val: &VideoConfiguration); } impl MediaConfiguration { #[doc = "Construct a new `MediaConfiguration`."] @@ -27,19 +45,15 @@ impl MediaConfiguration { ret } #[cfg(feature = "AudioConfiguration")] - #[doc = "Change the `audio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaConfiguration`*"] + #[deprecated = "Use `set_audio()` instead."] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - self.audio_shim(val); + self.set_audio(val); self } #[cfg(feature = "VideoConfiguration")] - #[doc = "Change the `video` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaConfiguration`, `VideoConfiguration`*"] + #[deprecated = "Use `set_video()` instead."] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - self.video_shim(val); + self.set_video(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs index 056b56bda30..297dd25ef9c 100644 --- a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs @@ -11,14 +11,41 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`*"] pub type MediaDecodingConfiguration; #[cfg(feature = "AudioConfiguration")] + #[doc = "Get the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaDecodingConfiguration`*"] + #[wasm_bindgen(method, getter = "audio")] + pub fn get_audio(this: &MediaDecodingConfiguration) -> Option; + #[cfg(feature = "AudioConfiguration")] + #[doc = "Change the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaDecodingConfiguration`*"] #[wasm_bindgen(method, setter = "audio")] - fn audio_shim(this: &MediaDecodingConfiguration, val: &AudioConfiguration); + pub fn set_audio(this: &MediaDecodingConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[doc = "Get the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "video")] + pub fn get_video(this: &MediaDecodingConfiguration) -> Option; #[cfg(feature = "VideoConfiguration")] + #[doc = "Change the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "video")] - fn video_shim(this: &MediaDecodingConfiguration, val: &VideoConfiguration); + pub fn set_video(this: &MediaDecodingConfiguration, val: &VideoConfiguration); #[cfg(feature = "MediaDecodingType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `MediaDecodingType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &MediaDecodingConfiguration) -> MediaDecodingType; + #[cfg(feature = "MediaDecodingType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `MediaDecodingType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &MediaDecodingConfiguration, val: MediaDecodingType); + pub fn set_type(this: &MediaDecodingConfiguration, val: MediaDecodingType); } impl MediaDecodingConfiguration { #[cfg(feature = "MediaDecodingType")] @@ -32,27 +59,21 @@ impl MediaDecodingConfiguration { ret } #[cfg(feature = "AudioConfiguration")] - #[doc = "Change the `audio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaDecodingConfiguration`*"] + #[deprecated = "Use `set_audio()` instead."] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - self.audio_shim(val); + self.set_audio(val); self } #[cfg(feature = "VideoConfiguration")] - #[doc = "Change the `video` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `VideoConfiguration`*"] + #[deprecated = "Use `set_video()` instead."] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - self.video_shim(val); + self.set_video(val); self } #[cfg(feature = "MediaDecodingType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaDecodingConfiguration`, `MediaDecodingType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: MediaDecodingType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs index c13381b70d2..5e5eb4b2621 100644 --- a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaElementAudioSourceOptions`*"] pub type MediaElementAudioSourceOptions; #[cfg(feature = "HtmlMediaElement")] + #[doc = "Get the `mediaElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`, `MediaElementAudioSourceOptions`*"] + #[wasm_bindgen(method, getter = "mediaElement")] + pub fn get_media_element(this: &MediaElementAudioSourceOptions) -> HtmlMediaElement; + #[cfg(feature = "HtmlMediaElement")] + #[doc = "Change the `mediaElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`, `MediaElementAudioSourceOptions`*"] #[wasm_bindgen(method, setter = "mediaElement")] - fn media_element_shim(this: &MediaElementAudioSourceOptions, val: &HtmlMediaElement); + pub fn set_media_element(this: &MediaElementAudioSourceOptions, val: &HtmlMediaElement); } impl MediaElementAudioSourceOptions { #[cfg(feature = "HtmlMediaElement")] @@ -26,11 +35,9 @@ impl MediaElementAudioSourceOptions { ret } #[cfg(feature = "HtmlMediaElement")] - #[doc = "Change the `mediaElement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`, `MediaElementAudioSourceOptions`*"] + #[deprecated = "Use `set_media_element()` instead."] pub fn media_element(&mut self, val: &HtmlMediaElement) -> &mut Self { - self.media_element_shim(val); + self.set_media_element(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs index eafa1733fc4..1880ab1d8d3 100644 --- a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs @@ -11,14 +11,41 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`*"] pub type MediaEncodingConfiguration; #[cfg(feature = "AudioConfiguration")] + #[doc = "Get the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaEncodingConfiguration`*"] + #[wasm_bindgen(method, getter = "audio")] + pub fn get_audio(this: &MediaEncodingConfiguration) -> Option; + #[cfg(feature = "AudioConfiguration")] + #[doc = "Change the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaEncodingConfiguration`*"] #[wasm_bindgen(method, setter = "audio")] - fn audio_shim(this: &MediaEncodingConfiguration, val: &AudioConfiguration); + pub fn set_audio(this: &MediaEncodingConfiguration, val: &AudioConfiguration); + #[cfg(feature = "VideoConfiguration")] + #[doc = "Get the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "video")] + pub fn get_video(this: &MediaEncodingConfiguration) -> Option; #[cfg(feature = "VideoConfiguration")] + #[doc = "Change the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "video")] - fn video_shim(this: &MediaEncodingConfiguration, val: &VideoConfiguration); + pub fn set_video(this: &MediaEncodingConfiguration, val: &VideoConfiguration); #[cfg(feature = "MediaEncodingType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `MediaEncodingType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &MediaEncodingConfiguration) -> MediaEncodingType; + #[cfg(feature = "MediaEncodingType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `MediaEncodingType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &MediaEncodingConfiguration, val: MediaEncodingType); + pub fn set_type(this: &MediaEncodingConfiguration, val: MediaEncodingType); } impl MediaEncodingConfiguration { #[cfg(feature = "MediaEncodingType")] @@ -32,27 +59,21 @@ impl MediaEncodingConfiguration { ret } #[cfg(feature = "AudioConfiguration")] - #[doc = "Change the `audio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`, `MediaEncodingConfiguration`*"] + #[deprecated = "Use `set_audio()` instead."] pub fn audio(&mut self, val: &AudioConfiguration) -> &mut Self { - self.audio_shim(val); + self.set_audio(val); self } #[cfg(feature = "VideoConfiguration")] - #[doc = "Change the `video` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `VideoConfiguration`*"] + #[deprecated = "Use `set_video()` instead."] pub fn video(&mut self, val: &VideoConfiguration) -> &mut Self { - self.video_shim(val); + self.set_video(val); self } #[cfg(feature = "MediaEncodingType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaEncodingConfiguration`, `MediaEncodingType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: MediaEncodingType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaImage.rs b/crates/web-sys/src/features/gen_MediaImage.rs index 779f4419ecb..151349e85ea 100644 --- a/crates/web-sys/src/features/gen_MediaImage.rs +++ b/crates/web-sys/src/features/gen_MediaImage.rs @@ -14,12 +14,60 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaImage; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sizes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sizes")] + pub fn get_sizes(this: &MediaImage) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sizes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sizes")] - fn sizes_shim(this: &MediaImage, val: &str); + pub fn set_sizes(this: &MediaImage, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `src` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "src")] + pub fn get_src(this: &MediaImage) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `src` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "src")] - fn src_shim(this: &MediaImage, val: &str); + pub fn set_src(this: &MediaImage, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &MediaImage) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &MediaImage, val: &str); + pub fn set_type(this: &MediaImage, val: &str); } #[cfg(web_sys_unstable_apis)] impl MediaImage { @@ -36,36 +84,21 @@ impl MediaImage { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sizes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_sizes()` instead."] pub fn sizes(&mut self, val: &str) -> &mut Self { - self.sizes_shim(val); + self.set_sizes(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `src` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_src()` instead."] pub fn src(&mut self, val: &str) -> &mut Self { - self.src_shim(val); + self.set_src(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaImage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs index b5d349fa116..8b64ac9ada6 100644 --- a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] pub type MediaKeyMessageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaKeyMessageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaKeyMessageEventInit, val: bool); + pub fn set_bubbles(this: &MediaKeyMessageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaKeyMessageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaKeyMessageEventInit, val: bool); + pub fn set_cancelable(this: &MediaKeyMessageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaKeyMessageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaKeyMessageEventInit, val: bool); + pub fn set_composed(this: &MediaKeyMessageEventInit, val: bool); + #[doc = "Get the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[wasm_bindgen(method, getter = "message")] + pub fn get_message(this: &MediaKeyMessageEventInit) -> ::js_sys::ArrayBuffer; + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] #[wasm_bindgen(method, setter = "message")] - fn message_shim(this: &MediaKeyMessageEventInit, val: &::js_sys::ArrayBuffer); + pub fn set_message(this: &MediaKeyMessageEventInit, val: &::js_sys::ArrayBuffer); #[cfg(feature = "MediaKeyMessageType")] + #[doc = "Get the `messageType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`, `MediaKeyMessageType`*"] + #[wasm_bindgen(method, getter = "messageType")] + pub fn get_message_type(this: &MediaKeyMessageEventInit) -> MediaKeyMessageType; + #[cfg(feature = "MediaKeyMessageType")] + #[doc = "Change the `messageType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`, `MediaKeyMessageType`*"] #[wasm_bindgen(method, setter = "messageType")] - fn message_type_shim(this: &MediaKeyMessageEventInit, val: MediaKeyMessageType); + pub fn set_message_type(this: &MediaKeyMessageEventInit, val: MediaKeyMessageType); } impl MediaKeyMessageEventInit { #[cfg(feature = "MediaKeyMessageType")] @@ -34,40 +75,30 @@ impl MediaKeyMessageEventInit { ret.message_type(message_type); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `message` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`*"] + #[deprecated = "Use `set_message()` instead."] pub fn message(&mut self, val: &::js_sys::ArrayBuffer) -> &mut Self { - self.message_shim(val); + self.set_message(val); self } #[cfg(feature = "MediaKeyMessageType")] - #[doc = "Change the `messageType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyMessageEventInit`, `MediaKeyMessageType`*"] + #[deprecated = "Use `set_message_type()` instead."] pub fn message_type(&mut self, val: MediaKeyMessageType) -> &mut Self { - self.message_type_shim(val); + self.set_message_type(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs index f723838a4c8..33419e081c3 100644 --- a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] pub type MediaKeyNeededEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaKeyNeededEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaKeyNeededEventInit, val: bool); + pub fn set_bubbles(this: &MediaKeyNeededEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaKeyNeededEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaKeyNeededEventInit, val: bool); + pub fn set_cancelable(this: &MediaKeyNeededEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaKeyNeededEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaKeyNeededEventInit, val: bool); + pub fn set_composed(this: &MediaKeyNeededEventInit, val: bool); + #[doc = "Get the `initData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[wasm_bindgen(method, getter = "initData")] + pub fn get_init_data(this: &MediaKeyNeededEventInit) -> Option<::js_sys::ArrayBuffer>; + #[doc = "Change the `initData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, setter = "initData")] - fn init_data_shim(this: &MediaKeyNeededEventInit, val: Option<&::js_sys::ArrayBuffer>); + pub fn set_init_data(this: &MediaKeyNeededEventInit, val: Option<&::js_sys::ArrayBuffer>); + #[doc = "Get the `initDataType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[wasm_bindgen(method, getter = "initDataType")] + pub fn get_init_data_type(this: &MediaKeyNeededEventInit) -> Option; + #[doc = "Change the `initDataType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, setter = "initDataType")] - fn init_data_type_shim(this: &MediaKeyNeededEventInit, val: &str); + pub fn set_init_data_type(this: &MediaKeyNeededEventInit, val: &str); } impl MediaKeyNeededEventInit { #[doc = "Construct a new `MediaKeyNeededEventInit`."] @@ -30,39 +70,29 @@ impl MediaKeyNeededEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `initData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[deprecated = "Use `set_init_data()` instead."] pub fn init_data(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - self.init_data_shim(val); + self.set_init_data(val); self } - #[doc = "Change the `initDataType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] + #[deprecated = "Use `set_init_data_type()` instead."] pub fn init_data_type(&mut self, val: &str) -> &mut Self { - self.init_data_type_shim(val); + self.set_init_data_type(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs index 189ffb73a60..e110b3e1ec1 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs @@ -10,22 +10,92 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] pub type MediaKeySystemConfiguration; + #[doc = "Get the `audioCapabilities` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[wasm_bindgen(method, getter = "audioCapabilities")] + pub fn get_audio_capabilities(this: &MediaKeySystemConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `audioCapabilities` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, setter = "audioCapabilities")] - fn audio_capabilities_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_audio_capabilities( + this: &MediaKeySystemConfiguration, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(feature = "MediaKeysRequirement")] + #[doc = "Get the `distinctiveIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] + #[wasm_bindgen(method, getter = "distinctiveIdentifier")] + pub fn get_distinctive_identifier( + this: &MediaKeySystemConfiguration, + ) -> Option; #[cfg(feature = "MediaKeysRequirement")] + #[doc = "Change the `distinctiveIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] #[wasm_bindgen(method, setter = "distinctiveIdentifier")] - fn distinctive_identifier_shim(this: &MediaKeySystemConfiguration, val: MediaKeysRequirement); + pub fn set_distinctive_identifier( + this: &MediaKeySystemConfiguration, + val: MediaKeysRequirement, + ); + #[doc = "Get the `initDataTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[wasm_bindgen(method, getter = "initDataTypes")] + pub fn get_init_data_types(this: &MediaKeySystemConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `initDataTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, setter = "initDataTypes")] - fn init_data_types_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_init_data_types(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &MediaKeySystemConfiguration) -> Option; + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &MediaKeySystemConfiguration, val: &str); + pub fn set_label(this: &MediaKeySystemConfiguration, val: &str); + #[cfg(feature = "MediaKeysRequirement")] + #[doc = "Get the `persistentState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] + #[wasm_bindgen(method, getter = "persistentState")] + pub fn get_persistent_state(this: &MediaKeySystemConfiguration) + -> Option; #[cfg(feature = "MediaKeysRequirement")] + #[doc = "Change the `persistentState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] #[wasm_bindgen(method, setter = "persistentState")] - fn persistent_state_shim(this: &MediaKeySystemConfiguration, val: MediaKeysRequirement); + pub fn set_persistent_state(this: &MediaKeySystemConfiguration, val: MediaKeysRequirement); + #[doc = "Get the `sessionTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[wasm_bindgen(method, getter = "sessionTypes")] + pub fn get_session_types(this: &MediaKeySystemConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `sessionTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, setter = "sessionTypes")] - fn session_types_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_session_types(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `videoCapabilities` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[wasm_bindgen(method, getter = "videoCapabilities")] + pub fn get_video_capabilities(this: &MediaKeySystemConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `videoCapabilities` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, setter = "videoCapabilities")] - fn video_capabilities_shim(this: &MediaKeySystemConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_video_capabilities( + this: &MediaKeySystemConfiguration, + val: &::wasm_bindgen::JsValue, + ); } impl MediaKeySystemConfiguration { #[doc = "Construct a new `MediaKeySystemConfiguration`."] @@ -36,55 +106,41 @@ impl MediaKeySystemConfiguration { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `audioCapabilities` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[deprecated = "Use `set_audio_capabilities()` instead."] pub fn audio_capabilities(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.audio_capabilities_shim(val); + self.set_audio_capabilities(val); self } #[cfg(feature = "MediaKeysRequirement")] - #[doc = "Change the `distinctiveIdentifier` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] + #[deprecated = "Use `set_distinctive_identifier()` instead."] pub fn distinctive_identifier(&mut self, val: MediaKeysRequirement) -> &mut Self { - self.distinctive_identifier_shim(val); + self.set_distinctive_identifier(val); self } - #[doc = "Change the `initDataTypes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[deprecated = "Use `set_init_data_types()` instead."] pub fn init_data_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.init_data_types_shim(val); + self.set_init_data_types(val); self } - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &str) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } #[cfg(feature = "MediaKeysRequirement")] - #[doc = "Change the `persistentState` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`, `MediaKeysRequirement`*"] + #[deprecated = "Use `set_persistent_state()` instead."] pub fn persistent_state(&mut self, val: MediaKeysRequirement) -> &mut Self { - self.persistent_state_shim(val); + self.set_persistent_state(val); self } - #[doc = "Change the `sessionTypes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[deprecated = "Use `set_session_types()` instead."] pub fn session_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.session_types_shim(val); + self.set_session_types(val); self } - #[doc = "Change the `videoCapabilities` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] + #[deprecated = "Use `set_video_capabilities()` instead."] pub fn video_capabilities(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.video_capabilities_shim(val); + self.set_video_capabilities(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs index 6d4e840e0fb..7740ba74e30 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] pub type MediaKeySystemMediaCapability; + #[doc = "Get the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] + #[wasm_bindgen(method, getter = "contentType")] + pub fn get_content_type(this: &MediaKeySystemMediaCapability) -> Option; + #[doc = "Change the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] #[wasm_bindgen(method, setter = "contentType")] - fn content_type_shim(this: &MediaKeySystemMediaCapability, val: &str); + pub fn set_content_type(this: &MediaKeySystemMediaCapability, val: &str); + #[doc = "Get the `robustness` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] + #[wasm_bindgen(method, getter = "robustness")] + pub fn get_robustness(this: &MediaKeySystemMediaCapability) -> Option; + #[doc = "Change the `robustness` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] #[wasm_bindgen(method, setter = "robustness")] - fn robustness_shim(this: &MediaKeySystemMediaCapability, val: &str); + pub fn set_robustness(this: &MediaKeySystemMediaCapability, val: &str); } impl MediaKeySystemMediaCapability { #[doc = "Construct a new `MediaKeySystemMediaCapability`."] @@ -24,18 +40,14 @@ impl MediaKeySystemMediaCapability { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `contentType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] + #[deprecated = "Use `set_content_type()` instead."] pub fn content_type(&mut self, val: &str) -> &mut Self { - self.content_type_shim(val); + self.set_content_type(val); self } - #[doc = "Change the `robustness` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] + #[deprecated = "Use `set_robustness()` instead."] pub fn robustness(&mut self, val: &str) -> &mut Self { - self.robustness_shim(val); + self.set_robustness(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs index de6f010e296..26f5b184200 100644 --- a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs +++ b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] pub type MediaKeysPolicy; + #[doc = "Get the `minHdcpVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] + #[wasm_bindgen(method, getter = "minHdcpVersion")] + pub fn get_min_hdcp_version(this: &MediaKeysPolicy) -> Option; + #[doc = "Change the `minHdcpVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] #[wasm_bindgen(method, setter = "minHdcpVersion")] - fn min_hdcp_version_shim(this: &MediaKeysPolicy, val: &str); + pub fn set_min_hdcp_version(this: &MediaKeysPolicy, val: &str); } impl MediaKeysPolicy { #[doc = "Construct a new `MediaKeysPolicy`."] @@ -22,11 +30,9 @@ impl MediaKeysPolicy { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `minHdcpVersion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] + #[deprecated = "Use `set_min_hdcp_version()` instead."] pub fn min_hdcp_version(&mut self, val: &str) -> &mut Self { - self.min_hdcp_version_shim(val); + self.set_min_hdcp_version(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaMetadataInit.rs b/crates/web-sys/src/features/gen_MediaMetadataInit.rs index 91fb637fb19..f2deaff2ec3 100644 --- a/crates/web-sys/src/features/gen_MediaMetadataInit.rs +++ b/crates/web-sys/src/features/gen_MediaMetadataInit.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaMetadataInit; - #[wasm_bindgen(method, setter = "album")] - fn album_shim(this: &MediaMetadataInit, val: &str); - #[wasm_bindgen(method, setter = "artist")] - fn artist_shim(this: &MediaMetadataInit, val: &str); - #[wasm_bindgen(method, setter = "artwork")] - fn artwork_shim(this: &MediaMetadataInit, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "title")] - fn title_shim(this: &MediaMetadataInit, val: &str); -} -#[cfg(web_sys_unstable_apis)] -impl MediaMetadataInit { - #[doc = "Construct a new `MediaMetadataInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `album` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "album")] + pub fn get_album(this: &MediaMetadataInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `album` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl MediaMetadataInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn album(&mut self, val: &str) -> &mut Self { - self.album_shim(val); - self - } + #[wasm_bindgen(method, setter = "album")] + pub fn set_album(this: &MediaMetadataInit, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `artist` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "artist")] + pub fn get_artist(this: &MediaMetadataInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `artist` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl MediaMetadataInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn artist(&mut self, val: &str) -> &mut Self { - self.artist_shim(val); - self - } + #[wasm_bindgen(method, setter = "artist")] + pub fn set_artist(this: &MediaMetadataInit, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `artwork` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "artwork")] + pub fn get_artwork(this: &MediaMetadataInit) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `artwork` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl MediaMetadataInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn artwork(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.artwork_shim(val); - self - } + #[wasm_bindgen(method, setter = "artwork")] + pub fn set_artwork(this: &MediaMetadataInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "title")] + pub fn get_title(this: &MediaMetadataInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `title` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl MediaMetadataInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "title")] + pub fn set_title(this: &MediaMetadataInit, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl MediaMetadataInit { + #[doc = "Construct a new `MediaMetadataInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaMetadataInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_album()` instead."] + pub fn album(&mut self, val: &str) -> &mut Self { + self.set_album(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_artist()` instead."] + pub fn artist(&mut self, val: &str) -> &mut Self { + self.set_artist(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_artwork()` instead."] + pub fn artwork(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_artwork(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_title()` instead."] pub fn title(&mut self, val: &str) -> &mut Self { - self.title_shim(val); + self.set_title(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaPositionState.rs b/crates/web-sys/src/features/gen_MediaPositionState.rs index 2cb0437b6cd..b381f380ad4 100644 --- a/crates/web-sys/src/features/gen_MediaPositionState.rs +++ b/crates/web-sys/src/features/gen_MediaPositionState.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaPositionState; - #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &MediaPositionState, val: f64); - #[wasm_bindgen(method, setter = "playbackRate")] - fn playback_rate_shim(this: &MediaPositionState, val: f64); - #[wasm_bindgen(method, setter = "position")] - fn position_shim(this: &MediaPositionState, val: f64); -} -#[cfg(web_sys_unstable_apis)] -impl MediaPositionState { - #[doc = "Construct a new `MediaPositionState`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &MediaPositionState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `duration` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl MediaPositionState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); - self - } + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &MediaPositionState, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `playbackRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "playbackRate")] + pub fn get_playback_rate(this: &MediaPositionState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `playbackRate` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl MediaPositionState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn playback_rate(&mut self, val: f64) -> &mut Self { - self.playback_rate_shim(val); - self - } + #[wasm_bindgen(method, setter = "playbackRate")] + pub fn set_playback_rate(this: &MediaPositionState, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `position` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "position")] + pub fn get_position(this: &MediaPositionState) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `position` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl MediaPositionState { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "position")] + pub fn set_position(this: &MediaPositionState, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl MediaPositionState { + #[doc = "Construct a new `MediaPositionState`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaPositionState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: f64) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_playback_rate()` instead."] + pub fn playback_rate(&mut self, val: f64) -> &mut Self { + self.set_playback_rate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_position()` instead."] pub fn position(&mut self, val: f64) -> &mut Self { - self.position_shim(val); + self.set_position(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs index 842841ed7d9..b656e13b75a 100644 --- a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] pub type MediaQueryListEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaQueryListEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaQueryListEventInit, val: bool); + pub fn set_bubbles(this: &MediaQueryListEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaQueryListEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaQueryListEventInit, val: bool); + pub fn set_cancelable(this: &MediaQueryListEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaQueryListEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaQueryListEventInit, val: bool); + pub fn set_composed(this: &MediaQueryListEventInit, val: bool); + #[doc = "Get the `matches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[wasm_bindgen(method, getter = "matches")] + pub fn get_matches(this: &MediaQueryListEventInit) -> Option; + #[doc = "Change the `matches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, setter = "matches")] - fn matches_shim(this: &MediaQueryListEventInit, val: bool); + pub fn set_matches(this: &MediaQueryListEventInit, val: bool); + #[doc = "Get the `media` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[wasm_bindgen(method, getter = "media")] + pub fn get_media(this: &MediaQueryListEventInit) -> Option; + #[doc = "Change the `media` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, setter = "media")] - fn media_shim(this: &MediaQueryListEventInit, val: &str); + pub fn set_media(this: &MediaQueryListEventInit, val: &str); } impl MediaQueryListEventInit { #[doc = "Construct a new `MediaQueryListEventInit`."] @@ -30,39 +70,29 @@ impl MediaQueryListEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `matches` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[deprecated = "Use `set_matches()` instead."] pub fn matches(&mut self, val: bool) -> &mut Self { - self.matches_shim(val); + self.set_matches(val); self } - #[doc = "Change the `media` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] + #[deprecated = "Use `set_media()` instead."] pub fn media(&mut self, val: &str) -> &mut Self { - self.media_shim(val); + self.set_media(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs index bd0cee69550..0c853852267 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] pub type MediaRecorderErrorEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaRecorderErrorEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaRecorderErrorEventInit, val: bool); + pub fn set_bubbles(this: &MediaRecorderErrorEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaRecorderErrorEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaRecorderErrorEventInit, val: bool); + pub fn set_cancelable(this: &MediaRecorderErrorEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaRecorderErrorEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaRecorderErrorEventInit, val: bool); + pub fn set_composed(this: &MediaRecorderErrorEventInit, val: bool); #[cfg(feature = "DomException")] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomException`, `MediaRecorderErrorEventInit`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &MediaRecorderErrorEventInit) -> DomException; + #[cfg(feature = "DomException")] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomException`, `MediaRecorderErrorEventInit`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &MediaRecorderErrorEventInit, val: &DomException); + pub fn set_error(this: &MediaRecorderErrorEventInit, val: &DomException); } impl MediaRecorderErrorEventInit { #[cfg(feature = "DomException")] @@ -31,33 +64,25 @@ impl MediaRecorderErrorEventInit { ret.error(error); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderErrorEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "DomException")] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomException`, `MediaRecorderErrorEventInit`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &DomException) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs index c2b2d199293..2cadbaa05ac 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] pub type MediaRecorderOptions; + #[doc = "Get the `audioBitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[wasm_bindgen(method, getter = "audioBitsPerSecond")] + pub fn get_audio_bits_per_second(this: &MediaRecorderOptions) -> Option; + #[doc = "Change the `audioBitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] #[wasm_bindgen(method, setter = "audioBitsPerSecond")] - fn audio_bits_per_second_shim(this: &MediaRecorderOptions, val: u32); + pub fn set_audio_bits_per_second(this: &MediaRecorderOptions, val: u32); + #[doc = "Get the `bitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[wasm_bindgen(method, getter = "bitsPerSecond")] + pub fn get_bits_per_second(this: &MediaRecorderOptions) -> Option; + #[doc = "Change the `bitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] #[wasm_bindgen(method, setter = "bitsPerSecond")] - fn bits_per_second_shim(this: &MediaRecorderOptions, val: u32); + pub fn set_bits_per_second(this: &MediaRecorderOptions, val: u32); + #[doc = "Get the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[wasm_bindgen(method, getter = "mimeType")] + pub fn get_mime_type(this: &MediaRecorderOptions) -> Option; + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] #[wasm_bindgen(method, setter = "mimeType")] - fn mime_type_shim(this: &MediaRecorderOptions, val: &str); + pub fn set_mime_type(this: &MediaRecorderOptions, val: &str); + #[doc = "Get the `videoBitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[wasm_bindgen(method, getter = "videoBitsPerSecond")] + pub fn get_video_bits_per_second(this: &MediaRecorderOptions) -> Option; + #[doc = "Change the `videoBitsPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] #[wasm_bindgen(method, setter = "videoBitsPerSecond")] - fn video_bits_per_second_shim(this: &MediaRecorderOptions, val: u32); + pub fn set_video_bits_per_second(this: &MediaRecorderOptions, val: u32); } impl MediaRecorderOptions { #[doc = "Construct a new `MediaRecorderOptions`."] @@ -28,32 +60,24 @@ impl MediaRecorderOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `audioBitsPerSecond` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[deprecated = "Use `set_audio_bits_per_second()` instead."] pub fn audio_bits_per_second(&mut self, val: u32) -> &mut Self { - self.audio_bits_per_second_shim(val); + self.set_audio_bits_per_second(val); self } - #[doc = "Change the `bitsPerSecond` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[deprecated = "Use `set_bits_per_second()` instead."] pub fn bits_per_second(&mut self, val: u32) -> &mut Self { - self.bits_per_second_shim(val); + self.set_bits_per_second(val); self } - #[doc = "Change the `mimeType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[deprecated = "Use `set_mime_type()` instead."] pub fn mime_type(&mut self, val: &str) -> &mut Self { - self.mime_type_shim(val); + self.set_mime_type(val); self } - #[doc = "Change the `videoBitsPerSecond` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] + #[deprecated = "Use `set_video_bits_per_second()` instead."] pub fn video_bits_per_second(&mut self, val: u32) -> &mut Self { - self.video_bits_per_second_shim(val); + self.set_video_bits_per_second(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs index 45cde7e9664..69cc21f6087 100644 --- a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs +++ b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs @@ -14,31 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaSessionActionDetails; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MediaSessionAction")] - #[wasm_bindgen(method, setter = "action")] - fn action_shim(this: &MediaSessionActionDetails, val: MediaSessionAction); - #[wasm_bindgen(method, setter = "fastSeek")] - fn fast_seek_shim(this: &MediaSessionActionDetails, val: Option); - #[wasm_bindgen(method, setter = "seekOffset")] - fn seek_offset_shim(this: &MediaSessionActionDetails, val: Option); - #[wasm_bindgen(method, setter = "seekTime")] - fn seek_time_shim(this: &MediaSessionActionDetails, val: Option); -} -#[cfg(web_sys_unstable_apis)] -impl MediaSessionActionDetails { - #[cfg(feature = "MediaSessionAction")] - #[doc = "Construct a new `MediaSessionActionDetails`."] + #[doc = "Get the `action` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaSessionAction`, `MediaSessionActionDetails`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(action: MediaSessionAction) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.action(action); - ret - } + #[wasm_bindgen(method, getter = "action")] + pub fn get_action(this: &MediaSessionActionDetails) -> MediaSessionAction; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MediaSessionAction")] #[doc = "Change the `action` field of this object."] @@ -47,10 +32,17 @@ impl MediaSessionActionDetails { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn action(&mut self, val: MediaSessionAction) -> &mut Self { - self.action_shim(val); - self - } + #[wasm_bindgen(method, setter = "action")] + pub fn set_action(this: &MediaSessionActionDetails, val: MediaSessionAction); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `fastSeek` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "fastSeek")] + pub fn get_fast_seek(this: &MediaSessionActionDetails) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `fastSeek` field of this object."] #[doc = ""] @@ -58,10 +50,17 @@ impl MediaSessionActionDetails { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn fast_seek(&mut self, val: Option) -> &mut Self { - self.fast_seek_shim(val); - self - } + #[wasm_bindgen(method, setter = "fastSeek")] + pub fn set_fast_seek(this: &MediaSessionActionDetails, val: Option); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `seekOffset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "seekOffset")] + pub fn get_seek_offset(this: &MediaSessionActionDetails) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `seekOffset` field of this object."] #[doc = ""] @@ -69,10 +68,17 @@ impl MediaSessionActionDetails { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn seek_offset(&mut self, val: Option) -> &mut Self { - self.seek_offset_shim(val); - self - } + #[wasm_bindgen(method, setter = "seekOffset")] + pub fn set_seek_offset(this: &MediaSessionActionDetails, val: Option); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `seekTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "seekTime")] + pub fn get_seek_time(this: &MediaSessionActionDetails) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `seekTime` field of this object."] #[doc = ""] @@ -80,8 +86,47 @@ impl MediaSessionActionDetails { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "seekTime")] + pub fn set_seek_time(this: &MediaSessionActionDetails, val: Option); +} +#[cfg(web_sys_unstable_apis)] +impl MediaSessionActionDetails { + #[cfg(feature = "MediaSessionAction")] + #[doc = "Construct a new `MediaSessionActionDetails`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaSessionAction`, `MediaSessionActionDetails`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(action: MediaSessionAction) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.action(action); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaSessionAction")] + #[deprecated = "Use `set_action()` instead."] + pub fn action(&mut self, val: MediaSessionAction) -> &mut Self { + self.set_action(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_fast_seek()` instead."] + pub fn fast_seek(&mut self, val: Option) -> &mut Self { + self.set_fast_seek(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_seek_offset()` instead."] + pub fn seek_offset(&mut self, val: Option) -> &mut Self { + self.set_seek_offset(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_seek_time()` instead."] pub fn seek_time(&mut self, val: Option) -> &mut Self { - self.seek_time_shim(val); + self.set_seek_time(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs index 633826b3f34..891dbe1e355 100644 --- a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MediaStreamAudioSourceOptions`*"] pub type MediaStreamAudioSourceOptions; #[cfg(feature = "MediaStream")] + #[doc = "Get the `mediaStream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamAudioSourceOptions`*"] + #[wasm_bindgen(method, getter = "mediaStream")] + pub fn get_media_stream(this: &MediaStreamAudioSourceOptions) -> MediaStream; + #[cfg(feature = "MediaStream")] + #[doc = "Change the `mediaStream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamAudioSourceOptions`*"] #[wasm_bindgen(method, setter = "mediaStream")] - fn media_stream_shim(this: &MediaStreamAudioSourceOptions, val: &MediaStream); + pub fn set_media_stream(this: &MediaStreamAudioSourceOptions, val: &MediaStream); } impl MediaStreamAudioSourceOptions { #[cfg(feature = "MediaStream")] @@ -26,11 +35,9 @@ impl MediaStreamAudioSourceOptions { ret } #[cfg(feature = "MediaStream")] - #[doc = "Change the `mediaStream` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamAudioSourceOptions`*"] + #[deprecated = "Use `set_media_stream()` instead."] pub fn media_stream(&mut self, val: &MediaStream) -> &mut Self { - self.media_stream_shim(val); + self.set_media_stream(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs index 9533a444d03..0a666f793b5 100644 --- a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] pub type MediaStreamConstraints; + #[doc = "Get the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "audio")] + pub fn get_audio(this: &MediaStreamConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `audio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "audio")] - fn audio_shim(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_audio(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `fake` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "fake")] + pub fn get_fake(this: &MediaStreamConstraints) -> Option; + #[doc = "Change the `fake` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "fake")] - fn fake_shim(this: &MediaStreamConstraints, val: bool); + pub fn set_fake(this: &MediaStreamConstraints, val: bool); + #[doc = "Get the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "peerIdentity")] + pub fn get_peer_identity(this: &MediaStreamConstraints) -> Option; + #[doc = "Change the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "peerIdentity")] - fn peer_identity_shim(this: &MediaStreamConstraints, val: Option<&str>); + pub fn set_peer_identity(this: &MediaStreamConstraints, val: Option<&str>); + #[doc = "Get the `picture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "picture")] + pub fn get_picture(this: &MediaStreamConstraints) -> Option; + #[doc = "Change the `picture` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "picture")] - fn picture_shim(this: &MediaStreamConstraints, val: bool); + pub fn set_picture(this: &MediaStreamConstraints, val: bool); + #[doc = "Get the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[wasm_bindgen(method, getter = "video")] + pub fn get_video(this: &MediaStreamConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `video` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, setter = "video")] - fn video_shim(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_video(this: &MediaStreamConstraints, val: &::wasm_bindgen::JsValue); } impl MediaStreamConstraints { #[doc = "Construct a new `MediaStreamConstraints`."] @@ -30,39 +70,29 @@ impl MediaStreamConstraints { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `audio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[deprecated = "Use `set_audio()` instead."] pub fn audio(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.audio_shim(val); + self.set_audio(val); self } - #[doc = "Change the `fake` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[deprecated = "Use `set_fake()` instead."] pub fn fake(&mut self, val: bool) -> &mut Self { - self.fake_shim(val); + self.set_fake(val); self } - #[doc = "Change the `peerIdentity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[deprecated = "Use `set_peer_identity()` instead."] pub fn peer_identity(&mut self, val: Option<&str>) -> &mut Self { - self.peer_identity_shim(val); + self.set_peer_identity(val); self } - #[doc = "Change the `picture` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[deprecated = "Use `set_picture()` instead."] pub fn picture(&mut self, val: bool) -> &mut Self { - self.picture_shim(val); + self.set_picture(val); self } - #[doc = "Change the `video` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] + #[deprecated = "Use `set_video()` instead."] pub fn video(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.video_shim(val); + self.set_video(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamEventInit.rs b/crates/web-sys/src/features/gen_MediaStreamEventInit.rs index 82458dfd60c..0bc44a3cd3d 100644 --- a/crates/web-sys/src/features/gen_MediaStreamEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] pub type MediaStreamEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaStreamEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaStreamEventInit, val: bool); + pub fn set_bubbles(this: &MediaStreamEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaStreamEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaStreamEventInit, val: bool); + pub fn set_cancelable(this: &MediaStreamEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaStreamEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaStreamEventInit, val: bool); + pub fn set_composed(this: &MediaStreamEventInit, val: bool); #[cfg(feature = "MediaStream")] + #[doc = "Get the `stream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamEventInit`*"] + #[wasm_bindgen(method, getter = "stream")] + pub fn get_stream(this: &MediaStreamEventInit) -> Option; + #[cfg(feature = "MediaStream")] + #[doc = "Change the `stream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamEventInit`*"] #[wasm_bindgen(method, setter = "stream")] - fn stream_shim(this: &MediaStreamEventInit, val: Option<&MediaStream>); + pub fn set_stream(this: &MediaStreamEventInit, val: Option<&MediaStream>); } impl MediaStreamEventInit { #[doc = "Construct a new `MediaStreamEventInit`."] @@ -29,33 +62,25 @@ impl MediaStreamEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "MediaStream")] - #[doc = "Change the `stream` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStream`, `MediaStreamEventInit`*"] + #[deprecated = "Use `set_stream()` instead."] pub fn stream(&mut self, val: Option<&MediaStream>) -> &mut Self { - self.stream_shim(val); + self.set_stream(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs index d66b918fe20..734dfeede6c 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] pub type MediaStreamTrackEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MediaStreamTrackEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MediaStreamTrackEventInit, val: bool); + pub fn set_bubbles(this: &MediaStreamTrackEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MediaStreamTrackEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MediaStreamTrackEventInit, val: bool); + pub fn set_cancelable(this: &MediaStreamTrackEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MediaStreamTrackEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MediaStreamTrackEventInit, val: bool); + pub fn set_composed(this: &MediaStreamTrackEventInit, val: bool); #[cfg(feature = "MediaStreamTrack")] + #[doc = "Get the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackEventInit`*"] + #[wasm_bindgen(method, getter = "track")] + pub fn get_track(this: &MediaStreamTrackEventInit) -> MediaStreamTrack; + #[cfg(feature = "MediaStreamTrack")] + #[doc = "Change the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackEventInit`*"] #[wasm_bindgen(method, setter = "track")] - fn track_shim(this: &MediaStreamTrackEventInit, val: &MediaStreamTrack); + pub fn set_track(this: &MediaStreamTrackEventInit, val: &MediaStreamTrack); } impl MediaStreamTrackEventInit { #[cfg(feature = "MediaStreamTrack")] @@ -31,33 +64,25 @@ impl MediaStreamTrackEventInit { ret.track(track); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "MediaStreamTrack")] - #[doc = "Change the `track` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackEventInit`*"] + #[deprecated = "Use `set_track()` instead."] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - self.track_shim(val); + self.set_track(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs index a85a9268d57..67d0fcd0431 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaStreamTrackGeneratorInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `kind` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "kind")] + pub fn get_kind(this: &MediaStreamTrackGeneratorInit) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `kind` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "kind")] - fn kind_shim(this: &MediaStreamTrackGeneratorInit, val: &str); + pub fn set_kind(this: &MediaStreamTrackGeneratorInit, val: &str); } #[cfg(web_sys_unstable_apis)] impl MediaStreamTrackGeneratorInit { @@ -32,14 +48,9 @@ impl MediaStreamTrackGeneratorInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `kind` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackGeneratorInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_kind()` instead."] pub fn kind(&mut self, val: &str) -> &mut Self { - self.kind_shim(val); + self.set_kind(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs index fabbd4a7418..76cf12ab2c0 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaStreamTrackProcessorInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `maxBufferSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "maxBufferSize")] + pub fn get_max_buffer_size(this: &MediaStreamTrackProcessorInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `maxBufferSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "maxBufferSize")] - fn max_buffer_size_shim(this: &MediaStreamTrackProcessorInit, val: u16); + pub fn set_max_buffer_size(this: &MediaStreamTrackProcessorInit, val: u16); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MediaStreamTrack")] + #[doc = "Get the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "track")] + pub fn get_track(this: &MediaStreamTrackProcessorInit) -> MediaStreamTrack; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaStreamTrack")] + #[doc = "Change the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackProcessorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "track")] - fn track_shim(this: &MediaStreamTrackProcessorInit, val: &MediaStreamTrack); + pub fn set_track(this: &MediaStreamTrackProcessorInit, val: &MediaStreamTrack); } #[cfg(web_sys_unstable_apis)] impl MediaStreamTrackProcessorInit { @@ -36,26 +69,16 @@ impl MediaStreamTrackProcessorInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `maxBufferSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrackProcessorInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_max_buffer_size()` instead."] pub fn max_buffer_size(&mut self, val: u16) -> &mut Self { - self.max_buffer_size_shim(val); + self.set_max_buffer_size(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MediaStreamTrack")] - #[doc = "Change the `track` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaStreamTrackProcessorInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_track()` instead."] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - self.track_shim(val); + self.set_track(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs index 76373c3967e..1c6d82c5cb9 100644 --- a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs +++ b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs @@ -14,58 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MediaTrackCapabilities; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DoubleRange")] - #[wasm_bindgen(method, setter = "aspectRatio")] - fn aspect_ratio_shim(this: &MediaTrackCapabilities, val: &DoubleRange); - #[wasm_bindgen(method, setter = "autoGainControl")] - fn auto_gain_control_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "ULongRange")] - #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &MediaTrackCapabilities, val: &ULongRange); - #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &MediaTrackCapabilities, val: &str); - #[wasm_bindgen(method, setter = "echoCancellation")] - fn echo_cancellation_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "facingMode")] - fn facing_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "DoubleRange")] - #[wasm_bindgen(method, setter = "frameRate")] - fn frame_rate_shim(this: &MediaTrackCapabilities, val: &DoubleRange); - #[wasm_bindgen(method, setter = "groupId")] - fn group_id_shim(this: &MediaTrackCapabilities, val: &str); - #[cfg(feature = "ULongRange")] - #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &MediaTrackCapabilities, val: &ULongRange); - #[cfg(feature = "DoubleRange")] - #[wasm_bindgen(method, setter = "latency")] - fn latency_shim(this: &MediaTrackCapabilities, val: &DoubleRange); - #[wasm_bindgen(method, setter = "noiseSuppression")] - fn noise_suppression_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "resizeMode")] - fn resize_mode_shim(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); - #[cfg(feature = "ULongRange")] - #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &MediaTrackCapabilities, val: &ULongRange); - #[cfg(feature = "ULongRange")] - #[wasm_bindgen(method, setter = "sampleSize")] - fn sample_size_shim(this: &MediaTrackCapabilities, val: &ULongRange); - #[cfg(feature = "ULongRange")] - #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &MediaTrackCapabilities, val: &ULongRange); -} -#[cfg(web_sys_unstable_apis)] -impl MediaTrackCapabilities { - #[doc = "Construct a new `MediaTrackCapabilities`."] + #[doc = "Get the `aspectRatio` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "aspectRatio")] + pub fn get_aspect_ratio(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DoubleRange")] #[doc = "Change the `aspectRatio` field of this object."] @@ -74,10 +32,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn aspect_ratio(&mut self, val: &DoubleRange) -> &mut Self { - self.aspect_ratio_shim(val); - self - } + #[wasm_bindgen(method, setter = "aspectRatio")] + pub fn set_aspect_ratio(this: &MediaTrackCapabilities, val: &DoubleRange); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "autoGainControl")] + pub fn get_auto_gain_control(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `autoGainControl` field of this object."] #[doc = ""] @@ -85,10 +50,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.auto_gain_control_shim(val); - self - } + #[wasm_bindgen(method, setter = "autoGainControl")] + pub fn set_auto_gain_control(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Change the `channelCount` field of this object."] @@ -97,10 +70,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn channel_count(&mut self, val: &ULongRange) -> &mut Self { - self.channel_count_shim(val); - self - } + #[wasm_bindgen(method, setter = "channelCount")] + pub fn set_channel_count(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `deviceId` field of this object."] #[doc = ""] @@ -108,10 +88,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn device_id(&mut self, val: &str) -> &mut Self { - self.device_id_shim(val); - self - } + #[wasm_bindgen(method, setter = "deviceId")] + pub fn set_device_id(this: &MediaTrackCapabilities, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "echoCancellation")] + pub fn get_echo_cancellation(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `echoCancellation` field of this object."] #[doc = ""] @@ -119,10 +106,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.echo_cancellation_shim(val); - self - } + #[wasm_bindgen(method, setter = "echoCancellation")] + pub fn set_echo_cancellation(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "facingMode")] + pub fn get_facing_mode(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `facingMode` field of this object."] #[doc = ""] @@ -130,10 +124,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.facing_mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "facingMode")] + pub fn set_facing_mode(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[doc = "Get the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frameRate")] + pub fn get_frame_rate(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DoubleRange")] #[doc = "Change the `frameRate` field of this object."] @@ -142,10 +144,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn frame_rate(&mut self, val: &DoubleRange) -> &mut Self { - self.frame_rate_shim(val); - self - } + #[wasm_bindgen(method, setter = "frameRate")] + pub fn set_frame_rate(this: &MediaTrackCapabilities, val: &DoubleRange); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `groupId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "groupId")] + pub fn get_group_id(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `groupId` field of this object."] #[doc = ""] @@ -153,10 +162,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn group_id(&mut self, val: &str) -> &mut Self { - self.group_id_shim(val); - self - } + #[wasm_bindgen(method, setter = "groupId")] + pub fn set_group_id(this: &MediaTrackCapabilities, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Change the `height` field of this object."] @@ -165,10 +182,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn height(&mut self, val: &ULongRange) -> &mut Self { - self.height_shim(val); - self - } + #[wasm_bindgen(method, setter = "height")] + pub fn set_height(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[doc = "Get the `latency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DoubleRange`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "latency")] + pub fn get_latency(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DoubleRange")] #[doc = "Change the `latency` field of this object."] @@ -177,10 +202,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn latency(&mut self, val: &DoubleRange) -> &mut Self { - self.latency_shim(val); - self - } + #[wasm_bindgen(method, setter = "latency")] + pub fn set_latency(this: &MediaTrackCapabilities, val: &DoubleRange); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "noiseSuppression")] + pub fn get_noise_suppression(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `noiseSuppression` field of this object."] #[doc = ""] @@ -188,10 +220,17 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.noise_suppression_shim(val); - self - } + #[wasm_bindgen(method, setter = "noiseSuppression")] + pub fn set_noise_suppression(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `resizeMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "resizeMode")] + pub fn get_resize_mode(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `resizeMode` field of this object."] #[doc = ""] @@ -199,10 +238,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn resize_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.resize_mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "resizeMode")] + pub fn set_resize_mode(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Change the `sampleRate` field of this object."] @@ -211,10 +258,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn sample_rate(&mut self, val: &ULongRange) -> &mut Self { - self.sample_rate_shim(val); - self - } + #[wasm_bindgen(method, setter = "sampleRate")] + pub fn set_sample_rate(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Get the `sampleSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sampleSize")] + pub fn get_sample_size(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Change the `sampleSize` field of this object."] @@ -223,10 +278,18 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn sample_size(&mut self, val: &ULongRange) -> &mut Self { - self.sample_size_shim(val); - self - } + #[wasm_bindgen(method, setter = "sampleSize")] + pub fn set_sample_size(this: &MediaTrackCapabilities, val: &ULongRange); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`, `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &MediaTrackCapabilities) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Change the `width` field of this object."] @@ -235,8 +298,118 @@ impl MediaTrackCapabilities { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "width")] + pub fn set_width(this: &MediaTrackCapabilities, val: &ULongRange); +} +#[cfg(web_sys_unstable_apis)] +impl MediaTrackCapabilities { + #[doc = "Construct a new `MediaTrackCapabilities`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[deprecated = "Use `set_aspect_ratio()` instead."] + pub fn aspect_ratio(&mut self, val: &DoubleRange) -> &mut Self { + self.set_aspect_ratio(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_auto_gain_control()` instead."] + pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_auto_gain_control(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[deprecated = "Use `set_channel_count()` instead."] + pub fn channel_count(&mut self, val: &ULongRange) -> &mut Self { + self.set_channel_count(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_device_id()` instead."] + pub fn device_id(&mut self, val: &str) -> &mut Self { + self.set_device_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_echo_cancellation()` instead."] + pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_echo_cancellation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_facing_mode()` instead."] + pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_facing_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[deprecated = "Use `set_frame_rate()` instead."] + pub fn frame_rate(&mut self, val: &DoubleRange) -> &mut Self { + self.set_frame_rate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_group_id()` instead."] + pub fn group_id(&mut self, val: &str) -> &mut Self { + self.set_group_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[deprecated = "Use `set_height()` instead."] + pub fn height(&mut self, val: &ULongRange) -> &mut Self { + self.set_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DoubleRange")] + #[deprecated = "Use `set_latency()` instead."] + pub fn latency(&mut self, val: &DoubleRange) -> &mut Self { + self.set_latency(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_noise_suppression()` instead."] + pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_noise_suppression(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_resize_mode()` instead."] + pub fn resize_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_resize_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[deprecated = "Use `set_sample_rate()` instead."] + pub fn sample_rate(&mut self, val: &ULongRange) -> &mut Self { + self.set_sample_rate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[deprecated = "Use `set_sample_size()` instead."] + pub fn sample_size(&mut self, val: &ULongRange) -> &mut Self { + self.set_sample_size(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ULongRange")] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: &ULongRange) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs index 866fad34359..2624e64f81a 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs @@ -10,38 +10,166 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] pub type MediaTrackConstraintSet; + #[doc = "Get the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "autoGainControl")] + pub fn get_auto_gain_control(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "autoGainControl")] - fn auto_gain_control_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_auto_gain_control(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `browserWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "browserWindow")] + pub fn get_browser_window(this: &MediaTrackConstraintSet) -> Option; + #[doc = "Change the `browserWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "browserWindow")] - fn browser_window_shim(this: &MediaTrackConstraintSet, val: f64); + pub fn set_browser_window(this: &MediaTrackConstraintSet, val: f64); + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_channel_count(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_device_id(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "echoCancellation")] + pub fn get_echo_cancellation(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "echoCancellation")] - fn echo_cancellation_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_echo_cancellation(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "facingMode")] + pub fn get_facing_mode(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "facingMode")] - fn facing_mode_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_facing_mode(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "frameRate")] + pub fn get_frame_rate(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "frameRate")] - fn frame_rate_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_frame_rate(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_height(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `mediaSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "mediaSource")] + pub fn get_media_source(this: &MediaTrackConstraintSet) -> Option; + #[doc = "Change the `mediaSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "mediaSource")] - fn media_source_shim(this: &MediaTrackConstraintSet, val: &str); + pub fn set_media_source(this: &MediaTrackConstraintSet, val: &str); + #[doc = "Get the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "noiseSuppression")] + pub fn get_noise_suppression(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "noiseSuppression")] - fn noise_suppression_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_noise_suppression(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `scrollWithPage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "scrollWithPage")] + pub fn get_scroll_with_page(this: &MediaTrackConstraintSet) -> Option; + #[doc = "Change the `scrollWithPage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "scrollWithPage")] - fn scroll_with_page_shim(this: &MediaTrackConstraintSet, val: bool); + pub fn set_scroll_with_page(this: &MediaTrackConstraintSet, val: bool); + #[doc = "Get the `viewportHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "viewportHeight")] + pub fn get_viewport_height(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "viewportHeight")] - fn viewport_height_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_height(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportOffsetX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "viewportOffsetX")] + pub fn get_viewport_offset_x(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportOffsetX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "viewportOffsetX")] - fn viewport_offset_x_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_offset_x(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportOffsetY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "viewportOffsetY")] + pub fn get_viewport_offset_y(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportOffsetY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "viewportOffsetY")] - fn viewport_offset_y_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_offset_y(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "viewportWidth")] + pub fn get_viewport_width(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "viewportWidth")] - fn viewport_width_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_width(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &MediaTrackConstraintSet) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); + pub fn set_width(this: &MediaTrackConstraintSet, val: &::wasm_bindgen::JsValue); } impl MediaTrackConstraintSet { #[doc = "Construct a new `MediaTrackConstraintSet`."] @@ -52,116 +180,84 @@ impl MediaTrackConstraintSet { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `autoGainControl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_auto_gain_control()` instead."] pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.auto_gain_control_shim(val); + self.set_auto_gain_control(val); self } - #[doc = "Change the `browserWindow` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_browser_window()` instead."] pub fn browser_window(&mut self, val: f64) -> &mut Self { - self.browser_window_shim(val); + self.set_browser_window(val); self } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } - #[doc = "Change the `deviceId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_device_id()` instead."] pub fn device_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.device_id_shim(val); + self.set_device_id(val); self } - #[doc = "Change the `echoCancellation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_echo_cancellation()` instead."] pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.echo_cancellation_shim(val); + self.set_echo_cancellation(val); self } - #[doc = "Change the `facingMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_facing_mode()` instead."] pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.facing_mode_shim(val); + self.set_facing_mode(val); self } - #[doc = "Change the `frameRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_frame_rate()` instead."] pub fn frame_rate(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.frame_rate_shim(val); + self.set_frame_rate(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `mediaSource` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_media_source()` instead."] pub fn media_source(&mut self, val: &str) -> &mut Self { - self.media_source_shim(val); + self.set_media_source(val); self } - #[doc = "Change the `noiseSuppression` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_noise_suppression()` instead."] pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.noise_suppression_shim(val); + self.set_noise_suppression(val); self } - #[doc = "Change the `scrollWithPage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_scroll_with_page()` instead."] pub fn scroll_with_page(&mut self, val: bool) -> &mut Self { - self.scroll_with_page_shim(val); + self.set_scroll_with_page(val); self } - #[doc = "Change the `viewportHeight` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_viewport_height()` instead."] pub fn viewport_height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_height_shim(val); + self.set_viewport_height(val); self } - #[doc = "Change the `viewportOffsetX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_viewport_offset_x()` instead."] pub fn viewport_offset_x(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_offset_x_shim(val); + self.set_viewport_offset_x(val); self } - #[doc = "Change the `viewportOffsetY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_viewport_offset_y()` instead."] pub fn viewport_offset_y(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_offset_y_shim(val); + self.set_viewport_offset_y(val); self } - #[doc = "Change the `viewportWidth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_viewport_width()` instead."] pub fn viewport_width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_width_shim(val); + self.set_viewport_width(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs index 8b89c26eef7..6d40272de64 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs @@ -10,40 +10,176 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] pub type MediaTrackConstraints; + #[doc = "Get the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "autoGainControl")] + pub fn get_auto_gain_control(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "autoGainControl")] - fn auto_gain_control_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_auto_gain_control(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `browserWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "browserWindow")] + pub fn get_browser_window(this: &MediaTrackConstraints) -> Option; + #[doc = "Change the `browserWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "browserWindow")] - fn browser_window_shim(this: &MediaTrackConstraints, val: f64); + pub fn set_browser_window(this: &MediaTrackConstraints, val: f64); + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_channel_count(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_device_id(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "echoCancellation")] + pub fn get_echo_cancellation(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "echoCancellation")] - fn echo_cancellation_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_echo_cancellation(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "facingMode")] + pub fn get_facing_mode(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "facingMode")] - fn facing_mode_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_facing_mode(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "frameRate")] + pub fn get_frame_rate(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "frameRate")] - fn frame_rate_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_frame_rate(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_height(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `mediaSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "mediaSource")] + pub fn get_media_source(this: &MediaTrackConstraints) -> Option; + #[doc = "Change the `mediaSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "mediaSource")] - fn media_source_shim(this: &MediaTrackConstraints, val: &str); + pub fn set_media_source(this: &MediaTrackConstraints, val: &str); + #[doc = "Get the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "noiseSuppression")] + pub fn get_noise_suppression(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "noiseSuppression")] - fn noise_suppression_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_noise_suppression(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `scrollWithPage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "scrollWithPage")] + pub fn get_scroll_with_page(this: &MediaTrackConstraints) -> Option; + #[doc = "Change the `scrollWithPage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "scrollWithPage")] - fn scroll_with_page_shim(this: &MediaTrackConstraints, val: bool); + pub fn set_scroll_with_page(this: &MediaTrackConstraints, val: bool); + #[doc = "Get the `viewportHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "viewportHeight")] + pub fn get_viewport_height(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "viewportHeight")] - fn viewport_height_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_height(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportOffsetX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "viewportOffsetX")] + pub fn get_viewport_offset_x(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportOffsetX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "viewportOffsetX")] - fn viewport_offset_x_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_offset_x(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportOffsetY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "viewportOffsetY")] + pub fn get_viewport_offset_y(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportOffsetY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "viewportOffsetY")] - fn viewport_offset_y_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_offset_y(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `viewportWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "viewportWidth")] + pub fn get_viewport_width(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `viewportWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "viewportWidth")] - fn viewport_width_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_viewport_width(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &MediaTrackConstraints) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_width(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `advanced` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[wasm_bindgen(method, getter = "advanced")] + pub fn get_advanced(this: &MediaTrackConstraints) -> Option<::js_sys::Array>; + #[doc = "Change the `advanced` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, setter = "advanced")] - fn advanced_shim(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); + pub fn set_advanced(this: &MediaTrackConstraints, val: &::wasm_bindgen::JsValue); } impl MediaTrackConstraints { #[doc = "Construct a new `MediaTrackConstraints`."] @@ -54,123 +190,89 @@ impl MediaTrackConstraints { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `autoGainControl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_auto_gain_control()` instead."] pub fn auto_gain_control(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.auto_gain_control_shim(val); + self.set_auto_gain_control(val); self } - #[doc = "Change the `browserWindow` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_browser_window()` instead."] pub fn browser_window(&mut self, val: f64) -> &mut Self { - self.browser_window_shim(val); + self.set_browser_window(val); self } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } - #[doc = "Change the `deviceId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_device_id()` instead."] pub fn device_id(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.device_id_shim(val); + self.set_device_id(val); self } - #[doc = "Change the `echoCancellation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_echo_cancellation()` instead."] pub fn echo_cancellation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.echo_cancellation_shim(val); + self.set_echo_cancellation(val); self } - #[doc = "Change the `facingMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_facing_mode()` instead."] pub fn facing_mode(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.facing_mode_shim(val); + self.set_facing_mode(val); self } - #[doc = "Change the `frameRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_frame_rate()` instead."] pub fn frame_rate(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.frame_rate_shim(val); + self.set_frame_rate(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `mediaSource` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_media_source()` instead."] pub fn media_source(&mut self, val: &str) -> &mut Self { - self.media_source_shim(val); + self.set_media_source(val); self } - #[doc = "Change the `noiseSuppression` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_noise_suppression()` instead."] pub fn noise_suppression(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.noise_suppression_shim(val); + self.set_noise_suppression(val); self } - #[doc = "Change the `scrollWithPage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_scroll_with_page()` instead."] pub fn scroll_with_page(&mut self, val: bool) -> &mut Self { - self.scroll_with_page_shim(val); + self.set_scroll_with_page(val); self } - #[doc = "Change the `viewportHeight` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_viewport_height()` instead."] pub fn viewport_height(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_height_shim(val); + self.set_viewport_height(val); self } - #[doc = "Change the `viewportOffsetX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_viewport_offset_x()` instead."] pub fn viewport_offset_x(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_offset_x_shim(val); + self.set_viewport_offset_x(val); self } - #[doc = "Change the `viewportOffsetY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_viewport_offset_y()` instead."] pub fn viewport_offset_y(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_offset_y_shim(val); + self.set_viewport_offset_y(val); self } - #[doc = "Change the `viewportWidth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_viewport_width()` instead."] pub fn viewport_width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.viewport_width_shim(val); + self.set_viewport_width(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } - #[doc = "Change the `advanced` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] + #[deprecated = "Use `set_advanced()` instead."] pub fn advanced(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.advanced_shim(val); + self.set_advanced(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackSettings.rs b/crates/web-sys/src/features/gen_MediaTrackSettings.rs index 3bd4e245aac..455fcad4822 100644 --- a/crates/web-sys/src/features/gen_MediaTrackSettings.rs +++ b/crates/web-sys/src/features/gen_MediaTrackSettings.rs @@ -10,24 +10,96 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] pub type MediaTrackSettings; + #[doc = "Get the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "autoGainControl")] + pub fn get_auto_gain_control(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "autoGainControl")] - fn auto_gain_control_shim(this: &MediaTrackSettings, val: bool); + pub fn set_auto_gain_control(this: &MediaTrackSettings, val: bool); + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &MediaTrackSettings, val: i32); + pub fn set_channel_count(this: &MediaTrackSettings, val: i32); + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &MediaTrackSettings, val: &str); + pub fn set_device_id(this: &MediaTrackSettings, val: &str); + #[doc = "Get the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "echoCancellation")] + pub fn get_echo_cancellation(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "echoCancellation")] - fn echo_cancellation_shim(this: &MediaTrackSettings, val: bool); + pub fn set_echo_cancellation(this: &MediaTrackSettings, val: bool); + #[doc = "Get the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "facingMode")] + pub fn get_facing_mode(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "facingMode")] - fn facing_mode_shim(this: &MediaTrackSettings, val: &str); + pub fn set_facing_mode(this: &MediaTrackSettings, val: &str); + #[doc = "Get the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "frameRate")] + pub fn get_frame_rate(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "frameRate")] - fn frame_rate_shim(this: &MediaTrackSettings, val: f64); + pub fn set_frame_rate(this: &MediaTrackSettings, val: f64); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &MediaTrackSettings, val: i32); + pub fn set_height(this: &MediaTrackSettings, val: i32); + #[doc = "Get the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "noiseSuppression")] + pub fn get_noise_suppression(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "noiseSuppression")] - fn noise_suppression_shim(this: &MediaTrackSettings, val: bool); + pub fn set_noise_suppression(this: &MediaTrackSettings, val: bool); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &MediaTrackSettings) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &MediaTrackSettings, val: i32); + pub fn set_width(this: &MediaTrackSettings, val: i32); } impl MediaTrackSettings { #[doc = "Construct a new `MediaTrackSettings`."] @@ -38,67 +110,49 @@ impl MediaTrackSettings { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `autoGainControl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_auto_gain_control()` instead."] pub fn auto_gain_control(&mut self, val: bool) -> &mut Self { - self.auto_gain_control_shim(val); + self.set_auto_gain_control(val); self } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: i32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } - #[doc = "Change the `deviceId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_device_id()` instead."] pub fn device_id(&mut self, val: &str) -> &mut Self { - self.device_id_shim(val); + self.set_device_id(val); self } - #[doc = "Change the `echoCancellation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_echo_cancellation()` instead."] pub fn echo_cancellation(&mut self, val: bool) -> &mut Self { - self.echo_cancellation_shim(val); + self.set_echo_cancellation(val); self } - #[doc = "Change the `facingMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_facing_mode()` instead."] pub fn facing_mode(&mut self, val: &str) -> &mut Self { - self.facing_mode_shim(val); + self.set_facing_mode(val); self } - #[doc = "Change the `frameRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_frame_rate()` instead."] pub fn frame_rate(&mut self, val: f64) -> &mut Self { - self.frame_rate_shim(val); + self.set_frame_rate(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: i32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `noiseSuppression` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_noise_suppression()` instead."] pub fn noise_suppression(&mut self, val: bool) -> &mut Self { - self.noise_suppression_shim(val); + self.set_noise_suppression(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: i32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs b/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs index 1cf7fc77567..6e5cc4cc683 100644 --- a/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaTrackSupportedConstraints.rs @@ -10,36 +10,156 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] pub type MediaTrackSupportedConstraints; + #[doc = "Get the `aspectRatio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "aspectRatio")] + pub fn get_aspect_ratio(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `aspectRatio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "aspectRatio")] - fn aspect_ratio_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_aspect_ratio(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "autoGainControl")] + pub fn get_auto_gain_control(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `autoGainControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "autoGainControl")] - fn auto_gain_control_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_auto_gain_control(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_channel_count(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "deviceId")] + pub fn get_device_id(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `deviceId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "deviceId")] - fn device_id_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_device_id(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "echoCancellation")] + pub fn get_echo_cancellation(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `echoCancellation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "echoCancellation")] - fn echo_cancellation_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_echo_cancellation(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "facingMode")] + pub fn get_facing_mode(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `facingMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "facingMode")] - fn facing_mode_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_facing_mode(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "frameRate")] + pub fn get_frame_rate(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `frameRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "frameRate")] - fn frame_rate_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_frame_rate(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `groupId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "groupId")] + pub fn get_group_id(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `groupId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "groupId")] - fn group_id_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_group_id(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_height(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `latency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "latency")] + pub fn get_latency(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `latency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "latency")] - fn latency_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_latency(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "noiseSuppression")] + pub fn get_noise_suppression(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `noiseSuppression` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "noiseSuppression")] - fn noise_suppression_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_noise_suppression(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_sample_rate(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `sampleSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "sampleSize")] + pub fn get_sample_size(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `sampleSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "sampleSize")] - fn sample_size_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_sample_size(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `volume` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "volume")] + pub fn get_volume(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `volume` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "volume")] - fn volume_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_volume(this: &MediaTrackSupportedConstraints, val: bool); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &MediaTrackSupportedConstraints) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &MediaTrackSupportedConstraints, val: bool); + pub fn set_width(this: &MediaTrackSupportedConstraints, val: bool); } impl MediaTrackSupportedConstraints { #[doc = "Construct a new `MediaTrackSupportedConstraints`."] @@ -50,109 +170,79 @@ impl MediaTrackSupportedConstraints { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `aspectRatio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_aspect_ratio()` instead."] pub fn aspect_ratio(&mut self, val: bool) -> &mut Self { - self.aspect_ratio_shim(val); + self.set_aspect_ratio(val); self } - #[doc = "Change the `autoGainControl` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_auto_gain_control()` instead."] pub fn auto_gain_control(&mut self, val: bool) -> &mut Self { - self.auto_gain_control_shim(val); + self.set_auto_gain_control(val); self } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: bool) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } - #[doc = "Change the `deviceId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_device_id()` instead."] pub fn device_id(&mut self, val: bool) -> &mut Self { - self.device_id_shim(val); + self.set_device_id(val); self } - #[doc = "Change the `echoCancellation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_echo_cancellation()` instead."] pub fn echo_cancellation(&mut self, val: bool) -> &mut Self { - self.echo_cancellation_shim(val); + self.set_echo_cancellation(val); self } - #[doc = "Change the `facingMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_facing_mode()` instead."] pub fn facing_mode(&mut self, val: bool) -> &mut Self { - self.facing_mode_shim(val); + self.set_facing_mode(val); self } - #[doc = "Change the `frameRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_frame_rate()` instead."] pub fn frame_rate(&mut self, val: bool) -> &mut Self { - self.frame_rate_shim(val); + self.set_frame_rate(val); self } - #[doc = "Change the `groupId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_group_id()` instead."] pub fn group_id(&mut self, val: bool) -> &mut Self { - self.group_id_shim(val); + self.set_group_id(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: bool) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `latency` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_latency()` instead."] pub fn latency(&mut self, val: bool) -> &mut Self { - self.latency_shim(val); + self.set_latency(val); self } - #[doc = "Change the `noiseSuppression` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_noise_suppression()` instead."] pub fn noise_suppression(&mut self, val: bool) -> &mut Self { - self.noise_suppression_shim(val); + self.set_noise_suppression(val); self } - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: bool) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } - #[doc = "Change the `sampleSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_sample_size()` instead."] pub fn sample_size(&mut self, val: bool) -> &mut Self { - self.sample_size_shim(val); + self.set_sample_size(val); self } - #[doc = "Change the `volume` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_volume()` instead."] pub fn volume(&mut self, val: bool) -> &mut Self { - self.volume_shim(val); + self.set_volume(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaTrackSupportedConstraints`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: bool) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryAttribution.rs b/crates/web-sys/src/features/gen_MemoryAttribution.rs index 9fdedda1113..be7056aa458 100644 --- a/crates/web-sys/src/features/gen_MemoryAttribution.rs +++ b/crates/web-sys/src/features/gen_MemoryAttribution.rs @@ -14,13 +14,62 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryAttribution; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MemoryAttributionContainer")] + #[doc = "Get the `container` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`, `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "container")] + pub fn get_container(this: &MemoryAttribution) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MemoryAttributionContainer")] + #[doc = "Change the `container` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`, `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "container")] - fn container_shim(this: &MemoryAttribution, val: &MemoryAttributionContainer); + pub fn set_container(this: &MemoryAttribution, val: &MemoryAttributionContainer); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "scope")] + pub fn get_scope(this: &MemoryAttribution) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "scope")] - fn scope_shim(this: &MemoryAttribution, val: &str); + pub fn set_scope(this: &MemoryAttribution, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &MemoryAttribution) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &MemoryAttribution, val: &str); + pub fn set_url(this: &MemoryAttribution, val: &str); } #[cfg(web_sys_unstable_apis)] impl MemoryAttribution { @@ -37,36 +86,21 @@ impl MemoryAttribution { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "MemoryAttributionContainer")] - #[doc = "Change the `container` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`, `MemoryAttributionContainer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_container()` instead."] pub fn container(&mut self, val: &MemoryAttributionContainer) -> &mut Self { - self.container_shim(val); + self.set_container(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `scope` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_scope()` instead."] pub fn scope(&mut self, val: &str) -> &mut Self { - self.scope_shim(val); + self.set_scope(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryAttribution`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: &str) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs index 0dfe8ce12ea..c7a6bb4c1e8 100644 --- a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs +++ b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryAttributionContainer; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &MemoryAttributionContainer) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &MemoryAttributionContainer, val: &str); + pub fn set_id(this: &MemoryAttributionContainer, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `src` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "src")] + pub fn get_src(this: &MemoryAttributionContainer) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `src` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "src")] - fn src_shim(this: &MemoryAttributionContainer, val: &str); + pub fn set_src(this: &MemoryAttributionContainer, val: &str); } #[cfg(web_sys_unstable_apis)] impl MemoryAttributionContainer { @@ -33,25 +65,15 @@ impl MemoryAttributionContainer { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `src` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryAttributionContainer`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_src()` instead."] pub fn src(&mut self, val: &str) -> &mut Self { - self.src_shim(val); + self.set_src(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs b/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs index 05592cc877c..97ad8cecf9d 100644 --- a/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs +++ b/crates/web-sys/src/features/gen_MemoryBreakdownEntry.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryBreakdownEntry; - #[wasm_bindgen(method, setter = "attribution")] - fn attribution_shim(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "bytes")] - fn bytes_shim(this: &MemoryBreakdownEntry, val: f64); - #[wasm_bindgen(method, setter = "types")] - fn types_shim(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl MemoryBreakdownEntry { - #[doc = "Construct a new `MemoryBreakdownEntry`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attribution` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MemoryBreakdownEntry`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "attribution")] + pub fn get_attribution(this: &MemoryBreakdownEntry) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attribution` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl MemoryBreakdownEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn attribution(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.attribution_shim(val); - self - } + #[wasm_bindgen(method, setter = "attribution")] + pub fn set_attribution(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryBreakdownEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytes")] + pub fn get_bytes(this: &MemoryBreakdownEntry) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytes` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl MemoryBreakdownEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes(&mut self, val: f64) -> &mut Self { - self.bytes_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytes")] + pub fn set_bytes(this: &MemoryBreakdownEntry, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryBreakdownEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "types")] + pub fn get_types(this: &MemoryBreakdownEntry) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `types` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl MemoryBreakdownEntry { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "types")] + pub fn set_types(this: &MemoryBreakdownEntry, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl MemoryBreakdownEntry { + #[doc = "Construct a new `MemoryBreakdownEntry`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryBreakdownEntry`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attribution()` instead."] + pub fn attribution(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attribution(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes()` instead."] + pub fn bytes(&mut self, val: f64) -> &mut Self { + self.set_bytes(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_types()` instead."] pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.types_shim(val); + self.set_types(val); self } } diff --git a/crates/web-sys/src/features/gen_MemoryMeasurement.rs b/crates/web-sys/src/features/gen_MemoryMeasurement.rs index b3bbfaca883..041a0e64493 100644 --- a/crates/web-sys/src/features/gen_MemoryMeasurement.rs +++ b/crates/web-sys/src/features/gen_MemoryMeasurement.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type MemoryMeasurement; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `breakdown` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "breakdown")] + pub fn get_breakdown(this: &MemoryMeasurement) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `breakdown` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "breakdown")] - fn breakdown_shim(this: &MemoryMeasurement, val: &::wasm_bindgen::JsValue); + pub fn set_breakdown(this: &MemoryMeasurement, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytes")] + pub fn get_bytes(this: &MemoryMeasurement) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bytes")] - fn bytes_shim(this: &MemoryMeasurement, val: f64); + pub fn set_bytes(this: &MemoryMeasurement, val: f64); } #[cfg(web_sys_unstable_apis)] impl MemoryMeasurement { @@ -33,25 +65,15 @@ impl MemoryMeasurement { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `breakdown` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_breakdown()` instead."] pub fn breakdown(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.breakdown_shim(val); + self.set_breakdown(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bytes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MemoryMeasurement`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bytes()` instead."] pub fn bytes(&mut self, val: f64) -> &mut Self { - self.bytes_shim(val); + self.set_bytes(val); self } } diff --git a/crates/web-sys/src/features/gen_MessageEventInit.rs b/crates/web-sys/src/features/gen_MessageEventInit.rs index 0e5381f8cc9..82a6cfe5cec 100644 --- a/crates/web-sys/src/features/gen_MessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MessageEventInit.rs @@ -10,22 +10,86 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] pub type MessageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MessageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MessageEventInit, val: bool); + pub fn set_bubbles(this: &MessageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MessageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MessageEventInit, val: bool); + pub fn set_cancelable(this: &MessageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MessageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MessageEventInit, val: bool); + pub fn set_composed(this: &MessageEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &MessageEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `lastEventId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "lastEventId")] + pub fn get_last_event_id(this: &MessageEventInit) -> Option; + #[doc = "Change the `lastEventId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "lastEventId")] - fn last_event_id_shim(this: &MessageEventInit, val: &str); + pub fn set_last_event_id(this: &MessageEventInit, val: &str); + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &MessageEventInit) -> Option; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &MessageEventInit, val: &str); + pub fn set_origin(this: &MessageEventInit, val: &str); + #[doc = "Get the `ports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "ports")] + pub fn get_ports(this: &MessageEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `ports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "ports")] - fn ports_shim(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_ports(this: &MessageEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &MessageEventInit) -> Option<::js_sys::Object>; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &MessageEventInit, val: Option<&::js_sys::Object>); + pub fn set_source(this: &MessageEventInit, val: Option<&::js_sys::Object>); } impl MessageEventInit { #[doc = "Construct a new `MessageEventInit`."] @@ -36,60 +100,44 @@ impl MessageEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } - #[doc = "Change the `lastEventId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_last_event_id()` instead."] pub fn last_event_id(&mut self, val: &str) -> &mut Self { - self.last_event_id_shim(val); + self.set_last_event_id(val); self } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &str) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `ports` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_ports()` instead."] pub fn ports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ports_shim(val); + self.set_ports(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs b/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs index 77e2f4b71df..97410953386 100644 --- a/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiConnectionEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] pub type MidiConnectionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MidiConnectionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MidiConnectionEventInit, val: bool); + pub fn set_bubbles(this: &MidiConnectionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MidiConnectionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MidiConnectionEventInit, val: bool); + pub fn set_cancelable(this: &MidiConnectionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MidiConnectionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MidiConnectionEventInit, val: bool); + pub fn set_composed(this: &MidiConnectionEventInit, val: bool); #[cfg(feature = "MidiPort")] + #[doc = "Get the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`, `MidiPort`*"] + #[wasm_bindgen(method, getter = "port")] + pub fn get_port(this: &MidiConnectionEventInit) -> Option; + #[cfg(feature = "MidiPort")] + #[doc = "Change the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`, `MidiPort`*"] #[wasm_bindgen(method, setter = "port")] - fn port_shim(this: &MidiConnectionEventInit, val: Option<&MidiPort>); + pub fn set_port(this: &MidiConnectionEventInit, val: Option<&MidiPort>); } impl MidiConnectionEventInit { #[doc = "Construct a new `MidiConnectionEventInit`."] @@ -29,33 +62,25 @@ impl MidiConnectionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "MidiPort")] - #[doc = "Change the `port` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiConnectionEventInit`, `MidiPort`*"] + #[deprecated = "Use `set_port()` instead."] pub fn port(&mut self, val: Option<&MidiPort>) -> &mut Self { - self.port_shim(val); + self.set_port(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs index da581fa01f1..9ea620bda4a 100644 --- a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] pub type MidiMessageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MidiMessageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MidiMessageEventInit, val: bool); + pub fn set_bubbles(this: &MidiMessageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MidiMessageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MidiMessageEventInit, val: bool); + pub fn set_cancelable(this: &MidiMessageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MidiMessageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MidiMessageEventInit, val: bool); + pub fn set_composed(this: &MidiMessageEventInit, val: bool); } impl MidiMessageEventInit { #[doc = "Construct a new `MidiMessageEventInit`."] @@ -26,25 +50,19 @@ impl MidiMessageEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_MidiOptions.rs b/crates/web-sys/src/features/gen_MidiOptions.rs index bb9a50ece05..3404891355a 100644 --- a/crates/web-sys/src/features/gen_MidiOptions.rs +++ b/crates/web-sys/src/features/gen_MidiOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] pub type MidiOptions; + #[doc = "Get the `software` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] + #[wasm_bindgen(method, getter = "software")] + pub fn get_software(this: &MidiOptions) -> Option; + #[doc = "Change the `software` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] #[wasm_bindgen(method, setter = "software")] - fn software_shim(this: &MidiOptions, val: bool); + pub fn set_software(this: &MidiOptions, val: bool); + #[doc = "Get the `sysex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] + #[wasm_bindgen(method, getter = "sysex")] + pub fn get_sysex(this: &MidiOptions) -> Option; + #[doc = "Change the `sysex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] #[wasm_bindgen(method, setter = "sysex")] - fn sysex_shim(this: &MidiOptions, val: bool); + pub fn set_sysex(this: &MidiOptions, val: bool); } impl MidiOptions { #[doc = "Construct a new `MidiOptions`."] @@ -24,18 +40,14 @@ impl MidiOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `software` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] + #[deprecated = "Use `set_software()` instead."] pub fn software(&mut self, val: bool) -> &mut Self { - self.software_shim(val); + self.set_software(val); self } - #[doc = "Change the `sysex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MidiOptions`*"] + #[deprecated = "Use `set_sysex()` instead."] pub fn sysex(&mut self, val: bool) -> &mut Self { - self.sysex_shim(val); + self.set_sysex(val); self } } diff --git a/crates/web-sys/src/features/gen_MouseEventInit.rs b/crates/web-sys/src/features/gen_MouseEventInit.rs index 340e3bddebd..61220cd7536 100644 --- a/crates/web-sys/src/features/gen_MouseEventInit.rs +++ b/crates/web-sys/src/features/gen_MouseEventInit.rs @@ -10,62 +10,280 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] pub type MouseEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &MouseEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &MouseEventInit, val: bool); + pub fn set_bubbles(this: &MouseEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &MouseEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &MouseEventInit, val: bool); + pub fn set_cancelable(this: &MouseEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &MouseEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &MouseEventInit, val: bool); + pub fn set_composed(this: &MouseEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &MouseEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &MouseEventInit, val: i32); + pub fn set_detail(this: &MouseEventInit, val: i32); + #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &MouseEventInit) -> Option; #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &MouseEventInit, val: Option<&Window>); + pub fn set_view(this: &MouseEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &MouseEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &MouseEventInit, val: bool); + pub fn set_alt_key(this: &MouseEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &MouseEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &MouseEventInit, val: bool); + pub fn set_ctrl_key(this: &MouseEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &MouseEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &MouseEventInit, val: bool); + pub fn set_meta_key(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_fn(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_num_lock(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_os(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_symbol(this: &MouseEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &MouseEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &MouseEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &MouseEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &MouseEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &MouseEventInit, val: bool); + pub fn set_shift_key(this: &MouseEventInit, val: bool); + #[doc = "Get the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "button")] + pub fn get_button(this: &MouseEventInit) -> Option; + #[doc = "Change the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "button")] - fn button_shim(this: &MouseEventInit, val: i16); + pub fn set_button(this: &MouseEventInit, val: i16); + #[doc = "Get the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "buttons")] + pub fn get_buttons(this: &MouseEventInit) -> Option; + #[doc = "Change the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "buttons")] - fn buttons_shim(this: &MouseEventInit, val: u16); + pub fn set_buttons(this: &MouseEventInit, val: u16); + #[doc = "Get the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "clientX")] + pub fn get_client_x(this: &MouseEventInit) -> Option; + #[doc = "Change the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "clientX")] - fn client_x_shim(this: &MouseEventInit, val: i32); + pub fn set_client_x(this: &MouseEventInit, val: i32); + #[doc = "Get the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "clientY")] + pub fn get_client_y(this: &MouseEventInit) -> Option; + #[doc = "Change the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "clientY")] - fn client_y_shim(this: &MouseEventInit, val: i32); + pub fn set_client_y(this: &MouseEventInit, val: i32); + #[doc = "Get the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "movementX")] + pub fn get_movement_x(this: &MouseEventInit) -> Option; + #[doc = "Change the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "movementX")] - fn movement_x_shim(this: &MouseEventInit, val: i32); + pub fn set_movement_x(this: &MouseEventInit, val: i32); + #[doc = "Get the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "movementY")] + pub fn get_movement_y(this: &MouseEventInit) -> Option; + #[doc = "Change the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "movementY")] - fn movement_y_shim(this: &MouseEventInit, val: i32); + pub fn set_movement_y(this: &MouseEventInit, val: i32); + #[cfg(feature = "EventTarget")] + #[doc = "Get the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "relatedTarget")] + pub fn get_related_target(this: &MouseEventInit) -> Option; #[cfg(feature = "EventTarget")] + #[doc = "Change the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `MouseEventInit`*"] #[wasm_bindgen(method, setter = "relatedTarget")] - fn related_target_shim(this: &MouseEventInit, val: Option<&EventTarget>); + pub fn set_related_target(this: &MouseEventInit, val: Option<&EventTarget>); + #[doc = "Get the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "screenX")] + pub fn get_screen_x(this: &MouseEventInit) -> Option; + #[doc = "Change the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "screenX")] - fn screen_x_shim(this: &MouseEventInit, val: i32); + pub fn set_screen_x(this: &MouseEventInit, val: i32); + #[doc = "Get the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[wasm_bindgen(method, getter = "screenY")] + pub fn get_screen_y(this: &MouseEventInit) -> Option; + #[doc = "Change the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] #[wasm_bindgen(method, setter = "screenY")] - fn screen_y_shim(this: &MouseEventInit, val: i32); + pub fn set_screen_y(this: &MouseEventInit, val: i32); } impl MouseEventInit { #[doc = "Construct a new `MouseEventInit`."] @@ -76,195 +294,141 @@ impl MouseEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_button()` instead."] pub fn button(&mut self, val: i16) -> &mut Self { - self.button_shim(val); + self.set_button(val); self } - #[doc = "Change the `buttons` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_buttons()` instead."] pub fn buttons(&mut self, val: u16) -> &mut Self { - self.buttons_shim(val); + self.set_buttons(val); self } - #[doc = "Change the `clientX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_client_x()` instead."] pub fn client_x(&mut self, val: i32) -> &mut Self { - self.client_x_shim(val); + self.set_client_x(val); self } - #[doc = "Change the `clientY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_client_y()` instead."] pub fn client_y(&mut self, val: i32) -> &mut Self { - self.client_y_shim(val); + self.set_client_y(val); self } - #[doc = "Change the `movementX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_movement_x()` instead."] pub fn movement_x(&mut self, val: i32) -> &mut Self { - self.movement_x_shim(val); + self.set_movement_x(val); self } - #[doc = "Change the `movementY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_movement_y()` instead."] pub fn movement_y(&mut self, val: i32) -> &mut Self { - self.movement_y_shim(val); + self.set_movement_y(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `relatedTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `MouseEventInit`*"] + #[deprecated = "Use `set_related_target()` instead."] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - self.related_target_shim(val); + self.set_related_target(val); self } - #[doc = "Change the `screenX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_screen_x()` instead."] pub fn screen_x(&mut self, val: i32) -> &mut Self { - self.screen_x_shim(val); + self.set_screen_x(val); self } - #[doc = "Change the `screenY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MouseEventInit`*"] + #[deprecated = "Use `set_screen_y()` instead."] pub fn screen_y(&mut self, val: i32) -> &mut Self { - self.screen_y_shim(val); + self.set_screen_y(val); self } } diff --git a/crates/web-sys/src/features/gen_MutationObserverInit.rs b/crates/web-sys/src/features/gen_MutationObserverInit.rs index 35251f2f6e8..69ac7cf001d 100644 --- a/crates/web-sys/src/features/gen_MutationObserverInit.rs +++ b/crates/web-sys/src/features/gen_MutationObserverInit.rs @@ -10,24 +10,96 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] pub type MutationObserverInit; + #[doc = "Get the `animations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "animations")] + pub fn get_animations(this: &MutationObserverInit) -> Option; + #[doc = "Change the `animations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "animations")] - fn animations_shim(this: &MutationObserverInit, val: bool); + pub fn set_animations(this: &MutationObserverInit, val: bool); + #[doc = "Get the `attributeFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "attributeFilter")] + pub fn get_attribute_filter(this: &MutationObserverInit) -> Option<::js_sys::Array>; + #[doc = "Change the `attributeFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "attributeFilter")] - fn attribute_filter_shim(this: &MutationObserverInit, val: &::wasm_bindgen::JsValue); + pub fn set_attribute_filter(this: &MutationObserverInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `attributeOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "attributeOldValue")] + pub fn get_attribute_old_value(this: &MutationObserverInit) -> Option; + #[doc = "Change the `attributeOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "attributeOldValue")] - fn attribute_old_value_shim(this: &MutationObserverInit, val: bool); + pub fn set_attribute_old_value(this: &MutationObserverInit, val: bool); + #[doc = "Get the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "attributes")] + pub fn get_attributes(this: &MutationObserverInit) -> Option; + #[doc = "Change the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "attributes")] - fn attributes_shim(this: &MutationObserverInit, val: bool); + pub fn set_attributes(this: &MutationObserverInit, val: bool); + #[doc = "Get the `characterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "characterData")] + pub fn get_character_data(this: &MutationObserverInit) -> Option; + #[doc = "Change the `characterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "characterData")] - fn character_data_shim(this: &MutationObserverInit, val: bool); + pub fn set_character_data(this: &MutationObserverInit, val: bool); + #[doc = "Get the `characterDataOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "characterDataOldValue")] + pub fn get_character_data_old_value(this: &MutationObserverInit) -> Option; + #[doc = "Change the `characterDataOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "characterDataOldValue")] - fn character_data_old_value_shim(this: &MutationObserverInit, val: bool); + pub fn set_character_data_old_value(this: &MutationObserverInit, val: bool); + #[doc = "Get the `childList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "childList")] + pub fn get_child_list(this: &MutationObserverInit) -> Option; + #[doc = "Change the `childList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "childList")] - fn child_list_shim(this: &MutationObserverInit, val: bool); + pub fn set_child_list(this: &MutationObserverInit, val: bool); + #[doc = "Get the `nativeAnonymousChildList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "nativeAnonymousChildList")] + pub fn get_native_anonymous_child_list(this: &MutationObserverInit) -> Option; + #[doc = "Change the `nativeAnonymousChildList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "nativeAnonymousChildList")] - fn native_anonymous_child_list_shim(this: &MutationObserverInit, val: bool); + pub fn set_native_anonymous_child_list(this: &MutationObserverInit, val: bool); + #[doc = "Get the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[wasm_bindgen(method, getter = "subtree")] + pub fn get_subtree(this: &MutationObserverInit) -> Option; + #[doc = "Change the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] #[wasm_bindgen(method, setter = "subtree")] - fn subtree_shim(this: &MutationObserverInit, val: bool); + pub fn set_subtree(this: &MutationObserverInit, val: bool); } impl MutationObserverInit { #[doc = "Construct a new `MutationObserverInit`."] @@ -38,67 +110,49 @@ impl MutationObserverInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `animations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_animations()` instead."] pub fn animations(&mut self, val: bool) -> &mut Self { - self.animations_shim(val); + self.set_animations(val); self } - #[doc = "Change the `attributeFilter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_attribute_filter()` instead."] pub fn attribute_filter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.attribute_filter_shim(val); + self.set_attribute_filter(val); self } - #[doc = "Change the `attributeOldValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_attribute_old_value()` instead."] pub fn attribute_old_value(&mut self, val: bool) -> &mut Self { - self.attribute_old_value_shim(val); + self.set_attribute_old_value(val); self } - #[doc = "Change the `attributes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_attributes()` instead."] pub fn attributes(&mut self, val: bool) -> &mut Self { - self.attributes_shim(val); + self.set_attributes(val); self } - #[doc = "Change the `characterData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_character_data()` instead."] pub fn character_data(&mut self, val: bool) -> &mut Self { - self.character_data_shim(val); + self.set_character_data(val); self } - #[doc = "Change the `characterDataOldValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_character_data_old_value()` instead."] pub fn character_data_old_value(&mut self, val: bool) -> &mut Self { - self.character_data_old_value_shim(val); + self.set_character_data_old_value(val); self } - #[doc = "Change the `childList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_child_list()` instead."] pub fn child_list(&mut self, val: bool) -> &mut Self { - self.child_list_shim(val); + self.set_child_list(val); self } - #[doc = "Change the `nativeAnonymousChildList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_native_anonymous_child_list()` instead."] pub fn native_anonymous_child_list(&mut self, val: bool) -> &mut Self { - self.native_anonymous_child_list_shim(val); + self.set_native_anonymous_child_list(val); self } - #[doc = "Change the `subtree` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObserverInit`*"] + #[deprecated = "Use `set_subtree()` instead."] pub fn subtree(&mut self, val: bool) -> &mut Self { - self.subtree_shim(val); + self.set_subtree(val); self } } diff --git a/crates/web-sys/src/features/gen_MutationObservingInfo.rs b/crates/web-sys/src/features/gen_MutationObservingInfo.rs index ebe00cccdf0..6d6aceb0514 100644 --- a/crates/web-sys/src/features/gen_MutationObservingInfo.rs +++ b/crates/web-sys/src/features/gen_MutationObservingInfo.rs @@ -10,27 +10,108 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] pub type MutationObservingInfo; + #[doc = "Get the `animations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "animations")] + pub fn get_animations(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `animations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "animations")] - fn animations_shim(this: &MutationObservingInfo, val: bool); + pub fn set_animations(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `attributeFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "attributeFilter")] + pub fn get_attribute_filter(this: &MutationObservingInfo) -> Option<::js_sys::Array>; + #[doc = "Change the `attributeFilter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "attributeFilter")] - fn attribute_filter_shim(this: &MutationObservingInfo, val: &::wasm_bindgen::JsValue); + pub fn set_attribute_filter(this: &MutationObservingInfo, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `attributeOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "attributeOldValue")] + pub fn get_attribute_old_value(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `attributeOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "attributeOldValue")] - fn attribute_old_value_shim(this: &MutationObservingInfo, val: bool); + pub fn set_attribute_old_value(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "attributes")] + pub fn get_attributes(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `attributes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "attributes")] - fn attributes_shim(this: &MutationObservingInfo, val: bool); + pub fn set_attributes(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `characterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "characterData")] + pub fn get_character_data(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `characterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "characterData")] - fn character_data_shim(this: &MutationObservingInfo, val: bool); + pub fn set_character_data(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `characterDataOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "characterDataOldValue")] + pub fn get_character_data_old_value(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `characterDataOldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "characterDataOldValue")] - fn character_data_old_value_shim(this: &MutationObservingInfo, val: bool); + pub fn set_character_data_old_value(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `childList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "childList")] + pub fn get_child_list(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `childList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "childList")] - fn child_list_shim(this: &MutationObservingInfo, val: bool); + pub fn set_child_list(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `nativeAnonymousChildList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "nativeAnonymousChildList")] + pub fn get_native_anonymous_child_list(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `nativeAnonymousChildList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "nativeAnonymousChildList")] - fn native_anonymous_child_list_shim(this: &MutationObservingInfo, val: bool); + pub fn set_native_anonymous_child_list(this: &MutationObservingInfo, val: bool); + #[doc = "Get the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[wasm_bindgen(method, getter = "subtree")] + pub fn get_subtree(this: &MutationObservingInfo) -> Option; + #[doc = "Change the `subtree` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] #[wasm_bindgen(method, setter = "subtree")] - fn subtree_shim(this: &MutationObservingInfo, val: bool); + pub fn set_subtree(this: &MutationObservingInfo, val: bool); + #[cfg(feature = "Node")] + #[doc = "Get the `observedNode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`, `Node`*"] + #[wasm_bindgen(method, getter = "observedNode")] + pub fn get_observed_node(this: &MutationObservingInfo) -> Option; #[cfg(feature = "Node")] + #[doc = "Change the `observedNode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`, `Node`*"] #[wasm_bindgen(method, setter = "observedNode")] - fn observed_node_shim(this: &MutationObservingInfo, val: Option<&Node>); + pub fn set_observed_node(this: &MutationObservingInfo, val: Option<&Node>); } impl MutationObservingInfo { #[doc = "Construct a new `MutationObservingInfo`."] @@ -41,75 +122,55 @@ impl MutationObservingInfo { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `animations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_animations()` instead."] pub fn animations(&mut self, val: bool) -> &mut Self { - self.animations_shim(val); + self.set_animations(val); self } - #[doc = "Change the `attributeFilter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_attribute_filter()` instead."] pub fn attribute_filter(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.attribute_filter_shim(val); + self.set_attribute_filter(val); self } - #[doc = "Change the `attributeOldValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_attribute_old_value()` instead."] pub fn attribute_old_value(&mut self, val: bool) -> &mut Self { - self.attribute_old_value_shim(val); + self.set_attribute_old_value(val); self } - #[doc = "Change the `attributes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_attributes()` instead."] pub fn attributes(&mut self, val: bool) -> &mut Self { - self.attributes_shim(val); + self.set_attributes(val); self } - #[doc = "Change the `characterData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_character_data()` instead."] pub fn character_data(&mut self, val: bool) -> &mut Self { - self.character_data_shim(val); + self.set_character_data(val); self } - #[doc = "Change the `characterDataOldValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_character_data_old_value()` instead."] pub fn character_data_old_value(&mut self, val: bool) -> &mut Self { - self.character_data_old_value_shim(val); + self.set_character_data_old_value(val); self } - #[doc = "Change the `childList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_child_list()` instead."] pub fn child_list(&mut self, val: bool) -> &mut Self { - self.child_list_shim(val); + self.set_child_list(val); self } - #[doc = "Change the `nativeAnonymousChildList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_native_anonymous_child_list()` instead."] pub fn native_anonymous_child_list(&mut self, val: bool) -> &mut Self { - self.native_anonymous_child_list_shim(val); + self.set_native_anonymous_child_list(val); self } - #[doc = "Change the `subtree` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`*"] + #[deprecated = "Use `set_subtree()` instead."] pub fn subtree(&mut self, val: bool) -> &mut Self { - self.subtree_shim(val); + self.set_subtree(val); self } #[cfg(feature = "Node")] - #[doc = "Change the `observedNode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MutationObservingInfo`, `Node`*"] + #[deprecated = "Use `set_observed_node()` instead."] pub fn observed_node(&mut self, val: Option<&Node>) -> &mut Self { - self.observed_node_shim(val); + self.set_observed_node(val); self } } diff --git a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs index 5245faddf78..7f8f52c40f6 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] pub type NativeOsFileReadOptions; + #[doc = "Get the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] + #[wasm_bindgen(method, getter = "bytes")] + pub fn get_bytes(this: &NativeOsFileReadOptions) -> Option; + #[doc = "Change the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] #[wasm_bindgen(method, setter = "bytes")] - fn bytes_shim(this: &NativeOsFileReadOptions, val: Option); + pub fn set_bytes(this: &NativeOsFileReadOptions, val: Option); + #[doc = "Get the `encoding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] + #[wasm_bindgen(method, getter = "encoding")] + pub fn get_encoding(this: &NativeOsFileReadOptions) -> Option; + #[doc = "Change the `encoding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] #[wasm_bindgen(method, setter = "encoding")] - fn encoding_shim(this: &NativeOsFileReadOptions, val: Option<&str>); + pub fn set_encoding(this: &NativeOsFileReadOptions, val: Option<&str>); } impl NativeOsFileReadOptions { #[doc = "Construct a new `NativeOsFileReadOptions`."] @@ -24,18 +40,14 @@ impl NativeOsFileReadOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bytes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] + #[deprecated = "Use `set_bytes()` instead."] pub fn bytes(&mut self, val: Option) -> &mut Self { - self.bytes_shim(val); + self.set_bytes(val); self } - #[doc = "Change the `encoding` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] + #[deprecated = "Use `set_encoding()` instead."] pub fn encoding(&mut self, val: Option<&str>) -> &mut Self { - self.encoding_shim(val); + self.set_encoding(val); self } } diff --git a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs index 7310b9a165b..6215a0b8529 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] pub type NativeOsFileWriteAtomicOptions; + #[doc = "Get the `backupTo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[wasm_bindgen(method, getter = "backupTo")] + pub fn get_backup_to(this: &NativeOsFileWriteAtomicOptions) -> Option; + #[doc = "Change the `backupTo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, setter = "backupTo")] - fn backup_to_shim(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); + pub fn set_backup_to(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); + #[doc = "Get the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[wasm_bindgen(method, getter = "bytes")] + pub fn get_bytes(this: &NativeOsFileWriteAtomicOptions) -> Option; + #[doc = "Change the `bytes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, setter = "bytes")] - fn bytes_shim(this: &NativeOsFileWriteAtomicOptions, val: Option); + pub fn set_bytes(this: &NativeOsFileWriteAtomicOptions, val: Option); + #[doc = "Get the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[wasm_bindgen(method, getter = "flush")] + pub fn get_flush(this: &NativeOsFileWriteAtomicOptions) -> Option; + #[doc = "Change the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, setter = "flush")] - fn flush_shim(this: &NativeOsFileWriteAtomicOptions, val: bool); + pub fn set_flush(this: &NativeOsFileWriteAtomicOptions, val: bool); + #[doc = "Get the `noOverwrite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[wasm_bindgen(method, getter = "noOverwrite")] + pub fn get_no_overwrite(this: &NativeOsFileWriteAtomicOptions) -> Option; + #[doc = "Change the `noOverwrite` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, setter = "noOverwrite")] - fn no_overwrite_shim(this: &NativeOsFileWriteAtomicOptions, val: bool); + pub fn set_no_overwrite(this: &NativeOsFileWriteAtomicOptions, val: bool); + #[doc = "Get the `tmpPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[wasm_bindgen(method, getter = "tmpPath")] + pub fn get_tmp_path(this: &NativeOsFileWriteAtomicOptions) -> Option; + #[doc = "Change the `tmpPath` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, setter = "tmpPath")] - fn tmp_path_shim(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); + pub fn set_tmp_path(this: &NativeOsFileWriteAtomicOptions, val: Option<&str>); } impl NativeOsFileWriteAtomicOptions { #[doc = "Construct a new `NativeOsFileWriteAtomicOptions`."] @@ -30,39 +70,29 @@ impl NativeOsFileWriteAtomicOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `backupTo` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[deprecated = "Use `set_backup_to()` instead."] pub fn backup_to(&mut self, val: Option<&str>) -> &mut Self { - self.backup_to_shim(val); + self.set_backup_to(val); self } - #[doc = "Change the `bytes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[deprecated = "Use `set_bytes()` instead."] pub fn bytes(&mut self, val: Option) -> &mut Self { - self.bytes_shim(val); + self.set_bytes(val); self } - #[doc = "Change the `flush` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[deprecated = "Use `set_flush()` instead."] pub fn flush(&mut self, val: bool) -> &mut Self { - self.flush_shim(val); + self.set_flush(val); self } - #[doc = "Change the `noOverwrite` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[deprecated = "Use `set_no_overwrite()` instead."] pub fn no_overwrite(&mut self, val: bool) -> &mut Self { - self.no_overwrite_shim(val); + self.set_no_overwrite(val); self } - #[doc = "Change the `tmpPath` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] + #[deprecated = "Use `set_tmp_path()` instead."] pub fn tmp_path(&mut self, val: Option<&str>) -> &mut Self { - self.tmp_path_shim(val); + self.set_tmp_path(val); self } } diff --git a/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs index 49e7ae06847..05be8c4f94f 100644 --- a/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs +++ b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type NavigatorUaBrandVersion; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `brand` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "brand")] + pub fn get_brand(this: &NavigatorUaBrandVersion) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `brand` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "brand")] - fn brand_shim(this: &NavigatorUaBrandVersion, val: &str); + pub fn set_brand(this: &NavigatorUaBrandVersion, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &NavigatorUaBrandVersion) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &NavigatorUaBrandVersion, val: &str); + pub fn set_version(this: &NavigatorUaBrandVersion, val: &str); } #[cfg(web_sys_unstable_apis)] impl NavigatorUaBrandVersion { @@ -33,25 +65,15 @@ impl NavigatorUaBrandVersion { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `brand` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_brand()` instead."] pub fn brand(&mut self, val: &str) -> &mut Self { - self.brand_shim(val); + self.set_brand(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NavigatorUaBrandVersion`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs index d90b1a5fcd7..0bac6a26bec 100644 --- a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs @@ -10,92 +10,436 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] pub type NetworkCommandOptions; + #[doc = "Get the `cmd` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "cmd")] + pub fn get_cmd(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `cmd` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "cmd")] - fn cmd_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_cmd(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `curExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "curExternalIfname")] + pub fn get_cur_external_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `curExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "curExternalIfname")] - fn cur_external_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_cur_external_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `curInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "curInternalIfname")] + pub fn get_cur_internal_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `curInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "curInternalIfname")] - fn cur_internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_cur_internal_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `dns1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "dns1")] + pub fn get_dns1(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `dns1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "dns1")] - fn dns1_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_dns1(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `dns1_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "dns1_long")] + pub fn get_dns1_long(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `dns1_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "dns1_long")] - fn dns1_long_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_dns1_long(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `dns2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "dns2")] + pub fn get_dns2(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `dns2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "dns2")] - fn dns2_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_dns2(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `dns2_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "dns2_long")] + pub fn get_dns2_long(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `dns2_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "dns2_long")] - fn dns2_long_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_dns2_long(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `dnses` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "dnses")] + pub fn get_dnses(this: &NetworkCommandOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `dnses` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "dnses")] - fn dnses_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + pub fn set_dnses(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `domain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "domain")] + pub fn get_domain(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `domain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "domain")] - fn domain_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_domain(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `enable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "enable")] + pub fn get_enable(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `enable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "enable")] - fn enable_shim(this: &NetworkCommandOptions, val: bool); + pub fn set_enable(this: &NetworkCommandOptions, val: bool); + #[doc = "Get the `enabled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "enabled")] + pub fn get_enabled(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `enabled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "enabled")] - fn enabled_shim(this: &NetworkCommandOptions, val: bool); + pub fn set_enabled(this: &NetworkCommandOptions, val: bool); + #[doc = "Get the `endIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "endIp")] + pub fn get_end_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `endIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "endIp")] - fn end_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_end_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `externalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "externalIfname")] + pub fn get_external_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `externalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "externalIfname")] - fn external_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_external_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `gateway` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "gateway")] + pub fn get_gateway(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `gateway` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "gateway")] - fn gateway_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_gateway(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `gateway_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "gateway_long")] + pub fn get_gateway_long(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `gateway_long` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "gateway_long")] - fn gateway_long_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_gateway_long(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `gateways` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "gateways")] + pub fn get_gateways(this: &NetworkCommandOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `gateways` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "gateways")] - fn gateways_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + pub fn set_gateways(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_id(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `ifname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "ifname")] + pub fn get_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `ifname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "ifname")] - fn ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `interfaceList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "interfaceList")] + pub fn get_interface_list(this: &NetworkCommandOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `interfaceList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "interfaceList")] - fn interface_list_shim(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + pub fn set_interface_list(this: &NetworkCommandOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `internalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "internalIfname")] + pub fn get_internal_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `internalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "internalIfname")] - fn internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_internal_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `ip` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "ip")] + pub fn get_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `ip` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "ip")] - fn ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `ipaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "ipaddr")] + pub fn get_ipaddr(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `ipaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "ipaddr")] - fn ipaddr_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_ipaddr(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "key")] + pub fn get_key(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "key")] - fn key_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_key(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `link` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "link")] + pub fn get_link(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `link` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "link")] - fn link_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_link(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "mask")] + pub fn get_mask(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "mask")] - fn mask_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_mask(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `maskLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "maskLength")] + pub fn get_mask_length(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `maskLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "maskLength")] - fn mask_length_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_mask_length(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_mode(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `mtu` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "mtu")] + pub fn get_mtu(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `mtu` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "mtu")] - fn mtu_shim(this: &NetworkCommandOptions, val: i32); + pub fn set_mtu(this: &NetworkCommandOptions, val: i32); + #[doc = "Get the `preExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "preExternalIfname")] + pub fn get_pre_external_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `preExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "preExternalIfname")] - fn pre_external_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_pre_external_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `preInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "preInternalIfname")] + pub fn get_pre_internal_ifname(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `preInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "preInternalIfname")] - fn pre_internal_ifname_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_pre_internal_ifname(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "prefix")] + pub fn get_prefix(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `prefix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "prefix")] - fn prefix_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_prefix(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `prefixLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "prefixLength")] + pub fn get_prefix_length(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `prefixLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "prefixLength")] - fn prefix_length_shim(this: &NetworkCommandOptions, val: u32); + pub fn set_prefix_length(this: &NetworkCommandOptions, val: u32); + #[doc = "Get the `report` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "report")] + pub fn get_report(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `report` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "report")] - fn report_shim(this: &NetworkCommandOptions, val: bool); + pub fn set_report(this: &NetworkCommandOptions, val: bool); + #[doc = "Get the `security` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "security")] + pub fn get_security(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `security` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "security")] - fn security_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_security(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `serverIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "serverIp")] + pub fn get_server_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `serverIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "serverIp")] - fn server_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_server_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `ssid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "ssid")] + pub fn get_ssid(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `ssid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "ssid")] - fn ssid_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_ssid(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `startIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "startIp")] + pub fn get_start_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `startIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "startIp")] - fn start_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_start_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "threshold")] + pub fn get_threshold(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `threshold` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "threshold")] - fn threshold_shim(this: &NetworkCommandOptions, val: f64); + pub fn set_threshold(this: &NetworkCommandOptions, val: f64); + #[doc = "Get the `usbEndIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "usbEndIp")] + pub fn get_usb_end_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `usbEndIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "usbEndIp")] - fn usb_end_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_usb_end_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `usbStartIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "usbStartIp")] + pub fn get_usb_start_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `usbStartIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "usbStartIp")] - fn usb_start_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_usb_start_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `wifiEndIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "wifiEndIp")] + pub fn get_wifi_end_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `wifiEndIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "wifiEndIp")] - fn wifi_end_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_wifi_end_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `wifiStartIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "wifiStartIp")] + pub fn get_wifi_start_ip(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `wifiStartIp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "wifiStartIp")] - fn wifi_start_ip_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_wifi_start_ip(this: &NetworkCommandOptions, val: &str); + #[doc = "Get the `wifictrlinterfacename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[wasm_bindgen(method, getter = "wifictrlinterfacename")] + pub fn get_wifictrlinterfacename(this: &NetworkCommandOptions) -> Option; + #[doc = "Change the `wifictrlinterfacename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, setter = "wifictrlinterfacename")] - fn wifictrlinterfacename_shim(this: &NetworkCommandOptions, val: &str); + pub fn set_wifictrlinterfacename(this: &NetworkCommandOptions, val: &str); } impl NetworkCommandOptions { #[doc = "Construct a new `NetworkCommandOptions`."] @@ -106,305 +450,219 @@ impl NetworkCommandOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `cmd` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_cmd()` instead."] pub fn cmd(&mut self, val: &str) -> &mut Self { - self.cmd_shim(val); + self.set_cmd(val); self } - #[doc = "Change the `curExternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_cur_external_ifname()` instead."] pub fn cur_external_ifname(&mut self, val: &str) -> &mut Self { - self.cur_external_ifname_shim(val); + self.set_cur_external_ifname(val); self } - #[doc = "Change the `curInternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_cur_internal_ifname()` instead."] pub fn cur_internal_ifname(&mut self, val: &str) -> &mut Self { - self.cur_internal_ifname_shim(val); + self.set_cur_internal_ifname(val); self } - #[doc = "Change the `dns1` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_dns1()` instead."] pub fn dns1(&mut self, val: &str) -> &mut Self { - self.dns1_shim(val); + self.set_dns1(val); self } - #[doc = "Change the `dns1_long` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_dns1_long()` instead."] pub fn dns1_long(&mut self, val: i32) -> &mut Self { - self.dns1_long_shim(val); + self.set_dns1_long(val); self } - #[doc = "Change the `dns2` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_dns2()` instead."] pub fn dns2(&mut self, val: &str) -> &mut Self { - self.dns2_shim(val); + self.set_dns2(val); self } - #[doc = "Change the `dns2_long` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_dns2_long()` instead."] pub fn dns2_long(&mut self, val: i32) -> &mut Self { - self.dns2_long_shim(val); + self.set_dns2_long(val); self } - #[doc = "Change the `dnses` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_dnses()` instead."] pub fn dnses(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.dnses_shim(val); + self.set_dnses(val); self } - #[doc = "Change the `domain` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_domain()` instead."] pub fn domain(&mut self, val: &str) -> &mut Self { - self.domain_shim(val); + self.set_domain(val); self } - #[doc = "Change the `enable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_enable()` instead."] pub fn enable(&mut self, val: bool) -> &mut Self { - self.enable_shim(val); + self.set_enable(val); self } - #[doc = "Change the `enabled` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_enabled()` instead."] pub fn enabled(&mut self, val: bool) -> &mut Self { - self.enabled_shim(val); + self.set_enabled(val); self } - #[doc = "Change the `endIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_end_ip()` instead."] pub fn end_ip(&mut self, val: &str) -> &mut Self { - self.end_ip_shim(val); + self.set_end_ip(val); self } - #[doc = "Change the `externalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_external_ifname()` instead."] pub fn external_ifname(&mut self, val: &str) -> &mut Self { - self.external_ifname_shim(val); + self.set_external_ifname(val); self } - #[doc = "Change the `gateway` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_gateway()` instead."] pub fn gateway(&mut self, val: &str) -> &mut Self { - self.gateway_shim(val); + self.set_gateway(val); self } - #[doc = "Change the `gateway_long` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_gateway_long()` instead."] pub fn gateway_long(&mut self, val: i32) -> &mut Self { - self.gateway_long_shim(val); + self.set_gateway_long(val); self } - #[doc = "Change the `gateways` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_gateways()` instead."] pub fn gateways(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.gateways_shim(val); + self.set_gateways(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: i32) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `ifname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_ifname()` instead."] pub fn ifname(&mut self, val: &str) -> &mut Self { - self.ifname_shim(val); + self.set_ifname(val); self } - #[doc = "Change the `interfaceList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_interface_list()` instead."] pub fn interface_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.interface_list_shim(val); + self.set_interface_list(val); self } - #[doc = "Change the `internalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_internal_ifname()` instead."] pub fn internal_ifname(&mut self, val: &str) -> &mut Self { - self.internal_ifname_shim(val); + self.set_internal_ifname(val); self } - #[doc = "Change the `ip` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_ip()` instead."] pub fn ip(&mut self, val: &str) -> &mut Self { - self.ip_shim(val); + self.set_ip(val); self } - #[doc = "Change the `ipaddr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_ipaddr()` instead."] pub fn ipaddr(&mut self, val: i32) -> &mut Self { - self.ipaddr_shim(val); + self.set_ipaddr(val); self } - #[doc = "Change the `key` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_key()` instead."] pub fn key(&mut self, val: &str) -> &mut Self { - self.key_shim(val); + self.set_key(val); self } - #[doc = "Change the `link` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_link()` instead."] pub fn link(&mut self, val: &str) -> &mut Self { - self.link_shim(val); + self.set_link(val); self } - #[doc = "Change the `mask` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_mask()` instead."] pub fn mask(&mut self, val: i32) -> &mut Self { - self.mask_shim(val); + self.set_mask(val); self } - #[doc = "Change the `maskLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_mask_length()` instead."] pub fn mask_length(&mut self, val: &str) -> &mut Self { - self.mask_length_shim(val); + self.set_mask_length(val); self } - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: &str) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } - #[doc = "Change the `mtu` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_mtu()` instead."] pub fn mtu(&mut self, val: i32) -> &mut Self { - self.mtu_shim(val); + self.set_mtu(val); self } - #[doc = "Change the `preExternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_pre_external_ifname()` instead."] pub fn pre_external_ifname(&mut self, val: &str) -> &mut Self { - self.pre_external_ifname_shim(val); + self.set_pre_external_ifname(val); self } - #[doc = "Change the `preInternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_pre_internal_ifname()` instead."] pub fn pre_internal_ifname(&mut self, val: &str) -> &mut Self { - self.pre_internal_ifname_shim(val); + self.set_pre_internal_ifname(val); self } - #[doc = "Change the `prefix` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_prefix()` instead."] pub fn prefix(&mut self, val: &str) -> &mut Self { - self.prefix_shim(val); + self.set_prefix(val); self } - #[doc = "Change the `prefixLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_prefix_length()` instead."] pub fn prefix_length(&mut self, val: u32) -> &mut Self { - self.prefix_length_shim(val); + self.set_prefix_length(val); self } - #[doc = "Change the `report` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_report()` instead."] pub fn report(&mut self, val: bool) -> &mut Self { - self.report_shim(val); + self.set_report(val); self } - #[doc = "Change the `security` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_security()` instead."] pub fn security(&mut self, val: &str) -> &mut Self { - self.security_shim(val); + self.set_security(val); self } - #[doc = "Change the `serverIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_server_ip()` instead."] pub fn server_ip(&mut self, val: &str) -> &mut Self { - self.server_ip_shim(val); + self.set_server_ip(val); self } - #[doc = "Change the `ssid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_ssid()` instead."] pub fn ssid(&mut self, val: &str) -> &mut Self { - self.ssid_shim(val); + self.set_ssid(val); self } - #[doc = "Change the `startIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_start_ip()` instead."] pub fn start_ip(&mut self, val: &str) -> &mut Self { - self.start_ip_shim(val); + self.set_start_ip(val); self } - #[doc = "Change the `threshold` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_threshold()` instead."] pub fn threshold(&mut self, val: f64) -> &mut Self { - self.threshold_shim(val); + self.set_threshold(val); self } - #[doc = "Change the `usbEndIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_usb_end_ip()` instead."] pub fn usb_end_ip(&mut self, val: &str) -> &mut Self { - self.usb_end_ip_shim(val); + self.set_usb_end_ip(val); self } - #[doc = "Change the `usbStartIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_usb_start_ip()` instead."] pub fn usb_start_ip(&mut self, val: &str) -> &mut Self { - self.usb_start_ip_shim(val); + self.set_usb_start_ip(val); self } - #[doc = "Change the `wifiEndIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_wifi_end_ip()` instead."] pub fn wifi_end_ip(&mut self, val: &str) -> &mut Self { - self.wifi_end_ip_shim(val); + self.set_wifi_end_ip(val); self } - #[doc = "Change the `wifiStartIp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_wifi_start_ip()` instead."] pub fn wifi_start_ip(&mut self, val: &str) -> &mut Self { - self.wifi_start_ip_shim(val); + self.set_wifi_start_ip(val); self } - #[doc = "Change the `wifictrlinterfacename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] + #[deprecated = "Use `set_wifictrlinterfacename()` instead."] pub fn wifictrlinterfacename(&mut self, val: &str) -> &mut Self { - self.wifictrlinterfacename_shim(val); + self.set_wifictrlinterfacename(val); self } } diff --git a/crates/web-sys/src/features/gen_NetworkResultOptions.rs b/crates/web-sys/src/features/gen_NetworkResultOptions.rs index 10662e3b521..4f456605968 100644 --- a/crates/web-sys/src/features/gen_NetworkResultOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkResultOptions.rs @@ -10,76 +10,356 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] pub type NetworkResultOptions; + #[doc = "Get the `broadcast` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "broadcast")] + pub fn get_broadcast(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `broadcast` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "broadcast")] - fn broadcast_shim(this: &NetworkResultOptions, val: bool); + pub fn set_broadcast(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `curExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "curExternalIfname")] + pub fn get_cur_external_ifname(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `curExternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "curExternalIfname")] - fn cur_external_ifname_shim(this: &NetworkResultOptions, val: &str); + pub fn set_cur_external_ifname(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `curInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "curInternalIfname")] + pub fn get_cur_internal_ifname(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `curInternalIfname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "curInternalIfname")] - fn cur_internal_ifname_shim(this: &NetworkResultOptions, val: &str); + pub fn set_cur_internal_ifname(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `dns1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "dns1")] + pub fn get_dns1(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `dns1` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "dns1")] - fn dns1_shim(this: &NetworkResultOptions, val: i32); + pub fn set_dns1(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `dns1_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "dns1_str")] + pub fn get_dns1_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `dns1_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "dns1_str")] - fn dns1_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_dns1_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `dns2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "dns2")] + pub fn get_dns2(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `dns2` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "dns2")] - fn dns2_shim(this: &NetworkResultOptions, val: i32); + pub fn set_dns2(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `dns2_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "dns2_str")] + pub fn get_dns2_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `dns2_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "dns2_str")] - fn dns2_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_dns2_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `enable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "enable")] + pub fn get_enable(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `enable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "enable")] - fn enable_shim(this: &NetworkResultOptions, val: bool); + pub fn set_enable(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &NetworkResultOptions, val: bool); + pub fn set_error(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `flag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "flag")] + pub fn get_flag(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `flag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "flag")] - fn flag_shim(this: &NetworkResultOptions, val: &str); + pub fn set_flag(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `gateway` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "gateway")] + pub fn get_gateway(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `gateway` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "gateway")] - fn gateway_shim(this: &NetworkResultOptions, val: i32); + pub fn set_gateway(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `gateway_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "gateway_str")] + pub fn get_gateway_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `gateway_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "gateway_str")] - fn gateway_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_gateway_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &NetworkResultOptions, val: i32); + pub fn set_id(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `interfaceList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "interfaceList")] + pub fn get_interface_list(this: &NetworkResultOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `interfaceList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "interfaceList")] - fn interface_list_shim(this: &NetworkResultOptions, val: &::wasm_bindgen::JsValue); + pub fn set_interface_list(this: &NetworkResultOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `ipAddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "ipAddr")] + pub fn get_ip_addr(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `ipAddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "ipAddr")] - fn ip_addr_shim(this: &NetworkResultOptions, val: &str); + pub fn set_ip_addr(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `ipaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "ipaddr")] + pub fn get_ipaddr(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `ipaddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "ipaddr")] - fn ipaddr_shim(this: &NetworkResultOptions, val: i32); + pub fn set_ipaddr(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `ipaddr_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "ipaddr_str")] + pub fn get_ipaddr_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `ipaddr_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "ipaddr_str")] - fn ipaddr_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_ipaddr_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `lease` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "lease")] + pub fn get_lease(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `lease` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "lease")] - fn lease_shim(this: &NetworkResultOptions, val: i32); + pub fn set_lease(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `macAddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "macAddr")] + pub fn get_mac_addr(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `macAddr` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "macAddr")] - fn mac_addr_shim(this: &NetworkResultOptions, val: &str); + pub fn set_mac_addr(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "mask")] + pub fn get_mask(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `mask` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "mask")] - fn mask_shim(this: &NetworkResultOptions, val: i32); + pub fn set_mask(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `mask_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "mask_str")] + pub fn get_mask_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `mask_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "mask_str")] - fn mask_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_mask_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `netId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "netId")] + pub fn get_net_id(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `netId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "netId")] - fn net_id_shim(this: &NetworkResultOptions, val: &str); + pub fn set_net_id(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `prefixLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "prefixLength")] + pub fn get_prefix_length(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `prefixLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "prefixLength")] - fn prefix_length_shim(this: &NetworkResultOptions, val: i32); + pub fn set_prefix_length(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &NetworkResultOptions, val: &str); + pub fn set_reason(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `reply` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "reply")] + pub fn get_reply(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `reply` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "reply")] - fn reply_shim(this: &NetworkResultOptions, val: &str); + pub fn set_reply(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `result` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "result")] + pub fn get_result(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `result` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "result")] - fn result_shim(this: &NetworkResultOptions, val: bool); + pub fn set_result(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `resultCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "resultCode")] + pub fn get_result_code(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `resultCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "resultCode")] - fn result_code_shim(this: &NetworkResultOptions, val: i32); + pub fn set_result_code(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `resultReason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "resultReason")] + pub fn get_result_reason(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `resultReason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "resultReason")] - fn result_reason_shim(this: &NetworkResultOptions, val: &str); + pub fn set_result_reason(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `ret` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "ret")] + pub fn get_ret(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `ret` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "ret")] - fn ret_shim(this: &NetworkResultOptions, val: bool); + pub fn set_ret(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `route` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "route")] + pub fn get_route(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `route` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "route")] - fn route_shim(this: &NetworkResultOptions, val: &str); + pub fn set_route(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `server` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "server")] + pub fn get_server(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `server` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "server")] - fn server_shim(this: &NetworkResultOptions, val: i32); + pub fn set_server(this: &NetworkResultOptions, val: i32); + #[doc = "Get the `server_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "server_str")] + pub fn get_server_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `server_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "server_str")] - fn server_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_server_str(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `success` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "success")] + pub fn get_success(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `success` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "success")] - fn success_shim(this: &NetworkResultOptions, val: bool); + pub fn set_success(this: &NetworkResultOptions, val: bool); + #[doc = "Get the `topic` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "topic")] + pub fn get_topic(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `topic` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "topic")] - fn topic_shim(this: &NetworkResultOptions, val: &str); + pub fn set_topic(this: &NetworkResultOptions, val: &str); + #[doc = "Get the `vendor_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[wasm_bindgen(method, getter = "vendor_str")] + pub fn get_vendor_str(this: &NetworkResultOptions) -> Option; + #[doc = "Change the `vendor_str` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, setter = "vendor_str")] - fn vendor_str_shim(this: &NetworkResultOptions, val: &str); + pub fn set_vendor_str(this: &NetworkResultOptions, val: &str); } impl NetworkResultOptions { #[doc = "Construct a new `NetworkResultOptions`."] @@ -90,249 +370,179 @@ impl NetworkResultOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `broadcast` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_broadcast()` instead."] pub fn broadcast(&mut self, val: bool) -> &mut Self { - self.broadcast_shim(val); + self.set_broadcast(val); self } - #[doc = "Change the `curExternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_cur_external_ifname()` instead."] pub fn cur_external_ifname(&mut self, val: &str) -> &mut Self { - self.cur_external_ifname_shim(val); + self.set_cur_external_ifname(val); self } - #[doc = "Change the `curInternalIfname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_cur_internal_ifname()` instead."] pub fn cur_internal_ifname(&mut self, val: &str) -> &mut Self { - self.cur_internal_ifname_shim(val); + self.set_cur_internal_ifname(val); self } - #[doc = "Change the `dns1` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_dns1()` instead."] pub fn dns1(&mut self, val: i32) -> &mut Self { - self.dns1_shim(val); + self.set_dns1(val); self } - #[doc = "Change the `dns1_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_dns1_str()` instead."] pub fn dns1_str(&mut self, val: &str) -> &mut Self { - self.dns1_str_shim(val); + self.set_dns1_str(val); self } - #[doc = "Change the `dns2` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_dns2()` instead."] pub fn dns2(&mut self, val: i32) -> &mut Self { - self.dns2_shim(val); + self.set_dns2(val); self } - #[doc = "Change the `dns2_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_dns2_str()` instead."] pub fn dns2_str(&mut self, val: &str) -> &mut Self { - self.dns2_str_shim(val); + self.set_dns2_str(val); self } - #[doc = "Change the `enable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_enable()` instead."] pub fn enable(&mut self, val: bool) -> &mut Self { - self.enable_shim(val); + self.set_enable(val); self } - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: bool) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } - #[doc = "Change the `flag` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_flag()` instead."] pub fn flag(&mut self, val: &str) -> &mut Self { - self.flag_shim(val); + self.set_flag(val); self } - #[doc = "Change the `gateway` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_gateway()` instead."] pub fn gateway(&mut self, val: i32) -> &mut Self { - self.gateway_shim(val); + self.set_gateway(val); self } - #[doc = "Change the `gateway_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_gateway_str()` instead."] pub fn gateway_str(&mut self, val: &str) -> &mut Self { - self.gateway_str_shim(val); + self.set_gateway_str(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: i32) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `interfaceList` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_interface_list()` instead."] pub fn interface_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.interface_list_shim(val); + self.set_interface_list(val); self } - #[doc = "Change the `ipAddr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_ip_addr()` instead."] pub fn ip_addr(&mut self, val: &str) -> &mut Self { - self.ip_addr_shim(val); + self.set_ip_addr(val); self } - #[doc = "Change the `ipaddr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_ipaddr()` instead."] pub fn ipaddr(&mut self, val: i32) -> &mut Self { - self.ipaddr_shim(val); + self.set_ipaddr(val); self } - #[doc = "Change the `ipaddr_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_ipaddr_str()` instead."] pub fn ipaddr_str(&mut self, val: &str) -> &mut Self { - self.ipaddr_str_shim(val); + self.set_ipaddr_str(val); self } - #[doc = "Change the `lease` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_lease()` instead."] pub fn lease(&mut self, val: i32) -> &mut Self { - self.lease_shim(val); + self.set_lease(val); self } - #[doc = "Change the `macAddr` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_mac_addr()` instead."] pub fn mac_addr(&mut self, val: &str) -> &mut Self { - self.mac_addr_shim(val); + self.set_mac_addr(val); self } - #[doc = "Change the `mask` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_mask()` instead."] pub fn mask(&mut self, val: i32) -> &mut Self { - self.mask_shim(val); + self.set_mask(val); self } - #[doc = "Change the `mask_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_mask_str()` instead."] pub fn mask_str(&mut self, val: &str) -> &mut Self { - self.mask_str_shim(val); + self.set_mask_str(val); self } - #[doc = "Change the `netId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_net_id()` instead."] pub fn net_id(&mut self, val: &str) -> &mut Self { - self.net_id_shim(val); + self.set_net_id(val); self } - #[doc = "Change the `prefixLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_prefix_length()` instead."] pub fn prefix_length(&mut self, val: i32) -> &mut Self { - self.prefix_length_shim(val); + self.set_prefix_length(val); self } - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: &str) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } - #[doc = "Change the `reply` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_reply()` instead."] pub fn reply(&mut self, val: &str) -> &mut Self { - self.reply_shim(val); + self.set_reply(val); self } - #[doc = "Change the `result` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_result()` instead."] pub fn result(&mut self, val: bool) -> &mut Self { - self.result_shim(val); + self.set_result(val); self } - #[doc = "Change the `resultCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_result_code()` instead."] pub fn result_code(&mut self, val: i32) -> &mut Self { - self.result_code_shim(val); + self.set_result_code(val); self } - #[doc = "Change the `resultReason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_result_reason()` instead."] pub fn result_reason(&mut self, val: &str) -> &mut Self { - self.result_reason_shim(val); + self.set_result_reason(val); self } - #[doc = "Change the `ret` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_ret()` instead."] pub fn ret(&mut self, val: bool) -> &mut Self { - self.ret_shim(val); + self.set_ret(val); self } - #[doc = "Change the `route` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_route()` instead."] pub fn route(&mut self, val: &str) -> &mut Self { - self.route_shim(val); + self.set_route(val); self } - #[doc = "Change the `server` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_server()` instead."] pub fn server(&mut self, val: i32) -> &mut Self { - self.server_shim(val); + self.set_server(val); self } - #[doc = "Change the `server_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_server_str()` instead."] pub fn server_str(&mut self, val: &str) -> &mut Self { - self.server_str_shim(val); + self.set_server_str(val); self } - #[doc = "Change the `success` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_success()` instead."] pub fn success(&mut self, val: bool) -> &mut Self { - self.success_shim(val); + self.set_success(val); self } - #[doc = "Change the `topic` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_topic()` instead."] pub fn topic(&mut self, val: &str) -> &mut Self { - self.topic_shim(val); + self.set_topic(val); self } - #[doc = "Change the `vendor_str` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] + #[deprecated = "Use `set_vendor_str()` instead."] pub fn vendor_str(&mut self, val: &str) -> &mut Self { - self.vendor_str_shim(val); + self.set_vendor_str(val); self } } diff --git a/crates/web-sys/src/features/gen_NodeFilter.rs b/crates/web-sys/src/features/gen_NodeFilter.rs index 9f41f29e589..dfc7bbf68f0 100644 --- a/crates/web-sys/src/features/gen_NodeFilter.rs +++ b/crates/web-sys/src/features/gen_NodeFilter.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] pub type NodeFilter; + #[doc = "Get the `acceptNode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] + #[wasm_bindgen(method, getter = "acceptNode")] + pub fn get_accept_node(this: &NodeFilter) -> Option<::js_sys::Function>; + #[doc = "Change the `acceptNode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] #[wasm_bindgen(method, setter = "acceptNode")] - fn accept_node_shim(this: &NodeFilter, val: &::js_sys::Function); + pub fn set_accept_node(this: &NodeFilter, val: &::js_sys::Function); } impl NodeFilter { #[doc = "Construct a new `NodeFilter`."] @@ -22,11 +30,9 @@ impl NodeFilter { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `acceptNode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NodeFilter`*"] + #[deprecated = "Use `set_accept_node()` instead."] pub fn accept_node(&mut self, val: &::js_sys::Function) -> &mut Self { - self.accept_node_shim(val); + self.set_accept_node(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationAction.rs b/crates/web-sys/src/features/gen_NotificationAction.rs index 24bfb4d8b22..f8fee81d848 100644 --- a/crates/web-sys/src/features/gen_NotificationAction.rs +++ b/crates/web-sys/src/features/gen_NotificationAction.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] pub type NotificationAction; + #[doc = "Get the `action` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[wasm_bindgen(method, getter = "action")] + pub fn get_action(this: &NotificationAction) -> String; + #[doc = "Change the `action` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, setter = "action")] - fn action_shim(this: &NotificationAction, val: &str); + pub fn set_action(this: &NotificationAction, val: &str); + #[doc = "Get the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[wasm_bindgen(method, getter = "icon")] + pub fn get_icon(this: &NotificationAction) -> Option; + #[doc = "Change the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, setter = "icon")] - fn icon_shim(this: &NotificationAction, val: &str); + pub fn set_icon(this: &NotificationAction, val: &str); + #[doc = "Get the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[wasm_bindgen(method, getter = "title")] + pub fn get_title(this: &NotificationAction) -> String; + #[doc = "Change the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, setter = "title")] - fn title_shim(this: &NotificationAction, val: &str); + pub fn set_title(this: &NotificationAction, val: &str); } impl NotificationAction { #[doc = "Construct a new `NotificationAction`."] @@ -28,25 +52,19 @@ impl NotificationAction { ret.title(title); ret } - #[doc = "Change the `action` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[deprecated = "Use `set_action()` instead."] pub fn action(&mut self, val: &str) -> &mut Self { - self.action_shim(val); + self.set_action(val); self } - #[doc = "Change the `icon` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[deprecated = "Use `set_icon()` instead."] pub fn icon(&mut self, val: &str) -> &mut Self { - self.icon_shim(val); + self.set_icon(val); self } - #[doc = "Change the `title` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] + #[deprecated = "Use `set_title()` instead."] pub fn title(&mut self, val: &str) -> &mut Self { - self.title_shim(val); + self.set_title(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationEventInit.rs b/crates/web-sys/src/features/gen_NotificationEventInit.rs index 6e73ccc7bf2..c7b748a391f 100644 --- a/crates/web-sys/src/features/gen_NotificationEventInit.rs +++ b/crates/web-sys/src/features/gen_NotificationEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] pub type NotificationEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &NotificationEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &NotificationEventInit, val: bool); + pub fn set_bubbles(this: &NotificationEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &NotificationEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &NotificationEventInit, val: bool); + pub fn set_cancelable(this: &NotificationEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &NotificationEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &NotificationEventInit, val: bool); + pub fn set_composed(this: &NotificationEventInit, val: bool); #[cfg(feature = "Notification")] + #[doc = "Get the `notification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationEventInit`*"] + #[wasm_bindgen(method, getter = "notification")] + pub fn get_notification(this: &NotificationEventInit) -> Notification; + #[cfg(feature = "Notification")] + #[doc = "Change the `notification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationEventInit`*"] #[wasm_bindgen(method, setter = "notification")] - fn notification_shim(this: &NotificationEventInit, val: &Notification); + pub fn set_notification(this: &NotificationEventInit, val: &Notification); } impl NotificationEventInit { #[cfg(feature = "Notification")] @@ -31,33 +64,25 @@ impl NotificationEventInit { ret.notification(notification); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Notification")] - #[doc = "Change the `notification` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationEventInit`*"] + #[deprecated = "Use `set_notification()` instead."] pub fn notification(&mut self, val: &Notification) -> &mut Self { - self.notification_shim(val); + self.set_notification(val); self } } diff --git a/crates/web-sys/src/features/gen_NotificationOptions.rs b/crates/web-sys/src/features/gen_NotificationOptions.rs index cd07eebe53a..c8e8bc9ccba 100644 --- a/crates/web-sys/src/features/gen_NotificationOptions.rs +++ b/crates/web-sys/src/features/gen_NotificationOptions.rs @@ -10,33 +10,138 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] pub type NotificationOptions; + #[doc = "Get the `actions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "actions")] + pub fn get_actions(this: &NotificationOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `actions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "actions")] - fn actions_shim(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); + pub fn set_actions(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `badge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "badge")] + pub fn get_badge(this: &NotificationOptions) -> Option; + #[doc = "Change the `badge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "badge")] - fn badge_shim(this: &NotificationOptions, val: &str); + pub fn set_badge(this: &NotificationOptions, val: &str); + #[doc = "Get the `body` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "body")] + pub fn get_body(this: &NotificationOptions) -> Option; + #[doc = "Change the `body` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "body")] - fn body_shim(this: &NotificationOptions, val: &str); + pub fn set_body(this: &NotificationOptions, val: &str); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &NotificationOptions) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); #[cfg(feature = "NotificationDirection")] + #[doc = "Get the `dir` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationDirection`, `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "dir")] + pub fn get_dir(this: &NotificationOptions) -> Option; + #[cfg(feature = "NotificationDirection")] + #[doc = "Change the `dir` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationDirection`, `NotificationOptions`*"] #[wasm_bindgen(method, setter = "dir")] - fn dir_shim(this: &NotificationOptions, val: NotificationDirection); + pub fn set_dir(this: &NotificationOptions, val: NotificationDirection); + #[doc = "Get the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "icon")] + pub fn get_icon(this: &NotificationOptions) -> Option; + #[doc = "Change the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "icon")] - fn icon_shim(this: &NotificationOptions, val: &str); + pub fn set_icon(this: &NotificationOptions, val: &str); + #[doc = "Get the `image` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "image")] + pub fn get_image(this: &NotificationOptions) -> Option; + #[doc = "Change the `image` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "image")] - fn image_shim(this: &NotificationOptions, val: &str); + pub fn set_image(this: &NotificationOptions, val: &str); + #[doc = "Get the `lang` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "lang")] + pub fn get_lang(this: &NotificationOptions) -> Option; + #[doc = "Change the `lang` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "lang")] - fn lang_shim(this: &NotificationOptions, val: &str); + pub fn set_lang(this: &NotificationOptions, val: &str); + #[doc = "Get the `renotify` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "renotify")] + pub fn get_renotify(this: &NotificationOptions) -> Option; + #[doc = "Change the `renotify` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "renotify")] - fn renotify_shim(this: &NotificationOptions, val: bool); + pub fn set_renotify(this: &NotificationOptions, val: bool); + #[doc = "Get the `requireInteraction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "requireInteraction")] + pub fn get_require_interaction(this: &NotificationOptions) -> Option; + #[doc = "Change the `requireInteraction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "requireInteraction")] - fn require_interaction_shim(this: &NotificationOptions, val: bool); + pub fn set_require_interaction(this: &NotificationOptions, val: bool); + #[doc = "Get the `silent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "silent")] + pub fn get_silent(this: &NotificationOptions) -> Option; + #[doc = "Change the `silent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "silent")] - fn silent_shim(this: &NotificationOptions, val: Option); + pub fn set_silent(this: &NotificationOptions, val: Option); + #[doc = "Get the `tag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "tag")] + pub fn get_tag(this: &NotificationOptions) -> Option; + #[doc = "Change the `tag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "tag")] - fn tag_shim(this: &NotificationOptions, val: &str); + pub fn set_tag(this: &NotificationOptions, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &NotificationOptions) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &NotificationOptions, val: f64); + pub fn set_timestamp(this: &NotificationOptions, val: f64); } impl NotificationOptions { #[doc = "Construct a new `NotificationOptions`."] @@ -47,96 +152,70 @@ impl NotificationOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `actions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_actions()` instead."] pub fn actions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.actions_shim(val); + self.set_actions(val); self } - #[doc = "Change the `badge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_badge()` instead."] pub fn badge(&mut self, val: &str) -> &mut Self { - self.badge_shim(val); + self.set_badge(val); self } - #[doc = "Change the `body` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_body()` instead."] pub fn body(&mut self, val: &str) -> &mut Self { - self.body_shim(val); + self.set_body(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } #[cfg(feature = "NotificationDirection")] - #[doc = "Change the `dir` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationDirection`, `NotificationOptions`*"] + #[deprecated = "Use `set_dir()` instead."] pub fn dir(&mut self, val: NotificationDirection) -> &mut Self { - self.dir_shim(val); + self.set_dir(val); self } - #[doc = "Change the `icon` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_icon()` instead."] pub fn icon(&mut self, val: &str) -> &mut Self { - self.icon_shim(val); + self.set_icon(val); self } - #[doc = "Change the `image` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_image()` instead."] pub fn image(&mut self, val: &str) -> &mut Self { - self.image_shim(val); + self.set_image(val); self } - #[doc = "Change the `lang` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_lang()` instead."] pub fn lang(&mut self, val: &str) -> &mut Self { - self.lang_shim(val); + self.set_lang(val); self } - #[doc = "Change the `renotify` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_renotify()` instead."] pub fn renotify(&mut self, val: bool) -> &mut Self { - self.renotify_shim(val); + self.set_renotify(val); self } - #[doc = "Change the `requireInteraction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_require_interaction()` instead."] pub fn require_interaction(&mut self, val: bool) -> &mut Self { - self.require_interaction_shim(val); + self.set_require_interaction(val); self } - #[doc = "Change the `silent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_silent()` instead."] pub fn silent(&mut self, val: Option) -> &mut Self { - self.silent_shim(val); + self.set_silent(val); self } - #[doc = "Change the `tag` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_tag()` instead."] pub fn tag(&mut self, val: &str) -> &mut Self { - self.tag_shim(val); + self.set_tag(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_ObserverCallback.rs b/crates/web-sys/src/features/gen_ObserverCallback.rs index 6136af2a956..8fa10f9d7da 100644 --- a/crates/web-sys/src/features/gen_ObserverCallback.rs +++ b/crates/web-sys/src/features/gen_ObserverCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] pub type ObserverCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &ObserverCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &ObserverCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &ObserverCallback, val: &::js_sys::Function); } impl ObserverCallback { #[doc = "Construct a new `ObserverCallback`."] @@ -22,11 +30,9 @@ impl ObserverCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs index dc607168d11..45043ee73a7 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] pub type OfflineAudioCompletionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &OfflineAudioCompletionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &OfflineAudioCompletionEventInit, val: bool); + pub fn set_bubbles(this: &OfflineAudioCompletionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &OfflineAudioCompletionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &OfflineAudioCompletionEventInit, val: bool); + pub fn set_cancelable(this: &OfflineAudioCompletionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &OfflineAudioCompletionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &OfflineAudioCompletionEventInit, val: bool); + pub fn set_composed(this: &OfflineAudioCompletionEventInit, val: bool); #[cfg(feature = "AudioBuffer")] + #[doc = "Get the `renderedBuffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `OfflineAudioCompletionEventInit`*"] + #[wasm_bindgen(method, getter = "renderedBuffer")] + pub fn get_rendered_buffer(this: &OfflineAudioCompletionEventInit) -> AudioBuffer; + #[cfg(feature = "AudioBuffer")] + #[doc = "Change the `renderedBuffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `OfflineAudioCompletionEventInit`*"] #[wasm_bindgen(method, setter = "renderedBuffer")] - fn rendered_buffer_shim(this: &OfflineAudioCompletionEventInit, val: &AudioBuffer); + pub fn set_rendered_buffer(this: &OfflineAudioCompletionEventInit, val: &AudioBuffer); } impl OfflineAudioCompletionEventInit { #[cfg(feature = "AudioBuffer")] @@ -31,33 +64,25 @@ impl OfflineAudioCompletionEventInit { ret.rendered_buffer(rendered_buffer); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioCompletionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "AudioBuffer")] - #[doc = "Change the `renderedBuffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `OfflineAudioCompletionEventInit`*"] + #[deprecated = "Use `set_rendered_buffer()` instead."] pub fn rendered_buffer(&mut self, val: &AudioBuffer) -> &mut Self { - self.rendered_buffer_shim(val); + self.set_rendered_buffer(val); self } } diff --git a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs index a60ff33bc11..b1fd7829e6c 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] pub type OfflineAudioContextOptions; + #[doc = "Get the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[wasm_bindgen(method, getter = "length")] + pub fn get_length(this: &OfflineAudioContextOptions) -> u32; + #[doc = "Change the `length` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] #[wasm_bindgen(method, setter = "length")] - fn length_shim(this: &OfflineAudioContextOptions, val: u32); + pub fn set_length(this: &OfflineAudioContextOptions, val: u32); + #[doc = "Get the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[wasm_bindgen(method, getter = "numberOfChannels")] + pub fn get_number_of_channels(this: &OfflineAudioContextOptions) -> Option; + #[doc = "Change the `numberOfChannels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] #[wasm_bindgen(method, setter = "numberOfChannels")] - fn number_of_channels_shim(this: &OfflineAudioContextOptions, val: u32); + pub fn set_number_of_channels(this: &OfflineAudioContextOptions, val: u32); + #[doc = "Get the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[wasm_bindgen(method, getter = "sampleRate")] + pub fn get_sample_rate(this: &OfflineAudioContextOptions) -> f32; + #[doc = "Change the `sampleRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] #[wasm_bindgen(method, setter = "sampleRate")] - fn sample_rate_shim(this: &OfflineAudioContextOptions, val: f32); + pub fn set_sample_rate(this: &OfflineAudioContextOptions, val: f32); } impl OfflineAudioContextOptions { #[doc = "Construct a new `OfflineAudioContextOptions`."] @@ -28,25 +52,19 @@ impl OfflineAudioContextOptions { ret.sample_rate(sample_rate); ret } - #[doc = "Change the `length` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[deprecated = "Use `set_length()` instead."] pub fn length(&mut self, val: u32) -> &mut Self { - self.length_shim(val); + self.set_length(val); self } - #[doc = "Change the `numberOfChannels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[deprecated = "Use `set_number_of_channels()` instead."] pub fn number_of_channels(&mut self, val: u32) -> &mut Self { - self.number_of_channels_shim(val); + self.set_number_of_channels(val); self } - #[doc = "Change the `sampleRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContextOptions`*"] + #[deprecated = "Use `set_sample_rate()` instead."] pub fn sample_rate(&mut self, val: f32) -> &mut Self { - self.sample_rate_shim(val); + self.set_sample_rate(val); self } } diff --git a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs index 533bef161de..512cc7bcace 100644 --- a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type OpenFilePickerOptions; - #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] - fn exclude_accept_all_option_shim(this: &OpenFilePickerOptions, val: bool); - #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &OpenFilePickerOptions, val: &str); - #[wasm_bindgen(method, setter = "startIn")] - fn start_in_shim(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "types")] - fn types_shim(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "multiple")] - fn multiple_shim(this: &OpenFilePickerOptions, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl OpenFilePickerOptions { - #[doc = "Construct a new `OpenFilePickerOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `excludeAcceptAllOption` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "excludeAcceptAllOption")] + pub fn get_exclude_accept_all_option(this: &OpenFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `excludeAcceptAllOption` field of this object."] #[doc = ""] @@ -45,10 +30,17 @@ impl OpenFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - self.exclude_accept_all_option_shim(val); - self - } + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + pub fn set_exclude_accept_all_option(this: &OpenFilePickerOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &OpenFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -56,10 +48,17 @@ impl OpenFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); - self - } + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &OpenFilePickerOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startIn")] + pub fn get_start_in(this: &OpenFilePickerOptions) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `startIn` field of this object."] #[doc = ""] @@ -67,10 +66,17 @@ impl OpenFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.start_in_shim(val); - self - } + #[wasm_bindgen(method, setter = "startIn")] + pub fn set_start_in(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "types")] + pub fn get_types(this: &OpenFilePickerOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `types` field of this object."] #[doc = ""] @@ -78,10 +84,17 @@ impl OpenFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.types_shim(val); - self - } + #[wasm_bindgen(method, setter = "types")] + pub fn set_types(this: &OpenFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `multiple` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "multiple")] + pub fn get_multiple(this: &OpenFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `multiple` field of this object."] #[doc = ""] @@ -89,8 +102,50 @@ impl OpenFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "multiple")] + pub fn set_multiple(this: &OpenFilePickerOptions, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl OpenFilePickerOptions { + #[doc = "Construct a new `OpenFilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_exclude_accept_all_option()` instead."] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + self.set_exclude_accept_all_option(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_start_in()` instead."] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_start_in(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_types()` instead."] + pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_types(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_multiple()` instead."] pub fn multiple(&mut self, val: bool) -> &mut Self { - self.multiple_shim(val); + self.set_multiple(val); self } } diff --git a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs index 326eedf30c9..442c35d3a4a 100644 --- a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs +++ b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] pub type OpenWindowEventDetail; + #[doc = "Get the `features` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[wasm_bindgen(method, getter = "features")] + pub fn get_features(this: &OpenWindowEventDetail) -> Option; + #[doc = "Change the `features` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, setter = "features")] - fn features_shim(this: &OpenWindowEventDetail, val: &str); + pub fn set_features(this: &OpenWindowEventDetail, val: &str); #[cfg(feature = "Node")] + #[doc = "Get the `frameElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Node`, `OpenWindowEventDetail`*"] + #[wasm_bindgen(method, getter = "frameElement")] + pub fn get_frame_element(this: &OpenWindowEventDetail) -> Option; + #[cfg(feature = "Node")] + #[doc = "Change the `frameElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Node`, `OpenWindowEventDetail`*"] #[wasm_bindgen(method, setter = "frameElement")] - fn frame_element_shim(this: &OpenWindowEventDetail, val: Option<&Node>); + pub fn set_frame_element(this: &OpenWindowEventDetail, val: Option<&Node>); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &OpenWindowEventDetail) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &OpenWindowEventDetail, val: &str); + pub fn set_name(this: &OpenWindowEventDetail, val: &str); + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &OpenWindowEventDetail) -> Option; + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &OpenWindowEventDetail, val: &str); + pub fn set_url(this: &OpenWindowEventDetail, val: &str); } impl OpenWindowEventDetail { #[doc = "Construct a new `OpenWindowEventDetail`."] @@ -29,33 +62,25 @@ impl OpenWindowEventDetail { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `features` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[deprecated = "Use `set_features()` instead."] pub fn features(&mut self, val: &str) -> &mut Self { - self.features_shim(val); + self.set_features(val); self } #[cfg(feature = "Node")] - #[doc = "Change the `frameElement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Node`, `OpenWindowEventDetail`*"] + #[deprecated = "Use `set_frame_element()` instead."] pub fn frame_element(&mut self, val: Option<&Node>) -> &mut Self { - self.frame_element_shim(val); + self.set_frame_element(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: &str) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } } diff --git a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs index a55b56f6bb6..195e6e3e2a5 100644 --- a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs +++ b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs @@ -10,24 +10,90 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] pub type OptionalEffectTiming; + #[doc = "Get the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &OptionalEffectTiming) -> Option; + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &OptionalEffectTiming, val: f64); + pub fn set_delay(this: &OptionalEffectTiming, val: f64); #[cfg(feature = "PlaybackDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`, `PlaybackDirection`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &OptionalEffectTiming) -> Option; + #[cfg(feature = "PlaybackDirection")] + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`, `PlaybackDirection`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &OptionalEffectTiming, val: PlaybackDirection); + pub fn set_direction(this: &OptionalEffectTiming, val: PlaybackDirection); + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &OptionalEffectTiming) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &OptionalEffectTiming, val: &::wasm_bindgen::JsValue); + pub fn set_duration(this: &OptionalEffectTiming, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "easing")] + pub fn get_easing(this: &OptionalEffectTiming) -> Option; + #[doc = "Change the `easing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "easing")] - fn easing_shim(this: &OptionalEffectTiming, val: &str); + pub fn set_easing(this: &OptionalEffectTiming, val: &str); + #[doc = "Get the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "endDelay")] + pub fn get_end_delay(this: &OptionalEffectTiming) -> Option; + #[doc = "Change the `endDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "endDelay")] - fn end_delay_shim(this: &OptionalEffectTiming, val: f64); + pub fn set_end_delay(this: &OptionalEffectTiming, val: f64); + #[cfg(feature = "FillMode")] + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FillMode`, `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &OptionalEffectTiming) -> Option; #[cfg(feature = "FillMode")] + #[doc = "Change the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FillMode`, `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &OptionalEffectTiming, val: FillMode); + pub fn set_fill(this: &OptionalEffectTiming, val: FillMode); + #[doc = "Get the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "iterationStart")] + pub fn get_iteration_start(this: &OptionalEffectTiming) -> Option; + #[doc = "Change the `iterationStart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "iterationStart")] - fn iteration_start_shim(this: &OptionalEffectTiming, val: f64); + pub fn set_iteration_start(this: &OptionalEffectTiming, val: f64); + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &OptionalEffectTiming) -> Option; + #[doc = "Change the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &OptionalEffectTiming, val: f64); + pub fn set_iterations(this: &OptionalEffectTiming, val: f64); } impl OptionalEffectTiming { #[doc = "Construct a new `OptionalEffectTiming`."] @@ -38,62 +104,46 @@ impl OptionalEffectTiming { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `delay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_delay()` instead."] pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); + self.set_delay(val); self } #[cfg(feature = "PlaybackDirection")] - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`, `PlaybackDirection`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: PlaybackDirection) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `easing` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_easing()` instead."] pub fn easing(&mut self, val: &str) -> &mut Self { - self.easing_shim(val); + self.set_easing(val); self } - #[doc = "Change the `endDelay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_end_delay()` instead."] pub fn end_delay(&mut self, val: f64) -> &mut Self { - self.end_delay_shim(val); + self.set_end_delay(val); self } #[cfg(feature = "FillMode")] - #[doc = "Change the `fill` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `FillMode`, `OptionalEffectTiming`*"] + #[deprecated = "Use `set_fill()` instead."] pub fn fill(&mut self, val: FillMode) -> &mut Self { - self.fill_shim(val); + self.set_fill(val); self } - #[doc = "Change the `iterationStart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_iteration_start()` instead."] pub fn iteration_start(&mut self, val: f64) -> &mut Self { - self.iteration_start_shim(val); + self.set_iteration_start(val); self } - #[doc = "Change the `iterations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] + #[deprecated = "Use `set_iterations()` instead."] pub fn iterations(&mut self, val: f64) -> &mut Self { - self.iterations_shim(val); + self.set_iterations(val); self } } diff --git a/crates/web-sys/src/features/gen_OscillatorOptions.rs b/crates/web-sys/src/features/gen_OscillatorOptions.rs index 52a53e00595..32f4507e5fd 100644 --- a/crates/web-sys/src/features/gen_OscillatorOptions.rs +++ b/crates/web-sys/src/features/gen_OscillatorOptions.rs @@ -10,24 +10,84 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] pub type OscillatorOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &OscillatorOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &OscillatorOptions, val: u32); + pub fn set_channel_count(this: &OscillatorOptions, val: u32); + #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `OscillatorOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &OscillatorOptions) -> Option; #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `OscillatorOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &OscillatorOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &OscillatorOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `OscillatorOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &OscillatorOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `OscillatorOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &OscillatorOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &OscillatorOptions, val: ChannelInterpretation); + #[doc = "Get the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[wasm_bindgen(method, getter = "detune")] + pub fn get_detune(this: &OscillatorOptions) -> Option; + #[doc = "Change the `detune` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] #[wasm_bindgen(method, setter = "detune")] - fn detune_shim(this: &OscillatorOptions, val: f32); + pub fn set_detune(this: &OscillatorOptions, val: f32); + #[doc = "Get the `frequency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[wasm_bindgen(method, getter = "frequency")] + pub fn get_frequency(this: &OscillatorOptions) -> Option; + #[doc = "Change the `frequency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] #[wasm_bindgen(method, setter = "frequency")] - fn frequency_shim(this: &OscillatorOptions, val: f32); + pub fn set_frequency(this: &OscillatorOptions, val: f32); + #[cfg(feature = "PeriodicWave")] + #[doc = "Get the `periodicWave` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `PeriodicWave`*"] + #[wasm_bindgen(method, getter = "periodicWave")] + pub fn get_periodic_wave(this: &OscillatorOptions) -> Option; #[cfg(feature = "PeriodicWave")] + #[doc = "Change the `periodicWave` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `PeriodicWave`*"] #[wasm_bindgen(method, setter = "periodicWave")] - fn periodic_wave_shim(this: &OscillatorOptions, val: &PeriodicWave); + pub fn set_periodic_wave(this: &OscillatorOptions, val: &PeriodicWave); + #[cfg(feature = "OscillatorType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `OscillatorType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &OscillatorOptions) -> Option; #[cfg(feature = "OscillatorType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `OscillatorType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &OscillatorOptions, val: OscillatorType); + pub fn set_type(this: &OscillatorOptions, val: OscillatorType); } impl OscillatorOptions { #[doc = "Construct a new `OscillatorOptions`."] @@ -38,57 +98,43 @@ impl OscillatorOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `OscillatorOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `OscillatorOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `detune` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[deprecated = "Use `set_detune()` instead."] pub fn detune(&mut self, val: f32) -> &mut Self { - self.detune_shim(val); + self.set_detune(val); self } - #[doc = "Change the `frequency` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`*"] + #[deprecated = "Use `set_frequency()` instead."] pub fn frequency(&mut self, val: f32) -> &mut Self { - self.frequency_shim(val); + self.set_frequency(val); self } #[cfg(feature = "PeriodicWave")] - #[doc = "Change the `periodicWave` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `PeriodicWave`*"] + #[deprecated = "Use `set_periodic_wave()` instead."] pub fn periodic_wave(&mut self, val: &PeriodicWave) -> &mut Self { - self.periodic_wave_shim(val); + self.set_periodic_wave(val); self } #[cfg(feature = "OscillatorType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OscillatorOptions`, `OscillatorType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: OscillatorType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_PageTransitionEventInit.rs b/crates/web-sys/src/features/gen_PageTransitionEventInit.rs index 3474f5bcb49..28e3cbeba68 100644 --- a/crates/web-sys/src/features/gen_PageTransitionEventInit.rs +++ b/crates/web-sys/src/features/gen_PageTransitionEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] pub type PageTransitionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PageTransitionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PageTransitionEventInit, val: bool); + pub fn set_bubbles(this: &PageTransitionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PageTransitionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PageTransitionEventInit, val: bool); + pub fn set_cancelable(this: &PageTransitionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PageTransitionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PageTransitionEventInit, val: bool); + pub fn set_composed(this: &PageTransitionEventInit, val: bool); + #[doc = "Get the `inFrameSwap` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[wasm_bindgen(method, getter = "inFrameSwap")] + pub fn get_in_frame_swap(this: &PageTransitionEventInit) -> Option; + #[doc = "Change the `inFrameSwap` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] #[wasm_bindgen(method, setter = "inFrameSwap")] - fn in_frame_swap_shim(this: &PageTransitionEventInit, val: bool); + pub fn set_in_frame_swap(this: &PageTransitionEventInit, val: bool); + #[doc = "Get the `persisted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[wasm_bindgen(method, getter = "persisted")] + pub fn get_persisted(this: &PageTransitionEventInit) -> Option; + #[doc = "Change the `persisted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] #[wasm_bindgen(method, setter = "persisted")] - fn persisted_shim(this: &PageTransitionEventInit, val: bool); + pub fn set_persisted(this: &PageTransitionEventInit, val: bool); } impl PageTransitionEventInit { #[doc = "Construct a new `PageTransitionEventInit`."] @@ -30,39 +70,29 @@ impl PageTransitionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `inFrameSwap` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[deprecated = "Use `set_in_frame_swap()` instead."] pub fn in_frame_swap(&mut self, val: bool) -> &mut Self { - self.in_frame_swap_shim(val); + self.set_in_frame_swap(val); self } - #[doc = "Change the `persisted` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PageTransitionEventInit`*"] + #[deprecated = "Use `set_persisted()` instead."] pub fn persisted(&mut self, val: bool) -> &mut Self { - self.persisted_shim(val); + self.set_persisted(val); self } } diff --git a/crates/web-sys/src/features/gen_PannerOptions.rs b/crates/web-sys/src/features/gen_PannerOptions.rs index 357ea977eb0..2447947c572 100644 --- a/crates/web-sys/src/features/gen_PannerOptions.rs +++ b/crates/web-sys/src/features/gen_PannerOptions.rs @@ -10,44 +10,184 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] pub type PannerOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &PannerOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &PannerOptions, val: u32); + pub fn set_channel_count(this: &PannerOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `PannerOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &PannerOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `PannerOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &PannerOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &PannerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `PannerOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &PannerOptions) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `PannerOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &PannerOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &PannerOptions, val: ChannelInterpretation); + #[doc = "Get the `coneInnerAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "coneInnerAngle")] + pub fn get_cone_inner_angle(this: &PannerOptions) -> Option; + #[doc = "Change the `coneInnerAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "coneInnerAngle")] - fn cone_inner_angle_shim(this: &PannerOptions, val: f64); + pub fn set_cone_inner_angle(this: &PannerOptions, val: f64); + #[doc = "Get the `coneOuterAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "coneOuterAngle")] + pub fn get_cone_outer_angle(this: &PannerOptions) -> Option; + #[doc = "Change the `coneOuterAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "coneOuterAngle")] - fn cone_outer_angle_shim(this: &PannerOptions, val: f64); + pub fn set_cone_outer_angle(this: &PannerOptions, val: f64); + #[doc = "Get the `coneOuterGain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "coneOuterGain")] + pub fn get_cone_outer_gain(this: &PannerOptions) -> Option; + #[doc = "Change the `coneOuterGain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "coneOuterGain")] - fn cone_outer_gain_shim(this: &PannerOptions, val: f64); + pub fn set_cone_outer_gain(this: &PannerOptions, val: f64); + #[cfg(feature = "DistanceModelType")] + #[doc = "Get the `distanceModel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DistanceModelType`, `PannerOptions`*"] + #[wasm_bindgen(method, getter = "distanceModel")] + pub fn get_distance_model(this: &PannerOptions) -> Option; #[cfg(feature = "DistanceModelType")] + #[doc = "Change the `distanceModel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DistanceModelType`, `PannerOptions`*"] #[wasm_bindgen(method, setter = "distanceModel")] - fn distance_model_shim(this: &PannerOptions, val: DistanceModelType); + pub fn set_distance_model(this: &PannerOptions, val: DistanceModelType); + #[doc = "Get the `maxDistance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "maxDistance")] + pub fn get_max_distance(this: &PannerOptions) -> Option; + #[doc = "Change the `maxDistance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "maxDistance")] - fn max_distance_shim(this: &PannerOptions, val: f64); + pub fn set_max_distance(this: &PannerOptions, val: f64); + #[doc = "Get the `orientationX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "orientationX")] + pub fn get_orientation_x(this: &PannerOptions) -> Option; + #[doc = "Change the `orientationX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "orientationX")] - fn orientation_x_shim(this: &PannerOptions, val: f32); + pub fn set_orientation_x(this: &PannerOptions, val: f32); + #[doc = "Get the `orientationY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "orientationY")] + pub fn get_orientation_y(this: &PannerOptions) -> Option; + #[doc = "Change the `orientationY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "orientationY")] - fn orientation_y_shim(this: &PannerOptions, val: f32); + pub fn set_orientation_y(this: &PannerOptions, val: f32); + #[doc = "Get the `orientationZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "orientationZ")] + pub fn get_orientation_z(this: &PannerOptions) -> Option; + #[doc = "Change the `orientationZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "orientationZ")] - fn orientation_z_shim(this: &PannerOptions, val: f32); + pub fn set_orientation_z(this: &PannerOptions, val: f32); #[cfg(feature = "PanningModelType")] + #[doc = "Get the `panningModel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`, `PanningModelType`*"] + #[wasm_bindgen(method, getter = "panningModel")] + pub fn get_panning_model(this: &PannerOptions) -> Option; + #[cfg(feature = "PanningModelType")] + #[doc = "Change the `panningModel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`, `PanningModelType`*"] #[wasm_bindgen(method, setter = "panningModel")] - fn panning_model_shim(this: &PannerOptions, val: PanningModelType); + pub fn set_panning_model(this: &PannerOptions, val: PanningModelType); + #[doc = "Get the `positionX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "positionX")] + pub fn get_position_x(this: &PannerOptions) -> Option; + #[doc = "Change the `positionX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "positionX")] - fn position_x_shim(this: &PannerOptions, val: f32); + pub fn set_position_x(this: &PannerOptions, val: f32); + #[doc = "Get the `positionY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "positionY")] + pub fn get_position_y(this: &PannerOptions) -> Option; + #[doc = "Change the `positionY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "positionY")] - fn position_y_shim(this: &PannerOptions, val: f32); + pub fn set_position_y(this: &PannerOptions, val: f32); + #[doc = "Get the `positionZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "positionZ")] + pub fn get_position_z(this: &PannerOptions) -> Option; + #[doc = "Change the `positionZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "positionZ")] - fn position_z_shim(this: &PannerOptions, val: f32); + pub fn set_position_z(this: &PannerOptions, val: f32); + #[doc = "Get the `refDistance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "refDistance")] + pub fn get_ref_distance(this: &PannerOptions) -> Option; + #[doc = "Change the `refDistance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "refDistance")] - fn ref_distance_shim(this: &PannerOptions, val: f64); + pub fn set_ref_distance(this: &PannerOptions, val: f64); + #[doc = "Get the `rolloffFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[wasm_bindgen(method, getter = "rolloffFactor")] + pub fn get_rolloff_factor(this: &PannerOptions) -> Option; + #[doc = "Change the `rolloffFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] #[wasm_bindgen(method, setter = "rolloffFactor")] - fn rolloff_factor_shim(this: &PannerOptions, val: f64); + pub fn set_rolloff_factor(this: &PannerOptions, val: f64); } impl PannerOptions { #[doc = "Construct a new `PannerOptions`."] @@ -58,127 +198,93 @@ impl PannerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `PannerOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `PannerOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `coneInnerAngle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_cone_inner_angle()` instead."] pub fn cone_inner_angle(&mut self, val: f64) -> &mut Self { - self.cone_inner_angle_shim(val); + self.set_cone_inner_angle(val); self } - #[doc = "Change the `coneOuterAngle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_cone_outer_angle()` instead."] pub fn cone_outer_angle(&mut self, val: f64) -> &mut Self { - self.cone_outer_angle_shim(val); + self.set_cone_outer_angle(val); self } - #[doc = "Change the `coneOuterGain` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_cone_outer_gain()` instead."] pub fn cone_outer_gain(&mut self, val: f64) -> &mut Self { - self.cone_outer_gain_shim(val); + self.set_cone_outer_gain(val); self } #[cfg(feature = "DistanceModelType")] - #[doc = "Change the `distanceModel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DistanceModelType`, `PannerOptions`*"] + #[deprecated = "Use `set_distance_model()` instead."] pub fn distance_model(&mut self, val: DistanceModelType) -> &mut Self { - self.distance_model_shim(val); + self.set_distance_model(val); self } - #[doc = "Change the `maxDistance` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_max_distance()` instead."] pub fn max_distance(&mut self, val: f64) -> &mut Self { - self.max_distance_shim(val); + self.set_max_distance(val); self } - #[doc = "Change the `orientationX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_orientation_x()` instead."] pub fn orientation_x(&mut self, val: f32) -> &mut Self { - self.orientation_x_shim(val); + self.set_orientation_x(val); self } - #[doc = "Change the `orientationY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_orientation_y()` instead."] pub fn orientation_y(&mut self, val: f32) -> &mut Self { - self.orientation_y_shim(val); + self.set_orientation_y(val); self } - #[doc = "Change the `orientationZ` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_orientation_z()` instead."] pub fn orientation_z(&mut self, val: f32) -> &mut Self { - self.orientation_z_shim(val); + self.set_orientation_z(val); self } #[cfg(feature = "PanningModelType")] - #[doc = "Change the `panningModel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`, `PanningModelType`*"] + #[deprecated = "Use `set_panning_model()` instead."] pub fn panning_model(&mut self, val: PanningModelType) -> &mut Self { - self.panning_model_shim(val); + self.set_panning_model(val); self } - #[doc = "Change the `positionX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_position_x()` instead."] pub fn position_x(&mut self, val: f32) -> &mut Self { - self.position_x_shim(val); + self.set_position_x(val); self } - #[doc = "Change the `positionY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_position_y()` instead."] pub fn position_y(&mut self, val: f32) -> &mut Self { - self.position_y_shim(val); + self.set_position_y(val); self } - #[doc = "Change the `positionZ` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_position_z()` instead."] pub fn position_z(&mut self, val: f32) -> &mut Self { - self.position_z_shim(val); + self.set_position_z(val); self } - #[doc = "Change the `refDistance` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_ref_distance()` instead."] pub fn ref_distance(&mut self, val: f64) -> &mut Self { - self.ref_distance_shim(val); + self.set_ref_distance(val); self } - #[doc = "Change the `rolloffFactor` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PannerOptions`*"] + #[deprecated = "Use `set_rolloff_factor()` instead."] pub fn rolloff_factor(&mut self, val: f64) -> &mut Self { - self.rolloff_factor_shim(val); + self.set_rolloff_factor(val); self } } diff --git a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs index 91144f4a6e6..704c8b3e6de 100644 --- a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] pub type PaymentMethodChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PaymentMethodChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PaymentMethodChangeEventInit, val: bool); + pub fn set_bubbles(this: &PaymentMethodChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PaymentMethodChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PaymentMethodChangeEventInit, val: bool); + pub fn set_cancelable(this: &PaymentMethodChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PaymentMethodChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PaymentMethodChangeEventInit, val: bool); + pub fn set_composed(this: &PaymentMethodChangeEventInit, val: bool); + #[doc = "Get the `methodDetails` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[wasm_bindgen(method, getter = "methodDetails")] + pub fn get_method_details(this: &PaymentMethodChangeEventInit) -> Option<::js_sys::Object>; + #[doc = "Change the `methodDetails` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, setter = "methodDetails")] - fn method_details_shim(this: &PaymentMethodChangeEventInit, val: Option<&::js_sys::Object>); + pub fn set_method_details(this: &PaymentMethodChangeEventInit, val: Option<&::js_sys::Object>); + #[doc = "Get the `methodName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[wasm_bindgen(method, getter = "methodName")] + pub fn get_method_name(this: &PaymentMethodChangeEventInit) -> String; + #[doc = "Change the `methodName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, setter = "methodName")] - fn method_name_shim(this: &PaymentMethodChangeEventInit, val: &str); + pub fn set_method_name(this: &PaymentMethodChangeEventInit, val: &str); } impl PaymentMethodChangeEventInit { #[doc = "Construct a new `PaymentMethodChangeEventInit`."] @@ -31,39 +71,29 @@ impl PaymentMethodChangeEventInit { ret.method_name(method_name); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `methodDetails` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[deprecated = "Use `set_method_details()` instead."] pub fn method_details(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.method_details_shim(val); + self.set_method_details(val); self } - #[doc = "Change the `methodName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] + #[deprecated = "Use `set_method_name()` instead."] pub fn method_name(&mut self, val: &str) -> &mut Self { - self.method_name_shim(val); + self.set_method_name(val); self } } diff --git a/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs b/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs index 0b096480b99..1ee2b715532 100644 --- a/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentRequestUpdateEventInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] pub type PaymentRequestUpdateEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PaymentRequestUpdateEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PaymentRequestUpdateEventInit, val: bool); + pub fn set_bubbles(this: &PaymentRequestUpdateEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PaymentRequestUpdateEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PaymentRequestUpdateEventInit, val: bool); + pub fn set_cancelable(this: &PaymentRequestUpdateEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PaymentRequestUpdateEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PaymentRequestUpdateEventInit, val: bool); + pub fn set_composed(this: &PaymentRequestUpdateEventInit, val: bool); } impl PaymentRequestUpdateEventInit { #[doc = "Construct a new `PaymentRequestUpdateEventInit`."] @@ -26,25 +50,19 @@ impl PaymentRequestUpdateEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PaymentRequestUpdateEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } } diff --git a/crates/web-sys/src/features/gen_Pbkdf2Params.rs b/crates/web-sys/src/features/gen_Pbkdf2Params.rs index 744c157c142..63318841580 100644 --- a/crates/web-sys/src/features/gen_Pbkdf2Params.rs +++ b/crates/web-sys/src/features/gen_Pbkdf2Params.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] pub type Pbkdf2Params; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &Pbkdf2Params) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &Pbkdf2Params, val: &str); + pub fn set_name(this: &Pbkdf2Params, val: &str); + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &Pbkdf2Params) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &Pbkdf2Params, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &Pbkdf2Params, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[wasm_bindgen(method, getter = "iterations")] + pub fn get_iterations(this: &Pbkdf2Params) -> u32; + #[doc = "Change the `iterations` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] #[wasm_bindgen(method, setter = "iterations")] - fn iterations_shim(this: &Pbkdf2Params, val: u32); + pub fn set_iterations(this: &Pbkdf2Params, val: u32); + #[doc = "Get the `salt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[wasm_bindgen(method, getter = "salt")] + pub fn get_salt(this: &Pbkdf2Params) -> ::js_sys::Object; + #[doc = "Change the `salt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] #[wasm_bindgen(method, setter = "salt")] - fn salt_shim(this: &Pbkdf2Params, val: &::js_sys::Object); + pub fn set_salt(this: &Pbkdf2Params, val: &::js_sys::Object); } impl Pbkdf2Params { #[doc = "Construct a new `Pbkdf2Params`."] @@ -37,32 +69,24 @@ impl Pbkdf2Params { ret.salt(salt); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } - #[doc = "Change the `iterations` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[deprecated = "Use `set_iterations()` instead."] pub fn iterations(&mut self, val: u32) -> &mut Self { - self.iterations_shim(val); + self.set_iterations(val); self } - #[doc = "Change the `salt` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] + #[deprecated = "Use `set_salt()` instead."] pub fn salt(&mut self, val: &::js_sys::Object) -> &mut Self { - self.salt_shim(val); + self.set_salt(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs index b83c1ba16a4..a8c4e2a9e28 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs @@ -10,24 +10,96 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] pub type PerformanceEntryEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PerformanceEntryEventInit, val: bool); + pub fn set_bubbles(this: &PerformanceEntryEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PerformanceEntryEventInit, val: bool); + pub fn set_cancelable(this: &PerformanceEntryEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PerformanceEntryEventInit, val: bool); + pub fn set_composed(this: &PerformanceEntryEventInit, val: bool); + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &PerformanceEntryEventInit, val: f64); + pub fn set_duration(this: &PerformanceEntryEventInit, val: f64); + #[doc = "Get the `entryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "entryType")] + pub fn get_entry_type(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `entryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "entryType")] - fn entry_type_shim(this: &PerformanceEntryEventInit, val: &str); + pub fn set_entry_type(this: &PerformanceEntryEventInit, val: &str); + #[doc = "Get the `epoch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "epoch")] + pub fn get_epoch(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `epoch` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "epoch")] - fn epoch_shim(this: &PerformanceEntryEventInit, val: f64); + pub fn set_epoch(this: &PerformanceEntryEventInit, val: f64); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PerformanceEntryEventInit, val: &str); + pub fn set_name(this: &PerformanceEntryEventInit, val: &str); + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &PerformanceEntryEventInit, val: &str); + pub fn set_origin(this: &PerformanceEntryEventInit, val: &str); + #[doc = "Get the `startTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[wasm_bindgen(method, getter = "startTime")] + pub fn get_start_time(this: &PerformanceEntryEventInit) -> Option; + #[doc = "Change the `startTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, setter = "startTime")] - fn start_time_shim(this: &PerformanceEntryEventInit, val: f64); + pub fn set_start_time(this: &PerformanceEntryEventInit, val: f64); } impl PerformanceEntryEventInit { #[doc = "Construct a new `PerformanceEntryEventInit`."] @@ -38,67 +110,49 @@ impl PerformanceEntryEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `duration` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_duration()` instead."] pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); + self.set_duration(val); self } - #[doc = "Change the `entryType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_entry_type()` instead."] pub fn entry_type(&mut self, val: &str) -> &mut Self { - self.entry_type_shim(val); + self.set_entry_type(val); self } - #[doc = "Change the `epoch` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_epoch()` instead."] pub fn epoch(&mut self, val: f64) -> &mut Self { - self.epoch_shim(val); + self.set_epoch(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &str) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `startTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] + #[deprecated = "Use `set_start_time()` instead."] pub fn start_time(&mut self, val: f64) -> &mut Self { - self.start_time_shim(val); + self.set_start_time(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs index f126babe13d..9300c84489a 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] pub type PerformanceEntryFilterOptions; + #[doc = "Get the `entryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[wasm_bindgen(method, getter = "entryType")] + pub fn get_entry_type(this: &PerformanceEntryFilterOptions) -> Option; + #[doc = "Change the `entryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, setter = "entryType")] - fn entry_type_shim(this: &PerformanceEntryFilterOptions, val: &str); + pub fn set_entry_type(this: &PerformanceEntryFilterOptions, val: &str); + #[doc = "Get the `initiatorType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[wasm_bindgen(method, getter = "initiatorType")] + pub fn get_initiator_type(this: &PerformanceEntryFilterOptions) -> Option; + #[doc = "Change the `initiatorType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, setter = "initiatorType")] - fn initiator_type_shim(this: &PerformanceEntryFilterOptions, val: &str); + pub fn set_initiator_type(this: &PerformanceEntryFilterOptions, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PerformanceEntryFilterOptions) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PerformanceEntryFilterOptions, val: &str); + pub fn set_name(this: &PerformanceEntryFilterOptions, val: &str); } impl PerformanceEntryFilterOptions { #[doc = "Construct a new `PerformanceEntryFilterOptions`."] @@ -26,25 +50,19 @@ impl PerformanceEntryFilterOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `entryType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[deprecated = "Use `set_entry_type()` instead."] pub fn entry_type(&mut self, val: &str) -> &mut Self { - self.entry_type_shim(val); + self.set_entry_type(val); self } - #[doc = "Change the `initiatorType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[deprecated = "Use `set_initiator_type()` instead."] pub fn initiator_type(&mut self, val: &str) -> &mut Self { - self.initiator_type_shim(val); + self.set_initiator_type(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs index d7ab2ac72b8..5a09e11a391 100644 --- a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] pub type PerformanceObserverInit; + #[doc = "Get the `buffered` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] + #[wasm_bindgen(method, getter = "buffered")] + pub fn get_buffered(this: &PerformanceObserverInit) -> Option; + #[doc = "Change the `buffered` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] #[wasm_bindgen(method, setter = "buffered")] - fn buffered_shim(this: &PerformanceObserverInit, val: bool); + pub fn set_buffered(this: &PerformanceObserverInit, val: bool); + #[doc = "Get the `entryTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] + #[wasm_bindgen(method, getter = "entryTypes")] + pub fn get_entry_types(this: &PerformanceObserverInit) -> ::js_sys::Array; + #[doc = "Change the `entryTypes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] #[wasm_bindgen(method, setter = "entryTypes")] - fn entry_types_shim(this: &PerformanceObserverInit, val: &::wasm_bindgen::JsValue); + pub fn set_entry_types(this: &PerformanceObserverInit, val: &::wasm_bindgen::JsValue); } impl PerformanceObserverInit { #[doc = "Construct a new `PerformanceObserverInit`."] @@ -25,18 +41,14 @@ impl PerformanceObserverInit { ret.entry_types(entry_types); ret } - #[doc = "Change the `buffered` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] + #[deprecated = "Use `set_buffered()` instead."] pub fn buffered(&mut self, val: bool) -> &mut Self { - self.buffered_shim(val); + self.set_buffered(val); self } - #[doc = "Change the `entryTypes` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PerformanceObserverInit`*"] + #[deprecated = "Use `set_entry_types()` instead."] pub fn entry_types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.entry_types_shim(val); + self.set_entry_types(val); self } } diff --git a/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs b/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs index 66005726781..d861b30c138 100644 --- a/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs +++ b/crates/web-sys/src/features/gen_PeriodicWaveConstraints.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] pub type PeriodicWaveConstraints; + #[doc = "Get the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] + #[wasm_bindgen(method, getter = "disableNormalization")] + pub fn get_disable_normalization(this: &PeriodicWaveConstraints) -> Option; + #[doc = "Change the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] #[wasm_bindgen(method, setter = "disableNormalization")] - fn disable_normalization_shim(this: &PeriodicWaveConstraints, val: bool); + pub fn set_disable_normalization(this: &PeriodicWaveConstraints, val: bool); } impl PeriodicWaveConstraints { #[doc = "Construct a new `PeriodicWaveConstraints`."] @@ -22,11 +30,9 @@ impl PeriodicWaveConstraints { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `disableNormalization` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveConstraints`*"] + #[deprecated = "Use `set_disable_normalization()` instead."] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - self.disable_normalization_shim(val); + self.set_disable_normalization(val); self } } diff --git a/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs b/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs index 60a33a1061d..d2adf3247e4 100644 --- a/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs +++ b/crates/web-sys/src/features/gen_PeriodicWaveOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] pub type PeriodicWaveOptions; + #[doc = "Get the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[wasm_bindgen(method, getter = "disableNormalization")] + pub fn get_disable_normalization(this: &PeriodicWaveOptions) -> Option; + #[doc = "Change the `disableNormalization` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] #[wasm_bindgen(method, setter = "disableNormalization")] - fn disable_normalization_shim(this: &PeriodicWaveOptions, val: bool); + pub fn set_disable_normalization(this: &PeriodicWaveOptions, val: bool); + #[doc = "Get the `imag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[wasm_bindgen(method, getter = "imag")] + pub fn get_imag(this: &PeriodicWaveOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `imag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] #[wasm_bindgen(method, setter = "imag")] - fn imag_shim(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); + pub fn set_imag(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `real` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[wasm_bindgen(method, getter = "real")] + pub fn get_real(this: &PeriodicWaveOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `real` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] #[wasm_bindgen(method, setter = "real")] - fn real_shim(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); + pub fn set_real(this: &PeriodicWaveOptions, val: &::wasm_bindgen::JsValue); } impl PeriodicWaveOptions { #[doc = "Construct a new `PeriodicWaveOptions`."] @@ -26,25 +50,19 @@ impl PeriodicWaveOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `disableNormalization` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[deprecated = "Use `set_disable_normalization()` instead."] pub fn disable_normalization(&mut self, val: bool) -> &mut Self { - self.disable_normalization_shim(val); + self.set_disable_normalization(val); self } - #[doc = "Change the `imag` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[deprecated = "Use `set_imag()` instead."] pub fn imag(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.imag_shim(val); + self.set_imag(val); self } - #[doc = "Change the `real` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PeriodicWaveOptions`*"] + #[deprecated = "Use `set_real()` instead."] pub fn real(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.real_shim(val); + self.set_real(val); self } } diff --git a/crates/web-sys/src/features/gen_PermissionDescriptor.rs b/crates/web-sys/src/features/gen_PermissionDescriptor.rs index 5d5777773f3..23005e4591f 100644 --- a/crates/web-sys/src/features/gen_PermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_PermissionDescriptor.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`*"] pub type PermissionDescriptor; #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`, `PermissionName`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PermissionDescriptor) -> PermissionName; + #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`, `PermissionName`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PermissionDescriptor, val: PermissionName); + pub fn set_name(this: &PermissionDescriptor, val: PermissionName); } impl PermissionDescriptor { #[cfg(feature = "PermissionName")] @@ -26,11 +35,9 @@ impl PermissionDescriptor { ret } #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PermissionDescriptor`, `PermissionName`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_PlaneLayout.rs b/crates/web-sys/src/features/gen_PlaneLayout.rs index d5859a0db5a..5b6df33cc86 100644 --- a/crates/web-sys/src/features/gen_PlaneLayout.rs +++ b/crates/web-sys/src/features/gen_PlaneLayout.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type PlaneLayout; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "offset")] + pub fn get_offset(this: &PlaneLayout) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `offset` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - fn offset_shim(this: &PlaneLayout, val: u32); + pub fn set_offset(this: &PlaneLayout, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stride` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stride")] + pub fn get_stride(this: &PlaneLayout) -> u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `stride` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "stride")] - fn stride_shim(this: &PlaneLayout, val: u32); + pub fn set_stride(this: &PlaneLayout, val: u32); } #[cfg(web_sys_unstable_apis)] impl PlaneLayout { @@ -35,25 +67,15 @@ impl PlaneLayout { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `offset` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_offset()` instead."] pub fn offset(&mut self, val: u32) -> &mut Self { - self.offset_shim(val); + self.set_offset(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `stride` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PlaneLayout`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_stride()` instead."] pub fn stride(&mut self, val: u32) -> &mut Self { - self.stride_shim(val); + self.set_stride(val); self } } diff --git a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs index 4a1f9c3f77d..ec2914c4923 100644 --- a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs +++ b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs @@ -10,26 +10,106 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] pub type PluginCrashedEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PluginCrashedEventInit, val: bool); + pub fn set_bubbles(this: &PluginCrashedEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PluginCrashedEventInit, val: bool); + pub fn set_cancelable(this: &PluginCrashedEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PluginCrashedEventInit, val: bool); + pub fn set_composed(this: &PluginCrashedEventInit, val: bool); + #[doc = "Get the `browserDumpID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "browserDumpID")] + pub fn get_browser_dump_id(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `browserDumpID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "browserDumpID")] - fn browser_dump_id_shim(this: &PluginCrashedEventInit, val: Option<&str>); + pub fn set_browser_dump_id(this: &PluginCrashedEventInit, val: Option<&str>); + #[doc = "Get the `gmpPlugin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "gmpPlugin")] + pub fn get_gmp_plugin(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `gmpPlugin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "gmpPlugin")] - fn gmp_plugin_shim(this: &PluginCrashedEventInit, val: bool); + pub fn set_gmp_plugin(this: &PluginCrashedEventInit, val: bool); + #[doc = "Get the `pluginDumpID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "pluginDumpID")] + pub fn get_plugin_dump_id(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `pluginDumpID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "pluginDumpID")] - fn plugin_dump_id_shim(this: &PluginCrashedEventInit, val: &str); + pub fn set_plugin_dump_id(this: &PluginCrashedEventInit, val: &str); + #[doc = "Get the `pluginFilename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "pluginFilename")] + pub fn get_plugin_filename(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `pluginFilename` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "pluginFilename")] - fn plugin_filename_shim(this: &PluginCrashedEventInit, val: Option<&str>); + pub fn set_plugin_filename(this: &PluginCrashedEventInit, val: Option<&str>); + #[doc = "Get the `pluginID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "pluginID")] + pub fn get_plugin_id(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `pluginID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "pluginID")] - fn plugin_id_shim(this: &PluginCrashedEventInit, val: u32); + pub fn set_plugin_id(this: &PluginCrashedEventInit, val: u32); + #[doc = "Get the `pluginName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "pluginName")] + pub fn get_plugin_name(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `pluginName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "pluginName")] - fn plugin_name_shim(this: &PluginCrashedEventInit, val: &str); + pub fn set_plugin_name(this: &PluginCrashedEventInit, val: &str); + #[doc = "Get the `submittedCrashReport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[wasm_bindgen(method, getter = "submittedCrashReport")] + pub fn get_submitted_crash_report(this: &PluginCrashedEventInit) -> Option; + #[doc = "Change the `submittedCrashReport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, setter = "submittedCrashReport")] - fn submitted_crash_report_shim(this: &PluginCrashedEventInit, val: bool); + pub fn set_submitted_crash_report(this: &PluginCrashedEventInit, val: bool); } impl PluginCrashedEventInit { #[doc = "Construct a new `PluginCrashedEventInit`."] @@ -40,74 +120,54 @@ impl PluginCrashedEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `browserDumpID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_browser_dump_id()` instead."] pub fn browser_dump_id(&mut self, val: Option<&str>) -> &mut Self { - self.browser_dump_id_shim(val); + self.set_browser_dump_id(val); self } - #[doc = "Change the `gmpPlugin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_gmp_plugin()` instead."] pub fn gmp_plugin(&mut self, val: bool) -> &mut Self { - self.gmp_plugin_shim(val); + self.set_gmp_plugin(val); self } - #[doc = "Change the `pluginDumpID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_plugin_dump_id()` instead."] pub fn plugin_dump_id(&mut self, val: &str) -> &mut Self { - self.plugin_dump_id_shim(val); + self.set_plugin_dump_id(val); self } - #[doc = "Change the `pluginFilename` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_plugin_filename()` instead."] pub fn plugin_filename(&mut self, val: Option<&str>) -> &mut Self { - self.plugin_filename_shim(val); + self.set_plugin_filename(val); self } - #[doc = "Change the `pluginID` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_plugin_id()` instead."] pub fn plugin_id(&mut self, val: u32) -> &mut Self { - self.plugin_id_shim(val); + self.set_plugin_id(val); self } - #[doc = "Change the `pluginName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_plugin_name()` instead."] pub fn plugin_name(&mut self, val: &str) -> &mut Self { - self.plugin_name_shim(val); + self.set_plugin_name(val); self } - #[doc = "Change the `submittedCrashReport` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] + #[deprecated = "Use `set_submitted_crash_report()` instead."] pub fn submitted_crash_report(&mut self, val: bool) -> &mut Self { - self.submitted_crash_report_shim(val); + self.set_submitted_crash_report(val); self } } diff --git a/crates/web-sys/src/features/gen_PointerEventInit.rs b/crates/web-sys/src/features/gen_PointerEventInit.rs index 33a30240346..c07ee4a26d4 100644 --- a/crates/web-sys/src/features/gen_PointerEventInit.rs +++ b/crates/web-sys/src/features/gen_PointerEventInit.rs @@ -10,84 +10,390 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] pub type PointerEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PointerEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PointerEventInit, val: bool); + pub fn set_bubbles(this: &PointerEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PointerEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PointerEventInit, val: bool); + pub fn set_cancelable(this: &PointerEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PointerEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PointerEventInit, val: bool); + pub fn set_composed(this: &PointerEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &PointerEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &PointerEventInit, val: i32); + pub fn set_detail(this: &PointerEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &PointerEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &PointerEventInit, val: Option<&Window>); + pub fn set_view(this: &PointerEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &PointerEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &PointerEventInit, val: bool); + pub fn set_alt_key(this: &PointerEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &PointerEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &PointerEventInit, val: bool); + pub fn set_ctrl_key(this: &PointerEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &PointerEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &PointerEventInit, val: bool); + pub fn set_meta_key(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_fn(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_num_lock(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_os(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_symbol(this: &PointerEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &PointerEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &PointerEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &PointerEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &PointerEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &PointerEventInit, val: bool); + pub fn set_shift_key(this: &PointerEventInit, val: bool); + #[doc = "Get the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "button")] + pub fn get_button(this: &PointerEventInit) -> Option; + #[doc = "Change the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "button")] - fn button_shim(this: &PointerEventInit, val: i16); + pub fn set_button(this: &PointerEventInit, val: i16); + #[doc = "Get the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "buttons")] + pub fn get_buttons(this: &PointerEventInit) -> Option; + #[doc = "Change the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "buttons")] - fn buttons_shim(this: &PointerEventInit, val: u16); + pub fn set_buttons(this: &PointerEventInit, val: u16); + #[doc = "Get the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "clientX")] + pub fn get_client_x(this: &PointerEventInit) -> Option; + #[doc = "Change the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "clientX")] - fn client_x_shim(this: &PointerEventInit, val: i32); + pub fn set_client_x(this: &PointerEventInit, val: i32); + #[doc = "Get the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "clientY")] + pub fn get_client_y(this: &PointerEventInit) -> Option; + #[doc = "Change the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "clientY")] - fn client_y_shim(this: &PointerEventInit, val: i32); + pub fn set_client_y(this: &PointerEventInit, val: i32); + #[doc = "Get the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "movementX")] + pub fn get_movement_x(this: &PointerEventInit) -> Option; + #[doc = "Change the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "movementX")] - fn movement_x_shim(this: &PointerEventInit, val: i32); + pub fn set_movement_x(this: &PointerEventInit, val: i32); + #[doc = "Get the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "movementY")] + pub fn get_movement_y(this: &PointerEventInit) -> Option; + #[doc = "Change the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "movementY")] - fn movement_y_shim(this: &PointerEventInit, val: i32); + pub fn set_movement_y(this: &PointerEventInit, val: i32); #[cfg(feature = "EventTarget")] + #[doc = "Get the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "relatedTarget")] + pub fn get_related_target(this: &PointerEventInit) -> Option; + #[cfg(feature = "EventTarget")] + #[doc = "Change the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `PointerEventInit`*"] #[wasm_bindgen(method, setter = "relatedTarget")] - fn related_target_shim(this: &PointerEventInit, val: Option<&EventTarget>); + pub fn set_related_target(this: &PointerEventInit, val: Option<&EventTarget>); + #[doc = "Get the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "screenX")] + pub fn get_screen_x(this: &PointerEventInit) -> Option; + #[doc = "Change the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "screenX")] - fn screen_x_shim(this: &PointerEventInit, val: i32); + pub fn set_screen_x(this: &PointerEventInit, val: i32); + #[doc = "Get the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "screenY")] + pub fn get_screen_y(this: &PointerEventInit) -> Option; + #[doc = "Change the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "screenY")] - fn screen_y_shim(this: &PointerEventInit, val: i32); + pub fn set_screen_y(this: &PointerEventInit, val: i32); + #[doc = "Get the `coalescedEvents` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "coalescedEvents")] + pub fn get_coalesced_events(this: &PointerEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `coalescedEvents` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "coalescedEvents")] - fn coalesced_events_shim(this: &PointerEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_coalesced_events(this: &PointerEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &PointerEventInit) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &PointerEventInit, val: i32); + pub fn set_height(this: &PointerEventInit, val: i32); + #[doc = "Get the `isPrimary` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "isPrimary")] + pub fn get_is_primary(this: &PointerEventInit) -> Option; + #[doc = "Change the `isPrimary` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "isPrimary")] - fn is_primary_shim(this: &PointerEventInit, val: bool); + pub fn set_is_primary(this: &PointerEventInit, val: bool); + #[doc = "Get the `pointerId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "pointerId")] + pub fn get_pointer_id(this: &PointerEventInit) -> Option; + #[doc = "Change the `pointerId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "pointerId")] - fn pointer_id_shim(this: &PointerEventInit, val: i32); + pub fn set_pointer_id(this: &PointerEventInit, val: i32); + #[doc = "Get the `pointerType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "pointerType")] + pub fn get_pointer_type(this: &PointerEventInit) -> Option; + #[doc = "Change the `pointerType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "pointerType")] - fn pointer_type_shim(this: &PointerEventInit, val: &str); + pub fn set_pointer_type(this: &PointerEventInit, val: &str); + #[doc = "Get the `pressure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "pressure")] + pub fn get_pressure(this: &PointerEventInit) -> Option; + #[doc = "Change the `pressure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "pressure")] - fn pressure_shim(this: &PointerEventInit, val: f32); + pub fn set_pressure(this: &PointerEventInit, val: f32); + #[doc = "Get the `tangentialPressure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "tangentialPressure")] + pub fn get_tangential_pressure(this: &PointerEventInit) -> Option; + #[doc = "Change the `tangentialPressure` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "tangentialPressure")] - fn tangential_pressure_shim(this: &PointerEventInit, val: f32); + pub fn set_tangential_pressure(this: &PointerEventInit, val: f32); + #[doc = "Get the `tiltX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "tiltX")] + pub fn get_tilt_x(this: &PointerEventInit) -> Option; + #[doc = "Change the `tiltX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "tiltX")] - fn tilt_x_shim(this: &PointerEventInit, val: i32); + pub fn set_tilt_x(this: &PointerEventInit, val: i32); + #[doc = "Get the `tiltY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "tiltY")] + pub fn get_tilt_y(this: &PointerEventInit) -> Option; + #[doc = "Change the `tiltY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "tiltY")] - fn tilt_y_shim(this: &PointerEventInit, val: i32); + pub fn set_tilt_y(this: &PointerEventInit, val: i32); + #[doc = "Get the `twist` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "twist")] + pub fn get_twist(this: &PointerEventInit) -> Option; + #[doc = "Change the `twist` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "twist")] - fn twist_shim(this: &PointerEventInit, val: i32); + pub fn set_twist(this: &PointerEventInit, val: i32); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &PointerEventInit) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &PointerEventInit, val: i32); + pub fn set_width(this: &PointerEventInit, val: i32); } impl PointerEventInit { #[doc = "Construct a new `PointerEventInit`."] @@ -98,272 +404,196 @@ impl PointerEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_button()` instead."] pub fn button(&mut self, val: i16) -> &mut Self { - self.button_shim(val); + self.set_button(val); self } - #[doc = "Change the `buttons` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_buttons()` instead."] pub fn buttons(&mut self, val: u16) -> &mut Self { - self.buttons_shim(val); + self.set_buttons(val); self } - #[doc = "Change the `clientX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_client_x()` instead."] pub fn client_x(&mut self, val: i32) -> &mut Self { - self.client_x_shim(val); + self.set_client_x(val); self } - #[doc = "Change the `clientY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_client_y()` instead."] pub fn client_y(&mut self, val: i32) -> &mut Self { - self.client_y_shim(val); + self.set_client_y(val); self } - #[doc = "Change the `movementX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_movement_x()` instead."] pub fn movement_x(&mut self, val: i32) -> &mut Self { - self.movement_x_shim(val); + self.set_movement_x(val); self } - #[doc = "Change the `movementY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_movement_y()` instead."] pub fn movement_y(&mut self, val: i32) -> &mut Self { - self.movement_y_shim(val); + self.set_movement_y(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `relatedTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `PointerEventInit`*"] + #[deprecated = "Use `set_related_target()` instead."] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - self.related_target_shim(val); + self.set_related_target(val); self } - #[doc = "Change the `screenX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_screen_x()` instead."] pub fn screen_x(&mut self, val: i32) -> &mut Self { - self.screen_x_shim(val); + self.set_screen_x(val); self } - #[doc = "Change the `screenY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_screen_y()` instead."] pub fn screen_y(&mut self, val: i32) -> &mut Self { - self.screen_y_shim(val); + self.set_screen_y(val); self } - #[doc = "Change the `coalescedEvents` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_coalesced_events()` instead."] pub fn coalesced_events(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.coalesced_events_shim(val); + self.set_coalesced_events(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: i32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `isPrimary` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_is_primary()` instead."] pub fn is_primary(&mut self, val: bool) -> &mut Self { - self.is_primary_shim(val); + self.set_is_primary(val); self } - #[doc = "Change the `pointerId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_pointer_id()` instead."] pub fn pointer_id(&mut self, val: i32) -> &mut Self { - self.pointer_id_shim(val); + self.set_pointer_id(val); self } - #[doc = "Change the `pointerType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_pointer_type()` instead."] pub fn pointer_type(&mut self, val: &str) -> &mut Self { - self.pointer_type_shim(val); + self.set_pointer_type(val); self } - #[doc = "Change the `pressure` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_pressure()` instead."] pub fn pressure(&mut self, val: f32) -> &mut Self { - self.pressure_shim(val); + self.set_pressure(val); self } - #[doc = "Change the `tangentialPressure` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_tangential_pressure()` instead."] pub fn tangential_pressure(&mut self, val: f32) -> &mut Self { - self.tangential_pressure_shim(val); + self.set_tangential_pressure(val); self } - #[doc = "Change the `tiltX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_tilt_x()` instead."] pub fn tilt_x(&mut self, val: i32) -> &mut Self { - self.tilt_x_shim(val); + self.set_tilt_x(val); self } - #[doc = "Change the `tiltY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_tilt_y()` instead."] pub fn tilt_y(&mut self, val: i32) -> &mut Self { - self.tilt_y_shim(val); + self.set_tilt_y(val); self } - #[doc = "Change the `twist` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_twist()` instead."] pub fn twist(&mut self, val: i32) -> &mut Self { - self.twist_shim(val); + self.set_twist(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: i32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_PopStateEventInit.rs b/crates/web-sys/src/features/gen_PopStateEventInit.rs index e00ea0f3eae..61178cc017e 100644 --- a/crates/web-sys/src/features/gen_PopStateEventInit.rs +++ b/crates/web-sys/src/features/gen_PopStateEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] pub type PopStateEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PopStateEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PopStateEventInit, val: bool); + pub fn set_bubbles(this: &PopStateEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PopStateEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PopStateEventInit, val: bool); + pub fn set_cancelable(this: &PopStateEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PopStateEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PopStateEventInit, val: bool); + pub fn set_composed(this: &PopStateEventInit, val: bool); + #[doc = "Get the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[wasm_bindgen(method, getter = "state")] + pub fn get_state(this: &PopStateEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] #[wasm_bindgen(method, setter = "state")] - fn state_shim(this: &PopStateEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_state(this: &PopStateEventInit, val: &::wasm_bindgen::JsValue); } impl PopStateEventInit { #[doc = "Construct a new `PopStateEventInit`."] @@ -28,32 +60,24 @@ impl PopStateEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `state` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopStateEventInit`*"] + #[deprecated = "Use `set_state()` instead."] pub fn state(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.state_shim(val); + self.set_state(val); self } } diff --git a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs index 3e1d3043190..94ae9d2c24d 100644 --- a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs +++ b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs @@ -10,19 +10,68 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] pub type PopupBlockedEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PopupBlockedEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PopupBlockedEventInit, val: bool); + pub fn set_bubbles(this: &PopupBlockedEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PopupBlockedEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PopupBlockedEventInit, val: bool); + pub fn set_cancelable(this: &PopupBlockedEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PopupBlockedEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PopupBlockedEventInit, val: bool); + pub fn set_composed(this: &PopupBlockedEventInit, val: bool); + #[doc = "Get the `popupWindowFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[wasm_bindgen(method, getter = "popupWindowFeatures")] + pub fn get_popup_window_features(this: &PopupBlockedEventInit) -> Option; + #[doc = "Change the `popupWindowFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, setter = "popupWindowFeatures")] - fn popup_window_features_shim(this: &PopupBlockedEventInit, val: &str); + pub fn set_popup_window_features(this: &PopupBlockedEventInit, val: &str); + #[doc = "Get the `popupWindowName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[wasm_bindgen(method, getter = "popupWindowName")] + pub fn get_popup_window_name(this: &PopupBlockedEventInit) -> Option; + #[doc = "Change the `popupWindowName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, setter = "popupWindowName")] - fn popup_window_name_shim(this: &PopupBlockedEventInit, val: &str); + pub fn set_popup_window_name(this: &PopupBlockedEventInit, val: &str); #[cfg(feature = "Window")] + #[doc = "Get the `requestingWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "requestingWindow")] + pub fn get_requesting_window(this: &PopupBlockedEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `requestingWindow` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "requestingWindow")] - fn requesting_window_shim(this: &PopupBlockedEventInit, val: Option<&Window>); + pub fn set_requesting_window(this: &PopupBlockedEventInit, val: Option<&Window>); } impl PopupBlockedEventInit { #[doc = "Construct a new `PopupBlockedEventInit`."] @@ -33,47 +82,35 @@ impl PopupBlockedEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `popupWindowFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[deprecated = "Use `set_popup_window_features()` instead."] pub fn popup_window_features(&mut self, val: &str) -> &mut Self { - self.popup_window_features_shim(val); + self.set_popup_window_features(val); self } - #[doc = "Change the `popupWindowName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] + #[deprecated = "Use `set_popup_window_name()` instead."] pub fn popup_window_name(&mut self, val: &str) -> &mut Self { - self.popup_window_name_shim(val); + self.set_popup_window_name(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `requestingWindow` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`, `Window`*"] + #[deprecated = "Use `set_requesting_window()` instead."] pub fn requesting_window(&mut self, val: Option<&Window>) -> &mut Self { - self.requesting_window_shim(val); + self.set_requesting_window(val); self } } diff --git a/crates/web-sys/src/features/gen_PositionOptions.rs b/crates/web-sys/src/features/gen_PositionOptions.rs index 2d5d5276299..63806556d61 100644 --- a/crates/web-sys/src/features/gen_PositionOptions.rs +++ b/crates/web-sys/src/features/gen_PositionOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] pub type PositionOptions; + #[doc = "Get the `enableHighAccuracy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[wasm_bindgen(method, getter = "enableHighAccuracy")] + pub fn get_enable_high_accuracy(this: &PositionOptions) -> Option; + #[doc = "Change the `enableHighAccuracy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] #[wasm_bindgen(method, setter = "enableHighAccuracy")] - fn enable_high_accuracy_shim(this: &PositionOptions, val: bool); + pub fn set_enable_high_accuracy(this: &PositionOptions, val: bool); + #[doc = "Get the `maximumAge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[wasm_bindgen(method, getter = "maximumAge")] + pub fn get_maximum_age(this: &PositionOptions) -> Option; + #[doc = "Change the `maximumAge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] #[wasm_bindgen(method, setter = "maximumAge")] - fn maximum_age_shim(this: &PositionOptions, val: u32); + pub fn set_maximum_age(this: &PositionOptions, val: u32); + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &PositionOptions) -> Option; + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] #[wasm_bindgen(method, setter = "timeout")] - fn timeout_shim(this: &PositionOptions, val: u32); + pub fn set_timeout(this: &PositionOptions, val: u32); } impl PositionOptions { #[doc = "Construct a new `PositionOptions`."] @@ -26,25 +50,19 @@ impl PositionOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `enableHighAccuracy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[deprecated = "Use `set_enable_high_accuracy()` instead."] pub fn enable_high_accuracy(&mut self, val: bool) -> &mut Self { - self.enable_high_accuracy_shim(val); + self.set_enable_high_accuracy(val); self } - #[doc = "Change the `maximumAge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[deprecated = "Use `set_maximum_age()` instead."] pub fn maximum_age(&mut self, val: u32) -> &mut Self { - self.maximum_age_shim(val); + self.set_maximum_age(val); self } - #[doc = "Change the `timeout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PositionOptions`*"] + #[deprecated = "Use `set_timeout()` instead."] pub fn timeout(&mut self, val: u32) -> &mut Self { - self.timeout_shim(val); + self.set_timeout(val); self } } diff --git a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs index 146db924710..22ef4de372d 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs @@ -10,15 +10,50 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] pub type PresentationConnectionAvailableEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PresentationConnectionAvailableEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + pub fn set_bubbles(this: &PresentationConnectionAvailableEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PresentationConnectionAvailableEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + pub fn set_cancelable(this: &PresentationConnectionAvailableEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PresentationConnectionAvailableEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PresentationConnectionAvailableEventInit, val: bool); + pub fn set_composed(this: &PresentationConnectionAvailableEventInit, val: bool); + #[cfg(feature = "PresentationConnection")] + #[doc = "Get the `connection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`, `PresentationConnectionAvailableEventInit`*"] + #[wasm_bindgen(method, getter = "connection")] + pub fn get_connection( + this: &PresentationConnectionAvailableEventInit, + ) -> PresentationConnection; #[cfg(feature = "PresentationConnection")] + #[doc = "Change the `connection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`, `PresentationConnectionAvailableEventInit`*"] #[wasm_bindgen(method, setter = "connection")] - fn connection_shim( + pub fn set_connection( this: &PresentationConnectionAvailableEventInit, val: &PresentationConnection, ); @@ -34,33 +69,25 @@ impl PresentationConnectionAvailableEventInit { ret.connection(connection); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionAvailableEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "PresentationConnection")] - #[doc = "Change the `connection` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`, `PresentationConnectionAvailableEventInit`*"] + #[deprecated = "Use `set_connection()` instead."] pub fn connection(&mut self, val: &PresentationConnection) -> &mut Self { - self.connection_shim(val); + self.set_connection(val); self } } diff --git a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs index c7786dacd06..aef67635b74 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs @@ -10,17 +10,60 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] pub type PresentationConnectionCloseEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PresentationConnectionCloseEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PresentationConnectionCloseEventInit, val: bool); + pub fn set_bubbles(this: &PresentationConnectionCloseEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PresentationConnectionCloseEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PresentationConnectionCloseEventInit, val: bool); + pub fn set_cancelable(this: &PresentationConnectionCloseEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PresentationConnectionCloseEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PresentationConnectionCloseEventInit, val: bool); + pub fn set_composed(this: &PresentationConnectionCloseEventInit, val: bool); + #[doc = "Get the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[wasm_bindgen(method, getter = "message")] + pub fn get_message(this: &PresentationConnectionCloseEventInit) -> Option; + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] #[wasm_bindgen(method, setter = "message")] - fn message_shim(this: &PresentationConnectionCloseEventInit, val: &str); + pub fn set_message(this: &PresentationConnectionCloseEventInit, val: &str); + #[cfg(feature = "PresentationConnectionClosedReason")] + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason( + this: &PresentationConnectionCloseEventInit, + ) -> PresentationConnectionClosedReason; #[cfg(feature = "PresentationConnectionClosedReason")] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim( + pub fn set_reason( this: &PresentationConnectionCloseEventInit, val: PresentationConnectionClosedReason, ); @@ -36,40 +79,30 @@ impl PresentationConnectionCloseEventInit { ret.reason(reason); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `message` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] + #[deprecated = "Use `set_message()` instead."] pub fn message(&mut self, val: &str) -> &mut Self { - self.message_shim(val); + self.set_message(val); self } #[cfg(feature = "PresentationConnectionClosedReason")] - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`, `PresentationConnectionClosedReason`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: PresentationConnectionClosedReason) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs b/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs index 7ab50ae8bb7..7dc5738b2d8 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineLayerRect.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] pub type ProfileTimelineLayerRect; + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &ProfileTimelineLayerRect) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &ProfileTimelineLayerRect, val: i32); + pub fn set_height(this: &ProfileTimelineLayerRect, val: i32); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &ProfileTimelineLayerRect) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &ProfileTimelineLayerRect, val: i32); + pub fn set_width(this: &ProfileTimelineLayerRect, val: i32); + #[doc = "Get the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[wasm_bindgen(method, getter = "x")] + pub fn get_x(this: &ProfileTimelineLayerRect) -> Option; + #[doc = "Change the `x` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] #[wasm_bindgen(method, setter = "x")] - fn x_shim(this: &ProfileTimelineLayerRect, val: i32); + pub fn set_x(this: &ProfileTimelineLayerRect, val: i32); + #[doc = "Get the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[wasm_bindgen(method, getter = "y")] + pub fn get_y(this: &ProfileTimelineLayerRect) -> Option; + #[doc = "Change the `y` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] #[wasm_bindgen(method, setter = "y")] - fn y_shim(this: &ProfileTimelineLayerRect, val: i32); + pub fn set_y(this: &ProfileTimelineLayerRect, val: i32); } impl ProfileTimelineLayerRect { #[doc = "Construct a new `ProfileTimelineLayerRect`."] @@ -28,32 +60,24 @@ impl ProfileTimelineLayerRect { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: i32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: i32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } - #[doc = "Change the `x` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[deprecated = "Use `set_x()` instead."] pub fn x(&mut self, val: i32) -> &mut Self { - self.x_shim(val); + self.set_x(val); self } - #[doc = "Change the `y` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineLayerRect`*"] + #[deprecated = "Use `set_y()` instead."] pub fn y(&mut self, val: i32) -> &mut Self { - self.y_shim(val); + self.set_y(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs index acd1885a31d..0aa2993c14a 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs @@ -10,41 +10,170 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] pub type ProfileTimelineMarker; + #[doc = "Get the `causeName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "causeName")] + pub fn get_cause_name(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `causeName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "causeName")] - fn cause_name_shim(this: &ProfileTimelineMarker, val: &str); + pub fn set_cause_name(this: &ProfileTimelineMarker, val: &str); + #[doc = "Get the `end` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "end")] + pub fn get_end(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `end` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "end")] - fn end_shim(this: &ProfileTimelineMarker, val: f64); + pub fn set_end(this: &ProfileTimelineMarker, val: f64); + #[doc = "Get the `endStack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "endStack")] + pub fn get_end_stack(this: &ProfileTimelineMarker) -> Option<::js_sys::Object>; + #[doc = "Change the `endStack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "endStack")] - fn end_stack_shim(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + pub fn set_end_stack(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + #[doc = "Get the `eventPhase` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "eventPhase")] + pub fn get_event_phase(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `eventPhase` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "eventPhase")] - fn event_phase_shim(this: &ProfileTimelineMarker, val: u16); + pub fn set_event_phase(this: &ProfileTimelineMarker, val: u16); + #[doc = "Get the `isAnimationOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "isAnimationOnly")] + pub fn get_is_animation_only(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `isAnimationOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "isAnimationOnly")] - fn is_animation_only_shim(this: &ProfileTimelineMarker, val: bool); + pub fn set_is_animation_only(this: &ProfileTimelineMarker, val: bool); + #[doc = "Get the `isOffMainThread` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "isOffMainThread")] + pub fn get_is_off_main_thread(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `isOffMainThread` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "isOffMainThread")] - fn is_off_main_thread_shim(this: &ProfileTimelineMarker, val: bool); + pub fn set_is_off_main_thread(this: &ProfileTimelineMarker, val: bool); #[cfg(feature = "ProfileTimelineMessagePortOperationType")] + #[doc = "Get the `messagePortOperation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineMessagePortOperationType`*"] + #[wasm_bindgen(method, getter = "messagePortOperation")] + pub fn get_message_port_operation( + this: &ProfileTimelineMarker, + ) -> Option; + #[cfg(feature = "ProfileTimelineMessagePortOperationType")] + #[doc = "Change the `messagePortOperation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineMessagePortOperationType`*"] #[wasm_bindgen(method, setter = "messagePortOperation")] - fn message_port_operation_shim( + pub fn set_message_port_operation( this: &ProfileTimelineMarker, val: ProfileTimelineMessagePortOperationType, ); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &ProfileTimelineMarker, val: &str); + pub fn set_name(this: &ProfileTimelineMarker, val: &str); + #[doc = "Get the `processType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "processType")] + pub fn get_process_type(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `processType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "processType")] - fn process_type_shim(this: &ProfileTimelineMarker, val: u16); + pub fn set_process_type(this: &ProfileTimelineMarker, val: u16); + #[doc = "Get the `rectangles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "rectangles")] + pub fn get_rectangles(this: &ProfileTimelineMarker) -> Option<::js_sys::Array>; + #[doc = "Change the `rectangles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "rectangles")] - fn rectangles_shim(this: &ProfileTimelineMarker, val: &::wasm_bindgen::JsValue); + pub fn set_rectangles(this: &ProfileTimelineMarker, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `stack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "stack")] + pub fn get_stack(this: &ProfileTimelineMarker) -> Option<::js_sys::Object>; + #[doc = "Change the `stack` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "stack")] - fn stack_shim(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + pub fn set_stack(this: &ProfileTimelineMarker, val: Option<&::js_sys::Object>); + #[doc = "Get the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "start")] + pub fn get_start(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "start")] - fn start_shim(this: &ProfileTimelineMarker, val: f64); + pub fn set_start(this: &ProfileTimelineMarker, val: f64); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &ProfileTimelineMarker, val: &str); + pub fn set_type(this: &ProfileTimelineMarker, val: &str); + #[doc = "Get the `unixTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[wasm_bindgen(method, getter = "unixTime")] + pub fn get_unix_time(this: &ProfileTimelineMarker) -> Option; + #[doc = "Change the `unixTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, setter = "unixTime")] - fn unix_time_shim(this: &ProfileTimelineMarker, val: f64); + pub fn set_unix_time(this: &ProfileTimelineMarker, val: f64); + #[cfg(feature = "ProfileTimelineWorkerOperationType")] + #[doc = "Get the `workerOperation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineWorkerOperationType`*"] + #[wasm_bindgen(method, getter = "workerOperation")] + pub fn get_worker_operation( + this: &ProfileTimelineMarker, + ) -> Option; #[cfg(feature = "ProfileTimelineWorkerOperationType")] + #[doc = "Change the `workerOperation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineWorkerOperationType`*"] #[wasm_bindgen(method, setter = "workerOperation")] - fn worker_operation_shim(this: &ProfileTimelineMarker, val: ProfileTimelineWorkerOperationType); + pub fn set_worker_operation( + this: &ProfileTimelineMarker, + val: ProfileTimelineWorkerOperationType, + ); } impl ProfileTimelineMarker { #[doc = "Construct a new `ProfileTimelineMarker`."] @@ -55,114 +184,84 @@ impl ProfileTimelineMarker { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `causeName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_cause_name()` instead."] pub fn cause_name(&mut self, val: &str) -> &mut Self { - self.cause_name_shim(val); + self.set_cause_name(val); self } - #[doc = "Change the `end` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_end()` instead."] pub fn end(&mut self, val: f64) -> &mut Self { - self.end_shim(val); + self.set_end(val); self } - #[doc = "Change the `endStack` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_end_stack()` instead."] pub fn end_stack(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.end_stack_shim(val); + self.set_end_stack(val); self } - #[doc = "Change the `eventPhase` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_event_phase()` instead."] pub fn event_phase(&mut self, val: u16) -> &mut Self { - self.event_phase_shim(val); + self.set_event_phase(val); self } - #[doc = "Change the `isAnimationOnly` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_is_animation_only()` instead."] pub fn is_animation_only(&mut self, val: bool) -> &mut Self { - self.is_animation_only_shim(val); + self.set_is_animation_only(val); self } - #[doc = "Change the `isOffMainThread` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_is_off_main_thread()` instead."] pub fn is_off_main_thread(&mut self, val: bool) -> &mut Self { - self.is_off_main_thread_shim(val); + self.set_is_off_main_thread(val); self } #[cfg(feature = "ProfileTimelineMessagePortOperationType")] - #[doc = "Change the `messagePortOperation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineMessagePortOperationType`*"] + #[deprecated = "Use `set_message_port_operation()` instead."] pub fn message_port_operation( &mut self, val: ProfileTimelineMessagePortOperationType, ) -> &mut Self { - self.message_port_operation_shim(val); + self.set_message_port_operation(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `processType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_process_type()` instead."] pub fn process_type(&mut self, val: u16) -> &mut Self { - self.process_type_shim(val); + self.set_process_type(val); self } - #[doc = "Change the `rectangles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_rectangles()` instead."] pub fn rectangles(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.rectangles_shim(val); + self.set_rectangles(val); self } - #[doc = "Change the `stack` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_stack()` instead."] pub fn stack(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.stack_shim(val); + self.set_stack(val); self } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_start()` instead."] pub fn start(&mut self, val: f64) -> &mut Self { - self.start_shim(val); + self.set_start(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `unixTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] + #[deprecated = "Use `set_unix_time()` instead."] pub fn unix_time(&mut self, val: f64) -> &mut Self { - self.unix_time_shim(val); + self.set_unix_time(val); self } #[cfg(feature = "ProfileTimelineWorkerOperationType")] - #[doc = "Change the `workerOperation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`, `ProfileTimelineWorkerOperationType`*"] + #[deprecated = "Use `set_worker_operation()` instead."] pub fn worker_operation(&mut self, val: ProfileTimelineWorkerOperationType) -> &mut Self { - self.worker_operation_shim(val); + self.set_worker_operation(val); self } } diff --git a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs index 33a4ac48f09..0c0181b6eee 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs @@ -10,20 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] pub type ProfileTimelineStackFrame; + #[doc = "Get the `asyncCause` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "asyncCause")] + pub fn get_async_cause(this: &ProfileTimelineStackFrame) -> Option; + #[doc = "Change the `asyncCause` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "asyncCause")] - fn async_cause_shim(this: &ProfileTimelineStackFrame, val: &str); + pub fn set_async_cause(this: &ProfileTimelineStackFrame, val: &str); + #[doc = "Get the `asyncParent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "asyncParent")] + pub fn get_async_parent(this: &ProfileTimelineStackFrame) -> Option<::js_sys::Object>; + #[doc = "Change the `asyncParent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "asyncParent")] - fn async_parent_shim(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + pub fn set_async_parent(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + #[doc = "Get the `column` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "column")] + pub fn get_column(this: &ProfileTimelineStackFrame) -> Option; + #[doc = "Change the `column` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "column")] - fn column_shim(this: &ProfileTimelineStackFrame, val: i32); + pub fn set_column(this: &ProfileTimelineStackFrame, val: i32); + #[doc = "Get the `functionDisplayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "functionDisplayName")] + pub fn get_function_display_name(this: &ProfileTimelineStackFrame) -> Option; + #[doc = "Change the `functionDisplayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "functionDisplayName")] - fn function_display_name_shim(this: &ProfileTimelineStackFrame, val: &str); + pub fn set_function_display_name(this: &ProfileTimelineStackFrame, val: &str); + #[doc = "Get the `line` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "line")] + pub fn get_line(this: &ProfileTimelineStackFrame) -> Option; + #[doc = "Change the `line` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "line")] - fn line_shim(this: &ProfileTimelineStackFrame, val: i32); + pub fn set_line(this: &ProfileTimelineStackFrame, val: i32); + #[doc = "Get the `parent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "parent")] + pub fn get_parent(this: &ProfileTimelineStackFrame) -> Option<::js_sys::Object>; + #[doc = "Change the `parent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "parent")] - fn parent_shim(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + pub fn set_parent(this: &ProfileTimelineStackFrame, val: Option<&::js_sys::Object>); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &ProfileTimelineStackFrame) -> Option; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &ProfileTimelineStackFrame, val: &str); + pub fn set_source(this: &ProfileTimelineStackFrame, val: &str); } impl ProfileTimelineStackFrame { #[doc = "Construct a new `ProfileTimelineStackFrame`."] @@ -34,53 +90,39 @@ impl ProfileTimelineStackFrame { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `asyncCause` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_async_cause()` instead."] pub fn async_cause(&mut self, val: &str) -> &mut Self { - self.async_cause_shim(val); + self.set_async_cause(val); self } - #[doc = "Change the `asyncParent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_async_parent()` instead."] pub fn async_parent(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.async_parent_shim(val); + self.set_async_parent(val); self } - #[doc = "Change the `column` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_column()` instead."] pub fn column(&mut self, val: i32) -> &mut Self { - self.column_shim(val); + self.set_column(val); self } - #[doc = "Change the `functionDisplayName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_function_display_name()` instead."] pub fn function_display_name(&mut self, val: &str) -> &mut Self { - self.function_display_name_shim(val); + self.set_function_display_name(val); self } - #[doc = "Change the `line` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_line()` instead."] pub fn line(&mut self, val: i32) -> &mut Self { - self.line_shim(val); + self.set_line(val); self } - #[doc = "Change the `parent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_parent()` instead."] pub fn parent(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.parent_shim(val); + self.set_parent(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: &str) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_ProgressEventInit.rs b/crates/web-sys/src/features/gen_ProgressEventInit.rs index f638b1dcad2..97a1fed65f7 100644 --- a/crates/web-sys/src/features/gen_ProgressEventInit.rs +++ b/crates/web-sys/src/features/gen_ProgressEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] pub type ProgressEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ProgressEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ProgressEventInit, val: bool); + pub fn set_bubbles(this: &ProgressEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ProgressEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ProgressEventInit, val: bool); + pub fn set_cancelable(this: &ProgressEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ProgressEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ProgressEventInit, val: bool); + pub fn set_composed(this: &ProgressEventInit, val: bool); + #[doc = "Get the `lengthComputable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "lengthComputable")] + pub fn get_length_computable(this: &ProgressEventInit) -> Option; + #[doc = "Change the `lengthComputable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "lengthComputable")] - fn length_computable_shim(this: &ProgressEventInit, val: bool); + pub fn set_length_computable(this: &ProgressEventInit, val: bool); + #[doc = "Get the `loaded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "loaded")] + pub fn get_loaded(this: &ProgressEventInit) -> Option; + #[doc = "Change the `loaded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "loaded")] - fn loaded_shim(this: &ProgressEventInit, val: f64); + pub fn set_loaded(this: &ProgressEventInit, val: f64); + #[doc = "Get the `total` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[wasm_bindgen(method, getter = "total")] + pub fn get_total(this: &ProgressEventInit) -> Option; + #[doc = "Change the `total` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] #[wasm_bindgen(method, setter = "total")] - fn total_shim(this: &ProgressEventInit, val: f64); + pub fn set_total(this: &ProgressEventInit, val: f64); } impl ProgressEventInit { #[doc = "Construct a new `ProgressEventInit`."] @@ -32,46 +80,34 @@ impl ProgressEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `lengthComputable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_length_computable()` instead."] pub fn length_computable(&mut self, val: bool) -> &mut Self { - self.length_computable_shim(val); + self.set_length_computable(val); self } - #[doc = "Change the `loaded` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_loaded()` instead."] pub fn loaded(&mut self, val: f64) -> &mut Self { - self.loaded_shim(val); + self.set_loaded(val); self } - #[doc = "Change the `total` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ProgressEventInit`*"] + #[deprecated = "Use `set_total()` instead."] pub fn total(&mut self, val: f64) -> &mut Self { - self.total_shim(val); + self.set_total(val); self } } diff --git a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs index 05effa91c6e..328fbe07318 100644 --- a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs +++ b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] pub type PromiseRejectionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PromiseRejectionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PromiseRejectionEventInit, val: bool); + pub fn set_bubbles(this: &PromiseRejectionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PromiseRejectionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PromiseRejectionEventInit, val: bool); + pub fn set_cancelable(this: &PromiseRejectionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PromiseRejectionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PromiseRejectionEventInit, val: bool); + pub fn set_composed(this: &PromiseRejectionEventInit, val: bool); + #[doc = "Get the `promise` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[wasm_bindgen(method, getter = "promise")] + pub fn get_promise(this: &PromiseRejectionEventInit) -> ::js_sys::Promise; + #[doc = "Change the `promise` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] #[wasm_bindgen(method, setter = "promise")] - fn promise_shim(this: &PromiseRejectionEventInit, val: &::js_sys::Promise); + pub fn set_promise(this: &PromiseRejectionEventInit, val: &::js_sys::Promise); + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &PromiseRejectionEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &PromiseRejectionEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_reason(this: &PromiseRejectionEventInit, val: &::wasm_bindgen::JsValue); } impl PromiseRejectionEventInit { #[doc = "Construct a new `PromiseRejectionEventInit`."] @@ -31,39 +71,29 @@ impl PromiseRejectionEventInit { ret.promise(promise); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `promise` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[deprecated = "Use `set_promise()` instead."] pub fn promise(&mut self, val: &::js_sys::Promise) -> &mut Self { - self.promise_shim(val); + self.set_promise(val); self } - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PromiseRejectionEventInit`*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs index bbd042e3033..630f3e6547a 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs @@ -11,43 +11,128 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] pub type PublicKeyCredentialCreationOptions; #[cfg(feature = "AttestationConveyancePreference")] + #[doc = "Get the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "attestation")] + pub fn get_attestation( + this: &PublicKeyCredentialCreationOptions, + ) -> Option; + #[cfg(feature = "AttestationConveyancePreference")] + #[doc = "Change the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "attestation")] - fn attestation_shim( + pub fn set_attestation( this: &PublicKeyCredentialCreationOptions, val: AttestationConveyancePreference, ); #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[doc = "Get the `authenticatorSelection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "authenticatorSelection")] + pub fn get_authenticator_selection( + this: &PublicKeyCredentialCreationOptions, + ) -> Option; + #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[doc = "Change the `authenticatorSelection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "authenticatorSelection")] - fn authenticator_selection_shim( + pub fn set_authenticator_selection( this: &PublicKeyCredentialCreationOptions, val: &AuthenticatorSelectionCriteria, ); + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &PublicKeyCredentialCreationOptions) -> ::js_sys::Object; + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "challenge")] - fn challenge_shim(this: &PublicKeyCredentialCreationOptions, val: &::js_sys::Object); + pub fn set_challenge(this: &PublicKeyCredentialCreationOptions, val: &::js_sys::Object); + #[doc = "Get the `excludeCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "excludeCredentials")] + pub fn get_exclude_credentials( + this: &PublicKeyCredentialCreationOptions, + ) -> Option<::js_sys::Array>; + #[doc = "Change the `excludeCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "excludeCredentials")] - fn exclude_credentials_shim( + pub fn set_exclude_credentials( this: &PublicKeyCredentialCreationOptions, val: &::wasm_bindgen::JsValue, ); #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Get the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "extensions")] + pub fn get_extensions( + this: &PublicKeyCredentialCreationOptions, + ) -> Option; + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Change the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "extensions")] - fn extensions_shim( + pub fn set_extensions( this: &PublicKeyCredentialCreationOptions, val: &AuthenticationExtensionsClientInputs, ); + #[doc = "Get the `pubKeyCredParams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "pubKeyCredParams")] + pub fn get_pub_key_cred_params(this: &PublicKeyCredentialCreationOptions) -> ::js_sys::Array; + #[doc = "Change the `pubKeyCredParams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "pubKeyCredParams")] - fn pub_key_cred_params_shim( + pub fn set_pub_key_cred_params( this: &PublicKeyCredentialCreationOptions, val: &::wasm_bindgen::JsValue, ); #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[doc = "Get the `rp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"] + #[wasm_bindgen(method, getter = "rp")] + pub fn get_rp(this: &PublicKeyCredentialCreationOptions) -> PublicKeyCredentialRpEntity; + #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[doc = "Change the `rp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, setter = "rp")] - fn rp_shim(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialRpEntity); + pub fn set_rp(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialRpEntity); + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &PublicKeyCredentialCreationOptions) -> Option; + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] #[wasm_bindgen(method, setter = "timeout")] - fn timeout_shim(this: &PublicKeyCredentialCreationOptions, val: u32); + pub fn set_timeout(this: &PublicKeyCredentialCreationOptions, val: u32); + #[cfg(feature = "PublicKeyCredentialUserEntity")] + #[doc = "Get the `user` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"] + #[wasm_bindgen(method, getter = "user")] + pub fn get_user(this: &PublicKeyCredentialCreationOptions) -> PublicKeyCredentialUserEntity; #[cfg(feature = "PublicKeyCredentialUserEntity")] + #[doc = "Change the `user` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, setter = "user")] - fn user_shim(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialUserEntity); + pub fn set_user(this: &PublicKeyCredentialCreationOptions, val: &PublicKeyCredentialUserEntity); } impl PublicKeyCredentialCreationOptions { #[cfg(all( @@ -72,71 +157,53 @@ impl PublicKeyCredentialCreationOptions { ret } #[cfg(feature = "AttestationConveyancePreference")] - #[doc = "Change the `attestation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`, `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_attestation()` instead."] pub fn attestation(&mut self, val: AttestationConveyancePreference) -> &mut Self { - self.attestation_shim(val); + self.set_attestation(val); self } #[cfg(feature = "AuthenticatorSelectionCriteria")] - #[doc = "Change the `authenticatorSelection` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_authenticator_selection()` instead."] pub fn authenticator_selection(&mut self, val: &AuthenticatorSelectionCriteria) -> &mut Self { - self.authenticator_selection_shim(val); + self.set_authenticator_selection(val); self } - #[doc = "Change the `challenge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self { - self.challenge_shim(val); + self.set_challenge(val); self } - #[doc = "Change the `excludeCredentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_exclude_credentials()` instead."] pub fn exclude_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.exclude_credentials_shim(val); + self.set_exclude_credentials(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] - #[doc = "Change the `extensions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_extensions()` instead."] pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - self.extensions_shim(val); + self.set_extensions(val); self } - #[doc = "Change the `pubKeyCredParams` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_pub_key_cred_params()` instead."] pub fn pub_key_cred_params(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.pub_key_cred_params_shim(val); + self.set_pub_key_cred_params(val); self } #[cfg(feature = "PublicKeyCredentialRpEntity")] - #[doc = "Change the `rp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialRpEntity`*"] + #[deprecated = "Use `set_rp()` instead."] pub fn rp(&mut self, val: &PublicKeyCredentialRpEntity) -> &mut Self { - self.rp_shim(val); + self.set_rp(val); self } - #[doc = "Change the `timeout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[deprecated = "Use `set_timeout()` instead."] pub fn timeout(&mut self, val: u32) -> &mut Self { - self.timeout_shim(val); + self.set_timeout(val); self } #[cfg(feature = "PublicKeyCredentialUserEntity")] - #[doc = "Change the `user` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialUserEntity`*"] + #[deprecated = "Use `set_user()` instead."] pub fn user(&mut self, val: &PublicKeyCredentialUserEntity) -> &mut Self { - self.user_shim(val); + self.set_user(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs index c2ca7cc04d7..3781622c4b3 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs @@ -10,13 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] pub type PublicKeyCredentialDescriptor; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &PublicKeyCredentialDescriptor) -> ::js_sys::Object; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Object); + pub fn set_id(this: &PublicKeyCredentialDescriptor, val: &::js_sys::Object); + #[doc = "Get the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] + #[wasm_bindgen(method, getter = "transports")] + pub fn get_transports(this: &PublicKeyCredentialDescriptor) -> Option<::js_sys::Array>; + #[doc = "Change the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] #[wasm_bindgen(method, setter = "transports")] - fn transports_shim(this: &PublicKeyCredentialDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_transports(this: &PublicKeyCredentialDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "PublicKeyCredentialType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &PublicKeyCredentialDescriptor) -> PublicKeyCredentialType; #[cfg(feature = "PublicKeyCredentialType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &PublicKeyCredentialDescriptor, val: PublicKeyCredentialType); + pub fn set_type(this: &PublicKeyCredentialDescriptor, val: PublicKeyCredentialType); } impl PublicKeyCredentialDescriptor { #[cfg(feature = "PublicKeyCredentialType")] @@ -30,26 +55,20 @@ impl PublicKeyCredentialDescriptor { ret.type_(type_); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &::js_sys::Object) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `transports` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`*"] + #[deprecated = "Use `set_transports()` instead."] pub fn transports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.transports_shim(val); + self.set_transports(val); self } #[cfg(feature = "PublicKeyCredentialType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptor`, `PublicKeyCredentialType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: PublicKeyCredentialType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs index 6dc0e64c189..f16bcd84e13 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] pub type PublicKeyCredentialEntity; + #[doc = "Get the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[wasm_bindgen(method, getter = "icon")] + pub fn get_icon(this: &PublicKeyCredentialEntity) -> Option; + #[doc = "Change the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] #[wasm_bindgen(method, setter = "icon")] - fn icon_shim(this: &PublicKeyCredentialEntity, val: &str); + pub fn set_icon(this: &PublicKeyCredentialEntity, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PublicKeyCredentialEntity) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PublicKeyCredentialEntity, val: &str); + pub fn set_name(this: &PublicKeyCredentialEntity, val: &str); } impl PublicKeyCredentialEntity { #[doc = "Construct a new `PublicKeyCredentialEntity`."] @@ -25,18 +41,14 @@ impl PublicKeyCredentialEntity { ret.name(name); ret } - #[doc = "Change the `icon` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[deprecated = "Use `set_icon()` instead."] pub fn icon(&mut self, val: &str) -> &mut Self { - self.icon_shim(val); + self.set_icon(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs index fd51859ddf6..a2903ffb8f2 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] pub type PublicKeyCredentialParameters; + #[doc = "Get the `alg` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] + #[wasm_bindgen(method, getter = "alg")] + pub fn get_alg(this: &PublicKeyCredentialParameters) -> i32; + #[doc = "Change the `alg` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] #[wasm_bindgen(method, setter = "alg")] - fn alg_shim(this: &PublicKeyCredentialParameters, val: i32); + pub fn set_alg(this: &PublicKeyCredentialParameters, val: i32); #[cfg(feature = "PublicKeyCredentialType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`, `PublicKeyCredentialType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &PublicKeyCredentialParameters) -> PublicKeyCredentialType; + #[cfg(feature = "PublicKeyCredentialType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`, `PublicKeyCredentialType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &PublicKeyCredentialParameters, val: PublicKeyCredentialType); + pub fn set_type(this: &PublicKeyCredentialParameters, val: PublicKeyCredentialType); } impl PublicKeyCredentialParameters { #[cfg(feature = "PublicKeyCredentialType")] @@ -28,19 +45,15 @@ impl PublicKeyCredentialParameters { ret.type_(type_); ret } - #[doc = "Change the `alg` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`*"] + #[deprecated = "Use `set_alg()` instead."] pub fn alg(&mut self, val: i32) -> &mut Self { - self.alg_shim(val); + self.set_alg(val); self } #[cfg(feature = "PublicKeyCredentialType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialParameters`, `PublicKeyCredentialType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: PublicKeyCredentialType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs index 3528ea3d7db..8f42a289bd5 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs @@ -10,26 +10,82 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] pub type PublicKeyCredentialRequestOptions; + #[doc = "Get the `allowCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "allowCredentials")] + pub fn get_allow_credentials( + this: &PublicKeyCredentialRequestOptions, + ) -> Option<::js_sys::Array>; + #[doc = "Change the `allowCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "allowCredentials")] - fn allow_credentials_shim( + pub fn set_allow_credentials( this: &PublicKeyCredentialRequestOptions, val: &::wasm_bindgen::JsValue, ); + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &PublicKeyCredentialRequestOptions) -> ::js_sys::Object; + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "challenge")] - fn challenge_shim(this: &PublicKeyCredentialRequestOptions, val: &::js_sys::Object); + pub fn set_challenge(this: &PublicKeyCredentialRequestOptions, val: &::js_sys::Object); #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Get the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "extensions")] + pub fn get_extensions( + this: &PublicKeyCredentialRequestOptions, + ) -> Option; + #[cfg(feature = "AuthenticationExtensionsClientInputs")] + #[doc = "Change the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "extensions")] - fn extensions_shim( + pub fn set_extensions( this: &PublicKeyCredentialRequestOptions, val: &AuthenticationExtensionsClientInputs, ); + #[doc = "Get the `rpId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "rpId")] + pub fn get_rp_id(this: &PublicKeyCredentialRequestOptions) -> Option; + #[doc = "Change the `rpId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "rpId")] - fn rp_id_shim(this: &PublicKeyCredentialRequestOptions, val: &str); + pub fn set_rp_id(this: &PublicKeyCredentialRequestOptions, val: &str); + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &PublicKeyCredentialRequestOptions) -> Option; + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, setter = "timeout")] - fn timeout_shim(this: &PublicKeyCredentialRequestOptions, val: u32); + pub fn set_timeout(this: &PublicKeyCredentialRequestOptions, val: u32); #[cfg(feature = "UserVerificationRequirement")] + #[doc = "Get the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`, `UserVerificationRequirement`*"] + #[wasm_bindgen(method, getter = "userVerification")] + pub fn get_user_verification( + this: &PublicKeyCredentialRequestOptions, + ) -> Option; + #[cfg(feature = "UserVerificationRequirement")] + #[doc = "Change the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`, `UserVerificationRequirement`*"] #[wasm_bindgen(method, setter = "userVerification")] - fn user_verification_shim( + pub fn set_user_verification( this: &PublicKeyCredentialRequestOptions, val: UserVerificationRequirement, ); @@ -44,48 +100,36 @@ impl PublicKeyCredentialRequestOptions { ret.challenge(challenge); ret } - #[doc = "Change the `allowCredentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_allow_credentials()` instead."] pub fn allow_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.allow_credentials_shim(val); + self.set_allow_credentials(val); self } - #[doc = "Change the `challenge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self { - self.challenge_shim(val); + self.set_challenge(val); self } #[cfg(feature = "AuthenticationExtensionsClientInputs")] - #[doc = "Change the `extensions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_extensions()` instead."] pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self { - self.extensions_shim(val); + self.set_extensions(val); self } - #[doc = "Change the `rpId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_rp_id()` instead."] pub fn rp_id(&mut self, val: &str) -> &mut Self { - self.rp_id_shim(val); + self.set_rp_id(val); self } - #[doc = "Change the `timeout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[deprecated = "Use `set_timeout()` instead."] pub fn timeout(&mut self, val: u32) -> &mut Self { - self.timeout_shim(val); + self.set_timeout(val); self } #[cfg(feature = "UserVerificationRequirement")] - #[doc = "Change the `userVerification` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`, `UserVerificationRequirement`*"] + #[deprecated = "Use `set_user_verification()` instead."] pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self { - self.user_verification_shim(val); + self.set_user_verification(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs index ac8318357da..1cfba5695b1 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] pub type PublicKeyCredentialRpEntity; + #[doc = "Get the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[wasm_bindgen(method, getter = "icon")] + pub fn get_icon(this: &PublicKeyCredentialRpEntity) -> Option; + #[doc = "Change the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, setter = "icon")] - fn icon_shim(this: &PublicKeyCredentialRpEntity, val: &str); + pub fn set_icon(this: &PublicKeyCredentialRpEntity, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PublicKeyCredentialRpEntity) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PublicKeyCredentialRpEntity, val: &str); + pub fn set_name(this: &PublicKeyCredentialRpEntity, val: &str); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &PublicKeyCredentialRpEntity) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &PublicKeyCredentialRpEntity, val: &str); + pub fn set_id(this: &PublicKeyCredentialRpEntity, val: &str); } impl PublicKeyCredentialRpEntity { #[doc = "Construct a new `PublicKeyCredentialRpEntity`."] @@ -27,25 +51,19 @@ impl PublicKeyCredentialRpEntity { ret.name(name); ret } - #[doc = "Change the `icon` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[deprecated = "Use `set_icon()` instead."] pub fn icon(&mut self, val: &str) -> &mut Self { - self.icon_shim(val); + self.set_icon(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs index a720e3a36e7..017f546fcc9 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] pub type PublicKeyCredentialUserEntity; + #[doc = "Get the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[wasm_bindgen(method, getter = "icon")] + pub fn get_icon(this: &PublicKeyCredentialUserEntity) -> Option; + #[doc = "Change the `icon` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, setter = "icon")] - fn icon_shim(this: &PublicKeyCredentialUserEntity, val: &str); + pub fn set_icon(this: &PublicKeyCredentialUserEntity, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PublicKeyCredentialUserEntity) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &PublicKeyCredentialUserEntity, val: &str); + pub fn set_name(this: &PublicKeyCredentialUserEntity, val: &str); + #[doc = "Get the `displayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[wasm_bindgen(method, getter = "displayName")] + pub fn get_display_name(this: &PublicKeyCredentialUserEntity) -> String; + #[doc = "Change the `displayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, setter = "displayName")] - fn display_name_shim(this: &PublicKeyCredentialUserEntity, val: &str); + pub fn set_display_name(this: &PublicKeyCredentialUserEntity, val: &str); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &PublicKeyCredentialUserEntity) -> ::js_sys::Object; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &PublicKeyCredentialUserEntity, val: &::js_sys::Object); + pub fn set_id(this: &PublicKeyCredentialUserEntity, val: &::js_sys::Object); } impl PublicKeyCredentialUserEntity { #[doc = "Construct a new `PublicKeyCredentialUserEntity`."] @@ -31,32 +63,24 @@ impl PublicKeyCredentialUserEntity { ret.id(id); ret } - #[doc = "Change the `icon` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated = "Use `set_icon()` instead."] pub fn icon(&mut self, val: &str) -> &mut Self { - self.icon_shim(val); + self.set_icon(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `displayName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated = "Use `set_display_name()` instead."] pub fn display_name(&mut self, val: &str) -> &mut Self { - self.display_name_shim(val); + self.set_display_name(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &::js_sys::Object) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } } diff --git a/crates/web-sys/src/features/gen_PushEventInit.rs b/crates/web-sys/src/features/gen_PushEventInit.rs index 5add3d2125d..80f525bbe2d 100644 --- a/crates/web-sys/src/features/gen_PushEventInit.rs +++ b/crates/web-sys/src/features/gen_PushEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] pub type PushEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &PushEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &PushEventInit, val: bool); + pub fn set_bubbles(this: &PushEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &PushEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &PushEventInit, val: bool); + pub fn set_cancelable(this: &PushEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &PushEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &PushEventInit, val: bool); + pub fn set_composed(this: &PushEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &PushEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &PushEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &PushEventInit, val: &::wasm_bindgen::JsValue); } impl PushEventInit { #[doc = "Construct a new `PushEventInit`."] @@ -28,32 +60,24 @@ impl PushEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs index 721c813742a..5ad982d96ca 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] pub type PushSubscriptionInit; + #[doc = "Get the `appServerKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[wasm_bindgen(method, getter = "appServerKey")] + pub fn get_app_server_key(this: &PushSubscriptionInit) -> Option<::js_sys::Object>; + #[doc = "Change the `appServerKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, setter = "appServerKey")] - fn app_server_key_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::Object>); + pub fn set_app_server_key(this: &PushSubscriptionInit, val: Option<&::js_sys::Object>); + #[doc = "Get the `authSecret` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[wasm_bindgen(method, getter = "authSecret")] + pub fn get_auth_secret(this: &PushSubscriptionInit) -> Option<::js_sys::ArrayBuffer>; + #[doc = "Change the `authSecret` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, setter = "authSecret")] - fn auth_secret_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + pub fn set_auth_secret(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + #[doc = "Get the `endpoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[wasm_bindgen(method, getter = "endpoint")] + pub fn get_endpoint(this: &PushSubscriptionInit) -> String; + #[doc = "Change the `endpoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, setter = "endpoint")] - fn endpoint_shim(this: &PushSubscriptionInit, val: &str); + pub fn set_endpoint(this: &PushSubscriptionInit, val: &str); + #[doc = "Get the `p256dhKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[wasm_bindgen(method, getter = "p256dhKey")] + pub fn get_p256dh_key(this: &PushSubscriptionInit) -> Option<::js_sys::ArrayBuffer>; + #[doc = "Change the `p256dhKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, setter = "p256dhKey")] - fn p256dh_key_shim(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + pub fn set_p256dh_key(this: &PushSubscriptionInit, val: Option<&::js_sys::ArrayBuffer>); + #[doc = "Get the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[wasm_bindgen(method, getter = "scope")] + pub fn get_scope(this: &PushSubscriptionInit) -> String; + #[doc = "Change the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, setter = "scope")] - fn scope_shim(this: &PushSubscriptionInit, val: &str); + pub fn set_scope(this: &PushSubscriptionInit, val: &str); } impl PushSubscriptionInit { #[doc = "Construct a new `PushSubscriptionInit`."] @@ -32,39 +72,29 @@ impl PushSubscriptionInit { ret.scope(scope); ret } - #[doc = "Change the `appServerKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[deprecated = "Use `set_app_server_key()` instead."] pub fn app_server_key(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.app_server_key_shim(val); + self.set_app_server_key(val); self } - #[doc = "Change the `authSecret` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[deprecated = "Use `set_auth_secret()` instead."] pub fn auth_secret(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - self.auth_secret_shim(val); + self.set_auth_secret(val); self } - #[doc = "Change the `endpoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[deprecated = "Use `set_endpoint()` instead."] pub fn endpoint(&mut self, val: &str) -> &mut Self { - self.endpoint_shim(val); + self.set_endpoint(val); self } - #[doc = "Change the `p256dhKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[deprecated = "Use `set_p256dh_key()` instead."] pub fn p256dh_key(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self { - self.p256dh_key_shim(val); + self.set_p256dh_key(val); self } - #[doc = "Change the `scope` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] + #[deprecated = "Use `set_scope()` instead."] pub fn scope(&mut self, val: &str) -> &mut Self { - self.scope_shim(val); + self.set_scope(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs index 1fdb21c22bc..c3b04f9af29 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] pub type PushSubscriptionJson; + #[doc = "Get the `endpoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] + #[wasm_bindgen(method, getter = "endpoint")] + pub fn get_endpoint(this: &PushSubscriptionJson) -> Option; + #[doc = "Change the `endpoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] #[wasm_bindgen(method, setter = "endpoint")] - fn endpoint_shim(this: &PushSubscriptionJson, val: &str); + pub fn set_endpoint(this: &PushSubscriptionJson, val: &str); #[cfg(feature = "PushSubscriptionKeys")] + #[doc = "Get the `keys` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`, `PushSubscriptionKeys`*"] + #[wasm_bindgen(method, getter = "keys")] + pub fn get_keys(this: &PushSubscriptionJson) -> Option; + #[cfg(feature = "PushSubscriptionKeys")] + #[doc = "Change the `keys` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`, `PushSubscriptionKeys`*"] #[wasm_bindgen(method, setter = "keys")] - fn keys_shim(this: &PushSubscriptionJson, val: &PushSubscriptionKeys); + pub fn set_keys(this: &PushSubscriptionJson, val: &PushSubscriptionKeys); } impl PushSubscriptionJson { #[doc = "Construct a new `PushSubscriptionJson`."] @@ -25,19 +42,15 @@ impl PushSubscriptionJson { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `endpoint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] + #[deprecated = "Use `set_endpoint()` instead."] pub fn endpoint(&mut self, val: &str) -> &mut Self { - self.endpoint_shim(val); + self.set_endpoint(val); self } #[cfg(feature = "PushSubscriptionKeys")] - #[doc = "Change the `keys` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`, `PushSubscriptionKeys`*"] + #[deprecated = "Use `set_keys()` instead."] pub fn keys(&mut self, val: &PushSubscriptionKeys) -> &mut Self { - self.keys_shim(val); + self.set_keys(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs index f4b03611fba..80a07f5ef6c 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] pub type PushSubscriptionKeys; + #[doc = "Get the `auth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] + #[wasm_bindgen(method, getter = "auth")] + pub fn get_auth(this: &PushSubscriptionKeys) -> Option; + #[doc = "Change the `auth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] #[wasm_bindgen(method, setter = "auth")] - fn auth_shim(this: &PushSubscriptionKeys, val: &str); + pub fn set_auth(this: &PushSubscriptionKeys, val: &str); + #[doc = "Get the `p256dh` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] + #[wasm_bindgen(method, getter = "p256dh")] + pub fn get_p256dh(this: &PushSubscriptionKeys) -> Option; + #[doc = "Change the `p256dh` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] #[wasm_bindgen(method, setter = "p256dh")] - fn p256dh_shim(this: &PushSubscriptionKeys, val: &str); + pub fn set_p256dh(this: &PushSubscriptionKeys, val: &str); } impl PushSubscriptionKeys { #[doc = "Construct a new `PushSubscriptionKeys`."] @@ -24,18 +40,14 @@ impl PushSubscriptionKeys { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `auth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] + #[deprecated = "Use `set_auth()` instead."] pub fn auth(&mut self, val: &str) -> &mut Self { - self.auth_shim(val); + self.set_auth(val); self } - #[doc = "Change the `p256dh` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] + #[deprecated = "Use `set_p256dh()` instead."] pub fn p256dh(&mut self, val: &str) -> &mut Self { - self.p256dh_shim(val); + self.set_p256dh(val); self } } diff --git a/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs index ba2ce96b985..507884a5c68 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionOptionsInit.rs @@ -10,13 +10,31 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] pub type PushSubscriptionOptionsInit; + #[doc = "Get the `applicationServerKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] + #[wasm_bindgen(method, getter = "applicationServerKey")] + pub fn get_application_server_key( + this: &PushSubscriptionOptionsInit, + ) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `applicationServerKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] #[wasm_bindgen(method, setter = "applicationServerKey")] - fn application_server_key_shim( + pub fn set_application_server_key( this: &PushSubscriptionOptionsInit, val: &::wasm_bindgen::JsValue, ); + #[doc = "Get the `userVisibleOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] + #[wasm_bindgen(method, getter = "userVisibleOnly")] + pub fn get_user_visible_only(this: &PushSubscriptionOptionsInit) -> Option; + #[doc = "Change the `userVisibleOnly` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] #[wasm_bindgen(method, setter = "userVisibleOnly")] - fn user_visible_only_shim(this: &PushSubscriptionOptionsInit, val: bool); + pub fn set_user_visible_only(this: &PushSubscriptionOptionsInit, val: bool); } impl PushSubscriptionOptionsInit { #[doc = "Construct a new `PushSubscriptionOptionsInit`."] @@ -27,18 +45,14 @@ impl PushSubscriptionOptionsInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `applicationServerKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] + #[deprecated = "Use `set_application_server_key()` instead."] pub fn application_server_key(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.application_server_key_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_application_server_key(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } - #[doc = "Change the `userVisibleOnly` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"] + #[deprecated = "Use `set_user_visible_only()` instead."] pub fn user_visible_only(&mut self, val: bool) -> &mut Self { - self.user_visible_only_shim(val); + self.set_user_visible_only(val); self } } diff --git a/crates/web-sys/src/features/gen_QueryOptions.rs b/crates/web-sys/src/features/gen_QueryOptions.rs index 6ef1d3ad6c0..b1a58c5a564 100644 --- a/crates/web-sys/src/features/gen_QueryOptions.rs +++ b/crates/web-sys/src/features/gen_QueryOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type QueryOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `postscriptNames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "postscriptNames")] + pub fn get_postscript_names(this: &QueryOptions) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `postscriptNames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "postscriptNames")] - fn postscript_names_shim(this: &QueryOptions, val: &::wasm_bindgen::JsValue); + pub fn set_postscript_names(this: &QueryOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl QueryOptions { @@ -31,14 +47,9 @@ impl QueryOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `postscriptNames` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueryOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_postscript_names()` instead."] pub fn postscript_names(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.postscript_names_shim(val); + self.set_postscript_names(val); self } } diff --git a/crates/web-sys/src/features/gen_QueuingStrategy.rs b/crates/web-sys/src/features/gen_QueuingStrategy.rs index 9ecbfa23cd1..6d22b29060a 100644 --- a/crates/web-sys/src/features/gen_QueuingStrategy.rs +++ b/crates/web-sys/src/features/gen_QueuingStrategy.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] pub type QueuingStrategy; + #[doc = "Get the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] + #[wasm_bindgen(method, getter = "highWaterMark")] + pub fn get_high_water_mark(this: &QueuingStrategy) -> Option; + #[doc = "Change the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] #[wasm_bindgen(method, setter = "highWaterMark")] - fn high_water_mark_shim(this: &QueuingStrategy, val: f64); + pub fn set_high_water_mark(this: &QueuingStrategy, val: f64); + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &QueuingStrategy) -> Option<::js_sys::Function>; + #[doc = "Change the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &QueuingStrategy, val: &::js_sys::Function); + pub fn set_size(this: &QueuingStrategy, val: &::js_sys::Function); } impl QueuingStrategy { #[doc = "Construct a new `QueuingStrategy`."] @@ -24,18 +40,14 @@ impl QueuingStrategy { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `highWaterMark` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] + #[deprecated = "Use `set_high_water_mark()` instead."] pub fn high_water_mark(&mut self, val: f64) -> &mut Self { - self.high_water_mark_shim(val); + self.set_high_water_mark(val); self } - #[doc = "Change the `size` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategy`*"] + #[deprecated = "Use `set_size()` instead."] pub fn size(&mut self, val: &::js_sys::Function) -> &mut Self { - self.size_shim(val); + self.set_size(val); self } } diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs index 42523cd8b2f..e917016bf96 100644 --- a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs +++ b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] pub type QueuingStrategyInit; + #[doc = "Get the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + #[wasm_bindgen(method, getter = "highWaterMark")] + pub fn get_high_water_mark(this: &QueuingStrategyInit) -> f64; + #[doc = "Change the `highWaterMark` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] #[wasm_bindgen(method, setter = "highWaterMark")] - fn high_water_mark_shim(this: &QueuingStrategyInit, val: f64); + pub fn set_high_water_mark(this: &QueuingStrategyInit, val: f64); } impl QueuingStrategyInit { #[doc = "Construct a new `QueuingStrategyInit`."] @@ -23,11 +31,9 @@ impl QueuingStrategyInit { ret.high_water_mark(high_water_mark); ret } - #[doc = "Change the `highWaterMark` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `QueuingStrategyInit`*"] + #[deprecated = "Use `set_high_water_mark()` instead."] pub fn high_water_mark(&mut self, val: f64) -> &mut Self { - self.high_water_mark_shim(val); + self.set_high_water_mark(val); self } } diff --git a/crates/web-sys/src/features/gen_RcwnPerfStats.rs b/crates/web-sys/src/features/gen_RcwnPerfStats.rs index ee8fc7c302a..b3cb7fd5b11 100644 --- a/crates/web-sys/src/features/gen_RcwnPerfStats.rs +++ b/crates/web-sys/src/features/gen_RcwnPerfStats.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] pub type RcwnPerfStats; + #[doc = "Get the `avgLong` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[wasm_bindgen(method, getter = "avgLong")] + pub fn get_avg_long(this: &RcwnPerfStats) -> Option; + #[doc = "Change the `avgLong` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] #[wasm_bindgen(method, setter = "avgLong")] - fn avg_long_shim(this: &RcwnPerfStats, val: u32); + pub fn set_avg_long(this: &RcwnPerfStats, val: u32); + #[doc = "Get the `avgShort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[wasm_bindgen(method, getter = "avgShort")] + pub fn get_avg_short(this: &RcwnPerfStats) -> Option; + #[doc = "Change the `avgShort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] #[wasm_bindgen(method, setter = "avgShort")] - fn avg_short_shim(this: &RcwnPerfStats, val: u32); + pub fn set_avg_short(this: &RcwnPerfStats, val: u32); + #[doc = "Get the `stddevLong` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[wasm_bindgen(method, getter = "stddevLong")] + pub fn get_stddev_long(this: &RcwnPerfStats) -> Option; + #[doc = "Change the `stddevLong` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] #[wasm_bindgen(method, setter = "stddevLong")] - fn stddev_long_shim(this: &RcwnPerfStats, val: u32); + pub fn set_stddev_long(this: &RcwnPerfStats, val: u32); } impl RcwnPerfStats { #[doc = "Construct a new `RcwnPerfStats`."] @@ -26,25 +50,19 @@ impl RcwnPerfStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `avgLong` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[deprecated = "Use `set_avg_long()` instead."] pub fn avg_long(&mut self, val: u32) -> &mut Self { - self.avg_long_shim(val); + self.set_avg_long(val); self } - #[doc = "Change the `avgShort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[deprecated = "Use `set_avg_short()` instead."] pub fn avg_short(&mut self, val: u32) -> &mut Self { - self.avg_short_shim(val); + self.set_avg_short(val); self } - #[doc = "Change the `stddevLong` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnPerfStats`*"] + #[deprecated = "Use `set_stddev_long()` instead."] pub fn stddev_long(&mut self, val: u32) -> &mut Self { - self.stddev_long_shim(val); + self.set_stddev_long(val); self } } diff --git a/crates/web-sys/src/features/gen_RcwnStatus.rs b/crates/web-sys/src/features/gen_RcwnStatus.rs index e29982da89e..c6a0d927176 100644 --- a/crates/web-sys/src/features/gen_RcwnStatus.rs +++ b/crates/web-sys/src/features/gen_RcwnStatus.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] pub type RcwnStatus; + #[doc = "Get the `cacheNotSlowCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "cacheNotSlowCount")] + pub fn get_cache_not_slow_count(this: &RcwnStatus) -> Option; + #[doc = "Change the `cacheNotSlowCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "cacheNotSlowCount")] - fn cache_not_slow_count_shim(this: &RcwnStatus, val: u32); + pub fn set_cache_not_slow_count(this: &RcwnStatus, val: u32); + #[doc = "Get the `cacheSlowCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "cacheSlowCount")] + pub fn get_cache_slow_count(this: &RcwnStatus) -> Option; + #[doc = "Change the `cacheSlowCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "cacheSlowCount")] - fn cache_slow_count_shim(this: &RcwnStatus, val: u32); + pub fn set_cache_slow_count(this: &RcwnStatus, val: u32); + #[doc = "Get the `perfStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "perfStats")] + pub fn get_perf_stats(this: &RcwnStatus) -> Option<::js_sys::Array>; + #[doc = "Change the `perfStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "perfStats")] - fn perf_stats_shim(this: &RcwnStatus, val: &::wasm_bindgen::JsValue); + pub fn set_perf_stats(this: &RcwnStatus, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `rcwnCacheWonCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "rcwnCacheWonCount")] + pub fn get_rcwn_cache_won_count(this: &RcwnStatus) -> Option; + #[doc = "Change the `rcwnCacheWonCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "rcwnCacheWonCount")] - fn rcwn_cache_won_count_shim(this: &RcwnStatus, val: u32); + pub fn set_rcwn_cache_won_count(this: &RcwnStatus, val: u32); + #[doc = "Get the `rcwnNetWonCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "rcwnNetWonCount")] + pub fn get_rcwn_net_won_count(this: &RcwnStatus) -> Option; + #[doc = "Change the `rcwnNetWonCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "rcwnNetWonCount")] - fn rcwn_net_won_count_shim(this: &RcwnStatus, val: u32); + pub fn set_rcwn_net_won_count(this: &RcwnStatus, val: u32); + #[doc = "Get the `totalNetworkRequests` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[wasm_bindgen(method, getter = "totalNetworkRequests")] + pub fn get_total_network_requests(this: &RcwnStatus) -> Option; + #[doc = "Change the `totalNetworkRequests` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] #[wasm_bindgen(method, setter = "totalNetworkRequests")] - fn total_network_requests_shim(this: &RcwnStatus, val: u32); + pub fn set_total_network_requests(this: &RcwnStatus, val: u32); } impl RcwnStatus { #[doc = "Construct a new `RcwnStatus`."] @@ -32,46 +80,34 @@ impl RcwnStatus { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `cacheNotSlowCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_cache_not_slow_count()` instead."] pub fn cache_not_slow_count(&mut self, val: u32) -> &mut Self { - self.cache_not_slow_count_shim(val); + self.set_cache_not_slow_count(val); self } - #[doc = "Change the `cacheSlowCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_cache_slow_count()` instead."] pub fn cache_slow_count(&mut self, val: u32) -> &mut Self { - self.cache_slow_count_shim(val); + self.set_cache_slow_count(val); self } - #[doc = "Change the `perfStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_perf_stats()` instead."] pub fn perf_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.perf_stats_shim(val); + self.set_perf_stats(val); self } - #[doc = "Change the `rcwnCacheWonCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_rcwn_cache_won_count()` instead."] pub fn rcwn_cache_won_count(&mut self, val: u32) -> &mut Self { - self.rcwn_cache_won_count_shim(val); + self.set_rcwn_cache_won_count(val); self } - #[doc = "Change the `rcwnNetWonCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_rcwn_net_won_count()` instead."] pub fn rcwn_net_won_count(&mut self, val: u32) -> &mut Self { - self.rcwn_net_won_count_shim(val); + self.set_rcwn_net_won_count(val); self } - #[doc = "Change the `totalNetworkRequests` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RcwnStatus`*"] + #[deprecated = "Use `set_total_network_requests()` instead."] pub fn total_network_requests(&mut self, val: u32) -> &mut Self { - self.total_network_requests_shim(val); + self.set_total_network_requests(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs b/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs index ba38a2a7cd6..0cf5d910ca9 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamGetReaderOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`*"] pub type ReadableStreamGetReaderOptions; #[cfg(feature = "ReadableStreamReaderMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`, `ReadableStreamReaderMode`*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &ReadableStreamGetReaderOptions) -> Option; + #[cfg(feature = "ReadableStreamReaderMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`, `ReadableStreamReaderMode`*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &ReadableStreamGetReaderOptions, val: ReadableStreamReaderMode); + pub fn set_mode(this: &ReadableStreamGetReaderOptions, val: ReadableStreamReaderMode); } impl ReadableStreamGetReaderOptions { #[doc = "Construct a new `ReadableStreamGetReaderOptions`."] @@ -24,11 +33,9 @@ impl ReadableStreamGetReaderOptions { ret } #[cfg(feature = "ReadableStreamReaderMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamGetReaderOptions`, `ReadableStreamReaderMode`*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: ReadableStreamReaderMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs b/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs index bd432a43d33..cc5b87e0bd2 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamIteratorOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] pub type ReadableStreamIteratorOptions; + #[doc = "Get the `preventCancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] + #[wasm_bindgen(method, getter = "preventCancel")] + pub fn get_prevent_cancel(this: &ReadableStreamIteratorOptions) -> Option; + #[doc = "Change the `preventCancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] #[wasm_bindgen(method, setter = "preventCancel")] - fn prevent_cancel_shim(this: &ReadableStreamIteratorOptions, val: bool); + pub fn set_prevent_cancel(this: &ReadableStreamIteratorOptions, val: bool); } impl ReadableStreamIteratorOptions { #[doc = "Construct a new `ReadableStreamIteratorOptions`."] @@ -22,11 +30,9 @@ impl ReadableStreamIteratorOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `preventCancel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamIteratorOptions`*"] + #[deprecated = "Use `set_prevent_cancel()` instead."] pub fn prevent_cancel(&mut self, val: bool) -> &mut Self { - self.prevent_cancel_shim(val); + self.set_prevent_cancel(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs index 1ee926ae577..9f22eb0a1eb 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamReadResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] pub type ReadableStreamReadResult; + #[doc = "Get the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + #[wasm_bindgen(method, getter = "done")] + pub fn get_done(this: &ReadableStreamReadResult) -> Option; + #[doc = "Change the `done` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] #[wasm_bindgen(method, setter = "done")] - fn done_shim(this: &ReadableStreamReadResult, val: bool); + pub fn set_done(this: &ReadableStreamReadResult, val: bool); + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &ReadableStreamReadResult) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &ReadableStreamReadResult, val: &::wasm_bindgen::JsValue); + pub fn set_value(this: &ReadableStreamReadResult, val: &::wasm_bindgen::JsValue); } impl ReadableStreamReadResult { #[doc = "Construct a new `ReadableStreamReadResult`."] @@ -24,18 +40,14 @@ impl ReadableStreamReadResult { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `done` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + #[deprecated = "Use `set_done()` instead."] pub fn done(&mut self, val: bool) -> &mut Self { - self.done_shim(val); + self.set_done(val); self } - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamReadResult`*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index 3079c8805c3..5b15a0cf997 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -11,11 +11,29 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`*"] pub type ReadableWritablePair; #[cfg(feature = "ReadableStream")] + #[doc = "Get the `readable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"] + #[wasm_bindgen(method, getter = "readable")] + pub fn get_readable(this: &ReadableWritablePair) -> ReadableStream; + #[cfg(feature = "ReadableStream")] + #[doc = "Change the `readable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"] #[wasm_bindgen(method, setter = "readable")] - fn readable_shim(this: &ReadableWritablePair, val: &ReadableStream); + pub fn set_readable(this: &ReadableWritablePair, val: &ReadableStream); + #[cfg(feature = "WritableStream")] + #[doc = "Get the `writable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] + #[wasm_bindgen(method, getter = "writable")] + pub fn get_writable(this: &ReadableWritablePair) -> WritableStream; #[cfg(feature = "WritableStream")] + #[doc = "Change the `writable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] #[wasm_bindgen(method, setter = "writable")] - fn writable_shim(this: &ReadableWritablePair, val: &WritableStream); + pub fn set_writable(this: &ReadableWritablePair, val: &WritableStream); } impl ReadableWritablePair { #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))] @@ -30,19 +48,15 @@ impl ReadableWritablePair { ret } #[cfg(feature = "ReadableStream")] - #[doc = "Change the `readable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"] + #[deprecated = "Use `set_readable()` instead."] pub fn readable(&mut self, val: &ReadableStream) -> &mut Self { - self.readable_shim(val); + self.set_readable(val); self } #[cfg(feature = "WritableStream")] - #[doc = "Change the `writable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"] + #[deprecated = "Use `set_writable()` instead."] pub fn writable(&mut self, val: &WritableStream) -> &mut Self { - self.writable_shim(val); + self.set_writable(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisterRequest.rs b/crates/web-sys/src/features/gen_RegisterRequest.rs index f35b3953389..0b3c741d805 100644 --- a/crates/web-sys/src/features/gen_RegisterRequest.rs +++ b/crates/web-sys/src/features/gen_RegisterRequest.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] pub type RegisterRequest; + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &RegisterRequest) -> Option; + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] #[wasm_bindgen(method, setter = "challenge")] - fn challenge_shim(this: &RegisterRequest, val: &str); + pub fn set_challenge(this: &RegisterRequest, val: &str); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &RegisterRequest) -> Option; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &RegisterRequest, val: &str); + pub fn set_version(this: &RegisterRequest, val: &str); } impl RegisterRequest { #[doc = "Construct a new `RegisterRequest`."] @@ -24,18 +40,14 @@ impl RegisterRequest { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `challenge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] + #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &str) -> &mut Self { - self.challenge_shim(val); + self.set_challenge(val); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisterResponse.rs b/crates/web-sys/src/features/gen_RegisterResponse.rs index eb73afa5f2c..3ec0f53e6b9 100644 --- a/crates/web-sys/src/features/gen_RegisterResponse.rs +++ b/crates/web-sys/src/features/gen_RegisterResponse.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] pub type RegisterResponse; + #[doc = "Get the `clientData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[wasm_bindgen(method, getter = "clientData")] + pub fn get_client_data(this: &RegisterResponse) -> Option; + #[doc = "Change the `clientData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, setter = "clientData")] - fn client_data_shim(this: &RegisterResponse, val: &str); + pub fn set_client_data(this: &RegisterResponse, val: &str); + #[doc = "Get the `errorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[wasm_bindgen(method, getter = "errorCode")] + pub fn get_error_code(this: &RegisterResponse) -> Option; + #[doc = "Change the `errorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, setter = "errorCode")] - fn error_code_shim(this: &RegisterResponse, val: Option); + pub fn set_error_code(this: &RegisterResponse, val: Option); + #[doc = "Get the `errorMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[wasm_bindgen(method, getter = "errorMessage")] + pub fn get_error_message(this: &RegisterResponse) -> Option; + #[doc = "Change the `errorMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, setter = "errorMessage")] - fn error_message_shim(this: &RegisterResponse, val: Option<&str>); + pub fn set_error_message(this: &RegisterResponse, val: Option<&str>); + #[doc = "Get the `registrationData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[wasm_bindgen(method, getter = "registrationData")] + pub fn get_registration_data(this: &RegisterResponse) -> Option; + #[doc = "Change the `registrationData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, setter = "registrationData")] - fn registration_data_shim(this: &RegisterResponse, val: &str); + pub fn set_registration_data(this: &RegisterResponse, val: &str); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &RegisterResponse) -> Option; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &RegisterResponse, val: &str); + pub fn set_version(this: &RegisterResponse, val: &str); } impl RegisterResponse { #[doc = "Construct a new `RegisterResponse`."] @@ -30,39 +70,29 @@ impl RegisterResponse { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `clientData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[deprecated = "Use `set_client_data()` instead."] pub fn client_data(&mut self, val: &str) -> &mut Self { - self.client_data_shim(val); + self.set_client_data(val); self } - #[doc = "Change the `errorCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[deprecated = "Use `set_error_code()` instead."] pub fn error_code(&mut self, val: Option) -> &mut Self { - self.error_code_shim(val); + self.set_error_code(val); self } - #[doc = "Change the `errorMessage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[deprecated = "Use `set_error_message()` instead."] pub fn error_message(&mut self, val: Option<&str>) -> &mut Self { - self.error_message_shim(val); + self.set_error_message(val); self } - #[doc = "Change the `registrationData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[deprecated = "Use `set_registration_data()` instead."] pub fn registration_data(&mut self, val: &str) -> &mut Self { - self.registration_data_shim(val); + self.set_registration_data(val); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_RegisteredKey.rs b/crates/web-sys/src/features/gen_RegisteredKey.rs index 34f727cbab4..9698b9c89c3 100644 --- a/crates/web-sys/src/features/gen_RegisteredKey.rs +++ b/crates/web-sys/src/features/gen_RegisteredKey.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] pub type RegisteredKey; + #[doc = "Get the `appId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[wasm_bindgen(method, getter = "appId")] + pub fn get_app_id(this: &RegisteredKey) -> Option; + #[doc = "Change the `appId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, setter = "appId")] - fn app_id_shim(this: &RegisteredKey, val: Option<&str>); + pub fn set_app_id(this: &RegisteredKey, val: Option<&str>); + #[doc = "Get the `keyHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[wasm_bindgen(method, getter = "keyHandle")] + pub fn get_key_handle(this: &RegisteredKey) -> Option; + #[doc = "Change the `keyHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, setter = "keyHandle")] - fn key_handle_shim(this: &RegisteredKey, val: &str); + pub fn set_key_handle(this: &RegisteredKey, val: &str); + #[doc = "Get the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[wasm_bindgen(method, getter = "transports")] + pub fn get_transports(this: &RegisteredKey) -> Option<::js_sys::Array>; + #[doc = "Change the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, setter = "transports")] - fn transports_shim(this: &RegisteredKey, val: &::wasm_bindgen::JsValue); + pub fn set_transports(this: &RegisteredKey, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &RegisteredKey) -> Option; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &RegisteredKey, val: &str); + pub fn set_version(this: &RegisteredKey, val: &str); } impl RegisteredKey { #[doc = "Construct a new `RegisteredKey`."] @@ -28,32 +60,24 @@ impl RegisteredKey { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `appId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[deprecated = "Use `set_app_id()` instead."] pub fn app_id(&mut self, val: Option<&str>) -> &mut Self { - self.app_id_shim(val); + self.set_app_id(val); self } - #[doc = "Change the `keyHandle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[deprecated = "Use `set_key_handle()` instead."] pub fn key_handle(&mut self, val: &str) -> &mut Self { - self.key_handle_shim(val); + self.set_key_handle(val); self } - #[doc = "Change the `transports` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[deprecated = "Use `set_transports()` instead."] pub fn transports(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.transports_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_transports(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } } diff --git a/crates/web-sys/src/features/gen_RegistrationOptions.rs b/crates/web-sys/src/features/gen_RegistrationOptions.rs index 8d635369a40..fe380286b6f 100644 --- a/crates/web-sys/src/features/gen_RegistrationOptions.rs +++ b/crates/web-sys/src/features/gen_RegistrationOptions.rs @@ -10,13 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] pub type RegistrationOptions; + #[doc = "Get the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] + #[wasm_bindgen(method, getter = "scope")] + pub fn get_scope(this: &RegistrationOptions) -> Option; + #[doc = "Change the `scope` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] #[wasm_bindgen(method, setter = "scope")] - fn scope_shim(this: &RegistrationOptions, val: &str); + pub fn set_scope(this: &RegistrationOptions, val: &str); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RegistrationOptions) -> Option; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RegistrationOptions, val: &str); + pub fn set_type(this: &RegistrationOptions, val: &str); + #[cfg(feature = "ServiceWorkerUpdateViaCache")] + #[doc = "Get the `updateViaCache` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`, `ServiceWorkerUpdateViaCache`*"] + #[wasm_bindgen(method, getter = "updateViaCache")] + pub fn get_update_via_cache(this: &RegistrationOptions) -> Option; #[cfg(feature = "ServiceWorkerUpdateViaCache")] + #[doc = "Change the `updateViaCache` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`, `ServiceWorkerUpdateViaCache`*"] #[wasm_bindgen(method, setter = "updateViaCache")] - fn update_via_cache_shim(this: &RegistrationOptions, val: ServiceWorkerUpdateViaCache); + pub fn set_update_via_cache(this: &RegistrationOptions, val: ServiceWorkerUpdateViaCache); } impl RegistrationOptions { #[doc = "Construct a new `RegistrationOptions`."] @@ -27,26 +52,20 @@ impl RegistrationOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `scope` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] + #[deprecated = "Use `set_scope()` instead."] pub fn scope(&mut self, val: &str) -> &mut Self { - self.scope_shim(val); + self.set_scope(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &str) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } #[cfg(feature = "ServiceWorkerUpdateViaCache")] - #[doc = "Change the `updateViaCache` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`, `ServiceWorkerUpdateViaCache`*"] + #[deprecated = "Use `set_update_via_cache()` instead."] pub fn update_via_cache(&mut self, val: ServiceWorkerUpdateViaCache) -> &mut Self { - self.update_via_cache_shim(val); + self.set_update_via_cache(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestDeviceOptions.rs b/crates/web-sys/src/features/gen_RequestDeviceOptions.rs index 85f4a2b5498..265dec607e0 100644 --- a/crates/web-sys/src/features/gen_RequestDeviceOptions.rs +++ b/crates/web-sys/src/features/gen_RequestDeviceOptions.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type RequestDeviceOptions; - #[wasm_bindgen(method, setter = "acceptAllDevices")] - fn accept_all_devices_shim(this: &RequestDeviceOptions, val: bool); - #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "optionalServices")] - fn optional_services_shim(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl RequestDeviceOptions { - #[doc = "Construct a new `RequestDeviceOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `acceptAllDevices` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "acceptAllDevices")] + pub fn get_accept_all_devices(this: &RequestDeviceOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `acceptAllDevices` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl RequestDeviceOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { - self.accept_all_devices_shim(val); - self - } + #[wasm_bindgen(method, setter = "acceptAllDevices")] + pub fn set_accept_all_devices(this: &RequestDeviceOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &RequestDeviceOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `filters` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl RequestDeviceOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); - self - } + #[wasm_bindgen(method, setter = "filters")] + pub fn set_filters(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `optionalServices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "optionalServices")] + pub fn get_optional_services(this: &RequestDeviceOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `optionalServices` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl RequestDeviceOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "optionalServices")] + pub fn set_optional_services(this: &RequestDeviceOptions, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl RequestDeviceOptions { + #[doc = "Construct a new `RequestDeviceOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_accept_all_devices()` instead."] + pub fn accept_all_devices(&mut self, val: bool) -> &mut Self { + self.set_accept_all_devices(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_filters()` instead."] + pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_filters(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_optional_services()` instead."] pub fn optional_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.optional_services_shim(val); + self.set_optional_services(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestInit.rs b/crates/web-sys/src/features/gen_RequestInit.rs index 532bdea1691..ed3eb257b7e 100644 --- a/crates/web-sys/src/features/gen_RequestInit.rs +++ b/crates/web-sys/src/features/gen_RequestInit.rs @@ -10,37 +10,140 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] pub type RequestInit; + #[doc = "Get the `body` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[wasm_bindgen(method, getter = "body")] + pub fn get_body(this: &RequestInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `body` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, setter = "body")] - fn body_shim(this: &RequestInit, val: &::wasm_bindgen::JsValue); + pub fn set_body(this: &RequestInit, val: &::wasm_bindgen::JsValue); #[cfg(feature = "RequestCache")] + #[doc = "Get the `cache` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*"] + #[wasm_bindgen(method, getter = "cache")] + pub fn get_cache(this: &RequestInit) -> Option; + #[cfg(feature = "RequestCache")] + #[doc = "Change the `cache` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*"] #[wasm_bindgen(method, setter = "cache")] - fn cache_shim(this: &RequestInit, val: RequestCache); + pub fn set_cache(this: &RequestInit, val: RequestCache); + #[cfg(feature = "RequestCredentials")] + #[doc = "Get the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*"] + #[wasm_bindgen(method, getter = "credentials")] + pub fn get_credentials(this: &RequestInit) -> Option; #[cfg(feature = "RequestCredentials")] + #[doc = "Change the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*"] #[wasm_bindgen(method, setter = "credentials")] - fn credentials_shim(this: &RequestInit, val: RequestCredentials); + pub fn set_credentials(this: &RequestInit, val: RequestCredentials); + #[doc = "Get the `headers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[wasm_bindgen(method, getter = "headers")] + pub fn get_headers(this: &RequestInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `headers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, setter = "headers")] - fn headers_shim(this: &RequestInit, val: &::wasm_bindgen::JsValue); + pub fn set_headers(this: &RequestInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `integrity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[wasm_bindgen(method, getter = "integrity")] + pub fn get_integrity(this: &RequestInit) -> Option; + #[doc = "Change the `integrity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, setter = "integrity")] - fn integrity_shim(this: &RequestInit, val: &str); + pub fn set_integrity(this: &RequestInit, val: &str); + #[doc = "Get the `method` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[wasm_bindgen(method, getter = "method")] + pub fn get_method(this: &RequestInit) -> Option; + #[doc = "Change the `method` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, setter = "method")] - fn method_shim(this: &RequestInit, val: &str); + pub fn set_method(this: &RequestInit, val: &str); #[cfg(feature = "RequestMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &RequestInit) -> Option; + #[cfg(feature = "RequestMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &RequestInit, val: RequestMode); + pub fn set_mode(this: &RequestInit, val: RequestMode); + #[cfg(feature = "ObserverCallback")] + #[doc = "Get the `observe` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*"] + #[wasm_bindgen(method, getter = "observe")] + pub fn get_observe(this: &RequestInit) -> Option; #[cfg(feature = "ObserverCallback")] + #[doc = "Change the `observe` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*"] #[wasm_bindgen(method, setter = "observe")] - fn observe_shim(this: &RequestInit, val: &ObserverCallback); + pub fn set_observe(this: &RequestInit, val: &ObserverCallback); #[cfg(feature = "RequestRedirect")] + #[doc = "Get the `redirect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*"] + #[wasm_bindgen(method, getter = "redirect")] + pub fn get_redirect(this: &RequestInit) -> Option; + #[cfg(feature = "RequestRedirect")] + #[doc = "Change the `redirect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*"] #[wasm_bindgen(method, setter = "redirect")] - fn redirect_shim(this: &RequestInit, val: RequestRedirect); + pub fn set_redirect(this: &RequestInit, val: RequestRedirect); + #[doc = "Get the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[wasm_bindgen(method, getter = "referrer")] + pub fn get_referrer(this: &RequestInit) -> Option; + #[doc = "Change the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, setter = "referrer")] - fn referrer_shim(this: &RequestInit, val: &str); + pub fn set_referrer(this: &RequestInit, val: &str); #[cfg(feature = "ReferrerPolicy")] + #[doc = "Get the `referrerPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*"] + #[wasm_bindgen(method, getter = "referrerPolicy")] + pub fn get_referrer_policy(this: &RequestInit) -> Option; + #[cfg(feature = "ReferrerPolicy")] + #[doc = "Change the `referrerPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*"] #[wasm_bindgen(method, setter = "referrerPolicy")] - fn referrer_policy_shim(this: &RequestInit, val: ReferrerPolicy); + pub fn set_referrer_policy(this: &RequestInit, val: ReferrerPolicy); + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &RequestInit) -> Option; #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &RequestInit, val: Option<&AbortSignal>); + pub fn set_signal(this: &RequestInit, val: Option<&AbortSignal>); } impl RequestInit { #[doc = "Construct a new `RequestInit`."] @@ -51,95 +154,71 @@ impl RequestInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `body` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[deprecated = "Use `set_body()` instead."] pub fn body(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.body_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_body(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } #[cfg(feature = "RequestCache")] - #[doc = "Change the `cache` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*"] + #[deprecated = "Use `set_cache()` instead."] pub fn cache(&mut self, val: RequestCache) -> &mut Self { - self.cache_shim(val); + self.set_cache(val); self } #[cfg(feature = "RequestCredentials")] - #[doc = "Change the `credentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*"] + #[deprecated = "Use `set_credentials()` instead."] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - self.credentials_shim(val); + self.set_credentials(val); self } - #[doc = "Change the `headers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[deprecated = "Use `set_headers()` instead."] pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.headers_shim(val); + self.set_headers(val); self } - #[doc = "Change the `integrity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[deprecated = "Use `set_integrity()` instead."] pub fn integrity(&mut self, val: &str) -> &mut Self { - self.integrity_shim(val); + self.set_integrity(val); self } - #[doc = "Change the `method` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[deprecated = "Use `set_method()` instead."] pub fn method(&mut self, val: &str) -> &mut Self { - self.method_shim(val); + self.set_method(val); self } #[cfg(feature = "RequestMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: RequestMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } #[cfg(feature = "ObserverCallback")] - #[doc = "Change the `observe` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*"] + #[deprecated = "Use `set_observe()` instead."] pub fn observe(&mut self, val: &ObserverCallback) -> &mut Self { - self.observe_shim(val); + self.set_observe(val); self } #[cfg(feature = "RequestRedirect")] - #[doc = "Change the `redirect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*"] + #[deprecated = "Use `set_redirect()` instead."] pub fn redirect(&mut self, val: RequestRedirect) -> &mut Self { - self.redirect_shim(val); + self.set_redirect(val); self } - #[doc = "Change the `referrer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] + #[deprecated = "Use `set_referrer()` instead."] pub fn referrer(&mut self, val: &str) -> &mut Self { - self.referrer_shim(val); + self.set_referrer(val); self } #[cfg(feature = "ReferrerPolicy")] - #[doc = "Change the `referrerPolicy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*"] + #[deprecated = "Use `set_referrer_policy()` instead."] pub fn referrer_policy(&mut self, val: ReferrerPolicy) -> &mut Self { - self.referrer_policy_shim(val); + self.set_referrer_policy(val); self } #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: Option<&AbortSignal>) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs index ea79accc1ef..5c0c2f0758b 100644 --- a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs +++ b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] pub type RequestMediaKeySystemAccessNotification; + #[doc = "Get the `keySystem` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] + #[wasm_bindgen(method, getter = "keySystem")] + pub fn get_key_system(this: &RequestMediaKeySystemAccessNotification) -> String; + #[doc = "Change the `keySystem` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] #[wasm_bindgen(method, setter = "keySystem")] - fn key_system_shim(this: &RequestMediaKeySystemAccessNotification, val: &str); + pub fn set_key_system(this: &RequestMediaKeySystemAccessNotification, val: &str); #[cfg(feature = "MediaKeySystemStatus")] + #[doc = "Get the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemStatus`, `RequestMediaKeySystemAccessNotification`*"] + #[wasm_bindgen(method, getter = "status")] + pub fn get_status(this: &RequestMediaKeySystemAccessNotification) -> MediaKeySystemStatus; + #[cfg(feature = "MediaKeySystemStatus")] + #[doc = "Change the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemStatus`, `RequestMediaKeySystemAccessNotification`*"] #[wasm_bindgen(method, setter = "status")] - fn status_shim(this: &RequestMediaKeySystemAccessNotification, val: MediaKeySystemStatus); + pub fn set_status(this: &RequestMediaKeySystemAccessNotification, val: MediaKeySystemStatus); } impl RequestMediaKeySystemAccessNotification { #[cfg(feature = "MediaKeySystemStatus")] @@ -28,19 +45,15 @@ impl RequestMediaKeySystemAccessNotification { ret.status(status); ret } - #[doc = "Change the `keySystem` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] + #[deprecated = "Use `set_key_system()` instead."] pub fn key_system(&mut self, val: &str) -> &mut Self { - self.key_system_shim(val); + self.set_key_system(val); self } #[cfg(feature = "MediaKeySystemStatus")] - #[doc = "Change the `status` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemStatus`, `RequestMediaKeySystemAccessNotification`*"] + #[deprecated = "Use `set_status()` instead."] pub fn status(&mut self, val: MediaKeySystemStatus) -> &mut Self { - self.status_shim(val); + self.set_status(val); self } } diff --git a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs index 322f2fbd507..07d824be9ac 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] pub type ResizeObserverOptions; #[cfg(feature = "ResizeObserverBoxOptions")] + #[doc = "Get the `box` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] + #[wasm_bindgen(method, getter = "box")] + pub fn get_box(this: &ResizeObserverOptions) -> Option; + #[cfg(feature = "ResizeObserverBoxOptions")] + #[doc = "Change the `box` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] #[wasm_bindgen(method, setter = "box")] - fn box__shim(this: &ResizeObserverOptions, val: ResizeObserverBoxOptions); + pub fn set_box(this: &ResizeObserverOptions, val: ResizeObserverBoxOptions); } impl ResizeObserverOptions { #[doc = "Construct a new `ResizeObserverOptions`."] @@ -24,11 +33,9 @@ impl ResizeObserverOptions { ret } #[cfg(feature = "ResizeObserverBoxOptions")] - #[doc = "Change the `box` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] + #[deprecated = "Use `set_box()` instead."] pub fn box_(&mut self, val: ResizeObserverBoxOptions) -> &mut Self { - self.box__shim(val); + self.set_box(val); self } } diff --git a/crates/web-sys/src/features/gen_ResponseInit.rs b/crates/web-sys/src/features/gen_ResponseInit.rs index 4466e72567d..0d65c079458 100644 --- a/crates/web-sys/src/features/gen_ResponseInit.rs +++ b/crates/web-sys/src/features/gen_ResponseInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] pub type ResponseInit; + #[doc = "Get the `headers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[wasm_bindgen(method, getter = "headers")] + pub fn get_headers(this: &ResponseInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `headers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] #[wasm_bindgen(method, setter = "headers")] - fn headers_shim(this: &ResponseInit, val: &::wasm_bindgen::JsValue); + pub fn set_headers(this: &ResponseInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[wasm_bindgen(method, getter = "status")] + pub fn get_status(this: &ResponseInit) -> Option; + #[doc = "Change the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] #[wasm_bindgen(method, setter = "status")] - fn status_shim(this: &ResponseInit, val: u16); + pub fn set_status(this: &ResponseInit, val: u16); + #[doc = "Get the `statusText` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[wasm_bindgen(method, getter = "statusText")] + pub fn get_status_text(this: &ResponseInit) -> Option; + #[doc = "Change the `statusText` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] #[wasm_bindgen(method, setter = "statusText")] - fn status_text_shim(this: &ResponseInit, val: &str); + pub fn set_status_text(this: &ResponseInit, val: &str); } impl ResponseInit { #[doc = "Construct a new `ResponseInit`."] @@ -26,25 +50,19 @@ impl ResponseInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `headers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[deprecated = "Use `set_headers()` instead."] pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.headers_shim(val); + self.set_headers(val); self } - #[doc = "Change the `status` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[deprecated = "Use `set_status()` instead."] pub fn status(&mut self, val: u16) -> &mut Self { - self.status_shim(val); + self.set_status(val); self } - #[doc = "Change the `statusText` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] + #[deprecated = "Use `set_status_text()` instead."] pub fn status_text(&mut self, val: &str) -> &mut Self { - self.status_text_shim(val); + self.set_status_text(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs index fd4c25042b3..f9f3a04a3fb 100644 --- a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs +++ b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] pub type RsaHashedImportParams; + #[doc = "Get the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] + #[wasm_bindgen(method, getter = "hash")] + pub fn get_hash(this: &RsaHashedImportParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `hash` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] #[wasm_bindgen(method, setter = "hash")] - fn hash_shim(this: &RsaHashedImportParams, val: &::wasm_bindgen::JsValue); + pub fn set_hash(this: &RsaHashedImportParams, val: &::wasm_bindgen::JsValue); } impl RsaHashedImportParams { #[doc = "Construct a new `RsaHashedImportParams`."] @@ -23,11 +31,9 @@ impl RsaHashedImportParams { ret.hash(hash); ret } - #[doc = "Change the `hash` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaHashedImportParams`*"] + #[deprecated = "Use `set_hash()` instead."] pub fn hash(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.hash_shim(val); + self.set_hash(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaOaepParams.rs b/crates/web-sys/src/features/gen_RsaOaepParams.rs index a500ce24ee7..f0ae80e6358 100644 --- a/crates/web-sys/src/features/gen_RsaOaepParams.rs +++ b/crates/web-sys/src/features/gen_RsaOaepParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] pub type RsaOaepParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &RsaOaepParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &RsaOaepParams, val: &str); + pub fn set_name(this: &RsaOaepParams, val: &str); + #[doc = "Get the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] + #[wasm_bindgen(method, getter = "label")] + pub fn get_label(this: &RsaOaepParams) -> Option<::js_sys::Object>; + #[doc = "Change the `label` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] #[wasm_bindgen(method, setter = "label")] - fn label_shim(this: &RsaOaepParams, val: &::js_sys::Object); + pub fn set_label(this: &RsaOaepParams, val: &::js_sys::Object); } impl RsaOaepParams { #[doc = "Construct a new `RsaOaepParams`."] @@ -25,18 +41,14 @@ impl RsaOaepParams { ret.name(name); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `label` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] + #[deprecated = "Use `set_label()` instead."] pub fn label(&mut self, val: &::js_sys::Object) -> &mut Self { - self.label_shim(val); + self.set_label(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs index 4071e4cd036..d31ec101bce 100644 --- a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs +++ b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] pub type RsaOtherPrimesInfo; + #[doc = "Get the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[wasm_bindgen(method, getter = "d")] + pub fn get_d(this: &RsaOtherPrimesInfo) -> String; + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, setter = "d")] - fn d_shim(this: &RsaOtherPrimesInfo, val: &str); + pub fn set_d(this: &RsaOtherPrimesInfo, val: &str); + #[doc = "Get the `r` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[wasm_bindgen(method, getter = "r")] + pub fn get_r(this: &RsaOtherPrimesInfo) -> String; + #[doc = "Change the `r` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, setter = "r")] - fn r_shim(this: &RsaOtherPrimesInfo, val: &str); + pub fn set_r(this: &RsaOtherPrimesInfo, val: &str); + #[doc = "Get the `t` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[wasm_bindgen(method, getter = "t")] + pub fn get_t(this: &RsaOtherPrimesInfo) -> String; + #[doc = "Change the `t` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, setter = "t")] - fn t_shim(this: &RsaOtherPrimesInfo, val: &str); + pub fn set_t(this: &RsaOtherPrimesInfo, val: &str); } impl RsaOtherPrimesInfo { #[doc = "Construct a new `RsaOtherPrimesInfo`."] @@ -29,25 +53,19 @@ impl RsaOtherPrimesInfo { ret.t(t); ret } - #[doc = "Change the `d` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[deprecated = "Use `set_d()` instead."] pub fn d(&mut self, val: &str) -> &mut Self { - self.d_shim(val); + self.set_d(val); self } - #[doc = "Change the `r` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[deprecated = "Use `set_r()` instead."] pub fn r(&mut self, val: &str) -> &mut Self { - self.r_shim(val); + self.set_r(val); self } - #[doc = "Change the `t` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] + #[deprecated = "Use `set_t()` instead."] pub fn t(&mut self, val: &str) -> &mut Self { - self.t_shim(val); + self.set_t(val); self } } diff --git a/crates/web-sys/src/features/gen_RsaPssParams.rs b/crates/web-sys/src/features/gen_RsaPssParams.rs index 49ece0023e9..1fd87410283 100644 --- a/crates/web-sys/src/features/gen_RsaPssParams.rs +++ b/crates/web-sys/src/features/gen_RsaPssParams.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] pub type RsaPssParams; + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &RsaPssParams) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &RsaPssParams, val: &str); + pub fn set_name(this: &RsaPssParams, val: &str); + #[doc = "Get the `saltLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] + #[wasm_bindgen(method, getter = "saltLength")] + pub fn get_salt_length(this: &RsaPssParams) -> u32; + #[doc = "Change the `saltLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] #[wasm_bindgen(method, setter = "saltLength")] - fn salt_length_shim(this: &RsaPssParams, val: u32); + pub fn set_salt_length(this: &RsaPssParams, val: u32); } impl RsaPssParams { #[doc = "Construct a new `RsaPssParams`."] @@ -26,18 +42,14 @@ impl RsaPssParams { ret.salt_length(salt_length); ret } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `saltLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] + #[deprecated = "Use `set_salt_length()` instead."] pub fn salt_length(&mut self, val: u32) -> &mut Self { - self.salt_length_shim(val); + self.set_salt_length(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs b/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs index 7eab6969f61..e11293272df 100644 --- a/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs +++ b/crates/web-sys/src/features/gen_RtcCertificateExpiration.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] pub type RtcCertificateExpiration; + #[doc = "Get the `expires` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] + #[wasm_bindgen(method, getter = "expires")] + pub fn get_expires(this: &RtcCertificateExpiration) -> Option; + #[doc = "Change the `expires` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] #[wasm_bindgen(method, setter = "expires")] - fn expires_shim(this: &RtcCertificateExpiration, val: f64); + pub fn set_expires(this: &RtcCertificateExpiration, val: f64); } impl RtcCertificateExpiration { #[doc = "Construct a new `RtcCertificateExpiration`."] @@ -22,11 +30,9 @@ impl RtcCertificateExpiration { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `expires` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCertificateExpiration`*"] + #[deprecated = "Use `set_expires()` instead."] pub fn expires(&mut self, val: f64) -> &mut Self { - self.expires_shim(val); + self.set_expires(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcCodecStats.rs b/crates/web-sys/src/features/gen_RtcCodecStats.rs index 3fbd0842d81..81bcee55873 100644 --- a/crates/web-sys/src/features/gen_RtcCodecStats.rs +++ b/crates/web-sys/src/features/gen_RtcCodecStats.rs @@ -10,23 +10,88 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] pub type RtcCodecStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcCodecStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcCodecStats, val: &str); + pub fn set_id(this: &RtcCodecStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcCodecStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcCodecStats, val: f64); + pub fn set_timestamp(this: &RtcCodecStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcCodecStats) -> Option; #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcCodecStats, val: RtcStatsType); + pub fn set_type(this: &RtcCodecStats, val: RtcStatsType); + #[doc = "Get the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "channels")] + pub fn get_channels(this: &RtcCodecStats) -> Option; + #[doc = "Change the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "channels")] - fn channels_shim(this: &RtcCodecStats, val: u32); + pub fn set_channels(this: &RtcCodecStats, val: u32); + #[doc = "Get the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "clockRate")] + pub fn get_clock_rate(this: &RtcCodecStats) -> Option; + #[doc = "Change the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "clockRate")] - fn clock_rate_shim(this: &RtcCodecStats, val: u32); + pub fn set_clock_rate(this: &RtcCodecStats, val: u32); + #[doc = "Get the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "codec")] + pub fn get_codec(this: &RtcCodecStats) -> Option; + #[doc = "Change the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "codec")] - fn codec_shim(this: &RtcCodecStats, val: &str); + pub fn set_codec(this: &RtcCodecStats, val: &str); + #[doc = "Get the `parameters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "parameters")] + pub fn get_parameters(this: &RtcCodecStats) -> Option; + #[doc = "Change the `parameters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "parameters")] - fn parameters_shim(this: &RtcCodecStats, val: &str); + pub fn set_parameters(this: &RtcCodecStats, val: &str); + #[doc = "Get the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[wasm_bindgen(method, getter = "payloadType")] + pub fn get_payload_type(this: &RtcCodecStats) -> Option; + #[doc = "Change the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, setter = "payloadType")] - fn payload_type_shim(this: &RtcCodecStats, val: u32); + pub fn set_payload_type(this: &RtcCodecStats, val: u32); } impl RtcCodecStats { #[doc = "Construct a new `RtcCodecStats`."] @@ -37,61 +102,45 @@ impl RtcCodecStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `channels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_channels()` instead."] pub fn channels(&mut self, val: u32) -> &mut Self { - self.channels_shim(val); + self.set_channels(val); self } - #[doc = "Change the `clockRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_clock_rate()` instead."] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - self.clock_rate_shim(val); + self.set_clock_rate(val); self } - #[doc = "Change the `codec` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_codec()` instead."] pub fn codec(&mut self, val: &str) -> &mut Self { - self.codec_shim(val); + self.set_codec(val); self } - #[doc = "Change the `parameters` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_parameters()` instead."] pub fn parameters(&mut self, val: &str) -> &mut Self { - self.parameters_shim(val); + self.set_parameters(val); self } - #[doc = "Change the `payloadType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] + #[deprecated = "Use `set_payload_type()` instead."] pub fn payload_type(&mut self, val: u32) -> &mut Self { - self.payload_type_shim(val); + self.set_payload_type(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcConfiguration.rs b/crates/web-sys/src/features/gen_RtcConfiguration.rs index 9d73017a32e..93343f2b14b 100644 --- a/crates/web-sys/src/features/gen_RtcConfiguration.rs +++ b/crates/web-sys/src/features/gen_RtcConfiguration.rs @@ -11,17 +11,59 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] pub type RtcConfiguration; #[cfg(feature = "RtcBundlePolicy")] + #[doc = "Get the `bundlePolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcBundlePolicy`, `RtcConfiguration`*"] + #[wasm_bindgen(method, getter = "bundlePolicy")] + pub fn get_bundle_policy(this: &RtcConfiguration) -> Option; + #[cfg(feature = "RtcBundlePolicy")] + #[doc = "Change the `bundlePolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcBundlePolicy`, `RtcConfiguration`*"] #[wasm_bindgen(method, setter = "bundlePolicy")] - fn bundle_policy_shim(this: &RtcConfiguration, val: RtcBundlePolicy); + pub fn set_bundle_policy(this: &RtcConfiguration, val: RtcBundlePolicy); + #[doc = "Get the `certificates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[wasm_bindgen(method, getter = "certificates")] + pub fn get_certificates(this: &RtcConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `certificates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] #[wasm_bindgen(method, setter = "certificates")] - fn certificates_shim(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_certificates(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `iceServers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[wasm_bindgen(method, getter = "iceServers")] + pub fn get_ice_servers(this: &RtcConfiguration) -> Option<::js_sys::Array>; + #[doc = "Change the `iceServers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] #[wasm_bindgen(method, setter = "iceServers")] - fn ice_servers_shim(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); + pub fn set_ice_servers(this: &RtcConfiguration, val: &::wasm_bindgen::JsValue); #[cfg(feature = "RtcIceTransportPolicy")] + #[doc = "Get the `iceTransportPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcIceTransportPolicy`*"] + #[wasm_bindgen(method, getter = "iceTransportPolicy")] + pub fn get_ice_transport_policy(this: &RtcConfiguration) -> Option; + #[cfg(feature = "RtcIceTransportPolicy")] + #[doc = "Change the `iceTransportPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcIceTransportPolicy`*"] #[wasm_bindgen(method, setter = "iceTransportPolicy")] - fn ice_transport_policy_shim(this: &RtcConfiguration, val: RtcIceTransportPolicy); + pub fn set_ice_transport_policy(this: &RtcConfiguration, val: RtcIceTransportPolicy); + #[doc = "Get the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[wasm_bindgen(method, getter = "peerIdentity")] + pub fn get_peer_identity(this: &RtcConfiguration) -> Option; + #[doc = "Change the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] #[wasm_bindgen(method, setter = "peerIdentity")] - fn peer_identity_shim(this: &RtcConfiguration, val: Option<&str>); + pub fn set_peer_identity(this: &RtcConfiguration, val: Option<&str>); } impl RtcConfiguration { #[doc = "Construct a new `RtcConfiguration`."] @@ -33,40 +75,30 @@ impl RtcConfiguration { ret } #[cfg(feature = "RtcBundlePolicy")] - #[doc = "Change the `bundlePolicy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcBundlePolicy`, `RtcConfiguration`*"] + #[deprecated = "Use `set_bundle_policy()` instead."] pub fn bundle_policy(&mut self, val: RtcBundlePolicy) -> &mut Self { - self.bundle_policy_shim(val); + self.set_bundle_policy(val); self } - #[doc = "Change the `certificates` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[deprecated = "Use `set_certificates()` instead."] pub fn certificates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.certificates_shim(val); + self.set_certificates(val); self } - #[doc = "Change the `iceServers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[deprecated = "Use `set_ice_servers()` instead."] pub fn ice_servers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ice_servers_shim(val); + self.set_ice_servers(val); self } #[cfg(feature = "RtcIceTransportPolicy")] - #[doc = "Change the `iceTransportPolicy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcIceTransportPolicy`*"] + #[deprecated = "Use `set_ice_transport_policy()` instead."] pub fn ice_transport_policy(&mut self, val: RtcIceTransportPolicy) -> &mut Self { - self.ice_transport_policy_shim(val); + self.set_ice_transport_policy(val); self } - #[doc = "Change the `peerIdentity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] + #[deprecated = "Use `set_peer_identity()` instead."] pub fn peer_identity(&mut self, val: Option<&str>) -> &mut Self { - self.peer_identity_shim(val); + self.set_peer_identity(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs index bf64ac7bcd1..9f798bbc70e 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] pub type RtcDataChannelEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &RtcDataChannelEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &RtcDataChannelEventInit, val: bool); + pub fn set_bubbles(this: &RtcDataChannelEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &RtcDataChannelEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &RtcDataChannelEventInit, val: bool); + pub fn set_cancelable(this: &RtcDataChannelEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &RtcDataChannelEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &RtcDataChannelEventInit, val: bool); + pub fn set_composed(this: &RtcDataChannelEventInit, val: bool); #[cfg(feature = "RtcDataChannel")] + #[doc = "Get the `channel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`, `RtcDataChannelEventInit`*"] + #[wasm_bindgen(method, getter = "channel")] + pub fn get_channel(this: &RtcDataChannelEventInit) -> RtcDataChannel; + #[cfg(feature = "RtcDataChannel")] + #[doc = "Change the `channel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`, `RtcDataChannelEventInit`*"] #[wasm_bindgen(method, setter = "channel")] - fn channel_shim(this: &RtcDataChannelEventInit, val: &RtcDataChannel); + pub fn set_channel(this: &RtcDataChannelEventInit, val: &RtcDataChannel); } impl RtcDataChannelEventInit { #[cfg(feature = "RtcDataChannel")] @@ -31,33 +64,25 @@ impl RtcDataChannelEventInit { ret.channel(channel); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "RtcDataChannel")] - #[doc = "Change the `channel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`, `RtcDataChannelEventInit`*"] + #[deprecated = "Use `set_channel()` instead."] pub fn channel(&mut self, val: &RtcDataChannel) -> &mut Self { - self.channel_shim(val); + self.set_channel(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs index 915662ba9a1..1e3a9331a66 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs @@ -10,20 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] pub type RtcDataChannelInit; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcDataChannelInit, val: u16); + pub fn set_id(this: &RtcDataChannelInit, val: u16); + #[doc = "Get the `maxPacketLifeTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "maxPacketLifeTime")] + pub fn get_max_packet_life_time(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `maxPacketLifeTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "maxPacketLifeTime")] - fn max_packet_life_time_shim(this: &RtcDataChannelInit, val: u16); + pub fn set_max_packet_life_time(this: &RtcDataChannelInit, val: u16); + #[doc = "Get the `maxRetransmitTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "maxRetransmitTime")] + pub fn get_max_retransmit_time(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `maxRetransmitTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "maxRetransmitTime")] - fn max_retransmit_time_shim(this: &RtcDataChannelInit, val: u16); + pub fn set_max_retransmit_time(this: &RtcDataChannelInit, val: u16); + #[doc = "Get the `maxRetransmits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "maxRetransmits")] + pub fn get_max_retransmits(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `maxRetransmits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "maxRetransmits")] - fn max_retransmits_shim(this: &RtcDataChannelInit, val: u16); + pub fn set_max_retransmits(this: &RtcDataChannelInit, val: u16); + #[doc = "Get the `negotiated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "negotiated")] + pub fn get_negotiated(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `negotiated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "negotiated")] - fn negotiated_shim(this: &RtcDataChannelInit, val: bool); + pub fn set_negotiated(this: &RtcDataChannelInit, val: bool); + #[doc = "Get the `ordered` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "ordered")] + pub fn get_ordered(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `ordered` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "ordered")] - fn ordered_shim(this: &RtcDataChannelInit, val: bool); + pub fn set_ordered(this: &RtcDataChannelInit, val: bool); + #[doc = "Get the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[wasm_bindgen(method, getter = "protocol")] + pub fn get_protocol(this: &RtcDataChannelInit) -> Option; + #[doc = "Change the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, setter = "protocol")] - fn protocol_shim(this: &RtcDataChannelInit, val: &str); + pub fn set_protocol(this: &RtcDataChannelInit, val: &str); } impl RtcDataChannelInit { #[doc = "Construct a new `RtcDataChannelInit`."] @@ -34,53 +90,39 @@ impl RtcDataChannelInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: u16) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `maxPacketLifeTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_max_packet_life_time()` instead."] pub fn max_packet_life_time(&mut self, val: u16) -> &mut Self { - self.max_packet_life_time_shim(val); + self.set_max_packet_life_time(val); self } - #[doc = "Change the `maxRetransmitTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_max_retransmit_time()` instead."] pub fn max_retransmit_time(&mut self, val: u16) -> &mut Self { - self.max_retransmit_time_shim(val); + self.set_max_retransmit_time(val); self } - #[doc = "Change the `maxRetransmits` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_max_retransmits()` instead."] pub fn max_retransmits(&mut self, val: u16) -> &mut Self { - self.max_retransmits_shim(val); + self.set_max_retransmits(val); self } - #[doc = "Change the `negotiated` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_negotiated()` instead."] pub fn negotiated(&mut self, val: bool) -> &mut Self { - self.negotiated_shim(val); + self.set_negotiated(val); self } - #[doc = "Change the `ordered` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_ordered()` instead."] pub fn ordered(&mut self, val: bool) -> &mut Self { - self.ordered_shim(val); + self.set_ordered(val); self } - #[doc = "Change the `protocol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] + #[deprecated = "Use `set_protocol()` instead."] pub fn protocol(&mut self, val: &str) -> &mut Self { - self.protocol_shim(val); + self.set_protocol(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcFecParameters.rs b/crates/web-sys/src/features/gen_RtcFecParameters.rs index 4ac685bf15c..b72b25c9095 100644 --- a/crates/web-sys/src/features/gen_RtcFecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcFecParameters.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] pub type RtcFecParameters; + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcFecParameters) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcFecParameters, val: u32); + pub fn set_ssrc(this: &RtcFecParameters, val: u32); } impl RtcFecParameters { #[doc = "Construct a new `RtcFecParameters`."] @@ -22,11 +30,9 @@ impl RtcFecParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: u32) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs index 9b4637f86a8..9268c3908da 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] pub type RtcIceCandidateInit; + #[doc = "Get the `candidate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[wasm_bindgen(method, getter = "candidate")] + pub fn get_candidate(this: &RtcIceCandidateInit) -> String; + #[doc = "Change the `candidate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] #[wasm_bindgen(method, setter = "candidate")] - fn candidate_shim(this: &RtcIceCandidateInit, val: &str); + pub fn set_candidate(this: &RtcIceCandidateInit, val: &str); + #[doc = "Get the `sdpMLineIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[wasm_bindgen(method, getter = "sdpMLineIndex")] + pub fn get_sdp_m_line_index(this: &RtcIceCandidateInit) -> Option; + #[doc = "Change the `sdpMLineIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] #[wasm_bindgen(method, setter = "sdpMLineIndex")] - fn sdp_m_line_index_shim(this: &RtcIceCandidateInit, val: Option); + pub fn set_sdp_m_line_index(this: &RtcIceCandidateInit, val: Option); + #[doc = "Get the `sdpMid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[wasm_bindgen(method, getter = "sdpMid")] + pub fn get_sdp_mid(this: &RtcIceCandidateInit) -> Option; + #[doc = "Change the `sdpMid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] #[wasm_bindgen(method, setter = "sdpMid")] - fn sdp_mid_shim(this: &RtcIceCandidateInit, val: Option<&str>); + pub fn set_sdp_mid(this: &RtcIceCandidateInit, val: Option<&str>); } impl RtcIceCandidateInit { #[doc = "Construct a new `RtcIceCandidateInit`."] @@ -27,25 +51,19 @@ impl RtcIceCandidateInit { ret.candidate(candidate); ret } - #[doc = "Change the `candidate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[deprecated = "Use `set_candidate()` instead."] pub fn candidate(&mut self, val: &str) -> &mut Self { - self.candidate_shim(val); + self.set_candidate(val); self } - #[doc = "Change the `sdpMLineIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[deprecated = "Use `set_sdp_m_line_index()` instead."] pub fn sdp_m_line_index(&mut self, val: Option) -> &mut Self { - self.sdp_m_line_index_shim(val); + self.set_sdp_m_line_index(val); self } - #[doc = "Change the `sdpMid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] + #[deprecated = "Use `set_sdp_mid()` instead."] pub fn sdp_mid(&mut self, val: Option<&str>) -> &mut Self { - self.sdp_mid_shim(val); + self.set_sdp_mid(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs index d2a83611f77..0ea8f977a5e 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs @@ -10,42 +10,180 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] pub type RtcIceCandidatePairStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcIceCandidatePairStats, val: &str); + pub fn set_id(this: &RtcIceCandidatePairStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_timestamp(this: &RtcIceCandidatePairStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcIceCandidatePairStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcIceCandidatePairStats, val: RtcStatsType); + pub fn set_type(this: &RtcIceCandidatePairStats, val: RtcStatsType); + #[doc = "Get the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_bytes_received(this: &RtcIceCandidatePairStats, val: f64); + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_bytes_sent(this: &RtcIceCandidatePairStats, val: f64); + #[doc = "Get the `componentId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "componentId")] + pub fn get_component_id(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `componentId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "componentId")] - fn component_id_shim(this: &RtcIceCandidatePairStats, val: u32); + pub fn set_component_id(this: &RtcIceCandidatePairStats, val: u32); + #[doc = "Get the `lastPacketReceivedTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "lastPacketReceivedTimestamp")] + pub fn get_last_packet_received_timestamp(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `lastPacketReceivedTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "lastPacketReceivedTimestamp")] - fn last_packet_received_timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_last_packet_received_timestamp(this: &RtcIceCandidatePairStats, val: f64); + #[doc = "Get the `lastPacketSentTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "lastPacketSentTimestamp")] + pub fn get_last_packet_sent_timestamp(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `lastPacketSentTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "lastPacketSentTimestamp")] - fn last_packet_sent_timestamp_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_last_packet_sent_timestamp(this: &RtcIceCandidatePairStats, val: f64); + #[doc = "Get the `localCandidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "localCandidateId")] + pub fn get_local_candidate_id(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `localCandidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "localCandidateId")] - fn local_candidate_id_shim(this: &RtcIceCandidatePairStats, val: &str); + pub fn set_local_candidate_id(this: &RtcIceCandidatePairStats, val: &str); + #[doc = "Get the `nominated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "nominated")] + pub fn get_nominated(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `nominated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "nominated")] - fn nominated_shim(this: &RtcIceCandidatePairStats, val: bool); + pub fn set_nominated(this: &RtcIceCandidatePairStats, val: bool); + #[doc = "Get the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "priority")] + pub fn get_priority(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "priority")] - fn priority_shim(this: &RtcIceCandidatePairStats, val: f64); + pub fn set_priority(this: &RtcIceCandidatePairStats, val: f64); + #[doc = "Get the `readable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "readable")] + pub fn get_readable(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `readable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "readable")] - fn readable_shim(this: &RtcIceCandidatePairStats, val: bool); + pub fn set_readable(this: &RtcIceCandidatePairStats, val: bool); + #[doc = "Get the `remoteCandidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "remoteCandidateId")] + pub fn get_remote_candidate_id(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `remoteCandidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "remoteCandidateId")] - fn remote_candidate_id_shim(this: &RtcIceCandidatePairStats, val: &str); + pub fn set_remote_candidate_id(this: &RtcIceCandidatePairStats, val: &str); + #[doc = "Get the `selected` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "selected")] + pub fn get_selected(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `selected` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "selected")] - fn selected_shim(this: &RtcIceCandidatePairStats, val: bool); + pub fn set_selected(this: &RtcIceCandidatePairStats, val: bool); + #[cfg(feature = "RtcStatsIceCandidatePairState")] + #[doc = "Get the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsIceCandidatePairState`*"] + #[wasm_bindgen(method, getter = "state")] + pub fn get_state(this: &RtcIceCandidatePairStats) -> Option; #[cfg(feature = "RtcStatsIceCandidatePairState")] + #[doc = "Change the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsIceCandidatePairState`*"] #[wasm_bindgen(method, setter = "state")] - fn state_shim(this: &RtcIceCandidatePairStats, val: RtcStatsIceCandidatePairState); + pub fn set_state(this: &RtcIceCandidatePairStats, val: RtcStatsIceCandidatePairState); + #[doc = "Get the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "transportId")] + pub fn get_transport_id(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "transportId")] - fn transport_id_shim(this: &RtcIceCandidatePairStats, val: &str); + pub fn set_transport_id(this: &RtcIceCandidatePairStats, val: &str); + #[doc = "Get the `writable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[wasm_bindgen(method, getter = "writable")] + pub fn get_writable(this: &RtcIceCandidatePairStats) -> Option; + #[doc = "Change the `writable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, setter = "writable")] - fn writable_shim(this: &RtcIceCandidatePairStats, val: bool); + pub fn set_writable(this: &RtcIceCandidatePairStats, val: bool); } impl RtcIceCandidatePairStats { #[doc = "Construct a new `RtcIceCandidatePairStats`."] @@ -56,125 +194,91 @@ impl RtcIceCandidatePairStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `bytesReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_bytes_received()` instead."] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - self.bytes_received_shim(val); + self.set_bytes_received(val); self } - #[doc = "Change the `bytesSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_bytes_sent()` instead."] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - self.bytes_sent_shim(val); + self.set_bytes_sent(val); self } - #[doc = "Change the `componentId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_component_id()` instead."] pub fn component_id(&mut self, val: u32) -> &mut Self { - self.component_id_shim(val); + self.set_component_id(val); self } - #[doc = "Change the `lastPacketReceivedTimestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_last_packet_received_timestamp()` instead."] pub fn last_packet_received_timestamp(&mut self, val: f64) -> &mut Self { - self.last_packet_received_timestamp_shim(val); + self.set_last_packet_received_timestamp(val); self } - #[doc = "Change the `lastPacketSentTimestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_last_packet_sent_timestamp()` instead."] pub fn last_packet_sent_timestamp(&mut self, val: f64) -> &mut Self { - self.last_packet_sent_timestamp_shim(val); + self.set_last_packet_sent_timestamp(val); self } - #[doc = "Change the `localCandidateId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_local_candidate_id()` instead."] pub fn local_candidate_id(&mut self, val: &str) -> &mut Self { - self.local_candidate_id_shim(val); + self.set_local_candidate_id(val); self } - #[doc = "Change the `nominated` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_nominated()` instead."] pub fn nominated(&mut self, val: bool) -> &mut Self { - self.nominated_shim(val); + self.set_nominated(val); self } - #[doc = "Change the `priority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_priority()` instead."] pub fn priority(&mut self, val: f64) -> &mut Self { - self.priority_shim(val); + self.set_priority(val); self } - #[doc = "Change the `readable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_readable()` instead."] pub fn readable(&mut self, val: bool) -> &mut Self { - self.readable_shim(val); + self.set_readable(val); self } - #[doc = "Change the `remoteCandidateId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_remote_candidate_id()` instead."] pub fn remote_candidate_id(&mut self, val: &str) -> &mut Self { - self.remote_candidate_id_shim(val); + self.set_remote_candidate_id(val); self } - #[doc = "Change the `selected` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_selected()` instead."] pub fn selected(&mut self, val: bool) -> &mut Self { - self.selected_shim(val); + self.set_selected(val); self } #[cfg(feature = "RtcStatsIceCandidatePairState")] - #[doc = "Change the `state` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`, `RtcStatsIceCandidatePairState`*"] + #[deprecated = "Use `set_state()` instead."] pub fn state(&mut self, val: RtcStatsIceCandidatePairState) -> &mut Self { - self.state_shim(val); + self.set_state(val); self } - #[doc = "Change the `transportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_transport_id()` instead."] pub fn transport_id(&mut self, val: &str) -> &mut Self { - self.transport_id_shim(val); + self.set_transport_id(val); self } - #[doc = "Change the `writable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] + #[deprecated = "Use `set_writable()` instead."] pub fn writable(&mut self, val: bool) -> &mut Self { - self.writable_shim(val); + self.set_writable(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs index 1b0e279c135..6ea9e9880b2 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs @@ -10,26 +10,100 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] pub type RtcIceCandidateStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcIceCandidateStats, val: &str); + pub fn set_id(this: &RtcIceCandidateStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcIceCandidateStats, val: f64); + pub fn set_timestamp(this: &RtcIceCandidateStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcIceCandidateStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcIceCandidateStats, val: RtcStatsType); + pub fn set_type(this: &RtcIceCandidateStats, val: RtcStatsType); + #[doc = "Get the `candidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "candidateId")] + pub fn get_candidate_id(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `candidateId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "candidateId")] - fn candidate_id_shim(this: &RtcIceCandidateStats, val: &str); + pub fn set_candidate_id(this: &RtcIceCandidateStats, val: &str); + #[cfg(feature = "RtcStatsIceCandidateType")] + #[doc = "Get the `candidateType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsIceCandidateType`*"] + #[wasm_bindgen(method, getter = "candidateType")] + pub fn get_candidate_type(this: &RtcIceCandidateStats) -> Option; #[cfg(feature = "RtcStatsIceCandidateType")] + #[doc = "Change the `candidateType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsIceCandidateType`*"] #[wasm_bindgen(method, setter = "candidateType")] - fn candidate_type_shim(this: &RtcIceCandidateStats, val: RtcStatsIceCandidateType); + pub fn set_candidate_type(this: &RtcIceCandidateStats, val: RtcStatsIceCandidateType); + #[doc = "Get the `componentId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "componentId")] + pub fn get_component_id(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `componentId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "componentId")] - fn component_id_shim(this: &RtcIceCandidateStats, val: &str); + pub fn set_component_id(this: &RtcIceCandidateStats, val: &str); + #[doc = "Get the `ipAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "ipAddress")] + pub fn get_ip_address(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `ipAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "ipAddress")] - fn ip_address_shim(this: &RtcIceCandidateStats, val: &str); + pub fn set_ip_address(this: &RtcIceCandidateStats, val: &str); + #[doc = "Get the `portNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "portNumber")] + pub fn get_port_number(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `portNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "portNumber")] - fn port_number_shim(this: &RtcIceCandidateStats, val: i32); + pub fn set_port_number(this: &RtcIceCandidateStats, val: i32); + #[doc = "Get the `transport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[wasm_bindgen(method, getter = "transport")] + pub fn get_transport(this: &RtcIceCandidateStats) -> Option; + #[doc = "Change the `transport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, setter = "transport")] - fn transport_shim(this: &RtcIceCandidateStats, val: &str); + pub fn set_transport(this: &RtcIceCandidateStats, val: &str); } impl RtcIceCandidateStats { #[doc = "Construct a new `RtcIceCandidateStats`."] @@ -40,69 +114,51 @@ impl RtcIceCandidateStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `candidateId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_candidate_id()` instead."] pub fn candidate_id(&mut self, val: &str) -> &mut Self { - self.candidate_id_shim(val); + self.set_candidate_id(val); self } #[cfg(feature = "RtcStatsIceCandidateType")] - #[doc = "Change the `candidateType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`, `RtcStatsIceCandidateType`*"] + #[deprecated = "Use `set_candidate_type()` instead."] pub fn candidate_type(&mut self, val: RtcStatsIceCandidateType) -> &mut Self { - self.candidate_type_shim(val); + self.set_candidate_type(val); self } - #[doc = "Change the `componentId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_component_id()` instead."] pub fn component_id(&mut self, val: &str) -> &mut Self { - self.component_id_shim(val); + self.set_component_id(val); self } - #[doc = "Change the `ipAddress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_ip_address()` instead."] pub fn ip_address(&mut self, val: &str) -> &mut Self { - self.ip_address_shim(val); + self.set_ip_address(val); self } - #[doc = "Change the `portNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_port_number()` instead."] pub fn port_number(&mut self, val: i32) -> &mut Self { - self.port_number_shim(val); + self.set_port_number(val); self } - #[doc = "Change the `transport` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] + #[deprecated = "Use `set_transport()` instead."] pub fn transport(&mut self, val: &str) -> &mut Self { - self.transport_shim(val); + self.set_transport(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs index b9d84119d9d..ffdf6a5ec07 100644 --- a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs @@ -10,23 +10,88 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] pub type RtcIceComponentStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcIceComponentStats, val: &str); + pub fn set_id(this: &RtcIceComponentStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcIceComponentStats, val: f64); + pub fn set_timestamp(this: &RtcIceComponentStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcIceComponentStats) -> Option; #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcIceComponentStats, val: RtcStatsType); + pub fn set_type(this: &RtcIceComponentStats, val: RtcStatsType); + #[doc = "Get the `activeConnection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "activeConnection")] + pub fn get_active_connection(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `activeConnection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "activeConnection")] - fn active_connection_shim(this: &RtcIceComponentStats, val: bool); + pub fn set_active_connection(this: &RtcIceComponentStats, val: bool); + #[doc = "Get the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &RtcIceComponentStats, val: u32); + pub fn set_bytes_received(this: &RtcIceComponentStats, val: u32); + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &RtcIceComponentStats, val: u32); + pub fn set_bytes_sent(this: &RtcIceComponentStats, val: u32); + #[doc = "Get the `component` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "component")] + pub fn get_component(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `component` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "component")] - fn component_shim(this: &RtcIceComponentStats, val: i32); + pub fn set_component(this: &RtcIceComponentStats, val: i32); + #[doc = "Get the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[wasm_bindgen(method, getter = "transportId")] + pub fn get_transport_id(this: &RtcIceComponentStats) -> Option; + #[doc = "Change the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, setter = "transportId")] - fn transport_id_shim(this: &RtcIceComponentStats, val: &str); + pub fn set_transport_id(this: &RtcIceComponentStats, val: &str); } impl RtcIceComponentStats { #[doc = "Construct a new `RtcIceComponentStats`."] @@ -37,61 +102,45 @@ impl RtcIceComponentStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `activeConnection` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_active_connection()` instead."] pub fn active_connection(&mut self, val: bool) -> &mut Self { - self.active_connection_shim(val); + self.set_active_connection(val); self } - #[doc = "Change the `bytesReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_bytes_received()` instead."] pub fn bytes_received(&mut self, val: u32) -> &mut Self { - self.bytes_received_shim(val); + self.set_bytes_received(val); self } - #[doc = "Change the `bytesSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_bytes_sent()` instead."] pub fn bytes_sent(&mut self, val: u32) -> &mut Self { - self.bytes_sent_shim(val); + self.set_bytes_sent(val); self } - #[doc = "Change the `component` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_component()` instead."] pub fn component(&mut self, val: i32) -> &mut Self { - self.component_shim(val); + self.set_component(val); self } - #[doc = "Change the `transportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] + #[deprecated = "Use `set_transport_id()` instead."] pub fn transport_id(&mut self, val: &str) -> &mut Self { - self.transport_id_shim(val); + self.set_transport_id(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIceServer.rs b/crates/web-sys/src/features/gen_RtcIceServer.rs index 23937c63109..9d68913411a 100644 --- a/crates/web-sys/src/features/gen_RtcIceServer.rs +++ b/crates/web-sys/src/features/gen_RtcIceServer.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] pub type RtcIceServer; + #[doc = "Get the `credential` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[wasm_bindgen(method, getter = "credential")] + pub fn get_credential(this: &RtcIceServer) -> Option; + #[doc = "Change the `credential` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, setter = "credential")] - fn credential_shim(this: &RtcIceServer, val: &str); + pub fn set_credential(this: &RtcIceServer, val: &str); #[cfg(feature = "RtcIceCredentialType")] + #[doc = "Get the `credentialType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCredentialType`, `RtcIceServer`*"] + #[wasm_bindgen(method, getter = "credentialType")] + pub fn get_credential_type(this: &RtcIceServer) -> Option; + #[cfg(feature = "RtcIceCredentialType")] + #[doc = "Change the `credentialType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCredentialType`, `RtcIceServer`*"] #[wasm_bindgen(method, setter = "credentialType")] - fn credential_type_shim(this: &RtcIceServer, val: RtcIceCredentialType); + pub fn set_credential_type(this: &RtcIceServer, val: RtcIceCredentialType); + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &RtcIceServer) -> Option; + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &RtcIceServer, val: &str); + pub fn set_url(this: &RtcIceServer, val: &str); + #[doc = "Get the `urls` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[wasm_bindgen(method, getter = "urls")] + pub fn get_urls(this: &RtcIceServer) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `urls` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, setter = "urls")] - fn urls_shim(this: &RtcIceServer, val: &::wasm_bindgen::JsValue); + pub fn set_urls(this: &RtcIceServer, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `username` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[wasm_bindgen(method, getter = "username")] + pub fn get_username(this: &RtcIceServer) -> Option; + #[doc = "Change the `username` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, setter = "username")] - fn username_shim(this: &RtcIceServer, val: &str); + pub fn set_username(this: &RtcIceServer, val: &str); } impl RtcIceServer { #[doc = "Construct a new `RtcIceServer`."] @@ -31,40 +72,30 @@ impl RtcIceServer { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `credential` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[deprecated = "Use `set_credential()` instead."] pub fn credential(&mut self, val: &str) -> &mut Self { - self.credential_shim(val); + self.set_credential(val); self } #[cfg(feature = "RtcIceCredentialType")] - #[doc = "Change the `credentialType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCredentialType`, `RtcIceServer`*"] + #[deprecated = "Use `set_credential_type()` instead."] pub fn credential_type(&mut self, val: RtcIceCredentialType) -> &mut Self { - self.credential_type_shim(val); + self.set_credential_type(val); self } - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: &str) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } - #[doc = "Change the `urls` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[deprecated = "Use `set_urls()` instead."] pub fn urls(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.urls_shim(val); + self.set_urls(val); self } - #[doc = "Change the `username` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] + #[deprecated = "Use `set_username()` instead."] pub fn username(&mut self, val: &str) -> &mut Self { - self.username_shim(val); + self.set_username(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs index 03e7922f9fc..7458c2702a8 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] pub type RtcIdentityAssertion; + #[doc = "Get the `idp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] + #[wasm_bindgen(method, getter = "idp")] + pub fn get_idp(this: &RtcIdentityAssertion) -> Option; + #[doc = "Change the `idp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] #[wasm_bindgen(method, setter = "idp")] - fn idp_shim(this: &RtcIdentityAssertion, val: &str); + pub fn set_idp(this: &RtcIdentityAssertion, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &RtcIdentityAssertion) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &RtcIdentityAssertion, val: &str); + pub fn set_name(this: &RtcIdentityAssertion, val: &str); } impl RtcIdentityAssertion { #[doc = "Construct a new `RtcIdentityAssertion`."] @@ -24,18 +40,14 @@ impl RtcIdentityAssertion { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `idp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] + #[deprecated = "Use `set_idp()` instead."] pub fn idp(&mut self, val: &str) -> &mut Self { - self.idp_shim(val); + self.set_idp(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs index 186af70aded..8a7503430a2 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] pub type RtcIdentityAssertionResult; + #[doc = "Get the `assertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] + #[wasm_bindgen(method, getter = "assertion")] + pub fn get_assertion(this: &RtcIdentityAssertionResult) -> String; + #[doc = "Change the `assertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] #[wasm_bindgen(method, setter = "assertion")] - fn assertion_shim(this: &RtcIdentityAssertionResult, val: &str); + pub fn set_assertion(this: &RtcIdentityAssertionResult, val: &str); #[cfg(feature = "RtcIdentityProviderDetails")] + #[doc = "Get the `idp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`, `RtcIdentityProviderDetails`*"] + #[wasm_bindgen(method, getter = "idp")] + pub fn get_idp(this: &RtcIdentityAssertionResult) -> RtcIdentityProviderDetails; + #[cfg(feature = "RtcIdentityProviderDetails")] + #[doc = "Change the `idp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`, `RtcIdentityProviderDetails`*"] #[wasm_bindgen(method, setter = "idp")] - fn idp_shim(this: &RtcIdentityAssertionResult, val: &RtcIdentityProviderDetails); + pub fn set_idp(this: &RtcIdentityAssertionResult, val: &RtcIdentityProviderDetails); } impl RtcIdentityAssertionResult { #[cfg(feature = "RtcIdentityProviderDetails")] @@ -28,19 +45,15 @@ impl RtcIdentityAssertionResult { ret.idp(idp); ret } - #[doc = "Change the `assertion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] + #[deprecated = "Use `set_assertion()` instead."] pub fn assertion(&mut self, val: &str) -> &mut Self { - self.assertion_shim(val); + self.set_assertion(val); self } #[cfg(feature = "RtcIdentityProviderDetails")] - #[doc = "Change the `idp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`, `RtcIdentityProviderDetails`*"] + #[deprecated = "Use `set_idp()` instead."] pub fn idp(&mut self, val: &RtcIdentityProviderDetails) -> &mut Self { - self.idp_shim(val); + self.set_idp(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs index b2d6b76b5b0..2b3fe976406 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] pub type RtcIdentityProvider; + #[doc = "Get the `generateAssertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] + #[wasm_bindgen(method, getter = "generateAssertion")] + pub fn get_generate_assertion(this: &RtcIdentityProvider) -> ::js_sys::Function; + #[doc = "Change the `generateAssertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] #[wasm_bindgen(method, setter = "generateAssertion")] - fn generate_assertion_shim(this: &RtcIdentityProvider, val: &::js_sys::Function); + pub fn set_generate_assertion(this: &RtcIdentityProvider, val: &::js_sys::Function); + #[doc = "Get the `validateAssertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] + #[wasm_bindgen(method, getter = "validateAssertion")] + pub fn get_validate_assertion(this: &RtcIdentityProvider) -> ::js_sys::Function; + #[doc = "Change the `validateAssertion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] #[wasm_bindgen(method, setter = "validateAssertion")] - fn validate_assertion_shim(this: &RtcIdentityProvider, val: &::js_sys::Function); + pub fn set_validate_assertion(this: &RtcIdentityProvider, val: &::js_sys::Function); } impl RtcIdentityProvider { #[doc = "Construct a new `RtcIdentityProvider`."] @@ -29,18 +45,14 @@ impl RtcIdentityProvider { ret.validate_assertion(validate_assertion); ret } - #[doc = "Change the `generateAssertion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] + #[deprecated = "Use `set_generate_assertion()` instead."] pub fn generate_assertion(&mut self, val: &::js_sys::Function) -> &mut Self { - self.generate_assertion_shim(val); + self.set_generate_assertion(val); self } - #[doc = "Change the `validateAssertion` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProvider`*"] + #[deprecated = "Use `set_validate_assertion()` instead."] pub fn validate_assertion(&mut self, val: &::js_sys::Function) -> &mut Self { - self.validate_assertion_shim(val); + self.set_validate_assertion(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs index 948c99eabda..e00b757903b 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] pub type RtcIdentityProviderDetails; + #[doc = "Get the `domain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] + #[wasm_bindgen(method, getter = "domain")] + pub fn get_domain(this: &RtcIdentityProviderDetails) -> String; + #[doc = "Change the `domain` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] #[wasm_bindgen(method, setter = "domain")] - fn domain_shim(this: &RtcIdentityProviderDetails, val: &str); + pub fn set_domain(this: &RtcIdentityProviderDetails, val: &str); + #[doc = "Get the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] + #[wasm_bindgen(method, getter = "protocol")] + pub fn get_protocol(this: &RtcIdentityProviderDetails) -> Option; + #[doc = "Change the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] #[wasm_bindgen(method, setter = "protocol")] - fn protocol_shim(this: &RtcIdentityProviderDetails, val: &str); + pub fn set_protocol(this: &RtcIdentityProviderDetails, val: &str); } impl RtcIdentityProviderDetails { #[doc = "Construct a new `RtcIdentityProviderDetails`."] @@ -25,18 +41,14 @@ impl RtcIdentityProviderDetails { ret.domain(domain); ret } - #[doc = "Change the `domain` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] + #[deprecated = "Use `set_domain()` instead."] pub fn domain(&mut self, val: &str) -> &mut Self { - self.domain_shim(val); + self.set_domain(val); self } - #[doc = "Change the `protocol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] + #[deprecated = "Use `set_protocol()` instead."] pub fn protocol(&mut self, val: &str) -> &mut Self { - self.protocol_shim(val); + self.set_protocol(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs index b4ee75df20c..2dc6811ef44 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] pub type RtcIdentityProviderOptions; + #[doc = "Get the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[wasm_bindgen(method, getter = "peerIdentity")] + pub fn get_peer_identity(this: &RtcIdentityProviderOptions) -> Option; + #[doc = "Change the `peerIdentity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, setter = "peerIdentity")] - fn peer_identity_shim(this: &RtcIdentityProviderOptions, val: &str); + pub fn set_peer_identity(this: &RtcIdentityProviderOptions, val: &str); + #[doc = "Get the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[wasm_bindgen(method, getter = "protocol")] + pub fn get_protocol(this: &RtcIdentityProviderOptions) -> Option; + #[doc = "Change the `protocol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, setter = "protocol")] - fn protocol_shim(this: &RtcIdentityProviderOptions, val: &str); + pub fn set_protocol(this: &RtcIdentityProviderOptions, val: &str); + #[doc = "Get the `usernameHint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[wasm_bindgen(method, getter = "usernameHint")] + pub fn get_username_hint(this: &RtcIdentityProviderOptions) -> Option; + #[doc = "Change the `usernameHint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, setter = "usernameHint")] - fn username_hint_shim(this: &RtcIdentityProviderOptions, val: &str); + pub fn set_username_hint(this: &RtcIdentityProviderOptions, val: &str); } impl RtcIdentityProviderOptions { #[doc = "Construct a new `RtcIdentityProviderOptions`."] @@ -26,25 +50,19 @@ impl RtcIdentityProviderOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `peerIdentity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[deprecated = "Use `set_peer_identity()` instead."] pub fn peer_identity(&mut self, val: &str) -> &mut Self { - self.peer_identity_shim(val); + self.set_peer_identity(val); self } - #[doc = "Change the `protocol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[deprecated = "Use `set_protocol()` instead."] pub fn protocol(&mut self, val: &str) -> &mut Self { - self.protocol_shim(val); + self.set_protocol(val); self } - #[doc = "Change the `usernameHint` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] + #[deprecated = "Use `set_username_hint()` instead."] pub fn username_hint(&mut self, val: &str) -> &mut Self { - self.username_hint_shim(val); + self.set_username_hint(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs index 3c86139a6e4..fd417af730f 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] pub type RtcIdentityValidationResult; + #[doc = "Get the `contents` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] + #[wasm_bindgen(method, getter = "contents")] + pub fn get_contents(this: &RtcIdentityValidationResult) -> String; + #[doc = "Change the `contents` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] #[wasm_bindgen(method, setter = "contents")] - fn contents_shim(this: &RtcIdentityValidationResult, val: &str); + pub fn set_contents(this: &RtcIdentityValidationResult, val: &str); + #[doc = "Get the `identity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] + #[wasm_bindgen(method, getter = "identity")] + pub fn get_identity(this: &RtcIdentityValidationResult) -> String; + #[doc = "Change the `identity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] #[wasm_bindgen(method, setter = "identity")] - fn identity_shim(this: &RtcIdentityValidationResult, val: &str); + pub fn set_identity(this: &RtcIdentityValidationResult, val: &str); } impl RtcIdentityValidationResult { #[doc = "Construct a new `RtcIdentityValidationResult`."] @@ -26,18 +42,14 @@ impl RtcIdentityValidationResult { ret.identity(identity); ret } - #[doc = "Change the `contents` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] + #[deprecated = "Use `set_contents()` instead."] pub fn contents(&mut self, val: &str) -> &mut Self { - self.contents_shim(val); + self.set_contents(val); self } - #[doc = "Change the `identity` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] + #[deprecated = "Use `set_identity()` instead."] pub fn identity(&mut self, val: &str) -> &mut Self { - self.identity_shim(val); + self.set_identity(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs index 4d8ff7ecc6c..21580dcb493 100644 --- a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs @@ -10,55 +10,248 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] pub type RtcInboundRtpStreamStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_id(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_timestamp(this: &RtcInboundRtpStreamStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcInboundRtpStreamStats) -> Option; #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcInboundRtpStreamStats, val: RtcStatsType); + pub fn set_type(this: &RtcInboundRtpStreamStats, val: RtcStatsType); + #[doc = "Get the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateMean")] + pub fn get_bitrate_mean(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateMean")] - fn bitrate_mean_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_bitrate_mean(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateStdDev")] + pub fn get_bitrate_std_dev(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateStdDev")] - fn bitrate_std_dev_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_bitrate_std_dev(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "codecId")] + pub fn get_codec_id(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "codecId")] - fn codec_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_codec_id(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "firCount")] + pub fn get_fir_count(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "firCount")] - fn fir_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_fir_count(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateMean")] + pub fn get_framerate_mean(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateMean")] - fn framerate_mean_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_framerate_mean(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateStdDev")] + pub fn get_framerate_std_dev(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateStdDev")] - fn framerate_std_dev_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_framerate_std_dev(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "isRemote")] + pub fn get_is_remote(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "isRemote")] - fn is_remote_shim(this: &RtcInboundRtpStreamStats, val: bool); + pub fn set_is_remote(this: &RtcInboundRtpStreamStats, val: bool); + #[doc = "Get the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaTrackId")] + pub fn get_media_track_id(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaTrackId")] - fn media_track_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_media_track_id(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaType")] + pub fn get_media_type(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaType")] - fn media_type_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_media_type(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "nackCount")] + pub fn get_nack_count(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "nackCount")] - fn nack_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_nack_count(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "pliCount")] + pub fn get_pli_count(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "pliCount")] - fn pli_count_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_pli_count(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "remoteId")] + pub fn get_remote_id(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "remoteId")] - fn remote_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_remote_id(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_ssrc(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "transportId")] + pub fn get_transport_id(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "transportId")] - fn transport_id_shim(this: &RtcInboundRtpStreamStats, val: &str); + pub fn set_transport_id(this: &RtcInboundRtpStreamStats, val: &str); + #[doc = "Get the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_bytes_received(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `discardedPackets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "discardedPackets")] + pub fn get_discarded_packets(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `discardedPackets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "discardedPackets")] - fn discarded_packets_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_discarded_packets(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `framesDecoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framesDecoded")] + pub fn get_frames_decoded(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `framesDecoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framesDecoded")] - fn frames_decoded_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_frames_decoded(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `jitter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "jitter")] + pub fn get_jitter(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `jitter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "jitter")] - fn jitter_shim(this: &RtcInboundRtpStreamStats, val: f64); + pub fn set_jitter(this: &RtcInboundRtpStreamStats, val: f64); + #[doc = "Get the `packetsLost` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "packetsLost")] + pub fn get_packets_lost(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `packetsLost` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "packetsLost")] - fn packets_lost_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_packets_lost(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `packetsReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "packetsReceived")] + pub fn get_packets_received(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `packetsReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "packetsReceived")] - fn packets_received_shim(this: &RtcInboundRtpStreamStats, val: u32); + pub fn set_packets_received(this: &RtcInboundRtpStreamStats, val: u32); + #[doc = "Get the `roundTripTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "roundTripTime")] + pub fn get_round_trip_time(this: &RtcInboundRtpStreamStats) -> Option; + #[doc = "Change the `roundTripTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "roundTripTime")] - fn round_trip_time_shim(this: &RtcInboundRtpStreamStats, val: i32); + pub fn set_round_trip_time(this: &RtcInboundRtpStreamStats, val: i32); } impl RtcInboundRtpStreamStats { #[doc = "Construct a new `RtcInboundRtpStreamStats`."] @@ -69,173 +262,125 @@ impl RtcInboundRtpStreamStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `bitrateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_mean()` instead."] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - self.bitrate_mean_shim(val); + self.set_bitrate_mean(val); self } - #[doc = "Change the `bitrateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_std_dev()` instead."] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - self.bitrate_std_dev_shim(val); + self.set_bitrate_std_dev(val); self } - #[doc = "Change the `codecId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_codec_id()` instead."] pub fn codec_id(&mut self, val: &str) -> &mut Self { - self.codec_id_shim(val); + self.set_codec_id(val); self } - #[doc = "Change the `firCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_fir_count()` instead."] pub fn fir_count(&mut self, val: u32) -> &mut Self { - self.fir_count_shim(val); + self.set_fir_count(val); self } - #[doc = "Change the `framerateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_framerate_mean()` instead."] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - self.framerate_mean_shim(val); + self.set_framerate_mean(val); self } - #[doc = "Change the `framerateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_framerate_std_dev()` instead."] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - self.framerate_std_dev_shim(val); + self.set_framerate_std_dev(val); self } - #[doc = "Change the `isRemote` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_is_remote()` instead."] pub fn is_remote(&mut self, val: bool) -> &mut Self { - self.is_remote_shim(val); + self.set_is_remote(val); self } - #[doc = "Change the `mediaTrackId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_media_track_id()` instead."] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - self.media_track_id_shim(val); + self.set_media_track_id(val); self } - #[doc = "Change the `mediaType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_media_type()` instead."] pub fn media_type(&mut self, val: &str) -> &mut Self { - self.media_type_shim(val); + self.set_media_type(val); self } - #[doc = "Change the `nackCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_nack_count()` instead."] pub fn nack_count(&mut self, val: u32) -> &mut Self { - self.nack_count_shim(val); + self.set_nack_count(val); self } - #[doc = "Change the `pliCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_pli_count()` instead."] pub fn pli_count(&mut self, val: u32) -> &mut Self { - self.pli_count_shim(val); + self.set_pli_count(val); self } - #[doc = "Change the `remoteId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_remote_id()` instead."] pub fn remote_id(&mut self, val: &str) -> &mut Self { - self.remote_id_shim(val); + self.set_remote_id(val); self } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: &str) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } - #[doc = "Change the `transportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_transport_id()` instead."] pub fn transport_id(&mut self, val: &str) -> &mut Self { - self.transport_id_shim(val); + self.set_transport_id(val); self } - #[doc = "Change the `bytesReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_bytes_received()` instead."] pub fn bytes_received(&mut self, val: f64) -> &mut Self { - self.bytes_received_shim(val); + self.set_bytes_received(val); self } - #[doc = "Change the `discardedPackets` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_discarded_packets()` instead."] pub fn discarded_packets(&mut self, val: u32) -> &mut Self { - self.discarded_packets_shim(val); + self.set_discarded_packets(val); self } - #[doc = "Change the `framesDecoded` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_frames_decoded()` instead."] pub fn frames_decoded(&mut self, val: u32) -> &mut Self { - self.frames_decoded_shim(val); + self.set_frames_decoded(val); self } - #[doc = "Change the `jitter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_jitter()` instead."] pub fn jitter(&mut self, val: f64) -> &mut Self { - self.jitter_shim(val); + self.set_jitter(val); self } - #[doc = "Change the `packetsLost` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_packets_lost()` instead."] pub fn packets_lost(&mut self, val: u32) -> &mut Self { - self.packets_lost_shim(val); + self.set_packets_lost(val); self } - #[doc = "Change the `packetsReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_packets_received()` instead."] pub fn packets_received(&mut self, val: u32) -> &mut Self { - self.packets_received_shim(val); + self.set_packets_received(val); self } - #[doc = "Change the `roundTripTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] + #[deprecated = "Use `set_round_trip_time()` instead."] pub fn round_trip_time(&mut self, val: i32) -> &mut Self { - self.round_trip_time_shim(val); + self.set_round_trip_time(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs index 3ee36c181b7..8dc44254a10 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] pub type RtcMediaStreamStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcMediaStreamStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcMediaStreamStats, val: &str); + pub fn set_id(this: &RtcMediaStreamStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcMediaStreamStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcMediaStreamStats, val: f64); + pub fn set_timestamp(this: &RtcMediaStreamStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcMediaStreamStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcMediaStreamStats, val: RtcStatsType); + pub fn set_type(this: &RtcMediaStreamStats, val: RtcStatsType); + #[doc = "Get the `streamIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[wasm_bindgen(method, getter = "streamIdentifier")] + pub fn get_stream_identifier(this: &RtcMediaStreamStats) -> Option; + #[doc = "Change the `streamIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, setter = "streamIdentifier")] - fn stream_identifier_shim(this: &RtcMediaStreamStats, val: &str); + pub fn set_stream_identifier(this: &RtcMediaStreamStats, val: &str); + #[doc = "Get the `trackIds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[wasm_bindgen(method, getter = "trackIds")] + pub fn get_track_ids(this: &RtcMediaStreamStats) -> Option<::js_sys::Array>; + #[doc = "Change the `trackIds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, setter = "trackIds")] - fn track_ids_shim(this: &RtcMediaStreamStats, val: &::wasm_bindgen::JsValue); + pub fn set_track_ids(this: &RtcMediaStreamStats, val: &::wasm_bindgen::JsValue); } impl RtcMediaStreamStats { #[doc = "Construct a new `RtcMediaStreamStats`."] @@ -31,40 +72,30 @@ impl RtcMediaStreamStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `streamIdentifier` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[deprecated = "Use `set_stream_identifier()` instead."] pub fn stream_identifier(&mut self, val: &str) -> &mut Self { - self.stream_identifier_shim(val); + self.set_stream_identifier(val); self } - #[doc = "Change the `trackIds` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] + #[deprecated = "Use `set_track_ids()` instead."] pub fn track_ids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.track_ids_shim(val); + self.set_track_ids(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs index 81b5fd0deda..0ba64d2a16b 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs @@ -10,41 +10,178 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] pub type RtcMediaStreamTrackStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcMediaStreamTrackStats, val: &str); + pub fn set_id(this: &RtcMediaStreamTrackStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcMediaStreamTrackStats, val: f64); + pub fn set_timestamp(this: &RtcMediaStreamTrackStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcMediaStreamTrackStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcMediaStreamTrackStats, val: RtcStatsType); + pub fn set_type(this: &RtcMediaStreamTrackStats, val: RtcStatsType); + #[doc = "Get the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "audioLevel")] + pub fn get_audio_level(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "audioLevel")] - fn audio_level_shim(this: &RtcMediaStreamTrackStats, val: f64); + pub fn set_audio_level(this: &RtcMediaStreamTrackStats, val: f64); + #[doc = "Get the `echoReturnLoss` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "echoReturnLoss")] + pub fn get_echo_return_loss(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `echoReturnLoss` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "echoReturnLoss")] - fn echo_return_loss_shim(this: &RtcMediaStreamTrackStats, val: f64); + pub fn set_echo_return_loss(this: &RtcMediaStreamTrackStats, val: f64); + #[doc = "Get the `echoReturnLossEnhancement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "echoReturnLossEnhancement")] + pub fn get_echo_return_loss_enhancement(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `echoReturnLossEnhancement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "echoReturnLossEnhancement")] - fn echo_return_loss_enhancement_shim(this: &RtcMediaStreamTrackStats, val: f64); + pub fn set_echo_return_loss_enhancement(this: &RtcMediaStreamTrackStats, val: f64); + #[doc = "Get the `frameHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "frameHeight")] + pub fn get_frame_height(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `frameHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "frameHeight")] - fn frame_height_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frame_height(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `frameWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "frameWidth")] + pub fn get_frame_width(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `frameWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "frameWidth")] - fn frame_width_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frame_width(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `framesCorrupted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesCorrupted")] + pub fn get_frames_corrupted(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesCorrupted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesCorrupted")] - fn frames_corrupted_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frames_corrupted(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `framesDecoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesDecoded")] + pub fn get_frames_decoded(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesDecoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesDecoded")] - fn frames_decoded_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frames_decoded(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `framesDropped` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesDropped")] + pub fn get_frames_dropped(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesDropped` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesDropped")] - fn frames_dropped_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frames_dropped(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `framesPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesPerSecond")] + pub fn get_frames_per_second(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesPerSecond` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesPerSecond")] - fn frames_per_second_shim(this: &RtcMediaStreamTrackStats, val: f64); + pub fn set_frames_per_second(this: &RtcMediaStreamTrackStats, val: f64); + #[doc = "Get the `framesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesReceived")] + pub fn get_frames_received(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesReceived")] - fn frames_received_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frames_received(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `framesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "framesSent")] + pub fn get_frames_sent(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `framesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "framesSent")] - fn frames_sent_shim(this: &RtcMediaStreamTrackStats, val: u32); + pub fn set_frames_sent(this: &RtcMediaStreamTrackStats, val: u32); + #[doc = "Get the `remoteSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "remoteSource")] + pub fn get_remote_source(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `remoteSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "remoteSource")] - fn remote_source_shim(this: &RtcMediaStreamTrackStats, val: bool); + pub fn set_remote_source(this: &RtcMediaStreamTrackStats, val: bool); + #[doc = "Get the `ssrcIds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "ssrcIds")] + pub fn get_ssrc_ids(this: &RtcMediaStreamTrackStats) -> Option<::js_sys::Array>; + #[doc = "Change the `ssrcIds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "ssrcIds")] - fn ssrc_ids_shim(this: &RtcMediaStreamTrackStats, val: &::wasm_bindgen::JsValue); + pub fn set_ssrc_ids(this: &RtcMediaStreamTrackStats, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `trackIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[wasm_bindgen(method, getter = "trackIdentifier")] + pub fn get_track_identifier(this: &RtcMediaStreamTrackStats) -> Option; + #[doc = "Change the `trackIdentifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, setter = "trackIdentifier")] - fn track_identifier_shim(this: &RtcMediaStreamTrackStats, val: &str); + pub fn set_track_identifier(this: &RtcMediaStreamTrackStats, val: &str); } impl RtcMediaStreamTrackStats { #[doc = "Construct a new `RtcMediaStreamTrackStats`."] @@ -55,124 +192,90 @@ impl RtcMediaStreamTrackStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `audioLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_audio_level()` instead."] pub fn audio_level(&mut self, val: f64) -> &mut Self { - self.audio_level_shim(val); + self.set_audio_level(val); self } - #[doc = "Change the `echoReturnLoss` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_echo_return_loss()` instead."] pub fn echo_return_loss(&mut self, val: f64) -> &mut Self { - self.echo_return_loss_shim(val); + self.set_echo_return_loss(val); self } - #[doc = "Change the `echoReturnLossEnhancement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_echo_return_loss_enhancement()` instead."] pub fn echo_return_loss_enhancement(&mut self, val: f64) -> &mut Self { - self.echo_return_loss_enhancement_shim(val); + self.set_echo_return_loss_enhancement(val); self } - #[doc = "Change the `frameHeight` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frame_height()` instead."] pub fn frame_height(&mut self, val: u32) -> &mut Self { - self.frame_height_shim(val); + self.set_frame_height(val); self } - #[doc = "Change the `frameWidth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frame_width()` instead."] pub fn frame_width(&mut self, val: u32) -> &mut Self { - self.frame_width_shim(val); + self.set_frame_width(val); self } - #[doc = "Change the `framesCorrupted` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_corrupted()` instead."] pub fn frames_corrupted(&mut self, val: u32) -> &mut Self { - self.frames_corrupted_shim(val); + self.set_frames_corrupted(val); self } - #[doc = "Change the `framesDecoded` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_decoded()` instead."] pub fn frames_decoded(&mut self, val: u32) -> &mut Self { - self.frames_decoded_shim(val); + self.set_frames_decoded(val); self } - #[doc = "Change the `framesDropped` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_dropped()` instead."] pub fn frames_dropped(&mut self, val: u32) -> &mut Self { - self.frames_dropped_shim(val); + self.set_frames_dropped(val); self } - #[doc = "Change the `framesPerSecond` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_per_second()` instead."] pub fn frames_per_second(&mut self, val: f64) -> &mut Self { - self.frames_per_second_shim(val); + self.set_frames_per_second(val); self } - #[doc = "Change the `framesReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_received()` instead."] pub fn frames_received(&mut self, val: u32) -> &mut Self { - self.frames_received_shim(val); + self.set_frames_received(val); self } - #[doc = "Change the `framesSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_frames_sent()` instead."] pub fn frames_sent(&mut self, val: u32) -> &mut Self { - self.frames_sent_shim(val); + self.set_frames_sent(val); self } - #[doc = "Change the `remoteSource` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_remote_source()` instead."] pub fn remote_source(&mut self, val: bool) -> &mut Self { - self.remote_source_shim(val); + self.set_remote_source(val); self } - #[doc = "Change the `ssrcIds` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_ssrc_ids()` instead."] pub fn ssrc_ids(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ssrc_ids_shim(val); + self.set_ssrc_ids(val); self } - #[doc = "Change the `trackIdentifier` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] + #[deprecated = "Use `set_track_identifier()` instead."] pub fn track_identifier(&mut self, val: &str) -> &mut Self { - self.track_identifier_shim(val); + self.set_track_identifier(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcOfferOptions.rs b/crates/web-sys/src/features/gen_RtcOfferOptions.rs index 11082e23695..ba2db197fcb 100644 --- a/crates/web-sys/src/features/gen_RtcOfferOptions.rs +++ b/crates/web-sys/src/features/gen_RtcOfferOptions.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] pub type RtcOfferOptions; + #[doc = "Get the `iceRestart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[wasm_bindgen(method, getter = "iceRestart")] + pub fn get_ice_restart(this: &RtcOfferOptions) -> Option; + #[doc = "Change the `iceRestart` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] #[wasm_bindgen(method, setter = "iceRestart")] - fn ice_restart_shim(this: &RtcOfferOptions, val: bool); + pub fn set_ice_restart(this: &RtcOfferOptions, val: bool); + #[doc = "Get the `offerToReceiveAudio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[wasm_bindgen(method, getter = "offerToReceiveAudio")] + pub fn get_offer_to_receive_audio(this: &RtcOfferOptions) -> Option; + #[doc = "Change the `offerToReceiveAudio` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] #[wasm_bindgen(method, setter = "offerToReceiveAudio")] - fn offer_to_receive_audio_shim(this: &RtcOfferOptions, val: bool); + pub fn set_offer_to_receive_audio(this: &RtcOfferOptions, val: bool); + #[doc = "Get the `offerToReceiveVideo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[wasm_bindgen(method, getter = "offerToReceiveVideo")] + pub fn get_offer_to_receive_video(this: &RtcOfferOptions) -> Option; + #[doc = "Change the `offerToReceiveVideo` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] #[wasm_bindgen(method, setter = "offerToReceiveVideo")] - fn offer_to_receive_video_shim(this: &RtcOfferOptions, val: bool); + pub fn set_offer_to_receive_video(this: &RtcOfferOptions, val: bool); } impl RtcOfferOptions { #[doc = "Construct a new `RtcOfferOptions`."] @@ -26,25 +50,19 @@ impl RtcOfferOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `iceRestart` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[deprecated = "Use `set_ice_restart()` instead."] pub fn ice_restart(&mut self, val: bool) -> &mut Self { - self.ice_restart_shim(val); + self.set_ice_restart(val); self } - #[doc = "Change the `offerToReceiveAudio` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[deprecated = "Use `set_offer_to_receive_audio()` instead."] pub fn offer_to_receive_audio(&mut self, val: bool) -> &mut Self { - self.offer_to_receive_audio_shim(val); + self.set_offer_to_receive_audio(val); self } - #[doc = "Change the `offerToReceiveVideo` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOfferOptions`*"] + #[deprecated = "Use `set_offer_to_receive_video()` instead."] pub fn offer_to_receive_video(&mut self, val: bool) -> &mut Self { - self.offer_to_receive_video_shim(val); + self.set_offer_to_receive_video(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs index 34881d1b56f..093c0b0af22 100644 --- a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs @@ -10,51 +10,228 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] pub type RtcOutboundRtpStreamStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_id(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_timestamp(this: &RtcOutboundRtpStreamStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcOutboundRtpStreamStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcOutboundRtpStreamStats, val: RtcStatsType); + pub fn set_type(this: &RtcOutboundRtpStreamStats, val: RtcStatsType); + #[doc = "Get the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateMean")] + pub fn get_bitrate_mean(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateMean")] - fn bitrate_mean_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_bitrate_mean(this: &RtcOutboundRtpStreamStats, val: f64); + #[doc = "Get the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateStdDev")] + pub fn get_bitrate_std_dev(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateStdDev")] - fn bitrate_std_dev_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_bitrate_std_dev(this: &RtcOutboundRtpStreamStats, val: f64); + #[doc = "Get the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "codecId")] + pub fn get_codec_id(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "codecId")] - fn codec_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_codec_id(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "firCount")] + pub fn get_fir_count(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "firCount")] - fn fir_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_fir_count(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateMean")] + pub fn get_framerate_mean(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateMean")] - fn framerate_mean_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_framerate_mean(this: &RtcOutboundRtpStreamStats, val: f64); + #[doc = "Get the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateStdDev")] + pub fn get_framerate_std_dev(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateStdDev")] - fn framerate_std_dev_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_framerate_std_dev(this: &RtcOutboundRtpStreamStats, val: f64); + #[doc = "Get the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "isRemote")] + pub fn get_is_remote(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "isRemote")] - fn is_remote_shim(this: &RtcOutboundRtpStreamStats, val: bool); + pub fn set_is_remote(this: &RtcOutboundRtpStreamStats, val: bool); + #[doc = "Get the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaTrackId")] + pub fn get_media_track_id(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaTrackId")] - fn media_track_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_media_track_id(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaType")] + pub fn get_media_type(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaType")] - fn media_type_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_media_type(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "nackCount")] + pub fn get_nack_count(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "nackCount")] - fn nack_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_nack_count(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "pliCount")] + pub fn get_pli_count(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "pliCount")] - fn pli_count_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_pli_count(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "remoteId")] + pub fn get_remote_id(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "remoteId")] - fn remote_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_remote_id(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_ssrc(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "transportId")] + pub fn get_transport_id(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "transportId")] - fn transport_id_shim(this: &RtcOutboundRtpStreamStats, val: &str); + pub fn set_transport_id(this: &RtcOutboundRtpStreamStats, val: &str); + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_bytes_sent(this: &RtcOutboundRtpStreamStats, val: f64); + #[doc = "Get the `droppedFrames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "droppedFrames")] + pub fn get_dropped_frames(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `droppedFrames` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "droppedFrames")] - fn dropped_frames_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_dropped_frames(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `framesEncoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framesEncoded")] + pub fn get_frames_encoded(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `framesEncoded` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "framesEncoded")] - fn frames_encoded_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_frames_encoded(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `packetsSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "packetsSent")] + pub fn get_packets_sent(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `packetsSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "packetsSent")] - fn packets_sent_shim(this: &RtcOutboundRtpStreamStats, val: u32); + pub fn set_packets_sent(this: &RtcOutboundRtpStreamStats, val: u32); + #[doc = "Get the `targetBitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[wasm_bindgen(method, getter = "targetBitrate")] + pub fn get_target_bitrate(this: &RtcOutboundRtpStreamStats) -> Option; + #[doc = "Change the `targetBitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, setter = "targetBitrate")] - fn target_bitrate_shim(this: &RtcOutboundRtpStreamStats, val: f64); + pub fn set_target_bitrate(this: &RtcOutboundRtpStreamStats, val: f64); } impl RtcOutboundRtpStreamStats { #[doc = "Construct a new `RtcOutboundRtpStreamStats`."] @@ -65,159 +242,115 @@ impl RtcOutboundRtpStreamStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `bitrateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_mean()` instead."] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - self.bitrate_mean_shim(val); + self.set_bitrate_mean(val); self } - #[doc = "Change the `bitrateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_std_dev()` instead."] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - self.bitrate_std_dev_shim(val); + self.set_bitrate_std_dev(val); self } - #[doc = "Change the `codecId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_codec_id()` instead."] pub fn codec_id(&mut self, val: &str) -> &mut Self { - self.codec_id_shim(val); + self.set_codec_id(val); self } - #[doc = "Change the `firCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_fir_count()` instead."] pub fn fir_count(&mut self, val: u32) -> &mut Self { - self.fir_count_shim(val); + self.set_fir_count(val); self } - #[doc = "Change the `framerateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_framerate_mean()` instead."] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - self.framerate_mean_shim(val); + self.set_framerate_mean(val); self } - #[doc = "Change the `framerateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_framerate_std_dev()` instead."] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - self.framerate_std_dev_shim(val); + self.set_framerate_std_dev(val); self } - #[doc = "Change the `isRemote` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_is_remote()` instead."] pub fn is_remote(&mut self, val: bool) -> &mut Self { - self.is_remote_shim(val); + self.set_is_remote(val); self } - #[doc = "Change the `mediaTrackId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_media_track_id()` instead."] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - self.media_track_id_shim(val); + self.set_media_track_id(val); self } - #[doc = "Change the `mediaType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_media_type()` instead."] pub fn media_type(&mut self, val: &str) -> &mut Self { - self.media_type_shim(val); + self.set_media_type(val); self } - #[doc = "Change the `nackCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_nack_count()` instead."] pub fn nack_count(&mut self, val: u32) -> &mut Self { - self.nack_count_shim(val); + self.set_nack_count(val); self } - #[doc = "Change the `pliCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_pli_count()` instead."] pub fn pli_count(&mut self, val: u32) -> &mut Self { - self.pli_count_shim(val); + self.set_pli_count(val); self } - #[doc = "Change the `remoteId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_remote_id()` instead."] pub fn remote_id(&mut self, val: &str) -> &mut Self { - self.remote_id_shim(val); + self.set_remote_id(val); self } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: &str) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } - #[doc = "Change the `transportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_transport_id()` instead."] pub fn transport_id(&mut self, val: &str) -> &mut Self { - self.transport_id_shim(val); + self.set_transport_id(val); self } - #[doc = "Change the `bytesSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_bytes_sent()` instead."] pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - self.bytes_sent_shim(val); + self.set_bytes_sent(val); self } - #[doc = "Change the `droppedFrames` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_dropped_frames()` instead."] pub fn dropped_frames(&mut self, val: u32) -> &mut Self { - self.dropped_frames_shim(val); + self.set_dropped_frames(val); self } - #[doc = "Change the `framesEncoded` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_frames_encoded()` instead."] pub fn frames_encoded(&mut self, val: u32) -> &mut Self { - self.frames_encoded_shim(val); + self.set_frames_encoded(val); self } - #[doc = "Change the `packetsSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_packets_sent()` instead."] pub fn packets_sent(&mut self, val: u32) -> &mut Self { - self.packets_sent_shim(val); + self.set_packets_sent(val); self } - #[doc = "Change the `targetBitrate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] + #[deprecated = "Use `set_target_bitrate()` instead."] pub fn target_bitrate(&mut self, val: f64) -> &mut Self { - self.target_bitrate_shim(val); + self.set_target_bitrate(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs index b82a2c9e22e..17b0a63b4d2 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnectionIceEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] pub type RtcPeerConnectionIceEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &RtcPeerConnectionIceEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + pub fn set_bubbles(this: &RtcPeerConnectionIceEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &RtcPeerConnectionIceEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + pub fn set_cancelable(this: &RtcPeerConnectionIceEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &RtcPeerConnectionIceEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &RtcPeerConnectionIceEventInit, val: bool); + pub fn set_composed(this: &RtcPeerConnectionIceEventInit, val: bool); #[cfg(feature = "RtcIceCandidate")] + #[doc = "Get the `candidate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`, `RtcPeerConnectionIceEventInit`*"] + #[wasm_bindgen(method, getter = "candidate")] + pub fn get_candidate(this: &RtcPeerConnectionIceEventInit) -> Option; + #[cfg(feature = "RtcIceCandidate")] + #[doc = "Change the `candidate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`, `RtcPeerConnectionIceEventInit`*"] #[wasm_bindgen(method, setter = "candidate")] - fn candidate_shim(this: &RtcPeerConnectionIceEventInit, val: Option<&RtcIceCandidate>); + pub fn set_candidate(this: &RtcPeerConnectionIceEventInit, val: Option<&RtcIceCandidate>); } impl RtcPeerConnectionIceEventInit { #[doc = "Construct a new `RtcPeerConnectionIceEventInit`."] @@ -29,33 +62,25 @@ impl RtcPeerConnectionIceEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "RtcIceCandidate")] - #[doc = "Change the `candidate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`, `RtcPeerConnectionIceEventInit`*"] + #[deprecated = "Use `set_candidate()` instead."] pub fn candidate(&mut self, val: Option<&RtcIceCandidate>) -> &mut Self { - self.candidate_shim(val); + self.set_candidate(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs index 37fa913401f..08bcfc0e6ee 100644 --- a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] pub type RtcRtcpParameters; + #[doc = "Get the `cname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] + #[wasm_bindgen(method, getter = "cname")] + pub fn get_cname(this: &RtcRtcpParameters) -> Option; + #[doc = "Change the `cname` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] #[wasm_bindgen(method, setter = "cname")] - fn cname_shim(this: &RtcRtcpParameters, val: &str); + pub fn set_cname(this: &RtcRtcpParameters, val: &str); + #[doc = "Get the `reducedSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] + #[wasm_bindgen(method, getter = "reducedSize")] + pub fn get_reduced_size(this: &RtcRtcpParameters) -> Option; + #[doc = "Change the `reducedSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] #[wasm_bindgen(method, setter = "reducedSize")] - fn reduced_size_shim(this: &RtcRtcpParameters, val: bool); + pub fn set_reduced_size(this: &RtcRtcpParameters, val: bool); } impl RtcRtcpParameters { #[doc = "Construct a new `RtcRtcpParameters`."] @@ -24,18 +40,14 @@ impl RtcRtcpParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `cname` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] + #[deprecated = "Use `set_cname()` instead."] pub fn cname(&mut self, val: &str) -> &mut Self { - self.cname_shim(val); + self.set_cname(val); self } - #[doc = "Change the `reducedSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] + #[deprecated = "Use `set_reduced_size()` instead."] pub fn reduced_size(&mut self, val: bool) -> &mut Self { - self.reduced_size_shim(val); + self.set_reduced_size(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs index b0b0fa4f9de..512311482ba 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] pub type RtcRtpCapabilities; + #[doc = "Get the `codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + #[wasm_bindgen(method, getter = "codecs")] + pub fn get_codecs(this: &RtcRtpCapabilities) -> ::js_sys::Array; + #[doc = "Change the `codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] #[wasm_bindgen(method, setter = "codecs")] - fn codecs_shim(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); + pub fn set_codecs(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `headerExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + #[wasm_bindgen(method, getter = "headerExtensions")] + pub fn get_header_extensions(this: &RtcRtpCapabilities) -> ::js_sys::Array; + #[doc = "Change the `headerExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] #[wasm_bindgen(method, setter = "headerExtensions")] - fn header_extensions_shim(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); + pub fn set_header_extensions(this: &RtcRtpCapabilities, val: &::wasm_bindgen::JsValue); } impl RtcRtpCapabilities { #[doc = "Construct a new `RtcRtpCapabilities`."] @@ -29,18 +45,14 @@ impl RtcRtpCapabilities { ret.header_extensions(header_extensions); ret } - #[doc = "Change the `codecs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + #[deprecated = "Use `set_codecs()` instead."] pub fn codecs(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.codecs_shim(val); + self.set_codecs(val); self } - #[doc = "Change the `headerExtensions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + #[deprecated = "Use `set_header_extensions()` instead."] pub fn header_extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.header_extensions_shim(val); + self.set_header_extensions(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs index 1e229356986..c398df3fdb6 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] pub type RtcRtpCodecCapability; + #[doc = "Get the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[wasm_bindgen(method, getter = "channels")] + pub fn get_channels(this: &RtcRtpCodecCapability) -> Option; + #[doc = "Change the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, setter = "channels")] - fn channels_shim(this: &RtcRtpCodecCapability, val: u16); + pub fn set_channels(this: &RtcRtpCodecCapability, val: u16); + #[doc = "Get the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[wasm_bindgen(method, getter = "clockRate")] + pub fn get_clock_rate(this: &RtcRtpCodecCapability) -> u32; + #[doc = "Change the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, setter = "clockRate")] - fn clock_rate_shim(this: &RtcRtpCodecCapability, val: u32); + pub fn set_clock_rate(this: &RtcRtpCodecCapability, val: u32); + #[doc = "Get the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[wasm_bindgen(method, getter = "mimeType")] + pub fn get_mime_type(this: &RtcRtpCodecCapability) -> String; + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, setter = "mimeType")] - fn mime_type_shim(this: &RtcRtpCodecCapability, val: &str); + pub fn set_mime_type(this: &RtcRtpCodecCapability, val: &str); + #[doc = "Get the `sdpFmtpLine` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[wasm_bindgen(method, getter = "sdpFmtpLine")] + pub fn get_sdp_fmtp_line(this: &RtcRtpCodecCapability) -> Option; + #[doc = "Change the `sdpFmtpLine` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, setter = "sdpFmtpLine")] - fn sdp_fmtp_line_shim(this: &RtcRtpCodecCapability, val: &str); + pub fn set_sdp_fmtp_line(this: &RtcRtpCodecCapability, val: &str); } impl RtcRtpCodecCapability { #[doc = "Construct a new `RtcRtpCodecCapability`."] @@ -30,32 +62,24 @@ impl RtcRtpCodecCapability { ret.mime_type(mime_type); ret } - #[doc = "Change the `channels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[deprecated = "Use `set_channels()` instead."] pub fn channels(&mut self, val: u16) -> &mut Self { - self.channels_shim(val); + self.set_channels(val); self } - #[doc = "Change the `clockRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[deprecated = "Use `set_clock_rate()` instead."] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - self.clock_rate_shim(val); + self.set_clock_rate(val); self } - #[doc = "Change the `mimeType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[deprecated = "Use `set_mime_type()` instead."] pub fn mime_type(&mut self, val: &str) -> &mut Self { - self.mime_type_shim(val); + self.set_mime_type(val); self } - #[doc = "Change the `sdpFmtpLine` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + #[deprecated = "Use `set_sdp_fmtp_line()` instead."] pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { - self.sdp_fmtp_line_shim(val); + self.set_sdp_fmtp_line(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs index 0293a310175..eefd4a90474 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] pub type RtcRtpCodecParameters; + #[doc = "Get the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[wasm_bindgen(method, getter = "channels")] + pub fn get_channels(this: &RtcRtpCodecParameters) -> Option; + #[doc = "Change the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, setter = "channels")] - fn channels_shim(this: &RtcRtpCodecParameters, val: u16); + pub fn set_channels(this: &RtcRtpCodecParameters, val: u16); + #[doc = "Get the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[wasm_bindgen(method, getter = "clockRate")] + pub fn get_clock_rate(this: &RtcRtpCodecParameters) -> Option; + #[doc = "Change the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, setter = "clockRate")] - fn clock_rate_shim(this: &RtcRtpCodecParameters, val: u32); + pub fn set_clock_rate(this: &RtcRtpCodecParameters, val: u32); + #[doc = "Get the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[wasm_bindgen(method, getter = "mimeType")] + pub fn get_mime_type(this: &RtcRtpCodecParameters) -> Option; + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, setter = "mimeType")] - fn mime_type_shim(this: &RtcRtpCodecParameters, val: &str); + pub fn set_mime_type(this: &RtcRtpCodecParameters, val: &str); + #[doc = "Get the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[wasm_bindgen(method, getter = "payloadType")] + pub fn get_payload_type(this: &RtcRtpCodecParameters) -> Option; + #[doc = "Change the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, setter = "payloadType")] - fn payload_type_shim(this: &RtcRtpCodecParameters, val: u16); + pub fn set_payload_type(this: &RtcRtpCodecParameters, val: u16); + #[doc = "Get the `sdpFmtpLine` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[wasm_bindgen(method, getter = "sdpFmtpLine")] + pub fn get_sdp_fmtp_line(this: &RtcRtpCodecParameters) -> Option; + #[doc = "Change the `sdpFmtpLine` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, setter = "sdpFmtpLine")] - fn sdp_fmtp_line_shim(this: &RtcRtpCodecParameters, val: &str); + pub fn set_sdp_fmtp_line(this: &RtcRtpCodecParameters, val: &str); } impl RtcRtpCodecParameters { #[doc = "Construct a new `RtcRtpCodecParameters`."] @@ -30,39 +70,29 @@ impl RtcRtpCodecParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channels` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[deprecated = "Use `set_channels()` instead."] pub fn channels(&mut self, val: u16) -> &mut Self { - self.channels_shim(val); + self.set_channels(val); self } - #[doc = "Change the `clockRate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[deprecated = "Use `set_clock_rate()` instead."] pub fn clock_rate(&mut self, val: u32) -> &mut Self { - self.clock_rate_shim(val); + self.set_clock_rate(val); self } - #[doc = "Change the `mimeType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[deprecated = "Use `set_mime_type()` instead."] pub fn mime_type(&mut self, val: &str) -> &mut Self { - self.mime_type_shim(val); + self.set_mime_type(val); self } - #[doc = "Change the `payloadType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[deprecated = "Use `set_payload_type()` instead."] pub fn payload_type(&mut self, val: u16) -> &mut Self { - self.payload_type_shim(val); + self.set_payload_type(val); self } - #[doc = "Change the `sdpFmtpLine` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] + #[deprecated = "Use `set_sdp_fmtp_line()` instead."] pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { - self.sdp_fmtp_line_shim(val); + self.set_sdp_fmtp_line(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs index 5cec0c96708..dc78cb31ad8 100644 --- a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] pub type RtcRtpContributingSource; + #[doc = "Get the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[wasm_bindgen(method, getter = "audioLevel")] + pub fn get_audio_level(this: &RtcRtpContributingSource) -> Option; + #[doc = "Change the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] #[wasm_bindgen(method, setter = "audioLevel")] - fn audio_level_shim(this: &RtcRtpContributingSource, val: f64); + pub fn set_audio_level(this: &RtcRtpContributingSource, val: f64); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &RtcRtpContributingSource) -> u32; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &RtcRtpContributingSource, val: u32); + pub fn set_source(this: &RtcRtpContributingSource, val: u32); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcRtpContributingSource) -> f64; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcRtpContributingSource, val: f64); + pub fn set_timestamp(this: &RtcRtpContributingSource, val: f64); } impl RtcRtpContributingSource { #[doc = "Construct a new `RtcRtpContributingSource`."] @@ -28,25 +52,19 @@ impl RtcRtpContributingSource { ret.timestamp(timestamp); ret } - #[doc = "Change the `audioLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[deprecated = "Use `set_audio_level()` instead."] pub fn audio_level(&mut self, val: f64) -> &mut Self { - self.audio_level_shim(val); + self.set_audio_level(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: u32) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpContributingSource`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index 1c8e1ed3b00..e9a65e07012 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -10,30 +10,127 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] pub type RtcRtpEncodingParameters; + #[doc = "Get the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "active")] + pub fn get_active(this: &RtcRtpEncodingParameters) -> Option; + #[doc = "Change the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "active")] - fn active_shim(this: &RtcRtpEncodingParameters, val: bool); + pub fn set_active(this: &RtcRtpEncodingParameters, val: bool); + #[cfg(feature = "RtcDegradationPreference")] + #[doc = "Get the `degradationPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDegradationPreference`, `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "degradationPreference")] + pub fn get_degradation_preference( + this: &RtcRtpEncodingParameters, + ) -> Option; #[cfg(feature = "RtcDegradationPreference")] + #[doc = "Change the `degradationPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDegradationPreference`, `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "degradationPreference")] - fn degradation_preference_shim(this: &RtcRtpEncodingParameters, val: RtcDegradationPreference); + pub fn set_degradation_preference( + this: &RtcRtpEncodingParameters, + val: RtcDegradationPreference, + ); + #[cfg(feature = "RtcFecParameters")] + #[doc = "Get the `fec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`, `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "fec")] + pub fn get_fec(this: &RtcRtpEncodingParameters) -> Option; #[cfg(feature = "RtcFecParameters")] + #[doc = "Change the `fec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`, `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "fec")] - fn fec_shim(this: &RtcRtpEncodingParameters, val: &RtcFecParameters); + pub fn set_fec(this: &RtcRtpEncodingParameters, val: &RtcFecParameters); + #[doc = "Get the `maxBitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "maxBitrate")] + pub fn get_max_bitrate(this: &RtcRtpEncodingParameters) -> Option; + #[doc = "Change the `maxBitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "maxBitrate")] - fn max_bitrate_shim(this: &RtcRtpEncodingParameters, val: u32); + pub fn set_max_bitrate(this: &RtcRtpEncodingParameters, val: u32); + #[cfg(feature = "RtcPriorityType")] + #[doc = "Get the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPriorityType`, `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "priority")] + pub fn get_priority(this: &RtcRtpEncodingParameters) -> Option; #[cfg(feature = "RtcPriorityType")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPriorityType`, `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "priority")] - fn priority_shim(this: &RtcRtpEncodingParameters, val: RtcPriorityType); + pub fn set_priority(this: &RtcRtpEncodingParameters, val: RtcPriorityType); + #[doc = "Get the `rid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "rid")] + pub fn get_rid(this: &RtcRtpEncodingParameters) -> Option; + #[doc = "Change the `rid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "rid")] - fn rid_shim(this: &RtcRtpEncodingParameters, val: &str); + pub fn set_rid(this: &RtcRtpEncodingParameters, val: &str); + #[cfg(feature = "RtcRtxParameters")] + #[doc = "Get the `rtx` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`, `RtcRtxParameters`*"] + #[wasm_bindgen(method, getter = "rtx")] + pub fn get_rtx(this: &RtcRtpEncodingParameters) -> Option; #[cfg(feature = "RtcRtxParameters")] + #[doc = "Change the `rtx` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`, `RtcRtxParameters`*"] #[wasm_bindgen(method, setter = "rtx")] - fn rtx_shim(this: &RtcRtpEncodingParameters, val: &RtcRtxParameters); + pub fn set_rtx(this: &RtcRtpEncodingParameters, val: &RtcRtxParameters); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "scalabilityMode")] + pub fn get_scalability_mode(this: &RtcRtpEncodingParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "scalabilityMode")] - fn scalability_mode_shim(this: &RtcRtpEncodingParameters, val: &str); + pub fn set_scalability_mode(this: &RtcRtpEncodingParameters, val: &str); + #[doc = "Get the `scaleResolutionDownBy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "scaleResolutionDownBy")] + pub fn get_scale_resolution_down_by(this: &RtcRtpEncodingParameters) -> Option; + #[doc = "Change the `scaleResolutionDownBy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "scaleResolutionDownBy")] - fn scale_resolution_down_by_shim(this: &RtcRtpEncodingParameters, val: f32); + pub fn set_scale_resolution_down_by(this: &RtcRtpEncodingParameters, val: f32); + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcRtpEncodingParameters) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcRtpEncodingParameters, val: u32); + pub fn set_ssrc(this: &RtcRtpEncodingParameters, val: u32); } impl RtcRtpEncodingParameters { #[doc = "Construct a new `RtcRtpEncodingParameters`."] @@ -44,82 +141,59 @@ impl RtcRtpEncodingParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `active` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_active()` instead."] pub fn active(&mut self, val: bool) -> &mut Self { - self.active_shim(val); + self.set_active(val); self } #[cfg(feature = "RtcDegradationPreference")] - #[doc = "Change the `degradationPreference` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcDegradationPreference`, `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_degradation_preference()` instead."] pub fn degradation_preference(&mut self, val: RtcDegradationPreference) -> &mut Self { - self.degradation_preference_shim(val); + self.set_degradation_preference(val); self } #[cfg(feature = "RtcFecParameters")] - #[doc = "Change the `fec` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcFecParameters`, `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_fec()` instead."] pub fn fec(&mut self, val: &RtcFecParameters) -> &mut Self { - self.fec_shim(val); + self.set_fec(val); self } - #[doc = "Change the `maxBitrate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_max_bitrate()` instead."] pub fn max_bitrate(&mut self, val: u32) -> &mut Self { - self.max_bitrate_shim(val); + self.set_max_bitrate(val); self } #[cfg(feature = "RtcPriorityType")] - #[doc = "Change the `priority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcPriorityType`, `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_priority()` instead."] pub fn priority(&mut self, val: RtcPriorityType) -> &mut Self { - self.priority_shim(val); + self.set_priority(val); self } - #[doc = "Change the `rid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_rid()` instead."] pub fn rid(&mut self, val: &str) -> &mut Self { - self.rid_shim(val); + self.set_rid(val); self } #[cfg(feature = "RtcRtxParameters")] - #[doc = "Change the `rtx` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`, `RtcRtxParameters`*"] + #[deprecated = "Use `set_rtx()` instead."] pub fn rtx(&mut self, val: &RtcRtxParameters) -> &mut Self { - self.rtx_shim(val); + self.set_rtx(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `scalabilityMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_scalability_mode()` instead."] pub fn scalability_mode(&mut self, val: &str) -> &mut Self { - self.scalability_mode_shim(val); + self.set_scalability_mode(val); self } - #[doc = "Change the `scaleResolutionDownBy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_scale_resolution_down_by()` instead."] pub fn scale_resolution_down_by(&mut self, val: f32) -> &mut Self { - self.scale_resolution_down_by_shim(val); + self.set_scale_resolution_down_by(val); self } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: u32) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs index 3a263a719e0..9372c5da79a 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] pub type RtcRtpHeaderExtensionCapability; + #[doc = "Get the `uri` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] + #[wasm_bindgen(method, getter = "uri")] + pub fn get_uri(this: &RtcRtpHeaderExtensionCapability) -> String; + #[doc = "Change the `uri` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] #[wasm_bindgen(method, setter = "uri")] - fn uri_shim(this: &RtcRtpHeaderExtensionCapability, val: &str); + pub fn set_uri(this: &RtcRtpHeaderExtensionCapability, val: &str); } impl RtcRtpHeaderExtensionCapability { #[doc = "Construct a new `RtcRtpHeaderExtensionCapability`."] @@ -23,11 +31,9 @@ impl RtcRtpHeaderExtensionCapability { ret.uri(uri); ret } - #[doc = "Change the `uri` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] + #[deprecated = "Use `set_uri()` instead."] pub fn uri(&mut self, val: &str) -> &mut Self { - self.uri_shim(val); + self.set_uri(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs index bd09da10daf..aeeeb11cc80 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] pub type RtcRtpHeaderExtensionParameters; + #[doc = "Get the `encrypted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[wasm_bindgen(method, getter = "encrypted")] + pub fn get_encrypted(this: &RtcRtpHeaderExtensionParameters) -> Option; + #[doc = "Change the `encrypted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] #[wasm_bindgen(method, setter = "encrypted")] - fn encrypted_shim(this: &RtcRtpHeaderExtensionParameters, val: bool); + pub fn set_encrypted(this: &RtcRtpHeaderExtensionParameters, val: bool); + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcRtpHeaderExtensionParameters) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcRtpHeaderExtensionParameters, val: u16); + pub fn set_id(this: &RtcRtpHeaderExtensionParameters, val: u16); + #[doc = "Get the `uri` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[wasm_bindgen(method, getter = "uri")] + pub fn get_uri(this: &RtcRtpHeaderExtensionParameters) -> Option; + #[doc = "Change the `uri` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] #[wasm_bindgen(method, setter = "uri")] - fn uri_shim(this: &RtcRtpHeaderExtensionParameters, val: &str); + pub fn set_uri(this: &RtcRtpHeaderExtensionParameters, val: &str); } impl RtcRtpHeaderExtensionParameters { #[doc = "Construct a new `RtcRtpHeaderExtensionParameters`."] @@ -26,25 +50,19 @@ impl RtcRtpHeaderExtensionParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `encrypted` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[deprecated = "Use `set_encrypted()` instead."] pub fn encrypted(&mut self, val: bool) -> &mut Self { - self.encrypted_shim(val); + self.set_encrypted(val); self } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: u16) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `uri` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] + #[deprecated = "Use `set_uri()` instead."] pub fn uri(&mut self, val: &str) -> &mut Self { - self.uri_shim(val); + self.set_uri(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpParameters.rs b/crates/web-sys/src/features/gen_RtcRtpParameters.rs index 1b260e0ea55..cd4bd2fa35a 100644 --- a/crates/web-sys/src/features/gen_RtcRtpParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpParameters.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] pub type RtcRtpParameters; + #[doc = "Get the `codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[wasm_bindgen(method, getter = "codecs")] + pub fn get_codecs(this: &RtcRtpParameters) -> Option<::js_sys::Array>; + #[doc = "Change the `codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] #[wasm_bindgen(method, setter = "codecs")] - fn codecs_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + pub fn set_codecs(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `encodings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[wasm_bindgen(method, getter = "encodings")] + pub fn get_encodings(this: &RtcRtpParameters) -> Option<::js_sys::Array>; + #[doc = "Change the `encodings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] #[wasm_bindgen(method, setter = "encodings")] - fn encodings_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + pub fn set_encodings(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `headerExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[wasm_bindgen(method, getter = "headerExtensions")] + pub fn get_header_extensions(this: &RtcRtpParameters) -> Option<::js_sys::Array>; + #[doc = "Change the `headerExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] #[wasm_bindgen(method, setter = "headerExtensions")] - fn header_extensions_shim(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); + pub fn set_header_extensions(this: &RtcRtpParameters, val: &::wasm_bindgen::JsValue); #[cfg(feature = "RtcRtcpParameters")] + #[doc = "Get the `rtcp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`, `RtcRtpParameters`*"] + #[wasm_bindgen(method, getter = "rtcp")] + pub fn get_rtcp(this: &RtcRtpParameters) -> Option; + #[cfg(feature = "RtcRtcpParameters")] + #[doc = "Change the `rtcp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`, `RtcRtpParameters`*"] #[wasm_bindgen(method, setter = "rtcp")] - fn rtcp_shim(this: &RtcRtpParameters, val: &RtcRtcpParameters); + pub fn set_rtcp(this: &RtcRtpParameters, val: &RtcRtcpParameters); } impl RtcRtpParameters { #[doc = "Construct a new `RtcRtpParameters`."] @@ -29,33 +62,25 @@ impl RtcRtpParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `codecs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[deprecated = "Use `set_codecs()` instead."] pub fn codecs(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.codecs_shim(val); + self.set_codecs(val); self } - #[doc = "Change the `encodings` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[deprecated = "Use `set_encodings()` instead."] pub fn encodings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.encodings_shim(val); + self.set_encodings(val); self } - #[doc = "Change the `headerExtensions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpParameters`*"] + #[deprecated = "Use `set_header_extensions()` instead."] pub fn header_extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.header_extensions_shim(val); + self.set_header_extensions(val); self } #[cfg(feature = "RtcRtcpParameters")] - #[doc = "Change the `rtcp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`, `RtcRtpParameters`*"] + #[deprecated = "Use `set_rtcp()` instead."] pub fn rtcp(&mut self, val: &RtcRtcpParameters) -> &mut Self { - self.rtcp_shim(val); + self.set_rtcp(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs index 3983d4b3827..880bb6be41d 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] pub type RtcRtpSourceEntry; + #[doc = "Get the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[wasm_bindgen(method, getter = "audioLevel")] + pub fn get_audio_level(this: &RtcRtpSourceEntry) -> Option; + #[doc = "Change the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] #[wasm_bindgen(method, setter = "audioLevel")] - fn audio_level_shim(this: &RtcRtpSourceEntry, val: f64); + pub fn set_audio_level(this: &RtcRtpSourceEntry, val: f64); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &RtcRtpSourceEntry) -> u32; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &RtcRtpSourceEntry, val: u32); + pub fn set_source(this: &RtcRtpSourceEntry, val: u32); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcRtpSourceEntry) -> f64; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcRtpSourceEntry, val: f64); + pub fn set_timestamp(this: &RtcRtpSourceEntry, val: f64); + #[doc = "Get the `voiceActivityFlag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[wasm_bindgen(method, getter = "voiceActivityFlag")] + pub fn get_voice_activity_flag(this: &RtcRtpSourceEntry) -> Option; + #[doc = "Change the `voiceActivityFlag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] #[wasm_bindgen(method, setter = "voiceActivityFlag")] - fn voice_activity_flag_shim(this: &RtcRtpSourceEntry, val: Option); + pub fn set_voice_activity_flag(this: &RtcRtpSourceEntry, val: Option); #[cfg(feature = "RtcRtpSourceEntryType")] + #[doc = "Get the `sourceType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`, `RtcRtpSourceEntryType`*"] + #[wasm_bindgen(method, getter = "sourceType")] + pub fn get_source_type(this: &RtcRtpSourceEntry) -> RtcRtpSourceEntryType; + #[cfg(feature = "RtcRtpSourceEntryType")] + #[doc = "Change the `sourceType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`, `RtcRtpSourceEntryType`*"] #[wasm_bindgen(method, setter = "sourceType")] - fn source_type_shim(this: &RtcRtpSourceEntry, val: RtcRtpSourceEntryType); + pub fn set_source_type(this: &RtcRtpSourceEntry, val: RtcRtpSourceEntryType); } impl RtcRtpSourceEntry { #[cfg(feature = "RtcRtpSourceEntryType")] @@ -35,40 +76,30 @@ impl RtcRtpSourceEntry { ret.source_type(source_type); ret } - #[doc = "Change the `audioLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[deprecated = "Use `set_audio_level()` instead."] pub fn audio_level(&mut self, val: f64) -> &mut Self { - self.audio_level_shim(val); + self.set_audio_level(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: u32) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } - #[doc = "Change the `voiceActivityFlag` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`*"] + #[deprecated = "Use `set_voice_activity_flag()` instead."] pub fn voice_activity_flag(&mut self, val: Option) -> &mut Self { - self.voice_activity_flag_shim(val); + self.set_voice_activity_flag(val); self } #[cfg(feature = "RtcRtpSourceEntryType")] - #[doc = "Change the `sourceType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSourceEntry`, `RtcRtpSourceEntryType`*"] + #[deprecated = "Use `set_source_type()` instead."] pub fn source_type(&mut self, val: RtcRtpSourceEntryType) -> &mut Self { - self.source_type_shim(val); + self.set_source_type(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs index 3b58feee346..ad2d27e2feb 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] pub type RtcRtpSynchronizationSource; + #[doc = "Get the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[wasm_bindgen(method, getter = "audioLevel")] + pub fn get_audio_level(this: &RtcRtpSynchronizationSource) -> Option; + #[doc = "Change the `audioLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] #[wasm_bindgen(method, setter = "audioLevel")] - fn audio_level_shim(this: &RtcRtpSynchronizationSource, val: f64); + pub fn set_audio_level(this: &RtcRtpSynchronizationSource, val: f64); + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &RtcRtpSynchronizationSource) -> u32; + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &RtcRtpSynchronizationSource, val: u32); + pub fn set_source(this: &RtcRtpSynchronizationSource, val: u32); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcRtpSynchronizationSource) -> f64; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcRtpSynchronizationSource, val: f64); + pub fn set_timestamp(this: &RtcRtpSynchronizationSource, val: f64); + #[doc = "Get the `voiceActivityFlag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[wasm_bindgen(method, getter = "voiceActivityFlag")] + pub fn get_voice_activity_flag(this: &RtcRtpSynchronizationSource) -> Option; + #[doc = "Change the `voiceActivityFlag` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] #[wasm_bindgen(method, setter = "voiceActivityFlag")] - fn voice_activity_flag_shim(this: &RtcRtpSynchronizationSource, val: Option); + pub fn set_voice_activity_flag(this: &RtcRtpSynchronizationSource, val: Option); } impl RtcRtpSynchronizationSource { #[doc = "Construct a new `RtcRtpSynchronizationSource`."] @@ -30,32 +62,24 @@ impl RtcRtpSynchronizationSource { ret.timestamp(timestamp); ret } - #[doc = "Change the `audioLevel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[deprecated = "Use `set_audio_level()` instead."] pub fn audio_level(&mut self, val: f64) -> &mut Self { - self.audio_level_shim(val); + self.set_audio_level(val); self } - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: u32) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } - #[doc = "Change the `voiceActivityFlag` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"] + #[deprecated = "Use `set_voice_activity_flag()` instead."] pub fn voice_activity_flag(&mut self, val: Option) -> &mut Self { - self.voice_activity_flag_shim(val); + self.set_voice_activity_flag(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs index 47fbc05961d..e0aae6edc7c 100644 --- a/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs +++ b/crates/web-sys/src/features/gen_RtcRtpTransceiverInit.rs @@ -11,12 +11,37 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] pub type RtcRtpTransceiverInit; #[cfg(feature = "RtcRtpTransceiverDirection")] + #[doc = "Get the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverDirection`, `RtcRtpTransceiverInit`*"] + #[wasm_bindgen(method, getter = "direction")] + pub fn get_direction(this: &RtcRtpTransceiverInit) -> Option; + #[cfg(feature = "RtcRtpTransceiverDirection")] + #[doc = "Change the `direction` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverDirection`, `RtcRtpTransceiverInit`*"] #[wasm_bindgen(method, setter = "direction")] - fn direction_shim(this: &RtcRtpTransceiverInit, val: RtcRtpTransceiverDirection); + pub fn set_direction(this: &RtcRtpTransceiverInit, val: RtcRtpTransceiverDirection); + #[doc = "Get the `sendEncodings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] + #[wasm_bindgen(method, getter = "sendEncodings")] + pub fn get_send_encodings(this: &RtcRtpTransceiverInit) -> Option<::js_sys::Array>; + #[doc = "Change the `sendEncodings` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] #[wasm_bindgen(method, setter = "sendEncodings")] - fn send_encodings_shim(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); + pub fn set_send_encodings(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `streams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] + #[wasm_bindgen(method, getter = "streams")] + pub fn get_streams(this: &RtcRtpTransceiverInit) -> Option<::js_sys::Array>; + #[doc = "Change the `streams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] #[wasm_bindgen(method, setter = "streams")] - fn streams_shim(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); + pub fn set_streams(this: &RtcRtpTransceiverInit, val: &::wasm_bindgen::JsValue); } impl RtcRtpTransceiverInit { #[doc = "Construct a new `RtcRtpTransceiverInit`."] @@ -28,25 +53,19 @@ impl RtcRtpTransceiverInit { ret } #[cfg(feature = "RtcRtpTransceiverDirection")] - #[doc = "Change the `direction` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverDirection`, `RtcRtpTransceiverInit`*"] + #[deprecated = "Use `set_direction()` instead."] pub fn direction(&mut self, val: RtcRtpTransceiverDirection) -> &mut Self { - self.direction_shim(val); + self.set_direction(val); self } - #[doc = "Change the `sendEncodings` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] + #[deprecated = "Use `set_send_encodings()` instead."] pub fn send_encodings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.send_encodings_shim(val); + self.set_send_encodings(val); self } - #[doc = "Change the `streams` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiverInit`*"] + #[deprecated = "Use `set_streams()` instead."] pub fn streams(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.streams_shim(val); + self.set_streams(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcRtxParameters.rs b/crates/web-sys/src/features/gen_RtcRtxParameters.rs index 29aba89a545..6fef2de956b 100644 --- a/crates/web-sys/src/features/gen_RtcRtxParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtxParameters.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] pub type RtcRtxParameters; + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcRtxParameters) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcRtxParameters, val: u32); + pub fn set_ssrc(this: &RtcRtxParameters, val: u32); } impl RtcRtxParameters { #[doc = "Construct a new `RtcRtxParameters`."] @@ -22,11 +30,9 @@ impl RtcRtxParameters { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtxParameters`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: u32) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs index e0b20763b49..7c159a09ef2 100644 --- a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs +++ b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs @@ -10,11 +10,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] pub type RtcSessionDescriptionInit; + #[doc = "Get the `sdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] + #[wasm_bindgen(method, getter = "sdp")] + pub fn get_sdp(this: &RtcSessionDescriptionInit) -> Option; + #[doc = "Change the `sdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] #[wasm_bindgen(method, setter = "sdp")] - fn sdp_shim(this: &RtcSessionDescriptionInit, val: &str); + pub fn set_sdp(this: &RtcSessionDescriptionInit, val: &str); #[cfg(feature = "RtcSdpType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcSessionDescriptionInit) -> RtcSdpType; + #[cfg(feature = "RtcSdpType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcSessionDescriptionInit, val: RtcSdpType); + pub fn set_type(this: &RtcSessionDescriptionInit, val: RtcSdpType); } impl RtcSessionDescriptionInit { #[cfg(feature = "RtcSdpType")] @@ -27,19 +44,15 @@ impl RtcSessionDescriptionInit { ret.type_(type_); ret } - #[doc = "Change the `sdp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] + #[deprecated = "Use `set_sdp()` instead."] pub fn sdp(&mut self, val: &str) -> &mut Self { - self.sdp_shim(val); + self.set_sdp(val); self } #[cfg(feature = "RtcSdpType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcSdpType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcStats.rs b/crates/web-sys/src/features/gen_RtcStats.rs index ecbb178de3f..76e02fe410b 100644 --- a/crates/web-sys/src/features/gen_RtcStats.rs +++ b/crates/web-sys/src/features/gen_RtcStats.rs @@ -10,13 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] pub type RtcStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcStats, val: &str); + pub fn set_id(this: &RtcStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcStats, val: f64); + pub fn set_timestamp(this: &RtcStats, val: f64); + #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`, `RtcStatsType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcStats) -> Option; #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStats`, `RtcStatsType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcStats, val: RtcStatsType); + pub fn set_type(this: &RtcStats, val: RtcStatsType); } impl RtcStats { #[doc = "Construct a new `RtcStats`."] @@ -27,26 +52,20 @@ impl RtcStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStats`, `RtcStatsType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs index a08365bf1a0..620270ec598 100644 --- a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs +++ b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs @@ -10,51 +10,235 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] pub type RtcStatsReportInternal; + #[doc = "Get the `closed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "closed")] + pub fn get_closed(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `closed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "closed")] - fn closed_shim(this: &RtcStatsReportInternal, val: bool); + pub fn set_closed(this: &RtcStatsReportInternal, val: bool); + #[doc = "Get the `codecStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "codecStats")] + pub fn get_codec_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `codecStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "codecStats")] - fn codec_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_codec_stats(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `iceCandidatePairStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "iceCandidatePairStats")] + pub fn get_ice_candidate_pair_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `iceCandidatePairStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "iceCandidatePairStats")] - fn ice_candidate_pair_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_ice_candidate_pair_stats( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); + #[doc = "Get the `iceCandidateStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "iceCandidateStats")] + pub fn get_ice_candidate_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `iceCandidateStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "iceCandidateStats")] - fn ice_candidate_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_ice_candidate_stats(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `iceComponentStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "iceComponentStats")] + pub fn get_ice_component_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `iceComponentStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "iceComponentStats")] - fn ice_component_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_ice_component_stats(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `iceRestarts` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "iceRestarts")] + pub fn get_ice_restarts(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `iceRestarts` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "iceRestarts")] - fn ice_restarts_shim(this: &RtcStatsReportInternal, val: u32); + pub fn set_ice_restarts(this: &RtcStatsReportInternal, val: u32); + #[doc = "Get the `iceRollbacks` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "iceRollbacks")] + pub fn get_ice_rollbacks(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `iceRollbacks` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "iceRollbacks")] - fn ice_rollbacks_shim(this: &RtcStatsReportInternal, val: u32); + pub fn set_ice_rollbacks(this: &RtcStatsReportInternal, val: u32); + #[doc = "Get the `inboundRTPStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "inboundRTPStreamStats")] + pub fn get_inbound_rtp_stream_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `inboundRTPStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "inboundRTPStreamStats")] - fn inbound_rtp_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_inbound_rtp_stream_stats( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); + #[doc = "Get the `localSdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "localSdp")] + pub fn get_local_sdp(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `localSdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "localSdp")] - fn local_sdp_shim(this: &RtcStatsReportInternal, val: &str); + pub fn set_local_sdp(this: &RtcStatsReportInternal, val: &str); + #[doc = "Get the `mediaStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "mediaStreamStats")] + pub fn get_media_stream_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `mediaStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "mediaStreamStats")] - fn media_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_media_stream_stats(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `mediaStreamTrackStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "mediaStreamTrackStats")] + pub fn get_media_stream_track_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `mediaStreamTrackStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "mediaStreamTrackStats")] - fn media_stream_track_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_media_stream_track_stats( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); + #[doc = "Get the `offerer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "offerer")] + pub fn get_offerer(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `offerer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "offerer")] - fn offerer_shim(this: &RtcStatsReportInternal, val: bool); + pub fn set_offerer(this: &RtcStatsReportInternal, val: bool); + #[doc = "Get the `outboundRTPStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "outboundRTPStreamStats")] + pub fn get_outbound_rtp_stream_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `outboundRTPStreamStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "outboundRTPStreamStats")] - fn outbound_rtp_stream_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_outbound_rtp_stream_stats( + this: &RtcStatsReportInternal, + val: &::wasm_bindgen::JsValue, + ); + #[doc = "Get the `pcid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "pcid")] + pub fn get_pcid(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `pcid` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "pcid")] - fn pcid_shim(this: &RtcStatsReportInternal, val: &str); + pub fn set_pcid(this: &RtcStatsReportInternal, val: &str); + #[doc = "Get the `rawLocalCandidates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "rawLocalCandidates")] + pub fn get_raw_local_candidates(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `rawLocalCandidates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "rawLocalCandidates")] - fn raw_local_candidates_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_raw_local_candidates(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `rawRemoteCandidates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "rawRemoteCandidates")] + pub fn get_raw_remote_candidates(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `rawRemoteCandidates` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "rawRemoteCandidates")] - fn raw_remote_candidates_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_raw_remote_candidates(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `remoteSdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "remoteSdp")] + pub fn get_remote_sdp(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `remoteSdp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "remoteSdp")] - fn remote_sdp_shim(this: &RtcStatsReportInternal, val: &str); + pub fn set_remote_sdp(this: &RtcStatsReportInternal, val: &str); + #[doc = "Get the `rtpContributingSourceStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "rtpContributingSourceStats")] + pub fn get_rtp_contributing_source_stats( + this: &RtcStatsReportInternal, + ) -> Option<::js_sys::Array>; + #[doc = "Change the `rtpContributingSourceStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "rtpContributingSourceStats")] - fn rtp_contributing_source_stats_shim( + pub fn set_rtp_contributing_source_stats( this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue, ); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcStatsReportInternal) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcStatsReportInternal, val: f64); + pub fn set_timestamp(this: &RtcStatsReportInternal, val: f64); + #[doc = "Get the `transportStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "transportStats")] + pub fn get_transport_stats(this: &RtcStatsReportInternal) -> Option<::js_sys::Array>; + #[doc = "Change the `transportStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "transportStats")] - fn transport_stats_shim(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + pub fn set_transport_stats(this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `trickledIceCandidateStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[wasm_bindgen(method, getter = "trickledIceCandidateStats")] + pub fn get_trickled_ice_candidate_stats( + this: &RtcStatsReportInternal, + ) -> Option<::js_sys::Array>; + #[doc = "Change the `trickledIceCandidateStats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, setter = "trickledIceCandidateStats")] - fn trickled_ice_candidate_stats_shim( + pub fn set_trickled_ice_candidate_stats( this: &RtcStatsReportInternal, val: &::wasm_bindgen::JsValue, ); @@ -68,151 +252,109 @@ impl RtcStatsReportInternal { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `closed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_closed()` instead."] pub fn closed(&mut self, val: bool) -> &mut Self { - self.closed_shim(val); + self.set_closed(val); self } - #[doc = "Change the `codecStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_codec_stats()` instead."] pub fn codec_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.codec_stats_shim(val); + self.set_codec_stats(val); self } - #[doc = "Change the `iceCandidatePairStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_ice_candidate_pair_stats()` instead."] pub fn ice_candidate_pair_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ice_candidate_pair_stats_shim(val); + self.set_ice_candidate_pair_stats(val); self } - #[doc = "Change the `iceCandidateStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_ice_candidate_stats()` instead."] pub fn ice_candidate_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ice_candidate_stats_shim(val); + self.set_ice_candidate_stats(val); self } - #[doc = "Change the `iceComponentStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_ice_component_stats()` instead."] pub fn ice_component_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.ice_component_stats_shim(val); + self.set_ice_component_stats(val); self } - #[doc = "Change the `iceRestarts` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_ice_restarts()` instead."] pub fn ice_restarts(&mut self, val: u32) -> &mut Self { - self.ice_restarts_shim(val); + self.set_ice_restarts(val); self } - #[doc = "Change the `iceRollbacks` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_ice_rollbacks()` instead."] pub fn ice_rollbacks(&mut self, val: u32) -> &mut Self { - self.ice_rollbacks_shim(val); + self.set_ice_rollbacks(val); self } - #[doc = "Change the `inboundRTPStreamStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_inbound_rtp_stream_stats()` instead."] pub fn inbound_rtp_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.inbound_rtp_stream_stats_shim(val); + self.set_inbound_rtp_stream_stats(val); self } - #[doc = "Change the `localSdp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_local_sdp()` instead."] pub fn local_sdp(&mut self, val: &str) -> &mut Self { - self.local_sdp_shim(val); + self.set_local_sdp(val); self } - #[doc = "Change the `mediaStreamStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_media_stream_stats()` instead."] pub fn media_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.media_stream_stats_shim(val); + self.set_media_stream_stats(val); self } - #[doc = "Change the `mediaStreamTrackStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_media_stream_track_stats()` instead."] pub fn media_stream_track_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.media_stream_track_stats_shim(val); + self.set_media_stream_track_stats(val); self } - #[doc = "Change the `offerer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_offerer()` instead."] pub fn offerer(&mut self, val: bool) -> &mut Self { - self.offerer_shim(val); + self.set_offerer(val); self } - #[doc = "Change the `outboundRTPStreamStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_outbound_rtp_stream_stats()` instead."] pub fn outbound_rtp_stream_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.outbound_rtp_stream_stats_shim(val); + self.set_outbound_rtp_stream_stats(val); self } - #[doc = "Change the `pcid` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_pcid()` instead."] pub fn pcid(&mut self, val: &str) -> &mut Self { - self.pcid_shim(val); + self.set_pcid(val); self } - #[doc = "Change the `rawLocalCandidates` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_raw_local_candidates()` instead."] pub fn raw_local_candidates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.raw_local_candidates_shim(val); + self.set_raw_local_candidates(val); self } - #[doc = "Change the `rawRemoteCandidates` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_raw_remote_candidates()` instead."] pub fn raw_remote_candidates(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.raw_remote_candidates_shim(val); + self.set_raw_remote_candidates(val); self } - #[doc = "Change the `remoteSdp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_remote_sdp()` instead."] pub fn remote_sdp(&mut self, val: &str) -> &mut Self { - self.remote_sdp_shim(val); + self.set_remote_sdp(val); self } - #[doc = "Change the `rtpContributingSourceStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_rtp_contributing_source_stats()` instead."] pub fn rtp_contributing_source_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.rtp_contributing_source_stats_shim(val); + self.set_rtp_contributing_source_stats(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } - #[doc = "Change the `transportStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_transport_stats()` instead."] pub fn transport_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.transport_stats_shim(val); + self.set_transport_stats(val); self } - #[doc = "Change the `trickledIceCandidateStats` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] + #[deprecated = "Use `set_trickled_ice_candidate_stats()` instead."] pub fn trickled_ice_candidate_stats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.trickled_ice_candidate_stats_shim(val); + self.set_trickled_ice_candidate_stats(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs index 03ef80243d1..e76dc70c25d 100644 --- a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs @@ -10,23 +10,82 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] pub type RtcTrackEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &RtcTrackEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &RtcTrackEventInit, val: bool); + pub fn set_bubbles(this: &RtcTrackEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &RtcTrackEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &RtcTrackEventInit, val: bool); + pub fn set_cancelable(this: &RtcTrackEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &RtcTrackEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &RtcTrackEventInit, val: bool); + pub fn set_composed(this: &RtcTrackEventInit, val: bool); #[cfg(feature = "RtcRtpReceiver")] + #[doc = "Get the `receiver` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "receiver")] + pub fn get_receiver(this: &RtcTrackEventInit) -> RtcRtpReceiver; + #[cfg(feature = "RtcRtpReceiver")] + #[doc = "Change the `receiver` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "receiver")] - fn receiver_shim(this: &RtcTrackEventInit, val: &RtcRtpReceiver); + pub fn set_receiver(this: &RtcTrackEventInit, val: &RtcRtpReceiver); + #[doc = "Get the `streams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "streams")] + pub fn get_streams(this: &RtcTrackEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `streams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "streams")] - fn streams_shim(this: &RtcTrackEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_streams(this: &RtcTrackEventInit, val: &::wasm_bindgen::JsValue); #[cfg(feature = "MediaStreamTrack")] + #[doc = "Get the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "track")] + pub fn get_track(this: &RtcTrackEventInit) -> MediaStreamTrack; + #[cfg(feature = "MediaStreamTrack")] + #[doc = "Change the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "track")] - fn track_shim(this: &RtcTrackEventInit, val: &MediaStreamTrack); + pub fn set_track(this: &RtcTrackEventInit, val: &MediaStreamTrack); + #[cfg(feature = "RtcRtpTransceiver")] + #[doc = "Get the `transceiver` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`, `RtcTrackEventInit`*"] + #[wasm_bindgen(method, getter = "transceiver")] + pub fn get_transceiver(this: &RtcTrackEventInit) -> RtcRtpTransceiver; #[cfg(feature = "RtcRtpTransceiver")] + #[doc = "Change the `transceiver` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`, `RtcTrackEventInit`*"] #[wasm_bindgen(method, setter = "transceiver")] - fn transceiver_shim(this: &RtcTrackEventInit, val: &RtcRtpTransceiver); + pub fn set_transceiver(this: &RtcTrackEventInit, val: &RtcRtpTransceiver); } impl RtcTrackEventInit { #[cfg(all( @@ -49,56 +108,42 @@ impl RtcTrackEventInit { ret.transceiver(transceiver); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "RtcRtpReceiver")] - #[doc = "Change the `receiver` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcTrackEventInit`*"] + #[deprecated = "Use `set_receiver()` instead."] pub fn receiver(&mut self, val: &RtcRtpReceiver) -> &mut Self { - self.receiver_shim(val); + self.set_receiver(val); self } - #[doc = "Change the `streams` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTrackEventInit`*"] + #[deprecated = "Use `set_streams()` instead."] pub fn streams(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.streams_shim(val); + self.set_streams(val); self } #[cfg(feature = "MediaStreamTrack")] - #[doc = "Change the `track` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `RtcTrackEventInit`*"] + #[deprecated = "Use `set_track()` instead."] pub fn track(&mut self, val: &MediaStreamTrack) -> &mut Self { - self.track_shim(val); + self.set_track(val); self } #[cfg(feature = "RtcRtpTransceiver")] - #[doc = "Change the `transceiver` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`, `RtcTrackEventInit`*"] + #[deprecated = "Use `set_transceiver()` instead."] pub fn transceiver(&mut self, val: &RtcRtpTransceiver) -> &mut Self { - self.transceiver_shim(val); + self.set_transceiver(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcTransportStats.rs b/crates/web-sys/src/features/gen_RtcTransportStats.rs index d76e5bb3220..6564b4c1fab 100644 --- a/crates/web-sys/src/features/gen_RtcTransportStats.rs +++ b/crates/web-sys/src/features/gen_RtcTransportStats.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] pub type RtcTransportStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcTransportStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcTransportStats, val: &str); + pub fn set_id(this: &RtcTransportStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcTransportStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcTransportStats, val: f64); + pub fn set_timestamp(this: &RtcTransportStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcTransportStats`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcTransportStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcTransportStats`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcTransportStats, val: RtcStatsType); + pub fn set_type(this: &RtcTransportStats, val: RtcStatsType); + #[doc = "Get the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &RtcTransportStats) -> Option; + #[doc = "Change the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &RtcTransportStats, val: u32); + pub fn set_bytes_received(this: &RtcTransportStats, val: u32); + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &RtcTransportStats) -> Option; + #[doc = "Change the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &RtcTransportStats, val: u32); + pub fn set_bytes_sent(this: &RtcTransportStats, val: u32); } impl RtcTransportStats { #[doc = "Construct a new `RtcTransportStats`."] @@ -31,40 +72,30 @@ impl RtcTransportStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcTransportStats`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `bytesReceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[deprecated = "Use `set_bytes_received()` instead."] pub fn bytes_received(&mut self, val: u32) -> &mut Self { - self.bytes_received_shim(val); + self.set_bytes_received(val); self } - #[doc = "Change the `bytesSent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] + #[deprecated = "Use `set_bytes_sent()` instead."] pub fn bytes_sent(&mut self, val: u32) -> &mut Self { - self.bytes_sent_shim(val); + self.set_bytes_sent(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs index 5232911bd6a..760ea9dceff 100644 --- a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] pub type RtcdtmfToneChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &RtcdtmfToneChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + pub fn set_bubbles(this: &RtcdtmfToneChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &RtcdtmfToneChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + pub fn set_cancelable(this: &RtcdtmfToneChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &RtcdtmfToneChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &RtcdtmfToneChangeEventInit, val: bool); + pub fn set_composed(this: &RtcdtmfToneChangeEventInit, val: bool); + #[doc = "Get the `tone` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[wasm_bindgen(method, getter = "tone")] + pub fn get_tone(this: &RtcdtmfToneChangeEventInit) -> Option; + #[doc = "Change the `tone` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] #[wasm_bindgen(method, setter = "tone")] - fn tone_shim(this: &RtcdtmfToneChangeEventInit, val: &str); + pub fn set_tone(this: &RtcdtmfToneChangeEventInit, val: &str); } impl RtcdtmfToneChangeEventInit { #[doc = "Construct a new `RtcdtmfToneChangeEventInit`."] @@ -28,32 +60,24 @@ impl RtcdtmfToneChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `tone` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] + #[deprecated = "Use `set_tone()` instead."] pub fn tone(&mut self, val: &str) -> &mut Self { - self.tone_shim(val); + self.set_tone(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs index 76ba0860223..c072f988065 100644 --- a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] pub type RtcrtpContributingSourceStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcrtpContributingSourceStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcrtpContributingSourceStats, val: &str); + pub fn set_id(this: &RtcrtpContributingSourceStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcrtpContributingSourceStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcrtpContributingSourceStats, val: f64); + pub fn set_timestamp(this: &RtcrtpContributingSourceStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpContributingSourceStats`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcrtpContributingSourceStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcrtpContributingSourceStats, val: RtcStatsType); + pub fn set_type(this: &RtcrtpContributingSourceStats, val: RtcStatsType); + #[doc = "Get the `contributorSsrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[wasm_bindgen(method, getter = "contributorSsrc")] + pub fn get_contributor_ssrc(this: &RtcrtpContributingSourceStats) -> Option; + #[doc = "Change the `contributorSsrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, setter = "contributorSsrc")] - fn contributor_ssrc_shim(this: &RtcrtpContributingSourceStats, val: u32); + pub fn set_contributor_ssrc(this: &RtcrtpContributingSourceStats, val: u32); + #[doc = "Get the `inboundRtpStreamId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[wasm_bindgen(method, getter = "inboundRtpStreamId")] + pub fn get_inbound_rtp_stream_id(this: &RtcrtpContributingSourceStats) -> Option; + #[doc = "Change the `inboundRtpStreamId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, setter = "inboundRtpStreamId")] - fn inbound_rtp_stream_id_shim(this: &RtcrtpContributingSourceStats, val: &str); + pub fn set_inbound_rtp_stream_id(this: &RtcrtpContributingSourceStats, val: &str); } impl RtcrtpContributingSourceStats { #[doc = "Construct a new `RtcrtpContributingSourceStats`."] @@ -31,40 +72,30 @@ impl RtcrtpContributingSourceStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpContributingSourceStats`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `contributorSsrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[deprecated = "Use `set_contributor_ssrc()` instead."] pub fn contributor_ssrc(&mut self, val: u32) -> &mut Self { - self.contributor_ssrc_shim(val); + self.set_contributor_ssrc(val); self } - #[doc = "Change the `inboundRtpStreamId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] + #[deprecated = "Use `set_inbound_rtp_stream_id()` instead."] pub fn inbound_rtp_stream_id(&mut self, val: &str) -> &mut Self { - self.inbound_rtp_stream_id_shim(val); + self.set_inbound_rtp_stream_id(val); self } } diff --git a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs index f33e1127499..8348f7fecff 100644 --- a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs @@ -10,41 +10,178 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] pub type RtcrtpStreamStats; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_id(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &RtcrtpStreamStats, val: f64); + pub fn set_timestamp(this: &RtcrtpStreamStats, val: f64); #[cfg(feature = "RtcStatsType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RtcrtpStreamStats) -> Option; + #[cfg(feature = "RtcStatsType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &RtcrtpStreamStats, val: RtcStatsType); + pub fn set_type(this: &RtcrtpStreamStats, val: RtcStatsType); + #[doc = "Get the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateMean")] + pub fn get_bitrate_mean(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `bitrateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateMean")] - fn bitrate_mean_shim(this: &RtcrtpStreamStats, val: f64); + pub fn set_bitrate_mean(this: &RtcrtpStreamStats, val: f64); + #[doc = "Get the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "bitrateStdDev")] + pub fn get_bitrate_std_dev(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `bitrateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "bitrateStdDev")] - fn bitrate_std_dev_shim(this: &RtcrtpStreamStats, val: f64); + pub fn set_bitrate_std_dev(this: &RtcrtpStreamStats, val: f64); + #[doc = "Get the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "codecId")] + pub fn get_codec_id(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `codecId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "codecId")] - fn codec_id_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_codec_id(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "firCount")] + pub fn get_fir_count(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `firCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "firCount")] - fn fir_count_shim(this: &RtcrtpStreamStats, val: u32); + pub fn set_fir_count(this: &RtcrtpStreamStats, val: u32); + #[doc = "Get the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateMean")] + pub fn get_framerate_mean(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `framerateMean` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateMean")] - fn framerate_mean_shim(this: &RtcrtpStreamStats, val: f64); + pub fn set_framerate_mean(this: &RtcrtpStreamStats, val: f64); + #[doc = "Get the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "framerateStdDev")] + pub fn get_framerate_std_dev(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `framerateStdDev` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "framerateStdDev")] - fn framerate_std_dev_shim(this: &RtcrtpStreamStats, val: f64); + pub fn set_framerate_std_dev(this: &RtcrtpStreamStats, val: f64); + #[doc = "Get the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "isRemote")] + pub fn get_is_remote(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `isRemote` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "isRemote")] - fn is_remote_shim(this: &RtcrtpStreamStats, val: bool); + pub fn set_is_remote(this: &RtcrtpStreamStats, val: bool); + #[doc = "Get the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaTrackId")] + pub fn get_media_track_id(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `mediaTrackId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaTrackId")] - fn media_track_id_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_media_track_id(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "mediaType")] + pub fn get_media_type(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `mediaType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "mediaType")] - fn media_type_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_media_type(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "nackCount")] + pub fn get_nack_count(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `nackCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "nackCount")] - fn nack_count_shim(this: &RtcrtpStreamStats, val: u32); + pub fn set_nack_count(this: &RtcrtpStreamStats, val: u32); + #[doc = "Get the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "pliCount")] + pub fn get_pli_count(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `pliCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "pliCount")] - fn pli_count_shim(this: &RtcrtpStreamStats, val: u32); + pub fn set_pli_count(this: &RtcrtpStreamStats, val: u32); + #[doc = "Get the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "remoteId")] + pub fn get_remote_id(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `remoteId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "remoteId")] - fn remote_id_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_remote_id(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "ssrc")] + pub fn get_ssrc(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `ssrc` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "ssrc")] - fn ssrc_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_ssrc(this: &RtcrtpStreamStats, val: &str); + #[doc = "Get the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[wasm_bindgen(method, getter = "transportId")] + pub fn get_transport_id(this: &RtcrtpStreamStats) -> Option; + #[doc = "Change the `transportId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, setter = "transportId")] - fn transport_id_shim(this: &RtcrtpStreamStats, val: &str); + pub fn set_transport_id(this: &RtcrtpStreamStats, val: &str); } impl RtcrtpStreamStats { #[doc = "Construct a new `RtcrtpStreamStats`."] @@ -55,124 +192,90 @@ impl RtcrtpStreamStats { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `id` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_id()` instead."] pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); + self.set_id(val); self } - #[doc = "Change the `timestamp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } #[cfg(feature = "RtcStatsType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcStatsType`, `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: RtcStatsType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `bitrateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_mean()` instead."] pub fn bitrate_mean(&mut self, val: f64) -> &mut Self { - self.bitrate_mean_shim(val); + self.set_bitrate_mean(val); self } - #[doc = "Change the `bitrateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_bitrate_std_dev()` instead."] pub fn bitrate_std_dev(&mut self, val: f64) -> &mut Self { - self.bitrate_std_dev_shim(val); + self.set_bitrate_std_dev(val); self } - #[doc = "Change the `codecId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_codec_id()` instead."] pub fn codec_id(&mut self, val: &str) -> &mut Self { - self.codec_id_shim(val); + self.set_codec_id(val); self } - #[doc = "Change the `firCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_fir_count()` instead."] pub fn fir_count(&mut self, val: u32) -> &mut Self { - self.fir_count_shim(val); + self.set_fir_count(val); self } - #[doc = "Change the `framerateMean` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_framerate_mean()` instead."] pub fn framerate_mean(&mut self, val: f64) -> &mut Self { - self.framerate_mean_shim(val); + self.set_framerate_mean(val); self } - #[doc = "Change the `framerateStdDev` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_framerate_std_dev()` instead."] pub fn framerate_std_dev(&mut self, val: f64) -> &mut Self { - self.framerate_std_dev_shim(val); + self.set_framerate_std_dev(val); self } - #[doc = "Change the `isRemote` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_is_remote()` instead."] pub fn is_remote(&mut self, val: bool) -> &mut Self { - self.is_remote_shim(val); + self.set_is_remote(val); self } - #[doc = "Change the `mediaTrackId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_media_track_id()` instead."] pub fn media_track_id(&mut self, val: &str) -> &mut Self { - self.media_track_id_shim(val); + self.set_media_track_id(val); self } - #[doc = "Change the `mediaType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_media_type()` instead."] pub fn media_type(&mut self, val: &str) -> &mut Self { - self.media_type_shim(val); + self.set_media_type(val); self } - #[doc = "Change the `nackCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_nack_count()` instead."] pub fn nack_count(&mut self, val: u32) -> &mut Self { - self.nack_count_shim(val); + self.set_nack_count(val); self } - #[doc = "Change the `pliCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_pli_count()` instead."] pub fn pli_count(&mut self, val: u32) -> &mut Self { - self.pli_count_shim(val); + self.set_pli_count(val); self } - #[doc = "Change the `remoteId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_remote_id()` instead."] pub fn remote_id(&mut self, val: &str) -> &mut Self { - self.remote_id_shim(val); + self.set_remote_id(val); self } - #[doc = "Change the `ssrc` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_ssrc()` instead."] pub fn ssrc(&mut self, val: &str) -> &mut Self { - self.ssrc_shim(val); + self.set_ssrc(val); self } - #[doc = "Change the `transportId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] + #[deprecated = "Use `set_transport_id()` instead."] pub fn transport_id(&mut self, val: &str) -> &mut Self { - self.transport_id_shim(val); + self.set_transport_id(val); self } } diff --git a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs index 9502619bfac..3e310a60ca1 100644 --- a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs @@ -14,30 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SaveFilePickerOptions; - #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] - fn exclude_accept_all_option_shim(this: &SaveFilePickerOptions, val: bool); - #[wasm_bindgen(method, setter = "id")] - fn id_shim(this: &SaveFilePickerOptions, val: &str); - #[wasm_bindgen(method, setter = "startIn")] - fn start_in_shim(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "types")] - fn types_shim(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "suggestedName")] - fn suggested_name_shim(this: &SaveFilePickerOptions, val: Option<&str>); -} -#[cfg(web_sys_unstable_apis)] -impl SaveFilePickerOptions { - #[doc = "Construct a new `SaveFilePickerOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `excludeAcceptAllOption` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "excludeAcceptAllOption")] + pub fn get_exclude_accept_all_option(this: &SaveFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `excludeAcceptAllOption` field of this object."] #[doc = ""] @@ -45,10 +30,17 @@ impl SaveFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { - self.exclude_accept_all_option_shim(val); - self - } + #[wasm_bindgen(method, setter = "excludeAcceptAllOption")] + pub fn set_exclude_accept_all_option(this: &SaveFilePickerOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &SaveFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -56,10 +48,17 @@ impl SaveFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn id(&mut self, val: &str) -> &mut Self { - self.id_shim(val); - self - } + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &SaveFilePickerOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startIn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startIn")] + pub fn get_start_in(this: &SaveFilePickerOptions) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `startIn` field of this object."] #[doc = ""] @@ -67,10 +66,17 @@ impl SaveFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.start_in_shim(val); - self - } + #[wasm_bindgen(method, setter = "startIn")] + pub fn set_start_in(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `types` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "types")] + pub fn get_types(this: &SaveFilePickerOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `types` field of this object."] #[doc = ""] @@ -78,10 +84,17 @@ impl SaveFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.types_shim(val); - self - } + #[wasm_bindgen(method, setter = "types")] + pub fn set_types(this: &SaveFilePickerOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `suggestedName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "suggestedName")] + pub fn get_suggested_name(this: &SaveFilePickerOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `suggestedName` field of this object."] #[doc = ""] @@ -89,8 +102,50 @@ impl SaveFilePickerOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "suggestedName")] + pub fn set_suggested_name(this: &SaveFilePickerOptions, val: Option<&str>); +} +#[cfg(web_sys_unstable_apis)] +impl SaveFilePickerOptions { + #[doc = "Construct a new `SaveFilePickerOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SaveFilePickerOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_exclude_accept_all_option()` instead."] + pub fn exclude_accept_all_option(&mut self, val: bool) -> &mut Self { + self.set_exclude_accept_all_option(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_start_in()` instead."] + pub fn start_in(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_start_in(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_types()` instead."] + pub fn types(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_types(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_suggested_name()` instead."] pub fn suggested_name(&mut self, val: Option<&str>) -> &mut Self { - self.suggested_name_shim(val); + self.set_suggested_name(val); self } } diff --git a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs index a913bd85edc..367acaf5a16 100644 --- a/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs +++ b/crates/web-sys/src/features/gen_SchedulerPostTaskOptions.rs @@ -14,14 +14,64 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SchedulerPostTaskOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "delay")] + pub fn get_delay(this: &SchedulerPostTaskOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `delay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "delay")] - fn delay_shim(this: &SchedulerPostTaskOptions, val: f64); + pub fn set_delay(this: &SchedulerPostTaskOptions, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Get the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "priority")] + pub fn get_priority(this: &SchedulerPostTaskOptions) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "priority")] - fn priority_shim(this: &SchedulerPostTaskOptions, val: TaskPriority); + pub fn set_priority(this: &SchedulerPostTaskOptions, val: TaskPriority); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &SchedulerPostTaskOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `SchedulerPostTaskOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &SchedulerPostTaskOptions, val: &AbortSignal); + pub fn set_signal(this: &SchedulerPostTaskOptions, val: &AbortSignal); } #[cfg(web_sys_unstable_apis)] impl SchedulerPostTaskOptions { @@ -37,38 +87,23 @@ impl SchedulerPostTaskOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `delay` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_delay()` instead."] pub fn delay(&mut self, val: f64) -> &mut Self { - self.delay_shim(val); + self.set_delay(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] - #[doc = "Change the `priority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SchedulerPostTaskOptions`, `TaskPriority`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_priority()` instead."] pub fn priority(&mut self, val: TaskPriority) -> &mut Self { - self.priority_shim(val); + self.set_priority(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `SchedulerPostTaskOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs b/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs index b412d88ad14..ec98659e7e3 100644 --- a/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollIntoViewOptions.rs @@ -11,14 +11,41 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`*"] pub type ScrollIntoViewOptions; #[cfg(feature = "ScrollBehavior")] + #[doc = "Get the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollIntoViewOptions`*"] + #[wasm_bindgen(method, getter = "behavior")] + pub fn get_behavior(this: &ScrollIntoViewOptions) -> Option; + #[cfg(feature = "ScrollBehavior")] + #[doc = "Change the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollIntoViewOptions`*"] #[wasm_bindgen(method, setter = "behavior")] - fn behavior_shim(this: &ScrollIntoViewOptions, val: ScrollBehavior); + pub fn set_behavior(this: &ScrollIntoViewOptions, val: ScrollBehavior); + #[cfg(feature = "ScrollLogicalPosition")] + #[doc = "Get the `block` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] + #[wasm_bindgen(method, getter = "block")] + pub fn get_block(this: &ScrollIntoViewOptions) -> Option; #[cfg(feature = "ScrollLogicalPosition")] + #[doc = "Change the `block` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] #[wasm_bindgen(method, setter = "block")] - fn block_shim(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); + pub fn set_block(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); #[cfg(feature = "ScrollLogicalPosition")] + #[doc = "Get the `inline` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] + #[wasm_bindgen(method, getter = "inline")] + pub fn get_inline(this: &ScrollIntoViewOptions) -> Option; + #[cfg(feature = "ScrollLogicalPosition")] + #[doc = "Change the `inline` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] #[wasm_bindgen(method, setter = "inline")] - fn inline_shim(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); + pub fn set_inline(this: &ScrollIntoViewOptions, val: ScrollLogicalPosition); } impl ScrollIntoViewOptions { #[doc = "Construct a new `ScrollIntoViewOptions`."] @@ -30,27 +57,21 @@ impl ScrollIntoViewOptions { ret } #[cfg(feature = "ScrollBehavior")] - #[doc = "Change the `behavior` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollIntoViewOptions`*"] + #[deprecated = "Use `set_behavior()` instead."] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - self.behavior_shim(val); + self.set_behavior(val); self } #[cfg(feature = "ScrollLogicalPosition")] - #[doc = "Change the `block` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] + #[deprecated = "Use `set_block()` instead."] pub fn block(&mut self, val: ScrollLogicalPosition) -> &mut Self { - self.block_shim(val); + self.set_block(val); self } #[cfg(feature = "ScrollLogicalPosition")] - #[doc = "Change the `inline` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollIntoViewOptions`, `ScrollLogicalPosition`*"] + #[deprecated = "Use `set_inline()` instead."] pub fn inline(&mut self, val: ScrollLogicalPosition) -> &mut Self { - self.inline_shim(val); + self.set_inline(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollOptions.rs b/crates/web-sys/src/features/gen_ScrollOptions.rs index 2357199aa50..0d960dadc0b 100644 --- a/crates/web-sys/src/features/gen_ScrollOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ScrollOptions`*"] pub type ScrollOptions; #[cfg(feature = "ScrollBehavior")] + #[doc = "Get the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollOptions`*"] + #[wasm_bindgen(method, getter = "behavior")] + pub fn get_behavior(this: &ScrollOptions) -> Option; + #[cfg(feature = "ScrollBehavior")] + #[doc = "Change the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollOptions`*"] #[wasm_bindgen(method, setter = "behavior")] - fn behavior_shim(this: &ScrollOptions, val: ScrollBehavior); + pub fn set_behavior(this: &ScrollOptions, val: ScrollBehavior); } impl ScrollOptions { #[doc = "Construct a new `ScrollOptions`."] @@ -24,11 +33,9 @@ impl ScrollOptions { ret } #[cfg(feature = "ScrollBehavior")] - #[doc = "Change the `behavior` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollOptions`*"] + #[deprecated = "Use `set_behavior()` instead."] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - self.behavior_shim(val); + self.set_behavior(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollToOptions.rs b/crates/web-sys/src/features/gen_ScrollToOptions.rs index d529c5913a8..497fdb92371 100644 --- a/crates/web-sys/src/features/gen_ScrollToOptions.rs +++ b/crates/web-sys/src/features/gen_ScrollToOptions.rs @@ -11,12 +11,37 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] pub type ScrollToOptions; #[cfg(feature = "ScrollBehavior")] + #[doc = "Get the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"] + #[wasm_bindgen(method, getter = "behavior")] + pub fn get_behavior(this: &ScrollToOptions) -> Option; + #[cfg(feature = "ScrollBehavior")] + #[doc = "Change the `behavior` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"] #[wasm_bindgen(method, setter = "behavior")] - fn behavior_shim(this: &ScrollToOptions, val: ScrollBehavior); + pub fn set_behavior(this: &ScrollToOptions, val: ScrollBehavior); + #[doc = "Get the `left` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] + #[wasm_bindgen(method, getter = "left")] + pub fn get_left(this: &ScrollToOptions) -> Option; + #[doc = "Change the `left` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] #[wasm_bindgen(method, setter = "left")] - fn left_shim(this: &ScrollToOptions, val: f64); + pub fn set_left(this: &ScrollToOptions, val: f64); + #[doc = "Get the `top` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] + #[wasm_bindgen(method, getter = "top")] + pub fn get_top(this: &ScrollToOptions) -> Option; + #[doc = "Change the `top` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] #[wasm_bindgen(method, setter = "top")] - fn top_shim(this: &ScrollToOptions, val: f64); + pub fn set_top(this: &ScrollToOptions, val: f64); } impl ScrollToOptions { #[doc = "Construct a new `ScrollToOptions`."] @@ -28,25 +53,19 @@ impl ScrollToOptions { ret } #[cfg(feature = "ScrollBehavior")] - #[doc = "Change the `behavior` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollBehavior`, `ScrollToOptions`*"] + #[deprecated = "Use `set_behavior()` instead."] pub fn behavior(&mut self, val: ScrollBehavior) -> &mut Self { - self.behavior_shim(val); + self.set_behavior(val); self } - #[doc = "Change the `left` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] + #[deprecated = "Use `set_left()` instead."] pub fn left(&mut self, val: f64) -> &mut Self { - self.left_shim(val); + self.set_left(val); self } - #[doc = "Change the `top` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollToOptions`*"] + #[deprecated = "Use `set_top()` instead."] pub fn top(&mut self, val: f64) -> &mut Self { - self.top_shim(val); + self.set_top(val); self } } diff --git a/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs b/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs index 79eb87f27ec..1160275d1c0 100644 --- a/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_ScrollViewChangeEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] pub type ScrollViewChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ScrollViewChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ScrollViewChangeEventInit, val: bool); + pub fn set_bubbles(this: &ScrollViewChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ScrollViewChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ScrollViewChangeEventInit, val: bool); + pub fn set_cancelable(this: &ScrollViewChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ScrollViewChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ScrollViewChangeEventInit, val: bool); + pub fn set_composed(this: &ScrollViewChangeEventInit, val: bool); #[cfg(feature = "ScrollState")] + #[doc = "Get the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollState`, `ScrollViewChangeEventInit`*"] + #[wasm_bindgen(method, getter = "state")] + pub fn get_state(this: &ScrollViewChangeEventInit) -> Option; + #[cfg(feature = "ScrollState")] + #[doc = "Change the `state` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ScrollState`, `ScrollViewChangeEventInit`*"] #[wasm_bindgen(method, setter = "state")] - fn state_shim(this: &ScrollViewChangeEventInit, val: ScrollState); + pub fn set_state(this: &ScrollViewChangeEventInit, val: ScrollState); } impl ScrollViewChangeEventInit { #[doc = "Construct a new `ScrollViewChangeEventInit`."] @@ -29,33 +62,25 @@ impl ScrollViewChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollViewChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "ScrollState")] - #[doc = "Change the `state` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ScrollState`, `ScrollViewChangeEventInit`*"] + #[deprecated = "Use `set_state()` instead."] pub fn state(&mut self, val: ScrollState) -> &mut Self { - self.state_shim(val); + self.set_state(val); self } } diff --git a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs index 2f86bc879fb..5176921a837 100644 --- a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs +++ b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs @@ -10,40 +10,163 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] pub type SecurityPolicyViolationEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SecurityPolicyViolationEventInit, val: bool); + pub fn set_bubbles(this: &SecurityPolicyViolationEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SecurityPolicyViolationEventInit, val: bool); + pub fn set_cancelable(this: &SecurityPolicyViolationEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SecurityPolicyViolationEventInit, val: bool); + pub fn set_composed(this: &SecurityPolicyViolationEventInit, val: bool); + #[doc = "Get the `blockedURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "blockedURI")] + pub fn get_blocked_uri(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `blockedURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "blockedURI")] - fn blocked_uri_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_blocked_uri(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "columnNumber")] + pub fn get_column_number(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `columnNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "columnNumber")] - fn column_number_shim(this: &SecurityPolicyViolationEventInit, val: i32); + pub fn set_column_number(this: &SecurityPolicyViolationEventInit, val: i32); #[cfg(feature = "SecurityPolicyViolationEventDisposition")] + #[doc = "Get the `disposition` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventDisposition`, `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "disposition")] + pub fn get_disposition( + this: &SecurityPolicyViolationEventInit, + ) -> Option; + #[cfg(feature = "SecurityPolicyViolationEventDisposition")] + #[doc = "Change the `disposition` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventDisposition`, `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "disposition")] - fn disposition_shim( + pub fn set_disposition( this: &SecurityPolicyViolationEventInit, val: SecurityPolicyViolationEventDisposition, ); + #[doc = "Get the `documentURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "documentURI")] + pub fn get_document_uri(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `documentURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "documentURI")] - fn document_uri_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_document_uri(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `effectiveDirective` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "effectiveDirective")] + pub fn get_effective_directive(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `effectiveDirective` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "effectiveDirective")] - fn effective_directive_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_effective_directive(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "lineNumber")] + pub fn get_line_number(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `lineNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "lineNumber")] - fn line_number_shim(this: &SecurityPolicyViolationEventInit, val: i32); + pub fn set_line_number(this: &SecurityPolicyViolationEventInit, val: i32); + #[doc = "Get the `originalPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "originalPolicy")] + pub fn get_original_policy(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `originalPolicy` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "originalPolicy")] - fn original_policy_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_original_policy(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "referrer")] + pub fn get_referrer(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `referrer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "referrer")] - fn referrer_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_referrer(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `sample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "sample")] + pub fn get_sample(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `sample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "sample")] - fn sample_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_sample(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `sourceFile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "sourceFile")] + pub fn get_source_file(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `sourceFile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "sourceFile")] - fn source_file_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_source_file(this: &SecurityPolicyViolationEventInit, val: &str); + #[doc = "Get the `statusCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "statusCode")] + pub fn get_status_code(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `statusCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "statusCode")] - fn status_code_shim(this: &SecurityPolicyViolationEventInit, val: u16); + pub fn set_status_code(this: &SecurityPolicyViolationEventInit, val: u16); + #[doc = "Get the `violatedDirective` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[wasm_bindgen(method, getter = "violatedDirective")] + pub fn get_violated_directive(this: &SecurityPolicyViolationEventInit) -> Option; + #[doc = "Change the `violatedDirective` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, setter = "violatedDirective")] - fn violated_directive_shim(this: &SecurityPolicyViolationEventInit, val: &str); + pub fn set_violated_directive(this: &SecurityPolicyViolationEventInit, val: &str); } impl SecurityPolicyViolationEventInit { #[doc = "Construct a new `SecurityPolicyViolationEventInit`."] @@ -54,110 +177,80 @@ impl SecurityPolicyViolationEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `blockedURI` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_blocked_uri()` instead."] pub fn blocked_uri(&mut self, val: &str) -> &mut Self { - self.blocked_uri_shim(val); + self.set_blocked_uri(val); self } - #[doc = "Change the `columnNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_column_number()` instead."] pub fn column_number(&mut self, val: i32) -> &mut Self { - self.column_number_shim(val); + self.set_column_number(val); self } #[cfg(feature = "SecurityPolicyViolationEventDisposition")] - #[doc = "Change the `disposition` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventDisposition`, `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_disposition()` instead."] pub fn disposition(&mut self, val: SecurityPolicyViolationEventDisposition) -> &mut Self { - self.disposition_shim(val); + self.set_disposition(val); self } - #[doc = "Change the `documentURI` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_document_uri()` instead."] pub fn document_uri(&mut self, val: &str) -> &mut Self { - self.document_uri_shim(val); + self.set_document_uri(val); self } - #[doc = "Change the `effectiveDirective` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_effective_directive()` instead."] pub fn effective_directive(&mut self, val: &str) -> &mut Self { - self.effective_directive_shim(val); + self.set_effective_directive(val); self } - #[doc = "Change the `lineNumber` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_line_number()` instead."] pub fn line_number(&mut self, val: i32) -> &mut Self { - self.line_number_shim(val); + self.set_line_number(val); self } - #[doc = "Change the `originalPolicy` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_original_policy()` instead."] pub fn original_policy(&mut self, val: &str) -> &mut Self { - self.original_policy_shim(val); + self.set_original_policy(val); self } - #[doc = "Change the `referrer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_referrer()` instead."] pub fn referrer(&mut self, val: &str) -> &mut Self { - self.referrer_shim(val); + self.set_referrer(val); self } - #[doc = "Change the `sample` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_sample()` instead."] pub fn sample(&mut self, val: &str) -> &mut Self { - self.sample_shim(val); + self.set_sample(val); self } - #[doc = "Change the `sourceFile` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_source_file()` instead."] pub fn source_file(&mut self, val: &str) -> &mut Self { - self.source_file_shim(val); + self.set_source_file(val); self } - #[doc = "Change the `statusCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_status_code()` instead."] pub fn status_code(&mut self, val: u16) -> &mut Self { - self.status_code_shim(val); + self.set_status_code(val); self } - #[doc = "Change the `violatedDirective` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] + #[deprecated = "Use `set_violated_directive()` instead."] pub fn violated_directive(&mut self, val: &str) -> &mut Self { - self.violated_directive_shim(val); + self.set_violated_directive(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialInputSignals.rs b/crates/web-sys/src/features/gen_SerialInputSignals.rs index bac6b8f7679..5cabc7a4ba5 100644 --- a/crates/web-sys/src/features/gen_SerialInputSignals.rs +++ b/crates/web-sys/src/features/gen_SerialInputSignals.rs @@ -14,14 +14,78 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialInputSignals; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `clearToSend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clearToSend")] + pub fn get_clear_to_send(this: &SerialInputSignals) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clearToSend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "clearToSend")] - fn clear_to_send_shim(this: &SerialInputSignals, val: bool); + pub fn set_clear_to_send(this: &SerialInputSignals, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dataCarrierDetect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dataCarrierDetect")] + pub fn get_data_carrier_detect(this: &SerialInputSignals) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataCarrierDetect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "dataCarrierDetect")] - fn data_carrier_detect_shim(this: &SerialInputSignals, val: bool); + pub fn set_data_carrier_detect(this: &SerialInputSignals, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dataSetReady` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dataSetReady")] + pub fn get_data_set_ready(this: &SerialInputSignals) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dataSetReady` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "dataSetReady")] - fn data_set_ready_shim(this: &SerialInputSignals, val: bool); + pub fn set_data_set_ready(this: &SerialInputSignals, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `ringIndicator` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "ringIndicator")] + pub fn get_ring_indicator(this: &SerialInputSignals) -> bool; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `ringIndicator` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "ringIndicator")] - fn ring_indicator_shim(this: &SerialInputSignals, val: bool); + pub fn set_ring_indicator(this: &SerialInputSignals, val: bool); } #[cfg(web_sys_unstable_apis)] impl SerialInputSignals { @@ -46,47 +110,27 @@ impl SerialInputSignals { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `clearToSend` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_clear_to_send()` instead."] pub fn clear_to_send(&mut self, val: bool) -> &mut Self { - self.clear_to_send_shim(val); + self.set_clear_to_send(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `dataCarrierDetect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data_carrier_detect()` instead."] pub fn data_carrier_detect(&mut self, val: bool) -> &mut Self { - self.data_carrier_detect_shim(val); + self.set_data_carrier_detect(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `dataSetReady` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_data_set_ready()` instead."] pub fn data_set_ready(&mut self, val: bool) -> &mut Self { - self.data_set_ready_shim(val); + self.set_data_set_ready(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `ringIndicator` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialInputSignals`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_ring_indicator()` instead."] pub fn ring_indicator(&mut self, val: bool) -> &mut Self { - self.ring_indicator_shim(val); + self.set_ring_indicator(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialOptions.rs b/crates/web-sys/src/features/gen_SerialOptions.rs index 02b78361511..a894c952f73 100644 --- a/crates/web-sys/src/features/gen_SerialOptions.rs +++ b/crates/web-sys/src/features/gen_SerialOptions.rs @@ -14,35 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialOptions; - #[wasm_bindgen(method, setter = "baudRate")] - fn baud_rate_shim(this: &SerialOptions, val: u32); - #[wasm_bindgen(method, setter = "bufferSize")] - fn buffer_size_shim(this: &SerialOptions, val: u32); - #[wasm_bindgen(method, setter = "dataBits")] - fn data_bits_shim(this: &SerialOptions, val: u8); - #[cfg(feature = "FlowControlType")] - #[wasm_bindgen(method, setter = "flowControl")] - fn flow_control_shim(this: &SerialOptions, val: FlowControlType); - #[cfg(feature = "ParityType")] - #[wasm_bindgen(method, setter = "parity")] - fn parity_shim(this: &SerialOptions, val: ParityType); - #[wasm_bindgen(method, setter = "stopBits")] - fn stop_bits_shim(this: &SerialOptions, val: u8); -} -#[cfg(web_sys_unstable_apis)] -impl SerialOptions { - #[doc = "Construct a new `SerialOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `baudRate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(baud_rate: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.baud_rate(baud_rate); - ret - } + #[wasm_bindgen(method, getter = "baudRate")] + pub fn get_baud_rate(this: &SerialOptions) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `baudRate` field of this object."] #[doc = ""] @@ -50,10 +30,17 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn baud_rate(&mut self, val: u32) -> &mut Self { - self.baud_rate_shim(val); - self - } + #[wasm_bindgen(method, setter = "baudRate")] + pub fn set_baud_rate(this: &SerialOptions, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bufferSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bufferSize")] + pub fn get_buffer_size(this: &SerialOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bufferSize` field of this object."] #[doc = ""] @@ -61,10 +48,17 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn buffer_size(&mut self, val: u32) -> &mut Self { - self.buffer_size_shim(val); - self - } + #[wasm_bindgen(method, setter = "bufferSize")] + pub fn set_buffer_size(this: &SerialOptions, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dataBits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dataBits")] + pub fn get_data_bits(this: &SerialOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `dataBits` field of this object."] #[doc = ""] @@ -72,10 +66,18 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn data_bits(&mut self, val: u8) -> &mut Self { - self.data_bits_shim(val); - self - } + #[wasm_bindgen(method, setter = "dataBits")] + pub fn set_data_bits(this: &SerialOptions, val: u8); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FlowControlType")] + #[doc = "Get the `flowControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FlowControlType`, `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "flowControl")] + pub fn get_flow_control(this: &SerialOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "FlowControlType")] #[doc = "Change the `flowControl` field of this object."] @@ -84,10 +86,18 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn flow_control(&mut self, val: FlowControlType) -> &mut Self { - self.flow_control_shim(val); - self - } + #[wasm_bindgen(method, setter = "flowControl")] + pub fn set_flow_control(this: &SerialOptions, val: FlowControlType); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ParityType")] + #[doc = "Get the `parity` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ParityType`, `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "parity")] + pub fn get_parity(this: &SerialOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ParityType")] #[doc = "Change the `parity` field of this object."] @@ -96,10 +106,17 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn parity(&mut self, val: ParityType) -> &mut Self { - self.parity_shim(val); - self - } + #[wasm_bindgen(method, setter = "parity")] + pub fn set_parity(this: &SerialOptions, val: ParityType); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stopBits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stopBits")] + pub fn get_stop_bits(this: &SerialOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stopBits` field of this object."] #[doc = ""] @@ -107,8 +124,59 @@ impl SerialOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "stopBits")] + pub fn set_stop_bits(this: &SerialOptions, val: u8); +} +#[cfg(web_sys_unstable_apis)] +impl SerialOptions { + #[doc = "Construct a new `SerialOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(baud_rate: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.baud_rate(baud_rate); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_baud_rate()` instead."] + pub fn baud_rate(&mut self, val: u32) -> &mut Self { + self.set_baud_rate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_buffer_size()` instead."] + pub fn buffer_size(&mut self, val: u32) -> &mut Self { + self.set_buffer_size(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_data_bits()` instead."] + pub fn data_bits(&mut self, val: u8) -> &mut Self { + self.set_data_bits(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FlowControlType")] + #[deprecated = "Use `set_flow_control()` instead."] + pub fn flow_control(&mut self, val: FlowControlType) -> &mut Self { + self.set_flow_control(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ParityType")] + #[deprecated = "Use `set_parity()` instead."] + pub fn parity(&mut self, val: ParityType) -> &mut Self { + self.set_parity(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stop_bits()` instead."] pub fn stop_bits(&mut self, val: u8) -> &mut Self { - self.stop_bits_shim(val); + self.set_stop_bits(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialOutputSignals.rs b/crates/web-sys/src/features/gen_SerialOutputSignals.rs index 73b3fb9764a..02a850f6621 100644 --- a/crates/web-sys/src/features/gen_SerialOutputSignals.rs +++ b/crates/web-sys/src/features/gen_SerialOutputSignals.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialOutputSignals; - #[wasm_bindgen(method, setter = "break")] - fn break__shim(this: &SerialOutputSignals, val: bool); - #[wasm_bindgen(method, setter = "dataTerminalReady")] - fn data_terminal_ready_shim(this: &SerialOutputSignals, val: bool); - #[wasm_bindgen(method, setter = "requestToSend")] - fn request_to_send_shim(this: &SerialOutputSignals, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl SerialOutputSignals { - #[doc = "Construct a new `SerialOutputSignals`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `break` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "break")] + pub fn get_break(this: &SerialOutputSignals) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `break` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl SerialOutputSignals { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn break_(&mut self, val: bool) -> &mut Self { - self.break__shim(val); - self - } + #[wasm_bindgen(method, setter = "break")] + pub fn set_break(this: &SerialOutputSignals, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dataTerminalReady` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dataTerminalReady")] + pub fn get_data_terminal_ready(this: &SerialOutputSignals) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `dataTerminalReady` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl SerialOutputSignals { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn data_terminal_ready(&mut self, val: bool) -> &mut Self { - self.data_terminal_ready_shim(val); - self - } + #[wasm_bindgen(method, setter = "dataTerminalReady")] + pub fn set_data_terminal_ready(this: &SerialOutputSignals, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requestToSend` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requestToSend")] + pub fn get_request_to_send(this: &SerialOutputSignals) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `requestToSend` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl SerialOutputSignals { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "requestToSend")] + pub fn set_request_to_send(this: &SerialOutputSignals, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl SerialOutputSignals { + #[doc = "Construct a new `SerialOutputSignals`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialOutputSignals`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_break()` instead."] + pub fn break_(&mut self, val: bool) -> &mut Self { + self.set_break(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_data_terminal_ready()` instead."] + pub fn data_terminal_ready(&mut self, val: bool) -> &mut Self { + self.set_data_terminal_ready(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_request_to_send()` instead."] pub fn request_to_send(&mut self, val: bool) -> &mut Self { - self.request_to_send_shim(val); + self.set_request_to_send(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortFilter.rs b/crates/web-sys/src/features/gen_SerialPortFilter.rs index e1f876619bf..99fb46cb5dc 100644 --- a/crates/web-sys/src/features/gen_SerialPortFilter.rs +++ b/crates/web-sys/src/features/gen_SerialPortFilter.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortFilter; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usbProductId")] + pub fn get_usb_product_id(this: &SerialPortFilter) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "usbProductId")] - fn usb_product_id_shim(this: &SerialPortFilter, val: u16); + pub fn set_usb_product_id(this: &SerialPortFilter, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usbVendorId")] + pub fn get_usb_vendor_id(this: &SerialPortFilter) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "usbVendorId")] - fn usb_vendor_id_shim(this: &SerialPortFilter, val: u16); + pub fn set_usb_vendor_id(this: &SerialPortFilter, val: u16); } #[cfg(web_sys_unstable_apis)] impl SerialPortFilter { @@ -33,25 +65,15 @@ impl SerialPortFilter { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usbProductId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_usb_product_id()` instead."] pub fn usb_product_id(&mut self, val: u16) -> &mut Self { - self.usb_product_id_shim(val); + self.set_usb_product_id(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usbVendorId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialPortFilter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_usb_vendor_id()` instead."] pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { - self.usb_vendor_id_shim(val); + self.set_usb_vendor_id(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortInfo.rs b/crates/web-sys/src/features/gen_SerialPortInfo.rs index 90953d2923b..07f598e29e7 100644 --- a/crates/web-sys/src/features/gen_SerialPortInfo.rs +++ b/crates/web-sys/src/features/gen_SerialPortInfo.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortInfo; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usbProductId")] + pub fn get_usb_product_id(this: &SerialPortInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbProductId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "usbProductId")] - fn usb_product_id_shim(this: &SerialPortInfo, val: u16); + pub fn set_usb_product_id(this: &SerialPortInfo, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usbVendorId")] + pub fn get_usb_vendor_id(this: &SerialPortInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usbVendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "usbVendorId")] - fn usb_vendor_id_shim(this: &SerialPortInfo, val: u16); + pub fn set_usb_vendor_id(this: &SerialPortInfo, val: u16); } #[cfg(web_sys_unstable_apis)] impl SerialPortInfo { @@ -33,25 +65,15 @@ impl SerialPortInfo { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usbProductId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_usb_product_id()` instead."] pub fn usb_product_id(&mut self, val: u16) -> &mut Self { - self.usb_product_id_shim(val); + self.set_usb_product_id(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `usbVendorId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialPortInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_usb_vendor_id()` instead."] pub fn usb_vendor_id(&mut self, val: u16) -> &mut Self { - self.usb_vendor_id_shim(val); + self.set_usb_vendor_id(val); self } } diff --git a/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs index 34238c807e0..b00ff33fb63 100644 --- a/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs +++ b/crates/web-sys/src/features/gen_SerialPortRequestOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SerialPortRequestOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &SerialPortRequestOptions) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &SerialPortRequestOptions, val: &::wasm_bindgen::JsValue); + pub fn set_filters(this: &SerialPortRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl SerialPortRequestOptions { @@ -31,14 +47,9 @@ impl SerialPortRequestOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `filters` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SerialPortRequestOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_filters()` instead."] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); + self.set_filters(val); self } } diff --git a/crates/web-sys/src/features/gen_ServerSocketOptions.rs b/crates/web-sys/src/features/gen_ServerSocketOptions.rs index 95133d8c0ef..803b7d63e11 100644 --- a/crates/web-sys/src/features/gen_ServerSocketOptions.rs +++ b/crates/web-sys/src/features/gen_ServerSocketOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`*"] pub type ServerSocketOptions; #[cfg(feature = "TcpSocketBinaryType")] + #[doc = "Get the `binaryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`, `TcpSocketBinaryType`*"] + #[wasm_bindgen(method, getter = "binaryType")] + pub fn get_binary_type(this: &ServerSocketOptions) -> Option; + #[cfg(feature = "TcpSocketBinaryType")] + #[doc = "Change the `binaryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`, `TcpSocketBinaryType`*"] #[wasm_bindgen(method, setter = "binaryType")] - fn binary_type_shim(this: &ServerSocketOptions, val: TcpSocketBinaryType); + pub fn set_binary_type(this: &ServerSocketOptions, val: TcpSocketBinaryType); } impl ServerSocketOptions { #[doc = "Construct a new `ServerSocketOptions`."] @@ -24,11 +33,9 @@ impl ServerSocketOptions { ret } #[cfg(feature = "TcpSocketBinaryType")] - #[doc = "Change the `binaryType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ServerSocketOptions`, `TcpSocketBinaryType`*"] + #[deprecated = "Use `set_binary_type()` instead."] pub fn binary_type(&mut self, val: TcpSocketBinaryType) -> &mut Self { - self.binary_type_shim(val); + self.set_binary_type(val); self } } diff --git a/crates/web-sys/src/features/gen_ShadowRootInit.rs b/crates/web-sys/src/features/gen_ShadowRootInit.rs index e86cf54eebb..995f1541770 100644 --- a/crates/web-sys/src/features/gen_ShadowRootInit.rs +++ b/crates/web-sys/src/features/gen_ShadowRootInit.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`*"] pub type ShadowRootInit; #[cfg(feature = "ShadowRootMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &ShadowRootInit) -> ShadowRootMode; + #[cfg(feature = "ShadowRootMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &ShadowRootInit, val: ShadowRootMode); + pub fn set_mode(this: &ShadowRootInit, val: ShadowRootMode); } impl ShadowRootInit { #[cfg(feature = "ShadowRootMode")] @@ -26,11 +35,9 @@ impl ShadowRootInit { ret } #[cfg(feature = "ShadowRootMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ShadowRootInit`, `ShadowRootMode`*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: ShadowRootMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_ShareData.rs b/crates/web-sys/src/features/gen_ShareData.rs index 5a8110527a4..2f366fb822c 100644 --- a/crates/web-sys/src/features/gen_ShareData.rs +++ b/crates/web-sys/src/features/gen_ShareData.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] pub type ShareData; + #[doc = "Get the `files` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[wasm_bindgen(method, getter = "files")] + pub fn get_files(this: &ShareData) -> Option<::js_sys::Array>; + #[doc = "Change the `files` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, setter = "files")] - fn files_shim(this: &ShareData, val: &::wasm_bindgen::JsValue); + pub fn set_files(this: &ShareData, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `text` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[wasm_bindgen(method, getter = "text")] + pub fn get_text(this: &ShareData) -> Option; + #[doc = "Change the `text` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, setter = "text")] - fn text_shim(this: &ShareData, val: &str); + pub fn set_text(this: &ShareData, val: &str); + #[doc = "Get the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[wasm_bindgen(method, getter = "title")] + pub fn get_title(this: &ShareData) -> Option; + #[doc = "Change the `title` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, setter = "title")] - fn title_shim(this: &ShareData, val: &str); + pub fn set_title(this: &ShareData, val: &str); + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &ShareData) -> Option; + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &ShareData, val: &str); + pub fn set_url(this: &ShareData, val: &str); } impl ShareData { #[doc = "Construct a new `ShareData`."] @@ -28,32 +60,24 @@ impl ShareData { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `files` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[deprecated = "Use `set_files()` instead."] pub fn files(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.files_shim(val); + self.set_files(val); self } - #[doc = "Change the `text` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[deprecated = "Use `set_text()` instead."] pub fn text(&mut self, val: &str) -> &mut Self { - self.text_shim(val); + self.set_text(val); self } - #[doc = "Change the `title` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[deprecated = "Use `set_title()` instead."] pub fn title(&mut self, val: &str) -> &mut Self { - self.title_shim(val); + self.set_title(val); self } - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: &str) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } } diff --git a/crates/web-sys/src/features/gen_SignResponse.rs b/crates/web-sys/src/features/gen_SignResponse.rs index 22a21bb2d05..248bfe60512 100644 --- a/crates/web-sys/src/features/gen_SignResponse.rs +++ b/crates/web-sys/src/features/gen_SignResponse.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] pub type SignResponse; + #[doc = "Get the `clientData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[wasm_bindgen(method, getter = "clientData")] + pub fn get_client_data(this: &SignResponse) -> Option; + #[doc = "Change the `clientData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, setter = "clientData")] - fn client_data_shim(this: &SignResponse, val: &str); + pub fn set_client_data(this: &SignResponse, val: &str); + #[doc = "Get the `errorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[wasm_bindgen(method, getter = "errorCode")] + pub fn get_error_code(this: &SignResponse) -> Option; + #[doc = "Change the `errorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, setter = "errorCode")] - fn error_code_shim(this: &SignResponse, val: Option); + pub fn set_error_code(this: &SignResponse, val: Option); + #[doc = "Get the `errorMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[wasm_bindgen(method, getter = "errorMessage")] + pub fn get_error_message(this: &SignResponse) -> Option; + #[doc = "Change the `errorMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, setter = "errorMessage")] - fn error_message_shim(this: &SignResponse, val: Option<&str>); + pub fn set_error_message(this: &SignResponse, val: Option<&str>); + #[doc = "Get the `keyHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[wasm_bindgen(method, getter = "keyHandle")] + pub fn get_key_handle(this: &SignResponse) -> Option; + #[doc = "Change the `keyHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, setter = "keyHandle")] - fn key_handle_shim(this: &SignResponse, val: &str); + pub fn set_key_handle(this: &SignResponse, val: &str); + #[doc = "Get the `signatureData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[wasm_bindgen(method, getter = "signatureData")] + pub fn get_signature_data(this: &SignResponse) -> Option; + #[doc = "Change the `signatureData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, setter = "signatureData")] - fn signature_data_shim(this: &SignResponse, val: &str); + pub fn set_signature_data(this: &SignResponse, val: &str); } impl SignResponse { #[doc = "Construct a new `SignResponse`."] @@ -30,39 +70,29 @@ impl SignResponse { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `clientData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[deprecated = "Use `set_client_data()` instead."] pub fn client_data(&mut self, val: &str) -> &mut Self { - self.client_data_shim(val); + self.set_client_data(val); self } - #[doc = "Change the `errorCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[deprecated = "Use `set_error_code()` instead."] pub fn error_code(&mut self, val: Option) -> &mut Self { - self.error_code_shim(val); + self.set_error_code(val); self } - #[doc = "Change the `errorMessage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[deprecated = "Use `set_error_message()` instead."] pub fn error_message(&mut self, val: Option<&str>) -> &mut Self { - self.error_message_shim(val); + self.set_error_message(val); self } - #[doc = "Change the `keyHandle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[deprecated = "Use `set_key_handle()` instead."] pub fn key_handle(&mut self, val: &str) -> &mut Self { - self.key_handle_shim(val); + self.set_key_handle(val); self } - #[doc = "Change the `signatureData` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] + #[deprecated = "Use `set_signature_data()` instead."] pub fn signature_data(&mut self, val: &str) -> &mut Self { - self.signature_data_shim(val); + self.set_signature_data(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketElement.rs b/crates/web-sys/src/features/gen_SocketElement.rs index cb535c7c6d2..e1270b6a247 100644 --- a/crates/web-sys/src/features/gen_SocketElement.rs +++ b/crates/web-sys/src/features/gen_SocketElement.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] pub type SocketElement; + #[doc = "Get the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "active")] + pub fn get_active(this: &SocketElement) -> Option; + #[doc = "Change the `active` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "active")] - fn active_shim(this: &SocketElement, val: bool); + pub fn set_active(this: &SocketElement, val: bool); + #[doc = "Get the `host` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "host")] + pub fn get_host(this: &SocketElement) -> Option; + #[doc = "Change the `host` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "host")] - fn host_shim(this: &SocketElement, val: &str); + pub fn set_host(this: &SocketElement, val: &str); + #[doc = "Get the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "port")] + pub fn get_port(this: &SocketElement) -> Option; + #[doc = "Change the `port` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "port")] - fn port_shim(this: &SocketElement, val: u32); + pub fn set_port(this: &SocketElement, val: u32); + #[doc = "Get the `received` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "received")] + pub fn get_received(this: &SocketElement) -> Option; + #[doc = "Change the `received` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "received")] - fn received_shim(this: &SocketElement, val: f64); + pub fn set_received(this: &SocketElement, val: f64); + #[doc = "Get the `sent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "sent")] + pub fn get_sent(this: &SocketElement) -> Option; + #[doc = "Change the `sent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "sent")] - fn sent_shim(this: &SocketElement, val: f64); + pub fn set_sent(this: &SocketElement, val: f64); + #[doc = "Get the `tcp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[wasm_bindgen(method, getter = "tcp")] + pub fn get_tcp(this: &SocketElement) -> Option; + #[doc = "Change the `tcp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, setter = "tcp")] - fn tcp_shim(this: &SocketElement, val: bool); + pub fn set_tcp(this: &SocketElement, val: bool); } impl SocketElement { #[doc = "Construct a new `SocketElement`."] @@ -32,46 +80,34 @@ impl SocketElement { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `active` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_active()` instead."] pub fn active(&mut self, val: bool) -> &mut Self { - self.active_shim(val); + self.set_active(val); self } - #[doc = "Change the `host` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_host()` instead."] pub fn host(&mut self, val: &str) -> &mut Self { - self.host_shim(val); + self.set_host(val); self } - #[doc = "Change the `port` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_port()` instead."] pub fn port(&mut self, val: u32) -> &mut Self { - self.port_shim(val); + self.set_port(val); self } - #[doc = "Change the `received` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_received()` instead."] pub fn received(&mut self, val: f64) -> &mut Self { - self.received_shim(val); + self.set_received(val); self } - #[doc = "Change the `sent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_sent()` instead."] pub fn sent(&mut self, val: f64) -> &mut Self { - self.sent_shim(val); + self.set_sent(val); self } - #[doc = "Change the `tcp` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] + #[deprecated = "Use `set_tcp()` instead."] pub fn tcp(&mut self, val: bool) -> &mut Self { - self.tcp_shim(val); + self.set_tcp(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketOptions.rs b/crates/web-sys/src/features/gen_SocketOptions.rs index 18c27e4f0d5..3d99e6381c8 100644 --- a/crates/web-sys/src/features/gen_SocketOptions.rs +++ b/crates/web-sys/src/features/gen_SocketOptions.rs @@ -11,10 +11,27 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] pub type SocketOptions; #[cfg(feature = "TcpSocketBinaryType")] + #[doc = "Get the `binaryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"] + #[wasm_bindgen(method, getter = "binaryType")] + pub fn get_binary_type(this: &SocketOptions) -> Option; + #[cfg(feature = "TcpSocketBinaryType")] + #[doc = "Change the `binaryType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"] #[wasm_bindgen(method, setter = "binaryType")] - fn binary_type_shim(this: &SocketOptions, val: TcpSocketBinaryType); + pub fn set_binary_type(this: &SocketOptions, val: TcpSocketBinaryType); + #[doc = "Get the `useSecureTransport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] + #[wasm_bindgen(method, getter = "useSecureTransport")] + pub fn get_use_secure_transport(this: &SocketOptions) -> Option; + #[doc = "Change the `useSecureTransport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] #[wasm_bindgen(method, setter = "useSecureTransport")] - fn use_secure_transport_shim(this: &SocketOptions, val: bool); + pub fn set_use_secure_transport(this: &SocketOptions, val: bool); } impl SocketOptions { #[doc = "Construct a new `SocketOptions`."] @@ -26,18 +43,14 @@ impl SocketOptions { ret } #[cfg(feature = "TcpSocketBinaryType")] - #[doc = "Change the `binaryType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"] + #[deprecated = "Use `set_binary_type()` instead."] pub fn binary_type(&mut self, val: TcpSocketBinaryType) -> &mut Self { - self.binary_type_shim(val); + self.set_binary_type(val); self } - #[doc = "Change the `useSecureTransport` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"] + #[deprecated = "Use `set_use_secure_transport()` instead."] pub fn use_secure_transport(&mut self, val: bool) -> &mut Self { - self.use_secure_transport_shim(val); + self.set_use_secure_transport(val); self } } diff --git a/crates/web-sys/src/features/gen_SocketsDict.rs b/crates/web-sys/src/features/gen_SocketsDict.rs index 8623ebb50a4..6a892687cae 100644 --- a/crates/web-sys/src/features/gen_SocketsDict.rs +++ b/crates/web-sys/src/features/gen_SocketsDict.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] pub type SocketsDict; + #[doc = "Get the `received` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[wasm_bindgen(method, getter = "received")] + pub fn get_received(this: &SocketsDict) -> Option; + #[doc = "Change the `received` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] #[wasm_bindgen(method, setter = "received")] - fn received_shim(this: &SocketsDict, val: f64); + pub fn set_received(this: &SocketsDict, val: f64); + #[doc = "Get the `sent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[wasm_bindgen(method, getter = "sent")] + pub fn get_sent(this: &SocketsDict) -> Option; + #[doc = "Change the `sent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] #[wasm_bindgen(method, setter = "sent")] - fn sent_shim(this: &SocketsDict, val: f64); + pub fn set_sent(this: &SocketsDict, val: f64); + #[doc = "Get the `sockets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[wasm_bindgen(method, getter = "sockets")] + pub fn get_sockets(this: &SocketsDict) -> Option<::js_sys::Array>; + #[doc = "Change the `sockets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] #[wasm_bindgen(method, setter = "sockets")] - fn sockets_shim(this: &SocketsDict, val: &::wasm_bindgen::JsValue); + pub fn set_sockets(this: &SocketsDict, val: &::wasm_bindgen::JsValue); } impl SocketsDict { #[doc = "Construct a new `SocketsDict`."] @@ -26,25 +50,19 @@ impl SocketsDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `received` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[deprecated = "Use `set_received()` instead."] pub fn received(&mut self, val: f64) -> &mut Self { - self.received_shim(val); + self.set_received(val); self } - #[doc = "Change the `sent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[deprecated = "Use `set_sent()` instead."] pub fn sent(&mut self, val: f64) -> &mut Self { - self.sent_shim(val); + self.set_sent(val); self } - #[doc = "Change the `sockets` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SocketsDict`*"] + #[deprecated = "Use `set_sockets()` instead."] pub fn sockets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.sockets_shim(val); + self.set_sockets(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs index 6781c3939d3..bc5e60a4e8e 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] pub type SpeechRecognitionErrorInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SpeechRecognitionErrorInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SpeechRecognitionErrorInit, val: bool); + pub fn set_bubbles(this: &SpeechRecognitionErrorInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SpeechRecognitionErrorInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SpeechRecognitionErrorInit, val: bool); + pub fn set_cancelable(this: &SpeechRecognitionErrorInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SpeechRecognitionErrorInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SpeechRecognitionErrorInit, val: bool); + pub fn set_composed(this: &SpeechRecognitionErrorInit, val: bool); + #[cfg(feature = "SpeechRecognitionErrorCode")] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorCode`, `SpeechRecognitionErrorInit`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &SpeechRecognitionErrorInit) -> Option; #[cfg(feature = "SpeechRecognitionErrorCode")] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorCode`, `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &SpeechRecognitionErrorInit, val: SpeechRecognitionErrorCode); + pub fn set_error(this: &SpeechRecognitionErrorInit, val: SpeechRecognitionErrorCode); + #[doc = "Get the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[wasm_bindgen(method, getter = "message")] + pub fn get_message(this: &SpeechRecognitionErrorInit) -> Option; + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, setter = "message")] - fn message_shim(this: &SpeechRecognitionErrorInit, val: &str); + pub fn set_message(this: &SpeechRecognitionErrorInit, val: &str); } impl SpeechRecognitionErrorInit { #[doc = "Construct a new `SpeechRecognitionErrorInit`."] @@ -31,40 +72,30 @@ impl SpeechRecognitionErrorInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "SpeechRecognitionErrorCode")] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorCode`, `SpeechRecognitionErrorInit`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: SpeechRecognitionErrorCode) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } - #[doc = "Change the `message` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] + #[deprecated = "Use `set_message()` instead."] pub fn message(&mut self, val: &str) -> &mut Self { - self.message_shim(val); + self.set_message(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs b/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs index 8db88b7b80f..dcd41c8616f 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionEventInit.rs @@ -10,22 +10,83 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] pub type SpeechRecognitionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SpeechRecognitionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SpeechRecognitionEventInit, val: bool); + pub fn set_bubbles(this: &SpeechRecognitionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SpeechRecognitionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SpeechRecognitionEventInit, val: bool); + pub fn set_cancelable(this: &SpeechRecognitionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SpeechRecognitionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SpeechRecognitionEventInit, val: bool); + pub fn set_composed(this: &SpeechRecognitionEventInit, val: bool); #[cfg(feature = "Document")] + #[doc = "Get the `emma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`, `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "emma")] + pub fn get_emma(this: &SpeechRecognitionEventInit) -> Option; + #[cfg(feature = "Document")] + #[doc = "Change the `emma` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`, `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "emma")] - fn emma_shim(this: &SpeechRecognitionEventInit, val: Option<&Document>); + pub fn set_emma(this: &SpeechRecognitionEventInit, val: Option<&Document>); + #[doc = "Get the `interpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "interpretation")] + pub fn get_interpretation(this: &SpeechRecognitionEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `interpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "interpretation")] - fn interpretation_shim(this: &SpeechRecognitionEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_interpretation(this: &SpeechRecognitionEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `resultIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[wasm_bindgen(method, getter = "resultIndex")] + pub fn get_result_index(this: &SpeechRecognitionEventInit) -> Option; + #[doc = "Change the `resultIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] #[wasm_bindgen(method, setter = "resultIndex")] - fn result_index_shim(this: &SpeechRecognitionEventInit, val: u32); + pub fn set_result_index(this: &SpeechRecognitionEventInit, val: u32); + #[cfg(feature = "SpeechRecognitionResultList")] + #[doc = "Get the `results` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`, `SpeechRecognitionResultList`*"] + #[wasm_bindgen(method, getter = "results")] + pub fn get_results(this: &SpeechRecognitionEventInit) -> Option; #[cfg(feature = "SpeechRecognitionResultList")] + #[doc = "Change the `results` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`, `SpeechRecognitionResultList`*"] #[wasm_bindgen(method, setter = "results")] - fn results_shim(this: &SpeechRecognitionEventInit, val: Option<&SpeechRecognitionResultList>); + pub fn set_results( + this: &SpeechRecognitionEventInit, + val: Option<&SpeechRecognitionResultList>, + ); } impl SpeechRecognitionEventInit { #[doc = "Construct a new `SpeechRecognitionEventInit`."] @@ -36,55 +97,41 @@ impl SpeechRecognitionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "Document")] - #[doc = "Change the `emma` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Document`, `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_emma()` instead."] pub fn emma(&mut self, val: Option<&Document>) -> &mut Self { - self.emma_shim(val); + self.set_emma(val); self } - #[doc = "Change the `interpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_interpretation()` instead."] pub fn interpretation(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.interpretation_shim(val); + self.set_interpretation(val); self } - #[doc = "Change the `resultIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`*"] + #[deprecated = "Use `set_result_index()` instead."] pub fn result_index(&mut self, val: u32) -> &mut Self { - self.result_index_shim(val); + self.set_result_index(val); self } #[cfg(feature = "SpeechRecognitionResultList")] - #[doc = "Change the `results` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionEventInit`, `SpeechRecognitionResultList`*"] + #[deprecated = "Use `set_results()` instead."] pub fn results(&mut self, val: Option<&SpeechRecognitionResultList>) -> &mut Self { - self.results_shim(val); + self.set_results(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs index 54fe4337561..5ffb6825037 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs @@ -10,26 +10,100 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] pub type SpeechSynthesisErrorEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + pub fn set_bubbles(this: &SpeechSynthesisErrorEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + pub fn set_cancelable(this: &SpeechSynthesisErrorEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SpeechSynthesisErrorEventInit, val: bool); + pub fn set_composed(this: &SpeechSynthesisErrorEventInit, val: bool); + #[doc = "Get the `charIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "charIndex")] + pub fn get_char_index(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `charIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "charIndex")] - fn char_index_shim(this: &SpeechSynthesisErrorEventInit, val: u32); + pub fn set_char_index(this: &SpeechSynthesisErrorEventInit, val: u32); + #[doc = "Get the `charLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "charLength")] + pub fn get_char_length(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `charLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "charLength")] - fn char_length_shim(this: &SpeechSynthesisErrorEventInit, val: Option); + pub fn set_char_length(this: &SpeechSynthesisErrorEventInit, val: Option); + #[doc = "Get the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "elapsedTime")] + pub fn get_elapsed_time(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "elapsedTime")] - fn elapsed_time_shim(this: &SpeechSynthesisErrorEventInit, val: f32); + pub fn set_elapsed_time(this: &SpeechSynthesisErrorEventInit, val: f32); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &SpeechSynthesisErrorEventInit) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &SpeechSynthesisErrorEventInit, val: &str); + pub fn set_name(this: &SpeechSynthesisErrorEventInit, val: &str); + #[cfg(feature = "SpeechSynthesisUtterance")] + #[doc = "Get the `utterance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"] + #[wasm_bindgen(method, getter = "utterance")] + pub fn get_utterance(this: &SpeechSynthesisErrorEventInit) -> SpeechSynthesisUtterance; #[cfg(feature = "SpeechSynthesisUtterance")] + #[doc = "Change the `utterance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"] #[wasm_bindgen(method, setter = "utterance")] - fn utterance_shim(this: &SpeechSynthesisErrorEventInit, val: &SpeechSynthesisUtterance); + pub fn set_utterance(this: &SpeechSynthesisErrorEventInit, val: &SpeechSynthesisUtterance); + #[cfg(feature = "SpeechSynthesisErrorCode")] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &SpeechSynthesisErrorEventInit) -> SpeechSynthesisErrorCode; #[cfg(feature = "SpeechSynthesisErrorCode")] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &SpeechSynthesisErrorEventInit, val: SpeechSynthesisErrorCode); + pub fn set_error(this: &SpeechSynthesisErrorEventInit, val: SpeechSynthesisErrorCode); } impl SpeechSynthesisErrorEventInit { #[cfg(all( @@ -46,69 +120,51 @@ impl SpeechSynthesisErrorEventInit { ret.error(error); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `charIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_char_index()` instead."] pub fn char_index(&mut self, val: u32) -> &mut Self { - self.char_index_shim(val); + self.set_char_index(val); self } - #[doc = "Change the `charLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_char_length()` instead."] pub fn char_length(&mut self, val: Option) -> &mut Self { - self.char_length_shim(val); + self.set_char_length(val); self } - #[doc = "Change the `elapsedTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_elapsed_time()` instead."] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - self.elapsed_time_shim(val); + self.set_elapsed_time(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "SpeechSynthesisUtterance")] - #[doc = "Change the `utterance` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`, `SpeechSynthesisUtterance`*"] + #[deprecated = "Use `set_utterance()` instead."] pub fn utterance(&mut self, val: &SpeechSynthesisUtterance) -> &mut Self { - self.utterance_shim(val); + self.set_utterance(val); self } #[cfg(feature = "SpeechSynthesisErrorCode")] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorCode`, `SpeechSynthesisErrorEventInit`*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: SpeechSynthesisErrorCode) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } } diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs index 3726366ad20..e3f4eed47a7 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs @@ -10,23 +10,88 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] pub type SpeechSynthesisEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SpeechSynthesisEventInit, val: bool); + pub fn set_bubbles(this: &SpeechSynthesisEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SpeechSynthesisEventInit, val: bool); + pub fn set_cancelable(this: &SpeechSynthesisEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SpeechSynthesisEventInit, val: bool); + pub fn set_composed(this: &SpeechSynthesisEventInit, val: bool); + #[doc = "Get the `charIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "charIndex")] + pub fn get_char_index(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `charIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "charIndex")] - fn char_index_shim(this: &SpeechSynthesisEventInit, val: u32); + pub fn set_char_index(this: &SpeechSynthesisEventInit, val: u32); + #[doc = "Get the `charLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "charLength")] + pub fn get_char_length(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `charLength` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "charLength")] - fn char_length_shim(this: &SpeechSynthesisEventInit, val: Option); + pub fn set_char_length(this: &SpeechSynthesisEventInit, val: Option); + #[doc = "Get the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "elapsedTime")] + pub fn get_elapsed_time(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "elapsedTime")] - fn elapsed_time_shim(this: &SpeechSynthesisEventInit, val: f32); + pub fn set_elapsed_time(this: &SpeechSynthesisEventInit, val: f32); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &SpeechSynthesisEventInit) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &SpeechSynthesisEventInit, val: &str); + pub fn set_name(this: &SpeechSynthesisEventInit, val: &str); + #[cfg(feature = "SpeechSynthesisUtterance")] + #[doc = "Get the `utterance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`, `SpeechSynthesisUtterance`*"] + #[wasm_bindgen(method, getter = "utterance")] + pub fn get_utterance(this: &SpeechSynthesisEventInit) -> SpeechSynthesisUtterance; #[cfg(feature = "SpeechSynthesisUtterance")] + #[doc = "Change the `utterance` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`, `SpeechSynthesisUtterance`*"] #[wasm_bindgen(method, setter = "utterance")] - fn utterance_shim(this: &SpeechSynthesisEventInit, val: &SpeechSynthesisUtterance); + pub fn set_utterance(this: &SpeechSynthesisEventInit, val: &SpeechSynthesisUtterance); } impl SpeechSynthesisEventInit { #[cfg(feature = "SpeechSynthesisUtterance")] @@ -39,61 +104,45 @@ impl SpeechSynthesisEventInit { ret.utterance(utterance); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `charIndex` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_char_index()` instead."] pub fn char_index(&mut self, val: u32) -> &mut Self { - self.char_index_shim(val); + self.set_char_index(val); self } - #[doc = "Change the `charLength` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_char_length()` instead."] pub fn char_length(&mut self, val: Option) -> &mut Self { - self.char_length_shim(val); + self.set_char_length(val); self } - #[doc = "Change the `elapsedTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_elapsed_time()` instead."] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - self.elapsed_time_shim(val); + self.set_elapsed_time(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "SpeechSynthesisUtterance")] - #[doc = "Change the `utterance` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`, `SpeechSynthesisUtterance`*"] + #[deprecated = "Use `set_utterance()` instead."] pub fn utterance(&mut self, val: &SpeechSynthesisUtterance) -> &mut Self { - self.utterance_shim(val); + self.set_utterance(val); self } } diff --git a/crates/web-sys/src/features/gen_StereoPannerOptions.rs b/crates/web-sys/src/features/gen_StereoPannerOptions.rs index 792a024f70c..3a56b27f013 100644 --- a/crates/web-sys/src/features/gen_StereoPannerOptions.rs +++ b/crates/web-sys/src/features/gen_StereoPannerOptions.rs @@ -10,16 +10,50 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] pub type StereoPannerOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &StereoPannerOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &StereoPannerOptions, val: u32); + pub fn set_channel_count(this: &StereoPannerOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `StereoPannerOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &StereoPannerOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `StereoPannerOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &StereoPannerOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &StereoPannerOptions, val: ChannelCountMode); + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `StereoPannerOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &StereoPannerOptions) -> Option; #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `StereoPannerOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &StereoPannerOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &StereoPannerOptions, val: ChannelInterpretation); + #[doc = "Get the `pan` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] + #[wasm_bindgen(method, getter = "pan")] + pub fn get_pan(this: &StereoPannerOptions) -> Option; + #[doc = "Change the `pan` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] #[wasm_bindgen(method, setter = "pan")] - fn pan_shim(this: &StereoPannerOptions, val: f32); + pub fn set_pan(this: &StereoPannerOptions, val: f32); } impl StereoPannerOptions { #[doc = "Construct a new `StereoPannerOptions`."] @@ -30,34 +64,26 @@ impl StereoPannerOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `StereoPannerOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `StereoPannerOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `pan` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StereoPannerOptions`*"] + #[deprecated = "Use `set_pan()` instead."] pub fn pan(&mut self, val: f32) -> &mut Self { - self.pan_shim(val); + self.set_pan(val); self } } diff --git a/crates/web-sys/src/features/gen_StorageEstimate.rs b/crates/web-sys/src/features/gen_StorageEstimate.rs index 242dc68778c..bd360574641 100644 --- a/crates/web-sys/src/features/gen_StorageEstimate.rs +++ b/crates/web-sys/src/features/gen_StorageEstimate.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] pub type StorageEstimate; + #[doc = "Get the `quota` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] + #[wasm_bindgen(method, getter = "quota")] + pub fn get_quota(this: &StorageEstimate) -> Option; + #[doc = "Change the `quota` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] #[wasm_bindgen(method, setter = "quota")] - fn quota_shim(this: &StorageEstimate, val: f64); + pub fn set_quota(this: &StorageEstimate, val: f64); + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &StorageEstimate) -> Option; + #[doc = "Change the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] #[wasm_bindgen(method, setter = "usage")] - fn usage_shim(this: &StorageEstimate, val: f64); + pub fn set_usage(this: &StorageEstimate, val: f64); } impl StorageEstimate { #[doc = "Construct a new `StorageEstimate`."] @@ -24,18 +40,14 @@ impl StorageEstimate { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `quota` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] + #[deprecated = "Use `set_quota()` instead."] pub fn quota(&mut self, val: f64) -> &mut Self { - self.quota_shim(val); + self.set_quota(val); self } - #[doc = "Change the `usage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEstimate`*"] + #[deprecated = "Use `set_usage()` instead."] pub fn usage(&mut self, val: f64) -> &mut Self { - self.usage_shim(val); + self.set_usage(val); self } } diff --git a/crates/web-sys/src/features/gen_StorageEventInit.rs b/crates/web-sys/src/features/gen_StorageEventInit.rs index 5c42540d6d6..51db6561485 100644 --- a/crates/web-sys/src/features/gen_StorageEventInit.rs +++ b/crates/web-sys/src/features/gen_StorageEventInit.rs @@ -10,23 +10,88 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] pub type StorageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &StorageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &StorageEventInit, val: bool); + pub fn set_bubbles(this: &StorageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &StorageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &StorageEventInit, val: bool); + pub fn set_cancelable(this: &StorageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &StorageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &StorageEventInit, val: bool); + pub fn set_composed(this: &StorageEventInit, val: bool); + #[doc = "Get the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "key")] + pub fn get_key(this: &StorageEventInit) -> Option; + #[doc = "Change the `key` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "key")] - fn key_shim(this: &StorageEventInit, val: Option<&str>); + pub fn set_key(this: &StorageEventInit, val: Option<&str>); + #[doc = "Get the `newValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "newValue")] + pub fn get_new_value(this: &StorageEventInit) -> Option; + #[doc = "Change the `newValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "newValue")] - fn new_value_shim(this: &StorageEventInit, val: Option<&str>); + pub fn set_new_value(this: &StorageEventInit, val: Option<&str>); + #[doc = "Get the `oldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "oldValue")] + pub fn get_old_value(this: &StorageEventInit) -> Option; + #[doc = "Change the `oldValue` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "oldValue")] - fn old_value_shim(this: &StorageEventInit, val: Option<&str>); + pub fn set_old_value(this: &StorageEventInit, val: Option<&str>); + #[cfg(feature = "Storage")] + #[doc = "Get the `storageArea` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Storage`, `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "storageArea")] + pub fn get_storage_area(this: &StorageEventInit) -> Option; #[cfg(feature = "Storage")] + #[doc = "Change the `storageArea` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Storage`, `StorageEventInit`*"] #[wasm_bindgen(method, setter = "storageArea")] - fn storage_area_shim(this: &StorageEventInit, val: Option<&Storage>); + pub fn set_storage_area(this: &StorageEventInit, val: Option<&Storage>); + #[doc = "Get the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[wasm_bindgen(method, getter = "url")] + pub fn get_url(this: &StorageEventInit) -> Option; + #[doc = "Change the `url` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, setter = "url")] - fn url_shim(this: &StorageEventInit, val: &str); + pub fn set_url(this: &StorageEventInit, val: &str); } impl StorageEventInit { #[doc = "Construct a new `StorageEventInit`."] @@ -37,61 +102,45 @@ impl StorageEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `key` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_key()` instead."] pub fn key(&mut self, val: Option<&str>) -> &mut Self { - self.key_shim(val); + self.set_key(val); self } - #[doc = "Change the `newValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_new_value()` instead."] pub fn new_value(&mut self, val: Option<&str>) -> &mut Self { - self.new_value_shim(val); + self.set_new_value(val); self } - #[doc = "Change the `oldValue` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_old_value()` instead."] pub fn old_value(&mut self, val: Option<&str>) -> &mut Self { - self.old_value_shim(val); + self.set_old_value(val); self } #[cfg(feature = "Storage")] - #[doc = "Change the `storageArea` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Storage`, `StorageEventInit`*"] + #[deprecated = "Use `set_storage_area()` instead."] pub fn storage_area(&mut self, val: Option<&Storage>) -> &mut Self { - self.storage_area_shim(val); + self.set_storage_area(val); self } - #[doc = "Change the `url` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] + #[deprecated = "Use `set_url()` instead."] pub fn url(&mut self, val: &str) -> &mut Self { - self.url_shim(val); + self.set_url(val); self } } diff --git a/crates/web-sys/src/features/gen_StreamPipeOptions.rs b/crates/web-sys/src/features/gen_StreamPipeOptions.rs index d9c02acc745..a23579d144b 100644 --- a/crates/web-sys/src/features/gen_StreamPipeOptions.rs +++ b/crates/web-sys/src/features/gen_StreamPipeOptions.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] pub type StreamPipeOptions; + #[doc = "Get the `preventAbort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[wasm_bindgen(method, getter = "preventAbort")] + pub fn get_prevent_abort(this: &StreamPipeOptions) -> Option; + #[doc = "Change the `preventAbort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] #[wasm_bindgen(method, setter = "preventAbort")] - fn prevent_abort_shim(this: &StreamPipeOptions, val: bool); + pub fn set_prevent_abort(this: &StreamPipeOptions, val: bool); + #[doc = "Get the `preventCancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[wasm_bindgen(method, getter = "preventCancel")] + pub fn get_prevent_cancel(this: &StreamPipeOptions) -> Option; + #[doc = "Change the `preventCancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] #[wasm_bindgen(method, setter = "preventCancel")] - fn prevent_cancel_shim(this: &StreamPipeOptions, val: bool); + pub fn set_prevent_cancel(this: &StreamPipeOptions, val: bool); + #[doc = "Get the `preventClose` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[wasm_bindgen(method, getter = "preventClose")] + pub fn get_prevent_close(this: &StreamPipeOptions) -> Option; + #[doc = "Change the `preventClose` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] #[wasm_bindgen(method, setter = "preventClose")] - fn prevent_close_shim(this: &StreamPipeOptions, val: bool); + pub fn set_prevent_close(this: &StreamPipeOptions, val: bool); #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `StreamPipeOptions`*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &StreamPipeOptions) -> Option; + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `StreamPipeOptions`*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &StreamPipeOptions, val: &AbortSignal); + pub fn set_signal(this: &StreamPipeOptions, val: &AbortSignal); } impl StreamPipeOptions { #[doc = "Construct a new `StreamPipeOptions`."] @@ -29,33 +62,25 @@ impl StreamPipeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `preventAbort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[deprecated = "Use `set_prevent_abort()` instead."] pub fn prevent_abort(&mut self, val: bool) -> &mut Self { - self.prevent_abort_shim(val); + self.set_prevent_abort(val); self } - #[doc = "Change the `preventCancel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[deprecated = "Use `set_prevent_cancel()` instead."] pub fn prevent_cancel(&mut self, val: bool) -> &mut Self { - self.prevent_cancel_shim(val); + self.set_prevent_cancel(val); self } - #[doc = "Change the `preventClose` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StreamPipeOptions`*"] + #[deprecated = "Use `set_prevent_close()` instead."] pub fn prevent_close(&mut self, val: bool) -> &mut Self { - self.prevent_close_shim(val); + self.set_prevent_close(val); self } #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `StreamPipeOptions`*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs index cf84e4807e9..9366e1e7345 100644 --- a/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleRuleChangeEventInit.rs @@ -10,18 +10,60 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] pub type StyleRuleChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &StyleRuleChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &StyleRuleChangeEventInit, val: bool); + pub fn set_bubbles(this: &StyleRuleChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &StyleRuleChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &StyleRuleChangeEventInit, val: bool); + pub fn set_cancelable(this: &StyleRuleChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &StyleRuleChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &StyleRuleChangeEventInit, val: bool); + pub fn set_composed(this: &StyleRuleChangeEventInit, val: bool); + #[cfg(feature = "CssRule")] + #[doc = "Get the `rule` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssRule`, `StyleRuleChangeEventInit`*"] + #[wasm_bindgen(method, getter = "rule")] + pub fn get_rule(this: &StyleRuleChangeEventInit) -> Option; #[cfg(feature = "CssRule")] + #[doc = "Change the `rule` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssRule`, `StyleRuleChangeEventInit`*"] #[wasm_bindgen(method, setter = "rule")] - fn rule_shim(this: &StyleRuleChangeEventInit, val: Option<&CssRule>); + pub fn set_rule(this: &StyleRuleChangeEventInit, val: Option<&CssRule>); #[cfg(feature = "CssStyleSheet")] + #[doc = "Get the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleRuleChangeEventInit`*"] + #[wasm_bindgen(method, getter = "stylesheet")] + pub fn get_stylesheet(this: &StyleRuleChangeEventInit) -> Option; + #[cfg(feature = "CssStyleSheet")] + #[doc = "Change the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleRuleChangeEventInit`*"] #[wasm_bindgen(method, setter = "stylesheet")] - fn stylesheet_shim(this: &StyleRuleChangeEventInit, val: Option<&CssStyleSheet>); + pub fn set_stylesheet(this: &StyleRuleChangeEventInit, val: Option<&CssStyleSheet>); } impl StyleRuleChangeEventInit { #[doc = "Construct a new `StyleRuleChangeEventInit`."] @@ -32,41 +74,31 @@ impl StyleRuleChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleRuleChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "CssRule")] - #[doc = "Change the `rule` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssRule`, `StyleRuleChangeEventInit`*"] + #[deprecated = "Use `set_rule()` instead."] pub fn rule(&mut self, val: Option<&CssRule>) -> &mut Self { - self.rule_shim(val); + self.set_rule(val); self } #[cfg(feature = "CssStyleSheet")] - #[doc = "Change the `stylesheet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleRuleChangeEventInit`*"] + #[deprecated = "Use `set_stylesheet()` instead."] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - self.stylesheet_shim(val); + self.set_stylesheet(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs index 547d1124cb7..70aecd5ed6f 100644 --- a/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleSheetApplicableStateChangeEventInit.rs @@ -10,17 +10,59 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] pub type StyleSheetApplicableStateChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &StyleSheetApplicableStateChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + pub fn set_bubbles(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &StyleSheetApplicableStateChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + pub fn set_cancelable(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &StyleSheetApplicableStateChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + pub fn set_composed(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + #[doc = "Get the `applicable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[wasm_bindgen(method, getter = "applicable")] + pub fn get_applicable(this: &StyleSheetApplicableStateChangeEventInit) -> Option; + #[doc = "Change the `applicable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] #[wasm_bindgen(method, setter = "applicable")] - fn applicable_shim(this: &StyleSheetApplicableStateChangeEventInit, val: bool); + pub fn set_applicable(this: &StyleSheetApplicableStateChangeEventInit, val: bool); #[cfg(feature = "CssStyleSheet")] + #[doc = "Get the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetApplicableStateChangeEventInit`*"] + #[wasm_bindgen(method, getter = "stylesheet")] + pub fn get_stylesheet(this: &StyleSheetApplicableStateChangeEventInit) + -> Option; + #[cfg(feature = "CssStyleSheet")] + #[doc = "Change the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetApplicableStateChangeEventInit`*"] #[wasm_bindgen(method, setter = "stylesheet")] - fn stylesheet_shim( + pub fn set_stylesheet( this: &StyleSheetApplicableStateChangeEventInit, val: Option<&CssStyleSheet>, ); @@ -34,40 +76,30 @@ impl StyleSheetApplicableStateChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `applicable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetApplicableStateChangeEventInit`*"] + #[deprecated = "Use `set_applicable()` instead."] pub fn applicable(&mut self, val: bool) -> &mut Self { - self.applicable_shim(val); + self.set_applicable(val); self } #[cfg(feature = "CssStyleSheet")] - #[doc = "Change the `stylesheet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetApplicableStateChangeEventInit`*"] + #[deprecated = "Use `set_stylesheet()` instead."] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - self.stylesheet_shim(val); + self.set_stylesheet(val); self } } diff --git a/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs b/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs index 4aeb6e4fc4a..a0d658a71fd 100644 --- a/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_StyleSheetChangeEventInit.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] pub type StyleSheetChangeEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &StyleSheetChangeEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &StyleSheetChangeEventInit, val: bool); + pub fn set_bubbles(this: &StyleSheetChangeEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &StyleSheetChangeEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &StyleSheetChangeEventInit, val: bool); + pub fn set_cancelable(this: &StyleSheetChangeEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &StyleSheetChangeEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &StyleSheetChangeEventInit, val: bool); + pub fn set_composed(this: &StyleSheetChangeEventInit, val: bool); + #[doc = "Get the `documentSheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[wasm_bindgen(method, getter = "documentSheet")] + pub fn get_document_sheet(this: &StyleSheetChangeEventInit) -> Option; + #[doc = "Change the `documentSheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] #[wasm_bindgen(method, setter = "documentSheet")] - fn document_sheet_shim(this: &StyleSheetChangeEventInit, val: bool); + pub fn set_document_sheet(this: &StyleSheetChangeEventInit, val: bool); #[cfg(feature = "CssStyleSheet")] + #[doc = "Get the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetChangeEventInit`*"] + #[wasm_bindgen(method, getter = "stylesheet")] + pub fn get_stylesheet(this: &StyleSheetChangeEventInit) -> Option; + #[cfg(feature = "CssStyleSheet")] + #[doc = "Change the `stylesheet` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetChangeEventInit`*"] #[wasm_bindgen(method, setter = "stylesheet")] - fn stylesheet_shim(this: &StyleSheetChangeEventInit, val: Option<&CssStyleSheet>); + pub fn set_stylesheet(this: &StyleSheetChangeEventInit, val: Option<&CssStyleSheet>); } impl StyleSheetChangeEventInit { #[doc = "Construct a new `StyleSheetChangeEventInit`."] @@ -31,40 +72,30 @@ impl StyleSheetChangeEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `documentSheet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `StyleSheetChangeEventInit`*"] + #[deprecated = "Use `set_document_sheet()` instead."] pub fn document_sheet(&mut self, val: bool) -> &mut Self { - self.document_sheet_shim(val); + self.set_document_sheet(val); self } #[cfg(feature = "CssStyleSheet")] - #[doc = "Change the `stylesheet` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssStyleSheet`, `StyleSheetChangeEventInit`*"] + #[deprecated = "Use `set_stylesheet()` instead."] pub fn stylesheet(&mut self, val: Option<&CssStyleSheet>) -> &mut Self { - self.stylesheet_shim(val); + self.set_stylesheet(val); self } } diff --git a/crates/web-sys/src/features/gen_SubmitEventInit.rs b/crates/web-sys/src/features/gen_SubmitEventInit.rs index 1fa2555e874..4d954d50e3f 100644 --- a/crates/web-sys/src/features/gen_SubmitEventInit.rs +++ b/crates/web-sys/src/features/gen_SubmitEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] pub type SubmitEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SubmitEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &SubmitEventInit, val: bool); + pub fn set_bubbles(this: &SubmitEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SubmitEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &SubmitEventInit, val: bool); + pub fn set_cancelable(this: &SubmitEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SubmitEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &SubmitEventInit, val: bool); + pub fn set_composed(this: &SubmitEventInit, val: bool); #[cfg(feature = "HtmlElement")] + #[doc = "Get the `submitter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEventInit`*"] + #[wasm_bindgen(method, getter = "submitter")] + pub fn get_submitter(this: &SubmitEventInit) -> Option; + #[cfg(feature = "HtmlElement")] + #[doc = "Change the `submitter` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEventInit`*"] #[wasm_bindgen(method, setter = "submitter")] - fn submitter_shim(this: &SubmitEventInit, val: Option<&HtmlElement>); + pub fn set_submitter(this: &SubmitEventInit, val: Option<&HtmlElement>); } impl SubmitEventInit { #[doc = "Construct a new `SubmitEventInit`."] @@ -29,33 +62,25 @@ impl SubmitEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SubmitEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "HtmlElement")] - #[doc = "Change the `submitter` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlElement`, `SubmitEventInit`*"] + #[deprecated = "Use `set_submitter()` instead."] pub fn submitter(&mut self, val: Option<&HtmlElement>) -> &mut Self { - self.submitter_shim(val); + self.set_submitter(val); self } } diff --git a/crates/web-sys/src/features/gen_SvcOutputMetadata.rs b/crates/web-sys/src/features/gen_SvcOutputMetadata.rs index f48c035565d..84f9d00dd6a 100644 --- a/crates/web-sys/src/features/gen_SvcOutputMetadata.rs +++ b/crates/web-sys/src/features/gen_SvcOutputMetadata.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type SvcOutputMetadata; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `temporalLayerId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvcOutputMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "temporalLayerId")] + pub fn get_temporal_layer_id(this: &SvcOutputMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `temporalLayerId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvcOutputMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "temporalLayerId")] - fn temporal_layer_id_shim(this: &SvcOutputMetadata, val: u32); + pub fn set_temporal_layer_id(this: &SvcOutputMetadata, val: u32); } #[cfg(web_sys_unstable_apis)] impl SvcOutputMetadata { @@ -31,14 +47,9 @@ impl SvcOutputMetadata { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `temporalLayerId` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvcOutputMetadata`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_temporal_layer_id()` instead."] pub fn temporal_layer_id(&mut self, val: u32) -> &mut Self { - self.temporal_layer_id_shim(val); + self.set_temporal_layer_id(val); self } } diff --git a/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs b/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs index 4d83aa30982..fc9141bf2fc 100644 --- a/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs +++ b/crates/web-sys/src/features/gen_SvgBoundingBoxOptions.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] pub type SvgBoundingBoxOptions; + #[doc = "Get the `clipped` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[wasm_bindgen(method, getter = "clipped")] + pub fn get_clipped(this: &SvgBoundingBoxOptions) -> Option; + #[doc = "Change the `clipped` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] #[wasm_bindgen(method, setter = "clipped")] - fn clipped_shim(this: &SvgBoundingBoxOptions, val: bool); + pub fn set_clipped(this: &SvgBoundingBoxOptions, val: bool); + #[doc = "Get the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[wasm_bindgen(method, getter = "fill")] + pub fn get_fill(this: &SvgBoundingBoxOptions) -> Option; + #[doc = "Change the `fill` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] #[wasm_bindgen(method, setter = "fill")] - fn fill_shim(this: &SvgBoundingBoxOptions, val: bool); + pub fn set_fill(this: &SvgBoundingBoxOptions, val: bool); + #[doc = "Get the `markers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[wasm_bindgen(method, getter = "markers")] + pub fn get_markers(this: &SvgBoundingBoxOptions) -> Option; + #[doc = "Change the `markers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] #[wasm_bindgen(method, setter = "markers")] - fn markers_shim(this: &SvgBoundingBoxOptions, val: bool); + pub fn set_markers(this: &SvgBoundingBoxOptions, val: bool); + #[doc = "Get the `stroke` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[wasm_bindgen(method, getter = "stroke")] + pub fn get_stroke(this: &SvgBoundingBoxOptions) -> Option; + #[doc = "Change the `stroke` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] #[wasm_bindgen(method, setter = "stroke")] - fn stroke_shim(this: &SvgBoundingBoxOptions, val: bool); + pub fn set_stroke(this: &SvgBoundingBoxOptions, val: bool); } impl SvgBoundingBoxOptions { #[doc = "Construct a new `SvgBoundingBoxOptions`."] @@ -28,32 +60,24 @@ impl SvgBoundingBoxOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `clipped` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[deprecated = "Use `set_clipped()` instead."] pub fn clipped(&mut self, val: bool) -> &mut Self { - self.clipped_shim(val); + self.set_clipped(val); self } - #[doc = "Change the `fill` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[deprecated = "Use `set_fill()` instead."] pub fn fill(&mut self, val: bool) -> &mut Self { - self.fill_shim(val); + self.set_fill(val); self } - #[doc = "Change the `markers` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[deprecated = "Use `set_markers()` instead."] pub fn markers(&mut self, val: bool) -> &mut Self { - self.markers_shim(val); + self.set_markers(val); self } - #[doc = "Change the `stroke` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgBoundingBoxOptions`*"] + #[deprecated = "Use `set_stroke()` instead."] pub fn stroke(&mut self, val: bool) -> &mut Self { - self.stroke_shim(val); + self.set_stroke(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskControllerInit.rs b/crates/web-sys/src/features/gen_TaskControllerInit.rs index 87fb5cbf035..71b2c5a0e46 100644 --- a/crates/web-sys/src/features/gen_TaskControllerInit.rs +++ b/crates/web-sys/src/features/gen_TaskControllerInit.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskControllerInit; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Get the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "priority")] + pub fn get_priority(this: &TaskControllerInit) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`, `TaskPriority`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "priority")] - fn priority_shim(this: &TaskControllerInit, val: TaskPriority); + pub fn set_priority(this: &TaskControllerInit, val: TaskPriority); } #[cfg(web_sys_unstable_apis)] impl TaskControllerInit { @@ -33,14 +50,9 @@ impl TaskControllerInit { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] - #[doc = "Change the `priority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskControllerInit`, `TaskPriority`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_priority()` instead."] pub fn priority(&mut self, val: TaskPriority) -> &mut Self { - self.priority_shim(val); + self.set_priority(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs index c2fc50429fa..9180af22954 100644 --- a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskPriorityChangeEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TaskPriorityChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TaskPriorityChangeEventInit, val: bool); + pub fn set_bubbles(this: &TaskPriorityChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TaskPriorityChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TaskPriorityChangeEventInit, val: bool); + pub fn set_cancelable(this: &TaskPriorityChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TaskPriorityChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TaskPriorityChangeEventInit, val: bool); + pub fn set_composed(this: &TaskPriorityChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "TaskPriority")] + #[doc = "Get the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "previousPriority")] + pub fn get_previous_priority(this: &TaskPriorityChangeEventInit) -> TaskPriority; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] + #[doc = "Change the `previousPriority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "previousPriority")] - fn previous_priority_shim(this: &TaskPriorityChangeEventInit, val: TaskPriority); + pub fn set_previous_priority(this: &TaskPriorityChangeEventInit, val: TaskPriority); } #[cfg(web_sys_unstable_apis)] impl TaskPriorityChangeEventInit { @@ -40,48 +105,28 @@ impl TaskPriorityChangeEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskPriorityChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "TaskPriority")] - #[doc = "Change the `previousPriority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskPriority`, `TaskPriorityChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_previous_priority()` instead."] pub fn previous_priority(&mut self, val: TaskPriority) -> &mut Self { - self.previous_priority_shim(val); + self.set_previous_priority(val); self } } diff --git a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs index 99b837c6d73..61fc8bc9de0 100644 --- a/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs +++ b/crates/web-sys/src/features/gen_TaskSignalAnyInit.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type TaskSignalAnyInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "priority")] + pub fn get_priority(this: &TaskSignalAnyInit) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `priority` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "priority")] - fn priority_shim(this: &TaskSignalAnyInit, val: &::wasm_bindgen::JsValue); + pub fn set_priority(this: &TaskSignalAnyInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl TaskSignalAnyInit { @@ -31,14 +47,9 @@ impl TaskSignalAnyInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `priority` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TaskSignalAnyInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_priority()` instead."] pub fn priority(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.priority_shim(val); + self.set_priority(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs b/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs index 480782339ae..1021c266f49 100644 --- a/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpServerSocketEventInit.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] pub type TcpServerSocketEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TcpServerSocketEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TcpServerSocketEventInit, val: bool); + pub fn set_bubbles(this: &TcpServerSocketEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TcpServerSocketEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TcpServerSocketEventInit, val: bool); + pub fn set_cancelable(this: &TcpServerSocketEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TcpServerSocketEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TcpServerSocketEventInit, val: bool); + pub fn set_composed(this: &TcpServerSocketEventInit, val: bool); #[cfg(feature = "TcpSocket")] + #[doc = "Get the `socket` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`, `TcpSocket`*"] + #[wasm_bindgen(method, getter = "socket")] + pub fn get_socket(this: &TcpServerSocketEventInit) -> Option; + #[cfg(feature = "TcpSocket")] + #[doc = "Change the `socket` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`, `TcpSocket`*"] #[wasm_bindgen(method, setter = "socket")] - fn socket_shim(this: &TcpServerSocketEventInit, val: Option<&TcpSocket>); + pub fn set_socket(this: &TcpServerSocketEventInit, val: Option<&TcpSocket>); } impl TcpServerSocketEventInit { #[doc = "Construct a new `TcpServerSocketEventInit`."] @@ -29,33 +62,25 @@ impl TcpServerSocketEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(feature = "TcpSocket")] - #[doc = "Change the `socket` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpServerSocketEventInit`, `TcpSocket`*"] + #[deprecated = "Use `set_socket()` instead."] pub fn socket(&mut self, val: Option<&TcpSocket>) -> &mut Self { - self.socket_shim(val); + self.set_socket(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs index 8ce673d4787..63c13ff0397 100644 --- a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] pub type TcpSocketErrorEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TcpSocketErrorEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TcpSocketErrorEventInit, val: bool); + pub fn set_bubbles(this: &TcpSocketErrorEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TcpSocketErrorEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TcpSocketErrorEventInit, val: bool); + pub fn set_cancelable(this: &TcpSocketErrorEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TcpSocketErrorEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TcpSocketErrorEventInit, val: bool); + pub fn set_composed(this: &TcpSocketErrorEventInit, val: bool); + #[doc = "Get the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[wasm_bindgen(method, getter = "message")] + pub fn get_message(this: &TcpSocketErrorEventInit) -> Option; + #[doc = "Change the `message` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, setter = "message")] - fn message_shim(this: &TcpSocketErrorEventInit, val: &str); + pub fn set_message(this: &TcpSocketErrorEventInit, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &TcpSocketErrorEventInit) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &TcpSocketErrorEventInit, val: &str); + pub fn set_name(this: &TcpSocketErrorEventInit, val: &str); } impl TcpSocketErrorEventInit { #[doc = "Construct a new `TcpSocketErrorEventInit`."] @@ -30,39 +70,29 @@ impl TcpSocketErrorEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `message` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[deprecated = "Use `set_message()` instead."] pub fn message(&mut self, val: &str) -> &mut Self { - self.message_shim(val); + self.set_message(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } } diff --git a/crates/web-sys/src/features/gen_TcpSocketEventInit.rs b/crates/web-sys/src/features/gen_TcpSocketEventInit.rs index c73323b4dde..5980130f25a 100644 --- a/crates/web-sys/src/features/gen_TcpSocketEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpSocketEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] pub type TcpSocketEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TcpSocketEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TcpSocketEventInit, val: bool); + pub fn set_bubbles(this: &TcpSocketEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TcpSocketEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TcpSocketEventInit, val: bool); + pub fn set_cancelable(this: &TcpSocketEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TcpSocketEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TcpSocketEventInit, val: bool); + pub fn set_composed(this: &TcpSocketEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &TcpSocketEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &TcpSocketEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &TcpSocketEventInit, val: &::wasm_bindgen::JsValue); } impl TcpSocketEventInit { #[doc = "Construct a new `TcpSocketEventInit`."] @@ -28,32 +60,24 @@ impl TcpSocketEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TcpSocketEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } } diff --git a/crates/web-sys/src/features/gen_TextDecodeOptions.rs b/crates/web-sys/src/features/gen_TextDecodeOptions.rs index ad37701b64f..e9176c5d9e8 100644 --- a/crates/web-sys/src/features/gen_TextDecodeOptions.rs +++ b/crates/web-sys/src/features/gen_TextDecodeOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] pub type TextDecodeOptions; + #[doc = "Get the `stream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] + #[wasm_bindgen(method, getter = "stream")] + pub fn get_stream(this: &TextDecodeOptions) -> Option; + #[doc = "Change the `stream` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] #[wasm_bindgen(method, setter = "stream")] - fn stream_shim(this: &TextDecodeOptions, val: bool); + pub fn set_stream(this: &TextDecodeOptions, val: bool); } impl TextDecodeOptions { #[doc = "Construct a new `TextDecodeOptions`."] @@ -22,11 +30,9 @@ impl TextDecodeOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `stream` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`*"] + #[deprecated = "Use `set_stream()` instead."] pub fn stream(&mut self, val: bool) -> &mut Self { - self.stream_shim(val); + self.set_stream(val); self } } diff --git a/crates/web-sys/src/features/gen_TextDecoderOptions.rs b/crates/web-sys/src/features/gen_TextDecoderOptions.rs index ece2e78e5df..1ca8079c0cd 100644 --- a/crates/web-sys/src/features/gen_TextDecoderOptions.rs +++ b/crates/web-sys/src/features/gen_TextDecoderOptions.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] pub type TextDecoderOptions; + #[doc = "Get the `fatal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] + #[wasm_bindgen(method, getter = "fatal")] + pub fn get_fatal(this: &TextDecoderOptions) -> Option; + #[doc = "Change the `fatal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] #[wasm_bindgen(method, setter = "fatal")] - fn fatal_shim(this: &TextDecoderOptions, val: bool); + pub fn set_fatal(this: &TextDecoderOptions, val: bool); } impl TextDecoderOptions { #[doc = "Construct a new `TextDecoderOptions`."] @@ -22,11 +30,9 @@ impl TextDecoderOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `fatal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TextDecoderOptions`*"] + #[deprecated = "Use `set_fatal()` instead."] pub fn fatal(&mut self, val: bool) -> &mut Self { - self.fatal_shim(val); + self.set_fatal(val); self } } diff --git a/crates/web-sys/src/features/gen_TouchEventInit.rs b/crates/web-sys/src/features/gen_TouchEventInit.rs index 4cec29ce0b4..18c280b631f 100644 --- a/crates/web-sys/src/features/gen_TouchEventInit.rs +++ b/crates/web-sys/src/features/gen_TouchEventInit.rs @@ -10,49 +10,218 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] pub type TouchEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TouchEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TouchEventInit, val: bool); + pub fn set_bubbles(this: &TouchEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TouchEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TouchEventInit, val: bool); + pub fn set_cancelable(this: &TouchEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TouchEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TouchEventInit, val: bool); + pub fn set_composed(this: &TouchEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &TouchEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &TouchEventInit, val: i32); + pub fn set_detail(this: &TouchEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &TouchEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &TouchEventInit, val: Option<&Window>); + pub fn set_view(this: &TouchEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &TouchEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &TouchEventInit, val: bool); + pub fn set_alt_key(this: &TouchEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &TouchEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &TouchEventInit, val: bool); + pub fn set_ctrl_key(this: &TouchEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &TouchEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &TouchEventInit, val: bool); + pub fn set_meta_key(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_fn(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_num_lock(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_os(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_symbol(this: &TouchEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &TouchEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &TouchEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &TouchEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &TouchEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &TouchEventInit, val: bool); + pub fn set_shift_key(this: &TouchEventInit, val: bool); + #[doc = "Get the `changedTouches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "changedTouches")] + pub fn get_changed_touches(this: &TouchEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `changedTouches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "changedTouches")] - fn changed_touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_changed_touches(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `targetTouches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "targetTouches")] + pub fn get_target_touches(this: &TouchEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `targetTouches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "targetTouches")] - fn target_touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_target_touches(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `touches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[wasm_bindgen(method, getter = "touches")] + pub fn get_touches(this: &TouchEventInit) -> Option<::js_sys::Array>; + #[doc = "Change the `touches` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] #[wasm_bindgen(method, setter = "touches")] - fn touches_shim(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_touches(this: &TouchEventInit, val: &::wasm_bindgen::JsValue); } impl TouchEventInit { #[doc = "Construct a new `TouchEventInit`."] @@ -63,152 +232,110 @@ impl TouchEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `changedTouches` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_changed_touches()` instead."] pub fn changed_touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.changed_touches_shim(val); + self.set_changed_touches(val); self } - #[doc = "Change the `targetTouches` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_target_touches()` instead."] pub fn target_touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.target_touches_shim(val); + self.set_target_touches(val); self } - #[doc = "Change the `touches` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchEventInit`*"] + #[deprecated = "Use `set_touches()` instead."] pub fn touches(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.touches_shim(val); + self.set_touches(val); self } } diff --git a/crates/web-sys/src/features/gen_TouchInit.rs b/crates/web-sys/src/features/gen_TouchInit.rs index a9c5cc1745a..37c8a7ab01d 100644 --- a/crates/web-sys/src/features/gen_TouchInit.rs +++ b/crates/web-sys/src/features/gen_TouchInit.rs @@ -10,31 +10,128 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] pub type TouchInit; + #[doc = "Get the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "clientX")] + pub fn get_client_x(this: &TouchInit) -> Option; + #[doc = "Change the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "clientX")] - fn client_x_shim(this: &TouchInit, val: i32); + pub fn set_client_x(this: &TouchInit, val: i32); + #[doc = "Get the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "clientY")] + pub fn get_client_y(this: &TouchInit) -> Option; + #[doc = "Change the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "clientY")] - fn client_y_shim(this: &TouchInit, val: i32); + pub fn set_client_y(this: &TouchInit, val: i32); + #[doc = "Get the `force` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "force")] + pub fn get_force(this: &TouchInit) -> Option; + #[doc = "Change the `force` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "force")] - fn force_shim(this: &TouchInit, val: f32); + pub fn set_force(this: &TouchInit, val: f32); + #[doc = "Get the `identifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "identifier")] + pub fn get_identifier(this: &TouchInit) -> i32; + #[doc = "Change the `identifier` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "identifier")] - fn identifier_shim(this: &TouchInit, val: i32); + pub fn set_identifier(this: &TouchInit, val: i32); + #[doc = "Get the `pageX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "pageX")] + pub fn get_page_x(this: &TouchInit) -> Option; + #[doc = "Change the `pageX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "pageX")] - fn page_x_shim(this: &TouchInit, val: i32); + pub fn set_page_x(this: &TouchInit, val: i32); + #[doc = "Get the `pageY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "pageY")] + pub fn get_page_y(this: &TouchInit) -> Option; + #[doc = "Change the `pageY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "pageY")] - fn page_y_shim(this: &TouchInit, val: i32); + pub fn set_page_y(this: &TouchInit, val: i32); + #[doc = "Get the `radiusX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "radiusX")] + pub fn get_radius_x(this: &TouchInit) -> Option; + #[doc = "Change the `radiusX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "radiusX")] - fn radius_x_shim(this: &TouchInit, val: f32); + pub fn set_radius_x(this: &TouchInit, val: f32); + #[doc = "Get the `radiusY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "radiusY")] + pub fn get_radius_y(this: &TouchInit) -> Option; + #[doc = "Change the `radiusY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "radiusY")] - fn radius_y_shim(this: &TouchInit, val: f32); + pub fn set_radius_y(this: &TouchInit, val: f32); + #[doc = "Get the `rotationAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "rotationAngle")] + pub fn get_rotation_angle(this: &TouchInit) -> Option; + #[doc = "Change the `rotationAngle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "rotationAngle")] - fn rotation_angle_shim(this: &TouchInit, val: f32); + pub fn set_rotation_angle(this: &TouchInit, val: f32); + #[doc = "Get the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "screenX")] + pub fn get_screen_x(this: &TouchInit) -> Option; + #[doc = "Change the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "screenX")] - fn screen_x_shim(this: &TouchInit, val: i32); + pub fn set_screen_x(this: &TouchInit, val: i32); + #[doc = "Get the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[wasm_bindgen(method, getter = "screenY")] + pub fn get_screen_y(this: &TouchInit) -> Option; + #[doc = "Change the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] #[wasm_bindgen(method, setter = "screenY")] - fn screen_y_shim(this: &TouchInit, val: i32); + pub fn set_screen_y(this: &TouchInit, val: i32); #[cfg(feature = "EventTarget")] + #[doc = "Get the `target` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"] + #[wasm_bindgen(method, getter = "target")] + pub fn get_target(this: &TouchInit) -> EventTarget; + #[cfg(feature = "EventTarget")] + #[doc = "Change the `target` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"] #[wasm_bindgen(method, setter = "target")] - fn target_shim(this: &TouchInit, val: &EventTarget); + pub fn set_target(this: &TouchInit, val: &EventTarget); } impl TouchInit { #[cfg(feature = "EventTarget")] @@ -48,89 +145,65 @@ impl TouchInit { ret.target(target); ret } - #[doc = "Change the `clientX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_client_x()` instead."] pub fn client_x(&mut self, val: i32) -> &mut Self { - self.client_x_shim(val); + self.set_client_x(val); self } - #[doc = "Change the `clientY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_client_y()` instead."] pub fn client_y(&mut self, val: i32) -> &mut Self { - self.client_y_shim(val); + self.set_client_y(val); self } - #[doc = "Change the `force` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_force()` instead."] pub fn force(&mut self, val: f32) -> &mut Self { - self.force_shim(val); + self.set_force(val); self } - #[doc = "Change the `identifier` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_identifier()` instead."] pub fn identifier(&mut self, val: i32) -> &mut Self { - self.identifier_shim(val); + self.set_identifier(val); self } - #[doc = "Change the `pageX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_page_x()` instead."] pub fn page_x(&mut self, val: i32) -> &mut Self { - self.page_x_shim(val); + self.set_page_x(val); self } - #[doc = "Change the `pageY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_page_y()` instead."] pub fn page_y(&mut self, val: i32) -> &mut Self { - self.page_y_shim(val); + self.set_page_y(val); self } - #[doc = "Change the `radiusX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_radius_x()` instead."] pub fn radius_x(&mut self, val: f32) -> &mut Self { - self.radius_x_shim(val); + self.set_radius_x(val); self } - #[doc = "Change the `radiusY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_radius_y()` instead."] pub fn radius_y(&mut self, val: f32) -> &mut Self { - self.radius_y_shim(val); + self.set_radius_y(val); self } - #[doc = "Change the `rotationAngle` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_rotation_angle()` instead."] pub fn rotation_angle(&mut self, val: f32) -> &mut Self { - self.rotation_angle_shim(val); + self.set_rotation_angle(val); self } - #[doc = "Change the `screenX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_screen_x()` instead."] pub fn screen_x(&mut self, val: i32) -> &mut Self { - self.screen_x_shim(val); + self.set_screen_x(val); self } - #[doc = "Change the `screenY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TouchInit`*"] + #[deprecated = "Use `set_screen_y()` instead."] pub fn screen_y(&mut self, val: i32) -> &mut Self { - self.screen_y_shim(val); + self.set_screen_y(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `target` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `TouchInit`*"] + #[deprecated = "Use `set_target()` instead."] pub fn target(&mut self, val: &EventTarget) -> &mut Self { - self.target_shim(val); + self.set_target(val); self } } diff --git a/crates/web-sys/src/features/gen_TrackEventInit.rs b/crates/web-sys/src/features/gen_TrackEventInit.rs index 18ede672b91..8097517d952 100644 --- a/crates/web-sys/src/features/gen_TrackEventInit.rs +++ b/crates/web-sys/src/features/gen_TrackEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] pub type TrackEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TrackEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TrackEventInit, val: bool); + pub fn set_bubbles(this: &TrackEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TrackEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TrackEventInit, val: bool); + pub fn set_cancelable(this: &TrackEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TrackEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TrackEventInit, val: bool); + pub fn set_composed(this: &TrackEventInit, val: bool); + #[doc = "Get the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[wasm_bindgen(method, getter = "track")] + pub fn get_track(this: &TrackEventInit) -> Option<::js_sys::Object>; + #[doc = "Change the `track` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] #[wasm_bindgen(method, setter = "track")] - fn track_shim(this: &TrackEventInit, val: Option<&::js_sys::Object>); + pub fn set_track(this: &TrackEventInit, val: Option<&::js_sys::Object>); } impl TrackEventInit { #[doc = "Construct a new `TrackEventInit`."] @@ -28,32 +60,24 @@ impl TrackEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `track` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TrackEventInit`*"] + #[deprecated = "Use `set_track()` instead."] pub fn track(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { - self.track_shim(val); + self.set_track(val); self } } diff --git a/crates/web-sys/src/features/gen_Transformer.rs b/crates/web-sys/src/features/gen_Transformer.rs index 02cb29200b1..77d6965fa3f 100644 --- a/crates/web-sys/src/features/gen_Transformer.rs +++ b/crates/web-sys/src/features/gen_Transformer.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] pub type Transformer; + #[doc = "Get the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[wasm_bindgen(method, getter = "flush")] + pub fn get_flush(this: &Transformer) -> Option<::js_sys::Function>; + #[doc = "Change the `flush` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] #[wasm_bindgen(method, setter = "flush")] - fn flush_shim(this: &Transformer, val: &::js_sys::Function); + pub fn set_flush(this: &Transformer, val: &::js_sys::Function); + #[doc = "Get the `readableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[wasm_bindgen(method, getter = "readableType")] + pub fn get_readable_type(this: &Transformer) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `readableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] #[wasm_bindgen(method, setter = "readableType")] - fn readable_type_shim(this: &Transformer, val: &::wasm_bindgen::JsValue); + pub fn set_readable_type(this: &Transformer, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[wasm_bindgen(method, getter = "start")] + pub fn get_start(this: &Transformer) -> Option<::js_sys::Function>; + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] #[wasm_bindgen(method, setter = "start")] - fn start_shim(this: &Transformer, val: &::js_sys::Function); + pub fn set_start(this: &Transformer, val: &::js_sys::Function); + #[doc = "Get the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[wasm_bindgen(method, getter = "transform")] + pub fn get_transform(this: &Transformer) -> Option<::js_sys::Function>; + #[doc = "Change the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] #[wasm_bindgen(method, setter = "transform")] - fn transform_shim(this: &Transformer, val: &::js_sys::Function); + pub fn set_transform(this: &Transformer, val: &::js_sys::Function); + #[doc = "Get the `writableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[wasm_bindgen(method, getter = "writableType")] + pub fn get_writable_type(this: &Transformer) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `writableType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] #[wasm_bindgen(method, setter = "writableType")] - fn writable_type_shim(this: &Transformer, val: &::wasm_bindgen::JsValue); + pub fn set_writable_type(this: &Transformer, val: &::wasm_bindgen::JsValue); } impl Transformer { #[doc = "Construct a new `Transformer`."] @@ -30,39 +70,29 @@ impl Transformer { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `flush` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[deprecated = "Use `set_flush()` instead."] pub fn flush(&mut self, val: &::js_sys::Function) -> &mut Self { - self.flush_shim(val); + self.set_flush(val); self } - #[doc = "Change the `readableType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[deprecated = "Use `set_readable_type()` instead."] pub fn readable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.readable_type_shim(val); + self.set_readable_type(val); self } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[deprecated = "Use `set_start()` instead."] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - self.start_shim(val); + self.set_start(val); self } - #[doc = "Change the `transform` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[deprecated = "Use `set_transform()` instead."] pub fn transform(&mut self, val: &::js_sys::Function) -> &mut Self { - self.transform_shim(val); + self.set_transform(val); self } - #[doc = "Change the `writableType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Transformer`*"] + #[deprecated = "Use `set_writable_type()` instead."] pub fn writable_type(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.writable_type_shim(val); + self.set_writable_type(val); self } } diff --git a/crates/web-sys/src/features/gen_TransitionEventInit.rs b/crates/web-sys/src/features/gen_TransitionEventInit.rs index a6d000fd7b6..b3ede75c465 100644 --- a/crates/web-sys/src/features/gen_TransitionEventInit.rs +++ b/crates/web-sys/src/features/gen_TransitionEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] pub type TransitionEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &TransitionEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &TransitionEventInit, val: bool); + pub fn set_bubbles(this: &TransitionEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &TransitionEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &TransitionEventInit, val: bool); + pub fn set_cancelable(this: &TransitionEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &TransitionEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &TransitionEventInit, val: bool); + pub fn set_composed(this: &TransitionEventInit, val: bool); + #[doc = "Get the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "elapsedTime")] + pub fn get_elapsed_time(this: &TransitionEventInit) -> Option; + #[doc = "Change the `elapsedTime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "elapsedTime")] - fn elapsed_time_shim(this: &TransitionEventInit, val: f32); + pub fn set_elapsed_time(this: &TransitionEventInit, val: f32); + #[doc = "Get the `propertyName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "propertyName")] + pub fn get_property_name(this: &TransitionEventInit) -> Option; + #[doc = "Change the `propertyName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "propertyName")] - fn property_name_shim(this: &TransitionEventInit, val: &str); + pub fn set_property_name(this: &TransitionEventInit, val: &str); + #[doc = "Get the `pseudoElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[wasm_bindgen(method, getter = "pseudoElement")] + pub fn get_pseudo_element(this: &TransitionEventInit) -> Option; + #[doc = "Change the `pseudoElement` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, setter = "pseudoElement")] - fn pseudo_element_shim(this: &TransitionEventInit, val: &str); + pub fn set_pseudo_element(this: &TransitionEventInit, val: &str); } impl TransitionEventInit { #[doc = "Construct a new `TransitionEventInit`."] @@ -32,46 +80,34 @@ impl TransitionEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `elapsedTime` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_elapsed_time()` instead."] pub fn elapsed_time(&mut self, val: f32) -> &mut Self { - self.elapsed_time_shim(val); + self.set_elapsed_time(val); self } - #[doc = "Change the `propertyName` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_property_name()` instead."] pub fn property_name(&mut self, val: &str) -> &mut Self { - self.property_name_shim(val); + self.set_property_name(val); self } - #[doc = "Change the `pseudoElement` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] + #[deprecated = "Use `set_pseudo_element()` instead."] pub fn pseudo_element(&mut self, val: &str) -> &mut Self { - self.pseudo_element_shim(val); + self.set_pseudo_element(val); self } } diff --git a/crates/web-sys/src/features/gen_TreeCellInfo.rs b/crates/web-sys/src/features/gen_TreeCellInfo.rs index 6d46b866721..75327d1ee85 100644 --- a/crates/web-sys/src/features/gen_TreeCellInfo.rs +++ b/crates/web-sys/src/features/gen_TreeCellInfo.rs @@ -10,10 +10,26 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] pub type TreeCellInfo; + #[doc = "Get the `childElt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] + #[wasm_bindgen(method, getter = "childElt")] + pub fn get_child_elt(this: &TreeCellInfo) -> Option; + #[doc = "Change the `childElt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] #[wasm_bindgen(method, setter = "childElt")] - fn child_elt_shim(this: &TreeCellInfo, val: &str); + pub fn set_child_elt(this: &TreeCellInfo, val: &str); + #[doc = "Get the `row` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] + #[wasm_bindgen(method, getter = "row")] + pub fn get_row(this: &TreeCellInfo) -> Option; + #[doc = "Change the `row` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] #[wasm_bindgen(method, setter = "row")] - fn row_shim(this: &TreeCellInfo, val: i32); + pub fn set_row(this: &TreeCellInfo, val: i32); } impl TreeCellInfo { #[doc = "Construct a new `TreeCellInfo`."] @@ -24,18 +40,14 @@ impl TreeCellInfo { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `childElt` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] + #[deprecated = "Use `set_child_elt()` instead."] pub fn child_elt(&mut self, val: &str) -> &mut Self { - self.child_elt_shim(val); + self.set_child_elt(val); self } - #[doc = "Change the `row` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] + #[deprecated = "Use `set_row()` instead."] pub fn row(&mut self, val: i32) -> &mut Self { - self.row_shim(val); + self.set_row(val); self } } diff --git a/crates/web-sys/src/features/gen_U2fClientData.rs b/crates/web-sys/src/features/gen_U2fClientData.rs index e633e97f4d6..a67f45af5d5 100644 --- a/crates/web-sys/src/features/gen_U2fClientData.rs +++ b/crates/web-sys/src/features/gen_U2fClientData.rs @@ -10,12 +10,36 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] pub type U2fClientData; + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &U2fClientData) -> Option; + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, setter = "challenge")] - fn challenge_shim(this: &U2fClientData, val: &str); + pub fn set_challenge(this: &U2fClientData, val: &str); + #[doc = "Get the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[wasm_bindgen(method, getter = "origin")] + pub fn get_origin(this: &U2fClientData) -> Option; + #[doc = "Change the `origin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, setter = "origin")] - fn origin_shim(this: &U2fClientData, val: &str); + pub fn set_origin(this: &U2fClientData, val: &str); + #[doc = "Get the `typ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[wasm_bindgen(method, getter = "typ")] + pub fn get_typ(this: &U2fClientData) -> Option; + #[doc = "Change the `typ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, setter = "typ")] - fn typ_shim(this: &U2fClientData, val: &str); + pub fn set_typ(this: &U2fClientData, val: &str); } impl U2fClientData { #[doc = "Construct a new `U2fClientData`."] @@ -26,25 +50,19 @@ impl U2fClientData { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `challenge` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &str) -> &mut Self { - self.challenge_shim(val); + self.set_challenge(val); self } - #[doc = "Change the `origin` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[deprecated = "Use `set_origin()` instead."] pub fn origin(&mut self, val: &str) -> &mut Self { - self.origin_shim(val); + self.set_origin(val); self } - #[doc = "Change the `typ` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] + #[deprecated = "Use `set_typ()` instead."] pub fn typ(&mut self, val: &str) -> &mut Self { - self.typ_shim(val); + self.set_typ(val); self } } diff --git a/crates/web-sys/src/features/gen_ULongRange.rs b/crates/web-sys/src/features/gen_ULongRange.rs index f365b9378f1..acf295622ee 100644 --- a/crates/web-sys/src/features/gen_ULongRange.rs +++ b/crates/web-sys/src/features/gen_ULongRange.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ULongRange; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "max")] + pub fn get_max(this: &ULongRange) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `max` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "max")] - fn max_shim(this: &ULongRange, val: u32); + pub fn set_max(this: &ULongRange, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "min")] + pub fn get_min(this: &ULongRange) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `min` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "min")] - fn min_shim(this: &ULongRange, val: u32); + pub fn set_min(this: &ULongRange, val: u32); } #[cfg(web_sys_unstable_apis)] impl ULongRange { @@ -33,25 +65,15 @@ impl ULongRange { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `max` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_max()` instead."] pub fn max(&mut self, val: u32) -> &mut Self { - self.max_shim(val); + self.set_max(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `min` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ULongRange`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_min()` instead."] pub fn min(&mut self, val: u32) -> &mut Self { - self.min_shim(val); + self.set_min(val); self } } diff --git a/crates/web-sys/src/features/gen_UaDataValues.rs b/crates/web-sys/src/features/gen_UaDataValues.rs index bf16447c90d..02cc3e761c1 100644 --- a/crates/web-sys/src/features/gen_UaDataValues.rs +++ b/crates/web-sys/src/features/gen_UaDataValues.rs @@ -14,40 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UaDataValues; - #[wasm_bindgen(method, setter = "architecture")] - fn architecture_shim(this: &UaDataValues, val: &str); - #[wasm_bindgen(method, setter = "bitness")] - fn bitness_shim(this: &UaDataValues, val: &str); - #[wasm_bindgen(method, setter = "brands")] - fn brands_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "formFactors")] - fn form_factors_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "fullVersionList")] - fn full_version_list_shim(this: &UaDataValues, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "mobile")] - fn mobile_shim(this: &UaDataValues, val: bool); - #[wasm_bindgen(method, setter = "model")] - fn model_shim(this: &UaDataValues, val: &str); - #[wasm_bindgen(method, setter = "platform")] - fn platform_shim(this: &UaDataValues, val: &str); - #[wasm_bindgen(method, setter = "platformVersion")] - fn platform_version_shim(this: &UaDataValues, val: &str); - #[wasm_bindgen(method, setter = "wow64")] - fn wow64_shim(this: &UaDataValues, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl UaDataValues { - #[doc = "Construct a new `UaDataValues`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `architecture` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "architecture")] + pub fn get_architecture(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `architecture` field of this object."] #[doc = ""] @@ -55,10 +30,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn architecture(&mut self, val: &str) -> &mut Self { - self.architecture_shim(val); - self - } + #[wasm_bindgen(method, setter = "architecture")] + pub fn set_architecture(this: &UaDataValues, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bitness` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bitness")] + pub fn get_bitness(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bitness` field of this object."] #[doc = ""] @@ -66,10 +48,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bitness(&mut self, val: &str) -> &mut Self { - self.bitness_shim(val); - self - } + #[wasm_bindgen(method, setter = "bitness")] + pub fn set_bitness(this: &UaDataValues, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `brands` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "brands")] + pub fn get_brands(this: &UaDataValues) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `brands` field of this object."] #[doc = ""] @@ -77,10 +66,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.brands_shim(val); - self - } + #[wasm_bindgen(method, setter = "brands")] + pub fn set_brands(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `formFactors` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "formFactors")] + pub fn get_form_factors(this: &UaDataValues) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `formFactors` field of this object."] #[doc = ""] @@ -88,10 +84,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn form_factors(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.form_factors_shim(val); - self - } + #[wasm_bindgen(method, setter = "formFactors")] + pub fn set_form_factors(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `fullVersionList` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "fullVersionList")] + pub fn get_full_version_list(this: &UaDataValues) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `fullVersionList` field of this object."] #[doc = ""] @@ -99,10 +102,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn full_version_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.full_version_list_shim(val); - self - } + #[wasm_bindgen(method, setter = "fullVersionList")] + pub fn set_full_version_list(this: &UaDataValues, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mobile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mobile")] + pub fn get_mobile(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mobile` field of this object."] #[doc = ""] @@ -110,10 +120,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mobile(&mut self, val: bool) -> &mut Self { - self.mobile_shim(val); - self - } + #[wasm_bindgen(method, setter = "mobile")] + pub fn set_mobile(this: &UaDataValues, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `model` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "model")] + pub fn get_model(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `model` field of this object."] #[doc = ""] @@ -121,10 +138,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn model(&mut self, val: &str) -> &mut Self { - self.model_shim(val); - self - } + #[wasm_bindgen(method, setter = "model")] + pub fn set_model(this: &UaDataValues, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `platform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "platform")] + pub fn get_platform(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platform` field of this object."] #[doc = ""] @@ -132,10 +156,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn platform(&mut self, val: &str) -> &mut Self { - self.platform_shim(val); - self - } + #[wasm_bindgen(method, setter = "platform")] + pub fn set_platform(this: &UaDataValues, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `platformVersion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "platformVersion")] + pub fn get_platform_version(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platformVersion` field of this object."] #[doc = ""] @@ -143,10 +174,17 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn platform_version(&mut self, val: &str) -> &mut Self { - self.platform_version_shim(val); - self - } + #[wasm_bindgen(method, setter = "platformVersion")] + pub fn set_platform_version(this: &UaDataValues, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `wow64` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "wow64")] + pub fn get_wow64(this: &UaDataValues) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `wow64` field of this object."] #[doc = ""] @@ -154,8 +192,80 @@ impl UaDataValues { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "wow64")] + pub fn set_wow64(this: &UaDataValues, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl UaDataValues { + #[doc = "Construct a new `UaDataValues`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaDataValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_architecture()` instead."] + pub fn architecture(&mut self, val: &str) -> &mut Self { + self.set_architecture(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bitness()` instead."] + pub fn bitness(&mut self, val: &str) -> &mut Self { + self.set_bitness(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_brands()` instead."] + pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_brands(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_form_factors()` instead."] + pub fn form_factors(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_form_factors(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_full_version_list()` instead."] + pub fn full_version_list(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_full_version_list(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mobile()` instead."] + pub fn mobile(&mut self, val: bool) -> &mut Self { + self.set_mobile(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_model()` instead."] + pub fn model(&mut self, val: &str) -> &mut Self { + self.set_model(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_platform()` instead."] + pub fn platform(&mut self, val: &str) -> &mut Self { + self.set_platform(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_platform_version()` instead."] + pub fn platform_version(&mut self, val: &str) -> &mut Self { + self.set_platform_version(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_wow64()` instead."] pub fn wow64(&mut self, val: bool) -> &mut Self { - self.wow64_shim(val); + self.set_wow64(val); self } } diff --git a/crates/web-sys/src/features/gen_UaLowEntropyJson.rs b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs index d6c1363ff14..4a099e10946 100644 --- a/crates/web-sys/src/features/gen_UaLowEntropyJson.rs +++ b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UaLowEntropyJson; - #[wasm_bindgen(method, setter = "brands")] - fn brands_shim(this: &UaLowEntropyJson, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "mobile")] - fn mobile_shim(this: &UaLowEntropyJson, val: bool); - #[wasm_bindgen(method, setter = "platform")] - fn platform_shim(this: &UaLowEntropyJson, val: &str); -} -#[cfg(web_sys_unstable_apis)] -impl UaLowEntropyJson { - #[doc = "Construct a new `UaLowEntropyJson`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `brands` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "brands")] + pub fn get_brands(this: &UaLowEntropyJson) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `brands` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl UaLowEntropyJson { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.brands_shim(val); - self - } + #[wasm_bindgen(method, setter = "brands")] + pub fn set_brands(this: &UaLowEntropyJson, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mobile` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mobile")] + pub fn get_mobile(this: &UaLowEntropyJson) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mobile` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl UaLowEntropyJson { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn mobile(&mut self, val: bool) -> &mut Self { - self.mobile_shim(val); - self - } + #[wasm_bindgen(method, setter = "mobile")] + pub fn set_mobile(this: &UaLowEntropyJson, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `platform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "platform")] + pub fn get_platform(this: &UaLowEntropyJson) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platform` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl UaLowEntropyJson { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "platform")] + pub fn set_platform(this: &UaLowEntropyJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl UaLowEntropyJson { + #[doc = "Construct a new `UaLowEntropyJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UaLowEntropyJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_brands()` instead."] + pub fn brands(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_brands(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mobile()` instead."] + pub fn mobile(&mut self, val: bool) -> &mut Self { + self.set_mobile(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_platform()` instead."] pub fn platform(&mut self, val: &str) -> &mut Self { - self.platform_shim(val); + self.set_platform(val); self } } diff --git a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs index 201113bd26f..7d8c01cf491 100644 --- a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] pub type UdpMessageEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &UdpMessageEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &UdpMessageEventInit, val: bool); + pub fn set_bubbles(this: &UdpMessageEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &UdpMessageEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &UdpMessageEventInit, val: bool); + pub fn set_cancelable(this: &UdpMessageEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &UdpMessageEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &UdpMessageEventInit, val: bool); + pub fn set_composed(this: &UdpMessageEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &UdpMessageEventInit) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &UdpMessageEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &UdpMessageEventInit, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `remoteAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "remoteAddress")] + pub fn get_remote_address(this: &UdpMessageEventInit) -> Option; + #[doc = "Change the `remoteAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "remoteAddress")] - fn remote_address_shim(this: &UdpMessageEventInit, val: &str); + pub fn set_remote_address(this: &UdpMessageEventInit, val: &str); + #[doc = "Get the `remotePort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[wasm_bindgen(method, getter = "remotePort")] + pub fn get_remote_port(this: &UdpMessageEventInit) -> Option; + #[doc = "Change the `remotePort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, setter = "remotePort")] - fn remote_port_shim(this: &UdpMessageEventInit, val: u16); + pub fn set_remote_port(this: &UdpMessageEventInit, val: u16); } impl UdpMessageEventInit { #[doc = "Construct a new `UdpMessageEventInit`."] @@ -32,46 +80,34 @@ impl UdpMessageEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.data_shim(val); + self.set_data(val); self } - #[doc = "Change the `remoteAddress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_remote_address()` instead."] pub fn remote_address(&mut self, val: &str) -> &mut Self { - self.remote_address_shim(val); + self.set_remote_address(val); self } - #[doc = "Change the `remotePort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] + #[deprecated = "Use `set_remote_port()` instead."] pub fn remote_port(&mut self, val: u16) -> &mut Self { - self.remote_port_shim(val); + self.set_remote_port(val); self } } diff --git a/crates/web-sys/src/features/gen_UdpOptions.rs b/crates/web-sys/src/features/gen_UdpOptions.rs index f890c614629..99b8f998ea1 100644 --- a/crates/web-sys/src/features/gen_UdpOptions.rs +++ b/crates/web-sys/src/features/gen_UdpOptions.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] pub type UdpOptions; + #[doc = "Get the `addressReuse` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "addressReuse")] + pub fn get_address_reuse(this: &UdpOptions) -> Option; + #[doc = "Change the `addressReuse` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "addressReuse")] - fn address_reuse_shim(this: &UdpOptions, val: bool); + pub fn set_address_reuse(this: &UdpOptions, val: bool); + #[doc = "Get the `localAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "localAddress")] + pub fn get_local_address(this: &UdpOptions) -> Option; + #[doc = "Change the `localAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "localAddress")] - fn local_address_shim(this: &UdpOptions, val: &str); + pub fn set_local_address(this: &UdpOptions, val: &str); + #[doc = "Get the `localPort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "localPort")] + pub fn get_local_port(this: &UdpOptions) -> Option; + #[doc = "Change the `localPort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "localPort")] - fn local_port_shim(this: &UdpOptions, val: u16); + pub fn set_local_port(this: &UdpOptions, val: u16); + #[doc = "Get the `loopback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "loopback")] + pub fn get_loopback(this: &UdpOptions) -> Option; + #[doc = "Change the `loopback` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "loopback")] - fn loopback_shim(this: &UdpOptions, val: bool); + pub fn set_loopback(this: &UdpOptions, val: bool); + #[doc = "Get the `remoteAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "remoteAddress")] + pub fn get_remote_address(this: &UdpOptions) -> Option; + #[doc = "Change the `remoteAddress` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "remoteAddress")] - fn remote_address_shim(this: &UdpOptions, val: &str); + pub fn set_remote_address(this: &UdpOptions, val: &str); + #[doc = "Get the `remotePort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[wasm_bindgen(method, getter = "remotePort")] + pub fn get_remote_port(this: &UdpOptions) -> Option; + #[doc = "Change the `remotePort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, setter = "remotePort")] - fn remote_port_shim(this: &UdpOptions, val: u16); + pub fn set_remote_port(this: &UdpOptions, val: u16); } impl UdpOptions { #[doc = "Construct a new `UdpOptions`."] @@ -32,46 +80,34 @@ impl UdpOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `addressReuse` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_address_reuse()` instead."] pub fn address_reuse(&mut self, val: bool) -> &mut Self { - self.address_reuse_shim(val); + self.set_address_reuse(val); self } - #[doc = "Change the `localAddress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_local_address()` instead."] pub fn local_address(&mut self, val: &str) -> &mut Self { - self.local_address_shim(val); + self.set_local_address(val); self } - #[doc = "Change the `localPort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_local_port()` instead."] pub fn local_port(&mut self, val: u16) -> &mut Self { - self.local_port_shim(val); + self.set_local_port(val); self } - #[doc = "Change the `loopback` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_loopback()` instead."] pub fn loopback(&mut self, val: bool) -> &mut Self { - self.loopback_shim(val); + self.set_loopback(val); self } - #[doc = "Change the `remoteAddress` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_remote_address()` instead."] pub fn remote_address(&mut self, val: &str) -> &mut Self { - self.remote_address_shim(val); + self.set_remote_address(val); self } - #[doc = "Change the `remotePort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] + #[deprecated = "Use `set_remote_port()` instead."] pub fn remote_port(&mut self, val: u16) -> &mut Self { - self.remote_port_shim(val); + self.set_remote_port(val); self } } diff --git a/crates/web-sys/src/features/gen_UiEventInit.rs b/crates/web-sys/src/features/gen_UiEventInit.rs index de144f4ed4d..75bdfc8b260 100644 --- a/crates/web-sys/src/features/gen_UiEventInit.rs +++ b/crates/web-sys/src/features/gen_UiEventInit.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] pub type UiEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &UiEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &UiEventInit, val: bool); + pub fn set_bubbles(this: &UiEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &UiEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &UiEventInit, val: bool); + pub fn set_cancelable(this: &UiEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &UiEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &UiEventInit, val: bool); + pub fn set_composed(this: &UiEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &UiEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &UiEventInit, val: i32); + pub fn set_detail(this: &UiEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &UiEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UiEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &UiEventInit, val: Option<&Window>); + pub fn set_view(this: &UiEventInit, val: Option<&Window>); } impl UiEventInit { #[doc = "Construct a new `UiEventInit`."] @@ -31,40 +72,30 @@ impl UiEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UiEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UiEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } } diff --git a/crates/web-sys/src/features/gen_UnderlyingSink.rs b/crates/web-sys/src/features/gen_UnderlyingSink.rs index 458fc583361..c01268facf9 100644 --- a/crates/web-sys/src/features/gen_UnderlyingSink.rs +++ b/crates/web-sys/src/features/gen_UnderlyingSink.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] pub type UnderlyingSink; + #[doc = "Get the `abort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[wasm_bindgen(method, getter = "abort")] + pub fn get_abort(this: &UnderlyingSink) -> Option<::js_sys::Function>; + #[doc = "Change the `abort` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] #[wasm_bindgen(method, setter = "abort")] - fn abort_shim(this: &UnderlyingSink, val: &::js_sys::Function); + pub fn set_abort(this: &UnderlyingSink, val: &::js_sys::Function); + #[doc = "Get the `close` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[wasm_bindgen(method, getter = "close")] + pub fn get_close(this: &UnderlyingSink) -> Option<::js_sys::Function>; + #[doc = "Change the `close` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] #[wasm_bindgen(method, setter = "close")] - fn close_shim(this: &UnderlyingSink, val: &::js_sys::Function); + pub fn set_close(this: &UnderlyingSink, val: &::js_sys::Function); + #[doc = "Get the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[wasm_bindgen(method, getter = "start")] + pub fn get_start(this: &UnderlyingSink) -> Option<::js_sys::Function>; + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] #[wasm_bindgen(method, setter = "start")] - fn start_shim(this: &UnderlyingSink, val: &::js_sys::Function); + pub fn set_start(this: &UnderlyingSink, val: &::js_sys::Function); + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &UnderlyingSink) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &UnderlyingSink, val: &::wasm_bindgen::JsValue); + pub fn set_type(this: &UnderlyingSink, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[wasm_bindgen(method, getter = "write")] + pub fn get_write(this: &UnderlyingSink) -> Option<::js_sys::Function>; + #[doc = "Change the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] #[wasm_bindgen(method, setter = "write")] - fn write_shim(this: &UnderlyingSink, val: &::js_sys::Function); + pub fn set_write(this: &UnderlyingSink, val: &::js_sys::Function); } impl UnderlyingSink { #[doc = "Construct a new `UnderlyingSink`."] @@ -30,39 +70,29 @@ impl UnderlyingSink { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `abort` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[deprecated = "Use `set_abort()` instead."] pub fn abort(&mut self, val: &::js_sys::Function) -> &mut Self { - self.abort_shim(val); + self.set_abort(val); self } - #[doc = "Change the `close` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[deprecated = "Use `set_close()` instead."] pub fn close(&mut self, val: &::js_sys::Function) -> &mut Self { - self.close_shim(val); + self.set_close(val); self } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[deprecated = "Use `set_start()` instead."] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - self.start_shim(val); + self.set_start(val); self } - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } - #[doc = "Change the `write` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSink`*"] + #[deprecated = "Use `set_write()` instead."] pub fn write(&mut self, val: &::js_sys::Function) -> &mut Self { - self.write_shim(val); + self.set_write(val); self } } diff --git a/crates/web-sys/src/features/gen_UnderlyingSource.rs b/crates/web-sys/src/features/gen_UnderlyingSource.rs index 99efecb0e14..c1da8cc9c1d 100644 --- a/crates/web-sys/src/features/gen_UnderlyingSource.rs +++ b/crates/web-sys/src/features/gen_UnderlyingSource.rs @@ -10,17 +10,58 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] pub type UnderlyingSource; + #[doc = "Get the `autoAllocateChunkSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[wasm_bindgen(method, getter = "autoAllocateChunkSize")] + pub fn get_auto_allocate_chunk_size(this: &UnderlyingSource) -> Option; + #[doc = "Change the `autoAllocateChunkSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] #[wasm_bindgen(method, setter = "autoAllocateChunkSize")] - fn auto_allocate_chunk_size_shim(this: &UnderlyingSource, val: f64); + pub fn set_auto_allocate_chunk_size(this: &UnderlyingSource, val: f64); + #[doc = "Get the `cancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[wasm_bindgen(method, getter = "cancel")] + pub fn get_cancel(this: &UnderlyingSource) -> Option<::js_sys::Function>; + #[doc = "Change the `cancel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] #[wasm_bindgen(method, setter = "cancel")] - fn cancel_shim(this: &UnderlyingSource, val: &::js_sys::Function); + pub fn set_cancel(this: &UnderlyingSource, val: &::js_sys::Function); + #[doc = "Get the `pull` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[wasm_bindgen(method, getter = "pull")] + pub fn get_pull(this: &UnderlyingSource) -> Option<::js_sys::Function>; + #[doc = "Change the `pull` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] #[wasm_bindgen(method, setter = "pull")] - fn pull_shim(this: &UnderlyingSource, val: &::js_sys::Function); + pub fn set_pull(this: &UnderlyingSource, val: &::js_sys::Function); + #[doc = "Get the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[wasm_bindgen(method, getter = "start")] + pub fn get_start(this: &UnderlyingSource) -> Option<::js_sys::Function>; + #[doc = "Change the `start` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] #[wasm_bindgen(method, setter = "start")] - fn start_shim(this: &UnderlyingSource, val: &::js_sys::Function); + pub fn set_start(this: &UnderlyingSource, val: &::js_sys::Function); #[cfg(feature = "ReadableStreamType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &UnderlyingSource) -> Option; + #[cfg(feature = "ReadableStreamType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &UnderlyingSource, val: ReadableStreamType); + pub fn set_type(this: &UnderlyingSource, val: ReadableStreamType); } impl UnderlyingSource { #[doc = "Construct a new `UnderlyingSource`."] @@ -31,40 +72,30 @@ impl UnderlyingSource { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `autoAllocateChunkSize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[deprecated = "Use `set_auto_allocate_chunk_size()` instead."] pub fn auto_allocate_chunk_size(&mut self, val: f64) -> &mut Self { - self.auto_allocate_chunk_size_shim(val); + self.set_auto_allocate_chunk_size(val); self } - #[doc = "Change the `cancel` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[deprecated = "Use `set_cancel()` instead."] pub fn cancel(&mut self, val: &::js_sys::Function) -> &mut Self { - self.cancel_shim(val); + self.set_cancel(val); self } - #[doc = "Change the `pull` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[deprecated = "Use `set_pull()` instead."] pub fn pull(&mut self, val: &::js_sys::Function) -> &mut Self { - self.pull_shim(val); + self.set_pull(val); self } - #[doc = "Change the `start` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UnderlyingSource`*"] + #[deprecated = "Use `set_start()` instead."] pub fn start(&mut self, val: &::js_sys::Function) -> &mut Self { - self.start_shim(val); + self.set_start(val); self } #[cfg(feature = "ReadableStreamType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ReadableStreamType`, `UnderlyingSource`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: ReadableStreamType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs index 5bcbff99c6d..0e7b327a5a1 100644 --- a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbConnectionEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &UsbConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &UsbConnectionEventInit, val: bool); + pub fn set_bubbles(this: &UsbConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &UsbConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &UsbConnectionEventInit, val: bool); + pub fn set_cancelable(this: &UsbConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &UsbConnectionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &UsbConnectionEventInit, val: bool); + pub fn set_composed(this: &UsbConnectionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbDevice")] + #[doc = "Get the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`, `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "device")] + pub fn get_device(this: &UsbConnectionEventInit) -> UsbDevice; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbDevice")] + #[doc = "Change the `device` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`, `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "device")] - fn device_shim(this: &UsbConnectionEventInit, val: &UsbDevice); + pub fn set_device(this: &UsbConnectionEventInit, val: &UsbDevice); } #[cfg(web_sys_unstable_apis)] impl UsbConnectionEventInit { @@ -40,48 +105,28 @@ impl UsbConnectionEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbDevice")] - #[doc = "Change the `device` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbConnectionEventInit`, `UsbDevice`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_device()` instead."] pub fn device(&mut self, val: &UsbDevice) -> &mut Self { - self.device_shim(val); + self.set_device(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs index 99a413d2354..0c8c87d3cb8 100644 --- a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs +++ b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs @@ -14,18 +14,100 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbControlTransferParameters; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `index` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "index")] + pub fn get_index(this: &UsbControlTransferParameters) -> u16; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `index` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "index")] - fn index_shim(this: &UsbControlTransferParameters, val: u16); + pub fn set_index(this: &UsbControlTransferParameters, val: u16); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbRecipient")] + #[doc = "Get the `recipient` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "recipient")] + pub fn get_recipient(this: &UsbControlTransferParameters) -> UsbRecipient; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbRecipient")] + #[doc = "Change the `recipient` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "recipient")] - fn recipient_shim(this: &UsbControlTransferParameters, val: UsbRecipient); + pub fn set_recipient(this: &UsbControlTransferParameters, val: UsbRecipient); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "request")] + pub fn get_request(this: &UsbControlTransferParameters) -> u8; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `request` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "request")] - fn request_shim(this: &UsbControlTransferParameters, val: u8); + pub fn set_request(this: &UsbControlTransferParameters, val: u8); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbRequestType")] + #[doc = "Get the `requestType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRequestType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requestType")] + pub fn get_request_type(this: &UsbControlTransferParameters) -> UsbRequestType; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbRequestType")] + #[doc = "Change the `requestType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRequestType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "requestType")] - fn request_type_shim(this: &UsbControlTransferParameters, val: UsbRequestType); + pub fn set_request_type(this: &UsbControlTransferParameters, val: UsbRequestType); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &UsbControlTransferParameters) -> u16; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &UsbControlTransferParameters, val: u16); + pub fn set_value(this: &UsbControlTransferParameters, val: u16); } #[cfg(web_sys_unstable_apis)] impl UsbControlTransferParameters { @@ -53,60 +135,35 @@ impl UsbControlTransferParameters { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `index` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_index()` instead."] pub fn index(&mut self, val: u16) -> &mut Self { - self.index_shim(val); + self.set_index(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbRecipient")] - #[doc = "Change the `recipient` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_recipient()` instead."] pub fn recipient(&mut self, val: UsbRecipient) -> &mut Self { - self.recipient_shim(val); + self.set_recipient(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `request` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_request()` instead."] pub fn request(&mut self, val: u8) -> &mut Self { - self.request_shim(val); + self.set_request(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbRequestType")] - #[doc = "Change the `requestType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRequestType`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_request_type()` instead."] pub fn request_type(&mut self, val: UsbRequestType) -> &mut Self { - self.request_type_shim(val); + self.set_request_type(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: u16) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs index 1dcc503db30..411a66a560b 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs @@ -14,32 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbDeviceFilter; - #[wasm_bindgen(method, setter = "classCode")] - fn class_code_shim(this: &UsbDeviceFilter, val: u8); - #[wasm_bindgen(method, setter = "productId")] - fn product_id_shim(this: &UsbDeviceFilter, val: u16); - #[wasm_bindgen(method, setter = "protocolCode")] - fn protocol_code_shim(this: &UsbDeviceFilter, val: u8); - #[wasm_bindgen(method, setter = "serialNumber")] - fn serial_number_shim(this: &UsbDeviceFilter, val: &str); - #[wasm_bindgen(method, setter = "subclassCode")] - fn subclass_code_shim(this: &UsbDeviceFilter, val: u8); - #[wasm_bindgen(method, setter = "vendorId")] - fn vendor_id_shim(this: &UsbDeviceFilter, val: u16); -} -#[cfg(web_sys_unstable_apis)] -impl UsbDeviceFilter { - #[doc = "Construct a new `UsbDeviceFilter`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `classCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "classCode")] + pub fn get_class_code(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `classCode` field of this object."] #[doc = ""] @@ -47,10 +30,17 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn class_code(&mut self, val: u8) -> &mut Self { - self.class_code_shim(val); - self - } + #[wasm_bindgen(method, setter = "classCode")] + pub fn set_class_code(this: &UsbDeviceFilter, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `productId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "productId")] + pub fn get_product_id(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `productId` field of this object."] #[doc = ""] @@ -58,10 +48,17 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn product_id(&mut self, val: u16) -> &mut Self { - self.product_id_shim(val); - self - } + #[wasm_bindgen(method, setter = "productId")] + pub fn set_product_id(this: &UsbDeviceFilter, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `protocolCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "protocolCode")] + pub fn get_protocol_code(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `protocolCode` field of this object."] #[doc = ""] @@ -69,10 +66,17 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn protocol_code(&mut self, val: u8) -> &mut Self { - self.protocol_code_shim(val); - self - } + #[wasm_bindgen(method, setter = "protocolCode")] + pub fn set_protocol_code(this: &UsbDeviceFilter, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `serialNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "serialNumber")] + pub fn get_serial_number(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `serialNumber` field of this object."] #[doc = ""] @@ -80,10 +84,17 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn serial_number(&mut self, val: &str) -> &mut Self { - self.serial_number_shim(val); - self - } + #[wasm_bindgen(method, setter = "serialNumber")] + pub fn set_serial_number(this: &UsbDeviceFilter, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `subclassCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "subclassCode")] + pub fn get_subclass_code(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `subclassCode` field of this object."] #[doc = ""] @@ -91,10 +102,17 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn subclass_code(&mut self, val: u8) -> &mut Self { - self.subclass_code_shim(val); - self - } + #[wasm_bindgen(method, setter = "subclassCode")] + pub fn set_subclass_code(this: &UsbDeviceFilter, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `vendorId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "vendorId")] + pub fn get_vendor_id(this: &UsbDeviceFilter) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `vendorId` field of this object."] #[doc = ""] @@ -102,8 +120,56 @@ impl UsbDeviceFilter { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "vendorId")] + pub fn set_vendor_id(this: &UsbDeviceFilter, val: u16); +} +#[cfg(web_sys_unstable_apis)] +impl UsbDeviceFilter { + #[doc = "Construct a new `UsbDeviceFilter`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_class_code()` instead."] + pub fn class_code(&mut self, val: u8) -> &mut Self { + self.set_class_code(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_product_id()` instead."] + pub fn product_id(&mut self, val: u16) -> &mut Self { + self.set_product_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_protocol_code()` instead."] + pub fn protocol_code(&mut self, val: u8) -> &mut Self { + self.set_protocol_code(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_serial_number()` instead."] + pub fn serial_number(&mut self, val: &str) -> &mut Self { + self.set_serial_number(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_subclass_code()` instead."] + pub fn subclass_code(&mut self, val: u8) -> &mut Self { + self.set_subclass_code(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_vendor_id()` instead."] pub fn vendor_id(&mut self, val: u16) -> &mut Self { - self.vendor_id_shim(val); + self.set_vendor_id(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs index 7d05fe0b907..b35430fc377 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbDeviceRequestOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &UsbDeviceRequestOptions) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDeviceRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &UsbDeviceRequestOptions, val: &::wasm_bindgen::JsValue); + pub fn set_filters(this: &UsbDeviceRequestOptions, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbDeviceRequestOptions { @@ -32,14 +48,9 @@ impl UsbDeviceRequestOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `filters` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbDeviceRequestOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_filters()` instead."] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); + self.set_filters(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs index 5688bc47d1f..7240f61781f 100644 --- a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &UsbPermissionDescriptor) -> PermissionName; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &UsbPermissionDescriptor, val: PermissionName); + pub fn set_name(this: &UsbPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "filters")] + pub fn get_filters(this: &UsbPermissionDescriptor) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `filters` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "filters")] - fn filters_shim(this: &UsbPermissionDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_filters(this: &UsbPermissionDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbPermissionDescriptor { @@ -37,25 +70,15 @@ impl UsbPermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `filters` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_filters()` instead."] pub fn filters(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.filters_shim(val); + self.set_filters(val); self } } diff --git a/crates/web-sys/src/features/gen_UsbPermissionStorage.rs b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs index 7fee5379ed9..7c99dd15666 100644 --- a/crates/web-sys/src/features/gen_UsbPermissionStorage.rs +++ b/crates/web-sys/src/features/gen_UsbPermissionStorage.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type UsbPermissionStorage; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowedDevices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionStorage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "allowedDevices")] + pub fn get_allowed_devices(this: &UsbPermissionStorage) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowedDevices` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbPermissionStorage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "allowedDevices")] - fn allowed_devices_shim(this: &UsbPermissionStorage, val: &::wasm_bindgen::JsValue); + pub fn set_allowed_devices(this: &UsbPermissionStorage, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl UsbPermissionStorage { @@ -31,14 +47,9 @@ impl UsbPermissionStorage { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `allowedDevices` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UsbPermissionStorage`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_allowed_devices()` instead."] pub fn allowed_devices(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.allowed_devices_shim(val); + self.set_allowed_devices(val); self } } diff --git a/crates/web-sys/src/features/gen_UserProximityEventInit.rs b/crates/web-sys/src/features/gen_UserProximityEventInit.rs index 7ab52a377c8..717e8354c82 100644 --- a/crates/web-sys/src/features/gen_UserProximityEventInit.rs +++ b/crates/web-sys/src/features/gen_UserProximityEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] pub type UserProximityEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &UserProximityEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &UserProximityEventInit, val: bool); + pub fn set_bubbles(this: &UserProximityEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &UserProximityEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &UserProximityEventInit, val: bool); + pub fn set_cancelable(this: &UserProximityEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &UserProximityEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &UserProximityEventInit, val: bool); + pub fn set_composed(this: &UserProximityEventInit, val: bool); + #[doc = "Get the `near` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[wasm_bindgen(method, getter = "near")] + pub fn get_near(this: &UserProximityEventInit) -> Option; + #[doc = "Change the `near` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] #[wasm_bindgen(method, setter = "near")] - fn near_shim(this: &UserProximityEventInit, val: bool); + pub fn set_near(this: &UserProximityEventInit, val: bool); } impl UserProximityEventInit { #[doc = "Construct a new `UserProximityEventInit`."] @@ -28,32 +60,24 @@ impl UserProximityEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `near` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `UserProximityEventInit`*"] + #[deprecated = "Use `set_near()` instead."] pub fn near(&mut self, val: bool) -> &mut Self { - self.near_shim(val); + self.set_near(val); self } } diff --git a/crates/web-sys/src/features/gen_ValueEventInit.rs b/crates/web-sys/src/features/gen_ValueEventInit.rs index 0e095a187a1..493a9f39cb0 100644 --- a/crates/web-sys/src/features/gen_ValueEventInit.rs +++ b/crates/web-sys/src/features/gen_ValueEventInit.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type ValueEventInit; - #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &ValueEventInit, val: bool); - #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &ValueEventInit, val: bool); - #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &ValueEventInit, val: bool); - #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &ValueEventInit, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl ValueEventInit { - #[doc = "Construct a new `ValueEventInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ValueEventInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ValueEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bubbles` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl ValueEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); - self - } + #[wasm_bindgen(method, setter = "bubbles")] + pub fn set_bubbles(this: &ValueEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ValueEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ValueEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `cancelable` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl ValueEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); - self - } + #[wasm_bindgen(method, setter = "cancelable")] + pub fn set_cancelable(this: &ValueEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ValueEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ValueEventInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `composed` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl ValueEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); - self - } + #[wasm_bindgen(method, setter = "composed")] + pub fn set_composed(this: &ValueEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ValueEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &ValueEventInit) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `value` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl ValueEventInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "value")] + pub fn set_value(this: &ValueEventInit, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl ValueEventInit { + #[doc = "Construct a new `ValueEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ValueEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bubbles()` instead."] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + self.set_bubbles(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_cancelable()` instead."] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + self.set_cancelable(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_composed()` instead."] + pub fn composed(&mut self, val: bool) -> &mut Self { + self.set_composed(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs b/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs index e2615680a89..fbf7cd1bc19 100644 --- a/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs +++ b/crates/web-sys/src/features/gen_VideoColorSpaceInit.rs @@ -14,17 +14,84 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoColorSpaceInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `fullRange` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "fullRange")] + pub fn get_full_range(this: &VideoColorSpaceInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `fullRange` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "fullRange")] - fn full_range_shim(this: &VideoColorSpaceInit, val: bool); + pub fn set_full_range(this: &VideoColorSpaceInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoMatrixCoefficients")] + #[doc = "Get the `matrix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoMatrixCoefficients`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "matrix")] + pub fn get_matrix(this: &VideoColorSpaceInit) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoMatrixCoefficients")] + #[doc = "Change the `matrix` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoMatrixCoefficients`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "matrix")] - fn matrix_shim(this: &VideoColorSpaceInit, val: VideoMatrixCoefficients); + pub fn set_matrix(this: &VideoColorSpaceInit, val: VideoMatrixCoefficients); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoColorPrimaries")] + #[doc = "Get the `primaries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorPrimaries`, `VideoColorSpaceInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "primaries")] + pub fn get_primaries(this: &VideoColorSpaceInit) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoColorPrimaries")] + #[doc = "Change the `primaries` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorPrimaries`, `VideoColorSpaceInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "primaries")] - fn primaries_shim(this: &VideoColorSpaceInit, val: VideoColorPrimaries); + pub fn set_primaries(this: &VideoColorSpaceInit, val: VideoColorPrimaries); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoTransferCharacteristics")] + #[doc = "Get the `transfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoTransferCharacteristics`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "transfer")] + pub fn get_transfer(this: &VideoColorSpaceInit) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoTransferCharacteristics")] + #[doc = "Change the `transfer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoTransferCharacteristics`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "transfer")] - fn transfer_shim(this: &VideoColorSpaceInit, val: VideoTransferCharacteristics); + pub fn set_transfer(this: &VideoColorSpaceInit, val: VideoTransferCharacteristics); } #[cfg(web_sys_unstable_apis)] impl VideoColorSpaceInit { @@ -40,50 +107,30 @@ impl VideoColorSpaceInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `fullRange` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_full_range()` instead."] pub fn full_range(&mut self, val: bool) -> &mut Self { - self.full_range_shim(val); + self.set_full_range(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoMatrixCoefficients")] - #[doc = "Change the `matrix` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoMatrixCoefficients`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_matrix()` instead."] pub fn matrix(&mut self, val: VideoMatrixCoefficients) -> &mut Self { - self.matrix_shim(val); + self.set_matrix(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoColorPrimaries")] - #[doc = "Change the `primaries` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoColorPrimaries`, `VideoColorSpaceInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_primaries()` instead."] pub fn primaries(&mut self, val: VideoColorPrimaries) -> &mut Self { - self.primaries_shim(val); + self.set_primaries(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoTransferCharacteristics")] - #[doc = "Change the `transfer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoTransferCharacteristics`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_transfer()` instead."] pub fn transfer(&mut self, val: VideoTransferCharacteristics) -> &mut Self { - self.transfer_shim(val); + self.set_transfer(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoConfiguration.rs b/crates/web-sys/src/features/gen_VideoConfiguration.rs index e3ec5697201..d6467cf6b20 100644 --- a/crates/web-sys/src/features/gen_VideoConfiguration.rs +++ b/crates/web-sys/src/features/gen_VideoConfiguration.rs @@ -10,16 +10,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] pub type VideoConfiguration; + #[doc = "Get the `bitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "bitrate")] + pub fn get_bitrate(this: &VideoConfiguration) -> Option; + #[doc = "Change the `bitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "bitrate")] - fn bitrate_shim(this: &VideoConfiguration, val: f64); + pub fn set_bitrate(this: &VideoConfiguration, val: f64); + #[doc = "Get the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "contentType")] + pub fn get_content_type(this: &VideoConfiguration) -> Option; + #[doc = "Change the `contentType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "contentType")] - fn content_type_shim(this: &VideoConfiguration, val: &str); + pub fn set_content_type(this: &VideoConfiguration, val: &str); + #[doc = "Get the `framerate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "framerate")] + pub fn get_framerate(this: &VideoConfiguration) -> Option; + #[doc = "Change the `framerate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "framerate")] - fn framerate_shim(this: &VideoConfiguration, val: &str); + pub fn set_framerate(this: &VideoConfiguration, val: &str); + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &VideoConfiguration) -> Option; + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &VideoConfiguration, val: u32); + pub fn set_height(this: &VideoConfiguration, val: u32); + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &VideoConfiguration) -> Option; + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &VideoConfiguration, val: u32); + pub fn set_width(this: &VideoConfiguration, val: u32); } impl VideoConfiguration { #[doc = "Construct a new `VideoConfiguration`."] @@ -30,39 +70,29 @@ impl VideoConfiguration { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bitrate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[deprecated = "Use `set_bitrate()` instead."] pub fn bitrate(&mut self, val: f64) -> &mut Self { - self.bitrate_shim(val); + self.set_bitrate(val); self } - #[doc = "Change the `contentType` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[deprecated = "Use `set_content_type()` instead."] pub fn content_type(&mut self, val: &str) -> &mut Self { - self.content_type_shim(val); + self.set_content_type(val); self } - #[doc = "Change the `framerate` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[deprecated = "Use `set_framerate()` instead."] pub fn framerate(&mut self, val: &str) -> &mut Self { - self.framerate_shim(val); + self.set_framerate(val); self } - #[doc = "Change the `height` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[deprecated = "Use `set_height()` instead."] pub fn height(&mut self, val: u32) -> &mut Self { - self.height_shim(val); + self.set_height(val); self } - #[doc = "Change the `width` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: u32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs index 6dba5389dd5..44c205a0984 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs @@ -14,41 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderConfig; - #[wasm_bindgen(method, setter = "codec")] - fn codec_shim(this: &VideoDecoderConfig, val: &str); - #[wasm_bindgen(method, setter = "codedHeight")] - fn coded_height_shim(this: &VideoDecoderConfig, val: u32); - #[wasm_bindgen(method, setter = "codedWidth")] - fn coded_width_shim(this: &VideoDecoderConfig, val: u32); - #[cfg(feature = "VideoColorSpaceInit")] - #[wasm_bindgen(method, setter = "colorSpace")] - fn color_space_shim(this: &VideoDecoderConfig, val: &VideoColorSpaceInit); - #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &VideoDecoderConfig, val: &::js_sys::Object); - #[wasm_bindgen(method, setter = "displayAspectHeight")] - fn display_aspect_height_shim(this: &VideoDecoderConfig, val: u32); - #[wasm_bindgen(method, setter = "displayAspectWidth")] - fn display_aspect_width_shim(this: &VideoDecoderConfig, val: u32); - #[cfg(feature = "HardwareAcceleration")] - #[wasm_bindgen(method, setter = "hardwareAcceleration")] - fn hardware_acceleration_shim(this: &VideoDecoderConfig, val: HardwareAcceleration); - #[wasm_bindgen(method, setter = "optimizeForLatency")] - fn optimize_for_latency_shim(this: &VideoDecoderConfig, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl VideoDecoderConfig { - #[doc = "Construct a new `VideoDecoderConfig`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codec` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(codec: &str) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); - ret - } + #[wasm_bindgen(method, getter = "codec")] + pub fn get_codec(this: &VideoDecoderConfig) -> String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] @@ -56,10 +30,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn codec(&mut self, val: &str) -> &mut Self { - self.codec_shim(val); - self - } + #[wasm_bindgen(method, setter = "codec")] + pub fn set_codec(this: &VideoDecoderConfig, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codedHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codedHeight")] + pub fn get_coded_height(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codedHeight` field of this object."] #[doc = ""] @@ -67,10 +48,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn coded_height(&mut self, val: u32) -> &mut Self { - self.coded_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "codedHeight")] + pub fn set_coded_height(this: &VideoDecoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codedWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codedWidth")] + pub fn get_coded_width(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codedWidth` field of this object."] #[doc = ""] @@ -78,10 +66,18 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn coded_width(&mut self, val: u32) -> &mut Self { - self.coded_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "codedWidth")] + pub fn set_coded_width(this: &VideoDecoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoColorSpaceInit")] + #[doc = "Get the `colorSpace` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "colorSpace")] + pub fn get_color_space(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoColorSpaceInit")] #[doc = "Change the `colorSpace` field of this object."] @@ -90,10 +86,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { - self.color_space_shim(val); - self - } + #[wasm_bindgen(method, setter = "colorSpace")] + pub fn set_color_space(this: &VideoDecoderConfig, val: &VideoColorSpaceInit); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &VideoDecoderConfig) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `description` field of this object."] #[doc = ""] @@ -101,10 +104,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self { - self.description_shim(val); - self - } + #[wasm_bindgen(method, setter = "description")] + pub fn set_description(this: &VideoDecoderConfig, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayAspectHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayAspectHeight")] + pub fn get_display_aspect_height(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayAspectHeight` field of this object."] #[doc = ""] @@ -112,10 +122,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_aspect_height(&mut self, val: u32) -> &mut Self { - self.display_aspect_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayAspectHeight")] + pub fn set_display_aspect_height(this: &VideoDecoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayAspectWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayAspectWidth")] + pub fn get_display_aspect_width(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayAspectWidth` field of this object."] #[doc = ""] @@ -123,10 +140,18 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_aspect_width(&mut self, val: u32) -> &mut Self { - self.display_aspect_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayAspectWidth")] + pub fn set_display_aspect_width(this: &VideoDecoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HardwareAcceleration")] + #[doc = "Get the `hardwareAcceleration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HardwareAcceleration`, `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hardwareAcceleration")] + pub fn get_hardware_acceleration(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HardwareAcceleration")] #[doc = "Change the `hardwareAcceleration` field of this object."] @@ -135,10 +160,17 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { - self.hardware_acceleration_shim(val); - self - } + #[wasm_bindgen(method, setter = "hardwareAcceleration")] + pub fn set_hardware_acceleration(this: &VideoDecoderConfig, val: HardwareAcceleration); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `optimizeForLatency` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "optimizeForLatency")] + pub fn get_optimize_for_latency(this: &VideoDecoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `optimizeForLatency` field of this object."] #[doc = ""] @@ -146,8 +178,77 @@ impl VideoDecoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "optimizeForLatency")] + pub fn set_optimize_for_latency(this: &VideoDecoderConfig, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl VideoDecoderConfig { + #[doc = "Construct a new `VideoDecoderConfig`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(codec: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.codec(codec); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_codec()` instead."] + pub fn codec(&mut self, val: &str) -> &mut Self { + self.set_codec(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_coded_height()` instead."] + pub fn coded_height(&mut self, val: u32) -> &mut Self { + self.set_coded_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_coded_width()` instead."] + pub fn coded_width(&mut self, val: u32) -> &mut Self { + self.set_coded_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoColorSpaceInit")] + #[deprecated = "Use `set_color_space()` instead."] + pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { + self.set_color_space(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_description()` instead."] + pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_description(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_aspect_height()` instead."] + pub fn display_aspect_height(&mut self, val: u32) -> &mut Self { + self.set_display_aspect_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_aspect_width()` instead."] + pub fn display_aspect_width(&mut self, val: u32) -> &mut Self { + self.set_display_aspect_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HardwareAcceleration")] + #[deprecated = "Use `set_hardware_acceleration()` instead."] + pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { + self.set_hardware_acceleration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_optimize_for_latency()` instead."] pub fn optimize_for_latency(&mut self, val: bool) -> &mut Self { - self.optimize_for_latency_shim(val); + self.set_optimize_for_latency(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderInit.rs b/crates/web-sys/src/features/gen_VideoDecoderInit.rs index a4b15fb60ba..19413cd55ab 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &VideoDecoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &VideoDecoderInit, val: &::js_sys::Function); + pub fn set_error(this: &VideoDecoderInit, val: &::js_sys::Function); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "output")] + pub fn get_output(this: &VideoDecoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "output")] - fn output_shim(this: &VideoDecoderInit, val: &::js_sys::Function); + pub fn set_output(this: &VideoDecoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl VideoDecoderInit { @@ -35,25 +67,15 @@ impl VideoDecoderInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `output` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoDecoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_output()` instead."] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - self.output_shim(val); + self.set_output(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoDecoderSupport.rs b/crates/web-sys/src/features/gen_VideoDecoderSupport.rs index 25c91ef0900..74356620b90 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderSupport.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderSupport.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoDecoderSupport; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoDecoderConfig")] + #[doc = "Get the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`, `VideoDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "config")] + pub fn get_config(this: &VideoDecoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoDecoderConfig")] + #[doc = "Change the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`, `VideoDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "config")] - fn config_shim(this: &VideoDecoderSupport, val: &VideoDecoderConfig); + pub fn set_config(this: &VideoDecoderSupport, val: &VideoDecoderConfig); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "supported")] + pub fn get_supported(this: &VideoDecoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoDecoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "supported")] - fn supported_shim(this: &VideoDecoderSupport, val: bool); + pub fn set_supported(this: &VideoDecoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoDecoderSupport { @@ -35,25 +68,15 @@ impl VideoDecoderSupport { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoDecoderConfig")] - #[doc = "Change the `config` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoDecoderConfig`, `VideoDecoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_config()` instead."] pub fn config(&mut self, val: &VideoDecoderConfig) -> &mut Self { - self.config_shim(val); + self.set_config(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `supported` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoDecoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_supported()` instead."] pub fn supported(&mut self, val: bool) -> &mut Self { - self.supported_shim(val); + self.set_supported(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs index e546329b66e..b497f718d8b 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs @@ -14,48 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderConfig; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AlphaOption")] - #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &VideoEncoderConfig, val: AlphaOption); - #[wasm_bindgen(method, setter = "bitrate")] - fn bitrate_shim(this: &VideoEncoderConfig, val: f64); - #[wasm_bindgen(method, setter = "codec")] - fn codec_shim(this: &VideoEncoderConfig, val: &str); - #[wasm_bindgen(method, setter = "displayHeight")] - fn display_height_shim(this: &VideoEncoderConfig, val: u32); - #[wasm_bindgen(method, setter = "displayWidth")] - fn display_width_shim(this: &VideoEncoderConfig, val: u32); - #[wasm_bindgen(method, setter = "framerate")] - fn framerate_shim(this: &VideoEncoderConfig, val: f64); - #[cfg(feature = "HardwareAcceleration")] - #[wasm_bindgen(method, setter = "hardwareAcceleration")] - fn hardware_acceleration_shim(this: &VideoEncoderConfig, val: HardwareAcceleration); - #[wasm_bindgen(method, setter = "height")] - fn height_shim(this: &VideoEncoderConfig, val: u32); - #[cfg(feature = "LatencyMode")] - #[wasm_bindgen(method, setter = "latencyMode")] - fn latency_mode_shim(this: &VideoEncoderConfig, val: LatencyMode); - #[wasm_bindgen(method, setter = "scalabilityMode")] - fn scalability_mode_shim(this: &VideoEncoderConfig, val: &str); - #[wasm_bindgen(method, setter = "width")] - fn width_shim(this: &VideoEncoderConfig, val: u32); -} -#[cfg(web_sys_unstable_apis)] -impl VideoEncoderConfig { - #[doc = "Construct a new `VideoEncoderConfig`."] + #[doc = "Get the `alpha` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = "*This API requires the following crate features to be activated: `AlphaOption`, `VideoEncoderConfig`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(codec: &str, height: u32, width: u32) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); - ret.height(height); - ret.width(width); - ret - } + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AlphaOption")] #[doc = "Change the `alpha` field of this object."] @@ -64,10 +32,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { - self.alpha_shim(val); - self - } + #[wasm_bindgen(method, setter = "alpha")] + pub fn set_alpha(this: &VideoEncoderConfig, val: AlphaOption); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bitrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bitrate")] + pub fn get_bitrate(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bitrate` field of this object."] #[doc = ""] @@ -75,10 +50,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bitrate(&mut self, val: f64) -> &mut Self { - self.bitrate_shim(val); - self - } + #[wasm_bindgen(method, setter = "bitrate")] + pub fn set_bitrate(this: &VideoEncoderConfig, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codec")] + pub fn get_codec(this: &VideoEncoderConfig) -> String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] @@ -86,10 +68,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn codec(&mut self, val: &str) -> &mut Self { - self.codec_shim(val); - self - } + #[wasm_bindgen(method, setter = "codec")] + pub fn set_codec(this: &VideoEncoderConfig, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayHeight")] + pub fn get_display_height(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayHeight` field of this object."] #[doc = ""] @@ -97,10 +86,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_height(&mut self, val: u32) -> &mut Self { - self.display_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayHeight")] + pub fn set_display_height(this: &VideoEncoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayWidth")] + pub fn get_display_width(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayWidth` field of this object."] #[doc = ""] @@ -108,10 +104,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_width(&mut self, val: u32) -> &mut Self { - self.display_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayWidth")] + pub fn set_display_width(this: &VideoEncoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `framerate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "framerate")] + pub fn get_framerate(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `framerate` field of this object."] #[doc = ""] @@ -119,10 +122,18 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn framerate(&mut self, val: f64) -> &mut Self { - self.framerate_shim(val); - self - } + #[wasm_bindgen(method, setter = "framerate")] + pub fn set_framerate(this: &VideoEncoderConfig, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HardwareAcceleration")] + #[doc = "Get the `hardwareAcceleration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HardwareAcceleration`, `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hardwareAcceleration")] + pub fn get_hardware_acceleration(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "HardwareAcceleration")] #[doc = "Change the `hardwareAcceleration` field of this object."] @@ -131,10 +142,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { - self.hardware_acceleration_shim(val); - self - } + #[wasm_bindgen(method, setter = "hardwareAcceleration")] + pub fn set_hardware_acceleration(this: &VideoEncoderConfig, val: HardwareAcceleration); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &VideoEncoderConfig) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `height` field of this object."] #[doc = ""] @@ -142,10 +160,18 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn height(&mut self, val: u32) -> &mut Self { - self.height_shim(val); - self - } + #[wasm_bindgen(method, setter = "height")] + pub fn set_height(this: &VideoEncoderConfig, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LatencyMode")] + #[doc = "Get the `latencyMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `LatencyMode`, `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "latencyMode")] + pub fn get_latency_mode(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "LatencyMode")] #[doc = "Change the `latencyMode` field of this object."] @@ -154,10 +180,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn latency_mode(&mut self, val: LatencyMode) -> &mut Self { - self.latency_mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "latencyMode")] + pub fn set_latency_mode(this: &VideoEncoderConfig, val: LatencyMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "scalabilityMode")] + pub fn get_scalability_mode(this: &VideoEncoderConfig) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `scalabilityMode` field of this object."] #[doc = ""] @@ -165,10 +198,17 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn scalability_mode(&mut self, val: &str) -> &mut Self { - self.scalability_mode_shim(val); - self - } + #[wasm_bindgen(method, setter = "scalabilityMode")] + pub fn set_scalability_mode(this: &VideoEncoderConfig, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &VideoEncoderConfig) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `width` field of this object."] #[doc = ""] @@ -176,8 +216,92 @@ impl VideoEncoderConfig { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "width")] + pub fn set_width(this: &VideoEncoderConfig, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl VideoEncoderConfig { + #[doc = "Construct a new `VideoEncoderConfig`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(codec: &str, height: u32, width: u32) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.codec(codec); + ret.height(height); + ret.width(width); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AlphaOption")] + #[deprecated = "Use `set_alpha()` instead."] + pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { + self.set_alpha(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bitrate()` instead."] + pub fn bitrate(&mut self, val: f64) -> &mut Self { + self.set_bitrate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_codec()` instead."] + pub fn codec(&mut self, val: &str) -> &mut Self { + self.set_codec(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_height()` instead."] + pub fn display_height(&mut self, val: u32) -> &mut Self { + self.set_display_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_width()` instead."] + pub fn display_width(&mut self, val: u32) -> &mut Self { + self.set_display_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_framerate()` instead."] + pub fn framerate(&mut self, val: f64) -> &mut Self { + self.set_framerate(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "HardwareAcceleration")] + #[deprecated = "Use `set_hardware_acceleration()` instead."] + pub fn hardware_acceleration(&mut self, val: HardwareAcceleration) -> &mut Self { + self.set_hardware_acceleration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_height()` instead."] + pub fn height(&mut self, val: u32) -> &mut Self { + self.set_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "LatencyMode")] + #[deprecated = "Use `set_latency_mode()` instead."] + pub fn latency_mode(&mut self, val: LatencyMode) -> &mut Self { + self.set_latency_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_scalability_mode()` instead."] + pub fn scalability_mode(&mut self, val: &str) -> &mut Self { + self.set_scalability_mode(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_width()` instead."] pub fn width(&mut self, val: u32) -> &mut Self { - self.width_shim(val); + self.set_width(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs b/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs index f95a89936ee..18c58aac847 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderEncodeOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderEncodeOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `keyFrame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderEncodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "keyFrame")] + pub fn get_key_frame(this: &VideoEncoderEncodeOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `keyFrame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderEncodeOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "keyFrame")] - fn key_frame_shim(this: &VideoEncoderEncodeOptions, val: bool); + pub fn set_key_frame(this: &VideoEncoderEncodeOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderEncodeOptions { @@ -31,14 +47,9 @@ impl VideoEncoderEncodeOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `keyFrame` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderEncodeOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_key_frame()` instead."] pub fn key_frame(&mut self, val: bool) -> &mut Self { - self.key_frame_shim(val); + self.set_key_frame(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderInit.rs b/crates/web-sys/src/features/gen_VideoEncoderInit.rs index cbded7262e9..47bd0e591d8 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "error")] + pub fn get_error(this: &VideoEncoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `error` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "error")] - fn error_shim(this: &VideoEncoderInit, val: &::js_sys::Function); + pub fn set_error(this: &VideoEncoderInit, val: &::js_sys::Function); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "output")] + pub fn get_output(this: &VideoEncoderInit) -> ::js_sys::Function; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `output` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "output")] - fn output_shim(this: &VideoEncoderInit, val: &::js_sys::Function); + pub fn set_output(this: &VideoEncoderInit, val: &::js_sys::Function); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderInit { @@ -35,25 +67,15 @@ impl VideoEncoderInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `error` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_error()` instead."] pub fn error(&mut self, val: &::js_sys::Function) -> &mut Self { - self.error_shim(val); + self.set_error(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `output` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_output()` instead."] pub fn output(&mut self, val: &::js_sys::Function) -> &mut Self { - self.output_shim(val); + self.set_output(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoEncoderSupport.rs b/crates/web-sys/src/features/gen_VideoEncoderSupport.rs index eb438851292..8fa25810ba6 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderSupport.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderSupport.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoEncoderSupport; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoEncoderConfig")] + #[doc = "Get the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`, `VideoEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "config")] + pub fn get_config(this: &VideoEncoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoEncoderConfig")] + #[doc = "Change the `config` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`, `VideoEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "config")] - fn config_shim(this: &VideoEncoderSupport, val: &VideoEncoderConfig); + pub fn set_config(this: &VideoEncoderSupport, val: &VideoEncoderConfig); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "supported")] + pub fn get_supported(this: &VideoEncoderSupport) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoEncoderSupport`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "supported")] - fn supported_shim(this: &VideoEncoderSupport, val: bool); + pub fn set_supported(this: &VideoEncoderSupport, val: bool); } #[cfg(web_sys_unstable_apis)] impl VideoEncoderSupport { @@ -35,25 +68,15 @@ impl VideoEncoderSupport { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoEncoderConfig")] - #[doc = "Change the `config` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderConfig`, `VideoEncoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_config()` instead."] pub fn config(&mut self, val: &VideoEncoderConfig) -> &mut Self { - self.config_shim(val); + self.set_config(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `supported` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoEncoderSupport`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_supported()` instead."] pub fn supported(&mut self, val: bool) -> &mut Self { - self.supported_shim(val); + self.set_supported(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs index f86531d6092..6b595155c23 100644 --- a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs +++ b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs @@ -14,53 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameBufferInit; - #[wasm_bindgen(method, setter = "codedHeight")] - fn coded_height_shim(this: &VideoFrameBufferInit, val: u32); - #[wasm_bindgen(method, setter = "codedWidth")] - fn coded_width_shim(this: &VideoFrameBufferInit, val: u32); - #[cfg(feature = "VideoColorSpaceInit")] - #[wasm_bindgen(method, setter = "colorSpace")] - fn color_space_shim(this: &VideoFrameBufferInit, val: &VideoColorSpaceInit); - #[wasm_bindgen(method, setter = "displayHeight")] - fn display_height_shim(this: &VideoFrameBufferInit, val: u32); - #[wasm_bindgen(method, setter = "displayWidth")] - fn display_width_shim(this: &VideoFrameBufferInit, val: u32); - #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &VideoFrameBufferInit, val: f64); - #[cfg(feature = "VideoPixelFormat")] - #[wasm_bindgen(method, setter = "format")] - fn format_shim(this: &VideoFrameBufferInit, val: VideoPixelFormat); - #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &VideoFrameBufferInit, val: &::wasm_bindgen::JsValue); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &VideoFrameBufferInit, val: f64); - #[cfg(feature = "DomRectInit")] - #[wasm_bindgen(method, setter = "visibleRect")] - fn visible_rect_shim(this: &VideoFrameBufferInit, val: &DomRectInit); -} -#[cfg(web_sys_unstable_apis)] -impl VideoFrameBufferInit { - #[cfg(feature = "VideoPixelFormat")] - #[doc = "Construct a new `VideoFrameBufferInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codedHeight` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`, `VideoPixelFormat`*"] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new( - coded_height: u32, - coded_width: u32, - format: VideoPixelFormat, - timestamp: f64, - ) -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.coded_height(coded_height); - ret.coded_width(coded_width); - ret.format(format); - ret.timestamp(timestamp); - ret - } + #[wasm_bindgen(method, getter = "codedHeight")] + pub fn get_coded_height(this: &VideoFrameBufferInit) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codedHeight` field of this object."] #[doc = ""] @@ -68,10 +30,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn coded_height(&mut self, val: u32) -> &mut Self { - self.coded_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "codedHeight")] + pub fn set_coded_height(this: &VideoFrameBufferInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `codedWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "codedWidth")] + pub fn get_coded_width(this: &VideoFrameBufferInit) -> u32; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codedWidth` field of this object."] #[doc = ""] @@ -79,10 +48,18 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn coded_width(&mut self, val: u32) -> &mut Self { - self.coded_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "codedWidth")] + pub fn set_coded_width(this: &VideoFrameBufferInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoColorSpaceInit")] + #[doc = "Get the `colorSpace` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoColorSpaceInit`, `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "colorSpace")] + pub fn get_color_space(this: &VideoFrameBufferInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoColorSpaceInit")] #[doc = "Change the `colorSpace` field of this object."] @@ -91,10 +68,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { - self.color_space_shim(val); - self - } + #[wasm_bindgen(method, setter = "colorSpace")] + pub fn set_color_space(this: &VideoFrameBufferInit, val: &VideoColorSpaceInit); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayHeight")] + pub fn get_display_height(this: &VideoFrameBufferInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayHeight` field of this object."] #[doc = ""] @@ -102,10 +86,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_height(&mut self, val: u32) -> &mut Self { - self.display_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayHeight")] + pub fn set_display_height(this: &VideoFrameBufferInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayWidth")] + pub fn get_display_width(this: &VideoFrameBufferInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayWidth` field of this object."] #[doc = ""] @@ -113,10 +104,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_width(&mut self, val: u32) -> &mut Self { - self.display_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayWidth")] + pub fn set_display_width(this: &VideoFrameBufferInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &VideoFrameBufferInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `duration` field of this object."] #[doc = ""] @@ -124,10 +122,18 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); - self - } + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &VideoFrameBufferInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoPixelFormat")] + #[doc = "Get the `format` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`, `VideoPixelFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "format")] + pub fn get_format(this: &VideoFrameBufferInit) -> VideoPixelFormat; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoPixelFormat")] #[doc = "Change the `format` field of this object."] @@ -136,10 +142,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn format(&mut self, val: VideoPixelFormat) -> &mut Self { - self.format_shim(val); - self - } + #[wasm_bindgen(method, setter = "format")] + pub fn set_format(this: &VideoFrameBufferInit, val: VideoPixelFormat); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &VideoFrameBufferInit) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `layout` field of this object."] #[doc = ""] @@ -147,10 +160,17 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); - self - } + #[wasm_bindgen(method, setter = "layout")] + pub fn set_layout(this: &VideoFrameBufferInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &VideoFrameBufferInit) -> f64; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -158,10 +178,18 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); - self - } + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &VideoFrameBufferInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomRectInit")] + #[doc = "Get the `visibleRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "visibleRect")] + pub fn get_visible_rect(this: &VideoFrameBufferInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DomRectInit")] #[doc = "Change the `visibleRect` field of this object."] @@ -170,8 +198,93 @@ impl VideoFrameBufferInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "visibleRect")] + pub fn set_visible_rect(this: &VideoFrameBufferInit, val: &DomRectInit); +} +#[cfg(web_sys_unstable_apis)] +impl VideoFrameBufferInit { + #[cfg(feature = "VideoPixelFormat")] + #[doc = "Construct a new `VideoFrameBufferInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameBufferInit`, `VideoPixelFormat`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + coded_height: u32, + coded_width: u32, + format: VideoPixelFormat, + timestamp: f64, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.coded_height(coded_height); + ret.coded_width(coded_width); + ret.format(format); + ret.timestamp(timestamp); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_coded_height()` instead."] + pub fn coded_height(&mut self, val: u32) -> &mut Self { + self.set_coded_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_coded_width()` instead."] + pub fn coded_width(&mut self, val: u32) -> &mut Self { + self.set_coded_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoColorSpaceInit")] + #[deprecated = "Use `set_color_space()` instead."] + pub fn color_space(&mut self, val: &VideoColorSpaceInit) -> &mut Self { + self.set_color_space(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_height()` instead."] + pub fn display_height(&mut self, val: u32) -> &mut Self { + self.set_display_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_width()` instead."] + pub fn display_width(&mut self, val: u32) -> &mut Self { + self.set_display_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: f64) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoPixelFormat")] + #[deprecated = "Use `set_format()` instead."] + pub fn format(&mut self, val: VideoPixelFormat) -> &mut Self { + self.set_format(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_layout()` instead."] + pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_layout(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + self.set_timestamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomRectInit")] + #[deprecated = "Use `set_visible_rect()` instead."] pub fn visible_rect(&mut self, val: &DomRectInit) -> &mut Self { - self.visible_rect_shim(val); + self.set_visible_rect(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs b/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs index b4daba7283d..686a12cbd92 100644 --- a/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs +++ b/crates/web-sys/src/features/gen_VideoFrameCopyToOptions.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameCopyToOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layout")] + pub fn get_layout(this: &VideoFrameCopyToOptions) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `layout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "layout")] - fn layout_shim(this: &VideoFrameCopyToOptions, val: &::wasm_bindgen::JsValue); + pub fn set_layout(this: &VideoFrameCopyToOptions, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DomRectInit")] + #[doc = "Get the `rect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `VideoFrameCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rect")] + pub fn get_rect(this: &VideoFrameCopyToOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomRectInit")] + #[doc = "Change the `rect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `VideoFrameCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "rect")] - fn rect_shim(this: &VideoFrameCopyToOptions, val: &DomRectInit); + pub fn set_rect(this: &VideoFrameCopyToOptions, val: &DomRectInit); } #[cfg(web_sys_unstable_apis)] impl VideoFrameCopyToOptions { @@ -34,26 +67,16 @@ impl VideoFrameCopyToOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `layout` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoFrameCopyToOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_layout()` instead."] pub fn layout(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.layout_shim(val); + self.set_layout(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DomRectInit")] - #[doc = "Change the `rect` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `VideoFrameCopyToOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_rect()` instead."] pub fn rect(&mut self, val: &DomRectInit) -> &mut Self { - self.rect_shim(val); + self.set_rect(val); self } } diff --git a/crates/web-sys/src/features/gen_VideoFrameInit.rs b/crates/web-sys/src/features/gen_VideoFrameInit.rs index 41ece8b8c55..2180804556f 100644 --- a/crates/web-sys/src/features/gen_VideoFrameInit.rs +++ b/crates/web-sys/src/features/gen_VideoFrameInit.rs @@ -14,34 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type VideoFrameInit; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AlphaOption")] - #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &VideoFrameInit, val: AlphaOption); - #[wasm_bindgen(method, setter = "displayHeight")] - fn display_height_shim(this: &VideoFrameInit, val: u32); - #[wasm_bindgen(method, setter = "displayWidth")] - fn display_width_shim(this: &VideoFrameInit, val: u32); - #[wasm_bindgen(method, setter = "duration")] - fn duration_shim(this: &VideoFrameInit, val: f64); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &VideoFrameInit, val: f64); - #[cfg(feature = "DomRectInit")] - #[wasm_bindgen(method, setter = "visibleRect")] - fn visible_rect_shim(this: &VideoFrameInit, val: &DomRectInit); -} -#[cfg(web_sys_unstable_apis)] -impl VideoFrameInit { - #[doc = "Construct a new `VideoFrameInit`."] + #[doc = "Get the `alpha` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = "*This API requires the following crate features to be activated: `AlphaOption`, `VideoFrameInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AlphaOption")] #[doc = "Change the `alpha` field of this object."] @@ -50,10 +32,17 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { - self.alpha_shim(val); - self - } + #[wasm_bindgen(method, setter = "alpha")] + pub fn set_alpha(this: &VideoFrameInit, val: AlphaOption); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayHeight")] + pub fn get_display_height(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayHeight` field of this object."] #[doc = ""] @@ -61,10 +50,17 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_height(&mut self, val: u32) -> &mut Self { - self.display_height_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayHeight")] + pub fn set_display_height(this: &VideoFrameInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayWidth")] + pub fn get_display_width(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayWidth` field of this object."] #[doc = ""] @@ -72,10 +68,17 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn display_width(&mut self, val: u32) -> &mut Self { - self.display_width_shim(val); - self - } + #[wasm_bindgen(method, setter = "displayWidth")] + pub fn set_display_width(this: &VideoFrameInit, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `duration` field of this object."] #[doc = ""] @@ -83,10 +86,17 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn duration(&mut self, val: f64) -> &mut Self { - self.duration_shim(val); - self - } + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &VideoFrameInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -94,10 +104,18 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); - self - } + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &VideoFrameInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomRectInit")] + #[doc = "Get the `visibleRect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectInit`, `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "visibleRect")] + pub fn get_visible_rect(this: &VideoFrameInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DomRectInit")] #[doc = "Change the `visibleRect` field of this object."] @@ -106,8 +124,58 @@ impl VideoFrameInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "visibleRect")] + pub fn set_visible_rect(this: &VideoFrameInit, val: &DomRectInit); +} +#[cfg(web_sys_unstable_apis)] +impl VideoFrameInit { + #[doc = "Construct a new `VideoFrameInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrameInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AlphaOption")] + #[deprecated = "Use `set_alpha()` instead."] + pub fn alpha(&mut self, val: AlphaOption) -> &mut Self { + self.set_alpha(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_height()` instead."] + pub fn display_height(&mut self, val: u32) -> &mut Self { + self.set_display_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_width()` instead."] + pub fn display_width(&mut self, val: u32) -> &mut Self { + self.set_display_width(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: f64) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + self.set_timestamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "DomRectInit")] + #[deprecated = "Use `set_visible_rect()` instead."] pub fn visible_rect(&mut self, val: &DomRectInit) -> &mut Self { - self.visible_rect_shim(val); + self.set_visible_rect(val); self } } diff --git a/crates/web-sys/src/features/gen_VoidCallback.rs b/crates/web-sys/src/features/gen_VoidCallback.rs index 08d9643e49c..46b21e4a6e5 100644 --- a/crates/web-sys/src/features/gen_VoidCallback.rs +++ b/crates/web-sys/src/features/gen_VoidCallback.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] pub type VoidCallback; + #[doc = "Get the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] + #[wasm_bindgen(method, getter = "handleEvent")] + pub fn get_handle_event(this: &VoidCallback) -> Option<::js_sys::Function>; + #[doc = "Change the `handleEvent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] #[wasm_bindgen(method, setter = "handleEvent")] - fn handle_event_shim(this: &VoidCallback, val: &::js_sys::Function); + pub fn set_handle_event(this: &VoidCallback, val: &::js_sys::Function); } impl VoidCallback { #[doc = "Construct a new `VoidCallback`."] @@ -22,11 +30,9 @@ impl VoidCallback { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `handleEvent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VoidCallback`*"] + #[deprecated = "Use `set_handle_event()` instead."] pub fn handle_event(&mut self, val: &::js_sys::Function) -> &mut Self { - self.handle_event_shim(val); + self.set_handle_event(val); self } } diff --git a/crates/web-sys/src/features/gen_VrLayer.rs b/crates/web-sys/src/features/gen_VrLayer.rs index fef6d7169ab..7fd282af462 100644 --- a/crates/web-sys/src/features/gen_VrLayer.rs +++ b/crates/web-sys/src/features/gen_VrLayer.rs @@ -10,13 +10,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] pub type VrLayer; + #[doc = "Get the `leftBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] + #[wasm_bindgen(method, getter = "leftBounds")] + pub fn get_left_bounds(this: &VrLayer) -> Option<::js_sys::Array>; + #[doc = "Change the `leftBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] #[wasm_bindgen(method, setter = "leftBounds")] - fn left_bounds_shim(this: &VrLayer, val: &::wasm_bindgen::JsValue); + pub fn set_left_bounds(this: &VrLayer, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `rightBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] + #[wasm_bindgen(method, getter = "rightBounds")] + pub fn get_right_bounds(this: &VrLayer) -> Option<::js_sys::Array>; + #[doc = "Change the `rightBounds` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] #[wasm_bindgen(method, setter = "rightBounds")] - fn right_bounds_shim(this: &VrLayer, val: &::wasm_bindgen::JsValue); + pub fn set_right_bounds(this: &VrLayer, val: &::wasm_bindgen::JsValue); + #[cfg(feature = "HtmlCanvasElement")] + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `VrLayer`*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &VrLayer) -> Option; #[cfg(feature = "HtmlCanvasElement")] + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `VrLayer`*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &VrLayer, val: Option<&HtmlCanvasElement>); + pub fn set_source(this: &VrLayer, val: Option<&HtmlCanvasElement>); } impl VrLayer { #[doc = "Construct a new `VrLayer`."] @@ -27,26 +52,20 @@ impl VrLayer { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `leftBounds` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] + #[deprecated = "Use `set_left_bounds()` instead."] pub fn left_bounds(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.left_bounds_shim(val); + self.set_left_bounds(val); self } - #[doc = "Change the `rightBounds` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `VrLayer`*"] + #[deprecated = "Use `set_right_bounds()` instead."] pub fn right_bounds(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.right_bounds_shim(val); + self.set_right_bounds(val); self } #[cfg(feature = "HtmlCanvasElement")] - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `VrLayer`*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: Option<&HtmlCanvasElement>) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } } diff --git a/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs b/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs index 910cb67592b..74a95c2f42e 100644 --- a/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs +++ b/crates/web-sys/src/features/gen_WatchAdvertisementsOptions.rs @@ -14,9 +14,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WatchAdvertisementsOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WatchAdvertisementsOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &WatchAdvertisementsOptions) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WatchAdvertisementsOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "signal")] - fn signal_shim(this: &WatchAdvertisementsOptions, val: &AbortSignal); + pub fn set_signal(this: &WatchAdvertisementsOptions, val: &AbortSignal); } #[cfg(web_sys_unstable_apis)] impl WatchAdvertisementsOptions { @@ -33,14 +50,9 @@ impl WatchAdvertisementsOptions { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "AbortSignal")] - #[doc = "Change the `signal` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `WatchAdvertisementsOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_signal()` instead."] pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { - self.signal_shim(val); + self.set_signal(val); self } } diff --git a/crates/web-sys/src/features/gen_WaveShaperOptions.rs b/crates/web-sys/src/features/gen_WaveShaperOptions.rs index 73eae9c0dc8..181269e5fa7 100644 --- a/crates/web-sys/src/features/gen_WaveShaperOptions.rs +++ b/crates/web-sys/src/features/gen_WaveShaperOptions.rs @@ -10,19 +10,62 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] pub type WaveShaperOptions; + #[doc = "Get the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] + #[wasm_bindgen(method, getter = "channelCount")] + pub fn get_channel_count(this: &WaveShaperOptions) -> Option; + #[doc = "Change the `channelCount` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] #[wasm_bindgen(method, setter = "channelCount")] - fn channel_count_shim(this: &WaveShaperOptions, val: u32); + pub fn set_channel_count(this: &WaveShaperOptions, val: u32); #[cfg(feature = "ChannelCountMode")] + #[doc = "Get the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `WaveShaperOptions`*"] + #[wasm_bindgen(method, getter = "channelCountMode")] + pub fn get_channel_count_mode(this: &WaveShaperOptions) -> Option; + #[cfg(feature = "ChannelCountMode")] + #[doc = "Change the `channelCountMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `WaveShaperOptions`*"] #[wasm_bindgen(method, setter = "channelCountMode")] - fn channel_count_mode_shim(this: &WaveShaperOptions, val: ChannelCountMode); + pub fn set_channel_count_mode(this: &WaveShaperOptions, val: ChannelCountMode); #[cfg(feature = "ChannelInterpretation")] + #[doc = "Get the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `WaveShaperOptions`*"] + #[wasm_bindgen(method, getter = "channelInterpretation")] + pub fn get_channel_interpretation(this: &WaveShaperOptions) -> Option; + #[cfg(feature = "ChannelInterpretation")] + #[doc = "Change the `channelInterpretation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `WaveShaperOptions`*"] #[wasm_bindgen(method, setter = "channelInterpretation")] - fn channel_interpretation_shim(this: &WaveShaperOptions, val: ChannelInterpretation); + pub fn set_channel_interpretation(this: &WaveShaperOptions, val: ChannelInterpretation); + #[doc = "Get the `curve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] + #[wasm_bindgen(method, getter = "curve")] + pub fn get_curve(this: &WaveShaperOptions) -> Option<::js_sys::Array>; + #[doc = "Change the `curve` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] #[wasm_bindgen(method, setter = "curve")] - fn curve_shim(this: &WaveShaperOptions, val: &::wasm_bindgen::JsValue); + pub fn set_curve(this: &WaveShaperOptions, val: &::wasm_bindgen::JsValue); #[cfg(feature = "OverSampleType")] + #[doc = "Get the `oversample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OverSampleType`, `WaveShaperOptions`*"] + #[wasm_bindgen(method, getter = "oversample")] + pub fn get_oversample(this: &WaveShaperOptions) -> Option; + #[cfg(feature = "OverSampleType")] + #[doc = "Change the `oversample` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OverSampleType`, `WaveShaperOptions`*"] #[wasm_bindgen(method, setter = "oversample")] - fn oversample_shim(this: &WaveShaperOptions, val: OverSampleType); + pub fn set_oversample(this: &WaveShaperOptions, val: OverSampleType); } impl WaveShaperOptions { #[doc = "Construct a new `WaveShaperOptions`."] @@ -33,42 +76,32 @@ impl WaveShaperOptions { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `channelCount` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] + #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: u32) -> &mut Self { - self.channel_count_shim(val); + self.set_channel_count(val); self } #[cfg(feature = "ChannelCountMode")] - #[doc = "Change the `channelCountMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelCountMode`, `WaveShaperOptions`*"] + #[deprecated = "Use `set_channel_count_mode()` instead."] pub fn channel_count_mode(&mut self, val: ChannelCountMode) -> &mut Self { - self.channel_count_mode_shim(val); + self.set_channel_count_mode(val); self } #[cfg(feature = "ChannelInterpretation")] - #[doc = "Change the `channelInterpretation` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `ChannelInterpretation`, `WaveShaperOptions`*"] + #[deprecated = "Use `set_channel_interpretation()` instead."] pub fn channel_interpretation(&mut self, val: ChannelInterpretation) -> &mut Self { - self.channel_interpretation_shim(val); + self.set_channel_interpretation(val); self } - #[doc = "Change the `curve` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WaveShaperOptions`*"] + #[deprecated = "Use `set_curve()` instead."] pub fn curve(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.curve_shim(val); + self.set_curve(val); self } #[cfg(feature = "OverSampleType")] - #[doc = "Change the `oversample` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OverSampleType`, `WaveShaperOptions`*"] + #[deprecated = "Use `set_oversample()` instead."] pub fn oversample(&mut self, val: OverSampleType) -> &mut Self { - self.oversample_shim(val); + self.set_oversample(val); self } } diff --git a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs index d939df42117..23109aab97e 100644 --- a/crates/web-sys/src/features/gen_WebGlContextAttributes.rs +++ b/crates/web-sys/src/features/gen_WebGlContextAttributes.rs @@ -10,25 +10,106 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] pub type WebGlContextAttributes; + #[doc = "Get the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `alpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_alpha(this: &WebGlContextAttributes, val: bool); + #[doc = "Get the `antialias` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "antialias")] + pub fn get_antialias(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `antialias` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "antialias")] - fn antialias_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_antialias(this: &WebGlContextAttributes, val: bool); + #[doc = "Get the `depth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "depth")] + pub fn get_depth(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `depth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "depth")] - fn depth_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_depth(this: &WebGlContextAttributes, val: bool); + #[doc = "Get the `failIfMajorPerformanceCaveat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "failIfMajorPerformanceCaveat")] + pub fn get_fail_if_major_performance_caveat(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "failIfMajorPerformanceCaveat")] - fn fail_if_major_performance_caveat_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_fail_if_major_performance_caveat(this: &WebGlContextAttributes, val: bool); + #[cfg(feature = "WebGlPowerPreference")] + #[doc = "Get the `powerPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"] + #[wasm_bindgen(method, getter = "powerPreference")] + pub fn get_power_preference(this: &WebGlContextAttributes) -> Option; #[cfg(feature = "WebGlPowerPreference")] + #[doc = "Change the `powerPreference` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"] #[wasm_bindgen(method, setter = "powerPreference")] - fn power_preference_shim(this: &WebGlContextAttributes, val: WebGlPowerPreference); + pub fn set_power_preference(this: &WebGlContextAttributes, val: WebGlPowerPreference); + #[doc = "Get the `premultipliedAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "premultipliedAlpha")] + pub fn get_premultiplied_alpha(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `premultipliedAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "premultipliedAlpha")] - fn premultiplied_alpha_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_premultiplied_alpha(this: &WebGlContextAttributes, val: bool); + #[doc = "Get the `preserveDrawingBuffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "preserveDrawingBuffer")] + pub fn get_preserve_drawing_buffer(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `preserveDrawingBuffer` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "preserveDrawingBuffer")] - fn preserve_drawing_buffer_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_preserve_drawing_buffer(this: &WebGlContextAttributes, val: bool); + #[doc = "Get the `stencil` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[wasm_bindgen(method, getter = "stencil")] + pub fn get_stencil(this: &WebGlContextAttributes) -> Option; + #[doc = "Change the `stencil` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] #[wasm_bindgen(method, setter = "stencil")] - fn stencil_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_stencil(this: &WebGlContextAttributes, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `xrCompatible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "xrCompatible")] + pub fn get_xr_compatible(this: &WebGlContextAttributes) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `xrCompatible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "xrCompatible")] - fn xr_compatible_shim(this: &WebGlContextAttributes, val: bool); + pub fn set_xr_compatible(this: &WebGlContextAttributes, val: bool); } impl WebGlContextAttributes { #[doc = "Construct a new `WebGlContextAttributes`."] @@ -39,72 +120,51 @@ impl WebGlContextAttributes { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `alpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_alpha()` instead."] pub fn alpha(&mut self, val: bool) -> &mut Self { - self.alpha_shim(val); + self.set_alpha(val); self } - #[doc = "Change the `antialias` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_antialias()` instead."] pub fn antialias(&mut self, val: bool) -> &mut Self { - self.antialias_shim(val); + self.set_antialias(val); self } - #[doc = "Change the `depth` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_depth()` instead."] pub fn depth(&mut self, val: bool) -> &mut Self { - self.depth_shim(val); + self.set_depth(val); self } - #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_fail_if_major_performance_caveat()` instead."] pub fn fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self { - self.fail_if_major_performance_caveat_shim(val); + self.set_fail_if_major_performance_caveat(val); self } #[cfg(feature = "WebGlPowerPreference")] - #[doc = "Change the `powerPreference` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"] + #[deprecated = "Use `set_power_preference()` instead."] pub fn power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self { - self.power_preference_shim(val); + self.set_power_preference(val); self } - #[doc = "Change the `premultipliedAlpha` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_premultiplied_alpha()` instead."] pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self { - self.premultiplied_alpha_shim(val); + self.set_premultiplied_alpha(val); self } - #[doc = "Change the `preserveDrawingBuffer` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_preserve_drawing_buffer()` instead."] pub fn preserve_drawing_buffer(&mut self, val: bool) -> &mut Self { - self.preserve_drawing_buffer_shim(val); + self.set_preserve_drawing_buffer(val); self } - #[doc = "Change the `stencil` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] + #[deprecated = "Use `set_stencil()` instead."] pub fn stencil(&mut self, val: bool) -> &mut Self { - self.stencil_shim(val); + self.set_stencil(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `xrCompatible` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_xr_compatible()` instead."] pub fn xr_compatible(&mut self, val: bool) -> &mut Self { - self.xr_compatible_shim(val); + self.set_xr_compatible(val); self } } diff --git a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs index 870603872a7..fff5f4f4790 100644 --- a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs +++ b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs @@ -10,14 +10,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] pub type WebGlContextEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &WebGlContextEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &WebGlContextEventInit, val: bool); + pub fn set_bubbles(this: &WebGlContextEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &WebGlContextEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &WebGlContextEventInit, val: bool); + pub fn set_cancelable(this: &WebGlContextEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &WebGlContextEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &WebGlContextEventInit, val: bool); + pub fn set_composed(this: &WebGlContextEventInit, val: bool); + #[doc = "Get the `statusMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[wasm_bindgen(method, getter = "statusMessage")] + pub fn get_status_message(this: &WebGlContextEventInit) -> Option; + #[doc = "Change the `statusMessage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] #[wasm_bindgen(method, setter = "statusMessage")] - fn status_message_shim(this: &WebGlContextEventInit, val: &str); + pub fn set_status_message(this: &WebGlContextEventInit, val: &str); } impl WebGlContextEventInit { #[doc = "Construct a new `WebGlContextEventInit`."] @@ -28,32 +60,24 @@ impl WebGlContextEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `statusMessage` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] + #[deprecated = "Use `set_status_message()` instead."] pub fn status_message(&mut self, val: &str) -> &mut Self { - self.status_message_shim(val); + self.set_status_message(val); self } } diff --git a/crates/web-sys/src/features/gen_WebSocketDict.rs b/crates/web-sys/src/features/gen_WebSocketDict.rs index 1586581b065..752934754b9 100644 --- a/crates/web-sys/src/features/gen_WebSocketDict.rs +++ b/crates/web-sys/src/features/gen_WebSocketDict.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] pub type WebSocketDict; + #[doc = "Get the `websockets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] + #[wasm_bindgen(method, getter = "websockets")] + pub fn get_websockets(this: &WebSocketDict) -> Option<::js_sys::Array>; + #[doc = "Change the `websockets` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] #[wasm_bindgen(method, setter = "websockets")] - fn websockets_shim(this: &WebSocketDict, val: &::wasm_bindgen::JsValue); + pub fn set_websockets(this: &WebSocketDict, val: &::wasm_bindgen::JsValue); } impl WebSocketDict { #[doc = "Construct a new `WebSocketDict`."] @@ -22,11 +30,9 @@ impl WebSocketDict { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `websockets` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketDict`*"] + #[deprecated = "Use `set_websockets()` instead."] pub fn websockets(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.websockets_shim(val); + self.set_websockets(val); self } } diff --git a/crates/web-sys/src/features/gen_WebSocketElement.rs b/crates/web-sys/src/features/gen_WebSocketElement.rs index ebe600ee7b1..7c6d3464b56 100644 --- a/crates/web-sys/src/features/gen_WebSocketElement.rs +++ b/crates/web-sys/src/features/gen_WebSocketElement.rs @@ -10,18 +10,66 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] pub type WebSocketElement; + #[doc = "Get the `encrypted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "encrypted")] + pub fn get_encrypted(this: &WebSocketElement) -> Option; + #[doc = "Change the `encrypted` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "encrypted")] - fn encrypted_shim(this: &WebSocketElement, val: bool); + pub fn set_encrypted(this: &WebSocketElement, val: bool); + #[doc = "Get the `hostport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "hostport")] + pub fn get_hostport(this: &WebSocketElement) -> Option; + #[doc = "Change the `hostport` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "hostport")] - fn hostport_shim(this: &WebSocketElement, val: &str); + pub fn set_hostport(this: &WebSocketElement, val: &str); + #[doc = "Get the `msgreceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "msgreceived")] + pub fn get_msgreceived(this: &WebSocketElement) -> Option; + #[doc = "Change the `msgreceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "msgreceived")] - fn msgreceived_shim(this: &WebSocketElement, val: u32); + pub fn set_msgreceived(this: &WebSocketElement, val: u32); + #[doc = "Get the `msgsent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "msgsent")] + pub fn get_msgsent(this: &WebSocketElement) -> Option; + #[doc = "Change the `msgsent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "msgsent")] - fn msgsent_shim(this: &WebSocketElement, val: u32); + pub fn set_msgsent(this: &WebSocketElement, val: u32); + #[doc = "Get the `receivedsize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "receivedsize")] + pub fn get_receivedsize(this: &WebSocketElement) -> Option; + #[doc = "Change the `receivedsize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "receivedsize")] - fn receivedsize_shim(this: &WebSocketElement, val: f64); + pub fn set_receivedsize(this: &WebSocketElement, val: f64); + #[doc = "Get the `sentsize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[wasm_bindgen(method, getter = "sentsize")] + pub fn get_sentsize(this: &WebSocketElement) -> Option; + #[doc = "Change the `sentsize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, setter = "sentsize")] - fn sentsize_shim(this: &WebSocketElement, val: f64); + pub fn set_sentsize(this: &WebSocketElement, val: f64); } impl WebSocketElement { #[doc = "Construct a new `WebSocketElement`."] @@ -32,46 +80,34 @@ impl WebSocketElement { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `encrypted` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_encrypted()` instead."] pub fn encrypted(&mut self, val: bool) -> &mut Self { - self.encrypted_shim(val); + self.set_encrypted(val); self } - #[doc = "Change the `hostport` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_hostport()` instead."] pub fn hostport(&mut self, val: &str) -> &mut Self { - self.hostport_shim(val); + self.set_hostport(val); self } - #[doc = "Change the `msgreceived` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_msgreceived()` instead."] pub fn msgreceived(&mut self, val: u32) -> &mut Self { - self.msgreceived_shim(val); + self.set_msgreceived(val); self } - #[doc = "Change the `msgsent` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_msgsent()` instead."] pub fn msgsent(&mut self, val: u32) -> &mut Self { - self.msgsent_shim(val); + self.set_msgsent(val); self } - #[doc = "Change the `receivedsize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_receivedsize()` instead."] pub fn receivedsize(&mut self, val: f64) -> &mut Self { - self.receivedsize_shim(val); + self.set_receivedsize(val); self } - #[doc = "Change the `sentsize` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] + #[deprecated = "Use `set_sentsize()` instead."] pub fn sentsize(&mut self, val: f64) -> &mut Self { - self.sentsize_shim(val); + self.set_sentsize(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs index 28ef40240d5..d33023f8870 100644 --- a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs +++ b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportCloseInfo; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `closeCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "closeCode")] + pub fn get_close_code(this: &WebTransportCloseInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `closeCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "closeCode")] - fn close_code_shim(this: &WebTransportCloseInfo, val: u32); + pub fn set_close_code(this: &WebTransportCloseInfo, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "reason")] + pub fn get_reason(this: &WebTransportCloseInfo) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `reason` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "reason")] - fn reason_shim(this: &WebTransportCloseInfo, val: &str); + pub fn set_reason(this: &WebTransportCloseInfo, val: &str); } #[cfg(web_sys_unstable_apis)] impl WebTransportCloseInfo { @@ -33,25 +65,15 @@ impl WebTransportCloseInfo { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `closeCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_close_code()` instead."] pub fn close_code(&mut self, val: u32) -> &mut Self { - self.close_code_shim(val); + self.set_close_code(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `reason` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportCloseInfo`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_reason()` instead."] pub fn reason(&mut self, val: &str) -> &mut Self { - self.reason_shim(val); + self.set_reason(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs index 70def34726b..22cd239a268 100644 --- a/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportDatagramStats.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportDatagramStats; - #[wasm_bindgen(method, setter = "droppedIncoming")] - fn dropped_incoming_shim(this: &WebTransportDatagramStats, val: f64); - #[wasm_bindgen(method, setter = "expiredOutgoing")] - fn expired_outgoing_shim(this: &WebTransportDatagramStats, val: f64); - #[wasm_bindgen(method, setter = "lostOutgoing")] - fn lost_outgoing_shim(this: &WebTransportDatagramStats, val: f64); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &WebTransportDatagramStats, val: f64); -} -#[cfg(web_sys_unstable_apis)] -impl WebTransportDatagramStats { - #[doc = "Construct a new `WebTransportDatagramStats`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `droppedIncoming` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "droppedIncoming")] + pub fn get_dropped_incoming(this: &WebTransportDatagramStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `droppedIncoming` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl WebTransportDatagramStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn dropped_incoming(&mut self, val: f64) -> &mut Self { - self.dropped_incoming_shim(val); - self - } + #[wasm_bindgen(method, setter = "droppedIncoming")] + pub fn set_dropped_incoming(this: &WebTransportDatagramStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `expiredOutgoing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "expiredOutgoing")] + pub fn get_expired_outgoing(this: &WebTransportDatagramStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `expiredOutgoing` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl WebTransportDatagramStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn expired_outgoing(&mut self, val: f64) -> &mut Self { - self.expired_outgoing_shim(val); - self - } + #[wasm_bindgen(method, setter = "expiredOutgoing")] + pub fn set_expired_outgoing(this: &WebTransportDatagramStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `lostOutgoing` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "lostOutgoing")] + pub fn get_lost_outgoing(this: &WebTransportDatagramStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `lostOutgoing` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl WebTransportDatagramStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn lost_outgoing(&mut self, val: f64) -> &mut Self { - self.lost_outgoing_shim(val); - self - } + #[wasm_bindgen(method, setter = "lostOutgoing")] + pub fn set_lost_outgoing(this: &WebTransportDatagramStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &WebTransportDatagramStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl WebTransportDatagramStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &WebTransportDatagramStats, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportDatagramStats { + #[doc = "Construct a new `WebTransportDatagramStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_dropped_incoming()` instead."] + pub fn dropped_incoming(&mut self, val: f64) -> &mut Self { + self.set_dropped_incoming(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_expired_outgoing()` instead."] + pub fn expired_outgoing(&mut self, val: f64) -> &mut Self { + self.set_expired_outgoing(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_lost_outgoing()` instead."] + pub fn lost_outgoing(&mut self, val: f64) -> &mut Self { + self.set_lost_outgoing(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs index 05069e0a71c..06a6c9dd632 100644 --- a/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportErrorOptions.rs @@ -14,11 +14,44 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportErrorOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportErrorSource")] + #[doc = "Get the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`, `WebTransportErrorSource`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "source")] + pub fn get_source(this: &WebTransportErrorOptions) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportErrorSource")] + #[doc = "Change the `source` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`, `WebTransportErrorSource`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "source")] - fn source_shim(this: &WebTransportErrorOptions, val: WebTransportErrorSource); + pub fn set_source(this: &WebTransportErrorOptions, val: WebTransportErrorSource); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `streamErrorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "streamErrorCode")] + pub fn get_stream_error_code(this: &WebTransportErrorOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `streamErrorCode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "streamErrorCode")] - fn stream_error_code_shim(this: &WebTransportErrorOptions, val: Option); + pub fn set_stream_error_code(this: &WebTransportErrorOptions, val: Option); } #[cfg(web_sys_unstable_apis)] impl WebTransportErrorOptions { @@ -35,25 +68,15 @@ impl WebTransportErrorOptions { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportErrorSource")] - #[doc = "Change the `source` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`, `WebTransportErrorSource`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_source()` instead."] pub fn source(&mut self, val: WebTransportErrorSource) -> &mut Self { - self.source_shim(val); + self.set_source(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `streamErrorCode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportErrorOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_stream_error_code()` instead."] pub fn stream_error_code(&mut self, val: Option) -> &mut Self { - self.stream_error_code_shim(val); + self.set_stream_error_code(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportHash.rs b/crates/web-sys/src/features/gen_WebTransportHash.rs index 46c4052620a..0a897b9f611 100644 --- a/crates/web-sys/src/features/gen_WebTransportHash.rs +++ b/crates/web-sys/src/features/gen_WebTransportHash.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportHash; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `algorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "algorithm")] + pub fn get_algorithm(this: &WebTransportHash) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `algorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "algorithm")] - fn algorithm_shim(this: &WebTransportHash, val: &str); + pub fn set_algorithm(this: &WebTransportHash, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &WebTransportHash) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "value")] - fn value_shim(this: &WebTransportHash, val: &::js_sys::Object); + pub fn set_value(this: &WebTransportHash, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl WebTransportHash { @@ -33,25 +65,15 @@ impl WebTransportHash { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `algorithm` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_algorithm()` instead."] pub fn algorithm(&mut self, val: &str) -> &mut Self { - self.algorithm_shim(val); + self.set_algorithm(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportHash`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_value()` instead."] pub fn value(&mut self, val: &::js_sys::Object) -> &mut Self { - self.value_shim(val); + self.set_value(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportOptions.rs b/crates/web-sys/src/features/gen_WebTransportOptions.rs index bd20cadbb79..bc293195182 100644 --- a/crates/web-sys/src/features/gen_WebTransportOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportOptions.rs @@ -14,29 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportOptions; - #[wasm_bindgen(method, setter = "allowPooling")] - fn allow_pooling_shim(this: &WebTransportOptions, val: bool); - #[cfg(feature = "WebTransportCongestionControl")] - #[wasm_bindgen(method, setter = "congestionControl")] - fn congestion_control_shim(this: &WebTransportOptions, val: WebTransportCongestionControl); - #[wasm_bindgen(method, setter = "requireUnreliable")] - fn require_unreliable_shim(this: &WebTransportOptions, val: bool); - #[wasm_bindgen(method, setter = "serverCertificateHashes")] - fn server_certificate_hashes_shim(this: &WebTransportOptions, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl WebTransportOptions { - #[doc = "Construct a new `WebTransportOptions`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowPooling` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "allowPooling")] + pub fn get_allow_pooling(this: &WebTransportOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `allowPooling` field of this object."] #[doc = ""] @@ -44,10 +30,20 @@ impl WebTransportOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn allow_pooling(&mut self, val: bool) -> &mut Self { - self.allow_pooling_shim(val); - self - } + #[wasm_bindgen(method, setter = "allowPooling")] + pub fn set_allow_pooling(this: &WebTransportOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportCongestionControl")] + #[doc = "Get the `congestionControl` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportCongestionControl`, `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "congestionControl")] + pub fn get_congestion_control( + this: &WebTransportOptions, + ) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportCongestionControl")] #[doc = "Change the `congestionControl` field of this object."] @@ -56,10 +52,17 @@ impl WebTransportOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn congestion_control(&mut self, val: WebTransportCongestionControl) -> &mut Self { - self.congestion_control_shim(val); - self - } + #[wasm_bindgen(method, setter = "congestionControl")] + pub fn set_congestion_control(this: &WebTransportOptions, val: WebTransportCongestionControl); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requireUnreliable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requireUnreliable")] + pub fn get_require_unreliable(this: &WebTransportOptions) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `requireUnreliable` field of this object."] #[doc = ""] @@ -67,10 +70,17 @@ impl WebTransportOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn require_unreliable(&mut self, val: bool) -> &mut Self { - self.require_unreliable_shim(val); - self - } + #[wasm_bindgen(method, setter = "requireUnreliable")] + pub fn set_require_unreliable(this: &WebTransportOptions, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `serverCertificateHashes` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "serverCertificateHashes")] + pub fn get_server_certificate_hashes(this: &WebTransportOptions) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `serverCertificateHashes` field of this object."] #[doc = ""] @@ -78,8 +88,45 @@ impl WebTransportOptions { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "serverCertificateHashes")] + pub fn set_server_certificate_hashes(this: &WebTransportOptions, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportOptions { + #[doc = "Construct a new `WebTransportOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_allow_pooling()` instead."] + pub fn allow_pooling(&mut self, val: bool) -> &mut Self { + self.set_allow_pooling(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportCongestionControl")] + #[deprecated = "Use `set_congestion_control()` instead."] + pub fn congestion_control(&mut self, val: WebTransportCongestionControl) -> &mut Self { + self.set_congestion_control(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_require_unreliable()` instead."] + pub fn require_unreliable(&mut self, val: bool) -> &mut Self { + self.set_require_unreliable(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_server_certificate_hashes()` instead."] pub fn server_certificate_hashes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.server_certificate_hashes_shim(val); + self.set_server_certificate_hashes(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs index 61a4c3d60c6..51efe4f837b 100644 --- a/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportReceiveStreamStats.rs @@ -14,26 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportReceiveStreamStats; - #[wasm_bindgen(method, setter = "bytesRead")] - fn bytes_read_shim(this: &WebTransportReceiveStreamStats, val: f64); - #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &WebTransportReceiveStreamStats, val: f64); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &WebTransportReceiveStreamStats, val: f64); -} -#[cfg(web_sys_unstable_apis)] -impl WebTransportReceiveStreamStats { - #[doc = "Construct a new `WebTransportReceiveStreamStats`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesRead` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "bytesRead")] + pub fn get_bytes_read(this: &WebTransportReceiveStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesRead` field of this object."] #[doc = ""] @@ -41,10 +30,17 @@ impl WebTransportReceiveStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_read(&mut self, val: f64) -> &mut Self { - self.bytes_read_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesRead")] + pub fn set_bytes_read(this: &WebTransportReceiveStreamStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &WebTransportReceiveStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] @@ -52,10 +48,17 @@ impl WebTransportReceiveStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_received(&mut self, val: f64) -> &mut Self { - self.bytes_received_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesReceived")] + pub fn set_bytes_received(this: &WebTransportReceiveStreamStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &WebTransportReceiveStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -63,8 +66,38 @@ impl WebTransportReceiveStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &WebTransportReceiveStreamStats, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportReceiveStreamStats { + #[doc = "Construct a new `WebTransportReceiveStreamStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportReceiveStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_read()` instead."] + pub fn bytes_read(&mut self, val: f64) -> &mut Self { + self.set_bytes_read(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_received()` instead."] + pub fn bytes_received(&mut self, val: f64) -> &mut Self { + self.set_bytes_received(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs index d4b1ee2cd93..8b7b073e0aa 100644 --- a/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamOptions.rs @@ -14,8 +14,24 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportSendStreamOptions; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sendOrder` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sendOrder")] + pub fn get_send_order(this: &WebTransportSendStreamOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sendOrder` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "sendOrder")] - fn send_order_shim(this: &WebTransportSendStreamOptions, val: Option); + pub fn set_send_order(this: &WebTransportSendStreamOptions, val: Option); } #[cfg(web_sys_unstable_apis)] impl WebTransportSendStreamOptions { @@ -31,14 +47,9 @@ impl WebTransportSendStreamOptions { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sendOrder` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamOptions`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_send_order()` instead."] pub fn send_order(&mut self, val: Option) -> &mut Self { - self.send_order_shim(val); + self.set_send_order(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs index 373f9a7bc13..e7f14805c32 100644 --- a/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportSendStreamStats.rs @@ -14,28 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportSendStreamStats; - #[wasm_bindgen(method, setter = "bytesAcknowledged")] - fn bytes_acknowledged_shim(this: &WebTransportSendStreamStats, val: f64); - #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &WebTransportSendStreamStats, val: f64); - #[wasm_bindgen(method, setter = "bytesWritten")] - fn bytes_written_shim(this: &WebTransportSendStreamStats, val: f64); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &WebTransportSendStreamStats, val: f64); -} -#[cfg(web_sys_unstable_apis)] -impl WebTransportSendStreamStats { - #[doc = "Construct a new `WebTransportSendStreamStats`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesAcknowledged` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "bytesAcknowledged")] + pub fn get_bytes_acknowledged(this: &WebTransportSendStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesAcknowledged` field of this object."] #[doc = ""] @@ -43,10 +30,17 @@ impl WebTransportSendStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_acknowledged(&mut self, val: f64) -> &mut Self { - self.bytes_acknowledged_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesAcknowledged")] + pub fn set_bytes_acknowledged(this: &WebTransportSendStreamStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &WebTransportSendStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] @@ -54,10 +48,17 @@ impl WebTransportSendStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - self.bytes_sent_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesSent")] + pub fn set_bytes_sent(this: &WebTransportSendStreamStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesWritten` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytesWritten")] + pub fn get_bytes_written(this: &WebTransportSendStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesWritten` field of this object."] #[doc = ""] @@ -65,10 +66,17 @@ impl WebTransportSendStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_written(&mut self, val: f64) -> &mut Self { - self.bytes_written_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesWritten")] + pub fn set_bytes_written(this: &WebTransportSendStreamStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &WebTransportSendStreamStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -76,8 +84,44 @@ impl WebTransportSendStreamStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &WebTransportSendStreamStats, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportSendStreamStats { + #[doc = "Construct a new `WebTransportSendStreamStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportSendStreamStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_acknowledged()` instead."] + pub fn bytes_acknowledged(&mut self, val: f64) -> &mut Self { + self.set_bytes_acknowledged(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_sent()` instead."] + pub fn bytes_sent(&mut self, val: f64) -> &mut Self { + self.set_bytes_sent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_written()` instead."] + pub fn bytes_written(&mut self, val: f64) -> &mut Self { + self.set_bytes_written(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_WebTransportStats.rs b/crates/web-sys/src/features/gen_WebTransportStats.rs index bc2b8fd4347..175fc01ee29 100644 --- a/crates/web-sys/src/features/gen_WebTransportStats.rs +++ b/crates/web-sys/src/features/gen_WebTransportStats.rs @@ -14,45 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type WebTransportStats; - #[wasm_bindgen(method, setter = "bytesReceived")] - fn bytes_received_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "bytesSent")] - fn bytes_sent_shim(this: &WebTransportStats, val: f64); - #[cfg(feature = "WebTransportDatagramStats")] - #[wasm_bindgen(method, setter = "datagrams")] - fn datagrams_shim(this: &WebTransportStats, val: &WebTransportDatagramStats); - #[wasm_bindgen(method, setter = "minRtt")] - fn min_rtt_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "numIncomingStreamsCreated")] - fn num_incoming_streams_created_shim(this: &WebTransportStats, val: u32); - #[wasm_bindgen(method, setter = "numOutgoingStreamsCreated")] - fn num_outgoing_streams_created_shim(this: &WebTransportStats, val: u32); - #[wasm_bindgen(method, setter = "packetsLost")] - fn packets_lost_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "packetsReceived")] - fn packets_received_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "packetsSent")] - fn packets_sent_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "rttVariation")] - fn rtt_variation_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "smoothedRtt")] - fn smoothed_rtt_shim(this: &WebTransportStats, val: f64); - #[wasm_bindgen(method, setter = "timestamp")] - fn timestamp_shim(this: &WebTransportStats, val: f64); -} -#[cfg(web_sys_unstable_apis)] -impl WebTransportStats { - #[doc = "Construct a new `WebTransportStats`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesReceived` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "bytesReceived")] + pub fn get_bytes_received(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesReceived` field of this object."] #[doc = ""] @@ -60,10 +30,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_received(&mut self, val: f64) -> &mut Self { - self.bytes_received_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesReceived")] + pub fn set_bytes_received(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bytesSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bytesSent")] + pub fn get_bytes_sent(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesSent` field of this object."] #[doc = ""] @@ -71,10 +48,18 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn bytes_sent(&mut self, val: f64) -> &mut Self { - self.bytes_sent_shim(val); - self - } + #[wasm_bindgen(method, setter = "bytesSent")] + pub fn set_bytes_sent(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportDatagramStats")] + #[doc = "Get the `datagrams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportDatagramStats`, `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "datagrams")] + pub fn get_datagrams(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebTransportDatagramStats")] #[doc = "Change the `datagrams` field of this object."] @@ -83,10 +68,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn datagrams(&mut self, val: &WebTransportDatagramStats) -> &mut Self { - self.datagrams_shim(val); - self - } + #[wasm_bindgen(method, setter = "datagrams")] + pub fn set_datagrams(this: &WebTransportStats, val: &WebTransportDatagramStats); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `minRtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "minRtt")] + pub fn get_min_rtt(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `minRtt` field of this object."] #[doc = ""] @@ -94,10 +86,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn min_rtt(&mut self, val: f64) -> &mut Self { - self.min_rtt_shim(val); - self - } + #[wasm_bindgen(method, setter = "minRtt")] + pub fn set_min_rtt(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numIncomingStreamsCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numIncomingStreamsCreated")] + pub fn get_num_incoming_streams_created(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `numIncomingStreamsCreated` field of this object."] #[doc = ""] @@ -105,10 +104,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn num_incoming_streams_created(&mut self, val: u32) -> &mut Self { - self.num_incoming_streams_created_shim(val); - self - } + #[wasm_bindgen(method, setter = "numIncomingStreamsCreated")] + pub fn set_num_incoming_streams_created(this: &WebTransportStats, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `numOutgoingStreamsCreated` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "numOutgoingStreamsCreated")] + pub fn get_num_outgoing_streams_created(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `numOutgoingStreamsCreated` field of this object."] #[doc = ""] @@ -116,10 +122,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn num_outgoing_streams_created(&mut self, val: u32) -> &mut Self { - self.num_outgoing_streams_created_shim(val); - self - } + #[wasm_bindgen(method, setter = "numOutgoingStreamsCreated")] + pub fn set_num_outgoing_streams_created(this: &WebTransportStats, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `packetsLost` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "packetsLost")] + pub fn get_packets_lost(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `packetsLost` field of this object."] #[doc = ""] @@ -127,10 +140,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn packets_lost(&mut self, val: f64) -> &mut Self { - self.packets_lost_shim(val); - self - } + #[wasm_bindgen(method, setter = "packetsLost")] + pub fn set_packets_lost(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `packetsReceived` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "packetsReceived")] + pub fn get_packets_received(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `packetsReceived` field of this object."] #[doc = ""] @@ -138,10 +158,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn packets_received(&mut self, val: f64) -> &mut Self { - self.packets_received_shim(val); - self - } + #[wasm_bindgen(method, setter = "packetsReceived")] + pub fn set_packets_received(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `packetsSent` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "packetsSent")] + pub fn get_packets_sent(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `packetsSent` field of this object."] #[doc = ""] @@ -149,10 +176,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn packets_sent(&mut self, val: f64) -> &mut Self { - self.packets_sent_shim(val); - self - } + #[wasm_bindgen(method, setter = "packetsSent")] + pub fn set_packets_sent(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rttVariation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rttVariation")] + pub fn get_rtt_variation(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rttVariation` field of this object."] #[doc = ""] @@ -160,10 +194,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn rtt_variation(&mut self, val: f64) -> &mut Self { - self.rtt_variation_shim(val); - self - } + #[wasm_bindgen(method, setter = "rttVariation")] + pub fn set_rtt_variation(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `smoothedRtt` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "smoothedRtt")] + pub fn get_smoothed_rtt(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `smoothedRtt` field of this object."] #[doc = ""] @@ -171,10 +212,17 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn smoothed_rtt(&mut self, val: f64) -> &mut Self { - self.smoothed_rtt_shim(val); - self - } + #[wasm_bindgen(method, setter = "smoothedRtt")] + pub fn set_smoothed_rtt(this: &WebTransportStats, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &WebTransportStats) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `timestamp` field of this object."] #[doc = ""] @@ -182,8 +230,93 @@ impl WebTransportStats { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &WebTransportStats, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl WebTransportStats { + #[doc = "Construct a new `WebTransportStats`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebTransportStats`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_received()` instead."] + pub fn bytes_received(&mut self, val: f64) -> &mut Self { + self.set_bytes_received(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bytes_sent()` instead."] + pub fn bytes_sent(&mut self, val: f64) -> &mut Self { + self.set_bytes_sent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WebTransportDatagramStats")] + #[deprecated = "Use `set_datagrams()` instead."] + pub fn datagrams(&mut self, val: &WebTransportDatagramStats) -> &mut Self { + self.set_datagrams(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_min_rtt()` instead."] + pub fn min_rtt(&mut self, val: f64) -> &mut Self { + self.set_min_rtt(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_num_incoming_streams_created()` instead."] + pub fn num_incoming_streams_created(&mut self, val: u32) -> &mut Self { + self.set_num_incoming_streams_created(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_num_outgoing_streams_created()` instead."] + pub fn num_outgoing_streams_created(&mut self, val: u32) -> &mut Self { + self.set_num_outgoing_streams_created(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_packets_lost()` instead."] + pub fn packets_lost(&mut self, val: f64) -> &mut Self { + self.set_packets_lost(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_packets_received()` instead."] + pub fn packets_received(&mut self, val: f64) -> &mut Self { + self.set_packets_received(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_packets_sent()` instead."] + pub fn packets_sent(&mut self, val: f64) -> &mut Self { + self.set_packets_sent(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rtt_variation()` instead."] + pub fn rtt_variation(&mut self, val: f64) -> &mut Self { + self.set_rtt_variation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_smoothed_rtt()` instead."] + pub fn smoothed_rtt(&mut self, val: f64) -> &mut Self { + self.set_smoothed_rtt(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] pub fn timestamp(&mut self, val: f64) -> &mut Self { - self.timestamp_shim(val); + self.set_timestamp(val); self } } diff --git a/crates/web-sys/src/features/gen_WheelEventInit.rs b/crates/web-sys/src/features/gen_WheelEventInit.rs index 26a815349b6..f8e734ab832 100644 --- a/crates/web-sys/src/features/gen_WheelEventInit.rs +++ b/crates/web-sys/src/features/gen_WheelEventInit.rs @@ -10,70 +10,320 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] pub type WheelEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &WheelEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &WheelEventInit, val: bool); + pub fn set_bubbles(this: &WheelEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &WheelEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &WheelEventInit, val: bool); + pub fn set_cancelable(this: &WheelEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &WheelEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &WheelEventInit, val: bool); + pub fn set_composed(this: &WheelEventInit, val: bool); + #[doc = "Get the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "detail")] + pub fn get_detail(this: &WheelEventInit) -> Option; + #[doc = "Change the `detail` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "detail")] - fn detail_shim(this: &WheelEventInit, val: i32); + pub fn set_detail(this: &WheelEventInit, val: i32); #[cfg(feature = "Window")] + #[doc = "Get the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`, `Window`*"] + #[wasm_bindgen(method, getter = "view")] + pub fn get_view(this: &WheelEventInit) -> Option; + #[cfg(feature = "Window")] + #[doc = "Change the `view` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`, `Window`*"] #[wasm_bindgen(method, setter = "view")] - fn view_shim(this: &WheelEventInit, val: Option<&Window>); + pub fn set_view(this: &WheelEventInit, val: Option<&Window>); + #[doc = "Get the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "altKey")] + pub fn get_alt_key(this: &WheelEventInit) -> Option; + #[doc = "Change the `altKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "altKey")] - fn alt_key_shim(this: &WheelEventInit, val: bool); + pub fn set_alt_key(this: &WheelEventInit, val: bool); + #[doc = "Get the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "ctrlKey")] + pub fn get_ctrl_key(this: &WheelEventInit) -> Option; + #[doc = "Change the `ctrlKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "ctrlKey")] - fn ctrl_key_shim(this: &WheelEventInit, val: bool); + pub fn set_ctrl_key(this: &WheelEventInit, val: bool); + #[doc = "Get the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "metaKey")] + pub fn get_meta_key(this: &WheelEventInit) -> Option; + #[doc = "Change the `metaKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "metaKey")] - fn meta_key_shim(this: &WheelEventInit, val: bool); + pub fn set_meta_key(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierAltGraph")] + pub fn get_modifier_alt_graph(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierAltGraph` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierAltGraph")] - fn modifier_alt_graph_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_alt_graph(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierCapsLock")] + pub fn get_modifier_caps_lock(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierCapsLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierCapsLock")] - fn modifier_caps_lock_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_caps_lock(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFn")] + pub fn get_modifier_fn(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierFn` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierFn")] - fn modifier_fn_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_fn(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierFnLock")] + pub fn get_modifier_fn_lock(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierFnLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierFnLock")] - fn modifier_fn_lock_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_fn_lock(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierNumLock")] + pub fn get_modifier_num_lock(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierNumLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierNumLock")] - fn modifier_num_lock_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_num_lock(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierOS")] + pub fn get_modifier_os(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierOS` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierOS")] - fn modifier_os_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_os(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierScrollLock")] + pub fn get_modifier_scroll_lock(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierScrollLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierScrollLock")] - fn modifier_scroll_lock_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_scroll_lock(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbol")] + pub fn get_modifier_symbol(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierSymbol` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbol")] - fn modifier_symbol_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_symbol(this: &WheelEventInit, val: bool); + #[doc = "Get the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "modifierSymbolLock")] + pub fn get_modifier_symbol_lock(this: &WheelEventInit) -> Option; + #[doc = "Change the `modifierSymbolLock` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "modifierSymbolLock")] - fn modifier_symbol_lock_shim(this: &WheelEventInit, val: bool); + pub fn set_modifier_symbol_lock(this: &WheelEventInit, val: bool); + #[doc = "Get the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "shiftKey")] + pub fn get_shift_key(this: &WheelEventInit) -> Option; + #[doc = "Change the `shiftKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "shiftKey")] - fn shift_key_shim(this: &WheelEventInit, val: bool); + pub fn set_shift_key(this: &WheelEventInit, val: bool); + #[doc = "Get the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "button")] + pub fn get_button(this: &WheelEventInit) -> Option; + #[doc = "Change the `button` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "button")] - fn button_shim(this: &WheelEventInit, val: i16); + pub fn set_button(this: &WheelEventInit, val: i16); + #[doc = "Get the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "buttons")] + pub fn get_buttons(this: &WheelEventInit) -> Option; + #[doc = "Change the `buttons` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "buttons")] - fn buttons_shim(this: &WheelEventInit, val: u16); + pub fn set_buttons(this: &WheelEventInit, val: u16); + #[doc = "Get the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "clientX")] + pub fn get_client_x(this: &WheelEventInit) -> Option; + #[doc = "Change the `clientX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "clientX")] - fn client_x_shim(this: &WheelEventInit, val: i32); + pub fn set_client_x(this: &WheelEventInit, val: i32); + #[doc = "Get the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "clientY")] + pub fn get_client_y(this: &WheelEventInit) -> Option; + #[doc = "Change the `clientY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "clientY")] - fn client_y_shim(this: &WheelEventInit, val: i32); + pub fn set_client_y(this: &WheelEventInit, val: i32); + #[doc = "Get the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "movementX")] + pub fn get_movement_x(this: &WheelEventInit) -> Option; + #[doc = "Change the `movementX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "movementX")] - fn movement_x_shim(this: &WheelEventInit, val: i32); + pub fn set_movement_x(this: &WheelEventInit, val: i32); + #[doc = "Get the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "movementY")] + pub fn get_movement_y(this: &WheelEventInit) -> Option; + #[doc = "Change the `movementY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "movementY")] - fn movement_y_shim(this: &WheelEventInit, val: i32); + pub fn set_movement_y(this: &WheelEventInit, val: i32); #[cfg(feature = "EventTarget")] + #[doc = "Get the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "relatedTarget")] + pub fn get_related_target(this: &WheelEventInit) -> Option; + #[cfg(feature = "EventTarget")] + #[doc = "Change the `relatedTarget` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `WheelEventInit`*"] #[wasm_bindgen(method, setter = "relatedTarget")] - fn related_target_shim(this: &WheelEventInit, val: Option<&EventTarget>); + pub fn set_related_target(this: &WheelEventInit, val: Option<&EventTarget>); + #[doc = "Get the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "screenX")] + pub fn get_screen_x(this: &WheelEventInit) -> Option; + #[doc = "Change the `screenX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "screenX")] - fn screen_x_shim(this: &WheelEventInit, val: i32); + pub fn set_screen_x(this: &WheelEventInit, val: i32); + #[doc = "Get the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "screenY")] + pub fn get_screen_y(this: &WheelEventInit) -> Option; + #[doc = "Change the `screenY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "screenY")] - fn screen_y_shim(this: &WheelEventInit, val: i32); + pub fn set_screen_y(this: &WheelEventInit, val: i32); + #[doc = "Get the `deltaMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "deltaMode")] + pub fn get_delta_mode(this: &WheelEventInit) -> Option; + #[doc = "Change the `deltaMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "deltaMode")] - fn delta_mode_shim(this: &WheelEventInit, val: u32); + pub fn set_delta_mode(this: &WheelEventInit, val: u32); + #[doc = "Get the `deltaX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "deltaX")] + pub fn get_delta_x(this: &WheelEventInit) -> Option; + #[doc = "Change the `deltaX` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "deltaX")] - fn delta_x_shim(this: &WheelEventInit, val: f64); + pub fn set_delta_x(this: &WheelEventInit, val: f64); + #[doc = "Get the `deltaY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "deltaY")] + pub fn get_delta_y(this: &WheelEventInit) -> Option; + #[doc = "Change the `deltaY` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "deltaY")] - fn delta_y_shim(this: &WheelEventInit, val: f64); + pub fn set_delta_y(this: &WheelEventInit, val: f64); + #[doc = "Get the `deltaZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[wasm_bindgen(method, getter = "deltaZ")] + pub fn get_delta_z(this: &WheelEventInit) -> Option; + #[doc = "Change the `deltaZ` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] #[wasm_bindgen(method, setter = "deltaZ")] - fn delta_z_shim(this: &WheelEventInit, val: f64); + pub fn set_delta_z(this: &WheelEventInit, val: f64); } impl WheelEventInit { #[doc = "Construct a new `WheelEventInit`."] @@ -84,223 +334,161 @@ impl WheelEventInit { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } - #[doc = "Change the `detail` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_detail()` instead."] pub fn detail(&mut self, val: i32) -> &mut Self { - self.detail_shim(val); + self.set_detail(val); self } #[cfg(feature = "Window")] - #[doc = "Change the `view` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`, `Window`*"] + #[deprecated = "Use `set_view()` instead."] pub fn view(&mut self, val: Option<&Window>) -> &mut Self { - self.view_shim(val); + self.set_view(val); self } - #[doc = "Change the `altKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_alt_key()` instead."] pub fn alt_key(&mut self, val: bool) -> &mut Self { - self.alt_key_shim(val); + self.set_alt_key(val); self } - #[doc = "Change the `ctrlKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_ctrl_key()` instead."] pub fn ctrl_key(&mut self, val: bool) -> &mut Self { - self.ctrl_key_shim(val); + self.set_ctrl_key(val); self } - #[doc = "Change the `metaKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_meta_key()` instead."] pub fn meta_key(&mut self, val: bool) -> &mut Self { - self.meta_key_shim(val); + self.set_meta_key(val); self } - #[doc = "Change the `modifierAltGraph` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_alt_graph()` instead."] pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self { - self.modifier_alt_graph_shim(val); + self.set_modifier_alt_graph(val); self } - #[doc = "Change the `modifierCapsLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_caps_lock()` instead."] pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self { - self.modifier_caps_lock_shim(val); + self.set_modifier_caps_lock(val); self } - #[doc = "Change the `modifierFn` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_fn()` instead."] pub fn modifier_fn(&mut self, val: bool) -> &mut Self { - self.modifier_fn_shim(val); + self.set_modifier_fn(val); self } - #[doc = "Change the `modifierFnLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_fn_lock()` instead."] pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self { - self.modifier_fn_lock_shim(val); + self.set_modifier_fn_lock(val); self } - #[doc = "Change the `modifierNumLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_num_lock()` instead."] pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self { - self.modifier_num_lock_shim(val); + self.set_modifier_num_lock(val); self } - #[doc = "Change the `modifierOS` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_os()` instead."] pub fn modifier_os(&mut self, val: bool) -> &mut Self { - self.modifier_os_shim(val); + self.set_modifier_os(val); self } - #[doc = "Change the `modifierScrollLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_scroll_lock()` instead."] pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self { - self.modifier_scroll_lock_shim(val); + self.set_modifier_scroll_lock(val); self } - #[doc = "Change the `modifierSymbol` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_symbol()` instead."] pub fn modifier_symbol(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_shim(val); + self.set_modifier_symbol(val); self } - #[doc = "Change the `modifierSymbolLock` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_modifier_symbol_lock()` instead."] pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self { - self.modifier_symbol_lock_shim(val); + self.set_modifier_symbol_lock(val); self } - #[doc = "Change the `shiftKey` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_shift_key()` instead."] pub fn shift_key(&mut self, val: bool) -> &mut Self { - self.shift_key_shim(val); + self.set_shift_key(val); self } - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_button()` instead."] pub fn button(&mut self, val: i16) -> &mut Self { - self.button_shim(val); + self.set_button(val); self } - #[doc = "Change the `buttons` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_buttons()` instead."] pub fn buttons(&mut self, val: u16) -> &mut Self { - self.buttons_shim(val); + self.set_buttons(val); self } - #[doc = "Change the `clientX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_client_x()` instead."] pub fn client_x(&mut self, val: i32) -> &mut Self { - self.client_x_shim(val); + self.set_client_x(val); self } - #[doc = "Change the `clientY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_client_y()` instead."] pub fn client_y(&mut self, val: i32) -> &mut Self { - self.client_y_shim(val); + self.set_client_y(val); self } - #[doc = "Change the `movementX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_movement_x()` instead."] pub fn movement_x(&mut self, val: i32) -> &mut Self { - self.movement_x_shim(val); + self.set_movement_x(val); self } - #[doc = "Change the `movementY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_movement_y()` instead."] pub fn movement_y(&mut self, val: i32) -> &mut Self { - self.movement_y_shim(val); + self.set_movement_y(val); self } #[cfg(feature = "EventTarget")] - #[doc = "Change the `relatedTarget` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `WheelEventInit`*"] + #[deprecated = "Use `set_related_target()` instead."] pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self { - self.related_target_shim(val); + self.set_related_target(val); self } - #[doc = "Change the `screenX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_screen_x()` instead."] pub fn screen_x(&mut self, val: i32) -> &mut Self { - self.screen_x_shim(val); + self.set_screen_x(val); self } - #[doc = "Change the `screenY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_screen_y()` instead."] pub fn screen_y(&mut self, val: i32) -> &mut Self { - self.screen_y_shim(val); + self.set_screen_y(val); self } - #[doc = "Change the `deltaMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_delta_mode()` instead."] pub fn delta_mode(&mut self, val: u32) -> &mut Self { - self.delta_mode_shim(val); + self.set_delta_mode(val); self } - #[doc = "Change the `deltaX` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_delta_x()` instead."] pub fn delta_x(&mut self, val: f64) -> &mut Self { - self.delta_x_shim(val); + self.set_delta_x(val); self } - #[doc = "Change the `deltaY` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_delta_y()` instead."] pub fn delta_y(&mut self, val: f64) -> &mut Self { - self.delta_y_shim(val); + self.set_delta_y(val); self } - #[doc = "Change the `deltaZ` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"] + #[deprecated = "Use `set_delta_z()` instead."] pub fn delta_z(&mut self, val: f64) -> &mut Self { - self.delta_z_shim(val); + self.set_delta_z(val); self } } diff --git a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs index 18a7300b0a1..a9ae7990833 100644 --- a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs +++ b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs @@ -10,20 +10,76 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] pub type WidevineCdmManifest; + #[doc = "Get the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "description")] + pub fn get_description(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `description` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "description")] - fn description_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_description(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_name(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "version")] + pub fn get_version(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `version` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "version")] - fn version_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_version(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `x-cdm-codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "x-cdm-codecs")] + pub fn get_x_cdm_codecs(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `x-cdm-codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "x-cdm-codecs")] - fn x_cdm_codecs_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_x_cdm_codecs(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `x-cdm-host-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "x-cdm-host-versions")] + pub fn get_x_cdm_host_versions(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `x-cdm-host-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "x-cdm-host-versions")] - fn x_cdm_host_versions_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_x_cdm_host_versions(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `x-cdm-interface-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "x-cdm-interface-versions")] + pub fn get_x_cdm_interface_versions(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `x-cdm-interface-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "x-cdm-interface-versions")] - fn x_cdm_interface_versions_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_x_cdm_interface_versions(this: &WidevineCdmManifest, val: &str); + #[doc = "Get the `x-cdm-module-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[wasm_bindgen(method, getter = "x-cdm-module-versions")] + pub fn get_x_cdm_module_versions(this: &WidevineCdmManifest) -> String; + #[doc = "Change the `x-cdm-module-versions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, setter = "x-cdm-module-versions")] - fn x_cdm_module_versions_shim(this: &WidevineCdmManifest, val: &str); + pub fn set_x_cdm_module_versions(this: &WidevineCdmManifest, val: &str); } impl WidevineCdmManifest { #[doc = "Construct a new `WidevineCdmManifest`."] @@ -49,53 +105,39 @@ impl WidevineCdmManifest { ret.x_cdm_module_versions(x_cdm_module_versions); ret } - #[doc = "Change the `description` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &str) -> &mut Self { - self.description_shim(val); + self.set_description(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } - #[doc = "Change the `version` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_version()` instead."] pub fn version(&mut self, val: &str) -> &mut Self { - self.version_shim(val); + self.set_version(val); self } - #[doc = "Change the `x-cdm-codecs` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_x_cdm_codecs()` instead."] pub fn x_cdm_codecs(&mut self, val: &str) -> &mut Self { - self.x_cdm_codecs_shim(val); + self.set_x_cdm_codecs(val); self } - #[doc = "Change the `x-cdm-host-versions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_x_cdm_host_versions()` instead."] pub fn x_cdm_host_versions(&mut self, val: &str) -> &mut Self { - self.x_cdm_host_versions_shim(val); + self.set_x_cdm_host_versions(val); self } - #[doc = "Change the `x-cdm-interface-versions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_x_cdm_interface_versions()` instead."] pub fn x_cdm_interface_versions(&mut self, val: &str) -> &mut Self { - self.x_cdm_interface_versions_shim(val); + self.set_x_cdm_interface_versions(val); self } - #[doc = "Change the `x-cdm-module-versions` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] + #[deprecated = "Use `set_x_cdm_module_versions()` instead."] pub fn x_cdm_module_versions(&mut self, val: &str) -> &mut Self { - self.x_cdm_module_versions_shim(val); + self.set_x_cdm_module_versions(val); self } } diff --git a/crates/web-sys/src/features/gen_WorkerOptions.rs b/crates/web-sys/src/features/gen_WorkerOptions.rs index e3f9b1edee3..e14b81609cc 100644 --- a/crates/web-sys/src/features/gen_WorkerOptions.rs +++ b/crates/web-sys/src/features/gen_WorkerOptions.rs @@ -11,13 +11,39 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] pub type WorkerOptions; #[cfg(feature = "RequestCredentials")] + #[doc = "Get the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"] + #[wasm_bindgen(method, getter = "credentials")] + pub fn get_credentials(this: &WorkerOptions) -> Option; + #[cfg(feature = "RequestCredentials")] + #[doc = "Change the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"] #[wasm_bindgen(method, setter = "credentials")] - fn credentials_shim(this: &WorkerOptions, val: RequestCredentials); + pub fn set_credentials(this: &WorkerOptions, val: RequestCredentials); + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &WorkerOptions) -> Option; + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &WorkerOptions, val: &str); + pub fn set_name(this: &WorkerOptions, val: &str); + #[cfg(feature = "WorkerType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &WorkerOptions) -> Option; #[cfg(feature = "WorkerType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &WorkerOptions, val: WorkerType); + pub fn set_type(this: &WorkerOptions, val: WorkerType); } impl WorkerOptions { #[doc = "Construct a new `WorkerOptions`."] @@ -29,26 +55,20 @@ impl WorkerOptions { ret } #[cfg(feature = "RequestCredentials")] - #[doc = "Change the `credentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"] + #[deprecated = "Use `set_credentials()` instead."] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - self.credentials_shim(val); + self.set_credentials(val); self } - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: &str) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(feature = "WorkerType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: WorkerType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_WorkletOptions.rs b/crates/web-sys/src/features/gen_WorkletOptions.rs index 94b0e62f7ab..07089ac8d49 100644 --- a/crates/web-sys/src/features/gen_WorkletOptions.rs +++ b/crates/web-sys/src/features/gen_WorkletOptions.rs @@ -11,8 +11,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `WorkletOptions`*"] pub type WorkletOptions; #[cfg(feature = "RequestCredentials")] + #[doc = "Get the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkletOptions`*"] + #[wasm_bindgen(method, getter = "credentials")] + pub fn get_credentials(this: &WorkletOptions) -> Option; + #[cfg(feature = "RequestCredentials")] + #[doc = "Change the `credentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkletOptions`*"] #[wasm_bindgen(method, setter = "credentials")] - fn credentials_shim(this: &WorkletOptions, val: RequestCredentials); + pub fn set_credentials(this: &WorkletOptions, val: RequestCredentials); } impl WorkletOptions { #[doc = "Construct a new `WorkletOptions`."] @@ -24,11 +33,9 @@ impl WorkletOptions { ret } #[cfg(feature = "RequestCredentials")] - #[doc = "Change the `credentials` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkletOptions`*"] + #[deprecated = "Use `set_credentials()` instead."] pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { - self.credentials_shim(val); + self.set_credentials(val); self } } diff --git a/crates/web-sys/src/features/gen_WriteParams.rs b/crates/web-sys/src/features/gen_WriteParams.rs index 13223458c74..a8c0ac9c754 100644 --- a/crates/web-sys/src/features/gen_WriteParams.rs +++ b/crates/web-sys/src/features/gen_WriteParams.rs @@ -10,15 +10,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] pub type WriteParams; + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &WriteParams) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] #[wasm_bindgen(method, setter = "data")] - fn data_shim(this: &WriteParams, val: &::wasm_bindgen::JsValue); + pub fn set_data(this: &WriteParams, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `position` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[wasm_bindgen(method, getter = "position")] + pub fn get_position(this: &WriteParams) -> Option; + #[doc = "Change the `position` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] #[wasm_bindgen(method, setter = "position")] - fn position_shim(this: &WriteParams, val: Option); + pub fn set_position(this: &WriteParams, val: Option); + #[doc = "Get the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[wasm_bindgen(method, getter = "size")] + pub fn get_size(this: &WriteParams) -> Option; + #[doc = "Change the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] #[wasm_bindgen(method, setter = "size")] - fn size_shim(this: &WriteParams, val: Option); + pub fn set_size(this: &WriteParams, val: Option); #[cfg(feature = "WriteCommandType")] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &WriteParams) -> WriteCommandType; + #[cfg(feature = "WriteCommandType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] #[wasm_bindgen(method, setter = "type")] - fn type__shim(this: &WriteParams, val: WriteCommandType); + pub fn set_type(this: &WriteParams, val: WriteCommandType); } impl WriteParams { #[cfg(feature = "WriteCommandType")] @@ -31,33 +64,25 @@ impl WriteParams { ret.type_(type_); ret } - #[doc = "Change the `data` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[deprecated = "Use `set_data()` instead."] pub fn data(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.data_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_data(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } - #[doc = "Change the `position` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[deprecated = "Use `set_position()` instead."] pub fn position(&mut self, val: Option) -> &mut Self { - self.position_shim(val); + self.set_position(val); self } - #[doc = "Change the `size` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[deprecated = "Use `set_size()` instead."] pub fn size(&mut self, val: Option) -> &mut Self { - self.size_shim(val); + self.set_size(val); self } #[cfg(feature = "WriteCommandType")] - #[doc = "Change the `type` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] + #[deprecated = "Use `set_type()` instead."] pub fn type_(&mut self, val: WriteCommandType) -> &mut Self { - self.type__shim(val); + self.set_type(val); self } } diff --git a/crates/web-sys/src/features/gen_XPathNsResolver.rs b/crates/web-sys/src/features/gen_XPathNsResolver.rs index 4601c9df1fc..d158b05ac1c 100644 --- a/crates/web-sys/src/features/gen_XPathNsResolver.rs +++ b/crates/web-sys/src/features/gen_XPathNsResolver.rs @@ -10,8 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] pub type XPathNsResolver; + #[doc = "Get the `lookupNamespaceURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] + #[wasm_bindgen(method, getter = "lookupNamespaceURI")] + pub fn get_lookup_namespace_uri(this: &XPathNsResolver) -> Option<::js_sys::Function>; + #[doc = "Change the `lookupNamespaceURI` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] #[wasm_bindgen(method, setter = "lookupNamespaceURI")] - fn lookup_namespace_uri_shim(this: &XPathNsResolver, val: &::js_sys::Function); + pub fn set_lookup_namespace_uri(this: &XPathNsResolver, val: &::js_sys::Function); } impl XPathNsResolver { #[doc = "Construct a new `XPathNsResolver`."] @@ -22,11 +30,9 @@ impl XPathNsResolver { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } - #[doc = "Change the `lookupNamespaceURI` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XPathNsResolver`*"] + #[deprecated = "Use `set_lookup_namespace_uri()` instead."] pub fn lookup_namespace_uri(&mut self, val: &::js_sys::Function) -> &mut Self { - self.lookup_namespace_uri_shim(val); + self.set_lookup_namespace_uri(val); self } } diff --git a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs index 6f6712be78c..fc4d8fa2c01 100644 --- a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs @@ -14,18 +14,100 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrInputSourceEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &XrInputSourceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &XrInputSourceEventInit, val: bool); + pub fn set_bubbles(this: &XrInputSourceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &XrInputSourceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &XrInputSourceEventInit, val: bool); + pub fn set_cancelable(this: &XrInputSourceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &XrInputSourceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &XrInputSourceEventInit, val: bool); + pub fn set_composed(this: &XrInputSourceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrFrame")] + #[doc = "Get the `frame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frame")] + pub fn get_frame(this: &XrInputSourceEventInit) -> XrFrame; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrFrame")] + #[doc = "Change the `frame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "frame")] - fn frame_shim(this: &XrInputSourceEventInit, val: &XrFrame); + pub fn set_frame(this: &XrInputSourceEventInit, val: &XrFrame); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrInputSource")] + #[doc = "Get the `inputSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSource`, `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "inputSource")] + pub fn get_input_source(this: &XrInputSourceEventInit) -> XrInputSource; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrInputSource")] + #[doc = "Change the `inputSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSource`, `XrInputSourceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "inputSource")] - fn input_source_shim(this: &XrInputSourceEventInit, val: &XrInputSource); + pub fn set_input_source(this: &XrInputSourceEventInit, val: &XrInputSource); } #[cfg(web_sys_unstable_apis)] impl XrInputSourceEventInit { @@ -44,60 +126,35 @@ impl XrInputSourceEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrFrame")] - #[doc = "Change the `frame` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrInputSourceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_frame()` instead."] pub fn frame(&mut self, val: &XrFrame) -> &mut Self { - self.frame_shim(val); + self.set_frame(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrInputSource")] - #[doc = "Change the `inputSource` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSource`, `XrInputSourceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_input_source()` instead."] pub fn input_source(&mut self, val: &XrInputSource) -> &mut Self { - self.input_source_shim(val); + self.set_input_source(val); self } } diff --git a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs index 849c940a1ad..c2d2e32e4bb 100644 --- a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs @@ -14,19 +14,116 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrInputSourcesChangeEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &XrInputSourcesChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &XrInputSourcesChangeEventInit, val: bool); + pub fn set_bubbles(this: &XrInputSourcesChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &XrInputSourcesChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &XrInputSourcesChangeEventInit, val: bool); + pub fn set_cancelable(this: &XrInputSourcesChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &XrInputSourcesChangeEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &XrInputSourcesChangeEventInit, val: bool); + pub fn set_composed(this: &XrInputSourcesChangeEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `added` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "added")] + pub fn get_added(this: &XrInputSourcesChangeEventInit) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `added` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "added")] - fn added_shim(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_added(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `removed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "removed")] + pub fn get_removed(this: &XrInputSourcesChangeEventInit) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `removed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "removed")] - fn removed_shim(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + pub fn set_removed(this: &XrInputSourcesChangeEventInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSession")] + #[doc = "Get the `session` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`, `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "session")] + pub fn get_session(this: &XrInputSourcesChangeEventInit) -> XrSession; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSession")] + #[doc = "Change the `session` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`, `XrSession`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "session")] - fn session_shim(this: &XrInputSourcesChangeEventInit, val: &XrSession); + pub fn set_session(this: &XrInputSourcesChangeEventInit, val: &XrSession); } #[cfg(web_sys_unstable_apis)] impl XrInputSourcesChangeEventInit { @@ -50,70 +147,40 @@ impl XrInputSourcesChangeEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `added` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_added()` instead."] pub fn added(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.added_shim(val); + self.set_added(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `removed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_removed()` instead."] pub fn removed(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.removed_shim(val); + self.set_removed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSession")] - #[doc = "Change the `session` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrInputSourcesChangeEventInit`, `XrSession`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_session()` instead."] pub fn session(&mut self, val: &XrSession) -> &mut Self { - self.session_shim(val); + self.set_session(val); self } } diff --git a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs index 51d4adbfe9e..6884a9b83db 100644 --- a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs @@ -14,16 +14,82 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &XrPermissionDescriptor) -> PermissionName; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &XrPermissionDescriptor, val: PermissionName); + pub fn set_name(this: &XrPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSessionMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`, `XrSessionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &XrPermissionDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSessionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`, `XrSessionMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &XrPermissionDescriptor, val: XrSessionMode); + pub fn set_mode(this: &XrPermissionDescriptor, val: XrSessionMode); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `optionalFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "optionalFeatures")] + pub fn get_optional_features(this: &XrPermissionDescriptor) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `optionalFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "optionalFeatures")] - fn optional_features_shim(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_optional_features(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requiredFeatures")] + pub fn get_required_features(this: &XrPermissionDescriptor) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "requiredFeatures")] - fn required_features_shim(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); + pub fn set_required_features(this: &XrPermissionDescriptor, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl XrPermissionDescriptor { @@ -42,48 +108,28 @@ impl XrPermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSessionMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`, `XrSessionMode`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `optionalFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_optional_features()` instead."] pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.optional_features_shim(val); + self.set_optional_features(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `requiredFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_required_features()` instead."] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.required_features_shim(val); + self.set_required_features(val); self } } diff --git a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs index 4dbfb69ea22..8d36176b94b 100644 --- a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs @@ -14,18 +14,100 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrReferenceSpaceEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &XrReferenceSpaceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &XrReferenceSpaceEventInit, val: bool); + pub fn set_bubbles(this: &XrReferenceSpaceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &XrReferenceSpaceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &XrReferenceSpaceEventInit, val: bool); + pub fn set_cancelable(this: &XrReferenceSpaceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &XrReferenceSpaceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &XrReferenceSpaceEventInit, val: bool); + pub fn set_composed(this: &XrReferenceSpaceEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrReferenceSpace")] + #[doc = "Get the `referenceSpace` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpace`, `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "referenceSpace")] + pub fn get_reference_space(this: &XrReferenceSpaceEventInit) -> XrReferenceSpace; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrReferenceSpace")] + #[doc = "Change the `referenceSpace` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpace`, `XrReferenceSpaceEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "referenceSpace")] - fn reference_space_shim(this: &XrReferenceSpaceEventInit, val: &XrReferenceSpace); + pub fn set_reference_space(this: &XrReferenceSpaceEventInit, val: &XrReferenceSpace); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrRigidTransform")] + #[doc = "Get the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`, `XrRigidTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "transform")] + pub fn get_transform(this: &XrReferenceSpaceEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrRigidTransform")] + #[doc = "Change the `transform` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`, `XrRigidTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "transform")] - fn transform_shim(this: &XrReferenceSpaceEventInit, val: Option<&XrRigidTransform>); + pub fn set_transform(this: &XrReferenceSpaceEventInit, val: Option<&XrRigidTransform>); } #[cfg(web_sys_unstable_apis)] impl XrReferenceSpaceEventInit { @@ -43,60 +125,35 @@ impl XrReferenceSpaceEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrReferenceSpace")] - #[doc = "Change the `referenceSpace` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpace`, `XrReferenceSpaceEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_reference_space()` instead."] pub fn reference_space(&mut self, val: &XrReferenceSpace) -> &mut Self { - self.reference_space_shim(val); + self.set_reference_space(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrRigidTransform")] - #[doc = "Change the `transform` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrReferenceSpaceEventInit`, `XrRigidTransform`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_transform()` instead."] pub fn transform(&mut self, val: Option<&XrRigidTransform>) -> &mut Self { - self.transform_shim(val); + self.set_transform(val); self } } diff --git a/crates/web-sys/src/features/gen_XrRenderStateInit.rs b/crates/web-sys/src/features/gen_XrRenderStateInit.rs index 7b982dfa1dc..80c948a87c0 100644 --- a/crates/web-sys/src/features/gen_XrRenderStateInit.rs +++ b/crates/web-sys/src/features/gen_XrRenderStateInit.rs @@ -14,31 +14,16 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrRenderStateInit; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrWebGlLayer")] - #[wasm_bindgen(method, setter = "baseLayer")] - fn base_layer_shim(this: &XrRenderStateInit, val: Option<&XrWebGlLayer>); - #[wasm_bindgen(method, setter = "depthFar")] - fn depth_far_shim(this: &XrRenderStateInit, val: f64); - #[wasm_bindgen(method, setter = "depthNear")] - fn depth_near_shim(this: &XrRenderStateInit, val: f64); - #[wasm_bindgen(method, setter = "inlineVerticalFieldOfView")] - fn inline_vertical_field_of_view_shim(this: &XrRenderStateInit, val: f64); - #[wasm_bindgen(method, setter = "layers")] - fn layers_shim(this: &XrRenderStateInit, val: &::wasm_bindgen::JsValue); -} -#[cfg(web_sys_unstable_apis)] -impl XrRenderStateInit { - #[doc = "Construct a new `XrRenderStateInit`."] + #[doc = "Get the `baseLayer` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "baseLayer")] + pub fn get_base_layer(this: &XrRenderStateInit) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrWebGlLayer")] #[doc = "Change the `baseLayer` field of this object."] @@ -47,10 +32,17 @@ impl XrRenderStateInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn base_layer(&mut self, val: Option<&XrWebGlLayer>) -> &mut Self { - self.base_layer_shim(val); - self - } + #[wasm_bindgen(method, setter = "baseLayer")] + pub fn set_base_layer(this: &XrRenderStateInit, val: Option<&XrWebGlLayer>); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthFar` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthFar")] + pub fn get_depth_far(this: &XrRenderStateInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthFar` field of this object."] #[doc = ""] @@ -58,10 +50,17 @@ impl XrRenderStateInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_far(&mut self, val: f64) -> &mut Self { - self.depth_far_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthFar")] + pub fn set_depth_far(this: &XrRenderStateInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depthNear` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depthNear")] + pub fn get_depth_near(this: &XrRenderStateInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depthNear` field of this object."] #[doc = ""] @@ -69,10 +68,17 @@ impl XrRenderStateInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth_near(&mut self, val: f64) -> &mut Self { - self.depth_near_shim(val); - self - } + #[wasm_bindgen(method, setter = "depthNear")] + pub fn set_depth_near(this: &XrRenderStateInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `inlineVerticalFieldOfView` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "inlineVerticalFieldOfView")] + pub fn get_inline_vertical_field_of_view(this: &XrRenderStateInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `inlineVerticalFieldOfView` field of this object."] #[doc = ""] @@ -80,10 +86,17 @@ impl XrRenderStateInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn inline_vertical_field_of_view(&mut self, val: f64) -> &mut Self { - self.inline_vertical_field_of_view_shim(val); - self - } + #[wasm_bindgen(method, setter = "inlineVerticalFieldOfView")] + pub fn set_inline_vertical_field_of_view(this: &XrRenderStateInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `layers` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "layers")] + pub fn get_layers(this: &XrRenderStateInit) -> Option<::js_sys::Array>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `layers` field of this object."] #[doc = ""] @@ -91,8 +104,51 @@ impl XrRenderStateInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "layers")] + pub fn set_layers(this: &XrRenderStateInit, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl XrRenderStateInit { + #[doc = "Construct a new `XrRenderStateInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrRenderStateInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrWebGlLayer")] + #[deprecated = "Use `set_base_layer()` instead."] + pub fn base_layer(&mut self, val: Option<&XrWebGlLayer>) -> &mut Self { + self.set_base_layer(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_far()` instead."] + pub fn depth_far(&mut self, val: f64) -> &mut Self { + self.set_depth_far(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth_near()` instead."] + pub fn depth_near(&mut self, val: f64) -> &mut Self { + self.set_depth_near(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_inline_vertical_field_of_view()` instead."] + pub fn inline_vertical_field_of_view(&mut self, val: f64) -> &mut Self { + self.set_inline_vertical_field_of_view(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_layers()` instead."] pub fn layers(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { - self.layers_shim(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self.set_layers(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionEventInit.rs b/crates/web-sys/src/features/gen_XrSessionEventInit.rs index 56caaf616cf..39cea922779 100644 --- a/crates/web-sys/src/features/gen_XrSessionEventInit.rs +++ b/crates/web-sys/src/features/gen_XrSessionEventInit.rs @@ -14,15 +14,80 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &XrSessionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bubbles")] - fn bubbles_shim(this: &XrSessionEventInit, val: bool); + pub fn set_bubbles(this: &XrSessionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &XrSessionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "cancelable")] - fn cancelable_shim(this: &XrSessionEventInit, val: bool); + pub fn set_cancelable(this: &XrSessionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &XrSessionEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "composed")] - fn composed_shim(this: &XrSessionEventInit, val: bool); + pub fn set_composed(this: &XrSessionEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSession")] + #[doc = "Get the `session` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`, `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "session")] + pub fn get_session(this: &XrSessionEventInit) -> XrSession; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSession")] + #[doc = "Change the `session` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSession`, `XrSessionEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "session")] - fn session_shim(this: &XrSessionEventInit, val: &XrSession); + pub fn set_session(this: &XrSessionEventInit, val: &XrSession); } #[cfg(web_sys_unstable_apis)] impl XrSessionEventInit { @@ -40,48 +105,28 @@ impl XrSessionEventInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_bubbles()` instead."] pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.bubbles_shim(val); + self.set_bubbles(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_cancelable()` instead."] pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.cancelable_shim(val); + self.set_cancelable(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_composed()` instead."] pub fn composed(&mut self, val: bool) -> &mut Self { - self.composed_shim(val); + self.set_composed(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSession")] - #[doc = "Change the `session` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSession`, `XrSessionEventInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_session()` instead."] pub fn session(&mut self, val: &XrSession) -> &mut Self { - self.session_shim(val); + self.set_session(val); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionInit.rs b/crates/web-sys/src/features/gen_XrSessionInit.rs index 8bc078da63c..1e31e73dbee 100644 --- a/crates/web-sys/src/features/gen_XrSessionInit.rs +++ b/crates/web-sys/src/features/gen_XrSessionInit.rs @@ -14,10 +14,42 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `optionalFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "optionalFeatures")] + pub fn get_optional_features(this: &XrSessionInit) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `optionalFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "optionalFeatures")] - fn optional_features_shim(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); + pub fn set_optional_features(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requiredFeatures")] + pub fn get_required_features(this: &XrSessionInit) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requiredFeatures` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "requiredFeatures")] - fn required_features_shim(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); + pub fn set_required_features(this: &XrSessionInit, val: &::wasm_bindgen::JsValue); } #[cfg(web_sys_unstable_apis)] impl XrSessionInit { @@ -33,25 +65,15 @@ impl XrSessionInit { ret } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `optionalFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_optional_features()` instead."] pub fn optional_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.optional_features_shim(val); + self.set_optional_features(val); self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `requiredFeatures` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionInit`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_required_features()` instead."] pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { - self.required_features_shim(val); + self.set_required_features(val); self } } diff --git a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs index dc221e82d24..1c1f76d054f 100644 --- a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs @@ -14,12 +14,46 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrSessionSupportedPermissionDescriptor; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PermissionName")] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &XrSessionSupportedPermissionDescriptor) -> PermissionName; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "name")] - fn name_shim(this: &XrSessionSupportedPermissionDescriptor, val: PermissionName); + pub fn set_name(this: &XrSessionSupportedPermissionDescriptor, val: PermissionName); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSessionMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionMode`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &XrSessionSupportedPermissionDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSessionMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrSessionMode`, `XrSessionSupportedPermissionDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mode")] - fn mode_shim(this: &XrSessionSupportedPermissionDescriptor, val: XrSessionMode); + pub fn set_mode(this: &XrSessionSupportedPermissionDescriptor, val: XrSessionMode); } #[cfg(web_sys_unstable_apis)] impl XrSessionSupportedPermissionDescriptor { @@ -38,26 +72,16 @@ impl XrSessionSupportedPermissionDescriptor { } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "PermissionName")] - #[doc = "Change the `name` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `XrSessionSupportedPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_name()` instead."] pub fn name(&mut self, val: PermissionName) -> &mut Self { - self.name_shim(val); + self.set_name(val); self } #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSessionMode")] - #[doc = "Change the `mode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `XrSessionMode`, `XrSessionSupportedPermissionDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated = "Use `set_mode()` instead."] pub fn mode(&mut self, val: XrSessionMode) -> &mut Self { - self.mode_shim(val); + self.set_mode(val); self } } diff --git a/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs b/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs index 9fe4ef7a073..9c813965d66 100644 --- a/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs +++ b/crates/web-sys/src/features/gen_XrWebGlLayerInit.rs @@ -14,32 +14,15 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrWebGlLayerInit; - #[wasm_bindgen(method, setter = "alpha")] - fn alpha_shim(this: &XrWebGlLayerInit, val: bool); - #[wasm_bindgen(method, setter = "antialias")] - fn antialias_shim(this: &XrWebGlLayerInit, val: bool); - #[wasm_bindgen(method, setter = "depth")] - fn depth_shim(this: &XrWebGlLayerInit, val: bool); - #[wasm_bindgen(method, setter = "framebufferScaleFactor")] - fn framebuffer_scale_factor_shim(this: &XrWebGlLayerInit, val: f64); - #[wasm_bindgen(method, setter = "ignoreDepthValues")] - fn ignore_depth_values_shim(this: &XrWebGlLayerInit, val: bool); - #[wasm_bindgen(method, setter = "stencil")] - fn stencil_shim(this: &XrWebGlLayerInit, val: bool); -} -#[cfg(web_sys_unstable_apis)] -impl XrWebGlLayerInit { - #[doc = "Construct a new `XrWebGlLayerInit`."] + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `alpha` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } + #[wasm_bindgen(method, getter = "alpha")] + pub fn get_alpha(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `alpha` field of this object."] #[doc = ""] @@ -47,10 +30,17 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn alpha(&mut self, val: bool) -> &mut Self { - self.alpha_shim(val); - self - } + #[wasm_bindgen(method, setter = "alpha")] + pub fn set_alpha(this: &XrWebGlLayerInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `antialias` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "antialias")] + pub fn get_antialias(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `antialias` field of this object."] #[doc = ""] @@ -58,10 +48,17 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn antialias(&mut self, val: bool) -> &mut Self { - self.antialias_shim(val); - self - } + #[wasm_bindgen(method, setter = "antialias")] + pub fn set_antialias(this: &XrWebGlLayerInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `depth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "depth")] + pub fn get_depth(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `depth` field of this object."] #[doc = ""] @@ -69,10 +66,17 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn depth(&mut self, val: bool) -> &mut Self { - self.depth_shim(val); - self - } + #[wasm_bindgen(method, setter = "depth")] + pub fn set_depth(this: &XrWebGlLayerInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `framebufferScaleFactor` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "framebufferScaleFactor")] + pub fn get_framebuffer_scale_factor(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `framebufferScaleFactor` field of this object."] #[doc = ""] @@ -80,10 +84,17 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn framebuffer_scale_factor(&mut self, val: f64) -> &mut Self { - self.framebuffer_scale_factor_shim(val); - self - } + #[wasm_bindgen(method, setter = "framebufferScaleFactor")] + pub fn set_framebuffer_scale_factor(this: &XrWebGlLayerInit, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `ignoreDepthValues` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "ignoreDepthValues")] + pub fn get_ignore_depth_values(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `ignoreDepthValues` field of this object."] #[doc = ""] @@ -91,10 +102,17 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn ignore_depth_values(&mut self, val: bool) -> &mut Self { - self.ignore_depth_values_shim(val); - self - } + #[wasm_bindgen(method, setter = "ignoreDepthValues")] + pub fn set_ignore_depth_values(this: &XrWebGlLayerInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `stencil` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "stencil")] + pub fn get_stencil(this: &XrWebGlLayerInit) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `stencil` field of this object."] #[doc = ""] @@ -102,8 +120,56 @@ impl XrWebGlLayerInit { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "stencil")] + pub fn set_stencil(this: &XrWebGlLayerInit, val: bool); +} +#[cfg(web_sys_unstable_apis)] +impl XrWebGlLayerInit { + #[doc = "Construct a new `XrWebGlLayerInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayerInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_alpha()` instead."] + pub fn alpha(&mut self, val: bool) -> &mut Self { + self.set_alpha(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_antialias()` instead."] + pub fn antialias(&mut self, val: bool) -> &mut Self { + self.set_antialias(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_depth()` instead."] + pub fn depth(&mut self, val: bool) -> &mut Self { + self.set_depth(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_framebuffer_scale_factor()` instead."] + pub fn framebuffer_scale_factor(&mut self, val: f64) -> &mut Self { + self.set_framebuffer_scale_factor(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_ignore_depth_values()` instead."] + pub fn ignore_depth_values(&mut self, val: bool) -> &mut Self { + self.set_ignore_depth_values(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_stencil()` instead."] pub fn stencil(&mut self, val: bool) -> &mut Self { - self.stencil_shim(val); + self.set_stencil(val); self } } diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index f65d5759318..33ffd094f65 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -630,9 +630,10 @@ impl Interface { } pub struct DictionaryField { - pub name: Ident, + pub name: String, pub js_name: String, pub ty: Type, + pub return_ty: Type, pub is_js_value_ref_option_type: bool, pub required: bool, pub unstable: bool, @@ -642,10 +643,14 @@ impl DictionaryField { fn generate_rust_shim( &self, parent_ident: &Ident, + options: &Options, + features: &BTreeSet, cfg_features: &Option, ) -> TokenStream { let ty = &self.ty; - let shim_name = self.shim_name(); + let return_ty = &self.return_ty; + let getter_name = format_ident!("get_{}", self.name); + let setter_name = self.setter_name(); let js_name = &self.js_name; let js_value_ref_type = shared_ref( @@ -659,37 +664,52 @@ impl DictionaryField { ty.clone() }; + let unstable_attr = maybe_unstable_attr(self.unstable); + let unstable_docs = maybe_unstable_docs(self.unstable); + + let getter_doc_comment = comment( + format!("Get the `{}` field of this object.", js_name), + &required_doc_string(options, features), + ); + + let setter_doc_comment = comment( + format!("Change the `{}` field of this object.", js_name), + &required_doc_string(options, features), + ); + quote! { + #unstable_attr #cfg_features + #getter_doc_comment + #unstable_docs + #[wasm_bindgen(method, getter = #js_name)] + pub fn #getter_name(this: &#parent_ident) -> #return_ty; + + #unstable_attr + #cfg_features + #setter_doc_comment + #unstable_docs #[wasm_bindgen(method, setter = #js_name)] - fn #shim_name(this: &#parent_ident, val: #ty); + pub fn #setter_name(this: &#parent_ident, val: #ty); } } - fn generate_rust_setter( - &self, - options: &Options, - features: &BTreeSet, - cfg_features: &Option, - ) -> TokenStream { + fn generate_rust_setter(&self, cfg_features: &Option) -> TokenStream { let DictionaryField { name, - js_name, + js_name: _, ty, + return_ty: _, is_js_value_ref_option_type: _, required: _, unstable, } = self; + let name = rust_ident(name); let unstable_attr = maybe_unstable_attr(*unstable); - let unstable_docs = maybe_unstable_docs(*unstable); - - let doc_comment = comment( - format!("Change the `{}` field of this object.", js_name), - &required_doc_string(options, features), - ); - let shim_name = self.shim_name(); + let setter_name = self.setter_name(); + let deprecated = format!("Use `{}()` instead.", setter_name); let shim_args = if self.is_js_value_ref_option_type { quote! { val.unwrap_or(&::wasm_bindgen::JsValue::NULL) } @@ -700,10 +720,9 @@ impl DictionaryField { quote! { #unstable_attr #cfg_features - #doc_comment - #unstable_docs + #[deprecated = #deprecated] pub fn #name(&mut self, val: #ty) -> &mut Self { - self.#shim_name(#shim_args); + self.#setter_name(#shim_args); self } } @@ -727,8 +746,8 @@ impl DictionaryField { (features, cfg_features) } - fn shim_name(&self) -> Ident { - format_ident!("{}_shim", self.name) + fn setter_name(&self) -> Ident { + format_ident!("set_{}", self.name) } } @@ -759,7 +778,7 @@ impl Dictionary { for field in fields.iter() { if field.required { - let name = &field.name; + let name = rust_ident(&field.name); let ty = &field.ty; required_args.push(quote!( #name: #ty )); required_calls.push(quote!( ret.#name(#name); )); @@ -789,17 +808,17 @@ impl Dictionary { let field_shims = fields .iter() + .zip(field_features.iter()) .zip(field_cfg_features.iter()) - .map(|(field, cfg_features)| field.generate_rust_shim(name, cfg_features)) + .map(|((field, features), cfg_features)| { + field.generate_rust_shim(name, options, features, cfg_features) + }) .collect::>(); let fields = fields .iter() - .zip(field_features.iter()) .zip(field_cfg_features.iter()) - .map(|((field, features), cfg_features)| { - field.generate_rust_setter(options, features, cfg_features) - }) + .map(|(field, cfg_features)| field.generate_rust_setter(cfg_features)) .collect::>(); let mut base_stream = quote! { diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index f011fe98006..2f921d46082 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -25,9 +25,9 @@ use crate::generator::{ use crate::idl_type::ToIdlType; use crate::traverse::TraverseType; use crate::util::{ - camel_case_ident, getter_throws, is_structural, is_type_unstable, read_dir, setter_throws, - shouty_snake_case_ident, snake_case_ident, throws, webidl_const_v_to_backend_const_v, - TypePosition, + camel_case_ident, getter_throws, is_structural, is_type_unstable, optional_return_ty, read_dir, + setter_throws, shouty_snake_case_ident, snake_case_ident, throws, + webidl_const_v_to_backend_const_v, TypePosition, }; use anyhow::Context; use anyhow::Result; @@ -397,6 +397,12 @@ impl<'src> FirstPassRecord<'src> { .to_syn_type(TypePosition::Argument) .unwrap_or(None)?; + let mut return_ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); + + if field.required.is_none() { + return_ty = optional_return_ty(return_ty); + } + // Slice types aren't supported because they don't implement // `Into` match ty { @@ -435,9 +441,10 @@ impl<'src> FirstPassRecord<'src> { Some(DictionaryField { required: field.required.is_some(), - name: rust_ident(&snake_case_ident(field.identifier.0)), + name: snake_case_ident(field.identifier.0), js_name: field.identifier.0.to_string(), ty, + return_ty, is_js_value_ref_option_type, unstable: unstable_override, }) @@ -779,12 +786,18 @@ impl<'src> FirstPassRecord<'src> { fields.push(DictionaryField { required: false, - name: rust_ident(&snake_case_ident(identifier)), + name: snake_case_ident(identifier), js_name: identifier.to_string(), ty: idl_type::IdlType::Callback .to_syn_type(pos) .unwrap() .unwrap(), + return_ty: optional_return_ty( + idl_type::IdlType::Callback + .to_syn_type(TypePosition::Return) + .unwrap() + .unwrap(), + ), is_js_value_ref_option_type: false, unstable: false, }) diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 0f663978fd3..3f1c6ccc638 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -81,6 +81,25 @@ pub fn snake_case_ident(identifier: &str) -> String { fix_ident(identifier).to_snake_case() } +/// Wrap [`TypePosition::Return`] type into an `Option` if not already and if not a `JsValue`. +pub fn optional_return_ty(ty: syn::Type) -> syn::Type { + if let syn::Type::Path(path) = &ty { + if let Some(segment) = path.path.segments.first() { + if segment.ident == "Option" { + return ty; + } else if path.path.leading_colon.is_some() && segment.ident == "wasm_bindgen" { + if let Some(segment) = path.path.segments.iter().nth(1) { + if segment.ident == "JsValue" { + return ty; + } + } + } + } + } + + option_ty(ty) +} + // Returns a link to MDN pub fn mdn_doc(class: &str, method: Option<&str>) -> String { let mut link = format!("https://developer.mozilla.org/en-US/docs/Web/API/{}", class); diff --git a/examples/fetch/src/lib.rs b/examples/fetch/src/lib.rs index 95af06e4c28..47e7c0f33fd 100644 --- a/examples/fetch/src/lib.rs +++ b/examples/fetch/src/lib.rs @@ -4,9 +4,9 @@ use web_sys::{Request, RequestInit, RequestMode, Response}; #[wasm_bindgen] pub async fn run(repo: String) -> Result { - let mut opts = RequestInit::new(); - opts.method("GET"); - opts.mode(RequestMode::Cors); + let opts = RequestInit::new(); + opts.set_method("GET"); + opts.set_mode(RequestMode::Cors); let url = format!("https://api.github.com/repos/{}/branches/master", repo); diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs index 6b01eb175ab..ce7f038fdcd 100644 --- a/examples/wasm-audio-worklet/src/dependent_module.rs +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -23,9 +23,11 @@ pub fn on_the_fly(code: &str) -> Result { IMPORT_META.url(), ); + let options = BlobPropertyBag::new(); + options.set_type("text/javascript"); Url::create_object_url_with_blob(&Blob::new_with_str_sequence_and_options( &Array::of2(&JsValue::from(header.as_str()), &JsValue::from(code)), - BlobPropertyBag::new().type_("text/javascript"), + &options, )?) } diff --git a/examples/wasm-audio-worklet/src/wasm_audio.rs b/examples/wasm-audio-worklet/src/wasm_audio.rs index decaebd60d5..5b0534d99b2 100644 --- a/examples/wasm-audio-worklet/src/wasm_audio.rs +++ b/examples/wasm-audio-worklet/src/wasm_audio.rs @@ -41,15 +41,13 @@ pub fn wasm_audio_node( ctx: &AudioContext, process: Box bool>, ) -> Result { - AudioWorkletNode::new_with_options( - ctx, - "WasmProcessor", - AudioWorkletNodeOptions::new().processor_options(Some(&js_sys::Array::of3( - &wasm_bindgen::module(), - &wasm_bindgen::memory(), - &WasmAudioProcessor(process).pack().into(), - ))), - ) + let options = AudioWorkletNodeOptions::new(); + options.set_processor_options(Some(&js_sys::Array::of3( + &wasm_bindgen::module(), + &wasm_bindgen::memory(), + &WasmAudioProcessor(process).pack().into(), + ))); + AudioWorkletNode::new_with_options(ctx, "WasmProcessor", &options) } pub async fn prepare_wasm_audio(ctx: &AudioContext) -> Result<(), JsValue> { diff --git a/examples/webrtc_datachannel/src/lib.rs b/examples/webrtc_datachannel/src/lib.rs index 7bb52f0a0e3..8a94fb62d45 100644 --- a/examples/webrtc_datachannel/src/lib.rs +++ b/examples/webrtc_datachannel/src/lib.rs @@ -113,8 +113,8 @@ async fn start() -> Result<(), JsValue> { .unwrap(); console_log!("pc1: offer {:?}", offer_sdp); - let mut offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer); - offer_obj.sdp(&offer_sdp); + let offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer); + offer_obj.set_sdp(&offer_sdp); let sld_promise = pc1.set_local_description(&offer_obj); JsFuture::from(sld_promise).await?; console_log!("pc1: state {:?}", pc1.signaling_state()); @@ -124,8 +124,8 @@ async fn start() -> Result<(), JsValue> { * Create and send ANSWER from pc2 to pc1 * */ - let mut offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer); - offer_obj.sdp(&offer_sdp); + let offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer); + offer_obj.set_sdp(&offer_sdp); let srd_promise = pc2.set_remote_description(&offer_obj); JsFuture::from(srd_promise).await?; console_log!("pc2: state {:?}", pc2.signaling_state()); @@ -136,8 +136,8 @@ async fn start() -> Result<(), JsValue> { .unwrap(); console_log!("pc2: answer {:?}", answer_sdp); - let mut answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer); - answer_obj.sdp(&answer_sdp); + let answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer); + answer_obj.set_sdp(&answer_sdp); let sld_promise = pc2.set_local_description(&answer_obj); JsFuture::from(sld_promise).await?; console_log!("pc2: state {:?}", pc2.signaling_state()); @@ -146,8 +146,8 @@ async fn start() -> Result<(), JsValue> { * Receive ANSWER from pc2 * */ - let mut answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer); - answer_obj.sdp(&answer_sdp); + let answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer); + answer_obj.set_sdp(&answer_sdp); let srd_promise = pc1.set_remote_description(&answer_obj); JsFuture::from(srd_promise).await?; console_log!("pc1: state {:?}", pc1.signaling_state()); From 9e6b1bc8e7358b155de60d2f54dccd6a31b20ab3 Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Sun, 28 Jul 2024 15:44:10 -0300 Subject: [PATCH 423/641] Imported async functions can return any `JsValue` convertible type (#3919) --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 4 ++-- tests/wasm/futures.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5959339c425..e632f28c5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,9 @@ * Deprecate builder-pattern type setters for WebIDL dictionary types and introduce non-mutable setters instead. [#3993](https://github.com/rustwasm/wasm-bindgen/pull/3993) +* Allow imported async functions to return any type that can be converted from a `JsValue`. + [#3919](https://github.com/rustwasm/wasm-bindgen/pull/3919) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 0dc8ee3d00f..43c01f48fb1 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1335,9 +1335,9 @@ impl TryToTokens for ast::ImportFunction { ).await }; convert_ret = if self.catch { - quote! { Ok(#future?) } + quote! { Ok(#wasm_bindgen::JsCast::unchecked_from_js(#future?)) } } else { - quote! { #future.expect("unexpected exception") } + quote! { #wasm_bindgen::JsCast::unchecked_from_js(#future.expect("unexpected exception")) } }; } else { abi_ret = quote! { diff --git a/tests/wasm/futures.rs b/tests/wasm/futures.rs index 3679a0d4836..73b51dd06d3 100644 --- a/tests/wasm/futures.rs +++ b/tests/wasm/futures.rs @@ -1,3 +1,4 @@ +use js_sys::JsString; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -8,10 +9,16 @@ extern "C" { async fn call_exports() -> Result; async fn call_promise() -> JsValue; + #[wasm_bindgen(js_name = call_promise)] + async fn call_promise_string() -> JsString; #[wasm_bindgen(catch)] async fn call_promise_ok() -> Result; + #[wasm_bindgen(catch, js_name = call_promise_ok)] + async fn call_promise_ok_string() -> Result; #[wasm_bindgen(catch)] async fn call_promise_err() -> Result; + #[wasm_bindgen(catch, js_name = call_promise_err)] + async fn call_promise_err_string() -> Result; #[wasm_bindgen] async fn call_promise_unit(); @@ -141,6 +148,11 @@ async fn test_promise() { assert_eq!(call_promise().await.as_string(), Some(String::from("ok"))) } +#[wasm_bindgen_test] +async fn test_promise_string() { + assert_eq!(String::from(call_promise_string().await), "ok") +} + #[wasm_bindgen_test] async fn test_promise_ok() { assert_eq!( @@ -149,6 +161,14 @@ async fn test_promise_ok() { ) } +#[wasm_bindgen_test] +async fn test_promise_ok_string() { + assert_eq!( + call_promise_ok_string().await.map(String::from), + Ok(String::from("ok")) + ) +} + #[wasm_bindgen_test] async fn test_promise_err() { assert_eq!( @@ -157,6 +177,14 @@ async fn test_promise_err() { ) } +#[wasm_bindgen_test] +async fn test_promise_err_string() { + assert_eq!( + call_promise_err_string().await.map_err(String::from), + Err(String::from("error")) + ) +} + #[wasm_bindgen_test] async fn test_promise_unit() { call_promise_unit().await From 168b8018753e7b9c5c61e7b69b2eea0609064a64 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 28 Jul 2024 21:23:01 +0200 Subject: [PATCH 424/641] Update Web Authentication API to level 3 (#4000) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 23 ++ .../gen_AttestationConveyancePreference.rs | 1 + ...en_AuthenticationExtensionsClientInputs.rs | 135 +++++++ ...uthenticationExtensionsClientInputsJson.rs | 37 ++ ...n_AuthenticationExtensionsClientOutputs.rs | 143 +++++++ ...thenticationExtensionsClientOutputsJson.rs | 37 ++ ...ticationExtensionsDevicePublicKeyInputs.rs | 90 +++++ ...icationExtensionsDevicePublicKeyOutputs.rs | 66 ++++ ...AuthenticationExtensionsLargeBlobInputs.rs | 73 ++++ ...uthenticationExtensionsLargeBlobOutputs.rs | 75 ++++ .../gen_AuthenticationExtensionsPrfInputs.rs | 69 ++++ .../gen_AuthenticationExtensionsPrfOutputs.rs | 93 +++++ .../gen_AuthenticationExtensionsPrfValues.rs | 80 ++++ .../gen_AuthenticationResponseJson.rs | 207 +++++++++++ .../gen_AuthenticatorAssertionResponse.rs | 13 + .../gen_AuthenticatorAssertionResponseJson.rs | 154 ++++++++ .../gen_AuthenticatorAttestationResponse.rs | 34 ++ ...en_AuthenticatorAttestationResponseJson.rs | 189 ++++++++++ .../gen_AuthenticatorSelectionCriteria.rs | 15 + .../features/gen_AuthenticatorTransport.rs | 1 + .../src/features/gen_CollectedClientData.rs | 39 ++ .../gen_CredentialPropertiesOutput.rs | 43 +++ .../src/features/gen_LargeBlobSupport.rs | 12 + .../src/features/gen_PublicKeyCredential.rs | 78 ++++ .../gen_PublicKeyCredentialCreationOptions.rs | 53 +++ ..._PublicKeyCredentialCreationOptionsJson.rs | 350 ++++++++++++++++++ .../gen_PublicKeyCredentialDescriptorJson.rs | 105 ++++++ .../features/gen_PublicKeyCredentialEntity.rs | 2 + .../features/gen_PublicKeyCredentialHints.rs | 17 + .../gen_PublicKeyCredentialRequestOptions.rs | 77 ++++ ...n_PublicKeyCredentialRequestOptionsJson.rs | 266 +++++++++++++ .../gen_PublicKeyCredentialRpEntity.rs | 2 + .../gen_PublicKeyCredentialUserEntity.rs | 2 + .../gen_PublicKeyCredentialUserEntityJson.rs | 106 ++++++ .../features/gen_RegistrationResponseJson.rs | 207 +++++++++++ .../features/gen_ResidentKeyRequirement.rs | 13 + .../web-sys/src/features/gen_TokenBinding.rs | 54 +++ .../src/features/gen_TokenBindingStatus.rs | 12 + crates/web-sys/src/features/mod.rs | 161 ++++++++ .../enabled/CredentialManagement.webidl | 2 - .../webidls/enabled/WebAuthentication.webidl | 140 +++++-- .../webidls/unstable/WebAuthentication.webidl | 181 +++++++++ crates/webidl/src/first_pass.rs | 5 +- crates/webidl/src/generator.rs | 18 +- crates/webidl/src/lib.rs | 6 +- crates/webidl/src/util.rs | 24 +- 47 files changed, 3465 insertions(+), 48 deletions(-) create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputsJson.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputsJson.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyOutputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobOutputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsPrfOutputs.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticationResponseJson.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs create mode 100644 crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs create mode 100644 crates/web-sys/src/features/gen_CredentialPropertiesOutput.rs create mode 100644 crates/web-sys/src/features/gen_LargeBlobSupport.rs create mode 100644 crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs create mode 100644 crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs create mode 100644 crates/web-sys/src/features/gen_PublicKeyCredentialHints.rs create mode 100644 crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs create mode 100644 crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs create mode 100644 crates/web-sys/src/features/gen_RegistrationResponseJson.rs create mode 100644 crates/web-sys/src/features/gen_ResidentKeyRequirement.rs create mode 100644 crates/web-sys/src/features/gen_TokenBinding.rs create mode 100644 crates/web-sys/src/features/gen_TokenBindingStatus.rs create mode 100644 crates/web-sys/webidls/unstable/WebAuthentication.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index e632f28c5dd..2873a756ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,9 @@ * Allow imported async functions to return any type that can be converted from a `JsValue`. [#3919](https://github.com/rustwasm/wasm-bindgen/pull/3919) +* Update Web Authentication API to level 3. + [#4000](https://github.com/rustwasm/wasm-bindgen/pull/4000) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 77ef42d3353..e6c64ccc29d 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -106,10 +106,22 @@ AudioWorkletNode = ["AudioNode", "EventTarget"] AudioWorkletNodeOptions = [] AudioWorkletProcessor = [] AuthenticationExtensionsClientInputs = [] +AuthenticationExtensionsClientInputsJson = [] AuthenticationExtensionsClientOutputs = [] +AuthenticationExtensionsClientOutputsJson = [] +AuthenticationExtensionsDevicePublicKeyInputs = [] +AuthenticationExtensionsDevicePublicKeyOutputs = [] +AuthenticationExtensionsLargeBlobInputs = [] +AuthenticationExtensionsLargeBlobOutputs = [] +AuthenticationExtensionsPrfInputs = [] +AuthenticationExtensionsPrfOutputs = [] +AuthenticationExtensionsPrfValues = [] +AuthenticationResponseJson = [] AuthenticatorAssertionResponse = ["AuthenticatorResponse"] +AuthenticatorAssertionResponseJson = [] AuthenticatorAttachment = [] AuthenticatorAttestationResponse = ["AuthenticatorResponse"] +AuthenticatorAttestationResponseJson = [] AuthenticatorResponse = [] AuthenticatorSelectionCriteria = [] AuthenticatorTransport = [] @@ -238,6 +250,7 @@ Coordinates = [] CountQueuingStrategy = [] Credential = [] CredentialCreationOptions = [] +CredentialPropertiesOutput = [] CredentialRequestOptions = [] CredentialsContainer = [] Crypto = [] @@ -757,6 +770,7 @@ KeyframeEffect = ["AnimationEffect"] KeyframeEffectOptions = [] L10nElement = [] L10nValue = [] +LargeBlobSupport = [] LatencyMode = [] LifecycleCallbacks = [] LineAlignSetting = [] @@ -1008,13 +1022,18 @@ PromiseRejectionEvent = ["Event"] PromiseRejectionEventInit = [] PublicKeyCredential = ["Credential"] PublicKeyCredentialCreationOptions = [] +PublicKeyCredentialCreationOptionsJson = [] PublicKeyCredentialDescriptor = [] +PublicKeyCredentialDescriptorJson = [] PublicKeyCredentialEntity = [] +PublicKeyCredentialHints = [] PublicKeyCredentialParameters = [] PublicKeyCredentialRequestOptions = [] +PublicKeyCredentialRequestOptionsJson = [] PublicKeyCredentialRpEntity = [] PublicKeyCredentialType = [] PublicKeyCredentialUserEntity = [] +PublicKeyCredentialUserEntityJson = [] PushEncryptionKeyName = [] PushEvent = ["Event", "ExtendableEvent"] PushEventInit = [] @@ -1052,6 +1071,7 @@ RegisterRequest = [] RegisterResponse = [] RegisteredKey = [] RegistrationOptions = [] +RegistrationResponseJson = [] Request = [] RequestCache = [] RequestCredentials = [] @@ -1061,6 +1081,7 @@ RequestInit = [] RequestMediaKeySystemAccessNotification = [] RequestMode = [] RequestRedirect = [] +ResidentKeyRequirement = [] ResizeObserver = [] ResizeObserverBoxOptions = [] ResizeObserverEntry = [] @@ -1396,6 +1417,8 @@ TextTrackList = ["EventTarget"] TextTrackMode = [] TimeEvent = ["Event"] TimeRanges = [] +TokenBinding = [] +TokenBindingStatus = [] Touch = [] TouchEvent = ["Event", "UiEvent"] TouchEventInit = [] diff --git a/crates/web-sys/src/features/gen_AttestationConveyancePreference.rs b/crates/web-sys/src/features/gen_AttestationConveyancePreference.rs index 268fd4ad8a7..c98cb125c86 100644 --- a/crates/web-sys/src/features/gen_AttestationConveyancePreference.rs +++ b/crates/web-sys/src/features/gen_AttestationConveyancePreference.rs @@ -10,4 +10,5 @@ pub enum AttestationConveyancePreference { None = "none", Indirect = "indirect", Direct = "direct", + Enterprise = "enterprise", } diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs index 1439f6b4d5d..6a01870170f 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs @@ -20,6 +20,103 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] #[wasm_bindgen(method, setter = "appid")] pub fn set_appid(this: &AuthenticationExtensionsClientInputs, val: &str); + #[doc = "Get the `appidExclude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, getter = "appidExclude")] + pub fn get_appid_exclude(this: &AuthenticationExtensionsClientInputs) -> Option; + #[doc = "Change the `appidExclude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, setter = "appidExclude")] + pub fn set_appid_exclude(this: &AuthenticationExtensionsClientInputs, val: &str); + #[doc = "Get the `credProps` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, getter = "credProps")] + pub fn get_cred_props(this: &AuthenticationExtensionsClientInputs) -> Option; + #[doc = "Change the `credProps` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, setter = "credProps")] + pub fn set_cred_props(this: &AuthenticationExtensionsClientInputs, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")] + #[doc = "Get the `devicePubKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "devicePubKey")] + pub fn get_device_pub_key( + this: &AuthenticationExtensionsClientInputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")] + #[doc = "Change the `devicePubKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "devicePubKey")] + pub fn set_device_pub_key( + this: &AuthenticationExtensionsClientInputs, + val: &AuthenticationExtensionsDevicePublicKeyInputs, + ); + #[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")] + #[doc = "Get the `largeBlob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, getter = "largeBlob")] + pub fn get_large_blob( + this: &AuthenticationExtensionsClientInputs, + ) -> Option; + #[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")] + #[doc = "Change the `largeBlob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, setter = "largeBlob")] + pub fn set_large_blob( + this: &AuthenticationExtensionsClientInputs, + val: &AuthenticationExtensionsLargeBlobInputs, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfInputs")] + #[doc = "Get the `prf` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "prf")] + pub fn get_prf( + this: &AuthenticationExtensionsClientInputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfInputs")] + #[doc = "Change the `prf` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "prf")] + pub fn set_prf( + this: &AuthenticationExtensionsClientInputs, + val: &AuthenticationExtensionsPrfInputs, + ); + #[doc = "Get the `uvm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, getter = "uvm")] + pub fn get_uvm(this: &AuthenticationExtensionsClientInputs) -> Option; + #[doc = "Change the `uvm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] + #[wasm_bindgen(method, setter = "uvm")] + pub fn set_uvm(this: &AuthenticationExtensionsClientInputs, val: bool); } impl AuthenticationExtensionsClientInputs { #[doc = "Construct a new `AuthenticationExtensionsClientInputs`."] @@ -35,6 +132,44 @@ impl AuthenticationExtensionsClientInputs { self.set_appid(val); self } + #[deprecated = "Use `set_appid_exclude()` instead."] + pub fn appid_exclude(&mut self, val: &str) -> &mut Self { + self.set_appid_exclude(val); + self + } + #[deprecated = "Use `set_cred_props()` instead."] + pub fn cred_props(&mut self, val: bool) -> &mut Self { + self.set_cred_props(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")] + #[deprecated = "Use `set_device_pub_key()` instead."] + pub fn device_pub_key( + &mut self, + val: &AuthenticationExtensionsDevicePublicKeyInputs, + ) -> &mut Self { + self.set_device_pub_key(val); + self + } + #[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")] + #[deprecated = "Use `set_large_blob()` instead."] + pub fn large_blob(&mut self, val: &AuthenticationExtensionsLargeBlobInputs) -> &mut Self { + self.set_large_blob(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfInputs")] + #[deprecated = "Use `set_prf()` instead."] + pub fn prf(&mut self, val: &AuthenticationExtensionsPrfInputs) -> &mut Self { + self.set_prf(val); + self + } + #[deprecated = "Use `set_uvm()` instead."] + pub fn uvm(&mut self, val: bool) -> &mut Self { + self.set_uvm(val); + self + } } impl Default for AuthenticationExtensionsClientInputs { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputsJson.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputsJson.rs new file mode 100644 index 00000000000..29d560c0bd3 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputsJson.rs @@ -0,0 +1,37 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsClientInputsJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsClientInputsJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsClientInputsJson; +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsClientInputsJson { + #[doc = "Construct a new `AuthenticationExtensionsClientInputsJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsClientInputsJson { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs index 46cfeb952c9..76772e7d31c 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputs.rs @@ -20,6 +20,110 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] #[wasm_bindgen(method, setter = "appid")] pub fn set_appid(this: &AuthenticationExtensionsClientOutputs, val: bool); + #[doc = "Get the `appidExclude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[wasm_bindgen(method, getter = "appidExclude")] + pub fn get_appid_exclude(this: &AuthenticationExtensionsClientOutputs) -> Option; + #[doc = "Change the `appidExclude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[wasm_bindgen(method, setter = "appidExclude")] + pub fn set_appid_exclude(this: &AuthenticationExtensionsClientOutputs, val: bool); + #[cfg(feature = "CredentialPropertiesOutput")] + #[doc = "Get the `credProps` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `CredentialPropertiesOutput`*"] + #[wasm_bindgen(method, getter = "credProps")] + pub fn get_cred_props( + this: &AuthenticationExtensionsClientOutputs, + ) -> Option; + #[cfg(feature = "CredentialPropertiesOutput")] + #[doc = "Change the `credProps` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `CredentialPropertiesOutput`*"] + #[wasm_bindgen(method, setter = "credProps")] + pub fn set_cred_props( + this: &AuthenticationExtensionsClientOutputs, + val: &CredentialPropertiesOutput, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyOutputs")] + #[doc = "Get the `devicePubKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "devicePubKey")] + pub fn get_device_pub_key( + this: &AuthenticationExtensionsClientOutputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyOutputs")] + #[doc = "Change the `devicePubKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "devicePubKey")] + pub fn set_device_pub_key( + this: &AuthenticationExtensionsClientOutputs, + val: &AuthenticationExtensionsDevicePublicKeyOutputs, + ); + #[cfg(feature = "AuthenticationExtensionsLargeBlobOutputs")] + #[doc = "Get the `largeBlob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, getter = "largeBlob")] + pub fn get_large_blob( + this: &AuthenticationExtensionsClientOutputs, + ) -> Option; + #[cfg(feature = "AuthenticationExtensionsLargeBlobOutputs")] + #[doc = "Change the `largeBlob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, setter = "largeBlob")] + pub fn set_large_blob( + this: &AuthenticationExtensionsClientOutputs, + val: &AuthenticationExtensionsLargeBlobOutputs, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfOutputs")] + #[doc = "Get the `prf` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "prf")] + pub fn get_prf( + this: &AuthenticationExtensionsClientOutputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfOutputs")] + #[doc = "Change the `prf` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`, `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "prf")] + pub fn set_prf( + this: &AuthenticationExtensionsClientOutputs, + val: &AuthenticationExtensionsPrfOutputs, + ); + #[doc = "Get the `uvm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[wasm_bindgen(method, getter = "uvm")] + pub fn get_uvm(this: &AuthenticationExtensionsClientOutputs) -> Option<::js_sys::Array>; + #[doc = "Change the `uvm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputs`*"] + #[wasm_bindgen(method, setter = "uvm")] + pub fn set_uvm(this: &AuthenticationExtensionsClientOutputs, val: &::wasm_bindgen::JsValue); } impl AuthenticationExtensionsClientOutputs { #[doc = "Construct a new `AuthenticationExtensionsClientOutputs`."] @@ -35,6 +139,45 @@ impl AuthenticationExtensionsClientOutputs { self.set_appid(val); self } + #[deprecated = "Use `set_appid_exclude()` instead."] + pub fn appid_exclude(&mut self, val: bool) -> &mut Self { + self.set_appid_exclude(val); + self + } + #[cfg(feature = "CredentialPropertiesOutput")] + #[deprecated = "Use `set_cred_props()` instead."] + pub fn cred_props(&mut self, val: &CredentialPropertiesOutput) -> &mut Self { + self.set_cred_props(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsDevicePublicKeyOutputs")] + #[deprecated = "Use `set_device_pub_key()` instead."] + pub fn device_pub_key( + &mut self, + val: &AuthenticationExtensionsDevicePublicKeyOutputs, + ) -> &mut Self { + self.set_device_pub_key(val); + self + } + #[cfg(feature = "AuthenticationExtensionsLargeBlobOutputs")] + #[deprecated = "Use `set_large_blob()` instead."] + pub fn large_blob(&mut self, val: &AuthenticationExtensionsLargeBlobOutputs) -> &mut Self { + self.set_large_blob(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfOutputs")] + #[deprecated = "Use `set_prf()` instead."] + pub fn prf(&mut self, val: &AuthenticationExtensionsPrfOutputs) -> &mut Self { + self.set_prf(val); + self + } + #[deprecated = "Use `set_uvm()` instead."] + pub fn uvm(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_uvm(val); + self + } } impl Default for AuthenticationExtensionsClientOutputs { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputsJson.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputsJson.rs new file mode 100644 index 00000000000..f2b7a553189 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientOutputsJson.rs @@ -0,0 +1,37 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsClientOutputsJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsClientOutputsJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsClientOutputsJson; +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsClientOutputsJson { + #[doc = "Construct a new `AuthenticationExtensionsClientOutputsJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsClientOutputsJson { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs new file mode 100644 index 00000000000..a03cb380b6a --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs @@ -0,0 +1,90 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsDevicePublicKeyInputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsDevicePublicKeyInputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsDevicePublicKeyInputs; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestation")] + pub fn get_attestation(this: &AuthenticationExtensionsDevicePublicKeyInputs) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestation")] + pub fn set_attestation(this: &AuthenticationExtensionsDevicePublicKeyInputs, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationFormats")] + pub fn get_attestation_formats( + this: &AuthenticationExtensionsDevicePublicKeyInputs, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationFormats")] + pub fn set_attestation_formats( + this: &AuthenticationExtensionsDevicePublicKeyInputs, + val: &::wasm_bindgen::JsValue, + ); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsDevicePublicKeyInputs { + #[doc = "Construct a new `AuthenticationExtensionsDevicePublicKeyInputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation()` instead."] + pub fn attestation(&mut self, val: &str) -> &mut Self { + self.set_attestation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_formats()` instead."] + pub fn attestation_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attestation_formats(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsDevicePublicKeyInputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyOutputs.rs new file mode 100644 index 00000000000..eec053201d6 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyOutputs.rs @@ -0,0 +1,66 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsDevicePublicKeyOutputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsDevicePublicKeyOutputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsDevicePublicKeyOutputs; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `signature` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "signature")] + pub fn get_signature( + this: &AuthenticationExtensionsDevicePublicKeyOutputs, + ) -> Option<::js_sys::ArrayBuffer>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `signature` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "signature")] + pub fn set_signature( + this: &AuthenticationExtensionsDevicePublicKeyOutputs, + val: &::js_sys::ArrayBuffer, + ); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsDevicePublicKeyOutputs { + #[doc = "Construct a new `AuthenticationExtensionsDevicePublicKeyOutputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsDevicePublicKeyOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_signature()` instead."] + pub fn signature(&mut self, val: &::js_sys::ArrayBuffer) -> &mut Self { + self.set_signature(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsDevicePublicKeyOutputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs new file mode 100644 index 00000000000..288681845e5 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs @@ -0,0 +1,73 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsLargeBlobInputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsLargeBlobInputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + pub type AuthenticationExtensionsLargeBlobInputs; + #[doc = "Get the `read` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, getter = "read")] + pub fn get_read(this: &AuthenticationExtensionsLargeBlobInputs) -> Option; + #[doc = "Change the `read` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, setter = "read")] + pub fn set_read(this: &AuthenticationExtensionsLargeBlobInputs, val: bool); + #[doc = "Get the `support` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, getter = "support")] + pub fn get_support(this: &AuthenticationExtensionsLargeBlobInputs) -> Option; + #[doc = "Change the `support` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, setter = "support")] + pub fn set_support(this: &AuthenticationExtensionsLargeBlobInputs, val: &str); + #[doc = "Get the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, getter = "write")] + pub fn get_write(this: &AuthenticationExtensionsLargeBlobInputs) -> Option<::js_sys::Object>; + #[doc = "Change the `write` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + #[wasm_bindgen(method, setter = "write")] + pub fn set_write(this: &AuthenticationExtensionsLargeBlobInputs, val: &::js_sys::Object); +} +impl AuthenticationExtensionsLargeBlobInputs { + #[doc = "Construct a new `AuthenticationExtensionsLargeBlobInputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[deprecated = "Use `set_read()` instead."] + pub fn read(&mut self, val: bool) -> &mut Self { + self.set_read(val); + self + } + #[deprecated = "Use `set_support()` instead."] + pub fn support(&mut self, val: &str) -> &mut Self { + self.set_support(val); + self + } + #[deprecated = "Use `set_write()` instead."] + pub fn write(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_write(val); + self + } +} +impl Default for AuthenticationExtensionsLargeBlobInputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobOutputs.rs new file mode 100644 index 00000000000..bf6bc50c046 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobOutputs.rs @@ -0,0 +1,75 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsLargeBlobOutputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsLargeBlobOutputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + pub type AuthenticationExtensionsLargeBlobOutputs; + #[doc = "Get the `blob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, getter = "blob")] + pub fn get_blob( + this: &AuthenticationExtensionsLargeBlobOutputs, + ) -> Option<::js_sys::ArrayBuffer>; + #[doc = "Change the `blob` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, setter = "blob")] + pub fn set_blob(this: &AuthenticationExtensionsLargeBlobOutputs, val: &::js_sys::ArrayBuffer); + #[doc = "Get the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, getter = "supported")] + pub fn get_supported(this: &AuthenticationExtensionsLargeBlobOutputs) -> Option; + #[doc = "Change the `supported` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, setter = "supported")] + pub fn set_supported(this: &AuthenticationExtensionsLargeBlobOutputs, val: bool); + #[doc = "Get the `written` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, getter = "written")] + pub fn get_written(this: &AuthenticationExtensionsLargeBlobOutputs) -> Option; + #[doc = "Change the `written` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + #[wasm_bindgen(method, setter = "written")] + pub fn set_written(this: &AuthenticationExtensionsLargeBlobOutputs, val: bool); +} +impl AuthenticationExtensionsLargeBlobOutputs { + #[doc = "Construct a new `AuthenticationExtensionsLargeBlobOutputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobOutputs`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[deprecated = "Use `set_blob()` instead."] + pub fn blob(&mut self, val: &::js_sys::ArrayBuffer) -> &mut Self { + self.set_blob(val); + self + } + #[deprecated = "Use `set_supported()` instead."] + pub fn supported(&mut self, val: bool) -> &mut Self { + self.set_supported(val); + self + } + #[deprecated = "Use `set_written()` instead."] + pub fn written(&mut self, val: bool) -> &mut Self { + self.set_written(val); + self + } +} +impl Default for AuthenticationExtensionsLargeBlobOutputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs new file mode 100644 index 00000000000..174b7e36ce2 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs @@ -0,0 +1,69 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsPRFInputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsPrfInputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsPrfInputs; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[doc = "Get the `eval` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`, `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "eval")] + pub fn get_eval( + this: &AuthenticationExtensionsPrfInputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[doc = "Change the `eval` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`, `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "eval")] + pub fn set_eval( + this: &AuthenticationExtensionsPrfInputs, + val: &AuthenticationExtensionsPrfValues, + ); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsPrfInputs { + #[doc = "Construct a new `AuthenticationExtensionsPrfInputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[deprecated = "Use `set_eval()` instead."] + pub fn eval(&mut self, val: &AuthenticationExtensionsPrfValues) -> &mut Self { + self.set_eval(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsPrfInputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfOutputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfOutputs.rs new file mode 100644 index 00000000000..296c8cabeb8 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfOutputs.rs @@ -0,0 +1,93 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsPRFOutputs)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsPrfOutputs` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsPrfOutputs; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `enabled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "enabled")] + pub fn get_enabled(this: &AuthenticationExtensionsPrfOutputs) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `enabled` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "enabled")] + pub fn set_enabled(this: &AuthenticationExtensionsPrfOutputs, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[doc = "Get the `results` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`, `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "results")] + pub fn get_results( + this: &AuthenticationExtensionsPrfOutputs, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[doc = "Change the `results` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`, `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "results")] + pub fn set_results( + this: &AuthenticationExtensionsPrfOutputs, + val: &AuthenticationExtensionsPrfValues, + ); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsPrfOutputs { + #[doc = "Construct a new `AuthenticationExtensionsPrfOutputs`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfOutputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_enabled()` instead."] + pub fn enabled(&mut self, val: bool) -> &mut Self { + self.set_enabled(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsPrfValues")] + #[deprecated = "Use `set_results()` instead."] + pub fn results(&mut self, val: &AuthenticationExtensionsPrfValues) -> &mut Self { + self.set_results(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for AuthenticationExtensionsPrfOutputs { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs new file mode 100644 index 00000000000..c57eb622acc --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs @@ -0,0 +1,80 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationExtensionsPRFValues)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationExtensionsPrfValues` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationExtensionsPrfValues; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `first` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "first")] + pub fn get_first(this: &AuthenticationExtensionsPrfValues) -> ::js_sys::Object; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `first` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "first")] + pub fn set_first(this: &AuthenticationExtensionsPrfValues, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `second` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "second")] + pub fn get_second(this: &AuthenticationExtensionsPrfValues) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `second` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "second")] + pub fn set_second(this: &AuthenticationExtensionsPrfValues, val: &::js_sys::Object); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationExtensionsPrfValues { + #[doc = "Construct a new `AuthenticationExtensionsPrfValues`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfValues`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(first: &::js_sys::Object) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.first(first); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_first()` instead."] + pub fn first(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_first(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_second()` instead."] + pub fn second(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_second(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs new file mode 100644 index 00000000000..62c2f9c1f02 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs @@ -0,0 +1,207 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticationResponseJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticationResponseJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticationResponseJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "authenticatorAttachment")] + pub fn get_authenticator_attachment(this: &AuthenticationResponseJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "authenticatorAttachment")] + pub fn set_authenticator_attachment(this: &AuthenticationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[doc = "Get the `clientExtensionResults` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clientExtensionResults")] + pub fn get_client_extension_results( + this: &AuthenticationResponseJson, + ) -> AuthenticationExtensionsClientOutputsJson; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[doc = "Change the `clientExtensionResults` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "clientExtensionResults")] + pub fn set_client_extension_results( + this: &AuthenticationResponseJson, + val: &AuthenticationExtensionsClientOutputsJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &AuthenticationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &AuthenticationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rawId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rawId")] + pub fn get_raw_id(this: &AuthenticationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rawId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rawId")] + pub fn set_raw_id(this: &AuthenticationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAssertionResponseJson")] + #[doc = "Get the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`, `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "response")] + pub fn get_response(this: &AuthenticationResponseJson) -> AuthenticatorAssertionResponseJson; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAssertionResponseJson")] + #[doc = "Change the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`, `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "response")] + pub fn set_response( + this: &AuthenticationResponseJson, + val: &AuthenticatorAssertionResponseJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &AuthenticationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "type")] + pub fn set_type(this: &AuthenticationResponseJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticationResponseJson { + #[cfg(all( + feature = "AuthenticationExtensionsClientOutputsJson", + feature = "AuthenticatorAssertionResponseJson", + ))] + #[doc = "Construct a new `AuthenticationResponseJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `AuthenticationResponseJson`, `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + client_extension_results: &AuthenticationExtensionsClientOutputsJson, + id: &str, + raw_id: &str, + response: &AuthenticatorAssertionResponseJson, + type_: &str, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.client_extension_results(client_extension_results); + ret.id(id); + ret.raw_id(raw_id); + ret.response(response); + ret.type_(type_); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_authenticator_attachment()` instead."] + pub fn authenticator_attachment(&mut self, val: &str) -> &mut Self { + self.set_authenticator_attachment(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[deprecated = "Use `set_client_extension_results()` instead."] + pub fn client_extension_results( + &mut self, + val: &AuthenticationExtensionsClientOutputsJson, + ) -> &mut Self { + self.set_client_extension_results(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_raw_id()` instead."] + pub fn raw_id(&mut self, val: &str) -> &mut Self { + self.set_raw_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAssertionResponseJson")] + #[deprecated = "Use `set_response()` instead."] + pub fn response(&mut self, val: &AuthenticatorAssertionResponseJson) -> &mut Self { + self.set_response(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_type()` instead."] + pub fn type_(&mut self, val: &str) -> &mut Self { + self.set_type(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponse.rs b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponse.rs index 0969f46bff1..f7e2fc913fd 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponse.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponse.rs @@ -33,4 +33,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponse`*"] pub fn user_handle(this: &AuthenticatorAssertionResponse) -> Option<::js_sys::ArrayBuffer>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "AuthenticatorAssertionResponse" , js_name = attestationObject)] + #[doc = "Getter for the `attestationObject` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse/attestationObject)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponse`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn attestation_object( + this: &AuthenticatorAssertionResponse, + ) -> Option<::js_sys::ArrayBuffer>; } diff --git a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs new file mode 100644 index 00000000000..d1a87b56980 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs @@ -0,0 +1,154 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticatorAssertionResponseJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticatorAssertionResponseJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticatorAssertionResponseJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationObject` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationObject")] + pub fn get_attestation_object(this: &AuthenticatorAssertionResponseJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationObject` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationObject")] + pub fn set_attestation_object(this: &AuthenticatorAssertionResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `authenticatorData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "authenticatorData")] + pub fn get_authenticator_data(this: &AuthenticatorAssertionResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `authenticatorData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "authenticatorData")] + pub fn set_authenticator_data(this: &AuthenticatorAssertionResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `clientDataJSON` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clientDataJSON")] + pub fn get_client_data_json(this: &AuthenticatorAssertionResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clientDataJSON` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "clientDataJSON")] + pub fn set_client_data_json(this: &AuthenticatorAssertionResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `signature` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "signature")] + pub fn get_signature(this: &AuthenticatorAssertionResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `signature` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "signature")] + pub fn set_signature(this: &AuthenticatorAssertionResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `userHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "userHandle")] + pub fn get_user_handle(this: &AuthenticatorAssertionResponseJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `userHandle` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "userHandle")] + pub fn set_user_handle(this: &AuthenticatorAssertionResponseJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticatorAssertionResponseJson { + #[doc = "Construct a new `AuthenticatorAssertionResponseJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAssertionResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(authenticator_data: &str, client_data_json: &str, signature: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.authenticator_data(authenticator_data); + ret.client_data_json(client_data_json); + ret.signature(signature); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_object()` instead."] + pub fn attestation_object(&mut self, val: &str) -> &mut Self { + self.set_attestation_object(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_authenticator_data()` instead."] + pub fn authenticator_data(&mut self, val: &str) -> &mut Self { + self.set_authenticator_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_client_data_json()` instead."] + pub fn client_data_json(&mut self, val: &str) -> &mut Self { + self.set_client_data_json(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_signature()` instead."] + pub fn signature(&mut self, val: &str) -> &mut Self { + self.set_signature(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_user_handle()` instead."] + pub fn user_handle(&mut self, val: &str) -> &mut Self { + self.set_user_handle(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponse.rs b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponse.rs index 97a82610896..290aff69105 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponse.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponse.rs @@ -19,4 +19,38 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponse`*"] pub fn attestation_object(this: &AuthenticatorAttestationResponse) -> ::js_sys::ArrayBuffer; + # [wasm_bindgen (catch , method , structural , js_class = "AuthenticatorAttestationResponse" , js_name = getAuthenticatorData)] + #[doc = "The `getAuthenticatorData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/getAuthenticatorData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponse`*"] + pub fn get_authenticator_data( + this: &AuthenticatorAttestationResponse, + ) -> Result<::js_sys::ArrayBuffer, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AuthenticatorAttestationResponse" , js_name = getPublicKey)] + #[doc = "The `getPublicKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/getPublicKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponse`*"] + pub fn get_public_key( + this: &AuthenticatorAttestationResponse, + ) -> Result, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AuthenticatorAttestationResponse" , js_name = getPublicKeyAlgorithm)] + #[doc = "The `getPublicKeyAlgorithm()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/getPublicKeyAlgorithm)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponse`*"] + pub fn get_public_key_algorithm( + this: &AuthenticatorAttestationResponse, + ) -> Result; + # [wasm_bindgen (method , structural , js_class = "AuthenticatorAttestationResponse" , js_name = getTransports)] + #[doc = "The `getTransports()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/getTransports)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponse`*"] + pub fn get_transports(this: &AuthenticatorAttestationResponse) -> ::js_sys::Array; } diff --git a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs new file mode 100644 index 00000000000..e591e05f032 --- /dev/null +++ b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs @@ -0,0 +1,189 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AuthenticatorAttestationResponseJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `AuthenticatorAttestationResponseJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type AuthenticatorAttestationResponseJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationObject` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationObject")] + pub fn get_attestation_object(this: &AuthenticatorAttestationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationObject` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationObject")] + pub fn set_attestation_object(this: &AuthenticatorAttestationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `authenticatorData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "authenticatorData")] + pub fn get_authenticator_data(this: &AuthenticatorAttestationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `authenticatorData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "authenticatorData")] + pub fn set_authenticator_data(this: &AuthenticatorAttestationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `clientDataJSON` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clientDataJSON")] + pub fn get_client_data_json(this: &AuthenticatorAttestationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `clientDataJSON` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "clientDataJSON")] + pub fn set_client_data_json(this: &AuthenticatorAttestationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "publicKey")] + pub fn get_public_key(this: &AuthenticatorAttestationResponseJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `publicKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "publicKey")] + pub fn set_public_key(this: &AuthenticatorAttestationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `publicKeyAlgorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "publicKeyAlgorithm")] + pub fn get_public_key_algorithm(this: &AuthenticatorAttestationResponseJson) -> f64; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `publicKeyAlgorithm` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "publicKeyAlgorithm")] + pub fn set_public_key_algorithm(this: &AuthenticatorAttestationResponseJson, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "transports")] + pub fn get_transports(this: &AuthenticatorAttestationResponseJson) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "transports")] + pub fn set_transports( + this: &AuthenticatorAttestationResponseJson, + val: &::wasm_bindgen::JsValue, + ); +} +#[cfg(web_sys_unstable_apis)] +impl AuthenticatorAttestationResponseJson { + #[doc = "Construct a new `AuthenticatorAttestationResponseJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + attestation_object: &str, + authenticator_data: &str, + client_data_json: &str, + public_key_algorithm: f64, + transports: &::wasm_bindgen::JsValue, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.attestation_object(attestation_object); + ret.authenticator_data(authenticator_data); + ret.client_data_json(client_data_json); + ret.public_key_algorithm(public_key_algorithm); + ret.transports(transports); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_object()` instead."] + pub fn attestation_object(&mut self, val: &str) -> &mut Self { + self.set_attestation_object(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_authenticator_data()` instead."] + pub fn authenticator_data(&mut self, val: &str) -> &mut Self { + self.set_authenticator_data(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_client_data_json()` instead."] + pub fn client_data_json(&mut self, val: &str) -> &mut Self { + self.set_client_data_json(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_public_key()` instead."] + pub fn public_key(&mut self, val: &str) -> &mut Self { + self.set_public_key(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_public_key_algorithm()` instead."] + pub fn public_key_algorithm(&mut self, val: f64) -> &mut Self { + self.set_public_key_algorithm(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_transports()` instead."] + pub fn transports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_transports(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs index cd8f0e36453..26409cbf27d 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs @@ -37,6 +37,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] #[wasm_bindgen(method, setter = "requireResidentKey")] pub fn set_require_resident_key(this: &AuthenticatorSelectionCriteria, val: bool); + #[doc = "Get the `residentKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] + #[wasm_bindgen(method, getter = "residentKey")] + pub fn get_resident_key(this: &AuthenticatorSelectionCriteria) -> Option; + #[doc = "Change the `residentKey` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] + #[wasm_bindgen(method, setter = "residentKey")] + pub fn set_resident_key(this: &AuthenticatorSelectionCriteria, val: &str); #[cfg(feature = "UserVerificationRequirement")] #[doc = "Get the `userVerification` field of this object."] #[doc = ""] @@ -75,6 +85,11 @@ impl AuthenticatorSelectionCriteria { self.set_require_resident_key(val); self } + #[deprecated = "Use `set_resident_key()` instead."] + pub fn resident_key(&mut self, val: &str) -> &mut Self { + self.set_resident_key(val); + self + } #[cfg(feature = "UserVerificationRequirement")] #[deprecated = "Use `set_user_verification()` instead."] pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self { diff --git a/crates/web-sys/src/features/gen_AuthenticatorTransport.rs b/crates/web-sys/src/features/gen_AuthenticatorTransport.rs index 2e1b2579c1c..9b43b08b139 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorTransport.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorTransport.rs @@ -10,4 +10,5 @@ pub enum AuthenticatorTransport { Usb = "usb", Nfc = "nfc", Ble = "ble", + Internal = "internal", } diff --git a/crates/web-sys/src/features/gen_CollectedClientData.rs b/crates/web-sys/src/features/gen_CollectedClientData.rs index e483aed9ae7..0631b9bb553 100644 --- a/crates/web-sys/src/features/gen_CollectedClientData.rs +++ b/crates/web-sys/src/features/gen_CollectedClientData.rs @@ -24,6 +24,7 @@ extern "C" { #[doc = "Get the `clientExtensions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, getter = "clientExtensions")] pub fn get_client_extensions( this: &CollectedClientData, @@ -32,19 +33,32 @@ extern "C" { #[doc = "Change the `clientExtensions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, setter = "clientExtensions")] pub fn set_client_extensions( this: &CollectedClientData, val: &AuthenticationExtensionsClientInputs, ); + #[doc = "Get the `crossOrigin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, getter = "crossOrigin")] + pub fn get_cross_origin(this: &CollectedClientData) -> Option; + #[doc = "Change the `crossOrigin` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[wasm_bindgen(method, setter = "crossOrigin")] + pub fn set_cross_origin(this: &CollectedClientData, val: bool); #[doc = "Get the `hashAlgorithm` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, getter = "hashAlgorithm")] pub fn get_hash_algorithm(this: &CollectedClientData) -> String; #[doc = "Change the `hashAlgorithm` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, setter = "hashAlgorithm")] pub fn set_hash_algorithm(this: &CollectedClientData, val: &str); #[doc = "Get the `origin` field of this object."] @@ -57,14 +71,28 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, setter = "origin")] pub fn set_origin(this: &CollectedClientData, val: &str); + #[cfg(feature = "TokenBinding")] + #[doc = "Get the `tokenBinding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`, `TokenBinding`*"] + #[wasm_bindgen(method, getter = "tokenBinding")] + pub fn get_token_binding(this: &CollectedClientData) -> Option; + #[cfg(feature = "TokenBinding")] + #[doc = "Change the `tokenBinding` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`, `TokenBinding`*"] + #[wasm_bindgen(method, setter = "tokenBinding")] + pub fn set_token_binding(this: &CollectedClientData, val: &TokenBinding); #[doc = "Get the `tokenBindingId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, getter = "tokenBindingId")] pub fn get_token_binding_id(this: &CollectedClientData) -> Option; #[doc = "Change the `tokenBindingId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] + #[deprecated] #[wasm_bindgen(method, setter = "tokenBindingId")] pub fn set_token_binding_id(this: &CollectedClientData, val: &str); #[doc = "Get the `type` field of this object."] @@ -102,6 +130,11 @@ impl CollectedClientData { self.set_client_extensions(val); self } + #[deprecated = "Use `set_cross_origin()` instead."] + pub fn cross_origin(&mut self, val: bool) -> &mut Self { + self.set_cross_origin(val); + self + } #[deprecated = "Use `set_hash_algorithm()` instead."] pub fn hash_algorithm(&mut self, val: &str) -> &mut Self { self.set_hash_algorithm(val); @@ -112,6 +145,12 @@ impl CollectedClientData { self.set_origin(val); self } + #[cfg(feature = "TokenBinding")] + #[deprecated = "Use `set_token_binding()` instead."] + pub fn token_binding(&mut self, val: &TokenBinding) -> &mut Self { + self.set_token_binding(val); + self + } #[deprecated = "Use `set_token_binding_id()` instead."] pub fn token_binding_id(&mut self, val: &str) -> &mut Self { self.set_token_binding_id(val); diff --git a/crates/web-sys/src/features/gen_CredentialPropertiesOutput.rs b/crates/web-sys/src/features/gen_CredentialPropertiesOutput.rs new file mode 100644 index 00000000000..5e44b35990a --- /dev/null +++ b/crates/web-sys/src/features/gen_CredentialPropertiesOutput.rs @@ -0,0 +1,43 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = CredentialPropertiesOutput)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `CredentialPropertiesOutput` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialPropertiesOutput`*"] + pub type CredentialPropertiesOutput; + #[doc = "Get the `rk` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialPropertiesOutput`*"] + #[wasm_bindgen(method, getter = "rk")] + pub fn get_rk(this: &CredentialPropertiesOutput) -> Option; + #[doc = "Change the `rk` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialPropertiesOutput`*"] + #[wasm_bindgen(method, setter = "rk")] + pub fn set_rk(this: &CredentialPropertiesOutput, val: bool); +} +impl CredentialPropertiesOutput { + #[doc = "Construct a new `CredentialPropertiesOutput`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CredentialPropertiesOutput`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[deprecated = "Use `set_rk()` instead."] + pub fn rk(&mut self, val: bool) -> &mut Self { + self.set_rk(val); + self + } +} +impl Default for CredentialPropertiesOutput { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_LargeBlobSupport.rs b/crates/web-sys/src/features/gen_LargeBlobSupport.rs new file mode 100644 index 00000000000..508b901fe8f --- /dev/null +++ b/crates/web-sys/src/features/gen_LargeBlobSupport.rs @@ -0,0 +1,12 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `LargeBlobSupport` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `LargeBlobSupport`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum LargeBlobSupport { + Required = "required", + Preferred = "preferred", +} diff --git a/crates/web-sys/src/features/gen_PublicKeyCredential.rs b/crates/web-sys/src/features/gen_PublicKeyCredential.rs index 9a383cb8590..90a07419189 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredential.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredential.rs @@ -27,6 +27,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorResponse`, `PublicKeyCredential`*"] pub fn response(this: &PublicKeyCredential) -> AuthenticatorResponse; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "PublicKeyCredential" , js_name = authenticatorAttachment)] + #[doc = "Getter for the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/authenticatorAttachment)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn authenticator_attachment(this: &PublicKeyCredential) -> Option; #[cfg(feature = "AuthenticationExtensionsClientOutputs")] # [wasm_bindgen (method , structural , js_class = "PublicKeyCredential" , js_name = getClientExtensionResults)] #[doc = "The `getClientExtensionResults()` method."] @@ -37,6 +48,28 @@ extern "C" { pub fn get_client_extension_results( this: &PublicKeyCredential, ) -> AuthenticationExtensionsClientOutputs; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = isConditionalMediationAvailable)] + #[doc = "The `isConditionalMediationAvailable()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/isConditionalMediationAvailable_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_conditional_mediation_available() -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = isPasskeyPlatformAuthenticatorAvailable)] + #[doc = "The `isPasskeyPlatformAuthenticatorAvailable()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/isPasskeyPlatformAuthenticatorAvailable_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_passkey_platform_authenticator_available() -> ::js_sys::Promise; # [wasm_bindgen (static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = isUserVerifyingPlatformAuthenticatorAvailable)] #[doc = "The `isUserVerifyingPlatformAuthenticatorAvailable()` method."] #[doc = ""] @@ -44,4 +77,49 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] pub fn is_user_verifying_platform_authenticator_available() -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "PublicKeyCredentialCreationOptions", + feature = "PublicKeyCredentialCreationOptionsJson", + ))] + # [wasm_bindgen (catch , static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = parseCreationOptionsFromJSON)] + #[doc = "The `parseCreationOptionsFromJSON()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/parseCreationOptionsFromJSON_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`, `PublicKeyCredentialCreationOptions`, `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn parse_creation_options_from_json( + options: &PublicKeyCredentialCreationOptionsJson, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "PublicKeyCredentialRequestOptions", + feature = "PublicKeyCredentialRequestOptionsJson", + ))] + # [wasm_bindgen (catch , static_method_of = PublicKeyCredential , js_class = "PublicKeyCredential" , js_name = parseRequestOptionsFromJSON)] + #[doc = "The `parseRequestOptionsFromJSON()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/parseRequestOptionsFromJSON_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`, `PublicKeyCredentialRequestOptions`, `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn parse_request_options_from_json( + options: &PublicKeyCredentialRequestOptionsJson, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "PublicKeyCredential" , js_name = toJSON)] + #[doc = "The `toJSON()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/toJSON)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredential`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn to_json(this: &PublicKeyCredential) -> Result<::wasm_bindgen::JsValue, JsValue>; } diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs index 630f3e6547a..8a4ac9a0f6e 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs @@ -27,6 +27,29 @@ extern "C" { this: &PublicKeyCredentialCreationOptions, val: AttestationConveyancePreference, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationFormats")] + pub fn get_attestation_formats( + this: &PublicKeyCredentialCreationOptions, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationFormats")] + pub fn set_attestation_formats( + this: &PublicKeyCredentialCreationOptions, + val: &::wasm_bindgen::JsValue, + ); #[cfg(feature = "AuthenticatorSelectionCriteria")] #[doc = "Get the `authenticatorSelection` field of this object."] #[doc = ""] @@ -86,6 +109,24 @@ extern "C" { this: &PublicKeyCredentialCreationOptions, val: &AuthenticationExtensionsClientInputs, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hints")] + pub fn get_hints(this: &PublicKeyCredentialCreationOptions) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "hints")] + pub fn set_hints(this: &PublicKeyCredentialCreationOptions, val: &::wasm_bindgen::JsValue); #[doc = "Get the `pubKeyCredParams` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptions`*"] @@ -162,6 +203,12 @@ impl PublicKeyCredentialCreationOptions { self.set_attestation(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_formats()` instead."] + pub fn attestation_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attestation_formats(val); + self + } #[cfg(feature = "AuthenticatorSelectionCriteria")] #[deprecated = "Use `set_authenticator_selection()` instead."] pub fn authenticator_selection(&mut self, val: &AuthenticatorSelectionCriteria) -> &mut Self { @@ -184,6 +231,12 @@ impl PublicKeyCredentialCreationOptions { self.set_extensions(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_hints()` instead."] + pub fn hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_hints(val); + self + } #[deprecated = "Use `set_pub_key_cred_params()` instead."] pub fn pub_key_cred_params(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { self.set_pub_key_cred_params(val); diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs new file mode 100644 index 00000000000..b56ce07fa5d --- /dev/null +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs @@ -0,0 +1,350 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PublicKeyCredentialCreationOptionsJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `PublicKeyCredentialCreationOptionsJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type PublicKeyCredentialCreationOptionsJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestation")] + pub fn get_attestation(this: &PublicKeyCredentialCreationOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestation")] + pub fn set_attestation(this: &PublicKeyCredentialCreationOptionsJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationFormats")] + pub fn get_attestation_formats( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationFormats")] + pub fn set_attestation_formats( + this: &PublicKeyCredentialCreationOptionsJson, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[doc = "Get the `authenticatorSelection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "authenticatorSelection")] + pub fn get_authenticator_selection( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[doc = "Change the `authenticatorSelection` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`, `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "authenticatorSelection")] + pub fn set_authenticator_selection( + this: &PublicKeyCredentialCreationOptionsJson, + val: &AuthenticatorSelectionCriteria, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &PublicKeyCredentialCreationOptionsJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "challenge")] + pub fn set_challenge(this: &PublicKeyCredentialCreationOptionsJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `excludeCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "excludeCredentials")] + pub fn get_exclude_credentials( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `excludeCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "excludeCredentials")] + pub fn set_exclude_credentials( + this: &PublicKeyCredentialCreationOptionsJson, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[doc = "Get the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`, `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "extensions")] + pub fn get_extensions( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[doc = "Change the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`, `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "extensions")] + pub fn set_extensions( + this: &PublicKeyCredentialCreationOptionsJson, + val: &AuthenticationExtensionsClientInputsJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hints")] + pub fn get_hints(this: &PublicKeyCredentialCreationOptionsJson) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "hints")] + pub fn set_hints(this: &PublicKeyCredentialCreationOptionsJson, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `pubKeyCredParams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "pubKeyCredParams")] + pub fn get_pub_key_cred_params( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `pubKeyCredParams` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "pubKeyCredParams")] + pub fn set_pub_key_cred_params( + this: &PublicKeyCredentialCreationOptionsJson, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[doc = "Get the `rp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`, `PublicKeyCredentialRpEntity`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rp")] + pub fn get_rp(this: &PublicKeyCredentialCreationOptionsJson) -> PublicKeyCredentialRpEntity; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[doc = "Change the `rp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`, `PublicKeyCredentialRpEntity`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rp")] + pub fn set_rp(this: &PublicKeyCredentialCreationOptionsJson, val: &PublicKeyCredentialRpEntity); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &PublicKeyCredentialCreationOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timeout")] + pub fn set_timeout(this: &PublicKeyCredentialCreationOptionsJson, val: u32); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialUserEntityJson")] + #[doc = "Get the `user` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`, `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "user")] + pub fn get_user( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> PublicKeyCredentialUserEntityJson; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialUserEntityJson")] + #[doc = "Change the `user` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`, `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "user")] + pub fn set_user( + this: &PublicKeyCredentialCreationOptionsJson, + val: &PublicKeyCredentialUserEntityJson, + ); +} +#[cfg(web_sys_unstable_apis)] +impl PublicKeyCredentialCreationOptionsJson { + #[cfg(all( + feature = "PublicKeyCredentialRpEntity", + feature = "PublicKeyCredentialUserEntityJson", + ))] + #[doc = "Construct a new `PublicKeyCredentialCreationOptionsJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialCreationOptionsJson`, `PublicKeyCredentialRpEntity`, `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + challenge: &str, + pub_key_cred_params: &::wasm_bindgen::JsValue, + rp: &PublicKeyCredentialRpEntity, + user: &PublicKeyCredentialUserEntityJson, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.challenge(challenge); + ret.pub_key_cred_params(pub_key_cred_params); + ret.rp(rp); + ret.user(user); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation()` instead."] + pub fn attestation(&mut self, val: &str) -> &mut Self { + self.set_attestation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_formats()` instead."] + pub fn attestation_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attestation_formats(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorSelectionCriteria")] + #[deprecated = "Use `set_authenticator_selection()` instead."] + pub fn authenticator_selection(&mut self, val: &AuthenticatorSelectionCriteria) -> &mut Self { + self.set_authenticator_selection(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_challenge()` instead."] + pub fn challenge(&mut self, val: &str) -> &mut Self { + self.set_challenge(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_exclude_credentials()` instead."] + pub fn exclude_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_exclude_credentials(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[deprecated = "Use `set_extensions()` instead."] + pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputsJson) -> &mut Self { + self.set_extensions(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_hints()` instead."] + pub fn hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_hints(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_pub_key_cred_params()` instead."] + pub fn pub_key_cred_params(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_pub_key_cred_params(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialRpEntity")] + #[deprecated = "Use `set_rp()` instead."] + pub fn rp(&mut self, val: &PublicKeyCredentialRpEntity) -> &mut Self { + self.set_rp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timeout()` instead."] + pub fn timeout(&mut self, val: u32) -> &mut Self { + self.set_timeout(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PublicKeyCredentialUserEntityJson")] + #[deprecated = "Use `set_user()` instead."] + pub fn user(&mut self, val: &PublicKeyCredentialUserEntityJson) -> &mut Self { + self.set_user(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs new file mode 100644 index 00000000000..adb9f81e42e --- /dev/null +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs @@ -0,0 +1,105 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PublicKeyCredentialDescriptorJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `PublicKeyCredentialDescriptorJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type PublicKeyCredentialDescriptorJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &PublicKeyCredentialDescriptorJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &PublicKeyCredentialDescriptorJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "transports")] + pub fn get_transports(this: &PublicKeyCredentialDescriptorJson) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `transports` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "transports")] + pub fn set_transports(this: &PublicKeyCredentialDescriptorJson, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &PublicKeyCredentialDescriptorJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "type")] + pub fn set_type(this: &PublicKeyCredentialDescriptorJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl PublicKeyCredentialDescriptorJson { + #[doc = "Construct a new `PublicKeyCredentialDescriptorJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialDescriptorJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(id: &str, type_: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.id(id); + ret.type_(type_); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_transports()` instead."] + pub fn transports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_transports(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_type()` instead."] + pub fn type_(&mut self, val: &str) -> &mut Self { + self.set_type(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs index f16bcd84e13..c27a716f361 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs @@ -13,11 +13,13 @@ extern "C" { #[doc = "Get the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[deprecated] #[wasm_bindgen(method, getter = "icon")] pub fn get_icon(this: &PublicKeyCredentialEntity) -> Option; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] + #[deprecated] #[wasm_bindgen(method, setter = "icon")] pub fn set_icon(this: &PublicKeyCredentialEntity, val: &str); #[doc = "Get the `name` field of this object."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialHints.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialHints.rs new file mode 100644 index 00000000000..a5aa405e64f --- /dev/null +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialHints.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `PublicKeyCredentialHints` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialHints`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PublicKeyCredentialHints { + SecurityKey = "security-key", + ClientDevice = "client-device", + Hybrid = "hybrid", +} diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs index 8f42a289bd5..ddc9c055760 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs @@ -25,6 +25,47 @@ extern "C" { this: &PublicKeyCredentialRequestOptions, val: &::wasm_bindgen::JsValue, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestation")] + pub fn get_attestation(this: &PublicKeyCredentialRequestOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestation")] + pub fn set_attestation(this: &PublicKeyCredentialRequestOptions, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationFormats")] + pub fn get_attestation_formats( + this: &PublicKeyCredentialRequestOptions, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationFormats")] + pub fn set_attestation_formats( + this: &PublicKeyCredentialRequestOptions, + val: &::wasm_bindgen::JsValue, + ); #[doc = "Get the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] @@ -52,6 +93,24 @@ extern "C" { this: &PublicKeyCredentialRequestOptions, val: &AuthenticationExtensionsClientInputs, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hints")] + pub fn get_hints(this: &PublicKeyCredentialRequestOptions) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "hints")] + pub fn set_hints(this: &PublicKeyCredentialRequestOptions, val: &::wasm_bindgen::JsValue); #[doc = "Get the `rpId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] @@ -105,6 +164,18 @@ impl PublicKeyCredentialRequestOptions { self.set_allow_credentials(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation()` instead."] + pub fn attestation(&mut self, val: &str) -> &mut Self { + self.set_attestation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_formats()` instead."] + pub fn attestation_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attestation_formats(val); + self + } #[deprecated = "Use `set_challenge()` instead."] pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self { self.set_challenge(val); @@ -116,6 +187,12 @@ impl PublicKeyCredentialRequestOptions { self.set_extensions(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_hints()` instead."] + pub fn hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_hints(val); + self + } #[deprecated = "Use `set_rp_id()` instead."] pub fn rp_id(&mut self, val: &str) -> &mut Self { self.set_rp_id(val); diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs new file mode 100644 index 00000000000..a7bf1f6c870 --- /dev/null +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs @@ -0,0 +1,266 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PublicKeyCredentialRequestOptionsJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `PublicKeyCredentialRequestOptionsJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type PublicKeyCredentialRequestOptionsJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `allowCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "allowCredentials")] + pub fn get_allow_credentials( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `allowCredentials` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "allowCredentials")] + pub fn set_allow_credentials( + this: &PublicKeyCredentialRequestOptionsJson, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestation")] + pub fn get_attestation(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestation")] + pub fn set_attestation(this: &PublicKeyCredentialRequestOptionsJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "attestationFormats")] + pub fn get_attestation_formats( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `attestationFormats` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "attestationFormats")] + pub fn set_attestation_formats( + this: &PublicKeyCredentialRequestOptionsJson, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "challenge")] + pub fn get_challenge(this: &PublicKeyCredentialRequestOptionsJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `challenge` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "challenge")] + pub fn set_challenge(this: &PublicKeyCredentialRequestOptionsJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[doc = "Get the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`, `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "extensions")] + pub fn get_extensions( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[doc = "Change the `extensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputsJson`, `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "extensions")] + pub fn set_extensions( + this: &PublicKeyCredentialRequestOptionsJson, + val: &AuthenticationExtensionsClientInputsJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "hints")] + pub fn get_hints(this: &PublicKeyCredentialRequestOptionsJson) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `hints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "hints")] + pub fn set_hints(this: &PublicKeyCredentialRequestOptionsJson, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rpId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rpId")] + pub fn get_rp_id(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rpId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rpId")] + pub fn set_rp_id(this: &PublicKeyCredentialRequestOptionsJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timeout")] + pub fn get_timeout(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timeout` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timeout")] + pub fn set_timeout(this: &PublicKeyCredentialRequestOptionsJson, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "userVerification")] + pub fn get_user_verification(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `userVerification` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "userVerification")] + pub fn set_user_verification(this: &PublicKeyCredentialRequestOptionsJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl PublicKeyCredentialRequestOptionsJson { + #[doc = "Construct a new `PublicKeyCredentialRequestOptionsJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptionsJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(challenge: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.challenge(challenge); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_allow_credentials()` instead."] + pub fn allow_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_allow_credentials(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation()` instead."] + pub fn attestation(&mut self, val: &str) -> &mut Self { + self.set_attestation(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_attestation_formats()` instead."] + pub fn attestation_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_attestation_formats(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_challenge()` instead."] + pub fn challenge(&mut self, val: &str) -> &mut Self { + self.set_challenge(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientInputsJson")] + #[deprecated = "Use `set_extensions()` instead."] + pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputsJson) -> &mut Self { + self.set_extensions(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_hints()` instead."] + pub fn hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_hints(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rp_id()` instead."] + pub fn rp_id(&mut self, val: &str) -> &mut Self { + self.set_rp_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timeout()` instead."] + pub fn timeout(&mut self, val: u32) -> &mut Self { + self.set_timeout(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_user_verification()` instead."] + pub fn user_verification(&mut self, val: &str) -> &mut Self { + self.set_user_verification(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs index 1cfba5695b1..17f68408a5d 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs @@ -13,11 +13,13 @@ extern "C" { #[doc = "Get the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[deprecated] #[wasm_bindgen(method, getter = "icon")] pub fn get_icon(this: &PublicKeyCredentialRpEntity) -> Option; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] + #[deprecated] #[wasm_bindgen(method, setter = "icon")] pub fn set_icon(this: &PublicKeyCredentialRpEntity, val: &str); #[doc = "Get the `name` field of this object."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs index 017f546fcc9..d04a2e50fda 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs @@ -13,11 +13,13 @@ extern "C" { #[doc = "Get the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated] #[wasm_bindgen(method, getter = "icon")] pub fn get_icon(this: &PublicKeyCredentialUserEntity) -> Option; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] + #[deprecated] #[wasm_bindgen(method, setter = "icon")] pub fn set_icon(this: &PublicKeyCredentialUserEntity, val: &str); #[doc = "Get the `name` field of this object."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs new file mode 100644 index 00000000000..7dc46e46b81 --- /dev/null +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs @@ -0,0 +1,106 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PublicKeyCredentialUserEntityJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `PublicKeyCredentialUserEntityJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type PublicKeyCredentialUserEntityJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `displayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "displayName")] + pub fn get_display_name(this: &PublicKeyCredentialUserEntityJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `displayName` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "displayName")] + pub fn set_display_name(this: &PublicKeyCredentialUserEntityJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &PublicKeyCredentialUserEntityJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &PublicKeyCredentialUserEntityJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "name")] + pub fn get_name(this: &PublicKeyCredentialUserEntityJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `name` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "name")] + pub fn set_name(this: &PublicKeyCredentialUserEntityJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl PublicKeyCredentialUserEntityJson { + #[doc = "Construct a new `PublicKeyCredentialUserEntityJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntityJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(display_name: &str, id: &str, name: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.display_name(display_name); + ret.id(id); + ret.name(name); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_display_name()` instead."] + pub fn display_name(&mut self, val: &str) -> &mut Self { + self.set_display_name(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_name()` instead."] + pub fn name(&mut self, val: &str) -> &mut Self { + self.set_name(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_RegistrationResponseJson.rs b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs new file mode 100644 index 00000000000..c34df99d37e --- /dev/null +++ b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs @@ -0,0 +1,207 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RegistrationResponseJSON)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RegistrationResponseJson` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RegistrationResponseJson; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "authenticatorAttachment")] + pub fn get_authenticator_attachment(this: &RegistrationResponseJson) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `authenticatorAttachment` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "authenticatorAttachment")] + pub fn set_authenticator_attachment(this: &RegistrationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[doc = "Get the `clientExtensionResults` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "clientExtensionResults")] + pub fn get_client_extension_results( + this: &RegistrationResponseJson, + ) -> AuthenticationExtensionsClientOutputsJson; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[doc = "Change the `clientExtensionResults` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "clientExtensionResults")] + pub fn set_client_extension_results( + this: &RegistrationResponseJson, + val: &AuthenticationExtensionsClientOutputsJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &RegistrationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &RegistrationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rawId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rawId")] + pub fn get_raw_id(this: &RegistrationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rawId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rawId")] + pub fn set_raw_id(this: &RegistrationResponseJson, val: &str); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAttestationResponseJson")] + #[doc = "Get the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`, `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "response")] + pub fn get_response(this: &RegistrationResponseJson) -> AuthenticatorAttestationResponseJson; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAttestationResponseJson")] + #[doc = "Change the `response` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticatorAttestationResponseJson`, `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "response")] + pub fn set_response( + this: &RegistrationResponseJson, + val: &AuthenticatorAttestationResponseJson, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "type")] + pub fn get_type(this: &RegistrationResponseJson) -> String; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "type")] + pub fn set_type(this: &RegistrationResponseJson, val: &str); +} +#[cfg(web_sys_unstable_apis)] +impl RegistrationResponseJson { + #[cfg(all( + feature = "AuthenticationExtensionsClientOutputsJson", + feature = "AuthenticatorAttestationResponseJson", + ))] + #[doc = "Construct a new `RegistrationResponseJson`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientOutputsJson`, `AuthenticatorAttestationResponseJson`, `RegistrationResponseJson`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + client_extension_results: &AuthenticationExtensionsClientOutputsJson, + id: &str, + raw_id: &str, + response: &AuthenticatorAttestationResponseJson, + type_: &str, + ) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.client_extension_results(client_extension_results); + ret.id(id); + ret.raw_id(raw_id); + ret.response(response); + ret.type_(type_); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_authenticator_attachment()` instead."] + pub fn authenticator_attachment(&mut self, val: &str) -> &mut Self { + self.set_authenticator_attachment(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] + #[deprecated = "Use `set_client_extension_results()` instead."] + pub fn client_extension_results( + &mut self, + val: &AuthenticationExtensionsClientOutputsJson, + ) -> &mut Self { + self.set_client_extension_results(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_raw_id()` instead."] + pub fn raw_id(&mut self, val: &str) -> &mut Self { + self.set_raw_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AuthenticatorAttestationResponseJson")] + #[deprecated = "Use `set_response()` instead."] + pub fn response(&mut self, val: &AuthenticatorAttestationResponseJson) -> &mut Self { + self.set_response(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_type()` instead."] + pub fn type_(&mut self, val: &str) -> &mut Self { + self.set_type(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_ResidentKeyRequirement.rs b/crates/web-sys/src/features/gen_ResidentKeyRequirement.rs new file mode 100644 index 00000000000..453e8363b21 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResidentKeyRequirement.rs @@ -0,0 +1,13 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ResidentKeyRequirement` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ResidentKeyRequirement`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ResidentKeyRequirement { + Discouraged = "discouraged", + Preferred = "preferred", + Required = "required", +} diff --git a/crates/web-sys/src/features/gen_TokenBinding.rs b/crates/web-sys/src/features/gen_TokenBinding.rs new file mode 100644 index 00000000000..3ebc6df4f23 --- /dev/null +++ b/crates/web-sys/src/features/gen_TokenBinding.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = TokenBinding)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `TokenBinding` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + pub type TokenBinding; + #[doc = "Get the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + #[wasm_bindgen(method, getter = "id")] + pub fn get_id(this: &TokenBinding) -> Option; + #[doc = "Change the `id` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + #[wasm_bindgen(method, setter = "id")] + pub fn set_id(this: &TokenBinding, val: &str); + #[doc = "Get the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + #[wasm_bindgen(method, getter = "status")] + pub fn get_status(this: &TokenBinding) -> String; + #[doc = "Change the `status` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + #[wasm_bindgen(method, setter = "status")] + pub fn set_status(this: &TokenBinding, val: &str); +} +impl TokenBinding { + #[doc = "Construct a new `TokenBinding`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] + pub fn new(status: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.status(status); + ret + } + #[deprecated = "Use `set_id()` instead."] + pub fn id(&mut self, val: &str) -> &mut Self { + self.set_id(val); + self + } + #[deprecated = "Use `set_status()` instead."] + pub fn status(&mut self, val: &str) -> &mut Self { + self.set_status(val); + self + } +} diff --git a/crates/web-sys/src/features/gen_TokenBindingStatus.rs b/crates/web-sys/src/features/gen_TokenBindingStatus.rs new file mode 100644 index 00000000000..a9afc68ae1f --- /dev/null +++ b/crates/web-sys/src/features/gen_TokenBindingStatus.rs @@ -0,0 +1,12 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `TokenBindingStatus` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `TokenBindingStatus`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TokenBindingStatus { + Present = "present", + Supported = "supported", +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 593a3f5e0de..a7f682498b3 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -502,6 +502,13 @@ mod gen_AuthenticationExtensionsClientInputs; #[allow(unused_imports)] pub use gen_AuthenticationExtensionsClientInputs::*; +#[cfg(feature = "AuthenticationExtensionsClientInputsJson")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsClientInputsJson; +#[cfg(feature = "AuthenticationExtensionsClientInputsJson")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsClientInputsJson::*; + #[cfg(feature = "AuthenticationExtensionsClientOutputs")] #[allow(non_snake_case)] mod gen_AuthenticationExtensionsClientOutputs; @@ -509,6 +516,69 @@ mod gen_AuthenticationExtensionsClientOutputs; #[allow(unused_imports)] pub use gen_AuthenticationExtensionsClientOutputs::*; +#[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsClientOutputsJson; +#[cfg(feature = "AuthenticationExtensionsClientOutputsJson")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsClientOutputsJson::*; + +#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsDevicePublicKeyInputs; +#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyInputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsDevicePublicKeyInputs::*; + +#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyOutputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsDevicePublicKeyOutputs; +#[cfg(feature = "AuthenticationExtensionsDevicePublicKeyOutputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsDevicePublicKeyOutputs::*; + +#[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsLargeBlobInputs; +#[cfg(feature = "AuthenticationExtensionsLargeBlobInputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsLargeBlobInputs::*; + +#[cfg(feature = "AuthenticationExtensionsLargeBlobOutputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsLargeBlobOutputs; +#[cfg(feature = "AuthenticationExtensionsLargeBlobOutputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsLargeBlobOutputs::*; + +#[cfg(feature = "AuthenticationExtensionsPrfInputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsPrfInputs; +#[cfg(feature = "AuthenticationExtensionsPrfInputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsPrfInputs::*; + +#[cfg(feature = "AuthenticationExtensionsPrfOutputs")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsPrfOutputs; +#[cfg(feature = "AuthenticationExtensionsPrfOutputs")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsPrfOutputs::*; + +#[cfg(feature = "AuthenticationExtensionsPrfValues")] +#[allow(non_snake_case)] +mod gen_AuthenticationExtensionsPrfValues; +#[cfg(feature = "AuthenticationExtensionsPrfValues")] +#[allow(unused_imports)] +pub use gen_AuthenticationExtensionsPrfValues::*; + +#[cfg(feature = "AuthenticationResponseJson")] +#[allow(non_snake_case)] +mod gen_AuthenticationResponseJson; +#[cfg(feature = "AuthenticationResponseJson")] +#[allow(unused_imports)] +pub use gen_AuthenticationResponseJson::*; + #[cfg(feature = "AuthenticatorAssertionResponse")] #[allow(non_snake_case)] mod gen_AuthenticatorAssertionResponse; @@ -516,6 +586,13 @@ mod gen_AuthenticatorAssertionResponse; #[allow(unused_imports)] pub use gen_AuthenticatorAssertionResponse::*; +#[cfg(feature = "AuthenticatorAssertionResponseJson")] +#[allow(non_snake_case)] +mod gen_AuthenticatorAssertionResponseJson; +#[cfg(feature = "AuthenticatorAssertionResponseJson")] +#[allow(unused_imports)] +pub use gen_AuthenticatorAssertionResponseJson::*; + #[cfg(feature = "AuthenticatorAttachment")] #[allow(non_snake_case)] mod gen_AuthenticatorAttachment; @@ -530,6 +607,13 @@ mod gen_AuthenticatorAttestationResponse; #[allow(unused_imports)] pub use gen_AuthenticatorAttestationResponse::*; +#[cfg(feature = "AuthenticatorAttestationResponseJson")] +#[allow(non_snake_case)] +mod gen_AuthenticatorAttestationResponseJson; +#[cfg(feature = "AuthenticatorAttestationResponseJson")] +#[allow(unused_imports)] +pub use gen_AuthenticatorAttestationResponseJson::*; + #[cfg(feature = "AuthenticatorResponse")] #[allow(non_snake_case)] mod gen_AuthenticatorResponse; @@ -1426,6 +1510,13 @@ mod gen_CredentialCreationOptions; #[allow(unused_imports)] pub use gen_CredentialCreationOptions::*; +#[cfg(feature = "CredentialPropertiesOutput")] +#[allow(non_snake_case)] +mod gen_CredentialPropertiesOutput; +#[cfg(feature = "CredentialPropertiesOutput")] +#[allow(unused_imports)] +pub use gen_CredentialPropertiesOutput::*; + #[cfg(feature = "CredentialRequestOptions")] #[allow(non_snake_case)] mod gen_CredentialRequestOptions; @@ -5059,6 +5150,13 @@ mod gen_L10nValue; #[allow(unused_imports)] pub use gen_L10nValue::*; +#[cfg(feature = "LargeBlobSupport")] +#[allow(non_snake_case)] +mod gen_LargeBlobSupport; +#[cfg(feature = "LargeBlobSupport")] +#[allow(unused_imports)] +pub use gen_LargeBlobSupport::*; + #[cfg(feature = "LatencyMode")] #[allow(non_snake_case)] mod gen_LatencyMode; @@ -6816,6 +6914,13 @@ mod gen_PublicKeyCredentialCreationOptions; #[allow(unused_imports)] pub use gen_PublicKeyCredentialCreationOptions::*; +#[cfg(feature = "PublicKeyCredentialCreationOptionsJson")] +#[allow(non_snake_case)] +mod gen_PublicKeyCredentialCreationOptionsJson; +#[cfg(feature = "PublicKeyCredentialCreationOptionsJson")] +#[allow(unused_imports)] +pub use gen_PublicKeyCredentialCreationOptionsJson::*; + #[cfg(feature = "PublicKeyCredentialDescriptor")] #[allow(non_snake_case)] mod gen_PublicKeyCredentialDescriptor; @@ -6823,6 +6928,13 @@ mod gen_PublicKeyCredentialDescriptor; #[allow(unused_imports)] pub use gen_PublicKeyCredentialDescriptor::*; +#[cfg(feature = "PublicKeyCredentialDescriptorJson")] +#[allow(non_snake_case)] +mod gen_PublicKeyCredentialDescriptorJson; +#[cfg(feature = "PublicKeyCredentialDescriptorJson")] +#[allow(unused_imports)] +pub use gen_PublicKeyCredentialDescriptorJson::*; + #[cfg(feature = "PublicKeyCredentialEntity")] #[allow(non_snake_case)] mod gen_PublicKeyCredentialEntity; @@ -6830,6 +6942,13 @@ mod gen_PublicKeyCredentialEntity; #[allow(unused_imports)] pub use gen_PublicKeyCredentialEntity::*; +#[cfg(feature = "PublicKeyCredentialHints")] +#[allow(non_snake_case)] +mod gen_PublicKeyCredentialHints; +#[cfg(feature = "PublicKeyCredentialHints")] +#[allow(unused_imports)] +pub use gen_PublicKeyCredentialHints::*; + #[cfg(feature = "PublicKeyCredentialParameters")] #[allow(non_snake_case)] mod gen_PublicKeyCredentialParameters; @@ -6844,6 +6963,13 @@ mod gen_PublicKeyCredentialRequestOptions; #[allow(unused_imports)] pub use gen_PublicKeyCredentialRequestOptions::*; +#[cfg(feature = "PublicKeyCredentialRequestOptionsJson")] +#[allow(non_snake_case)] +mod gen_PublicKeyCredentialRequestOptionsJson; +#[cfg(feature = "PublicKeyCredentialRequestOptionsJson")] +#[allow(unused_imports)] +pub use gen_PublicKeyCredentialRequestOptionsJson::*; + #[cfg(feature = "PublicKeyCredentialRpEntity")] #[allow(non_snake_case)] mod gen_PublicKeyCredentialRpEntity; @@ -6865,6 +6991,13 @@ mod gen_PublicKeyCredentialUserEntity; #[allow(unused_imports)] pub use gen_PublicKeyCredentialUserEntity::*; +#[cfg(feature = "PublicKeyCredentialUserEntityJson")] +#[allow(non_snake_case)] +mod gen_PublicKeyCredentialUserEntityJson; +#[cfg(feature = "PublicKeyCredentialUserEntityJson")] +#[allow(unused_imports)] +pub use gen_PublicKeyCredentialUserEntityJson::*; + #[cfg(feature = "PushEncryptionKeyName")] #[allow(non_snake_case)] mod gen_PushEncryptionKeyName; @@ -7124,6 +7257,13 @@ mod gen_RegistrationOptions; #[allow(unused_imports)] pub use gen_RegistrationOptions::*; +#[cfg(feature = "RegistrationResponseJson")] +#[allow(non_snake_case)] +mod gen_RegistrationResponseJson; +#[cfg(feature = "RegistrationResponseJson")] +#[allow(unused_imports)] +pub use gen_RegistrationResponseJson::*; + #[cfg(feature = "Request")] #[allow(non_snake_case)] mod gen_Request; @@ -7187,6 +7327,13 @@ mod gen_RequestRedirect; #[allow(unused_imports)] pub use gen_RequestRedirect::*; +#[cfg(feature = "ResidentKeyRequirement")] +#[allow(non_snake_case)] +mod gen_ResidentKeyRequirement; +#[cfg(feature = "ResidentKeyRequirement")] +#[allow(unused_imports)] +pub use gen_ResidentKeyRequirement::*; + #[cfg(feature = "ResizeObserver")] #[allow(non_snake_case)] mod gen_ResizeObserver; @@ -9532,6 +9679,20 @@ mod gen_TimeRanges; #[allow(unused_imports)] pub use gen_TimeRanges::*; +#[cfg(feature = "TokenBinding")] +#[allow(non_snake_case)] +mod gen_TokenBinding; +#[cfg(feature = "TokenBinding")] +#[allow(unused_imports)] +pub use gen_TokenBinding::*; + +#[cfg(feature = "TokenBindingStatus")] +#[allow(non_snake_case)] +mod gen_TokenBindingStatus; +#[cfg(feature = "TokenBindingStatus")] +#[allow(unused_imports)] +pub use gen_TokenBindingStatus::*; + #[cfg(feature = "Touch")] #[allow(non_snake_case)] mod gen_Touch; diff --git a/crates/web-sys/webidls/enabled/CredentialManagement.webidl b/crates/web-sys/webidls/enabled/CredentialManagement.webidl index 31dbfe65f0f..13b2e577454 100644 --- a/crates/web-sys/webidls/enabled/CredentialManagement.webidl +++ b/crates/web-sys/webidls/enabled/CredentialManagement.webidl @@ -26,11 +26,9 @@ interface CredentialsContainer { }; dictionary CredentialRequestOptions { - PublicKeyCredentialRequestOptions publicKey; AbortSignal signal; }; dictionary CredentialCreationOptions { - PublicKeyCredentialCreationOptions publicKey; AbortSignal signal; }; diff --git a/crates/web-sys/webidls/enabled/WebAuthentication.webidl b/crates/web-sys/webidls/enabled/WebAuthentication.webidl index f9a6df41575..0bc68aaae68 100644 --- a/crates/web-sys/webidls/enabled/WebAuthentication.webidl +++ b/crates/web-sys/webidls/enabled/WebAuthentication.webidl @@ -16,6 +16,14 @@ interface PublicKeyCredential : Credential { AuthenticationExtensionsClientOutputs getClientExtensionResults(); }; +partial dictionary CredentialCreationOptions { + PublicKeyCredentialCreationOptions publicKey; +}; + +partial dictionary CredentialRequestOptions { + PublicKeyCredentialRequestOptions publicKey; +}; + [SecureContext] partial interface PublicKeyCredential { static Promise isUserVerifyingPlatformAuthenticatorAvailable(); @@ -28,7 +36,11 @@ interface AuthenticatorResponse { [SecureContext, Pref="security.webauth.webauthn"] interface AuthenticatorAttestationResponse : AuthenticatorResponse { - [SameObject] readonly attribute ArrayBuffer attestationObject; + [SameObject] readonly attribute ArrayBuffer attestationObject; + sequence getTransports(); + [Throws] ArrayBuffer getAuthenticatorData(); + [Throws] ArrayBuffer? getPublicKey(); + [Throws] COSEAlgorithmIdentifier getPublicKeyAlgorithm(); }; [SecureContext, Pref="security.webauth.webauthn"] @@ -39,6 +51,7 @@ interface AuthenticatorAssertionResponse : AuthenticatorResponse { }; dictionary PublicKeyCredentialParameters { + // Should be `DOMString`. required PublicKeyCredentialType type; required COSEAlgorithmIdentifier alg; }; @@ -53,12 +66,14 @@ dictionary PublicKeyCredentialCreationOptions { unsigned long timeout; sequence excludeCredentials = []; AuthenticatorSelectionCriteria authenticatorSelection; + // Should be `DOMString`. AttestationConveyancePreference attestation = "none"; AuthenticationExtensionsClientInputs extensions; }; dictionary PublicKeyCredentialEntity { required DOMString name; + [RustDeprecated] USVString icon; }; @@ -72,8 +87,11 @@ dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity { }; dictionary AuthenticatorSelectionCriteria { + // Should be `DOMString`. AuthenticatorAttachment authenticatorAttachment; + DOMString residentKey; boolean requireResidentKey = false; + // Should be `DOMString`. UserVerificationRequirement userVerification = "preferred"; }; @@ -82,16 +100,17 @@ enum AuthenticatorAttachment { "cross-platform" // Cross-platform attachment }; +enum ResidentKeyRequirement { + "discouraged", + "preferred", + "required" +}; + enum AttestationConveyancePreference { "none", "indirect", - "direct" -}; - -enum UserVerificationRequirement { - "required", - "preferred", - "discouraged" + "direct", + "enterprise" }; dictionary PublicKeyCredentialRequestOptions { @@ -99,68 +118,131 @@ dictionary PublicKeyCredentialRequestOptions { unsigned long timeout; USVString rpId; sequence allowCredentials = []; + // Should be `DOMString`. UserVerificationRequirement userVerification = "preferred"; AuthenticationExtensionsClientInputs extensions; }; -// TODO - Use partial dictionaries when bug 1436329 is fixed. dictionary AuthenticationExtensionsClientInputs { - // FIDO AppID Extension (appid) - // - USVString appid; }; -// TODO - Use partial dictionaries when bug 1436329 is fixed. dictionary AuthenticationExtensionsClientOutputs { - // FIDO AppID Extension (appid) - // - boolean appid; }; -typedef record AuthenticationExtensionsAuthenticatorInputs; - dictionary CollectedClientData { required DOMString type; required DOMString challenge; required DOMString origin; + [RustDeprecated] required DOMString hashAlgorithm; + [RustDeprecated] DOMString tokenBindingId; + [RustDeprecated] AuthenticationExtensionsClientInputs clientExtensions; + [RustDeprecated] AuthenticationExtensionsAuthenticatorInputs authenticatorExtensions; + boolean crossOrigin; + TokenBinding tokenBinding; +}; + +dictionary TokenBinding { + required DOMString status; + DOMString id; }; +enum TokenBindingStatus { "present", "supported" }; + enum PublicKeyCredentialType { "public-key" }; dictionary PublicKeyCredentialDescriptor { + // Should be `DOMString`. required PublicKeyCredentialType type; required BufferSource id; + // Should be `DOMString`. sequence transports; }; enum AuthenticatorTransport { "usb", "nfc", - "ble" + "ble", + "internal" }; typedef long COSEAlgorithmIdentifier; -typedef sequence AuthenticatorSelectionList; - -typedef BufferSource AAGUID; +enum UserVerificationRequirement { + "required", + "preferred", + "discouraged" +}; -/* -// FIDO AppID Extension (appid) -// partial dictionary AuthenticationExtensionsClientInputs { + // FIDO AppID Extension (appid) + // USVString appid; }; -// FIDO AppID Extension (appid) -// partial dictionary AuthenticationExtensionsClientOutputs { - boolean appid; + // FIDO AppID Extension (appid) + // + boolean appid; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + USVString appidExclude; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + boolean appidExclude; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + boolean uvm; +}; + +typedef sequence UvmEntry; +typedef sequence UvmEntries; + +partial dictionary AuthenticationExtensionsClientOutputs { + UvmEntries uvm; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + boolean credProps; +}; + +dictionary CredentialPropertiesOutput { + boolean rk; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + CredentialPropertiesOutput credProps; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + AuthenticationExtensionsLargeBlobInputs largeBlob; +}; + +enum LargeBlobSupport { + "required", + "preferred", +}; + +dictionary AuthenticationExtensionsLargeBlobInputs { + DOMString support; + boolean read; + BufferSource write; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + AuthenticationExtensionsLargeBlobOutputs largeBlob; +}; + +dictionary AuthenticationExtensionsLargeBlobOutputs { + boolean supported; + ArrayBuffer blob; + boolean written; }; -*/ diff --git a/crates/web-sys/webidls/unstable/WebAuthentication.webidl b/crates/web-sys/webidls/unstable/WebAuthentication.webidl new file mode 100644 index 00000000000..08371d21c44 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebAuthentication.webidl @@ -0,0 +1,181 @@ +partial interface PublicKeyCredential { + [SameObject] readonly attribute DOMString? authenticatorAttachment; + static Promise isConditionalMediationAvailable(); + [Throws] PublicKeyCredentialJSON toJSON(); +}; + +typedef DOMString Base64URLString; +typedef (RegistrationResponseJSON or AuthenticationResponseJSON) PublicKeyCredentialJSON; + +dictionary RegistrationResponseJSON { + required Base64URLString id; + required Base64URLString rawId; + required AuthenticatorAttestationResponseJSON response; + DOMString authenticatorAttachment; + required AuthenticationExtensionsClientOutputsJSON clientExtensionResults; + required DOMString type; +}; + +dictionary AuthenticatorAttestationResponseJSON { + required Base64URLString clientDataJSON; + required Base64URLString authenticatorData; + required sequence transports; + // The publicKey field will be missing if pubKeyCredParams was used to + // negotiate a public-key algorithm that the user agent doesn’t + // understand. (See section “Easily accessing credential data” for a + // list of which algorithms user agents must support.) If using such an + // algorithm then the public key must be parsed directly from + // attestationObject or authenticatorData. + Base64URLString publicKey; + required long long publicKeyAlgorithm; + // This value contains copies of some of the fields above. See + // section “Easily accessing credential data”. + required Base64URLString attestationObject; +}; + +dictionary AuthenticationResponseJSON { + required Base64URLString id; + required Base64URLString rawId; + required AuthenticatorAssertionResponseJSON response; + DOMString authenticatorAttachment; + required AuthenticationExtensionsClientOutputsJSON clientExtensionResults; + required DOMString type; +}; + +dictionary AuthenticatorAssertionResponseJSON { + required Base64URLString clientDataJSON; + required Base64URLString authenticatorData; + required Base64URLString signature; + Base64URLString userHandle; + Base64URLString attestationObject; +}; + +dictionary AuthenticationExtensionsClientOutputsJSON { +}; + +partial interface PublicKeyCredential { + static Promise isPasskeyPlatformAuthenticatorAvailable(); +}; + +partial interface PublicKeyCredential { + [Throws] static PublicKeyCredentialCreationOptions parseCreationOptionsFromJSON(PublicKeyCredentialCreationOptionsJSON options); +}; + +dictionary PublicKeyCredentialCreationOptionsJSON { + required PublicKeyCredentialRpEntity rp; + required PublicKeyCredentialUserEntityJSON user; + required Base64URLString challenge; + required sequence pubKeyCredParams; + unsigned long timeout; + sequence excludeCredentials = []; + AuthenticatorSelectionCriteria authenticatorSelection; + sequence hints = []; + DOMString attestation = "none"; + sequence attestationFormats = []; + AuthenticationExtensionsClientInputsJSON extensions; +}; + +dictionary PublicKeyCredentialUserEntityJSON { + required Base64URLString id; + required DOMString name; + required DOMString displayName; +}; + +dictionary PublicKeyCredentialDescriptorJSON { + required Base64URLString id; + required DOMString type; + sequence transports; +}; + +dictionary AuthenticationExtensionsClientInputsJSON { +}; + +partial interface PublicKeyCredential { + [Throws] static PublicKeyCredentialRequestOptions parseRequestOptionsFromJSON(PublicKeyCredentialRequestOptionsJSON options); +}; + +dictionary PublicKeyCredentialRequestOptionsJSON { + required Base64URLString challenge; + unsigned long timeout; + DOMString rpId; + sequence allowCredentials = []; + DOMString userVerification = "preferred"; + sequence hints = []; + DOMString attestation = "none"; + sequence attestationFormats = []; + AuthenticationExtensionsClientInputsJSON extensions; +}; + +partial interface AuthenticatorAssertionResponse { + [SameObject] readonly attribute ArrayBuffer? attestationObject; +}; + +partial dictionary PublicKeyCredentialCreationOptions { + sequence hints = []; + sequence attestationFormats = []; +}; + +partial dictionary PublicKeyCredentialRequestOptions { + sequence hints = []; + DOMString attestation = "none"; + sequence attestationFormats = []; +}; + +/* Deprecated. +partial dictionary CollectedClientData { + TokenBinding tokenBinding; +}; +*/ + +/* TODO: requires partial or extend support. +enum AuthenticatorTransport { + "smart-card", + "hybrid", +}; +*/ + +enum PublicKeyCredentialHints { + "security-key", + "client-device", + "hybrid", +}; + +dictionary AuthenticationExtensionsPRFValues { + required BufferSource first; + BufferSource second; +}; + +dictionary AuthenticationExtensionsPRFInputs { + AuthenticationExtensionsPRFValues eval; + record evalByCredential; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + AuthenticationExtensionsPRFInputs prf; +}; + +dictionary AuthenticationExtensionsPRFOutputs { + boolean enabled; + AuthenticationExtensionsPRFValues results; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + AuthenticationExtensionsPRFOutputs prf; +}; + +dictionary AuthenticationExtensionsDevicePublicKeyInputs { + DOMString attestation = "none"; + sequence attestationFormats = []; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + AuthenticationExtensionsDevicePublicKeyInputs devicePubKey; +}; + +dictionary AuthenticationExtensionsDevicePublicKeyOutputs { + ArrayBuffer signature; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + AuthenticationExtensionsDevicePublicKeyOutputs devicePubKey; +}; diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index bc0d5695430..f20a017d350 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -96,7 +96,7 @@ pub(crate) struct InterfaceData<'src> { /// Whether only partial interfaces were encountered pub(crate) partial: bool, pub(crate) has_interface: bool, - pub(crate) deprecated: Option, + pub(crate) deprecated: Option>, pub(crate) attributes: Vec>, pub(crate) consts: Vec>, pub(crate) operations: BTreeMap, OperationData<'src>>, @@ -415,8 +415,7 @@ impl<'src> FirstPass<'src, ApiStability> for weedle::InterfaceDefinition<'src> { interface_data.partial = false; interface_data.superclass = self.inheritance.map(|s| s.identifier.0); interface_data.definition_attributes = self.attributes.as_ref(); - interface_data.deprecated = - util::get_rust_deprecated(&self.attributes).map(|s| s.to_string()); + interface_data.deprecated = util::get_rust_deprecated(&self.attributes); interface_data.has_interface = !util::is_no_interface_object(&self.attributes); interface_data.stability = stability; if let Some(attrs) = &self.attributes { diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index 33ffd094f65..6ce9b2e2a82 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -517,7 +517,7 @@ impl InterfaceMethod { pub struct Interface { pub name: Ident, pub js_name: String, - pub deprecated: Option, + pub deprecated: Option>, pub has_interface: bool, pub parents: Vec, pub consts: Vec, @@ -548,9 +548,10 @@ impl Interface { &get_features_doc(options, name.to_string()), ); - let deprecated = deprecated - .as_ref() - .map(|msg| quote!( #[deprecated(note = #msg)] )); + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let is_type_of = if *has_interface { None @@ -637,6 +638,7 @@ pub struct DictionaryField { pub is_js_value_ref_option_type: bool, pub required: bool, pub unstable: bool, + pub deprecated: Option>, } impl DictionaryField { @@ -667,6 +669,11 @@ impl DictionaryField { let unstable_attr = maybe_unstable_attr(self.unstable); let unstable_docs = maybe_unstable_docs(self.unstable); + let deprecated = self.deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); + let getter_doc_comment = comment( format!("Get the `{}` field of this object.", js_name), &required_doc_string(options, features), @@ -682,6 +689,7 @@ impl DictionaryField { #cfg_features #getter_doc_comment #unstable_docs + #deprecated #[wasm_bindgen(method, getter = #js_name)] pub fn #getter_name(this: &#parent_ident) -> #return_ty; @@ -689,6 +697,7 @@ impl DictionaryField { #cfg_features #setter_doc_comment #unstable_docs + #deprecated #[wasm_bindgen(method, setter = #js_name)] pub fn #setter_name(this: &#parent_ident, val: #ty); } @@ -703,6 +712,7 @@ impl DictionaryField { is_js_value_ref_option_type: _, required: _, unstable, + deprecated: _, } = self; let name = rust_ident(name); diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 2f921d46082..4ea97047ad7 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -25,8 +25,8 @@ use crate::generator::{ use crate::idl_type::ToIdlType; use crate::traverse::TraverseType; use crate::util::{ - camel_case_ident, getter_throws, is_structural, is_type_unstable, optional_return_ty, read_dir, - setter_throws, shouty_snake_case_ident, snake_case_ident, throws, + camel_case_ident, get_rust_deprecated, getter_throws, is_structural, is_type_unstable, + optional_return_ty, read_dir, setter_throws, shouty_snake_case_ident, snake_case_ident, throws, webidl_const_v_to_backend_const_v, TypePosition, }; use anyhow::Context; @@ -447,6 +447,7 @@ impl<'src> FirstPassRecord<'src> { return_ty, is_js_value_ref_option_type, unstable: unstable_override, + deprecated: get_rust_deprecated(&field.attributes), }) } @@ -800,6 +801,7 @@ impl<'src> FirstPassRecord<'src> { ), is_js_value_ref_option_type: false, unstable: false, + deprecated: get_rust_deprecated(&item.definition.attributes), }) } _ => { diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 3f1c6ccc638..1865c007f54 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -8,7 +8,10 @@ use heck::{CamelCase, ShoutySnakeCase, SnakeCase}; use proc_macro2::{Ident, TokenStream}; use quote::quote; use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; -use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList, IdentifierOrString}; +use weedle::attribute::{ + ExtendedAttribute, ExtendedAttributeIdent, ExtendedAttributeList, ExtendedAttributeNoArgs, + IdentifierOrString, +}; use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{MayBeNull, NonAnyType, SingleType}; @@ -607,22 +610,27 @@ pub fn is_no_interface_object(ext_attrs: &Option) -> bool has_named_attribute(ext_attrs.as_ref(), "NoInterfaceObject") } -pub fn get_rust_deprecated<'a>(ext_attrs: &Option>) -> Option<&'a str> { +pub fn get_rust_deprecated(ext_attrs: &Option) -> Option> { ext_attrs .as_ref()? .body .list .iter() .filter_map(|attr| match attr { - ExtendedAttribute::Ident(id) => Some(id), + ExtendedAttribute::NoArgs(ExtendedAttributeNoArgs(id)) => Some((id, None)), + ExtendedAttribute::Ident(ExtendedAttributeIdent { + lhs_identifier: id, + rhs, + .. + }) => Some((id, Some(rhs))), _ => None, }) - .filter(|attr| attr.lhs_identifier.0 == "RustDeprecated") - .find_map(|ident| match ident.rhs { - IdentifierOrString::String(s) => Some(s), - IdentifierOrString::Identifier(_) => None, + .filter(|(id, _)| id.0 == "RustDeprecated") + .find_map(|(_, rhs)| match rhs { + None => Some(None), + Some(IdentifierOrString::String(s)) => Some(Some(s.0.to_owned())), + _ => unimplemented!(), }) - .map(|s| s.0) } /// Whether a webidl object is marked as structural. From 240fbd247342036da8432dc62df48db24a46ff1d Mon Sep 17 00:00:00 2001 From: Raoul Hidalgo Charman Date: Sun, 28 Jul 2024 20:35:47 +0100 Subject: [PATCH 425/641] Add webidl iterable support (#3962) --- .github/workflows/main.yml | 4 +- CHANGELOG.md | 3 + crates/futures/Cargo.toml | 4 + crates/futures/src/lib.rs | 2 + crates/web-sys/Cargo.toml | 3 +- .../web-sys/src/features/gen_DomTokenList.rs | 28 +++ .../features/gen_FileSystemDirectoryHandle.rs | 21 +++ crates/web-sys/src/features/gen_FormData.rs | 28 +++ crates/web-sys/src/features/gen_Headers.rs | 28 +++ .../src/features/gen_MediaKeyStatusMap.rs | 29 +++ crates/web-sys/src/features/gen_NodeList.rs | 28 +++ .../src/features/gen_ReadableStream.rs | 21 +++ .../src/features/gen_UrlSearchParams.rs | 28 +++ crates/web-sys/src/features/gen_XrHand.rs | 44 +++++ .../src/features/gen_XrInputSourceArray.rs | 47 +++++ crates/web-sys/tests/wasm/headers.js | 4 + crates/web-sys/tests/wasm/headers.rs | 39 ++++ crates/web-sys/tests/wasm/main.rs | 1 + crates/web-sys/tests/wasm/opfs.rs | 156 ++++++++++++++++ crates/webidl/src/constants.rs | 1 + crates/webidl/src/first_pass.rs | 176 ++++++++++++++++-- crates/webidl/src/idl_type.rs | 5 + 22 files changed, 686 insertions(+), 14 deletions(-) create mode 100644 crates/web-sys/tests/wasm/opfs.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c30297270de..58c5cd842f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -427,7 +427,9 @@ jobs: - run: cargo doc --no-deps --manifest-path crates/web-sys/Cargo.toml --all-features env: RUSTDOCFLAGS: --cfg=web_sys_unstable_apis - - run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml + - run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml --all-features + env: + RUSTDOCFLAGS: --cfg=docsrs - run: tar czvf docs.tar.gz target/doc - uses: actions/upload-artifact@v4 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2873a756ccc..ed138fcfa97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,9 @@ * Generate getters for all WebIDL dictionary types. [#3993](https://github.com/rustwasm/wasm-bindgen/pull/3993) +* Support for iterable in WebIDL. Gives `entries`, `keys`, `values` methods for regular and asynchronous, as well as `for_each` for regular, iterables. + [#3962](https://github.com/rustwasm/wasm-bindgen/pull/3962) + ### Changed * Stabilize Web Share API. diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index eb389cdba8c..90efc86e72e 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -11,6 +11,10 @@ version = "0.4.42" edition = "2018" rust-version = "1.57" +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [dependencies] cfg-if = "1.0.0" js-sys = { path = "../js-sys", version = '0.3.69' } diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index a44ec7c6d27..ba54d7864a1 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -32,6 +32,7 @@ #![cfg_attr(target_feature = "atomics", feature(stdarch_wasm_atomic_wait))] #![deny(missing_docs)] +#![cfg_attr(docsrs, feature(doc_cfg))] use js_sys::Promise; use std::cell::RefCell; @@ -43,6 +44,7 @@ use std::task::{Context, Poll, Waker}; use wasm_bindgen::prelude::*; mod queue; +#[cfg_attr(docsrs, doc(cfg(feature = "futures-core-03-stream")))] #[cfg(feature = "futures-core-03-stream")] pub mod stream; diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index e6c64ccc29d..284f88de6a4 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -27,7 +27,8 @@ js-sys = { path = '../js-sys', version = '0.3.69' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = { path = '../test', version = '0.3.42' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.42', features = [ "futures-core-03-stream" ] } +futures = "0.3" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } diff --git a/crates/web-sys/src/features/gen_DomTokenList.rs b/crates/web-sys/src/features/gen_DomTokenList.rs index d88b957cd66..742a389ddc5 100644 --- a/crates/web-sys/src/features/gen_DomTokenList.rs +++ b/crates/web-sys/src/features/gen_DomTokenList.rs @@ -138,6 +138,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] pub fn contains(this: &DomTokenList, token: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "DOMTokenList" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] + pub fn entries(this: &DomTokenList) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "DOMTokenList" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] + pub fn for_each(this: &DomTokenList, callback: &::js_sys::Function) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "DOMTokenList" , js_name = item)] #[doc = "The `item()` method."] #[doc = ""] @@ -145,6 +159,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] pub fn item(this: &DomTokenList, index: u32) -> Option; + # [wasm_bindgen (method , structural , js_class = "DOMTokenList" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] + pub fn keys(this: &DomTokenList) -> ::js_sys::Iterator; # [wasm_bindgen (catch , method , structural , variadic , js_class = "DOMTokenList" , js_name = remove)] #[doc = "The `remove()` method."] #[doc = ""] @@ -275,6 +296,13 @@ extern "C" { token: &str, force: bool, ) -> Result; + # [wasm_bindgen (method , structural , js_class = "DOMTokenList" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] + pub fn values(this: &DomTokenList) -> ::js_sys::Iterator; #[wasm_bindgen(method, structural, js_class = "DOMTokenList", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs b/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs index cfac88f43e0..c7ce4bed22c 100644 --- a/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs +++ b/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs @@ -12,6 +12,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] pub type FileSystemDirectoryHandle; + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + pub fn entries(this: &FileSystemDirectoryHandle) -> ::js_sys::AsyncIterator; # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getDirectoryHandle)] #[doc = "The `getDirectoryHandle()` method."] #[doc = ""] @@ -50,6 +57,13 @@ extern "C" { name: &str, options: &FileSystemGetFileOptions, ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + pub fn keys(this: &FileSystemDirectoryHandle) -> ::js_sys::AsyncIterator; # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = removeEntry)] #[doc = "The `removeEntry()` method."] #[doc = ""] @@ -79,4 +93,11 @@ extern "C" { this: &FileSystemDirectoryHandle, possible_descendant: &FileSystemHandle, ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + pub fn values(this: &FileSystemDirectoryHandle) -> ::js_sys::AsyncIterator; } diff --git a/crates/web-sys/src/features/gen_FormData.rs b/crates/web-sys/src/features/gen_FormData.rs index a75c95b008d..959d014ed3b 100644 --- a/crates/web-sys/src/features/gen_FormData.rs +++ b/crates/web-sys/src/features/gen_FormData.rs @@ -62,6 +62,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FormData`*"] pub fn delete(this: &FormData, name: &str); + # [wasm_bindgen (method , structural , js_class = "FormData" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FormData/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FormData`*"] + pub fn entries(this: &FormData) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "FormData" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FormData/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FormData`*"] + pub fn for_each(this: &FormData, callback: &::js_sys::Function) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "FormData" , js_name = get)] #[doc = "The `get()` method."] #[doc = ""] @@ -83,6 +97,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FormData`*"] pub fn has(this: &FormData, name: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "FormData" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FormData/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FormData`*"] + pub fn keys(this: &FormData) -> ::js_sys::Iterator; #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "FormData" , js_name = set)] #[doc = "The `set()` method."] @@ -111,4 +132,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FormData`*"] pub fn set_with_str(this: &FormData, name: &str, value: &str) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "FormData" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FormData/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FormData`*"] + pub fn values(this: &FormData) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_Headers.rs b/crates/web-sys/src/features/gen_Headers.rs index 143f68a63da..c7f7deeee98 100644 --- a/crates/web-sys/src/features/gen_Headers.rs +++ b/crates/web-sys/src/features/gen_Headers.rs @@ -49,6 +49,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Headers`*"] pub fn delete(this: &Headers, name: &str) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "Headers" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Headers`*"] + pub fn entries(this: &Headers) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "Headers" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Headers`*"] + pub fn for_each(this: &Headers, callback: &::js_sys::Function) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Headers" , js_name = get)] #[doc = "The `get()` method."] #[doc = ""] @@ -63,6 +77,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Headers`*"] pub fn has(this: &Headers, name: &str) -> Result; + # [wasm_bindgen (method , structural , js_class = "Headers" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Headers`*"] + pub fn keys(this: &Headers) -> ::js_sys::Iterator; # [wasm_bindgen (catch , method , structural , js_class = "Headers" , js_name = set)] #[doc = "The `set()` method."] #[doc = ""] @@ -70,4 +91,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Headers`*"] pub fn set(this: &Headers, name: &str, value: &str) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "Headers" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Headers`*"] + pub fn values(this: &Headers) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs b/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs index ea2a4aef676..f753b5a98e2 100644 --- a/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs +++ b/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs @@ -19,6 +19,21 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] pub fn size(this: &MediaKeyStatusMap) -> u32; + # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn entries(this: &MediaKeyStatusMap) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "MediaKeyStatusMap" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn for_each(this: &MediaKeyStatusMap, callback: &::js_sys::Function) + -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "MediaKeyStatusMap" , js_name = get)] #[doc = "The `get()` method."] #[doc = ""] @@ -53,4 +68,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] pub fn has_with_u8_array(this: &MediaKeyStatusMap, key_id: &mut [u8]) -> bool; + # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn keys(this: &MediaKeyStatusMap) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn values(this: &MediaKeyStatusMap) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_NodeList.rs b/crates/web-sys/src/features/gen_NodeList.rs index 3a3a959371d..21edd471cbc 100644 --- a/crates/web-sys/src/features/gen_NodeList.rs +++ b/crates/web-sys/src/features/gen_NodeList.rs @@ -19,6 +19,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NodeList`*"] pub fn length(this: &NodeList) -> u32; + # [wasm_bindgen (method , structural , js_class = "NodeList" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeList`*"] + pub fn entries(this: &NodeList) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "NodeList" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeList`*"] + pub fn for_each(this: &NodeList, callback: &::js_sys::Function) -> Result<(), JsValue>; #[cfg(feature = "Node")] # [wasm_bindgen (method , structural , js_class = "NodeList" , js_name = item)] #[doc = "The `item()` method."] @@ -27,6 +41,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`, `NodeList`*"] pub fn item(this: &NodeList, index: u32) -> Option; + # [wasm_bindgen (method , structural , js_class = "NodeList" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeList`*"] + pub fn keys(this: &NodeList) -> ::js_sys::Iterator; + # [wasm_bindgen (method , structural , js_class = "NodeList" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NodeList`*"] + pub fn values(this: &NodeList) -> ::js_sys::Iterator; #[cfg(feature = "Node")] #[wasm_bindgen(method, structural, js_class = "NodeList", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] diff --git a/crates/web-sys/src/features/gen_ReadableStream.rs b/crates/web-sys/src/features/gen_ReadableStream.rs index 77a44341a63..352be8a833b 100644 --- a/crates/web-sys/src/features/gen_ReadableStream.rs +++ b/crates/web-sys/src/features/gen_ReadableStream.rs @@ -63,6 +63,13 @@ extern "C" { this: &ReadableStream, reason: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"] + pub fn entries(this: &ReadableStream) -> ::js_sys::AsyncIterator; # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = getReader)] #[doc = "The `getReader()` method."] #[doc = ""] @@ -81,6 +88,13 @@ extern "C" { this: &ReadableStream, options: &ReadableStreamGetReaderOptions, ) -> ::js_sys::Object; + # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"] + pub fn keys(this: &ReadableStream) -> ::js_sys::AsyncIterator; #[cfg(feature = "ReadableWritablePair")] # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeThrough)] #[doc = "The `pipeThrough()` method."] @@ -128,4 +142,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"] pub fn tee(this: &ReadableStream) -> ::js_sys::Array; + # [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"] + pub fn values(this: &ReadableStream) -> ::js_sys::AsyncIterator; } diff --git a/crates/web-sys/src/features/gen_UrlSearchParams.rs b/crates/web-sys/src/features/gen_UrlSearchParams.rs index a2cb9204e50..7872f099e3c 100644 --- a/crates/web-sys/src/features/gen_UrlSearchParams.rs +++ b/crates/web-sys/src/features/gen_UrlSearchParams.rs @@ -49,6 +49,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] pub fn delete(this: &UrlSearchParams, name: &str); + # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] + pub fn entries(this: &UrlSearchParams) -> ::js_sys::Iterator; + # [wasm_bindgen (catch , method , structural , js_class = "URLSearchParams" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] + pub fn for_each(this: &UrlSearchParams, callback: &::js_sys::Function) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = get)] #[doc = "The `get()` method."] #[doc = ""] @@ -70,6 +84,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] pub fn has(this: &UrlSearchParams, name: &str) -> bool; + # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] + pub fn keys(this: &UrlSearchParams) -> ::js_sys::Iterator; # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = set)] #[doc = "The `set()` method."] #[doc = ""] @@ -84,4 +105,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] pub fn sort(this: &UrlSearchParams) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] + pub fn values(this: &UrlSearchParams) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_XrHand.rs b/crates/web-sys/src/features/gen_XrHand.rs index ad496a99f12..0812d5a3e9c 100644 --- a/crates/web-sys/src/features/gen_XrHand.rs +++ b/crates/web-sys/src/features/gen_XrHand.rs @@ -28,6 +28,28 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn size(this: &XrHand) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRHand" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entries(this: &XrHand) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "XRHand" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn for_each(this: &XrHand, callback: &::js_sys::Function) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "XrHandJoint", feature = "XrJointSpace",))] # [wasm_bindgen (method , structural , js_class = "XRHand" , js_name = get)] #[doc = "The `get()` method."] @@ -39,4 +61,26 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get(this: &XrHand, key: XrHandJoint) -> XrJointSpace; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRHand" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keys(this: &XrHand) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRHand" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRHand/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrHand`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn values(this: &XrHand) -> ::js_sys::Iterator; } diff --git a/crates/web-sys/src/features/gen_XrInputSourceArray.rs b/crates/web-sys/src/features/gen_XrInputSourceArray.rs index 8489fb12a02..131e956e569 100644 --- a/crates/web-sys/src/features/gen_XrInputSourceArray.rs +++ b/crates/web-sys/src/features/gen_XrInputSourceArray.rs @@ -28,6 +28,53 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn length(this: &XrInputSourceArray) -> u32; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRInputSourceArray" , js_name = entries)] + #[doc = "The `entries()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceArray/entries)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceArray`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn entries(this: &XrInputSourceArray) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "XRInputSourceArray" , js_name = forEach)] + #[doc = "The `forEach()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceArray/forEach)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceArray`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn for_each( + this: &XrInputSourceArray, + callback: &::js_sys::Function, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRInputSourceArray" , js_name = keys)] + #[doc = "The `keys()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceArray/keys)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceArray`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keys(this: &XrInputSourceArray) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "XRInputSourceArray" , js_name = values)] + #[doc = "The `values()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSourceArray/values)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrInputSourceArray`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn values(this: &XrInputSourceArray) -> ::js_sys::Iterator; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrInputSource")] #[wasm_bindgen(method, structural, js_class = "XRInputSourceArray", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] diff --git a/crates/web-sys/tests/wasm/headers.js b/crates/web-sys/tests/wasm/headers.js index 3b71cdc66ab..267c0744c00 100644 --- a/crates/web-sys/tests/wasm/headers.js +++ b/crates/web-sys/tests/wasm/headers.js @@ -1,3 +1,7 @@ export function new_headers() { return new Headers({'Content-Type': 'text/plain'}); } + +export function new_headers_2() { + return new Headers({'Content-Type': 'text/plain', 'Cookie': 'foobarbaz'}); +} diff --git a/crates/web-sys/tests/wasm/headers.rs b/crates/web-sys/tests/wasm/headers.rs index 08751444b60..f7cb4f7d7e8 100644 --- a/crates/web-sys/tests/wasm/headers.rs +++ b/crates/web-sys/tests/wasm/headers.rs @@ -1,3 +1,4 @@ +use js_sys::{Array, Function, JsString}; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; use web_sys::Headers; @@ -5,6 +6,7 @@ use web_sys::Headers; #[wasm_bindgen(module = "/tests/wasm/headers.js")] extern "C" { fn new_headers() -> Headers; + fn new_headers_2() -> Headers; } #[wasm_bindgen_test] @@ -29,3 +31,40 @@ fn headers() { assert!(headers.append("a", "z").is_ok()); assert_eq!(headers.get("a").unwrap(), Some("y, z".to_string())); } + +#[wasm_bindgen_test] +fn headers_iter() { + let headers = new_headers_2() + .entries() + .into_iter() + .map(|x| { + let array = x.unwrap().dyn_into::().unwrap(); + assert_eq!(array.length(), 2); + let k: String = array.at(0).as_string().unwrap(); + let v: String = array.at(1).as_string().unwrap(); + (k, v) + }) + .collect::>(); + + assert_eq!(headers.len(), 2); + assert_eq!(&headers[0].0, "content-type"); + assert_eq!(&headers[0].1, "text/plain"); + assert_eq!(&headers[1].0, "cookie"); + assert_eq!(&headers[1].1, "foobarbaz"); +} + +#[wasm_bindgen_test] +fn headers_for_each() { + let mut count = 0; + let cb = Closure::wrap(Box::new(move |jval: JsValue| { + let val: String = jval.as_string().unwrap(); + if count == 0 { + assert_eq!(val, "text/plain"); + } else { + assert_eq!(val, "foobarbaz"); + } + count += 1; + }) as Box); + let res = new_headers_2().for_each(&cb.as_ref().unchecked_ref()); + assert!(res.is_ok()); +} diff --git a/crates/web-sys/tests/wasm/main.rs b/crates/web-sys/tests/wasm/main.rs index a587b9f6921..737d1029a3e 100644 --- a/crates/web-sys/tests/wasm/main.rs +++ b/crates/web-sys/tests/wasm/main.rs @@ -30,6 +30,7 @@ pub mod meta_element; pub mod meter_element; pub mod mod_elements; pub mod olist_element; +pub mod opfs; pub mod optgroup_element; pub mod option_element; pub mod options_collection; diff --git a/crates/web-sys/tests/wasm/opfs.rs b/crates/web-sys/tests/wasm/opfs.rs new file mode 100644 index 00000000000..98bd9fc92c6 --- /dev/null +++ b/crates/web-sys/tests/wasm/opfs.rs @@ -0,0 +1,156 @@ +use std::collections::BTreeMap; + +use futures::stream::StreamExt; +use js_sys::{Array, JsString}; +use wasm_bindgen::prelude::*; +use wasm_bindgen_futures::{stream::JsStream, JsFuture}; +use wasm_bindgen_test::*; +use web_sys::{ + window, File, FileSystemDirectoryHandle, FileSystemFileHandle, FileSystemGetDirectoryOptions, + FileSystemGetFileOptions, FileSystemWritableFileStream, +}; + +// aux functions + +async fn get_storage() -> FileSystemDirectoryHandle { + let storage_promise = window().unwrap().navigator().storage().get_directory(); + JsFuture::from(storage_promise) + .await + .unwrap() + .dyn_into::() + .unwrap() +} + +async fn create_directory( + dir: &FileSystemDirectoryHandle, + path: &str, +) -> FileSystemDirectoryHandle { + let mut opts = FileSystemGetDirectoryOptions::new(); + opts.create(true); + JsFuture::from(dir.get_directory_handle_with_options(&path, &opts)) + .await + .expect("Couldn't create test directory") + .dyn_into::() + .unwrap() +} + +async fn create_test_directory(path: &str) -> FileSystemDirectoryHandle { + let storage = get_storage().await; + create_directory(&storage, path).await +} + +async fn create_file(dir: &FileSystemDirectoryHandle, path: &str) { + let mut opts = FileSystemGetFileOptions::new(); + opts.create(true); + let _ = JsFuture::from(dir.get_file_handle_with_options(path, &opts)).await; +} + +// Tests + +// Check we can access the root opfs directory +#[wasm_bindgen_test] +async fn access_storage() { + let storage_promise = window().unwrap().navigator().storage().get_directory(); + let storage = JsFuture::from(storage_promise).await; + assert!(storage.is_ok()); +} + +// Creating a directory in the root dir and test it's there +#[wasm_bindgen_test] +async fn test_create_directory() { + let _test_dir = create_test_directory("create_directory").await; + let storage = get_storage().await; + let dir = JsFuture::from(storage.get_directory_handle("create_directory")).await; + assert!(dir.is_ok()); +} + +#[wasm_bindgen_test] +async fn test_create_file() { + let test_dir = create_test_directory("create_file").await; + create_file(&test_dir, "test.txt").await; + let stream = JsStream::from(test_dir.keys()); + let mut res = stream.collect::>>().await; + assert_eq!(res.len(), 1, "Expected number of files"); + let path = res.pop().unwrap().unwrap().dyn_into::().unwrap(); + assert_eq!(path, "test.txt", "Searched for file"); +} + +#[wasm_bindgen_test] +async fn test_write_to_file() { + let test_dir = create_test_directory("write_to_file").await; + + // create file + let mut opts = FileSystemGetFileOptions::new(); + opts.create(true); + let file = JsFuture::from(test_dir.get_file_handle_with_options(&"test.txt", &opts)) + .await + .expect("Couldn't create file") + .dyn_into::() + .unwrap(); + + // Write to file + let test_txt = "testing testing"; + let write_stream = JsFuture::from(file.create_writable()) + .await + .unwrap() + .dyn_into::() + .unwrap(); + JsFuture::from(write_stream.write_with_str(test_txt).unwrap()).await; + JsFuture::from(write_stream.close()).await.unwrap(); + + // Read and check contents + let mut values = JsStream::from(test_dir.values()) + .map(|x| x.unwrap().dyn_into::().unwrap()) + .collect::>() + .await; + assert_eq!(values.len(), 1); + + let file = JsFuture::from(values[0].get_file()) + .await + .unwrap() + .dyn_into::() + .unwrap(); + + let text = JsFuture::from(file.text()) + .await + .unwrap() + .dyn_into::() + .unwrap(); + assert_eq!(&text, test_txt); +} + +// Create a couple of entries in a directory and check entries returns them all +#[wasm_bindgen_test] +async fn test_entries() { + let test_dir = create_test_directory("entries").await; + create_directory(&test_dir, "dir").await; + create_file(&test_dir, "file").await; + create_file(&test_dir, "file2").await; + + let entries = JsStream::from(test_dir.entries()) + .map(|x| { + let array: Vec = x.unwrap().dyn_into::().unwrap().to_vec(); + assert_eq!(array.len(), 2); + let path: String = array[0].clone().dyn_into::().unwrap().into(); + (path, array[1].clone()) + }) + .collect::>() + .await; + + assert_eq!(entries.len(), 3); + + match entries.get("dir") { + Some(handle) => assert!(FileSystemDirectoryHandle::instanceof(&handle)), + _ => panic!("Didn't find directory"), + } + + match entries.get("file") { + Some(handle) => assert!(FileSystemFileHandle::instanceof(&handle)), + _ => panic!("Couldn't find file"), + } + + match entries.get("file2") { + Some(handle) => assert!(FileSystemFileHandle::instanceof(&handle)), + _ => panic!("Couldn't find file2"), + } +} diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index de9129f96a0..33144506e02 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -33,6 +33,7 @@ pub(crate) static BUILTIN_IDENTS: Lazy> = Lazy::new(|| { "Clamped", "DataView", "Iterator", + "AsyncIterator", ]) }); diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index f20a017d350..ef111f574bc 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -71,6 +71,7 @@ pub(crate) struct FirstPassRecord<'src> { pub(crate) dictionaries: BTreeMap<&'src str, DictionaryData<'src>>, pub(crate) callbacks: BTreeSet<&'src str>, pub(crate) iterators: BTreeSet<&'src str>, + pub(crate) async_iterators: BTreeSet<&'src str>, pub(crate) callback_interfaces: BTreeMap<&'src str, CallbackInterfaceData<'src>>, } @@ -545,11 +546,8 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int InterfaceMember::Constructor(constr) => constr.first_pass(record, ctx), InterfaceMember::Maplike(ml) => ml.first_pass(record, ctx), InterfaceMember::Setlike(sl) => sl.first_pass(record, ctx), - // TODO - InterfaceMember::Iterable(_iterable) => { - log::warn!("Unsupported WebIDL iterable interface member: {:?}", self); - Ok(()) - } + InterfaceMember::Iterable(iterable) => iterable.first_pass(record, ctx), + InterfaceMember::AsyncIterable(iterable) => iterable.first_pass(record, ctx), InterfaceMember::Stringifier(_) => { log::warn!( "Unsupported WebIDL Stringifier interface member: {:?}", @@ -557,13 +555,6 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int ); Ok(()) } - InterfaceMember::AsyncIterable(_iterable) => { - log::warn!( - "Unsupported WebIDL async iterable interface member: {:?}", - self - ); - Ok(()) - } } } } @@ -1076,6 +1067,167 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> Ok(()) } } +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::IterableInterfaceMember<'src> +{ + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + ctx: (&'src str, ApiStability), + ) -> Result<()> { + record.iterators.insert("Iterator"); + + // [NewObject] Iterator entries(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("entries"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("Iterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + // [NewObject] Iterator keys(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("keys"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("Iterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + // [NewObject] Iterator values(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("values"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("Iterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + let undefined_ret = || ReturnType::Undefined(term!(undefined)); + + // callback SetlikeForEachCallback = undefined (V value); + // TODO: the signature of the callback is erased, could we keep it? + let foreach_callback_arg = Arg { + name: "callback", + ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { + type_: Identifier("IterableForEachCallback"), + q_mark: None, + }))), + optional: false, + variadic: false, + }; + + record.callbacks.insert("IterableForEachCallback"); + + // [Throws] undefined forEach(SetlikeForEachCallback cb); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("forEach"))], + [foreach_callback_arg], + &undefined_ret(), + &THROWS_ATTR, + false, + ctx.1, + ); + Ok(()) + } +} + +impl<'src> FirstPass<'src, (&'src str, ApiStability)> + for weedle::interface::AsyncIterableInterfaceMember<'src> +{ + fn first_pass( + &'src self, + record: &mut FirstPassRecord<'src>, + ctx: (&'src str, ApiStability), + ) -> Result<()> { + record.async_iterators.insert("AsyncIterator"); + + // [NewObject] MapLikeIterator entries(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("entries"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("AsyncIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + // [NewObject] MapLikeIterator keys(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("keys"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("AsyncIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + // [NewObject] MapLikeIterator values(); + first_pass_operation( + record, + FirstPassOperationType::Interface, + ctx.0, + &[OperationId::Operation(Some("values"))], + &[], + &ReturnType::Type(Type::Single(SingleType::NonAny(NonAnyType::Identifier( + MayBeNull { + type_: Identifier("AsyncIterator"), + q_mark: None, + }, + )))), + &NEW_OBJECT_ATTR, + false, + ctx.1, + ); + + Ok(()) + } +} impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::AttributeInterfaceMember<'src> diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 1843210da5a..27839d8d866 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -31,6 +31,7 @@ pub(crate) enum IdlType<'a> { Error, Callback, Iterator, + AsyncIterator, ArrayBuffer, DataView, @@ -335,6 +336,8 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { IdlType::Callback } else if record.iterators.contains(self.0) { IdlType::Iterator + } else if record.async_iterators.contains(self.0) { + IdlType::AsyncIterator } else if let Some(data) = record.callback_interfaces.get(self.0) { IdlType::CallbackInterface { name: self.0, @@ -438,6 +441,7 @@ impl<'a> IdlType<'a> { IdlType::Error => dst.push_str("error"), IdlType::Callback => dst.push_str("callback"), IdlType::Iterator => dst.push_str("iterator"), + IdlType::AsyncIterator => dst.push_str("async_iterator"), IdlType::ArrayBuffer => dst.push_str("array_buffer"), IdlType::DataView => dst.push_str("data_view"), @@ -650,6 +654,7 @@ impl<'a> IdlType<'a> { IdlType::Undefined => Ok(None), IdlType::Callback => Ok(js_sys("Function")), IdlType::Iterator => Ok(js_sys("Iterator")), + IdlType::AsyncIterator => Ok(js_sys("AsyncIterator")), IdlType::UnknownInterface(_) => Err(TypeError::CannotConvert), } } From 69f9fe56ba432f4a525956db4671aca590ae6db0 Mon Sep 17 00:00:00 2001 From: Will Leslie Date: Sun, 28 Jul 2024 12:53:30 -0700 Subject: [PATCH 426/641] Restore HTMLTableCellElement's abbr and scope properties (#3972) --- CHANGELOG.md | 3 ++ .../src/features/gen_HtmlTableCellElement.rs | 28 +++++++++++++++++++ .../enabled/HTMLTableCellElement.webidl | 4 +++ 3 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed138fcfa97..827c76f6deb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ * Support for iterable in WebIDL. Gives `entries`, `keys`, `values` methods for regular and asynchronous, as well as `for_each` for regular, iterables. [#3962](https://github.com/rustwasm/wasm-bindgen/pull/3962) +* Add bindings for `HTMLTableCellElement.abbr` and `scope` properties. + [#3972](https://github.com/rustwasm/wasm-bindgen/pull/3972) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_HtmlTableCellElement.rs b/crates/web-sys/src/features/gen_HtmlTableCellElement.rs index 0398abfdda0..9a4f0556e1d 100644 --- a/crates/web-sys/src/features/gen_HtmlTableCellElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableCellElement.rs @@ -61,6 +61,34 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] pub fn cell_index(this: &HtmlTableCellElement) -> i32; + # [wasm_bindgen (structural , method , getter , js_class = "HTMLTableCellElement" , js_name = abbr)] + #[doc = "Getter for the `abbr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/abbr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] + pub fn abbr(this: &HtmlTableCellElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = abbr)] + #[doc = "Setter for the `abbr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/abbr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] + pub fn set_abbr(this: &HtmlTableCellElement, value: &str); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLTableCellElement" , js_name = scope)] + #[doc = "Getter for the `scope` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/scope)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] + pub fn scope(this: &HtmlTableCellElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = scope)] + #[doc = "Setter for the `scope` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/scope)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] + pub fn set_scope(this: &HtmlTableCellElement, value: &str); # [wasm_bindgen (structural , method , getter , js_class = "HTMLTableCellElement" , js_name = align)] #[doc = "Getter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/HTMLTableCellElement.webidl b/crates/web-sys/webidls/enabled/HTMLTableCellElement.webidl index ffb04d72a76..6e1209d17aa 100644 --- a/crates/web-sys/webidls/enabled/HTMLTableCellElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLTableCellElement.webidl @@ -21,6 +21,10 @@ interface HTMLTableCellElement : HTMLElement { [CEReactions, SetterThrows] attribute DOMString headers; readonly attribute long cellIndex; + [CEReactions] + attribute DOMString abbr; + [CEReactions] + attribute DOMString scope; }; partial interface HTMLTableCellElement { From ae2d76af40de726e158e212b086a48404a10b9f5 Mon Sep 17 00:00:00 2001 From: CJ Date: Sun, 28 Jul 2024 21:07:12 +0100 Subject: [PATCH 427/641] Add WebIDL definitions relating to `Popover API`. (#3977) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 2 + crates/web-sys/src/features/gen_Document.rs | 14 +++ .../src/features/gen_HtmlButtonElement.rs | 28 +++++ .../web-sys/src/features/gen_HtmlElement.rs | 56 ++++++++++ .../src/features/gen_HtmlInputElement.rs | 28 +++++ crates/web-sys/src/features/gen_SvgElement.rs | 14 +++ .../web-sys/src/features/gen_ToggleEvent.rs | 47 ++++++++ .../src/features/gen_ToggleEventInit.rs | 103 ++++++++++++++++++ crates/web-sys/src/features/gen_Window.rs | 14 +++ crates/web-sys/src/features/mod.rs | 14 +++ .../webidls/enabled/EventHandler.webidl | 2 + .../webidls/enabled/HTMLButtonElement.webidl | 2 + .../webidls/enabled/HTMLElement.webidl | 9 ++ .../webidls/enabled/HTMLInputElement.webidl | 2 + .../enabled/PopoverInvokerElement.webidl | 13 +++ .../webidls/enabled/ToggleEvent.webidl | 20 ++++ 17 files changed, 371 insertions(+) create mode 100644 crates/web-sys/src/features/gen_ToggleEvent.rs create mode 100644 crates/web-sys/src/features/gen_ToggleEventInit.rs create mode 100644 crates/web-sys/webidls/enabled/PopoverInvokerElement.webidl create mode 100644 crates/web-sys/webidls/enabled/ToggleEvent.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 827c76f6deb..8c7b7e449ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,9 @@ * Add bindings for `HTMLTableCellElement.abbr` and `scope` properties. [#3972](https://github.com/rustwasm/wasm-bindgen/pull/3972) +* Add WebIDL definitions relating to `Popover API`. + [#3977](https://github.com/rustwasm/wasm-bindgen/pull/3977) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 284f88de6a4..0836308ca09 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1418,6 +1418,8 @@ TextTrackList = ["EventTarget"] TextTrackMode = [] TimeEvent = ["Event"] TimeRanges = [] +ToggleEvent = ["Event"] +ToggleEventInit = [] TokenBinding = [] TokenBindingStatus = [] Touch = [] diff --git a/crates/web-sys/src/features/gen_Document.rs b/crates/web-sys/src/features/gen_Document.rs index b910b43c3e8..1ca915c769e 100644 --- a/crates/web-sys/src/features/gen_Document.rs +++ b/crates/web-sys/src/features/gen_Document.rs @@ -599,6 +599,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] pub fn set_onauxclick(this: &Document, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = onbeforetoggle)] + #[doc = "Getter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn onbeforetoggle(this: &Document) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "Document" , js_name = onbeforetoggle)] + #[doc = "Setter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Document`*"] + pub fn set_onbeforetoggle(this: &Document, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = oncanplay)] #[doc = "Getter for the `oncanplay` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlButtonElement.rs b/crates/web-sys/src/features/gen_HtmlButtonElement.rs index 08d5fb91dee..70127fbb0c7 100644 --- a/crates/web-sys/src/features/gen_HtmlButtonElement.rs +++ b/crates/web-sys/src/features/gen_HtmlButtonElement.rs @@ -190,6 +190,34 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`, `NodeList`*"] pub fn labels(this: &HtmlButtonElement) -> NodeList; + # [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = popoverTargetElement)] + #[doc = "Getter for the `popoverTargetElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + pub fn popover_target_element(this: &HtmlButtonElement) -> Option; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = popoverTargetElement)] + #[doc = "Setter for the `popoverTargetElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + pub fn set_popover_target_element(this: &HtmlButtonElement, value: Option<&Element>); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = popoverTargetAction)] + #[doc = "Getter for the `popoverTargetAction` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetAction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + pub fn popover_target_action(this: &HtmlButtonElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = popoverTargetAction)] + #[doc = "Setter for the `popoverTargetAction` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetAction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + pub fn set_popover_target_action(this: &HtmlButtonElement, value: &str); # [wasm_bindgen (method , structural , js_class = "HTMLButtonElement" , js_name = checkValidity)] #[doc = "The `checkValidity()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlElement.rs b/crates/web-sys/src/features/gen_HtmlElement.rs index 24149ad9587..0de35b5e951 100644 --- a/crates/web-sys/src/features/gen_HtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlElement.rs @@ -202,6 +202,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn is_content_editable(this: &HtmlElement) -> bool; + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = popover)] + #[doc = "Getter for the `popover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn popover(this: &HtmlElement) -> Option; + # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLElement" , js_name = popover)] + #[doc = "Setter for the `popover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_popover(this: &HtmlElement, value: Option<&str>) -> Result<(), JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = spellcheck)] #[doc = "Getter for the `spellcheck` field of this object."] #[doc = ""] @@ -357,6 +371,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_onauxclick(this: &HtmlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = onbeforetoggle)] + #[doc = "Getter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn onbeforetoggle(this: &HtmlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = onbeforetoggle)] + #[doc = "Setter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_onbeforetoggle(this: &HtmlElement, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = oncanplay)] #[doc = "Getter for the `oncanplay` field of this object."] #[doc = ""] @@ -1548,4 +1576,32 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FocusOptions`, `HtmlElement`*"] pub fn focus_with_options(this: &HtmlElement, options: &FocusOptions) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = hidePopover)] + #[doc = "The `hidePopover()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidePopover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn hide_popover(this: &HtmlElement) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = showPopover)] + #[doc = "The `showPopover()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/showPopover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn show_popover(this: &HtmlElement) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = togglePopover)] + #[doc = "The `togglePopover()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/togglePopover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn toggle_popover(this: &HtmlElement) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = togglePopover)] + #[doc = "The `togglePopover()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/togglePopover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn toggle_popover_with_force(this: &HtmlElement, force: bool) -> Result; } diff --git a/crates/web-sys/src/features/gen_HtmlInputElement.rs b/crates/web-sys/src/features/gen_HtmlInputElement.rs index bb780650a59..e91e812b561 100644 --- a/crates/web-sys/src/features/gen_HtmlInputElement.rs +++ b/crates/web-sys/src/features/gen_HtmlInputElement.rs @@ -629,6 +629,34 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] pub fn set_webkitdirectory(this: &HtmlInputElement, value: bool); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = popoverTargetElement)] + #[doc = "Getter for the `popoverTargetElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + pub fn popover_target_element(this: &HtmlInputElement) -> Option; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = popoverTargetElement)] + #[doc = "Setter for the `popoverTargetElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + pub fn set_popover_target_element(this: &HtmlInputElement, value: Option<&Element>); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = popoverTargetAction)] + #[doc = "Getter for the `popoverTargetAction` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + pub fn popover_target_action(this: &HtmlInputElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = popoverTargetAction)] + #[doc = "Setter for the `popoverTargetAction` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + pub fn set_popover_target_action(this: &HtmlInputElement, value: &str); # [wasm_bindgen (method , structural , js_class = "HTMLInputElement" , js_name = checkValidity)] #[doc = "The `checkValidity()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgElement.rs b/crates/web-sys/src/features/gen_SvgElement.rs index d911161e2a4..03c837ed1d2 100644 --- a/crates/web-sys/src/features/gen_SvgElement.rs +++ b/crates/web-sys/src/features/gen_SvgElement.rs @@ -177,6 +177,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] pub fn set_onauxclick(this: &SvgElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = onbeforetoggle)] + #[doc = "Getter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn onbeforetoggle(this: &SvgElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = onbeforetoggle)] + #[doc = "Setter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn set_onbeforetoggle(this: &SvgElement, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = oncanplay)] #[doc = "Getter for the `oncanplay` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ToggleEvent.rs b/crates/web-sys/src/features/gen_ToggleEvent.rs new file mode 100644 index 00000000000..4bd2f383fda --- /dev/null +++ b/crates/web-sys/src/features/gen_ToggleEvent.rs @@ -0,0 +1,47 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = ToggleEvent , typescript_type = "ToggleEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ToggleEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] + pub type ToggleEvent; + # [wasm_bindgen (structural , method , getter , js_class = "ToggleEvent" , js_name = oldState)] + #[doc = "Getter for the `oldState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/oldState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] + pub fn old_state(this: &ToggleEvent) -> String; + # [wasm_bindgen (structural , method , getter , js_class = "ToggleEvent" , js_name = newState)] + #[doc = "Getter for the `newState` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/newState)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] + pub fn new_state(this: &ToggleEvent) -> String; + #[wasm_bindgen(catch, constructor, js_class = "ToggleEvent")] + #[doc = "The `new ToggleEvent(..)` constructor, creating a new instance of `ToggleEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/ToggleEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] + pub fn new(type_: &str) -> Result; + #[cfg(feature = "ToggleEventInit")] + #[wasm_bindgen(catch, constructor, js_class = "ToggleEvent")] + #[doc = "The `new ToggleEvent(..)` constructor, creating a new instance of `ToggleEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/ToggleEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`, `ToggleEventInit`*"] + pub fn new_with_event_init_dict( + type_: &str, + event_init_dict: &ToggleEventInit, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_ToggleEventInit.rs b/crates/web-sys/src/features/gen_ToggleEventInit.rs new file mode 100644 index 00000000000..cec8e059b99 --- /dev/null +++ b/crates/web-sys/src/features/gen_ToggleEventInit.rs @@ -0,0 +1,103 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ToggleEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ToggleEventInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + pub type ToggleEventInit; + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &ToggleEventInit) -> Option; + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, setter = "bubbles")] + pub fn set_bubbles(this: &ToggleEventInit, val: bool); + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &ToggleEventInit) -> Option; + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, setter = "cancelable")] + pub fn set_cancelable(this: &ToggleEventInit, val: bool); + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &ToggleEventInit) -> Option; + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, setter = "composed")] + pub fn set_composed(this: &ToggleEventInit, val: bool); + #[doc = "Get the `newState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, getter = "newState")] + pub fn get_new_state(this: &ToggleEventInit) -> Option; + #[doc = "Change the `newState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, setter = "newState")] + pub fn set_new_state(this: &ToggleEventInit, val: &str); + #[doc = "Get the `oldState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, getter = "oldState")] + pub fn get_old_state(this: &ToggleEventInit) -> Option; + #[doc = "Change the `oldState` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + #[wasm_bindgen(method, setter = "oldState")] + pub fn set_old_state(this: &ToggleEventInit, val: &str); +} +impl ToggleEventInit { + #[doc = "Construct a new `ToggleEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[deprecated = "Use `set_bubbles()` instead."] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + self.set_bubbles(val); + self + } + #[deprecated = "Use `set_cancelable()` instead."] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + self.set_cancelable(val); + self + } + #[deprecated = "Use `set_composed()` instead."] + pub fn composed(&mut self, val: bool) -> &mut Self { + self.set_composed(val); + self + } + #[deprecated = "Use `set_new_state()` instead."] + pub fn new_state(&mut self, val: &str) -> &mut Self { + self.set_new_state(val); + self + } + #[deprecated = "Use `set_old_state()` instead."] + pub fn old_state(&mut self, val: &str) -> &mut Self { + self.set_old_state(val); + self + } +} +impl Default for ToggleEventInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index f0d74ecb39d..c89c3c6ae75 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -526,6 +526,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn set_onauxclick(this: &Window, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = onbeforetoggle)] + #[doc = "Getter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + pub fn onbeforetoggle(this: &Window) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = onbeforetoggle)] + #[doc = "Setter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + pub fn set_onbeforetoggle(this: &Window, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = oncanplay)] #[doc = "Getter for the `oncanplay` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index a7f682498b3..d2039edb41d 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -9679,6 +9679,20 @@ mod gen_TimeRanges; #[allow(unused_imports)] pub use gen_TimeRanges::*; +#[cfg(feature = "ToggleEvent")] +#[allow(non_snake_case)] +mod gen_ToggleEvent; +#[cfg(feature = "ToggleEvent")] +#[allow(unused_imports)] +pub use gen_ToggleEvent::*; + +#[cfg(feature = "ToggleEventInit")] +#[allow(non_snake_case)] +mod gen_ToggleEventInit; +#[cfg(feature = "ToggleEventInit")] +#[allow(unused_imports)] +pub use gen_ToggleEventInit::*; + #[cfg(feature = "TokenBinding")] #[allow(non_snake_case)] mod gen_TokenBinding; diff --git a/crates/web-sys/webidls/enabled/EventHandler.webidl b/crates/web-sys/webidls/enabled/EventHandler.webidl index 5d28db0a056..90e9ae1f3b6 100644 --- a/crates/web-sys/webidls/enabled/EventHandler.webidl +++ b/crates/web-sys/webidls/enabled/EventHandler.webidl @@ -31,6 +31,8 @@ interface mixin GlobalEventHandlers { attribute EventHandler onfocus; //(Not implemented)attribute EventHandler oncancel; attribute EventHandler onauxclick; + [Pref="dom.element.popover.enabled"] + attribute EventHandler onbeforetoggle; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; diff --git a/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl b/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl index bc4af418c44..2097cd06904 100644 --- a/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl @@ -46,3 +46,5 @@ interface HTMLButtonElement : HTMLElement { readonly attribute NodeList labels; }; + +HTMLButtonElement includes PopoverInvokerElement; diff --git a/crates/web-sys/webidls/enabled/HTMLElement.webidl b/crates/web-sys/webidls/enabled/HTMLElement.webidl index f6516c3ad88..e0b70802e72 100644 --- a/crates/web-sys/webidls/enabled/HTMLElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLElement.webidl @@ -60,6 +60,8 @@ interface HTMLElement : Element { //readonly attribute HTMLMenuElement? contextMenu; //[SetterThrows] // attribute HTMLMenuElement? contextMenu; + [CEReactions, SetterThrows, Pure, Pref="dom.element.popover.enabled"] + attribute DOMString? popover; [CEReactions, SetterThrows, Pure] attribute boolean spellcheck; @@ -71,6 +73,13 @@ interface HTMLElement : Element { //readonly attribute boolean? commandDisabled; //readonly attribute boolean? commandChecked; + [Throws, Pref="dom.element.popover.enabled"] + undefined showPopover(); + [Throws, Pref="dom.element.popover.enabled"] + undefined hidePopover(); + [Throws, Pref="dom.element.popover.enabled"] + boolean togglePopover(optional boolean force); + // styling [PutForwards=cssText, Constant] readonly attribute CSSStyleDeclaration style; diff --git a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl index 32a0e22e812..11c15761d14 100644 --- a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl @@ -148,6 +148,8 @@ partial interface HTMLInputElement { attribute DOMString useMap; }; +HTMLInputElement includes PopoverInvokerElement; + /*Non standard partial interface HTMLInputElement { [Pref="dom.input.dirpicker", SetterThrows] diff --git a/crates/web-sys/webidls/enabled/PopoverInvokerElement.webidl b/crates/web-sys/webidls/enabled/PopoverInvokerElement.webidl new file mode 100644 index 00000000000..b5d98856b71 --- /dev/null +++ b/crates/web-sys/webidls/enabled/PopoverInvokerElement.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/popover.html#popoverinvokerelement + */ + +interface mixin PopoverInvokerElement { + [Pref="dom.element.popover.enabled", CEReactions] attribute Element? popoverTargetElement; + [Pref="dom.element.popover.enabled", CEReactions] attribute DOMString popoverTargetAction; +}; diff --git a/crates/web-sys/webidls/enabled/ToggleEvent.webidl b/crates/web-sys/webidls/enabled/ToggleEvent.webidl new file mode 100644 index 00000000000..bff4c41062f --- /dev/null +++ b/crates/web-sys/webidls/enabled/ToggleEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/popover.html#the-toggleevent-interface + */ + +[Exposed=Window] +interface ToggleEvent : Event { + constructor(DOMString type, optional ToggleEventInit eventInitDict = {}); + readonly attribute DOMString oldState; + readonly attribute DOMString newState; +}; + +dictionary ToggleEventInit : EventInit { + DOMString oldState = ""; + DOMString newState = ""; +}; From 277868af59b24053c633b0eceef8f1b13f847ed4 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 28 Jul 2024 22:42:51 +0200 Subject: [PATCH 428/641] Update `AudioBufferSourceNode` WebIDL (#4020) Co-authored-by: Pablo Sichert --- CHANGELOG.md | 3 ++ .../src/features/gen_AudioBufferSourceNode.rs | 10 +++-- .../enabled/AudioBufferSourceNode.webidl | 38 ++++++++----------- crates/webidl/src/constants.rs | 13 +++++++ crates/webidl/src/generator.rs | 15 ++++++++ crates/webidl/src/lib.rs | 3 ++ crates/webidl/src/util.rs | 3 ++ 7 files changed, 60 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c7b7e449ba..8f132f8b64f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,9 @@ * Update Web Authentication API to level 3. [#4000](https://github.com/rustwasm/wasm-bindgen/pull/4000) +* Deprecate `AudioBufferSourceNode.onended` and `AudioBufferSourceNode.stop()`. + [#4020](https://github.com/rustwasm/wasm-bindgen/pull/4020) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/src/features/gen_AudioBufferSourceNode.rs b/crates/web-sys/src/features/gen_AudioBufferSourceNode.rs index 4ca1070115b..5b3d41f1425 100644 --- a/crates/web-sys/src/features/gen_AudioBufferSourceNode.rs +++ b/crates/web-sys/src/features/gen_AudioBufferSourceNode.rs @@ -92,6 +92,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/onended)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceNode`*"] + #[deprecated] pub fn onended(this: &AudioBufferSourceNode) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "AudioBufferSourceNode" , js_name = onended)] #[doc = "Setter for the `onended` field of this object."] @@ -99,6 +100,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/onended)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceNode`*"] + #[deprecated] pub fn set_onended(this: &AudioBufferSourceNode, value: Option<&::js_sys::Function>); #[cfg(feature = "BaseAudioContext")] #[wasm_bindgen(catch, constructor, js_class = "AudioBufferSourceNode")] @@ -142,7 +144,7 @@ extern "C" { pub fn start_with_when_and_grain_offset( this: &AudioBufferSourceNode, when: f64, - grain_offset: f64, + offset: f64, ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "AudioBufferSourceNode" , js_name = start)] #[doc = "The `start()` method."] @@ -153,8 +155,8 @@ extern "C" { pub fn start_with_when_and_grain_offset_and_grain_duration( this: &AudioBufferSourceNode, when: f64, - grain_offset: f64, - grain_duration: f64, + offset: f64, + duration: f64, ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "AudioBufferSourceNode" , js_name = stop)] #[doc = "The `stop()` method."] @@ -162,6 +164,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/stop)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceNode`*"] + #[deprecated] pub fn stop(this: &AudioBufferSourceNode) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "AudioBufferSourceNode" , js_name = stop)] #[doc = "The `stop()` method."] @@ -169,5 +172,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/stop)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceNode`*"] + #[deprecated] pub fn stop_with_when(this: &AudioBufferSourceNode, when: f64) -> Result<(), JsValue>; } diff --git a/crates/web-sys/webidls/enabled/AudioBufferSourceNode.webidl b/crates/web-sys/webidls/enabled/AudioBufferSourceNode.webidl index cbab503c8e9..6849d1231c8 100644 --- a/crates/web-sys/webidls/enabled/AudioBufferSourceNode.webidl +++ b/crates/web-sys/webidls/enabled/AudioBufferSourceNode.webidl @@ -10,34 +10,28 @@ * liability, trademark and document use rules apply. */ -dictionary AudioBufferSourceOptions { - AudioBuffer? buffer; - float detune = 0; - boolean loop = false; - double loopEnd = 0; - double loopStart = 0; - float playbackRate = 1; -}; - -[Pref="dom.webaudio.enabled", - Constructor(BaseAudioContext context, optional AudioBufferSourceOptions options)] +[Exposed=Window] interface AudioBufferSourceNode : AudioScheduledSourceNode { - + constructor (BaseAudioContext context, + optional AudioBufferSourceOptions options = {}); attribute AudioBuffer? buffer; - readonly attribute AudioParam playbackRate; readonly attribute AudioParam detune; - attribute boolean loop; attribute double loopStart; attribute double loopEnd; + [RustDeprecated] attribute EventHandler onended; + [Throws] undefined start (optional double when = 0, + optional double offset, + optional double duration); + [Throws, RustDeprecated] undefined stop (optional double when = 0); +}; - attribute EventHandler onended; - - [Throws] - undefined start(optional double when = 0, optional double grainOffset = 0, - optional double grainDuration); - - [Throws] - undefined stop (optional double when = 0); +dictionary AudioBufferSourceOptions { + AudioBuffer? buffer; + float detune = 0; + boolean loop = false; + double loopEnd = 0; + double loopStart = 0; + float playbackRate = 1; }; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 33144506e02..b455556ef3e 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -152,6 +152,19 @@ pub(crate) static FIXED_INTERFACES: Lazy< "ReadableStreamByobReader", BTreeMap::from_iter([("read", "read_with_array_buffer_view")]), ), + ( + "AudioBufferSourceNode", + BTreeMap::from_iter([ + ( + "start_with_when_and_offset", + "start_with_when_and_grain_offset", + ), + ( + "start_with_when_and_offset_and_duration", + "start_with_when_and_grain_offset_and_grain_duration", + ), + ]), + ), ]) }); diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index 6ce9b2e2a82..7eb8df18166 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -225,6 +225,7 @@ pub enum InterfaceAttributeKind { pub struct InterfaceAttribute { pub js_name: String, + pub deprecated: Option>, pub ty: Type, pub is_static: bool, pub structural: bool, @@ -243,6 +244,7 @@ impl InterfaceAttribute { ) -> TokenStream { let InterfaceAttribute { js_name, + deprecated, ty, is_static, structural, @@ -319,6 +321,10 @@ impl InterfaceAttribute { }; let catch = if *catch { Some(quote!(catch,)) } else { None }; + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let doc_comment = comment( format!( @@ -343,6 +349,7 @@ impl InterfaceAttribute { )] #doc_comment #unstable_docs + #deprecated #def } } @@ -360,6 +367,7 @@ pub enum InterfaceMethodKind { pub struct InterfaceMethod { pub name: Ident, pub js_name: String, + pub deprecated: Option>, pub arguments: Vec<(Ident, Type)>, pub ret_ty: Option, pub kind: InterfaceMethodKind, @@ -381,6 +389,7 @@ impl InterfaceMethod { let InterfaceMethod { name, js_name, + deprecated, arguments, ret_ty, kind, @@ -463,6 +472,11 @@ impl InterfaceMethod { let doc_comment = comment(doc_comment, &required_doc_string(options, &features)); + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); + let ret = ret_ty.as_ref().map(|ret| quote!( #ret )); let ret = if *catch { @@ -509,6 +523,7 @@ impl InterfaceMethod { )] #doc_comment #unstable_docs + #deprecated pub fn #name(#this #(#arguments),*) #ret; } } diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 4ea97047ad7..5fac4fe10ce 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -696,6 +696,7 @@ impl<'src> FirstPassRecord<'src> { let structural = is_structural(attrs.as_ref(), container_attrs); let catch = throws(attrs); + let deprecated: Option> = get_rust_deprecated(attrs); let ty = type_ .type_ @@ -712,6 +713,7 @@ impl<'src> FirstPassRecord<'src> { catch: catch || getter_throws(parent_js_name, &js_name, attrs), ty, js_name: js_name.clone(), + deprecated: deprecated.clone(), kind, unstable, }); @@ -733,6 +735,7 @@ impl<'src> FirstPassRecord<'src> { catch: catch || setter_throws(parent_js_name, &js_name, attrs), ty, js_name, + deprecated, kind, unstable, }); diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 1865c007f54..c7fd0c35945 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -410,6 +410,7 @@ impl<'src> FirstPassRecord<'src> { let structural = force_structural || is_structural(signature.orig.attrs.as_ref(), container_attrs); let catch = force_throws || throws(signature.orig.attrs); + let deprecated = get_rust_deprecated(signature.orig.attrs); let ret_ty = if id == &OperationId::IndexingGetter { // All indexing getters should return optional values (or // otherwise be marked with catch). @@ -476,6 +477,7 @@ impl<'src> FirstPassRecord<'src> { ret.push(InterfaceMethod { name: rust_ident(&rust_name), js_name: name.to_string(), + deprecated: deprecated.clone(), arguments, ret_ty, kind: kind.clone(), @@ -507,6 +509,7 @@ impl<'src> FirstPassRecord<'src> { ret.push(InterfaceMethod { name: rust_ident(&format!("{}_{}", rust_name, i)), js_name: name.to_string(), + deprecated: deprecated.clone(), arguments, kind: kind.clone(), ret_ty, From 7ad1a2703d8a555a773bb9f20e3c0dbbde6f461b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 28 Jul 2024 23:12:24 +0200 Subject: [PATCH 429/641] Add ability to set stack size for spawned threads (#3995) --- CHANGELOG.md | 12 +++ crates/cli-support/src/js/mod.rs | 84 +++++++++++++++----- crates/cli/tests/wasm-bindgen/main.rs | 40 ++++++++-- crates/threads-xform/src/lib.rs | 64 +++++++++++---- crates/wasm-conventions/src/lib.rs | 24 +++--- examples/synchronous-instantiation/worker.js | 2 +- examples/wasm-audio-worklet/src/worklet.js | 2 +- examples/websockets/index.js | 2 +- 8 files changed, 170 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f132f8b64f..ad339b8897a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,9 @@ * Add WebIDL definitions relating to `Popover API`. [#3977](https://github.com/rustwasm/wasm-bindgen/pull/3977) +* Added the `thread_stack_size` property to the object parameter of `default()` (`init()`) and `initSync()`, making it possible to set the stack size of spawned threads. `__wbindgen_thread_destroy()` now has a third optional parameter for the stack size, the default stack size is assumed when not passing it. When calling from the thread to be destroyed, by passing no parameters, the correct stack size is determined internally. + [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) + ### Changed * Stabilize Web Share API. @@ -86,6 +89,12 @@ * Deprecate `AudioBufferSourceNode.onended` and `AudioBufferSourceNode.stop()`. [#4020](https://github.com/rustwasm/wasm-bindgen/pull/4020) +* Increase default stack size for spawned threads from 1 to 2 MB. + [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) + +* Deprecated parameters to `default` (`init`) and `initSync` in favor of an object. + [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. @@ -118,6 +127,9 @@ * Fixed Deno support. [#3990](https://github.com/rustwasm/wasm-bindgen/pull/3990) +* Fix `__wbindgen_thread_destroy()` ignoring parameters. + [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8604d6f2a9c..bff177c662f 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -63,6 +63,9 @@ pub struct Context<'a> { /// A flag to track if the stack pointer setter shim has been injected. stack_pointer_shim_injected: bool, + + /// If threading is enabled. + threads_enabled: bool, } #[derive(Default)] @@ -107,6 +110,7 @@ impl<'a> Context<'a> { wasm_import_definitions: Default::default(), exported_classes: Some(Default::default()), config, + threads_enabled: config.threads.is_enabled(module), module, npm_dependencies: Default::default(), next_export_idx: 0, @@ -613,12 +617,17 @@ impl<'a> Context<'a> { let (memory_doc, memory_param) = if has_memory { ( - "* @param {WebAssembly.Memory} maybe_memory\n", - ", maybe_memory?: WebAssembly.Memory", + "* @param {WebAssembly.Memory} memory - Deprecated.\n", + ", memory?: WebAssembly.Memory", ) } else { ("", "") }; + let stack_size = if self.threads_enabled { + ", thread_stack_size?: number" + } else { + "" + }; let arg_optional = if has_module_or_path_optional { "?" } else { "" }; // With TypeScript 3.8.3, I'm seeing that any "export"s at the root level cause TypeScript to ignore all "declare" statements. // So using "declare" everywhere for at least the NoModules option. @@ -639,12 +648,12 @@ impl<'a> Context<'a> { * Instantiates the given `module`, which can either be bytes or\n\ * a precompiled `WebAssembly.Module`.\n\ *\n\ - * @param {{SyncInitInput}} module\n\ + * @param {{{{ module: SyncInitInput{memory_param}{stack_size} }}}} module - Passing `SyncInitInput` directly is deprecated.\n\ {memory_doc}\ *\n\ * @returns {{InitOutput}}\n\ */\n\ - export function initSync(module: SyncInitInput{memory_param}): InitOutput;\n\n\ + export function initSync(module: {{ module: SyncInitInput{memory_param}{stack_size} }} | SyncInitInput{memory_param}): InitOutput;\n\n\ ", memory_doc = memory_doc, memory_param = memory_param @@ -664,13 +673,13 @@ impl<'a> Context<'a> { * If `module_or_path` is {{RequestInfo}} or {{URL}}, makes a request and\n\ * for everything else, calls `WebAssembly.instantiate` directly.\n\ *\n\ - * @param {{InitInput | Promise}} module_or_path\n\ + * @param {{{{ module_or_path: InitInput | Promise{memory_param}{stack_size} }}}} module_or_path - Passing `InitInput` directly is deprecated.\n\ {}\ *\n\ * @returns {{Promise}}\n\ */\n\ {setup_function_declaration} \ - (module_or_path{}: InitInput | Promise{}): Promise;\n", + (module_or_path{}: {{ module_or_path: InitInput | Promise{memory_param}{stack_size} }} | InitInput | Promise{}): Promise;\n", memory_doc, arg_optional, memory_param, output = output, sync_init_function = sync_init_function, @@ -692,7 +701,7 @@ impl<'a> Context<'a> { if let Some(id) = mem.import { self.module.imports.get_mut(id).module = module_name.to_string(); init_memory = format!( - "imports.{}.memory = maybe_memory || new WebAssembly.Memory({{", + "imports.{}.memory = memory || new WebAssembly.Memory({{", module_name ); init_memory.push_str(&format!("initial:{}", mem.initial)); @@ -703,7 +712,7 @@ impl<'a> Context<'a> { init_memory.push_str(",shared:true"); } init_memory.push_str("});"); - init_memory_arg = ", maybe_memory"; + init_memory_arg = ", memory"; has_memory = true; } } @@ -712,14 +721,14 @@ impl<'a> Context<'a> { match self.config.mode { OutputMode::Web => format!( "\ - if (typeof input === 'undefined') {{ - input = new URL('{stem}_bg.wasm', import.meta.url); + if (typeof module_or_path === 'undefined') {{ + module_or_path = new URL('{stem}_bg.wasm', import.meta.url); }}", stem = self.config.stem()? ), OutputMode::NoModules { .. } => "\ - if (typeof input === 'undefined' && typeof script_src !== 'undefined') { - input = script_src.replace(/\\.js$/, '_bg.wasm'); + if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') { + module_or_path = script_src.replace(/\\.js$/, '_bg.wasm'); }" .to_string(), _ => "".to_string(), @@ -836,14 +845,15 @@ impl<'a> Context<'a> { return imports; }} - function __wbg_init_memory(imports, maybe_memory) {{ + function __wbg_init_memory(imports, memory) {{ {init_memory} }} - function __wbg_finalize_init(instance, module) {{ + function __wbg_finalize_init(instance, module{init_stack_size_arg}) {{ wasm = instance.exports; __wbg_init.__wbindgen_wasm_module = module; {init_memviews} + {init_stack_size_check} {start} return wasm; }} @@ -851,6 +861,12 @@ impl<'a> Context<'a> { function initSync(module{init_memory_arg}) {{ if (wasm !== undefined) return wasm; + {init_stack_size} + if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype) + ({{module{init_memory_arg}{init_stack_size_arg}}} = module) + else + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + const imports = __wbg_get_imports(); __wbg_init_memory(imports{init_memory_arg}); @@ -861,36 +877,62 @@ impl<'a> Context<'a> { const instance = new WebAssembly.Instance(module, imports); - return __wbg_finalize_init(instance, module); + return __wbg_finalize_init(instance, module{init_stack_size_arg}); }} - async function __wbg_init(input{init_memory_arg}) {{ + async function __wbg_init(module_or_path{init_memory_arg}) {{ if (wasm !== undefined) return wasm; + {init_stack_size} + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({{module_or_path{init_memory_arg}{init_stack_size_arg}}} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + {default_module_path} const imports = __wbg_get_imports(); - if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {{ - input = fetch(input); + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {{ + module_or_path = fetch(module_or_path); }} __wbg_init_memory(imports{init_memory_arg}); - const {{ instance, module }} = await __wbg_load(await input, imports); + const {{ instance, module }} = await __wbg_load(await module_or_path, imports); - return __wbg_finalize_init(instance, module); + return __wbg_finalize_init(instance, module{init_stack_size_arg}); }} ", init_memory_arg = init_memory_arg, default_module_path = default_module_path, init_memory = init_memory, init_memviews = init_memviews, - start = if needs_manual_start { + start = if needs_manual_start && self.threads_enabled { + "wasm.__wbindgen_start(thread_stack_size);" + } else if needs_manual_start { "wasm.__wbindgen_start();" } else { "" }, imports_init = imports_init, + init_stack_size = if self.threads_enabled { + "let thread_stack_size" + } else { + "" + }, + init_stack_size_arg = if self.threads_enabled { + ", thread_stack_size" + } else { + "" + }, + init_stack_size_check = if self.threads_enabled { + format!( + "if (typeof thread_stack_size !== 'undefined' && (typeof thread_stack_size !== 'number' || thread_stack_size === 0 || thread_stack_size % {} !== 0)) {{ throw 'invalid stack size' }}", + wasm_bindgen_threads_xform::PAGE_SIZE, + ) + } else { + String::new() + }, ); Ok((js, ts)) diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index b15a053d375..3a78cfa860e 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -332,11 +332,17 @@ fn default_module_path_target_web() { let contents = fs::read_to_string(out_dir.join("default_module_path_target_web.js")).unwrap(); assert!(contents.contains( "\ -async function __wbg_init(input) { +async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; - if (typeof input === 'undefined') { - input = new URL('default_module_path_target_web_bg.wasm', import.meta.url); + + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({module_or_path} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('default_module_path_target_web_bg.wasm', import.meta.url); }", )); } @@ -361,11 +367,17 @@ fn default_module_path_target_no_modules() { )); assert!(contents.contains( "\ - async function __wbg_init(input) { + async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; - if (typeof input === 'undefined' && typeof script_src !== 'undefined') { - input = script_src.replace(/\\.js$/, '_bg.wasm'); + + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({module_or_path} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + + if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') { + module_or_path = script_src.replace(/\\.js$/, '_bg.wasm'); }", )); } @@ -384,10 +396,16 @@ fn omit_default_module_path_target_web() { fs::read_to_string(out_dir.join("omit_default_module_path_target_web.js")).unwrap(); assert!(contents.contains( "\ -async function __wbg_init(input) { +async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({module_or_path} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + + const imports = __wbg_get_imports();", )); } @@ -406,10 +424,16 @@ fn omit_default_module_path_target_no_modules() { fs::read_to_string(out_dir.join("omit_default_module_path_target_no_modules.js")).unwrap(); assert!(contents.contains( "\ - async function __wbg_init(input) { + async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; + if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) + ({module_or_path} = module_or_path) + else + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + + const imports = __wbg_get_imports();", )); } diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 326d6a292b0..cc1a8cd1d06 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -2,13 +2,14 @@ use anyhow::{anyhow, bail, Error}; use std::cmp; use std::env; use walrus::ir::Value; +use walrus::FunctionBuilder; use walrus::{ ir::MemArg, ExportItem, FunctionId, GlobalId, GlobalKind, InitExpr, InstrSeqBuilder, MemoryId, Module, ValType, }; use wasm_bindgen_wasm_conventions as wasm_conventions; -const PAGE_SIZE: u32 = 1 << 16; +pub const PAGE_SIZE: u32 = 1 << 16; const ATOMIC_MEM_ARG: MemArg = MemArg { align: 4, offset: 0, @@ -31,7 +32,7 @@ impl Config { pub fn new() -> Config { Config { maximum_memory: 1 << 30, // 1GB - thread_stack_size: 1 << 20, // 1MB + thread_stack_size: 1 << 21, // 2MB enabled: env::var("WASM_BINDGEN_THREADS").is_ok(), } } @@ -149,13 +150,19 @@ impl Config { // Make sure the temporary stack is aligned down let temp_stack = (base + static_data_pages * PAGE_SIZE) & !(static_data_align - 1); + assert!(self.thread_stack_size % PAGE_SIZE == 0); + let stack = Stack { pointer: wasm_conventions::get_shadow_stack_pointer(module) .ok_or_else(|| anyhow!("failed to find shadow stack pointer"))?, temp: temp_stack as i32, temp_lock: thread_counter_addr + 4, alloc: stack_alloc, - size: self.thread_stack_size, + size: module.globals.add_local( + ValType::I32, + true, + InitExpr::Value(Value::I32(self.thread_stack_size as i32)), + ), }; let _ = module.exports.add("__stack_alloc", stack.alloc); @@ -172,20 +179,20 @@ impl Config { // You can also call it from a "leader" agent, passing appropriate values, if said leader // is in charge of cleaning up after a "follower" agent. In that case: // - The "appropriate values" are the values of the `__tls_base` and `__stack_alloc` globals - // from the follower thread, after initialization. + // and the stack size from the follower thread, after initialization. // - The leader does _not_ need to block. // - Similar restrictions apply: the follower thread should be considered unusable afterwards, // the leader should not call this function with the same set of parameters twice. // - Moreover, concurrent calls can lead to UB: the follower could be in the middle of a // call while the leader is destroying its stack! You should make sure that this cannot happen. - inject_destroy(module, &tls, &stack, memory)?; + inject_destroy(self, module, &tls, &stack, memory)?; Ok(Some(thread_count)) } } impl ThreadCount { - pub fn wrap_start(self, builder: &mut walrus::FunctionBuilder, start: FunctionId) { + pub fn wrap_start(self, builder: &mut FunctionBuilder, start: FunctionId) { // We only want to call the start function if we are in the first thread. // The thread counter should be 0 for the first thread. builder.func_body().local_get(self.0).if_else( @@ -307,7 +314,7 @@ struct Stack { /// A global to store allocated stack alloc: GlobalId, /// The size of the stack - size: u32, + size: GlobalId, } fn inject_start( @@ -319,14 +326,18 @@ fn inject_start( ) -> Result { use walrus::ir::*; - assert!(stack.size % PAGE_SIZE == 0); - let local = module.locals.add(ValType::I32); let thread_count = module.locals.add(ValType::I32); + let stack_size = module.locals.add(ValType::I32); let malloc = find_function(module, "__wbindgen_malloc")?; - let builder = wasm_bindgen_wasm_conventions::get_or_insert_start_builder(module); + let prev_start = wasm_bindgen_wasm_conventions::get_start(module); + let mut builder = FunctionBuilder::new(&mut module.types, &[ValType::I32], &[]); + + if let Ok(prev_start) | Err(Some(prev_start)) = prev_start { + builder.func_body().call(prev_start); + } let mut body = builder.func_body(); @@ -343,9 +354,17 @@ fn inject_start( // we give ourselves a stack and we update our stack // pointer as the default stack pointer is surely wrong for us. |body| { + body.local_get(stack_size).if_else( + None, + |body| { + body.local_get(stack_size).global_set(stack.size); + }, + |_| (), + ); + // local = malloc(stack.size, align) [aka base] with_temp_stack(body, memory, stack, |body| { - body.i32_const(stack.size as i32) + body.global_get(stack.size) .i32_const(16) .call(malloc) .local_tee(local); @@ -356,7 +375,7 @@ fn inject_start( // stack_pointer = base + stack.size body.global_get(stack.alloc) - .i32_const(stack.size as i32) + .global_get(stack.size) .binop(BinaryOp::I32Add) .global_set(stack.pointer); }, @@ -373,10 +392,14 @@ fn inject_start( .global_get(tls.base) .call(tls.init); + let id = builder.finish(vec![stack_size], &mut module.funcs); + module.start = Some(id); + Ok(ThreadCount(thread_count)) } fn inject_destroy( + config: &Config, module: &mut Module, tls: &Tls, stack: &Stack, @@ -384,8 +407,11 @@ fn inject_destroy( ) -> Result<(), Error> { let free = find_function(module, "__wbindgen_free")?; - let mut builder = - walrus::FunctionBuilder::new(&mut module.types, &[ValType::I32, ValType::I32], &[]); + let mut builder = FunctionBuilder::new( + &mut module.types, + &[ValType::I32, ValType::I32, ValType::I32], + &[], + ); builder.name("__wbindgen_thread_destroy".into()); @@ -395,6 +421,7 @@ fn inject_destroy( // we're being called from the agent that must be destroyed and rely on its globals let tls_base = module.locals.add(ValType::I32); let stack_alloc = module.locals.add(ValType::I32); + let stack_size = module.locals.add(ValType::I32); // Ideally, at this point, we would destroy the values stored in TLS. // We can't really do that without help from the standard library. @@ -425,14 +452,17 @@ fn inject_destroy( |body| { // we're destroying somebody else's stack, so we can use our own body.local_get(stack_alloc) - .i32_const(stack.size as i32) + .local_get(stack_size) + .i32_const(config.thread_stack_size as i32) + .local_get(stack_size) + .select(None) .i32_const(16) .call(free); }, |body| { with_temp_stack(body, memory, stack, |body| { body.global_get(stack.alloc) - .i32_const(stack.size as i32) + .global_get(stack.size) .i32_const(16) .call(free); }); @@ -442,7 +472,7 @@ fn inject_destroy( }, ); - let destroy_id = builder.finish(Vec::new(), &mut module.funcs); + let destroy_id = builder.finish(vec![tls_base, stack_alloc, stack_size], &mut module.funcs); module.exports.add("__wbindgen_thread_destroy", destroy_id); diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index 2161a0d3b43..345209e6ac6 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -52,7 +52,7 @@ pub fn get_shadow_stack_pointer(module: &Module) -> Option { match candidates.len() { 0 => None, // TODO: have an actual check here. - 1 => Some(candidates[0].id()), + 1 | 2 => Some(candidates[0].id()), _ => None, } } @@ -117,17 +117,19 @@ pub fn get_function_table_entry(module: &Module, idx: u32) -> Result Result> { + match module.start { + Some(start) => match module.funcs.get_mut(start).kind { + FunctionKind::Import(_) => Err(Some(start)), + FunctionKind::Local(_) => Ok(start), + FunctionKind::Uninitialized(_) => unimplemented!(), + }, + None => Err(None), + } +} + pub fn get_or_insert_start_builder(module: &mut Module) -> &mut FunctionBuilder { - let prev_start = { - match module.start { - Some(start) => match module.funcs.get_mut(start).kind { - FunctionKind::Import(_) => Err(Some(start)), - FunctionKind::Local(_) => Ok(start), - FunctionKind::Uninitialized(_) => unimplemented!(), - }, - None => Err(None), - } - }; + let prev_start = get_start(module); let id = match prev_start { Ok(id) => id, diff --git a/examples/synchronous-instantiation/worker.js b/examples/synchronous-instantiation/worker.js index 33fb148fe94..31841de4c97 100644 --- a/examples/synchronous-instantiation/worker.js +++ b/examples/synchronous-instantiation/worker.js @@ -7,7 +7,7 @@ self.onmessage = ({ data: bytes }) => { * via the default export. The synchronous method internally uses * `new WebAssembly.Module()` and `new WebAssembly.Instance()`. */ - wasm.initSync(bytes); + wasm.initSync({ module: bytes }); /** * Once initialized we can call our exported `greet()` functions. diff --git a/examples/wasm-audio-worklet/src/worklet.js b/examples/wasm-audio-worklet/src/worklet.js index 4223d72ca30..0a6c41b054a 100644 --- a/examples/wasm-audio-worklet/src/worklet.js +++ b/examples/wasm-audio-worklet/src/worklet.js @@ -2,7 +2,7 @@ registerProcessor("WasmProcessor", class WasmProcessor extends AudioWorkletProce constructor(options) { super(); let [module, memory, handle] = options.processorOptions; - bindgen.initSync(module, memory); + bindgen.initSync({ module, memory }); this.processor = bindgen.WasmAudioProcessor.unpack(handle); } process(inputs, outputs) { diff --git a/examples/websockets/index.js b/examples/websockets/index.js index 1b3361cc0fd..0ce0ce659bc 100644 --- a/examples/websockets/index.js +++ b/examples/websockets/index.js @@ -1,5 +1,5 @@ import init from './pkg/websockets.js'; window.addEventListener('load', async () => { - await init('./pkg/websockets_bg.wasm'); + await init({ module_or_path: './pkg/websockets_bg.wasm' }); }); From 06b347f908a736905b2ab6cd9313bd39ecb0a628 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 29 Jul 2024 00:14:06 +0200 Subject: [PATCH 430/641] Fix no-std compatibility (#4005) --- .github/workflows/main.yml | 2 + CHANGELOG.md | 3 + crates/backend/src/codegen.rs | 54 ++-- src/closure.rs | 13 +- src/convert/impls.rs | 76 ++--- src/convert/slices.rs | 435 +++++++++++++++------------- src/convert/traits.rs | 28 +- src/describe.rs | 62 ++-- src/externref.rs | 30 +- src/lib.rs | 529 +++++++++++++++++----------------- src/link.rs | 3 + 11 files changed, 635 insertions(+), 600 deletions(-) create mode 100644 src/link.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58c5cd842f0..474927a2317 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: cargo check --all + - run: cargo check --no-default-features # Run `cargo clippy` over everything clippy: @@ -66,6 +67,7 @@ jobs: - run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings - run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings diff --git a/CHANGELOG.md b/CHANGELOG.md index ad339b8897a..d094b0daa59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,9 @@ * Fix `__wbindgen_thread_destroy()` ignoring parameters. [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) +* Fix `no_std` support and therefor compiling with `default-features = false`. + [#4005](https://github.com/rustwasm/wasm-bindgen/pull/4005) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 43c01f48fb1..21b326ba153 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -221,12 +221,6 @@ impl ToTokens for ast::Struct { impl #wasm_bindgen::describe::WasmDescribe for #name { fn describe() { use #wasm_bindgen::__wbindgen_if_not_std; - __wbindgen_if_not_std! { - compile_error! { - "exporting a class to JS requires the `std` feature to \ - be enabled in the `wasm-bindgen` crate" - } - } use #wasm_bindgen::describe::*; inform(RUST_STRUCT); inform(#name_len); @@ -239,7 +233,7 @@ impl ToTokens for ast::Struct { type Abi = u32; fn into_abi(self) -> u32 { - use #wasm_bindgen::__rt::std::rc::Rc; + use #wasm_bindgen::__rt::alloc::rc::Rc; use #wasm_bindgen::__rt::WasmRefCell; Rc::into_raw(Rc::new(WasmRefCell::new(self))) as u32 } @@ -250,8 +244,8 @@ impl ToTokens for ast::Struct { type Abi = u32; unsafe fn from_abi(js: u32) -> Self { - use #wasm_bindgen::__rt::std::rc::Rc; - use #wasm_bindgen::__rt::std::result::Result::{Ok, Err}; + use #wasm_bindgen::__rt::alloc::rc::Rc; + use #wasm_bindgen::__rt::core::result::Result::{Ok, Err}; use #wasm_bindgen::__rt::{assert_not_null, WasmRefCell}; let ptr = js as *mut WasmRefCell<#name>; @@ -299,7 +293,7 @@ impl ToTokens for ast::Struct { // `allow_delayed` is whether it's ok to not actually free the `ptr` immediately // if it's still borrowed. pub unsafe extern "C" fn #free_fn(ptr: u32, allow_delayed: u32) { - use #wasm_bindgen::__rt::std::rc::Rc; + use #wasm_bindgen::__rt::alloc::rc::Rc; if allow_delayed != 0 { // Just drop the implicit `Rc` owned by JS, and then if the value is still @@ -320,7 +314,7 @@ impl ToTokens for ast::Struct { type Anchor = #wasm_bindgen::__rt::RcRef<#name>; unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor { - use #wasm_bindgen::__rt::std::rc::Rc; + use #wasm_bindgen::__rt::alloc::rc::Rc; let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; #wasm_bindgen::__rt::assert_not_null(js); @@ -337,7 +331,7 @@ impl ToTokens for ast::Struct { type Anchor = #wasm_bindgen::__rt::RcRefMut<#name>; unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor { - use #wasm_bindgen::__rt::std::rc::Rc; + use #wasm_bindgen::__rt::alloc::rc::Rc; let js = js as *mut #wasm_bindgen::__rt::WasmRefCell<#name>; #wasm_bindgen::__rt::assert_not_null(js); @@ -375,7 +369,7 @@ impl ToTokens for ast::Struct { type Error = #wasm_bindgen::JsValue; fn try_from_js_value(value: #wasm_bindgen::JsValue) - -> #wasm_bindgen::__rt::std::result::Result { + -> #wasm_bindgen::__rt::core::result::Result { let idx = #wasm_bindgen::convert::IntoWasmAbi::into_abi(&value); #[link(wasm_import_module = "__wbindgen_placeholder__")] @@ -391,13 +385,13 @@ impl ToTokens for ast::Struct { let ptr = unsafe { #unwrap_fn(idx) }; if ptr == 0 { - #wasm_bindgen::__rt::std::result::Result::Err(value) + #wasm_bindgen::__rt::core::result::Result::Err(value) } else { // Don't run `JsValue`'s destructor, `unwrap_fn` already did that for us. #[allow(clippy::mem_forget)] - #wasm_bindgen::__rt::std::mem::forget(value); + #wasm_bindgen::__rt::core::mem::forget(value); unsafe { - #wasm_bindgen::__rt::std::result::Result::Ok( + #wasm_bindgen::__rt::core::result::Result::Ok( ::from_abi(ptr) ) } @@ -417,12 +411,12 @@ impl ToTokens for ast::Struct { impl #wasm_bindgen::convert::VectorIntoWasmAbi for #name { type Abi = < - #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> as #wasm_bindgen::convert::IntoWasmAbi >::Abi; fn vector_into_abi( - vector: #wasm_bindgen::__rt::std::boxed::Box<[#name]> + vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#name]> ) -> Self::Abi { #wasm_bindgen::convert::js_value_vector_into_abi(vector) } @@ -430,19 +424,19 @@ impl ToTokens for ast::Struct { impl #wasm_bindgen::convert::VectorFromWasmAbi for #name { type Abi = < - #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> as #wasm_bindgen::convert::FromWasmAbi >::Abi; unsafe fn vector_from_abi( js: Self::Abi - ) -> #wasm_bindgen::__rt::std::boxed::Box<[#name]> { + ) -> #wasm_bindgen::__rt::alloc::boxed::Box<[#name]> { #wasm_bindgen::convert::js_value_vector_from_abi(js) } } impl #wasm_bindgen::__rt::VectorIntoJsValue for #name { - fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::std::boxed::Box<[#name]>) -> #wasm_bindgen::JsValue { + fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#name]>) -> #wasm_bindgen::JsValue { #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) } } @@ -597,7 +591,7 @@ impl TryToTokens for ast::Export { quote!(long_ref_from_abi), quote!( <<#class as #wasm_bindgen::convert::LongRefFromWasmAbi> - ::Anchor as #wasm_bindgen::__rt::std::borrow::Borrow<#class>> + ::Anchor as #wasm_bindgen::__rt::core::borrow::Borrow<#class>> ::borrow(&me) ), ) @@ -1589,13 +1583,13 @@ impl ToTokens for ast::Enum { type Error = #wasm_bindgen::JsValue; fn try_from_js_value(value: #wasm_bindgen::JsValue) - -> #wasm_bindgen::__rt::std::result::Result::Error> { + -> #wasm_bindgen::__rt::core::result::Result::Error> { use #wasm_bindgen::__rt::core::convert::TryFrom; let js = f64::try_from(&value)? as u32; - #wasm_bindgen::__rt::std::result::Result::Ok( + #wasm_bindgen::__rt::core::result::Result::Ok( #(#try_from_cast_clauses else)* { - return #wasm_bindgen::__rt::std::result::Result::Err(value) + return #wasm_bindgen::__rt::core::result::Result::Err(value) } ) } @@ -1611,12 +1605,12 @@ impl ToTokens for ast::Enum { impl #wasm_bindgen::convert::VectorIntoWasmAbi for #enum_name { type Abi = < - #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> as #wasm_bindgen::convert::IntoWasmAbi >::Abi; fn vector_into_abi( - vector: #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]> + vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#enum_name]> ) -> Self::Abi { #wasm_bindgen::convert::js_value_vector_into_abi(vector) } @@ -1624,19 +1618,19 @@ impl ToTokens for ast::Enum { impl #wasm_bindgen::convert::VectorFromWasmAbi for #enum_name { type Abi = < - #wasm_bindgen::__rt::std::boxed::Box<[#wasm_bindgen::JsValue]> + #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> as #wasm_bindgen::convert::FromWasmAbi >::Abi; unsafe fn vector_from_abi( js: Self::Abi - ) -> #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]> { + ) -> #wasm_bindgen::__rt::alloc::boxed::Box<[#enum_name]> { #wasm_bindgen::convert::js_value_vector_from_abi(js) } } impl #wasm_bindgen::__rt::VectorIntoJsValue for #enum_name { - fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::std::boxed::Box<[#enum_name]>) -> #wasm_bindgen::JsValue { + fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#enum_name]>) -> #wasm_bindgen::JsValue { #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) } } diff --git a/src/closure.rs b/src/closure.rs index 430cee5df05..b038b1775ba 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -6,9 +6,10 @@ #![allow(clippy::fn_to_numeric_cast)] -use std::fmt; -use std::mem::{self, ManuallyDrop}; -use std::prelude::v1::*; +use alloc::boxed::Box; +use alloc::string::String; +use core::fmt; +use core::mem::{self, ManuallyDrop}; use crate::convert::*; use crate::describe::*; @@ -356,7 +357,7 @@ where /// lifetime dynamically managed by the JS GC. This function can be used /// to drop this `Closure` while keeping the associated JS function still /// valid. - /// + /// /// If the platform supports weak references, the Rust memory will be /// reclaimed when the JS closure is GC'd. If weak references is not /// supported, this can be dangerous if this function is called many times @@ -685,7 +686,7 @@ macro_rules! doit { } fn into_js_function(self) -> JsValue { - use std::rc::Rc; + use alloc::rc::Rc; use crate::__rt::WasmRefCell; let mut me = Some(self); @@ -866,7 +867,7 @@ where fn into_js_function(self) -> JsValue { use crate::__rt::WasmRefCell; - use std::rc::Rc; + use alloc::rc::Rc; let mut me = Some(self); diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 4ecef7821ef..0010743cd66 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -1,4 +1,7 @@ +use alloc::boxed::Box; +use alloc::vec::Vec; use core::char; +use core::fmt::Debug; use core::mem::{self, ManuallyDrop}; use core::ptr::NonNull; @@ -8,12 +11,6 @@ use crate::convert::{FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAb use crate::convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi}; use crate::{Clamped, JsError, JsValue, UnwrapThrowExt}; -if_std! { - use std::boxed::Box; - use std::fmt::Debug; - use std::vec::Vec; -} - // Primitive types can always be passed over the ABI. impl WasmAbi for T { type Prim1 = Self; @@ -473,36 +470,39 @@ impl IntoWasmAbi for JsError { } } -if_std! { - // Note: this can't take `&[T]` because the `Into` impl needs - // ownership of `T`. - pub fn js_value_vector_into_abi>(vector: Box<[T]>) -> as IntoWasmAbi>::Abi { - let js_vals: Box<[JsValue]> = vector - .into_vec() - .into_iter() - .map(|x| x.into()) - .collect(); - - js_vals.into_abi() - } - - pub unsafe fn js_value_vector_from_abi(js: as FromWasmAbi>::Abi) -> Box<[T]> where T::Error: Debug { - let js_vals = as FromWasmAbi>::from_abi(js); - - let mut result = Vec::with_capacity(js_vals.len()); - for value in js_vals { - // We push elements one-by-one instead of using `collect` in order to improve - // error messages. When using `collect`, this `expect_throw` is buried in a - // giant chain of internal iterator functions, which results in the actual - // function that takes this `Vec` falling off the end of the call stack. - // So instead, make sure to call it directly within this function. - // - // This is only a problem in debug mode. Since this is the browser's error stack - // we're talking about, it can only see functions that actually make it to the - // final wasm binary (i.e., not inlined functions). All of those internal - // iterator functions get inlined in release mode, and so they don't show up. - result.push(T::try_from_js_value(value).expect_throw("array contains a value of the wrong type")); - } - result.into_boxed_slice() - } +// Note: this can't take `&[T]` because the `Into` impl needs +// ownership of `T`. +pub fn js_value_vector_into_abi>( + vector: Box<[T]>, +) -> as IntoWasmAbi>::Abi { + let js_vals: Box<[JsValue]> = vector.into_vec().into_iter().map(|x| x.into()).collect(); + + js_vals.into_abi() +} + +pub unsafe fn js_value_vector_from_abi( + js: as FromWasmAbi>::Abi, +) -> Box<[T]> +where + T::Error: Debug, +{ + let js_vals = as FromWasmAbi>::from_abi(js); + + let mut result = Vec::with_capacity(js_vals.len()); + for value in js_vals { + // We push elements one-by-one instead of using `collect` in order to improve + // error messages. When using `collect`, this `expect_throw` is buried in a + // giant chain of internal iterator functions, which results in the actual + // function that takes this `Vec` falling off the end of the call stack. + // So instead, make sure to call it directly within this function. + // + // This is only a problem in debug mode. Since this is the browser's error stack + // we're talking about, it can only see functions that actually make it to the + // final wasm binary (i.e., not inlined functions). All of those internal + // iterator functions get inlined in release mode, and so they don't show up. + result.push( + T::try_from_js_value(value).expect_throw("array contains a value of the wrong type"), + ); + } + result.into_boxed_slice() } diff --git a/src/convert/slices.rs b/src/convert/slices.rs index b051e3814a0..ee9c20f57aa 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -1,24 +1,24 @@ #[cfg(feature = "std")] use std::prelude::v1::*; +use alloc::boxed::Box; +use alloc::string::String; +use alloc::vec::Vec; +use core::mem; use core::ops::{Deref, DerefMut}; use core::str; use crate::__wbindgen_copy_to_typed_array; use crate::cast::JsObject; -use crate::convert::OptionIntoWasmAbi; +use crate::convert::{js_value_vector_from_abi, js_value_vector_into_abi}; use crate::convert::{ - FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi, + FromWasmAbi, IntoWasmAbi, LongRefFromWasmAbi, OptionFromWasmAbi, OptionIntoWasmAbi, + RefFromWasmAbi, RefMutFromWasmAbi, VectorFromWasmAbi, VectorIntoWasmAbi, WasmAbi, }; -use crate::convert::{VectorFromWasmAbi, VectorIntoWasmAbi}; use crate::describe::*; -use cfg_if::cfg_if; +use crate::JsValue; -if_std! { - use core::mem; - use crate::convert::OptionFromWasmAbi; - use crate::convert::{js_value_vector_from_abi, js_value_vector_into_abi}; -} +use cfg_if::cfg_if; // note: `WasmAbi` types do not need to be FFI-safe themselves, it's just more // convenient to directly write `WasmSlice` in some of the manually-written FFI @@ -53,104 +53,100 @@ fn null_slice() -> WasmSlice { WasmSlice { ptr: 0, len: 0 } } -if_std! { - pub struct WasmMutSlice { - pub slice: WasmSlice, - pub idx: u32, - } +pub struct WasmMutSlice { + pub slice: WasmSlice, + pub idx: u32, +} - impl WasmAbi for WasmMutSlice { - /// `self.slice.ptr` - type Prim1 = u32; - /// `self.slice.len` - type Prim2 = u32; - /// `self.idx` - type Prim3 = u32; - type Prim4 = (); +impl WasmAbi for WasmMutSlice { + /// `self.slice.ptr` + type Prim1 = u32; + /// `self.slice.len` + type Prim2 = u32; + /// `self.idx` + type Prim3 = u32; + type Prim4 = (); - #[inline] - fn split(self) -> (u32, u32, u32, ()) { - (self.slice.ptr, self.slice.len, self.idx, ()) - } + #[inline] + fn split(self) -> (u32, u32, u32, ()) { + (self.slice.ptr, self.slice.len, self.idx, ()) + } - #[inline] - fn join(ptr: u32, len: u32, idx: u32, _: ()) -> Self { - Self { - slice: WasmSlice { ptr, len }, - idx, - } + #[inline] + fn join(ptr: u32, len: u32, idx: u32, _: ()) -> Self { + Self { + slice: WasmSlice { ptr, len }, + idx, } } +} - /// The representation of a mutable slice passed from JS to Rust. - pub struct MutSlice { - /// A copy of the data in the JS typed array. - contents: Box<[T]>, - /// A reference to the original JS typed array. - js: JsValue, - } +/// The representation of a mutable slice passed from JS to Rust. +pub struct MutSlice { + /// A copy of the data in the JS typed array. + contents: Box<[T]>, + /// A reference to the original JS typed array. + js: JsValue, +} - impl Drop for MutSlice { - fn drop(&mut self) { - unsafe { - __wbindgen_copy_to_typed_array( - self.contents.as_ptr() as *const u8, - self.contents.len() * mem::size_of::(), - self.js.idx - ); - } +impl Drop for MutSlice { + fn drop(&mut self) { + unsafe { + __wbindgen_copy_to_typed_array( + self.contents.as_ptr() as *const u8, + self.contents.len() * mem::size_of::(), + self.js.idx, + ); } } +} - impl Deref for MutSlice { - type Target = [T]; +impl Deref for MutSlice { + type Target = [T]; - fn deref(&self) -> &[T] { - &self.contents - } + fn deref(&self) -> &[T] { + &self.contents } +} - impl DerefMut for MutSlice { - fn deref_mut(&mut self) -> &mut [T] { - &mut self.contents - } +impl DerefMut for MutSlice { + fn deref_mut(&mut self) -> &mut [T] { + &mut self.contents } } macro_rules! vectors { ($($t:ident)*) => ($( - if_std! { - impl WasmDescribeVector for $t { - fn describe_vector() { - inform(VECTOR); - $t::describe(); - } + impl WasmDescribeVector for $t { + fn describe_vector() { + inform(VECTOR); + $t::describe(); } + } - impl VectorIntoWasmAbi for $t { - type Abi = WasmSlice; - - #[inline] - fn vector_into_abi(vector: Box<[$t]>) -> WasmSlice { - let ptr = vector.as_ptr(); - let len = vector.len(); - mem::forget(vector); - WasmSlice { - ptr: ptr.into_abi(), - len: len as u32, - } + impl VectorIntoWasmAbi for $t { + type Abi = WasmSlice; + + #[inline] + fn vector_into_abi(vector: Box<[$t]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); + WasmSlice { + ptr: ptr.into_abi(), + len: len as u32, } } + } - impl VectorFromWasmAbi for $t { - type Abi = WasmSlice; + impl VectorFromWasmAbi for $t { + type Abi = WasmSlice; - #[inline] - unsafe fn vector_from_abi(js: WasmSlice) -> Box<[$t]> { - let ptr = <*mut $t>::from_abi(js.ptr); - let len = js.len as usize; - Vec::from_raw_parts(ptr, len, len).into_boxed_slice() - } + #[inline] + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[$t]> { + let ptr = <*mut $t>::from_abi(js.ptr); + let len = js.len as usize; + Vec::from_raw_parts(ptr, len, len).into_boxed_slice() } } @@ -223,36 +219,34 @@ vectors! { u8 i8 u16 i16 u32 i32 u64 i64 usize isize f32 f64 } -if_std! { - impl WasmDescribeVector for String { - fn describe_vector() { - inform(VECTOR); - inform(NAMED_EXTERNREF); - // Trying to use an actual loop for this breaks the wasm interpreter. - inform(6); - inform('s' as u32); - inform('t' as u32); - inform('r' as u32); - inform('i' as u32); - inform('n' as u32); - inform('g' as u32); - } +impl WasmDescribeVector for String { + fn describe_vector() { + inform(VECTOR); + inform(NAMED_EXTERNREF); + // Trying to use an actual loop for this breaks the wasm interpreter. + inform(6); + inform('s' as u32); + inform('t' as u32); + inform('r' as u32); + inform('i' as u32); + inform('n' as u32); + inform('g' as u32); } +} - impl VectorIntoWasmAbi for String { - type Abi = as IntoWasmAbi>::Abi; +impl VectorIntoWasmAbi for String { + type Abi = as IntoWasmAbi>::Abi; - fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi { - js_value_vector_into_abi(vector) - } + fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi { + js_value_vector_into_abi(vector) } +} - impl VectorFromWasmAbi for String { - type Abi = as FromWasmAbi>::Abi; +impl VectorFromWasmAbi for String { + type Abi = as FromWasmAbi>::Abi; - unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]> { - js_value_vector_from_abi(js) - } + unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]> { + js_value_vector_from_abi(js) } } @@ -272,63 +266,81 @@ cfg_if! { } } -if_std! { - impl IntoWasmAbi for Vec where Box<[T]>: IntoWasmAbi { - type Abi = as IntoWasmAbi>::Abi; +impl IntoWasmAbi for Vec +where + Box<[T]>: IntoWasmAbi, +{ + type Abi = as IntoWasmAbi>::Abi; - #[inline] - fn into_abi(self) -> Self::Abi { - self.into_boxed_slice().into_abi() - } + #[inline] + fn into_abi(self) -> Self::Abi { + self.into_boxed_slice().into_abi() } +} - impl OptionIntoWasmAbi for Vec where Box<[T]>: IntoWasmAbi { - #[inline] - fn none() -> WasmSlice { null_slice() } +impl OptionIntoWasmAbi for Vec +where + Box<[T]>: IntoWasmAbi, +{ + #[inline] + fn none() -> WasmSlice { + null_slice() } +} - impl FromWasmAbi for Vec where Box<[T]>: FromWasmAbi { - type Abi = as FromWasmAbi>::Abi; +impl FromWasmAbi for Vec +where + Box<[T]>: FromWasmAbi, +{ + type Abi = as FromWasmAbi>::Abi; - #[inline] - unsafe fn from_abi(js: Self::Abi) -> Self { - >::from_abi(js).into() - } + #[inline] + unsafe fn from_abi(js: Self::Abi) -> Self { + >::from_abi(js).into() } +} - impl OptionFromWasmAbi for Vec where Box<[T]>: FromWasmAbi { - #[inline] - fn is_none(abi: &WasmSlice) -> bool { abi.ptr == 0 } +impl OptionFromWasmAbi for Vec +where + Box<[T]>: FromWasmAbi, +{ + #[inline] + fn is_none(abi: &WasmSlice) -> bool { + abi.ptr == 0 } +} - impl IntoWasmAbi for String { - type Abi = as IntoWasmAbi>::Abi; +impl IntoWasmAbi for String { + type Abi = as IntoWasmAbi>::Abi; - #[inline] - fn into_abi(self) -> Self::Abi { - // This is safe because the JsValue is immediately looked up in the heap and - // then returned, so use-after-free cannot occur. - unsafe_get_cached_str(&self).unwrap_or_else(|| self.into_bytes().into_abi()) - } + #[inline] + fn into_abi(self) -> Self::Abi { + // This is safe because the JsValue is immediately looked up in the heap and + // then returned, so use-after-free cannot occur. + unsafe_get_cached_str(&self).unwrap_or_else(|| self.into_bytes().into_abi()) } +} - impl OptionIntoWasmAbi for String { - #[inline] - fn none() -> Self::Abi { null_slice() } +impl OptionIntoWasmAbi for String { + #[inline] + fn none() -> Self::Abi { + null_slice() } +} - impl FromWasmAbi for String { - type Abi = as FromWasmAbi>::Abi; +impl FromWasmAbi for String { + type Abi = as FromWasmAbi>::Abi; - #[inline] - unsafe fn from_abi(js: Self::Abi) -> Self { - String::from_utf8_unchecked(>::from_abi(js)) - } + #[inline] + unsafe fn from_abi(js: Self::Abi) -> Self { + String::from_utf8_unchecked(>::from_abi(js)) } +} - impl OptionFromWasmAbi for String { - #[inline] - fn is_none(slice: &WasmSlice) -> bool { slice.ptr == 0 } +impl OptionFromWasmAbi for String { + #[inline] + fn is_none(slice: &WasmSlice) -> bool { + slice.ptr == 0 } } @@ -370,87 +382,98 @@ impl LongRefFromWasmAbi for str { } } -if_std! { - use crate::JsValue; - - impl IntoWasmAbi for Box<[T]> { - type Abi = ::Abi; +impl IntoWasmAbi for Box<[T]> { + type Abi = ::Abi; - fn into_abi(self) -> Self::Abi { - T::vector_into_abi(self) - } + fn into_abi(self) -> Self::Abi { + T::vector_into_abi(self) } +} - impl OptionIntoWasmAbi for Box<[T]> where Self: IntoWasmAbi { - fn none() -> WasmSlice { - null_slice() - } +impl OptionIntoWasmAbi for Box<[T]> +where + Self: IntoWasmAbi, +{ + fn none() -> WasmSlice { + null_slice() } +} - impl FromWasmAbi for Box<[T]> { - type Abi = ::Abi; +impl FromWasmAbi for Box<[T]> { + type Abi = ::Abi; - unsafe fn from_abi(js: Self::Abi) -> Self { - T::vector_from_abi(js) - } + unsafe fn from_abi(js: Self::Abi) -> Self { + T::vector_from_abi(js) } +} - impl OptionFromWasmAbi for Box<[T]> where Self: FromWasmAbi { - fn is_none(slice: &WasmSlice) -> bool { - slice.ptr == 0 - } +impl OptionFromWasmAbi for Box<[T]> +where + Self: FromWasmAbi, +{ + fn is_none(slice: &WasmSlice) -> bool { + slice.ptr == 0 } +} - impl VectorIntoWasmAbi for JsValue { - type Abi = WasmSlice; +impl VectorIntoWasmAbi for JsValue { + type Abi = WasmSlice; - #[inline] - fn vector_into_abi(vector: Box<[Self]>) -> WasmSlice { - let ptr = vector.as_ptr(); - let len = vector.len(); - mem::forget(vector); - WasmSlice { - ptr: ptr.into_abi(), - len: len as u32, - } + #[inline] + fn vector_into_abi(vector: Box<[Self]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); + WasmSlice { + ptr: ptr.into_abi(), + len: len as u32, } } +} - impl VectorFromWasmAbi for JsValue { - type Abi = WasmSlice; +impl VectorFromWasmAbi for JsValue { + type Abi = WasmSlice; - #[inline] - unsafe fn vector_from_abi(js: WasmSlice) -> Box<[Self]> { - let ptr = <*mut JsValue>::from_abi(js.ptr); - let len = js.len as usize; - Vec::from_raw_parts(ptr, len, len).into_boxed_slice() - } + #[inline] + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[Self]> { + let ptr = <*mut JsValue>::from_abi(js.ptr); + let len = js.len as usize; + Vec::from_raw_parts(ptr, len, len).into_boxed_slice() } +} - impl VectorIntoWasmAbi for T where T: JsObject { - type Abi = WasmSlice; +impl VectorIntoWasmAbi for T +where + T: JsObject, +{ + type Abi = WasmSlice; - #[inline] - fn vector_into_abi(vector: Box<[T]>) -> WasmSlice { - let ptr = vector.as_ptr(); - let len = vector.len(); - mem::forget(vector); - WasmSlice { - ptr: ptr.into_abi(), - len: len as u32, - } + #[inline] + fn vector_into_abi(vector: Box<[T]>) -> WasmSlice { + let ptr = vector.as_ptr(); + let len = vector.len(); + mem::forget(vector); + WasmSlice { + ptr: ptr.into_abi(), + len: len as u32, } } +} - impl VectorFromWasmAbi for T where T: JsObject { - type Abi = WasmSlice; +impl VectorFromWasmAbi for T +where + T: JsObject, +{ + type Abi = WasmSlice; - #[inline] - unsafe fn vector_from_abi(js: WasmSlice) -> Box<[T]> { - let ptr = <*mut JsValue>::from_abi(js.ptr); - let len = js.len as usize; - let vec: Vec = Vec::from_raw_parts(ptr, len, len).drain(..).map(|js_value| T::unchecked_from_js(js_value)).collect(); - vec.into_boxed_slice() - } + #[inline] + unsafe fn vector_from_abi(js: WasmSlice) -> Box<[T]> { + let ptr = <*mut JsValue>::from_abi(js.ptr); + let len = js.len as usize; + let vec: Vec = Vec::from_raw_parts(ptr, len, len) + .drain(..) + .map(|js_value| T::unchecked_from_js(js_value)) + .collect(); + vec.into_boxed_slice() } } diff --git a/src/convert/traits.rs b/src/convert/traits.rs index a32598abce8..547e9703a52 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -192,25 +192,23 @@ impl ReturnWasmAbi for T { } } -if_std! { - use core::marker::Sized; - use std::boxed::Box; +use alloc::boxed::Box; +use core::marker::Sized; - /// Trait for element types to implement IntoWasmAbi for vectors of - /// themselves. - pub trait VectorIntoWasmAbi: WasmDescribeVector + Sized { - type Abi: WasmAbi; +/// Trait for element types to implement IntoWasmAbi for vectors of +/// themselves. +pub trait VectorIntoWasmAbi: WasmDescribeVector + Sized { + type Abi: WasmAbi; - fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi; - } + fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi; +} - /// Trait for element types to implement FromWasmAbi for vectors of - /// themselves. - pub trait VectorFromWasmAbi: WasmDescribeVector + Sized { - type Abi: WasmAbi; +/// Trait for element types to implement FromWasmAbi for vectors of +/// themselves. +pub trait VectorFromWasmAbi: WasmDescribeVector + Sized { + type Abi: WasmAbi; - unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>; - } + unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>; } /// A repr(C) struct containing all of the primitives of a `WasmAbi` type, in diff --git a/src/describe.rs b/src/describe.rs index 140018a8097..58b02e17a22 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -3,6 +3,9 @@ #![doc(hidden)] +use alloc::boxed::Box; +use alloc::string::String; +use alloc::vec::Vec; use core::ptr::NonNull; use crate::{Clamped, JsError, JsObject, JsValue}; @@ -145,46 +148,45 @@ impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a mut T { } } -if_std! { - use std::prelude::v1::*; - - cfg_if! { - if #[cfg(feature = "enable-interning")] { - simple! { - String => CACHED_STRING - } +cfg_if! { + if #[cfg(feature = "enable-interning")] { + simple! { + String => CACHED_STRING + } - } else { - simple! { - String => STRING - } + } else { + simple! { + String => STRING } } +} - impl WasmDescribeVector for JsValue { - fn describe_vector() { - inform(VECTOR); - JsValue::describe(); - } +impl WasmDescribeVector for JsValue { + fn describe_vector() { + inform(VECTOR); + JsValue::describe(); } +} - impl WasmDescribeVector for T { - fn describe_vector() { - inform(VECTOR); - T::describe(); - } +impl WasmDescribeVector for T { + fn describe_vector() { + inform(VECTOR); + T::describe(); } +} - impl WasmDescribe for Box<[T]> { - fn describe() { - T::describe_vector(); - } +impl WasmDescribe for Box<[T]> { + fn describe() { + T::describe_vector(); } +} - impl WasmDescribe for Vec where Box<[T]>: WasmDescribe { - fn describe() { - >::describe(); - } +impl WasmDescribe for Vec +where + Box<[T]>: WasmDescribe, +{ + fn describe() { + >::describe(); } } diff --git a/src/externref.rs b/src/externref.rs index 7eeb7237904..b4c73e4405b 100644 --- a/src/externref.rs +++ b/src/externref.rs @@ -1,8 +1,9 @@ use crate::JsValue; -use std::cell::Cell; -use std::slice; -use std::vec::Vec; -use std::cmp::max; + +use alloc::slice; +use alloc::vec::Vec; +use core::cell::Cell; +use core::cmp::max; externs! { #[link(wasm_import_module = "__wbindgen_externref_xform__")] @@ -98,10 +99,19 @@ impl Slab { } fn internal_error(msg: &str) -> ! { - if cfg!(debug_assertions) { - super::throw_str(msg) - } else { - std::process::abort() + cfg_if::cfg_if! { + if #[cfg(debug_assertions)] { + super::throw_str(msg) + } else if #[cfg(feature = "std")] { + std::process::abort(); + } else if #[cfg(all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + ))] { + core::arch::wasm32::unreachable(); + } else { + unreachable!() + } } } @@ -160,7 +170,3 @@ pub unsafe extern "C" fn __externref_heap_live_count() -> u32 { }) .unwrap_or_else(|_| internal_error("tls access failure")) } - -// see comment in module above this in `link_mem_intrinsics` -#[inline(never)] -pub fn link_intrinsics() {} diff --git a/src/lib.rs b/src/lib.rs index babb913bf4e..ec8a847933a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,12 @@ #![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] +extern crate alloc; + +use alloc::boxed::Box; +use alloc::string::String; +use alloc::vec::Vec; use core::convert::TryFrom; -use core::fmt; use core::marker; use core::mem; use core::ops::{ @@ -50,6 +54,7 @@ macro_rules! externs { /// use wasm_bindgen::prelude::*; /// ``` pub mod prelude { + pub use crate::closure::Closure; pub use crate::JsCast; pub use crate::JsValue; pub use crate::UnwrapThrowExt; @@ -57,17 +62,15 @@ pub mod prelude { pub use wasm_bindgen_macro::__wasm_bindgen_class_marker; pub use wasm_bindgen_macro::wasm_bindgen; - if_std! { - pub use crate::closure::Closure; - } - pub use crate::JsError; } pub use wasm_bindgen_macro::link_to; +pub mod closure; pub mod convert; pub mod describe; +mod link; mod cast; pub use crate::cast::{JsCast, JsObject}; @@ -75,9 +78,7 @@ pub use crate::cast::{JsCast, JsObject}; if_std! { extern crate std; use std::prelude::v1::*; - pub mod closure; mod externref; - mod cache; pub use cache::intern::{intern, unintern}; } @@ -293,7 +294,6 @@ impl JsValue { /// caveats about the encodings. /// /// [caveats]: https://rustwasm.github.io/docs/wasm-bindgen/reference/types/str.html - #[cfg(feature = "std")] #[inline] pub fn as_string(&self) -> Option { unsafe { FromWasmAbi::from_abi(__wbindgen_string_get(self.idx)) } @@ -512,18 +512,16 @@ impl<'a> PartialEq<&'a str> for JsValue { } } -if_std! { - impl PartialEq for JsValue { - #[inline] - fn eq(&self, other: &String) -> bool { - >::eq(self, other) - } +impl PartialEq for JsValue { + #[inline] + fn eq(&self, other: &String) -> bool { + >::eq(self, other) } - impl<'a> PartialEq<&'a String> for JsValue { - #[inline] - fn eq(&self, other: &&'a String) -> bool { - >::eq(self, other) - } +} +impl<'a> PartialEq<&'a String> for JsValue { + #[inline] + fn eq(&self, other: &&'a String) -> bool { + >::eq(self, other) } } @@ -797,40 +795,38 @@ impl From> for JsValue { } } -if_std! { - impl<'a> From<&'a String> for JsValue { - #[inline] - fn from(s: &'a String) -> JsValue { - JsValue::from_str(s) - } +impl<'a> From<&'a String> for JsValue { + #[inline] + fn from(s: &'a String) -> JsValue { + JsValue::from_str(s) } +} - impl From for JsValue { - #[inline] - fn from(s: String) -> JsValue { - JsValue::from_str(&s) - } +impl From for JsValue { + #[inline] + fn from(s: String) -> JsValue { + JsValue::from_str(&s) } +} - impl TryFrom for String { - type Error = JsValue; +impl TryFrom for String { + type Error = JsValue; - fn try_from(value: JsValue) -> Result { - match value.as_string() { - Some(s) => Ok(s), - None => Err(value), - } + fn try_from(value: JsValue) -> Result { + match value.as_string() { + Some(s) => Ok(s), + None => Err(value), } } +} - impl TryFromJsValue for String { - type Error = JsValue; +impl TryFromJsValue for String { + type Error = JsValue; - fn try_from_js_value(value: JsValue) -> Result { - match value.as_string() { - Some(s) => Ok(s), - None => Err(value), - } + fn try_from_js_value(value: JsValue) -> Result { + match value.as_string() { + Some(s) => Ok(s), + None => Err(value), } } } @@ -1132,15 +1128,15 @@ impl Clone for JsValue { } #[cfg(feature = "std")] -impl fmt::Debug for JsValue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +impl core::fmt::Debug for JsValue { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "JsValue({})", self.as_debug_string()) } } #[cfg(not(feature = "std"))] -impl fmt::Debug for JsValue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +impl core::fmt::Debug for JsValue { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { f.write_str("JsValue") } } @@ -1345,7 +1341,7 @@ pub trait UnwrapThrowExt: Sized { fn unwrap_throw(self) -> T { if cfg!(all(debug_assertions, feature = "std")) { let loc = core::panic::Location::caller(); - let msg = std::format!( + let msg = alloc::format!( "`unwrap_throw` failed ({}:{}:{})", loc.file(), loc.line(), @@ -1430,12 +1426,18 @@ pub mod __rt { use core::borrow::{Borrow, BorrowMut}; use core::cell::{Cell, UnsafeCell}; use core::convert::Infallible; + use core::mem; use core::ops::{Deref, DerefMut}; + pub extern crate alloc; pub extern crate core; #[cfg(feature = "std")] pub extern crate std; + use alloc::alloc::{alloc, dealloc, realloc, Layout}; + use alloc::boxed::Box; + use alloc::rc::Rc; + #[macro_export] #[doc(hidden)] #[cfg(feature = "std")] @@ -1609,151 +1611,157 @@ pub mod __rt { ); } - if_std! { - use std::rc::Rc; - - /// A type that encapsulates an `Rc>` as well as a `Ref` - /// to the contents of that `WasmRefCell`. - /// - /// The `'static` requirement is an unfortunate consequence of how this - /// is implemented. - pub struct RcRef { - // The 'static is a lie. - // - // We could get away without storing this, since we're in the same module as - // `WasmRefCell` and can directly manipulate its `borrow`, but I'm considering - // turning it into a wrapper around `std`'s `RefCell` to reduce `unsafe` in - // which case that would stop working. This also requires less `unsafe` as is. - // - // It's important that this goes before `Rc` so that it gets dropped first. - ref_: Ref<'static, T>, - _rc: Rc>, - } - - impl RcRef { - pub fn new(rc: Rc>) -> Self { - let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow() }; - Self { _rc: rc, ref_ } - } + /// A type that encapsulates an `Rc>` as well as a `Ref` + /// to the contents of that `WasmRefCell`. + /// + /// The `'static` requirement is an unfortunate consequence of how this + /// is implemented. + pub struct RcRef { + // The 'static is a lie. + // + // We could get away without storing this, since we're in the same module as + // `WasmRefCell` and can directly manipulate its `borrow`, but I'm considering + // turning it into a wrapper around `std`'s `RefCell` to reduce `unsafe` in + // which case that would stop working. This also requires less `unsafe` as is. + // + // It's important that this goes before `Rc` so that it gets dropped first. + ref_: Ref<'static, T>, + _rc: Rc>, + } + + impl RcRef { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow() }; + Self { _rc: rc, ref_ } } + } - impl Deref for RcRef { - type Target = T; + impl Deref for RcRef { + type Target = T; - #[inline] - fn deref(&self) -> &T { - &self.ref_ - } + #[inline] + fn deref(&self) -> &T { + &self.ref_ } + } - impl Borrow for RcRef { - #[inline] - fn borrow(&self) -> &T { - &self.ref_ - } + impl Borrow for RcRef { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ } + } - /// A type that encapsulates an `Rc>` as well as a - /// `RefMut` to the contents of that `WasmRefCell`. - /// - /// The `'static` requirement is an unfortunate consequence of how this - /// is implemented. - pub struct RcRefMut { - ref_: RefMut<'static, T>, - _rc: Rc>, - } + /// A type that encapsulates an `Rc>` as well as a + /// `RefMut` to the contents of that `WasmRefCell`. + /// + /// The `'static` requirement is an unfortunate consequence of how this + /// is implemented. + pub struct RcRefMut { + ref_: RefMut<'static, T>, + _rc: Rc>, + } - impl RcRefMut { - pub fn new(rc: Rc>) -> Self { - let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow_mut() }; - Self { _rc: rc, ref_ } - } + impl RcRefMut { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow_mut() }; + Self { _rc: rc, ref_ } } + } - impl Deref for RcRefMut { - type Target = T; + impl Deref for RcRefMut { + type Target = T; - #[inline] - fn deref(&self) -> &T { - &self.ref_ - } + #[inline] + fn deref(&self) -> &T { + &self.ref_ } + } - impl DerefMut for RcRefMut { - #[inline] - fn deref_mut(&mut self) -> &mut T { - &mut self.ref_ - } + impl DerefMut for RcRefMut { + #[inline] + fn deref_mut(&mut self) -> &mut T { + &mut self.ref_ } + } - impl Borrow for RcRefMut { - #[inline] - fn borrow(&self) -> &T { - &self.ref_ - } + impl Borrow for RcRefMut { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ } + } - impl BorrowMut for RcRefMut { - #[inline] - fn borrow_mut(&mut self) -> &mut T { - &mut self.ref_ - } + impl BorrowMut for RcRefMut { + #[inline] + fn borrow_mut(&mut self) -> &mut T { + &mut self.ref_ } } - if_std! { - use std::alloc::{alloc, dealloc, realloc, Layout}; - - #[no_mangle] - pub extern "C" fn __wbindgen_malloc(size: usize, align: usize) -> *mut u8 { - if let Ok(layout) = Layout::from_size_align(size, align) { - unsafe { - if layout.size() > 0 { - let ptr = alloc(layout); - if !ptr.is_null() { - return ptr - } - } else { - return align as *mut u8 + #[no_mangle] + pub extern "C" fn __wbindgen_malloc(size: usize, align: usize) -> *mut u8 { + if let Ok(layout) = Layout::from_size_align(size, align) { + unsafe { + if layout.size() > 0 { + let ptr = alloc(layout); + if !ptr.is_null() { + return ptr; } + } else { + return align as *mut u8; } } - - malloc_failure(); } - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_realloc(ptr: *mut u8, old_size: usize, new_size: usize, align: usize) -> *mut u8 { - debug_assert!(old_size > 0); - debug_assert!(new_size > 0); - if let Ok(layout) = Layout::from_size_align(old_size, align) { - let ptr = realloc(ptr, layout, new_size); - if !ptr.is_null() { - return ptr - } + malloc_failure(); + } + + #[no_mangle] + pub unsafe extern "C" fn __wbindgen_realloc( + ptr: *mut u8, + old_size: usize, + new_size: usize, + align: usize, + ) -> *mut u8 { + debug_assert!(old_size > 0); + debug_assert!(new_size > 0); + if let Ok(layout) = Layout::from_size_align(old_size, align) { + let ptr = realloc(ptr, layout, new_size); + if !ptr.is_null() { + return ptr; } - malloc_failure(); } + malloc_failure(); + } - #[cold] - fn malloc_failure() -> ! { - if cfg!(debug_assertions) { + #[cold] + fn malloc_failure() -> ! { + cfg_if::cfg_if! { + if #[cfg(debug_assertions)] { super::throw_str("invalid malloc request") - } else { + } else if #[cfg(feature = "std")] { std::process::abort(); + } else if #[cfg(all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + ))] { + core::arch::wasm32::unreachable(); + } else { + unreachable!() } } + } - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_free(ptr: *mut u8, size: usize, align: usize) { - // This happens for zero-length slices, and in that case `ptr` is - // likely bogus so don't actually send this to the system allocator - if size == 0 { - return - } - let layout = Layout::from_size_align_unchecked(size, align); - dealloc(ptr, layout); + #[no_mangle] + pub unsafe extern "C" fn __wbindgen_free(ptr: *mut u8, size: usize, align: usize) { + // This happens for zero-length slices, and in that case `ptr` is + // likely bogus so don't actually send this to the system allocator + if size == 0 { + return; } + let layout = Layout::from_size_align_unchecked(size, align); + dealloc(ptr, layout); } /// This is a curious function necessary to get wasm-bindgen working today, @@ -1790,31 +1798,33 @@ pub mod __rt { /// /// Ideas for how to improve this are most welcome! pub fn link_mem_intrinsics() { - crate::externref::link_intrinsics(); - } - - std::thread_local! { - static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + crate::link::link_intrinsics(); } - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { - GLOBAL_EXNDATA.with(|data| { - debug_assert_eq!(data.get()[0], 0); - data.set([1, idx]); - }); - } + if_std! { + std::thread_local! { + static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + } - pub fn take_last_exception() -> Result<(), super::JsValue> { - GLOBAL_EXNDATA.with(|data| { - let ret = if data.get()[0] == 1 { - Err(super::JsValue::_new(data.get()[1])) - } else { - Ok(()) - }; - data.set([0, 0]); - ret - }) + #[no_mangle] + pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { + GLOBAL_EXNDATA.with(|data| { + debug_assert_eq!(data.get()[0], 0); + data.set([1, idx]); + }); + } + + pub fn take_last_exception() -> Result<(), super::JsValue> { + GLOBAL_EXNDATA.with(|data| { + let ret = if data.get()[0] == 1 { + Err(super::JsValue::_new(data.get()[1])) + } else { + Ok(()) + }; + data.set([0, 0]); + ret + }) + } } /// An internal helper trait for usage in `#[wasm_bindgen]` on `async` @@ -1902,11 +1912,11 @@ pub mod __rt { } } - impl Main for &mut MainWrapper> { + impl Main for &mut MainWrapper> { #[inline] fn __wasm_bindgen_main(&mut self) { if let Err(e) = self.0.take().unwrap() { - crate::throw_str(&std::format!("{:?}", e)); + crate::throw_str(&alloc::format!("{:?}", e)); } } } @@ -1957,33 +1967,28 @@ pub mod __rt { result } - if_std! { - use core::mem; - use std::boxed::Box; - - /// Trait for element types to implement `Into` for vectors of - /// themselves, which isn't possible directly thanks to the orphan rule. - pub trait VectorIntoJsValue: Sized { - fn vector_into_jsvalue(vector: Box<[Self]>) -> JsValue; - } + /// Trait for element types to implement `Into` for vectors of + /// themselves, which isn't possible directly thanks to the orphan rule. + pub trait VectorIntoJsValue: Sized { + fn vector_into_jsvalue(vector: Box<[Self]>) -> JsValue; + } - impl From> for JsValue { - fn from(vector: Box<[T]>) -> Self { - T::vector_into_jsvalue(vector) - } + impl From> for JsValue { + fn from(vector: Box<[T]>) -> Self { + T::vector_into_jsvalue(vector) } + } - pub fn js_value_vector_into_jsvalue>(vector: Box<[T]>) -> JsValue { - let result = unsafe { JsValue::_new(super::__wbindgen_array_new()) }; - for value in vector.into_vec() { - let js: JsValue = value.into(); - unsafe { super::__wbindgen_array_push(result.idx, js.idx) } - // `__wbindgen_array_push` takes ownership over `js` and has already dropped it, - // so don't drop it again. - mem::forget(js); - } - result + pub fn js_value_vector_into_jsvalue>(vector: Box<[T]>) -> JsValue { + let result = unsafe { JsValue::_new(super::__wbindgen_array_new()) }; + for value in vector.into_vec() { + let js: JsValue = value.into(); + unsafe { super::__wbindgen_array_push(result.idx, js.idx) } + // `__wbindgen_array_push` takes ownership over `js` and has already dropped it, + // so don't drop it again. + mem::forget(js); } + result } } @@ -2105,74 +2110,72 @@ impl From for JsValue { } macro_rules! typed_arrays { - ($($ty:ident $ctor:ident $clamped_ctor:ident,)*) => { - $( - impl From> for JsValue { - fn from(mut vector: Box<[$ty]>) -> Self { - let result = unsafe { JsValue::_new($ctor(vector.as_mut_ptr(), vector.len())) }; - mem::forget(vector); - result + ($($ty:ident $ctor:ident $clamped_ctor:ident,)*) => { + $( + impl From> for JsValue { + fn from(mut vector: Box<[$ty]>) -> Self { + let result = unsafe { JsValue::_new($ctor(vector.as_mut_ptr(), vector.len())) }; + mem::forget(vector); + result + } } - } - impl From>> for JsValue { - fn from(mut vector: Clamped>) -> Self { - let result = unsafe { JsValue::_new($clamped_ctor(vector.as_mut_ptr(), vector.len())) }; - mem::forget(vector); - result + impl From>> for JsValue { + fn from(mut vector: Clamped>) -> Self { + let result = unsafe { JsValue::_new($clamped_ctor(vector.as_mut_ptr(), vector.len())) }; + mem::forget(vector); + result + } } - } - )* - }; -} - -if_std! { - typed_arrays! { - u8 __wbindgen_uint8_array_new __wbindgen_uint8_clamped_array_new, - u16 __wbindgen_uint16_array_new __wbindgen_uint16_array_new, - u32 __wbindgen_uint32_array_new __wbindgen_uint32_array_new, - u64 __wbindgen_biguint64_array_new __wbindgen_biguint64_array_new, - i8 __wbindgen_int8_array_new __wbindgen_int8_array_new, - i16 __wbindgen_int16_array_new __wbindgen_int16_array_new, - i32 __wbindgen_int32_array_new __wbindgen_int32_array_new, - i64 __wbindgen_bigint64_array_new __wbindgen_bigint64_array_new, - f32 __wbindgen_float32_array_new __wbindgen_float32_array_new, - f64 __wbindgen_float64_array_new __wbindgen_float64_array_new, + )* + }; } - impl __rt::VectorIntoJsValue for JsValue { - fn vector_into_jsvalue(vector: Box<[JsValue]>) -> JsValue { - __rt::js_value_vector_into_jsvalue::(vector) - } +typed_arrays! { + u8 __wbindgen_uint8_array_new __wbindgen_uint8_clamped_array_new, + u16 __wbindgen_uint16_array_new __wbindgen_uint16_array_new, + u32 __wbindgen_uint32_array_new __wbindgen_uint32_array_new, + u64 __wbindgen_biguint64_array_new __wbindgen_biguint64_array_new, + i8 __wbindgen_int8_array_new __wbindgen_int8_array_new, + i16 __wbindgen_int16_array_new __wbindgen_int16_array_new, + i32 __wbindgen_int32_array_new __wbindgen_int32_array_new, + i64 __wbindgen_bigint64_array_new __wbindgen_bigint64_array_new, + f32 __wbindgen_float32_array_new __wbindgen_float32_array_new, + f64 __wbindgen_float64_array_new __wbindgen_float64_array_new, +} + +impl __rt::VectorIntoJsValue for JsValue { + fn vector_into_jsvalue(vector: Box<[JsValue]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) } +} - impl __rt::VectorIntoJsValue for T { - fn vector_into_jsvalue(vector: Box<[T]>) -> JsValue { - __rt::js_value_vector_into_jsvalue::(vector) - } +impl __rt::VectorIntoJsValue for T { + fn vector_into_jsvalue(vector: Box<[T]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) } +} - impl __rt::VectorIntoJsValue for String { - fn vector_into_jsvalue(vector: Box<[String]>) -> JsValue { - __rt::js_value_vector_into_jsvalue::(vector) - } +impl __rt::VectorIntoJsValue for String { + fn vector_into_jsvalue(vector: Box<[String]>) -> JsValue { + __rt::js_value_vector_into_jsvalue::(vector) } +} - impl From> for JsValue - where - JsValue: From>, - { - fn from(vector: Vec) -> Self { - JsValue::from(vector.into_boxed_slice()) - } +impl From> for JsValue +where + JsValue: From>, +{ + fn from(vector: Vec) -> Self { + JsValue::from(vector.into_boxed_slice()) } +} - impl From>> for JsValue - where - JsValue: From>>, - { - fn from(vector: Clamped>) -> Self { - JsValue::from(Clamped(vector.0.into_boxed_slice())) - } +impl From>> for JsValue +where + JsValue: From>>, +{ + fn from(vector: Clamped>) -> Self { + JsValue::from(Clamped(vector.0.into_boxed_slice())) } } diff --git a/src/link.rs b/src/link.rs new file mode 100644 index 00000000000..aa75707700e --- /dev/null +++ b/src/link.rs @@ -0,0 +1,3 @@ +// see comment in module above this in `link_mem_intrinsics` +#[inline(never)] +pub fn link_intrinsics() {} From f423bd9bae0bcfc704ec5ba0f21ede29816ca53f Mon Sep 17 00:00:00 2001 From: Elijah <83283675+tltsutltsu@users.noreply.github.com> Date: Mon, 29 Jul 2024 04:04:12 +0500 Subject: [PATCH 431/641] feat: add `deviceMemory` to Navigator IDL (#4011) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_Navigator.rs | 11 +++++++++++ crates/web-sys/src/features/gen_WorkerNavigator.rs | 11 +++++++++++ crates/web-sys/webidls/unstable/DeviceMemory.webidl | 11 +++++++++++ 4 files changed, 36 insertions(+) create mode 100644 crates/web-sys/webidls/unstable/DeviceMemory.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index d094b0daa59..87971ba8c2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,9 @@ * Added the `thread_stack_size` property to the object parameter of `default()` (`init()`) and `initSync()`, making it possible to set the stack size of spawned threads. `__wbindgen_thread_destroy()` now has a third optional parameter for the stack size, the default stack size is assumed when not passing it. When calling from the thread to be destroyed, by passing no parameters, the correct stack size is determined internally. [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) +* Added bindings to the Device Memory API. + [#4011](https://github.com/rustwasm/wasm-bindgen/pull/4011) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 8b28f73df54..c084077cff4 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -225,6 +225,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] pub fn hardware_concurrency(this: &Navigator) -> f64; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = deviceMemory)] + #[doc = "Getter for the `deviceMemory` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn device_memory(this: &Navigator) -> f64; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Gpu")] # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = gpu)] #[doc = "Getter for the `gpu` field of this object."] diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index aacffd95736..9fbedbbbfbb 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -60,6 +60,17 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] pub fn hardware_concurrency(this: &WorkerNavigator) -> f64; #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = deviceMemory)] + #[doc = "Getter for the `deviceMemory` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/deviceMemory)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn device_memory(this: &WorkerNavigator) -> f64; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Gpu")] # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = gpu)] #[doc = "Getter for the `gpu` field of this object."] diff --git a/crates/web-sys/webidls/unstable/DeviceMemory.webidl b/crates/web-sys/webidls/unstable/DeviceMemory.webidl new file mode 100644 index 00000000000..5baf308361a --- /dev/null +++ b/crates/web-sys/webidls/unstable/DeviceMemory.webidl @@ -0,0 +1,11 @@ +// https://www.w3.org/TR/2022/WD-device-memory-1-20220722 + +[ + SecureContext, + Exposed=(Window,Worker) +] interface mixin NavigatorDeviceMemory { + readonly attribute double deviceMemory; +}; + +Navigator includes NavigatorDeviceMemory; +WorkerNavigator includes NavigatorDeviceMemory; From 7f3c21b9e24b90502e858ba91d7f3aeab0ce7dbe Mon Sep 17 00:00:00 2001 From: Simon Niedermayr <14186588+KeKsBoTer@users.noreply.github.com> Date: Mon, 29 Jul 2024 01:07:02 +0200 Subject: [PATCH 432/641] Update `env_logger` to v0.11 (#4018) --- crates/cli/Cargo.toml | 2 +- crates/webidl/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 8872c8b2797..b4f1b2c7885 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -21,7 +21,7 @@ bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" [dependencies] docopt = "1.0" -env_logger = "0.8" +env_logger = "0.11.5" anyhow = "1.0" log = "0.4" native-tls = { version = "0.2", default-features = false, optional = true } diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 3f3663ef2a6..91bb047a7c1 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -14,7 +14,7 @@ edition = "2018" rust-version = "1.57" [dependencies] -env_logger = "0.8.1" +env_logger = "0.11.5" anyhow = "1.0" heck = "0.3" log = "0.4.1" From a2761f66ec5174e084b5152a428e04ef22071dd5 Mon Sep 17 00:00:00 2001 From: magic-akari Date: Mon, 29 Jul 2024 16:21:56 +0800 Subject: [PATCH 433/641] Fix byte order for big-endian platforms (#4015) Co-authored-by: daxpedda --- CHANGELOG.md | 3 ++ crates/cli-support/src/js/binding.rs | 30 ++++++----- crates/cli-support/src/js/mod.rs | 50 +++++++++++-------- .../tests/reference/anyref-import-catch.js | 26 +++++----- crates/cli/tests/reference/builder.js | 12 ++--- crates/cli/tests/reference/constructor.js | 12 ++--- crates/cli/tests/reference/enums.js | 12 ++--- crates/cli/tests/reference/import-catch.js | 14 +++--- crates/cli/tests/reference/result-string.js | 30 +++++------ crates/cli/tests/reference/string-arg.js | 18 +++---- 10 files changed, 111 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87971ba8c2b..9e3864eca31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,9 @@ * Fix `no_std` support and therefor compiling with `default-features = false`. [#4005](https://github.com/rustwasm/wasm-bindgen/pull/4005) +* Fix byte order for big-endian platforms. + [#4015](https://github.com/rustwasm/wasm-bindgen/pull/4015) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index dfbd28b8b2f..a2950cd403b 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -784,19 +784,21 @@ fn instruction( } Instruction::StoreRetptr { ty, offset, mem } => { - let (mem, size) = match ty { - AdapterType::I32 => (js.cx.expose_int32_memory(*mem), 4), - AdapterType::I64 => (js.cx.expose_int64_memory(*mem), 8), - AdapterType::F32 => (js.cx.expose_f32_memory(*mem), 4), - AdapterType::F64 => (js.cx.expose_f64_memory(*mem), 8), + let mem = js.cx.expose_dataview_memory(*mem); + let (method, size) = match ty { + AdapterType::I32 => ("setInt32", 4), + AdapterType::I64 => ("setBigInt64", 8), + AdapterType::F32 => ("setFloat32", 4), + AdapterType::F64 => ("setFloat64", 8), other => bail!("invalid aggregate return type {:?}", other), }; // Note that we always assume the return pointer is argument 0, // which is currently the case for LLVM. let val = js.pop(); let expr = format!( - "{}()[{} / {} + {}] = {};", + "{}().{}({} + {} * {}, {}, true);", mem, + method, js.arg(0), size, offset, @@ -806,11 +808,12 @@ fn instruction( } Instruction::LoadRetptr { ty, offset, mem } => { - let (mem, quads) = match ty { - AdapterType::I32 => (js.cx.expose_int32_memory(*mem), 1), - AdapterType::I64 => (js.cx.expose_int64_memory(*mem), 2), - AdapterType::F32 => (js.cx.expose_f32_memory(*mem), 1), - AdapterType::F64 => (js.cx.expose_f64_memory(*mem), 2), + let mem = js.cx.expose_dataview_memory(*mem); + let (method, quads) = match ty { + AdapterType::I32 => ("getInt32", 1), + AdapterType::I64 => ("getBigInt64", 2), + AdapterType::F32 => ("getFloat32", 1), + AdapterType::F64 => ("getFloat64", 2), other => bail!("invalid aggregate return type {:?}", other), }; let size = quads * 4; @@ -820,7 +823,10 @@ fn instruction( // If we're loading from the return pointer then we must have pushed // it earlier, and we always push the same value, so load that value // here - let expr = format!("{}()[retptr / {} + {}]", mem, size, scaled_offset); + let expr = format!( + "{}().{}(retptr + {} * {}, true)", + mem, method, size, scaled_offset + ); js.prelude(&format!("var r{} = {};", offset, expr)); js.push(format!("r{}", offset)); } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index bff177c662f..56c1f12ebf1 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1392,7 +1392,7 @@ impl<'a> Context<'a> { } fn expose_pass_array_jsvalue_to_wasm(&mut self, memory: MemoryId) -> Result { - let mem = self.expose_uint32_memory(memory); + let mem = self.expose_dataview_memory(memory); let ret = MemView { name: "passArrayJsValueToWasm".into(), num: mem.num, @@ -1412,7 +1412,7 @@ impl<'a> Context<'a> { const ptr = malloc(array.length * 4, 4) >>> 0; const mem = {}(); for (let i = 0; i < array.length; i++) {{ - mem[ptr / 4 + i] = {}(array[i]); + mem.setUint32(ptr + 4 * i, {}(array[i]), true); }} WASM_VECTOR_LEN = array.length; return ptr; @@ -1429,7 +1429,7 @@ impl<'a> Context<'a> { const ptr = malloc(array.length * 4, 4) >>> 0; const mem = {}(); for (let i = 0; i < array.length; i++) {{ - mem[ptr / 4 + i] = addHeapObject(array[i]); + mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true); }} WASM_VECTOR_LEN = array.length; return ptr; @@ -1639,7 +1639,7 @@ impl<'a> Context<'a> { } fn expose_get_array_js_value_from_wasm(&mut self, memory: MemoryId) -> Result { - let mem = self.expose_uint32_memory(memory); + let mem = self.expose_dataview_memory(memory); let ret = MemView { name: "getArrayJsValueFromWasm".into(), num: mem.num, @@ -1656,10 +1656,9 @@ impl<'a> Context<'a> { function {}(ptr, len) {{ ptr = ptr >>> 0; const mem = {}(); - const slice = mem.subarray(ptr / 4, ptr / 4 + len); const result = []; - for (let i = 0; i < slice.length; i++) {{ - result.push(wasm.{}.get(slice[i])); + for (let i = ptr; i < ptr + 4 * len; i += 4) {{ + result.push(wasm.{}.get(mem.getUint32(i, true))); }} wasm.{}(ptr, len); return result; @@ -1675,10 +1674,9 @@ impl<'a> Context<'a> { function {}(ptr, len) {{ ptr = ptr >>> 0; const mem = {}(); - const slice = mem.subarray(ptr / 4, ptr / 4 + len); const result = []; - for (let i = 0; i < slice.length; i++) {{ - result.push(takeObject(slice[i])); + for (let i = ptr; i < ptr + 4 * len; i += 4) {{ + result.push(takeObject(mem.getUint32(i, true))); }} return result; }} @@ -1768,47 +1766,51 @@ impl<'a> Context<'a> { } fn expose_int8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Int8", memory) + self.memview("Int8Array", memory) } fn expose_uint8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Uint8", memory) + self.memview("Uint8Array", memory) } fn expose_clamped_uint8_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Uint8Clamped", memory) + self.memview("Uint8ClampedArray", memory) } fn expose_int16_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Int16", memory) + self.memview("Int16Array", memory) } fn expose_uint16_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Uint16", memory) + self.memview("Uint16Array", memory) } fn expose_int32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Int32", memory) + self.memview("Int32Array", memory) } fn expose_uint32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Uint32", memory) + self.memview("Uint32Array", memory) } fn expose_int64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("BigInt64", memory) + self.memview("BigInt64Array", memory) } fn expose_uint64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("BigUint64", memory) + self.memview("BigUint64Array", memory) } fn expose_f32_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Float32", memory) + self.memview("Float32Array", memory) } fn expose_f64_memory(&mut self, memory: MemoryId) -> MemView { - self.memview("Float64", memory) + self.memview("Float64Array", memory) + } + + fn expose_dataview_memory(&mut self, memory: MemoryId) -> MemView { + self.memview("DataView", memory) } fn memview(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView { @@ -1829,6 +1831,10 @@ impl<'a> Context<'a> { cache = cache, mem = mem ) + } else if kind == "DataView" { + // `DataView`s throw when accessing detached memory, including `byteLength`. + // However this requires JS engine support, so we fallback to comparing the buffer. + format!("{cache}.buffer.detached === true || ({cache}.buffer.detached === undefined && {cache}.buffer !== wasm.{mem}.buffer)", cache = cache) } else { // Otherwise, we can do a quicker check of whether the buffer's been detached, // which is indicated by a length of 0. @@ -1841,7 +1847,7 @@ impl<'a> Context<'a> { " function {name}() {{ if ({cache} === null || {resized_check}) {{ - {cache} = new {kind}Array(wasm.{mem}.buffer); + {cache} = new {kind}(wasm.{mem}.buffer); }} return {cache}; }} diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index f7727f5e627..9fb5c31b135 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -10,18 +10,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } function addToExternrefTable0(obj) { @@ -39,13 +39,13 @@ function handleError(f, args) { } } -let cachedInt32Memory0 = null; +let cachedDataViewMemory0 = null; -function getInt32Memory0() { - if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { - cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); } - return cachedInt32Memory0; + return cachedDataViewMemory0; } function takeFromExternrefTable0(idx) { @@ -59,8 +59,8 @@ export function exported() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.exported(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); if (r1) { throw takeFromExternrefTable0(r0); } diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js index f31735af193..b491793222a 100644 --- a/crates/cli/tests/reference/builder.js +++ b/crates/cli/tests/reference/builder.js @@ -10,18 +10,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } const ClassBuilderFinalization = (typeof FinalizationRegistry === 'undefined') diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js index 3f096f76657..ffac02b997a 100644 --- a/crates/cli/tests/reference/constructor.js +++ b/crates/cli/tests/reference/constructor.js @@ -10,18 +10,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } const ClassConstructorFinalization = (typeof FinalizationRegistry === 'undefined') diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 4a0ea680071..c7446efaa24 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -10,18 +10,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } /** * @param {Color} color diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index f587b8346c3..ad340f07bbd 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -27,13 +27,13 @@ function handleError(f, args) { } } -let cachedInt32Memory0 = null; +let cachedDataViewMemory0 = null; -function getInt32Memory0() { - if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { - cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); } - return cachedInt32Memory0; + return cachedDataViewMemory0; } function getObject(idx) { return heap[idx]; } @@ -55,8 +55,8 @@ export function exported() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.exported(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); if (r1) { throw takeObject(r0); } diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index a0795b44d4d..6d3c47f400b 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -19,13 +19,13 @@ function addHeapObject(obj) { return idx; } -let cachedInt32Memory0 = null; +let cachedDataViewMemory0 = null; -function getInt32Memory0() { - if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { - cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); } - return cachedInt32Memory0; + return cachedDataViewMemory0; } function getObject(idx) { return heap[idx]; } @@ -48,18 +48,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } /** * @returns {string} @@ -70,10 +70,10 @@ export function exported() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); wasm.exported(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - var r3 = getInt32Memory0()[retptr / 4 + 3]; + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); var ptr1 = r0; var len1 = r1; if (r3) { diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index 7ce1a4db2f3..62d6ce47201 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -10,18 +10,18 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true cachedTextDecoder.decode(); -let cachedUint8Memory0 = null; +let cachedUint8ArrayMemory0 = null; -function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } - return cachedUint8Memory0; + return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } let WASM_VECTOR_LEN = 0; @@ -48,7 +48,7 @@ function passStringToWasm0(arg, malloc, realloc) { if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length, 1) >>> 0; - getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } @@ -56,7 +56,7 @@ function passStringToWasm0(arg, malloc, realloc) { let len = arg.length; let ptr = malloc(len, 1) >>> 0; - const mem = getUint8Memory0(); + const mem = getUint8ArrayMemory0(); let offset = 0; @@ -71,7 +71,7 @@ function passStringToWasm0(arg, malloc, realloc) { arg = arg.slice(offset); } ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; - const view = getUint8Memory0().subarray(ptr + offset, ptr + len); + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; From 34858e15e0f44511e7050c5ba4f1499ab6814b28 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 29 Jul 2024 18:58:30 +0200 Subject: [PATCH 434/641] Allow ex/importing more raw identifier names (#4025) --- CHANGELOG.md | 3 + crates/backend/src/encode.rs | 3 +- crates/cli/tests/reference/raw.d.ts | 21 +++++ crates/cli/tests/reference/raw.js | 120 ++++++++++++++++++++++++++++ crates/cli/tests/reference/raw.rs | 24 ++++++ crates/cli/tests/reference/raw.wat | 14 ++++ crates/macro-support/src/lib.rs | 6 +- crates/macro-support/src/parser.rs | 6 +- 8 files changed, 192 insertions(+), 5 deletions(-) create mode 100644 crates/cli/tests/reference/raw.d.ts create mode 100644 crates/cli/tests/reference/raw.js create mode 100644 crates/cli/tests/reference/raw.rs create mode 100644 crates/cli/tests/reference/raw.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e3864eca31..647f6383254 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -139,6 +139,9 @@ * Fix byte order for big-endian platforms. [#4015](https://github.com/rustwasm/wasm-bindgen/pull/4015) +* Allow ex/importing structs, functions and parameters named with raw identifiers. + [#4025](https://github.com/rustwasm/wasm-bindgen/pull/4025) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 4bf9047300c..b571d046dfe 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; use std::env; use std::fs; use std::path::PathBuf; +use syn::ext::IdentExt; use crate::ast; use crate::Diagnostic; @@ -212,7 +213,7 @@ fn shared_function<'a>(func: &'a ast::Function, _intern: &'a Interner) -> Functi .enumerate() .map(|(idx, arg)| { if let syn::Pat::Ident(x) = &*arg.pat { - return x.ident.to_string(); + return x.ident.unraw().to_string(); } format!("arg{}", idx) }) diff --git a/crates/cli/tests/reference/raw.d.ts b/crates/cli/tests/reference/raw.d.ts new file mode 100644 index 00000000000..944af97ab04 --- /dev/null +++ b/crates/cli/tests/reference/raw.d.ts @@ -0,0 +1,21 @@ +/* tslint:disable */ +/* eslint-disable */ +/** +* @param {number} test +* @returns {number} +*/ +export function test1(test: number): number; +/** +*/ +export class Test { + free(): void; +/** +* @param {number} test +* @returns {Test} +*/ + static test1(test: number): Test; +/** +* @param {number} test +*/ + test2(test: number): void; +} diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js new file mode 100644 index 00000000000..3432d150366 --- /dev/null +++ b/crates/cli/tests/reference/raw.js @@ -0,0 +1,120 @@ +import { test2 } from 'test'; + +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} +/** +* @param {number} test +* @returns {number} +*/ +export function test1(test) { + const ret = wasm.test1(test); + return ret >>> 0; +} + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +const TestFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_test_free(ptr >>> 0, 1)); +/** +*/ +export class Test { + + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(Test.prototype); + obj.__wbg_ptr = ptr; + TestFinalization.register(obj, obj.__wbg_ptr, obj); + return obj; + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + TestFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_test_free(ptr, 0); + } + /** + * @param {number} test + * @returns {Test} + */ + static test1(test) { + const ret = wasm.test_test1(test); + return Test.__wrap(ret); + } + /** + * @param {number} test + */ + test2(test) { + wasm.test_test2(this.__wbg_ptr, test); + } +} + +export function __wbg_test2_39fe629b9aa739cf() { + const ret = test2(); + return addHeapObject(ret); +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + diff --git a/crates/cli/tests/reference/raw.rs b/crates/cli/tests/reference/raw.rs new file mode 100644 index 00000000000..7c49eba5b04 --- /dev/null +++ b/crates/cli/tests/reference/raw.rs @@ -0,0 +1,24 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn r#test1(r#test: u32) -> u32 { + r#test2(); + r#test +} + +#[wasm_bindgen] +pub struct r#Test; + +#[wasm_bindgen] +impl r#Test { + pub fn r#test1(r#test: u32) -> Self { + Self + } + + pub fn r#test2(&self, r#test: u32) {} +} + +#[wasm_bindgen(module = "test")] +extern "C" { + fn r#test2() -> JsValue; +} diff --git a/crates/cli/tests/reference/raw.wat b/crates/cli/tests/reference/raw.wat new file mode 100644 index 00000000000..0b4ec6cc732 --- /dev/null +++ b/crates/cli/tests/reference/raw.wat @@ -0,0 +1,14 @@ +(module $reference_test.wasm + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32 i32))) + (func $test_test2 (;0;) (type 1) (param i32 i32)) + (func $test1 (;1;) (type 0) (param i32) (result i32)) + (func $test_test1 (;2;) (type 0) (param i32) (result i32)) + (func $__wbg_test_free (;3;) (type 1) (param i32 i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "test1" (func $test1)) + (export "__wbg_test_free" (func $__wbg_test_free)) + (export "test_test1" (func $test_test1)) + (export "test_test2" (func $test_test2)) +) diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index 21d66305c38..dd609f42260 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -115,7 +115,11 @@ impl Parse for ClassMarker { fn parse(input: ParseStream) -> SynResult { let class = input.parse::()?; input.parse::()?; - let js_class = input.parse::()?.value(); + let mut js_class = input.parse::()?.value(); + js_class = js_class + .strip_prefix("r#") + .map(String::from) + .unwrap_or(js_class); let mut wasm_bindgen = None; let mut wasm_bindgen_futures = None; diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index dd581b2700d..376c15b1133 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -417,7 +417,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs)> for &'a mut syn::ItemStruct let js_name = attrs .js_name() .map(|s| s.0.to_string()) - .unwrap_or(self.ident.to_string()); + .unwrap_or(self.ident.unraw().to_string()); let is_inspectable = attrs.inspectable().is_some(); let getter_with_clone = attrs.getter_with_clone(); for (i, field) in self.fields.iter_mut().enumerate() { @@ -921,9 +921,9 @@ fn function_from_decl( && opts.method().is_none() && is_js_keyword(&decl_name.to_string(), skip_keywords) { - format!("_{}", decl_name) + format!("_{}", decl_name.unraw()) } else { - decl_name.to_string() + decl_name.unraw().to_string() }; (name, decl_name.span(), false) }; From cdcbaf1a75d3e89494bbaa46890791094018e386 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 29 Jul 2024 19:03:51 +0200 Subject: [PATCH 435/641] Update `AbortSignal` and `AbortController` (#4026) --- CHANGELOG.md | 3 ++ .../src/features/gen_AbortController.rs | 7 +++ .../web-sys/src/features/gen_AbortSignal.rs | 49 +++++++++++++++++++ .../features/gen_AddEventListenerOptions.rs | 18 +++++++ .../webidls/enabled/AbortController.webidl | 8 +-- .../webidls/enabled/AbortSignal.webidl | 8 ++- .../webidls/enabled/EventTarget.webidl | 1 + 7 files changed, 90 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 647f6383254..90855a6206b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,9 @@ * Deprecated parameters to `default` (`init`) and `initSync` in favor of an object. [#3995](https://github.com/rustwasm/wasm-bindgen/pull/3995) +* Update `AbortSignal` and `AbortController` according to the WHATWG specification. + [#4026](https://github.com/rustwasm/wasm-bindgen/pull/4026) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/src/features/gen_AbortController.rs b/crates/web-sys/src/features/gen_AbortController.rs index ff01ba37eaf..df2aa0b021a 100644 --- a/crates/web-sys/src/features/gen_AbortController.rs +++ b/crates/web-sys/src/features/gen_AbortController.rs @@ -34,4 +34,11 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortController`*"] pub fn abort(this: &AbortController); + # [wasm_bindgen (method , structural , js_class = "AbortController" , js_name = abort)] + #[doc = "The `abort()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortController`*"] + pub fn abort_with_reason(this: &AbortController, reason: &::wasm_bindgen::JsValue); } diff --git a/crates/web-sys/src/features/gen_AbortSignal.rs b/crates/web-sys/src/features/gen_AbortSignal.rs index ecf05a7bdde..bc0b69718e6 100644 --- a/crates/web-sys/src/features/gen_AbortSignal.rs +++ b/crates/web-sys/src/features/gen_AbortSignal.rs @@ -19,6 +19,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] pub fn aborted(this: &AbortSignal) -> bool; + # [wasm_bindgen (structural , method , getter , js_class = "AbortSignal" , js_name = reason)] + #[doc = "Getter for the `reason` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/reason)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn reason(this: &AbortSignal) -> ::wasm_bindgen::JsValue; # [wasm_bindgen (structural , method , getter , js_class = "AbortSignal" , js_name = onabort)] #[doc = "Getter for the `onabort` field of this object."] #[doc = ""] @@ -33,4 +40,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] pub fn set_onabort(this: &AbortSignal, value: Option<&::js_sys::Function>); + # [wasm_bindgen (static_method_of = AbortSignal , js_class = "AbortSignal" , js_name = abort)] + #[doc = "The `abort()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn abort() -> AbortSignal; + # [wasm_bindgen (static_method_of = AbortSignal , js_class = "AbortSignal" , js_name = abort)] + #[doc = "The `abort()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn abort_with_reason(reason: &::wasm_bindgen::JsValue) -> AbortSignal; + # [wasm_bindgen (static_method_of = AbortSignal , js_class = "AbortSignal" , js_name = any)] + #[doc = "The `any()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn any(signals: &::wasm_bindgen::JsValue) -> AbortSignal; + # [wasm_bindgen (method , structural , js_class = "AbortSignal" , js_name = throwIfAborted)] + #[doc = "The `throwIfAborted()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn throw_if_aborted(this: &AbortSignal); + # [wasm_bindgen (static_method_of = AbortSignal , js_class = "AbortSignal" , js_name = timeout)] + #[doc = "The `timeout()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn timeout_with_u32(milliseconds: u32) -> AbortSignal; + # [wasm_bindgen (static_method_of = AbortSignal , js_class = "AbortSignal" , js_name = timeout)] + #[doc = "The `timeout()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`*"] + pub fn timeout_with_f64(milliseconds: f64) -> AbortSignal; } diff --git a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs index 3a600c0442e..d34654d22ee 100644 --- a/crates/web-sys/src/features/gen_AddEventListenerOptions.rs +++ b/crates/web-sys/src/features/gen_AddEventListenerOptions.rs @@ -40,6 +40,18 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AddEventListenerOptions`*"] #[wasm_bindgen(method, setter = "passive")] pub fn set_passive(this: &AddEventListenerOptions, val: bool); + #[cfg(feature = "AbortSignal")] + #[doc = "Get the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `AddEventListenerOptions`*"] + #[wasm_bindgen(method, getter = "signal")] + pub fn get_signal(this: &AddEventListenerOptions) -> Option; + #[cfg(feature = "AbortSignal")] + #[doc = "Change the `signal` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `AddEventListenerOptions`*"] + #[wasm_bindgen(method, setter = "signal")] + pub fn set_signal(this: &AddEventListenerOptions, val: &AbortSignal); } impl AddEventListenerOptions { #[doc = "Construct a new `AddEventListenerOptions`."] @@ -65,6 +77,12 @@ impl AddEventListenerOptions { self.set_passive(val); self } + #[cfg(feature = "AbortSignal")] + #[deprecated = "Use `set_signal()` instead."] + pub fn signal(&mut self, val: &AbortSignal) -> &mut Self { + self.set_signal(val); + self + } } impl Default for AddEventListenerOptions { fn default() -> Self { diff --git a/crates/web-sys/webidls/enabled/AbortController.webidl b/crates/web-sys/webidls/enabled/AbortController.webidl index 1fc3e8fd9e2..f7dec48087d 100644 --- a/crates/web-sys/webidls/enabled/AbortController.webidl +++ b/crates/web-sys/webidls/enabled/AbortController.webidl @@ -7,9 +7,11 @@ * https://dom.spec.whatwg.org/#abortcontroller */ -[Constructor(), Exposed=(Window,Worker,System)] +[Exposed=*] interface AbortController { - readonly attribute AbortSignal signal; + constructor(); - undefined abort(); + [SameObject] readonly attribute AbortSignal signal; + + undefined abort(optional any reason); }; diff --git a/crates/web-sys/webidls/enabled/AbortSignal.webidl b/crates/web-sys/webidls/enabled/AbortSignal.webidl index 6b66f76c4cd..b57c6a5feeb 100644 --- a/crates/web-sys/webidls/enabled/AbortSignal.webidl +++ b/crates/web-sys/webidls/enabled/AbortSignal.webidl @@ -7,9 +7,15 @@ * https://dom.spec.whatwg.org/#abortsignal */ -[Exposed=(Window,Worker,System)] +[Exposed=*] interface AbortSignal : EventTarget { + [NewObject] static AbortSignal abort(optional any reason); + [Exposed=(Window,Worker), NewObject] static AbortSignal timeout([EnforceRange] unsigned long long milliseconds); + [NewObject] static AbortSignal _any(sequence signals); + readonly attribute boolean aborted; + readonly attribute any reason; + undefined throwIfAborted(); attribute EventHandler onabort; }; diff --git a/crates/web-sys/webidls/enabled/EventTarget.webidl b/crates/web-sys/webidls/enabled/EventTarget.webidl index fc40a314faf..5e36a09d691 100644 --- a/crates/web-sys/webidls/enabled/EventTarget.webidl +++ b/crates/web-sys/webidls/enabled/EventTarget.webidl @@ -18,6 +18,7 @@ dictionary EventListenerOptions { dictionary AddEventListenerOptions : EventListenerOptions { boolean passive; boolean once = false; + AbortSignal signal; }; [Constructor, From 19a17871f19e115211bc7b5c63c1e9dc1d97b27e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 30 Jul 2024 14:28:24 +0200 Subject: [PATCH 436/641] Update the Indexed DB API (#4028) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 2 + .../src/features/gen_HtmlMenuItemElement.rs | 28 +- crates/web-sys/src/features/gen_IdbCursor.rs | 1 + .../web-sys/src/features/gen_IdbDatabase.rs | 47 ++- crates/web-sys/src/features/gen_IdbFactory.rs | 18 +- .../web-sys/src/features/gen_IdbFileHandle.rs | 35 ++ .../features/gen_IdbFileMetadataParameters.rs | 6 + .../src/features/gen_IdbFileRequest.rs | 5 + crates/web-sys/src/features/gen_IdbIndex.rs | 29 +- .../src/features/gen_IdbIndexParameters.rs | 2 + .../features/gen_IdbLocaleAwareKeyRange.rs | 4 + .../src/features/gen_IdbMutableFile.rs | 10 + .../src/features/gen_IdbObjectStore.rs | 38 ++- .../src/features/gen_IdbOpenDbOptions.rs | 6 + .../src/features/gen_IdbTransaction.rs | 17 +- .../features/gen_IdbTransactionDurability.rs | 17 + .../src/features/gen_IdbTransactionMode.rs | 2 +- .../src/features/gen_IdbTransactionOptions.rs | 64 ++++ crates/web-sys/src/features/gen_Window.rs | 16 +- .../src/features/gen_WorkerGlobalScope.rs | 16 +- crates/web-sys/src/features/mod.rs | 14 + crates/web-sys/webidls/enabled/IDB.webidl | 314 ++++++++++++++++++ .../web-sys/webidls/enabled/IDBCursor.webidl | 52 --- .../webidls/enabled/IDBDatabase.webidl | 44 --- .../web-sys/webidls/enabled/IDBFactory.webidl | 66 ---- .../webidls/enabled/IDBFileHandle.webidl | 43 --- .../webidls/enabled/IDBFileRequest.webidl | 14 - .../web-sys/webidls/enabled/IDBIndex.webidl | 65 ---- .../webidls/enabled/IDBKeyRange.webidl | 41 --- .../webidls/enabled/IDBMutableFile.webidl | 21 -- .../webidls/enabled/IDBObjectStore.webidl | 70 ---- .../webidls/enabled/IDBOpenDBRequest.webidl | 15 - .../web-sys/webidls/enabled/IDBRequest.webidl | 31 -- .../webidls/enabled/IDBTransaction.webidl | 47 --- .../enabled/IDBVersionChangeEvent.webidl | 25 -- .../enabled/WindowOrWorkerGlobalScope.webidl | 7 - crates/web-sys/webidls/unstable/IDB.webidl | 13 + crates/webidl/Cargo.toml | 2 +- crates/webidl/src/constants.rs | 65 ++++ crates/webidl/src/generator.rs | 100 ++++-- crates/webidl/src/idl_type.rs | 204 ++++++++---- crates/webidl/src/lib.rs | 78 +++-- crates/webidl/src/util.rs | 65 ++-- 44 files changed, 998 insertions(+), 764 deletions(-) create mode 100644 crates/web-sys/src/features/gen_IdbTransactionDurability.rs create mode 100644 crates/web-sys/src/features/gen_IdbTransactionOptions.rs create mode 100644 crates/web-sys/webidls/enabled/IDB.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBCursor.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBDatabase.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBFactory.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBFileHandle.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBFileRequest.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBIndex.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBKeyRange.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBMutableFile.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBObjectStore.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBOpenDBRequest.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBRequest.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBTransaction.webidl delete mode 100644 crates/web-sys/webidls/enabled/IDBVersionChangeEvent.webidl create mode 100644 crates/web-sys/webidls/unstable/IDB.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 90855a6206b..b279311b0a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,9 @@ * Update `AbortSignal` and `AbortController` according to the WHATWG specification. [#4026](https://github.com/rustwasm/wasm-bindgen/pull/4026) +* Update the Indexed DB API. + [#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 0836308ca09..71c498216f5 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -725,7 +725,9 @@ IdbOpenDbRequest = ["EventTarget", "IdbRequest"] IdbRequest = ["EventTarget"] IdbRequestReadyState = [] IdbTransaction = ["EventTarget"] +IdbTransactionDurability = [] IdbTransactionMode = [] +IdbTransactionOptions = [] IdbVersionChangeEvent = ["Event"] IdbVersionChangeEventInit = [] IdleDeadline = [] diff --git a/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs b/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs index dd1f4d83267..e4d713f353a 100644 --- a/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs @@ -13,116 +13,116 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] #[deprecated(note = "Absent in all major browsers")] pub type HtmlMenuItemElement; - #[deprecated(note = "Absent in all major browsers")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = type)] #[doc = "Getter for the `type` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn type_(this: &HtmlMenuItemElement) -> String; #[deprecated(note = "Absent in all major browsers")] + pub fn type_(this: &HtmlMenuItemElement) -> String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_type(this: &HtmlMenuItemElement, value: &str); #[deprecated(note = "Absent in all major browsers")] + pub fn set_type(this: &HtmlMenuItemElement, value: &str); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn label(this: &HtmlMenuItemElement) -> String; #[deprecated(note = "Absent in all major browsers")] + pub fn label(this: &HtmlMenuItemElement) -> String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_label(this: &HtmlMenuItemElement, value: &str); #[deprecated(note = "Absent in all major browsers")] + pub fn set_label(this: &HtmlMenuItemElement, value: &str); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = icon)] #[doc = "Getter for the `icon` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/icon)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn icon(this: &HtmlMenuItemElement) -> String; #[deprecated(note = "Absent in all major browsers")] + pub fn icon(this: &HtmlMenuItemElement) -> String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = icon)] #[doc = "Setter for the `icon` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/icon)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_icon(this: &HtmlMenuItemElement, value: &str); #[deprecated(note = "Absent in all major browsers")] + pub fn set_icon(this: &HtmlMenuItemElement, value: &str); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = disabled)] #[doc = "Getter for the `disabled` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/disabled)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn disabled(this: &HtmlMenuItemElement) -> bool; #[deprecated(note = "Absent in all major browsers")] + pub fn disabled(this: &HtmlMenuItemElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = disabled)] #[doc = "Setter for the `disabled` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/disabled)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_disabled(this: &HtmlMenuItemElement, value: bool); #[deprecated(note = "Absent in all major browsers")] + pub fn set_disabled(this: &HtmlMenuItemElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = checked)] #[doc = "Getter for the `checked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/checked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn checked(this: &HtmlMenuItemElement) -> bool; #[deprecated(note = "Absent in all major browsers")] + pub fn checked(this: &HtmlMenuItemElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = checked)] #[doc = "Setter for the `checked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/checked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_checked(this: &HtmlMenuItemElement, value: bool); #[deprecated(note = "Absent in all major browsers")] + pub fn set_checked(this: &HtmlMenuItemElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = radiogroup)] #[doc = "Getter for the `radiogroup` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/radiogroup)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn radiogroup(this: &HtmlMenuItemElement) -> String; #[deprecated(note = "Absent in all major browsers")] + pub fn radiogroup(this: &HtmlMenuItemElement) -> String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = radiogroup)] #[doc = "Setter for the `radiogroup` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/radiogroup)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn set_radiogroup(this: &HtmlMenuItemElement, value: &str); #[deprecated(note = "Absent in all major browsers")] + pub fn set_radiogroup(this: &HtmlMenuItemElement, value: &str); # [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = defaultChecked)] #[doc = "Getter for the `defaultChecked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/defaultChecked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] - pub fn default_checked(this: &HtmlMenuItemElement) -> bool; #[deprecated(note = "Absent in all major browsers")] + pub fn default_checked(this: &HtmlMenuItemElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = defaultChecked)] #[doc = "Setter for the `defaultChecked` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/defaultChecked)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] + #[deprecated(note = "Absent in all major browsers")] pub fn set_default_checked(this: &HtmlMenuItemElement, value: bool); } diff --git a/crates/web-sys/src/features/gen_IdbCursor.rs b/crates/web-sys/src/features/gen_IdbCursor.rs index bf8d235434a..e4e98ed9f7e 100644 --- a/crates/web-sys/src/features/gen_IdbCursor.rs +++ b/crates/web-sys/src/features/gen_IdbCursor.rs @@ -48,6 +48,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBCursor/request)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbCursor`, `IdbRequest`*"] + #[deprecated] pub fn request(this: &IdbCursor) -> IdbRequest; # [wasm_bindgen (catch , method , structural , js_class = "IDBCursor" , js_name = advance)] #[doc = "The `advance()` method."] diff --git a/crates/web-sys/src/features/gen_IdbDatabase.rs b/crates/web-sys/src/features/gen_IdbDatabase.rs index 07738820971..d7cdae29364 100644 --- a/crates/web-sys/src/features/gen_IdbDatabase.rs +++ b/crates/web-sys/src/features/gen_IdbDatabase.rs @@ -97,6 +97,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/storage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `StorageType`*"] + #[deprecated] pub fn storage(this: &IdbDatabase) -> StorageType; # [wasm_bindgen (method , structural , js_class = "IDBDatabase" , js_name = close)] #[doc = "The `close()` method."] @@ -112,6 +113,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/createMutableFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbRequest`*"] + #[deprecated] pub fn create_mutable_file(this: &IdbDatabase, name: &str) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = createMutableFile)] @@ -120,6 +122,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/createMutableFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbRequest`*"] + #[deprecated] pub fn create_mutable_file_with_type( this: &IdbDatabase, name: &str, @@ -143,7 +146,7 @@ extern "C" { pub fn create_object_store_with_optional_parameters( this: &IdbDatabase, name: &str, - optional_parameters: &IdbObjectStoreParameters, + options: &IdbObjectStoreParameters, ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = deleteObjectStore)] #[doc = "The `deleteObjectStore()` method."] @@ -198,4 +201,46 @@ extern "C" { store_names: &::wasm_bindgen::JsValue, mode: IdbTransactionMode, ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "IdbTransaction", + feature = "IdbTransactionMode", + feature = "IdbTransactionOptions", + ))] + # [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = transaction)] + #[doc = "The `transaction()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/transaction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbTransaction`, `IdbTransactionMode`, `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transaction_with_str_and_mode_and_options( + this: &IdbDatabase, + store_names: &str, + mode: IdbTransactionMode, + options: &IdbTransactionOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "IdbTransaction", + feature = "IdbTransactionMode", + feature = "IdbTransactionOptions", + ))] + # [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = transaction)] + #[doc = "The `transaction()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/transaction)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbTransaction`, `IdbTransactionMode`, `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transaction_with_str_sequence_and_mode_and_options( + this: &IdbDatabase, + store_names: &::wasm_bindgen::JsValue, + mode: IdbTransactionMode, + options: &IdbTransactionOptions, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_IdbFactory.rs b/crates/web-sys/src/features/gen_IdbFactory.rs index 573493931ce..023c786d060 100644 --- a/crates/web-sys/src/features/gen_IdbFactory.rs +++ b/crates/web-sys/src/features/gen_IdbFactory.rs @@ -38,6 +38,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/deleteDatabase)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbOptions`, `IdbOpenDbRequest`*"] + #[deprecated] pub fn delete_database_with_options( this: &IdbFactory, name: &str, @@ -50,11 +51,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"] - pub fn open_with_u32( - this: &IdbFactory, - name: &str, - version: u32, - ) -> Result; + pub fn open(this: &IdbFactory, name: &str) -> Result; #[cfg(feature = "IdbOpenDbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)] #[doc = "The `open()` method."] @@ -62,10 +59,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"] - pub fn open_with_f64( + pub fn open_with_u32( this: &IdbFactory, name: &str, - version: f64, + version: u32, ) -> Result; #[cfg(feature = "IdbOpenDbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)] @@ -74,7 +71,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"] - pub fn open(this: &IdbFactory, name: &str) -> Result; + pub fn open_with_f64( + this: &IdbFactory, + name: &str, + version: f64, + ) -> Result; #[cfg(all(feature = "IdbOpenDbOptions", feature = "IdbOpenDbRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)] #[doc = "The `open()` method."] @@ -82,6 +83,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbOptions`, `IdbOpenDbRequest`*"] + #[deprecated] pub fn open_with_idb_open_db_options( this: &IdbFactory, name: &str, diff --git a/crates/web-sys/src/features/gen_IdbFileHandle.rs b/crates/web-sys/src/features/gen_IdbFileHandle.rs index 4881af976e3..2c679fa388b 100644 --- a/crates/web-sys/src/features/gen_IdbFileHandle.rs +++ b/crates/web-sys/src/features/gen_IdbFileHandle.rs @@ -11,6 +11,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub type IdbFileHandle; #[cfg(feature = "IdbMutableFile")] # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = mutableFile)] @@ -19,6 +20,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/mutableFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"] + #[deprecated] pub fn mutable_file(this: &IdbFileHandle) -> Option; #[cfg(feature = "IdbMutableFile")] # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = fileHandle)] @@ -27,6 +29,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/fileHandle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"] + #[deprecated] pub fn file_handle(this: &IdbFileHandle) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = active)] #[doc = "Getter for the `active` field of this object."] @@ -34,6 +37,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/active)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn active(this: &IdbFileHandle) -> bool; # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = location)] #[doc = "Getter for the `location` field of this object."] @@ -41,6 +45,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn location(this: &IdbFileHandle) -> Option; # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = location)] #[doc = "Setter for the `location` field of this object."] @@ -48,6 +53,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn set_location(this: &IdbFileHandle, value: Option); # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = oncomplete)] #[doc = "Getter for the `oncomplete` field of this object."] @@ -55,6 +61,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/oncomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn oncomplete(this: &IdbFileHandle) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = oncomplete)] #[doc = "Setter for the `oncomplete` field of this object."] @@ -62,6 +69,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/oncomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn set_oncomplete(this: &IdbFileHandle, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = onabort)] #[doc = "Getter for the `onabort` field of this object."] @@ -69,6 +77,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onabort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn onabort(this: &IdbFileHandle) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = onabort)] #[doc = "Setter for the `onabort` field of this object."] @@ -76,6 +85,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onabort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn set_onabort(this: &IdbFileHandle, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = onerror)] #[doc = "Getter for the `onerror` field of this object."] @@ -83,6 +93,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onerror)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn onerror(this: &IdbFileHandle) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = onerror)] #[doc = "Setter for the `onerror` field of this object."] @@ -90,6 +101,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onerror)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn set_onerror(this: &IdbFileHandle, value: Option<&::js_sys::Function>); # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = abort)] #[doc = "The `abort()` method."] @@ -97,6 +109,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/abort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] pub fn abort(this: &IdbFileHandle) -> Result<(), JsValue>; #[cfg(feature = "IdbFileRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = append)] @@ -105,6 +118,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn append_with_str( this: &IdbFileHandle, value: &str, @@ -116,6 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn append_with_array_buffer( this: &IdbFileHandle, value: &::js_sys::ArrayBuffer, @@ -127,6 +142,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn append_with_array_buffer_view( this: &IdbFileHandle, value: &::js_sys::Object, @@ -138,6 +154,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn append_with_u8_array( this: &IdbFileHandle, value: &mut [u8], @@ -149,6 +166,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn append_with_blob( this: &IdbFileHandle, value: &Blob, @@ -160,6 +178,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/flush)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn flush(this: &IdbFileHandle) -> Result, JsValue>; #[cfg(feature = "IdbFileRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = getMetadata)] @@ -168,6 +187,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/getMetadata)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn get_metadata(this: &IdbFileHandle) -> Result, JsValue>; #[cfg(all(feature = "IdbFileMetadataParameters", feature = "IdbFileRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = getMetadata)] @@ -176,6 +196,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/getMetadata)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileMetadataParameters`, `IdbFileRequest`*"] + #[deprecated] pub fn get_metadata_with_parameters( this: &IdbFileHandle, parameters: &IdbFileMetadataParameters, @@ -187,6 +208,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsArrayBuffer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_array_buffer_with_u32( this: &IdbFileHandle, size: u32, @@ -198,6 +220,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsArrayBuffer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_array_buffer_with_f64( this: &IdbFileHandle, size: f64, @@ -209,6 +232,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_text_with_u32( this: &IdbFileHandle, size: u32, @@ -220,6 +244,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_text_with_f64( this: &IdbFileHandle, size: f64, @@ -231,6 +256,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_text_with_u32_and_encoding( this: &IdbFileHandle, size: u32, @@ -243,6 +269,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn read_as_text_with_f64_and_encoding( this: &IdbFileHandle, size: f64, @@ -255,6 +282,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn truncate(this: &IdbFileHandle) -> Result, JsValue>; #[cfg(feature = "IdbFileRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = truncate)] @@ -263,6 +291,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn truncate_with_u32( this: &IdbFileHandle, size: u32, @@ -274,6 +303,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn truncate_with_f64( this: &IdbFileHandle, size: f64, @@ -285,6 +315,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn write_with_str( this: &IdbFileHandle, value: &str, @@ -296,6 +327,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn write_with_array_buffer( this: &IdbFileHandle, value: &::js_sys::ArrayBuffer, @@ -307,6 +339,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn write_with_array_buffer_view( this: &IdbFileHandle, value: &::js_sys::Object, @@ -318,6 +351,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn write_with_u8_array( this: &IdbFileHandle, value: &[u8], @@ -329,6 +363,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn write_with_blob( this: &IdbFileHandle, value: &Blob, diff --git a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs index 2ec009b1338..5f7a67999a1 100644 --- a/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs +++ b/crates/web-sys/src/features/gen_IdbFileMetadataParameters.rs @@ -9,25 +9,30 @@ extern "C" { #[doc = "The `IdbFileMetadataParameters` dictionary."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] pub type IdbFileMetadataParameters; #[doc = "Get the `lastModified` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] #[wasm_bindgen(method, getter = "lastModified")] pub fn get_last_modified(this: &IdbFileMetadataParameters) -> Option; #[doc = "Change the `lastModified` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] #[wasm_bindgen(method, setter = "lastModified")] pub fn set_last_modified(this: &IdbFileMetadataParameters, val: bool); #[doc = "Get the `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] #[wasm_bindgen(method, getter = "size")] pub fn get_size(this: &IdbFileMetadataParameters) -> Option; #[doc = "Change the `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] #[wasm_bindgen(method, setter = "size")] pub fn set_size(this: &IdbFileMetadataParameters, val: bool); } @@ -35,6 +40,7 @@ impl IdbFileMetadataParameters { #[doc = "Construct a new `IdbFileMetadataParameters`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"] + #[deprecated] pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); diff --git a/crates/web-sys/src/features/gen_IdbFileRequest.rs b/crates/web-sys/src/features/gen_IdbFileRequest.rs index 67d8a4c1cbb..0fb917b9b80 100644 --- a/crates/web-sys/src/features/gen_IdbFileRequest.rs +++ b/crates/web-sys/src/features/gen_IdbFileRequest.rs @@ -11,6 +11,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"] + #[deprecated] pub type IdbFileRequest; #[cfg(feature = "IdbFileHandle")] # [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = fileHandle)] @@ -19,6 +20,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/fileHandle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn file_handle(this: &IdbFileRequest) -> Option; #[cfg(feature = "IdbFileHandle")] # [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = lockedFile)] @@ -27,6 +29,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/lockedFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] pub fn locked_file(this: &IdbFileRequest) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = onprogress)] #[doc = "Getter for the `onprogress` field of this object."] @@ -34,6 +37,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/onprogress)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"] + #[deprecated] pub fn onprogress(this: &IdbFileRequest) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBFileRequest" , js_name = onprogress)] #[doc = "Setter for the `onprogress` field of this object."] @@ -41,5 +45,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/onprogress)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"] + #[deprecated] pub fn set_onprogress(this: &IdbFileRequest, value: Option<&::js_sys::Function>); } diff --git a/crates/web-sys/src/features/gen_IdbIndex.rs b/crates/web-sys/src/features/gen_IdbIndex.rs index 675da44ef89..0a2eeebc174 100644 --- a/crates/web-sys/src/features/gen_IdbIndex.rs +++ b/crates/web-sys/src/features/gen_IdbIndex.rs @@ -61,6 +61,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/locale)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"] + #[deprecated] pub fn locale(this: &IdbIndex) -> Option; # [wasm_bindgen (structural , method , getter , js_class = "IDBIndex" , js_name = isAutoLocale)] #[doc = "Getter for the `isAutoLocale` field of this object."] @@ -68,6 +69,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/isAutoLocale)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"] + #[deprecated] pub fn is_auto_locale(this: &IdbIndex) -> bool; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = count)] @@ -86,7 +88,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn count_with_key( this: &IdbIndex, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = get)] @@ -95,7 +97,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/get)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] - pub fn get(this: &IdbIndex, key: &::wasm_bindgen::JsValue) -> Result; + pub fn get(this: &IdbIndex, query: &::wasm_bindgen::JsValue) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAll)] #[doc = "The `getAll()` method."] @@ -113,7 +115,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn get_all_with_key( this: &IdbIndex, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAll)] @@ -124,8 +126,8 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn get_all_with_key_and_limit( this: &IdbIndex, - key: &::wasm_bindgen::JsValue, - limit: u32, + query: &::wasm_bindgen::JsValue, + count: u32, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAllKeys)] @@ -144,7 +146,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn get_all_keys_with_key( this: &IdbIndex, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAllKeys)] @@ -155,8 +157,8 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn get_all_keys_with_key_and_limit( this: &IdbIndex, - key: &::wasm_bindgen::JsValue, - limit: u32, + query: &::wasm_bindgen::JsValue, + count: u32, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getKey)] @@ -165,7 +167,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/getKey)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] - pub fn get_key(this: &IdbIndex, key: &::wasm_bindgen::JsValue) -> Result; + pub fn get_key(this: &IdbIndex, query: &::wasm_bindgen::JsValue) + -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openCursor)] #[doc = "The `openCursor()` method."] @@ -183,7 +186,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn open_cursor_with_range( this: &IdbIndex, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openCursor)] @@ -194,7 +197,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbIndex`, `IdbRequest`*"] pub fn open_cursor_with_range_and_direction( this: &IdbIndex, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, direction: IdbCursorDirection, ) -> Result; #[cfg(feature = "IdbRequest")] @@ -214,7 +217,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"] pub fn open_key_cursor_with_range( this: &IdbIndex, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openKeyCursor)] @@ -225,7 +228,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbIndex`, `IdbRequest`*"] pub fn open_key_cursor_with_range_and_direction( this: &IdbIndex, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, direction: IdbCursorDirection, ) -> Result; } diff --git a/crates/web-sys/src/features/gen_IdbIndexParameters.rs b/crates/web-sys/src/features/gen_IdbIndexParameters.rs index 9238e85f6ff..87f7c4b228d 100644 --- a/crates/web-sys/src/features/gen_IdbIndexParameters.rs +++ b/crates/web-sys/src/features/gen_IdbIndexParameters.rs @@ -13,11 +13,13 @@ extern "C" { #[doc = "Get the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[deprecated] #[wasm_bindgen(method, getter = "locale")] pub fn get_locale(this: &IdbIndexParameters) -> Option; #[doc = "Change the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] + #[deprecated] #[wasm_bindgen(method, setter = "locale")] pub fn set_locale(this: &IdbIndexParameters, val: Option<&str>); #[doc = "Get the `multiEntry` field of this object."] diff --git a/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs b/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs index ab1695a3fcb..ca0dae2f914 100644 --- a/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs +++ b/crates/web-sys/src/features/gen_IdbLocaleAwareKeyRange.rs @@ -11,6 +11,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] + #[deprecated] pub type IdbLocaleAwareKeyRange; # [wasm_bindgen (catch , static_method_of = IdbLocaleAwareKeyRange , js_class = "IDBLocaleAwareKeyRange" , js_name = bound)] #[doc = "The `bound()` method."] @@ -18,6 +19,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] + #[deprecated] pub fn bound( lower: &::wasm_bindgen::JsValue, upper: &::wasm_bindgen::JsValue, @@ -28,6 +30,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] + #[deprecated] pub fn bound_with_lower_open( lower: &::wasm_bindgen::JsValue, upper: &::wasm_bindgen::JsValue, @@ -39,6 +42,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"] + #[deprecated] pub fn bound_with_lower_open_and_upper_open( lower: &::wasm_bindgen::JsValue, upper: &::wasm_bindgen::JsValue, diff --git a/crates/web-sys/src/features/gen_IdbMutableFile.rs b/crates/web-sys/src/features/gen_IdbMutableFile.rs index 6b441447430..cabc735391a 100644 --- a/crates/web-sys/src/features/gen_IdbMutableFile.rs +++ b/crates/web-sys/src/features/gen_IdbMutableFile.rs @@ -11,6 +11,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub type IdbMutableFile; # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = name)] #[doc = "Getter for the `name` field of this object."] @@ -18,6 +19,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn name(this: &IdbMutableFile) -> String; # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = type)] #[doc = "Getter for the `type` field of this object."] @@ -25,6 +27,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn type_(this: &IdbMutableFile) -> String; #[cfg(feature = "IdbDatabase")] # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = database)] @@ -33,6 +36,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/database)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbMutableFile`*"] + #[deprecated] pub fn database(this: &IdbMutableFile) -> IdbDatabase; # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = onabort)] #[doc = "Getter for the `onabort` field of this object."] @@ -40,6 +44,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onabort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn onabort(this: &IdbMutableFile) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBMutableFile" , js_name = onabort)] #[doc = "Setter for the `onabort` field of this object."] @@ -47,6 +52,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onabort)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn set_onabort(this: &IdbMutableFile, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = onerror)] #[doc = "Getter for the `onerror` field of this object."] @@ -54,6 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onerror)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn onerror(this: &IdbMutableFile) -> Option<::js_sys::Function>; # [wasm_bindgen (structural , method , setter , js_class = "IDBMutableFile" , js_name = onerror)] #[doc = "Setter for the `onerror` field of this object."] @@ -61,6 +68,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onerror)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] + #[deprecated] pub fn set_onerror(this: &IdbMutableFile, value: Option<&::js_sys::Function>); #[cfg(feature = "DomRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBMutableFile" , js_name = getFile)] @@ -69,6 +77,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/getFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRequest`, `IdbMutableFile`*"] + #[deprecated] pub fn get_file(this: &IdbMutableFile) -> Result; #[cfg(feature = "IdbFileHandle")] # [wasm_bindgen (catch , method , structural , js_class = "IDBMutableFile" , js_name = open)] @@ -77,5 +86,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/open)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"] + #[deprecated] pub fn open(this: &IdbMutableFile) -> Result; } diff --git a/crates/web-sys/src/features/gen_IdbObjectStore.rs b/crates/web-sys/src/features/gen_IdbObjectStore.rs index 7916454a842..3d3ab9609e6 100644 --- a/crates/web-sys/src/features/gen_IdbObjectStore.rs +++ b/crates/web-sys/src/features/gen_IdbObjectStore.rs @@ -104,7 +104,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn count_with_key( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbIndex")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = createIndex)] @@ -141,7 +141,7 @@ extern "C" { this: &IdbObjectStore, name: &str, key_path: &str, - optional_parameters: &IdbIndexParameters, + options: &IdbIndexParameters, ) -> Result; #[cfg(all(feature = "IdbIndex", feature = "IdbIndexParameters",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = createIndex)] @@ -154,7 +154,7 @@ extern "C" { this: &IdbObjectStore, name: &str, key_path: &::wasm_bindgen::JsValue, - optional_parameters: &IdbIndexParameters, + options: &IdbIndexParameters, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = delete)] @@ -165,7 +165,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn delete( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = deleteIndex)] #[doc = "The `deleteIndex()` method."] @@ -173,7 +173,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/deleteIndex)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`*"] - pub fn delete_index(this: &IdbObjectStore, index_name: &str) -> Result<(), JsValue>; + pub fn delete_index(this: &IdbObjectStore, name: &str) -> Result<(), JsValue>; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = get)] #[doc = "The `get()` method."] @@ -181,8 +181,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/get)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] - pub fn get(this: &IdbObjectStore, key: &::wasm_bindgen::JsValue) - -> Result; + pub fn get( + this: &IdbObjectStore, + query: &::wasm_bindgen::JsValue, + ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAll)] #[doc = "The `getAll()` method."] @@ -200,7 +202,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn get_all_with_key( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAll)] @@ -211,8 +213,8 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn get_all_with_key_and_limit( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, - limit: u32, + query: &::wasm_bindgen::JsValue, + count: u32, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAllKeys)] @@ -231,7 +233,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn get_all_keys_with_key( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAllKeys)] @@ -242,8 +244,8 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn get_all_keys_with_key_and_limit( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, - limit: u32, + query: &::wasm_bindgen::JsValue, + count: u32, ) -> Result; #[cfg(feature = "IdbRequest")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getKey)] @@ -254,7 +256,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn get_key( this: &IdbObjectStore, - key: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(feature = "IdbIndex")] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = index)] @@ -281,7 +283,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn open_cursor_with_range( this: &IdbObjectStore, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = openCursor)] @@ -292,7 +294,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbObjectStore`, `IdbRequest`*"] pub fn open_cursor_with_range_and_direction( this: &IdbObjectStore, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, direction: IdbCursorDirection, ) -> Result; #[cfg(feature = "IdbRequest")] @@ -312,7 +314,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"] pub fn open_key_cursor_with_range( this: &IdbObjectStore, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, ) -> Result; #[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = openKeyCursor)] @@ -323,7 +325,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbObjectStore`, `IdbRequest`*"] pub fn open_key_cursor_with_range_and_direction( this: &IdbObjectStore, - range: &::wasm_bindgen::JsValue, + query: &::wasm_bindgen::JsValue, direction: IdbCursorDirection, ) -> Result; #[cfg(feature = "IdbRequest")] diff --git a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs index 162108e06b4..b9fc6f4eb2b 100644 --- a/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs +++ b/crates/web-sys/src/features/gen_IdbOpenDbOptions.rs @@ -9,27 +9,32 @@ extern "C" { #[doc = "The `IdbOpenDbOptions` dictionary."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[deprecated] pub type IdbOpenDbOptions; #[cfg(feature = "StorageType")] #[doc = "Get the `storage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] + #[deprecated] #[wasm_bindgen(method, getter = "storage")] pub fn get_storage(this: &IdbOpenDbOptions) -> Option; #[cfg(feature = "StorageType")] #[doc = "Change the `storage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"] + #[deprecated] #[wasm_bindgen(method, setter = "storage")] pub fn set_storage(this: &IdbOpenDbOptions, val: StorageType); #[doc = "Get the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[deprecated] #[wasm_bindgen(method, getter = "version")] pub fn get_version(this: &IdbOpenDbOptions) -> Option; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[deprecated] #[wasm_bindgen(method, setter = "version")] pub fn set_version(this: &IdbOpenDbOptions, val: f64); } @@ -37,6 +42,7 @@ impl IdbOpenDbOptions { #[doc = "Construct a new `IdbOpenDbOptions`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"] + #[deprecated] pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); diff --git a/crates/web-sys/src/features/gen_IdbTransaction.rs b/crates/web-sys/src/features/gen_IdbTransaction.rs index 70a8620df78..cf83d06efd2 100644 --- a/crates/web-sys/src/features/gen_IdbTransaction.rs +++ b/crates/web-sys/src/features/gen_IdbTransaction.rs @@ -12,6 +12,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"] pub type IdbTransaction; + #[cfg(feature = "DomStringList")] + # [wasm_bindgen (structural , method , getter , js_class = "IDBTransaction" , js_name = objectStoreNames)] + #[doc = "Getter for the `objectStoreNames` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/objectStoreNames)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomStringList`, `IdbTransaction`*"] + pub fn object_store_names(this: &IdbTransaction) -> DomStringList; #[cfg(feature = "IdbTransactionMode")] # [wasm_bindgen (structural , catch , method , getter , js_class = "IDBTransaction" , js_name = mode)] #[doc = "Getter for the `mode` field of this object."] @@ -78,14 +86,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"] pub fn set_onerror(this: &IdbTransaction, value: Option<&::js_sys::Function>); - #[cfg(feature = "DomStringList")] - # [wasm_bindgen (structural , method , getter , js_class = "IDBTransaction" , js_name = objectStoreNames)] - #[doc = "Getter for the `objectStoreNames` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/objectStoreNames)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomStringList`, `IdbTransaction`*"] - pub fn object_store_names(this: &IdbTransaction) -> DomStringList; # [wasm_bindgen (catch , method , structural , js_class = "IDBTransaction" , js_name = abort)] #[doc = "The `abort()` method."] #[doc = ""] @@ -99,6 +99,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/commit)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"] + #[deprecated] pub fn commit(this: &IdbTransaction) -> Result<(), JsValue>; #[cfg(feature = "IdbObjectStore")] # [wasm_bindgen (catch , method , structural , js_class = "IDBTransaction" , js_name = objectStore)] diff --git a/crates/web-sys/src/features/gen_IdbTransactionDurability.rs b/crates/web-sys/src/features/gen_IdbTransactionDurability.rs new file mode 100644 index 00000000000..756fac38578 --- /dev/null +++ b/crates/web-sys/src/features/gen_IdbTransactionDurability.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `IdbTransactionDurability` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum IdbTransactionDurability { + Default = "default", + Strict = "strict", + Relaxed = "relaxed", +} diff --git a/crates/web-sys/src/features/gen_IdbTransactionMode.rs b/crates/web-sys/src/features/gen_IdbTransactionMode.rs index 8115b39d2db..e0886c5284e 100644 --- a/crates/web-sys/src/features/gen_IdbTransactionMode.rs +++ b/crates/web-sys/src/features/gen_IdbTransactionMode.rs @@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*; pub enum IdbTransactionMode { Readonly = "readonly", Readwrite = "readwrite", + Versionchange = "versionchange", Readwriteflush = "readwriteflush", Cleanup = "cleanup", - Versionchange = "versionchange", } diff --git a/crates/web-sys/src/features/gen_IdbTransactionOptions.rs b/crates/web-sys/src/features/gen_IdbTransactionOptions.rs new file mode 100644 index 00000000000..5f4ac1cd485 --- /dev/null +++ b/crates/web-sys/src/features/gen_IdbTransactionOptions.rs @@ -0,0 +1,64 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = IDBTransactionOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `IdbTransactionOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type IdbTransactionOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IdbTransactionDurability")] + #[doc = "Get the `durability` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`, `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "durability")] + pub fn get_durability(this: &IdbTransactionOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IdbTransactionDurability")] + #[doc = "Change the `durability` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`, `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "durability")] + pub fn set_durability(this: &IdbTransactionOptions, val: IdbTransactionDurability); +} +#[cfg(web_sys_unstable_apis)] +impl IdbTransactionOptions { + #[doc = "Construct a new `IdbTransactionOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbTransactionOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "IdbTransactionDurability")] + #[deprecated = "Use `set_durability()` instead."] + pub fn durability(&mut self, val: IdbTransactionDurability) -> &mut Self { + self.set_durability(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for IdbTransactionOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index c89c3c6ae75..e9ba9d1a8d3 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1922,6 +1922,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`, `Window`*"] pub fn local_storage(this: &Window) -> Result, JsValue>; + #[cfg(feature = "IdbFactory")] + # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = indexedDB)] + #[doc = "Getter for the `indexedDB` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/indexedDB)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `Window`*"] + pub fn indexed_db(this: &Window) -> Result, JsValue>; #[cfg(feature = "Performance")] # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)] #[doc = "Getter for the `performance` field of this object."] @@ -1944,14 +1952,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn is_secure_context(this: &Window) -> bool; - #[cfg(feature = "IdbFactory")] - # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = indexedDB)] - #[doc = "Getter for the `indexedDB` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/indexedDB)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `Window`*"] - pub fn indexed_db(this: &Window) -> Result, JsValue>; #[cfg(feature = "CacheStorage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = caches)] #[doc = "Getter for the `caches` field of this object."] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index d46c62d8211..ff7518533e5 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -85,6 +85,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Crypto`, `WorkerGlobalScope`*"] pub fn crypto(this: &WorkerGlobalScope) -> Result; + #[cfg(feature = "IdbFactory")] + # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = indexedDB)] + #[doc = "Getter for the `indexedDB` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/indexedDB)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `WorkerGlobalScope`*"] + pub fn indexed_db(this: &WorkerGlobalScope) -> Result, JsValue>; #[cfg(feature = "Performance")] # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = performance)] #[doc = "Getter for the `performance` field of this object."] @@ -107,14 +115,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] pub fn is_secure_context(this: &WorkerGlobalScope) -> bool; - #[cfg(feature = "IdbFactory")] - # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = indexedDB)] - #[doc = "Getter for the `indexedDB` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/indexedDB)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `WorkerGlobalScope`*"] - pub fn indexed_db(this: &WorkerGlobalScope) -> Result, JsValue>; #[cfg(feature = "CacheStorage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = caches)] #[doc = "Getter for the `caches` field of this object."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index d2039edb41d..cf01e4d5763 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -4828,6 +4828,13 @@ mod gen_IdbTransaction; #[allow(unused_imports)] pub use gen_IdbTransaction::*; +#[cfg(feature = "IdbTransactionDurability")] +#[allow(non_snake_case)] +mod gen_IdbTransactionDurability; +#[cfg(feature = "IdbTransactionDurability")] +#[allow(unused_imports)] +pub use gen_IdbTransactionDurability::*; + #[cfg(feature = "IdbTransactionMode")] #[allow(non_snake_case)] mod gen_IdbTransactionMode; @@ -4835,6 +4842,13 @@ mod gen_IdbTransactionMode; #[allow(unused_imports)] pub use gen_IdbTransactionMode::*; +#[cfg(feature = "IdbTransactionOptions")] +#[allow(non_snake_case)] +mod gen_IdbTransactionOptions; +#[cfg(feature = "IdbTransactionOptions")] +#[allow(unused_imports)] +pub use gen_IdbTransactionOptions::*; + #[cfg(feature = "IdbVersionChangeEvent")] #[allow(non_snake_case)] mod gen_IdbVersionChangeEvent; diff --git a/crates/web-sys/webidls/enabled/IDB.webidl b/crates/web-sys/webidls/enabled/IDB.webidl new file mode 100644 index 00000000000..aebda8e8e48 --- /dev/null +++ b/crates/web-sys/webidls/enabled/IDB.webidl @@ -0,0 +1,314 @@ +// https://www.w3.org/TR/IndexedDB-2/ + +[Exposed=(Window,Worker)] +interface IDBRequest : EventTarget { + [Throws] + readonly attribute any result; + [Throws] + readonly attribute DOMException? error; + readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source; + readonly attribute IDBTransaction? transaction; + readonly attribute IDBRequestReadyState readyState; + + // Event handlers: + attribute EventHandler onsuccess; + attribute EventHandler onerror; +}; + +enum IDBRequestReadyState { + "pending", + "done" +}; + +[Exposed=(Window,Worker)] +interface IDBOpenDBRequest : IDBRequest { + // Event handlers: + attribute EventHandler onblocked; + attribute EventHandler onupgradeneeded; +}; + +[Exposed=(Window,Worker), + Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict)] +interface IDBVersionChangeEvent : Event { + readonly attribute unsigned long long oldVersion; + readonly attribute unsigned long long? newVersion; +}; + +dictionary IDBVersionChangeEventInit : EventInit { + unsigned long long oldVersion = 0; + unsigned long long? newVersion = null; +}; + +partial interface mixin WindowOrWorkerGlobalScope { + // Breaking change: Should this throw or be optional? + [Throws, SameObject] readonly attribute IDBFactory? indexedDB; +}; + +[Exposed=(Window,Worker)] +interface IDBFactory { + [Throws, NewObject] IDBOpenDBRequest open(DOMString name, + optional [EnforceRange] unsigned long long version); + [Throws, NewObject] IDBOpenDBRequest deleteDatabase(DOMString name); + + [Throws] + short cmp(any first, any second); +}; + +[Exposed=(Window,Worker)] +interface IDBDatabase : EventTarget { + readonly attribute DOMString name; + readonly attribute unsigned long long version; + readonly attribute DOMStringList objectStoreNames; + + [Throws, NewObject] IDBTransaction transaction((DOMString or sequence) storeNames, + optional IDBTransactionMode mode = "readonly"); + undefined close(); + + [Throws, NewObject] IDBObjectStore createObjectStore(DOMString name, + optional IDBObjectStoreParameters options); + [Throws] undefined deleteObjectStore(DOMString name); + + // Event handlers: + attribute EventHandler onabort; + attribute EventHandler onclose; + attribute EventHandler onerror; + attribute EventHandler onversionchange; +}; + +dictionary IDBObjectStoreParameters { + (DOMString or sequence)? keyPath = null; + boolean autoIncrement = false; +}; + +[Exposed=(Window,Worker)] +interface IDBObjectStore { + [SetterThrows] attribute DOMString name; + [Throws] readonly attribute any keyPath; + readonly attribute DOMStringList indexNames; + [SameObject] readonly attribute IDBTransaction transaction; + readonly attribute boolean autoIncrement; + + [Throws, NewObject] IDBRequest put(any value, optional any key); + [Throws, NewObject] IDBRequest add(any value, optional any key); + [Throws, NewObject] IDBRequest delete(any query); + [Throws, NewObject] IDBRequest clear(); + [Throws, NewObject] IDBRequest get(any query); + [Throws, NewObject] IDBRequest getKey(any query); + [Throws, NewObject] IDBRequest getAll(optional any query, + optional [EnforceRange] unsigned long count); + [Throws, NewObject] IDBRequest getAllKeys(optional any query, + optional [EnforceRange] unsigned long count); + [Throws, NewObject] IDBRequest count(optional any query); + + [Throws, NewObject] IDBRequest openCursor(optional any query, + optional IDBCursorDirection direction = "next"); + [Throws, NewObject] IDBRequest openKeyCursor(optional any query, + optional IDBCursorDirection direction = "next"); + + [Throws] IDBIndex index(DOMString name); + + [Throws, NewObject] IDBIndex createIndex(DOMString name, + (DOMString or sequence) keyPath, + optional IDBIndexParameters options); + [Throws] undefined deleteIndex(DOMString name); +}; + +dictionary IDBIndexParameters { + boolean unique = false; + boolean multiEntry = false; +}; + +[Exposed=(Window,Worker)] +interface IDBIndex { + [SetterThrows] attribute DOMString name; + [SameObject] readonly attribute IDBObjectStore objectStore; + [Throws] readonly attribute any keyPath; + readonly attribute boolean multiEntry; + readonly attribute boolean unique; + + [Throws, NewObject] IDBRequest get(any query); + [Throws, NewObject] IDBRequest getKey(any query); + [Throws, NewObject] IDBRequest getAll(optional any query, + optional [EnforceRange] unsigned long count); + [Throws, NewObject] IDBRequest getAllKeys(optional any query, + optional [EnforceRange] unsigned long count); + [Throws, NewObject] IDBRequest count(optional any query); + + [Throws, NewObject] IDBRequest openCursor(optional any query, + optional IDBCursorDirection direction = "next"); + [Throws, NewObject] IDBRequest openKeyCursor(optional any query, + optional IDBCursorDirection direction = "next"); +}; + +[Exposed=(Window,Worker)] +interface IDBKeyRange { + [Throws] readonly attribute any lower; + [Throws] readonly attribute any upper; + readonly attribute boolean lowerOpen; + readonly attribute boolean upperOpen; + + // Static construction methods: + [Throws, NewObject] static IDBKeyRange only(any value); + [Throws, NewObject] static IDBKeyRange lowerBound(any lower, optional boolean open = false); + [Throws, NewObject] static IDBKeyRange upperBound(any upper, optional boolean open = false); + [Throws, NewObject] static IDBKeyRange bound(any lower, + any upper, + optional boolean lowerOpen = false, + optional boolean upperOpen = false); + + [Throws] boolean _includes(any key); +}; + +[Exposed=(Window,Worker)] +interface IDBCursor { + readonly attribute (IDBObjectStore or IDBIndex) source; + readonly attribute IDBCursorDirection direction; + [Throws] readonly attribute any key; + [Throws] readonly attribute any primaryKey; + + [Throws] undefined advance([EnforceRange] unsigned long count); + [Throws] undefined continue(optional any key); + [Throws] undefined continuePrimaryKey(any key, any primaryKey); + + [Throws, NewObject] IDBRequest update(any value); + [Throws, NewObject] IDBRequest delete(); +}; + +enum IDBCursorDirection { + "next", + "nextunique", + "prev", + "prevunique" +}; + +[Exposed=(Window,Worker)] +interface IDBCursorWithValue : IDBCursor { + [Throws] readonly attribute any value; +}; + +[Exposed=(Window,Worker)] +interface IDBTransaction : EventTarget { + readonly attribute DOMStringList objectStoreNames; + [Throws] readonly attribute IDBTransactionMode mode; + [SameObject] readonly attribute IDBDatabase db; + // TODO: remove optional? + readonly attribute DOMException? error; + + [Throws] IDBObjectStore objectStore(DOMString name); + [Throws] undefined abort(); + + // Event handlers: + attribute EventHandler onabort; + attribute EventHandler oncomplete; + attribute EventHandler onerror; +}; + +enum IDBTransactionMode { + "readonly", + "readwrite", + "versionchange", + // TODO: deprecated + "readwriteflush", + // TODO: deprecated + "cleanup" +}; + +/* +** DEPRECATED +*/ + +partial interface IDBFactory { + [RustDeprecated, Throws, NewObject] + IDBOpenDBRequest open(DOMString name, optional IDBOpenDBOptions options = {}); + [RustDeprecated, Throws, NewObject] + IDBOpenDBRequest deleteDatabase(DOMString name, optional IDBOpenDBOptions options = {}); +}; + +partial dictionary IDBIndexParameters { + [RustDeprecated] DOMString? locale = null; +}; + +partial interface IDBIndex { + [RustDeprecated] readonly attribute DOMString? locale; + [RustDeprecated] readonly attribute boolean isAutoLocale; +}; + +partial interface IDBCursor { + [RustDeprecated] readonly attribute IDBRequest request; +}; + +partial interface IDBTransaction { + [RustDeprecated, Throws] undefined commit(); +}; + +partial interface IDBDatabase { + [RustDeprecated] readonly attribute StorageType storage; + [RustDeprecated, Throws] IDBRequest createMutableFile (DOMString name, optional DOMString type); +}; + +[RustDeprecated] dictionary IDBOpenDBOptions { + [EnforceRange] unsigned long long version; + StorageType storage; +}; + +[RustDeprecated] dictionary IDBFileMetadataParameters { + boolean size = true; + boolean lastModified = true; +}; + +[RustDeprecated] interface IDBFileHandle : EventTarget { + readonly attribute IDBMutableFile? mutableFile; + readonly attribute IDBMutableFile? fileHandle; + readonly attribute FileMode mode; + readonly attribute boolean active; + attribute unsigned long long? location; + + [Throws] + IDBFileRequest? getMetadata(optional IDBFileMetadataParameters parameters = {}); + [Throws] + IDBFileRequest? readAsArrayBuffer(unsigned long long size); + [Throws] + IDBFileRequest? readAsText(unsigned long long size, + optional DOMString? encoding = null); + + [Throws] + IDBFileRequest? write((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); + [Throws] + IDBFileRequest? append((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); + [Throws] + IDBFileRequest? truncate(optional unsigned long long size); + [Throws] + IDBFileRequest? flush(); + [Throws] + undefined abort(); + + attribute EventHandler oncomplete; + attribute EventHandler onabort; + attribute EventHandler onerror; +}; + +[RustDeprecated] interface IDBFileRequest : DOMRequest { + readonly attribute IDBFileHandle? fileHandle; + readonly attribute IDBFileHandle? lockedFile; + + attribute EventHandler onprogress; +}; + +[RustDeprecated] interface IDBLocaleAwareKeyRange : IDBKeyRange { + [Throws] + static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); +}; + +[RustDeprecated] interface IDBMutableFile : EventTarget { + readonly attribute DOMString name; + readonly attribute DOMString type; + + readonly attribute IDBDatabase database; + + [Throws] IDBFileHandle open(optional FileMode mode = "readonly"); + + [Throws] DOMRequest getFile(); + + attribute EventHandler onabort; + attribute EventHandler onerror; +}; diff --git a/crates/web-sys/webidls/enabled/IDBCursor.webidl b/crates/web-sys/webidls/enabled/IDBCursor.webidl deleted file mode 100644 index bbbfebecde2..00000000000 --- a/crates/web-sys/webidls/enabled/IDBCursor.webidl +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursorDirection - */ - -enum IDBCursorDirection { - "next", - "nextunique", - "prev", - "prevunique" -}; - -[Exposed=(Window,Worker)] -interface IDBCursor { - readonly attribute (IDBObjectStore or IDBIndex) source; - - [BinaryName="getDirection"] - readonly attribute IDBCursorDirection direction; - - [Throws] - readonly attribute any key; - - [Throws] - readonly attribute any primaryKey; - - readonly attribute IDBRequest request; - - [Throws] - IDBRequest update (any value); - - [Throws] - undefined advance ([EnforceRange] unsigned long count); - - [Throws] - undefined continue (optional any key); - - [Throws] - undefined continuePrimaryKey(any key, any primaryKey); - - [Throws] - IDBRequest delete (); -}; - -[Exposed=(Window,Worker)] -interface IDBCursorWithValue : IDBCursor { - [Throws] - readonly attribute any value; -}; diff --git a/crates/web-sys/webidls/enabled/IDBDatabase.webidl b/crates/web-sys/webidls/enabled/IDBDatabase.webidl deleted file mode 100644 index 069901a686c..00000000000 --- a/crates/web-sys/webidls/enabled/IDBDatabase.webidl +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStoreParameters - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=(Window,Worker)] -interface IDBDatabase : EventTarget { - readonly attribute DOMString name; - readonly attribute unsigned long long version; - - readonly attribute DOMStringList objectStoreNames; - - [Throws] - IDBObjectStore createObjectStore (DOMString name, optional IDBObjectStoreParameters optionalParameters = {}); - - [Throws] - undefined deleteObjectStore (DOMString name); - - [Throws] - IDBTransaction transaction ((DOMString or sequence) storeNames, - optional IDBTransactionMode mode = "readonly"); - - undefined close (); - - attribute EventHandler onabort; - attribute EventHandler onclose; - attribute EventHandler onerror; - attribute EventHandler onversionchange; -}; - -partial interface IDBDatabase { - [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] - readonly attribute StorageType storage; - - [Exposed=Window, Throws, Deprecated="IDBDatabaseCreateMutableFile"] - IDBRequest createMutableFile (DOMString name, optional DOMString type); -}; diff --git a/crates/web-sys/webidls/enabled/IDBFactory.webidl b/crates/web-sys/webidls/enabled/IDBFactory.webidl deleted file mode 100644 index e8b2c3ec001..00000000000 --- a/crates/web-sys/webidls/enabled/IDBFactory.webidl +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -// invalid widl -// interface Principal; - -dictionary IDBOpenDBOptions -{ - [EnforceRange] unsigned long long version; - StorageType storage; -}; - -/** - * Interface that defines the indexedDB property on a window. See - * http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory - * for more information. - */ -[Exposed=(Window,Worker)] -interface IDBFactory { - [Throws, NeedsCallerType] - IDBOpenDBRequest - open(DOMString name, - [EnforceRange] unsigned long long version); - - [Throws, NeedsCallerType] - IDBOpenDBRequest - open(DOMString name, - optional IDBOpenDBOptions options = {}); - - [Throws, NeedsCallerType] - IDBOpenDBRequest - deleteDatabase(DOMString name, - optional IDBOpenDBOptions options = {}); - - [Throws] - short - cmp(any first, - any second); - - [Throws, ChromeOnly, NeedsCallerType] - IDBOpenDBRequest - openForPrincipal(Principal principal, - DOMString name, - [EnforceRange] unsigned long long version); - - [Throws, ChromeOnly, NeedsCallerType] - IDBOpenDBRequest - openForPrincipal(Principal principal, - DOMString name, - optional IDBOpenDBOptions options = {}); - - [Throws, ChromeOnly, NeedsCallerType] - IDBOpenDBRequest - deleteForPrincipal(Principal principal, - DOMString name, - optional IDBOpenDBOptions options = {}); -}; diff --git a/crates/web-sys/webidls/enabled/IDBFileHandle.webidl b/crates/web-sys/webidls/enabled/IDBFileHandle.webidl deleted file mode 100644 index 233ff2f24fc..00000000000 --- a/crates/web-sys/webidls/enabled/IDBFileHandle.webidl +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtaone at http://mozilla.org/MPL/2.0/. */ - -dictionary IDBFileMetadataParameters -{ - boolean size = true; - boolean lastModified = true; -}; - -[Exposed=Window] -interface IDBFileHandle : EventTarget -{ - readonly attribute IDBMutableFile? mutableFile; - // this is deprecated due to renaming in the spec - readonly attribute IDBMutableFile? fileHandle; // now mutableFile - readonly attribute FileMode mode; - readonly attribute boolean active; - attribute unsigned long long? location; - - [Throws] - IDBFileRequest? getMetadata(optional IDBFileMetadataParameters parameters = {}); - [Throws] - IDBFileRequest? readAsArrayBuffer(unsigned long long size); - [Throws] - IDBFileRequest? readAsText(unsigned long long size, - optional DOMString? encoding = null); - - [Throws] - IDBFileRequest? write((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); - [Throws] - IDBFileRequest? append((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); - [Throws] - IDBFileRequest? truncate(optional unsigned long long size); - [Throws] - IDBFileRequest? flush(); - [Throws] - undefined abort(); - - attribute EventHandler oncomplete; - attribute EventHandler onabort; - attribute EventHandler onerror; -}; diff --git a/crates/web-sys/webidls/enabled/IDBFileRequest.webidl b/crates/web-sys/webidls/enabled/IDBFileRequest.webidl deleted file mode 100644 index 7e9bae27a77..00000000000 --- a/crates/web-sys/webidls/enabled/IDBFileRequest.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -[Exposed=Window] -interface IDBFileRequest : DOMRequest { - readonly attribute IDBFileHandle? fileHandle; - // this is deprecated due to renaming in the spec - readonly attribute IDBFileHandle? lockedFile; // now fileHandle - - attribute EventHandler onprogress; -}; diff --git a/crates/web-sys/webidls/enabled/IDBIndex.webidl b/crates/web-sys/webidls/enabled/IDBIndex.webidl deleted file mode 100644 index f53576374ce..00000000000 --- a/crates/web-sys/webidls/enabled/IDBIndex.webidl +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBIndexParameters - */ - -dictionary IDBIndexParameters { - boolean unique = false; - boolean multiEntry = false; - // : Not locale-aware, uses normal JS sorting. - // : Always sorted based on the rules of the specified - // locale (e.g. "en-US", etc.). - // "auto": Sorted by the platform default, may change based on - // user agent options. - DOMString? locale = null; -}; - -[Exposed=(Window,Worker)] -interface IDBIndex { - [SetterThrows] - attribute DOMString name; - - readonly attribute IDBObjectStore objectStore; - - [Throws] - readonly attribute any keyPath; - - readonly attribute boolean multiEntry; - readonly attribute boolean unique; - - // : Not locale-aware, uses normal JS sorting. - // : Sorted based on the rules of the specified locale. - // Note: never returns "auto", only the current locale. - [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] - readonly attribute DOMString? locale; - - [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] - readonly attribute boolean isAutoLocale; - - [Throws] - IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next"); - - [Throws] - IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next"); - - [Throws] - IDBRequest get (any key); - - [Throws] - IDBRequest getKey (any key); - - [Throws] - IDBRequest count (optional any key); -}; - -partial interface IDBIndex { - [Throws] - IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); - - [Throws] - IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); -}; diff --git a/crates/web-sys/webidls/enabled/IDBKeyRange.webidl b/crates/web-sys/webidls/enabled/IDBKeyRange.webidl deleted file mode 100644 index 92469aeb049..00000000000 --- a/crates/web-sys/webidls/enabled/IDBKeyRange.webidl +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=(Window,Worker)] -interface IDBKeyRange { - [Throws] - readonly attribute any lower; - [Throws] - readonly attribute any upper; - [Constant] - readonly attribute boolean lowerOpen; - [Constant] - readonly attribute boolean upperOpen; - [Throws] - boolean _includes(any key); - - - [NewObject, Throws] - static IDBKeyRange only (any value); - [NewObject, Throws] - static IDBKeyRange lowerBound (any lower, optional boolean open = false); - [NewObject, Throws] - static IDBKeyRange upperBound (any upper, optional boolean open = false); - [NewObject, Throws] - static IDBKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); -}; - -[Exposed=(Window,Worker), - Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] -interface IDBLocaleAwareKeyRange : IDBKeyRange { - [NewObject, Throws] - static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); -}; diff --git a/crates/web-sys/webidls/enabled/IDBMutableFile.webidl b/crates/web-sys/webidls/enabled/IDBMutableFile.webidl deleted file mode 100644 index 973a0e5d09a..00000000000 --- a/crates/web-sys/webidls/enabled/IDBMutableFile.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -[Exposed=Window] -interface IDBMutableFile : EventTarget { - readonly attribute DOMString name; - readonly attribute DOMString type; - - readonly attribute IDBDatabase database; - - [Throws, Deprecated="IDBMutableFileOpen"] - IDBFileHandle open(optional FileMode mode = "readonly"); - - [Throws, UseCounter] - DOMRequest getFile(); - - attribute EventHandler onabort; - attribute EventHandler onerror; -}; diff --git a/crates/web-sys/webidls/enabled/IDBObjectStore.webidl b/crates/web-sys/webidls/enabled/IDBObjectStore.webidl deleted file mode 100644 index 70a650b1706..00000000000 --- a/crates/web-sys/webidls/enabled/IDBObjectStore.webidl +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore - */ - -dictionary IDBObjectStoreParameters { - (DOMString or sequence)? keyPath = null; - boolean autoIncrement = false; -}; - -[Exposed=(Window,Worker)] -interface IDBObjectStore { - [SetterThrows] - attribute DOMString name; - - [Throws] - readonly attribute any keyPath; - - readonly attribute DOMStringList indexNames; - readonly attribute IDBTransaction transaction; - readonly attribute boolean autoIncrement; - - [Throws] - IDBRequest put (any value, optional any key); - - [Throws] - IDBRequest add (any value, optional any key); - - [Throws] - IDBRequest delete (any key); - - [Throws] - IDBRequest get (any key); - - [Throws] - IDBRequest getKey (any key); - - [Throws] - IDBRequest clear (); - - [Throws] - IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next"); - - [Throws] - IDBIndex createIndex (DOMString name, (DOMString or sequence) keyPath, optional IDBIndexParameters optionalParameters = {}); - - [Throws] - IDBIndex index (DOMString name); - - [Throws] - undefined deleteIndex (DOMString indexName); - - [Throws] - IDBRequest count (optional any key); -}; - -partial interface IDBObjectStore { - [Throws] - IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); - - [Throws] - IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); - - [Throws] - IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next"); -}; diff --git a/crates/web-sys/webidls/enabled/IDBOpenDBRequest.webidl b/crates/web-sys/webidls/enabled/IDBOpenDBRequest.webidl deleted file mode 100644 index 8668009a6b7..00000000000 --- a/crates/web-sys/webidls/enabled/IDBOpenDBRequest.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBOpenDBRequest - */ - -[Exposed=(Window,Worker)] -interface IDBOpenDBRequest : IDBRequest { - attribute EventHandler onblocked; - - attribute EventHandler onupgradeneeded; -}; diff --git a/crates/web-sys/webidls/enabled/IDBRequest.webidl b/crates/web-sys/webidls/enabled/IDBRequest.webidl deleted file mode 100644 index 029368bc7d1..00000000000 --- a/crates/web-sys/webidls/enabled/IDBRequest.webidl +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBRequest - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBRequestReadyState - */ - -enum IDBRequestReadyState { - "pending", - "done" -}; - -[Exposed=(Window,Worker)] -interface IDBRequest : EventTarget { - [Throws] - readonly attribute any result; - - [Throws] - readonly attribute DOMException? error; - - readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source; - readonly attribute IDBTransaction? transaction; - readonly attribute IDBRequestReadyState readyState; - - attribute EventHandler onsuccess; - - attribute EventHandler onerror; -}; diff --git a/crates/web-sys/webidls/enabled/IDBTransaction.webidl b/crates/web-sys/webidls/enabled/IDBTransaction.webidl deleted file mode 100644 index 13ded1c7953..00000000000 --- a/crates/web-sys/webidls/enabled/IDBTransaction.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransactionMode - */ - -enum IDBTransactionMode { - "readonly", - "readwrite", - // The "readwriteflush" mode is only available when the - // |IndexedDatabaseManager::ExperimentalFeaturesEnabled()| function returns - // true. This mode is not yet part of the standard. - "readwriteflush", - "cleanup", - "versionchange" -}; - -[Exposed=(Window,Worker)] -interface IDBTransaction : EventTarget { - [Throws] - readonly attribute IDBTransactionMode mode; - readonly attribute IDBDatabase db; - - readonly attribute DOMException? error; - - [Throws] - IDBObjectStore objectStore (DOMString name); - - [Throws] - undefined commit(); - - [Throws] - undefined abort(); - - attribute EventHandler onabort; - attribute EventHandler oncomplete; - attribute EventHandler onerror; -}; - -// This seems to be custom -partial interface IDBTransaction { - readonly attribute DOMStringList objectStoreNames; -}; diff --git a/crates/web-sys/webidls/enabled/IDBVersionChangeEvent.webidl b/crates/web-sys/webidls/enabled/IDBVersionChangeEvent.webidl deleted file mode 100644 index c25f561d7be..00000000000 --- a/crates/web-sys/webidls/enabled/IDBVersionChangeEvent.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBVersionChangeEvent - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -dictionary IDBVersionChangeEventInit : EventInit { - unsigned long long oldVersion = 0; - unsigned long long? newVersion = null; -}; - -[Exposed=(Window,Worker)] -interface IDBVersionChangeEvent : Event { - constructor(DOMString type, - optional IDBVersionChangeEventInit eventInitDict = {}); - - readonly attribute unsigned long long oldVersion; - readonly attribute unsigned long long? newVersion; -}; diff --git a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl index 3c06b1bf716..48ced2ae891 100644 --- a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl +++ b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl @@ -56,13 +56,6 @@ partial interface mixin WindowOrWorkerGlobalScope { readonly attribute boolean isSecureContext; }; -// http://w3c.github.io/IndexedDB/#factory-interface -partial interface mixin WindowOrWorkerGlobalScope { - // readonly attribute IDBFactory indexedDB; - [Throws] - readonly attribute IDBFactory? indexedDB; -}; - // https://w3c.github.io/ServiceWorker/#self-caches partial interface mixin WindowOrWorkerGlobalScope { [Throws, Func="mozilla::dom::DOMPrefs::DOMCachesEnabled", SameObject] diff --git a/crates/web-sys/webidls/unstable/IDB.webidl b/crates/web-sys/webidls/unstable/IDB.webidl new file mode 100644 index 00000000000..a4348de9c4b --- /dev/null +++ b/crates/web-sys/webidls/unstable/IDB.webidl @@ -0,0 +1,13 @@ +// https://www.w3.org/TR/2023/WD-IndexedDB-3-20231212/ + +interface mixin IDBDatabase { + [Throws, NewObject] IDBTransaction transaction((DOMString or sequence) storeNames, + optional IDBTransactionMode mode = "readonly", + optional IDBTransactionOptions options = {}); +}; + +enum IDBTransactionDurability { "default", "strict", "relaxed" }; + +dictionary IDBTransactionOptions { + IDBTransactionDurability durability = "default"; +}; diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 91bb047a7c1..6c9a6a6726c 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -20,7 +20,7 @@ heck = "0.3" log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' -syn = { version = '2.0', features = ['full'] } +syn = { version = '2.0', features = ['extra-traits', 'full'] } wasm-bindgen-backend = { version = "=0.2.92", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index b455556ef3e..4744e47fd5a 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -165,6 +165,71 @@ pub(crate) static FIXED_INTERFACES: Lazy< ), ]), ), + ( + "IdbFactory", + BTreeMap::from_iter([("open_with_options", "open_with_idb_open_db_options")]), + ), + ( + "IdbDatabase", + BTreeMap::from_iter([( + "create_object_store_with_options", + "create_object_store_with_optional_parameters", + )]), + ), + ( + "IdbObjectStore", + BTreeMap::from_iter([ + ("count_with_query", "count_with_key"), + ( + "create_index_with_str_and_options", + "create_index_with_str_and_optional_parameters", + ), + ( + "create_index_with_str_sequence_and_options", + "create_index_with_str_sequence_and_optional_parameters", + ), + ("open_cursor_with_query", "open_cursor_with_range"), + ( + "open_cursor_with_query_and_direction", + "open_cursor_with_range_and_direction", + ), + ("open_key_cursor_with_query", "open_key_cursor_with_range"), + ( + "open_key_cursor_with_query_and_direction", + "open_key_cursor_with_range_and_direction", + ), + ("get_all_with_query", "get_all_with_key"), + ("get_all_with_query_and_count", "get_all_with_key_and_limit"), + ("get_all_keys_with_query", "get_all_keys_with_key"), + ( + "get_all_keys_with_query_and_count", + "get_all_keys_with_key_and_limit", + ), + ]), + ), + ( + "IdbIndex", + BTreeMap::from_iter([ + ("count_with_query", "count_with_key"), + ("open_cursor_with_query", "open_cursor_with_range"), + ( + "open_cursor_with_query_and_direction", + "open_cursor_with_range_and_direction", + ), + ("open_key_cursor_with_query", "open_key_cursor_with_range"), + ( + "open_key_cursor_with_query_and_direction", + "open_key_cursor_with_range_and_direction", + ), + ("get_all_with_query", "get_all_with_key"), + ("get_all_with_query_and_count", "get_all_with_key_and_limit"), + ("get_all_keys_with_query", "get_all_keys_with_key"), + ( + "get_all_keys_with_query_and_count", + "get_all_keys_with_key_and_limit", + ), + ]), + ), ]) }); diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index 7eb8df18166..2dd2bb33680 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -8,6 +8,7 @@ use wasm_bindgen_backend::util::leading_colon_path_ty; use wasm_bindgen_backend::util::{raw_ident, rust_ident}; use crate::constants::{BUILTIN_IDENTS, POLYFILL_INTERFACES}; +use crate::idl_type::IdlType; use crate::traverse::TraverseType; use crate::util::shared_ref; use crate::util::{get_cfg_features, mdn_doc, required_doc_string, snake_case_ident}; @@ -63,11 +64,14 @@ fn maybe_unstable_docs(unstable: bool) -> Option { } } -fn generate_arguments(arguments: &[(Ident, Type)], variadic: bool) -> Vec { +fn generate_arguments( + arguments: &[(Ident, IdlType<'_>, Type)], + variadic: bool, +) -> Vec { arguments .iter() .enumerate() - .map(|(i, (name, ty))| { + .map(|(i, (name, _, ty))| { if variadic && i + 1 == arguments.len() { quote!( #name: &::js_sys::Array ) } else { @@ -194,6 +198,7 @@ impl Const { options: &Options, parent_name: &Ident, parent_js_name: &str, + deprecated: &Option>, ) -> TokenStream { let name = &self.name; let ty = &self.ty; @@ -209,10 +214,16 @@ impl Const { &get_features_doc(options, parent_name.to_string()), ); + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); + quote! { #unstable_attr #doc_comment #unstable_docs + #deprecated pub const #name: #ty = #value as #ty; } } @@ -241,6 +252,7 @@ impl InterfaceAttribute { parent_name: &Ident, parent_js_name: &str, parents: &[Ident], + parent_deprecated: &Option>, ) -> TokenStream { let InterfaceAttribute { js_name, @@ -321,10 +333,13 @@ impl InterfaceAttribute { }; let catch = if *catch { Some(quote!(catch,)) } else { None }; - let deprecated = deprecated.as_ref().map(|msg| match msg { - Some(msg) => quote!( #[deprecated(note = #msg)] ), - None => quote!( #[deprecated] ), - }); + let deprecated = deprecated + .as_ref() + .or(parent_deprecated.as_ref()) + .map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let doc_comment = comment( format!( @@ -364,11 +379,12 @@ pub enum InterfaceMethodKind { IndexingDeleter, } -pub struct InterfaceMethod { +pub struct InterfaceMethod<'a> { pub name: Ident, pub js_name: String, pub deprecated: Option>, - pub arguments: Vec<(Ident, Type)>, + pub arguments: Vec<(Ident, IdlType<'a>, Type)>, + pub variadic_type: Option>, pub ret_ty: Option, pub kind: InterfaceMethodKind, pub is_static: bool, @@ -378,19 +394,21 @@ pub struct InterfaceMethod { pub unstable: bool, } -impl InterfaceMethod { +impl InterfaceMethod<'_> { fn generate( &self, options: &Options, parent_name: &Ident, parent_js_name: String, parents: &[Ident], + parent_deprecated: &Option>, ) -> TokenStream { let InterfaceMethod { name, js_name, deprecated, arguments, + variadic_type: _, ret_ty, kind, is_static, @@ -452,7 +470,7 @@ impl InterfaceMethod { let mut features = BTreeSet::new(); - for (_, ty) in arguments.iter() { + for (_, _, ty) in arguments.iter() { add_features(&mut features, ty); } @@ -472,10 +490,13 @@ impl InterfaceMethod { let doc_comment = comment(doc_comment, &required_doc_string(options, &features)); - let deprecated = deprecated.as_ref().map(|msg| match msg { - Some(msg) => quote!( #[deprecated(note = #msg)] ), - None => quote!( #[deprecated] ), - }); + let deprecated = deprecated + .as_ref() + .or(parent_deprecated.as_ref()) + .map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let ret = ret_ty.as_ref().map(|ret| quote!( #ret )); @@ -529,7 +550,7 @@ impl InterfaceMethod { } } -pub struct Interface { +pub struct Interface<'a> { pub name: Ident, pub js_name: String, pub deprecated: Option>, @@ -537,11 +558,11 @@ pub struct Interface { pub parents: Vec, pub consts: Vec, pub attributes: Vec, - pub methods: Vec, + pub methods: Vec>, pub unstable: bool, } -impl Interface { +impl Interface<'_> { pub fn generate(&self, options: &Options) -> TokenStream { let Interface { name, @@ -563,11 +584,6 @@ impl Interface { &get_features_doc(options, name.to_string()), ); - let deprecated = deprecated.as_ref().map(|msg| match msg { - Some(msg) => quote!( #[deprecated(note = #msg)] ), - None => quote!( #[deprecated] ), - }); - let is_type_of = if *has_interface { None } else { @@ -587,7 +603,7 @@ impl Interface { let consts = consts .iter() - .map(|x| x.generate(options, name, js_name)) + .map(|x| x.generate(options, name, js_name, deprecated)) .collect::>(); let consts = if consts.is_empty() { @@ -596,21 +612,25 @@ impl Interface { Some(quote! { #unstable_attr impl #name { - #(#deprecated #consts)* + #(#consts)* } }) }; let attributes = attributes .iter() - .map(|x| x.generate(options, name, js_name, parents)) + .map(|x| x.generate(options, name, js_name, parents, deprecated)) .collect::>(); let methods = methods .iter() - .map(|x| x.generate(options, name, js_name.to_string(), parents)) + .map(|x| x.generate(options, name, js_name.to_string(), parents, deprecated)) .collect::>(); + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let js_ident = raw_ident(js_name); quote! { @@ -636,8 +656,8 @@ impl Interface { #deprecated pub type #name; - #(#deprecated #attributes)* - #(#deprecated #methods)* + #(#attributes)* + #(#methods)* } #consts @@ -781,6 +801,7 @@ pub struct Dictionary { pub js_name: String, pub fields: Vec, pub unstable: bool, + pub deprecated: Option>, } impl Dictionary { @@ -790,10 +811,15 @@ impl Dictionary { js_name, fields, unstable, + deprecated, } = self; let unstable_attr = maybe_unstable_attr(*unstable); let unstable_docs = maybe_unstable_docs(*unstable); + let deprecated = deprecated.as_ref().map(|msg| match msg { + Some(msg) => quote!( #[deprecated(note = #msg)] ), + None => quote!( #[deprecated] ), + }); let js_name = raw_ident(js_name); @@ -859,6 +885,7 @@ impl Dictionary { #[derive(Debug, Clone, PartialEq, Eq)] #doc_comment #unstable_docs + #deprecated pub type #name; #(#field_shims)* @@ -869,6 +896,7 @@ impl Dictionary { #cfg_features #ctor_doc_comment #unstable_docs + #deprecated pub fn new(#(#required_args),*) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); @@ -897,17 +925,17 @@ impl Dictionary { } } -pub struct Function { +pub struct Function<'a> { pub name: Ident, pub js_name: String, - pub arguments: Vec<(Ident, Type)>, + pub arguments: Vec<(Ident, IdlType<'a>, Type)>, pub ret_ty: Option, pub catch: bool, pub variadic: bool, pub unstable: bool, } -impl Function { +impl Function<'_> { fn generate( &self, options: &Options, @@ -938,7 +966,7 @@ impl Function { let mut features = BTreeSet::new(); - for (_, ty) in arguments.iter() { + for (_, _, ty) in arguments.iter() { add_features(&mut features, ty); } @@ -988,15 +1016,15 @@ impl Function { } } -pub struct Namespace { +pub struct Namespace<'a> { pub name: Ident, pub js_name: String, pub consts: Vec, - pub functions: Vec, + pub functions: Vec>, pub unstable: bool, } -impl Namespace { +impl Namespace<'_> { pub fn generate(&self, options: &Options) -> TokenStream { let Namespace { name, @@ -1027,7 +1055,7 @@ impl Namespace { let consts = consts .iter() - .map(|x| x.generate(options, name, js_name)) + .map(|x| x.generate(options, name, js_name, &None)) .collect::>(); quote! { diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 27839d8d866..ae98c505e15 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use proc_macro2::{Ident, Span}; use wasm_bindgen_backend::util::{ident_ty, leading_colon_path_ty, raw_ident, rust_ident}; use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList}; @@ -29,9 +31,6 @@ pub(crate) enum IdlType<'a> { Object, Symbol, Error, - Callback, - Iterator, - AsyncIterator, ArrayBuffer, DataView, @@ -69,14 +68,6 @@ pub(crate) enum IdlType<'a> { immutable: bool, }, - Interface(&'a str), - Dictionary(&'a str), - Enum(&'a str), - CallbackInterface { - name: &'a str, - single_function: bool, - }, - Nullable(Box>), FrozenArray(Box>), Sequence(Box>), @@ -87,7 +78,28 @@ pub(crate) enum IdlType<'a> { Any, Undefined, - UnknownInterface(&'a str), + UnknownIdentifier(&'a str), + + Identifier { + name: &'a str, + ty: IdentifierType<'a>, + }, +} + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)] +pub(crate) enum IdentifierType<'a> { + Callback, + Iterator, + AsyncIterator, + Interface(&'a str), + Dictionary(&'a str), + Enum(&'a str), + CallbackInterface { + name: &'a str, + single_function: bool, + }, + // DOMTimeStamp + UnsignedLongLong, } pub(crate) trait ToIdlType<'a> { @@ -321,25 +333,25 @@ impl<'a> ToIdlType<'a> for AttributedNonAnyType<'a> { impl<'a> ToIdlType<'a> for Identifier<'a> { fn to_idl_type(&self, record: &FirstPassRecord<'a>) -> IdlType<'a> { - if self.0 == "DOMTimeStamp" { + let ty = if self.0 == "DOMTimeStamp" { // https://heycam.github.io/webidl/#DOMTimeStamp - IdlType::UnsignedLongLong + IdentifierType::UnsignedLongLong } else if let Some(idl_type) = record.typedefs.get(&self.0) { - idl_type.to_idl_type(record) + return idl_type.to_idl_type(record); } else if record.interfaces.contains_key(self.0) { - IdlType::Interface(self.0) + IdentifierType::Interface(self.0) } else if record.dictionaries.contains_key(self.0) { - IdlType::Dictionary(self.0) + IdentifierType::Dictionary(self.0) } else if record.enums.contains_key(self.0) { - IdlType::Enum(self.0) + IdentifierType::Enum(self.0) } else if record.callbacks.contains(self.0) { - IdlType::Callback + IdentifierType::Callback } else if record.iterators.contains(self.0) { - IdlType::Iterator + IdentifierType::Iterator } else if record.async_iterators.contains(self.0) { - IdlType::AsyncIterator + IdentifierType::AsyncIterator } else if let Some(data) = record.callback_interfaces.get(self.0) { - IdlType::CallbackInterface { + IdentifierType::CallbackInterface { name: self.0, single_function: data.single_function, } @@ -350,11 +362,13 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { // // namely this seems to be "legalese" for "this is a `Window`", so // let's translate it as such. - IdlType::Interface("Window") + IdentifierType::Interface("Window") } else { log::warn!("Unrecognized type: {}", self.0); - IdlType::UnknownInterface(self.0) - } + return IdlType::UnknownIdentifier(self.0); + }; + + IdlType::id(self.0, ty) } } @@ -421,6 +435,10 @@ pub enum TypeError { } impl<'a> IdlType<'a> { + fn id(name: &'a str, ty: IdentifierType<'a>) -> Self { + IdlType::Identifier { name, ty } + } + /// Generates a snake case type name. pub(crate) fn push_snake_case_name(&self, dst: &mut String) { match self { @@ -439,9 +457,6 @@ impl<'a> IdlType<'a> { IdlType::Object => dst.push_str("object"), IdlType::Symbol => dst.push_str("symbol"), IdlType::Error => dst.push_str("error"), - IdlType::Callback => dst.push_str("callback"), - IdlType::Iterator => dst.push_str("iterator"), - IdlType::AsyncIterator => dst.push_str("async_iterator"), IdlType::ArrayBuffer => dst.push_str("array_buffer"), IdlType::DataView => dst.push_str("data_view"), @@ -457,11 +472,7 @@ impl<'a> IdlType<'a> { IdlType::ArrayBufferView { .. } => dst.push_str("array_buffer_view"), IdlType::BufferSource { .. } => dst.push_str("buffer_source"), - IdlType::Interface(name) => dst.push_str(&snake_case_ident(name)), - IdlType::UnknownInterface(name) => dst.push_str(&snake_case_ident(name)), - IdlType::Dictionary(name) => dst.push_str(&snake_case_ident(name)), - IdlType::Enum(name) => dst.push_str(&snake_case_ident(name)), - IdlType::CallbackInterface { name, .. } => dst.push_str(&snake_case_ident(name)), + IdlType::UnknownIdentifier(name) => dst.push_str(&snake_case_ident(name)), IdlType::Nullable(idl_type) => { dst.push_str("opt_"); @@ -500,6 +511,21 @@ impl<'a> IdlType<'a> { IdlType::Any => dst.push_str("any"), IdlType::Undefined => dst.push_str("undefined"), + + IdlType::Identifier { ty, .. } => match ty { + IdentifierType::Callback => dst.push_str("callback"), + IdentifierType::Iterator => dst.push_str("iterator"), + IdentifierType::AsyncIterator => dst.push_str("async_iterator"), + IdentifierType::Interface(name) => dst.push_str(&snake_case_ident(name)), + IdentifierType::Dictionary(name) => dst.push_str(&snake_case_ident(name)), + IdentifierType::Enum(name) => dst.push_str(&snake_case_ident(name)), + IdentifierType::CallbackInterface { name, .. } => { + dst.push_str(&snake_case_ident(name)) + } + IdentifierType::UnsignedLongLong => { + IdlType::UnsignedLongLong.push_snake_case_name(dst) + } + }, } } @@ -570,13 +596,6 @@ impl<'a> IdlType<'a> { IdlType::Float64Array { immutable } => Ok(Some(array("f64", pos, *immutable))), IdlType::ArrayBufferView { .. } | IdlType::BufferSource { .. } => Ok(js_sys("Object")), - IdlType::Interface(name) - | IdlType::Dictionary(name) - | IdlType::CallbackInterface { name, .. } => { - let ty = ident_ty(rust_ident(camel_case_ident(name).as_str())); - Ok(externref(ty)) - } - IdlType::Enum(name) => Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str())))), IdlType::Nullable(idl_type) => { let inner = idl_type.to_syn_type(pos)?; @@ -640,10 +659,15 @@ impl<'a> IdlType<'a> { // Such an enum, however, might have a relatively high // overhead in creating it from a JS value, but would be // cheap to convert from a variant back to a JS value. - if idl_types - .iter() - .all(|idl_type| matches!(idl_type, IdlType::Interface(..))) - { + if idl_types.iter().all(|idl_type| { + matches!( + idl_type, + IdlType::Identifier { + ty: IdentifierType::Interface(..), + .. + } + ) + }) { IdlType::Object.to_syn_type(pos) } else { IdlType::Any.to_syn_type(pos) @@ -652,10 +676,8 @@ impl<'a> IdlType<'a> { IdlType::Any => Ok(js_value), IdlType::Undefined => Ok(None), - IdlType::Callback => Ok(js_sys("Function")), - IdlType::Iterator => Ok(js_sys("Iterator")), - IdlType::AsyncIterator => Ok(js_sys("AsyncIterator")), - IdlType::UnknownInterface(_) => Err(TypeError::CannotConvert), + IdlType::Identifier { ty, .. } => ty.to_syn_type(pos), + IdlType::UnknownIdentifier(_) => Err(TypeError::CannotConvert), } } @@ -739,9 +761,13 @@ impl<'a> IdlType<'a> { ], IdlType::LongLong => vec![IdlType::Long, IdlType::Double], IdlType::UnsignedLongLong => vec![IdlType::UnsignedLong, IdlType::Double], - IdlType::CallbackInterface { - name, - single_function: true, + IdlType::Identifier { + name: identifier, + ty: + IdentifierType::CallbackInterface { + name, + single_function: true, + }, } => { // According to the webidl spec [1] single-function callback // interfaces can also be replaced in arguments with simply a @@ -749,44 +775,94 @@ impl<'a> IdlType<'a> { // // [1]: https://heycam.github.io/webidl/#es-user-objects vec![ - IdlType::Callback, - IdlType::CallbackInterface { - name, - single_function: false, - }, + IdlType::id(identifier, IdentifierType::Callback), + IdlType::id( + identifier, + IdentifierType::CallbackInterface { + name, + single_function: false, + }, + ), ] } idl_type => vec![idl_type.clone()], } } + + pub(crate) fn orig(&self) -> Cow<'_, Self> { + if let Self::Identifier { name, .. } = self { + Cow::Owned(Self::UnknownIdentifier(name)) + } else { + Cow::Borrowed(self) + } + } +} + +impl<'a> IdentifierType<'a> { + /// Converts to syn type if possible. + pub(crate) fn to_syn_type(&self, pos: TypePosition) -> Result, TypeError> { + let externref = |ty| { + Some(match pos { + TypePosition::Argument => shared_ref(ty, false), + TypePosition::Return => ty, + }) + }; + let js_sys = |name: &str| { + let path = vec![rust_ident("js_sys"), rust_ident(name)]; + let ty = leading_colon_path_ty(path); + externref(ty) + }; + match self { + IdentifierType::Callback => Ok(js_sys("Function")), + IdentifierType::Iterator => Ok(js_sys("Iterator")), + IdentifierType::AsyncIterator => Ok(js_sys("AsyncIterator")), + IdentifierType::Interface(name) + | IdentifierType::Dictionary(name) + | IdentifierType::CallbackInterface { name, .. } => { + let ty = ident_ty(rust_ident(camel_case_ident(name).as_str())); + Ok(externref(ty)) + } + IdentifierType::Enum(name) => { + Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str())))) + } + IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.to_syn_type(pos), + } + } } #[test] fn idl_type_flatten_test() { + use self::IdentifierType::*; use self::IdlType::*; assert_eq!( Union(vec![ - Interface("Node"), - Union(vec![Sequence(Box::new(Long),), Interface("Event"),]), + IdlType::id("Node", Interface("Node")), + Union(vec![ + Sequence(Box::new(Long),), + IdlType::id("Event", Interface("Event")) + ]), Nullable(Box::new(Union(vec![ - Interface("XMLHttpRequest"), + IdlType::id("XMLHttpRequest", Interface("XMLHttpRequest")), DomString, ])),), Sequence(Box::new(Union(vec![ Sequence(Box::new(Double),), - Interface("NodeList"), + IdlType::id("NodeList", Interface("NodeList")), ])),), ]) .flatten(None), vec![ - Interface("Node"), + IdlType::id("Node", Interface("Node")), Sequence(Box::new(Long)), - Interface("Event"), - Nullable(Box::new(Interface("XMLHttpRequest"))), + IdlType::id("Event", Interface("Event")), + Nullable(Box::new(IdlType::id( + "XMLHttpRequest", + Interface("XMLHttpRequest") + ))), Nullable(Box::new(DomString)), Sequence(Box::new(Sequence(Box::new(Double)))), - Sequence(Box::new(Interface("NodeList"))), + Sequence(Box::new(IdlType::id("NodeList", Interface("NodeList")))), ], ); } diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 5fac4fe10ce..acbbe523e74 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -31,7 +31,7 @@ use crate::util::{ }; use anyhow::Context; use anyhow::Result; -use idl_type::IdlType; +use idl_type::{IdentifierType, IdlType}; use proc_macro2::{Ident, TokenStream}; use quote::ToTokens; use sourcefile::SourceFile; @@ -298,7 +298,17 @@ impl<'src> FirstPassRecord<'src> { let mut fields = Vec::new(); - if !self.append_dictionary_members(&js_name, &mut fields, unstable, unstable_types) { + let deprecated = data + .definition + .and_then(|d| get_rust_deprecated(&d.attributes)); + + if !self.append_dictionary_members( + &js_name, + &mut fields, + unstable, + unstable_types, + &deprecated, + ) { return; } @@ -307,6 +317,7 @@ impl<'src> FirstPassRecord<'src> { js_name, fields, unstable, + deprecated, } .generate(options) .to_tokens(&mut program.tokens); @@ -318,6 +329,7 @@ impl<'src> FirstPassRecord<'src> { dst: &mut Vec, unstable: bool, unstable_types: &HashSet, + parent_deprecated: &Option>, ) -> bool { let dict_data = &self.dictionaries[&dict]; let definition = dict_data.definition.unwrap(); @@ -326,7 +338,13 @@ impl<'src> FirstPassRecord<'src> { // > such that inherited dictionary members are ordered before // > non-inherited members ... if let Some(parent) = &definition.inheritance { - if !self.append_dictionary_members(parent.identifier.0, dst, unstable, unstable_types) { + if !self.append_dictionary_members( + parent.identifier.0, + dst, + unstable, + unstable_types, + parent_deprecated, + ) { return false; } } @@ -345,7 +363,7 @@ impl<'src> FirstPassRecord<'src> { .zip(iter::repeat(unstable || d.stability.is_unstable())) }); for (member, unstable) in members.zip(iter::repeat(unstable)).chain(partials) { - match self.dictionary_field(member, unstable, unstable_types) { + match self.dictionary_field(member, unstable, unstable_types, parent_deprecated) { Some(f) => dst.push(f), None => { log::warn!( @@ -372,6 +390,7 @@ impl<'src> FirstPassRecord<'src> { field: &'src DictionaryMember<'src>, unstable: bool, unstable_types: &HashSet, + parent_deprecated: &Option>, ) -> Option { let unstable_override = match unstable { true => true, @@ -384,9 +403,15 @@ impl<'src> FirstPassRecord<'src> { idl_type::IdlType::Nullable(ty) => match **ty { idl_type::IdlType::Any => true, IdlType::FrozenArray(ref _idl_type) | IdlType::Sequence(ref _idl_type) => true, - idl_type::IdlType::Union(ref types) => !types - .iter() - .all(|idl_type| matches!(idl_type, IdlType::Interface(..))), + idl_type::IdlType::Union(ref types) => !types.iter().all(|idl_type| { + matches!( + idl_type, + IdlType::Identifier { + ty: IdentifierType::Interface(..), + .. + } + ) + }), _ => false, }, _ => false, @@ -447,7 +472,8 @@ impl<'src> FirstPassRecord<'src> { return_ty, is_js_value_ref_option_type, unstable: unstable_override, - deprecated: get_rust_deprecated(&field.attributes), + deprecated: get_rust_deprecated(&field.attributes) + .or_else(|| parent_deprecated.clone()), }) } @@ -508,11 +534,11 @@ impl<'src> FirstPassRecord<'src> { } fn append_ns_operation( - &self, - functions: &mut Vec, - js_name: &'src str, - id: &OperationId<'src>, - data: &OperationData<'src>, + &'src self, + functions: &mut Vec>, + js_name: &str, + id: &'src OperationId<'src>, + data: &'src OperationData<'src>, ) { match id { OperationId::Operation(Some(_)) => {} @@ -744,12 +770,12 @@ impl<'src> FirstPassRecord<'src> { } fn member_operation( - &self, + &'src self, type_name: &str, - methods: &mut Vec, + methods: &mut Vec>, data: &InterfaceData<'src>, - id: &OperationId<'src>, - op_data: &OperationData<'src>, + id: &'src OperationId<'src>, + op_data: &'src OperationData<'src>, unstable_types: &HashSet, ) { let attrs = data.definition_attributes; @@ -763,7 +789,18 @@ impl<'src> FirstPassRecord<'src> { unstable, unstable_types, ) { - methods.push(method); + if !methods.iter().any(|old_method| { + old_method.variadic == method.variadic + && old_method.js_name == method.js_name + && old_method.variadic_type == method.variadic_type + && old_method + .arguments + .iter() + .map(|(_, idl, wb)| (idl.orig(), wb)) + .eq(method.arguments.iter().map(|(_, idl, wb)| (idl.orig(), wb))) + }) { + methods.push(method); + } } } @@ -792,12 +829,12 @@ impl<'src> FirstPassRecord<'src> { required: false, name: snake_case_ident(identifier), js_name: identifier.to_string(), - ty: idl_type::IdlType::Callback + ty: idl_type::IdentifierType::Callback .to_syn_type(pos) .unwrap() .unwrap(), return_ty: optional_return_ty( - idl_type::IdlType::Callback + idl_type::IdentifierType::Callback .to_syn_type(TypePosition::Return) .unwrap() .unwrap(), @@ -821,6 +858,7 @@ impl<'src> FirstPassRecord<'src> { js_name, fields, unstable: false, + deprecated: None, } .generate(options) .to_tokens(&mut program.tokens); diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index c7fd0c35945..370a0231ac4 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -21,7 +21,7 @@ use crate::constants::{ }; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; -use crate::idl_type::{IdlType, ToIdlType}; +use crate::idl_type::{IdentifierType, IdlType, ToIdlType}; use crate::Options; /// For variadic operations an overload with a `js_sys::Array` argument is generated alongside with @@ -220,8 +220,8 @@ impl<'src> FirstPassRecord<'src> { &self, type_name: Option<&str>, container_attrs: Option<&ExtendedAttributeList<'src>>, - id: &OperationId<'src>, - data: &OperationData<'src>, + id: &'src OperationId<'src>, + data: &'src OperationData<'src>, unstable: bool, unstable_types: &HashSet, ) -> Vec { @@ -308,7 +308,7 @@ impl<'src> FirstPassRecord<'src> { } } - let (name, kind, force_structural, force_throws) = match id { + let (js_name, kind, force_structural, force_throws) = match id { // Constructors aren't annotated with `[Throws]` extended attributes // (how could they be, since they themselves are extended // attributes?) so we must conservatively assume that they can @@ -355,7 +355,7 @@ impl<'src> FirstPassRecord<'src> { // possible. let ret_ty = signature.orig.ret.to_idl_type(self); - let mut rust_name = snake_case_ident(name); + let mut rust_name = snake_case_ident(js_name); let mut first = true; for (i, arg) in signature.args.iter().enumerate() { // Find out if any other known signature either has the same @@ -435,9 +435,9 @@ impl<'src> FirstPassRecord<'src> { .map(|arg| arg.variadic) .unwrap_or(false); - fn idl_arguments<'a>( - args: impl Iterator)>, - ) -> Option> { + fn idl_arguments<'a: 'b, 'b>( + args: impl Iterator)>, + ) -> Option, syn::Type)>> { let mut output = vec![]; for (name, idl_type) in args { @@ -448,7 +448,11 @@ impl<'src> FirstPassRecord<'src> { } }; - output.push((rust_ident(&snake_case_ident(&name[..])), ty)); + output.push(( + rust_ident(&snake_case_ident(&name[..])), + idl_type.clone(), + ty, + )); } Some(output) @@ -474,11 +478,22 @@ impl<'src> FirstPassRecord<'src> { if let Some(arguments) = arguments { if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) { + let mut rust_name = rust_name.clone(); + + if let Some(map) = + type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name)) + { + if let Some(fixed) = map.get(rust_name.as_str()) { + rust_name = fixed.to_string(); + } + } + ret.push(InterfaceMethod { name: rust_ident(&rust_name), - js_name: name.to_string(), + js_name: js_name.to_string(), deprecated: deprecated.clone(), arguments, + variadic_type: None, ret_ty, kind: kind.clone(), is_static, @@ -506,11 +521,22 @@ impl<'src> FirstPassRecord<'src> { if let Some(arguments) = arguments { if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) { + let mut rust_name = format!("{}_{}", &rust_name, i); + + if let Some(map) = + type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name)) + { + if let Some(fixed) = map.get(rust_name.as_str()) { + rust_name = fixed.to_string(); + } + } + ret.push(InterfaceMethod { - name: rust_ident(&format!("{}_{}", rust_name, i)), - js_name: name.to_string(), + name: rust_ident(&rust_name), + js_name: js_name.to_string(), deprecated: deprecated.clone(), arguments, + variadic_type: Some(last_idl_type.clone()), kind: kind.clone(), ret_ty, is_static, @@ -524,14 +550,6 @@ impl<'src> FirstPassRecord<'src> { } } - for interface in &mut ret { - if let Some(map) = type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name)) { - if let Some(fixed) = map.get(&interface.name.to_string().as_ref()) { - interface.name = rust_ident(fixed); - } - } - } - ret } @@ -572,9 +590,10 @@ pub fn is_type_unstable(ty: &weedle::types::Type, unstable_types: &HashSet) -> bool { match ty { - IdlType::Dictionary(name) | IdlType::Interface(name) => { - unstable_types.contains(&Identifier(name)) - } + IdlType::Identifier { + ty: IdentifierType::Dictionary(name) | IdentifierType::Interface(name), + .. + } => unstable_types.contains(&Identifier(name)), _ => false, } } From 12f560acbd6320c45385cedfce8c869dc93596f1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 31 Jul 2024 00:29:45 +0200 Subject: [PATCH 437/641] Added support for WebIDL records (#4030) --- CHANGELOG.md | 3 ++ .../features/gen_AudioWorkletNodeOptions.rs | 15 +++++++ .../gen_AuthenticationExtensionsPrfInputs.rs | 26 ++++++++++++ .../web-sys/src/features/gen_ClipboardItem.rs | 40 +++++++++++++++++++ .../src/features/gen_DisplayNameResult.rs | 15 +++++++ .../src/features/gen_FilePickerAcceptType.rs | 24 +++++++++++ .../src/features/gen_GpuDeviceDescriptor.rs | 24 +++++++++++ .../src/features/gen_GpuFragmentState.rs | 24 +++++++++++ .../src/features/gen_GpuProgrammableStage.rs | 24 +++++++++++ .../src/features/gen_GpuVertexState.rs | 24 +++++++++++ crates/web-sys/src/features/gen_Headers.rs | 7 ++++ .../src/features/gen_UrlSearchParams.rs | 9 +++++ crates/webidl/src/idl_type.rs | 2 +- 13 files changed, 236 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b279311b0a4..381699686aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,9 @@ * Added bindings to the Device Memory API. [#4011](https://github.com/rustwasm/wasm-bindgen/pull/4011) +* Added support for WebIDL records. This added new methods to various APIs, notably `ClipboardItem()`, `GPUDeviceDescriptor.requiredLimits` and `Header()`. + [#4030](https://github.com/rustwasm/wasm-bindgen/pull/4030) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs index 82c717bde6b..d6bd95e150d 100644 --- a/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs +++ b/crates/web-sys/src/features/gen_AudioWorkletNodeOptions.rs @@ -76,6 +76,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] #[wasm_bindgen(method, setter = "outputChannelCount")] pub fn set_output_channel_count(this: &AudioWorkletNodeOptions, val: &::wasm_bindgen::JsValue); + #[doc = "Get the `parameterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, getter = "parameterData")] + pub fn get_parameter_data(this: &AudioWorkletNodeOptions) -> Option<::js_sys::Object>; + #[doc = "Change the `parameterData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] + #[wasm_bindgen(method, setter = "parameterData")] + pub fn set_parameter_data(this: &AudioWorkletNodeOptions, val: &::js_sys::Object); #[doc = "Get the `processorOptions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioWorkletNodeOptions`*"] @@ -128,6 +138,11 @@ impl AudioWorkletNodeOptions { self.set_output_channel_count(val); self } + #[deprecated = "Use `set_parameter_data()` instead."] + pub fn parameter_data(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_parameter_data(val); + self + } #[deprecated = "Use `set_processor_options()` instead."] pub fn processor_options(&mut self, val: Option<&::js_sys::Object>) -> &mut Self { self.set_processor_options(val); diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs index 174b7e36ce2..a2f2e32c54a 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfInputs.rs @@ -39,6 +39,26 @@ extern "C" { this: &AuthenticationExtensionsPrfInputs, val: &AuthenticationExtensionsPrfValues, ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `evalByCredential` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "evalByCredential")] + pub fn get_eval_by_credential( + this: &AuthenticationExtensionsPrfInputs, + ) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `evalByCredential` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsPrfInputs`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "evalByCredential")] + pub fn set_eval_by_credential(this: &AuthenticationExtensionsPrfInputs, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl AuthenticationExtensionsPrfInputs { @@ -60,6 +80,12 @@ impl AuthenticationExtensionsPrfInputs { self.set_eval(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_eval_by_credential()` instead."] + pub fn eval_by_credential(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_eval_by_credential(val); + self + } } #[cfg(web_sys_unstable_apis)] impl Default for AuthenticationExtensionsPrfInputs { diff --git a/crates/web-sys/src/features/gen_ClipboardItem.rs b/crates/web-sys/src/features/gen_ClipboardItem.rs index 558d4561fad..25999c63171 100644 --- a/crates/web-sys/src/features/gen_ClipboardItem.rs +++ b/crates/web-sys/src/features/gen_ClipboardItem.rs @@ -27,6 +27,46 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] pub fn types(this: &ClipboardItem) -> ::js_sys::Array; + #[wasm_bindgen(catch, constructor, js_class = "ClipboardItem")] + #[doc = "The `new ClipboardItem(..)` constructor, creating a new instance of `ClipboardItem`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] + pub fn new_with_record_from_str_to_str_promise( + items: &::js_sys::Object, + ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "ClipboardItem")] + #[doc = "The `new ClipboardItem(..)` constructor, creating a new instance of `ClipboardItem`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`*"] + pub fn new_with_record_from_str_to_blob_promise( + items: &::js_sys::Object, + ) -> Result; + #[cfg(feature = "ClipboardItemOptions")] + #[wasm_bindgen(catch, constructor, js_class = "ClipboardItem")] + #[doc = "The `new ClipboardItem(..)` constructor, creating a new instance of `ClipboardItem`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`, `ClipboardItemOptions`*"] + pub fn new_with_record_from_str_to_str_promise_and_options( + items: &::js_sys::Object, + options: &ClipboardItemOptions, + ) -> Result; + #[cfg(feature = "ClipboardItemOptions")] + #[wasm_bindgen(catch, constructor, js_class = "ClipboardItem")] + #[doc = "The `new ClipboardItem(..)` constructor, creating a new instance of `ClipboardItem`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ClipboardItem`, `ClipboardItemOptions`*"] + pub fn new_with_record_from_str_to_blob_promise_and_options( + items: &::js_sys::Object, + options: &ClipboardItemOptions, + ) -> Result; # [wasm_bindgen (method , structural , js_class = "ClipboardItem" , js_name = getType)] #[doc = "The `getType()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DisplayNameResult.rs b/crates/web-sys/src/features/gen_DisplayNameResult.rs index bfb8507ddd5..ccfe023c9ae 100644 --- a/crates/web-sys/src/features/gen_DisplayNameResult.rs +++ b/crates/web-sys/src/features/gen_DisplayNameResult.rs @@ -30,6 +30,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] #[wasm_bindgen(method, setter = "style")] pub fn set_style(this: &DisplayNameResult, val: &str); + #[doc = "Get the `values` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[wasm_bindgen(method, getter = "values")] + pub fn get_values(this: &DisplayNameResult) -> Option<::js_sys::Object>; + #[doc = "Change the `values` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] + #[wasm_bindgen(method, setter = "values")] + pub fn set_values(this: &DisplayNameResult, val: &::js_sys::Object); } impl DisplayNameResult { #[doc = "Construct a new `DisplayNameResult`."] @@ -50,6 +60,11 @@ impl DisplayNameResult { self.set_style(val); self } + #[deprecated = "Use `set_values()` instead."] + pub fn values(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_values(val); + self + } } impl Default for DisplayNameResult { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs index f969507a01c..63c010f5f8e 100644 --- a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs +++ b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs @@ -15,6 +15,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type FilePickerAcceptType; #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `accept` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "accept")] + pub fn get_accept(this: &FilePickerAcceptType) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `accept` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "accept")] + pub fn set_accept(this: &FilePickerAcceptType, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `description` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePickerAcceptType`*"] @@ -47,6 +65,12 @@ impl FilePickerAcceptType { ret } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_accept()` instead."] + pub fn accept(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_accept(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_description()` instead."] pub fn description(&mut self, val: &str) -> &mut Self { self.set_description(val); diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index 02166f68a81..b6090cf7454 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -70,6 +70,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "requiredFeatures")] pub fn set_required_features(this: &GpuDeviceDescriptor, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `requiredLimits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "requiredLimits")] + pub fn get_required_limits(this: &GpuDeviceDescriptor) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `requiredLimits` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "requiredLimits")] + pub fn set_required_limits(this: &GpuDeviceDescriptor, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuDeviceDescriptor { @@ -103,6 +121,12 @@ impl GpuDeviceDescriptor { self.set_required_features(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_required_limits()` instead."] + pub fn required_limits(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_required_limits(val); + self + } } #[cfg(web_sys_unstable_apis)] impl Default for GpuDeviceDescriptor { diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 33c1059e584..200758fd892 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -15,6 +15,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuFragmentState; #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "constants")] + pub fn get_constants(this: &GpuFragmentState) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "constants")] + pub fn set_constants(this: &GpuFragmentState, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `entryPoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuFragmentState`*"] @@ -88,6 +106,12 @@ impl GpuFragmentState { ret } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_constants()` instead."] + pub fn constants(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_constants(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { self.set_entry_point(val); diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index 3f929264764..164b2e2f701 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -15,6 +15,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuProgrammableStage; #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "constants")] + pub fn get_constants(this: &GpuProgrammableStage) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "constants")] + pub fn set_constants(this: &GpuProgrammableStage, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `entryPoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuProgrammableStage`*"] @@ -69,6 +87,12 @@ impl GpuProgrammableStage { ret } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_constants()` instead."] + pub fn constants(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_constants(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { self.set_entry_point(val); diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index 29bc317bd66..5f8901ee638 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -15,6 +15,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuVertexState; #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "constants")] + pub fn get_constants(this: &GpuVertexState) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `constants` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "constants")] + pub fn set_constants(this: &GpuVertexState, val: &::js_sys::Object); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `entryPoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuVertexState`*"] @@ -87,6 +105,12 @@ impl GpuVertexState { ret } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_constants()` instead."] + pub fn constants(&mut self, val: &::js_sys::Object) -> &mut Self { + self.set_constants(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_entry_point()` instead."] pub fn entry_point(&mut self, val: &str) -> &mut Self { self.set_entry_point(val); diff --git a/crates/web-sys/src/features/gen_Headers.rs b/crates/web-sys/src/features/gen_Headers.rs index c7f7deeee98..28556d47b01 100644 --- a/crates/web-sys/src/features/gen_Headers.rs +++ b/crates/web-sys/src/features/gen_Headers.rs @@ -35,6 +35,13 @@ extern "C" { pub fn new_with_str_sequence_sequence( init: &::wasm_bindgen::JsValue, ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "Headers")] + #[doc = "The `new Headers(..)` constructor, creating a new instance of `Headers`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Headers`*"] + pub fn new_with_record_from_str_to_str(init: &::js_sys::Object) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "Headers" , js_name = append)] #[doc = "The `append()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_UrlSearchParams.rs b/crates/web-sys/src/features/gen_UrlSearchParams.rs index 7872f099e3c..0e3132681e6 100644 --- a/crates/web-sys/src/features/gen_UrlSearchParams.rs +++ b/crates/web-sys/src/features/gen_UrlSearchParams.rs @@ -34,6 +34,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] + pub fn new_with_record_from_str_to_str( + init: &::js_sys::Object, + ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "URLSearchParams")] + #[doc = "The `new UrlSearchParams(..)` constructor, creating a new instance of `UrlSearchParams`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] pub fn new_with_str(init: &str) -> Result; # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = append)] #[doc = "The `append()` method."] diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index ae98c505e15..674fad0d447 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -634,7 +634,7 @@ impl<'a> IdlType<'a> { TypePosition::Return => Ok(js_sys("Array")), }, IdlType::Promise(_idl_type) => Ok(js_sys("Promise")), - IdlType::Record(_idl_type_from, _idl_type_to) => Err(TypeError::CannotConvert), + IdlType::Record(_idl_type_from, _idl_type_to) => Ok(js_sys("Object")), IdlType::Union(idl_types) => { // Note that most union types have already been expanded to // their components via `flatten`. Unions in a return position From 5b28b66e7c77e569a3979294026756e6ef4dc951 Mon Sep 17 00:00:00 2001 From: Ihor Ranchynskyi Date: Thu, 1 Aug 2024 19:19:50 +0100 Subject: [PATCH 438/641] Add semicolon to "export { initSync }" in OutputMode::Web (#4033) --- crates/cli-support/src/js/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 56c1f12ebf1..7703b341f4b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -487,7 +487,7 @@ impl<'a> Context<'a> { OutputMode::Web => { self.imports_post.push_str("let wasm;\n"); init = self.gen_init(needs_manual_start, Some(&mut imports))?; - footer.push_str("export { initSync }\n"); + footer.push_str("export { initSync };\n"); footer.push_str("export default __wbg_init;"); } } From 5490ed2fdc3f9143961ca6f26fac07376182cae6 Mon Sep 17 00:00:00 2001 From: Newton Toto <53893043+sokorototo@users.noreply.github.com> Date: Thu, 1 Aug 2024 21:36:49 +0300 Subject: [PATCH 439/641] `UnwrapThrowExt for Result` now prints the error (#4035) --- CHANGELOG.md | 3 +++ src/lib.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 381699686aa..5295fd4f95c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,9 @@ * Update the Indexed DB API. [#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027) +* `UnwrapThrowExt for Result` now makes use of the required `Debug` bound to display the error as well. + [#4035](https://github.com/rustwasm/wasm-bindgen/pull/4035) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/src/lib.rs b/src/lib.rs index ec8a847933a..34b533bdfd6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1381,6 +1381,32 @@ impl UnwrapThrowExt for Result where E: core::fmt::Debug, { + #[cfg_attr(debug_assertions, track_caller)] + fn unwrap_throw(self) -> T { + if cfg!(all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + )) { + match self { + Ok(val) => val, + Err(err) => { + let loc = core::panic::Location::caller(); + let msg = alloc::format!( + "`unwrap_throw` failed ({}:{}:{}): {:?}", + loc.file(), + loc.line(), + loc.column(), + err + ); + + throw_str(&msg) + } + } + } else { + self.unwrap() + } + } + #[cfg_attr(debug_assertions, track_caller)] fn expect_throw(self, message: &str) -> T { if cfg!(all( From a4e54500e006a14e2dc9d110ea4b1327668c79c8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 1 Aug 2024 23:59:07 +0200 Subject: [PATCH 440/641] Fix/improve stack pointer detection (#4036) Renamed all instances of "shadow stack" to just "stack". --- CHANGELOG.md | 3 ++ crates/cli-support/src/js/mod.rs | 4 +- crates/cli-support/src/multivalue.rs | 10 ++--- crates/cli-support/src/wit/mod.rs | 3 +- crates/cli-support/src/wit/nonstandard.rs | 4 +- crates/cli-support/src/wit/section.rs | 2 +- crates/multi-value-xform/src/lib.rs | 48 +++++++++++------------ crates/threads-xform/src/lib.rs | 4 +- crates/wasm-conventions/Cargo.toml | 1 + crates/wasm-conventions/src/lib.rs | 23 ++++++++--- 10 files changed, 57 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5295fd4f95c..ee14315533d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,9 @@ * Allow ex/importing structs, functions and parameters named with raw identifiers. [#4025](https://github.com/rustwasm/wasm-bindgen/pull/4025) +* Implement a more reliable way to detect the stack pointer. + [#4036](https://github.com/rustwasm/wasm-bindgen/pull/4036) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 7703b341f4b..7781e3165e0 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3963,13 +3963,13 @@ impl<'a> Context<'a> { if self.stack_pointer_shim_injected { return Ok(()); } - let stack_pointer = match self.aux.shadow_stack_pointer { + let stack_pointer = match self.aux.stack_pointer { Some(s) => s, // In theory this shouldn't happen since malloc is included in // most wasm binaries (and may be gc'd out) and that almost // always pulls in a stack pointer. We can try to synthesize // something here later if necessary. - None => bail!("failed to find shadow stack pointer"), + None => bail!("failed to find stack pointer"), }; use walrus::ir::*; diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index 9fd7071b483..4ba319685db 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -18,21 +18,21 @@ pub fn run(module: &mut Module) -> Result<(), Error> { extract_xform(module, adapter, &mut to_xform, &mut slots); } if to_xform.is_empty() { - // Early exit to avoid failing if we don't have a memory or shadow stack + // Early exit to avoid failing if we don't have a memory or stack // pointer because this is a minimal module that doesn't use linear // memory. module.customs.add(*adapters); return Ok(()); } - let shadow_stack_pointer = module + let stack_pointer = module .customs .get_typed::() .expect("aux section should be present") - .shadow_stack_pointer - .ok_or_else(|| anyhow!("failed to find shadow stack pointer in wasm module"))?; + .stack_pointer + .ok_or_else(|| anyhow!("failed to find stack pointer in wasm module"))?; let memory = wasm_conventions::get_memory(module)?; - let wrappers = multi_value_xform::run(module, memory, shadow_stack_pointer, &to_xform)?; + let wrappers = multi_value_xform::run(module, memory, stack_pointer, &to_xform)?; for (slot, id) in slots.into_iter().zip(wrappers) { match slot { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 45333858f33..0053e351336 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -90,8 +90,7 @@ pub fn process( impl<'a> Context<'a> { fn init(&mut self) -> Result<(), Error> { - self.aux.shadow_stack_pointer = - wasm_bindgen_wasm_conventions::get_shadow_stack_pointer(self.module); + self.aux.stack_pointer = wasm_bindgen_wasm_conventions::get_stack_pointer(self.module); // Make a map from string name to ids of all exports for export in self.module.exports.iter() { diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index a9b7f90e599..70bca5ad915 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -57,7 +57,7 @@ pub struct WasmBindgenAux { /// Various intrinsics used for JS glue generation pub exn_store: Option, - pub shadow_stack_pointer: Option, + pub stack_pointer: Option, pub thread_destroy: Option, } @@ -430,7 +430,7 @@ impl walrus::CustomSection for WasmBindgenAux { if let Some(id) = self.exn_store { roots.push_func(id); } - if let Some(id) = self.shadow_stack_pointer { + if let Some(id) = self.stack_pointer { roots.push_global(id); } if let Some(id) = self.thread_destroy { diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index 4b22e6f97c6..c1e4ce4a896 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -50,7 +50,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { externref_drop: _, externref_drop_slice: _, exn_store: _, - shadow_stack_pointer: _, + stack_pointer: _, function_table: _, thread_destroy: _, } = *aux; diff --git a/crates/multi-value-xform/src/lib.rs b/crates/multi-value-xform/src/lib.rs index 510aef3553c..27645c8de5b 100644 --- a/crates/multi-value-xform/src/lib.rs +++ b/crates/multi-value-xform/src/lib.rs @@ -58,33 +58,33 @@ //! //! (func $pairWrapper (param i32 i32) (result i32 i32) //! ;; Our return pointer that points to the scratch space we are allocating -//! ;; on the shadow stack for calling `$pair`. +//! ;; on the stack for calling `$pair`. //! (local i32) //! -//! ;; Allocate space on the shadow stack for the result. -//! global.get $shadowStackPointer +//! ;; Allocate space on the stack for the result. +//! global.get $stackPointer //! i32.const 8 //! i32.sub //! local.tee 2 -//! global.set $shadowStackPointer +//! global.set $stackPointer //! -//! ;; Call `$pair` with our allocated shadow stack space for its results. +//! ;; Call `$pair` with our allocated stack space for its results. //! local.get 2 //! local.get 0 //! local.get 1 //! call $pair //! -//! ;; Copy the return values from the shadow stack to the wasm stack. +//! ;; Copy the return values from the stack to the wasm stack. //! local.get 2 //! i32.load //! local.get 2 offset=4 //! i32.load //! -//! ;; Finally, restore the shadow stack pointer. +//! ;; Finally, restore the stack pointer. //! local.get 2 //! i32.const 8 //! i32.add -//! global.set $shadowStackPointer) +//! global.set $stackPointer) //! ``` //! //! This `$pairWrapper` function is what we actually end up exporting instead of @@ -98,12 +98,11 @@ use anyhow::Context; /// /// See the module-level docs for details on the transformation. /// -/// * `memory` is the module's memory that has the shadow stack where return +/// * `memory` is the module's memory that has the stack where return /// pointers are allocated within. /// -/// * `shadow_stack_pointer` is the global that is being used as the stack -/// pointer for the shadow stack. With LLVM, this is typically the first -/// global. +/// * `__stack_pointer` is the global that is being used as the stack +/// pointer. With LLVM, this is typically the first global. /// /// * `to_xform` is the set of exported functions we want to transform and /// information required to transform them. The `usize` is the index of the @@ -116,7 +115,7 @@ use anyhow::Context; pub fn run( module: &mut walrus::Module, memory: walrus::MemoryId, - shadow_stack_pointer: walrus::GlobalId, + stack_pointer: walrus::GlobalId, to_xform: &[(walrus::FunctionId, usize, Vec)], ) -> Result, anyhow::Error> { // Insert multi-value to the target features section. @@ -128,7 +127,7 @@ pub fn run( wrappers.push(xform_one( module, memory, - shadow_stack_pointer, + stack_pointer, *func, *return_pointer_index, results, @@ -146,13 +145,13 @@ fn round_up_to_alignment(n: u32, align: u32) -> u32 { fn xform_one( module: &mut walrus::Module, memory: walrus::MemoryId, - shadow_stack_pointer: walrus::GlobalId, + stack_pointer: walrus::GlobalId, func: walrus::FunctionId, return_pointer_index: usize, results: &[walrus::ValType], ) -> Result { - if module.globals.get(shadow_stack_pointer).ty != walrus::ValType::I32 { - anyhow::bail!("shadow stack pointer global does not have type `i32`"); + if module.globals.get(stack_pointer).ty != walrus::ValType::I32 { + anyhow::bail!("stack pointer global does not have type `i32`"); } // Compute the total size of all results, potentially with padding to ensure @@ -210,18 +209,18 @@ fn xform_one( // The locals for the function parameters. let params: Vec<_> = new_params.iter().map(|ty| module.locals.add(*ty)).collect(); - // A local to hold our shadow stack-allocated return pointer. + // A local to hold our stack-allocated return pointer. let return_pointer = module.locals.add(walrus::ValType::I32); let mut wrapper = walrus::FunctionBuilder::new(&mut module.types, &new_params, results); let mut body = wrapper.func_body(); - // Allocate space in the shadow stack for the call. - body.global_get(shadow_stack_pointer) + // Allocate space in the stack for the call. + body.global_get(stack_pointer) .i32_const(results_size as i32) .binop(walrus::ir::BinaryOp::I32Sub) .local_tee(return_pointer) - .global_set(shadow_stack_pointer); + .global_set(stack_pointer); // Push the parameters for calling our wrapped function -- including the // return pointer! -- on to the stack. @@ -238,8 +237,7 @@ fn xform_one( // Call our wrapped function. body.call(func); - // Copy the return values from our shadow stack-allocated space and onto the - // Wasm stack. + // Copy the return values from our stack-allocated space and onto the Wasm stack. let mut offset = 0; for ty in results { debug_assert!(offset < results_size); @@ -294,11 +292,11 @@ fn xform_one( } } - // Finally, restore the shadow stack pointer. + // Finally, restore the stack pointer. body.local_get(return_pointer) .i32_const(results_size as i32) .binop(walrus::ir::BinaryOp::I32Add) - .global_set(shadow_stack_pointer); + .global_set(stack_pointer); let wrapper = wrapper.finish(params, &mut module.funcs); if let Some(name) = &module.funcs.get(func).name { diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index cc1a8cd1d06..a9d0898cd33 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -153,8 +153,8 @@ impl Config { assert!(self.thread_stack_size % PAGE_SIZE == 0); let stack = Stack { - pointer: wasm_conventions::get_shadow_stack_pointer(module) - .ok_or_else(|| anyhow!("failed to find shadow stack pointer"))?, + pointer: wasm_conventions::get_stack_pointer(module) + .ok_or_else(|| anyhow!("failed to find stack pointer"))?, temp: temp_stack as i32, temp_lock: thread_counter_addr + 4, alloc: stack_alloc, diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index cd2b474032a..da05515c9cc 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -16,3 +16,4 @@ walrus = "0.20.2" # Matching the version `walrus` depends on. wasmparser = "0.80" anyhow = "1.0" +log = "0.4" diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index 345209e6ac6..d7cb7279b0c 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -3,8 +3,8 @@ //! //! Examples conventions include: //! -//! * The shadow stack pointer -//! * The canonical linear memory that contains the shadow stack +//! * The stack pointer +//! * The canonical linear memory that contains the stack use std::io::Cursor; @@ -33,8 +33,16 @@ pub fn get_memory(module: &Module) -> Result { }) } -/// Get the `__shadow_stack_pointer`. -pub fn get_shadow_stack_pointer(module: &Module) -> Option { +/// Get the `__stack_pointer`. +pub fn get_stack_pointer(module: &Module) -> Option { + if let Some(g) = module + .globals + .iter() + .find(|g| matches!(g.name.as_deref(), Some("__stack_pointer"))) + { + return Some(g.id()); + } + let candidates = module .globals .iter() @@ -51,8 +59,11 @@ pub fn get_shadow_stack_pointer(module: &Module) -> Option { match candidates.len() { 0 => None, - // TODO: have an actual check here. - 1 | 2 => Some(candidates[0].id()), + 1 => Some(candidates[0].id()), + 2 => { + log::warn!("Unable to accurately determine the location of `__stack_pointer`"); + Some(candidates[0].id()) + } _ => None, } } From f47b7fec753a6704b915715cf61e062abd117883 Mon Sep 17 00:00:00 2001 From: hrxi Date: Fri, 2 Aug 2024 13:17:04 +0200 Subject: [PATCH 441/641] Mention that the traits in `convert` are internal (#4034) --- src/convert/impls.rs | 10 ++++++ src/convert/mod.rs | 6 ++-- src/convert/slices.rs | 5 +++ src/convert/traits.rs | 84 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 0010743cd66..fd77ce88f8f 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -470,6 +470,11 @@ impl IntoWasmAbi for JsError { } } +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. // Note: this can't take `&[T]` because the `Into` impl needs // ownership of `T`. pub fn js_value_vector_into_abi>( @@ -480,6 +485,11 @@ pub fn js_value_vector_into_abi>( js_vals.into_abi() } +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub unsafe fn js_value_vector_from_abi( js: as FromWasmAbi>::Abi, ) -> Box<[T]> diff --git a/src/convert/mod.rs b/src/convert/mod.rs index ce2c0b2c847..548b42fda05 100644 --- a/src/convert/mod.rs +++ b/src/convert/mod.rs @@ -1,5 +1,7 @@ -//! This is mostly an internal module, no stability guarantees are provided. Use -//! at your own risk. +//! # ⚠️ Unstable +//! +//! This is an internal module, no stability guarantees are provided. Use at +//! your own risk. mod closures; mod impls; diff --git a/src/convert/slices.rs b/src/convert/slices.rs index ee9c20f57aa..ee922b901b2 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -20,6 +20,11 @@ use crate::JsValue; use cfg_if::cfg_if; +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. // note: `WasmAbi` types do not need to be FFI-safe themselves, it's just more // convenient to directly write `WasmSlice` in some of the manually-written FFI // functions in `lib.rs` rather than `WasmRet`. diff --git a/src/convert/traits.rs b/src/convert/traits.rs index 547e9703a52..ca2441d5f02 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -8,6 +8,12 @@ use crate::JsValue; /// wasm ABI directly, eg `u32` or `f64`. /// /// This is the opposite operation as `FromWasmAbi` and `Ref[Mut]FromWasmAbi`. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait IntoWasmAbi: WasmDescribe { /// The wasm ABI type that this converts into when crossing the ABI /// boundary. @@ -22,6 +28,12 @@ pub trait IntoWasmAbi: WasmDescribe { /// boundary, eg a Rust `u8` can be recovered from the wasm ABI `u32` type. /// /// This is the by-value variant of the opposite operation as `IntoWasmAbi`. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait FromWasmAbi: WasmDescribe { /// The wasm ABI type that this converts from when coming back out from the /// ABI boundary. @@ -42,6 +54,12 @@ pub trait FromWasmAbi: WasmDescribe { /// /// This is the shared reference variant of the opposite operation as /// `IntoWasmAbi`. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait RefFromWasmAbi: WasmDescribe { /// The wasm ABI type references to `Self` are recovered from. type Abi: WasmAbi; @@ -75,6 +93,12 @@ pub trait RefFromWasmAbi: WasmDescribe { /// call. /// /// 'long ref' is short for 'long-lived reference'. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait LongRefFromWasmAbi: WasmDescribe { /// Same as `RefFromWasmAbi::Abi` type Abi: WasmAbi; @@ -87,6 +111,12 @@ pub trait LongRefFromWasmAbi: WasmDescribe { } /// Dual of the `RefFromWasmAbi` trait, except for mutable references. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait RefMutFromWasmAbi: WasmDescribe { /// Same as `RefFromWasmAbi::Abi` type Abi: WasmAbi; @@ -99,6 +129,12 @@ pub trait RefMutFromWasmAbi: WasmDescribe { /// Indicates that this type can be passed to JS as `Option`. /// /// This trait is used when implementing `IntoWasmAbi for Option`. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait OptionIntoWasmAbi: IntoWasmAbi { /// Returns an ABI instance indicating "none", which JS will interpret as /// the `None` branch of this option. @@ -111,6 +147,12 @@ pub trait OptionIntoWasmAbi: IntoWasmAbi { /// Indicates that this type can be received from JS as `Option`. /// /// This trait is used when implementing `FromWasmAbi for Option`. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait OptionFromWasmAbi: FromWasmAbi { /// Tests whether the argument is a "none" instance. If so it will be /// deserialized as `None`, and otherwise it will be passed to @@ -128,6 +170,12 @@ pub trait OptionFromWasmAbi: FromWasmAbi { /// /// This is an unsafe trait to implement as there's no guarantee the type /// actually maps to a primitive type. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub unsafe trait WasmPrimitive: Default {} unsafe impl WasmPrimitive for u32 {} @@ -154,6 +202,12 @@ unsafe impl WasmPrimitive for () {} /// There's already one type that uses 3 primitives: `&mut [T]`. However, it /// can't be returned anyway, so it doesn't matter that /// `Result<&mut [T], JsValue>` wouldn't work. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait WasmAbi { type Prim1: WasmPrimitive; type Prim2: WasmPrimitive; @@ -174,6 +228,12 @@ pub trait WasmAbi { /// implementation for all implementors of the `IntoWasmAbi`. The primary use /// case of this trait is to enable functions to return `Result`, interpreting /// an error as "rethrow this to JS" +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait ReturnWasmAbi: WasmDescribe { /// Same as `IntoWasmAbi::Abi` type Abi: WasmAbi; @@ -197,6 +257,12 @@ use core::marker::Sized; /// Trait for element types to implement IntoWasmAbi for vectors of /// themselves. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait VectorIntoWasmAbi: WasmDescribeVector + Sized { type Abi: WasmAbi; @@ -205,6 +271,12 @@ pub trait VectorIntoWasmAbi: WasmDescribeVector + Sized { /// Trait for element types to implement FromWasmAbi for vectors of /// themselves. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait VectorFromWasmAbi: WasmDescribeVector + Sized { type Abi: WasmAbi; @@ -220,6 +292,12 @@ pub trait VectorFromWasmAbi: WasmDescribeVector + Sized { /// /// If all but one of the primitives is `()`, this corresponds to returning the /// remaining primitive directly, otherwise a return pointer is used. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. #[repr(C)] pub struct WasmRet { prim1: T::Prim1, @@ -256,6 +334,12 @@ impl WasmRet { /// Types implementing this trait must specify their conversion logic from /// [`JsValue`] to the Rust type, handling any potential errors that may occur /// during the conversion process. +/// +/// # ⚠️ Unstable +/// +/// This is part of the internal [`convert`](crate::convert) module, **no +/// stability guarantees** are provided. Use at your own risk. See its +/// documentation for more details. pub trait TryFromJsValue: Sized { /// The type returned in the event of a conversion error. type Error; From 5b2922c9f8e86cab835800625048e8f2254eb6c4 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 00:55:11 +0200 Subject: [PATCH 442/641] Update Walrus to v0.21 (#4037) --- CHANGELOG.md | 3 + crates/cli-support/Cargo.toml | 2 +- crates/cli-support/src/descriptors.rs | 60 ++++++++++++++++--- crates/cli-support/src/externref.rs | 55 ++++++++++------- crates/cli-support/src/multivalue.rs | 53 ++++++++++++---- crates/cli-support/src/wit/standard.rs | 10 ++-- crates/cli/Cargo.toml | 6 +- crates/cli/tests/reference/add.wat | 2 + crates/cli/tests/reference/anyref-empty.wat | 2 + .../tests/reference/anyref-import-catch.wat | 2 + crates/cli/tests/reference/anyref-nop.wat | 2 + crates/cli/tests/reference/builder.wat | 2 + crates/cli/tests/reference/constructor.wat | 2 + crates/cli/tests/reference/empty.wat | 2 + crates/cli/tests/reference/enums.wat | 2 + crates/cli/tests/reference/import-catch.wat | 2 + crates/cli/tests/reference/nop.wat | 2 + crates/cli/tests/reference/pointers.wat | 2 + crates/cli/tests/reference/raw.wat | 2 + crates/cli/tests/reference/result-string.wat | 2 + crates/cli/tests/reference/skip-jsdoc.wat | 2 + crates/cli/tests/reference/string-arg.wat | 2 + crates/externref-xform/Cargo.toml | 4 +- crates/externref-xform/src/lib.rs | 60 ++++++++++++------- crates/externref-xform/tests/all.rs | 3 - .../tests/anyref-param-owned.wat | 5 +- crates/externref-xform/tests/anyref-param.wat | 5 +- .../tests/clone-ref-intrinsic.wat | 5 +- .../tests/drop-ref-intrinsic.wat | 5 +- .../tests/import-anyref-owned.wat | 5 +- .../tests/import-anyref-ret.wat | 5 +- .../externref-xform/tests/import-anyref.wat | 5 +- crates/externref-xform/tests/mixed-export.wat | 5 +- crates/externref-xform/tests/mixed.wat | 5 +- crates/externref-xform/tests/ret-anyref.wat | 5 +- .../tests/table-grow-intrinsic.wat | 5 +- .../tests/table-set-null-intrinsic.wat | 5 +- crates/externref-xform/tests/table.wat | 5 +- .../externref-xform/tests/tee-before-grow.wat | 5 +- crates/multi-value-xform/Cargo.toml | 4 +- crates/multi-value-xform/src/lib.rs | 4 +- crates/multi-value-xform/tests/align.wat | 5 +- crates/multi-value-xform/tests/all.rs | 3 - crates/multi-value-xform/tests/many.wat | 5 +- crates/multi-value-xform/tests/simple.wat | 17 +++--- crates/threads-xform/Cargo.toml | 6 +- crates/threads-xform/src/lib.rs | 18 +++--- crates/threads-xform/tests/all.rs | 12 +--- crates/wasm-conventions/Cargo.toml | 4 +- crates/wasm-conventions/src/lib.rs | 30 +++++++--- crates/wasm-interpreter/Cargo.toml | 2 +- crates/wasm-interpreter/src/lib.rs | 9 ++- 52 files changed, 321 insertions(+), 154 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee14315533d..654c4b5d288 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -110,6 +110,9 @@ * `UnwrapThrowExt for Result` now makes use of the required `Debug` bound to display the error as well. [#4035](https://github.com/rustwasm/wasm-bindgen/pull/4035) +* MSRV of CLI tools bumped to v1.76. This does not affect libraries like `wasm-bindgen`, `js-sys` and `web-sys`! + [#4037](https://github.com/rustwasm/wasm-bindgen/pull/4037) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 48bb44f93f1..157c1b6c160 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -19,7 +19,7 @@ log = "0.4" rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" -walrus = "0.20.2" +walrus = "0.21" wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.92' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.92' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.92' } diff --git a/crates/cli-support/src/descriptors.rs b/crates/cli-support/src/descriptors.rs index b4af4bc36a9..83617900532 100644 --- a/crates/cli-support/src/descriptors.rs +++ b/crates/cli-support/src/descriptors.rs @@ -11,10 +11,10 @@ //! functions. use crate::descriptor::{Closure, Descriptor}; -use anyhow::Error; +use anyhow::{bail, Error}; use std::borrow::Cow; -use std::collections::{HashMap, HashSet}; -use walrus::ImportId; +use std::collections::HashMap; +use walrus::{ConstExpr, ElementItems, ElementKind, ImportId, RefType}; use walrus::{CustomSection, FunctionId, Module, TypedCustomSectionId}; use wasm_bindgen_wasm_interpreter::Interpreter; @@ -87,7 +87,7 @@ impl WasmBindgenDescriptorsSection { // Find all functions which call `wbindgen_describe_closure`. These are // specially codegen'd so we know the rough structure of them. For each // one we delegate to the interpreter to figure out the actual result. - let mut element_removal_list = HashSet::new(); + let mut element_removal_list = HashMap::new(); let mut func_to_descriptor = HashMap::new(); for (id, local) in module.funcs.iter_local() { let mut find = FindDescribeClosure { @@ -106,9 +106,55 @@ impl WasmBindgenDescriptorsSection { // For all indirect functions that were closure descriptors, delete them // from the function table since we've executed them and they're not // necessary in the final binary. - for (segment, idx) in element_removal_list { - log::trace!("delete element {}", idx); - module.elements.get_mut(segment).members[idx] = None; + for (segment, idxs) in element_removal_list { + let segment = module.elements.get_mut(segment); + + let items = match &mut segment.items { + ElementItems::Functions(items) => items, + ElementItems::Expressions(_, items) => { + for idx in idxs { + log::trace!("delete element {}", idx); + items[idx] = ConstExpr::RefNull(RefType::Funcref) + } + + continue; + } + }; + + let (table, offset) = match &segment.kind { + ElementKind::Active { + table, + offset: ConstExpr::Value(Value::I32(n)), + } => (*table, *n), + _ => bail!("somehow found a closure in an unexpected element segment"), + }; + + let mut to_insert = Vec::new(); + + for idx in idxs.into_iter().rev() { + log::trace!("delete element {}", idx); + + items.remove(idx); + + // Last item, no need to do anything fancy. + if items.len() == idx { + continue; + } + + let block = items.split_off(idx); + let offset = offset + idx as i32 + 1; + let offset = ConstExpr::Value(Value::I32(offset)); + + to_insert.push((offset, block)); + } + + for (offset, block) in to_insert.into_iter().rev() { + let id = module.elements.add( + ElementKind::Active { table, offset }, + ElementItems::Functions(block), + ); + module.tables.get_mut(table).elem_segments.insert(id); + } } // And finally replace all calls of `wbindgen_describe_closure` with a diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index ef3a726ad9f..be732ceeef0 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -5,7 +5,8 @@ use crate::wit::{AdapterKind, Instruction, NonstandardWitSection}; use crate::wit::{AdapterType, InstructionData, StackChange, WasmBindgenAux}; use anyhow::Result; use std::collections::HashMap; -use walrus::{ir::Value, ElementKind, InitExpr, Module}; +use walrus::ElementItems; +use walrus::{ir::Value, ConstExpr, ElementKind, Module}; use wasm_bindgen_externref_xform::Context; pub fn process(module: &mut Module) -> Result<()> { @@ -397,11 +398,22 @@ pub fn force_contiguous_elements(module: &mut Module) -> Result<()> { // Here we take a look at all element segments in the module to see if we // need to split them. for segment in module.elements.iter_mut() { - // If this segment has all-`Some` members then it's already contiguous - // and we can skip it. - if segment.members.iter().all(|m| m.is_some()) { - continue; - } + let (ty, items) = match &mut segment.items { + ElementItems::Expressions(ty, items) => { + // If this segment has no null reference members then it's already + // contiguous and we can skip it. + if items + .iter() + .all(|item| !matches!(item, ConstExpr::RefNull(_))) + { + continue; + } + + (*ty, items) + } + // Function index segments don't have holes. + ElementItems::Functions(_) => continue, + }; // For now active segments are all we're interested in since // passive/declared have no hope of being MVP-compatible anyway. @@ -410,7 +422,7 @@ pub fn force_contiguous_elements(module: &mut Module) -> Result<()> { let (table, offset) = match &segment.kind { ElementKind::Active { table, - offset: InitExpr::Value(Value::I32(n)), + offset: ConstExpr::Value(Value::I32(n)), } => (*table, *n), _ => continue, }; @@ -425,16 +437,13 @@ pub fn force_contiguous_elements(module: &mut Module) -> Result<()> { // offset. let mut commit = |last_idx: usize, block: Vec<_>| { let new_offset = offset + (last_idx - block.len()) as i32; - let new_offset = InitExpr::Value(Value::I32(new_offset)); - new_segments.push((table, new_offset, segment.ty, block)); + let new_offset = ConstExpr::Value(Value::I32(new_offset)); + new_segments.push((table, new_offset, ty, block)); }; - for (i, id) in segment.members.iter().enumerate() { - match id { - // If we find a function, then we either start a new block or - // push it onto the existing block. - Some(id) => block.get_or_insert(Vec::new()).push(Some(*id)), - None => { - let block = match block.take() { + for (i, expr) in items.iter().enumerate() { + match expr { + ConstExpr::RefNull(_) => { + let block: Vec<_> = match block.take() { Some(b) => b, None => continue, }; @@ -449,21 +458,25 @@ pub fn force_contiguous_elements(module: &mut Module) -> Result<()> { commit(i, block); } } + // If we find a function, then we either start a new block or + // push it onto the existing block. + _ => block.get_or_insert(Vec::new()).push(*expr), } } // If there's no trailing empty slots then we commit the last block onto // the new segment list. if let Some(block) = block { - commit(segment.members.len(), block); + commit(items.len(), block); } - segment.members.truncate(truncate); + items.truncate(truncate); } for (table, offset, ty, members) in new_segments { - let id = module - .elements - .add(ElementKind::Active { table, offset }, ty, members); + let id = module.elements.add( + ElementKind::Active { table, offset }, + ElementItems::Expressions(ty, members), + ); module.tables.get_mut(table).elem_segments.insert(id); } Ok(()) diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index 4ba319685db..f6b8afb078f 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -2,7 +2,7 @@ use crate::wit::{Adapter, NonstandardWitSection}; use crate::wit::{AdapterKind, Instruction, WasmBindgenAux}; use anyhow::{anyhow, Error}; use walrus::ir::Value; -use walrus::{FunctionId, InitExpr, Module}; +use walrus::{ConstExpr, FunctionId, Module}; use wasm_bindgen_multi_value_xform as multi_value_xform; use wasm_bindgen_wasm_conventions as wasm_conventions; @@ -125,19 +125,36 @@ fn resolve_table_entry(module: &Module, func_index: u32) -> FunctionId { let elem = module.elements.get(id); let offset = match elem.kind { walrus::ElementKind::Active { offset, .. } => match offset { - InitExpr::Value(Value::I32(value)) => value as u32, + ConstExpr::Value(Value::I32(value)) => value as u32, _ => panic!("table offset was not an i32 value"), }, _ => panic!("found non-active element section for function table"), }; - elem.members.iter().enumerate().find_map(|(i, &func_id)| { + + let find = |(i, func_id): (usize, Option<&FunctionId>)| { let table_index = i as u32 + offset; if table_index == func_index { - func_id + func_id.cloned() } else { None } - }) + }; + match &elem.items { + walrus::ElementItems::Functions(items) => { + items.iter().map(Some).enumerate().find_map(find) + } + walrus::ElementItems::Expressions(_, items) => items + .iter() + .map(|expr| { + if let ConstExpr::RefFunc(id) = expr { + Some(id) + } else { + None + } + }) + .enumerate() + .find_map(find), + } }) .expect("function in function table is not initialized") } @@ -154,15 +171,31 @@ fn set_table_entry(module: &mut Module, func_index: u32, new_id: FunctionId) { let elem = module.elements.get_mut(id); let offset = match elem.kind { walrus::ElementKind::Active { offset, .. } => match offset { - InitExpr::Value(Value::I32(value)) => value as u32, + ConstExpr::Value(Value::I32(value)) => value as u32, _ => panic!("table offset was not an i32 value"), }, _ => panic!("found non-active element section for function table"), }; - for (i, func_id) in elem.members.iter_mut().enumerate() { - let table_index = i as u32 + offset; - if table_index == func_index { - *func_id = Some(new_id); + match &mut elem.items { + walrus::ElementItems::Functions(items) => { + items.iter_mut().enumerate().for_each(|(i, func_id)| { + let table_index = i as u32 + offset; + if table_index == func_index { + *func_id = new_id; + } + }) + } + walrus::ElementItems::Expressions(_, items) => { + items.iter_mut().enumerate().for_each(|(i, func_id)| { + let table_index = i as u32 + offset; + if table_index == func_index { + assert!( + matches!(func_id, ConstExpr::RefFunc(_)), + "didn't find a function at the expected position" + ); + *func_id = ConstExpr::RefFunc(new_id); + } + }) } } } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index e4d7aa745c1..0be106f060d 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -2,7 +2,7 @@ use crate::descriptor::VectorKind; use crate::wit::{AuxImport, WasmBindgenAux}; use std::borrow::Cow; use std::collections::{HashMap, HashSet}; -use walrus::{FunctionId, ImportId, TypedCustomSectionId}; +use walrus::{FunctionId, ImportId, RefType, TypedCustomSectionId}; #[derive(Default, Debug)] pub struct NonstandardWitSection { @@ -344,8 +344,8 @@ impl AdapterType { walrus::ValType::I64 => AdapterType::I64, walrus::ValType::F32 => AdapterType::F32, walrus::ValType::F64 => AdapterType::F64, - walrus::ValType::Externref => AdapterType::Externref, - walrus::ValType::Funcref | walrus::ValType::V128 => return None, + walrus::ValType::Ref(RefType::Externref) => AdapterType::Externref, + walrus::ValType::Ref(_) | walrus::ValType::V128 => return None, }) } @@ -356,7 +356,9 @@ impl AdapterType { AdapterType::F32 => walrus::ValType::F32, AdapterType::F64 => walrus::ValType::F64, AdapterType::Enum(_) => walrus::ValType::I32, - AdapterType::Externref | AdapterType::NamedExternref(_) => walrus::ValType::Externref, + AdapterType::Externref | AdapterType::NamedExternref(_) => { + walrus::ValType::Ref(RefType::Externref) + } _ => return None, }) } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index b4f1b2c7885..78a7915daa4 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -33,7 +33,7 @@ ureq = { version = "2.7", default-features = false, features = [ "brotli", "gzip", ] } -walrus = { version = "0.20.2", features = ['parallel'] } +walrus = { version = "0.21", features = ['parallel'] } wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.92" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } @@ -43,8 +43,8 @@ diff = "0.1" predicates = "1.0.0" rayon = "1.0" tempfile = "3.0" -wasmparser = "0.102.0" -wasmprinter = "0.2.54" +wasmparser = "0.212" +wasmprinter = "0.212" [[test]] name = "reference" diff --git a/crates/cli/tests/reference/add.wat b/crates/cli/tests/reference/add.wat index b285488bd1a..62ab9c0876b 100644 --- a/crates/cli/tests/reference/add.wat +++ b/crates/cli/tests/reference/add.wat @@ -6,4 +6,6 @@ (export "memory" (memory 0)) (export "add_u32" (func $add_u32)) (export "add_i32" (func $add_i32)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/anyref-empty.wat b/crates/cli/tests/reference/anyref-empty.wat index d8de8796570..2ff9975bfff 100644 --- a/crates/cli/tests/reference/anyref-empty.wat +++ b/crates/cli/tests/reference/anyref-empty.wat @@ -6,4 +6,6 @@ (export "memory" (memory 0)) (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after export) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") ) + diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 42867acbf63..fd4ba663d5e 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -19,4 +19,6 @@ (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__externref_table_dealloc" (func $__externref_table_dealloc)) (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") ) + diff --git a/crates/cli/tests/reference/anyref-nop.wat b/crates/cli/tests/reference/anyref-nop.wat index a410ecd9aac..5b10a28d750 100644 --- a/crates/cli/tests/reference/anyref-nop.wat +++ b/crates/cli/tests/reference/anyref-nop.wat @@ -8,4 +8,6 @@ (export "foo" (func $foo)) (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") ) + diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index 16a39fa1d49..47c4a031437 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -7,4 +7,6 @@ (export "memory" (memory 0)) (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) (export "classbuilder_builder" (func $classbuilder_builder)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index 8bc0fdcb4f6..08eb4887660 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -7,4 +7,6 @@ (export "memory" (memory 0)) (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) (export "classconstructor_new" (func $classconstructor_new)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/empty.wat b/crates/cli/tests/reference/empty.wat index 78e5118949a..b2199f956b4 100644 --- a/crates/cli/tests/reference/empty.wat +++ b/crates/cli/tests/reference/empty.wat @@ -1,4 +1,6 @@ (module $reference_test.wasm (memory (;0;) 16) (export "memory" (memory 0)) + (@custom "target_features" (after export) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index 4928e4e4338..4c9fd212451 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -6,4 +6,6 @@ (export "memory" (memory 0)) (export "enum_echo" (func $enum_echo)) (export "option_enum_echo" (func $option_enum_echo)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import-catch.wat index 2c00b9253d0..2189e238a2e 100644 --- a/crates/cli/tests/reference/import-catch.wat +++ b/crates/cli/tests/reference/import-catch.wat @@ -9,4 +9,6 @@ (export "exported" (func $exported)) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/nop.wat b/crates/cli/tests/reference/nop.wat index 27e6124af3b..211418dd944 100644 --- a/crates/cli/tests/reference/nop.wat +++ b/crates/cli/tests/reference/nop.wat @@ -4,4 +4,6 @@ (memory (;0;) 17) (export "memory" (memory 0)) (export "nop" (func $nop)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/pointers.wat b/crates/cli/tests/reference/pointers.wat index a011881f11f..5d64739088d 100644 --- a/crates/cli/tests/reference/pointers.wat +++ b/crates/cli/tests/reference/pointers.wat @@ -6,4 +6,6 @@ (export "memory" (memory 0)) (export "const_pointer" (func $const_pointer)) (export "mut_pointer" (func $mut_pointer)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/raw.wat b/crates/cli/tests/reference/raw.wat index 0b4ec6cc732..d3589ef5dba 100644 --- a/crates/cli/tests/reference/raw.wat +++ b/crates/cli/tests/reference/raw.wat @@ -11,4 +11,6 @@ (export "__wbg_test_free" (func $__wbg_test_free)) (export "test_test1" (func $test_test1)) (export "test_test2" (func $test_test2)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/result-string.wat b/crates/cli/tests/reference/result-string.wat index c887f70d2c4..c7f63576bbd 100644 --- a/crates/cli/tests/reference/result-string.wat +++ b/crates/cli/tests/reference/result-string.wat @@ -10,4 +10,6 @@ (export "exported" (func $exported)) (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__wbindgen_free" (func $__wbindgen_free)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index c4e8b32b131..e81e8942422 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -4,4 +4,6 @@ (memory (;0;) 17) (export "memory" (memory 0)) (export "docme" (func $docme)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/cli/tests/reference/string-arg.wat b/crates/cli/tests/reference/string-arg.wat index 759fe869e0b..1ce4e8ca28a 100644 --- a/crates/cli/tests/reference/string-arg.wat +++ b/crates/cli/tests/reference/string-arg.wat @@ -10,4 +10,6 @@ (export "foo" (func $foo)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) + diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 173967be1ee..949fdf4fb88 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -14,12 +14,12 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" -walrus = "0.20.2" +walrus = "0.21" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" -wasmprinter = "0.2" +wasmprinter = "0.212" wast = "21.0" wat = "1.0" diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index faa2b1ac1ca..df18491889a 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -20,12 +20,12 @@ use std::cmp; use std::collections::{BTreeMap, HashMap, HashSet}; use std::mem; -use walrus::ir::*; +use walrus::{ir::*, ElementItems, RefType}; +use walrus::{ConstExpr, FunctionId, GlobalId, Module, TableId, ValType}; use walrus::{ElementId, ExportId, ImportId, InstrLocId, TypeId}; -use walrus::{FunctionId, GlobalId, InitExpr, Module, TableId, ValType}; // must be kept in sync with src/lib.rs and EXTERNREF_HEAP_START -const DEFAULT_MIN: u32 = 128; +const DEFAULT_MIN: u64 = 128; /// State of the externref pass, used to collect information while bindings are /// generated and used eventually to actually execute the entire pass. @@ -117,10 +117,14 @@ impl Context { _ => continue, }; let offset = match offset { - walrus::InitExpr::Value(Value::I32(n)) => *n as u32, + walrus::ConstExpr::Value(Value::I32(n)) => *n as u32, other => bail!("invalid offset for segment of function table {:?}", other), }; - let max = offset + elem.members.len() as u32; + let len = match &elem.items { + ElementItems::Functions(items) => items.len(), + ElementItems::Expressions(_, items) => items.len(), + }; + let max = offset + len as u32; self.new_element_offset = cmp::max(self.new_element_offset, max); self.elements.insert(offset, *id); } @@ -131,7 +135,7 @@ impl Context { self.table = Some( module .tables - .add_local(DEFAULT_MIN, None, ValType::Externref), + .add_local(false, DEFAULT_MIN, None, RefType::Externref), ); Ok(()) @@ -195,8 +199,8 @@ impl Context { // Inject a stack pointer global which will be used for managing the // stack on the externref table. - let init = InitExpr::Value(Value::I32(DEFAULT_MIN as i32)); - let stack_pointer = module.globals.add_local(ValType::I32, true, init); + let init = ConstExpr::Value(Value::I32(DEFAULT_MIN as i32)); + let stack_pointer = module.globals.add_local(ValType::I32, true, false, init); let mut heap_alloc = None; let mut heap_dealloc = None; @@ -430,9 +434,18 @@ impl Transform<'_> { .range(..=idx) .next_back() .ok_or(anyhow!("failed to find segment defining index {}", idx))?; - let target = module.elements.get(orig_element).members[(idx - offset) as usize].ok_or( - anyhow!("function index {} not present in element segment", idx), - )?; + + let target = match &module.elements.get(orig_element).items { + ElementItems::Functions(items) => items[(idx - offset) as usize], + ElementItems::Expressions(_, items) => { + if let ConstExpr::RefFunc(target) = items[(idx - offset) as usize] { + target + } else { + bail!("function index {} not present in element segment", idx) + } + } + }; + let (shim, _externref_ty) = self.append_shim( target, &format!("closure{}", idx), @@ -441,20 +454,23 @@ impl Transform<'_> { &mut module.funcs, &mut module.locals, )?; - new_segment.push(Some(shim)); + new_segment.push(ConstExpr::RefFunc(shim)); } // ... and next update the limits of the table in case any are listed. let new_max = self.cx.new_element_offset + new_segment.len() as u32; - table.initial = cmp::max(table.initial, new_max); + table.initial = cmp::max(table.initial, u64::from(new_max)); if let Some(max) = table.maximum { - table.maximum = Some(cmp::max(max, new_max)); + table.maximum = Some(cmp::max(max, u64::from(new_max))); } let kind = walrus::ElementKind::Active { table: table.id(), - offset: InitExpr::Value(Value::I32(self.cx.new_element_offset as i32)), + offset: ConstExpr::Value(Value::I32(self.cx.new_element_offset as i32)), }; - let segment = module.elements.add(kind, ValType::Funcref, new_segment); + let segment = module.elements.add( + kind, + ElementItems::Expressions(RefType::Funcref, new_segment), + ); table.elem_segments.insert(segment); Ok(()) @@ -494,7 +510,9 @@ impl Transform<'_> { for (i, old_ty) in target_ty.params().iter().enumerate() { let is_owned = func.args.remove(&i); - let new_ty = is_owned.map(|_which| ValType::Externref).unwrap_or(*old_ty); + let new_ty = is_owned + .map(|_which| ValType::Ref(RefType::Externref)) + .unwrap_or(*old_ty); param_tys.push(new_ty); if new_ty == *old_ty { param_convert.push(Convert::None); @@ -518,7 +536,7 @@ impl Transform<'_> { let new_ret = if func.ret_externref { assert_eq!(target_ty.results(), &[ValType::I32]); - vec![ValType::Externref] + vec![ValType::Ref(RefType::Externref)] } else { target_ty.results().to_vec() }; @@ -558,7 +576,7 @@ impl Transform<'_> { // gc passes if we don't actually end up using them. let fp = locals.add(ValType::I32); let scratch_i32 = locals.add(ValType::I32); - let scratch_externref = locals.add(ValType::Externref); + let scratch_externref = locals.add(ValType::Ref(RefType::Externref)); // Update our stack pointer if there's any borrowed externref objects. if externref_stack > 0 { @@ -654,7 +672,7 @@ impl Transform<'_> { // no longer in use by our wasm instance. if externref_stack > 0 { body.local_get(fp) - .ref_null(ValType::Externref) + .ref_null(RefType::Externref) .i32_const(externref_stack) .table_fill(self.table) .local_get(fp) @@ -721,7 +739,7 @@ impl Transform<'_> { } }; - let ty = ValType::Externref; + let ty = RefType::Externref; match intrinsic { Intrinsic::TableGrow => { // Change something that looks like: diff --git a/crates/externref-xform/tests/all.rs b/crates/externref-xform/tests/all.rs index 865d8212d25..ce36dd2b0f5 100644 --- a/crates/externref-xform/tests/all.rs +++ b/crates/externref-xform/tests/all.rs @@ -152,9 +152,6 @@ impl Test { pattern.push_str(line); pattern.push('\n'); } - while pattern.ends_with('\n') { - pattern.pop(); - } if iter.next().is_some() { bail!("CHECK-ALL must be at the end of the file"); } diff --git a/crates/externref-xform/tests/anyref-param-owned.wat b/crates/externref-xform/tests/anyref-param-owned.wat index e61883d71da..a0063d05c8e 100644 --- a/crates/externref-xform/tests/anyref-param-owned.wat +++ b/crates/externref-xform/tests/anyref-param-owned.wat @@ -12,7 +12,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) + (func $"foo externref shim" (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -26,6 +26,7 @@ ) (func $foo (;2;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/anyref-param.wat b/crates/externref-xform/tests/anyref-param.wat index 715d908e892..d36133fc763 100644 --- a/crates/externref-xform/tests/anyref-param.wat +++ b/crates/externref-xform/tests/anyref-param.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (param i32))) (type (;1;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (;0;) (type 1) (param externref) + (func $"foo externref shim" (;0;) (type 1) (param externref) (local i32) global.get 0 i32.const 1 @@ -35,6 +35,7 @@ (func $foo (;1;) (type 0) (param i32)) (table (;0;) 128 externref) (global (;0;) (mut i32) i32.const 128) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/clone-ref-intrinsic.wat b/crates/externref-xform/tests/clone-ref-intrinsic.wat index e62fabdc164..4fdf99a186c 100644 --- a/crates/externref-xform/tests/clone-ref-intrinsic.wat +++ b/crates/externref-xform/tests/clone-ref-intrinsic.wat @@ -17,7 +17,7 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param i32) (result i32))) (type (;3;) (func (param externref) (result externref))) - (func $#func0 (@name "foo externref shim") (;0;) (type 3) (param externref) (result externref) + (func $"foo externref shim" (;0;) (type 3) (param externref) (result externref) (local i32) call $alloc local.tee 1 @@ -48,6 +48,7 @@ ) (func $dealloc (;4;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/drop-ref-intrinsic.wat b/crates/externref-xform/tests/drop-ref-intrinsic.wat index 782c85419f8..9f17f64748d 100644 --- a/crates/externref-xform/tests/drop-ref-intrinsic.wat +++ b/crates/externref-xform/tests/drop-ref-intrinsic.wat @@ -16,7 +16,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) + (func $"foo externref shim" (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -34,6 +34,7 @@ ) (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/import-anyref-owned.wat b/crates/externref-xform/tests/import-anyref-owned.wat index b77bd7e7655..35563bc10ca 100644 --- a/crates/externref-xform/tests/import-anyref-owned.wat +++ b/crates/externref-xform/tests/import-anyref-owned.wat @@ -16,7 +16,7 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) (import "" "a" (func $a (;0;) (type 2))) - (func $#func1 (@name "a externref shim") (;1;) (type 1) (param i32) + (func $"a externref shim" (;1;) (type 1) (param i32) local.get 0 table.get 0 local.get 0 @@ -25,10 +25,11 @@ ) (func (;2;) (type 0) i32.const 0 - call $#func1 + call $"a externref shim" ) (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) (export "foo" (func 2)) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/import-anyref-ret.wat b/crates/externref-xform/tests/import-anyref-ret.wat index 14878d3444c..52c0719877c 100644 --- a/crates/externref-xform/tests/import-anyref-ret.wat +++ b/crates/externref-xform/tests/import-anyref-ret.wat @@ -14,7 +14,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (result externref))) (import "" "a" (func $a (;0;) (type 1))) - (func $#func1 (@name "a externref shim") (;1;) (type 0) (result i32) + (func $"a externref shim" (;1;) (type 0) (result i32) (local i32 externref) call $a local.set 1 @@ -25,12 +25,13 @@ local.get 0 ) (func (;2;) (type 0) (result i32) - call $#func1 + call $"a externref shim" ) (func $alloc (;3;) (type 0) (result i32) i32.const 0 ) (table (;0;) 128 externref) (export "foo" (func 2)) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/import-anyref.wat b/crates/externref-xform/tests/import-anyref.wat index 55fe31976bb..2ed417c0bbe 100644 --- a/crates/externref-xform/tests/import-anyref.wat +++ b/crates/externref-xform/tests/import-anyref.wat @@ -16,16 +16,17 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) (import "" "a" (func $a (;0;) (type 2))) - (func $#func1 (@name "a externref shim") (;1;) (type 1) (param i32) + (func $"a externref shim" (;1;) (type 1) (param i32) local.get 0 table.get 0 call $a ) (func (;2;) (type 0) i32.const 0 - call $#func1 + call $"a externref shim" ) (table (;0;) 128 externref) (export "foo" (func 2)) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/mixed-export.wat b/crates/externref-xform/tests/mixed-export.wat index 02327414562..26a08f2c249 100644 --- a/crates/externref-xform/tests/mixed-export.wat +++ b/crates/externref-xform/tests/mixed-export.wat @@ -12,7 +12,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param f32 i32 i64 i32 i32))) (type (;2;) (func (param f32 externref i64 externref i32))) - (func $#func0 (@name "a externref shim") (;0;) (type 2) (param f32 externref i64 externref i32) + (func $"a externref shim" (;0;) (type 2) (param f32 externref i64 externref i32) (local i32 i32) global.get 0 i32.const 1 @@ -47,6 +47,7 @@ (func $a (;2;) (type 1) (param f32 i32 i64 i32 i32)) (table (;0;) 128 externref) (global (;0;) (mut i32) i32.const 128) - (export "a" (func $#func0)) + (export "a" (func $"a externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/mixed.wat b/crates/externref-xform/tests/mixed.wat index 5eba64fd171..edeb646f00d 100644 --- a/crates/externref-xform/tests/mixed.wat +++ b/crates/externref-xform/tests/mixed.wat @@ -21,7 +21,7 @@ (type (;2;) (func (param f32 i32 i64 i32 i32))) (type (;3;) (func (param f32 externref i64 externref i32))) (import "" "a" (func $a (;0;) (type 3))) - (func $#func1 (@name "a externref shim") (;1;) (type 2) (param f32 i32 i64 i32 i32) + (func $"a externref shim" (;1;) (type 2) (param f32 i32 i64 i32 i32) local.get 0 local.get 1 table.get 0 @@ -39,10 +39,11 @@ i64.const 3 i32.const 4 i32.const 5 - call $#func1 + call $"a externref shim" ) (func $dealloc (;3;) (type 1) (param i32)) (table (;0;) 128 externref) (export "foo" (func 2)) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/ret-anyref.wat b/crates/externref-xform/tests/ret-anyref.wat index 811c46b9a37..936d5d0c811 100644 --- a/crates/externref-xform/tests/ret-anyref.wat +++ b/crates/externref-xform/tests/ret-anyref.wat @@ -14,7 +14,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (result externref))) (type (;2;) (func (param i32))) - (func $#func0 (@name "foo externref shim") (;0;) (type 1) (result externref) + (func $"foo externref shim" (;0;) (type 1) (result externref) (local i32) call $foo local.tee 0 @@ -27,6 +27,7 @@ ) (func $dealloc (;2;) (type 2) (param i32)) (table (;0;) 128 externref) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/table-grow-intrinsic.wat b/crates/externref-xform/tests/table-grow-intrinsic.wat index ec7cc07ce0b..9fc963923d9 100644 --- a/crates/externref-xform/tests/table-grow-intrinsic.wat +++ b/crates/externref-xform/tests/table-grow-intrinsic.wat @@ -26,7 +26,7 @@ table.grow 0 drop ) - (func $#func1 (@name "foo externref shim") (;1;) (type 2) (param externref) + (func $"foo externref shim" (;1;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -39,6 +39,7 @@ i32.const 0 ) (table (;0;) 128 externref) - (export "foo" (func $#func1)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/table-set-null-intrinsic.wat b/crates/externref-xform/tests/table-set-null-intrinsic.wat index 3f5cf954986..4a84bb88935 100644 --- a/crates/externref-xform/tests/table-set-null-intrinsic.wat +++ b/crates/externref-xform/tests/table-set-null-intrinsic.wat @@ -16,7 +16,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "foo externref shim") (;0;) (type 2) (param externref) + (func $"foo externref shim" (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -34,6 +34,7 @@ i32.const 0 ) (table (;0;) 128 externref) - (export "foo" (func $#func0)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/table.wat b/crates/externref-xform/tests/table.wat index 1acda79e6f6..3f651ddb879 100644 --- a/crates/externref-xform/tests/table.wat +++ b/crates/externref-xform/tests/table.wat @@ -14,7 +14,7 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param externref))) - (func $#func0 (@name "closure0 externref shim") (;0;) (type 2) (param externref) + (func $"closure0 externref shim" (;0;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -31,6 +31,7 @@ (table (;1;) 128 externref) (export "func" (table 0)) (elem (;0;) (i32.const 0) func $foo) - (elem (;1;) (i32.const 1) func $#func0) + (elem (;1;) (i32.const 1) funcref (ref.func $"closure0 externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/externref-xform/tests/tee-before-grow.wat b/crates/externref-xform/tests/tee-before-grow.wat index b73ffe083fb..2b206343d16 100644 --- a/crates/externref-xform/tests/tee-before-grow.wat +++ b/crates/externref-xform/tests/tee-before-grow.wat @@ -29,7 +29,7 @@ table.grow 0 drop ) - (func $#func1 (@name "foo externref shim") (;1;) (type 2) (param externref) + (func $"foo externref shim" (;1;) (type 2) (param externref) (local i32) call $alloc local.tee 1 @@ -42,6 +42,7 @@ i32.const 0 ) (table (;0;) 128 externref) - (export "foo" (func $#func1)) + (export "foo" (func $"foo externref shim")) + (@custom "target_features" (after code) "\01+\0freference-types") ) ;) diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 6f2a807ff21..20ffe99ad72 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -14,12 +14,12 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" -walrus = "0.20.2" +walrus = "0.21" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" -wasmprinter = "0.2" +wasmprinter = "0.212" wast = "21.0" wat = "1.0" diff --git a/crates/multi-value-xform/src/lib.rs b/crates/multi-value-xform/src/lib.rs index 27645c8de5b..fe87d32ed46 100644 --- a/crates/multi-value-xform/src/lib.rs +++ b/crates/multi-value-xform/src/lib.rs @@ -167,7 +167,7 @@ fn xform_one( round_up_to_alignment(results_size, 8) + 8 } walrus::ValType::V128 => round_up_to_alignment(results_size, 16) + 16, - walrus::ValType::Externref | walrus::ValType::Funcref => anyhow::bail!( + walrus::ValType::Ref(_) => anyhow::bail!( "cannot multi-value transform functions that return \ reference types, since they can't go into linear memory" ), @@ -288,7 +288,7 @@ fn xform_one( ); offset += 16; } - walrus::ValType::Externref | walrus::ValType::Funcref => unreachable!(), + walrus::ValType::Ref(_) => unreachable!(), } } diff --git a/crates/multi-value-xform/tests/align.wat b/crates/multi-value-xform/tests/align.wat index 4a5b9e18a86..89c63267867 100644 --- a/crates/multi-value-xform/tests/align.wat +++ b/crates/multi-value-xform/tests/align.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (result f64 i32 i64))) (type (;1;) (func (param i32))) - (func $#func0 (@name "foo multivalue shim") (;0;) (type 0) (result f64 i32 i64) + (func $"foo multivalue shim" (;0;) (type 0) (result f64 i32 i64) (local i32) global.get 0 i32.const 32 @@ -34,6 +34,7 @@ (func $foo (;1;) (type 1) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) - (export "foo" (func $#func0)) + (export "foo" (func $"foo multivalue shim")) + (@custom "target_features" (after code) "\01+\0amultivalue") ) ;) diff --git a/crates/multi-value-xform/tests/all.rs b/crates/multi-value-xform/tests/all.rs index a72b244b9db..1e14b623625 100644 --- a/crates/multi-value-xform/tests/all.rs +++ b/crates/multi-value-xform/tests/all.rs @@ -140,9 +140,6 @@ impl Test { pattern.push_str(line); pattern.push('\n'); } - while pattern.ends_with('\n') { - pattern.pop(); - } if iter.next().is_some() { bail!("CHECK-ALL must be at the end of the file"); } diff --git a/crates/multi-value-xform/tests/many.wat b/crates/multi-value-xform/tests/many.wat index 680715f4a89..c4fee08a895 100644 --- a/crates/multi-value-xform/tests/many.wat +++ b/crates/multi-value-xform/tests/many.wat @@ -11,7 +11,7 @@ (module (type (;0;) (func (result i32 f32 f64 i64))) (type (;1;) (func (param i32))) - (func $#func0 (@name "foo multivalue shim") (;0;) (type 0) (result i32 f32 f64 i64) + (func $"foo multivalue shim" (;0;) (type 0) (result i32 f32 f64 i64) (local i32) global.get 0 i32.const 32 @@ -36,6 +36,7 @@ (func $foo (;1;) (type 1) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) - (export "foo" (func $#func0)) + (export "foo" (func $"foo multivalue shim")) + (@custom "target_features" (after code) "\01+\0amultivalue") ) ;) diff --git a/crates/multi-value-xform/tests/simple.wat b/crates/multi-value-xform/tests/simple.wat index 045bab590bb..b0f1c0d942a 100644 --- a/crates/multi-value-xform/tests/simple.wat +++ b/crates/multi-value-xform/tests/simple.wat @@ -20,7 +20,7 @@ (type (;2;) (func (result f32))) (type (;3;) (func (result f64))) (type (;4;) (func (param i32))) - (func $#func0 (@name "i32 multivalue shim") (;0;) (type 0) (result i32) + (func $"i32 multivalue shim" (;0;) (type 0) (result i32) (local i32) global.get 0 i32.const 16 @@ -36,7 +36,7 @@ i32.add global.set 0 ) - (func $#func1 (@name "i64 multivalue shim") (;1;) (type 1) (result i64) + (func $"i64 multivalue shim" (;1;) (type 1) (result i64) (local i32) global.get 0 i32.const 16 @@ -52,7 +52,7 @@ i32.add global.set 0 ) - (func $#func2 (@name "f32 multivalue shim") (;2;) (type 2) (result f32) + (func $"f32 multivalue shim" (;2;) (type 2) (result f32) (local i32) global.get 0 i32.const 16 @@ -68,7 +68,7 @@ i32.add global.set 0 ) - (func $#func3 (@name "f64 multivalue shim") (;3;) (type 3) (result f64) + (func $"f64 multivalue shim" (;3;) (type 3) (result f64) (local i32) global.get 0 i32.const 16 @@ -90,9 +90,10 @@ (func $f64 (;7;) (type 4) (param i32)) (memory (;0;) 1) (global (;0;) (mut i32) i32.const 0) - (export "i32" (func $#func0)) - (export "i64" (func $#func1)) - (export "f32" (func $#func2)) - (export "f64" (func $#func3)) + (export "i32" (func $"i32 multivalue shim")) + (export "i64" (func $"i64 multivalue shim")) + (export "f32" (func $"f32 multivalue shim")) + (export "f64" (func $"f64 multivalue shim")) + (@custom "target_features" (after code) "\01+\0amultivalue") ) ;) diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 14edd58207e..e714207c1ce 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -14,13 +14,13 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" -walrus = "0.20.2" +walrus = "0.21" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } [dev-dependencies] rayon = "1.0" -wasmprinter = "0.2" -wasmparser = "0.82" +wasmprinter = "0.212" +wasmparser = "0.212" wat = "1.0" [[test]] diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index a9d0898cd33..1dd4d70c151 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -4,7 +4,7 @@ use std::env; use walrus::ir::Value; use walrus::FunctionBuilder; use walrus::{ - ir::MemArg, ExportItem, FunctionId, GlobalId, GlobalKind, InitExpr, InstrSeqBuilder, MemoryId, + ir::MemArg, ConstExpr, ExportItem, FunctionId, GlobalId, GlobalKind, InstrSeqBuilder, MemoryId, Module, ValType, }; use wasm_bindgen_wasm_conventions as wasm_conventions; @@ -129,7 +129,10 @@ impl Config { assert!(mem.shared); let prev_max = mem.maximum.unwrap(); assert!(mem.import.is_some()); - mem.maximum = Some(cmp::max(self.maximum_memory / PAGE_SIZE, prev_max)); + mem.maximum = Some(cmp::max( + u64::from(self.maximum_memory / PAGE_SIZE), + prev_max, + )); assert!(mem.data_segments.is_empty()); let tls = Tls { @@ -145,7 +148,7 @@ impl Config { let stack_alloc = module .globals - .add_local(ValType::I32, true, InitExpr::Value(Value::I32(0))); + .add_local(ValType::I32, true, false, ConstExpr::Value(Value::I32(0))); // Make sure the temporary stack is aligned down let temp_stack = (base + static_data_pages * PAGE_SIZE) & !(static_data_align - 1); @@ -161,7 +164,8 @@ impl Config { size: module.globals.add_local( ValType::I32, true, - InitExpr::Value(Value::I32(self.thread_stack_size as i32)), + false, + ConstExpr::Value(Value::I32(self.thread_stack_size as i32)), ), }; @@ -222,7 +226,7 @@ fn delete_synthetic_global(module: &mut Module, name: &str) -> Result bail!("`{}` must not be an imported global", name), }; match g { - InitExpr::Value(Value::I32(v)) => Ok(v as u32), + ConstExpr::Value(Value::I32(v)) => Ok(v as u32), _ => bail!("`{}` was not an `i32` constant", name), } } @@ -278,7 +282,7 @@ fn allocate_static_data( bail!("the `__heap_base` global is unexpectedly mutable"); } let offset = match &mut global.kind { - GlobalKind::Local(InitExpr::Value(Value::I32(n))) => n, + GlobalKind::Local(ConstExpr::Value(Value::I32(n))) => n, _ => bail!("`__heap_base` not a locally defined `i32`"), }; @@ -291,7 +295,7 @@ fn allocate_static_data( }; let memory = module.memories.get_mut(memory); - memory.initial += pages; + memory.initial += u64::from(pages); memory.maximum = memory.maximum.map(|m| cmp::max(m, memory.initial)); Ok((base as u32, address)) diff --git a/crates/threads-xform/tests/all.rs b/crates/threads-xform/tests/all.rs index 789346f3446..e38f377f211 100644 --- a/crates/threads-xform/tests/all.rs +++ b/crates/threads-xform/tests/all.rs @@ -28,14 +28,9 @@ fn runtest(test: &Test) -> Result { config.run(&mut module)?; walrus::passes::gc::run(&mut module); - let features = wasmparser::WasmFeatures { - threads: true, - ..Default::default() - }; + let features = wasmparser::WasmFeatures::default() | wasmparser::WasmFeatures::THREADS; - wasmparser::Validator::new() - .wasm_features(features) - .validate_all(&module.emit_wasm())?; + wasmparser::Validator::new_with_features(features).validate_all(&module.emit_wasm())?; let printed = wasmprinter::print_bytes(module.emit_wasm())?; @@ -126,9 +121,6 @@ impl Test { pattern.push_str(line); pattern.push('\n'); } - while pattern.ends_with('\n') { - pattern.pop(); - } if iter.next().is_some() { bail!("CHECK-ALL must be at the end of the file"); } diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index da05515c9cc..d4178ec94b2 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -12,8 +12,8 @@ rust-version = "1.57" [dependencies] leb128 = "0.2" -walrus = "0.20.2" +walrus = "0.21" # Matching the version `walrus` depends on. -wasmparser = "0.80" +wasmparser = "0.212" anyhow = "1.0" log = "0.4" diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index d7cb7279b0c..c0f25739456 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -10,10 +10,10 @@ use std::io::Cursor; use anyhow::{anyhow, bail, Context, Result}; use walrus::{ - ir::Value, ElementId, FunctionBuilder, FunctionId, FunctionKind, GlobalId, GlobalKind, - InitExpr, MemoryId, Module, RawCustomSection, ValType, + ir::Value, ConstExpr, ElementId, ElementItems, FunctionBuilder, FunctionId, FunctionKind, + GlobalId, GlobalKind, MemoryId, Module, RawCustomSection, ValType, }; -use wasmparser::BinaryReader; +use wasmparser::{BinaryReader, WasmFeatures}; /// Get a Wasm module's canonical linear memory. pub fn get_memory(module: &Module) -> Result { @@ -52,7 +52,7 @@ pub fn get_stack_pointer(module: &Module) -> Option { // guaranteed to have an i32 initializer, so find globals which are // locally defined, are an i32, and have a nonzero initializer .filter(|g| match g.kind { - GlobalKind::Local(InitExpr::Value(Value::I32(n))) => n != 0, + GlobalKind::Local(ConstExpr::Value(Value::I32(n))) => n != 0, _ => false, }) .collect::>(); @@ -108,18 +108,30 @@ pub fn get_function_table_entry(module: &Module, idx: u32) -> Result *n as u32, _ => continue, }; let idx = (idx - offset) as usize; - match segment.members.get(idx) { + + let slot = match &segment.items { + ElementItems::Functions(items) => items.get(idx).map(Some), + ElementItems::Expressions(_, items) => items.get(idx).map(|item| { + if let ConstExpr::RefFunc(target) = item { + Some(target) + } else { + None + } + }), + }; + + match slot { Some(slot) => { return Ok(FunctionTableEntry { element: segment.id(), idx, - func: *slot, + func: slot.cloned(), }) } None => continue, @@ -181,7 +193,7 @@ pub fn insert_target_feature(module: &mut Module, new_feature: &str) -> Result<( .as_any_mut() .downcast_mut() .context("failed to read section")?; - let mut reader = BinaryReader::new(§ion.data); + let mut reader = BinaryReader::new(§ion.data, 0, WasmFeatures::default()); // The first integer contains the target feature count. let count = reader.read_var_u32()?; @@ -189,7 +201,7 @@ pub fn insert_target_feature(module: &mut Module, new_feature: &str) -> Result<( for _ in 0..count { // First byte is the prefix. let prefix_index = reader.current_position(); - let prefix = reader.read_u8()? as u8; + let prefix = reader.read_u8()?; // Read the feature. let length = reader.read_var_u32()?; let feature = reader.read_bytes(length as usize)?; diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 879602ec935..33c0c20eea9 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.57" [dependencies] anyhow = "1.0" log = "0.4" -walrus = "0.20.2" +walrus = "0.21" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.92" } [dev-dependencies] diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 359eb197a94..c13a23f64b8 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -18,7 +18,7 @@ #![deny(missing_docs)] -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet, HashMap}; use walrus::ir::Instr; use walrus::{ElementId, FunctionId, LocalId, Module, TableId}; @@ -157,7 +157,7 @@ impl Interpreter { &mut self, id: FunctionId, module: &Module, - entry_removal_list: &mut HashSet<(ElementId, usize)>, + entry_removal_list: &mut HashMap>, ) -> Option<&[u32]> { // Call the `id` function. This is an internal `#[inline(never)]` // whose code is completely controlled by the `wasm-bindgen` crate, so @@ -194,7 +194,10 @@ impl Interpreter { wasm_bindgen_wasm_conventions::get_function_table_entry(module, descriptor_table_idx) .expect("failed to find entry in function table"); let descriptor_id = entry.func.expect("element segment slot wasn't set"); - entry_removal_list.insert((entry.element, entry.idx)); + entry_removal_list + .entry(entry.element) + .or_default() + .insert(entry.idx); // And now execute the descriptor! self.interpret_descriptor(descriptor_id, module) From e58ff180e7978e1b401fac2fe1f2dd4429e4c4c2 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 01:18:37 +0200 Subject: [PATCH 443/641] Introduce MSRV policy (#4038) --- .github/workflows/main.yml | 22 +++++++++++++++++++ .gitignore | 1 + CHANGELOG.md | 3 +++ Cargo.toml | 1 + README.md | 6 +++++ benchmarks/Cargo.toml | 1 - crates/cli-support/Cargo.toml | 2 +- crates/cli-support/src/js/mod.rs | 2 +- crates/cli/Cargo.toml | 2 +- crates/example-tests/Cargo.toml | 1 - crates/msrv/cli/Cargo.toml | 8 +++++++ crates/msrv/cli/src/lib.rs | 0 crates/msrv/lib/Cargo.toml | 19 ++++++++++++++++ crates/msrv/lib/src/lib.rs | 0 crates/test/src/rt/mod.rs | 2 +- crates/typescript-tests/Cargo.toml | 1 - crates/webidl-tests/Cargo.toml | 1 - crates/webidl/Cargo.toml | 1 - examples/add/Cargo.toml | 1 - examples/canvas/Cargo.toml | 1 - examples/char/Cargo.toml | 1 - examples/closures/Cargo.toml | 1 - examples/console_log/Cargo.toml | 1 - examples/deno/Cargo.toml | 1 - examples/dom/Cargo.toml | 1 - examples/duck-typed-interfaces/Cargo.toml | 1 - examples/fetch/Cargo.toml | 1 - .../guide-supported-types-examples/Cargo.toml | 1 - examples/hello_world/Cargo.toml | 1 - examples/julia_set/Cargo.toml | 1 - examples/paint/Cargo.toml | 1 - examples/performance/Cargo.toml | 1 - examples/raytrace-parallel/Cargo.toml | 1 - examples/request-animation-frame/Cargo.toml | 1 - examples/synchronous-instantiation/Cargo.toml | 1 - examples/todomvc/Cargo.toml | 1 - examples/wasm-audio-worklet/Cargo.toml | 1 - examples/wasm-in-wasm-imports/Cargo.toml | 1 - examples/wasm-in-wasm/Cargo.toml | 1 - examples/wasm-in-web-worker/Cargo.toml | 1 - examples/wasm2js/Cargo.toml | 1 - examples/weather_report/Cargo.toml | 1 - examples/webaudio/Cargo.toml | 1 - examples/webgl/Cargo.toml | 1 - examples/webrtc_datachannel/Cargo.toml | 1 - examples/websockets/Cargo.toml | 1 - examples/webxr/Cargo.toml | 1 - .../without-a-bundler-no-modules/Cargo.toml | 1 - examples/without-a-bundler/Cargo.toml | 1 - 49 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 crates/msrv/cli/Cargo.toml create mode 100644 crates/msrv/cli/src/lib.rs create mode 100644 crates/msrv/lib/Cargo.toml create mode 100644 crates/msrv/lib/src/lib.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 474927a2317..02e750ec043 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -438,6 +438,28 @@ jobs: name: doc_api path: docs.tar.gz + msrv-lib: + name: Check MSRV for libraries + runs-on: ubuntu-latest + defaults: + run: + working-directory: crates/msrv/lib + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update 1.57 && rustup default 1.57 + - run: cargo build + + msrv-cli: + name: Check MSRV for CLI tools + runs-on: ubuntu-latest + defaults: + run: + working-directory: crates/msrv/cli + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update 1.76 && rustup default 1.76 + - run: cargo build + deploy: permissions: diff --git a/.gitignore b/.gitignore index 01d711fac1a..57e7ac31a73 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ yarn.lock .vscode webdriver.json benchmarks/pkg +/crates/msrv/*/target diff --git a/CHANGELOG.md b/CHANGELOG.md index 654c4b5d288..aed74616a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,9 @@ * Added support for WebIDL records. This added new methods to various APIs, notably `ClipboardItem()`, `GPUDeviceDescriptor.requiredLimits` and `Header()`. [#4030](https://github.com/rustwasm/wasm-bindgen/pull/4030) +* Added an official MSRV policy. Library MSRV changes will be accompanied by a minor version bump. CLI tool MSRV can change with any version bump. + [#4038](https://github.com/rustwasm/wasm-bindgen/pull/4038) + ### Changed * Stabilize Web Share API. diff --git a/Cargo.toml b/Cargo.toml index c06934617d1..2c005e69adc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,6 +101,7 @@ members = [ "examples/synchronous-instantiation", "tests/no-std", ] +exclude = ["crates/msrv"] resolver = "2" [patch.crates-io] diff --git a/README.md b/README.md index 82a9da42182..a9d57ee0a4e 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,12 @@ You can find general documentation about using Rust and WebAssembly together - [web-sys](https://docs.rs/web-sys) - [wasm-bindgen-futures](https://docs.rs/wasm-bindgen-futures) +## MSRV Policy + +Libraries that are released on [crates.io](https://crates.io) have a MSRV of v1.57. Changes to the MSRV will be accompanied by a minor version bump. + +CLI tools and their corresponding support libraries have a MSRV of v1.76. Changes to the MSRV will be accompanied by a patch version bump. + ## License This project is licensed under either of diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 1321bf7e38a..373e793eef8 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm-bindgen-benchmark" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [dependencies] wasm-bindgen = { path = '../' } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 157c1b6c160..983b0fadbeb 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -10,7 +10,7 @@ description = """ Shared support for the wasm-bindgen-cli package, an internal dependency """ edition = '2018' -rust-version = "1.57" +rust-version = "1.76" [dependencies] anyhow = "1.0" diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 7781e3165e0..1fae3de1454 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2637,7 +2637,7 @@ impl<'a> Context<'a> { assert!(!catch); assert!(!log_error); - let ts_sig = export.generate_typescript.then(|| ts_sig.as_str()); + let ts_sig = export.generate_typescript.then_some(ts_sig.as_str()); let js_docs = format_doc_comments(&export.comments, Some(js_doc)); let ts_docs = format_doc_comments(&export.comments, None); diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 78a7915daa4..c0ea98c0190 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -13,7 +13,7 @@ information see https://github.com/rustwasm/wasm-bindgen. """ edition = '2018' default-run = 'wasm-bindgen' -rust-version = "1.57" +rust-version = "1.76" [package.metadata.binstall] pkg-url = "https://github.com/rustwasm/wasm-bindgen/releases/download/{ version }/wasm-bindgen-{ version }-{ target }{ archive-suffix }" diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index ac21c421632..c394b9dbe60 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -3,7 +3,6 @@ name = "example-tests" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [dependencies] anyhow = "1.0.75" diff --git a/crates/msrv/cli/Cargo.toml b/crates/msrv/cli/Cargo.toml new file mode 100644 index 00000000000..c5fcdfcb967 --- /dev/null +++ b/crates/msrv/cli/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "msrv-cli-test" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies] +wasm-bindgen-cli = { path = "../../cli" } diff --git a/crates/msrv/cli/src/lib.rs b/crates/msrv/cli/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml new file mode 100644 index 00000000000..f7ac53ea6e2 --- /dev/null +++ b/crates/msrv/lib/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "msrv-library-test" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies] +js-sys = { path = "../../js-sys" } +wasm-bindgen = { path = "../../../" } +wasm-bindgen-futures = { path = "../../futures" } +wasm-bindgen-test = { path = "../../test" } +web-sys = { path = "../../web-sys" } + +bumpalo = "=3.12.0" +log = "=0.4.18" +scoped-tls = "=1.0.0" + +[patch.crates-io] +wasm-bindgen = { path = "../../../" } diff --git a/crates/msrv/lib/src/lib.rs b/crates/msrv/lib/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index c1be2904303..b89646026c1 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -216,7 +216,7 @@ impl Display for TestResult { TestResult::Ok => write!(f, "ok"), TestResult::Err(_) => write!(f, "FAIL"), TestResult::Ignored(None) => write!(f, "ignored"), - TestResult::Ignored(Some(reason)) => write!(f, "ignored, {reason}"), + TestResult::Ignored(Some(reason)) => write!(f, "ignored, {}", reason), } } } diff --git a/crates/typescript-tests/Cargo.toml b/crates/typescript-tests/Cargo.toml index 92465c4b14e..6ce332a887d 100644 --- a/crates/typescript-tests/Cargo.toml +++ b/crates/typescript-tests/Cargo.toml @@ -3,7 +3,6 @@ name = "typescript-tests" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [dependencies] wasm-bindgen = { path = '../..' } diff --git a/crates/webidl-tests/Cargo.toml b/crates/webidl-tests/Cargo.toml index 5f3333d5dce..c16223adc97 100644 --- a/crates/webidl-tests/Cargo.toml +++ b/crates/webidl-tests/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" publish = false -rust-version = "1.57" [lib] test = false diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 6c9a6a6726c..a151dfbec8f 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -11,7 +11,6 @@ description = """ Support for parsing WebIDL specific to wasm-bindgen """ edition = "2018" -rust-version = "1.57" [dependencies] env_logger = "0.11.5" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index 5cbc88d4e79..ae70f80a3f3 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -3,7 +3,6 @@ name = "add" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 8fc55fc09b0..8ec3f019095 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -3,7 +3,6 @@ name = "canvas" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 6378d2aab0e..bf54d80c78b 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -3,7 +3,6 @@ name = "char" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 31f0d065a19..c049f8fd40c 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -3,7 +3,6 @@ name = "closures" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index e5aa71a73f2..24d45648fa4 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -3,7 +3,6 @@ name = "console_log" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index c4f54a9f227..b9200c8e2b9 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -3,7 +3,6 @@ name = "deno" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 0ce8e8ac8da..d9192ba9ede 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -3,7 +3,6 @@ name = "dom" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index e7835f2c866..859424183f0 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -3,7 +3,6 @@ name = "rust-duck-typed-interfaces" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 4e3e0221f0d..ca06756d4ec 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -3,7 +3,6 @@ name = "fetch" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 3d7c676ed75..718fa6071a1 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -3,7 +3,6 @@ name = "guide-supported-types-examples" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index af785ee9a0e..82141390286 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -3,7 +3,6 @@ name = "hello_world" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 9ec7b105958..d909de5c05d 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -3,7 +3,6 @@ name = "julia_set" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 8bfe388ca65..de74bcbd787 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm-bindgen-paint" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 6893b153ad1..8d4357705de 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -3,7 +3,6 @@ name = "performance" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 1120fab045a..a568710146d 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -3,7 +3,6 @@ name = "raytrace-parallel" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 1497c24bbe8..c3c7cb69baa 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -3,7 +3,6 @@ name = "request-animation-frame" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 900e06dca74..38821a43db6 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -3,7 +3,6 @@ name = "synchronous-instantiation" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index e5a030c5e60..d0109503eea 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -3,7 +3,6 @@ name = "todomvc" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index 9345765d1c0..b4c7d430735 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -2,7 +2,6 @@ name = "wasm-audio-worklet" version = "0.1.0" edition = "2021" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 2083ce4bbd3..531d66dc1c3 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm-in-wasm-imports" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 2556bb3d8ef..bc27b3b9279 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm-in-wasm" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 3505c6264c1..0af50a7037a 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm-in-web-worker" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index d1b32152293..c562b740cbf 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -3,7 +3,6 @@ name = "wasm2js" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index a7e9d25c509..8f28c0e74d5 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -6,7 +6,6 @@ authors = ["Ayush "] categories = ["wasm"] readme = "README.md" edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 628b967fbea..75a3e4626a5 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -3,7 +3,6 @@ name = "webaudio" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index 2cea61a990d..ada463ffefb 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -3,7 +3,6 @@ name = "webgl" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index aa7abf9a026..b0353ee8adc 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -3,7 +3,6 @@ name = "webrtc_datachannel" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 1a8f5b19904..41ef57c17ed 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -3,7 +3,6 @@ name = "websockets" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 48aeae2c1f7..3db27855c88 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -3,7 +3,6 @@ name = "webxr" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/without-a-bundler-no-modules/Cargo.toml b/examples/without-a-bundler-no-modules/Cargo.toml index a112b33d61f..9c0bf1cbe70 100644 --- a/examples/without-a-bundler-no-modules/Cargo.toml +++ b/examples/without-a-bundler-no-modules/Cargo.toml @@ -3,7 +3,6 @@ name = "without-a-bundler-no-modules" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 3c5025647d6..9d71debcb19 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -3,7 +3,6 @@ name = "without-a-bundler" version = "0.1.0" authors = ["The wasm-bindgen Developers"] edition = "2018" -rust-version = "1.57" [lib] crate-type = ["cdylib"] From 4f3734349dca2ecdebbd036aa31a58db6d5c163f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 01:30:51 +0200 Subject: [PATCH 444/641] Bump `base64` to v0.22 (#4039) --- crates/cli-support/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 983b0fadbeb..57e4f7e156f 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -14,7 +14,7 @@ rust-version = "1.76" [dependencies] anyhow = "1.0" -base64 = "0.21" +base64 = "0.22" log = "0.4" rustc-demangle = "0.1.13" serde_json = "1.0" From 2308e610728300ef489e6e3a949504d368b73cf8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 10:35:32 +0200 Subject: [PATCH 445/641] Revise `#[track_caller]` condition on `UnwrapThrowExt` (#4042) Fixes missing `cfg(debug_assertions)` condition in `impl UnwrapThrowExt for Result`. Remove wrong `cfg(feature = "std")` condition on `UnwrapThrowExt::unwrap_throw()`s default implementation. Co-authored-by: Liam Murphy <43807659+Liamolucko@users.noreply.github.com> --- CHANGELOG.md | 3 +++ src/lib.rs | 36 +++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aed74616a12..1f5373f6df8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -163,6 +163,9 @@ * Implement a more reliable way to detect the stack pointer. [#4036](https://github.com/rustwasm/wasm-bindgen/pull/4036) +* `#[track_caller]` is now always applied on `UnwrapThrowExt` methods when not targetting `wasm32-unknown-unknown`. + [#4042](https://github.com/rustwasm/wasm-bindgen/pull/4042) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/src/lib.rs b/src/lib.rs index 34b533bdfd6..5f77c3a3ccc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1337,9 +1337,24 @@ pub fn anyref_heap_live_count() -> u32 { pub trait UnwrapThrowExt: Sized { /// Unwrap this `Option` or `Result`, but instead of panicking on failure, /// throw an exception to JavaScript. - #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr( + any( + debug_assertions, + not(all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + )) + ), + track_caller + )] fn unwrap_throw(self) -> T { - if cfg!(all(debug_assertions, feature = "std")) { + if cfg!(all( + debug_assertions, + all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + ) + )) { let loc = core::panic::Location::caller(); let msg = alloc::format!( "`unwrap_throw` failed ({}:{}:{})", @@ -1356,12 +1371,20 @@ pub trait UnwrapThrowExt: Sized { /// Unwrap this container's `T` value, or throw an error to JS with the /// given message if the `T` value is unavailable (e.g. an `Option` is /// `None`). - #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr( + any( + debug_assertions, + not(all( + target_arch = "wasm32", + not(any(target_os = "emscripten", target_os = "wasi")) + )) + ), + track_caller + )] fn expect_throw(self, message: &str) -> T; } impl UnwrapThrowExt for Option { - #[cfg_attr(debug_assertions, track_caller)] fn expect_throw(self, message: &str) -> T { if cfg!(all( target_arch = "wasm32", @@ -1381,9 +1404,9 @@ impl UnwrapThrowExt for Result where E: core::fmt::Debug, { - #[cfg_attr(debug_assertions, track_caller)] fn unwrap_throw(self) -> T { if cfg!(all( + debug_assertions, target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")) )) { @@ -1403,11 +1426,10 @@ where } } } else { - self.unwrap() + self.expect("`unwrap_throw` failed") } } - #[cfg_attr(debug_assertions, track_caller)] fn expect_throw(self, message: &str) -> T { if cfg!(all( target_arch = "wasm32", From 542b1db09a42ef015d760e1b2a13c111b104f216 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 10:57:43 +0200 Subject: [PATCH 446/641] Use `cfg(target_os = "unknown")` (#4043) --- crates/backend/src/codegen.rs | 32 ++++++++++++++++---------------- src/externref.rs | 2 +- src/lib.rs | 33 +++++++++------------------------ 3 files changed, 26 insertions(+), 41 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 21b326ba153..e76718148af 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -159,7 +159,7 @@ impl TryToTokens for ast::Program { let prefix_json_bytes = syn::LitByteStr::new(&prefix_json_bytes, Span::call_site()); (quote! { - #[cfg(target_arch = "wasm32")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #[automatically_derived] const _: () = { use #wasm_bindgen::__rt::{flat_len, flat_byte_slices}; @@ -268,12 +268,12 @@ impl ToTokens for ast::Struct { let ptr = #wasm_bindgen::convert::IntoWasmAbi::into_abi(value); #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] extern "C" { fn #new_fn(ptr: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #new_fn(_: u32) -> u32 { panic!("cannot convert to JsValue outside of the wasm target") } @@ -285,7 +285,7 @@ impl ToTokens for ast::Struct { } } - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #[automatically_derived] const _: () = { #[no_mangle] @@ -373,12 +373,12 @@ impl ToTokens for ast::Struct { let idx = #wasm_bindgen::convert::IntoWasmAbi::into_abi(&value); #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] extern "C" { fn #unwrap_fn(ptr: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #unwrap_fn(_: u32) -> u32 { panic!("cannot convert from JsValue outside of the wasm target") } @@ -481,7 +481,7 @@ impl ToTokens for ast::StructField { (quote! { #[automatically_derived] const _: () = { - #[cfg_attr(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))), no_mangle)] + #[cfg_attr(all(target_arch = "wasm32", target_os = "unknown"), no_mangle)] #[doc(hidden)] pub unsafe extern "C" fn #getter(js: u32) -> #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi> @@ -519,7 +519,7 @@ impl ToTokens for ast::StructField { let (args, names) = splat(wasm_bindgen, &Ident::new("val", rust_name.span()), &abi); (quote! { - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #[automatically_derived] const _: () = { #[no_mangle] @@ -777,7 +777,7 @@ impl TryToTokens for ast::Export { const _: () = { #(#attrs)* #[cfg_attr( - all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))), + all(target_arch = "wasm32", target_os = "unknown"), export_name = #export_name, )] pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { @@ -1036,11 +1036,11 @@ impl ToTokens for ast::ImportType { impl JsCast for #rust_name { fn instanceof(val: &JsValue) -> bool { #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] extern "C" { fn #instanceof_shim(val: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #instanceof_shim(_: u32) -> u32 { panic!("cannot check instanceof on non-wasm targets"); } @@ -1655,12 +1655,12 @@ impl ToTokens for ast::ImportStatic { #vis static #name: #wasm_bindgen::JsStatic<#ty> = { fn init() -> #ty { #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] extern "C" { fn #shim_name() -> #abi_ret; } - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #shim_name() -> #abi_ret { panic!("cannot access imported statics on non-wasm targets") } @@ -1725,7 +1725,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { let attrs = &self.attrs; let wasm_bindgen = &self.wasm_bindgen; (quote! { - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #[automatically_derived] const _: () = { #(#attrs)* @@ -1751,14 +1751,14 @@ fn extern_fn( abi_ret: TokenStream, ) -> TokenStream { quote! { - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #(#attrs)* #[link(wasm_import_module = "__wbindgen_placeholder__")] extern "C" { fn #import_name(#(#abi_arguments),*) -> #abi_ret; } - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #import_name(#(#abi_arguments),*) -> #abi_ret { #( drop(#abi_argument_names); diff --git a/src/externref.rs b/src/externref.rs index b4c73e4405b..1691bc45892 100644 --- a/src/externref.rs +++ b/src/externref.rs @@ -106,7 +106,7 @@ fn internal_error(msg: &str) -> ! { std::process::abort(); } else if #[cfg(all( target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) + target_os = "unknown" ))] { core::arch::wasm32::unreachable(); } else { diff --git a/src/lib.rs b/src/lib.rs index 5f77c3a3ccc..4fe948ff4af 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,14 +32,14 @@ macro_rules! if_std { macro_rules! externs { ($(#[$attr:meta])* extern "C" { $(fn $name:ident($($args:tt)*) -> $ret:ty;)* }) => ( - #[cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] $(#[$attr])* extern "C" { $(fn $name($($args)*) -> $ret;)* } $( - #[cfg(not(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] #[allow(unused_variables)] unsafe extern fn $name($($args)*) -> $ret { panic!("function not implemented on non-wasm32 targets") @@ -1340,20 +1340,14 @@ pub trait UnwrapThrowExt: Sized { #[cfg_attr( any( debug_assertions, - not(all( - target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) - )) + not(all(target_arch = "wasm32", target_os = "unknown")) ), track_caller )] fn unwrap_throw(self) -> T { if cfg!(all( debug_assertions, - all( - target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) - ) + all(target_arch = "wasm32", target_os = "unknown") )) { let loc = core::panic::Location::caller(); let msg = alloc::format!( @@ -1374,10 +1368,7 @@ pub trait UnwrapThrowExt: Sized { #[cfg_attr( any( debug_assertions, - not(all( - target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) - )) + not(all(target_arch = "wasm32", target_os = "unknown")) ), track_caller )] @@ -1386,10 +1377,7 @@ pub trait UnwrapThrowExt: Sized { impl UnwrapThrowExt for Option { fn expect_throw(self, message: &str) -> T { - if cfg!(all( - target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) - )) { + if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { match self { Some(val) => val, None => throw_str(message), @@ -1408,7 +1396,7 @@ where if cfg!(all( debug_assertions, target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) + target_os = "unknown" )) { match self { Ok(val) => val, @@ -1431,10 +1419,7 @@ where } fn expect_throw(self, message: &str) -> T { - if cfg!(all( - target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) - )) { + if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { match self { Ok(val) => val, Err(_) => throw_str(message), @@ -1792,7 +1777,7 @@ pub mod __rt { std::process::abort(); } else if #[cfg(all( target_arch = "wasm32", - not(any(target_os = "emscripten", target_os = "wasi")) + target_os = "unknown" ))] { core::arch::wasm32::unreachable(); } else { From f6bcfd030380051891eaa447b78312e557f7af33 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 10:58:10 +0200 Subject: [PATCH 447/641] Fix CLI MSRV (#4044) Added a complete list of dependencies to test into dedicated MSRV testing crates. --- crates/externref-xform/Cargo.toml | 2 +- crates/msrv/cli/Cargo.toml | 6 ++++++ crates/msrv/lib/Cargo.toml | 9 +++++++-- crates/multi-value-xform/Cargo.toml | 2 +- crates/threads-xform/Cargo.toml | 2 +- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 949fdf4fb88..3e1986c29f1 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -10,7 +10,7 @@ description = """ Internal externref transformations for wasm-bindgen """ edition = '2018' -rust-version = "1.57" +rust-version = "1.76" [dependencies] anyhow = "1.0" diff --git a/crates/msrv/cli/Cargo.toml b/crates/msrv/cli/Cargo.toml index c5fcdfcb967..407449459a7 100644 --- a/crates/msrv/cli/Cargo.toml +++ b/crates/msrv/cli/Cargo.toml @@ -6,3 +6,9 @@ publish = false [dependencies] wasm-bindgen-cli = { path = "../../cli" } +wasm-bindgen-cli-support = { path = "../../cli-support" } +wasm-bindgen-wasm-interpreter = { path = "../../wasm-interpreter" } +wasm-bindgen-threads-xform = { path = "../../threads-xform" } +wasm-bindgen-multi-value-xform = { path = "../../multi-value-xform" } +wasm-bindgen-externref-xform = { path = "../../externref-xform" } +wasm-bindgen-wasm-conventions = { path = "../../wasm-conventions" } diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index f7ac53ea6e2..6af2d333a1f 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -5,11 +5,16 @@ edition = "2018" publish = false [dependencies] -js-sys = { path = "../../js-sys" } wasm-bindgen = { path = "../../../" } +js-sys = { path = "../../js-sys" } +web-sys = { path = "../../web-sys" } wasm-bindgen-futures = { path = "../../futures" } wasm-bindgen-test = { path = "../../test" } -web-sys = { path = "../../web-sys" } +wasm-bindgen-macro = { path = "../../macro" } +wasm-bindgen-test-macro = { path = "../../test-macro" } +wasm-bindgen-macro-support = { path = "../../macro-support" } +wasm-bindgen-backend = { path = "../../backend" } +wasm-bindgen-shared = { path = "../../shared" } bumpalo = "=3.12.0" log = "=0.4.18" diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 20ffe99ad72..6bbec0c8b81 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -10,7 +10,7 @@ description = """ Internal multi-value transformations for wasm-bindgen """ edition = "2018" -rust-version = "1.57" +rust-version = "1.76" [dependencies] anyhow = "1.0" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index e714207c1ce..172c7a0c202 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -10,7 +10,7 @@ description = """ Support for threading-related transformations in wasm-bindgen """ edition = "2018" -rust-version = "1.57" +rust-version = "1.76" [dependencies] anyhow = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index d4178ec94b2..9c1fcfdd463 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://rustwasm.github.io/wasm-bindgen/" documentation = "https://docs.rs/wasm-bindgen-wasm-conventions" description = "Utilities for working with Wasm codegen conventions (usually established by LLVM/lld)" edition = "2018" -rust-version = "1.57" +rust-version = "1.76" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 33c0c20eea9..c27c8b4cc8c 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -10,7 +10,7 @@ description = """ Micro-interpreter optimized for wasm-bindgen's use case """ edition = '2018' -rust-version = "1.57" +rust-version = "1.76" [dependencies] anyhow = "1.0" From 2efd450b2f54795b6a31e6bf8c56743d19204455 Mon Sep 17 00:00:00 2001 From: Hector G Candelaria Date: Sat, 3 Aug 2024 05:54:07 -0400 Subject: [PATCH 448/641] Add bindings to `NavigatorOptions.vibrate` (#4041) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_Navigator.rs | 2 +- .../src/features/gen_NotificationOptions.rs | 15 +++++++++++++++ crates/web-sys/webidls/enabled/Navigator.webidl | 8 -------- .../web-sys/webidls/enabled/Notification.webidl | 1 + crates/web-sys/webidls/enabled/Vibration.webidl | 7 +++++++ crates/webidl/src/constants.rs | 7 +++++++ 7 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 crates/web-sys/webidls/enabled/Vibration.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f5373f6df8..fb7bf7024e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,9 @@ * Added an official MSRV policy. Library MSRV changes will be accompanied by a minor version bump. CLI tool MSRV can change with any version bump. [#4038](https://github.com/rustwasm/wasm-bindgen/pull/4038) +* Added bindings to `NavigatorOptions.vibrate`. + [#4041](https://github.com/rustwasm/wasm-bindgen/pull/4041) + ### Changed * Stabilize Web Share API. diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index c084077cff4..bef2bb5427d 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -533,7 +533,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn vibrate_with_duration(this: &Navigator, duration: u32) -> bool; + pub fn vibrate_with_duration(this: &Navigator, pattern: u32) -> bool; # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = vibrate)] #[doc = "The `vibrate()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_NotificationOptions.rs b/crates/web-sys/src/features/gen_NotificationOptions.rs index c8e8bc9ccba..d3ec99545d0 100644 --- a/crates/web-sys/src/features/gen_NotificationOptions.rs +++ b/crates/web-sys/src/features/gen_NotificationOptions.rs @@ -142,6 +142,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, setter = "timestamp")] pub fn set_timestamp(this: &NotificationOptions, val: f64); + #[doc = "Get the `vibrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, getter = "vibrate")] + pub fn get_vibrate(this: &NotificationOptions) -> ::wasm_bindgen::JsValue; + #[doc = "Change the `vibrate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] + #[wasm_bindgen(method, setter = "vibrate")] + pub fn set_vibrate(this: &NotificationOptions, val: &::wasm_bindgen::JsValue); } impl NotificationOptions { #[doc = "Construct a new `NotificationOptions`."] @@ -218,6 +228,11 @@ impl NotificationOptions { self.set_timestamp(val); self } + #[deprecated = "Use `set_vibrate()` instead."] + pub fn vibrate(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_vibrate(val); + self + } } impl Default for NotificationOptions { fn default() -> Self { diff --git a/crates/web-sys/webidls/enabled/Navigator.webidl b/crates/web-sys/webidls/enabled/Navigator.webidl index e06c383b848..0d116932b01 100644 --- a/crates/web-sys/webidls/enabled/Navigator.webidl +++ b/crates/web-sys/webidls/enabled/Navigator.webidl @@ -134,14 +134,6 @@ partial interface Navigator { Promise getBattery(); }; -// http://www.w3.org/TR/vibration/#vibration-interface -partial interface Navigator { - // We don't support sequences in unions yet - //boolean vibrate ((unsigned long or sequence) pattern); - boolean vibrate(unsigned long duration); - boolean vibrate(sequence pattern); -}; - // http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface partial interface Navigator { [Pref="dom.w3c_pointer_events.enabled"] diff --git a/crates/web-sys/webidls/enabled/Notification.webidl b/crates/web-sys/webidls/enabled/Notification.webidl index 3114b8cd909..8027fcbeaed 100644 --- a/crates/web-sys/webidls/enabled/Notification.webidl +++ b/crates/web-sys/webidls/enabled/Notification.webidl @@ -41,6 +41,7 @@ dictionary NotificationOptions { USVString image; USVString icon; USVString badge; + VibratePattern vibrate = []; unsigned long long timestamp; boolean renotify = false; boolean? silent = null; diff --git a/crates/web-sys/webidls/enabled/Vibration.webidl b/crates/web-sys/webidls/enabled/Vibration.webidl new file mode 100644 index 00000000000..23f15e073df --- /dev/null +++ b/crates/web-sys/webidls/enabled/Vibration.webidl @@ -0,0 +1,7 @@ +// https://www.w3.org/TR/vibration/#vibration-interface + +typedef (unsigned long or sequence) VibratePattern; + +partial interface Navigator { + boolean vibrate(VibratePattern pattern); +}; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 4744e47fd5a..779e0d40f96 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -230,6 +230,13 @@ pub(crate) static FIXED_INTERFACES: Lazy< ), ]), ), + ( + "Navigator", + BTreeMap::from_iter([ + ("vibrate_with_u32", "vibrate_with_duration"), + ("vibrate_with_u32_sequence", "vibrate_with_pattern"), + ]), + ), ]) }); From 2467e799c72bd4c9f03f5c83112b0a3e0ebafcd9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 12:51:49 +0200 Subject: [PATCH 449/641] Update dev-dependencies (#4040) --- crates/cli/Cargo.toml | 4 +- crates/example-tests/Cargo.toml | 15 +++---- crates/example-tests/src/lib.rs | 54 +++++++++++++++++--------- crates/externref-xform/Cargo.toml | 2 +- crates/externref-xform/tests/all.rs | 8 ++-- crates/multi-value-xform/Cargo.toml | 2 +- crates/multi-value-xform/tests/all.rs | 2 +- crates/webidl/Cargo.toml | 4 +- crates/webidl/src/lib.rs | 2 +- crates/webidl/src/util.rs | 4 +- examples/raytrace-parallel/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 4 +- examples/wasm-audio-worklet/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 6 +-- 14 files changed, 64 insertions(+), 47 deletions(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index c0ea98c0190..98f8e795a73 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -38,9 +38,9 @@ wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.92" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } [dev-dependencies] -assert_cmd = "1.0" +assert_cmd = "2" diff = "0.1" -predicates = "1.0.0" +predicates = "3" rayon = "1.0" tempfile = "3.0" wasmparser = "0.212" diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index c394b9dbe60..5d0631a19a8 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -7,13 +7,14 @@ edition = "2018" [dependencies] anyhow = "1.0.75" futures-util = { version = "0.3.28", features = ["sink"] } -http = "0.2.9" -hyper = { version = "0.14.27", features = ["server", "tcp", "http1"] } -mozprofile = "0.8.0" -mozrunner = "0.14.0" +http = "1" +hyper = "1" +hyper-util = { version = "0.1.6", features = ["http1", "service", "server", "tokio"] } +mozprofile = "0.9" +mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -tokio = { version = "1.29.1", features = ["macros", "time"] } -tokio-tungstenite = "0.17.2" +tokio = { version = "1.29.1", features = ["macros", "net", "time"] } +tokio-tungstenite = "0.23" tower = { version = "0.4.13", features = ["make"] } -tower-http = { version = "0.3.5", features = ["fs", "util", "set-header"] } +tower-http = { version = "0.5", features = ["fs", "util", "set-header"] } diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index b064858c0db..0486e8fd19e 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -9,6 +9,9 @@ use std::{env, str}; use anyhow::{bail, Context}; use futures_util::{future, SinkExt, StreamExt}; use http::{HeaderName, HeaderValue}; +use hyper_util::rt::{TokioExecutor, TokioIo}; +use hyper_util::server::conn::auto::Builder; +use hyper_util::service::TowerToHyperService; use mozprofile::profile::Profile; use mozrunner::firefox_default_path; use mozrunner::runner::{FirefoxProcess, FirefoxRunner, Runner, RunnerProcess}; @@ -20,7 +23,6 @@ use tokio::sync::oneshot; use tokio::time::timeout; use tokio_tungstenite::tungstenite::{self, Message}; use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; -use tower::make::Shared; use tower::ServiceBuilder; use tower_http::services::ServeDir; use tower_http::ServiceBuilderExt; @@ -146,7 +148,7 @@ impl WebDriver { // For the moment, we're only supporting Firefox here. let mut builder = FirefoxRunner::new( &firefox_default_path().context("failed to find Firefox installation")?, - Some(Profile::new()?), + Some(Profile::new(None)?), ); builder .arg("--remote-debugging-port") @@ -326,27 +328,41 @@ pub async fn test_example( let mut driver = WebDriver::new().await?; // Serve the path. - let service = ServiceBuilder::new() - .override_response_header( - HeaderName::from_static("cross-origin-opener-policy"), - HeaderValue::from_static("same-origin"), - ) - .override_response_header( - HeaderName::from_static("cross-origin-embedder-policy"), - HeaderValue::from_static("require-corp"), - ) - .service(ServeDir::new(path)); - let server = - hyper::Server::try_bind(&"127.0.0.1:0".parse().unwrap())?.serve(Shared::new(service)); - - let addr = server.local_addr(); + let service = TowerToHyperService::new( + ServiceBuilder::new() + .override_response_header( + HeaderName::from_static("cross-origin-opener-policy"), + HeaderValue::from_static("same-origin"), + ) + .override_response_header( + HeaderName::from_static("cross-origin-embedder-policy"), + HeaderValue::from_static("require-corp"), + ) + .service(ServeDir::new(path)), + ); + + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await?; + let addr = listener.local_addr()?; + let builder = Builder::new(TokioExecutor::new()).http1_only(); let (tx, rx) = oneshot::channel(); let (server_result, result) = future::join( - server.with_graceful_shutdown(async move { - let _ = rx.await; - }), + async move { + let (stream, _) = listener.accept().await?; + + let conn = builder.serve_connection(TokioIo::new(stream), &service); + tokio::pin!(conn); + + tokio::select! { + res = conn.as_mut() => { + res.map_err(|e| anyhow::Error::msg(e.to_string())) + } + _ = rx => { + Ok(()) + } + } + }, async { #[derive(Deserialize)] struct BrowsingContextCreateResult { diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 3e1986c29f1..03eb3df138c 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -20,7 +20,7 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2. [dev-dependencies] rayon = "1.0" wasmprinter = "0.212" -wast = "21.0" +wast = "212" wat = "1.0" [[test]] diff --git a/crates/externref-xform/tests/all.rs b/crates/externref-xform/tests/all.rs index ce36dd2b0f5..063c6ec6c18 100644 --- a/crates/externref-xform/tests/all.rs +++ b/crates/externref-xform/tests/all.rs @@ -220,10 +220,10 @@ impl<'a> Parse<'a> for Directive { wast::custom_keyword!(externref_borrowed); wast::custom_keyword!(other); - let kind = if parser.peek::() { + let kind = if parser.peek::()? { parser.parse::()?; DirectiveKind::Import(parser.parse()?, parser.parse()?) - } else if parser.peek::() { + } else if parser.peek::()? { parser.parse::()?; DirectiveKind::Export(parser.parse()?) } else { @@ -234,10 +234,10 @@ impl<'a> Parse<'a> for Directive { parser.parens(|p| { let mut i = 0; while !p.is_empty() { - if parser.peek::() { + if parser.peek::()? { parser.parse::()?; args.push((i, true)); - } else if parser.peek::() { + } else if parser.peek::()? { parser.parse::()?; args.push((i, false)); } else { diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 6bbec0c8b81..eb0b7233381 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -20,7 +20,7 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2. [dev-dependencies] rayon = "1.0" wasmprinter = "0.212" -wast = "21.0" +wast = "212" wat = "1.0" [[test]] diff --git a/crates/multi-value-xform/tests/all.rs b/crates/multi-value-xform/tests/all.rs index 1e14b623625..8b3638c2497 100644 --- a/crates/multi-value-xform/tests/all.rs +++ b/crates/multi-value-xform/tests/all.rs @@ -203,7 +203,7 @@ fn update_output(path: &Path, output: &str) -> Result<()> { impl<'a> Parse<'a> for Directive { fn parse(parser: Parser<'a>) -> wast::parser::Result { - use wast::{kw, ValType}; + use wast::{core::ValType, kw}; parser.parse::()?; let name = parser.parse()?; diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index a151dfbec8f..4f122546a36 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" [dependencies] env_logger = "0.11.5" anyhow = "1.0" -heck = "0.3" +heck = "0.5" log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' @@ -23,6 +23,6 @@ syn = { version = '2.0', features = ['extra-traits', 'full'] } wasm-bindgen-backend = { version = "=0.2.92", path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" -sourcefile = "0.1" +sourcefile = "0.2" structopt = "0.3.9" lazy_static = "1.4.0" diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index acbbe523e74..238a0a0cc31 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -938,7 +938,7 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { if path.extension() != Some(OsStr::new("webidl")) { continue; } - source = source + source .add_file(&path) .with_context(|| format!("reading contents of file \"{}\"", path.display()))?; } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 370a0231ac4..6f40f64e6d1 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -4,7 +4,7 @@ use std::iter::FromIterator; use std::path::{Path, PathBuf}; use std::ptr; -use heck::{CamelCase, ShoutySnakeCase, SnakeCase}; +use heck::{ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase}; use proc_macro2::{Ident, TokenStream}; use quote::quote; use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; @@ -71,7 +71,7 @@ fn fix_ident(identifier: &str) -> String { /// Convert an identifier to camel case pub fn camel_case_ident(identifier: &str) -> String { - fix_ident(identifier).to_camel_case() + fix_ident(identifier).to_upper_camel_case() } /// Convert an identifier to shouty snake case diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index a568710146d..27b82dca395 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -13,7 +13,7 @@ js-sys = "0.3.69" rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } -serde-wasm-bindgen = "0.4.3" +serde-wasm-bindgen = "0.6" futures-channel-preview = "0.3.0-alpha.18" wasm-bindgen = "0.2.92" wasm-bindgen-futures = "0.4.42" diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index d0109503eea..61a10cf2a82 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -8,12 +8,12 @@ edition = "2018" crate-type = ["cdylib"] [build-dependencies] -askama = "0.10.0" +askama = "0.12" [dependencies] js-sys = "0.3.69" wasm-bindgen = "0.2.92" -askama = "0.10.0" +askama = "0.12" console_error_panic_hook = "0.1.5" [dependencies.web-sys] diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index b4c7d430735..e9cd0c549ee 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -console_log = "0.2.0" +console_log = "1" js-sys = "0.3.69" wasm-bindgen = "0.2.92" wasm-bindgen-futures = "0.4.42" diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 8f28c0e74d5..a8ef5defd27 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -12,11 +12,11 @@ crate-type = ["cdylib"] [dependencies] chrono = "0.4.11" -reqwest = "0.10.6" +reqwest = "0.12" wasm-bindgen-futures = "0.4.1" -json= "*" +json= "0.12" wasm-bindgen = "0.2.92" -gloo = "0.2.1" +gloo = "0.11" [dependencies.web-sys] version = "0.3.40" From 739ade118e904fefe84a82227a7bc2752f8f7b0f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 3 Aug 2024 21:32:15 +0200 Subject: [PATCH 450/641] Update all crates to edition 2021 (#4045) --- Cargo.toml | 2 +- benchmarks/Cargo.toml | 2 +- crates/backend/Cargo.toml | 2 +- crates/cli-support/Cargo.toml | 2 +- crates/cli/Cargo.toml | 2 +- crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs | 5 ++++- crates/cli/tests/reference.rs | 2 +- crates/cli/tests/wasm-bindgen/main.rs | 6 +++--- crates/cli/tests/wasm-bindgen/npm.rs | 4 ++-- crates/example-tests/Cargo.toml | 2 +- crates/externref-xform/Cargo.toml | 2 +- crates/futures/Cargo.toml | 2 +- crates/js-sys/Cargo.toml | 2 +- crates/macro-support/Cargo.toml | 2 +- crates/macro/Cargo.toml | 2 +- crates/msrv/cli/Cargo.toml | 2 +- crates/msrv/lib/Cargo.toml | 2 +- crates/multi-value-xform/Cargo.toml | 2 +- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 2 +- crates/test/sample/Cargo.toml | 2 +- crates/threads-xform/Cargo.toml | 2 +- crates/typescript-tests/Cargo.toml | 2 +- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- crates/web-sys/Cargo.toml | 2 +- crates/webidl-tests/Cargo.toml | 2 +- crates/webidl/Cargo.toml | 2 +- crates/webidl/src/lib.rs | 2 +- examples/add/Cargo.toml | 2 +- examples/canvas/Cargo.toml | 2 +- examples/char/Cargo.toml | 2 +- examples/closures/Cargo.toml | 2 +- examples/console_log/Cargo.toml | 2 +- examples/deno/Cargo.toml | 2 +- examples/dom/Cargo.toml | 2 +- examples/duck-typed-interfaces/Cargo.toml | 2 +- examples/fetch/Cargo.toml | 2 +- examples/guide-supported-types-examples/Cargo.toml | 2 +- examples/hello_world/Cargo.toml | 2 +- examples/import_js/crate/Cargo.toml | 2 +- examples/julia_set/Cargo.toml | 2 +- examples/paint/Cargo.toml | 2 +- examples/performance/Cargo.toml | 2 +- examples/raytrace-parallel/Cargo.toml | 2 +- examples/request-animation-frame/Cargo.toml | 2 +- examples/synchronous-instantiation/Cargo.toml | 2 +- examples/todomvc/Cargo.toml | 2 +- examples/wasm-in-wasm-imports/Cargo.toml | 2 +- examples/wasm-in-wasm/Cargo.toml | 2 +- examples/wasm-in-web-worker/Cargo.toml | 2 +- examples/wasm2js/Cargo.toml | 2 +- examples/weather_report/Cargo.toml | 2 +- examples/webaudio/Cargo.toml | 2 +- examples/webgl/Cargo.toml | 2 +- examples/webrtc_datachannel/Cargo.toml | 2 +- examples/websockets/Cargo.toml | 2 +- examples/webxr/Cargo.toml | 2 +- examples/without-a-bundler-no-modules/Cargo.toml | 2 +- examples/without-a-bundler/Cargo.toml | 2 +- tests/wasm/closures.rs | 2 +- 62 files changed, 68 insertions(+), 65 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2c005e69adc..f82afda4f8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ documentation = "https://docs.rs/wasm-bindgen" description = """ Easy support for interacting between JS and Rust. """ -edition = "2018" +edition = "2021" rust-version = "1.57" [package.metadata.docs.rs] diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 373e793eef8..e6bbec6371b 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-bindgen-benchmark" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [dependencies] wasm-bindgen = { path = '../' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 3e8a4e5f563..c91a3b2dbf0 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-backend" description = """ Backend code generation of the wasm-bindgen tool """ -edition = "2018" +edition = "2021" rust-version = "1.57" [features] diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 57e4f7e156f..453f7613ccb 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-cli-support" description = """ Shared support for the wasm-bindgen-cli package, an internal dependency """ -edition = '2018' +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 98f8e795a73..7d098ea16e8 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -11,7 +11,7 @@ description = """ Command line interface of the `#[wasm_bindgen]` attribute and project. For more information see https://github.com/rustwasm/wasm-bindgen. """ -edition = '2018' +edition = "2021" default-run = 'wasm-bindgen' rust-version = "1.76" diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index a4886800260..38a94d4b87d 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -71,7 +71,10 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error let mut cmd = Command::new(path); cmd.args(args).arg(format!("--port={}", driver_addr.port())); let mut child = BackgroundChild::spawn(path, &mut cmd, shell)?; - drop_log = Box::new(move || child.print_stdio_on_drop = false); + drop_log = Box::new(move || { + let _ = &child; + child.print_stdio_on_drop = false; + }); // Wait for the driver to come online and bind its port before we try to // connect to it. diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index 272c711f083..a8a39132310 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -62,7 +62,7 @@ fn runtest(test: &Path) -> Result<()> { name = \"reference-test\" authors = [] version = \"1.0.0\" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 3a78cfa860e..10425018ce7 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -79,7 +79,7 @@ impl Project { name = \"{}\" authors = [] version = \"1.0.0\" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} @@ -207,7 +207,7 @@ fn bin_crate_works() { name = \"bin_crate_works\" authors = [] version = \"1.0.0\" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} @@ -254,7 +254,7 @@ fn bin_crate_works_without_name_section() { name = \"bin_crate_works_without_name_section\" authors = [] version = \"1.0.0\" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} diff --git a/crates/cli/tests/wasm-bindgen/npm.rs b/crates/cli/tests/wasm-bindgen/npm.rs index 9f35723ac70..a1e76cd2dca 100644 --- a/crates/cli/tests/wasm-bindgen/npm.rs +++ b/crates/cli/tests/wasm-bindgen/npm.rs @@ -77,7 +77,7 @@ fn npm_conflict_rejected() { name = "npm_conflict_rejected" authors = [] version = "1.0.0" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} @@ -124,7 +124,7 @@ fn npm_conflict_rejected() { name = "bar" authors = [] version = "1.0.0" - edition = '2018' + edition = '2021' [dependencies] wasm-bindgen = {{ path = '{}' }} diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 5d0631a19a8..e6416823cf8 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "example-tests" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [dependencies] anyhow = "1.0.75" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 03eb3df138c..51ade2e74fb 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-externref-xform" description = """ Internal externref transformations for wasm-bindgen """ -edition = '2018' +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 90efc86e72e..1bf222df2e6 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -8,7 +8,7 @@ name = "wasm-bindgen-futures" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" version = "0.4.42" -edition = "2018" +edition = "2021" rust-version = "1.57" [package.metadata.docs.rs] diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 5bb63a5ac4d..eb0d196be90 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -12,7 +12,7 @@ Bindings for all JS global objects and functions in all JS environments like Node.js and browsers, built on `#[wasm_bindgen]` using the `wasm-bindgen` crate. """ license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" rust-version = "1.57" [lib] diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index e809478d699..b63c2d17cd9 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen" description = """ The part of the implementation of the `#[wasm_bindgen]` attribute that is not in the shared backend crate """ -edition = '2018' +edition = "2021" rust-version = "1.57" [features] diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 5aead30add2..f70a5343f5a 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen" description = """ Definition of the `#[wasm_bindgen]` attribute, an internal dependency """ -edition = "2018" +edition = "2021" rust-version = "1.57" [lib] diff --git a/crates/msrv/cli/Cargo.toml b/crates/msrv/cli/Cargo.toml index 407449459a7..d283451c04a 100644 --- a/crates/msrv/cli/Cargo.toml +++ b/crates/msrv/cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "msrv-cli-test" version = "0.0.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index 6af2d333a1f..2fe30ddec40 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "msrv-library-test" version = "0.0.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index eb0b7233381..79c7d3d63e5 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-multi-value-xform" description = """ Internal multi-value transformations for wasm-bindgen """ -edition = "2018" +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index ae438cf53a9..c73b1f22922 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -10,7 +10,7 @@ description = """ Shared support between wasm-bindgen and wasm-bindgen cli, an internal dependency. """ -edition = "2018" +edition = "2021" rust-version = "1.57" # Because only a single `wasm_bindgen` version can be used in a dependency diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 99c62981876..d7ba0985bdc 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -5,7 +5,7 @@ authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen" -edition = "2018" +edition = "2021" rust-version = "1.57" [lib] diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 001e6814ea0..24abcae88e9 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -5,7 +5,7 @@ authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen" -edition = "2018" +edition = "2021" rust-version = "1.57" [dependencies] diff --git a/crates/test/sample/Cargo.toml b/crates/test/sample/Cargo.toml index 05544ab4a3d..f30f1b98351 100644 --- a/crates/test/sample/Cargo.toml +++ b/crates/test/sample/Cargo.toml @@ -2,7 +2,7 @@ name = "sample" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 172c7a0c202..fb81014dccb 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-threads-xform" description = """ Support for threading-related transformations in wasm-bindgen """ -edition = "2018" +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/typescript-tests/Cargo.toml b/crates/typescript-tests/Cargo.toml index 6ce332a887d..f171cdb09a1 100644 --- a/crates/typescript-tests/Cargo.toml +++ b/crates/typescript-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "typescript-tests" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [dependencies] wasm-bindgen = { path = '../..' } diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 9c1fcfdd463..e66f37fdee0 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-c homepage = "https://rustwasm.github.io/wasm-bindgen/" documentation = "https://docs.rs/wasm-bindgen-wasm-conventions" description = "Utilities for working with Wasm codegen conventions (usually established by LLVM/lld)" -edition = "2018" +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index c27c8b4cc8c..795c2547587 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-wasm-interpreter" description = """ Micro-interpreter optimized for wasm-bindgen's use case """ -edition = '2018' +edition = "2021" rust-version = "1.76" [dependencies] diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 71c498216f5..9a4affada4a 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -10,7 +10,7 @@ description = """ Bindings for all Web APIs, a procedurally generated crate from WebIDL """ license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" rust-version = "1.57" [package.metadata.docs.rs] diff --git a/crates/webidl-tests/Cargo.toml b/crates/webidl-tests/Cargo.toml index c16223adc97..cc9c7fea415 100644 --- a/crates/webidl-tests/Cargo.toml +++ b/crates/webidl-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "webidl-tests" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" publish = false [lib] diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 4f122546a36..2c1147f4d98 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://docs.rs/wasm-bindgen" description = """ Support for parsing WebIDL specific to wasm-bindgen """ -edition = "2018" +edition = "2021" [dependencies] env_logger = "0.11.5" diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 238a0a0cc31..372fe4b0851 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -950,7 +950,7 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { // run rustfmt on the generated file - really handy for debugging let result = Command::new("rustfmt") .arg("--edition") - .arg("2018") + .arg("2021") .args(paths) .status() .context("rustfmt failed")?; diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index ae70f80a3f3..95e5d4cd402 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -2,7 +2,7 @@ name = "add" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 8ec3f019095..565b403c78e 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -2,7 +2,7 @@ name = "canvas" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index bf54d80c78b..1cc1db2df3a 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -2,7 +2,7 @@ name = "char" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index c049f8fd40c..f4e5c2d1cf9 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -2,7 +2,7 @@ name = "closures" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 24d45648fa4..7052ae96e56 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -2,7 +2,7 @@ name = "console_log" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index b9200c8e2b9..7e7064dde55 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -2,7 +2,7 @@ name = "deno" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index d9192ba9ede..d44cef608fc 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -2,7 +2,7 @@ name = "dom" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index 859424183f0..10f4019615d 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -2,7 +2,7 @@ name = "rust-duck-typed-interfaces" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index ca06756d4ec..fd681949483 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -2,7 +2,7 @@ name = "fetch" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 718fa6071a1..23a34ebf138 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -2,7 +2,7 @@ name = "guide-supported-types-examples" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 82141390286..d7f62f91cef 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -2,7 +2,7 @@ name = "hello_world" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index eec97f08e6b..04a9c9582d0 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -2,7 +2,7 @@ name = "import_js" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index d909de5c05d..5afa67c7a10 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -2,7 +2,7 @@ name = "julia_set" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index de74bcbd787..cee71e8a070 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-bindgen-paint" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index 8d4357705de..c33c4e99170 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -2,7 +2,7 @@ name = "performance" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 27b82dca395..dd6ba4562ab 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -2,7 +2,7 @@ name = "raytrace-parallel" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index c3c7cb69baa..4316e4a2988 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -2,7 +2,7 @@ name = "request-animation-frame" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 38821a43db6..21d2a9df943 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -2,7 +2,7 @@ name = "synchronous-instantiation" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index 61a10cf2a82..c49a6b02fea 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -2,7 +2,7 @@ name = "todomvc" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 531d66dc1c3..0d1a7738e50 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-in-wasm-imports" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index bc27b3b9279..0c0f4b3a93d 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-in-wasm" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 0af50a7037a..288f7a4f99c 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-in-web-worker" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index c562b740cbf..e16282ed71e 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm2js" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index a8ef5defd27..3017924adbc 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.1" authors = ["Ayush "] categories = ["wasm"] readme = "README.md" -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 75a3e4626a5..f694108b4e5 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -2,7 +2,7 @@ name = "webaudio" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index ada463ffefb..e4ae1ff5464 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -2,7 +2,7 @@ name = "webgl" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index b0353ee8adc..839aa3d5b18 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -2,7 +2,7 @@ name = "webrtc_datachannel" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 41ef57c17ed..c7073c1b772 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -2,7 +2,7 @@ name = "websockets" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 3db27855c88..4345ad48748 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -2,7 +2,7 @@ name = "webxr" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/without-a-bundler-no-modules/Cargo.toml b/examples/without-a-bundler-no-modules/Cargo.toml index 9c0bf1cbe70..293c74067cb 100644 --- a/examples/without-a-bundler-no-modules/Cargo.toml +++ b/examples/without-a-bundler-no-modules/Cargo.toml @@ -2,7 +2,7 @@ name = "without-a-bundler-no-modules" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 9d71debcb19..12abaa68b76 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -2,7 +2,7 @@ name = "without-a-bundler" version = "0.1.0" authors = ["The wasm-bindgen Developers"] -edition = "2018" +edition = "2021" [lib] crate-type = ["cdylib"] diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index c36b5720559..4cf7b21e737 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -433,7 +433,7 @@ fn drop_drops() { } let a = A; let x: Closure = Closure::new(move || { - let _ = a; + let _ = &a; }); drop(x); unsafe { From 4596d4a633900a3f474c715aa51937ed0282e205 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 4 Aug 2024 01:53:24 +0200 Subject: [PATCH 451/641] Add `package.include` to all crates (#4046) This significantly reduces package size and notably excludes any bash files from landing on a user device. Adds `package.publish = false` to any crate not being published. Removes unnecessary version specifiers in e.g. dev-dependencies, reducing churn during a new version release. --- CHANGELOG.md | 3 +++ Cargo.toml | 11 ++++++----- benchmarks/Cargo.toml | 3 ++- crates/backend/Cargo.toml | 1 + crates/cli-support/Cargo.toml | 1 + crates/cli/Cargo.toml | 1 + crates/example-tests/Cargo.toml | 3 ++- crates/externref-xform/Cargo.toml | 1 + crates/futures/Cargo.toml | 3 ++- crates/js-sys/Cargo.toml | 7 ++++--- crates/macro-support/Cargo.toml | 1 + crates/macro/Cargo.toml | 7 ++++--- crates/multi-value-xform/Cargo.toml | 1 + crates/shared/Cargo.toml | 1 + crates/test-macro/Cargo.toml | 1 + crates/test/Cargo.toml | 1 + crates/test/sample/Cargo.toml | 3 ++- crates/threads-xform/Cargo.toml | 1 + crates/typescript-tests/Cargo.toml | 3 ++- crates/wasm-conventions/Cargo.toml | 1 + crates/wasm-interpreter/Cargo.toml | 1 + crates/web-sys/Cargo.toml | 5 +++-- crates/webidl-tests/Cargo.toml | 2 +- crates/webidl/Cargo.toml | 13 +++---------- examples/add/Cargo.toml | 5 +++-- examples/canvas/Cargo.toml | 9 +++++---- examples/char/Cargo.toml | 5 +++-- examples/closures/Cargo.toml | 9 +++++---- examples/console_log/Cargo.toml | 7 ++++--- examples/deno/Cargo.toml | 5 +++-- examples/dom/Cargo.toml | 7 ++++--- examples/duck-typed-interfaces/Cargo.toml | 5 +++-- examples/fetch/Cargo.toml | 11 ++++++----- examples/guide-supported-types-examples/Cargo.toml | 7 ++++--- examples/hello_world/Cargo.toml | 5 +++-- examples/import_js/crate/Cargo.toml | 5 +++-- examples/julia_set/Cargo.toml | 7 ++++--- examples/paint/Cargo.toml | 9 +++++---- examples/performance/Cargo.toml | 7 ++++--- examples/raytrace-parallel/Cargo.toml | 11 ++++++----- examples/request-animation-frame/Cargo.toml | 7 ++++--- examples/synchronous-instantiation/Cargo.toml | 5 +++-- examples/todomvc/Cargo.toml | 9 +++++---- examples/wasm-audio-worklet/Cargo.toml | 12 +++++++----- examples/wasm-in-wasm-imports/Cargo.toml | 9 +++++---- examples/wasm-in-wasm/Cargo.toml | 9 +++++---- examples/wasm-in-web-worker/Cargo.toml | 7 ++++--- examples/wasm2js/Cargo.toml | 5 +++-- examples/weather_report/Cargo.toml | 12 +++++------- examples/webaudio/Cargo.toml | 7 ++++--- examples/webgl/Cargo.toml | 9 +++++---- examples/webrtc_datachannel/Cargo.toml | 11 ++++++----- examples/websockets/Cargo.toml | 9 +++++---- examples/webxr/Cargo.toml | 11 ++++++----- examples/without-a-bundler-no-modules/Cargo.toml | 7 ++++--- examples/without-a-bundler/Cargo.toml | 7 ++++--- tests/crates/a/Cargo.toml | 8 ++++---- tests/crates/b/Cargo.toml | 8 ++++---- tests/no-std/Cargo.toml | 7 +++---- tests/no-std/lib.rs | 0 tests/no-std/{test.rs => src/lib.rs} | 0 61 files changed, 197 insertions(+), 151 deletions(-) delete mode 100644 tests/no-std/lib.rs rename tests/no-std/{test.rs => src/lib.rs} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7bf7024e3..52e92864783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,9 @@ * MSRV of CLI tools bumped to v1.76. This does not affect libraries like `wasm-bindgen`, `js-sys` and `web-sys`! [#4037](https://github.com/rustwasm/wasm-bindgen/pull/4037) +* Filtered files in published crates, significantly reducing the package size and notably excluding any bash files. + [#4046](https://github.com/rustwasm/wasm-bindgen/pull/4046) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/Cargo.toml b/Cargo.toml index f82afda4f8b..663ae407b7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ Easy support for interacting between JS and Rust. """ edition = "2021" rust-version = "1.57" +include = ["/build.rs", "/LICENSE-*", "/src"] [package.metadata.docs.rs] features = ["serde-serialize"] @@ -48,12 +49,12 @@ serde_json = { version = "1.0", optional = true } cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -js-sys = { path = 'crates/js-sys', version = '0.3.69' } -wasm-bindgen-test = { path = 'crates/test', version = '=0.3.42' } -wasm-bindgen-futures = { path = 'crates/futures', version = '=0.4.42' } +js-sys = { path = 'crates/js-sys' } +wasm-bindgen-test = { path = 'crates/test' } +wasm-bindgen-futures = { path = 'crates/futures' } serde_derive = "1.0" -wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' } -wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' } +wasm-bindgen-test-crate-a = { path = 'tests/crates/a' } +wasm-bindgen-test-crate-b = { path = 'tests/crates/b' } [workspace] members = [ diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index e6bbec6371b..5b14b808884 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "wasm-bindgen-benchmark" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [dependencies] wasm-bindgen = { path = '../' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index c91a3b2dbf0..6852a5be5a9 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,6 +11,7 @@ Backend code generation of the wasm-bindgen tool """ edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [features] spans = [] diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 453f7613ccb..eba33234327 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,6 +11,7 @@ Shared support for the wasm-bindgen-cli package, an internal dependency """ edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] anyhow = "1.0" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 7d098ea16e8..8bcb97fe0e6 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,6 +14,7 @@ information see https://github.com/rustwasm/wasm-bindgen. edition = "2021" default-run = 'wasm-bindgen' rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [package.metadata.binstall] pkg-url = "https://github.com/rustwasm/wasm-bindgen/releases/download/{ version }/wasm-bindgen-{ version }-{ target }{ archive-suffix }" diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index e6416823cf8..6f12da85a38 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "example-tests" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [dependencies] anyhow = "1.0.75" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 51ade2e74fb..8a5644dc693 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,6 +11,7 @@ Internal externref transformations for wasm-bindgen """ edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] anyhow = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 1bf222df2e6..257c7fd2b4d 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,6 +10,7 @@ readme = "./README.md" version = "0.4.42" edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [package.metadata.docs.rs] all-features = true @@ -33,6 +34,6 @@ features = [ ] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.42' } +wasm-bindgen-test = { path = '../test' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index eb0d196be90..18f969e2e7c 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,6 +14,7 @@ Node.js and browsers, built on `#[wasm_bindgen]` using the `wasm-bindgen` crate. license = "MIT OR Apache-2.0" edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [lib] test = false @@ -23,9 +24,9 @@ doctest = false wasm-bindgen = { path = "../..", version = "0.2.92" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '=0.3.42' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } -web-sys = { path = "../web-sys", version = "0.3.69", features = ["Headers", "Response", "ResponseInit"] } +wasm-bindgen-test = { path = '../test' } +wasm-bindgen-futures = { path = '../futures' } +web-sys = { path = "../web-sys", features = ["Headers", "Response", "ResponseInit"] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(js_sys_unstable_apis)'] } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index b63c2d17cd9..fd8c02b2783 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,6 +11,7 @@ The part of the implementation of the `#[wasm_bindgen]` attribute that is not in """ edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [features] spans = ["wasm-bindgen-backend/spans"] diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index f70a5343f5a..cd04f2a6074 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,6 +11,7 @@ Definition of the `#[wasm_bindgen]` attribute, an internal dependency """ edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [lib] proc-macro = true @@ -26,6 +27,6 @@ quote = "1.0" [dev-dependencies] trybuild = "1.0" -wasm-bindgen = { path = "../..", version = "0.2.92" } -wasm-bindgen-futures = { path = "../futures", version = "0.4.42" } -web-sys = { path = "../web-sys", version = "0.3.69", features = ["Worker"] } +wasm-bindgen = { path = "../.." } +wasm-bindgen-futures = { path = "../futures" } +web-sys = { path = "../web-sys", features = ["Worker"] } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 79c7d3d63e5..197ae423f77 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,6 +11,7 @@ Internal multi-value transformations for wasm-bindgen """ edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] anyhow = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index c73b1f22922..aa853bae08f 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,6 +12,7 @@ dependency. """ edition = "2021" rust-version = "1.57" +include = ["/build.rs", "/LICENSE-*", "/src"] # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index d7ba0985bdc..61b7c19a0bd 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen" edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 24abcae88e9..4a8dfdf21c3 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rustwasm/wasm-bindgen" edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [dependencies] console_error_panic_hook = '0.1' diff --git a/crates/test/sample/Cargo.toml b/crates/test/sample/Cargo.toml index f30f1b98351..7b0cb8107b5 100644 --- a/crates/test/sample/Cargo.toml +++ b/crates/test/sample/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "sample" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index fb81014dccb..7672c15b2fc 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,6 +11,7 @@ Support for threading-related transformations in wasm-bindgen """ edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] anyhow = "1.0" diff --git a/crates/typescript-tests/Cargo.toml b/crates/typescript-tests/Cargo.toml index f171cdb09a1..2cd71930ba4 100644 --- a/crates/typescript-tests/Cargo.toml +++ b/crates/typescript-tests/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "typescript-tests" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [dependencies] wasm-bindgen = { path = '../..' } diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index e66f37fdee0..fe3fd4421c4 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,6 +9,7 @@ documentation = "https://docs.rs/wasm-bindgen-wasm-conventions" description = "Utilities for working with Wasm codegen conventions (usually established by LLVM/lld)" edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 795c2547587..00ecd4f44f4 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,6 +11,7 @@ Micro-interpreter optimized for wasm-bindgen's use case """ edition = "2021" rust-version = "1.76" +include = ["/LICENSE-*", "/src"] [dependencies] anyhow = "1.0" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 9a4affada4a..3572c835e17 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,6 +12,7 @@ Bindings for all Web APIs, a procedurally generated crate from WebIDL license = "MIT OR Apache-2.0" edition = "2021" rust-version = "1.57" +include = ["/LICENSE-*", "/src"] [package.metadata.docs.rs] all-features = true @@ -26,8 +27,8 @@ wasm-bindgen = { path = "../..", version = "0.2.92" } js-sys = { path = '../js-sys', version = '0.3.69' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test', version = '0.3.42' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.42', features = [ "futures-core-03-stream" ] } +wasm-bindgen-test = { path = '../test' } +wasm-bindgen-futures = { path = '../futures', features = [ "futures-core-03-stream" ] } futures = "0.3" [lints.rust] diff --git a/crates/webidl-tests/Cargo.toml b/crates/webidl-tests/Cargo.toml index cc9c7fea415..8ee9e368e52 100644 --- a/crates/webidl-tests/Cargo.toml +++ b/crates/webidl-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webidl-tests" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" publish = false diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index 2c1147f4d98..d171c46bbcb 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -1,16 +1,9 @@ [package] name = "wasm-bindgen-webidl" -version = "0.2.76" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -categories = ["wasm"] -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/webidl" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen" -description = """ -Support for parsing WebIDL specific to wasm-bindgen -""" edition = "2021" +publish = false [dependencies] env_logger = "0.11.5" @@ -20,7 +13,7 @@ log = "0.4.1" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['extra-traits', 'full'] } -wasm-bindgen-backend = { version = "=0.2.92", path = "../backend" } +wasm-bindgen-backend = { path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } once_cell = "1.12" sourcefile = "0.2" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index 95e5d4cd402..faf072e38af 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "add" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 565b403c78e..c4014f7fccd 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "canvas" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'CanvasRenderingContext2d', 'Document', diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index 1cc1db2df3a..f1aa4704e4b 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "char" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index f4e5c2d1cf9..65cb8f52805 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "closures" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3.69" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'CssStyleDeclaration', 'Document', diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 7052ae96e56..f949471a836 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "console_log" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -web-sys = { version = "0.3.69", features = ['console'] } +wasm-bindgen = { path = "../../" } +web-sys = { path = "../../crates/web-sys", features = ['console'] } diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 7e7064dde55..7169562a2d7 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "deno" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index d44cef608fc..b8abfa60062 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "dom" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index 10f4019615d..87dcb3e3400 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "rust-duck-typed-interfaces" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index fd681949483..8bda684751f 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -1,19 +1,20 @@ [package] name = "fetch" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3.69" -wasm-bindgen-futures = "0.4.42" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Headers', 'Request', diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 23a34ebf138..38264118b54 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "guide-supported-types-examples" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3.69" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index d7f62f91cef..a65ef226e82 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "hello_world" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 04a9c9582d0..326c848c5b6 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "import_js" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../../" } diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 5afa67c7a10..00f9f2ab5de 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "julia_set" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'ImageData', 'CanvasRenderingContext2d', diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index cee71e8a070..4222eeff7ad 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "wasm-bindgen-paint" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'CanvasRenderingContext2d', 'CssStyleDeclaration', diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index c33c4e99170..c50fcdf489b 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -1,16 +1,17 @@ [package] name = "performance" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } humantime = "2" [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = ['Window', 'Performance', 'PerformanceTiming'] diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index dd6ba4562ab..145376c026e 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -1,25 +1,26 @@ [package] name = "raytrace-parallel" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" -js-sys = "0.3.69" +js-sys = { path = "../../crates/js-sys" } rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.6" futures-channel-preview = "0.3.0-alpha.18" -wasm-bindgen = "0.2.92" -wasm-bindgen-futures = "0.4.42" +wasm-bindgen = { path = "../../" } +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -version = "0.3.23" +path = "../../crates/web-sys" features = [ 'CanvasRenderingContext2d', 'ErrorEvent', diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 4316e4a2988..358c86579e2 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "request-animation-frame" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 21d2a9df943..035d372f518 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "synchronous-instantiation" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index c49a6b02fea..e1fc87d50df 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "todomvc" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] @@ -11,13 +12,13 @@ crate-type = ["cdylib"] askama = "0.12" [dependencies] -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } askama = "0.12" console_error_panic_hook = "0.1.5" [dependencies.web-sys] -version = "0.3.5" +path = "../../crates/web-sys" features = [ 'console', 'CssStyleDeclaration', diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index e9cd0c549ee..2b8d3a14265 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -1,19 +1,21 @@ [package] name = "wasm-audio-worklet" -version = "0.1.0" +version = "0.0.0" +authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] console_log = "1" -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" -wasm-bindgen-futures = "0.4.42" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -version = "0.3.59" +path = "../../crates/web-sys" features = [ "AudioContext", "AudioDestinationNode", diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 0d1a7738e50..402433e2481 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -1,13 +1,14 @@ [package] name = "wasm-in-wasm-imports" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3.69" -wasm-bindgen-futures = "0.4.42" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen-futures = { path = "../../crates/futures" } diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index 0c0f4b3a93d..acb7e6d5d31 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -1,13 +1,14 @@ [package] name = "wasm-in-wasm" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3.69" -wasm-bindgen-futures = "0.4.42" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen-futures = { path = "../../crates/futures" } diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 288f7a4f99c..f3968f4c8e4 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "wasm-in-web-worker" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } console_error_panic_hook = { version = "0.1.6", optional = true } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'console', 'Document', diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index e16282ed71e..6157ac4f1f3 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "wasm2js" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 3017924adbc..56eaffb254b 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -1,11 +1,9 @@ [package] name = "rust-webassembly-weather-reports" -description = "Weather Information System- Get the mood of your city on one click using Rust and Webassembly" -version = "0.1.1" +version = "0.0.0" authors = ["Ayush "] -categories = ["wasm"] -readme = "README.md" edition = "2021" +publish = false [lib] crate-type = ["cdylib"] @@ -13,11 +11,11 @@ crate-type = ["cdylib"] [dependencies] chrono = "0.4.11" reqwest = "0.12" -wasm-bindgen-futures = "0.4.1" +wasm-bindgen-futures = { path = "../../crates/futures" } json= "0.12" -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } gloo = "0.11" [dependencies.web-sys] -version = "0.3.40" +path = "../../crates/web-sys" features = ["Document", "Element", "HtmlElement", "Window"] diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index f694108b4e5..ea61373ccdb 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "webaudio" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'AudioContext', 'AudioDestinationNode', diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index e4ae1ff5464..b3f9f006417 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "webgl" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 839aa3d5b18..6cbf946bd4f 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -1,19 +1,20 @@ [package] name = "webrtc_datachannel" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3" -wasm-bindgen-futures = "0.4.42" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -version = "0.3.22" +path = "../../crates/web-sys" features = [ "MessageEvent", "RtcPeerConnection", diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index c7073c1b772..8e957e424a5 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "websockets" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" -js-sys = "0.3" +wasm-bindgen = { path = "../../" } +js-sys = { path = "../../crates/js-sys" } [dependencies.web-sys] -version = "0.3.22" +path = "../../crates/web-sys" features = [ "BinaryType", "Blob", diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 4345ad48748..850e09cb020 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -1,20 +1,21 @@ [package] name = "webxr" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] futures = "0.3.4" -js-sys = "0.3.69" -wasm-bindgen = "0.2.92" -wasm-bindgen-futures = "0.4.42" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -version = "0.3.37" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/examples/without-a-bundler-no-modules/Cargo.toml b/examples/without-a-bundler-no-modules/Cargo.toml index 293c74067cb..24611da861f 100644 --- a/examples/without-a-bundler-no-modules/Cargo.toml +++ b/examples/without-a-bundler-no-modules/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "without-a-bundler-no-modules" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.37" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 12abaa68b76..44e2d597144 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "without-a-bundler" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +publish = false [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.92" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -version = "0.3.4" +path = "../../crates/web-sys" features = [ 'Document', 'Element', diff --git a/tests/crates/a/Cargo.toml b/tests/crates/a/Cargo.toml index 754df360a3a..f60a23a8805 100644 --- a/tests/crates/a/Cargo.toml +++ b/tests/crates/a/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "wasm-bindgen-test-crate-a" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] -license = "MIT/Apache-2.0" -description = "internal test crate for wasm-bindgen" +edition = "2021" +publish = false [dependencies] -wasm-bindgen = { path = '../../..', version = '0.2' } +wasm-bindgen = { path = '../../..' } diff --git a/tests/crates/b/Cargo.toml b/tests/crates/b/Cargo.toml index 916107feb96..c67b9cc50c9 100644 --- a/tests/crates/b/Cargo.toml +++ b/tests/crates/b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "wasm-bindgen-test-crate-b" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] -license = "MIT/Apache-2.0" -description = "internal test crate for wasm-bindgen" +edition = "2021" +publish = false [dependencies] -wasm-bindgen = { path = '../../..', version = '0.2' } +wasm-bindgen = { path = '../../..' } diff --git a/tests/no-std/Cargo.toml b/tests/no-std/Cargo.toml index 23f3040031c..22806c101eb 100644 --- a/tests/no-std/Cargo.toml +++ b/tests/no-std/Cargo.toml @@ -1,10 +1,9 @@ [package] name = "no-std" -version = "0.1.0" +version = "0.0.0" authors = ["The wasm-bindgen Developers"] - -[lib] -path = "test.rs" +edition = "2021" +publish = false [dependencies] wasm-bindgen = { path = '../..', default-features = false } diff --git a/tests/no-std/lib.rs b/tests/no-std/lib.rs deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/no-std/test.rs b/tests/no-std/src/lib.rs similarity index 100% rename from tests/no-std/test.rs rename to tests/no-std/src/lib.rs From cf186acf48c4b0649934d19ba1aa18282bd2ec44 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 4 Aug 2024 16:35:38 +0200 Subject: [PATCH 452/641] Print location when using `expect_throw()` (#4049) --- CHANGELOG.md | 1 + src/lib.rs | 96 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 75 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e92864783..33f1f1e8cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ * `UnwrapThrowExt for Result` now makes use of the required `Debug` bound to display the error as well. [#4035](https://github.com/rustwasm/wasm-bindgen/pull/4035) + [#4049](https://github.com/rustwasm/wasm-bindgen/pull/4049) * MSRV of CLI tools bumped to v1.76. This does not affect libraries like `wasm-bindgen`, `js-sys` and `web-sys`! [#4037](https://github.com/rustwasm/wasm-bindgen/pull/4037) diff --git a/src/lib.rs b/src/lib.rs index 4fe948ff4af..a691426994c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1351,14 +1351,15 @@ pub trait UnwrapThrowExt: Sized { )) { let loc = core::panic::Location::caller(); let msg = alloc::format!( - "`unwrap_throw` failed ({}:{}:{})", + "called `{}::unwrap_throw()` ({}:{}:{})", + core::any::type_name::(), loc.file(), loc.line(), loc.column() ); self.expect_throw(&msg) } else { - self.expect_throw("`unwrap_throw` failed") + self.expect_throw("called `unwrap_throw()`") } } @@ -1376,11 +1377,43 @@ pub trait UnwrapThrowExt: Sized { } impl UnwrapThrowExt for Option { + fn unwrap_throw(self) -> T { + const MSG: &str = "called `Option::unwrap_throw()` on a `None` value"; + + if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { + if let Some(val) = self { + val + } else if cfg!(debug_assertions) { + let loc = core::panic::Location::caller(); + let msg = + alloc::format!("{} ({}:{}:{})", MSG, loc.file(), loc.line(), loc.column(),); + + throw_str(&msg) + } else { + throw_str(MSG) + } + } else { + self.expect(MSG) + } + } + fn expect_throw(self, message: &str) -> T { if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { - match self { - Some(val) => val, - None => throw_str(message), + if let Some(val) = self { + val + } else if cfg!(debug_assertions) { + let loc = core::panic::Location::caller(); + let msg = alloc::format!( + "{} ({}:{}:{})", + message, + loc.file(), + loc.line(), + loc.column(), + ); + + throw_str(&msg) + } else { + throw_str(message) } } else { self.expect(message) @@ -1393,28 +1426,31 @@ where E: core::fmt::Debug, { fn unwrap_throw(self) -> T { - if cfg!(all( - debug_assertions, - target_arch = "wasm32", - target_os = "unknown" - )) { + const MSG: &str = "called `Result::unwrap_throw()` on an `Err` value"; + + if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { match self { Ok(val) => val, Err(err) => { - let loc = core::panic::Location::caller(); - let msg = alloc::format!( - "`unwrap_throw` failed ({}:{}:{}): {:?}", - loc.file(), - loc.line(), - loc.column(), - err - ); - - throw_str(&msg) + if cfg!(debug_assertions) { + let loc = core::panic::Location::caller(); + let msg = alloc::format!( + "{} ({}:{}:{}): {:?}", + MSG, + loc.file(), + loc.line(), + loc.column(), + err + ); + + throw_str(&msg) + } else { + throw_str(MSG) + } } } } else { - self.expect("`unwrap_throw` failed") + self.expect(MSG) } } @@ -1422,7 +1458,23 @@ where if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { match self { Ok(val) => val, - Err(_) => throw_str(message), + Err(err) => { + if cfg!(debug_assertions) { + let loc = core::panic::Location::caller(); + let msg = alloc::format!( + "{} ({}:{}:{}): {:?}", + message, + loc.file(), + loc.line(), + loc.column(), + err + ); + + throw_str(&msg) + } else { + throw_str(message) + } + } } } else { self.expect(message) From 09e0e6d28b769141fde6100b6785dfdb40d2fe8f Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 4 Aug 2024 22:58:52 +0200 Subject: [PATCH 453/641] Add experimental Node module output target (#4027) --- CHANGELOG.md | 3 + crates/cli-support/src/js/mod.rs | 124 +++++++++--------- crates/cli-support/src/lib.rs | 68 ++++------ .../src/bin/wasm-bindgen-test-runner/main.rs | 18 ++- .../src/bin/wasm-bindgen-test-runner/node.rs | 25 +++- crates/cli/src/bin/wasm-bindgen.rs | 3 +- crates/js-sys/tests/browser.rs | 11 ++ crates/js-sys/tests/{ => common}/headless.js | 0 .../tests/{headless.rs => common/mod.rs} | 10 +- crates/js-sys/tests/node.rs | 11 ++ crates/test/src/lib.rs | 6 + guide/src/reference/deployment.md | 19 ++- guide/src/wasm-bindgen-test/browsers.md | 3 + 13 files changed, 181 insertions(+), 120 deletions(-) create mode 100644 crates/js-sys/tests/browser.rs rename crates/js-sys/tests/{ => common}/headless.js (100%) rename crates/js-sys/tests/{headless.rs => common/mod.rs} (81%) create mode 100644 crates/js-sys/tests/node.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 33f1f1e8cee..014f3e6f8e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,9 @@ * Added bindings to `NavigatorOptions.vibrate`. [#4041](https://github.com/rustwasm/wasm-bindgen/pull/4041) +* Added an experimental Node.JS ES module target, in comparison the current `node` target uses CommonJS, with `--target experimental-nodejs-module` or when testing with `wasm_bindgen_test_configure!(run_in_node_experimental)`. + [#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027) + ### Changed * Stabilize Web Share API. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 1fae3de1454..759ddcc4678 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -142,9 +142,7 @@ impl<'a> Context<'a> { self.globals.push_str(c); } let global = match self.config.mode { - OutputMode::Node { - experimental_modules: false, - } => { + OutputMode::Node { module: false } => { if contents.starts_with("class") { format!("{}\nmodule.exports.{1} = {1};\n", contents, export_name) } else { @@ -159,9 +157,7 @@ impl<'a> Context<'a> { } } OutputMode::Bundler { .. } - | OutputMode::Node { - experimental_modules: true, - } + | OutputMode::Node { module: true } | OutputMode::Web | OutputMode::Deno => { if let Some(body) = contents.strip_prefix("function") { @@ -217,26 +213,29 @@ impl<'a> Context<'a> { let mut shim = String::new(); - shim.push_str("let imports = {};\n"); + shim.push_str("\nlet imports = {};\n"); - if self.config.mode.nodejs_experimental_modules() { + if self.config.mode.uses_es_modules() { for (i, module) in imports.iter().enumerate() { if module.as_str() != PLACEHOLDER_MODULE { shim.push_str(&format!("import * as import{} from '{}';\n", i, module)); } } - } - - for (i, module) in imports.iter().enumerate() { - if module.as_str() == PLACEHOLDER_MODULE { - shim.push_str(&format!( - "imports['{0}'] = module.exports;\n", - PLACEHOLDER_MODULE - )); - } else if self.config.mode.nodejs_experimental_modules() { - shim.push_str(&format!("imports['{}'] = import{};\n", module, i)); - } else { - shim.push_str(&format!("imports['{0}'] = require('{0}');\n", module)); + for (i, module) in imports.iter().enumerate() { + if module.as_str() != PLACEHOLDER_MODULE { + shim.push_str(&format!("imports['{}'] = import{};\n", module, i)); + } + } + } else { + for module in imports.iter() { + if module.as_str() == PLACEHOLDER_MODULE { + shim.push_str(&format!( + "imports['{0}'] = module.exports;\n", + PLACEHOLDER_MODULE + )); + } else { + shim.push_str(&format!("imports['{0}'] = require('{0}');\n", module)); + } } } @@ -246,17 +245,16 @@ impl<'a> Context<'a> { fn generate_node_wasm_loading(&self, path: &Path) -> String { let mut shim = String::new(); - if self.config.mode.nodejs_experimental_modules() { + if self.config.mode.uses_es_modules() { // On windows skip the leading `/` which comes out when we parse a // url to use `C:\...` instead of `\C:\...` shim.push_str(&format!( " - import * as path from 'path'; - import * as fs from 'fs'; - import * as url from 'url'; - import * as process from 'process'; + import * as path from 'node:path'; + import * as fs from 'node:fs'; + import * as process from 'node:process'; - let file = path.dirname(url.parse(import.meta.url).pathname); + let file = path.dirname(new URL(import.meta.url).pathname); if (process.platform === 'win32') {{ file = file.substring(1); }} @@ -264,6 +262,14 @@ impl<'a> Context<'a> { ", path.file_name().unwrap().to_str().unwrap() )); + shim.push_str( + " + const wasmModule = new WebAssembly.Module(bytes); + const wasmInstance = new WebAssembly.Instance(wasmModule, imports); + const wasm = wasmInstance.exports; + export const __wasm = wasm; + ", + ); } else { shim.push_str(&format!( " @@ -272,17 +278,16 @@ impl<'a> Context<'a> { ", path.file_name().unwrap().to_str().unwrap() )); + shim.push_str( + " + const wasmModule = new WebAssembly.Module(bytes); + const wasmInstance = new WebAssembly.Instance(wasmModule, imports); + wasm = wasmInstance.exports; + module.exports.__wasm = wasm; + ", + ); } - shim.push_str( - " - const wasmModule = new WebAssembly.Module(bytes); - const wasmInstance = new WebAssembly.Instance(wasmModule, imports); - wasm = wasmInstance.exports; - module.exports.__wasm = wasm; - ", - ); - reset_indentation(&shim) } @@ -400,9 +405,7 @@ impl<'a> Context<'a> { // With normal CommonJS node we need to defer requiring the wasm // until the end so most of our own exports are hooked up - OutputMode::Node { - experimental_modules: false, - } => { + OutputMode::Node { module: false } => { js.push_str(&self.generate_node_imports()); js.push_str("let wasm;\n"); @@ -442,13 +445,10 @@ impl<'a> Context<'a> { } } - // With Bundlers and modern ES6 support in Node we can simply import - // the wasm file as if it were an ES module and let the - // bundler/runtime take care of it. - OutputMode::Bundler { .. } - | OutputMode::Node { - experimental_modules: true, - } => { + // With Bundlers we can simply import the wasm file as if it were an ES module + // and let the bundler/runtime take care of it. + // With Node we manually read the wasm file from the filesystem and instantiate it. + OutputMode::Bundler { .. } | OutputMode::Node { module: true } => { for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { let import = self.module.imports.get_mut(*id); import.module = format!("./{}_bg.js", module_name); @@ -475,8 +475,18 @@ impl<'a> Context<'a> { ", ); + if matches!(self.config.mode, OutputMode::Node { module: true }) { + let start = start.get_or_insert_with(String::new); + start.push_str(&self.generate_node_imports()); + start.push_str(&self.generate_node_wasm_loading(Path::new(&format!( + "./{}_bg.wasm", + module_name + )))); + } if needs_manual_start { - start = Some("\nwasm.__wbindgen_start();\n".to_string()); + start + .get_or_insert_with(String::new) + .push_str("\nwasm.__wbindgen_start();\n"); } } @@ -509,7 +519,9 @@ impl<'a> Context<'a> { // Emit all the JS for importing all our functionality assert!( !self.config.mode.uses_es_modules() || js.is_empty(), - "ES modules require imports to be at the start of the file" + "ES modules require imports to be at the start of the file, but we \ + generated some JS before the imports: {}", + js ); let mut push_with_newline = |s| { @@ -556,9 +568,7 @@ impl<'a> Context<'a> { } } - OutputMode::Node { - experimental_modules: false, - } => { + OutputMode::Node { module: false } => { for (module, items) in crate::sorted_iter(&self.js_imports) { imports.push_str("const { "); for (i, (item, rename)) in items.iter().enumerate() { @@ -582,9 +592,7 @@ impl<'a> Context<'a> { } OutputMode::Bundler { .. } - | OutputMode::Node { - experimental_modules: true, - } + | OutputMode::Node { module: true } | OutputMode::Web | OutputMode::Deno => { for (module, items) in crate::sorted_iter(&self.js_imports) { @@ -3216,12 +3224,10 @@ impl<'a> Context<'a> { OutputMode::Web | OutputMode::Bundler { .. } | OutputMode::Deno - | OutputMode::Node { - experimental_modules: true, - } => "import.meta.url", - OutputMode::Node { - experimental_modules: false, - } => "require('url').pathToFileURL(__filename)", + | OutputMode::Node { module: true } => "import.meta.url", + OutputMode::Node { module: false } => { + "require('url').pathToFileURL(__filename)" + } OutputMode::NoModules { .. } => { prelude.push_str( "if (script_src === undefined) { diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 37428bd20fd..53270eb6eda 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -66,7 +66,7 @@ enum OutputMode { Bundler { browser_only: bool }, Web, NoModules { global: String }, - Node { experimental_modules: bool }, + Node { module: bool }, Deno, } @@ -154,23 +154,16 @@ impl Bindgen { pub fn nodejs(&mut self, node: bool) -> Result<&mut Bindgen, Error> { if node { - self.switch_mode( - OutputMode::Node { - experimental_modules: false, - }, - "--target nodejs", - )?; + self.switch_mode(OutputMode::Node { module: false }, "--target nodejs")?; } Ok(self) } - pub fn nodejs_experimental_modules(&mut self, node: bool) -> Result<&mut Bindgen, Error> { + pub fn nodejs_module(&mut self, node: bool) -> Result<&mut Bindgen, Error> { if node { self.switch_mode( - OutputMode::Node { - experimental_modules: true, - }, - "--nodejs-experimental-modules", + OutputMode::Node { module: true }, + "--target experimental-nodejs-module", )?; } Ok(self) @@ -548,22 +541,11 @@ impl OutputMode { self, OutputMode::Bundler { .. } | OutputMode::Web - | OutputMode::Node { - experimental_modules: true, - } + | OutputMode::Node { module: true } | OutputMode::Deno ) } - fn nodejs_experimental_modules(&self) -> bool { - match self { - OutputMode::Node { - experimental_modules, - } => *experimental_modules, - _ => false, - } - } - fn nodejs(&self) -> bool { matches!(self, OutputMode::Node { .. }) } @@ -579,10 +561,7 @@ impl OutputMode { fn esm_integration(&self) -> bool { matches!( self, - OutputMode::Bundler { .. } - | OutputMode::Node { - experimental_modules: true, - } + OutputMode::Bundler { .. } | OutputMode::Node { module: true } ) } } @@ -687,11 +666,7 @@ impl Output { // And now that we've got all our JS and TypeScript, actually write it // out to the filesystem. - let extension = if gen.mode.nodejs_experimental_modules() { - "mjs" - } else { - "js" - }; + let extension = "js"; fn write(path: P, contents: C) -> Result<(), anyhow::Error> where @@ -709,17 +684,30 @@ impl Output { let start = gen.start.as_deref().unwrap_or(""); - write( - &js_path, - format!( - "import * as wasm from \"./{wasm_name}.wasm\"; + if matches!(gen.mode, OutputMode::Node { .. }) { + write( + &js_path, + format!( + " +import {{ __wbg_set_wasm }} from \"./{js_name}\"; +{start} +__wbg_set_wasm(wasm); +export * from \"./{js_name}\";", + ), + )?; + } else { + write( + &js_path, + format!( + " +import * as wasm from \"./{wasm_name}.wasm\"; import {{ __wbg_set_wasm }} from \"./{js_name}\"; __wbg_set_wasm(wasm); export * from \"./{js_name}\"; {start}" - ), - )?; - + ), + )?; + } write(out_dir.join(&js_name), reset_indentation(&gen.js))?; } else { write(&js_path, reset_indentation(&gen.js))?; diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 06d386119ed..585f8aa34ca 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -27,7 +27,7 @@ mod shell; #[derive(Debug, Copy, Clone, Eq, PartialEq)] enum TestMode { - Node, + Node { no_modules: bool }, Deno, Browser { no_modules: bool }, DedicatedWorker { no_modules: bool }, @@ -45,9 +45,9 @@ impl TestMode { fn no_modules(self) -> bool { match self { - Self::Node => true, Self::Deno => true, Self::Browser { no_modules } + | Self::Node { no_modules } | Self::DedicatedWorker { no_modules } | Self::SharedWorker { no_modules } | Self::ServiceWorker { no_modules } => no_modules, @@ -150,16 +150,19 @@ fn main() -> anyhow::Result<()> { Some(section) if section.data.contains(&0x04) => TestMode::ServiceWorker { no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), }, + Some(section) if section.data.contains(&0x05) => TestMode::Node { + no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), + }, Some(_) => bail!("invalid __wasm_bingen_test_unstable value"), None if std::env::var("WASM_BINDGEN_USE_DENO").is_ok() => TestMode::Deno, - None => TestMode::Node, + None => TestMode::Node { no_modules: true }, }; let headless = env::var("NO_HEADLESS").is_err(); let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err(); // Gracefully handle requests to execute only node or only web tests. - let node = test_mode == TestMode::Node; + let node = matches!(test_mode, TestMode::Node { .. }); if env::var_os("WASM_BINDGEN_TEST_ONLY_NODE").is_some() && !node { println!( @@ -200,7 +203,8 @@ fn main() -> anyhow::Result<()> { shell.status("Executing bindgen..."); let mut b = Bindgen::new(); match test_mode { - TestMode::Node => b.nodejs(true)?, + TestMode::Node { no_modules: true } => b.nodejs(true)?, + TestMode::Node { no_modules: false } => b.nodejs_module(true)?, TestMode::Deno => b.deno(true)?, TestMode::Browser { .. } | TestMode::DedicatedWorker { .. } @@ -229,7 +233,9 @@ fn main() -> anyhow::Result<()> { let args: Vec<_> = args.collect(); match test_mode { - TestMode::Node => node::execute(module, &tmpdir, &args, &tests)?, + TestMode::Node { no_modules } => { + node::execute(module, &tmpdir, &args, &tests, !no_modules)? + } TestMode::Deno => deno::execute(module, &tmpdir, &args, &tests)?, TestMode::Browser { .. } | TestMode::DedicatedWorker { .. } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 0e1718119ae..2bc9f2ae640 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -43,11 +43,12 @@ pub fn execute( tmpdir: &Path, args: &[OsString], tests: &[String], + module_format: bool, ) -> Result<(), Error> { let mut js_to_execute = format!( r#" - const {{ exit }} = require('process'); - const wasm = require("./{0}"); + {exit}; + {wasm}; {console_override} @@ -67,7 +68,16 @@ pub fn execute( const tests = []; "#, - module, + wasm = if !module_format { + format!(r"const wasm = require('./{0}.js')", module) + } else { + format!(r"import * as wasm from './{0}.js'", module) + }, + exit = if !module_format { + r"const { exit } = require('node:process')".to_string() + } else { + r"import { exit } from 'node:process'".to_string() + }, console_override = SHARED_SETUP, ); @@ -88,7 +98,14 @@ pub fn execute( ", ); - let js_path = tmpdir.join("run.js"); + let js_path = if module_format { + // fixme: this is a hack to make node understand modules + let package_json = tmpdir.join("package.json"); + fs::write(&package_json, r#"{"type": "module"}"#).unwrap(); + tmpdir.join("run.mjs") + } else { + tmpdir.join("run.cjs") + }; fs::write(&js_path, js_to_execute).context("failed to write JS file")?; // Augment `NODE_PATH` so things like `require("tests/my-custom.js")` work diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index b62449392c9..ee33c8de036 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -18,7 +18,7 @@ Options: --out-dir DIR Output directory --out-name VAR Set a custom output filename (Without extension. Defaults to crate name) --target TARGET What type of output to generate, valid - values are [web, bundler, nodejs, no-modules, deno], + values are [web, bundler, nodejs, no-modules, deno, experimental-nodejs-module], and the default is [bundler] --no-modules-global VAR Name of the global variable to initialize --browser Hint that JS should only be compatible with a browser @@ -109,6 +109,7 @@ fn rmain(args: &Args) -> Result<(), Error> { "no-modules" => b.no_modules(true)?, "nodejs" => b.nodejs(true)?, "deno" => b.deno(true)?, + "experimental-nodejs-module" => b.nodejs_module(true)?, s => bail!("invalid encode-into mode: `{}`", s), }; } diff --git a/crates/js-sys/tests/browser.rs b/crates/js-sys/tests/browser.rs new file mode 100644 index 00000000000..38b55e9792c --- /dev/null +++ b/crates/js-sys/tests/browser.rs @@ -0,0 +1,11 @@ +#![cfg(target_arch = "wasm32")] + +extern crate js_sys; +extern crate wasm_bindgen; +extern crate wasm_bindgen_test; + +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); + +pub mod common; diff --git a/crates/js-sys/tests/headless.js b/crates/js-sys/tests/common/headless.js similarity index 100% rename from crates/js-sys/tests/headless.js rename to crates/js-sys/tests/common/headless.js diff --git a/crates/js-sys/tests/headless.rs b/crates/js-sys/tests/common/mod.rs similarity index 81% rename from crates/js-sys/tests/headless.rs rename to crates/js-sys/tests/common/mod.rs index aafa6b0ae2a..b5cdd579c76 100644 --- a/crates/js-sys/tests/headless.rs +++ b/crates/js-sys/tests/common/mod.rs @@ -1,16 +1,8 @@ -#![cfg(target_arch = "wasm32")] - -extern crate js_sys; -extern crate wasm_bindgen; -extern crate wasm_bindgen_test; - use js_sys::Array; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; -wasm_bindgen_test_configure!(run_in_browser); - -#[wasm_bindgen(module = "/tests/headless.js")] +#[wasm_bindgen(module = "/tests/common/headless.js")] extern "C" { fn is_array_values_supported() -> bool; } diff --git a/crates/js-sys/tests/node.rs b/crates/js-sys/tests/node.rs new file mode 100644 index 00000000000..d4d5d1139c9 --- /dev/null +++ b/crates/js-sys/tests/node.rs @@ -0,0 +1,11 @@ +#![cfg(target_arch = "wasm32")] + +extern crate js_sys; +extern crate wasm_bindgen; +extern crate wasm_bindgen_test; + +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_node_experimental); + +pub mod common; diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index 6b4174b1d77..d05d46f5785 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -76,6 +76,12 @@ macro_rules! wasm_bindgen_test_configure { pub static __WBG_TEST_RUN_IN_SERVICE_WORKER: [u8; 1] = [0x04]; $crate::wasm_bindgen_test_configure!($($others)*); ); + (run_in_node_experimental $($others:tt)*) => ( + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_run_in_node_experimental: [u8; 1] = [0x05]; + $crate::wasm_bindgen_test_configure!($($others)*); + ); () => () } diff --git a/guide/src/reference/deployment.md b/guide/src/reference/deployment.md index d0530941a55..aa66e8d6f65 100644 --- a/guide/src/reference/deployment.md +++ b/guide/src/reference/deployment.md @@ -12,9 +12,10 @@ The methods of deployment and integration here are primarily tied to the |-----------------|------------------------------------------------------------| | [`bundler`] | Suitable for loading in bundlers like Webpack | | [`web`] | Directly loadable in a web browser | -| [`nodejs`] | Loadable via `require` as a Node.js module | +| [`nodejs`] | Loadable via `require` as a Node.js CommonJS module | | [`deno`] | Loadable using imports from Deno modules | | [`no-modules`] | Like `web`, but older and doesn't use ES modules | +| [`experimental-nodejs-module`] | Loadable via `import` as a Node.js ESM module. | [`bundler`]: #bundlers [`web`]: #without-a-bundler @@ -87,6 +88,22 @@ as it has a JS shim generated as well). Note that this method requires a version of Node.js with WebAssembly support, which is currently Node 8 and above. +## Node.js Module + +**`--target experemintal-nodejs-module`** + +If you're deploying WebAssembly into Node.js as a JavaScript module, +then you'll want to pass the `--target experimental-nodejs-module` flag to `wasm-bindgen`. + +Like the "node" strategy, this method of deployment does not +require any further postprocessing. The generated JS shims can be `import`ed +just like any other Node module. + +Note that this method requires a version of Node.js with WebAssembly and module support, +which is currently Node 12 and above. + +**Currently experimental. Target is expected to be changed before stabilization.** + ## Deno **`--target deno`** diff --git a/guide/src/wasm-bindgen-test/browsers.md b/guide/src/wasm-bindgen-test/browsers.md index 5477e6b4d2f..7028575efc3 100644 --- a/guide/src/wasm-bindgen-test/browsers.md +++ b/guide/src/wasm-bindgen-test/browsers.md @@ -23,6 +23,8 @@ wasm_bindgen_test_configure!(run_in_dedicated_worker); wasm_bindgen_test_configure!(run_in_shared_worker); // Or run in service worker. wasm_bindgen_test_configure!(run_in_service_worker); +// Or run in Node.js but as an ES module. +wasm_bindgen_test_configure!(run_in_node_experimental); ``` Note that although a particular test crate must target either headless browsers @@ -33,6 +35,7 @@ project by using multiple test crates. For example: $MY_CRATE/ `-- tests |-- node.rs # The tests in this suite use the default Node.js. + |-- node_module.rs # The tests in this suite are configured for Node.js but as an ES module. |-- dedicated_worker.rs # The tests in this suite are configured for dedicated workers. |-- shared_worker.rs # The tests in this suite are configured for shared workers. |-- service_worker.rs # The tests in this suite are configured for service workers. From 33ea44fd24f925c2c1cd327999e35bf6a41e7c91 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Aug 2024 14:02:59 +0200 Subject: [PATCH 454/641] Graceful shutdown Hyper connection (#4052) --- crates/example-tests/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 0486e8fd19e..7a5e360d57f 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -354,14 +354,17 @@ pub async fn test_example( let conn = builder.serve_connection(TokioIo::new(stream), &service); tokio::pin!(conn); - tokio::select! { + let ret = tokio::select! { res = conn.as_mut() => { res.map_err(|e| anyhow::Error::msg(e.to_string())) } _ = rx => { Ok(()) } - } + }; + + conn.graceful_shutdown(); + ret }, async { #[derive(Deserialize)] From 0b1cce69708543f2890b61799826ed2abfdc5cf4 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 6 Aug 2024 15:24:38 +0200 Subject: [PATCH 455/641] Add importing strings as `JsString` (#4055) --- CHANGELOG.md | 3 + crates/backend/src/ast.rs | 26 ++++++ crates/backend/src/codegen.rs | 101 ++++++++++++++-------- crates/backend/src/encode.rs | 8 ++ crates/cli-support/src/js/mod.rs | 13 +++ crates/cli-support/src/wit/mod.rs | 27 ++++++ crates/cli-support/src/wit/nonstandard.rs | 3 + crates/macro-support/src/parser.rs | 74 ++++++++++++++++ crates/shared/src/lib.rs | 6 ++ crates/shared/src/schema_hash_approval.rs | 2 +- guide/src/reference/static-js-objects.md | 12 +++ tests/headless/strings.rs | 12 +++ 12 files changed, 252 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 014f3e6f8e0..e9f9997dd69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,9 @@ * Added an experimental Node.JS ES module target, in comparison the current `node` target uses CommonJS, with `--target experimental-nodejs-module` or when testing with `wasm_bindgen_test_configure!(run_in_node_experimental)`. [#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027) +* Added importing strings as `JsString` through `#[wasm_bindgen(static_string)] static STRING: JsString = "a string literal";`. + [#4055](https://github.com/rustwasm/wasm-bindgen/pull/4055) + ### Changed * Stabilize Web Share API. diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 91aa23040e6..3474d3a5a51 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -29,6 +29,8 @@ pub struct Program { pub inline_js: Vec, /// Path to wasm_bindgen pub wasm_bindgen: Path, + /// Path to js_sys + pub js_sys: Path, /// Path to wasm_bindgen_futures pub wasm_bindgen_futures: Path, } @@ -44,6 +46,7 @@ impl Default for Program { typescript_custom_sections: Default::default(), inline_js: Default::default(), wasm_bindgen: syn::parse_quote! { wasm_bindgen }, + js_sys: syn::parse_quote! { js_sys }, wasm_bindgen_futures: syn::parse_quote! { wasm_bindgen_futures }, } } @@ -160,6 +163,8 @@ pub enum ImportKind { Function(ImportFunction), /// Importing a static value Static(ImportStatic), + /// Importing a static string + String(ImportString), /// Importing a type/class Type(ImportType), /// Importing a JS enum @@ -272,6 +277,26 @@ pub struct ImportStatic { pub wasm_bindgen: Path, } +/// The type of a static string being imported +#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))] +#[derive(Clone)] +pub struct ImportString { + /// The visibility of this static string in Rust + pub vis: syn::Visibility, + /// The type specified by the user, which we only use to show an error if the wrong type is used. + pub ty: syn::Type, + /// The name of the shim function used to access this static + pub shim: Ident, + /// The name of this static on the Rust side + pub rust_name: Ident, + /// Path to wasm_bindgen + pub wasm_bindgen: Path, + /// Path to js_sys + pub js_sys: Path, + /// The string to export. + pub string: String, +} + /// The metadata for a type being imported #[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))] #[derive(Clone)] @@ -502,6 +527,7 @@ impl ImportKind { match *self { ImportKind::Function(_) => true, ImportKind::Static(_) => false, + ImportKind::String(_) => false, ImportKind::Type(_) => false, ImportKind::Enum(_) => false, } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index e76718148af..c826d67cb4d 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -9,6 +9,7 @@ use quote::quote_spanned; use quote::{quote, ToTokens}; use std::collections::{HashMap, HashSet}; use std::sync::Mutex; +use syn::parse_quote; use syn::spanned::Spanned; use wasm_bindgen_shared as shared; @@ -846,6 +847,7 @@ impl TryToTokens for ast::ImportKind { match *self { ast::ImportKind::Function(ref f) => f.try_to_tokens(tokens)?, ast::ImportKind::Static(ref s) => s.to_tokens(tokens), + ast::ImportKind::String(ref s) => s.to_tokens(tokens), ast::ImportKind::Type(ref t) => t.to_tokens(tokens), ast::ImportKind::Enum(ref e) => e.to_tokens(tokens), } @@ -1477,6 +1479,7 @@ impl<'a> ToTokens for DescribeImport<'a> { let f = match *self.kind { ast::ImportKind::Function(ref f) => f, ast::ImportKind::Static(_) => return, + ast::ImportKind::String(_) => return, ast::ImportKind::Type(_) => return, ast::ImportKind::Enum(_) => return, }; @@ -1641,44 +1644,19 @@ impl ToTokens for ast::Enum { impl ToTokens for ast::ImportStatic { fn to_tokens(&self, into: &mut TokenStream) { - let name = &self.rust_name; let ty = &self.ty; - let shim_name = &self.shim; - let vis = &self.vis; - let wasm_bindgen = &self.wasm_bindgen; - - let abi_ret = quote! { - #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi> - }; - (quote! { - #[automatically_derived] - #vis static #name: #wasm_bindgen::JsStatic<#ty> = { - fn init() -> #ty { - #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] - extern "C" { - fn #shim_name() -> #abi_ret; - } - - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] - unsafe fn #shim_name() -> #abi_ret { - panic!("cannot access imported statics on non-wasm targets") - } - - unsafe { - <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name().join()) - } - } - thread_local!(static _VAL: #ty = init();); - #wasm_bindgen::JsStatic { - __inner: &_VAL, - } - }; - }) + static_import( + &self.vis, + &self.rust_name, + &self.wasm_bindgen, + ty, + ty, + &self.shim, + ) .to_tokens(into); Descriptor { - ident: shim_name, + ident: &self.shim, inner: quote! { <#ty as WasmDescribe>::describe(); }, @@ -1689,6 +1667,61 @@ impl ToTokens for ast::ImportStatic { } } +impl ToTokens for ast::ImportString { + fn to_tokens(&self, into: &mut TokenStream) { + let js_sys = &self.js_sys; + let actual_ty: syn::Type = parse_quote!(#js_sys::JsString); + + static_import( + &self.vis, + &self.rust_name, + &self.wasm_bindgen, + &actual_ty, + &self.ty, + &self.shim, + ) + .to_tokens(into); + } +} + +fn static_import( + vis: &syn::Visibility, + name: &Ident, + wasm_bindgen: &syn::Path, + actual_ty: &syn::Type, + ty: &syn::Type, + shim_name: &Ident, +) -> TokenStream { + let abi_ret = quote! { + #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi> + }; + quote! { + #[automatically_derived] + #vis static #name: #wasm_bindgen::JsStatic<#actual_ty> = { + fn init() -> #ty { + #[link(wasm_import_module = "__wbindgen_placeholder__")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + extern "C" { + fn #shim_name() -> #abi_ret; + } + + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + unsafe fn #shim_name() -> #abi_ret { + panic!("cannot access imported statics on non-wasm targets") + } + + unsafe { + <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name().join()) + } + } + thread_local!(static _VAL: #ty = init();); + #wasm_bindgen::JsStatic { + __inner: &_VAL, + } + }; + } +} + /// Emits the necessary glue tokens for "descriptor", generating an appropriate /// symbol name as well as attributes around the descriptor function itself. struct Descriptor<'a, T> { diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index b571d046dfe..0daa9ff1123 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -297,6 +297,7 @@ fn shared_import_kind<'a>( Ok(match i { ast::ImportKind::Function(f) => ImportKind::Function(shared_import_function(f, intern)?), ast::ImportKind::Static(f) => ImportKind::Static(shared_import_static(f, intern)), + ast::ImportKind::String(f) => ImportKind::String(shared_import_string(f, intern)), ast::ImportKind::Type(f) => ImportKind::Type(shared_import_type(f, intern)), ast::ImportKind::Enum(f) => ImportKind::Enum(shared_import_enum(f, intern)), }) @@ -332,6 +333,13 @@ fn shared_import_static<'a>(i: &'a ast::ImportStatic, intern: &'a Interner) -> I } } +fn shared_import_string<'a>(i: &'a ast::ImportString, intern: &'a Interner) -> ImportString<'a> { + ImportString { + shim: intern.intern(&i.shim), + string: &i.string, + } +} + fn shared_import_type<'a>(i: &'a ast::ImportType, intern: &'a Interner) -> ImportType<'a> { ImportType { name: &i.js_name, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 759ddcc4678..c95a2ae7892 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3067,6 +3067,19 @@ impl<'a> Context<'a> { self.import_name(js) } + AuxImport::String(string) => { + assert!(kind == AdapterJsImportKind::Normal); + assert!(!variadic); + assert_eq!(args.len(), 0); + + let mut escaped = String::with_capacity(string.len()); + string.chars().for_each(|c| match c { + '`' | '\\' | '$' => escaped.extend(['\\', c]), + _ => escaped.extend([c]), + }); + Ok(format!("`{escaped}`")) + } + AuxImport::Closure { dtor, mutable, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 0053e351336..f85537b8fa2 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -567,6 +567,7 @@ impl<'a> Context<'a> { match &import.kind { decode::ImportKind::Function(f) => self.import_function(&import, f), decode::ImportKind::Static(s) => self.import_static(&import, s), + decode::ImportKind::String(s) => self.import_string(s), decode::ImportKind::Type(t) => self.import_type(&import, t), decode::ImportKind::Enum(_) => Ok(()), } @@ -803,6 +804,32 @@ impl<'a> Context<'a> { Ok(()) } + fn import_string(&mut self, string: &decode::ImportString<'_>) -> Result<(), Error> { + let (import_id, _id) = match self.function_imports.get(string.shim) { + Some(pair) => *pair, + None => return Ok(()), + }; + + // Register the signature of this imported shim + let id = self.import_adapter( + import_id, + Function { + arguments: Vec::new(), + shim_idx: 0, + ret: Descriptor::Externref, + inner_ret: None, + }, + AdapterJsImportKind::Normal, + )?; + + // And then save off that this function is is an instanceof shim for an + // imported item. + self.aux + .import_map + .insert(id, AuxImport::String(string.string.to_owned())); + Ok(()) + } + fn import_type( &mut self, import: &decode::Import<'_>, diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 70bca5ad915..4a9d5598ff5 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -220,6 +220,9 @@ pub enum AuxImport { /// `JsImport`. Static(JsImport), + /// This import is expected to be a shim that returns an exported `JsString`. + String(String), + /// This import is intended to manufacture a JS closure with the given /// signature and then return that back to Rust. Closure { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 376c15b1133..3e3f3113a0e 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -87,10 +87,12 @@ macro_rules! attrgen { (main, Main(Span)), (start, Start(Span)), (wasm_bindgen, WasmBindgen(Span, syn::Path)), + (js_sys, JsSys(Span, syn::Path)), (wasm_bindgen_futures, WasmBindgenFutures(Span, syn::Path)), (skip, Skip(Span)), (typescript_type, TypeScriptType(Span, String, Span)), (getter_with_clone, GetterWithClone(Span)), + (static_string, StaticString(Span)), // For testing purposes only. (assert_no_shim, AssertNoShim(Span)), @@ -774,6 +776,57 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option)> + for syn::ItemStatic +{ + type Target = ast::ImportKind; + + fn convert( + self, + (program, opts, module): (&ast::Program, BindgenAttrs, &'a Option), + ) -> Result { + if let syn::StaticMutability::Mut(_) = self.mutability { + bail_span!(self.mutability, "cannot import mutable globals yet") + } + + let string = if let syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Str(string), + .. + }) = *self.expr.clone() + { + string.value() + } else { + bail_span!( + self.expr, + "statics with a value can only be string literals" + ) + }; + + if opts.static_string().is_none() { + bail_span!( + self, + "statics strings require `#[wasm_bindgen(static_string)]`" + ) + } + + let shim = format!( + "__wbg_string_{}_{}", + self.ident, + ShortHash((&module, &self.ident)), + ); + opts.check_used(); + Ok(ast::ImportKind::String(ast::ImportString { + ty: *self.ty, + vis: self.vis, + rust_name: self.ident.clone(), + shim: Ident::new(&shim, Span::call_site()), + wasm_bindgen: program.wasm_bindgen.clone(), + js_sys: program.js_sys.clone(), + string, + })) + } +} + impl ConvertToAst for syn::ItemFn { type Target = ast::Function; @@ -966,6 +1019,9 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { if let Some(path) = opts.wasm_bindgen() { program.wasm_bindgen = path.clone(); } + if let Some(path) = opts.js_sys() { + program.js_sys = path.clone(); + } if let Some(path) = opts.wasm_bindgen_futures() { program.wasm_bindgen_futures = path.clone(); } @@ -1466,6 +1522,20 @@ impl MacroParse for syn::ForeignItem { syn::ForeignItem::Fn(ref mut f) => &mut f.attrs, syn::ForeignItem::Type(ref mut t) => &mut t.attrs, syn::ForeignItem::Static(ref mut s) => &mut s.attrs, + syn::ForeignItem::Verbatim(v) => { + let mut item: syn::ItemStatic = + syn::parse(v.into()).expect("only foreign functions/types allowed for now"); + let item_opts = BindgenAttrs::find(&mut item.attrs)?; + let kind = item.convert((program, item_opts, &ctx.module))?; + + program.imports.push(ast::Import { + module: None, + js_namespace: None, + kind, + }); + + return Ok(()); + } _ => panic!("only foreign functions/types allowed for now"), }; BindgenAttrs::find(attrs)? @@ -1502,6 +1572,10 @@ pub fn module_from_opts( program.wasm_bindgen = path.clone(); } + if let Some(path) = opts.js_sys() { + program.js_sys = path.clone(); + } + if let Some(path) = opts.wasm_bindgen_futures() { program.wasm_bindgen_futures = path.clone(); } diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 0c3af022dbf..e85ddf9b87c 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -49,6 +49,7 @@ macro_rules! shared_api { enum ImportKind<'a> { Function(ImportFunction<'a>), Static(ImportStatic<'a>), + String(ImportString<'a>), Type(ImportType<'a>), Enum(StringEnum), } @@ -92,6 +93,11 @@ macro_rules! shared_api { shim: &'a str, } + struct ImportString<'a> { + shim: &'a str, + string: &'a str, + } + struct ImportType<'a> { name: &'a str, instanceof_shim: &'a str, diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 0ba79b8eefb..a52716f360f 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "6362870592255096957"; +const APPROVED_SCHEMA_FILE_HASH: &str = "3501400214978266446"; #[test] fn schema_version() { diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md index f4826ea0dd1..9c15fcbb3d5 100644 --- a/guide/src/reference/static-js-objects.md +++ b/guide/src/reference/static-js-objects.md @@ -62,3 +62,15 @@ extern "C" { fn new() -> SomeType; } ``` + +## Static strings + +Strings can be imported to avoid going through `TextDecoder/Encoder` when requiring just a `JsString`. This can be useful when dealing with environments where `TextDecoder/Encoder` is not available, like in audio worklets. + +```rust +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(static_string)] + static STRING: JsString = "a string literal"; +} +``` diff --git a/tests/headless/strings.rs b/tests/headless/strings.rs index 300187b2c91..944db5f2e56 100644 --- a/tests/headless/strings.rs +++ b/tests/headless/strings.rs @@ -1,3 +1,4 @@ +use js_sys::JsString; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -13,4 +14,15 @@ fn string_roundtrip() { test_string_roundtrip(&Closure::wrap(Box::new(|s| s))); assert_eq!("\u{feff}bar", &identity("\u{feff}bar")); + + assert_eq!(String::from(&*STRING), "foo") +} + +#[wasm_bindgen] +// Currently Rustfmt simply removes the value on this static. +// See . +#[rustfmt::skip] +extern "C" { + #[wasm_bindgen(static_string)] + static STRING: JsString = "foo"; } From acfd1ee40c65bdd9b734eb48194281ee8b78dc62 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 7 Aug 2024 00:20:39 +0200 Subject: [PATCH 456/641] Deprecate `JsStatic` in favor of `#[wasm_bindgen(thread_local)]` (#4057) Removed `impl Deref for JsStatic` when compiling with `cfg(target_feature = "atomics")`, which was unsound. --- CHANGELOG.md | 8 +- crates/backend/src/ast.rs | 2 + crates/backend/src/codegen.rs | 95 ++++++++++++------- crates/js-sys/tests/wasm/Function.rs | 36 ++++--- crates/js-sys/tests/wasm/Object.rs | 16 ++-- crates/macro-support/src/parser.rs | 20 +++- crates/macro/Cargo.toml | 1 + crates/macro/ui-tests/invalid-items.rs | 15 ++- crates/macro/ui-tests/invalid-items.stderr | 52 +++++++--- .../macro/ui-tests/invalid-static-string.rs | 10 ++ .../ui-tests/invalid-static-string.stderr | 14 +++ crates/test/src/rt/browser.rs | 5 +- crates/web-sys/tests/wasm/history.rs | 32 ++++--- crates/web-sys/tests/wasm/performance.rs | 4 +- .../src/dependent_module.rs | 4 +- .../indexing-getter-setter-deleter.md | 15 +-- guide/src/reference/static-js-objects.md | 9 +- src/lib.rs | 11 +-- tests/headless/strings.rs | 4 +- tests/non_wasm.rs | 3 +- tests/wasm/duplicates.rs | 20 ++-- tests/wasm/imports.rs | 14 +-- tests/wasm/node.rs | 3 +- 23 files changed, 266 insertions(+), 127 deletions(-) create mode 100644 crates/macro/ui-tests/invalid-static-string.rs create mode 100644 crates/macro/ui-tests/invalid-static-string.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f9997dd69..df7ad8a6217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,7 +72,7 @@ * Added an experimental Node.JS ES module target, in comparison the current `node` target uses CommonJS, with `--target experimental-nodejs-module` or when testing with `wasm_bindgen_test_configure!(run_in_node_experimental)`. [#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027) -* Added importing strings as `JsString` through `#[wasm_bindgen(static_string)] static STRING: JsString = "a string literal";`. +* Added importing strings as `JsString` through `#[wasm_bindgen(thread_local, static_string)] static STRING: JsString = "a string literal";`. [#4055](https://github.com/rustwasm/wasm-bindgen/pull/4055) ### Changed @@ -129,6 +129,12 @@ * Filtered files in published crates, significantly reducing the package size and notably excluding any bash files. [#4046](https://github.com/rustwasm/wasm-bindgen/pull/4046) +* Deprecated `JsStatic` in favor of `#[wasm_bindgen(thread_local)]`, which creates a `std::thread::LocalKey`. The syntax is otherwise the same. + [#4057](https://github.com/rustwasm/wasm-bindgen/pull/4057) + +* Removed `impl Deref for JsStatic` when compiling with `cfg(target_feature = "atomics")`, which was unsound. + [#4057](https://github.com/rustwasm/wasm-bindgen/pull/4057) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 3474d3a5a51..e10cf756ddd 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -275,6 +275,8 @@ pub struct ImportStatic { pub js_name: String, /// Path to wasm_bindgen pub wasm_bindgen: Path, + /// [`true`] if using the new `thread_local` representation. + pub thread_local: bool, } /// The type of a static string being imported diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index c826d67cb4d..4add9859cd6 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1645,15 +1645,42 @@ impl ToTokens for ast::Enum { impl ToTokens for ast::ImportStatic { fn to_tokens(&self, into: &mut TokenStream) { let ty = &self.ty; - static_import( - &self.vis, - &self.rust_name, - &self.wasm_bindgen, - ty, - ty, - &self.shim, - ) - .to_tokens(into); + + if self.thread_local { + thread_local_import( + &self.vis, + &self.rust_name, + &self.wasm_bindgen, + ty, + ty, + &self.shim, + ) + .to_tokens(into) + } else { + let vis = &self.vis; + let name = &self.rust_name; + let wasm_bindgen = &self.wasm_bindgen; + let ty = &self.ty; + let shim_name = &self.shim; + let init = static_init(wasm_bindgen, ty, shim_name); + + into.extend(quote! { + #[automatically_derived] + #[deprecated = "use with `#[wasm_bindgen(thread_local)]` instead"] + }); + into.extend( + quote_spanned! { name.span() => #vis static #name: #wasm_bindgen::JsStatic<#ty> = { + fn init() -> #ty { + #init + } + thread_local!(static _VAL: #ty = init();); + #wasm_bindgen::JsStatic { + __inner: &_VAL, + } + }; + }, + ); + } Descriptor { ident: &self.shim, @@ -1672,7 +1699,7 @@ impl ToTokens for ast::ImportString { let js_sys = &self.js_sys; let actual_ty: syn::Type = parse_quote!(#js_sys::JsString); - static_import( + thread_local_import( &self.vis, &self.rust_name, &self.wasm_bindgen, @@ -1684,7 +1711,7 @@ impl ToTokens for ast::ImportString { } } -fn static_import( +fn thread_local_import( vis: &syn::Visibility, name: &Ident, wasm_bindgen: &syn::Path, @@ -1692,33 +1719,37 @@ fn static_import( ty: &syn::Type, shim_name: &Ident, ) -> TokenStream { + let init = static_init(wasm_bindgen, ty, shim_name); + + quote! { + thread_local! { + #[automatically_derived] + #vis static #name: #actual_ty = { + #init + }; + } + } +} + +fn static_init(wasm_bindgen: &syn::Path, ty: &syn::Type, shim_name: &Ident) -> TokenStream { let abi_ret = quote! { #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; quote! { - #[automatically_derived] - #vis static #name: #wasm_bindgen::JsStatic<#actual_ty> = { - fn init() -> #ty { - #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] - extern "C" { - fn #shim_name() -> #abi_ret; - } + #[link(wasm_import_module = "__wbindgen_placeholder__")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + extern "C" { + fn #shim_name() -> #abi_ret; + } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] - unsafe fn #shim_name() -> #abi_ret { - panic!("cannot access imported statics on non-wasm targets") - } + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + unsafe fn #shim_name() -> #abi_ret { + panic!("cannot access imported statics on non-wasm targets") + } - unsafe { - <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name().join()) - } - } - thread_local!(static _VAL: #ty = init();); - #wasm_bindgen::JsStatic { - __inner: &_VAL, - } - }; + unsafe { + <#ty as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#shim_name().join()) + } } } diff --git a/crates/js-sys/tests/wasm/Function.rs b/crates/js-sys/tests/wasm/Function.rs index c87a46cca2d..f0f27dca123 100644 --- a/crates/js-sys/tests/wasm/Function.rs +++ b/crates/js-sys/tests/wasm/Function.rs @@ -5,13 +5,13 @@ use wasm_bindgen_test::*; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(js_name = max, js_namespace = Math)] + #[wasm_bindgen(thread_local, js_name = max, js_namespace = Math)] static MAX: Function; type ArrayPrototype; #[wasm_bindgen(method, getter, structural)] pub fn push(this: &ArrayPrototype) -> Function; - #[wasm_bindgen(js_name = prototype, js_namespace = Array)] + #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Array)] static ARRAY_PROTOTYPE2: ArrayPrototype; } @@ -21,12 +21,19 @@ fn apply() { args.push(&1.into()); args.push(&2.into()); args.push(&3.into()); - assert_eq!(MAX.apply(&JsValue::undefined(), &args).unwrap(), 3); + assert_eq!( + MAX.with(|max| max.apply(&JsValue::undefined(), &args)) + .unwrap(), + 3 + ); let arr = JsValue::from(Array::new()); let args = Array::new(); args.push(&1.into()); - ARRAY_PROTOTYPE2.push().apply(&arr, &args).unwrap(); + ARRAY_PROTOTYPE2 + .with(ArrayPrototype::push) + .apply(&arr, &args) + .unwrap(); assert_eq!(Array::from(&arr).length(), 1); } @@ -111,24 +118,29 @@ fn bind3() { #[wasm_bindgen_test] fn length() { - assert_eq!(MAX.length(), 2); - assert_eq!(ARRAY_PROTOTYPE2.push().length(), 1); + assert_eq!(MAX.with(Function::length), 2); + assert_eq!(ARRAY_PROTOTYPE2.with(ArrayPrototype::push).length(), 1); } #[wasm_bindgen_test] fn name() { - assert_eq!(JsValue::from(MAX.name()), "max"); - assert_eq!(JsValue::from(ARRAY_PROTOTYPE2.push().name()), "push"); + assert_eq!(JsValue::from(MAX.with(Function::name)), "max"); + assert_eq!( + JsValue::from(ARRAY_PROTOTYPE2.with(ArrayPrototype::push).name()), + "push" + ); } #[wasm_bindgen_test] fn to_string() { - assert!(MAX.to_string().length() > 0); + assert!(MAX.with(Function::to_string).length() > 0); } #[wasm_bindgen_test] fn function_inheritance() { - assert!(MAX.is_instance_of::()); - assert!(MAX.is_instance_of::()); - let _: &Object = MAX.as_ref(); + assert!(MAX.with(Function::is_instance_of::)); + assert!(MAX.with(Function::is_instance_of::)); + MAX.with(|max| { + let _: &Object = max.as_ref(); + }); } diff --git a/crates/js-sys/tests/wasm/Object.rs b/crates/js-sys/tests/wasm/Object.rs index 69db1af3af5..b97c31d0fbf 100644 --- a/crates/js-sys/tests/wasm/Object.rs +++ b/crates/js-sys/tests/wasm/Object.rs @@ -9,9 +9,9 @@ extern "C" { #[wasm_bindgen(method, setter, structural)] fn set_foo(this: &Foo42, val: JsValue); - #[wasm_bindgen(js_name = prototype, js_namespace = Object)] + #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Object)] static OBJECT_PROTOTYPE: JsValue; - #[wasm_bindgen(js_name = prototype, js_namespace = Array)] + #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Array)] static ARRAY_PROTOTYPE: JsValue; type DefinePropertyAttrs; @@ -32,9 +32,9 @@ extern "C" { #[wasm_bindgen(constructor)] fn new() -> Foo; - #[wasm_bindgen(js_name = prototype, js_namespace = Foo)] + #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Foo)] static FOO_PROTOTYPE: Object; - #[wasm_bindgen(js_name = prototype, js_namespace = Bar)] + #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Bar)] static BAR_PROTOTYPE: Object; } @@ -178,9 +178,9 @@ fn get_own_property_symbols() { #[wasm_bindgen_test] fn get_prototype_of() { let proto = JsValue::from(Object::get_prototype_of(&Object::new().into())); - assert_eq!(proto, *OBJECT_PROTOTYPE); + OBJECT_PROTOTYPE.with(|op| assert_eq!(proto, *op)); let proto = JsValue::from(Object::get_prototype_of(&Array::new().into())); - assert_eq!(proto, *ARRAY_PROTOTYPE); + ARRAY_PROTOTYPE.with(|ap| assert_eq!(proto, *ap)); } #[wasm_bindgen_test] @@ -249,8 +249,8 @@ fn is_sealed() { #[wasm_bindgen_test] fn is_prototype_of() { let foo = JsValue::from(Foo::new()); - assert!(FOO_PROTOTYPE.is_prototype_of(&foo)); - assert!(!BAR_PROTOTYPE.is_prototype_of(&foo)); + assert!(FOO_PROTOTYPE.with(|fp| fp.is_prototype_of(&foo))); + assert!(!BAR_PROTOTYPE.with(|bp| bp.is_prototype_of(&foo))); } #[wasm_bindgen_test] diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 3e3f3113a0e..bcc4d73932f 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -93,6 +93,7 @@ macro_rules! attrgen { (typescript_type, TypeScriptType(Span, String, Span)), (getter_with_clone, GetterWithClone(Span)), (static_string, StaticString(Span)), + (thread_local, ThreadLocal(Span)), // For testing purposes only. (assert_no_shim, AssertNoShim(Span)), @@ -753,6 +754,13 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option(T); #[wasm_bindgen] +#[rustfmt::skip] extern "C" { static mut FOO: u32; + #[wasm_bindgen(static_string)] + static FOO2: JsString; + + #[wasm_bindgen(thread_local, static_string)] + static FOO3: JsString; + + static FOO4: JsString = "test"; + + #[wasm_bindgen(static_string)] + static FOO5: JsString = "test"; + pub fn foo3(x: i32, ...); } #[wasm_bindgen] -extern "system" { -} +extern "system" {} #[wasm_bindgen] pub fn foo4() {} diff --git a/crates/macro/ui-tests/invalid-items.stderr b/crates/macro/ui-tests/invalid-items.stderr index 1800ade29d7..f985c96c070 100644 --- a/crates/macro/ui-tests/invalid-items.stderr +++ b/crates/macro/ui-tests/invalid-items.stderr @@ -17,43 +17,67 @@ error: structs with #[wasm_bindgen] cannot have lifetime or type parameters curr | ^^^ error: cannot import mutable globals yet - --> $DIR/invalid-items.rs:14:12 + --> $DIR/invalid-items.rs:15:12 | -14 | static mut FOO: u32; +15 | static mut FOO: u32; | ^^^ +error: static strings require a string literal + --> $DIR/invalid-items.rs:17:20 + | +17 | #[wasm_bindgen(static_string)] + | ^^^^^^^^^^^^^ + +error: static strings require a string literal + --> $DIR/invalid-items.rs:20:34 + | +20 | #[wasm_bindgen(thread_local, static_string)] + | ^^^^^^^^^^^^^ + +error: static strings require `#[wasm_bindgen(static_string)]` + --> $DIR/invalid-items.rs:23:5 + | +23 | static FOO4: JsString = "test"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: static strings require `#[wasm_bindgen(thread_local)]` + --> $DIR/invalid-items.rs:26:5 + | +26 | static FOO5: JsString = "test"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: can't #[wasm_bindgen] variadic functions - --> $DIR/invalid-items.rs:16:25 + --> $DIR/invalid-items.rs:28:25 | -16 | pub fn foo3(x: i32, ...); +28 | pub fn foo3(x: i32, ...); | ^^^ error: only foreign mods with the `C` ABI are allowed - --> $DIR/invalid-items.rs:20:8 + --> $DIR/invalid-items.rs:32:8 | -20 | extern "system" { +32 | extern "system" {} | ^^^^^^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:24:12 + --> $DIR/invalid-items.rs:35:12 | -24 | pub fn foo4() {} +35 | pub fn foo4() {} | ^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:26:12 + --> $DIR/invalid-items.rs:37:12 | -26 | pub fn foo5<'a>() {} +37 | pub fn foo5<'a>() {} | ^^^^ error: can't #[wasm_bindgen] functions with lifetime or type parameters - --> $DIR/invalid-items.rs:28:12 + --> $DIR/invalid-items.rs:39:12 | -28 | pub fn foo6<'a, T>() {} +39 | pub fn foo6<'a, T>() {} | ^^^^^^^ error: #[wasm_bindgen] can only be applied to a function, struct, enum, impl, or extern block - --> $DIR/invalid-items.rs:31:1 + --> $DIR/invalid-items.rs:42:1 | -31 | trait X {} +42 | trait X {} | ^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-static-string.rs b/crates/macro/ui-tests/invalid-static-string.rs new file mode 100644 index 00000000000..7b50b1079b0 --- /dev/null +++ b/crates/macro/ui-tests/invalid-static-string.rs @@ -0,0 +1,10 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +#[rustfmt::skip] +extern "C" { + #[wasm_bindgen(thread_local, static_string)] + static FOO: JsValue = "test"; +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-static-string.stderr b/crates/macro/ui-tests/invalid-static-string.stderr new file mode 100644 index 00000000000..7d1872a10ec --- /dev/null +++ b/crates/macro/ui-tests/invalid-static-string.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/invalid-static-string.rs:3:1 + | +3 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ + | | + | expected `JsString`, found `JsValue` + | expected `JsString` because of return type + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) +help: call `Into::into` on this expression to convert `wasm_bindgen::JsValue` into `JsString` + | +3 | #[wasm_bindgen].into() + | +++++++ diff --git a/crates/test/src/rt/browser.rs b/crates/test/src/rt/browser.rs index fc576f6db30..49b27725e75 100644 --- a/crates/test/src/rt/browser.rs +++ b/crates/test/src/rt/browser.rs @@ -19,7 +19,8 @@ pub struct Browser { #[wasm_bindgen] extern "C" { type HTMLDocument; - static document: HTMLDocument; + #[wasm_bindgen(thread_local, js_name = document)] + static DOCUMENT: HTMLDocument; #[wasm_bindgen(method, structural)] fn getElementById(this: &HTMLDocument, id: &str) -> Element; @@ -38,7 +39,7 @@ impl Browser { /// Creates a new instance of `Browser`, assuming that its APIs will work /// (requires `Node::new()` to have return `None` first). pub fn new() -> Browser { - let pre = document.getElementById("output"); + let pre = DOCUMENT.with(|document| document.getElementById("output")); pre.set_text_content(""); Browser { pre } } diff --git a/crates/web-sys/tests/wasm/history.rs b/crates/web-sys/tests/wasm/history.rs index f3ecdc42eb0..e2800520eb9 100644 --- a/crates/web-sys/tests/wasm/history.rs +++ b/crates/web-sys/tests/wasm/history.rs @@ -4,25 +4,27 @@ use web_sys::{History, ScrollRestoration}; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(js_name = history, js_namespace = window)] + #[wasm_bindgen(thread_local, js_name = history, js_namespace = window)] static HISTORY: History; } #[wasm_bindgen_test] fn history() { - HISTORY - .set_scroll_restoration(ScrollRestoration::Manual) - .expect("failure to set scroll restoration"); - assert_eq!( - HISTORY.scroll_restoration().unwrap(), - ScrollRestoration::Manual - ); + HISTORY.with(|history| { + history + .set_scroll_restoration(ScrollRestoration::Manual) + .expect("failure to set scroll restoration"); + assert_eq!( + history.scroll_restoration().unwrap(), + ScrollRestoration::Manual + ); - HISTORY - .set_scroll_restoration(ScrollRestoration::Auto) - .expect("failure to set scroll restoration"); - assert_eq!( - HISTORY.scroll_restoration().unwrap(), - ScrollRestoration::Auto - ); + history + .set_scroll_restoration(ScrollRestoration::Auto) + .expect("failure to set scroll restoration"); + assert_eq!( + history.scroll_restoration().unwrap(), + ScrollRestoration::Auto + ); + }); } diff --git a/crates/web-sys/tests/wasm/performance.rs b/crates/web-sys/tests/wasm/performance.rs index 84931a627cd..09fb59a66a1 100644 --- a/crates/web-sys/tests/wasm/performance.rs +++ b/crates/web-sys/tests/wasm/performance.rs @@ -4,12 +4,12 @@ use web_sys::Performance; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(js_name = performance)] + #[wasm_bindgen(thread_local, js_name = performance)] static PERFORMANCE: Performance; } #[wasm_bindgen_test] fn to_json() { - let perf = JsValue::from(PERFORMANCE.to_json()); + let perf = JsValue::from(PERFORMANCE.with(Performance::to_json)); assert!(perf.is_object()); } diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs index ce7f038fdcd..5e074d72b0b 100644 --- a/examples/wasm-audio-worklet/src/dependent_module.rs +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -12,7 +12,7 @@ extern "C" { #[wasm_bindgen(method, getter)] fn url(this: &ImportMeta) -> JsString; - #[wasm_bindgen(js_namespace = import, js_name = meta)] + #[wasm_bindgen(thread_local, js_namespace = import, js_name = meta)] static IMPORT_META: ImportMeta; } @@ -20,7 +20,7 @@ pub fn on_the_fly(code: &str) -> Result { // Generate the import of the bindgen ES module, assuming `--target web`. let header = format!( "import init, * as bindgen from '{}';\n\n", - IMPORT_META.url(), + IMPORT_META.with(ImportMeta::url), ); let options = BlobPropertyBag::new(); diff --git a/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md b/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md index 5dad7d461a7..0d0443cb001 100644 --- a/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md +++ b/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md @@ -60,7 +60,8 @@ on methods: #[wasm_bindgen] extern "C" { type Foo; - static foo: Foo; + #[wasm_bindgen(thread_local)] + static FOO: Foo; #[wasm_bindgen(method, structural, indexing_getter)] fn get(this: &Foo, prop: &str) -> u32; @@ -72,11 +73,13 @@ extern "C" { fn delete(this: &Foo, prop: &str); } -assert_eq!(foo.get("ten"), 3); +FOO.with(|foo| { + assert_eq!(foo.get("ten"), 3); -foo.set("ten", 10); -assert_eq!(foo.get("ten"), 10); + foo.set("ten", 10); + assert_eq!(foo.get("ten"), 10); -foo.delete("ten"); -assert_eq!(foo.get("ten"), 3); + foo.delete("ten"); + assert_eq!(foo.get("ten"), 3); +}); ``` diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md index 9c15fcbb3d5..2402098e606 100644 --- a/guide/src/reference/static-js-objects.md +++ b/guide/src/reference/static-js-objects.md @@ -19,11 +19,12 @@ let COLORS = { ```rust #[wasm_bindgen] extern "C" { + #[wasm_bindgen(thread_local)] static COLORS; } fn get_colors() -> JsValue { - COLORS.clone() + COLORS.with(JsValue::clone) } ``` @@ -49,11 +50,11 @@ The binding for this module: #[wasm_bindgen(module = "/js/some-rollup.js")] extern "C" { // Likewise with the namespace--this refers to the object directly. - #[wasm_bindgen(js_name = namespace)] + #[wasm_bindgen(thread_local, js_name = namespace)] static NAMESPACE: JsValue; // Refer to SomeType's class - #[wasm_bindgen(js_name = SomeType)] + #[wasm_bindgen(thread_local, js_name = SomeType)] static SOME_TYPE: JsValue; // Other bindings for SomeType @@ -70,7 +71,7 @@ Strings can be imported to avoid going through `TextDecoder/Encoder` when requir ```rust #[wasm_bindgen] extern "C" { - #[wasm_bindgen(static_string)] + #[wasm_bindgen(thread_local, static_string)] static STRING: JsString = "a string literal"; } ``` diff --git a/src/lib.rs b/src/lib.rs index a691426994c..e8e30b9aa95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1185,23 +1185,18 @@ impl Default for JsValue { /// This type implements `Deref` to the inner type so it's typically used as if /// it were `&T`. #[cfg(feature = "std")] +#[deprecated = "use with `#[wasm_bindgen(thread_local)]` instead"] pub struct JsStatic { #[doc(hidden)] pub __inner: &'static std::thread::LocalKey, } #[cfg(feature = "std")] +#[allow(deprecated)] +#[cfg(not(target_feature = "atomics"))] impl Deref for JsStatic { type Target = T; fn deref(&self) -> &T { - // We know that our tls key is never overwritten after initialization, - // so it should be safe (on that axis at least) to hand out a reference - // that lives longer than the closure below. - // - // FIXME: this is not sound if we ever implement thread exit hooks on - // wasm, as the pointer will eventually be invalidated but you can get - // `&'static T` from this interface. We... probably need to deprecate - // and/or remove this interface nowadays. unsafe { self.__inner.with(|ptr| &*(ptr as *const T)) } } } diff --git a/tests/headless/strings.rs b/tests/headless/strings.rs index 944db5f2e56..baa551b8950 100644 --- a/tests/headless/strings.rs +++ b/tests/headless/strings.rs @@ -15,7 +15,7 @@ fn string_roundtrip() { assert_eq!("\u{feff}bar", &identity("\u{feff}bar")); - assert_eq!(String::from(&*STRING), "foo") + assert_eq!(STRING.with(|s| String::from(s)), "foo"); } #[wasm_bindgen] @@ -23,6 +23,6 @@ fn string_roundtrip() { // See . #[rustfmt::skip] extern "C" { - #[wasm_bindgen(static_string)] + #[wasm_bindgen(thread_local, static_string)] static STRING: JsString = "foo"; } diff --git a/tests/non_wasm.rs b/tests/non_wasm.rs index dd770732302..ca8acad3b58 100644 --- a/tests/non_wasm.rs +++ b/tests/non_wasm.rs @@ -31,13 +31,14 @@ pub fn foo(x: bool) { #[wasm_bindgen] extern "C" { fn some_import(); + #[wasm_bindgen(thread_local)] static A: JsValue; } #[wasm_bindgen] pub fn bar(_: &str) -> JsValue { some_import(); - A.clone() + A.with(JsValue::clone) } #[wasm_bindgen] diff --git a/tests/wasm/duplicates.rs b/tests/wasm/duplicates.rs index 206fede7183..348f67b8cd0 100644 --- a/tests/wasm/duplicates.rs +++ b/tests/wasm/duplicates.rs @@ -6,7 +6,8 @@ pub mod same_function_different_locations_a { #[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] extern "C" { pub fn foo(); - pub static bar: JsValue; + #[wasm_bindgen(thread_local, js_name = bar)] + pub static BAR: JsValue; } } @@ -16,7 +17,8 @@ pub mod same_function_different_locations_b { #[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] extern "C" { pub fn foo(); - pub static bar: JsValue; + #[wasm_bindgen(thread_local, js_name = bar)] + pub static BAR: JsValue; } } @@ -24,8 +26,8 @@ pub mod same_function_different_locations_b { fn same_function_different_locations() { same_function_different_locations_a::foo(); same_function_different_locations_b::foo(); - assert_eq!(*same_function_different_locations_a::bar, 3); - assert_eq!(*same_function_different_locations_a::bar, 3); + same_function_different_locations_a::BAR.with(|bar| assert_eq!(*bar, 3)); + same_function_different_locations_a::BAR.with(|bar| assert_eq!(*bar, 3)); } pub mod same_function_different_modules_a { @@ -34,7 +36,8 @@ pub mod same_function_different_modules_a { #[wasm_bindgen(module = "tests/wasm/duplicates_b.js")] extern "C" { pub fn foo() -> bool; - pub static bar: JsValue; + #[wasm_bindgen(thread_local, js_name = bar)] + pub static BAR: JsValue; } } @@ -44,7 +47,8 @@ pub mod same_function_different_modules_b { #[wasm_bindgen(module = "tests/wasm/duplicates_c.js")] extern "C" { pub fn foo() -> bool; - pub static bar: JsValue; + #[wasm_bindgen(thread_local, js_name = bar)] + pub static BAR: JsValue; } } @@ -52,6 +56,6 @@ pub mod same_function_different_modules_b { fn same_function_different_modules() { assert!(same_function_different_modules_a::foo()); assert!(!same_function_different_modules_b::foo()); - assert_eq!(*same_function_different_modules_a::bar, 4); - assert_eq!(*same_function_different_modules_b::bar, 5); + same_function_different_modules_a::BAR.with(|bar| assert_eq!(*bar, 4)); + same_function_different_modules_b::BAR.with(|bar| assert_eq!(*bar, 5)); } diff --git a/tests/wasm/imports.rs b/tests/wasm/imports.rs index a9fbb33b7b1..aa5a8b4f038 100644 --- a/tests/wasm/imports.rs +++ b/tests/wasm/imports.rs @@ -23,6 +23,7 @@ extern "C" { fn assert_valid_error(val: JsValue); + #[wasm_bindgen(thread_local)] static IMPORT: JsValue; #[wasm_bindgen(js_name = return_three)] @@ -35,7 +36,7 @@ extern "C" { #[allow(non_camel_case_types)] type bar; - #[wasm_bindgen(js_namespace = bar, js_name = foo)] + #[wasm_bindgen(thread_local, js_namespace = bar, js_name = foo)] static FOO: JsValue; fn take_custom_type(f: CustomType) -> CustomType; @@ -46,7 +47,7 @@ extern "C" { #[wasm_bindgen(js_name = "baz$")] fn renamed_with_dollar_sign(); - #[wasm_bindgen(js_name = "$foo")] + #[wasm_bindgen(thread_local, js_name = "$foo")] static RENAMED: JsValue; fn unused_import(); @@ -57,6 +58,7 @@ extern "C" { #[wasm_bindgen(static_method_of = StaticMethodCheck)] fn static_method_of_right_this(); + #[wasm_bindgen(thread_local)] static STATIC_STRING: String; #[derive(Clone)] @@ -170,7 +172,7 @@ fn free_imports() { #[wasm_bindgen_test] fn import_a_field() { - assert_eq!(IMPORT.as_f64(), Some(1.0)); + assert_eq!(IMPORT.with(JsValue::as_f64), Some(1.0)); } #[wasm_bindgen_test] @@ -190,7 +192,7 @@ fn rust_keyword() { #[wasm_bindgen_test] fn rust_keyword2() { - assert_eq!(FOO.as_f64(), Some(3.0)); + assert_eq!(FOO.with(JsValue::as_f64), Some(3.0)); } #[wasm_bindgen_test] @@ -222,7 +224,7 @@ fn rename_with_string() { #[wasm_bindgen_test] fn rename_static_with_string() { - assert_eq!(RENAMED.as_f64(), Some(1.0)); + assert_eq!(RENAMED.with(JsValue::as_f64), Some(1.0)); } #[wasm_bindgen_test] @@ -285,7 +287,7 @@ fn undefined_function_is_ok() { #[wasm_bindgen_test] fn static_string_ok() { - assert_eq!(*STATIC_STRING, "x"); + STATIC_STRING.with(|s| assert_eq!(*s, "x")); } #[wasm_bindgen_test] diff --git a/tests/wasm/node.rs b/tests/wasm/node.rs index 8f57e1731d1..59f43eb71d9 100644 --- a/tests/wasm/node.rs +++ b/tests/wasm/node.rs @@ -4,6 +4,7 @@ use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/node.js")] extern "C" { fn test_works(); + #[wasm_bindgen(thread_local)] static FOO: JsValue; fn hit(); } @@ -11,7 +12,7 @@ extern "C" { #[wasm_bindgen_test] fn works() { hit(); - assert_eq!(FOO.as_f64(), Some(1.0)); + assert_eq!(FOO.with(JsValue::as_f64), Some(1.0)); test_works(); } From 2ea6ab1c9402ac13c361d7cfe9818bea006cf9bd Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 7 Aug 2024 00:21:40 +0200 Subject: [PATCH 457/641] Improve the CI runtime (#4056) --- .github/workflows/main.yml | 94 ++++++++++++++++++- _package.json | 13 ++- crates/js-sys/src/lib.rs | 2 +- examples/add/package.json | 9 +- examples/add/webpack.config.js | 6 -- examples/canvas/package.json | 9 +- examples/canvas/webpack.config.js | 6 -- examples/char/package.json | 9 +- examples/char/webpack.config.js | 6 -- examples/closures/package.json | 9 +- examples/closures/webpack.config.js | 6 -- examples/console_log/package.json | 9 +- examples/console_log/webpack.config.js | 6 -- examples/dom/package.json | 9 +- examples/dom/webpack.config.js | 6 -- examples/duck-typed-interfaces/package.json | 9 +- .../duck-typed-interfaces/webpack.config.js | 6 -- examples/fetch/package.json | 9 +- examples/fetch/webpack.config.js | 6 -- .../package.json | 9 +- .../webpack.config.js | 6 -- examples/hello_world/package.json | 9 +- examples/hello_world/webpack.config.js | 6 -- examples/import_js/package.json | 9 +- examples/import_js/webpack.config.js | 6 -- examples/julia_set/package.json | 9 +- examples/julia_set/webpack.config.js | 6 -- examples/paint/package.json | 9 +- examples/paint/webpack.config.js | 6 -- examples/performance/package.json | 9 +- examples/performance/webpack.config.js | 6 -- examples/request-animation-frame/package.json | 11 +-- .../request-animation-frame/webpack.config.js | 6 -- examples/todomvc/package.json | 13 ++- examples/todomvc/webpack.config.js | 6 -- examples/wasm-in-wasm-imports/package.json | 9 +- .../wasm-in-wasm-imports/webpack.config.js | 6 -- examples/wasm-in-wasm/package.json | 9 +- examples/wasm-in-wasm/webpack.config.js | 6 -- examples/weather_report/package.json | 9 +- examples/weather_report/webpack.config.js | 6 -- examples/webaudio/package.json | 9 +- examples/webaudio/webpack.config.js | 6 -- examples/webgl/package.json | 9 +- examples/webgl/webpack.config.js | 6 -- examples/webrtc_datachannel/package.json | 9 +- examples/webrtc_datachannel/webpack.config.js | 6 -- examples/webxr/package.json | 9 +- examples/webxr/webpack.config.js | 6 -- 49 files changed, 191 insertions(+), 269 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02e750ec043..fcc080ee31c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,7 @@ on: tags-ignore: [dev] pull_request: branches: [main] + workflow_dispatch: defaults: run: shell: bash @@ -53,7 +54,6 @@ jobs: - run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings - - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings @@ -66,11 +66,30 @@ jobs: - run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-interpreter -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings - run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings + - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings + + # Run `cargo clippy` over web-sys and js-sys crates + clippy_web_sys: + name: Clippy (web-sys) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings + + # Run `cargo clippy` over the project + clippy_project: + name: Clippy (project) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings - - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings - run: for i in examples/*/; do cd "$i"; cargo +stable clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings || exit 1; cd ../..; done test_wasm_bindgen: @@ -87,12 +106,52 @@ jobs: node-version: '20' - uses: ./.github/actions/setup-geckodriver - run: cargo test --target wasm32-unknown-unknown + - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures + + test_wasm_bindgen_features: + name: "Run wasm-bindgen crate tests with different features" + runs-on: ubuntu-latest + env: + WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - uses: actions/setup-node@v4 + with: + node-version: '20' + - uses: ./.github/actions/setup-geckodriver - run: cargo test --target wasm32-unknown-unknown --features serde-serialize - run: cargo test --target wasm32-unknown-unknown --features enable-interning - - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures + + test_wasm_bindgen_wasm: + name: "Run wasm-bindgen wasm test" + runs-on: ubuntu-latest + env: + WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - uses: actions/setup-node@v4 + with: + node-version: '20' - run: cargo test --target wasm32-unknown-unknown --test wasm env: WASM_BINDGEN_NO_DEBUG: 1 + + test_wasm_bindgen_envs: + name: "Run wasm-bindgen crate tests with various environment variables" + runs-on: ubuntu-latest + env: + WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - uses: actions/setup-node@v4 + with: + node-version: '20' - run: cargo test --target wasm32-unknown-unknown env: WASM_BINDGEN_EXTERNREF: 1 @@ -171,7 +230,31 @@ jobs: - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window + + test_web_sys_all_features: + name: "Run web-sys crate tests with all features" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - uses: actions/setup-node@v4 + with: + node-version: '20' + - uses: ./.github/actions/setup-geckodriver - run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features + + test_web_sys_all_features_unstable: + name: "Run web-sys crate tests with all features and unstable APIs" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - uses: actions/setup-node@v4 + with: + node-version: '20' + - uses: ./.github/actions/setup-geckodriver - run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features env: RUSTFLAGS: --cfg=web_sys_unstable_apis @@ -448,7 +531,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update 1.57 && rustup default 1.57 - run: cargo build - + msrv-cli: name: Check MSRV for CLI tools runs-on: ubuntu-latest @@ -459,12 +542,13 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update 1.76 && rustup default 1.76 - run: cargo build - + deploy: permissions: contents: write # to push changes in repo (jamesives/github-pages-deploy-action) + if: github.repository == 'rustwasm/wasm-bindgen' needs: - doc_api - doc_book diff --git a/_package.json b/_package.json index f69515ae85b..d347502d91f 100644 --- a/_package.json +++ b/_package.json @@ -5,12 +5,11 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "css-loader": "^6.8.1", - "html-webpack-plugin": "^5.3.2", - "mini-css-extract-plugin": "^2.7.6", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^3.11.2" + "css-loader": "^7.1.2", + "html-webpack-plugin": "^5.6.0", + "mini-css-extract-plugin": "^2.9.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "5.0.4" } } diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 3c1196b7e51..a9f57d0c20e 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -2835,7 +2835,7 @@ macro_rules! number_try_from { #[inline] fn try_from(x: $x) -> Result { let x_f64 = x as f64; - if x_f64 >= Number::MIN_SAFE_INTEGER && x_f64 <= Number::MAX_SAFE_INTEGER { + if (Number::MIN_SAFE_INTEGER..=Number::MAX_SAFE_INTEGER).contains(&x_f64) { Ok(Number::from(x_f64)) } else { Err(TryFromIntError(())) diff --git a/examples/add/package.json b/examples/add/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/add/package.json +++ b/examples/add/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/add/webpack.config.js b/examples/add/webpack.config.js index 0e3fcd8b930..84d67fcf25c 100644 --- a/examples/add/webpack.config.js +++ b/examples/add/webpack.config.js @@ -14,12 +14,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/canvas/package.json b/examples/canvas/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/canvas/package.json +++ b/examples/canvas/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/canvas/webpack.config.js b/examples/canvas/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/canvas/webpack.config.js +++ b/examples/canvas/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/char/package.json b/examples/char/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/char/package.json +++ b/examples/char/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/char/webpack.config.js b/examples/char/webpack.config.js index b75134c3f5d..3b17bdb664c 100644 --- a/examples/char/webpack.config.js +++ b/examples/char/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/closures/package.json b/examples/closures/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/closures/package.json +++ b/examples/closures/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/closures/webpack.config.js b/examples/closures/webpack.config.js index 0d85b51793f..aac81329b2e 100644 --- a/examples/closures/webpack.config.js +++ b/examples/closures/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/console_log/package.json b/examples/console_log/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/console_log/package.json +++ b/examples/console_log/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/console_log/webpack.config.js b/examples/console_log/webpack.config.js index 0e3fcd8b930..84d67fcf25c 100644 --- a/examples/console_log/webpack.config.js +++ b/examples/console_log/webpack.config.js @@ -14,12 +14,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/dom/package.json b/examples/dom/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/dom/package.json +++ b/examples/dom/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/dom/webpack.config.js b/examples/dom/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/dom/webpack.config.js +++ b/examples/dom/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/duck-typed-interfaces/package.json b/examples/duck-typed-interfaces/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/duck-typed-interfaces/package.json +++ b/examples/duck-typed-interfaces/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/duck-typed-interfaces/webpack.config.js b/examples/duck-typed-interfaces/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/duck-typed-interfaces/webpack.config.js +++ b/examples/duck-typed-interfaces/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/fetch/package.json b/examples/fetch/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/fetch/package.json +++ b/examples/fetch/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/fetch/webpack.config.js b/examples/fetch/webpack.config.js index 0e3fcd8b930..84d67fcf25c 100644 --- a/examples/fetch/webpack.config.js +++ b/examples/fetch/webpack.config.js @@ -14,12 +14,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/guide-supported-types-examples/package.json b/examples/guide-supported-types-examples/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/guide-supported-types-examples/package.json +++ b/examples/guide-supported-types-examples/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/guide-supported-types-examples/webpack.config.js b/examples/guide-supported-types-examples/webpack.config.js index 0e3fcd8b930..84d67fcf25c 100644 --- a/examples/guide-supported-types-examples/webpack.config.js +++ b/examples/guide-supported-types-examples/webpack.config.js @@ -14,12 +14,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/hello_world/package.json b/examples/hello_world/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/hello_world/package.json +++ b/examples/hello_world/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/hello_world/webpack.config.js b/examples/hello_world/webpack.config.js index 0e3fcd8b930..84d67fcf25c 100644 --- a/examples/hello_world/webpack.config.js +++ b/examples/hello_world/webpack.config.js @@ -14,12 +14,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/import_js/package.json b/examples/import_js/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/import_js/package.json +++ b/examples/import_js/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/import_js/webpack.config.js b/examples/import_js/webpack.config.js index fa5fce2316f..45d8bde807f 100644 --- a/examples/import_js/webpack.config.js +++ b/examples/import_js/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, "crate") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/julia_set/package.json b/examples/julia_set/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/julia_set/package.json +++ b/examples/julia_set/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/julia_set/webpack.config.js b/examples/julia_set/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/julia_set/webpack.config.js +++ b/examples/julia_set/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/paint/package.json b/examples/paint/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/paint/package.json +++ b/examples/paint/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/paint/webpack.config.js b/examples/paint/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/paint/webpack.config.js +++ b/examples/paint/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/performance/package.json b/examples/performance/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/performance/package.json +++ b/examples/performance/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/performance/webpack.config.js b/examples/performance/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/performance/webpack.config.js +++ b/examples/performance/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/request-animation-frame/package.json b/examples/request-animation-frame/package.json index 8b08e487074..e9feb6b10f8 100644 --- a/examples/request-animation-frame/package.json +++ b/examples/request-animation-frame/package.json @@ -1,14 +1,13 @@ { "scripts": { "build": "webpack", - "serve" : "webpack serve" + "serve": "webpack serve" }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "text-encoding": "^0.7.0", - "html-webpack-plugin": "^5.3.2", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^3.11.2" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^3.11.3" } } diff --git a/examples/request-animation-frame/webpack.config.js b/examples/request-animation-frame/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/request-animation-frame/webpack.config.js +++ b/examples/request-animation-frame/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/todomvc/package.json b/examples/todomvc/package.json index 8d72e6a97a3..889bc2b653f 100644 --- a/examples/todomvc/package.json +++ b/examples/todomvc/package.json @@ -5,12 +5,11 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "css-loader": "^6.8.1", - "html-webpack-plugin": "^5.3.2", - "mini-css-extract-plugin": "^2.7.6", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "css-loader": "^6.11.0", + "html-webpack-plugin": "^5.6.0", + "mini-css-extract-plugin": "^2.9.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/todomvc/webpack.config.js b/examples/todomvc/webpack.config.js index 27eafe3279d..cee2b6b7ed8 100644 --- a/examples/todomvc/webpack.config.js +++ b/examples/todomvc/webpack.config.js @@ -18,12 +18,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/wasm-in-wasm-imports/package.json b/examples/wasm-in-wasm-imports/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/wasm-in-wasm-imports/package.json +++ b/examples/wasm-in-wasm-imports/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/wasm-in-wasm-imports/webpack.config.js b/examples/wasm-in-wasm-imports/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/wasm-in-wasm-imports/webpack.config.js +++ b/examples/wasm-in-wasm-imports/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/wasm-in-wasm/package.json b/examples/wasm-in-wasm/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/wasm-in-wasm/package.json +++ b/examples/wasm-in-wasm/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/wasm-in-wasm/webpack.config.js b/examples/wasm-in-wasm/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/wasm-in-wasm/webpack.config.js +++ b/examples/wasm-in-wasm/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/weather_report/package.json b/examples/weather_report/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/weather_report/package.json +++ b/examples/weather_report/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/weather_report/webpack.config.js b/examples/weather_report/webpack.config.js index 2562545703f..7e6b1687d5e 100644 --- a/examples/weather_report/webpack.config.js +++ b/examples/weather_report/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/webaudio/package.json b/examples/webaudio/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/webaudio/package.json +++ b/examples/webaudio/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/webaudio/webpack.config.js b/examples/webaudio/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/webaudio/webpack.config.js +++ b/examples/webaudio/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/webgl/package.json b/examples/webgl/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/webgl/package.json +++ b/examples/webgl/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/webgl/webpack.config.js b/examples/webgl/webpack.config.js index 18329afd80d..7db80e9dfce 100644 --- a/examples/webgl/webpack.config.js +++ b/examples/webgl/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/webrtc_datachannel/package.json b/examples/webrtc_datachannel/package.json index 8332534cfb4..5dc619b4a6b 100644 --- a/examples/webrtc_datachannel/package.json +++ b/examples/webrtc_datachannel/package.json @@ -5,10 +5,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/webrtc_datachannel/webpack.config.js b/examples/webrtc_datachannel/webpack.config.js index 95559a4445e..b1d31d4f38e 100644 --- a/examples/webrtc_datachannel/webpack.config.js +++ b/examples/webrtc_datachannel/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { diff --git a/examples/webxr/package.json b/examples/webxr/package.json index 91598ef379d..ec5924d6f4f 100644 --- a/examples/webxr/package.json +++ b/examples/webxr/package.json @@ -8,10 +8,9 @@ }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", - "html-webpack-plugin": "^5.3.2", - "text-encoding": "^0.7.0", - "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" + "html-webpack-plugin": "^5.6.0", + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4" } } diff --git a/examples/webxr/webpack.config.js b/examples/webxr/webpack.config.js index 18329afd80d..7db80e9dfce 100644 --- a/examples/webxr/webpack.config.js +++ b/examples/webxr/webpack.config.js @@ -16,12 +16,6 @@ module.exports = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, ".") }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ['text-encoding', 'TextDecoder'], - TextEncoder: ['text-encoding', 'TextEncoder'] - }) ], mode: 'development', experiments: { From 9a584e9be7ba2c838a8b058513b927a0a588ce88 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 11 Aug 2024 12:36:30 +0200 Subject: [PATCH 458/641] Update WebGPU (#4062) - Appropriately mark WebGPU functions with `[Throws]`. - Add support for `AllowSharedBufferSource`. - Add support for optional arguments followed by non-optional ones. --- CHANGELOG.md | 3 + crates/cli/tests/reference/raw.js | 48 +++---- crates/web-sys/Cargo.toml | 2 + crates/web-sys/src/features/gen_GpuAdapter.rs | 13 ++ .../src/features/gen_GpuBlendFactor.rs | 4 + crates/web-sys/src/features/gen_GpuBuffer.rs | 34 +++-- .../features/gen_GpuCanvasConfiguration.rs | 27 ++++ .../src/features/gen_GpuCanvasContext.rs | 11 +- .../src/features/gen_GpuCanvasToneMapping.rs | 64 +++++++++ .../features/gen_GpuCanvasToneMappingMode.rs | 16 +++ .../src/features/gen_GpuCommandEncoder.rs | 28 ++-- .../src/features/gen_GpuComputePassEncoder.rs | 8 +- crates/web-sys/src/features/gen_GpuDevice.rs | 41 +++--- .../src/features/gen_GpuFeatureName.rs | 3 + .../src/features/gen_GpuPipelineError.rs | 17 ++- crates/web-sys/src/features/gen_GpuQueue.rs | 136 +++++++++--------- .../features/gen_GpuRenderBundleEncoder.rs | 8 +- .../src/features/gen_GpuRenderPassEncoder.rs | 16 +-- crates/web-sys/src/features/gen_GpuTexture.rs | 8 +- crates/web-sys/src/features/mod.rs | 14 ++ crates/web-sys/webidls/unstable/WebGPU.webidl | 130 +++++++++++------ crates/webidl/src/idl_type.rs | 61 +++++--- crates/webidl/src/util.rs | 128 ++++++++++------- 23 files changed, 546 insertions(+), 274 deletions(-) create mode 100644 crates/web-sys/src/features/gen_GpuCanvasToneMapping.rs create mode 100644 crates/web-sys/src/features/gen_GpuCanvasToneMappingMode.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index df7ad8a6217..8eed5b1fd78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -135,6 +135,9 @@ * Removed `impl Deref for JsStatic` when compiling with `cfg(target_feature = "atomics")`, which was unsound. [#4057](https://github.com/rustwasm/wasm-bindgen/pull/4057) +* Updated the WebGPU WebIDL to the current draft as of 2024-08-05. + [#4062](https://github.com/rustwasm/wasm-bindgen/pull/4062) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 3432d150366..6b831debb89 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -45,6 +25,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 3572c835e17..9527a00b5a3 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -495,6 +495,8 @@ GpuBufferMapState = [] GpuCanvasAlphaMode = [] GpuCanvasConfiguration = [] GpuCanvasContext = [] +GpuCanvasToneMapping = [] +GpuCanvasToneMappingMode = [] GpuColorDict = [] GpuColorTargetState = [] GpuCommandBuffer = [] diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 760614c78ef..53ac082e5b9 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -41,6 +41,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn limits(this: &GpuAdapter) -> GpuSupportedLimits; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAdapterInfo")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = info)] + #[doc = "Getter for the `info` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/info)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuAdapterInfo`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn info(this: &GpuAdapter) -> GpuAdapterInfo; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isFallbackAdapter)] #[doc = "Getter for the `isFallbackAdapter` field of this object."] #[doc = ""] @@ -61,6 +73,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[deprecated] pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] diff --git a/crates/web-sys/src/features/gen_GpuBlendFactor.rs b/crates/web-sys/src/features/gen_GpuBlendFactor.rs index a8de869f3a7..6ae84672461 100644 --- a/crates/web-sys/src/features/gen_GpuBlendFactor.rs +++ b/crates/web-sys/src/features/gen_GpuBlendFactor.rs @@ -24,4 +24,8 @@ pub enum GpuBlendFactor { SrcAlphaSaturated = "src-alpha-saturated", Constant = "constant", OneMinusConstant = "one-minus-constant", + Src1 = "src1", + OneMinusSrc1 = "one-minus-src1", + Src1Alpha = "src1-alpha", + OneMinusSrc1Alpha = "one-minus-src1-alpha", } diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index 436ba800c97..2b51482df29 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -84,7 +84,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn destroy(this: &GpuBuffer); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -93,9 +93,9 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_mapped_range(this: &GpuBuffer) -> ::js_sys::ArrayBuffer; + pub fn get_mapped_range(this: &GpuBuffer) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -104,9 +104,12 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_mapped_range_with_u32(this: &GpuBuffer, offset: u32) -> ::js_sys::ArrayBuffer; + pub fn get_mapped_range_with_u32( + this: &GpuBuffer, + offset: u32, + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -115,9 +118,12 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_mapped_range_with_f64(this: &GpuBuffer, offset: f64) -> ::js_sys::ArrayBuffer; + pub fn get_mapped_range_with_f64( + this: &GpuBuffer, + offset: f64, + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -130,9 +136,9 @@ extern "C" { this: &GpuBuffer, offset: u32, size: u32, - ) -> ::js_sys::ArrayBuffer; + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -145,9 +151,9 @@ extern "C" { this: &GpuBuffer, offset: f64, size: u32, - ) -> ::js_sys::ArrayBuffer; + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -160,9 +166,9 @@ extern "C" { this: &GpuBuffer, offset: u32, size: f64, - ) -> ::js_sys::ArrayBuffer; + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] #[doc = "The `getMappedRange()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] @@ -175,7 +181,7 @@ extern "C" { this: &GpuBuffer, offset: f64, size: f64, - ) -> ::js_sys::ArrayBuffer; + ) -> Result<::js_sys::ArrayBuffer, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] #[doc = "The `mapAsync()` method."] diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index 220fcebe4d7..956cb9494c3 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -75,6 +75,26 @@ extern "C" { #[wasm_bindgen(method, setter = "format")] pub fn set_format(this: &GpuCanvasConfiguration, val: GpuTextureFormat); #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMapping")] + #[doc = "Get the `toneMapping` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "toneMapping")] + pub fn get_tone_mapping(this: &GpuCanvasConfiguration) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMapping")] + #[doc = "Change the `toneMapping` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "toneMapping")] + pub fn set_tone_mapping(this: &GpuCanvasConfiguration, val: &GpuCanvasToneMapping); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `usage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"] @@ -149,6 +169,13 @@ impl GpuCanvasConfiguration { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMapping")] + #[deprecated = "Use `set_tone_mapping()` instead."] + pub fn tone_mapping(&mut self, val: &GpuCanvasToneMapping) -> &mut Self { + self.set_tone_mapping(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_usage()` instead."] pub fn usage(&mut self, val: u32) -> &mut Self { self.set_usage(val); diff --git a/crates/web-sys/src/features/gen_GpuCanvasContext.rs b/crates/web-sys/src/features/gen_GpuCanvasContext.rs index c5f50dd5a5b..11b819b44c7 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasContext.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasContext.rs @@ -29,7 +29,7 @@ extern "C" { pub fn canvas(this: &GpuCanvasContext) -> ::js_sys::Object; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCanvasConfiguration")] - # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = configure)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCanvasContext" , js_name = configure)] #[doc = "The `configure()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/configure)"] @@ -38,10 +38,13 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configure(this: &GpuCanvasContext, configuration: &GpuCanvasConfiguration); + pub fn configure( + this: &GpuCanvasContext, + configuration: &GpuCanvasConfiguration, + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] - # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getCurrentTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCanvasContext" , js_name = getCurrentTexture)] #[doc = "The `getCurrentTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getCurrentTexture)"] @@ -50,7 +53,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_current_texture(this: &GpuCanvasContext) -> GpuTexture; + pub fn get_current_texture(this: &GpuCanvasContext) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = unconfigure)] #[doc = "The `unconfigure()` method."] diff --git a/crates/web-sys/src/features/gen_GpuCanvasToneMapping.rs b/crates/web-sys/src/features/gen_GpuCanvasToneMapping.rs new file mode 100644 index 00000000000..c2fa53c0eff --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuCanvasToneMapping.rs @@ -0,0 +1,64 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasToneMapping)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuCanvasToneMapping` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasToneMapping`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GpuCanvasToneMapping; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMappingMode")] + #[doc = "Get the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasToneMapping`, `GpuCanvasToneMappingMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mode")] + pub fn get_mode(this: &GpuCanvasToneMapping) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMappingMode")] + #[doc = "Change the `mode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasToneMapping`, `GpuCanvasToneMappingMode`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mode")] + pub fn set_mode(this: &GpuCanvasToneMapping, val: GpuCanvasToneMappingMode); +} +#[cfg(web_sys_unstable_apis)] +impl GpuCanvasToneMapping { + #[doc = "Construct a new `GpuCanvasToneMapping`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasToneMapping`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasToneMappingMode")] + #[deprecated = "Use `set_mode()` instead."] + pub fn mode(&mut self, val: GpuCanvasToneMappingMode) -> &mut Self { + self.set_mode(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for GpuCanvasToneMapping { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_GpuCanvasToneMappingMode.rs b/crates/web-sys/src/features/gen_GpuCanvasToneMappingMode.rs new file mode 100644 index 00000000000..106664a51ad --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuCanvasToneMappingMode.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GpuCanvasToneMappingMode` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GpuCanvasToneMappingMode`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GpuCanvasToneMappingMode { + Standard = "standard", + Extended = "extended", +} diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index 5e8deb5d8e7..6b1ceef6815 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -70,7 +70,7 @@ extern "C" { ) -> GpuComputePassEncoder; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuRenderPassDescriptor", feature = "GpuRenderPassEncoder",))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = beginRenderPass)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = beginRenderPass)] #[doc = "The `beginRenderPass()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/beginRenderPass)"] @@ -82,7 +82,7 @@ extern "C" { pub fn begin_render_pass( this: &GpuCommandEncoder, descriptor: &GpuRenderPassDescriptor, - ) -> GpuRenderPassEncoder; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = clearBuffer)] @@ -341,7 +341,7 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] #[doc = "The `copyBufferToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"] @@ -355,14 +355,14 @@ extern "C" { source: &GpuImageCopyBuffer, destination: &GpuImageCopyTexture, copy_size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture", ))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] #[doc = "The `copyBufferToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"] @@ -376,10 +376,10 @@ extern "C" { source: &GpuImageCopyBuffer, destination: &GpuImageCopyTexture, copy_size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] #[doc = "The `copyTextureToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"] @@ -393,14 +393,14 @@ extern "C" { source: &GpuImageCopyTexture, destination: &GpuImageCopyBuffer, copy_size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture", ))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] #[doc = "The `copyTextureToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"] @@ -414,10 +414,10 @@ extern "C" { source: &GpuImageCopyTexture, destination: &GpuImageCopyBuffer, copy_size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuImageCopyTexture")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] #[doc = "The `copyTextureToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"] @@ -431,10 +431,10 @@ extern "C" { source: &GpuImageCopyTexture, destination: &GpuImageCopyTexture, copy_size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture",))] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] #[doc = "The `copyTextureToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"] @@ -448,7 +448,7 @@ extern "C" { source: &GpuImageCopyTexture, destination: &GpuImageCopyTexture, copy_size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCommandBuffer")] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = finish)] diff --git a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs index 527442433d3..899ecbc8bcb 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs @@ -170,7 +170,7 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/setBindGroup)"] @@ -186,10 +186,10 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: u32, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/setBindGroup)"] @@ -205,7 +205,7 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: f64, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 4ee8647c8e4..0a06252b1d2 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -125,7 +125,7 @@ extern "C" { feature = "GpuBindGroupLayout", feature = "GpuBindGroupLayoutDescriptor", ))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createBindGroupLayout)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createBindGroupLayout)] #[doc = "The `createBindGroupLayout()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createBindGroupLayout)"] @@ -137,10 +137,10 @@ extern "C" { pub fn create_bind_group_layout( this: &GpuDevice, descriptor: &GpuBindGroupLayoutDescriptor, - ) -> GpuBindGroupLayout; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuBuffer", feature = "GpuBufferDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createBuffer)] #[doc = "The `createBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createBuffer)"] @@ -149,7 +149,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn create_buffer(this: &GpuDevice, descriptor: &GpuBufferDescriptor) -> GpuBuffer; + pub fn create_buffer( + this: &GpuDevice, + descriptor: &GpuBufferDescriptor, + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCommandEncoder")] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createCommandEncoder)] @@ -227,7 +230,7 @@ extern "C" { ) -> GpuPipelineLayout; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuQuerySet", feature = "GpuQuerySetDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createQuerySet)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createQuerySet)] #[doc = "The `createQuerySet()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createQuerySet)"] @@ -236,13 +239,16 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn create_query_set(this: &GpuDevice, descriptor: &GpuQuerySetDescriptor) -> GpuQuerySet; + pub fn create_query_set( + this: &GpuDevice, + descriptor: &GpuQuerySetDescriptor, + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuRenderBundleEncoder", feature = "GpuRenderBundleEncoderDescriptor", ))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createRenderBundleEncoder)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createRenderBundleEncoder)] #[doc = "The `createRenderBundleEncoder()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createRenderBundleEncoder)"] @@ -254,10 +260,10 @@ extern "C" { pub fn create_render_bundle_encoder( this: &GpuDevice, descriptor: &GpuRenderBundleEncoderDescriptor, - ) -> GpuRenderBundleEncoder; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuRenderPipeline", feature = "GpuRenderPipelineDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createRenderPipeline)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createRenderPipeline)] #[doc = "The `createRenderPipeline()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createRenderPipeline)"] @@ -269,7 +275,7 @@ extern "C" { pub fn create_render_pipeline( this: &GpuDevice, descriptor: &GpuRenderPipelineDescriptor, - ) -> GpuRenderPipeline; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuRenderPipelineDescriptor")] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createRenderPipelineAsync)] @@ -314,7 +320,7 @@ extern "C" { ) -> GpuSampler; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuShaderModule", feature = "GpuShaderModuleDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createShaderModule)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createShaderModule)] #[doc = "The `createShaderModule()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createShaderModule)"] @@ -326,10 +332,10 @@ extern "C" { pub fn create_shader_module( this: &GpuDevice, descriptor: &GpuShaderModuleDescriptor, - ) -> GpuShaderModule; + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuTexture", feature = "GpuTextureDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createTexture)] #[doc = "The `createTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createTexture)"] @@ -338,7 +344,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn create_texture(this: &GpuDevice, descriptor: &GpuTextureDescriptor) -> GpuTexture; + pub fn create_texture( + this: &GpuDevice, + descriptor: &GpuTextureDescriptor, + ) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = destroy)] #[doc = "The `destroy()` method."] @@ -355,7 +364,7 @@ extern "C" { feature = "GpuExternalTexture", feature = "GpuExternalTextureDescriptor", ))] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = importExternalTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = importExternalTexture)] #[doc = "The `importExternalTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/importExternalTexture)"] @@ -367,7 +376,7 @@ extern "C" { pub fn import_external_texture( this: &GpuDevice, descriptor: &GpuExternalTextureDescriptor, - ) -> GpuExternalTexture; + ) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = popErrorScope)] #[doc = "The `popErrorScope()` method."] diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index 223d0d3ccea..82603e3f165 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -14,6 +14,7 @@ pub enum GpuFeatureName { DepthClipControl = "depth-clip-control", Depth32floatStencil8 = "depth32float-stencil8", TextureCompressionBc = "texture-compression-bc", + TextureCompressionBcSliced3d = "texture-compression-bc-sliced-3d", TextureCompressionEtc2 = "texture-compression-etc2", TextureCompressionAstc = "texture-compression-astc", TimestampQuery = "timestamp-query", @@ -22,4 +23,6 @@ pub enum GpuFeatureName { Rg11b10ufloatRenderable = "rg11b10ufloat-renderable", Bgra8unormStorage = "bgra8unorm-storage", Float32Filterable = "float32-filterable", + ClipDistances = "clip-distances", + DualSourceBlending = "dual-source-blending", } diff --git a/crates/web-sys/src/features/gen_GpuPipelineError.rs b/crates/web-sys/src/features/gen_GpuPipelineError.rs index cfd85856d0f..7fe7c408f2b 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineError.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineError.rs @@ -39,5 +39,20 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new(message: &str, options: &GpuPipelineErrorInit) -> Result; + pub fn new(options: &GpuPipelineErrorInit) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuPipelineErrorInit")] + #[wasm_bindgen(catch, constructor, js_class = "GPUPipelineError")] + #[doc = "The `new GpuPipelineError(..)` constructor, creating a new instance of `GpuPipelineError`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPipelineError/GPUPipelineError)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuPipelineError`, `GpuPipelineErrorInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_message( + message: &str, + options: &GpuPipelineErrorInit, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index f1c02321b81..501aedbd2fa 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -43,7 +43,7 @@ extern "C" { feature = "GpuImageCopyExternalImage", feature = "GpuImageCopyTextureTagged", ))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] #[doc = "The `copyExternalImageToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture)"] @@ -57,14 +57,14 @@ extern "C" { source: &GpuImageCopyExternalImage, destination: &GpuImageCopyTextureTagged, copy_size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyExternalImage", feature = "GpuImageCopyTextureTagged", ))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] #[doc = "The `copyExternalImageToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture)"] @@ -78,7 +78,7 @@ extern "C" { source: &GpuImageCopyExternalImage, destination: &GpuImageCopyTextureTagged, copy_size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = onSubmittedWorkDone)] #[doc = "The `onSubmittedWorkDone()` method."] @@ -103,7 +103,7 @@ extern "C" { pub fn submit(this: &GpuQueue, command_buffers: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -117,10 +117,10 @@ extern "C" { buffer: &GpuBuffer, buffer_offset: u32, data: &::js_sys::Object, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -134,10 +134,10 @@ extern "C" { buffer: &GpuBuffer, buffer_offset: f64, data: &::js_sys::Object, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -151,10 +151,10 @@ extern "C" { buffer: &GpuBuffer, buffer_offset: u32, data: &[u8], - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -168,10 +168,10 @@ extern "C" { buffer: &GpuBuffer, buffer_offset: f64, data: &[u8], - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -186,10 +186,10 @@ extern "C" { buffer_offset: u32, data: &::js_sys::Object, data_offset: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -204,10 +204,10 @@ extern "C" { buffer_offset: f64, data: &::js_sys::Object, data_offset: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -222,10 +222,10 @@ extern "C" { buffer_offset: u32, data: &[u8], data_offset: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -240,10 +240,10 @@ extern "C" { buffer_offset: f64, data: &[u8], data_offset: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -258,10 +258,10 @@ extern "C" { buffer_offset: u32, data: &::js_sys::Object, data_offset: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -276,10 +276,10 @@ extern "C" { buffer_offset: f64, data: &::js_sys::Object, data_offset: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -294,10 +294,10 @@ extern "C" { buffer_offset: u32, data: &[u8], data_offset: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -312,10 +312,10 @@ extern "C" { buffer_offset: f64, data: &[u8], data_offset: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -331,10 +331,10 @@ extern "C" { data: &::js_sys::Object, data_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -350,10 +350,10 @@ extern "C" { data: &::js_sys::Object, data_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -369,10 +369,10 @@ extern "C" { data: &[u8], data_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -388,10 +388,10 @@ extern "C" { data: &[u8], data_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -407,10 +407,10 @@ extern "C" { data: &::js_sys::Object, data_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -426,10 +426,10 @@ extern "C" { data: &::js_sys::Object, data_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -445,10 +445,10 @@ extern "C" { data: &[u8], data_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -464,10 +464,10 @@ extern "C" { data: &[u8], data_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -483,10 +483,10 @@ extern "C" { data: &::js_sys::Object, data_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -502,10 +502,10 @@ extern "C" { data: &::js_sys::Object, data_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -521,10 +521,10 @@ extern "C" { data: &[u8], data_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -540,10 +540,10 @@ extern "C" { data: &[u8], data_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -559,10 +559,10 @@ extern "C" { data: &::js_sys::Object, data_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -578,10 +578,10 @@ extern "C" { data: &::js_sys::Object, data_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -597,10 +597,10 @@ extern "C" { data: &[u8], data_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] #[doc = "The `writeBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] @@ -616,10 +616,10 @@ extern "C" { data: &[u8], data_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] @@ -634,10 +634,10 @@ extern "C" { data: &::js_sys::Object, data_layout: &GpuImageDataLayout, size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] @@ -652,14 +652,14 @@ extern "C" { data: &[u8], data_layout: &GpuImageDataLayout, size: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout", ))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] @@ -674,14 +674,14 @@ extern "C" { data: &::js_sys::Object, data_layout: &GpuImageDataLayout, size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout", ))] - # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] @@ -696,5 +696,5 @@ extern "C" { data: &[u8], data_layout: &GpuImageDataLayout, size: &GpuExtent3dDict, - ); + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs index 9aaecf3d44d..355f86931f8 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs @@ -100,7 +100,7 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/setBindGroup)"] @@ -116,10 +116,10 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: u32, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/setBindGroup)"] @@ -135,7 +135,7 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: f64, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs index a708d6978f9..131609d43e0 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs @@ -83,7 +83,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn execute_bundles(this: &GpuRenderPassEncoder, bundles: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setBlendConstant)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBlendConstant)] #[doc = "The `setBlendConstant()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBlendConstant)"] @@ -95,10 +95,10 @@ extern "C" { pub fn set_blend_constant_with_f64_sequence( this: &GpuRenderPassEncoder, color: &::wasm_bindgen::JsValue, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuColorDict")] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setBlendConstant)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBlendConstant)] #[doc = "The `setBlendConstant()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBlendConstant)"] @@ -110,7 +110,7 @@ extern "C" { pub fn set_blend_constant_with_gpu_color_dict( this: &GpuRenderPassEncoder, color: &GpuColorDict, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setScissorRect)] #[doc = "The `setScissorRect()` method."] @@ -187,7 +187,7 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBindGroup)"] @@ -203,10 +203,10 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: u32, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBindGroup")] - # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] #[doc = "The `setBindGroup()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBindGroup)"] @@ -222,7 +222,7 @@ extern "C" { dynamic_offsets_data: &[u32], dynamic_offsets_data_start: f64, dynamic_offsets_data_length: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] diff --git a/crates/web-sys/src/features/gen_GpuTexture.rs b/crates/web-sys/src/features/gen_GpuTexture.rs index 0e7fc68ed8b..d1d72cd0b65 100644 --- a/crates/web-sys/src/features/gen_GpuTexture.rs +++ b/crates/web-sys/src/features/gen_GpuTexture.rs @@ -130,7 +130,7 @@ extern "C" { pub fn set_label(this: &GpuTexture, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureView")] - # [wasm_bindgen (method , structural , js_class = "GPUTexture" , js_name = createView)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUTexture" , js_name = createView)] #[doc = "The `createView()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/createView)"] @@ -139,10 +139,10 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn create_view(this: &GpuTexture) -> GpuTextureView; + pub fn create_view(this: &GpuTexture) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuTextureView", feature = "GpuTextureViewDescriptor",))] - # [wasm_bindgen (method , structural , js_class = "GPUTexture" , js_name = createView)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUTexture" , js_name = createView)] #[doc = "The `createView()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUTexture/createView)"] @@ -154,7 +154,7 @@ extern "C" { pub fn create_view_with_descriptor( this: &GpuTexture, descriptor: &GpuTextureViewDescriptor, - ) -> GpuTextureView; + ) -> Result; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUTexture" , js_name = destroy)] #[doc = "The `destroy()` method."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index cf01e4d5763..d6091590a63 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -3211,6 +3211,20 @@ mod gen_GpuCanvasContext; #[allow(unused_imports)] pub use gen_GpuCanvasContext::*; +#[cfg(feature = "GpuCanvasToneMapping")] +#[allow(non_snake_case)] +mod gen_GpuCanvasToneMapping; +#[cfg(feature = "GpuCanvasToneMapping")] +#[allow(unused_imports)] +pub use gen_GpuCanvasToneMapping::*; + +#[cfg(feature = "GpuCanvasToneMappingMode")] +#[allow(non_snake_case)] +mod gen_GpuCanvasToneMappingMode; +#[cfg(feature = "GpuCanvasToneMappingMode")] +#[allow(unused_imports)] +pub use gen_GpuCanvasToneMappingMode::*; + #[cfg(feature = "GpuColorDict")] #[allow(non_snake_case)] mod gen_GpuColorDict; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 32397b6e27b..96fa115992e 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -6,7 +6,7 @@ dictionary GPUObjectDescriptorBase { USVString label = ""; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension1D; readonly attribute unsigned long maxTextureDimension2D; @@ -42,17 +42,17 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxComputeWorkgroupsPerDimension; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUSupportedFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface WGSLLanguageFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUAdapterInfo { readonly attribute DOMString vendor; readonly attribute DOMString architecture; @@ -66,7 +66,7 @@ interface mixin NavigatorGPU { Navigator includes NavigatorGPU; WorkerNavigator includes NavigatorGPU; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPU { Promise requestAdapter(optional GPURequestAdapterOptions options = {}); GPUTextureFormat getPreferredCanvasFormat(); @@ -83,13 +83,15 @@ enum GPUPowerPreference { "high-performance", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUAdapter { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; + [SameObject] readonly attribute GPUAdapterInfo info; readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); + [RustDeprecated] Promise requestAdapterInfo(); }; @@ -104,6 +106,7 @@ enum GPUFeatureName { "depth-clip-control", "depth32float-stencil8", "texture-compression-bc", + "texture-compression-bc-sliced-3d", "texture-compression-etc2", "texture-compression-astc", "timestamp-query", @@ -112,9 +115,11 @@ enum GPUFeatureName { "rg11b10ufloat-renderable", "bgra8unorm-storage", "float32-filterable", + "clip-distances", + "dual-source-blending", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; @@ -123,29 +128,37 @@ interface GPUDevice : EventTarget { undefined destroy(); + [Throws] GPUBuffer createBuffer(GPUBufferDescriptor descriptor); + [Throws] GPUTexture createTexture(GPUTextureDescriptor descriptor); GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); + [Throws] GPUExternalTexture importExternalTexture(GPUExternalTextureDescriptor descriptor); + [Throws] GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor); GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); + [Throws] GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); + [Throws] GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor); Promise createComputePipelineAsync(GPUComputePipelineDescriptor descriptor); Promise createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor); GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {}); + [Throws] GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); + [Throws] GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor); }; GPUDevice includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUBuffer { readonly attribute GPUSize64Out size; readonly attribute GPUFlagsConstant usage; @@ -153,6 +166,7 @@ interface GPUBuffer { readonly attribute GPUBufferMapState mapState; Promise mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); + [Throws] ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); undefined unmap(); @@ -174,7 +188,7 @@ dictionary GPUBufferDescriptor }; typedef [EnforceRange] unsigned long GPUBufferUsageFlags; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] namespace GPUBufferUsage { const GPUFlagsConstant MAP_READ = 0x0001; const GPUFlagsConstant MAP_WRITE = 0x0002; @@ -189,14 +203,15 @@ namespace GPUBufferUsage { }; typedef [EnforceRange] unsigned long GPUMapModeFlags; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUTexture { + [Throws] GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); undefined destroy(); @@ -230,7 +245,7 @@ enum GPUTextureDimension { }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] namespace GPUTextureUsage { const GPUFlagsConstant COPY_SRC = 0x01; const GPUFlagsConstant COPY_DST = 0x02; @@ -239,7 +254,7 @@ namespace GPUTextureUsage { const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUTextureView { }; GPUTextureView includes GPUObjectBase; @@ -391,7 +406,7 @@ enum GPUTextureFormat { "astc-12x12-unorm-srgb", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUExternalTexture { }; GPUExternalTexture includes GPUObjectBase; @@ -402,7 +417,7 @@ dictionary GPUExternalTextureDescriptor PredefinedColorSpace colorSpace = "srgb"; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUSampler { }; GPUSampler includes GPUObjectBase; @@ -448,7 +463,7 @@ enum GPUCompareFunction { "always", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUBindGroupLayout { }; GPUBindGroupLayout includes GPUObjectBase; @@ -470,7 +485,7 @@ dictionary GPUBindGroupLayoutEntry { }; typedef [EnforceRange] unsigned long GPUShaderStageFlags; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] namespace GPUShaderStage { const GPUFlagsConstant VERTEX = 0x1; const GPUFlagsConstant FRAGMENT = 0x2; @@ -528,7 +543,7 @@ dictionary GPUStorageTextureBindingLayout { dictionary GPUExternalTextureBindingLayout { }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUBindGroup { }; GPUBindGroup includes GPUObjectBase; @@ -552,7 +567,7 @@ dictionary GPUBufferBinding { GPUSize64 size; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUPipelineLayout { }; GPUPipelineLayout includes GPUObjectBase; @@ -562,7 +577,7 @@ dictionary GPUPipelineLayoutDescriptor required sequence bindGroupLayouts; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUShaderModule { Promise getCompilationInfo(); }; @@ -586,7 +601,7 @@ enum GPUCompilationMessageType { "info", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] +[Exposed=(Window, Worker), Serializable, SecureContext] interface GPUCompilationMessage { readonly attribute DOMString message; readonly attribute GPUCompilationMessageType type; @@ -596,14 +611,14 @@ interface GPUCompilationMessage { readonly attribute unsigned long long length; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] +[Exposed=(Window, Worker), Serializable, SecureContext] interface GPUCompilationInfo { readonly attribute FrozenArray messages; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext, Serializable] +[Exposed=(Window, Worker), SecureContext, Serializable] interface GPUPipelineError : DOMException { - constructor(DOMString message, GPUPipelineErrorInit options); + constructor(optional DOMString message = "", GPUPipelineErrorInit options); readonly attribute GPUPipelineErrorReason reason; }; @@ -637,7 +652,7 @@ dictionary GPUProgrammableStage { typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled. -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUComputePipeline { }; GPUComputePipeline includes GPUObjectBase; @@ -648,7 +663,7 @@ dictionary GPUComputePipelineDescriptor required GPUProgrammableStage compute; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPURenderPipeline { }; GPURenderPipeline includes GPUObjectBase; @@ -716,7 +731,7 @@ dictionary GPUBlendState { }; typedef [EnforceRange] unsigned long GPUColorWriteFlags; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] namespace GPUColorWrite { const GPUFlagsConstant RED = 0x1; const GPUFlagsConstant GREEN = 0x2; @@ -745,6 +760,10 @@ enum GPUBlendFactor { "src-alpha-saturated", "constant", "one-minus-constant", + "src1", + "one-minus-src1", + "src1-alpha", + "one-minus-src1-alpha", }; enum GPUBlendOperation { @@ -890,7 +909,7 @@ dictionary GPUImageCopyExternalImage { boolean flipY = false; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUCommandBuffer { }; GPUCommandBuffer includes GPUObjectBase; @@ -902,8 +921,9 @@ dictionary GPUCommandBufferDescriptor interface mixin GPUCommandsMixin { }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUCommandEncoder { + [Throws] GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); @@ -914,16 +934,19 @@ interface GPUCommandEncoder { GPUSize64 destinationOffset, GPUSize64 size); + [Throws] undefined copyBufferToTexture( GPUImageCopyBuffer source, GPUImageCopyTexture destination, GPUExtent3D copySize); + [Throws] undefined copyTextureToBuffer( GPUImageCopyTexture source, GPUImageCopyBuffer destination, GPUExtent3D copySize); + [Throws] undefined copyTextureToTexture( GPUImageCopyTexture source, GPUImageCopyTexture destination, @@ -955,6 +978,7 @@ interface mixin GPUBindingCommandsMixin { undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup, optional sequence dynamicOffsets = []); + [Throws] undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup, Uint32Array dynamicOffsetsData, GPUSize64 dynamicOffsetsDataStart, @@ -967,7 +991,7 @@ interface mixin GPUDebugCommandsMixin { undefined insertDebugMarker(USVString markerLabel); }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUComputePassEncoder { undefined setPipeline(GPUComputePipeline pipeline); undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); @@ -991,7 +1015,7 @@ dictionary GPUComputePassDescriptor GPUComputePassTimestampWrites timestampWrites; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, float width, float height, @@ -1000,6 +1024,7 @@ interface GPURenderPassEncoder { undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y, GPUIntegerCoordinate width, GPUIntegerCoordinate height); + [Throws] undefined setBlendConstant(GPUColor color); undefined setStencilReference(GPUStencilValue reference); @@ -1088,7 +1113,7 @@ interface mixin GPURenderCommandsMixin { undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPURenderBundle { }; GPURenderBundle includes GPUObjectBase; @@ -1097,7 +1122,7 @@ dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPURenderBundleEncoder { GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; @@ -1117,25 +1142,28 @@ dictionary GPUQueueDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUQueue { undefined submit(sequence commandBuffers); Promise onSubmittedWorkDone(); + [Throws] undefined writeBuffer( GPUBuffer buffer, GPUSize64 bufferOffset, - [AllowShared] BufferSource data, + AllowSharedBufferSource data, optional GPUSize64 dataOffset = 0, optional GPUSize64 size); + [Throws] undefined writeTexture( GPUImageCopyTexture destination, - [AllowShared] BufferSource data, + AllowSharedBufferSource data, GPUImageDataLayout dataLayout, GPUExtent3D size); + [Throws] undefined copyExternalImageToTexture( GPUImageCopyExternalImage source, GPUImageCopyTextureTagged destination, @@ -1143,7 +1171,7 @@ interface GPUQueue { }; GPUQueue includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUQuerySet { undefined destroy(); @@ -1163,13 +1191,15 @@ enum GPUQueryType { "timestamp", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUCanvasContext { readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; + [Throws] undefined configure(GPUCanvasConfiguration configuration); undefined unconfigure(); + [Throws] GPUTexture getCurrentTexture(); }; @@ -1178,12 +1208,22 @@ enum GPUCanvasAlphaMode { "premultiplied", }; +enum GPUCanvasToneMappingMode { + "standard", + "extended", +}; + +dictionary GPUCanvasToneMapping { + GPUCanvasToneMappingMode mode = "standard"; +}; + dictionary GPUCanvasConfiguration { required GPUDevice device; required GPUTextureFormat format; GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT sequence viewFormats = []; PredefinedColorSpace colorSpace = "srgb"; + GPUCanvasToneMapping toneMapping = {}; GPUCanvasAlphaMode alphaMode = "opaque"; }; @@ -1192,7 +1232,7 @@ enum GPUDeviceLostReason { "destroyed", }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUDeviceLostInfo { readonly attribute GPUDeviceLostReason reason; readonly attribute DOMString message; @@ -1202,24 +1242,24 @@ partial interface GPUDevice { readonly attribute Promise lost; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUError { readonly attribute DOMString message; }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUValidationError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUOutOfMemoryError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUInternalError : GPUError { constructor(DOMString message); @@ -1236,7 +1276,7 @@ partial interface GPUDevice { Promise popErrorScope(); }; -[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] +[Exposed=(Window, Worker), SecureContext] interface GPUUncapturedErrorEvent : Event { constructor( DOMString type, @@ -1250,7 +1290,7 @@ dictionary GPUUncapturedErrorEventInit : EventInit { }; partial interface GPUDevice { - [Exposed=(Window, DedicatedWorker, ServiceWorker)] + [Exposed=(Window, Worker)] attribute EventHandler onuncapturederror; }; diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 674fad0d447..750649f65c9 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -100,6 +100,10 @@ pub(crate) enum IdentifierType<'a> { }, // DOMTimeStamp UnsignedLongLong, + // AllowSharedBufferSource + BufferSource { + immutable: bool, + }, } pub(crate) trait ToIdlType<'a> { @@ -336,6 +340,8 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { let ty = if self.0 == "DOMTimeStamp" { // https://heycam.github.io/webidl/#DOMTimeStamp IdentifierType::UnsignedLongLong + } else if self.0 == "AllowSharedBufferSource" { + IdentifierType::BufferSource { immutable: false } } else if let Some(idl_type) = record.typedefs.get(&self.0) { return idl_type.to_idl_type(record); } else if record.interfaces.contains_key(self.0) { @@ -525,6 +531,10 @@ impl<'a> IdlType<'a> { IdentifierType::UnsignedLongLong => { IdlType::UnsignedLongLong.push_snake_case_name(dst) } + IdentifierType::BufferSource { immutable } => IdlType::BufferSource { + immutable: *immutable, + } + .push_snake_case_name(dst), }, } } @@ -761,29 +771,38 @@ impl<'a> IdlType<'a> { ], IdlType::LongLong => vec![IdlType::Long, IdlType::Double], IdlType::UnsignedLongLong => vec![IdlType::UnsignedLong, IdlType::Double], - IdlType::Identifier { + idl_type @ IdlType::Identifier { name: identifier, - ty: + ty, + } => { + match ty { IdentifierType::CallbackInterface { name, single_function: true, - }, - } => { - // According to the webidl spec [1] single-function callback - // interfaces can also be replaced in arguments with simply a - // single callable function, which we map to a `Callback`. - // - // [1]: https://heycam.github.io/webidl/#es-user-objects - vec![ - IdlType::id(identifier, IdentifierType::Callback), - IdlType::id( - identifier, - IdentifierType::CallbackInterface { - name, - single_function: false, - }, - ), - ] + } => { + // According to the webidl spec [1] single-function callback + // interfaces can also be replaced in arguments with simply a + // single callable function, which we map to a `Callback`. + // + // [1]: https://heycam.github.io/webidl/#es-user-objects + vec![ + IdlType::id(identifier, IdentifierType::Callback), + IdlType::id( + identifier, + IdentifierType::CallbackInterface { + name, + single_function: false, + }, + ), + ] + } + IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.flatten(attrs), + IdentifierType::BufferSource { immutable } => IdlType::BufferSource { + immutable: *immutable, + } + .flatten(attrs), + _ => vec![idl_type.clone()], + } } idl_type => vec![idl_type.clone()], } @@ -826,6 +845,10 @@ impl<'a> IdentifierType<'a> { Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str())))) } IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.to_syn_type(pos), + IdentifierType::BufferSource { immutable } => IdlType::BufferSource { + immutable: *immutable, + } + .to_syn_type(pos), } } } diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index 6f40f64e6d1..c103def4165 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -237,24 +237,36 @@ impl<'src> FirstPassRecord<'src> { // undefined. let mut signatures = Vec::new(); for signature in data.signatures.iter() { - let mut idl_args = Vec::with_capacity(signature.args.len()); - for (i, arg) in signature.args.iter().enumerate() { - if arg.optional { - assert!( - signature.args[i..] + fn pass<'src>( + this: &FirstPassRecord<'src>, + id: &'src OperationId<'_>, + signatures: &mut Vec<(&Signature<'src>, Vec>>)>, + signature: &'src Signature<'_>, + mut idl_args: Vec>>, + ) { + for (i, arg) in signature.args.iter().enumerate().skip(idl_args.len()) { + if arg.optional { + if signature.args[i..] .iter() - .all(|arg| arg.optional || arg.variadic), - "Not optional or variadic argument after optional argument: {:?}", - signature.args, - ); - signatures.push((signature, idl_args.clone())); - } + .all(|arg| arg.optional || arg.variadic) + { + signatures.push((signature, idl_args.clone())); + } else if signature.args.get(i + 1).is_some() { + let mut idl_args = idl_args.clone(); + idl_args.push(None); + pass(this, id, signatures, signature, idl_args) + } + } - let idl_type = arg.ty.to_idl_type(self); - let idl_type = self.maybe_adjust(idl_type, id); - idl_args.push(idl_type); + let idl_type = arg.ty.to_idl_type(this); + let idl_type = this.maybe_adjust(idl_type, id); + idl_args.push(Some(idl_type)); + } + signatures.push((signature, idl_args)); } - signatures.push((signature, idl_args)); + + let idl_args = Vec::with_capacity(signature.args.len()); + pass(self, id, &mut signatures, signature, idl_args); } // Next expand all the signatures in `data` into all signatures that @@ -263,7 +275,7 @@ impl<'src> FirstPassRecord<'src> { #[derive(Clone)] struct ExpandedSig<'a> { orig: &'a Signature<'a>, - args: Vec>, + args: Vec>>, } let mut actual_signatures = Vec::new(); @@ -280,30 +292,34 @@ impl<'src> FirstPassRecord<'src> { for (i, idl_type) in idl_args.iter().enumerate() { // small sanity check assert!(start < actual_signatures.len()); - for sig in actual_signatures[start..].iter() { - assert_eq!(sig.args.len(), i); - } // The first element of the flattened type gets pushed directly // in-place, but all other flattened types will cause new // signatures to be created. let cur = actual_signatures.len(); - for (j, idl_type) in idl_type - .flatten(signature.attrs.as_ref()) - .into_iter() - .enumerate() - { - for k in start..cur { - if j == 0 { - actual_signatures[k].args.push(idl_type.clone()); - } else { - let mut sig = actual_signatures[k].clone(); - assert_eq!(sig.args.len(), i + 1); - sig.args.truncate(i); - sig.args.push(idl_type.clone()); - actual_signatures.push(sig); + + if let Some(idl_type) = idl_type { + for (j, idl_type) in idl_type + .flatten(signature.attrs.as_ref()) + .into_iter() + .enumerate() + { + for k in start..cur { + if j == 0 { + actual_signatures[k].args.push(Some(idl_type.clone())); + } else { + let mut sig = actual_signatures[k].clone(); + assert_eq!(sig.args.len(), i + 1); + sig.args.truncate(i); + sig.args.push(Some(idl_type.clone())); + actual_signatures.push(sig); + } } } + } else { + for signature in actual_signatures.iter_mut().take(cur).skip(start) { + signature.args.push(None); + } } } } @@ -357,7 +373,12 @@ impl<'src> FirstPassRecord<'src> { let mut rust_name = snake_case_ident(js_name); let mut first = true; - for (i, arg) in signature.args.iter().enumerate() { + for (i, arg) in signature + .args + .iter() + .enumerate() + .filter_map(|(i, ty)| ty.as_ref().map(|ty| (i, ty))) + { // Find out if any other known signature either has the same // name for this argument or a different type for this argument. let mut any_same_name = false; @@ -370,7 +391,7 @@ impl<'src> FirstPassRecord<'src> { { any_same_name = true; } - if let Some(other) = other.args.get(i) { + if let Some(Some(other)) = other.args.get(i) { if other != arg { any_different_type = true; any_different = true; @@ -458,21 +479,22 @@ impl<'src> FirstPassRecord<'src> { Some(output) } - let arguments = idl_arguments( - signature - .args - .iter() - .zip(&signature.orig.args) - .map(|(idl_type, orig_arg)| (orig_arg.name.to_string(), idl_type)), - ); + let arguments = + idl_arguments(signature.args.iter().zip(&signature.orig.args).filter_map( + |(idl_type, orig_arg)| { + idl_type + .as_ref() + .map(|idl_type| (orig_arg.name.to_string(), idl_type)) + }, + )); // Stable types can have methods that have unstable argument types. // If any of the arguments types are `unstable` then this method is downgraded // to be unstable. - let has_unstable_args = signature - .args - .iter() - .any(|arg| is_idl_type_unstable(arg, unstable_types)); + let has_unstable_args = signature.args.iter().any(|arg| { + arg.as_ref() + .is_some_and(|arg| is_idl_type_unstable(arg, unstable_types)) + }); let unstable = unstable || data.stability.is_unstable() || has_unstable_args; @@ -508,14 +530,18 @@ impl<'src> FirstPassRecord<'src> { if !variadic { continue; } - let last_idl_type = &signature.args[signature.args.len() - 1]; + let last_idl_type = signature.args[signature.args.len() - 1].as_ref().unwrap(); let last_name = signature.orig.args[signature.args.len() - 1].name; for i in 0..=MAX_VARIADIC_ARGUMENTS_COUNT { let arguments = idl_arguments( signature.args[..signature.args.len() - 1] .iter() .zip(&signature.orig.args) - .map(|(idl_type, orig_arg)| (orig_arg.name.to_string(), idl_type)) + .filter_map(|(idl_type, orig_arg)| { + idl_type + .as_ref() + .map(|idl_type| (orig_arg.name.to_string(), idl_type)) + }) .chain((1..=i).map(|j| (format!("{}_{}", last_name, j), last_idl_type))), ); @@ -715,7 +741,11 @@ fn flag_slices_immutable(ty: &mut IdlType) { | IdlType::Float32Array { immutable } | IdlType::Float64Array { immutable } | IdlType::ArrayBufferView { immutable } - | IdlType::BufferSource { immutable } => *immutable = true, + | IdlType::BufferSource { immutable } + | IdlType::Identifier { + ty: IdentifierType::BufferSource { immutable }, + .. + } => *immutable = true, IdlType::Nullable(item) => flag_slices_immutable(item), IdlType::FrozenArray(item) => flag_slices_immutable(item), IdlType::Sequence(item) => flag_slices_immutable(item), From 402dae7d9b89eb9626257a5f1b87754c4b0f3000 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 11 Aug 2024 13:04:23 +0200 Subject: [PATCH 459/641] Experimental test coverage support (#4060) --- CHANGELOG.md | 3 + Cargo.toml | 5 ++ crates/backend/src/codegen.rs | 11 +++ .../src/bin/wasm-bindgen-test-runner/main.rs | 29 +++++++ .../bin/wasm-bindgen-test-runner/server.rs | 47 ++++++++++- crates/macro/Cargo.toml | 5 ++ crates/macro/src/lib.rs | 17 ++++ crates/test-macro/Cargo.toml | 5 ++ crates/test-macro/src/lib.rs | 11 +++ crates/test/Cargo.toml | 8 ++ crates/test/src/coverage.rs | 24 ++++++ crates/test/src/lib.rs | 17 +++- crates/test/src/rt/mod.rs | 11 ++- crates/wasm-interpreter/src/lib.rs | 45 ++++++++-- guide/src/SUMMARY.md | 1 + guide/src/wasm-bindgen-test/coverage.md | 83 +++++++++++++++++++ src/closure.rs | 13 +++ src/convert/closures.rs | 6 ++ src/convert/slices.rs | 2 + src/describe.rs | 17 ++++ src/lib.rs | 2 + src/link.rs | 1 + 22 files changed, 351 insertions(+), 12 deletions(-) create mode 100644 crates/test/src/coverage.rs create mode 100644 guide/src/wasm-bindgen-test/coverage.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eed5b1fd78..02e23a00a4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,9 @@ * Added importing strings as `JsString` through `#[wasm_bindgen(thread_local, static_string)] static STRING: JsString = "a string literal";`. [#4055](https://github.com/rustwasm/wasm-bindgen/pull/4055) +* Added experimental test coverage support for `wasm-bindgen-test-runner`, see the guide for more information. + [#4060](https://github.com/rustwasm/wasm-bindgen/pull/4060) + ### Changed * Stabilize Web Share API. diff --git a/Cargo.toml b/Cargo.toml index 663ae407b7d..ca425da4c2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,11 @@ serde_derive = "1.0" wasm-bindgen-test-crate-a = { path = 'tests/crates/a' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b' } +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(wasm_bindgen_unstable_test_coverage)', +] } + [workspace] members = [ "benchmarks", diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 4add9859cd6..d11894518cb 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -220,6 +220,7 @@ impl ToTokens for ast::Struct { (quote! { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { use #wasm_bindgen::__wbindgen_if_not_std; use #wasm_bindgen::describe::*; @@ -293,6 +294,7 @@ impl ToTokens for ast::Struct { #[doc(hidden)] // `allow_delayed` is whether it's ok to not actually free the `ptr` immediately // if it's still borrowed. + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub unsafe extern "C" fn #free_fn(ptr: u32, allow_delayed: u32) { use #wasm_bindgen::__rt::alloc::rc::Rc; @@ -401,6 +403,7 @@ impl ToTokens for ast::Struct { } impl #wasm_bindgen::describe::WasmDescribeVector for #name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { use #wasm_bindgen::describe::*; inform(VECTOR); @@ -484,6 +487,7 @@ impl ToTokens for ast::StructField { const _: () = { #[cfg_attr(all(target_arch = "wasm32", target_os = "unknown"), no_mangle)] #[doc(hidden)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub unsafe extern "C" fn #getter(js: u32) -> #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi> { @@ -525,6 +529,7 @@ impl ToTokens for ast::StructField { const _: () = { #[no_mangle] #[doc(hidden)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub unsafe extern "C" fn #setter( js: u32, #(#args,)* @@ -781,6 +786,7 @@ impl TryToTokens for ast::Export { all(target_arch = "wasm32", target_os = "unknown"), export_name = #export_name, )] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { #start_check @@ -932,6 +938,7 @@ impl ToTokens for ast::ImportType { use #wasm_bindgen::__rt::core; impl WasmDescribe for #rust_name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #description } @@ -1222,6 +1229,7 @@ impl ToTokens for ast::StringEnum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { use #wasm_bindgen::describe::*; inform(STRING_ENUM); @@ -1563,6 +1571,7 @@ impl ToTokens for ast::Enum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { use #wasm_bindgen::describe::*; inform(ENUM); @@ -1599,6 +1608,7 @@ impl ToTokens for ast::Enum { } impl #wasm_bindgen::describe::WasmDescribeVector for #enum_name { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { use #wasm_bindgen::describe::*; inform(VECTOR); @@ -1795,6 +1805,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { #(#attrs)* #[no_mangle] #[doc(hidden)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub extern "C" fn #name() { use #wasm_bindgen::describe::*; // See definition of `link_mem_intrinsics` for what this is doing diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 585f8aa34ca..26959e9e57f 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -15,6 +15,7 @@ use anyhow::{anyhow, bail, Context}; use log::error; use std::env; use std::fs; +use std::path::Path; use std::path::PathBuf; use std::thread; use wasm_bindgen_cli_support::Bindgen; @@ -222,6 +223,8 @@ fn main() -> anyhow::Result<()> { b.split_linked_modules(true); } + let coverage = coverage_args(&tmpdir); + b.debug(debug) .input_module(module, wasm) .keep_debug(false) @@ -256,6 +259,7 @@ fn main() -> anyhow::Result<()> { &tests, test_mode, std::env::var("WASM_BINDGEN_TEST_NO_ORIGIN_ISOLATION").is_err(), + coverage, ) .context("failed to spawn server")?; let addr = srv.server_addr(); @@ -282,3 +286,28 @@ fn main() -> anyhow::Result<()> { } Ok(()) } + +fn coverage_args(tmpdir: &Path) -> PathBuf { + fn generated(tmpdir: &Path, prefix: &str) -> String { + let res = format!( + "{prefix}{}.profraw", + tmpdir.file_name().and_then(|s| s.to_str()).unwrap() + ); + res + } + + let prefix = env::var_os("WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_PREFIX") + .map(|s| s.to_str().unwrap().to_string()) + .unwrap_or_default(); + + match env::var_os("WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT") { + Some(s) => { + let mut buf = PathBuf::from(s); + if buf.is_dir() { + buf.push(generated(tmpdir, &prefix)); + } + buf + } + None => PathBuf::from(generated(tmpdir, &prefix)), + } +} diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index 9c434a00010..ad3678b1cae 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -1,8 +1,9 @@ use std::borrow::Cow; use std::ffi::OsString; use std::fs; +use std::io::{Read, Write}; use std::net::SocketAddr; -use std::path::Path; +use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context, Error}; use rouille::{Request, Response, Server}; @@ -18,9 +19,24 @@ pub(crate) fn spawn( tests: &[String], test_mode: TestMode, isolate_origin: bool, + coverage: PathBuf, ) -> Result Response + Send + Sync>, Error> { let mut js_to_execute = String::new(); + let cov_import = if test_mode.no_modules() { + "let __wbgtest_cov_dump = wasm_bindgen.__wbgtest_cov_dump;" + } else { + "__wbgtest_cov_dump," + }; + let cov_dump = r#" + // Dump the coverage data collected during the tests + const coverage = __wbgtest_cov_dump(); + await fetch("/__wasm_bindgen/coverage", { + method: "POST", + body: coverage + }); + "#; + let wbg_import_script = if test_mode.no_modules() { String::from( r#" @@ -30,6 +46,7 @@ pub(crate) fn spawn( let __wbgtest_console_info = wasm_bindgen.__wbgtest_console_info; let __wbgtest_console_warn = wasm_bindgen.__wbgtest_console_warn; let __wbgtest_console_error = wasm_bindgen.__wbgtest_console_error; + {cov_import} let init = wasm_bindgen; "#, ) @@ -43,6 +60,7 @@ pub(crate) fn spawn( __wbgtest_console_info, __wbgtest_console_warn, __wbgtest_console_error, + {cov_import} default as init, }} from './{}'; "#, @@ -116,6 +134,7 @@ pub(crate) fn spawn( cx.args({1:?}); await cx.run(tests.map(s => wasm[s])); + {cov_dump} }} port.onmessage = function(e) {{ @@ -250,6 +269,7 @@ pub(crate) fn spawn( cx.args({1:?}); await cx.run(test.map(s => wasm[s])); + {cov_dump} }} const tests = []; @@ -300,6 +320,16 @@ pub(crate) fn spawn( } return response; + } else if request.url() == "/__wasm_bindgen/coverage" { + return if let Err(e) = handle_coverage_dump(&coverage, request) { + let s: &str = &format!("Failed to dump coverage: {e}"); + log::error!("{s}"); + let mut ret = Response::text(s); + ret.status_code = 500; + ret + } else { + Response::empty_204() + }; } // Otherwise we need to find the asset here. It may either be in our @@ -351,6 +381,21 @@ pub(crate) fn spawn( } } +fn handle_coverage_dump(profraw_path: &Path, request: &Request) -> anyhow::Result<()> { + // This is run after all tests are done and dumps the data received in the request + // into a single profraw file + let mut profraw = std::fs::File::create(profraw_path)?; + let mut data = Vec::new(); + if let Some(mut r_data) = request.data() { + r_data.read_to_end(&mut data)?; + } + // Warnings about empty data should have already been handled by + // the client + + profraw.write_all(&data)?; + Ok(()) +} + /* * Set the Cross-Origin-Opener-Policy and Cross-Origin_Embedder-Policy headers * on the Server response to enable worker context sharing, as described in: diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index e448a0d2285..9a738c7a533 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -31,3 +31,8 @@ trybuild = "1.0" wasm-bindgen = { path = "../.." } wasm-bindgen-futures = { path = "../futures" } web-sys = { path = "../web-sys", features = ["Worker"] } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(wasm_bindgen_unstable_test_coverage)', +] } diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index aa4ab3f066b..2c1fa471ce2 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -1,4 +1,9 @@ #![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")] +#![cfg_attr( + wasm_bindgen_unstable_test_coverage, + feature(allow_internal_unstable), + allow(internal_features) +)] extern crate proc_macro; @@ -6,6 +11,10 @@ use proc_macro::TokenStream; use quote::quote; #[proc_macro_attribute] +#[cfg_attr( + wasm_bindgen_unstable_test_coverage, + allow_internal_unstable(coverage_attribute) +)] pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand(attr.into(), input.into()) { Ok(tokens) => { @@ -32,6 +41,10 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { /// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js")); /// ``` #[proc_macro] +#[cfg_attr( + wasm_bindgen_unstable_test_coverage, + allow_internal_unstable(coverage_attribute) +)] pub fn link_to(input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_link_to(input.into()) { Ok(tokens) => { @@ -48,6 +61,10 @@ pub fn link_to(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] +#[cfg_attr( + wasm_bindgen_unstable_test_coverage, + allow_internal_unstable(coverage_attribute) +)] pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { Ok(tokens) => { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 61b7c19a0bd..89b6bf48223 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -20,3 +20,8 @@ syn = { version = "2.0", default-features = false, features = [ "parsing", "proc [dev-dependencies] wasm-bindgen-test = { path = "../test" } trybuild = "1.0" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(wasm_bindgen_unstable_test_coverage)', +] } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index c3829df823c..d9bd781481a 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -1,6 +1,12 @@ //! See the README for `wasm-bindgen-test` for a bit more info about what's //! going on here. +#![cfg_attr( + wasm_bindgen_unstable_test_coverage, + feature(allow_internal_unstable), + allow(internal_features) +)] + extern crate proc_macro; use proc_macro2::*; @@ -12,6 +18,10 @@ use std::sync::atomic::*; static CNT: AtomicUsize = AtomicUsize::new(0); #[proc_macro_attribute] +#[cfg_attr( + wasm_bindgen_unstable_test_coverage, + allow_internal_unstable(coverage_attribute) +)] pub fn wasm_bindgen_test( attr: proc_macro::TokenStream, body: proc_macro::TokenStream, @@ -102,6 +112,7 @@ pub fn wasm_bindgen_test( tokens.extend( quote! { #[no_mangle] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 4a8dfdf21c3..e8135d9a6fb 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -18,5 +18,13 @@ wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.42' } gg-alloc = { version = "1.0", optional = true } +[target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] +minicov = "0.3" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(wasm_bindgen_unstable_test_coverage)', +] } + [lib] test = false diff --git a/crates/test/src/coverage.rs b/crates/test/src/coverage.rs new file mode 100644 index 00000000000..a28bc734780 --- /dev/null +++ b/crates/test/src/coverage.rs @@ -0,0 +1,24 @@ +use wasm_bindgen::prelude::wasm_bindgen; + +#[cfg(wasm_bindgen_unstable_test_coverage)] +#[wasm_bindgen] +pub fn __wbgtest_cov_dump() -> Vec { + let mut coverage = Vec::new(); + // SAFETY: this function is not thread-safe, but our whole test runner is running single-threaded. + unsafe { + minicov::capture_coverage(&mut coverage).unwrap(); + } + if coverage.is_empty() { + console_error!( + "Empty coverage data received. Make sure you compile the tests with + RUSTFLAGS=\"-Cinstrument-coverage -Zno-profile-runtime --emit=llvm-ir\"", + ); + } + coverage +} + +#[cfg(not(wasm_bindgen_unstable_test_coverage))] +#[wasm_bindgen] +pub fn __wbgtest_cov_dump() -> Vec { + Vec::new() +} diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index d05d46f5785..2827dbcbe4d 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -12,12 +12,21 @@ pub use wasm_bindgen_test_macro::wasm_bindgen_test; #[global_allocator] static A: gg_alloc::GgAlloc = gg_alloc::GgAlloc::new(std::alloc::System); +/// Helper macro which acts like `println!` only routes to `console.error` +/// instead. +#[macro_export] +macro_rules! console_error { + ($($arg:tt)*) => ( + $crate::__rt::console_error(&format_args!($($arg)*)) + ) +} + /// Helper macro which acts like `println!` only routes to `console.log` /// instead. #[macro_export] macro_rules! console_log { ($($arg:tt)*) => ( - $crate::__rt::log(&format_args!($($arg)*)) + $crate::__rt::console_log(&format_args!($($arg)*)) ) } @@ -87,3 +96,9 @@ macro_rules! wasm_bindgen_test_configure { #[path = "rt/mod.rs"] pub mod __rt; + +// Make this only available to wasm32 so that we don't +// import minicov on other archs. +// That way you can use normal cargo test without minicov +#[cfg(target_arch = "wasm32")] +mod coverage; diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index b89646026c1..838156155b3 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -239,16 +239,25 @@ extern "C" { #[doc(hidden)] pub fn js_console_log(s: &str); + #[wasm_bindgen(js_namespace = console, js_name = error)] + #[doc(hidden)] + pub fn js_console_error(s: &str); + // General-purpose conversion into a `String`. #[wasm_bindgen(js_name = String)] fn stringify(val: &JsValue) -> String; } /// Internal implementation detail of the `console_log!` macro. -pub fn log(args: &fmt::Arguments) { +pub fn console_log(args: &fmt::Arguments) { js_console_log(&args.to_string()); } +/// Internal implementation detail of the `console_error!` macro. +pub fn console_error(args: &fmt::Arguments) { + js_console_error(&args.to_string()); +} + #[wasm_bindgen(js_class = WasmBindgenTestContext)] impl Context { /// Creates a new context ready to run tests. diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index c13a23f64b8..61357c1b12c 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -18,6 +18,7 @@ #![deny(missing_docs)] +use anyhow::{bail, ensure}; use std::collections::{BTreeMap, BTreeSet, HashMap}; use walrus::ir::Instr; use walrus::{ElementId, FunctionId, LocalId, Module, TableId}; @@ -239,7 +240,14 @@ impl Interpreter { } for (instr, _) in block.instrs.iter() { - frame.eval(instr); + if let Err(err) = frame.eval(instr) { + if let Some(name) = &module.funcs.get(id).name { + panic!("{name}: {err}") + } else { + panic!("{err}") + } + } + if frame.done { break; } @@ -256,7 +264,7 @@ struct Frame<'a> { } impl Frame<'_> { - fn eval(&mut self, instr: &Instr) { + fn eval(&mut self, instr: &Instr) -> anyhow::Result<()> { use walrus::ir::*; let stack = &mut self.interp.scratch; @@ -264,7 +272,7 @@ impl Frame<'_> { match instr { Instr::Const(c) => match c.value { Value::I32(n) => stack.push(n), - _ => panic!("non-i32 constant"), + _ => bail!("non-i32 constant"), }, Instr::LocalGet(e) => stack.push(self.locals.get(&e.local).cloned().unwrap_or(0)), Instr::LocalSet(e) => { @@ -291,7 +299,7 @@ impl Frame<'_> { stack.push(match e.op { BinaryOp::I32Sub => lhs - rhs, BinaryOp::I32Add => lhs + rhs, - op => panic!("invalid binary op {:?}", op), + op => bail!("invalid binary op {:?}", op), }); } @@ -300,23 +308,23 @@ impl Frame<'_> { // theory there doesn't need to be. Instr::Load(e) => { let address = stack.pop().unwrap(); - assert!( + ensure!( address > 0, "Read a negative address value from the stack. Did we run out of memory?" ); let address = address as u32 + e.arg.offset; - assert!(address % 4 == 0); + ensure!(address % 4 == 0); stack.push(self.interp.mem[address as usize / 4]) } Instr::Store(e) => { let value = stack.pop().unwrap(); let address = stack.pop().unwrap(); - assert!( + ensure!( address > 0, "Read a negative address value from the stack. Did we run out of memory?" ); let address = address as u32 + e.arg.offset; - assert!(address % 4 == 0); + ensure!(address % 4 == 0); self.interp.mem[address as usize / 4] = value; } @@ -356,10 +364,27 @@ impl Frame<'_> { // ... otherwise this is a normal call so we recurse. } else { + // Skip profiling related functions which we don't want to interpret. + if self + .module + .funcs + .get(e.func) + .name + .as_ref() + .is_some_and(|name| { + name.starts_with("__llvm_profile_init") + || name.starts_with("__llvm_profile_register_function") + || name.starts_with("__llvm_profile_register_function") + }) + { + return Ok(()); + } + let ty = self.module.types.get(self.module.funcs.get(e.func).ty()); let args = (0..ty.params().len()) .map(|_| stack.pop().unwrap()) .collect::>(); + self.interp.call(e.func, self.module, &args); } } @@ -373,7 +398,9 @@ impl Frame<'_> { // Note that LLVM may change over time to generate new // instructions in debug mode, and we'll have to react to those // sorts of changes as they arise. - s => panic!("unknown instruction {:?}", s), + s => bail!("unknown instruction {:?}", s), } + + Ok(()) } } diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 7ba50cd5042..d11123ee764 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -111,6 +111,7 @@ - [Writing Asynchronous Tests](./wasm-bindgen-test/asynchronous-tests.md) - [Testing in Headless Browsers](./wasm-bindgen-test/browsers.md) - [Continuous Integration](./wasm-bindgen-test/continuous-integration.md) + - [Coverage (Experimental)](./wasm-bindgen-test/coverage.md) - [Contributing to `wasm-bindgen`](./contributing/index.md) - [Testing](./contributing/testing.md) diff --git a/guide/src/wasm-bindgen-test/coverage.md b/guide/src/wasm-bindgen-test/coverage.md new file mode 100644 index 00000000000..6172877917b --- /dev/null +++ b/guide/src/wasm-bindgen-test/coverage.md @@ -0,0 +1,83 @@ +# Generating Coverage Data + +You can ask the runner to generate coverage data from functions marked as `#[wasm_bindgen_test]` in the `.profraw` format. + +
+ Coverage is still in an experimental state, requires Rust Nightly, may be + unreliable and could experience breaking changes at any time. +
+ +## Enabling the feature + +To enable this feature, you need to set `cfg(wasm_bindgen_unstable_test_coverage)` for `wasm-bindgen-test` and its dependencies. + +Currently it is particularly difficult to [deliver compile-line arguments to proc-macros when cross-compiling with Cargo][1]. To circumvent this [host-config] can be used. + +[1]: https://github.com/rust-lang/cargo/issues/4423 +[host-config]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#host-config + +## Generating the data + +### `RUSTFLAGS` that need to be present + +Make sure you are using `RUSTFLAGS=-Cinstrument-coverage -Zno-profiler-runtime`. + +Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted. Clang must use the same LLVM version that Rustc is using, which can be checkd by calling `rustc +nightly -vV`. + +### Arguments to the test runner + +The following environment variables can be used to control the coverage output when [executing the test runner][2]: + +- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT` to control the file name of the profraw or the directory in which it is placed +- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_PREFIX` to add a custom prefix to the profraw files. This can be useful if you're running the tests automatically in succession. + +[2]: usage.html#appendix-using-wasm-bindgen-test-without-wasm-pack + +### Target features + +This feature relies on the [minicov] crate, which provides a profiling runtime for WebAssembly. It in turn uses [cc] to compile the runtime to Wasm, which [currently doesn't support accounting for target feature][3]. Use e.g. `CFLAGS_wasm32_unknown_unknown="-matomics -mbulk-memory"` to account for that. + +[3]: https://github.com/rust-lang/cc-rs/issues/268 +[cc]: https://crates.io/crates/cc +[minicov]: https://crates.io/crates/minicov + +### Example + +```sh +# Run the tests: +# - `CARGO_HOST_RUSTFLAGS` to pass the configuration to `wasm-bindgen-macro`. +# - `-Ztarget-applies-to-host -Zhost-config` to enable `CARGO_HOST_RUSTFLAGS`. +# - `--tests` to not run documentation tests, which is currently not supported. +CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ +RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ +CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner \ +cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests +# Adjust the LLVM IR and compile to object files: +# - Replaces every function body with `unreachable`. +# - Removes Rust-specific `range` annotations from function signatures. +name=name_of_the_tested_crate_in_snake_case; \ +for file in `ls target/wasm32-unknown-unknown/debug/deps/$name-*.ll`; \ +do \ + perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file && \ + perl -i -p0e 's/(?<=noundef) range\(.*?\)//g' $file && \ + clang $file -Wno-override-module -c; \ +done +# Merge all generated raw profiling data. +# This uses `cargo-binutils` which uses LLVM tools shipped by Rust to make sure there is no LLVM version discrepancy. +# But `llvm-profdata` can be used directly as well. +# See . +rust-profdata merge -sparse ./*.profraw -o coverage.profdata +# Produce test coverage data in the HTML format. +rust-cov show --instr-profile=coverage.profdata --object ./*.o --format=html --Xdemangler=rust-demangler --sources src --output-dir coverage +``` + +The [rustc book] has a lot more exapmles and information on test coverage as well. + +[rustc book]: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html + +## Attribution + +These methods have originally been pioneered by [Hacken OÜ], see [their guide][4] as well. + +[4]: https://hknio.github.io/wasmcov +[Hacken OÜ]: https://hacken.io diff --git a/src/closure.rs b/src/closure.rs index b038b1775ba..8cda5f896a7 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -331,12 +331,14 @@ where // See crates/cli-support/src/js/closures.rs for a more information // about what's going on here. + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] extern "C" fn describe() { inform(CLOSURE); T::describe() } #[inline(never)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe fn breaks_if_inlined(a: usize, b: usize) -> u32 { super::__wbindgen_describe_closure(a as u32, b as u32, describe:: as u32) } @@ -462,6 +464,7 @@ impl WasmDescribe for Closure where T: WasmClosure + ?Sized, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(EXTERNREF); } @@ -562,8 +565,10 @@ macro_rules! doit { where $($var: FromWasmAbi + 'static,)* R: ReturnWasmAbi + 'static, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #[allow(non_snake_case)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, @@ -619,8 +624,10 @@ macro_rules! doit { where $($var: FromWasmAbi + 'static,)* R: ReturnWasmAbi + 'static, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #[allow(non_snake_case)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, b: usize, @@ -760,8 +767,10 @@ where A: RefFromWasmAbi, R: ReturnWasmAbi + 'static, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #[allow(non_snake_case)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke( a: usize, b: usize, @@ -786,6 +795,7 @@ where inform(invoke:: as u32); + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn destroy(a: usize, b: usize) { // See `Fn()` above for why we simply return if a == 0 { @@ -806,8 +816,10 @@ where A: RefFromWasmAbi, R: ReturnWasmAbi + 'static, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #[allow(non_snake_case)] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke( a: usize, b: usize, @@ -833,6 +845,7 @@ where inform(invoke:: as u32); + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn destroy(a: usize, b: usize) { // See `Fn()` above for why we simply return if a == 0 { diff --git a/src/convert/closures.rs b/src/convert/closures.rs index 8227a6b622f..dbe1318cb72 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -54,6 +54,7 @@ macro_rules! stack_closures { where $($var: FromWasmAbi,)* R: ReturnWasmAbi { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); inform($invoke::<$($var,)* R> as u32); @@ -108,6 +109,7 @@ macro_rules! stack_closures { where $($var: FromWasmAbi,)* R: ReturnWasmAbi { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); inform($invoke_mut::<$($var,)* R> as u32); @@ -151,6 +153,7 @@ where } #[allow(non_snake_case)] +#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke1_ref( a: usize, b: usize, @@ -177,6 +180,7 @@ where A: RefFromWasmAbi, R: ReturnWasmAbi, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); inform(invoke1_ref:: as u32); @@ -206,6 +210,7 @@ where } #[allow(non_snake_case)] +#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn invoke1_mut_ref( a: usize, b: usize, @@ -232,6 +237,7 @@ where A: RefFromWasmAbi, R: ReturnWasmAbi, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); inform(invoke1_mut_ref:: as u32); diff --git a/src/convert/slices.rs b/src/convert/slices.rs index ee922b901b2..99adc9b3745 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -123,6 +123,7 @@ impl DerefMut for MutSlice { macro_rules! vectors { ($($t:ident)*) => ($( impl WasmDescribeVector for $t { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { inform(VECTOR); $t::describe(); @@ -225,6 +226,7 @@ vectors! { } impl WasmDescribeVector for String { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { inform(VECTOR); inform(NAMED_EXTERNREF); diff --git a/src/describe.rs b/src/describe.rs index 58b02e17a22..f7e9e83d2cf 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -56,6 +56,7 @@ tys! { } #[inline(always)] // see the wasm-interpreter crate +#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub fn inform(a: u32) { unsafe { super::__wbindgen_describe(a) } } @@ -73,6 +74,7 @@ pub trait WasmDescribeVector { macro_rules! simple { ($($t:ident => $d:ident)*) => ($( impl WasmDescribe for $t { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform($d) } } )*) @@ -110,24 +112,28 @@ cfg_if! { } impl WasmDescribe for *const T { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(U32) } } impl WasmDescribe for *mut T { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(U32) } } impl WasmDescribe for NonNull { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(NONNULL) } } impl WasmDescribe for [T] { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(SLICE); T::describe(); @@ -135,6 +141,7 @@ impl WasmDescribe for [T] { } impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a T { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(REF); T::describe(); @@ -142,6 +149,7 @@ impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a T { } impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a mut T { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(REFMUT); T::describe(); @@ -162,6 +170,7 @@ cfg_if! { } impl WasmDescribeVector for JsValue { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { inform(VECTOR); JsValue::describe(); @@ -169,6 +178,7 @@ impl WasmDescribeVector for JsValue { } impl WasmDescribeVector for T { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { inform(VECTOR); T::describe(); @@ -176,6 +186,7 @@ impl WasmDescribeVector for T { } impl WasmDescribe for Box<[T]> { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { T::describe_vector(); } @@ -185,12 +196,14 @@ impl WasmDescribe for Vec where Box<[T]>: WasmDescribe, { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { >::describe(); } } impl WasmDescribe for Option { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(OPTIONAL); T::describe(); @@ -198,12 +211,14 @@ impl WasmDescribe for Option { } impl WasmDescribe for () { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(UNIT) } } impl> WasmDescribe for Result { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(RESULT); T::describe(); @@ -211,6 +226,7 @@ impl> WasmDescribe for Result { } impl WasmDescribe for Clamped { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(CLAMPED); T::describe(); @@ -218,6 +234,7 @@ impl WasmDescribe for Clamped { } impl WasmDescribe for JsError { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { JsValue::describe(); } diff --git a/src/lib.rs b/src/lib.rs index e8e30b9aa95..23cc9db2f0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ //! interface. #![no_std] +#![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] #![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] @@ -1877,6 +1878,7 @@ pub mod __rt { /// in the object file and link the intrinsics. /// /// Ideas for how to improve this are most welcome! + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub fn link_mem_intrinsics() { crate::link::link_intrinsics(); } diff --git a/src/link.rs b/src/link.rs index aa75707700e..4d9858189ab 100644 --- a/src/link.rs +++ b/src/link.rs @@ -1,3 +1,4 @@ // see comment in module above this in `link_mem_intrinsics` #[inline(never)] +#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub fn link_intrinsics() {} From 031fe890a5e8b2381896e4e2ac9682d6ceafde75 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 11 Aug 2024 15:47:29 +0200 Subject: [PATCH 460/641] Improve the CI runtime, take two (#4058) --- .github/workflows/main.yml | 223 ++++++++++++-------------- .gitignore | 1 + _package.json | 15 -- crates/example-tests/Cargo.toml | 12 +- crates/example-tests/tests/shell.rs | 8 + crates/example-tests/tests/webpack.rs | 2 + 6 files changed, 122 insertions(+), 139 deletions(-) delete mode 100644 _package.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcc080ee31c..d3a57be9904 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,7 +93,18 @@ jobs: - run: for i in examples/*/; do cd "$i"; cargo +stable clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings || exit 1; cd ../..; done test_wasm_bindgen: - name: "Run wasm-bindgen crate tests (unix)" + strategy: + matrix: + runs: + - name: "wasm-bindgen" + run: | + cargo test --target wasm32-unknown-unknown + cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures + - name: "wasm-bindgen (serde-serialize)" + run: cargo test --target wasm32-unknown-unknown --features serde-serialize + - name: "wasm-bindgen (enable-interning)" + run: cargo test --target wasm32-unknown-unknown --features enable-interning + name: "Run wasm-bindgen crate tests (${{ matrix.runs.name }})" runs-on: ubuntu-latest env: WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 @@ -105,24 +116,7 @@ jobs: with: node-version: '20' - uses: ./.github/actions/setup-geckodriver - - run: cargo test --target wasm32-unknown-unknown - - run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures - - test_wasm_bindgen_features: - name: "Run wasm-bindgen crate tests with different features" - runs-on: ubuntu-latest - env: - WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - uses: ./.github/actions/setup-geckodriver - - run: cargo test --target wasm32-unknown-unknown --features serde-serialize - - run: cargo test --target wasm32-unknown-unknown --features enable-interning + - run: ${{ matrix.runs.run }} test_wasm_bindgen_wasm: name: "Run wasm-bindgen wasm test" @@ -141,10 +135,21 @@ jobs: WASM_BINDGEN_NO_DEBUG: 1 test_wasm_bindgen_envs: - name: "Run wasm-bindgen crate tests with various environment variables" + strategy: + matrix: + envs: + - name: "externref" + env: + WASM_BINDGEN_EXTERNREF: 1 + - name: "multi-value" + env: + WASM_BINDGEN_MULTI_VALUE: 1 + name: "Run wasm-bindgen crate tests with ${{ matrix.envs.name }} feature" runs-on: ubuntu-latest env: WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 + WASM_BINDGEN_EXTERNREF: ${{ matrix.envs.WASM_BINDGEN_EXTERNREF }} + WASM_BINDGEN_MULTI_VALUE: ${{ matrix.envs.WASM_BINDGEN_MULTI_VALUE }} steps: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable @@ -153,14 +158,9 @@ jobs: with: node-version: '20' - run: cargo test --target wasm32-unknown-unknown - env: - WASM_BINDGEN_EXTERNREF: 1 - - run: cargo test --target wasm32-unknown-unknown - env: - WASM_BINDGEN_MULTI_VALUE: 1 test_threads: - name: "Run wasm-bindgen crate tests with multithreading enabled" + name: "Run wasm-bindgen crate tests with multithreading" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -215,61 +215,44 @@ jobs: - run: cargo test -p wasm-bindgen-futures - run: cargo test -p wasm-bindgen-shared - test_web_sys: - name: "Run web-sys crate tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - uses: ./.github/actions/setup-geckodriver - - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown - - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node - - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element - - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window - - test_web_sys_all_features: - name: "Run web-sys crate tests with all features" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - uses: ./.github/actions/setup-geckodriver - - run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features - - test_web_sys_all_features_unstable: - name: "Run web-sys crate tests with all features and unstable APIs" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - uses: ./.github/actions/setup-geckodriver - - run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features - env: - RUSTFLAGS: --cfg=web_sys_unstable_apis - - check_web_sys: - name: "Verify that web-sys is compiled correctly" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml - - run: git diff --exit-code - - test_js_sys: - name: "Run js-sys crate tests" + test_with_geckodriver: + strategy: + matrix: + runs: + - name: "web-sys" + run: | + cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown + cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node + cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element + cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window + - name: "web-sys (all features)" + run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features + - name: "web-sys (unstable, all features)" + run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis + - name: "js-sys" + run: cargo test -p js-sys --target wasm32-unknown-unknown + - name: "js-sys (unstable)" + run: cargo test -p js-sys --target wasm32-unknown-unknown + env: + RUSTFLAGS: --cfg=js_sys_unstable_apis + - name: "wasm-bindgen-webidl" + run: cargo test -p wasm-bindgen-webidl + - name: "webidl-tests" + run: cargo test -p webidl-tests --target wasm32-unknown-unknown + env: + WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 + - name: "webidl-tests (unstable)" + run: cargo test -p webidl-tests --target wasm32-unknown-unknown + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis + - name: "typescript-tests" + run: cd crates/typescript-tests && ./run.sh + name: "Run ${{ matrix.runs.name }} tests (with geckodriver)" + env: + RUSTFLAGS: ${{ matrix.runs.env.RUSTFLAGS }} + WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: ${{ matrix.runs.env.WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -279,40 +262,7 @@ jobs: with: node-version: '20' - uses: ./.github/actions/setup-geckodriver - - run: cargo test -p js-sys --target wasm32-unknown-unknown - - run: cargo test -p js-sys --target wasm32-unknown-unknown - env: - RUSTFLAGS: --cfg=js_sys_unstable_apis - - test_webidl: - name: "Run wasm-bindgen-webidl crate tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - run: cargo test -p wasm-bindgen-webidl - - run: cargo test -p webidl-tests --target wasm32-unknown-unknown - env: - WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 - - run: cargo test -p webidl-tests --target wasm32-unknown-unknown - env: - RUSTFLAGS: --cfg=web_sys_unstable_apis - - test_typescript_output: - name: "Test TypeScript output of wasm-bindgen" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add wasm32-unknown-unknown - - uses: actions/setup-node@v4 - with: - node-version: '20' - - run: cd crates/typescript-tests && ./run.sh + - run: ${{ matrix.runs.run }} test_deno: name: "Build and test the deno example" @@ -335,6 +285,15 @@ jobs: - run: cargo test -p wasm-bindgen-macro - run: cargo test -p wasm-bindgen-test-macro + build_webidl: + name: "Verify that web-sys is compiled correctly" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml + - run: git diff --exit-code + build_examples: runs-on: ubuntu-latest steps: @@ -349,14 +308,22 @@ jobs: - run: | cargo build -p wasm-bindgen-cli ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen - - run: mv _package.json package.json && npm install && rm package.json + # crete a workspace of all examples and install their dependencies at once + # sed is used to convert the literal "\n" to a newline character - run: | - for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet`; do - (cd examples/$dir && - (npm run build -- --output-path ../../exbuild/$dir || - (./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir && rm ../../exbuild/$dir/**/.gitignore)) + [ -f pnpm-workspace.yaml ] || (echo 'packages:\n - "examples/*"' > pnpm-workspace.yaml && sed -i -e 's/\\n/\n/g' pnpm-workspace.yaml) + - run: | + [ -f package.json ] || (echo '{}' > package.json) + - run: corepack pnpm install -r + - run: | + function build() { + (cd examples/$1 && + (corepack pnpm run build -- --output-path ../../exbuild/$1 || + (./build.sh && mkdir -p ../../exbuild/$1 && cp -r ./* ../../exbuild/$1 && rm ../../exbuild/$1/**/.gitignore)) ) || exit 1; - done + } + export -f build + ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet | parallel -j4 build env: RUSTFLAGS: --cfg=web_sys_unstable_apis - uses: actions/upload-artifact@v4 @@ -385,7 +352,6 @@ jobs: test_examples: needs: - build_examples - - build_nightly runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -393,12 +359,23 @@ jobs: with: name: examples1 path: exbuild + - run: rustup update --no-self-update stable && rustup default stable + - run: cargo test -p example-tests + env: + EXBUILD: ${{ github.workspace }}/exbuild + + test_nightly: + needs: + - build_nightly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: examples2 path: exbuild - run: rustup update --no-self-update stable && rustup default stable - - run: cargo test -p example-tests + - run: cargo test -p example-tests --no-default-features --features nightly env: EXBUILD: ${{ github.workspace }}/exbuild diff --git a/.gitignore b/.gitignore index 57e7ac31a73..cb63ac51317 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ Cargo.lock node_modules package-lock.json npm-shrinkwrap.json +pnpm-lock.yaml yarn.lock /publish /publish.exe diff --git a/_package.json b/_package.json deleted file mode 100644 index d347502d91f..00000000000 --- a/_package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "scripts": { - "build": "webpack", - "serve": "webpack serve" - }, - "devDependencies": { - "@wasm-tool/wasm-pack-plugin": "1.5.0", - "css-loader": "^7.1.2", - "html-webpack-plugin": "^5.6.0", - "mini-css-extract-plugin": "^2.9.0", - "webpack": "^5.93.0", - "webpack-cli": "^5.1.4", - "webpack-dev-server": "5.0.4" - } -} diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 6f12da85a38..03fdfe5c43c 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -5,12 +5,22 @@ authors = ["The wasm-bindgen Developers"] edition = "2021" publish = false +[features] +default = ["stable"] +stable = [] +nightly = [] + [dependencies] anyhow = "1.0.75" futures-util = { version = "0.3.28", features = ["sink"] } http = "1" hyper = "1" -hyper-util = { version = "0.1.6", features = ["http1", "service", "server", "tokio"] } +hyper-util = { version = "0.1.6", features = [ + "http1", + "service", + "server", + "tokio", +] } mozprofile = "0.9" mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } diff --git a/crates/example-tests/tests/shell.rs b/crates/example-tests/tests/shell.rs index 19af0db4fec..f333e3a2058 100644 --- a/crates/example-tests/tests/shell.rs +++ b/crates/example-tests/tests/shell.rs @@ -34,14 +34,22 @@ macro_rules! shell_tests { } shell_tests! { + #[cfg(feature = "nightly")] #["RUSTUP_TOOLCHAIN" = "nightly"] raytrace_parallel = "raytrace-parallel", + #[cfg(feature = "stable")] synchronous_instantiation = "synchronous-instantiation", + #[cfg(feature = "stable")] wasm2js = "wasm2js", + #[cfg(feature = "nightly")] #["RUSTUP_TOOLCHAIN" = "nightly"] wasm_audio_worklet = "wasm-audio-worklet", + #[cfg(feature = "stable")] wasm_in_web_worker = "wasm-in-web-worker", + #[cfg(feature = "stable")] websockets = "websockets", + #[cfg(feature = "stable")] without_a_bundler = "without-a-bundler", + #[cfg(feature = "stable")] without_a_bundler_no_modules = "without-a-bundler-no-modules", } diff --git a/crates/example-tests/tests/webpack.rs b/crates/example-tests/tests/webpack.rs index d3927c2e6f9..8cc233283b3 100644 --- a/crates/example-tests/tests/webpack.rs +++ b/crates/example-tests/tests/webpack.rs @@ -48,6 +48,7 @@ async fn test_webpack_example(name: &str) -> anyhow::Result<()> { .await } +#[allow(unused_macros)] macro_rules! webpack_tests { ($( $(#[$attr:meta])* @@ -63,6 +64,7 @@ macro_rules! webpack_tests { }; } +#[cfg(feature = "stable")] webpack_tests! { add = "add", canvas = "canvas", From d3872f17d3e6fbed19eef71a8056b904b5c0fb63 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 11 Aug 2024 21:26:58 +0200 Subject: [PATCH 461/641] Handle empty coverage report (#4063) --- .../bin/wasm-bindgen-test-runner/server.rs | 11 +++-- crates/cli/tests/reference/raw.js | 48 +++++++++---------- crates/test/src/coverage.rs | 8 ++-- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index ad3678b1cae..d0eee0c81d5 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -31,10 +31,13 @@ pub(crate) fn spawn( let cov_dump = r#" // Dump the coverage data collected during the tests const coverage = __wbgtest_cov_dump(); - await fetch("/__wasm_bindgen/coverage", { - method: "POST", - body: coverage - }); + + if (coverage !== undefined) { + await fetch("/__wasm_bindgen/coverage", { + method: "POST", + body: coverage + }); + } "#; let wbg_import_script = if test_mode.no_modules() { diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6b831debb89..3432d150366 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -45,6 +25,26 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); -}; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + diff --git a/crates/test/src/coverage.rs b/crates/test/src/coverage.rs index a28bc734780..855e6a3d1e3 100644 --- a/crates/test/src/coverage.rs +++ b/crates/test/src/coverage.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::wasm_bindgen; #[cfg(wasm_bindgen_unstable_test_coverage)] #[wasm_bindgen] -pub fn __wbgtest_cov_dump() -> Vec { +pub fn __wbgtest_cov_dump() -> Option> { let mut coverage = Vec::new(); // SAFETY: this function is not thread-safe, but our whole test runner is running single-threaded. unsafe { @@ -14,11 +14,11 @@ pub fn __wbgtest_cov_dump() -> Vec { RUSTFLAGS=\"-Cinstrument-coverage -Zno-profile-runtime --emit=llvm-ir\"", ); } - coverage + Some(coverage) } #[cfg(not(wasm_bindgen_unstable_test_coverage))] #[wasm_bindgen] -pub fn __wbgtest_cov_dump() -> Vec { - Vec::new() +pub fn __wbgtest_cov_dump() -> Option> { + None } From 5d45bd637c88e7745a1c7d03cb20e2b6e88934e4 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 12 Aug 2024 15:37:20 +0200 Subject: [PATCH 462/641] Fix test coverage documentation (#4064) --- guide/src/wasm-bindgen-test/coverage.md | 55 +++++++++++++++++-------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/guide/src/wasm-bindgen-test/coverage.md b/guide/src/wasm-bindgen-test/coverage.md index 6172877917b..d1a66d9315f 100644 --- a/guide/src/wasm-bindgen-test/coverage.md +++ b/guide/src/wasm-bindgen-test/coverage.md @@ -22,7 +22,11 @@ Currently it is particularly difficult to [deliver compile-line arguments to pro Make sure you are using `RUSTFLAGS=-Cinstrument-coverage -Zno-profiler-runtime`. -Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted. Clang must use the same LLVM version that Rustc is using, which can be checkd by calling `rustc +nightly -vV`. +Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted. + +At the time of writing Rust Nightly uses LLVM v19, however [minicov] only supports LLVM v18. Usage of Clang or any LLVM tools must match the version used by [minicov]. + +[minicov]: https://crates.io/crates/minicov ### Arguments to the test runner @@ -43,6 +47,8 @@ This feature relies on the [minicov] crate, which provides a profiling runtime f ### Example +This adapts code taken from the [Rustc book], see that for more examples and general information on test coverage as well. + ```sh # Run the tests: # - `CARGO_HOST_RUSTFLAGS` to pass the configuration to `wasm-bindgen-macro`. @@ -53,26 +59,41 @@ RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner \ cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests # Adjust the LLVM IR and compile to object files: -# - Replaces every function body with `unreachable`. -# - Removes Rust-specific `range` annotations from function signatures. -name=name_of_the_tested_crate_in_snake_case; \ -for file in `ls target/wasm32-unknown-unknown/debug/deps/$name-*.ll`; \ -do \ - perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file && \ - perl -i -p0e 's/(?<=noundef) range\(.*?\)//g' $file && \ - clang $file -Wno-override-module -c; \ +# - Extract a list of compiled artifacts from Cargo and filter them with `jq`. +# - Figure out the path to the LLVM IR file corresponding to an artifact. +# - Replace every function body with `unreachable`. +# - Remove Rust-specific `range` annotations from function signatures. +# - Compile to object file with Clang and store for later usage with `llvm-cov`. +crate_name=name_of_the_tested_crate_in_snake_case +objects=() +IFS=$'\n' +for file in $( + CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ + RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ + cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \ + jq -r "select(.reason == \"compiler-artifact\") | (select(.target.kind == [\"test\"]) // select(.target.name == \"$crate_name\")) | .filenames[0]" +) +do + if [[ ${file##*.} == "rlib" ]]; then + base=$(basename $file .rlib) + file=$(dirname $file)/${base#"lib"}.ll + else + file=$(dirname $file)/$(basename $file .wasm).ll + fi + + perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file + perl -i -p0e 's/(^define( [^ ]+)*) range\(.*?\)/$1/gm' $file + + output = $(basename $file .ll).o + clang-18 $input -Wno-override-module -c -o $output + objects+=(-object $output) done # Merge all generated raw profiling data. -# This uses `cargo-binutils` which uses LLVM tools shipped by Rust to make sure there is no LLVM version discrepancy. -# But `llvm-profdata` can be used directly as well. -# See . -rust-profdata merge -sparse ./*.profraw -o coverage.profdata -# Produce test coverage data in the HTML format. -rust-cov show --instr-profile=coverage.profdata --object ./*.o --format=html --Xdemangler=rust-demangler --sources src --output-dir coverage +llvm-profdata-18 merge -sparse *.profraw -o coverage.profdata +# Produce test coverage data in the HTML format and pass the object files we generated earlier. +llvm-cov-18 show -show-instantiations=false -Xdemangler=rustfilt -output-dir coverage -format=html -instr-profile=coverage.profdata ${objects[@]} -sources src ``` -The [rustc book] has a lot more exapmles and information on test coverage as well. - [rustc book]: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html ## Attribution From e845f51148fc95360aa5ec1c4a2e58316b70f804 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 00:48:23 +0200 Subject: [PATCH 463/641] Use object URLs for inlined linked modules (#4067) --- CHANGELOG.md | 3 ++ Cargo.toml | 1 + crates/backend/src/codegen.rs | 10 ++++--- crates/cli-support/src/js/mod.rs | 8 ++++-- crates/cli/tests/reference/raw.js | 48 +++++++++++++++---------------- src/lib.rs | 1 + 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02e23a00a4f..1548e21c8af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -141,6 +141,9 @@ * Updated the WebGPU WebIDL to the current draft as of 2024-08-05. [#4062](https://github.com/rustwasm/wasm-bindgen/pull/4062) +* Use object URLs for linked modules without `--split-linked-modules`. + [#4067](https://github.com/rustwasm/wasm-bindgen/pull/4067) + ### Fixed * Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`. diff --git a/Cargo.toml b/Cargo.toml index ca425da4c2f..282df895512 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ xxx_debug_only_print_generated_code = [ ] [dependencies] +once_cell = "1.12" wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.92" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index d11894518cb..4121ada5fdc 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -190,16 +190,18 @@ impl TryToTokens for ast::LinkToModule { let link_function_name = self.0.link_function_name(0); let name = Ident::new(&link_function_name, Span::call_site()); let wasm_bindgen = &self.0.wasm_bindgen; - let abi_ret = quote! { #wasm_bindgen::convert::WasmRet<::Abi> }; + let abi_ret = quote! { #wasm_bindgen::convert::WasmRet<<#wasm_bindgen::__rt::alloc::string::String as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; let extern_fn = extern_fn(&name, &[], &[], &[], abi_ret); (quote! { { #program #extern_fn - unsafe { - ::from_abi(#name().join()) - } + static __VAL: #wasm_bindgen::__rt::Lazy = #wasm_bindgen::__rt::Lazy::new(|| unsafe { + <#wasm_bindgen::__rt::alloc::string::String as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#name().join()) + }); + + #wasm_bindgen::__rt::alloc::string::String::clone(&__VAL) } }) .to_tokens(tokens); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index c95a2ae7892..5d655c1f707 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3262,9 +3262,11 @@ impl<'a> Context<'a> { '`' | '\\' | '$' => escaped.extend(['\\', c]), _ => escaped.extend([c]), }); - Ok(format!( - "\"data:application/javascript,\" + encodeURIComponent(`{escaped}`)" - )) + prelude.push_str(&format!("const val = `{escaped}`;\n")); + Ok("typeof URL.createObjectURL === 'undefined' ? \ + \"data:application/javascript,\" + encodeURIComponent(val) : \ + URL.createObjectURL(new Blob([val], { type: \"text/javascript\" }))" + .to_owned()) } else { Err(anyhow!("wasm-bindgen needs to be invoked with `--split-linked-modules`, because \"{}\" cannot be embedded.\n\ See https://rustwasm.github.io/wasm-bindgen/reference/cli.html#--split-linked-modules for details.", path)) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 3432d150366..6b831debb89 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -45,6 +25,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/src/lib.rs b/src/lib.rs index 23cc9db2f0c..8c512d882a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1518,6 +1518,7 @@ pub mod __rt { use alloc::alloc::{alloc, dealloc, realloc, Layout}; use alloc::boxed::Box; use alloc::rc::Rc; + pub use once_cell::sync::Lazy; #[macro_export] #[doc(hidden)] From 343af0e33e32d17e32f0cb4bfcfab9389c6df04f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 00:53:41 +0200 Subject: [PATCH 464/641] Add Dependabot (#4069) --- .github/dependabot.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/dependabot.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000000..690cf6dfac4 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,20 @@ +version: 2 + +updates: + - package-ecosystem: cargo + directory: / + schedule: + interval: daily + ignore: + - dependency-name: 'wasmparser' + - dependency-name: 'wasmprinter' + - dependency-name: 'wast' + + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + groups: + github-actions: + patterns: + - "*" From f4176dadfaaed515dc3bf5fb5ffe0d08a9305855 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 01:18:20 +0200 Subject: [PATCH 465/641] Use Taplo for TOML formatting (#4071) --- .cargo/config.toml | 18 ++++----- .github/workflows/main.yml | 13 ++++++ Cargo.toml | 40 +++++++++---------- benchmarks/Cargo.toml | 6 +-- crates/backend/Cargo.toml | 16 ++++---- crates/cli-support/Cargo.toml | 16 ++++---- crates/cli/Cargo.toml | 27 ++++++------- crates/example-tests/Cargo.toml | 13 ++---- crates/externref-xform/Cargo.toml | 16 ++++---- crates/futures/Cargo.toml | 17 ++++---- crates/js-sys/Cargo.toml | 20 +++++----- crates/macro-support/Cargo.toml | 20 +++++----- crates/macro/Cargo.toml | 22 +++++----- crates/msrv/cli/Cargo.toml | 10 ++--- crates/msrv/lib/Cargo.toml | 14 +++---- crates/multi-value-xform/Cargo.toml | 16 ++++---- crates/shared/Cargo.toml | 14 +++---- crates/test-macro/Cargo.toml | 21 +++++----- crates/test/Cargo.toml | 14 +++---- crates/test/sample/Cargo.toml | 4 +- crates/threads-xform/Cargo.toml | 18 ++++----- crates/typescript-tests/Cargo.toml | 10 ++--- crates/wasm-conventions/Cargo.toml | 16 ++++---- crates/wasm-interpreter/Cargo.toml | 14 +++---- crates/web-sys/Cargo.toml | 22 +++++----- crates/webidl-tests/Cargo.toml | 8 ++-- crates/webidl/Cargo.toml | 14 +++---- examples/add/Cargo.toml | 4 +- examples/canvas/Cargo.toml | 12 ++---- examples/char/Cargo.toml | 4 +- examples/closures/Cargo.toml | 14 ++----- examples/console_log/Cargo.toml | 4 +- examples/deno/Cargo.toml | 4 +- examples/dom/Cargo.toml | 12 ++---- examples/duck-typed-interfaces/Cargo.toml | 4 +- examples/fetch/Cargo.toml | 15 ++----- .../guide-supported-types-examples/Cargo.toml | 6 +-- examples/hello_world/Cargo.toml | 4 +- examples/import_js/crate/Cargo.toml | 4 +- examples/julia_set/Cargo.toml | 9 ++--- examples/paint/Cargo.toml | 6 +-- examples/performance/Cargo.toml | 8 ++-- examples/raytrace-parallel/Cargo.toml | 8 ++-- .../raytrace-parallel/rust-toolchain.toml | 2 +- examples/request-animation-frame/Cargo.toml | 12 ++---- examples/synchronous-instantiation/Cargo.toml | 4 +- examples/todomvc/Cargo.toml | 10 ++--- examples/wasm-audio-worklet/Cargo.toml | 6 +-- .../wasm-audio-worklet/rust-toolchain.toml | 2 +- examples/wasm-in-wasm-imports/Cargo.toml | 6 +-- examples/wasm-in-wasm/Cargo.toml | 6 +-- examples/wasm-in-web-worker/Cargo.toml | 22 +++++----- examples/wasm2js/Cargo.toml | 4 +- examples/weather_report/Cargo.toml | 12 +++--- examples/webaudio/Cargo.toml | 6 +-- examples/webgl/Cargo.toml | 6 +-- examples/webrtc_datachannel/Cargo.toml | 8 ++-- examples/websockets/Cargo.toml | 8 ++-- examples/webxr/Cargo.toml | 8 ++-- .../without-a-bundler-no-modules/Cargo.toml | 12 ++---- examples/without-a-bundler/Cargo.toml | 12 ++---- taplo.toml | 9 +++++ tests/crates/a/Cargo.toml | 4 +- tests/crates/b/Cargo.toml | 4 +- tests/no-std/Cargo.toml | 4 +- 65 files changed, 342 insertions(+), 382 deletions(-) create mode 100644 taplo.toml diff --git a/.cargo/config.toml b/.cargo/config.toml index cf1995cbc32..59337eed45f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,13 +3,13 @@ runner = 'cargo run -p wasm-bindgen-cli --bin wasm-bindgen-test-runner --' [target.'cfg(all())'] rustflags = [ - "-Adead_code", - "-Anon_upper_case_globals", - "-Aunused_doc_comments", - "-Aclippy::large_enum_variant", - "-Aclippy::missing_safety_doc", - "-Aclippy::new_without_default", - "-Aclippy::overly_complex_bool_expr", - "-Aclippy::too_many_arguments", - "-Aclippy::type_complexity" + "-Adead_code", + "-Anon_upper_case_globals", + "-Aunused_doc_comments", + "-Aclippy::large_enum_variant", + "-Aclippy::missing_safety_doc", + "-Aclippy::new_without_default", + "-Aclippy::overly_complex_bool_expr", + "-Aclippy::too_many_arguments", + "-Aclippy::type_complexity", ] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d3a57be9904..85f7ade42dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,19 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check + + # Check TOML style by using Taplo. + taplo: + name: Taplo + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: taiki-e/install-action@v2 + with: + tool: taplo-cli + - run: taplo fmt --check # Run `cargo check` over everything check: diff --git a/Cargo.toml b/Cargo.toml index 282df895512..251995815eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,19 @@ [package] -name = "wasm-bindgen" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -readme = "README.md" categories = ["wasm"] -repository = "https://github.com/rustwasm/wasm-bindgen" -homepage = "https://rustwasm.github.io/" -documentation = "https://docs.rs/wasm-bindgen" description = """ Easy support for interacting between JS and Rust. """ +documentation = "https://docs.rs/wasm-bindgen" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/" include = ["/build.rs", "/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen" +readme = "README.md" +repository = "https://github.com/rustwasm/wasm-bindgen" +rust-version = "1.57" +version = "0.2.92" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -23,10 +23,10 @@ test = false [features] default = ["spans", "std"] +enable-interning = ["std"] +serde-serialize = ["serde", "serde_json", "std"] spans = ["wasm-bindgen-macro/spans"] std = [] -serde-serialize = ["serde", "serde_json", "std"] -enable-interning = ["std"] # Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on # all unused attributes @@ -38,31 +38,28 @@ gg-alloc = ["wasm-bindgen-test/gg-alloc"] # This is only for debugging wasm-bindgen! No stability guarantees, so enable # this at your own peril! -xxx_debug_only_print_generated_code = [ - "wasm-bindgen-macro/xxx_debug_only_print_generated_code", -] +xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] [dependencies] +cfg-if = "1.0.0" once_cell = "1.12" -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.92" } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -cfg-if = "1.0.0" +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.92" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] js-sys = { path = 'crates/js-sys' } -wasm-bindgen-test = { path = 'crates/test' } -wasm-bindgen-futures = { path = 'crates/futures' } serde_derive = "1.0" +wasm-bindgen-futures = { path = 'crates/futures' } +wasm-bindgen-test = { path = 'crates/test' } wasm-bindgen-test-crate-a = { path = 'tests/crates/a' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b' } [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(wasm_bindgen_unstable_test_coverage)', -] } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } [workspace] +exclude = ["crates/msrv"] members = [ "benchmarks", "crates/cli", @@ -108,11 +105,10 @@ members = [ "examples/synchronous-instantiation", "tests/no-std", ] -exclude = ["crates/msrv"] resolver = "2" [patch.crates-io] +js-sys = { path = 'crates/js-sys' } wasm-bindgen = { path = '.' } wasm-bindgen-futures = { path = 'crates/futures' } -js-sys = { path = 'crates/js-sys' } web-sys = { path = 'crates/web-sys' } diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 5b14b808884..8c41d2d7998 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "wasm-bindgen-benchmark" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-bindgen-benchmark" publish = false +version = "0.0.0" [dependencies] +js-sys = { path = '../crates/js-sys' } wasm-bindgen = { path = '../' } web-sys = { path = '../crates/web-sys', features = ['Node'] } -js-sys = { path = '../crates/js-sys' } [lib] crate-type = ['cdylib'] diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 6852a5be5a9..a95f148fbb7 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -1,21 +1,21 @@ [package] -name = "wasm-bindgen-backend" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-backend" description = """ Backend code generation of the wasm-bindgen tool """ +documentation = "https://docs.rs/wasm-bindgen-backend" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-backend" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" +rust-version = "1.57" +version = "0.2.92" [features] -spans = [] extra-traits = ["syn/extra-traits"] +spans = [] [dependencies] bumpalo = "3.0.0" diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index eba33234327..c38417d37c3 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "wasm-bindgen-cli-support" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-cli-support" description = """ Shared support for the wasm-bindgen-cli package, an internal dependency """ +documentation = "https://docs.rs/wasm-bindgen-cli-support" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-cli-support" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" +rust-version = "1.76" +version = "0.2.92" [dependencies] anyhow = "1.0" @@ -20,6 +20,7 @@ log = "0.4" rustc-demangle = "0.1.13" serde_json = "1.0" tempfile = "3.0" +unicode-ident = "1.0.5" walrus = "0.21" wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.92' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.92' } @@ -27,4 +28,3 @@ wasm-bindgen-shared = { path = "../shared", version = '=0.2.92' } wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.92' } wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.92' } wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.92' } -unicode-ident = "1.0.5" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 8bcb97fe0e6..57dec1cbb1c 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,39 +1,36 @@ [package] -name = "wasm-bindgen-cli" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://rustwasm.github.io/wasm-bindgen/" categories = ["wasm"] +default-run = 'wasm-bindgen' description = """ Command line interface of the `#[wasm_bindgen]` attribute and project. For more information see https://github.com/rustwasm/wasm-bindgen. """ +documentation = "https://rustwasm.github.io/wasm-bindgen/" edition = "2021" -default-run = 'wasm-bindgen' -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-cli" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" +rust-version = "1.76" +version = "0.2.92" [package.metadata.binstall] -pkg-url = "https://github.com/rustwasm/wasm-bindgen/releases/download/{ version }/wasm-bindgen-{ version }-{ target }{ archive-suffix }" bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" +pkg-url = "https://github.com/rustwasm/wasm-bindgen/releases/download/{ version }/wasm-bindgen-{ version }-{ target }{ archive-suffix }" [dependencies] +anyhow = "1.0" docopt = "1.0" env_logger = "0.11.5" -anyhow = "1.0" log = "0.4" native-tls = { version = "0.2", default-features = false, optional = true } rouille = { version = "3.0.0", default-features = false } serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" -ureq = { version = "2.7", default-features = false, features = [ - "brotli", - "gzip", -] } +ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.21", features = ['parallel'] } wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.92" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } @@ -48,8 +45,8 @@ wasmparser = "0.212" wasmprinter = "0.212" [[test]] -name = "reference" harness = false +name = "reference" [features] default = ["rustls-tls"] diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 03fdfe5c43c..ae947439437 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -1,26 +1,21 @@ [package] -name = "example-tests" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "example-tests" publish = false +version = "0.0.0" [features] default = ["stable"] -stable = [] nightly = [] +stable = [] [dependencies] anyhow = "1.0.75" futures-util = { version = "0.3.28", features = ["sink"] } http = "1" hyper = "1" -hyper-util = { version = "0.1.6", features = [ - "http1", - "service", - "server", - "tokio", -] } +hyper-util = { version = "0.1.6", features = ["http1", "service", "server", "tokio"] } mozprofile = "0.9" mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 8a5644dc693..1de15ddd248 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "wasm-bindgen-externref-xform" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-externref-xform" description = """ Internal externref transformations for wasm-bindgen """ +documentation = "https://docs.rs/wasm-bindgen-externref-xform" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-externref-xform" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" +rust-version = "1.76" +version = "0.2.92" [dependencies] anyhow = "1.0" @@ -25,5 +25,5 @@ wast = "212" wat = "1.0" [[test]] -name = "all" harness = false +name = "all" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 257c7fd2b4d..8ce2dd30d78 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -2,15 +2,15 @@ authors = ["The wasm-bindgen Developers"] description = "Bridging the gap between Rust Futures and JavaScript Promises" documentation = "https://docs.rs/wasm-bindgen-futures" +edition = "2021" homepage = "https://rustwasm.github.io/wasm-bindgen/" +include = ["/LICENSE-*", "/src"] license = "MIT OR Apache-2.0" name = "wasm-bindgen-futures" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" readme = "./README.md" -version = "0.4.42" -edition = "2021" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -include = ["/LICENSE-*", "/src"] +version = "0.4.42" [package.metadata.docs.rs] all-features = true @@ -18,22 +18,19 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" +futures-core = { version = '0.3.8', default-features = false, optional = true } js-sys = { path = "../js-sys", version = '0.3.69' } wasm-bindgen = { path = "../..", version = '0.2.92' } -futures-core = { version = '0.3.8', default-features = false, optional = true } [features] futures-core-03-stream = ['futures-core'] [target.'cfg(target_feature = "atomics")'.dependencies.web-sys] +features = ["MessageEvent", "Worker"] path = "../web-sys" version = "0.3.24" -features = [ - "MessageEvent", - "Worker", -] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test' } futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } +wasm-bindgen-test = { path = '../test' } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 18f969e2e7c..986b1152c7f 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -1,31 +1,31 @@ [package] -name = "js-sys" -version = "0.3.69" authors = ["The wasm-bindgen Developers"] -readme = "./README.md" categories = ["wasm"] -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/js-sys" description = """ Bindings for all JS global objects and functions in all JS environments like Node.js and browsers, built on `#[wasm_bindgen]` using the `wasm-bindgen` crate. """ -license = "MIT OR Apache-2.0" +documentation = "https://docs.rs/js-sys" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "js-sys" +readme = "./README.md" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" +rust-version = "1.57" +version = "0.3.69" [lib] -test = false doctest = false +test = false [dependencies] wasm-bindgen = { path = "../..", version = "0.2.92" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test' } wasm-bindgen-futures = { path = '../futures' } +wasm-bindgen-test = { path = '../test' } web-sys = { path = "../web-sys", features = ["Headers", "Response", "ResponseInit"] } [lints.rust] diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index fd8c02b2783..4e9b76cf31a 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -1,26 +1,26 @@ [package] -name = "wasm-bindgen-macro-support" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen" description = """ The part of the implementation of the `#[wasm_bindgen]` attribute that is not in the shared backend crate """ +documentation = "https://docs.rs/wasm-bindgen" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-macro-support" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" +rust-version = "1.57" +version = "0.2.92" [features] -spans = ["wasm-bindgen-backend/spans"] extra-traits = ["syn/extra-traits"] +spans = ["wasm-bindgen-backend/spans"] strict-macro = [] [dependencies] -syn = { version = '2.0', features = ['visit', 'full'] } -quote = '1.0' proc-macro2 = "1.0" +quote = '1.0' +syn = { version = '2.0', features = ['visit', 'full'] } wasm-bindgen-backend = { path = "../backend", version = "=0.2.92" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 9a738c7a533..aae505645cc 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -1,29 +1,29 @@ [package] -name = "wasm-bindgen-macro" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen" description = """ Definition of the `#[wasm_bindgen]` attribute, an internal dependency """ +documentation = "https://docs.rs/wasm-bindgen" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-macro" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" +rust-version = "1.57" +version = "0.2.92" [lib] proc-macro = true [features] spans = ["wasm-bindgen-macro-support/spans"] -xxx_debug_only_print_generated_code = [] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] +xxx_debug_only_print_generated_code = [] [dependencies] -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.92" } quote = "1.0" +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.92" } [dev-dependencies] js-sys = { path = "../js-sys" } @@ -33,6 +33,4 @@ wasm-bindgen-futures = { path = "../futures" } web-sys = { path = "../web-sys", features = ["Worker"] } [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(wasm_bindgen_unstable_test_coverage)', -] } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/msrv/cli/Cargo.toml b/crates/msrv/cli/Cargo.toml index d283451c04a..7f7c5e7a686 100644 --- a/crates/msrv/cli/Cargo.toml +++ b/crates/msrv/cli/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "msrv-cli-test" -version = "0.0.0" edition = "2021" +name = "msrv-cli-test" publish = false +version = "0.0.0" [dependencies] wasm-bindgen-cli = { path = "../../cli" } wasm-bindgen-cli-support = { path = "../../cli-support" } -wasm-bindgen-wasm-interpreter = { path = "../../wasm-interpreter" } -wasm-bindgen-threads-xform = { path = "../../threads-xform" } -wasm-bindgen-multi-value-xform = { path = "../../multi-value-xform" } wasm-bindgen-externref-xform = { path = "../../externref-xform" } +wasm-bindgen-multi-value-xform = { path = "../../multi-value-xform" } +wasm-bindgen-threads-xform = { path = "../../threads-xform" } wasm-bindgen-wasm-conventions = { path = "../../wasm-conventions" } +wasm-bindgen-wasm-interpreter = { path = "../../wasm-interpreter" } diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index 2fe30ddec40..c01fce77871 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "msrv-library-test" -version = "0.0.0" edition = "2021" +name = "msrv-library-test" publish = false +version = "0.0.0" [dependencies] -wasm-bindgen = { path = "../../../" } js-sys = { path = "../../js-sys" } -web-sys = { path = "../../web-sys" } +wasm-bindgen = { path = "../../../" } +wasm-bindgen-backend = { path = "../../backend" } wasm-bindgen-futures = { path = "../../futures" } -wasm-bindgen-test = { path = "../../test" } wasm-bindgen-macro = { path = "../../macro" } -wasm-bindgen-test-macro = { path = "../../test-macro" } wasm-bindgen-macro-support = { path = "../../macro-support" } -wasm-bindgen-backend = { path = "../../backend" } wasm-bindgen-shared = { path = "../../shared" } +wasm-bindgen-test = { path = "../../test" } +wasm-bindgen-test-macro = { path = "../../test-macro" } +web-sys = { path = "../../web-sys" } bumpalo = "=3.12.0" log = "=0.4.18" diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 197ae423f77..05a18baf37a 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "wasm-bindgen-multi-value-xform" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-multi-value-xform" description = """ Internal multi-value transformations for wasm-bindgen """ +documentation = "https://docs.rs/wasm-bindgen-multi-value-xform" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-multi-value-xform" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" +rust-version = "1.76" +version = "0.2.92" [dependencies] anyhow = "1.0" @@ -25,5 +25,5 @@ wast = "212" wat = "1.0" [[test]] -name = "all" harness = false +name = "all" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index aa853bae08f..cc505182138 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,18 +1,18 @@ [package] -name = "wasm-bindgen-shared" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-shared" description = """ Shared support between wasm-bindgen and wasm-bindgen cli, an internal dependency. """ +documentation = "https://docs.rs/wasm-bindgen-shared" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/build.rs", "/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-shared" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" +rust-version = "1.57" +version = "0.2.92" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 89b6bf48223..50bc35d077e 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "wasm-bindgen-test-macro" -version = "0.3.42" authors = ["The wasm-bindgen Developers"] description = "Internal testing macro for wasm-bindgen" +edition = "2021" +include = ["/LICENSE-*", "/src"] license = "MIT OR Apache-2.0" +name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" -edition = "2021" rust-version = "1.57" -include = ["/LICENSE-*", "/src"] +version = "0.3.42" [lib] proc-macro = true @@ -15,13 +15,16 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -syn = { version = "2.0", default-features = false, features = [ "parsing", "proc-macro", "derive", "printing" ] } +syn = { version = "2.0", default-features = false, features = [ + "parsing", + "proc-macro", + "derive", + "printing", +] } [dev-dependencies] -wasm-bindgen-test = { path = "../test" } trybuild = "1.0" +wasm-bindgen-test = { path = "../test" } [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(wasm_bindgen_unstable_test_coverage)', -] } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index e8135d9a6fb..92b02f3da4b 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -1,30 +1,28 @@ [package] -name = "wasm-bindgen-test" -version = "0.3.42" authors = ["The wasm-bindgen Developers"] description = "Internal testing crate for wasm-bindgen" +edition = "2021" +include = ["/LICENSE-*", "/src"] license = "MIT OR Apache-2.0" +name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" -edition = "2021" rust-version = "1.57" -include = ["/LICENSE-*", "/src"] +version = "0.3.42" [dependencies] console_error_panic_hook = '0.1' +gg-alloc = { version = "1.0", optional = true } js-sys = { path = '../js-sys', version = '0.3.69' } scoped-tls = "1.0" wasm-bindgen = { path = '../..', version = '0.2.92' } wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.42' } -gg-alloc = { version = "1.0", optional = true } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(wasm_bindgen_unstable_test_coverage)', -] } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } [lib] test = false diff --git a/crates/test/sample/Cargo.toml b/crates/test/sample/Cargo.toml index 7b0cb8107b5..e6d8ea5dee4 100644 --- a/crates/test/sample/Cargo.toml +++ b/crates/test/sample/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "sample" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "sample" publish = false +version = "0.0.0" [lib] test = false diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 7672c15b2fc..d19fdd59930 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "wasm-bindgen-threads-xform" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-threads-xform" description = """ Support for threading-related transformations in wasm-bindgen """ +documentation = "https://docs.rs/wasm-bindgen-threads-xform" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-threads-xform" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" +rust-version = "1.76" +version = "0.2.92" [dependencies] anyhow = "1.0" @@ -20,10 +20,10 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2. [dev-dependencies] rayon = "1.0" -wasmprinter = "0.212" wasmparser = "0.212" +wasmprinter = "0.212" wat = "1.0" [[test]] -name = "all" harness = false +name = "all" diff --git a/crates/typescript-tests/Cargo.toml b/crates/typescript-tests/Cargo.toml index 2cd71930ba4..90d394bc285 100644 --- a/crates/typescript-tests/Cargo.toml +++ b/crates/typescript-tests/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "typescript-tests" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "typescript-tests" publish = false +version = "0.0.0" [dependencies] -wasm-bindgen = { path = '../..' } -wasm-bindgen-futures = { path = '../futures' } -web-sys = { path = '../web-sys', features = [ 'HtmlElement', 'Node', 'Document' ] } js-sys = { path = '../js-sys' } serde = { version = "1.0", features = ["derive"] } serde-wasm-bindgen = "0.6" +wasm-bindgen = { path = '../..' } +wasm-bindgen-futures = { path = '../futures' } +web-sys = { path = '../web-sys', features = ['HtmlElement', 'Node', 'Document'] } [lib] crate-type = ['cdylib'] diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index fe3fd4421c4..aff8e40a63a 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "wasm-bindgen-wasm-conventions" -version = "0.2.92" authors = ["The wasm-bindgen developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-wasm-conventions" description = "Utilities for working with Wasm codegen conventions (usually established by LLVM/lld)" +documentation = "https://docs.rs/wasm-bindgen-wasm-conventions" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-wasm-conventions" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" +rust-version = "1.76" +version = "0.2.92" [dependencies] leb128 = "0.2" walrus = "0.21" # Matching the version `walrus` depends on. -wasmparser = "0.212" anyhow = "1.0" log = "0.4" +wasmparser = "0.212" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 00ecd4f44f4..3a5be59306c 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "wasm-bindgen-wasm-interpreter" -version = "0.2.92" authors = ["The wasm-bindgen Developers"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" -homepage = "https://rustwasm.github.io/wasm-bindgen/" -documentation = "https://docs.rs/wasm-bindgen-wasm-interpreter" description = """ Micro-interpreter optimized for wasm-bindgen's use case """ +documentation = "https://docs.rs/wasm-bindgen-wasm-interpreter" edition = "2021" -rust-version = "1.76" +homepage = "https://rustwasm.github.io/wasm-bindgen/" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "wasm-bindgen-wasm-interpreter" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" +rust-version = "1.76" +version = "0.2.92" [dependencies] anyhow = "1.0" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 9527a00b5a3..c4f602cf3b0 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1,18 +1,18 @@ [package] -name = "web-sys" -version = "0.3.69" authors = ["The wasm-bindgen Developers"] -readme = "./README.md" -homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" -documentation = "https://rustwasm.github.io/wasm-bindgen/api/web_sys/" -repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" description = """ Bindings for all Web APIs, a procedurally generated crate from WebIDL """ -license = "MIT OR Apache-2.0" +documentation = "https://rustwasm.github.io/wasm-bindgen/api/web_sys/" edition = "2021" -rust-version = "1.57" +homepage = "https://rustwasm.github.io/wasm-bindgen/web-sys/index.html" include = ["/LICENSE-*", "/src"] +license = "MIT OR Apache-2.0" +name = "web-sys" +readme = "./README.md" +repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" +rust-version = "1.57" +version = "0.3.69" [package.metadata.docs.rs] all-features = true @@ -23,13 +23,13 @@ doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.92" } js-sys = { path = '../js-sys', version = '0.3.69' } +wasm-bindgen = { path = "../..", version = "0.2.92" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -wasm-bindgen-test = { path = '../test' } -wasm-bindgen-futures = { path = '../futures', features = [ "futures-core-03-stream" ] } futures = "0.3" +wasm-bindgen-futures = { path = '../futures', features = ["futures-core-03-stream"] } +wasm-bindgen-test = { path = '../test' } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } diff --git a/crates/webidl-tests/Cargo.toml b/crates/webidl-tests/Cargo.toml index 8ee9e368e52..2296c4babf2 100644 --- a/crates/webidl-tests/Cargo.toml +++ b/crates/webidl-tests/Cargo.toml @@ -1,19 +1,19 @@ [package] -name = "webidl-tests" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "webidl-tests" publish = false +version = "0.0.0" [lib] -test = false doctest = false path = 'lib.rs' +test = false [dependencies] js-sys = { path = '../js-sys' } -wasm-bindgen-futures = { path = '../futures' } wasm-bindgen = { path = '../..' } +wasm-bindgen-futures = { path = '../futures' } [build-dependencies] wasm-bindgen-webidl = { path = "../webidl" } diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index d171c46bbcb..fecfcb7c973 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -1,21 +1,21 @@ [package] -name = "wasm-bindgen-webidl" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-bindgen-webidl" publish = false +version = "0.0.0" [dependencies] -env_logger = "0.11.5" anyhow = "1.0" +env_logger = "0.11.5" heck = "0.5" +lazy_static = "1.4.0" log = "0.4.1" +once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' +sourcefile = "0.2" +structopt = "0.3.9" syn = { version = '2.0', features = ['extra-traits', 'full'] } wasm-bindgen-backend = { path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } -once_cell = "1.12" -sourcefile = "0.2" -structopt = "0.3.9" -lazy_static = "1.4.0" diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index faf072e38af..5836f5cc25e 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "add" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "add" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index c4014f7fccd..4aec70ddc8d 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "canvas" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "canvas" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -13,11 +13,5 @@ js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['CanvasRenderingContext2d', 'Document', 'Element', 'HtmlCanvasElement', 'Window'] path = "../../crates/web-sys" -features = [ - 'CanvasRenderingContext2d', - 'Document', - 'Element', - 'HtmlCanvasElement', - 'Window', -] diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index f1aa4704e4b..bc6bf3c363f 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "char" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "char" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 65cb8f52805..4a70ab8a6da 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -1,23 +1,17 @@ [package] -name = "closures" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "closures" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['CssStyleDeclaration', 'Document', 'Element', 'HtmlElement', 'Window'] path = "../../crates/web-sys" -features = [ - 'CssStyleDeclaration', - 'Document', - 'Element', - 'HtmlElement', - 'Window', -] diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index f949471a836..165c280c86f 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "console_log" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "console_log" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 7169562a2d7..8268d48e4c8 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "deno" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "deno" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index b8abfa60062..0b4b310464b 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "dom" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "dom" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,11 +12,5 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" -features = [ - 'Document', - 'Element', - 'HtmlElement', - 'Node', - 'Window', -] diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index 87dcb3e3400..50f470d2642 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "rust-duck-typed-interfaces" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "rust-duck-typed-interfaces" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 8bda684751f..27719b43b4a 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -1,25 +1,18 @@ [package] -name = "fetch" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "fetch" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] +features = ['Headers', 'Request', 'RequestInit', 'RequestMode', 'Response', 'Window'] path = "../../crates/web-sys" -features = [ - 'Headers', - 'Request', - 'RequestInit', - 'RequestMode', - 'Response', - 'Window', -] diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 38264118b54..5918ea94451 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "guide-supported-types-examples" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "guide-supported-types-examples" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index a65ef226e82..d1218b0be6d 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "hello_world" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "hello_world" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 326c848c5b6..5b53eb99be6 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "import_js" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "import_js" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 00f9f2ab5de..8bdb3ff22af 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "julia_set" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "julia_set" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,8 +12,5 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['ImageData', 'CanvasRenderingContext2d'] path = "../../crates/web-sys" -features = [ - 'ImageData', - 'CanvasRenderingContext2d', -] diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 4222eeff7ad..9771b0b413b 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "wasm-bindgen-paint" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-bindgen-paint" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -13,7 +13,6 @@ js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'CanvasRenderingContext2d', 'CssStyleDeclaration', @@ -26,3 +25,4 @@ features = [ 'Node', 'Window', ] +path = "../../crates/web-sys" diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index c50fcdf489b..ef3aa683d1f 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "performance" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "performance" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } humantime = "2" +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = ['Window', 'Performance', 'PerformanceTiming'] +path = "../../crates/web-sys" diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 145376c026e..79bdebdaf90 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -1,26 +1,25 @@ [package] -name = "raytrace-parallel" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "raytrace-parallel" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] console_error_panic_hook = "0.1" +futures-channel-preview = "0.3.0-alpha.18" js-sys = { path = "../../crates/js-sys" } rayon = "1.1.0" rayon-core = "1.5.0" raytracer = { git = 'https://github.com/alexcrichton/raytracer', branch = 'update-deps' } serde-wasm-bindgen = "0.6" -futures-channel-preview = "0.3.0-alpha.18" wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'CanvasRenderingContext2d', 'ErrorEvent', @@ -32,3 +31,4 @@ features = [ 'DedicatedWorkerGlobalScope', 'MessageEvent', ] +path = "../../crates/web-sys" diff --git a/examples/raytrace-parallel/rust-toolchain.toml b/examples/raytrace-parallel/rust-toolchain.toml index fa80a7badaf..2dc8cf0f027 100644 --- a/examples/raytrace-parallel/rust-toolchain.toml +++ b/examples/raytrace-parallel/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] channel = "nightly" components = ["rust-src"] -targets = ["wasm32-unknown-unknown"] profile = "minimal" +targets = ["wasm32-unknown-unknown"] diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 358c86579e2..3fe83f77730 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "request-animation-frame" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "request-animation-frame" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,11 +12,5 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" -features = [ - 'Document', - 'Element', - 'HtmlElement', - 'Node', - 'Window', -] diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 035d372f518..9eda0ee8692 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "synchronous-instantiation" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "synchronous-instantiation" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index e1fc87d50df..67fe6bcd18d 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "todomvc" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "todomvc" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,13 +12,12 @@ crate-type = ["cdylib"] askama = "0.12" [dependencies] -js-sys = { path = "../../crates/js-sys" } -wasm-bindgen = { path = "../../" } askama = "0.12" console_error_panic_hook = "0.1.5" +js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'console', 'CssStyleDeclaration', @@ -38,3 +37,4 @@ features = [ 'Storage', 'Window', ] +path = "../../crates/web-sys" diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index 2b8d3a14265..6a0fae91946 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "wasm-audio-worklet" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-audio-worklet" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -15,7 +15,6 @@ wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ "AudioContext", "AudioDestinationNode", @@ -31,3 +30,4 @@ features = [ "Url", "Window", ] +path = "../../crates/web-sys" diff --git a/examples/wasm-audio-worklet/rust-toolchain.toml b/examples/wasm-audio-worklet/rust-toolchain.toml index fa80a7badaf..2dc8cf0f027 100644 --- a/examples/wasm-audio-worklet/rust-toolchain.toml +++ b/examples/wasm-audio-worklet/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] channel = "nightly" components = ["rust-src"] -targets = ["wasm32-unknown-unknown"] profile = "minimal" +targets = ["wasm32-unknown-unknown"] diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index 402433e2481..ff98763f802 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "wasm-in-wasm-imports" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-in-wasm-imports" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index acb7e6d5d31..ce9f72ceff8 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "wasm-in-wasm" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-in-wasm" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index f3968f4c8e4..8d623646fc1 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -1,25 +1,25 @@ [package] -name = "wasm-in-web-worker" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-in-web-worker" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } console_error_panic_hook = { version = "0.1.6", optional = true } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ - 'console', - 'Document', - 'HtmlElement', - 'HtmlInputElement', - 'MessageEvent', - 'Window', - 'Worker', + 'console', + 'Document', + 'HtmlElement', + 'HtmlInputElement', + 'MessageEvent', + 'Window', + 'Worker', ] +path = "../../crates/web-sys" diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml index 6157ac4f1f3..2e19ef01d4e 100644 --- a/examples/wasm2js/Cargo.toml +++ b/examples/wasm2js/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "wasm2js" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm2js" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 56eaffb254b..1bb0a665c26 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -1,21 +1,21 @@ [package] -name = "rust-webassembly-weather-reports" -version = "0.0.0" authors = ["Ayush "] edition = "2021" +name = "rust-webassembly-weather-reports" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] chrono = "0.4.11" +gloo = "0.11" +json = "0.12" reqwest = "0.12" -wasm-bindgen-futures = { path = "../../crates/futures" } -json= "0.12" wasm-bindgen = { path = "../../" } -gloo = "0.11" +wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -path = "../../crates/web-sys" features = ["Document", "Element", "HtmlElement", "Window"] +path = "../../crates/web-sys" diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index ea61373ccdb..4fbea599082 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "webaudio" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "webaudio" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,7 +12,6 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'AudioContext', 'AudioDestinationNode', @@ -22,3 +21,4 @@ features = [ 'OscillatorNode', 'OscillatorType', ] +path = "../../crates/web-sys" diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index b3f9f006417..ebf3967e81f 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "webgl" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "webgl" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -13,7 +13,6 @@ js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'Document', 'Element', @@ -25,3 +24,4 @@ features = [ 'WebGlShader', 'Window', ] +path = "../../crates/web-sys" diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 6cbf946bd4f..9773e0e94c4 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -1,20 +1,19 @@ [package] -name = "webrtc_datachannel" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "webrtc_datachannel" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ "MessageEvent", "RtcPeerConnection", @@ -26,3 +25,4 @@ features = [ "RtcDataChannel", "RtcDataChannelEvent", ] +path = "../../crates/web-sys" diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 8e957e424a5..63f201d35e5 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -1,19 +1,18 @@ [package] -name = "websockets" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "websockets" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] [dependencies] -wasm-bindgen = { path = "../../" } js-sys = { path = "../../crates/js-sys" } +wasm-bindgen = { path = "../../" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ "BinaryType", "Blob", @@ -23,3 +22,4 @@ features = [ "ProgressEvent", "WebSocket", ] +path = "../../crates/web-sys" diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 850e09cb020..0e2efb8a65d 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "webxr" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "webxr" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -15,7 +15,6 @@ wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] -path = "../../crates/web-sys" features = [ 'Document', 'Element', @@ -62,8 +61,9 @@ features = [ 'XrWebGlLayer', 'XrWebGlLayerInit', 'XrSystem', - 'console' + 'console', ] +path = "../../crates/web-sys" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } diff --git a/examples/without-a-bundler-no-modules/Cargo.toml b/examples/without-a-bundler-no-modules/Cargo.toml index 24611da861f..a5e70744cfe 100644 --- a/examples/without-a-bundler-no-modules/Cargo.toml +++ b/examples/without-a-bundler-no-modules/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "without-a-bundler-no-modules" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "without-a-bundler-no-modules" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,11 +12,5 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" -features = [ - 'Document', - 'Element', - 'HtmlElement', - 'Node', - 'Window', -] diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 44e2d597144..07ccf676c78 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "without-a-bundler" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "without-a-bundler" publish = false +version = "0.0.0" [lib] crate-type = ["cdylib"] @@ -12,11 +12,5 @@ crate-type = ["cdylib"] wasm-bindgen = { path = "../../" } [dependencies.web-sys] +features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" -features = [ - 'Document', - 'Element', - 'HtmlElement', - 'Node', - 'Window', -] diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 00000000000..56bc58a4c7d --- /dev/null +++ b/taplo.toml @@ -0,0 +1,9 @@ +[formatting] +allowed_blank_lines = 1 +column_width = 100 +reorder_keys = true + +[[rule]] +formatting = { array_auto_expand = false } +include = ["crates/web-sys/Cargo.toml"] +keys = ["features"] diff --git a/tests/crates/a/Cargo.toml b/tests/crates/a/Cargo.toml index f60a23a8805..56f3007ed57 100644 --- a/tests/crates/a/Cargo.toml +++ b/tests/crates/a/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "wasm-bindgen-test-crate-a" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-bindgen-test-crate-a" publish = false +version = "0.0.0" [dependencies] wasm-bindgen = { path = '../../..' } diff --git a/tests/crates/b/Cargo.toml b/tests/crates/b/Cargo.toml index c67b9cc50c9..75a143e9a51 100644 --- a/tests/crates/b/Cargo.toml +++ b/tests/crates/b/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "wasm-bindgen-test-crate-b" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "wasm-bindgen-test-crate-b" publish = false +version = "0.0.0" [dependencies] wasm-bindgen = { path = '../../..' } diff --git a/tests/no-std/Cargo.toml b/tests/no-std/Cargo.toml index 22806c101eb..fca6ee89aef 100644 --- a/tests/no-std/Cargo.toml +++ b/tests/no-std/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "no-std" -version = "0.0.0" authors = ["The wasm-bindgen Developers"] edition = "2021" +name = "no-std" publish = false +version = "0.0.0" [dependencies] wasm-bindgen = { path = '../..', default-features = false } From bf9807c5a0c593cf03a5f648b93a738e74fce1d0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 01:31:07 +0200 Subject: [PATCH 466/641] Prepare v0.2.93 release (#4072) --- CHANGELOG.md | 4 +++- Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 6 +++--- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- publish.rs | 2 ++ 19 files changed, 48 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1548e21c8af..61f708ace5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) + +Released 2024-08-13 ### Added diff --git a/Cargo.toml b/Cargo.toml index 251995815eb..141f0f316d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.92" +version = "0.2.93" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,7 +45,7 @@ cfg-if = "1.0.0" once_cell = "1.12" serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.92" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.93" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] js-sys = { path = 'crates/js-sys' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index a95f148fbb7..dbc404c1a32 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.92" +version = "0.2.93" [features] extra-traits = ["syn/extra-traits"] @@ -24,4 +24,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index c38417d37c3..0bc105fffe3 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] anyhow = "1.0" @@ -22,9 +22,9 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = "0.21" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.92' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.92' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.92' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.92' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.92' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.92' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.93' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.93' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.93' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.93' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.93' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.93' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 57dec1cbb1c..66e39de960e 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.21", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.92" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.93" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 1de15ddd248..27feed12b5d 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] anyhow = "1.0" walrus = "0.21" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 8ce2dd30d78..0899a830a5c 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.42" +version = "0.4.43" [package.metadata.docs.rs] all-features = true @@ -19,8 +19,8 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '0.3.69' } -wasm-bindgen = { path = "../..", version = '0.2.92' } +js-sys = { path = "../js-sys", version = '0.3.70' } +wasm-bindgen = { path = "../..", version = '0.2.93' } [features] futures-core-03-stream = ['futures-core'] diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 986b1152c7f..ff8c6581d01 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,14 +14,14 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.69" +version = "0.3.70" [lib] doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.92" } +wasm-bindgen = { path = "../..", version = "0.2.93" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 4e9b76cf31a..26ae4a4c5a8 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.92" +version = "0.2.93" [features] extra-traits = ["syn/extra-traits"] @@ -22,5 +22,5 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.92" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.92" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.93" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index aae505645cc..eb5bd214212 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.92" +version = "0.2.93" [lib] proc-macro = true @@ -23,7 +23,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.92" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.93" } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 05a18baf37a..8361b0b4d10 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] anyhow = "1.0" walrus = "0.21" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index cc505182138..46672e2dad8 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.92" +version = "0.2.93" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 50bc35d077e..87e55ad1e13 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.42" +version = "0.3.43" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 92b02f3da4b..33e987b0963 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,16 +7,16 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.42" +version = "0.3.43" [dependencies] console_error_panic_hook = '0.1' gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '0.3.69' } +js-sys = { path = '../js-sys', version = '0.3.70' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.92' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.42' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.42' } +wasm-bindgen = { path = '../..', version = '0.2.93' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.43' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.43' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index d19fdd59930..df6ca461e9f 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] anyhow = "1.0" walrus = "0.21" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.92" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index aff8e40a63a..c840850a07f 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 3a5be59306c..899025b7a09 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.92" +version = "0.2.93" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.21" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.92" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.93" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index c4f602cf3b0..5fae721d362 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.69" +version = "0.3.70" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '0.3.69' } -wasm-bindgen = { path = "../..", version = "0.2.92" } +js-sys = { path = '../js-sys', version = '0.3.70' } +wasm-bindgen = { path = "../..", version = "0.2.93" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" diff --git a/publish.rs b/publish.rs index e3ea6728a30..f60234b03af 100644 --- a/publish.rs +++ b/publish.rs @@ -47,6 +47,8 @@ const CRATES_TO_AVOID_PUBLISH: &[&str] = &[ "typescript-tests", "wasm-bindgen-webidl", "example-tests", + "msrv-cli-test", + "msrv-library-test", ]; struct Crate { From ee049dc870954ca75191eb1c69ccd1247fb18650 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 02:10:45 +0200 Subject: [PATCH 467/641] Bump `softprops/action-gh-release` to v2 (#4070) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85f7ade42dc..252c6506c5d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -606,7 +606,7 @@ jobs: folder: gh-pages single-commit: true if: github.event_name == 'push' && github.ref == 'refs/heads/main' - - uses: softprops/action-gh-release@v1 + - uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: files: "gh-release/*.tar.gz*" From 0f0b4e2d0d60068a621276364f0e2af8f7512f48 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 09:57:00 +0200 Subject: [PATCH 468/641] Fix Apple deployment for Intel CPUs (#4073) --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 252c6506c5d..975837793a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -443,28 +443,28 @@ jobs: steps: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - - run: cargo build --manifest-path crates/cli/Cargo.toml --release + - run: rustup target add x86_64-apple-darwin + - run: cargo build --manifest-path crates/cli/Cargo.toml --target x86_64-apple-darwin --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - uses: actions/upload-artifact@v4 with: name: dist_macos_x86_64 - path: "target/release/wasm*" + path: "target/x86_64-apple-darwin/release/wasm*" dist_macos_aarch64: runs-on: macos-latest steps: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - - run: rustup target add aarch64-apple-darwin - run: | - cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-apple-darwin --release + cargo build --manifest-path crates/cli/Cargo.toml --release env: MACOSX_DEPLOYMENT_TARGET: 10.7 - uses: actions/upload-artifact@v4 with: name: dist_macos_aarch64 - path: "target/aarch64-apple-darwin/release/wasm*" + path: "target/release/wasm*" dist_windows: runs-on: windows-latest From d813df7bc1f01af51d5c678bcc4d8d4db9edf81b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 17:14:10 +0200 Subject: [PATCH 469/641] Don't emit snippets without `--split-linked-modules` (#4066) --- CHANGELOG.md | 3 +++ crates/backend/src/encode.rs | 21 ++++++++++++++++----- crates/cli-support/src/lib.rs | 16 +--------------- crates/cli-support/src/wit/mod.rs | 16 ++++++++++------ crates/shared/src/lib.rs | 1 + crates/shared/src/schema_hash_approval.rs | 2 +- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61f708ace5d..a4cbddbec64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -196,6 +196,9 @@ Released 2024-08-13 * `#[track_caller]` is now always applied on `UnwrapThrowExt` methods when not targetting `wasm32-unknown-unknown`. [#4042](https://github.com/rustwasm/wasm-bindgen/pull/4042) +* Fixed linked modules emitting snippet files when not using `--split-linked-modules`. + [#4066](https://github.com/rustwasm/wasm-bindgen/pull/4066) + -------------------------------------------------------------------------------- ## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92) diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 0daa9ff1123..44f36942b36 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -52,6 +52,7 @@ struct LocalFile { path: PathBuf, definition: Span, new_identifier: String, + linked_module: bool, } impl Interner { @@ -85,7 +86,12 @@ impl Interner { /// /// Note that repeated invocations of this function will be memoized, so the /// same `id` will always return the same resulting unique `id`. - fn resolve_import_module(&self, id: &str, span: Span) -> Result { + fn resolve_import_module( + &self, + id: &str, + span: Span, + linked_module: bool, + ) -> Result { let mut files = self.files.borrow_mut(); if let Some(file) = files.get(id) { return Ok(ImportModule::Named(self.intern_str(&file.new_identifier))); @@ -107,10 +113,11 @@ impl Interner { path, definition: span, new_identifier, + linked_module, }; files.insert(id.to_string(), file); drop(files); - self.resolve_import_module(id, span) + self.resolve_import_module(id, span, linked_module) } fn unique_crate_identifier(&self) -> String { @@ -169,6 +176,7 @@ fn shared_program<'a>( .map(|s| LocalModule { identifier: intern.intern_str(&file.new_identifier), contents: intern.intern_str(&s), + linked_module: file.linked_module, }) .map_err(|e| { let msg = format!("failed to read file `{}`: {}", file.path.display(), e); @@ -254,7 +262,7 @@ fn shared_import<'a>(i: &'a ast::Import, intern: &'a Interner) -> Result( intern: &'a Interner, ) -> Result, Diagnostic> { Ok(LinkedModule { - module: shared_module(i, intern)?, + module: shared_module(i, intern, true)?, link_function_name: intern.intern_str(name), }) } @@ -282,9 +290,12 @@ fn shared_linked_module<'a>( fn shared_module<'a>( m: &'a ast::ImportModule, intern: &'a Interner, + linked_module: bool, ) -> Result, Diagnostic> { Ok(match m { - ast::ImportModule::Named(m, span) => intern.resolve_import_module(m, *span)?, + ast::ImportModule::Named(m, span) => { + intern.resolve_import_module(m, *span, linked_module)? + } ast::ImportModule::RawNamed(m, _span) => ImportModule::RawNamed(intern.intern_str(m)), ast::ImportModule::Inline(idx, _) => ImportModule::Inline(*idx as u32), }) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 53270eb6eda..7a3d70cc704 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -368,13 +368,7 @@ impl Bindgen { // auxiliary section for all sorts of miscellaneous information and // features #[wasm_bindgen] supports that aren't covered by wasm // interface types. - wit::process( - &mut module, - programs, - self.externref, - thread_count, - self.emit_start, - )?; + wit::process(self, &mut module, programs, thread_count)?; // Now that we've got type information from the webidl processing pass, // touch up the output of rustc to insert externref shims where necessary. @@ -601,14 +595,6 @@ impl Output { self.generated.start.as_ref() } - pub fn snippets(&self) -> &HashMap> { - &self.generated.snippets - } - - pub fn local_modules(&self) -> &HashMap { - &self.generated.local_modules - } - pub fn npm_dependencies(&self) -> &HashMap { &self.generated.npm_dependencies } diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index f85537b8fa2..ca0306967be 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -2,7 +2,7 @@ use crate::decode::LocalModule; use crate::descriptor::{Descriptor, Function}; use crate::descriptors::WasmBindgenDescriptorsSection; use crate::intrinsic::Intrinsic; -use crate::{decode, PLACEHOLDER_MODULE}; +use crate::{decode, Bindgen, PLACEHOLDER_MODULE}; use anyhow::{anyhow, bail, Error}; use std::collections::{HashMap, HashSet}; use std::str; @@ -36,6 +36,7 @@ struct Context<'a> { externref_enabled: bool, thread_count: Option, support_start: bool, + linked_modules: bool, } struct InstructionBuilder<'a, 'b> { @@ -47,11 +48,10 @@ struct InstructionBuilder<'a, 'b> { } pub fn process( + bindgen: &mut Bindgen, module: &mut Module, programs: Vec, - externref_enabled: bool, thread_count: Option, - support_start: bool, ) -> Result<(NonstandardWitSectionId, WasmBindgenAuxId), Error> { let mut cx = Context { adapters: Default::default(), @@ -65,9 +65,10 @@ pub fn process( memory: wasm_bindgen_wasm_conventions::get_memory(module).ok(), module, start_found: false, - externref_enabled, + externref_enabled: bindgen.externref, thread_count, - support_start, + support_start: bindgen.emit_start, + linked_modules: bindgen.split_linked_modules, }; cx.init()?; @@ -392,7 +393,10 @@ impl<'a> Context<'a> { linked_modules, } = program; - for module in &local_modules { + for module in local_modules + .iter() + .filter(|module| self.linked_modules || !module.linked_module) + { // All local modules we find should be unique, but the same module // may have showed up in a few different blocks. If that's the case // all the same identifiers should have the same contents. diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index e85ddf9b87c..0b9af3b581b 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -156,6 +156,7 @@ macro_rules! shared_api { struct LocalModule<'a> { identifier: &'a str, contents: &'a str, + linked_module: bool, } } }; // end of mac case diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index a52716f360f..1de5ee31cd3 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "3501400214978266446"; +const APPROVED_SCHEMA_FILE_HASH: &str = "9336383503182818021"; #[test] fn schema_version() { From b012a75b44c61abf53003206074c3b6801dd5511 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 13 Aug 2024 19:19:08 +0200 Subject: [PATCH 470/641] Fixed incorrect deprecation warning (#4074) --- CHANGELOG.md | 12 ++++++++ crates/cli-support/src/js/mod.rs | 22 +++++++++----- crates/cli/tests/wasm-bindgen/main.rs | 44 +++++++++++++++++---------- 3 files changed, 54 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4cbddbec64..7134cfdb53c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Fixed + +* Fixed linked modules emitting snippet files when not using `--split-linked-modules`. + [#4066](https://github.com/rustwasm/wasm-bindgen/pull/4066) + +* Fixed incorrect deprecation warning when passing no parameter into `default()` (`init()`) or `initSync()`. + [#4074](https://github.com/rustwasm/wasm-bindgen/pull/4074) + +-------------------------------------------------------------------------------- + ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) Released 2024-08-13 diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 5d655c1f707..8450349482d 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -870,10 +870,13 @@ impl<'a> Context<'a> { if (wasm !== undefined) return wasm; {init_stack_size} - if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype) - ({{module{init_memory_arg}{init_stack_size_arg}}} = module) - else - console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + if (typeof module !== 'undefined') {{ + if (Object.getPrototypeOf(module) === Object.prototype) {{ + ({{module{init_memory_arg}{init_stack_size_arg}}} = module) + }} else {{ + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + }} + }} const imports = __wbg_get_imports(); @@ -892,10 +895,13 @@ impl<'a> Context<'a> { if (wasm !== undefined) return wasm; {init_stack_size} - if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) - ({{module_or_path{init_memory_arg}{init_stack_size_arg}}} = module_or_path) - else - console.warn('using deprecated parameters for the initialization function; pass a single object instead') + if (typeof module_or_path !== 'undefined') {{ + if (Object.getPrototypeOf(module_or_path) === Object.prototype) {{ + ({{module_or_path{init_memory_arg}{init_stack_size_arg}}} = module_or_path) + }} else {{ + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + }} + }} {default_module_path} const imports = __wbg_get_imports(); diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 10425018ce7..8961a7a4a70 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -336,10 +336,13 @@ async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; - if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) - ({module_or_path} = module_or_path) - else - console.warn('using deprecated parameters for the initialization function; pass a single object instead') + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } if (typeof module_or_path === 'undefined') { module_or_path = new URL('default_module_path_target_web_bg.wasm', import.meta.url); @@ -371,10 +374,13 @@ fn default_module_path_target_no_modules() { if (wasm !== undefined) return wasm; - if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) - ({module_or_path} = module_or_path) - else - console.warn('using deprecated parameters for the initialization function; pass a single object instead') + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') { module_or_path = script_src.replace(/\\.js$/, '_bg.wasm'); @@ -400,10 +406,13 @@ async function __wbg_init(module_or_path) { if (wasm !== undefined) return wasm; - if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) - ({module_or_path} = module_or_path) - else - console.warn('using deprecated parameters for the initialization function; pass a single object instead') + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } const imports = __wbg_get_imports();", @@ -428,10 +437,13 @@ fn omit_default_module_path_target_no_modules() { if (wasm !== undefined) return wasm; - if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype) - ({module_or_path} = module_or_path) - else - console.warn('using deprecated parameters for the initialization function; pass a single object instead') + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } const imports = __wbg_get_imports();", From e5c63866d0c9b40637e29a6fc1618affc6a0a8e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Aug 2024 19:05:00 +0200 Subject: [PATCH 471/641] Bump `tower` to v0.5 (#4075) --- crates/example-tests/Cargo.toml | 2 +- crates/example-tests/src/lib.rs | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index ae947439437..232e8db7db3 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -22,5 +22,5 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.29.1", features = ["macros", "net", "time"] } tokio-tungstenite = "0.23" -tower = { version = "0.4.13", features = ["make"] } +tower = { version = "0.5", features = ["make", "util"] } tower-http = { version = "0.5", features = ["fs", "util", "set-header"] } diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 7a5e360d57f..8753dad2f18 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -8,7 +8,7 @@ use std::{env, str}; use anyhow::{bail, Context}; use futures_util::{future, SinkExt, StreamExt}; -use http::{HeaderName, HeaderValue}; +use http::{HeaderName, HeaderValue, Response}; use hyper_util::rt::{TokioExecutor, TokioIo}; use hyper_util::server::conn::auto::Builder; use hyper_util::service::TowerToHyperService; @@ -24,8 +24,8 @@ use tokio::time::timeout; use tokio_tungstenite::tungstenite::{self, Message}; use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; use tower::ServiceBuilder; +use tower_http::services::fs::ServeFileSystemResponseBody; use tower_http::services::ServeDir; -use tower_http::ServiceBuilderExt; /// A command sent from the client to the server. #[derive(Serialize)] @@ -330,14 +330,17 @@ pub async fn test_example( // Serve the path. let service = TowerToHyperService::new( ServiceBuilder::new() - .override_response_header( - HeaderName::from_static("cross-origin-opener-policy"), - HeaderValue::from_static("same-origin"), - ) - .override_response_header( - HeaderName::from_static("cross-origin-embedder-policy"), - HeaderValue::from_static("require-corp"), - ) + .map_response(|mut response: Response| { + response.headers_mut().insert( + HeaderName::from_static("cross-origin-opener-policy"), + HeaderValue::from_static("same-origin"), + ); + response.headers_mut().insert( + HeaderName::from_static("cross-origin-embedder-policy"), + HeaderValue::from_static("require-corp"), + ); + response + }) .service(ServeDir::new(path)), ); From 275ba6d6adc892e3f16c0033d57f6c95b9f42267 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 17 Aug 2024 20:31:38 +0200 Subject: [PATCH 472/641] Update test coverage documentation (#4077) --- guide/src/wasm-bindgen-test/coverage.md | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/guide/src/wasm-bindgen-test/coverage.md b/guide/src/wasm-bindgen-test/coverage.md index d1a66d9315f..f445a61700a 100644 --- a/guide/src/wasm-bindgen-test/coverage.md +++ b/guide/src/wasm-bindgen-test/coverage.md @@ -68,21 +68,24 @@ crate_name=name_of_the_tested_crate_in_snake_case objects=() IFS=$'\n' for file in $( - CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ - RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ - cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \ - jq -r "select(.reason == \"compiler-artifact\") | (select(.target.kind == [\"test\"]) // select(.target.name == \"$crate_name\")) | .filenames[0]" + CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ + RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ + cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \ + jq -r "select(.reason == \"compiler-artifact\") | (select(.target.kind == [\"test\"]) // select(.target.name == \"$crate_name\")) | .filenames[0]" ) do - if [[ ${file##*.} == "rlib" ]]; then - base=$(basename $file .rlib) - file=$(dirname $file)/${base#"lib"}.ll - else - file=$(dirname $file)/$(basename $file .wasm).ll - fi - - perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file - perl -i -p0e 's/(^define( [^ ]+)*) range\(.*?\)/$1/gm' $file + if [[ ${file##*.} == "rlib" ]]; then + base=$(basename $file .rlib) + file=$(dirname $file)/${base#"lib"}.ll + else + file=$(dirname $file)/$(basename $file .wasm).ll + fi + + perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file + counter=1 + while (( counter != 0 )); do + counter=$(perl -i -p0e '$c+= s/(^(define|declare)(,? [^\n ]+)*),? range\(.*?\)/$1/gm; END{print "$c"}' $file) + done output = $(basename $file .ll).o clang-18 $input -Wno-override-module -c -o $output From ddceac747876d67fe52dafc90964f95741ae467d Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 18 Aug 2024 15:54:56 +0200 Subject: [PATCH 473/641] Use `#[automatically_derived]` instead of `#[coverage(off)]` (#4078) --- CHANGELOG.md | 3 ++ crates/backend/src/codegen.rs | 30 +++++++++++++++---- crates/cli/tests/reference/raw.js | 48 +++++++++++++++---------------- 3 files changed, 51 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7134cfdb53c..eaf97bc6412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Fixed incorrect deprecation warning when passing no parameter into `default()` (`init()`) or `initSync()`. [#4074](https://github.com/rustwasm/wasm-bindgen/pull/4074) +* Fixed many proc-macro generated `impl` blocks missing `#[automatically_derived]`, affecting test coverage. + [#4078](https://github.com/rustwasm/wasm-bindgen/pull/4078) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 4121ada5fdc..9a41621cb1e 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -222,7 +222,6 @@ impl ToTokens for ast::Struct { (quote! { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { use #wasm_bindgen::__wbindgen_if_not_std; use #wasm_bindgen::describe::*; @@ -369,7 +368,7 @@ impl ToTokens for ast::Struct { fn is_none(abi: &Self::Abi) -> bool { *abi == 0 } } - #[allow(clippy::all)] + #[automatically_derived] impl #wasm_bindgen::convert::TryFromJsValue for #name { type Error = #wasm_bindgen::JsValue; @@ -404,8 +403,8 @@ impl ToTokens for ast::Struct { } } + #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribeVector for #name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { use #wasm_bindgen::describe::*; inform(VECTOR); @@ -415,6 +414,7 @@ impl ToTokens for ast::Struct { } } + #[automatically_derived] impl #wasm_bindgen::convert::VectorIntoWasmAbi for #name { type Abi = < #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> @@ -428,6 +428,7 @@ impl ToTokens for ast::Struct { } } + #[automatically_derived] impl #wasm_bindgen::convert::VectorFromWasmAbi for #name { type Abi = < #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> @@ -441,6 +442,7 @@ impl ToTokens for ast::Struct { } } + #[automatically_derived] impl #wasm_bindgen::__rt::VectorIntoJsValue for #name { fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#name]>) -> #wasm_bindgen::JsValue { #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) @@ -939,13 +941,14 @@ impl ToTokens for ast::ImportType { use #wasm_bindgen::{JsValue, JsCast, JsObject}; use #wasm_bindgen::__rt::core; + #[automatically_derived] impl WasmDescribe for #rust_name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { #description } } + #[automatically_derived] impl IntoWasmAbi for #rust_name { type Abi = ::Abi; @@ -955,6 +958,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl OptionIntoWasmAbi for #rust_name { #[inline] fn none() -> Self::Abi { @@ -962,6 +966,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl<'a> OptionIntoWasmAbi for &'a #rust_name { #[inline] fn none() -> Self::Abi { @@ -969,6 +974,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl FromWasmAbi for #rust_name { type Abi = ::Abi; @@ -980,11 +986,13 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl OptionFromWasmAbi for #rust_name { #[inline] fn is_none(abi: &Self::Abi) -> bool { *abi == 0 } } + #[automatically_derived] impl<'a> IntoWasmAbi for &'a #rust_name { type Abi = <&'a JsValue as IntoWasmAbi>::Abi; @@ -994,6 +1002,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl RefFromWasmAbi for #rust_name { type Abi = ::Abi; type Anchor = core::mem::ManuallyDrop<#rust_name>; @@ -1007,6 +1016,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl LongRefFromWasmAbi for #rust_name { type Abi = ::Abi; type Anchor = #rust_name; @@ -1019,6 +1029,7 @@ impl ToTokens for ast::ImportType { } // TODO: remove this on the next major version + #[automatically_derived] impl From for #rust_name { #[inline] fn from(obj: JsValue) -> #rust_name { @@ -1026,17 +1037,20 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl AsRef for #rust_name { #[inline] fn as_ref(&self) -> &JsValue { self.obj.as_ref() } } + #[automatically_derived] impl AsRef<#rust_name> for #rust_name { #[inline] fn as_ref(&self) -> &#rust_name { self } } + #[automatically_derived] impl From<#rust_name> for JsValue { #[inline] fn from(obj: #rust_name) -> JsValue { @@ -1044,6 +1058,7 @@ impl ToTokens for ast::ImportType { } } + #[automatically_derived] impl JsCast for #rust_name { fn instanceof(val: &JsValue) -> bool { #[link(wasm_import_module = "__wbindgen_placeholder__")] @@ -1592,7 +1607,7 @@ impl ToTokens for ast::Enum { } } - #[allow(clippy::all)] + #[automatically_derived] impl #wasm_bindgen::convert::TryFromJsValue for #enum_name { type Error = #wasm_bindgen::JsValue; @@ -1609,8 +1624,8 @@ impl ToTokens for ast::Enum { } } + #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribeVector for #enum_name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { use #wasm_bindgen::describe::*; inform(VECTOR); @@ -1618,6 +1633,7 @@ impl ToTokens for ast::Enum { } } + #[automatically_derived] impl #wasm_bindgen::convert::VectorIntoWasmAbi for #enum_name { type Abi = < #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> @@ -1631,6 +1647,7 @@ impl ToTokens for ast::Enum { } } + #[automatically_derived] impl #wasm_bindgen::convert::VectorFromWasmAbi for #enum_name { type Abi = < #wasm_bindgen::__rt::alloc::boxed::Box<[#wasm_bindgen::JsValue]> @@ -1644,6 +1661,7 @@ impl ToTokens for ast::Enum { } } + #[automatically_derived] impl #wasm_bindgen::__rt::VectorIntoJsValue for #enum_name { fn vector_into_jsvalue(vector: #wasm_bindgen::__rt::alloc::boxed::Box<[#enum_name]>) -> #wasm_bindgen::JsValue { #wasm_bindgen::__rt::js_value_vector_into_jsvalue(vector) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6b831debb89..3432d150366 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -45,6 +25,26 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); -}; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + From 0cbca3174acad5111725f7e7d4f1ab7c10bebaaf Mon Sep 17 00:00:00 2001 From: Ryan Goree Date: Wed, 21 Aug 2024 09:51:22 -0500 Subject: [PATCH 474/641] Fix negative `BigInt` formatting (#4082) --- CHANGELOG.md | 3 +++ crates/js-sys/src/lib.rs | 31 +++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf97bc6412..80cc9e080ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Fixed many proc-macro generated `impl` blocks missing `#[automatically_derived]`, affecting test coverage. [#4078](https://github.com/rustwasm/wasm-bindgen/pull/4078) +* Fixed negative `BigInt` values being incorrectly formatted with two minus signs. + [#4082](https://github.com/rustwasm/wasm-bindgen/pull/4082) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index a9f57d0c20e..8d64a937e41 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -1387,6 +1387,16 @@ impl BigInt { .pow(JsValue::as_ref(rhs)) .unchecked_into() } + + /// Returns a tuple of this [`BigInt`]'s absolute value along with a + /// [`bool`] indicating whether the [`BigInt`] was negative. + fn abs(&self) -> (Self, bool) { + if self >= &BigInt::from(0) { + (self.clone(), false) + } else { + (-self, true) + } + } } macro_rules! bigint_from { @@ -1493,41 +1503,42 @@ impl fmt::Debug for BigInt { impl fmt::Display for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad_integral(self >= &BigInt::from(0), "", &self.to_string_unchecked(10)) + let (abs, is_neg) = self.abs(); + f.pad_integral(is_neg, "", &abs.to_string_unchecked(10)) } } impl fmt::Binary for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad_integral(self >= &BigInt::from(0), "0b", &self.to_string_unchecked(2)) + let (abs, is_neg) = self.abs(); + f.pad_integral(is_neg, "0b", &abs.to_string_unchecked(2)) } } impl fmt::Octal for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad_integral(self >= &BigInt::from(0), "0o", &self.to_string_unchecked(8)) + let (abs, is_neg) = self.abs(); + f.pad_integral(is_neg, "0o", &abs.to_string_unchecked(8)) } } impl fmt::LowerHex for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.pad_integral( - self >= &BigInt::from(0), - "0x", - &self.to_string_unchecked(16), - ) + let (abs, is_neg) = self.abs(); + f.pad_integral(is_neg, "0x", &abs.to_string_unchecked(16)) } } impl fmt::UpperHex for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut s: String = self.to_string_unchecked(16); + let (abs, is_neg) = self.abs(); + let mut s: String = abs.to_string_unchecked(16); s.make_ascii_uppercase(); - f.pad_integral(self >= &BigInt::from(0), "0x", &s) + f.pad_integral(is_neg, "0x", &s) } } From 9d6693a14e5107f7beed84599525c571a70e7189 Mon Sep 17 00:00:00 2001 From: Ryan Goree Date: Tue, 27 Aug 2024 03:09:29 -0500 Subject: [PATCH 475/641] Fix `BigInt` formatting negative check (#4088) --- CHANGELOG.md | 1 + crates/js-sys/src/lib.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80cc9e080ac..eb7a7fc082b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * Fixed negative `BigInt` values being incorrectly formatted with two minus signs. [#4082](https://github.com/rustwasm/wasm-bindgen/pull/4082) + [#4088](https://github.com/rustwasm/wasm-bindgen/pull/4088) -------------------------------------------------------------------------------- diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 8d64a937e41..829a6246d9b 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -1391,10 +1391,10 @@ impl BigInt { /// Returns a tuple of this [`BigInt`]'s absolute value along with a /// [`bool`] indicating whether the [`BigInt`] was negative. fn abs(&self) -> (Self, bool) { - if self >= &BigInt::from(0) { - (self.clone(), false) - } else { + if self < &BigInt::from(0) { (-self, true) + } else { + (self.clone(), false) } } } @@ -1504,7 +1504,7 @@ impl fmt::Display for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (abs, is_neg) = self.abs(); - f.pad_integral(is_neg, "", &abs.to_string_unchecked(10)) + f.pad_integral(!is_neg, "", &abs.to_string_unchecked(10)) } } @@ -1512,7 +1512,7 @@ impl fmt::Binary for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (abs, is_neg) = self.abs(); - f.pad_integral(is_neg, "0b", &abs.to_string_unchecked(2)) + f.pad_integral(!is_neg, "0b", &abs.to_string_unchecked(2)) } } @@ -1520,7 +1520,7 @@ impl fmt::Octal for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (abs, is_neg) = self.abs(); - f.pad_integral(is_neg, "0o", &abs.to_string_unchecked(8)) + f.pad_integral(!is_neg, "0o", &abs.to_string_unchecked(8)) } } @@ -1528,7 +1528,7 @@ impl fmt::LowerHex for BigInt { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (abs, is_neg) = self.abs(); - f.pad_integral(is_neg, "0x", &abs.to_string_unchecked(16)) + f.pad_integral(!is_neg, "0x", &abs.to_string_unchecked(16)) } } @@ -1538,7 +1538,7 @@ impl fmt::UpperHex for BigInt { let (abs, is_neg) = self.abs(); let mut s: String = abs.to_string_unchecked(16); s.make_ascii_uppercase(); - f.pad_integral(is_neg, "0x", &s) + f.pad_integral(!is_neg, "0x", &s) } } From 125aa23b588102a4cb029e4269e297e542b98d88 Mon Sep 17 00:00:00 2001 From: kawaemon Date: Tue, 27 Aug 2024 17:11:22 +0900 Subject: [PATCH 476/641] Fix emitted package.json structure (#4091) --- CHANGELOG.md | 3 +++ crates/cli-support/Cargo.toml | 1 + crates/cli-support/src/lib.rs | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb7a7fc082b..b5ef4213c6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ [#4082](https://github.com/rustwasm/wasm-bindgen/pull/4082) [#4088](https://github.com/rustwasm/wasm-bindgen/pull/4088) +* Fixed emitted `package.json` structure to correctly specify its dependencies + [#4091](https://github.com/rustwasm/wasm-bindgen/pull/4091) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 0bc105fffe3..9513c5adbdf 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -18,6 +18,7 @@ anyhow = "1.0" base64 = "0.22" log = "0.4" rustc-demangle = "0.1.13" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 7a3d70cc704..7366bb5acb9 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -641,12 +641,18 @@ impl Output { } if !gen.npm_dependencies.is_empty() { - let map = gen - .npm_dependencies - .iter() - .map(|(k, v)| (k, &v.1)) - .collect::>(); - let json = serde_json::to_string_pretty(&map)?; + #[derive(serde::Serialize)] + struct PackageJson<'a> { + dependencies: BTreeMap<&'a str, &'a str>, + } + let pj = PackageJson { + dependencies: gen + .npm_dependencies + .iter() + .map(|(k, v)| (k.as_str(), v.1.as_str())) + .collect(), + }; + let json = serde_json::to_string_pretty(&pj)?; fs::write(out_dir.join("package.json"), json)?; } From e4f8c4540aee2f3c0798fdae51ac7dace28e102b Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Tue, 27 Aug 2024 10:18:49 +0200 Subject: [PATCH 477/641] =?UTF-8?q?Consistently=20capitalize=20=E2=80=9CWa?= =?UTF-8?q?sm=E2=80=9D=20(#4094)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 26 +++++++------- README.md | 2 +- benchmarks/index.html | 6 ++-- benchmarks/index.js | 2 +- crates/backend/src/ast.rs | 4 +-- crates/backend/src/codegen.rs | 6 ++-- crates/cli-support/src/externref.rs | 10 +++--- crates/cli-support/src/js/binding.rs | 8 ++--- crates/cli-support/src/js/mod.rs | 34 +++++++++---------- crates/cli-support/src/lib.rs | 10 +++--- crates/cli-support/src/multivalue.rs | 2 +- crates/cli-support/src/wasm2es6js.rs | 2 +- crates/cli-support/src/wit/incoming.rs | 6 ++-- crates/cli-support/src/wit/mod.rs | 28 +++++++-------- crates/cli-support/src/wit/nonstandard.rs | 12 +++---- crates/cli-support/src/wit/outgoing.rs | 6 ++-- crates/cli-support/src/wit/section.rs | 18 +++++----- crates/cli-support/src/wit/standard.rs | 12 +++---- .../src/bin/wasm-bindgen-test-runner/main.rs | 14 ++++---- .../src/bin/wasm-bindgen-test-runner/node.rs | 2 +- .../bin/wasm-bindgen-test-runner/server.rs | 8 ++--- crates/cli/src/bin/wasm-bindgen.rs | 4 +-- crates/cli/src/bin/wasm2es6js.rs | 4 +-- crates/cli/tests/reference.rs | 6 ++-- crates/externref-xform/src/lib.rs | 12 +++---- crates/futures/src/lib.rs | 6 ++-- crates/js-sys/src/lib.rs | 10 +++--- crates/macro-support/src/parser.rs | 2 +- crates/multi-value-xform/src/lib.rs | 2 +- crates/test/README.md | 10 +++--- crates/test/src/rt/mod.rs | 16 ++++----- crates/threads-xform/src/lib.rs | 6 ++-- crates/wasm-interpreter/src/lib.rs | 16 ++++----- examples/add/README.md | 2 +- examples/console_log/src/lib.rs | 2 +- examples/deno/README.md | 2 +- examples/raytrace-parallel/build.py | 2 +- examples/raytrace-parallel/index.js | 2 +- examples/raytrace-parallel/src/lib.rs | 2 +- examples/raytrace-parallel/src/pool.rs | 6 ++-- examples/request-animation-frame/src/lib.rs | 2 +- examples/wasm-audio-worklet/build.py | 2 +- examples/wasm-audio-worklet/src/wasm_audio.rs | 4 +-- examples/wasm-in-wasm-imports/src/lib.rs | 2 +- examples/wasm-in-wasm/src/lib.rs | 2 +- examples/wasm-in-web-worker/index.js | 2 +- examples/wasm-in-web-worker/worker.js | 2 +- examples/wasm2js/build.sh | 2 +- .../without-a-bundler-no-modules/src/lib.rs | 2 +- examples/without-a-bundler/index.html | 10 +++--- examples/without-a-bundler/src/lib.rs | 2 +- guide/src/SUMMARY.md | 2 +- guide/src/contributing/design/describe.md | 4 +-- .../src/contributing/design/exporting-rust.md | 16 ++++----- guide/src/contributing/design/index.md | 10 +++--- .../contributing/design/js-objects-in-rust.md | 18 +++++----- guide/src/examples/add.md | 4 +-- guide/src/examples/raytrace.md | 12 +++---- guide/src/examples/web-audio.md | 2 +- guide/src/introduction.md | 2 +- .../attributes/on-js-imports/catch.md | 6 ++-- .../attributes/on-js-imports/final.md | 4 +-- .../attributes/on-js-imports/raw_module.md | 2 +- .../attributes/on-js-imports/variadic.md | 2 +- .../attributes/on-rust-exports/start.md | 6 ++-- guide/src/reference/browser-support.md | 2 +- guide/src/reference/cli.md | 2 +- guide/src/reference/deployment.md | 6 ++-- guide/src/reference/optimize-size.md | 4 +-- guide/src/reference/reference-types.md | 4 +-- guide/src/reference/types/result.md | 2 +- .../continuous-integration.md | 2 +- guide/src/wasm-bindgen-test/index.md | 4 +-- releases/release-announcement-template.md | 2 +- src/convert/impls.rs | 2 +- src/convert/slices.rs | 2 +- src/convert/traits.rs | 16 ++++----- src/lib.rs | 18 +++++----- 78 files changed, 259 insertions(+), 259 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5ef4213c6d..ee519b69adc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -472,7 +472,7 @@ Released 2023-11-01 [#3537](https://github.com/rustwasm/wasm-bindgen/pull/3537) * Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and - non-WASM targets, generating a stub that panics when called rather than a wasm- + non-Wasm targets, generating a stub that panics when called rather than a wasm- bindgen placeholder. [#3233](https://github.com/rustwasm/wasm-bindgen/pull/3233) @@ -940,7 +940,7 @@ Released 2020-04-29. [#2099](https://github.com/rustwasm/wasm-bindgen/pull/2099) * The output of `wasm-bindgen` is now compatible with Webpack 5 and the updated - version of the wasm ESM integration specification. + version of the Wasm ESM integration specification. [#2110](https://github.com/rustwasm/wasm-bindgen/pull/2099) -------------------------------------------------------------------------------- @@ -1123,7 +1123,7 @@ Released 2019-11-19. * Running `wasm-bindgen` over empty anyref modules now works again. [#1861](https://github.com/rustwasm/wasm-bindgen/pull/1861) -* Support for multi-value JS engines has been fixed as a wasm interface types +* Support for multi-value JS engines has been fixed as a Wasm interface types polyfill. [#1863](https://github.com/rustwasm/wasm-bindgen/pull/1863) @@ -1346,8 +1346,8 @@ Released 2019-07-11. slices. [#1639](https://github.com/rustwasm/wasm-bindgen/pull/1639) -* When using the `bundler` target the import of the wasm file now uses the - `.wasm` extension to ensure a wasm file is loaded. +* When using the `bundler` target the import of the Wasm file now uses the + `.wasm` extension to ensure a Wasm file is loaded. [#1646](https://github.com/rustwasm/wasm-bindgen/pull/1646) * The old internal `Stack` trait has been removed since it is no longer used. @@ -1475,7 +1475,7 @@ Released 2019-05-16. * A utility for counting the size of the `anyref` heap has been added. [#1521](https://github.com/rustwasm/wasm-bindgen/pull/1521) -* Passing ASCII-only strings to WASM should now be significantly faster. +* Passing ASCII-only strings to Wasm should now be significantly faster. [#1470](https://github.com/rustwasm/wasm-bindgen/pull/1470) * The `selectionStart` and `selectionEnd` APIs of text areas have been enabled. @@ -1615,7 +1615,7 @@ Released 2019-04-10. [#1416](https://github.com/rustwasm/wasm-bindgen/pull/1416) * A `wasm_bindgen::function_table()` function has been added to expose the - `WebAssembly.Table` and get access to it in wasm code. + `WebAssembly.Table` and get access to it in Wasm code. [#1431](https://github.com/rustwasm/wasm-bindgen/pull/1431) ### Fixed @@ -1778,7 +1778,7 @@ Released 2019-02-15. [#1225](https://github.com/rustwasm/wasm-bindgen/pull/1225). * A `--remove-producers-section` flag has been added to the CLI tool to, well, - remove the `producers` section from the final wasm file. + remove the `producers` section from the final Wasm file. [#1256](https://github.com/rustwasm/wasm-bindgen/pull/1256). ### Fixed @@ -1816,7 +1816,7 @@ Released 2019-02-12. ### Changed * `wasm-bindgen` now internally uses the `walrus` crate to perform its - transformations of the wasm that rustc/LLVM emits. See + transformations of the Wasm that rustc/LLVM emits. See [#1237](https://github.com/rustwasm/wasm-bindgen/pull/1237). ### Fixed @@ -1968,17 +1968,17 @@ Released 2018-12-04. ### Added * Add a `#[wasm_bindgen(start)]` attribute to customize the `start` section of - the wasm module. + the Wasm module. [#1057](https://github.com/rustwasm/wasm-bindgen/pull/1057) -* Add support for producing the new "producers" section of wasm binaries +* Add support for producing the new "producers" section of Wasm binaries [#1041](https://github.com/rustwasm/wasm-bindgen/pull/1041) * Add support a `typescript_custom_section` attribute for producing custom typescript abstractions [#1048](https://github.com/rustwasm/wasm-bindgen/pull/1048) -* Generate `*.d.ts` files for wasm files in addition to the JS bindings +* Generate `*.d.ts` files for Wasm files in addition to the JS bindings [#1053](https://github.com/rustwasm/wasm-bindgen/pull/1053) * Add a feature to assert that all attributes in `#[wasm_bindgen]` are used to @@ -2255,7 +2255,7 @@ Released 2018-09-07 ### Fixed -* The "names" section of the wasm binary is now correctly preserved by +* The "names" section of the Wasm binary is now correctly preserved by wasm-bindgen. -------------------------------------------------------------------------------- diff --git a/README.md b/README.md index a9d57ee0a4e..d8e07bc0952 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ greet("World!"); * **Designed with the ["Web IDL bindings" proposal][webidl-bindings] in mind.** Eventually, there won't be any JavaScript shims between Rust-generated wasm - functions and native DOM methods. Because the wasm functions are statically + functions and native DOM methods. Because the Wasm functions are statically type checked, some of those native methods' dynamic type checks should become unnecessary, promising to unlock even-faster-than-JavaScript DOM access. diff --git a/benchmarks/index.html b/benchmarks/index.html index 49cf021333a..b20d27e5d45 100644 --- a/benchmarks/index.html +++ b/benchmarks/index.html @@ -56,7 +56,7 @@

JS / wasm-bindgen comparison

This benchmarks tests out how long it take JS to call a thunk in the given language. For example JS will call a JS thunk or - JS will call a wasm function that does nothing. + JS will call a Wasm function that does nothing.

@@ -131,7 +131,7 @@

JS / wasm-bindgen comparison

This benchmarks calculates the 40th fibonacci number. It in - theory should favor wasm since wasm is "better a compute", but + theory should favor Wasm since Wasm is "better a compute", but a good JIT will probably make the code roughly equivalent.

@@ -296,7 +296,7 @@

wasm-bindgen benchmarks

(?)

- This benchmarks the overhead of passing strings to wasm and + This benchmarks the overhead of passing strings to Wasm and also receiving them from wasm.

diff --git a/benchmarks/index.js b/benchmarks/index.js index e74d8781da5..a8cbae01e77 100644 --- a/benchmarks/index.js +++ b/benchmarks/index.js @@ -160,7 +160,7 @@ function executeBenchmark(name, bm) { }); } -// Load wasm files and when they're done (plus the DOM) then we initialize +// Load Wasm files and when they're done (plus the DOM) then we initialize // everything const wasms = []; wasms.push(wbindgen_init('./pkg/wasm_bindgen_benchmark_bg.wasm')); diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index e10cf756ddd..d27e1e746b8 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -1,5 +1,5 @@ //! A representation of the Abstract Syntax Tree of a Rust program, -//! with all the added metadata necessary to generate WASM bindings +//! with all the added metadata necessary to generate Wasm bindings //! for it. use crate::{util::ShortHash, Diagnostic}; @@ -100,7 +100,7 @@ pub struct Export { pub rust_class: Option, /// The name of the rust function/method on the rust side. pub rust_name: Ident, - /// Whether or not this function should be flagged as the wasm start + /// Whether or not this function should be flagged as the Wasm start /// function. pub start: bool, /// Path to wasm_bindgen diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 9a41621cb1e..11daf2ccc15 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -86,7 +86,7 @@ impl TryToTokens for ast::Program { Diagnostic::from_vec(errors)?; // Generate a static which will eventually be what lives in a custom section - // of the wasm executable. For now it's just a plain old static, but we'll + // of the Wasm executable. For now it's just a plain old static, but we'll // eventually have it actually in its own section. // See comments in `crates/cli-support/src/lib.rs` about what this @@ -278,7 +278,7 @@ impl ToTokens for ast::Struct { #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #new_fn(_: u32) -> u32 { - panic!("cannot convert to JsValue outside of the wasm target") + panic!("cannot convert to JsValue outside of the Wasm target") } unsafe { @@ -384,7 +384,7 @@ impl ToTokens for ast::Struct { #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] unsafe fn #unwrap_fn(_: u32) -> u32 { - panic!("cannot convert from JsValue outside of the wasm target") + panic!("cannot convert from JsValue outside of the Wasm target") } let ptr = unsafe { #unwrap_fn(idx) }; diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index be732ceeef0..a7803313541 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -86,7 +86,7 @@ pub fn process(module: &mut Module) -> Result<()> { for instr in instrs { match instr.instr { // Calls to the heap live count intrinsic are now routed to the - // actual wasm function which keeps track of this. + // actual Wasm function which keeps track of this. Instruction::CallAdapter(adapter) => { let id = match meta.live_count { Some(id) => id, @@ -103,7 +103,7 @@ pub fn process(module: &mut Module) -> Result<()> { instr.instr = Instruction::CallCore(id); } - // Optional externref values are now managed in the wasm module, so + // Optional externref values are now managed in the Wasm module, so // we need to store where they're managed. Instruction::I32FromOptionExternref { ref mut table_and_alloc, @@ -333,7 +333,7 @@ fn export_xform(cx: &mut Context, export: Export, instrs: &mut Vec { /// use to translate the `arg.get` instruction. args: Vec, - /// The wasm interface types "stack". The expressions pushed onto this stack + /// The Wasm interface types "stack". The expressions pushed onto this stack /// are intended to be *pure*, and if they're not, they should be pushed /// into the `prelude`, assigned to a variable, and the variable should be /// pushed to the stack. We're not super principled about this though, so @@ -164,7 +164,7 @@ impl<'a, 'b> Builder<'a, 'b> { // We don't actually manage a literal stack at runtime, but instead we // act as more of a compiler to generate straight-line code to make it // more JIT-friendly. The generated code should be equivalent to the - // wasm interface types stack machine, however. + // Wasm interface types stack machine, however. for instr in instructions { instruction( &mut js, @@ -1103,8 +1103,8 @@ fn instruction( // Then pass it the pointer and the length of where we copied it. js.push(format!("ptr{}", i)); js.push(format!("len{}", i)); - // Then we give wasm a reference to the original typed array, so that it can - // update it with modifications made on the wasm side before returning. + // Then we give Wasm a reference to the original typed array, so that it can + // update it with modifications made on the Wasm side before returning. js.push(val); } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8450349482d..87042e608fb 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -36,7 +36,7 @@ pub struct Context<'a> { /// renames for each identifier. js_imports: HashMap)>>, - /// A map of each wasm import and what JS to hook up to it. + /// A map of each Wasm import and what JS to hook up to it. wasm_import_definitions: HashMap, /// A map from an import to the name we've locally imported it as. @@ -377,7 +377,7 @@ impl<'a> Context<'a> { } // Depending on the output mode, generate necessary glue to actually - // import the wasm file in one way or another. + // import the Wasm file in one way or another. let mut init = (String::new(), String::new()); let mut footer = String::new(); let mut imports = self.js_import_header()?; @@ -445,9 +445,9 @@ impl<'a> Context<'a> { } } - // With Bundlers we can simply import the wasm file as if it were an ES module + // With Bundlers we can simply import the Wasm file as if it were an ES module // and let the bundler/runtime take care of it. - // With Node we manually read the wasm file from the filesystem and instantiate it. + // With Node we manually read the Wasm file from the filesystem and instantiate it. OutputMode::Bundler { .. } | OutputMode::Node { module: true } => { for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { let import = self.module.imports.get_mut(*id); @@ -491,7 +491,7 @@ impl<'a> Context<'a> { } // With a browser-native output we're generating an ES module, but - // browsers don't support natively importing wasm right now so we + // browsers don't support natively importing Wasm right now so we // expose the same initialization function as `--target no-modules` // as the default export of the module. OutputMode::Web => { @@ -821,7 +821,7 @@ impl<'a> Context<'a> { }} catch (e) {{ if (module.headers.get('Content-Type') != 'application/wasm') {{ console.warn(\"`WebAssembly.instantiateStreaming` failed \ - because your server does not serve wasm with \ + because your server does not serve Wasm with \ `application/wasm` MIME type. Falling back to \ `WebAssembly.instantiate` which is slower. Original \ error:\\n\", e); @@ -1307,7 +1307,7 @@ impl<'a> Context<'a> { } } - // A fast path that directly writes char codes into WASM memory as long + // A fast path that directly writes char codes into Wasm memory as long // as it finds only ASCII characters. // // This is much faster for common ASCII strings because it can avoid @@ -1836,7 +1836,7 @@ impl<'a> Context<'a> { let cache = format!("cached{}Memory{}", kind, view.num); let resized_check = if self.module.memories.get(memory).shared { - // When it's backed by a `SharedArrayBuffer`, growing the wasm module's memory + // When it's backed by a `SharedArrayBuffer`, growing the Wasm module's memory // doesn't detach old references; instead, it just leaves them pointing to a // slice of the up-to-date memory. So in order to check if it's been grown, we // have to compare it to the up-to-date buffer. @@ -2393,7 +2393,7 @@ impl<'a> Context<'a> { } /// If a start function is present, it removes it from the `start` section - /// of the wasm module and then moves it to an exported function, named + /// of the Wasm module and then moves it to an exported function, named /// `__wbindgen_start`. fn unstart_start_function(&mut self) -> bool { let start = match self.module.start.take() { @@ -2780,7 +2780,7 @@ impl<'a> Context<'a> { } } - /// Attempts to directly hook up the `id` import in the wasm module with + /// Attempts to directly hook up the `id` import in the Wasm module with /// the `instrs` specified. /// /// If this succeeds it returns `Ok(true)`, otherwise if it cannot be @@ -2845,15 +2845,15 @@ impl<'a> Context<'a> { // If there's no field projection happening here and this is a direct // import from an ES-looking module, then we can actually just hook this - // up directly in the wasm file itself. Note that this is covered in the + // up directly in the Wasm file itself. Note that this is covered in the // various output formats as well: // - // * `bundler` - they think wasm is an ES module anyway + // * `bundler` - they think Wasm is an ES module anyway // * `web` - we're sure to emit more `import` directives during // `gen_init` and we update the import object accordingly. - // * `nodejs` - the polyfill we have for requiring a wasm file as a node + // * `nodejs` - the polyfill we have for requiring a Wasm file as a node // module will naturally emit `require` directives for the module - // listed on each wasm import. + // listed on each Wasm import. // * `no-modules` - imports aren't allowed here anyway from other // modules and an error is generated. if js.fields.is_empty() { @@ -2928,11 +2928,11 @@ impl<'a> Context<'a> { // needed. CallAdapter(_) => saw_call = true, - // Conversions to wasm integers are always supported since + // Conversions to Wasm integers are always supported since // they're coerced into i32/f32/f64 appropriately. IntToWasm { .. } => {} - // Converts from wasm to JS, however, only supports most + // Converts from Wasm to JS, however, only supports most // integers. Converting into a u32 isn't supported because we // need to generate glue to change the sign. WasmToInt { @@ -3993,7 +3993,7 @@ impl<'a> Context<'a> { let stack_pointer = match self.aux.stack_pointer { Some(s) => s, // In theory this shouldn't happen since malloc is included in - // most wasm binaries (and may be gc'd out) and that almost + // most Wasm binaries (and may be gc'd out) and that almost // always pulls in a stack pointer. We can try to synthesize // something here later if necessary. None => bail!("failed to find stack pointer"), diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 7366bb5acb9..cf37a130616 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -35,7 +35,7 @@ pub struct Bindgen { remove_producers_section: bool, omit_default_module_path: bool, emit_start: bool, - // Support for the wasm threads proposal, transforms the wasm module to be + // Support for the Wasm threads proposal, transforms the Wasm module to be // "ready to be instantiated on any thread" threads: wasm_bindgen_threads_xform::Config, externref: bool, @@ -364,7 +364,7 @@ impl Bindgen { descriptors::execute(&mut module)?; // Process the custom section we extracted earlier. In its stead insert - // a forward-compatible wasm interface types section as well as an + // a forward-compatible Wasm interface types section as well as an // auxiliary section for all sorts of miscellaneous information and // features #[wasm_bindgen] supports that aren't covered by wasm // interface types. @@ -405,7 +405,7 @@ impl Bindgen { .context("failed to transform return pointers into multi-value Wasm")?; } - // We've done a whole bunch of transformations to the wasm module, many + // We've done a whole bunch of transformations to the Wasm module, many // of which leave "garbage" lying around, so let's prune out all our // unnecessary things here. gc_module_and_adapters(&mut module); @@ -724,8 +724,8 @@ export * from \"./{js_name}\"; fn gc_module_and_adapters(module: &mut Module) { loop { - // Fist up, cleanup the native wasm module. Note that roots can come - // from custom sections, namely our wasm interface types custom section + // Fist up, cleanup the native Wasm module. Note that roots can come + // from custom sections, namely our Wasm interface types custom section // as well as the aux section. walrus::passes::gc::run(module); diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index f6b8afb078f..a49875381bf 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -30,7 +30,7 @@ pub fn run(module: &mut Module) -> Result<(), Error> { .get_typed::() .expect("aux section should be present") .stack_pointer - .ok_or_else(|| anyhow!("failed to find stack pointer in wasm module"))?; + .ok_or_else(|| anyhow!("failed to find stack pointer in Wasm module"))?; let memory = wasm_conventions::get_memory(module)?; let wrappers = multi_value_xform::run(module, memory, stack_pointer, &to_xform)?; diff --git a/crates/cli-support/src/wasm2es6js.rs b/crates/cli-support/src/wasm2es6js.rs index 77a51d8b445..36298fdd54e 100644 --- a/crates/cli-support/src/wasm2es6js.rs +++ b/crates/cli-support/src/wasm2es6js.rs @@ -205,7 +205,7 @@ impl Output { // This ends up helping out in situations such as: // // * The start function calls an imported function - // * That imported function in turn tries to access the wasm module + // * That imported function in turn tries to access the Wasm module // // If we don't do this then the second step won't work because the start // function is automatically executed before the promise of diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 583c1c34378..73571763834 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -1,8 +1,8 @@ -//! Definition of how to convert Rust types (`Description`) into wasm types +//! Definition of how to convert Rust types (`Description`) into Wasm types //! through adapter functions. //! //! Note that many Rust types use "nonstandard" instructions which only work in -//! the JS output, not for the "pure wasm interface types" output. +//! the JS output, not for the "pure Wasm interface types" output. //! //! Note that the mirror operation, going from WebAssembly to JS, is found in //! the `outgoing.rs` module. @@ -23,7 +23,7 @@ impl InstructionBuilder<'_, '_> { } // This is a wrapper around `_incoming` to have a number of sanity checks // that we don't forget things. We should always produce at least one - // wasm arge and exactly one webidl arg. Additionally the number of + // Wasm arge and exactly one webidl arg. Additionally the number of // bindings should always match the number of webidl types for now. let input_before = self.input.len(); let output_before = self.output.len(); diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index ca0306967be..fb1825e01d7 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -23,9 +23,9 @@ struct Context<'a> { module: &'a mut Module, adapters: NonstandardWitSection, aux: WasmBindgenAux, - /// All of the wasm module's exported functions. + /// All of the Wasm module's exported functions. function_exports: HashMap, - /// All of the wasm module's imported functions. + /// All of the Wasm module's imported functions. function_imports: HashMap, /// A map from the signature of a function in the function table to its adapter, if we've already created it. table_adapters: HashMap, @@ -1093,7 +1093,7 @@ impl<'a> Context<'a> { /// Perform a small verification pass over the module to perform some /// internal sanity checks. fn verify(&self) -> Result<(), Error> { - // First up verify that all imports in the wasm module from our + // First up verify that all imports in the Wasm module from our // `$PLACEHOLDER_MODULE` are connected to an adapter via the // `implements` section. let mut implemented = HashMap::new(); @@ -1182,7 +1182,7 @@ impl<'a> Context<'a> { }; // Process the returned type first to see if it needs an out-pointer. This - // happens if the results of the incoming arguments translated to wasm take + // happens if the results of the incoming arguments translated to Wasm take // up more than one type. let mut ret = self.instruction_builder(true); ret.incoming(&signature.ret)?; @@ -1200,7 +1200,7 @@ impl<'a> Context<'a> { } // Build up the list of instructions for our adapter function. We start out - // with all the outgoing instructions which convert all wasm params to the + // with all the outgoing instructions which convert all Wasm params to the // desired types to call our import... let mut instructions = args.instructions; @@ -1226,7 +1226,7 @@ impl<'a> Context<'a> { instructions.extend(ret.instructions); // ... and if a return pointer is in use then we need to store the types on - // the stack into the wasm return pointer. Note that we iterate in reverse + // the stack into the Wasm return pointer. Note that we iterate in reverse // here because the last result is the top value on the stack. let results = if uses_retptr { let mem = args.cx.memory()?; @@ -1342,10 +1342,10 @@ impl<'a> Context<'a> { let uses_retptr = ret.input.len() > 1; // Our instruction stream starts out with the return pointer as the first - // argument to the wasm function, if one is in use. Then we convert - // everything to wasm types. + // argument to the Wasm function, if one is in use. Then we convert + // everything to Wasm types. // - // After calling the core wasm function we need to load all the return + // After calling the core Wasm function we need to load all the return // pointer arguments if there were any, otherwise we simply convert // everything into the outgoing arguments. let mut instructions = Vec::new(); @@ -1530,7 +1530,7 @@ pub fn extract_programs<'a>( while let Some(raw) = module.customs.remove_raw("__wasm_bindgen_unstable") { log::debug!( - "custom section '{}' looks like a wasm bindgen section", + "custom section '{}' looks like a Wasm bindgen section", raw.name ); program_storage.push(raw.data); @@ -1542,7 +1542,7 @@ pub fn extract_programs<'a>( while let Some(data) = get_remaining(&mut payload) { // Historical versions of wasm-bindgen have used JSON as the custom // data section format. Newer versions, however, are using a custom - // serialization protocol that looks much more like the wasm spec. + // serialization protocol that looks much more like the Wasm spec. // // We, however, want a sanity check to ensure that if we're running // against the wrong wasm-bindgen we get a nicer error than an @@ -1559,10 +1559,10 @@ pub fn extract_programs<'a>( bail!( " -it looks like the Rust project used to create this wasm file was linked against +it looks like the Rust project used to create this Wasm file was linked against version of wasm-bindgen that uses a different bindgen format than this binary: - rust wasm file schema version: {their_version} + rust Wasm file schema version: {their_version} this binary schema version: {my_version} Currently the bindgen format is unstable enough that these two schema versions @@ -1573,7 +1573,7 @@ You should be able to update the wasm-bindgen dependency with: cargo update -p wasm-bindgen --precise {my_version} -don't forget to recompile your wasm file! Alternatively, you can update the +don't forget to recompile your Wasm file! Alternatively, you can update the binary with: cargo install -f wasm-bindgen-cli --version {their_version} diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 4a9d5598ff5..5099a72098c 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -85,17 +85,17 @@ pub struct AuxExport { pub variadic: bool, } -/// All possible kinds of exports from a wasm module. +/// All possible kinds of exports from a Wasm module. /// -/// This `enum` says where to place an exported wasm function. For example it +/// This `enum` says where to place an exported Wasm function. For example it /// may want to get hooked up to a JS class, or it may want to be exported as a /// free function (etc). /// /// TODO: it feels like this should not really be here per se. We probably want -/// to either construct the JS object itself from within wasm or somehow move +/// to either construct the JS object itself from within Wasm or somehow move /// more of this information into some other section. Really what this is is /// sort of an "export map" saying how to wire up all the free functions from -/// the wasm module into the output expected JS module. All our functions here +/// the Wasm module into the output expected JS module. All our functions here /// currently take integer parameters and require a JS wrapper, but ideally /// we'd change them one day to taking/receiving `externref` which then use some /// sort of webidl import to customize behavior or something like that. In any @@ -184,7 +184,7 @@ pub struct AuxStruct { pub generate_typescript: bool, } -/// All possible types of imports that can be imported by a wasm module. +/// All possible types of imports that can be imported by a Wasm module. /// /// This `enum` is intended to map out what an imported value is. For example /// this contains a ton of shims and various ways you can call a function. The @@ -193,7 +193,7 @@ pub struct AuxStruct { /// /// Note that this is *not* the same as the webidl bindings section. This is /// intended to be coupled with that to map out what actually gets hooked up to -/// an import in the wasm module. The two work in tandem. +/// an import in the Wasm module. The two work in tandem. /// /// Some of these items here are native to JS (like `Value`, indexing /// operations, etc). Others are shims generated by wasm-bindgen (like `Closure` diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 033217f61ad..b79a7b68cc6 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -6,10 +6,10 @@ use walrus::ValType; impl InstructionBuilder<'_, '_> { /// Processes one more `Descriptor` as an argument to a JS function that - /// wasm is calling. + /// Wasm is calling. /// /// This will internally skip `Unit` and otherwise build up the `bindings` - /// map and ensure that it's correctly mapped from wasm to JS. + /// map and ensure that it's correctly mapped from Wasm to JS. pub fn outgoing(&mut self, arg: &Descriptor) -> Result<(), Error> { if let Descriptor::Unit = arg { return Ok(()); @@ -213,7 +213,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Function(descriptor) => { // synthesize the a/b arguments that aren't present in the - // signature from wasm-bindgen but are present in the wasm file. + // signature from wasm-bindgen but are present in the Wasm file. let mut descriptor = (**descriptor).clone(); let nargs = descriptor.arguments.len(); descriptor.arguments.insert(0, Descriptor::I32); diff --git a/crates/cli-support/src/wit/section.rs b/crates/cli-support/src/wit/section.rs index c1e4ce4a896..a534e87ce39 100644 --- a/crates/cli-support/src/wit/section.rs +++ b/crates/cli-support/src/wit/section.rs @@ -1,20 +1,20 @@ -//! Support for generating a standard wasm interface types +//! Support for generating a standard Wasm interface types //! //! This module has all the necessary support for generating a full-fledged -//! standard wasm interface types section as defined by the `wit_walrus` +//! standard Wasm interface types section as defined by the `wit_walrus` //! crate. This module also critically assumes that the WebAssembly module //! being generated **must be standalone**. In this mode all sorts of features //! supported by `#[wasm_bindgen]` aren't actually supported, such as closures, //! imports of global js names, js getters/setters, exporting structs, etc. //! These features may all eventually come to the standard bindings proposal, //! but it will likely take some time. In the meantime this module simply focuses -//! on taking what's already a valid wasm module and letting it through with a +//! on taking what's already a valid Wasm module and letting it through with a //! standard WebIDL custom section. All other modules generate an error during //! this binding process. //! //! Note that when this function is called and used we're also not actually //! generating any JS glue. Any JS glue currently generated is also invalid if -//! the module contains the wasm bindings section and it's actually respected. +//! the module contains the Wasm bindings section and it's actually respected. use crate::wit::AuxExport; use crate::wit::{AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, Instruction}; @@ -145,7 +145,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { bail!( "generating a bindings section is currently incompatible with \ local JS modules being specified as well, `{}` cannot be used \ - since a standalone wasm file is being generated", + since a standalone Wasm file is being generated", name, ); } @@ -154,7 +154,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { bail!( "generating a bindings section is currently incompatible with \ local JS snippets being specified as well, `{}` cannot be used \ - since a standalone wasm file is being generated", + since a standalone Wasm file is being generated", name, ); } @@ -163,7 +163,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { bail!( "generating a bindings section is currently incompatible with \ package.json being consumed as well, `{}` cannot be used \ - since a standalone wasm file is being generated", + since a standalone Wasm file is being generated", path.display(), ); } @@ -187,7 +187,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { if let Some(enum_) = enums.iter().next() { bail!( "generating a bindings section is currently incompatible with \ - exporting an `enum` from the wasm file, cannot export `{}`", + exporting an `enum` from the Wasm file, cannot export `{}`", enum_.name, ); } @@ -195,7 +195,7 @@ pub fn add(module: &mut Module) -> Result<(), Error> { if let Some(struct_) = structs.iter().next() { bail!( "generating a bindings section is currently incompatible with \ - exporting a `struct` from the wasm file, cannot export `{}`", + exporting a `struct` from the Wasm file, cannot export `{}`", struct_.name, ); } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 0be106f060d..c93c4ef4d3f 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -9,7 +9,7 @@ pub struct NonstandardWitSection { /// A list of adapter functions, keyed by their id. pub adapters: HashMap, - /// A list of pairs for adapter functions that implement core wasm imports. + /// A list of pairs for adapter functions that implement core Wasm imports. pub implements: Vec<(ImportId, FunctionId, AdapterId)>, /// A list of adapter functions and the names they're exported under. @@ -130,18 +130,18 @@ pub enum Instruction { size: u32, }, - /// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain wasm `i32` or `i64` equivalent. + /// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain Wasm `i32` or `i64` equivalent. IntToWasm { input: AdapterType, output: walrus::ValType, }, - /// Pops a wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent. + /// Pops a Wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent. WasmToInt { input: walrus::ValType, output: AdapterType, }, - /// Pops a wasm `i32` and pushes the enum variant as a string + /// Pops a Wasm `i32` and pushes the enum variant as a string WasmToStringEnum { variant_values: Vec, }, @@ -170,7 +170,7 @@ pub enum Instruction { /// Pops an `externref` from the stack, allocates space in the externref table, /// returns the index it was stored at. I32FromExternrefOwned, - /// Pops an `externref` from the stack, pushes it onto the externref wasm table + /// Pops an `externref` from the stack, pushes it onto the externref Wasm table /// stack, and returns the index it was stored at. I32FromExternrefBorrow, /// Pops an `externref` from the stack, assumes it's a Rust class given, and @@ -190,7 +190,7 @@ pub enum Instruction { class: String, }, /// Pops an `externref` from the stack, pushes either 0 if it's "none" or and - /// index into the owned wasm table it was stored at if it's "some" + /// index into the owned Wasm table it was stored at if it's "some" I32FromOptionExternref { /// Set to `Some` by the externref pass of where to put it in the wasm /// module, otherwise it's shoved into the JS shim. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 26959e9e57f..919702af026 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -1,7 +1,7 @@ -//! A "wrapper binary" used to execute wasm files as tests +//! A "wrapper binary" used to execute Wasm files as tests //! -//! This binary is intended to be used as a "test runner" for wasm binaries, -//! being compatible with `cargo test` for the wasm target. It will +//! This binary is intended to be used as a "test runner" for Wasm binaries, +//! being compatible with `cargo test` for the Wasm target. It will //! automatically execute `wasm-bindgen` (or the equivalent thereof) and then //! execute either Node.js over the tests or start a server which a browser can //! be used to run against to execute tests. In a browser mode if `CI` is in the @@ -72,7 +72,7 @@ fn main() -> anyhow::Result<()> { let shell = shell::Shell::new(); // Currently no flags are supported, and assume there's only one argument - // which is the wasm file to test. This'll want to improve over time! + // which is the Wasm file to test. This'll want to improve over time! let wasm_file_to_test = match args.next() { Some(file) => PathBuf::from(file), None => bail!("must have a file to test as first argument"), @@ -112,9 +112,9 @@ fn main() -> anyhow::Result<()> { // Collect all tests that the test harness is supposed to run. We assume // that any exported function with the prefix `__wbg_test` is a test we need // to execute. - let wasm = fs::read(&wasm_file_to_test).context("failed to read wasm file")?; + let wasm = fs::read(&wasm_file_to_test).context("failed to read Wasm file")?; let mut wasm = - walrus::Module::from_buffer(&wasm).context("failed to deserialize wasm module")?; + walrus::Module::from_buffer(&wasm).context("failed to deserialize Wasm module")?; let mut tests = Vec::new(); for export in wasm.exports.iter() { @@ -230,7 +230,7 @@ fn main() -> anyhow::Result<()> { .keep_debug(false) .emit_start(false) .generate(&tmpdir) - .context("executing `wasm-bindgen` over the wasm file")?; + .context("executing `wasm-bindgen` over the Wasm file")?; shell.clear(); let args: Vec<_> = args.collect(); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 2bc9f2ae640..ba131cf5465 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -82,7 +82,7 @@ pub fn execute( ); // Note that we're collecting *JS objects* that represent the functions to - // execute, and then those objects are passed into wasm for it to execute + // execute, and then those objects are passed into Wasm for it to execute // when it sees fit. for test in tests { js_to_execute.push_str(&format!("tests.push('{}')\n", test)); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index d0eee0c81d5..f77768c3c61 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -167,8 +167,8 @@ pub(crate) fn spawn( r#" // Now that we've gotten to the point where JS is executing, update our // status text as at this point we should be asynchronously fetching the - // wasm module. - document.getElementById('output').textContent = "Loading wasm module..."; + // Wasm module. + document.getElementById('output').textContent = "Loading Wasm module..."; {} port.addEventListener("message", function(e) {{ @@ -252,8 +252,8 @@ pub(crate) fn spawn( r#" // Now that we've gotten to the point where JS is executing, update our // status text as at this point we should be asynchronously fetching the - // wasm module. - document.getElementById('output').textContent = "Loading wasm module..."; + // Wasm module. + document.getElementById('output').textContent = "Loading Wasm module..."; async function main(test) {{ const wasm = await init('./{0}_bg.wasm'); diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index ee33c8de036..6076641c138 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -6,7 +6,7 @@ use std::process; use wasm_bindgen_cli_support::{Bindgen, EncodeInto}; const USAGE: &str = " -Generating JS bindings for a wasm file +Generating JS bindings for a Wasm file Usage: wasm-bindgen [options] @@ -28,7 +28,7 @@ Options: --debug Include otherwise-extraneous debug checks in output --no-demangle Don't demangle Rust symbol names --keep-lld-exports Keep exports synthesized by LLD - --keep-debug Keep debug sections in wasm files + --keep-debug Keep debug sections in Wasm files --remove-name-section Remove the debugging `name` section of the file --remove-producers-section Remove the telemetry `producers` section --omit-default-module-path Don't add WebAssembly fallback imports in generated JavaScript diff --git a/crates/cli/src/bin/wasm2es6js.rs b/crates/cli/src/bin/wasm2es6js.rs index 249faa3a3dd..593dcfb2d11 100644 --- a/crates/cli/src/bin/wasm2es6js.rs +++ b/crates/cli/src/bin/wasm2es6js.rs @@ -5,7 +5,7 @@ use std::fs; use std::path::PathBuf; const USAGE: &str = " -Converts a wasm file to an ES6 JS module +Converts a Wasm file to an ES6 JS module Usage: wasm2es6js [options] @@ -16,7 +16,7 @@ Options: -o --output FILE File to place output in --out-dir DIR Directory to place output in --typescript Output a `*.d.ts` file next to the JS output - --base64 Inline the wasm module using base64 encoding + --base64 Inline the Wasm module using base64 encoding --fetch PATH Load module by passing the PATH argument to `fetch()` Note that this is not intended to produce a production-ready output module diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index a8a39132310..6a4c57956df 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -1,8 +1,8 @@ -//! A test suite to check the reference JS and wasm output of the `wasm-bindgen` +//! A test suite to check the reference JS and Wasm output of the `wasm-bindgen` //! library. //! //! This is intended as an end-to-end integration test where we can track -//! changes to the JS and wasm output. +//! changes to the JS and Wasm output. //! //! Tests are located in `reference/*.rs` files and are accompanied with sibling //! `*.js` files and `*.wat` files with the expected output of the `*.rs` @@ -127,7 +127,7 @@ fn assert_same(output: &str, expected: &Path) -> Result<()> { } fn sanitize_wasm(wasm: &Path) -> Result { - // Clean up the wasm module by removing all function + // Clean up the Wasm module by removing all function // implementations/instructions, data sections, etc. This'll help us largely // only deal with exports/imports which is all we're really interested in. let mut module = ModuleConfig::new() diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index df18491889a..7ddf593b2cf 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -2,7 +2,7 @@ //! module. //! //! This crate is in charge of enabling code using `wasm-bindgen` to use the -//! `externref` type inside of the wasm module. This transformation pass primarily +//! `externref` type inside of the Wasm module. This transformation pass primarily //! wraps exports and imports in shims which use `externref`, but quickly turn them //! into `i32` value types. This is all largely a stopgap until Rust has //! first-class support for the `externref` type, but that's thought to be in the @@ -11,9 +11,9 @@ //! //! The pass here works by collecting information during binding generation //! about imports and exports. Afterwards this pass runs in one go against a -//! wasm module, updating exports, imports, calls to these functions, etc. The -//! goal at least is to have valid wasm modules coming in that don't use -//! `externref` and valid wasm modules going out which use `externref` at the fringes. +//! Wasm module, updating exports, imports, calls to these functions, etc. The +//! goal at least is to have valid Wasm modules coming in that don't use +//! `externref` and valid Wasm modules going out which use `externref` at the fringes. use anyhow::{anyhow, bail, Context as _, Error}; use std::cmp; @@ -97,7 +97,7 @@ enum Intrinsic { } impl Context { - /// Executed first very early over a wasm module, used to learn about how + /// Executed first very early over a Wasm module, used to learn about how /// large the function table is so we know what indexes to hand out when /// we're appending entries. pub fn prepare(&mut self, module: &mut Module) -> Result<(), Error> { @@ -669,7 +669,7 @@ impl Transform<'_> { // // Note that we pave over all our stack slots with `ref.null` to ensure // that the table doesn't accidentally hold a strong reference to items - // no longer in use by our wasm instance. + // no longer in use by our Wasm instance. if externref_stack > 0 { body.local_get(fp) .ref_null(RefType::Externref) diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index ba54d7864a1..2c1eb3db6ee 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -204,13 +204,13 @@ impl Future for JsFuture { /// /// # Panics /// -/// Note that in wasm panics are currently translated to aborts, but "abort" in -/// this case means that a JavaScript exception is thrown. The wasm module is +/// Note that in Wasm panics are currently translated to aborts, but "abort" in +/// this case means that a JavaScript exception is thrown. The Wasm module is /// still usable (likely erroneously) after Rust panics. /// /// If the `future` provided panics then the returned `Promise` **will not /// resolve**. Instead it will be a leaked promise. This is an unfortunate -/// limitation of wasm currently that's hoped to be fixed one day! +/// limitation of Wasm currently that's hoped to be fixed one day! pub fn future_to_promise(future: F) -> Promise where F: Future> + 'static, diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 829a6246d9b..300eca2d16c 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -4406,7 +4406,7 @@ pub mod WebAssembly { /// The `WebAssembly.instantiateStreaming()` function compiles and /// instantiates a WebAssembly module directly from a streamed /// underlying source. This is the most efficient, optimized way to load - /// wasm code. + /// Wasm code. /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming) #[wasm_bindgen(js_namespace = WebAssembly, js_name = instantiateStreaming)] @@ -4414,7 +4414,7 @@ pub mod WebAssembly { /// The `WebAssembly.validate()` function validates a given typed /// array of WebAssembly binary code, returning whether the bytes - /// form a valid wasm module (`true`) or not (`false`). + /// form a valid Wasm module (`true`) or not (`false`). /// /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate) #[wasm_bindgen(js_namespace = WebAssembly, catch)] @@ -6283,7 +6283,7 @@ macro_rules! arrays { /// Rust pointer. /// /// This function will efficiently copy the memory from a typed - /// array into this wasm module's own linear memory, initializing + /// array into this Wasm module's own linear memory, initializing /// the memory destination provided. /// /// # Unsafety @@ -6302,7 +6302,7 @@ macro_rules! arrays { /// Rust slice. /// /// This function will efficiently copy the memory from a typed - /// array into this wasm module's own linear memory, initializing + /// array into this Wasm module's own linear memory, initializing /// the memory destination provided. /// /// # Panics @@ -6318,7 +6318,7 @@ macro_rules! arrays { /// JS typed array. /// /// This function will efficiently copy the memory from within - /// the wasm module's own linear memory to this typed array. + /// the Wasm module's own linear memory to this typed array. /// /// # Panics /// diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index bcc4d73932f..338c931c598 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1059,7 +1059,7 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { } let comments = extract_doc_comments(&f.attrs); // If the function isn't used for anything other than being exported to JS, - // it'll be unused when not building for the wasm target and produce a + // it'll be unused when not building for the Wasm target and produce a // `dead_code` warning. So, add `#[allow(dead_code)]` before it to avoid that. tokens.extend(quote::quote! { #[allow(dead_code)] }); f.to_tokens(tokens); diff --git a/crates/multi-value-xform/src/lib.rs b/crates/multi-value-xform/src/lib.rs index fe87d32ed46..955cb0d2bfa 100644 --- a/crates/multi-value-xform/src/lib.rs +++ b/crates/multi-value-xform/src/lib.rs @@ -74,7 +74,7 @@ //! local.get 1 //! call $pair //! -//! ;; Copy the return values from the stack to the wasm stack. +//! ;; Copy the return values from the stack to the Wasm stack. //! local.get 2 //! i32.load //! local.get 2 offset=4 diff --git a/crates/test/README.md b/crates/test/README.md index fb7cdc1844e..833d0106758 100644 --- a/crates/test/README.md +++ b/crates/test/README.md @@ -34,7 +34,7 @@ provides the support for: * Catching JS exceptions so tests can continue to run after a test fails * Driving execution of all tests -This is the crate which you actually link to in your wasm test and through which +This is the crate which you actually link to in your Wasm test and through which you import the `#[wasm_bindgen_test]` macro. Otherwise this crate provides a `console_log!` macro that's a utility like `println!` only using `console.log`. @@ -46,7 +46,7 @@ bare bones! This is where the secret sauce comes into play. We configured Cargo to execute this binary *instead* of directly executing the `*.wasm` file (which Cargo would otherwise try to do). This means that whenever a test is executed it executes -this binary with the wasm file as an argument, allowing it to take full control +this binary with the Wasm file as an argument, allowing it to take full control over the test process! The test runner is currently pretty simple, executing a few steps: @@ -59,8 +59,8 @@ The test runner is currently pretty simple, executing a few steps: tests. In essence what happens is that this test runner automatically executes -`wasm-bindgen` and then uses Node to actually execute the wasm file, meaning -that your wasm code currently runs in a Node environment. +`wasm-bindgen` and then uses Node to actually execute the Wasm file, meaning +that your Wasm code currently runs in a Node environment. ## Future Work @@ -68,5 +68,5 @@ Things that'd be awesome to support in the future: * Arguments to `wasm-bindgen-test-runner` which are the same as `wasm-bindgen`, for example `--debug` to affect the generated output. -* Running each test in its own wasm instance to avoid poisoning the environment +* Running each test in its own Wasm instance to avoid poisoning the environment on panic diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 838156155b3..a4343787149 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -6,8 +6,8 @@ // # Architecture of `wasm_bindgen_test` // // This module can seem a bit funky, but it's intended to be the runtime support -// of the `#[wasm_bindgen_test]` macro and be amenable to executing wasm test -// suites. The general idea is that for a wasm test binary there will be a set +// of the `#[wasm_bindgen_test]` macro and be amenable to executing Wasm test +// suites. The general idea is that for a Wasm test binary there will be a set // of functions tagged `#[wasm_bindgen_test]`. It's the job of the runtime // support to execute all of these functions, collecting and collating the // results. @@ -22,11 +22,11 @@ // // * First, the user runs `cargo test --target wasm32-unknown-unknown` // -// * Cargo then compiles all the test suites (aka `tests/*.rs`) as wasm binaries +// * Cargo then compiles all the test suites (aka `tests/*.rs`) as Wasm binaries // (the `bin` crate type). These binaries all have entry points that are // `main` functions, but it's actually not used. The binaries are also // compiled with `--test`, which means they're linked to the standard `test` -// crate, but this crate doesn't work on wasm and so we bypass it entirely. +// crate, but this crate doesn't work on Wasm and so we bypass it entirely. // // * Instead of using `#[test]`, which doesn't work, users wrote tests with // `#[wasm_bindgen_test]`. This macro expands to a bunch of `#[no_mangle]` @@ -44,7 +44,7 @@ // // * The `wasm-bindgen-test-runner` binary generates a JS entry point. This // entry point creates a `Context` below. The runner binary also parses the -// wasm file and finds all functions that are named `__wbg_test_*`. The +// Wasm file and finds all functions that are named `__wbg_test_*`. The // generate file gathers up all these functions into an array and then passes // them to `Context` below. Note that these functions are passed as *JS // values*. @@ -61,7 +61,7 @@ // This is used for test filters today. // // * The `Context::run` function is called. Again, the generated JS has gathered -// all wasm tests to be executed into a list, and it's passed in here. +// all Wasm tests to be executed into a list, and it's passed in here. // // * Next, `Context::run` returns a `Promise` representing the eventual // execution of all the tests. The Rust `Future` that's returned will work @@ -351,7 +351,7 @@ impl Context { .writeln(&format!("running {} {}", tests.len(), noun)); self.state.formatter.writeln(""); - // Execute all our test functions through their wasm shims (unclear how + // Execute all our test functions through their Wasm shims (unclear how // to pass native function pointers around here). Each test will // execute one of the `execute_*` tests below which will push a // future onto our `remaining` list, which we'll process later. @@ -726,7 +726,7 @@ impl State { /// variable to capture output for the current test. That way at least when /// we've got Rust code running we'll be able to capture output. /// -/// * Next, this "catches panics". Right now all wasm code is configured as +/// * Next, this "catches panics". Right now all Wasm code is configured as /// panic=abort, but it's more like an exception in JS. It's pretty sketchy /// to actually continue executing Rust code after an "abort", but we don't /// have much of a choice for now. diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index 1dd4d70c151..f60a85c14d7 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -55,9 +55,9 @@ impl Config { } } - /// Specify the maximum amount of memory the wasm module can ever have. + /// Specify the maximum amount of memory the Wasm module can ever have. /// - /// We'll be specifying that the memory for this wasm module is shared, and + /// We'll be specifying that the memory for this Wasm module is shared, and /// all shared memories must have their maximum limit specified (whereas /// by default Rust/LLVM/LLD don't specify a maximum). /// @@ -87,7 +87,7 @@ impl Config { self } - /// Execute the transformation on the parsed wasm module specified. + /// Execute the transformation on the parsed Wasm module specified. /// /// This function will prepare `Module` to be run on multiple threads, /// performing steps such as: diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 61357c1b12c..23729a17e14 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -1,8 +1,8 @@ -//! A tiny and incomplete wasm interpreter +//! A tiny and incomplete Wasm interpreter //! -//! This module contains a tiny and incomplete wasm interpreter built on top of +//! This module contains a tiny and incomplete Wasm interpreter built on top of //! `walrus`'s module structure. Each `Interpreter` contains some state -//! about the execution of a wasm instance. The "incomplete" part here is +//! about the execution of a Wasm instance. The "incomplete" part here is //! related to the fact that this is *only* used to execute the various //! descriptor functions for wasm-bindgen. //! @@ -23,11 +23,11 @@ use std::collections::{BTreeMap, BTreeSet, HashMap}; use walrus::ir::Instr; use walrus::{ElementId, FunctionId, LocalId, Module, TableId}; -/// A ready-to-go interpreter of a wasm module. +/// A ready-to-go interpreter of a Wasm module. /// /// An interpreter currently represents effectively cached state. It is reused /// between calls to `interpret` and is precomputed from a `Module`. It houses -/// state like the wasm stack, wasm memory, etc. +/// state like the Wasm stack, Wasm memory, etc. #[derive(Default)] pub struct Interpreter { // Function index of the `__wbindgen_describe` and @@ -43,7 +43,7 @@ pub struct Interpreter { // functions. name_map: HashMap, - // The current stack pointer (global 0) and wasm memory (the stack). Only + // The current stack pointer (global 0) and Wasm memory (the stack). Only // used in a limited capacity. sp: i32, mem: Vec, @@ -70,7 +70,7 @@ impl Interpreter { let mut ret = Interpreter::default(); // Give ourselves some memory and set the stack pointer - // (the LLVM call stack, now the wasm stack, global 0) to the top. + // (the LLVM call stack, now the Wasm stack, global 0) to the top. ret.mem = vec![0; 0x8000]; ret.sp = ret.mem.len() as i32; @@ -130,7 +130,7 @@ impl Interpreter { pub fn interpret_descriptor(&mut self, id: FunctionId, module: &Module) -> Option<&[u32]> { self.descriptor.truncate(0); - // We should have a blank wasm and LLVM stack at both the start and end + // We should have a blank Wasm and LLVM stack at both the start and end // of the call. assert_eq!(self.sp, self.mem.len() as i32); self.call(id, module, &[]); diff --git a/examples/add/README.md b/examples/add/README.md index dea1f47b08e..17f7d9fa3f0 100644 --- a/examples/add/README.md +++ b/examples/add/README.md @@ -1,4 +1,4 @@ -# Adding numbers (small wasm files) +# Adding numbers (small Wasm files) [View documentation for this example online][dox] or [View compiled example online][compiled] diff --git a/examples/console_log/src/lib.rs b/examples/console_log/src/lib.rs index f0e5a4954e2..39bddc57c7a 100644 --- a/examples/console_log/src/lib.rs +++ b/examples/console_log/src/lib.rs @@ -37,7 +37,7 @@ fn bare_bones() { } // Next let's define a macro that's like `println!`, only it works for -// `console.log`. Note that `println!` doesn't actually work on the wasm target +// `console.log`. Note that `println!` doesn't actually work on the Wasm target // because the standard library currently just eats all output. To get // `println!`-like behavior in your app you'll likely want a macro like this. diff --git a/examples/deno/README.md b/examples/deno/README.md index 9378700f4f0..2d98e0d01f2 100644 --- a/examples/deno/README.md +++ b/examples/deno/README.md @@ -12,5 +12,5 @@ and test it with $ deno run --allow-read test.ts ``` -The `--allow-read` flag is needed because the wasm file is read during runtime. +The `--allow-read` flag is needed because the Wasm file is read during runtime. This will be fixed when https://github.com/denoland/deno/issues/2552 is resolved. diff --git a/examples/raytrace-parallel/build.py b/examples/raytrace-parallel/build.py index 0e14f490711..c0fc29f8867 100755 --- a/examples/raytrace-parallel/build.py +++ b/examples/raytrace-parallel/build.py @@ -31,7 +31,7 @@ ).check_returncode() # Note the usage of `--target no-modules` here which is required for passing -# the memory import to each wasm module. +# the memory import to each Wasm module. subprocess.run( [ "cargo", diff --git a/examples/raytrace-parallel/index.js b/examples/raytrace-parallel/index.js index 4ef286715a9..49529492c35 100644 --- a/examples/raytrace-parallel/index.js +++ b/examples/raytrace-parallel/index.js @@ -22,7 +22,7 @@ function loadWasm() { const buf = new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x00, 0x01, 0x0b, 0x03, 0x01, 0x01, 0x00]); if (!WebAssembly.validate(buf)) { - alert('this browser does not support passive wasm memory, demo does not work' + '\n\n' + msg); + alert('this browser does not support passive Wasm memory, demo does not work' + '\n\n' + msg); return } diff --git a/examples/raytrace-parallel/src/lib.rs b/examples/raytrace-parallel/src/lib.rs index a08f8aad6b7..91db0906c57 100644 --- a/examples/raytrace-parallel/src/lib.rs +++ b/examples/raytrace-parallel/src/lib.rs @@ -149,7 +149,7 @@ fn image_data(base: usize, len: usize, width: u32, height: u32) -> ImageData { // // FIXME: that this may or may not be UB based on Rust's rules. For example // threads may be doing unsynchronized writes to pixel data as we read it - // off here. In the context of wasm this may or may not be UB, we're + // off here. In the context of Wasm this may or may not be UB, we're // unclear! In any case for now it seems to work and produces a nifty // progressive rendering. A more production-ready application may prefer to // instead use some form of signaling here to request an update from the diff --git a/examples/raytrace-parallel/src/pool.rs b/examples/raytrace-parallel/src/pool.rs index 7c7118d771c..6a0470d392b 100644 --- a/examples/raytrace-parallel/src/pool.rs +++ b/examples/raytrace-parallel/src/pool.rs @@ -59,7 +59,7 @@ impl WorkerPool { /// Unconditionally spawns a new worker /// /// The worker isn't registered with this `WorkerPool` but is capable of - /// executing work for this wasm module. + /// executing work for this Wasm module. /// /// # Errors /// @@ -76,8 +76,8 @@ impl WorkerPool { let worker = Worker::new("./worker.js")?; // With a worker spun up send it the module/memory so it can start - // instantiating the wasm module. Later it might receive further - // messages about code to run on the wasm module. + // instantiating the Wasm module. Later it might receive further + // messages about code to run on the Wasm module. let array = js_sys::Array::new(); array.push(&wasm_bindgen::module()); array.push(&wasm_bindgen::memory()); diff --git a/examples/request-animation-frame/src/lib.rs b/examples/request-animation-frame/src/lib.rs index 7cf0dc81979..defd417bb3b 100644 --- a/examples/request-animation-frame/src/lib.rs +++ b/examples/request-animation-frame/src/lib.rs @@ -22,7 +22,7 @@ fn body() -> web_sys::HtmlElement { document().body().expect("document should have a body") } -// This function is automatically invoked after the wasm module is instantiated. +// This function is automatically invoked after the Wasm module is instantiated. #[wasm_bindgen(start)] fn run() -> Result<(), JsValue> { // Here we want to call `requestAnimationFrame` in a loop, but only a fixed diff --git a/examples/wasm-audio-worklet/build.py b/examples/wasm-audio-worklet/build.py index e2e53d16596..37a93c20db6 100644 --- a/examples/wasm-audio-worklet/build.py +++ b/examples/wasm-audio-worklet/build.py @@ -31,7 +31,7 @@ ).check_returncode() # Note the usage of `--target no-modules` here which is required for passing -# the memory import to each wasm module. +# the memory import to each Wasm module. subprocess.run( [ "cargo", diff --git a/examples/wasm-audio-worklet/src/wasm_audio.rs b/examples/wasm-audio-worklet/src/wasm_audio.rs index 5b0534d99b2..55724c96ef2 100644 --- a/examples/wasm-audio-worklet/src/wasm_audio.rs +++ b/examples/wasm-audio-worklet/src/wasm_audio.rs @@ -20,7 +20,7 @@ impl WasmAudioProcessor { } } -// Use wasm_audio if you have a single wasm audio processor in your application +// Use wasm_audio if you have a single Wasm audio processor in your application // whose samples should be played directly. Ideally, call wasm_audio based on // user interaction. Otherwise, resume the context on user interaction, so // playback starts reliably on all browsers. @@ -34,7 +34,7 @@ pub async fn wasm_audio( Ok(ctx) } -// wasm_audio_node creates an AudioWorkletNode running a wasm audio processor. +// wasm_audio_node creates an AudioWorkletNode running a Wasm audio processor. // Remember to call prepare_wasm_audio once on your context before calling // this function. pub fn wasm_audio_node( diff --git a/examples/wasm-in-wasm-imports/src/lib.rs b/examples/wasm-in-wasm-imports/src/lib.rs index ed122627bdd..9c03400815a 100644 --- a/examples/wasm-in-wasm-imports/src/lib.rs +++ b/examples/wasm-in-wasm-imports/src/lib.rs @@ -23,7 +23,7 @@ macro_rules! console_error { const WASM: &[u8] = include_bytes!("native_add.wasm"); async fn run_async() -> Result<(), JsValue> { - console_log!("instantiating a new wasm module directly"); + console_log!("instantiating a new Wasm module directly"); let imports = make_imports()?; let a = JsFuture::from(WebAssembly::instantiate_buffer(WASM, &imports)).await?; diff --git a/examples/wasm-in-wasm/src/lib.rs b/examples/wasm-in-wasm/src/lib.rs index 6f91b07b683..94c097c520d 100644 --- a/examples/wasm-in-wasm/src/lib.rs +++ b/examples/wasm-in-wasm/src/lib.rs @@ -16,7 +16,7 @@ macro_rules! console_log { const WASM: &[u8] = include_bytes!("add.wasm"); async fn run_async() -> Result<(), JsValue> { - console_log!("instantiating a new wasm module directly"); + console_log!("instantiating a new Wasm module directly"); let a = JsFuture::from(WebAssembly::instantiate_buffer(WASM, &Object::new())).await?; let b: WebAssembly::Instance = Reflect::get(&a, &"instance".into())?.dyn_into()?; diff --git a/examples/wasm-in-web-worker/index.js b/examples/wasm-in-web-worker/index.js index 21c76f79941..05d2209d8e5 100644 --- a/examples/wasm-in-web-worker/index.js +++ b/examples/wasm-in-web-worker/index.js @@ -4,7 +4,7 @@ const {startup} = wasm_bindgen; async function run_wasm() { - // Load the wasm file by awaiting the Promise returned by `wasm_bindgen` + // Load the Wasm file by awaiting the Promise returned by `wasm_bindgen` // `wasm_bindgen` was imported in `index.html` await wasm_bindgen(); diff --git a/examples/wasm-in-web-worker/worker.js b/examples/wasm-in-web-worker/worker.js index 3131110b447..99f4d30817b 100644 --- a/examples/wasm-in-web-worker/worker.js +++ b/examples/wasm-in-web-worker/worker.js @@ -10,7 +10,7 @@ console.log('Initializing worker') const {NumberEval} = wasm_bindgen; async function init_wasm_in_worker() { - // Load the wasm file by awaiting the Promise returned by `wasm_bindgen`. + // Load the Wasm file by awaiting the Promise returned by `wasm_bindgen`. await wasm_bindgen('./pkg/wasm_in_web_worker_bg.wasm'); // Create a new object of the `NumberEval` struct. diff --git a/examples/wasm2js/build.sh b/examples/wasm2js/build.sh index 4c77c30acb4..9ac5332f1a0 100755 --- a/examples/wasm2js/build.sh +++ b/examples/wasm2js/build.sh @@ -2,7 +2,7 @@ set -ex -# Compile our wasm module and run `wasm-bindgen` +# Compile our Wasm module and run `wasm-bindgen` wasm-pack build # Run the `wasm2js` tool from `binaryen` diff --git a/examples/without-a-bundler-no-modules/src/lib.rs b/examples/without-a-bundler-no-modules/src/lib.rs index 3f365b50825..c927ac0700c 100644 --- a/examples/without-a-bundler-no-modules/src/lib.rs +++ b/examples/without-a-bundler-no-modules/src/lib.rs @@ -1,6 +1,6 @@ use wasm_bindgen::prelude::*; -// Called when the wasm module is instantiated +// Called when the Wasm module is instantiated #[wasm_bindgen(start)] fn main() -> Result<(), JsValue> { // Use `web_sys`'s global `window` function to get a handle on the global diff --git a/examples/without-a-bundler/index.html b/examples/without-a-bundler/index.html index 7296030f5c5..4e1655cc871 100644 --- a/examples/without-a-bundler/index.html +++ b/examples/without-a-bundler/index.html @@ -15,14 +15,14 @@ import init, { add } from './pkg/without_a_bundler.js'; async function run() { - // First up we need to actually load the wasm file, so we use the - // default export to inform it where the wasm file is located on the + // First up we need to actually load the Wasm file, so we use the + // default export to inform it where the Wasm file is located on the // server, and then we wait on the returned promise to wait for the - // wasm to be loaded. + // Wasm to be loaded. // // It may look like this: `await init('./pkg/without_a_bundler_bg.wasm');`, // but there is also a handy default inside `init` function, which uses - // `import.meta` to locate the wasm file relatively to js file. + // `import.meta` to locate the Wasm file relatively to js file. // // Note that instead of a string you can also pass in any of the // following things: @@ -38,7 +38,7 @@ // This gives you complete control over how the module is loaded // and compiled. // - // Also note that the promise, when resolved, yields the wasm module's + // Also note that the promise, when resolved, yields the Wasm module's // exports which is the same as importing the `*_bg` module in other // modes await init(); diff --git a/examples/without-a-bundler/src/lib.rs b/examples/without-a-bundler/src/lib.rs index 3f365b50825..c927ac0700c 100644 --- a/examples/without-a-bundler/src/lib.rs +++ b/examples/without-a-bundler/src/lib.rs @@ -1,6 +1,6 @@ use wasm_bindgen::prelude::*; -// Called when the wasm module is instantiated +// Called when the Wasm module is instantiated #[wasm_bindgen(start)] fn main() -> Result<(), JsValue> { // Use `web_sys`'s global `window` function to get a handle on the global diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index d11123ee764..9ef51ede23a 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -7,7 +7,7 @@ - [Examples](./examples/index.md) - [Hello, World!](./examples/hello-world.md) - [Using `console.log`](./examples/console-log.md) - - [Small wasm files](./examples/add.md) + - [Small Wasm files](./examples/add.md) - [Without a Bundler](./examples/without-a-bundler.md) - [Synchronous Instantiation](./examples/synchronous-instantiation.md) - [Converting WebAssembly to JS](./examples/wasm2js.md) diff --git a/guide/src/contributing/design/describe.md b/guide/src/contributing/design/describe.md index d8684b2f8bc..5cf3a47b47d 100644 --- a/guide/src/contributing/design/describe.md +++ b/guide/src/contributing/design/describe.md @@ -8,7 +8,7 @@ reads. To accomplish this a slightly unconventional approach is taken. Static information about the structure of the Rust code is serialized via JSON -(currently) to a custom section of the wasm executable. Other information, like +(currently) to a custom section of the Wasm executable. Other information, like what the types actually are, unfortunately isn't known until later in the compiler due to things like associated type projections and typedefs. It also turns out that we want to convey "rich" types like `FnMut(String, Foo, @@ -54,4 +54,4 @@ which fully describes a type. All in all this is a bit roundabout but shouldn't have any impact on the generated code or runtime at all. All these descriptor functions are pruned from -the emitted wasm file. +the emitted Wasm file. diff --git a/guide/src/contributing/design/exporting-rust.md b/guide/src/contributing/design/exporting-rust.md index 58491b34d4a..73149662f1a 100644 --- a/guide/src/contributing/design/exporting-rust.md +++ b/guide/src/contributing/design/exporting-rust.md @@ -5,8 +5,8 @@ let's take a look at another feature of `wasm-bindgen`: exporting functionality with types that are richer than just numbers. The basic idea around exporting functionality with more flavorful types is that -the wasm exports won't actually be called directly. Instead the generated -`foo.js` module will have shims for all exported functions in the wasm module. +the Wasm exports won't actually be called directly. Instead the generated +`foo.js` module will have shims for all exported functions in the Wasm module. The most interesting conversion here happens with strings so let's take a look at that. @@ -64,14 +64,14 @@ export function greet(arg0) { Phew, that's quite a lot! We can sort of see though if we look closely what's happening: -* Strings are passed to wasm via two arguments, a pointer and a length. Right - now we have to copy the string onto the wasm heap which means we'll be using +* Strings are passed to Wasm via two arguments, a pointer and a length. Right + now we have to copy the string onto the Wasm heap which means we'll be using `TextEncoder` to actually do the encoding. Once this is done we use an internal function in `wasm-bindgen` to allocate space for the string to go, - and then we'll pass that ptr/length to wasm later on. + and then we'll pass that ptr/length to Wasm later on. -* Returning strings from wasm is a little tricky as we need to return a ptr/len - pair, but wasm currently only supports one return value (multiple return values +* Returning strings from Wasm is a little tricky as we need to return a ptr/len + pair, but Wasm currently only supports one return value (multiple return values [is being standardized](https://github.com/WebAssembly/design/issues/1146)). To work around this in the meantime, we're actually returning a pointer to a ptr/len pair, and then using functions to access the various fields. @@ -111,7 +111,7 @@ string slice, while the return value is boxed up into just a pointer and is then returned up to was for reading via the `__wbindgen_boxed_str_*` functions. So in general exporting a function involves a shim both in JS and in Rust with -each side translating to or from wasm arguments to the native types of each +each side translating to or from Wasm arguments to the native types of each language. The `wasm-bindgen` tool manages hooking up all these shims while the `#[wasm_bindgen]` macro takes care of the Rust shim as well. diff --git a/guide/src/contributing/design/index.md b/guide/src/contributing/design/index.md index 5f353495db7..4f5398279af 100644 --- a/guide/src/contributing/design/index.md +++ b/guide/src/contributing/design/index.md @@ -9,18 +9,18 @@ answer questions and/or update this! The first thing to know about `wasm-bindgen` is that it's fundamentally built on the idea of ES Modules. In other words this tool takes an opinionated stance -that wasm files *should be viewed as ES modules*. This means that you can -`import` from a wasm file, use its `export`-ed functionality, etc, from normal +that Wasm files *should be viewed as ES modules*. This means that you can +`import` from a Wasm file, use its `export`-ed functionality, etc, from normal JS files. -Now unfortunately at the time of this writing the interface of wasm interop +Now unfortunately at the time of this writing the interface of Wasm interop isn't very rich. Wasm modules can only call functions or export functions that deal exclusively with `i32`, `i64`, `f32`, and `f64`. Bummer! That's where this project comes in. The goal of `wasm-bindgen` is to enhance the -"ABI" of wasm modules with richer types like classes, JS objects, Rust structs, +"ABI" of Wasm modules with richer types like classes, JS objects, Rust structs, strings, etc. Keep in mind, though, that everything is based on ES Modules! This -means that the compiler is actually producing a "broken" wasm file of sorts. The +means that the compiler is actually producing a "broken" Wasm file of sorts. The wasm file emitted by rustc, for example, does not have the interface we would like to have. Instead it requires the `wasm-bindgen` tool to postprocess the file, generating a `foo.js` and `foo_bg.wasm` file. The `foo.js` file is the diff --git a/guide/src/contributing/design/js-objects-in-rust.md b/guide/src/contributing/design/js-objects-in-rust.md index 4cc28092324..6e0afcc6a57 100644 --- a/guide/src/contributing/design/js-objects-in-rust.md +++ b/guide/src/contributing/design/js-objects-in-rust.md @@ -4,7 +4,7 @@ One of the main goals of `wasm-bindgen` is to allow working with and passing around JS objects in wasm, but that's not allowed today! While indeed true, that's where the polyfill comes in. -The question here is how we shoehorn JS objects into a `u32` for wasm to use. +The question here is how we shoehorn JS objects into a `u32` for Wasm to use. The current strategy for this approach is to maintain a module-local variable in the generated `foo.js` file: a `heap`. @@ -18,7 +18,7 @@ pushed. JS objects are then only removed from the bottom of the stack as well. Removal is simply storing null then incrementing a counter. Because of the "stack-y" -nature of this scheme it only works for when wasm doesn't hold onto a JS object +nature of this scheme it only works for when Wasm doesn't hold onto a JS object (aka it only gets a "reference" in Rust parlance). Let's take a look at an example. @@ -72,13 +72,13 @@ export function foo(arg0) { Here we can see a few notable points of action: -* The wasm file was renamed to `foo_bg.wasm`, and we can see how the JS module - generated here is importing from the wasm file. +* The Wasm file was renamed to `foo_bg.wasm`, and we can see how the JS module + generated here is importing from the Wasm file. * Next we can see our `heap` module variable which is to store all JS values reference-able from wasm. * Our exported function `foo`, takes an arbitrary argument, `arg0`, which is converted to an index with the `addBorrowedObject` object function. The index - is then passed to wasm so wasm can operate with it. + is then passed to Wasm so Wasm can operate with it. * Finally, we have a `finally` which frees the stack slot as it's no longer used, popping the value that was pushed at the start of the function. @@ -105,7 +105,7 @@ And as with the JS, the notable points here are: * The original function, `foo`, is unmodified in the output * A generated function here (with a unique name) is the one that's actually - exported from the wasm module + exported from the Wasm module * Our generated function takes an integer argument (our index) and then wraps it in a `JsValue`. There's some trickery here that's not worth going into just yet, but we'll see in a bit what's happening under the hood. @@ -118,8 +118,8 @@ dynamic lifetime or otherwise need to be stored on Rust's heap. To cope with this there's a second half of management of JS objects, naturally corresponding to the other side of the JS `heap` array. -JS Objects passed to wasm that are not references are assumed to have a dynamic -lifetime inside of the wasm module. As a result the strict push/pop of the stack +JS Objects passed to Wasm that are not references are assumed to have a dynamic +lifetime inside of the Wasm module. As a result the strict push/pop of the stack won't work and we need more permanent storage for the JS objects. To cope with this we build our own "slab allocator" of sorts. @@ -140,7 +140,7 @@ module interface is the same as before, but the ownership mechanics are slightly different. Let's see the generated JS's slab in action: ```js -import * as wasm from './foo_bg'; // imports from wasm file +import * as wasm from './foo_bg'; // imports from Wasm file const heap = new Array(32); heap.push(undefined, null, true, false); diff --git a/guide/src/examples/add.md b/guide/src/examples/add.md index 1d3fadd50fb..3c844e85d25 100644 --- a/guide/src/examples/add.md +++ b/guide/src/examples/add.md @@ -1,4 +1,4 @@ -# Small wasm files +# Small Wasm files [View full source code][code] or [view the compiled example online][online] @@ -15,7 +15,7 @@ Currently this code... {{#include ../../../examples/add/src/lib.rs}} ``` -generates a 710 byte wasm binary: +generates a 710 byte Wasm binary: ``` $ ls -l add_bg.wasm diff --git a/guide/src/examples/raytrace.md b/guide/src/examples/raytrace.md index 522a2f70b96..2e012190d16 100644 --- a/guide/src/examples/raytrace.md +++ b/guide/src/examples/raytrace.md @@ -9,7 +9,7 @@ This is an example of using threads with WebAssembly, Rust, and `wasm-bindgen`, culminating in a parallel raytracer demo. There's a number of moving pieces to this demo and it's unfortunately not the easiest thing to wrangle, but it's hoped that this'll give you a bit of a taste of what it's like to use threads -and wasm with Rust on the web. +and Wasm with Rust on the web. ### Building the demo @@ -68,7 +68,7 @@ post its memory object to all other threads to get instantiated with. ### Caveats -Unfortunately at this time running wasm on the web with threads has a number of +Unfortunately at this time running Wasm on the web with threads has a number of caveats, although some are specific to just `wasm-bindgen`. These are some pieces to consider and watch out for, although we're always looking for improvements to be made so if you have an idea please file an issue! @@ -76,7 +76,7 @@ improvements to be made so if you have an idea please file an issue! * The main thread in a browser cannot block. This means that if you run WebAssembly code on the main thread you can *never* block, meaning you can't do so much as acquire a mutex. This is an extremely difficult limitation to - work with on the web, although one workaround is to run wasm exclusively in + work with on the web, although one workaround is to run Wasm exclusively in web workers and run JS on the main thread. It is possible to run the same wasm across all threads, but you need to be extremely vigilant about synchronization with the main thread. @@ -85,19 +85,19 @@ improvements to be made so if you have an idea please file an issue! today. For example `--target bundler` is unsupported and very specific shims are required on both the main thread and worker threads. These are possible to work with but are somewhat brittle since there's no standard way to spin up - web workers as wasm threads. + web workers as Wasm threads. * There is no standard notion of a "thread". For example the standard library has no viable route to implement the `std::thread` module. As a consequence there is no concept of thread exit and TLS destructors will never run. We do expose a helper, `__wbindgen_thread_destroy`, that deallocates the thread stack and TLS. If you invoke it, it *must* be the last function - you invoke from the wasm module for a given thread. + you invoke from the Wasm module for a given thread. * Any thread launched after the first one _might attempt to block_ implicitly in its initialization routine. This is a constraint introduced by the way we set up the space for thread stacks and TLS. This means that if you attempt - to run a wasm module in the main thread _after_ you are already running it + to run a Wasm module in the main thread _after_ you are already running it in a worker, it might fail. * Web Workers executing WebAssembly code cannot receive events from JS. A Web diff --git a/guide/src/examples/web-audio.md b/guide/src/examples/web-audio.md index ed41f7a0403..8785fdb800b 100644 --- a/guide/src/examples/web-audio.md +++ b/guide/src/examples/web-audio.md @@ -31,7 +31,7 @@ The Rust code implements the FM oscillator. ## `index.js` A small bit of JavaScript glues the rust module to input widgets and translates -events into calls into wasm code. +events into calls into Wasm code. ```js {{#include ../../../examples/webaudio/index.js}} diff --git a/guide/src/introduction.md b/guide/src/introduction.md index a2f1592b92b..c9ffdc15bf9 100644 --- a/guide/src/introduction.md +++ b/guide/src/introduction.md @@ -1,7 +1,7 @@ # Introduction This book is about `wasm-bindgen`, a Rust library and CLI tool that facilitate -high-level interactions between wasm modules and JavaScript. The `wasm-bindgen` +high-level interactions between Wasm modules and JavaScript. The `wasm-bindgen` tool and crate are only one part of the [Rust and WebAssembly ecosystem][rustwasm]. If you're not familiar already with `wasm-bindgen` it's recommended to start by reading the [Game of Life tutorial][gol]. If you're diff --git a/guide/src/reference/attributes/on-js-imports/catch.md b/guide/src/reference/attributes/on-js-imports/catch.md index 07c15d2646d..7ec9e6dcc56 100644 --- a/guide/src/reference/attributes/on-js-imports/catch.md +++ b/guide/src/reference/attributes/on-js-imports/catch.md @@ -22,8 +22,8 @@ If calling the imported function throws an exception, then `Err` will be returned with the exception that was raised. Otherwise, `Ok` is returned with the result of the function. -> By default `wasm-bindgen` will take no action when wasm calls a JS function -> which ends up throwing an exception. The wasm spec right now doesn't support +> By default `wasm-bindgen` will take no action when Wasm calls a JS function +> which ends up throwing an exception. The Wasm spec right now doesn't support > stack unwinding and as a result Rust code **will not execute destructors**. > This can unfortunately cause memory leaks in Rust right now, but as soon as -> wasm implements catching exceptions we'll be sure to add support as well! +> Wasm implements catching exceptions we'll be sure to add support as well! diff --git a/guide/src/reference/attributes/on-js-imports/final.md b/guide/src/reference/attributes/on-js-imports/final.md index a3e65b04c67..e912a50fad3 100644 --- a/guide/src/reference/attributes/on-js-imports/final.md +++ b/guide/src/reference/attributes/on-js-imports/final.md @@ -140,10 +140,10 @@ export const __wbg_bar_a81456386e6b526f = Foo.prototype.bar; and voila! We, with [reference types][reference-types] and [component model][component-model], now have no JS function shim at all necessary to call -the imported function. Additionally future wasm proposals to the ES module +the imported function. Additionally future Wasm proposals to the ES module system may also mean that don't even need the `export const ...` here too. -It's also worth pointing out that with all these wasm proposals implemented the +It's also worth pointing out that with all these Wasm proposals implemented the default way to import the `bar` function (aka `structural`) would generate a JS function shim that looks like: diff --git a/guide/src/reference/attributes/on-js-imports/raw_module.md b/guide/src/reference/attributes/on-js-imports/raw_module.md index 1f8da2f3dfb..0a1f82f9572 100644 --- a/guide/src/reference/attributes/on-js-imports/raw_module.md +++ b/guide/src/reference/attributes/on-js-imports/raw_module.md @@ -14,6 +14,6 @@ extern "C" { Note that if you use this attribute with a relative or absolute path, it's likely up to the final bundler or project to assign meaning to that path. This typically means that the JS file or module will be resolved relative to the -final location of the wasm file itself. That means that `raw_module` is likely +final location of the Wasm file itself. That means that `raw_module` is likely unsuitable for libraries on crates.io, but may be usable within end-user applications. diff --git a/guide/src/reference/attributes/on-js-imports/variadic.md b/guide/src/reference/attributes/on-js-imports/variadic.md index 31cec10a12d..af6c56994e9 100644 --- a/guide/src/reference/attributes/on-js-imports/variadic.md +++ b/guide/src/reference/attributes/on-js-imports/variadic.md @@ -23,7 +23,7 @@ function sum(...rest) { ``` This function doesn't translate directly into rust, since we don't currently support variadic -arguments on the wasm target. To bind to it, we use a slice as the last argument, and annotate the +arguments on the Wasm target. To bind to it, we use a slice as the last argument, and annotate the function as variadic: ```rust diff --git a/guide/src/reference/attributes/on-rust-exports/start.md b/guide/src/reference/attributes/on-rust-exports/start.md index b3b583cb5f2..1d05196bc61 100644 --- a/guide/src/reference/attributes/on-rust-exports/start.md +++ b/guide/src/reference/attributes/on-rust-exports/start.md @@ -1,8 +1,8 @@ # `start` When attached to a function this attribute will configure the `start` -section of the wasm executable to be emitted, executing the tagged function as -soon as the wasm module is instantiated. +section of the Wasm executable to be emitted, executing the tagged function as +soon as the Wasm module is instantiated. ```rust #[wasm_bindgen(start)] @@ -11,7 +11,7 @@ fn start() { } ``` -The `start` section of the wasm executable will be configured to execute the +The `start` section of the Wasm executable will be configured to execute the `start` function here as soon as it can. Note that due to various practical limitations today the start section of the executable may not literally point to `start`, but the `start` function here should be started up automatically when the diff --git a/guide/src/reference/browser-support.md b/guide/src/reference/browser-support.md index f2a05cad3f9..aa43c644ade 100644 --- a/guide/src/reference/browser-support.md +++ b/guide/src/reference/browser-support.md @@ -15,7 +15,7 @@ also like to be aware of it! * **IE 11** - `wasm-bindgen` by default requires support for `WebAssembly`, but no version of IE currently supports `WebAssembly`. You can - support IE by [compiling wasm files to JS using `wasm2js`][w2js] (you can [see + support IE by [compiling Wasm files to JS using `wasm2js`][w2js] (you can [see an example of doing this too](../examples/wasm2js.html)). Note that at this time no bundler will do this by default, but we'd love to document plugins which do this if you are aware of one! diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index f7377ae7abf..ad300bdca5e 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -60,7 +60,7 @@ where the imports are instead handled through a separate preload script. ### `--debug` -Generates a bit more JS and wasm in "debug mode" to help catch programmer +Generates a bit more JS and Wasm in "debug mode" to help catch programmer errors, but this output isn't intended to be shipped to production. ### `--no-demangle` diff --git a/guide/src/reference/deployment.md b/guide/src/reference/deployment.md index aa66e8d6f65..fd6f5f23390 100644 --- a/guide/src/reference/deployment.md +++ b/guide/src/reference/deployment.md @@ -28,13 +28,13 @@ The methods of deployment and integration here are primarily tied to the **`--target bundler`** The default output of `wasm-bindgen`, or the `bundler` target, assumes a model -where the wasm module itself is natively an ES module. This model, however, is not +where the Wasm module itself is natively an ES module. This model, however, is not natively implemented in any JS implementation at this time. As a result, to consume the default output of `wasm-bindgen` you will need a bundler of some form. > **Note**: the choice of this default output was done to reflect the trends of -> the JS ecosystem. While tools other than bundlers don't support wasm files as +> the JS ecosystem. While tools other than bundlers don't support Wasm files as > native ES modules today they're all very much likely to in the future! Currently the only known bundler known to be fully compatible with @@ -82,7 +82,7 @@ native module), then you'll want to pass the `--target nodejs` flag to `wasm-bin Like the "without a bundler" strategy, this method of deployment does not require any further postprocessing. The generated JS shims can be `require`'d -just like any other Node module (even the `*_bg` wasm file can be `require`'d +just like any other Node module (even the `*_bg` Wasm file can be `require`'d as it has a JS shim generated as well). Note that this method requires a version of Node.js with WebAssembly support, diff --git a/guide/src/reference/optimize-size.md b/guide/src/reference/optimize-size.md index 6f869ffd88b..8a9c26836cc 100644 --- a/guide/src/reference/optimize-size.md +++ b/guide/src/reference/optimize-size.md @@ -1,7 +1,7 @@ # Optimizing for Size with `wasm-bindgen` The Rust and WebAssembly Working Group's [Game of Life tutorial][gol] has an -excellent section on [shrinking wasm code size][size], but there's a few +excellent section on [shrinking Wasm code size][size], but there's a few `wasm-bindgen`-specific items to mention as well! First and foremost, `wasm-bindgen` is designed to be lightweight and a "pay only @@ -40,7 +40,7 @@ This leaves us with two primary generated files to measure the size of: ### Example As an example, the `wasm-bindgen` repository [contains an example][example] -about generating small wasm binaries and shows off how to generate a small wasm +about generating small Wasm binaries and shows off how to generate a small wasm file for adding two numbers. [gol]: https://rustwasm.github.io/book/game-of-life/introduction.html diff --git a/guide/src/reference/reference-types.md b/guide/src/reference/reference-types.md index 82edeea6fb9..c5315d6a97e 100644 --- a/guide/src/reference/reference-types.md +++ b/guide/src/reference/reference-types.md @@ -4,7 +4,7 @@ WebAssembly recently has gained support for a new value type called `externref`. Proposed in the [WebAssembly reference types repo](https://github.com/webassembly/reference-types) this feature of WebAssembly is hoped to enable more efficient communication between the host -(JS) and the wasm module. This feature removes the need for much of the JS glue +(JS) and the Wasm module. This feature removes the need for much of the JS glue generated by `wasm-bindgen` because it can natively call APIs with JS values. For example, this Rust function: @@ -41,7 +41,7 @@ export function takes_js_value(a) { ``` We can see here how under the hood the JS is managing a table of JS values which -are passed to the wasm binary, so wasm actually only works in indices. If we +are passed to the Wasm binary, so Wasm actually only works in indices. If we pass the `--reference-types` flag to the CLI, however, the generated JS looks like: ```js diff --git a/guide/src/reference/types/result.md b/guide/src/reference/types/result.md index 8e9b880aaaf..029fcdcaf4f 100644 --- a/guide/src/reference/types/result.md +++ b/guide/src/reference/types/result.md @@ -11,7 +11,7 @@ it's converted to JS and handed off, and whenever `Err(error)` is encountered an exception is thrown in JS with `error`. You can use `Result` to enable handling of JS exceptions with `?` in Rust, -naturally propagating it upwards to the wasm boundary. Furthermore you can also +naturally propagating it upwards to the Wasm boundary. Furthermore you can also return custom types in Rust so long as they're all convertible to `JsValue`. Note that if you import a JS function with `Result` you need diff --git a/guide/src/wasm-bindgen-test/continuous-integration.md b/guide/src/wasm-bindgen-test/continuous-integration.md index 9e8823d9cc5..aa56dc1e295 100644 --- a/guide/src/wasm-bindgen-test/continuous-integration.md +++ b/guide/src/wasm-bindgen-test/continuous-integration.md @@ -21,7 +21,7 @@ install: script: - # this will test the non wasm targets if your crate has those, otherwise remove this line. + # this will test the non Wasm targets if your crate has those, otherwise remove this line. # - cargo test diff --git a/guide/src/wasm-bindgen-test/index.md b/guide/src/wasm-bindgen-test/index.md index 3667d7f7a04..010fe6ee2af 100644 --- a/guide/src/wasm-bindgen-test/index.md +++ b/guide/src/wasm-bindgen-test/index.md @@ -1,12 +1,12 @@ # Testing on `wasm32-unknown-unknown` with `wasm-bindgen-test` The `wasm-bindgen-test` crate is an experimental test harness for Rust programs -compiled to wasm using `wasm-bindgen` and the `wasm32-unknown-unknown` +compiled to Wasm using `wasm-bindgen` and the `wasm32-unknown-unknown` target. ## Goals -* Write tests for wasm as similar as possible to how you normally would write +* Write tests for Wasm as similar as possible to how you normally would write `#[test]`-style unit tests for native targets. * Run the tests with the usual `cargo test` command but with an explicit wasm diff --git a/releases/release-announcement-template.md b/releases/release-announcement-template.md index a1feaf4b684..56757241ff2 100644 --- a/releases/release-announcement-template.md +++ b/releases/release-announcement-template.md @@ -1,6 +1,6 @@ # Announcing `wasm-bindgen` $TODO_VERSION -`wasm-bindgen` facilitates high-level interactions between wasm modules and +`wasm-bindgen` facilitates high-level interactions between Wasm modules and JavaScript. * [GitHub][] diff --git a/src/convert/impls.rs b/src/convert/impls.rs index fd77ce88f8f..e54f0669c5a 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -508,7 +508,7 @@ where // // This is only a problem in debug mode. Since this is the browser's error stack // we're talking about, it can only see functions that actually make it to the - // final wasm binary (i.e., not inlined functions). All of those internal + // final Wasm binary (i.e., not inlined functions). All of those internal // iterator functions get inlined in release mode, and so they don't show up. result.push( T::try_from_js_value(value).expect_throw("array contains a value of the wrong type"), diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 99adc9b3745..45ec69bcb5d 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -230,7 +230,7 @@ impl WasmDescribeVector for String { fn describe_vector() { inform(VECTOR); inform(NAMED_EXTERNREF); - // Trying to use an actual loop for this breaks the wasm interpreter. + // Trying to use an actual loop for this breaks the Wasm interpreter. inform(6); inform('s' as u32); inform('t' as u32); diff --git a/src/convert/traits.rs b/src/convert/traits.rs index ca2441d5f02..d13929e6b31 100644 --- a/src/convert/traits.rs +++ b/src/convert/traits.rs @@ -5,7 +5,7 @@ use crate::describe::*; use crate::JsValue; /// A trait for anything that can be converted into a type that can cross the -/// wasm ABI directly, eg `u32` or `f64`. +/// Wasm ABI directly, eg `u32` or `f64`. /// /// This is the opposite operation as `FromWasmAbi` and `Ref[Mut]FromWasmAbi`. /// @@ -15,7 +15,7 @@ use crate::JsValue; /// stability guarantees** are provided. Use at your own risk. See its /// documentation for more details. pub trait IntoWasmAbi: WasmDescribe { - /// The wasm ABI type that this converts into when crossing the ABI + /// The Wasm ABI type that this converts into when crossing the ABI /// boundary. type Abi: WasmAbi; @@ -24,8 +24,8 @@ pub trait IntoWasmAbi: WasmDescribe { fn into_abi(self) -> Self::Abi; } -/// A trait for anything that can be recovered by-value from the wasm ABI -/// boundary, eg a Rust `u8` can be recovered from the wasm ABI `u32` type. +/// A trait for anything that can be recovered by-value from the Wasm ABI +/// boundary, eg a Rust `u8` can be recovered from the Wasm ABI `u32` type. /// /// This is the by-value variant of the opposite operation as `IntoWasmAbi`. /// @@ -35,7 +35,7 @@ pub trait IntoWasmAbi: WasmDescribe { /// stability guarantees** are provided. Use at your own risk. See its /// documentation for more details. pub trait FromWasmAbi: WasmDescribe { - /// The wasm ABI type that this converts from when coming back out from the + /// The Wasm ABI type that this converts from when coming back out from the /// ABI boundary. type Abi: WasmAbi; @@ -50,7 +50,7 @@ pub trait FromWasmAbi: WasmDescribe { } /// A trait for anything that can be recovered as some sort of shared reference -/// from the wasm ABI boundary. +/// from the Wasm ABI boundary. /// /// This is the shared reference variant of the opposite operation as /// `IntoWasmAbi`. @@ -61,7 +61,7 @@ pub trait FromWasmAbi: WasmDescribe { /// stability guarantees** are provided. Use at your own risk. See its /// documentation for more details. pub trait RefFromWasmAbi: WasmDescribe { - /// The wasm ABI type references to `Self` are recovered from. + /// The Wasm ABI type references to `Self` are recovered from. type Abi: WasmAbi; /// The type that holds the reference to `Self` for the duration of the @@ -222,7 +222,7 @@ pub trait WasmAbi { } /// A trait representing how to interpret the return value of a function for -/// the wasm ABI. +/// the Wasm ABI. /// /// This is very similar to the `IntoWasmAbi` trait and in fact has a blanket /// implementation for all implementors of the `IntoWasmAbi`. The primary use diff --git a/src/lib.rs b/src/lib.rs index 8c512d882a1..aa1e7c897f1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,7 @@ if_std! { /// /// A `JsValue` doesn't actually live in Rust right now but actually in a table /// owned by the `wasm-bindgen` generated JS glue code. Eventually the ownership -/// will transfer into wasm directly and this will likely become more efficient, +/// will transfer into Wasm directly and this will likely become more efficient, /// but for now it may be slightly slow. pub struct JsValue { idx: u32, @@ -276,7 +276,7 @@ impl JsValue { } /// If this JS value is a string value, this function copies the JS string - /// value into wasm linear memory, encoded as UTF-8, and returns it as a + /// value into Wasm linear memory, encoded as UTF-8, and returns it as a /// Rust `String`. /// /// To avoid the copying and re-encoding, consider the @@ -1213,7 +1213,7 @@ pub fn throw(s: &str) -> ! { /// Throws a JS exception. /// /// This function will throw a JS exception with the message provided. The -/// function will not return as the wasm stack will be popped when the exception +/// function will not return as the Wasm stack will be popped when the exception /// is thrown. /// /// Note that it is very easy to leak memory with this function because this @@ -1231,8 +1231,8 @@ pub fn throw_str(s: &str) -> ! { /// Rethrow a JS exception /// /// This function will throw a JS exception with the JS value provided. This -/// function will not return and the wasm stack will be popped until the point -/// of entry of wasm itself. +/// function will not return and the Wasm stack will be popped until the point +/// of entry of Wasm itself. /// /// Note that it is very easy to leak memory with this function because this /// function, unlike `panic!` on other platforms, **will not run destructors**. @@ -1306,7 +1306,7 @@ pub fn anyref_heap_live_count() -> u32 { /// /// These methods should have a smaller code size footprint than the normal /// `Option::unwrap` and `Option::expect` methods, but they are specific to -/// working with wasm and JS. +/// working with Wasm and JS. /// /// On non-wasm32 targets, defaults to the normal unwrap/expect calls. /// @@ -1485,17 +1485,17 @@ pub fn module() -> JsValue { unsafe { JsValue::_new(__wbindgen_module()) } } -/// Returns a handle to this wasm instance's `WebAssembly.Instance.prototype.exports` +/// Returns a handle to this Wasm instance's `WebAssembly.Instance.prototype.exports` pub fn exports() -> JsValue { unsafe { JsValue::_new(__wbindgen_exports()) } } -/// Returns a handle to this wasm instance's `WebAssembly.Memory` +/// Returns a handle to this Wasm instance's `WebAssembly.Memory` pub fn memory() -> JsValue { unsafe { JsValue::_new(__wbindgen_memory()) } } -/// Returns a handle to this wasm instance's `WebAssembly.Table` which is the +/// Returns a handle to this Wasm instance's `WebAssembly.Table` which is the /// indirect function table used by Rust pub fn function_table() -> JsValue { unsafe { JsValue::_new(__wbindgen_function_table()) } From ac8bd2da78b121fd66875e792103ba6757ee3f60 Mon Sep 17 00:00:00 2001 From: mx Date: Sun, 8 Sep 2024 03:19:17 +1200 Subject: [PATCH 478/641] Guide: added and async fn call example with f64 (#4097) --- guide/src/reference/js-promises-and-rust-futures.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/guide/src/reference/js-promises-and-rust-futures.md b/guide/src/reference/js-promises-and-rust-futures.md index 1598a1e83ba..89aea0a1e82 100644 --- a/guide/src/reference/js-promises-and-rust-futures.md +++ b/guide/src/reference/js-promises-and-rust-futures.md @@ -32,9 +32,13 @@ must be `JsValue` or no return at all: ```rust #[wasm_bindgen] extern "C" { - async fn async_func_1() -> JsValue; + async fn async_func_1_ret_number() -> JsValue; async fn async_func_2(); } + +async fn get_from_js() -> f64 { + async_func_1_ret_number().await.as_f64().unwrap_or(0.0) +} ``` The `async` can be combined with the `catch` attribute to manage errors from the From 3474f3cff6ea67bbd2c790f2ad68218f4f6fb1cc Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 7 Sep 2024 22:36:34 +0700 Subject: [PATCH 479/641] Reduce the number of typos (#4100) --- CHANGELOG.md | 6 +++--- crates/example-tests/src/lib.rs | 4 ++-- crates/js-sys/src/lib.rs | 2 +- crates/web-sys/tests/wasm/element.rs | 2 +- guide/src/web-sys/inheritance.md | 2 +- tests/wasm/getters_and_setters.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee519b69adc..faa009ad97f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -215,7 +215,7 @@ Released 2024-08-13 * Implement a more reliable way to detect the stack pointer. [#4036](https://github.com/rustwasm/wasm-bindgen/pull/4036) -* `#[track_caller]` is now always applied on `UnwrapThrowExt` methods when not targetting `wasm32-unknown-unknown`. +* `#[track_caller]` is now always applied on `UnwrapThrowExt` methods when not targeting `wasm32-unknown-unknown`. [#4042](https://github.com/rustwasm/wasm-bindgen/pull/4042) * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. @@ -293,7 +293,7 @@ Released 2024-02-06 * Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods. [#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816) -* Depreate `--weak-refs` and `WASM_BINDGEN_WEAKREF` in favor of automatic run-time detection. +* Deprecate `--weak-refs` and `WASM_BINDGEN_WEAKREF` in favor of automatic run-time detection. [#3822](https://github.com/rustwasm/wasm-bindgen/pull/3822) ### Fixed @@ -307,7 +307,7 @@ Released 2024-02-06 * Fixed using `#[wasm_bindgen(js_name = default)]` with `#[wasm_bindgen(module = ...)]`. [#3823](https://github.com/rustwasm/wasm-bindgen/pull/3823) -* Fixed nighly build of `wasm-bindgen-futures`. +* Fixed nightly build of `wasm-bindgen-futures`. [#3827](https://github.com/rustwasm/wasm-bindgen/pull/3827) -------------------------------------------------------------------------------- diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 8753dad2f18..6464941929a 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -420,7 +420,7 @@ pub async fn test_example( "log.entryAdded" => handle_log_event(event.params)?, "network.responseCompleted" => { #[derive(Deserialize)] - struct NetworkReponseCompletedParameters { + struct NetworkResponseCompletedParameters { navigation: Option, response: NetworkResponseData, } @@ -432,7 +432,7 @@ pub async fn test_example( status_text: String, } - let params: NetworkReponseCompletedParameters = + let params: NetworkResponseCompletedParameters = serde_json::from_value(event.params)?; if params.navigation.as_ref() == Some(&navigation) { if !(200..300).contains(¶ms.response.status) { diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 300eca2d16c..1833cd5d77a 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -2773,7 +2773,7 @@ impl Number { /// (without actually being zero). /// /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE) - // Cannot use f64::MIN_POSITIVE since that is the smallest **normal** postitive number. + // Cannot use f64::MIN_POSITIVE since that is the smallest **normal** positive number. pub const MIN_VALUE: f64 = 5E-324; /// Special "Not a Number" value. /// diff --git a/crates/web-sys/tests/wasm/element.rs b/crates/web-sys/tests/wasm/element.rs index 3e54cdc9372..ba4053627a1 100644 --- a/crates/web-sys/tests/wasm/element.rs +++ b/crates/web-sys/tests/wasm/element.rs @@ -228,7 +228,7 @@ fn element() { assert_eq!( element.get_elements_by_class_name("foo").length(), 0, - "Element should not have childs with class foo" + "Element should not have children with class foo" ); child.class_list().add_1("foo").unwrap(); assert_eq!( diff --git a/guide/src/web-sys/inheritance.md b/guide/src/web-sys/inheritance.md index 211117f3768..54ead7b4821 100644 --- a/guide/src/web-sys/inheritance.md +++ b/guide/src/web-sys/inheritance.md @@ -44,7 +44,7 @@ You can use `.as_ref()` to explicitly get a reference to any parent class from from a type in `web_sys`. Note that because of the number of `AsRef` implementations you'll likely need to have type inference guidance as well. -### Accessing child clases using `JsCast` +### Accessing child classes using `JsCast` Finally the `wasm_bindgen::JsCast` trait can be used to implement all manner of casts between types. It supports static unchecked casts between types as well as diff --git a/tests/wasm/getters_and_setters.rs b/tests/wasm/getters_and_setters.rs index 8c841198362..0f3f5f15de5 100644 --- a/tests/wasm/getters_and_setters.rs +++ b/tests/wasm/getters_and_setters.rs @@ -20,7 +20,7 @@ extern "C" { fn _12_js(rules: Rules) -> Rules; fn _13_js(rules: Rules) -> Rules; - fn raw_identifer(rules: RulesWithRawField) -> RulesWithRawField; + fn raw_identifier(rules: RulesWithRawField) -> RulesWithRawField; fn test_getter_compute(x: GetterCompute); fn test_setter_compute(x: SetterCompute); From 35cdc21282fcd934b84de6f0ee247f8be3b30fa8 Mon Sep 17 00:00:00 2001 From: alexlapa <36732824+alexlapa@users.noreply.github.com> Date: Sat, 7 Sep 2024 18:39:37 +0300 Subject: [PATCH 480/641] [web-sys] Add `RTCRtpTransceiverDirection.stopped` variant (#4102) --- CHANGELOG.md | 5 +++++ .../web-sys/src/features/gen_RtcRtpTransceiverDirection.rs | 1 + crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faa009ad97f..97b36510e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Unreleased +### Added + +* Add bindings to `RTCRtpTransceiverDirection.stopped`. + [#4102](https://github.com/rustwasm/wasm-bindgen/pull/4102) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiverDirection.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiverDirection.rs index ed06356751d..cdbbdd8c522 100644 --- a/crates/web-sys/src/features/gen_RtcRtpTransceiverDirection.rs +++ b/crates/web-sys/src/features/gen_RtcRtpTransceiverDirection.rs @@ -11,4 +11,5 @@ pub enum RtcRtpTransceiverDirection { Sendonly = "sendonly", Recvonly = "recvonly", Inactive = "inactive", + Stopped = "stopped", } diff --git a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl index 4c89a032b4c..46757b490f5 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpTransceiver.webidl @@ -11,7 +11,8 @@ enum RTCRtpTransceiverDirection { "sendrecv", "sendonly", "recvonly", - "inactive" + "inactive", + "stopped" }; dictionary RTCRtpTransceiverInit { From 4d5c06385011c5e499a564ae7325fd5b2e32a59a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Sep 2024 17:41:48 +0200 Subject: [PATCH 481/641] Update Clippy to v1.81 (#4109) --- crates/cli/tests/reference/raw.js | 48 +++++++++++++++---------------- examples/todomvc/src/template.rs | 6 +--- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 3432d150366..6b831debb89 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -45,6 +25,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/examples/todomvc/src/template.rs b/examples/todomvc/src/template.rs index 20b800ce860..a4e9af4bb92 100644 --- a/examples/todomvc/src/template.rs +++ b/examples/todomvc/src/template.rs @@ -46,10 +46,6 @@ impl Template { /// Returns the contents for an "items left" indicator pub fn item_counter(active_todos: usize) -> String { let items_left = ItemsLeftTemplate { active_todos }; - if let Ok(res) = items_left.render() { - res - } else { - String::new() - } + items_left.render().unwrap_or_default() } } From d661f3014800a395e5ba4f69e0c231dbfb107f04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:58:06 +0200 Subject: [PATCH 482/641] Bump `tokio-tungstenite` from v0.23 to v0.24 (#4114) --- crates/example-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 232e8db7db3..77c43a83455 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -21,6 +21,6 @@ mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.29.1", features = ["macros", "net", "time"] } -tokio-tungstenite = "0.23" +tokio-tungstenite = "0.24" tower = { version = "0.5", features = ["make", "util"] } tower-http = { version = "0.5", features = ["fs", "util", "set-header"] } From 71af617723305b5d7d0543afb149d681e83aaa6d Mon Sep 17 00:00:00 2001 From: Adam Maciejczuk Date: Mon, 16 Sep 2024 14:04:51 +0200 Subject: [PATCH 483/641] Fix documentation in worker example (#4110) --- examples/wasm-in-web-worker/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wasm-in-web-worker/src/lib.rs b/examples/wasm-in-web-worker/src/lib.rs index 41562ff480a..1985721b4c7 100644 --- a/examples/wasm-in-web-worker/src/lib.rs +++ b/examples/wasm-in-web-worker/src/lib.rs @@ -7,7 +7,7 @@ use web_sys::{console, HtmlElement, HtmlInputElement, MessageEvent, Worker}; /// /// This struct will be the main object which responds to messages passed to the /// worker. It stores the last number which it was passed to have a state. The -/// statefulness is not is not required in this example but should show how +/// statefulness is not required in this example but should show how /// larger, more complex scenarios with statefulness can be set up. #[wasm_bindgen] pub struct NumberEval { From 20c010db6fdc441b9f7c63ffe030763a9ba5687d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Wa=C5=9Bniowski?= Date: Mon, 16 Sep 2024 14:06:55 +0200 Subject: [PATCH 484/641] Add bindings for `RTCPeerConnection.setConfiguration()` (#4105) --- CHANGELOG.md | 3 +++ .../src/features/gen_RtcPeerConnection.rs | 18 ++++++++++++++++++ .../webidls/enabled/RTCPeerConnection.webidl | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b36510e80..20fb6ba7308 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add bindings for `RTCPeerConnection.setConfiguration(RTCConfiguration)` method. + [#4105](https://github.com/rustwasm/wasm-bindgen/pull/4105) + * Add bindings to `RTCRtpTransceiverDirection.stopped`. [#4102](https://github.com/rustwasm/wasm-bindgen/pull/4102) diff --git a/crates/web-sys/src/features/gen_RtcPeerConnection.rs b/crates/web-sys/src/features/gen_RtcPeerConnection.rs index 89396ac4560..5c98c638706 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnection.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnection.rs @@ -775,6 +775,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`, `RtcRtpSender`*"] pub fn remove_track(this: &RtcPeerConnection, sender: &RtcRtpSender); + # [wasm_bindgen (catch , method , structural , js_class = "RTCPeerConnection" , js_name = setConfiguration)] + #[doc = "The `setConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] + pub fn set_configuration(this: &RtcPeerConnection) -> Result<(), JsValue>; + #[cfg(feature = "RtcConfiguration")] + # [wasm_bindgen (catch , method , structural , js_class = "RTCPeerConnection" , js_name = setConfiguration)] + #[doc = "The `setConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcPeerConnection`*"] + pub fn set_configuration_with_configuration( + this: &RtcPeerConnection, + configuration: &RtcConfiguration, + ) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "RTCPeerConnection" , js_name = setIdentityProvider)] #[doc = "The `setIdentityProvider()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl index b91563e99c3..e9bf55a7e1d 100644 --- a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl +++ b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl @@ -107,7 +107,9 @@ interface RTCPeerConnection : EventTarget { [ChromeOnly] attribute DOMString id; - RTCConfiguration getConfiguration (); + [Throws] + undefined setConfiguration(optional RTCConfiguration configuration = {}); + RTCConfiguration getConfiguration (); [Deprecated="RTCPeerConnectionGetStreams"] sequence getLocalStreams (); [Deprecated="RTCPeerConnectionGetStreams"] From 5372294b6449d1e57b183ae674337895db86b331 Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Mon, 16 Sep 2024 23:57:05 +0200 Subject: [PATCH 485/641] Support the Tail Call Proposal (#4111) --- CHANGELOG.md | 5 ++++- crates/cli-support/Cargo.toml | 2 +- crates/cli-support/src/descriptors.rs | 12 ++++++++++++ crates/cli/Cargo.toml | 2 +- crates/externref-xform/Cargo.toml | 2 +- crates/externref-xform/src/lib.rs | 15 ++++++++------- crates/multi-value-xform/Cargo.toml | 2 +- crates/threads-xform/Cargo.toml | 2 +- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- crates/wasm-interpreter/src/lib.rs | 18 ++++++++++++------ 11 files changed, 43 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20fb6ba7308..7ae724f8cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Added support for the WebAssembly `Tail Call` proposal. + [#4111](https://github.com/rustwasm/wasm-bindgen/pull/4111) + * Add bindings for `RTCPeerConnection.setConfiguration(RTCConfiguration)` method. [#4105](https://github.com/rustwasm/wasm-bindgen/pull/4105) @@ -204,7 +207,7 @@ Released 2024-08-13 * Fix MDN links to static interface methods. [#4010](https://github.com/rustwasm/wasm-bindgen/pull/4010) - + * Fixed Deno support. [#3990](https://github.com/rustwasm/wasm-bindgen/pull/3990) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 9513c5adbdf..1486027f9d4 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" -walrus = "0.21" +walrus = "0.21.2" wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.93' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.93' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.93' } diff --git a/crates/cli-support/src/descriptors.rs b/crates/cli-support/src/descriptors.rs index 83617900532..30cd06db029 100644 --- a/crates/cli-support/src/descriptors.rs +++ b/crates/cli-support/src/descriptors.rs @@ -199,6 +199,12 @@ impl WasmBindgenDescriptorsSection { self.found = true; } } + + fn visit_return_call(&mut self, instr: &walrus::ir::ReturnCall) { + if instr.func == self.wbindgen_describe_closure { + self.found = true; + } + } } struct UpdateDescribeClosure { @@ -212,6 +218,12 @@ impl WasmBindgenDescriptorsSection { call.func = self.replacement; } } + + fn visit_return_call_mut(&mut self, instr: &mut walrus::ir::ReturnCall) { + if instr.func == self.wbindgen_describe_closure { + instr.func = self.replacement; + } + } } } } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 66e39de960e..f6fb21aebb6 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } -walrus = { version = "0.21", features = ['parallel'] } +walrus = { version = "0.21.2", features = ['parallel'] } wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.93" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 27feed12b5d..3131625ec6e 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21" +walrus = "0.21.2" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index 7ddf593b2cf..dae449264c0 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -722,18 +722,19 @@ impl Transform<'_> { impl VisitorMut for Rewrite<'_, '_> { fn start_instr_seq_mut(&mut self, seq: &mut InstrSeq) { for i in (0..seq.instrs.len()).rev() { - let call = match &mut seq.instrs[i].0 { - Instr::Call(call) => call, + let func = match &mut seq.instrs[i].0 { + Instr::Call(Call { func }) => func, + Instr::ReturnCall(ReturnCall { func }) => func, _ => continue, }; - let intrinsic = match self.xform.intrinsic_map.get(&call.func) { + let intrinsic = match self.xform.intrinsic_map.get(func) { Some(f) => f, None => { // If this wasn't a call of an intrinsic, but it was a // call of one of our old import functions then we // switch the functions we're calling here. - if let Some(f) = self.xform.import_map.get(&call.func) { - call.func = *f; + if let Some(f) = self.xform.import_map.get(func) { + *func = *f; } continue; } @@ -776,8 +777,8 @@ impl Transform<'_> { seq.instrs .insert(i, (RefNull { ty }.into(), InstrLocId::default())); } - Intrinsic::DropRef => call.func = self.heap_dealloc, - Intrinsic::CloneRef => call.func = self.clone_ref, + Intrinsic::DropRef => *func = self.heap_dealloc, + Intrinsic::CloneRef => *func = self.clone_ref, } } } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 8361b0b4d10..af64348884c 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21" +walrus = "0.21.2" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index df6ca461e9f..d702fc6169e 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21" +walrus = "0.21.2" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index c840850a07f..9ff8a9ffeb2 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -13,7 +13,7 @@ version = "0.2.93" [dependencies] leb128 = "0.2" -walrus = "0.21" +walrus = "0.21.2" # Matching the version `walrus` depends on. anyhow = "1.0" log = "0.4" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 899025b7a09..ce62ffd1091 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -16,7 +16,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" log = "0.4" -walrus = "0.21" +walrus = "0.21.2" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.93" } [dev-dependencies] diff --git a/crates/wasm-interpreter/src/lib.rs b/crates/wasm-interpreter/src/lib.rs index 23729a17e14..a45772ad5a0 100644 --- a/crates/wasm-interpreter/src/lib.rs +++ b/crates/wasm-interpreter/src/lib.rs @@ -338,13 +338,14 @@ impl Frame<'_> { stack.pop().unwrap(); } - Instr::Call(e) => { + Instr::Call(Call { func }) | Instr::ReturnCall(ReturnCall { func }) => { + let func = *func; // If this function is calling the `__wbindgen_describe` // function, which we've precomputed the id for, then // it's telling us about the next `u32` element in the // descriptor to return. We "call" the imported function // here by directly inlining it. - if Some(e.func) == self.interp.describe_id { + if Some(func) == self.interp.describe_id { let val = stack.pop().unwrap(); log::debug!("__wbindgen_describe({})", val); self.interp.descriptor.push(val as u32); @@ -354,7 +355,7 @@ impl Frame<'_> { // slightly different signature. Note that we don't eval the // previous arguments because they shouldn't have any side // effects we're interested in. - } else if Some(e.func) == self.interp.describe_closure_id { + } else if Some(func) == self.interp.describe_closure_id { let val = stack.pop().unwrap(); stack.pop(); stack.pop(); @@ -368,7 +369,7 @@ impl Frame<'_> { if self .module .funcs - .get(e.func) + .get(func) .name .as_ref() .is_some_and(|name| { @@ -380,12 +381,17 @@ impl Frame<'_> { return Ok(()); } - let ty = self.module.types.get(self.module.funcs.get(e.func).ty()); + let ty = self.module.types.get(self.module.funcs.get(func).ty()); let args = (0..ty.params().len()) .map(|_| stack.pop().unwrap()) .collect::>(); - self.interp.call(e.func, self.module, &args); + self.interp.call(func, self.module, &args); + } + + if let Instr::ReturnCall(_) = instr { + log::debug!("return_call"); + self.done = true; } } From 8e66719182441eb5da5f15dcee75e475dbea2db5 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 19 Sep 2024 14:21:12 +0200 Subject: [PATCH 486/641] Firefox supports import in Worklet (#4120) --- guide/src/examples/wasm-audio-worklet.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/guide/src/examples/wasm-audio-worklet.md b/guide/src/examples/wasm-audio-worklet.md index 2d3ef0f130d..b0d6ad4ecf5 100644 --- a/guide/src/examples/wasm-audio-worklet.md +++ b/guide/src/examples/wasm-audio-worklet.md @@ -35,10 +35,8 @@ the application developer does not need to maintain custom JS code. ### Browser Requirements -This demo should work in the latest Chrome and Safari versions at this time. -Firefox [does not support][firefox-worklet-import] imports in worklet modules, -which are difficult to avoid in this example, as `importScripts` is unavailable -in worklets. Note that this example requires HTTP headers to be set like in +This demo should work in the latest Chrome, Firefox and Safari versions at this time. +Note that this example requires HTTP headers to be set like in [parallel-raytrace][headers]. [firefox-worklet-import]: https://bugzilla.mozilla.org/show_bug.cgi?id=1572644 From ffdf0debb3b4a063a816509e9a4b5305e4795335 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 28 Sep 2024 10:06:54 +0200 Subject: [PATCH 487/641] Fix CI (#4132) --- crates/cli/tests/reference/raw.js | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6b831debb89..3432d150366 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -45,6 +25,26 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); -}; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + From 9b81f4b96795620949b622f08e341b4326065503 Mon Sep 17 00:00:00 2001 From: Nicholas Roberts Date: Sat, 28 Sep 2024 18:56:19 +1000 Subject: [PATCH 488/641] Add experimental support for `Symbol.dispose` (#4118) Via `WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE`. --- CHANGELOG.md | 3 + Cargo.toml | 1 + crates/cli-support/src/js/mod.rs | 22 +++++++ crates/cli-support/src/lib.rs | 3 + .../explicit-resource-management/Cargo.toml | 12 ++++ .../explicit-resource-management/README.md | 16 +++++ .../explicit-resource-management/build.sh | 7 +++ .../crate/.gitignore | 1 + .../explicit-resource-management/src/lib.rs | 63 +++++++++++++++++++ examples/explicit-resource-management/test.ts | 17 +++++ 10 files changed, 145 insertions(+) create mode 100644 examples/explicit-resource-management/Cargo.toml create mode 100644 examples/explicit-resource-management/README.md create mode 100755 examples/explicit-resource-management/build.sh create mode 100644 examples/explicit-resource-management/crate/.gitignore create mode 100644 examples/explicit-resource-management/src/lib.rs create mode 100644 examples/explicit-resource-management/test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae724f8cbc..2430b15802d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Add bindings to `RTCRtpTransceiverDirection.stopped`. [#4102](https://github.com/rustwasm/wasm-bindgen/pull/4102) +* Added experimental support for `Symbol.dispose` via `WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE`. + [#4118](https://github.com/rustwasm/wasm-bindgen/pull/4118) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/Cargo.toml b/Cargo.toml index 141f0f316d5..ac38d0504d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ members = [ "examples/deno", "examples/dom", "examples/duck-typed-interfaces", + "examples/explicit-resource-management", "examples/fetch", "examples/guide-supported-types-examples", "examples/hello_world", diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 87042e608fb..b053bbd526c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1084,6 +1084,16 @@ impl<'a> Context<'a> { wasm_bindgen_shared::free_function(name), )); ts_dst.push_str(" free(): void;\n"); + if self.config.symbol_dispose { + dst.push_str( + " + [Symbol.dispose]() {{ + this.free(); + }} + ", + ); + ts_dst.push_str(" [Symbol.dispose](): void;\n"); + } dst.push_str(&class.contents); ts_dst.push_str(&class.typescript); @@ -1486,6 +1496,14 @@ impl<'a> Context<'a> { Ok(ret) } + fn expose_symbol_dispose(&mut self) -> Result<(), Error> { + if !self.should_write_global("symbol_dispose") { + return Ok(()); + } + self.global("if(!Symbol.dispose) { Symbol.dispose = Symbol('Symbol.dispose'); }"); + Ok(()) + } + fn expose_text_encoder(&mut self) -> Result<(), Error> { if !self.should_write_global("text_encoder") { return Ok(()); @@ -2476,6 +2494,10 @@ impl<'a> Context<'a> { pub fn generate(&mut self) -> Result<(), Error> { self.prestore_global_import_identifiers()?; + // conditionally override Symbol.dispose + if self.config.symbol_dispose && !self.aux.structs.is_empty() { + self.expose_symbol_dispose()?; + } for (id, adapter) in crate::sorted_iter(&self.wit.adapters) { let instrs = match &adapter.kind { AdapterKind::Import { .. } => continue, diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index cf37a130616..a35b057e6a6 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -42,6 +42,7 @@ pub struct Bindgen { multi_value: bool, encode_into: EncodeInto, split_linked_modules: bool, + symbol_dispose: bool, } pub struct Output { @@ -88,6 +89,7 @@ impl Bindgen { let externref = env::var("WASM_BINDGEN_ANYREF").is_ok() || env::var("WASM_BINDGEN_EXTERNREF").is_ok(); let multi_value = env::var("WASM_BINDGEN_MULTI_VALUE").is_ok(); + let symbol_dispose = env::var("WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE").is_ok(); Bindgen { input: Input::None, out_name: None, @@ -109,6 +111,7 @@ impl Bindgen { encode_into: EncodeInto::Test, omit_default_module_path: true, split_linked_modules: false, + symbol_dispose, } } diff --git a/examples/explicit-resource-management/Cargo.toml b/examples/explicit-resource-management/Cargo.toml new file mode 100644 index 00000000000..1bba26018ff --- /dev/null +++ b/examples/explicit-resource-management/Cargo.toml @@ -0,0 +1,12 @@ +[package] +authors = ["The wasm-bindgen Developers"] +edition = "2021" +name = "explicit-resource-management" +publish = false +version = "0.0.0" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = { path = "../../" } diff --git a/examples/explicit-resource-management/README.md b/examples/explicit-resource-management/README.md new file mode 100644 index 00000000000..d6b6f76b939 --- /dev/null +++ b/examples/explicit-resource-management/README.md @@ -0,0 +1,16 @@ +# Using Explicit Resource Management (via Deno) + +You can build the example with + +```sh +$ ./build.sh +``` + +and test it with + +```sh +$ deno run --allow-read test.ts +``` + +The `--allow-read` flag is needed because the Wasm file is read during runtime. +This will be fixed when https://github.com/denoland/deno/issues/2552 is resolved. diff --git a/examples/explicit-resource-management/build.sh b/examples/explicit-resource-management/build.sh new file mode 100755 index 00000000000..0aecc1b2092 --- /dev/null +++ b/examples/explicit-resource-management/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eux + +cargo build --target wasm32-unknown-unknown --release +WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE=1 cargo run --package wasm-bindgen-cli --bin wasm-bindgen -- \ + --out-dir pkg --target deno ${CARGO_TARGET_DIR:-../../target}/wasm32-unknown-unknown/release/explicit_resource_management.wasm diff --git a/examples/explicit-resource-management/crate/.gitignore b/examples/explicit-resource-management/crate/.gitignore new file mode 100644 index 00000000000..5e38902c91f --- /dev/null +++ b/examples/explicit-resource-management/crate/.gitignore @@ -0,0 +1 @@ +/explicit-resource-management.wasm diff --git a/examples/explicit-resource-management/src/lib.rs b/examples/explicit-resource-management/src/lib.rs new file mode 100644 index 00000000000..67441dd798d --- /dev/null +++ b/examples/explicit-resource-management/src/lib.rs @@ -0,0 +1,63 @@ +use std::alloc::{GlobalAlloc, Layout, System}; +use std::sync::atomic::{AtomicUsize, Ordering::Relaxed}; +use wasm_bindgen::prelude::*; + +// simple counting allocator tracking +struct Counter; + +static ALLOCATED: AtomicUsize = AtomicUsize::new(0); + +unsafe impl GlobalAlloc for Counter { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + let ret = System.alloc(layout); + if !ret.is_null() { + ALLOCATED.fetch_add(layout.size(), Relaxed); + } + ret + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + System.dealloc(ptr, layout); + ALLOCATED.fetch_sub(layout.size(), Relaxed); + } +} + +#[global_allocator] +static A: Counter = Counter; + +#[wasm_bindgen] +pub fn current_allocation() -> usize { + ALLOCATED.load(Relaxed) +} + +// lifted from the `console_log` example +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = console)] + fn log(s: &str); +} + +#[wasm_bindgen] +pub struct MyStruct { + x: Vec, + y: Vec, + name: String, +} + +#[wasm_bindgen] +impl MyStruct { + #[wasm_bindgen(constructor)] + pub fn new(name: String) -> MyStruct { + Self { + name, + x: (0..50).collect(), + y: (0..50).collect(), + } + } +} + +impl Drop for MyStruct { + fn drop(&mut self) { + log(&format!("Goodbye from {}!", self.name)); // should output "Goodbye from Rust!" + } +} diff --git a/examples/explicit-resource-management/test.ts b/examples/explicit-resource-management/test.ts new file mode 100644 index 00000000000..c622ce60e65 --- /dev/null +++ b/examples/explicit-resource-management/test.ts @@ -0,0 +1,17 @@ +import { current_allocation, MyStruct } from "./pkg/explicit_resource_management.js"; + +const initialAllocation = current_allocation(); +let referrent = {}; +console.log('Before scope: ', initialAllocation); + +{ + using foo = new MyStruct("Rust"); + // force foo to be treated as live by implicit memory management (FinalizationRegistry/GC) + // by retaining a reference that outlives the scope block (for the purposes of proving + // Symbol.dispose is called on scope exit). + referrent['foo'] = foo; + console.log('After construction, but before scope exit: ', current_allocation()); +} +const afterDisposeAllocation = current_allocation(); +console.log('After scope exit: ', afterDisposeAllocation); +console.log(referrent); \ No newline at end of file From d8b6bd03b4aeac9981747d9c859b159bff647605 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 28 Sep 2024 11:07:05 +0200 Subject: [PATCH 489/641] Bump Walrus from v0.21 to v0.22 (#4126) Co-authored-by: daxpedda --- crates/cli-support/Cargo.toml | 2 +- crates/cli/Cargo.toml | 2 +- crates/externref-xform/Cargo.toml | 2 +- crates/multi-value-xform/Cargo.toml | 2 +- crates/threads-xform/Cargo.toml | 2 +- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- crates/wasm-interpreter/tests/smoke.rs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 1486027f9d4..b7680d17fc9 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" -walrus = "0.21.2" +walrus = "0.22" wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.93' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.93' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.93' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index f6fb21aebb6..e51011a7a85 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } -walrus = { version = "0.21.2", features = ['parallel'] } +walrus = { version = "0.22", features = ['parallel'] } wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.93" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 3131625ec6e..6a3b744dd8c 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21.2" +walrus = "0.22" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index af64348884c..450ca40aad2 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21.2" +walrus = "0.22" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index d702fc6169e..54ae6e9f15b 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -15,7 +15,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" -walrus = "0.21.2" +walrus = "0.22" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } [dev-dependencies] diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 9ff8a9ffeb2..5d1ae31bc37 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -13,7 +13,7 @@ version = "0.2.93" [dependencies] leb128 = "0.2" -walrus = "0.21.2" +walrus = "0.22" # Matching the version `walrus` depends on. anyhow = "1.0" log = "0.4" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index ce62ffd1091..25f34d53074 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -16,7 +16,7 @@ version = "0.2.93" [dependencies] anyhow = "1.0" log = "0.4" -walrus = "0.21.2" +walrus = "0.22" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.93" } [dev-dependencies] diff --git a/crates/wasm-interpreter/tests/smoke.rs b/crates/wasm-interpreter/tests/smoke.rs index 6848d003932..71fd3b51380 100644 --- a/crates/wasm-interpreter/tests/smoke.rs +++ b/crates/wasm-interpreter/tests/smoke.rs @@ -3,7 +3,7 @@ use wasm_bindgen_wasm_interpreter::Interpreter; fn interpret(wat: &str, name: &str, result: Option<&[u32]>) { let wasm = wat::parse_str(wat).unwrap(); - let mut module = ModuleConfig::new() + let module = ModuleConfig::new() .generate_producers_section(false) .parse(&wasm) .unwrap(); From 1ebbfc064e26944e31d72d2f866c22f07193f39c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 28 Sep 2024 11:16:14 +0200 Subject: [PATCH 490/641] Bump `tower-http` from v0.5 to v0.6 (#4121) --- crates/example-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 77c43a83455..d8c64e4d7be 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -23,4 +23,4 @@ serde_json = "1.0" tokio = { version = "1.29.1", features = ["macros", "net", "time"] } tokio-tungstenite = "0.24" tower = { version = "0.5", features = ["make", "util"] } -tower-http = { version = "0.5", features = ["fs", "util", "set-header"] } +tower-http = { version = "0.6", features = ["fs", "util", "set-header"] } From 532f30a2678f74247ea6bff059f7a008805a4714 Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Sat, 28 Sep 2024 05:17:36 -0400 Subject: [PATCH 491/641] Add bindings for the WebRTC Encoded Transform API (#4125) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 17 + .../gen_DedicatedWorkerGlobalScope.rs | 25 ++ .../src/features/gen_KeyFrameRequestEvent.rs | 52 +++ .../src/features/gen_RtcEncodedAudioFrame.rs | 79 +++++ .../gen_RtcEncodedAudioFrameMetadata.rs | 185 ++++++++++ .../gen_RtcEncodedAudioFrameOptions.rs | 65 ++++ .../src/features/gen_RtcEncodedVideoFrame.rs | 91 +++++ .../gen_RtcEncodedVideoFrameMetadata.rs | 329 ++++++++++++++++++ .../gen_RtcEncodedVideoFrameOptions.rs | 65 ++++ .../features/gen_RtcEncodedVideoFrameType.rs | 17 + .../src/features/gen_RtcRtpReceiver.rs | 22 ++ .../src/features/gen_RtcRtpScriptTransform.rs | 62 ++++ .../features/gen_RtcRtpScriptTransformer.rs | 115 ++++++ .../web-sys/src/features/gen_RtcRtpSender.rs | 47 +++ .../src/features/gen_RtcTransformEvent.rs | 31 ++ .../src/features/gen_SFrameTransform.rs | 132 +++++++ .../features/gen_SFrameTransformErrorEvent.rs | 68 ++++ .../gen_SFrameTransformErrorEventInit.rs | 181 ++++++++++ .../gen_SFrameTransformErrorEventType.rs | 17 + .../features/gen_SFrameTransformOptions.rs | 64 ++++ .../src/features/gen_SFrameTransformRole.rs | 16 + crates/web-sys/src/features/mod.rs | 119 +++++++ .../unstable/WebRTCEncodeTransform.webidl | 154 ++++++++ 24 files changed, 1956 insertions(+) create mode 100644 crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedAudioFrame.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedAudioFrameOptions.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedVideoFrame.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedVideoFrameOptions.rs create mode 100644 crates/web-sys/src/features/gen_RtcEncodedVideoFrameType.rs create mode 100644 crates/web-sys/src/features/gen_RtcRtpScriptTransform.rs create mode 100644 crates/web-sys/src/features/gen_RtcRtpScriptTransformer.rs create mode 100644 crates/web-sys/src/features/gen_RtcTransformEvent.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransform.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransformErrorEvent.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransformErrorEventType.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransformOptions.rs create mode 100644 crates/web-sys/src/features/gen_SFrameTransformRole.rs create mode 100644 crates/web-sys/webidls/unstable/WebRTCEncodeTransform.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 2430b15802d..95d8901c392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Added experimental support for `Symbol.dispose` via `WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE`. [#4118](https://github.com/rustwasm/wasm-bindgen/pull/4118) +* Added bindings for the draft [WebRTC Encoded Transform](https://www.w3.org/TR/webrtc-encoded-transform) spec. + [#4125](https://github.com/rustwasm/wasm-bindgen/pull/4125) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 5fae721d362..83c7c7441de 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -768,6 +768,7 @@ IterationCompositeOperation = [] JsonWebKey = [] KeyAlgorithm = [] KeyEvent = [] +KeyFrameRequestEvent = ["Event"] KeyIdsInitData = [] KeyboardEvent = ["Event", "UiEvent"] KeyboardEventInit = [] @@ -1114,6 +1115,13 @@ RtcDataChannelInit = [] RtcDataChannelState = [] RtcDataChannelType = [] RtcDegradationPreference = [] +RtcEncodedAudioFrame = [] +RtcEncodedAudioFrameMetadata = [] +RtcEncodedAudioFrameOptions = [] +RtcEncodedVideoFrame = [] +RtcEncodedVideoFrameMetadata = [] +RtcEncodedVideoFrameOptions = [] +RtcEncodedVideoFrameType = [] RtcFecParameters = [] RtcIceCandidate = [] RtcIceCandidateInit = [] @@ -1154,6 +1162,8 @@ RtcRtpHeaderExtensionCapability = [] RtcRtpHeaderExtensionParameters = [] RtcRtpParameters = [] RtcRtpReceiver = [] +RtcRtpScriptTransform = [] +RtcRtpScriptTransformer = ["EventTarget"] RtcRtpSender = [] RtcRtpSourceEntry = [] RtcRtpSourceEntryType = [] @@ -1174,12 +1184,19 @@ RtcStatsReportInternal = [] RtcStatsType = [] RtcTrackEvent = ["Event"] RtcTrackEventInit = [] +RtcTransformEvent = ["Event"] RtcTransportStats = [] RtcdtmfSender = ["EventTarget"] RtcdtmfToneChangeEvent = ["Event"] RtcdtmfToneChangeEventInit = [] RtcrtpContributingSourceStats = [] RtcrtpStreamStats = [] +SFrameTransform = ["EventTarget"] +SFrameTransformErrorEvent = ["Event"] +SFrameTransformErrorEventInit = [] +SFrameTransformErrorEventType = [] +SFrameTransformOptions = [] +SFrameTransformRole = [] SaveFilePickerOptions = [] Scheduler = [] SchedulerPostTaskOptions = [] diff --git a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs index 59deb0b2ef2..fff3988a169 100644 --- a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs @@ -50,6 +50,31 @@ extern "C" { this: &DedicatedWorkerGlobalScope, value: Option<&::js_sys::Function>, ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "DedicatedWorkerGlobalScope" , js_name = onrtctransform)] + #[doc = "Getter for the `onrtctransform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/onrtctransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onrtctransform(this: &DedicatedWorkerGlobalScope) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "DedicatedWorkerGlobalScope" , js_name = onrtctransform)] + #[doc = "Setter for the `onrtctransform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/onrtctransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onrtctransform( + this: &DedicatedWorkerGlobalScope, + value: Option<&::js_sys::Function>, + ); # [wasm_bindgen (method , structural , js_class = "DedicatedWorkerGlobalScope" , js_name = close)] #[doc = "The `close()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs b/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs new file mode 100644 index 00000000000..537a35063ac --- /dev/null +++ b/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs @@ -0,0 +1,52 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = KeyFrameRequestEvent , typescript_type = "KeyFrameRequestEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `KeyFrameRequestEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type KeyFrameRequestEvent; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "KeyFrameRequestEvent" , js_name = rid)] + #[doc = "Getter for the `rid` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/rid)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn rid(this: &KeyFrameRequestEvent) -> Option; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "KeyFrameRequestEvent")] + #[doc = "The `new KeyFrameRequestEvent(..)` constructor, creating a new instance of `KeyFrameRequestEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/KeyFrameRequestEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(type_: &str) -> Result; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "KeyFrameRequestEvent")] + #[doc = "The `new KeyFrameRequestEvent(..)` constructor, creating a new instance of `KeyFrameRequestEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/KeyFrameRequestEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_rid(type_: &str, rid: &str) -> Result; +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedAudioFrame.rs b/crates/web-sys/src/features/gen_RtcEncodedAudioFrame.rs new file mode 100644 index 00000000000..e670d5bd6a6 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedAudioFrame.rs @@ -0,0 +1,79 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedAudioFrame , typescript_type = "RTCEncodedAudioFrame")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedAudioFrame` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedAudioFrame; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCEncodedAudioFrame" , js_name = data)] + #[doc = "Getter for the `data` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data(this: &RtcEncodedAudioFrame) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "RTCEncodedAudioFrame" , js_name = data)] + #[doc = "Setter for the `data` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_data(this: &RtcEncodedAudioFrame, value: &::js_sys::ArrayBuffer); + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "RTCEncodedAudioFrame")] + #[doc = "The `new RtcEncodedAudioFrame(..)` constructor, creating a new instance of `RtcEncodedAudioFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/RTCEncodedAudioFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(original_frame: &RtcEncodedAudioFrame) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedAudioFrameOptions")] + #[wasm_bindgen(catch, constructor, js_class = "RTCEncodedAudioFrame")] + #[doc = "The `new RtcEncodedAudioFrame(..)` constructor, creating a new instance of `RtcEncodedAudioFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/RTCEncodedAudioFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`, `RtcEncodedAudioFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options( + original_frame: &RtcEncodedAudioFrame, + options: &RtcEncodedAudioFrameOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedAudioFrameMetadata")] + # [wasm_bindgen (method , structural , js_class = "RTCEncodedAudioFrame" , js_name = getMetadata)] + #[doc = "The `getMetadata()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/getMetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`, `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_metadata(this: &RtcEncodedAudioFrame) -> RtcEncodedAudioFrameMetadata; +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs new file mode 100644 index 00000000000..32eb233b84b --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs @@ -0,0 +1,185 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedAudioFrameMetadata)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedAudioFrameMetadata` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedAudioFrameMetadata; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `contributingSources` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "contributingSources")] + pub fn get_contributing_sources(this: &RtcEncodedAudioFrameMetadata) + -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `contributingSources` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "contributingSources")] + pub fn set_contributing_sources( + this: &RtcEncodedAudioFrameMetadata, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mimeType")] + pub fn get_mime_type(this: &RtcEncodedAudioFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mimeType")] + pub fn set_mime_type(this: &RtcEncodedAudioFrameMetadata, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "payloadType")] + pub fn get_payload_type(this: &RtcEncodedAudioFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "payloadType")] + pub fn set_payload_type(this: &RtcEncodedAudioFrameMetadata, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rtpTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rtpTimestamp")] + pub fn get_rtp_timestamp(this: &RtcEncodedAudioFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rtpTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rtpTimestamp")] + pub fn set_rtp_timestamp(this: &RtcEncodedAudioFrameMetadata, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `sequenceNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "sequenceNumber")] + pub fn get_sequence_number(this: &RtcEncodedAudioFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `sequenceNumber` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "sequenceNumber")] + pub fn set_sequence_number(this: &RtcEncodedAudioFrameMetadata, val: i16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `synchronizationSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "synchronizationSource")] + pub fn get_synchronization_source(this: &RtcEncodedAudioFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `synchronizationSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "synchronizationSource")] + pub fn set_synchronization_source(this: &RtcEncodedAudioFrameMetadata, val: u32); +} +#[cfg(web_sys_unstable_apis)] +impl RtcEncodedAudioFrameMetadata { + #[doc = "Construct a new `RtcEncodedAudioFrameMetadata`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_contributing_sources()` instead."] + pub fn contributing_sources(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_contributing_sources(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mime_type()` instead."] + pub fn mime_type(&mut self, val: &str) -> &mut Self { + self.set_mime_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_payload_type()` instead."] + pub fn payload_type(&mut self, val: u8) -> &mut Self { + self.set_payload_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rtp_timestamp()` instead."] + pub fn rtp_timestamp(&mut self, val: u32) -> &mut Self { + self.set_rtp_timestamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_sequence_number()` instead."] + pub fn sequence_number(&mut self, val: i16) -> &mut Self { + self.set_sequence_number(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_synchronization_source()` instead."] + pub fn synchronization_source(&mut self, val: u32) -> &mut Self { + self.set_synchronization_source(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for RtcEncodedAudioFrameMetadata { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedAudioFrameOptions.rs b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameOptions.rs new file mode 100644 index 00000000000..23fb8cdd1f6 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameOptions.rs @@ -0,0 +1,65 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedAudioFrameOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedAudioFrameOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedAudioFrameOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedAudioFrameMetadata")] + #[doc = "Get the `metadata` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`, `RtcEncodedAudioFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "metadata")] + pub fn get_metadata(this: &RtcEncodedAudioFrameOptions) + -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedAudioFrameMetadata")] + #[doc = "Change the `metadata` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameMetadata`, `RtcEncodedAudioFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "metadata")] + pub fn set_metadata(this: &RtcEncodedAudioFrameOptions, val: &RtcEncodedAudioFrameMetadata); +} +#[cfg(web_sys_unstable_apis)] +impl RtcEncodedAudioFrameOptions { + #[doc = "Construct a new `RtcEncodedAudioFrameOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedAudioFrameMetadata")] + #[deprecated = "Use `set_metadata()` instead."] + pub fn metadata(&mut self, val: &RtcEncodedAudioFrameMetadata) -> &mut Self { + self.set_metadata(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for RtcEncodedAudioFrameOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedVideoFrame.rs b/crates/web-sys/src/features/gen_RtcEncodedVideoFrame.rs new file mode 100644 index 00000000000..3e78b749670 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedVideoFrame.rs @@ -0,0 +1,91 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedVideoFrame , typescript_type = "RTCEncodedVideoFrame")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedVideoFrame` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedVideoFrame; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameType")] + # [wasm_bindgen (structural , method , getter , js_class = "RTCEncodedVideoFrame" , js_name = type)] + #[doc = "Getter for the `type` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/type)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`, `RtcEncodedVideoFrameType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn type_(this: &RtcEncodedVideoFrame) -> RtcEncodedVideoFrameType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCEncodedVideoFrame" , js_name = data)] + #[doc = "Getter for the `data` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data(this: &RtcEncodedVideoFrame) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "RTCEncodedVideoFrame" , js_name = data)] + #[doc = "Setter for the `data` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/data)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_data(this: &RtcEncodedVideoFrame, value: &::js_sys::ArrayBuffer); + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "RTCEncodedVideoFrame")] + #[doc = "The `new RtcEncodedVideoFrame(..)` constructor, creating a new instance of `RtcEncodedVideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/RTCEncodedVideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(original_frame: &RtcEncodedVideoFrame) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameOptions")] + #[wasm_bindgen(catch, constructor, js_class = "RTCEncodedVideoFrame")] + #[doc = "The `new RtcEncodedVideoFrame(..)` constructor, creating a new instance of `RtcEncodedVideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/RTCEncodedVideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`, `RtcEncodedVideoFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options( + original_frame: &RtcEncodedVideoFrame, + options: &RtcEncodedVideoFrameOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameMetadata")] + # [wasm_bindgen (method , structural , js_class = "RTCEncodedVideoFrame" , js_name = getMetadata)] + #[doc = "The `getMetadata()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedVideoFrame/getMetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrame`, `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_metadata(this: &RtcEncodedVideoFrame) -> RtcEncodedVideoFrameMetadata; +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs new file mode 100644 index 00000000000..9e544e9d4c3 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs @@ -0,0 +1,329 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedVideoFrameMetadata)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedVideoFrameMetadata` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedVideoFrameMetadata; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `contributingSources` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "contributingSources")] + pub fn get_contributing_sources(this: &RtcEncodedVideoFrameMetadata) + -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `contributingSources` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "contributingSources")] + pub fn set_contributing_sources( + this: &RtcEncodedVideoFrameMetadata, + val: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `dependencies` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "dependencies")] + pub fn get_dependencies(this: &RtcEncodedVideoFrameMetadata) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `dependencies` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "dependencies")] + pub fn set_dependencies(this: &RtcEncodedVideoFrameMetadata, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `frameId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frameId")] + pub fn get_frame_id(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `frameId` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "frameId")] + pub fn set_frame_id(this: &RtcEncodedVideoFrameMetadata, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "height")] + pub fn get_height(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `height` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "height")] + pub fn set_height(this: &RtcEncodedVideoFrameMetadata, val: u16); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "mimeType")] + pub fn get_mime_type(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "mimeType")] + pub fn set_mime_type(this: &RtcEncodedVideoFrameMetadata, val: &str); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "payloadType")] + pub fn get_payload_type(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `payloadType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "payloadType")] + pub fn set_payload_type(this: &RtcEncodedVideoFrameMetadata, val: u8); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rtpTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rtpTimestamp")] + pub fn get_rtp_timestamp(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rtpTimestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rtpTimestamp")] + pub fn set_rtp_timestamp(this: &RtcEncodedVideoFrameMetadata, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `spatialIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "spatialIndex")] + pub fn get_spatial_index(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `spatialIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "spatialIndex")] + pub fn set_spatial_index(this: &RtcEncodedVideoFrameMetadata, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `synchronizationSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "synchronizationSource")] + pub fn get_synchronization_source(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `synchronizationSource` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "synchronizationSource")] + pub fn set_synchronization_source(this: &RtcEncodedVideoFrameMetadata, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `temporalIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "temporalIndex")] + pub fn get_temporal_index(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `temporalIndex` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "temporalIndex")] + pub fn set_temporal_index(this: &RtcEncodedVideoFrameMetadata, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "timestamp")] + pub fn get_timestamp(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `timestamp` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "timestamp")] + pub fn set_timestamp(this: &RtcEncodedVideoFrameMetadata, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "width")] + pub fn get_width(this: &RtcEncodedVideoFrameMetadata) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `width` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "width")] + pub fn set_width(this: &RtcEncodedVideoFrameMetadata, val: u16); +} +#[cfg(web_sys_unstable_apis)] +impl RtcEncodedVideoFrameMetadata { + #[doc = "Construct a new `RtcEncodedVideoFrameMetadata`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_contributing_sources()` instead."] + pub fn contributing_sources(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_contributing_sources(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_dependencies()` instead."] + pub fn dependencies(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_dependencies(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_frame_id()` instead."] + pub fn frame_id(&mut self, val: f64) -> &mut Self { + self.set_frame_id(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_height()` instead."] + pub fn height(&mut self, val: u16) -> &mut Self { + self.set_height(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_mime_type()` instead."] + pub fn mime_type(&mut self, val: &str) -> &mut Self { + self.set_mime_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_payload_type()` instead."] + pub fn payload_type(&mut self, val: u8) -> &mut Self { + self.set_payload_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_rtp_timestamp()` instead."] + pub fn rtp_timestamp(&mut self, val: u32) -> &mut Self { + self.set_rtp_timestamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_spatial_index()` instead."] + pub fn spatial_index(&mut self, val: u32) -> &mut Self { + self.set_spatial_index(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_synchronization_source()` instead."] + pub fn synchronization_source(&mut self, val: u32) -> &mut Self { + self.set_synchronization_source(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_temporal_index()` instead."] + pub fn temporal_index(&mut self, val: u32) -> &mut Self { + self.set_temporal_index(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_timestamp()` instead."] + pub fn timestamp(&mut self, val: f64) -> &mut Self { + self.set_timestamp(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_width()` instead."] + pub fn width(&mut self, val: u16) -> &mut Self { + self.set_width(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for RtcEncodedVideoFrameMetadata { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedVideoFrameOptions.rs b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameOptions.rs new file mode 100644 index 00000000000..080cd6dc37e --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameOptions.rs @@ -0,0 +1,65 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedVideoFrameOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcEncodedVideoFrameOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcEncodedVideoFrameOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameMetadata")] + #[doc = "Get the `metadata` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`, `RtcEncodedVideoFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "metadata")] + pub fn get_metadata(this: &RtcEncodedVideoFrameOptions) + -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameMetadata")] + #[doc = "Change the `metadata` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameMetadata`, `RtcEncodedVideoFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "metadata")] + pub fn set_metadata(this: &RtcEncodedVideoFrameOptions, val: &RtcEncodedVideoFrameMetadata); +} +#[cfg(web_sys_unstable_apis)] +impl RtcEncodedVideoFrameOptions { + #[doc = "Construct a new `RtcEncodedVideoFrameOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcEncodedVideoFrameMetadata")] + #[deprecated = "Use `set_metadata()` instead."] + pub fn metadata(&mut self, val: &RtcEncodedVideoFrameMetadata) -> &mut Self { + self.set_metadata(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for RtcEncodedVideoFrameOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcEncodedVideoFrameType.rs b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameType.rs new file mode 100644 index 00000000000..3874a7f483f --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameType.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `RtcEncodedVideoFrameType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `RtcEncodedVideoFrameType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RtcEncodedVideoFrameType { + Empty = "empty", + Key = "key", + Delta = "delta", +} diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 4e65f620aa5..8bc85580089 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -45,6 +45,28 @@ extern "C" { this: &RtcRtpReceiver, value: Option, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpReceiver" , js_name = transform)] + #[doc = "Getter for the `transform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transform(this: &RtcRtpReceiver) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_transform(this: &RtcRtpReceiver, value: Option<&::js_sys::Object>); #[cfg(feature = "RtcRtpCapabilities")] # [wasm_bindgen (static_method_of = RtcRtpReceiver , js_class = "RTCRtpReceiver" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] diff --git a/crates/web-sys/src/features/gen_RtcRtpScriptTransform.rs b/crates/web-sys/src/features/gen_RtcRtpScriptTransform.rs new file mode 100644 index 00000000000..196091bf213 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpScriptTransform.rs @@ -0,0 +1,62 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpScriptTransform , typescript_type = "RTCRtpScriptTransform")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpScriptTransform` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcRtpScriptTransform; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Worker")] + #[wasm_bindgen(catch, constructor, js_class = "RTCRtpScriptTransform")] + #[doc = "The `new RtcRtpScriptTransform(..)` constructor, creating a new instance of `RtcRtpScriptTransform`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransform/RTCRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`, `Worker`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(worker: &Worker) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Worker")] + #[wasm_bindgen(catch, constructor, js_class = "RTCRtpScriptTransform")] + #[doc = "The `new RtcRtpScriptTransform(..)` constructor, creating a new instance of `RtcRtpScriptTransform`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransform/RTCRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`, `Worker`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options( + worker: &Worker, + options: &::wasm_bindgen::JsValue, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Worker")] + #[wasm_bindgen(catch, constructor, js_class = "RTCRtpScriptTransform")] + #[doc = "The `new RtcRtpScriptTransform(..)` constructor, creating a new instance of `RtcRtpScriptTransform`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransform/RTCRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`, `Worker`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options_and_transfer( + worker: &Worker, + options: &::wasm_bindgen::JsValue, + transfer: &::wasm_bindgen::JsValue, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_RtcRtpScriptTransformer.rs b/crates/web-sys/src/features/gen_RtcRtpScriptTransformer.rs new file mode 100644 index 00000000000..77a39edbe77 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpScriptTransformer.rs @@ -0,0 +1,115 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = RTCRtpScriptTransformer , typescript_type = "RTCRtpScriptTransformer")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpScriptTransformer` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcRtpScriptTransformer; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpScriptTransformer" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &RtcRtpScriptTransformer) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpScriptTransformer" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &RtcRtpScriptTransformer) -> WritableStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpScriptTransformer" , js_name = onkeyframerequest)] + #[doc = "Getter for the `onkeyframerequest` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/onkeyframerequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onkeyframerequest(this: &RtcRtpScriptTransformer) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpScriptTransformer" , js_name = onkeyframerequest)] + #[doc = "Setter for the `onkeyframerequest` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/onkeyframerequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onkeyframerequest( + this: &RtcRtpScriptTransformer, + value: Option<&::js_sys::Function>, + ); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpScriptTransformer" , js_name = options)] + #[doc = "Getter for the `options` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/options)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn options(this: &RtcRtpScriptTransformer) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "RTCRtpScriptTransformer" , js_name = generateKeyFrame)] + #[doc = "The `generateKeyFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/generateKeyFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn generate_key_frame(this: &RtcRtpScriptTransformer) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "RTCRtpScriptTransformer" , js_name = generateKeyFrame)] + #[doc = "The `generateKeyFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/generateKeyFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn generate_key_frame_with_rid( + this: &RtcRtpScriptTransformer, + rid: &str, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "RTCRtpScriptTransformer" , js_name = sendKeyFrameRequest)] + #[doc = "The `sendKeyFrameRequest()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpScriptTransformer/sendKeyFrameRequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn send_key_frame_request(this: &RtcRtpScriptTransformer) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 74ecf498d8f..7aa2057004f 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -28,6 +28,53 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`, `RtcdtmfSender`*"] pub fn dtmf(this: &RtcRtpSender) -> Option; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpSender" , js_name = transform)] + #[doc = "Getter for the `transform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transform(this: &RtcRtpSender) -> Option<::js_sys::Object>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_transform(this: &RtcRtpSender, value: Option<&::js_sys::Object>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = generateKeyFrame)] + #[doc = "The `generateKeyFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/generateKeyFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn generate_key_frame(this: &RtcRtpSender) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = generateKeyFrame)] + #[doc = "The `generateKeyFrame()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/generateKeyFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn generate_key_frame_with_rids( + this: &RtcRtpSender, + rids: &::wasm_bindgen::JsValue, + ) -> ::js_sys::Promise; #[cfg(feature = "RtcRtpCapabilities")] # [wasm_bindgen (static_method_of = RtcRtpSender , js_class = "RTCRtpSender" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] diff --git a/crates/web-sys/src/features/gen_RtcTransformEvent.rs b/crates/web-sys/src/features/gen_RtcTransformEvent.rs new file mode 100644 index 00000000000..68975654017 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcTransformEvent.rs @@ -0,0 +1,31 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = RTCTransformEvent , typescript_type = "RTCTransformEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcTransformEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCTransformEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcTransformEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type RtcTransformEvent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcRtpScriptTransformer")] + # [wasm_bindgen (structural , method , getter , js_class = "RTCTransformEvent" , js_name = transformer)] + #[doc = "Getter for the `transformer` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCTransformEvent/transformer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransformer`, `RtcTransformEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transformer(this: &RtcTransformEvent) -> RtcRtpScriptTransformer; +} diff --git a/crates/web-sys/src/features/gen_SFrameTransform.rs b/crates/web-sys/src/features/gen_SFrameTransform.rs new file mode 100644 index 00000000000..ade06fff155 --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransform.rs @@ -0,0 +1,132 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = SFrameTransform , typescript_type = "SFrameTransform")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SFrameTransform` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SFrameTransform; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransform" , js_name = onerror)] + #[doc = "Getter for the `onerror` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/onerror)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn onerror(this: &SFrameTransform) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "SFrameTransform" , js_name = onerror)] + #[doc = "Setter for the `onerror` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/onerror)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_onerror(this: &SFrameTransform, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ReadableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransform" , js_name = readable)] + #[doc = "Getter for the `readable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/readable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn readable(this: &SFrameTransform) -> ReadableStream; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WritableStream")] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransform" , js_name = writable)] + #[doc = "Getter for the `writable` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/writable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`, `WritableStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn writable(this: &SFrameTransform) -> WritableStream; + #[cfg(web_sys_unstable_apis)] + #[wasm_bindgen(catch, constructor, js_class = "SFrameTransform")] + #[doc = "The `new SFrameTransform(..)` constructor, creating a new instance of `SFrameTransform`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/SFrameTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformOptions")] + #[wasm_bindgen(catch, constructor, js_class = "SFrameTransform")] + #[doc = "The `new SFrameTransform(..)` constructor, creating a new instance of `SFrameTransform`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/SFrameTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransform`, `SFrameTransformOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_options(options: &SFrameTransformOptions) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (method , structural , js_class = "SFrameTransform" , js_name = setEncryptionKey)] + #[doc = "The `setEncryptionKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/setEncryptionKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_encryption_key(this: &SFrameTransform, key: &CryptoKey) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (method , structural , js_class = "SFrameTransform" , js_name = setEncryptionKey)] + #[doc = "The `setEncryptionKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/setEncryptionKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_encryption_key_with_u32( + this: &SFrameTransform, + key: &CryptoKey, + key_id: u32, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (method , structural , js_class = "SFrameTransform" , js_name = setEncryptionKey)] + #[doc = "The `setEncryptionKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransform/setEncryptionKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_encryption_key_with_f64( + this: &SFrameTransform, + key: &CryptoKey, + key_id: f64, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_SFrameTransformErrorEvent.rs b/crates/web-sys/src/features/gen_SFrameTransformErrorEvent.rs new file mode 100644 index 00000000000..51b78448c26 --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransformErrorEvent.rs @@ -0,0 +1,68 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = SFrameTransformErrorEvent , typescript_type = "SFrameTransformErrorEvent")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SFrameTransformErrorEvent` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransformErrorEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SFrameTransformErrorEvent; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformErrorEventType")] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransformErrorEvent" , js_name = errorType)] + #[doc = "Getter for the `errorType` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransformErrorEvent/errorType)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEvent`, `SFrameTransformErrorEventType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn error_type(this: &SFrameTransformErrorEvent) -> SFrameTransformErrorEventType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransformErrorEvent" , js_name = keyID)] + #[doc = "Getter for the `keyID` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransformErrorEvent/keyID)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn key_id(this: &SFrameTransformErrorEvent) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "SFrameTransformErrorEvent" , js_name = frame)] + #[doc = "Getter for the `frame` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransformErrorEvent/frame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEvent`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn frame(this: &SFrameTransformErrorEvent) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformErrorEventInit")] + #[wasm_bindgen(catch, constructor, js_class = "SFrameTransformErrorEvent")] + #[doc = "The `new SFrameTransformErrorEvent(..)` constructor, creating a new instance of `SFrameTransformErrorEvent`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SFrameTransformErrorEvent/SFrameTransformErrorEvent)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEvent`, `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new( + type_: &str, + event_init_dict: &SFrameTransformErrorEventInit, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs b/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs new file mode 100644 index 00000000000..7acce345f2a --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs @@ -0,0 +1,181 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SFrameTransformErrorEventInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SFrameTransformErrorEventInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SFrameTransformErrorEventInit; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "bubbles")] + pub fn get_bubbles(this: &SFrameTransformErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `bubbles` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "bubbles")] + pub fn set_bubbles(this: &SFrameTransformErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "cancelable")] + pub fn get_cancelable(this: &SFrameTransformErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `cancelable` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "cancelable")] + pub fn set_cancelable(this: &SFrameTransformErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "composed")] + pub fn get_composed(this: &SFrameTransformErrorEventInit) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `composed` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "composed")] + pub fn set_composed(this: &SFrameTransformErrorEventInit, val: bool); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformErrorEventType")] + #[doc = "Get the `errorType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`, `SFrameTransformErrorEventType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "errorType")] + pub fn get_error_type(this: &SFrameTransformErrorEventInit) -> SFrameTransformErrorEventType; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformErrorEventType")] + #[doc = "Change the `errorType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`, `SFrameTransformErrorEventType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "errorType")] + pub fn set_error_type(this: &SFrameTransformErrorEventInit, val: SFrameTransformErrorEventType); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `frame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "frame")] + pub fn get_frame(this: &SFrameTransformErrorEventInit) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `frame` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "frame")] + pub fn set_frame(this: &SFrameTransformErrorEventInit, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `keyID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "keyID")] + pub fn get_key_id(this: &SFrameTransformErrorEventInit) -> ::wasm_bindgen::JsValue; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `keyID` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "keyID")] + pub fn set_key_id(this: &SFrameTransformErrorEventInit, val: &::wasm_bindgen::JsValue); +} +#[cfg(web_sys_unstable_apis)] +impl SFrameTransformErrorEventInit { + #[cfg(feature = "SFrameTransformErrorEventType")] + #[doc = "Construct a new `SFrameTransformErrorEventInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventInit`, `SFrameTransformErrorEventType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(error_type: SFrameTransformErrorEventType, frame: &::wasm_bindgen::JsValue) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.error_type(error_type); + ret.frame(frame); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_bubbles()` instead."] + pub fn bubbles(&mut self, val: bool) -> &mut Self { + self.set_bubbles(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_cancelable()` instead."] + pub fn cancelable(&mut self, val: bool) -> &mut Self { + self.set_cancelable(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_composed()` instead."] + pub fn composed(&mut self, val: bool) -> &mut Self { + self.set_composed(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformErrorEventType")] + #[deprecated = "Use `set_error_type()` instead."] + pub fn error_type(&mut self, val: SFrameTransformErrorEventType) -> &mut Self { + self.set_error_type(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_frame()` instead."] + pub fn frame(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_frame(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_key_id()` instead."] + pub fn key_id(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { + self.set_key_id(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); + self + } +} diff --git a/crates/web-sys/src/features/gen_SFrameTransformErrorEventType.rs b/crates/web-sys/src/features/gen_SFrameTransformErrorEventType.rs new file mode 100644 index 00000000000..9bd1e81e9f1 --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransformErrorEventType.rs @@ -0,0 +1,17 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `SFrameTransformErrorEventType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `SFrameTransformErrorEventType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum SFrameTransformErrorEventType { + Authentication = "authentication", + KeyId = "keyID", + Syntax = "syntax", +} diff --git a/crates/web-sys/src/features/gen_SFrameTransformOptions.rs b/crates/web-sys/src/features/gen_SFrameTransformOptions.rs new file mode 100644 index 00000000000..eca2ad5f175 --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransformOptions.rs @@ -0,0 +1,64 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SFrameTransformOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `SFrameTransformOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type SFrameTransformOptions; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformRole")] + #[doc = "Get the `role` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformOptions`, `SFrameTransformRole`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "role")] + pub fn get_role(this: &SFrameTransformOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformRole")] + #[doc = "Change the `role` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformOptions`, `SFrameTransformRole`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "role")] + pub fn set_role(this: &SFrameTransformOptions, val: SFrameTransformRole); +} +#[cfg(web_sys_unstable_apis)] +impl SFrameTransformOptions { + #[doc = "Construct a new `SFrameTransformOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SFrameTransformOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "SFrameTransformRole")] + #[deprecated = "Use `set_role()` instead."] + pub fn role(&mut self, val: SFrameTransformRole) -> &mut Self { + self.set_role(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for SFrameTransformOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_SFrameTransformRole.rs b/crates/web-sys/src/features/gen_SFrameTransformRole.rs new file mode 100644 index 00000000000..7556496670e --- /dev/null +++ b/crates/web-sys/src/features/gen_SFrameTransformRole.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `SFrameTransformRole` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `SFrameTransformRole`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum SFrameTransformRole { + Encrypt = "encrypt", + Decrypt = "decrypt", +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index d6091590a63..d37dbf057dc 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -5122,6 +5122,13 @@ mod gen_KeyEvent; #[allow(unused_imports)] pub use gen_KeyEvent::*; +#[cfg(feature = "KeyFrameRequestEvent")] +#[allow(non_snake_case)] +mod gen_KeyFrameRequestEvent; +#[cfg(feature = "KeyFrameRequestEvent")] +#[allow(unused_imports)] +pub use gen_KeyFrameRequestEvent::*; + #[cfg(feature = "KeyIdsInitData")] #[allow(non_snake_case)] mod gen_KeyIdsInitData; @@ -7544,6 +7551,55 @@ mod gen_RtcDegradationPreference; #[allow(unused_imports)] pub use gen_RtcDegradationPreference::*; +#[cfg(feature = "RtcEncodedAudioFrame")] +#[allow(non_snake_case)] +mod gen_RtcEncodedAudioFrame; +#[cfg(feature = "RtcEncodedAudioFrame")] +#[allow(unused_imports)] +pub use gen_RtcEncodedAudioFrame::*; + +#[cfg(feature = "RtcEncodedAudioFrameMetadata")] +#[allow(non_snake_case)] +mod gen_RtcEncodedAudioFrameMetadata; +#[cfg(feature = "RtcEncodedAudioFrameMetadata")] +#[allow(unused_imports)] +pub use gen_RtcEncodedAudioFrameMetadata::*; + +#[cfg(feature = "RtcEncodedAudioFrameOptions")] +#[allow(non_snake_case)] +mod gen_RtcEncodedAudioFrameOptions; +#[cfg(feature = "RtcEncodedAudioFrameOptions")] +#[allow(unused_imports)] +pub use gen_RtcEncodedAudioFrameOptions::*; + +#[cfg(feature = "RtcEncodedVideoFrame")] +#[allow(non_snake_case)] +mod gen_RtcEncodedVideoFrame; +#[cfg(feature = "RtcEncodedVideoFrame")] +#[allow(unused_imports)] +pub use gen_RtcEncodedVideoFrame::*; + +#[cfg(feature = "RtcEncodedVideoFrameMetadata")] +#[allow(non_snake_case)] +mod gen_RtcEncodedVideoFrameMetadata; +#[cfg(feature = "RtcEncodedVideoFrameMetadata")] +#[allow(unused_imports)] +pub use gen_RtcEncodedVideoFrameMetadata::*; + +#[cfg(feature = "RtcEncodedVideoFrameOptions")] +#[allow(non_snake_case)] +mod gen_RtcEncodedVideoFrameOptions; +#[cfg(feature = "RtcEncodedVideoFrameOptions")] +#[allow(unused_imports)] +pub use gen_RtcEncodedVideoFrameOptions::*; + +#[cfg(feature = "RtcEncodedVideoFrameType")] +#[allow(non_snake_case)] +mod gen_RtcEncodedVideoFrameType; +#[cfg(feature = "RtcEncodedVideoFrameType")] +#[allow(unused_imports)] +pub use gen_RtcEncodedVideoFrameType::*; + #[cfg(feature = "RtcFecParameters")] #[allow(non_snake_case)] mod gen_RtcFecParameters; @@ -7824,6 +7880,20 @@ mod gen_RtcRtpReceiver; #[allow(unused_imports)] pub use gen_RtcRtpReceiver::*; +#[cfg(feature = "RtcRtpScriptTransform")] +#[allow(non_snake_case)] +mod gen_RtcRtpScriptTransform; +#[cfg(feature = "RtcRtpScriptTransform")] +#[allow(unused_imports)] +pub use gen_RtcRtpScriptTransform::*; + +#[cfg(feature = "RtcRtpScriptTransformer")] +#[allow(non_snake_case)] +mod gen_RtcRtpScriptTransformer; +#[cfg(feature = "RtcRtpScriptTransformer")] +#[allow(unused_imports)] +pub use gen_RtcRtpScriptTransformer::*; + #[cfg(feature = "RtcRtpSender")] #[allow(non_snake_case)] mod gen_RtcRtpSender; @@ -7964,6 +8034,13 @@ mod gen_RtcTrackEventInit; #[allow(unused_imports)] pub use gen_RtcTrackEventInit::*; +#[cfg(feature = "RtcTransformEvent")] +#[allow(non_snake_case)] +mod gen_RtcTransformEvent; +#[cfg(feature = "RtcTransformEvent")] +#[allow(unused_imports)] +pub use gen_RtcTransformEvent::*; + #[cfg(feature = "RtcTransportStats")] #[allow(non_snake_case)] mod gen_RtcTransportStats; @@ -8006,6 +8083,48 @@ mod gen_RtcrtpStreamStats; #[allow(unused_imports)] pub use gen_RtcrtpStreamStats::*; +#[cfg(feature = "SFrameTransform")] +#[allow(non_snake_case)] +mod gen_SFrameTransform; +#[cfg(feature = "SFrameTransform")] +#[allow(unused_imports)] +pub use gen_SFrameTransform::*; + +#[cfg(feature = "SFrameTransformErrorEvent")] +#[allow(non_snake_case)] +mod gen_SFrameTransformErrorEvent; +#[cfg(feature = "SFrameTransformErrorEvent")] +#[allow(unused_imports)] +pub use gen_SFrameTransformErrorEvent::*; + +#[cfg(feature = "SFrameTransformErrorEventInit")] +#[allow(non_snake_case)] +mod gen_SFrameTransformErrorEventInit; +#[cfg(feature = "SFrameTransformErrorEventInit")] +#[allow(unused_imports)] +pub use gen_SFrameTransformErrorEventInit::*; + +#[cfg(feature = "SFrameTransformErrorEventType")] +#[allow(non_snake_case)] +mod gen_SFrameTransformErrorEventType; +#[cfg(feature = "SFrameTransformErrorEventType")] +#[allow(unused_imports)] +pub use gen_SFrameTransformErrorEventType::*; + +#[cfg(feature = "SFrameTransformOptions")] +#[allow(non_snake_case)] +mod gen_SFrameTransformOptions; +#[cfg(feature = "SFrameTransformOptions")] +#[allow(unused_imports)] +pub use gen_SFrameTransformOptions::*; + +#[cfg(feature = "SFrameTransformRole")] +#[allow(non_snake_case)] +mod gen_SFrameTransformRole; +#[cfg(feature = "SFrameTransformRole")] +#[allow(unused_imports)] +pub use gen_SFrameTransformRole::*; + #[cfg(feature = "SaveFilePickerOptions")] #[allow(non_snake_case)] mod gen_SaveFilePickerOptions; diff --git a/crates/web-sys/webidls/unstable/WebRTCEncodeTransform.webidl b/crates/web-sys/webidls/unstable/WebRTCEncodeTransform.webidl new file mode 100644 index 00000000000..76a51267b72 --- /dev/null +++ b/crates/web-sys/webidls/unstable/WebRTCEncodeTransform.webidl @@ -0,0 +1,154 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc-encoded-transform/#idl-index + */ + + typedef (SFrameTransform or RTCRtpScriptTransform) RTCRtpTransform; + +// New methods for RTCRtpSender and RTCRtpReceiver +partial interface RTCRtpSender { + attribute RTCRtpTransform? transform; +}; + +partial interface RTCRtpReceiver { + attribute RTCRtpTransform? transform; +}; + +enum SFrameTransformRole { + "encrypt", + "decrypt" +}; + +dictionary SFrameTransformOptions { + SFrameTransformRole role = "encrypt"; +}; + +typedef [EnforceRange] unsigned long long SmallCryptoKeyID; +typedef (SmallCryptoKeyID or bigint) CryptoKeyID; + +[Exposed=(Window,DedicatedWorker)] +interface SFrameTransform : EventTarget { + constructor(optional SFrameTransformOptions options = {}); + Promise setEncryptionKey(CryptoKey key, optional CryptoKeyID keyID); + attribute EventHandler onerror; +}; +SFrameTransform includes GenericTransformStream; + +enum SFrameTransformErrorEventType { + "authentication", + "keyID", + "syntax" +}; + +[Exposed=(Window,DedicatedWorker)] +interface SFrameTransformErrorEvent : Event { + constructor(DOMString type, SFrameTransformErrorEventInit eventInitDict); + + readonly attribute SFrameTransformErrorEventType errorType; + readonly attribute CryptoKeyID? keyID; + readonly attribute any frame; +}; + +dictionary SFrameTransformErrorEventInit : EventInit { + required SFrameTransformErrorEventType errorType; + required any frame; + CryptoKeyID? keyID; +}; + +// New enum for video frame types. Will eventually re-use the equivalent defined +// by WebCodecs. +enum RTCEncodedVideoFrameType { + "empty", + "key", + "delta", +}; + +dictionary RTCEncodedVideoFrameMetadata { + unsigned long long frameId; + sequence dependencies; + unsigned short width; + unsigned short height; + unsigned long spatialIndex; + unsigned long temporalIndex; + unsigned long synchronizationSource; + octet payloadType; + sequence contributingSources; + long long timestamp; // microseconds + unsigned long rtpTimestamp; + DOMString mimeType; +}; + +dictionary RTCEncodedVideoFrameOptions { + RTCEncodedVideoFrameMetadata metadata; +}; + +// New interfaces to define encoded video and audio frames. Will eventually +// re-use or extend the equivalent defined in WebCodecs. +[Exposed=(Window,DedicatedWorker), Serializable] +interface RTCEncodedVideoFrame { + constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameOptions options = {}); + readonly attribute RTCEncodedVideoFrameType type; + attribute ArrayBuffer data; + RTCEncodedVideoFrameMetadata getMetadata(); +}; + +dictionary RTCEncodedAudioFrameMetadata { + unsigned long synchronizationSource; + octet payloadType; + sequence contributingSources; + short sequenceNumber; + unsigned long rtpTimestamp; + DOMString mimeType; +}; + +dictionary RTCEncodedAudioFrameOptions { + RTCEncodedAudioFrameMetadata metadata; +}; + +[Exposed=(Window,DedicatedWorker), Serializable] +interface RTCEncodedAudioFrame { + constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameOptions options = {}); + attribute ArrayBuffer data; + RTCEncodedAudioFrameMetadata getMetadata(); +}; + +[Exposed=DedicatedWorker] +interface RTCTransformEvent : Event { + readonly attribute RTCRtpScriptTransformer transformer; +}; + +partial interface DedicatedWorkerGlobalScope { + attribute EventHandler onrtctransform; +}; + +[Exposed=DedicatedWorker] +interface RTCRtpScriptTransformer : EventTarget { + // Attributes and methods related to the transformer source + readonly attribute ReadableStream readable; + Promise generateKeyFrame(optional DOMString rid); + Promise sendKeyFrameRequest(); + // Attributes and methods related to the transformer sink + readonly attribute WritableStream writable; + attribute EventHandler onkeyframerequest; + // Attributes for configuring the Javascript code + readonly attribute any options; +}; + +[Exposed=Window] +interface RTCRtpScriptTransform { + constructor(Worker worker, optional any options, optional sequence transfer); +}; + +[Exposed=DedicatedWorker] +interface KeyFrameRequestEvent : Event { + constructor(DOMString type, optional DOMString rid); + readonly attribute DOMString? rid; +}; + +partial interface RTCRtpSender { + Promise generateKeyFrame(optional sequence rids); +}; From 73460587d42e7faba0cef672da2bcf754337f384 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 28 Sep 2024 11:42:18 +0200 Subject: [PATCH 492/641] Enable transformations when detecting target features (#4133) --- CHANGELOG.md | 5 ++++ crates/cli-support/src/lib.rs | 11 ++++++++ crates/wasm-conventions/src/lib.rs | 44 ++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d8901c392..e4c194d677c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ * Added bindings for the draft [WebRTC Encoded Transform](https://www.w3.org/TR/webrtc-encoded-transform) spec. [#4125](https://github.com/rustwasm/wasm-bindgen/pull/4125) +### Changed + +* Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. + [#4133](https://github.com/rustwasm/wasm-bindgen/pull/4133) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index a35b057e6a6..8c49ddbc1a6 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -323,6 +323,17 @@ impl Bindgen { .context("failed getting Wasm module")?, }; + // Enable reference type transformations if the module is already using it. + if let Ok(true) = wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types") + { + self.externref = true; + } + + // Enable multivalue transformations if the module is already using it. + if let Ok(true) = wasm_bindgen_wasm_conventions::target_feature(&module, "multivalue") { + self.multi_value = true; + } + // Check that no exported symbol is called "default" if we target web. if matches!(self.mode, OutputMode::Web) && module.exports.iter().any(|export| export.name == "default") diff --git a/crates/wasm-conventions/src/lib.rs b/crates/wasm-conventions/src/lib.rs index c0f25739456..beb0fe9da09 100755 --- a/crates/wasm-conventions/src/lib.rs +++ b/crates/wasm-conventions/src/lib.rs @@ -177,6 +177,50 @@ pub fn get_or_insert_start_builder(module: &mut Module) -> &mut FunctionBuilder .builder_mut() } +pub fn target_feature(module: &Module, feature: &str) -> Result { + // Taken from . + anyhow::ensure!(feature.len() <= 100_000, "feature name too long"); + + // Try to find an existing section. + let section = module + .customs + .iter() + .find(|(_, custom)| custom.name() == "target_features"); + + if let Some((_, section)) = section { + let section: &RawCustomSection = section + .as_any() + .downcast_ref() + .context("failed to read section")?; + let mut reader = BinaryReader::new(§ion.data, 0, WasmFeatures::default()); + // The first integer contains the target feature count. + let count = reader.read_var_u32()?; + + // Try to find if the target feature is already present. + for _ in 0..count { + // First byte is the prefix. + let prefix = reader.read_u8()?; + // Read the feature. + let length = reader.read_var_u32()?; + let this_feature = reader.read_bytes(length as usize)?; + + // If we found the target feature, we are done here. + if this_feature == feature.as_bytes() { + // Make sure we set any existing prefix to "enabled". + if prefix == b'-' { + return Ok(false); + } + + return Ok(true); + } + } + + Ok(false) + } else { + Ok(false) + } +} + pub fn insert_target_feature(module: &mut Module, new_feature: &str) -> Result<()> { // Taken from . anyhow::ensure!(new_feature.len() <= 100_000, "feature name too long"); From 4765448545d7bfc0223fd52f25d966b0bfbf8004 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 28 Sep 2024 13:31:54 +0200 Subject: [PATCH 493/641] Update Gamepad API (#4134) --- CHANGELOG.md | 9 + crates/web-sys/Cargo.toml | 9 +- crates/web-sys/src/features/gen_Gamepad.rs | 86 ++++++--- .../src/features/gen_GamepadAxisMoveEvent.rs | 47 ----- .../features/gen_GamepadAxisMoveEventInit.rs | 121 ------------ .../src/features/gen_GamepadButtonEvent.rs | 40 ---- .../features/gen_GamepadButtonEventInit.rs | 106 ---------- .../features/gen_GamepadEffectParameters.rs | 181 ++++++++++++++++++ .../src/features/gen_GamepadHapticActuator.rs | 57 ++++++ .../features/gen_GamepadHapticEffectType.rs | 16 ++ .../src/features/gen_GamepadHapticsResult.rs | 16 ++ .../src/features/gen_GamepadServiceTest.rs | 128 ------------- .../web-sys/src/features/gen_GamepadTouch.rs | 63 ++++++ .../src/features/gen_HtmlBodyElement.rs | 44 +++++ .../src/features/gen_HtmlFrameSetElement.rs | 47 +++++ crates/web-sys/src/features/gen_Navigator.rs | 8 - crates/web-sys/src/features/gen_Window.rs | 44 +++++ crates/web-sys/src/features/mod.rs | 51 +++-- crates/web-sys/webidls/enabled/Gamepad.webidl | 126 ++++-------- .../enabled/GamepadAxisMoveEvent.webidl | 19 -- .../webidls/enabled/GamepadButtonEvent.webidl | 17 -- .../webidls/enabled/GamepadEvent.webidl | 17 -- .../webidls/enabled/GamepadExtensions.webidl | 38 ++++ .../enabled/GamepadHapticActuator.webidl | 21 -- .../webidls/enabled/GamepadPose.webidl | 30 --- .../webidls/enabled/GamepadServiceTest.webidl | 45 ----- .../web-sys/webidls/enabled/Navigator.webidl | 10 - .../web-sys/webidls/unstable/Gamepad.webidl | 44 +++++ .../webidls/unstable/GamepadExtensions.webidl | 13 ++ 29 files changed, 695 insertions(+), 758 deletions(-) delete mode 100644 crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadButtonEvent.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadButtonEventInit.rs create mode 100644 crates/web-sys/src/features/gen_GamepadEffectParameters.rs create mode 100644 crates/web-sys/src/features/gen_GamepadHapticEffectType.rs create mode 100644 crates/web-sys/src/features/gen_GamepadHapticsResult.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadServiceTest.rs create mode 100644 crates/web-sys/src/features/gen_GamepadTouch.rs delete mode 100644 crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadEvent.webidl create mode 100644 crates/web-sys/webidls/enabled/GamepadExtensions.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadPose.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadServiceTest.webidl create mode 100644 crates/web-sys/webidls/unstable/Gamepad.webidl create mode 100644 crates/web-sys/webidls/unstable/GamepadExtensions.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c194d677c..57639df10ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,15 @@ * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. [#4133](https://github.com/rustwasm/wasm-bindgen/pull/4133) +* Updated Gamepad API. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + +* Deprecated `Gamepad::display_id` and `GamepadHapticActuator::type_`. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + +* Removed `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`, `GamepadButtonEvent`, `GamepadButtonEventInit` and `GamepadServiceTest`, which were seemingly never implemented by any JS environment. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 83c7c7441de..0dd64d2cd34 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -454,19 +454,18 @@ FuzzingFunctions = [] GainNode = ["AudioNode", "EventTarget"] GainOptions = [] Gamepad = [] -GamepadAxisMoveEvent = ["Event", "GamepadEvent"] -GamepadAxisMoveEventInit = [] GamepadButton = [] -GamepadButtonEvent = ["Event", "GamepadEvent"] -GamepadButtonEventInit = [] +GamepadEffectParameters = [] GamepadEvent = ["Event"] GamepadEventInit = [] GamepadHand = [] GamepadHapticActuator = [] GamepadHapticActuatorType = [] +GamepadHapticEffectType = [] +GamepadHapticsResult = [] GamepadMappingType = [] GamepadPose = [] -GamepadServiceTest = [] +GamepadTouch = [] Geolocation = [] GetAnimationsOptions = [] GetRootNodeOptions = [] diff --git a/crates/web-sys/src/features/gen_Gamepad.rs b/crates/web-sys/src/features/gen_Gamepad.rs index c9cd0e79191..cb20fdf2e18 100644 --- a/crates/web-sys/src/features/gen_Gamepad.rs +++ b/crates/web-sys/src/features/gen_Gamepad.rs @@ -26,6 +26,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] pub fn index(this: &Gamepad) -> u32; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)] + #[doc = "Getter for the `connected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn connected(this: &Gamepad) -> bool; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)] + #[doc = "Getter for the `timestamp` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn timestamp(this: &Gamepad) -> f64; #[cfg(feature = "GamepadMappingType")] # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = mapping)] #[doc = "Getter for the `mapping` field of this object."] @@ -34,28 +48,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadMappingType`*"] pub fn mapping(this: &Gamepad) -> GamepadMappingType; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hand)] - #[doc = "Getter for the `hand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHand`*"] - pub fn hand(this: &Gamepad) -> GamepadHand; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)] - #[doc = "Getter for the `displayId` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn display_id(this: &Gamepad) -> u32; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)] - #[doc = "Getter for the `connected` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)] + #[doc = "Getter for the `axes` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn connected(this: &Gamepad) -> bool; + pub fn axes(this: &Gamepad) -> ::js_sys::Array; # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = buttons)] #[doc = "Getter for the `buttons` field of this object."] #[doc = ""] @@ -63,20 +62,29 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] pub fn buttons(this: &Gamepad) -> ::js_sys::Array; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)] - #[doc = "Getter for the `axes` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)] + #[doc = "Getter for the `displayId` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn axes(this: &Gamepad) -> ::js_sys::Array; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)] - #[doc = "Getter for the `timestamp` field of this object."] + #[deprecated] + pub fn display_id(this: &Gamepad) -> u32; + #[cfg(feature = "GamepadHand")] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hand)] + #[doc = "Getter for the `hand` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hand)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHand`*"] + pub fn hand(this: &Gamepad) -> GamepadHand; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)] + #[doc = "Getter for the `hapticActuators` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn timestamp(this: &Gamepad) -> f64; + pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array; #[cfg(feature = "GamepadPose")] # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = pose)] #[doc = "Getter for the `pose` field of this object."] @@ -85,11 +93,27 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadPose`*"] pub fn pose(this: &Gamepad) -> Option; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)] - #[doc = "Getter for the `hapticActuators` field of this object."] + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GamepadHapticActuator")] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = vibrationActuator)] + #[doc = "Getter for the `vibrationActuator` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/vibrationActuator)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn vibration_actuator(this: &Gamepad) -> GamepadHapticActuator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = touchEvents)] + #[doc = "Getter for the `touchEvents` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/touchEvents)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array; + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn touch_events(this: &Gamepad) -> Option<::js_sys::Array>; } diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs deleted file mode 100644 index 4ab18a1eb7d..00000000000 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = GamepadEvent , extends = Event , extends = :: js_sys :: Object , js_name = GamepadAxisMoveEvent , typescript_type = "GamepadAxisMoveEvent")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadAxisMoveEvent` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub type GamepadAxisMoveEvent; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadAxisMoveEvent" , js_name = axis)] - #[doc = "Getter for the `axis` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/axis)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn axis(this: &GamepadAxisMoveEvent) -> u32; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadAxisMoveEvent" , js_name = value)] - #[doc = "Getter for the `value` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/value)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn value(this: &GamepadAxisMoveEvent) -> f64; - #[wasm_bindgen(catch, constructor, js_class = "GamepadAxisMoveEvent")] - #[doc = "The `new GamepadAxisMoveEvent(..)` constructor, creating a new instance of `GamepadAxisMoveEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn new(type_: &str) -> Result; - #[cfg(feature = "GamepadAxisMoveEventInit")] - #[wasm_bindgen(catch, constructor, js_class = "GamepadAxisMoveEvent")] - #[doc = "The `new GamepadAxisMoveEvent(..)` constructor, creating a new instance of `GamepadAxisMoveEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`*"] - pub fn new_with_event_init_dict( - type_: &str, - event_init_dict: &GamepadAxisMoveEventInit, - ) -> Result; -} diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs deleted file mode 100644 index 885cee25eca..00000000000 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs +++ /dev/null @@ -1,121 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadAxisMoveEventInit)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadAxisMoveEventInit` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - pub type GamepadAxisMoveEventInit; - #[doc = "Get the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "bubbles")] - pub fn get_bubbles(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "bubbles")] - pub fn set_bubbles(this: &GamepadAxisMoveEventInit, val: bool); - #[doc = "Get the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "cancelable")] - pub fn get_cancelable(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "cancelable")] - pub fn set_cancelable(this: &GamepadAxisMoveEventInit, val: bool); - #[doc = "Get the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "composed")] - pub fn get_composed(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "composed")] - pub fn set_composed(this: &GamepadAxisMoveEventInit, val: bool); - #[cfg(feature = "Gamepad")] - #[doc = "Get the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "gamepad")] - pub fn get_gamepad(this: &GamepadAxisMoveEventInit) -> Option; - #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "gamepad")] - pub fn set_gamepad(this: &GamepadAxisMoveEventInit, val: Option<&Gamepad>); - #[doc = "Get the `axis` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "axis")] - pub fn get_axis(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `axis` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "axis")] - pub fn set_axis(this: &GamepadAxisMoveEventInit, val: u32); - #[doc = "Get the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "value")] - pub fn set_value(this: &GamepadAxisMoveEventInit, val: f64); -} -impl GamepadAxisMoveEventInit { - #[doc = "Construct a new `GamepadAxisMoveEventInit`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[deprecated = "Use `set_bubbles()` instead."] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.set_bubbles(val); - self - } - #[deprecated = "Use `set_cancelable()` instead."] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.set_cancelable(val); - self - } - #[deprecated = "Use `set_composed()` instead."] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.set_composed(val); - self - } - #[cfg(feature = "Gamepad")] - #[deprecated = "Use `set_gamepad()` instead."] - pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.set_gamepad(val); - self - } - #[deprecated = "Use `set_axis()` instead."] - pub fn axis(&mut self, val: u32) -> &mut Self { - self.set_axis(val); - self - } - #[deprecated = "Use `set_value()` instead."] - pub fn value(&mut self, val: f64) -> &mut Self { - self.set_value(val); - self - } -} -impl Default for GamepadAxisMoveEventInit { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GamepadButtonEvent.rs b/crates/web-sys/src/features/gen_GamepadButtonEvent.rs deleted file mode 100644 index 42262148400..00000000000 --- a/crates/web-sys/src/features/gen_GamepadButtonEvent.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = GamepadEvent , extends = Event , extends = :: js_sys :: Object , js_name = GamepadButtonEvent , typescript_type = "GamepadButtonEvent")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadButtonEvent` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub type GamepadButtonEvent; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadButtonEvent" , js_name = button)] - #[doc = "Getter for the `button` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/button)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub fn button(this: &GamepadButtonEvent) -> u32; - #[wasm_bindgen(catch, constructor, js_class = "GamepadButtonEvent")] - #[doc = "The `new GamepadButtonEvent(..)` constructor, creating a new instance of `GamepadButtonEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub fn new(type_: &str) -> Result; - #[cfg(feature = "GamepadButtonEventInit")] - #[wasm_bindgen(catch, constructor, js_class = "GamepadButtonEvent")] - #[doc = "The `new GamepadButtonEvent(..)` constructor, creating a new instance of `GamepadButtonEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`, `GamepadButtonEventInit`*"] - pub fn new_with_event_init_dict( - type_: &str, - event_init_dict: &GamepadButtonEventInit, - ) -> Result; -} diff --git a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs deleted file mode 100644 index 9cd13854ed9..00000000000 --- a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs +++ /dev/null @@ -1,106 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadButtonEventInit)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadButtonEventInit` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - pub type GamepadButtonEventInit; - #[doc = "Get the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "bubbles")] - pub fn get_bubbles(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "bubbles")] - pub fn set_bubbles(this: &GamepadButtonEventInit, val: bool); - #[doc = "Get the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "cancelable")] - pub fn get_cancelable(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "cancelable")] - pub fn set_cancelable(this: &GamepadButtonEventInit, val: bool); - #[doc = "Get the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "composed")] - pub fn get_composed(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "composed")] - pub fn set_composed(this: &GamepadButtonEventInit, val: bool); - #[cfg(feature = "Gamepad")] - #[doc = "Get the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "gamepad")] - pub fn get_gamepad(this: &GamepadButtonEventInit) -> Option; - #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "gamepad")] - pub fn set_gamepad(this: &GamepadButtonEventInit, val: Option<&Gamepad>); - #[doc = "Get the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "button")] - pub fn get_button(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "button")] - pub fn set_button(this: &GamepadButtonEventInit, val: u32); -} -impl GamepadButtonEventInit { - #[doc = "Construct a new `GamepadButtonEventInit`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[deprecated = "Use `set_bubbles()` instead."] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.set_bubbles(val); - self - } - #[deprecated = "Use `set_cancelable()` instead."] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.set_cancelable(val); - self - } - #[deprecated = "Use `set_composed()` instead."] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.set_composed(val); - self - } - #[cfg(feature = "Gamepad")] - #[deprecated = "Use `set_gamepad()` instead."] - pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.set_gamepad(val); - self - } - #[deprecated = "Use `set_button()` instead."] - pub fn button(&mut self, val: u32) -> &mut Self { - self.set_button(val); - self - } -} -impl Default for GamepadButtonEventInit { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GamepadEffectParameters.rs b/crates/web-sys/src/features/gen_GamepadEffectParameters.rs new file mode 100644 index 00000000000..07849052610 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadEffectParameters.rs @@ -0,0 +1,181 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadEffectParameters)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GamepadEffectParameters` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GamepadEffectParameters; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `leftTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "leftTrigger")] + pub fn get_left_trigger(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `leftTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "leftTrigger")] + pub fn set_left_trigger(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rightTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rightTrigger")] + pub fn get_right_trigger(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rightTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rightTrigger")] + pub fn set_right_trigger(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startDelay")] + pub fn get_start_delay(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "startDelay")] + pub fn set_start_delay(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `strongMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "strongMagnitude")] + pub fn get_strong_magnitude(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `strongMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "strongMagnitude")] + pub fn set_strong_magnitude(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `weakMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "weakMagnitude")] + pub fn get_weak_magnitude(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `weakMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "weakMagnitude")] + pub fn set_weak_magnitude(this: &GamepadEffectParameters, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl GamepadEffectParameters { + #[doc = "Construct a new `GamepadEffectParameters`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: f64) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_left_trigger()` instead."] + pub fn left_trigger(&mut self, val: f64) -> &mut Self { + self.set_left_trigger(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_right_trigger()` instead."] + pub fn right_trigger(&mut self, val: f64) -> &mut Self { + self.set_right_trigger(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_start_delay()` instead."] + pub fn start_delay(&mut self, val: f64) -> &mut Self { + self.set_start_delay(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_strong_magnitude()` instead."] + pub fn strong_magnitude(&mut self, val: f64) -> &mut Self { + self.set_strong_magnitude(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_weak_magnitude()` instead."] + pub fn weak_magnitude(&mut self, val: f64) -> &mut Self { + self.set_weak_magnitude(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for GamepadEffectParameters { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_GamepadHapticActuator.rs b/crates/web-sys/src/features/gen_GamepadHapticActuator.rs index 8a6737528c6..b1d1ac87e81 100644 --- a/crates/web-sys/src/features/gen_GamepadHapticActuator.rs +++ b/crates/web-sys/src/features/gen_GamepadHapticActuator.rs @@ -19,7 +19,53 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`, `GamepadHapticActuatorType`*"] + #[deprecated] pub fn type_(this: &GamepadHapticActuator) -> GamepadHapticActuatorType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadHapticActuator" , js_name = effects)] + #[doc = "Getter for the `effects` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/effects)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn effects(this: &GamepadHapticActuator) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GamepadHapticEffectType")] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = playEffect)] + #[doc = "The `playEffect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/playEffect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`, `GamepadHapticEffectType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn play_effect( + this: &GamepadHapticActuator, + type_: GamepadHapticEffectType, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "GamepadEffectParameters", + feature = "GamepadHapticEffectType", + ))] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = playEffect)] + #[doc = "The `playEffect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/playEffect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`, `GamepadHapticActuator`, `GamepadHapticEffectType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn play_effect_with_params( + this: &GamepadHapticActuator, + type_: GamepadHapticEffectType, + params: &GamepadEffectParameters, + ) -> ::js_sys::Promise; # [wasm_bindgen (catch , method , structural , js_class = "GamepadHapticActuator" , js_name = pulse)] #[doc = "The `pulse()` method."] #[doc = ""] @@ -31,4 +77,15 @@ extern "C" { value: f64, duration: f64, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn reset(this: &GamepadHapticActuator) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs b/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs new file mode 100644 index 00000000000..f78269698f8 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GamepadHapticEffectType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GamepadHapticEffectType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GamepadHapticEffectType { + DualRumble = "dual-rumble", + TriggerRumble = "trigger-rumble", +} diff --git a/crates/web-sys/src/features/gen_GamepadHapticsResult.rs b/crates/web-sys/src/features/gen_GamepadHapticsResult.rs new file mode 100644 index 00000000000..14a59728c18 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadHapticsResult.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GamepadHapticsResult` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GamepadHapticsResult`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GamepadHapticsResult { + Complete = "complete", + Preempted = "preempted", +} diff --git a/crates/web-sys/src/features/gen_GamepadServiceTest.rs b/crates/web-sys/src/features/gen_GamepadServiceTest.rs deleted file mode 100644 index a8cd86aef95..00000000000 --- a/crates/web-sys/src/features/gen_GamepadServiceTest.rs +++ /dev/null @@ -1,128 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadServiceTest , typescript_type = "GamepadServiceTest")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadServiceTest` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub type GamepadServiceTest; - #[cfg(feature = "GamepadMappingType")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = noMapping)] - #[doc = "Getter for the `noMapping` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/noMapping)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn no_mapping(this: &GamepadServiceTest) -> GamepadMappingType; - #[cfg(feature = "GamepadMappingType")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = standardMapping)] - #[doc = "Getter for the `standardMapping` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/standardMapping)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn standard_mapping(this: &GamepadServiceTest) -> GamepadMappingType; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = noHand)] - #[doc = "Getter for the `noHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/noHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn no_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = leftHand)] - #[doc = "Getter for the `leftHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/leftHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn left_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = rightHand)] - #[doc = "Getter for the `rightHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/rightHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn right_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(all(feature = "GamepadHand", feature = "GamepadMappingType",))] - # [wasm_bindgen (catch , method , structural , js_class = "GamepadServiceTest" , js_name = addGamepad)] - #[doc = "The `addGamepad()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/addGamepad)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn add_gamepad( - this: &GamepadServiceTest, - id: &str, - mapping: GamepadMappingType, - hand: GamepadHand, - num_buttons: u32, - num_axes: u32, - num_haptics: u32, - ) -> Result<::js_sys::Promise, JsValue>; - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newAxisMoveEvent)] - #[doc = "The `newAxisMoveEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_axis_move_event(this: &GamepadServiceTest, index: u32, axis: u32, value: f64); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newButtonEvent)] - #[doc = "The `newButtonEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_button_event( - this: &GamepadServiceTest, - index: u32, - button: u32, - pressed: bool, - touched: bool, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newButtonValueEvent)] - #[doc = "The `newButtonValueEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newButtonValueEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_button_value_event( - this: &GamepadServiceTest, - index: u32, - button: u32, - pressed: bool, - touched: bool, - value: f64, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newPoseMove)] - #[doc = "The `newPoseMove()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newPoseMove)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_pose_move( - this: &GamepadServiceTest, - index: u32, - orient: Option<&mut [f32]>, - pos: Option<&mut [f32]>, - ang_velocity: Option<&mut [f32]>, - ang_acceleration: Option<&mut [f32]>, - lin_velocity: Option<&mut [f32]>, - lin_acceleration: Option<&mut [f32]>, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = removeGamepad)] - #[doc = "The `removeGamepad()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/removeGamepad)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn remove_gamepad(this: &GamepadServiceTest, index: u32); -} diff --git a/crates/web-sys/src/features/gen_GamepadTouch.rs b/crates/web-sys/src/features/gen_GamepadTouch.rs new file mode 100644 index 00000000000..af4e6097294 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadTouch.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadTouch , typescript_type = "GamepadTouch")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GamepadTouch` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GamepadTouch; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = touchId)] + #[doc = "Getter for the `touchId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/touchId)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn touch_id(this: &GamepadTouch) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = surfaceId)] + #[doc = "Getter for the `surfaceId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/surfaceId)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn surface_id(this: &GamepadTouch) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = position)] + #[doc = "Getter for the `position` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/position)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn position(this: &GamepadTouch) -> Vec; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = surfaceDimensions)] + #[doc = "Getter for the `surfaceDimensions` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/surfaceDimensions)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn surface_dimensions(this: &GamepadTouch) -> Option>; +} diff --git a/crates/web-sys/src/features/gen_HtmlBodyElement.rs b/crates/web-sys/src/features/gen_HtmlBodyElement.rs index c7870c9af27..9f1e6ed6bbc 100644 --- a/crates/web-sys/src/features/gen_HtmlBodyElement.rs +++ b/crates/web-sys/src/features/gen_HtmlBodyElement.rs @@ -292,4 +292,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] pub fn set_onunload(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLBodyElement" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &HtmlBodyElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLBodyElement" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &HtmlBodyElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); } diff --git a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs index 85458a0d80f..ed44859b390 100644 --- a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs @@ -236,4 +236,51 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] pub fn set_onunload(this: &HtmlFrameSetElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLFrameSetElement" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &HtmlFrameSetElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &HtmlFrameSetElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLFrameSetElement" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &HtmlFrameSetElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected( + this: &HtmlFrameSetElement, + value: Option<&::js_sys::Function>, + ); } diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index bef2bb5427d..114e7faf128 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -379,14 +379,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] pub fn get_vr_displays(this: &Navigator) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "GamepadServiceTest")] - # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = requestGamepadServiceTest)] - #[doc = "The `requestGamepadServiceTest()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestGamepadServiceTest)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`, `Navigator`*"] - pub fn request_gamepad_service_test(this: &Navigator) -> GamepadServiceTest; # [wasm_bindgen (catch , method , structural , js_class = "Navigator" , js_name = requestMIDIAccess)] #[doc = "The `requestMIDIAccess()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index e9ba9d1a8d3..01a879dc969 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1914,6 +1914,50 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn set_onunload(this: &Window, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &Window) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &Window, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &Window) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected(this: &Window, value: Option<&::js_sys::Function>); #[cfg(feature = "Storage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = localStorage)] #[doc = "Getter for the `localStorage` field of this object."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index d37dbf057dc..6568633cec0 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2924,20 +2924,6 @@ mod gen_Gamepad; #[allow(unused_imports)] pub use gen_Gamepad::*; -#[cfg(feature = "GamepadAxisMoveEvent")] -#[allow(non_snake_case)] -mod gen_GamepadAxisMoveEvent; -#[cfg(feature = "GamepadAxisMoveEvent")] -#[allow(unused_imports)] -pub use gen_GamepadAxisMoveEvent::*; - -#[cfg(feature = "GamepadAxisMoveEventInit")] -#[allow(non_snake_case)] -mod gen_GamepadAxisMoveEventInit; -#[cfg(feature = "GamepadAxisMoveEventInit")] -#[allow(unused_imports)] -pub use gen_GamepadAxisMoveEventInit::*; - #[cfg(feature = "GamepadButton")] #[allow(non_snake_case)] mod gen_GamepadButton; @@ -2945,19 +2931,12 @@ mod gen_GamepadButton; #[allow(unused_imports)] pub use gen_GamepadButton::*; -#[cfg(feature = "GamepadButtonEvent")] +#[cfg(feature = "GamepadEffectParameters")] #[allow(non_snake_case)] -mod gen_GamepadButtonEvent; -#[cfg(feature = "GamepadButtonEvent")] +mod gen_GamepadEffectParameters; +#[cfg(feature = "GamepadEffectParameters")] #[allow(unused_imports)] -pub use gen_GamepadButtonEvent::*; - -#[cfg(feature = "GamepadButtonEventInit")] -#[allow(non_snake_case)] -mod gen_GamepadButtonEventInit; -#[cfg(feature = "GamepadButtonEventInit")] -#[allow(unused_imports)] -pub use gen_GamepadButtonEventInit::*; +pub use gen_GamepadEffectParameters::*; #[cfg(feature = "GamepadEvent")] #[allow(non_snake_case)] @@ -2994,6 +2973,20 @@ mod gen_GamepadHapticActuatorType; #[allow(unused_imports)] pub use gen_GamepadHapticActuatorType::*; +#[cfg(feature = "GamepadHapticEffectType")] +#[allow(non_snake_case)] +mod gen_GamepadHapticEffectType; +#[cfg(feature = "GamepadHapticEffectType")] +#[allow(unused_imports)] +pub use gen_GamepadHapticEffectType::*; + +#[cfg(feature = "GamepadHapticsResult")] +#[allow(non_snake_case)] +mod gen_GamepadHapticsResult; +#[cfg(feature = "GamepadHapticsResult")] +#[allow(unused_imports)] +pub use gen_GamepadHapticsResult::*; + #[cfg(feature = "GamepadMappingType")] #[allow(non_snake_case)] mod gen_GamepadMappingType; @@ -3008,12 +3001,12 @@ mod gen_GamepadPose; #[allow(unused_imports)] pub use gen_GamepadPose::*; -#[cfg(feature = "GamepadServiceTest")] +#[cfg(feature = "GamepadTouch")] #[allow(non_snake_case)] -mod gen_GamepadServiceTest; -#[cfg(feature = "GamepadServiceTest")] +mod gen_GamepadTouch; +#[cfg(feature = "GamepadTouch")] #[allow(unused_imports)] -pub use gen_GamepadServiceTest::*; +pub use gen_GamepadTouch::*; #[cfg(feature = "Geolocation")] #[allow(non_snake_case)] diff --git a/crates/web-sys/webidls/enabled/Gamepad.webidl b/crates/web-sys/webidls/enabled/Gamepad.webidl index 480f9469663..9d2b711a90d 100644 --- a/crates/web-sys/webidls/enabled/Gamepad.webidl +++ b/crates/web-sys/webidls/enabled/Gamepad.webidl @@ -1,99 +1,57 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/ - * https://w3c.github.io/gamepad/extensions.html - * https://w3c.github.io/webvr/spec/1.1/#interface-gamepad - */ +// https://www.w3.org/TR/gamepad -[Pref="dom.gamepad.enabled"] -interface GamepadButton { - readonly attribute boolean pressed; - readonly attribute boolean touched; - readonly attribute double value; +[Exposed=Window] +interface Gamepad { + readonly attribute DOMString id; + // TODO: remove `unsigned` + readonly attribute unsigned long index; + readonly attribute boolean connected; + readonly attribute DOMHighResTimeStamp timestamp; + readonly attribute GamepadMappingType mapping; + readonly attribute FrozenArray axes; + readonly attribute FrozenArray buttons; + [RustDeprecated] + readonly attribute unsigned long displayId; }; -enum GamepadHand { - "", - "left", - "right" +[Exposed=Window] +interface GamepadButton { + readonly attribute boolean pressed; + readonly attribute boolean touched; + readonly attribute double value; }; enum GamepadMappingType { "", - "standard" + "standard", }; -[Pref="dom.gamepad.enabled"] -interface Gamepad { - /** - * An identifier, unique per type of device. - */ - readonly attribute DOMString id; - - /** - * The game port index for the device. Unique per device - * attached to this system. - */ - readonly attribute unsigned long index; - - /** - * The mapping in use for this device. The empty string - * indicates that no mapping is in use. - */ - readonly attribute GamepadMappingType mapping; - - /** - * The hand in use for this device. The empty string - * indicates that unknown, both hands, or not applicable - */ - [Pref="dom.gamepad.extensions.enabled"] - readonly attribute GamepadHand hand; - - /** - * The displayId in use for as an association point in the VRDisplay API - * to identify which VRDisplay that the gamepad is associated with. - */ - [Pref="dom.vr.enabled"] - readonly attribute unsigned long displayId; - - /** - * true if this gamepad is currently connected to the system. - */ - readonly attribute boolean connected; +interface GamepadHapticActuator { + [RustDeprecated] + readonly attribute GamepadHapticActuatorType type; +}; - /** - * The current state of all buttons on the device, an - * array of GamepadButton. - */ - [Pure, Cached, Frozen] - readonly attribute sequence buttons; +[RustDeprecated] +enum GamepadHapticActuatorType { + "vibration" +}; - /** - * The current position of all axes on the device, an - * array of doubles. - */ - [Pure, Cached, Frozen] - readonly attribute sequence axes; +[Exposed=Window] +partial interface Navigator { + [Throws] sequence getGamepads(); +}; - /** - * Timestamp from when the data of this device was last updated. - */ - readonly attribute DOMHighResTimeStamp timestamp; +[Exposed=Window] - /** - * The current pose of the device, a GamepadPose. - */ - [Pref="dom.gamepad.extensions.enabled"] - readonly attribute GamepadPose? pose; +interface GamepadEvent: Event { + // TODO: remove `optional` modifier on `eventInitDict` + constructor(DOMString type, optional GamepadEventInit eventInitDict); + // TODO: remove `?` modifier + [SameObject] readonly attribute Gamepad? gamepad; +}; - /** - * The current haptic actuator of the device, an array of - * GamepadHapticActuator. - */ - [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"] - readonly attribute sequence hapticActuators; +dictionary GamepadEventInit : EventInit { + // TODO: add `required` + // TODO: remove `?` modifier + Gamepad? gamepad; }; diff --git a/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl b/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl deleted file mode 100644 index 7699674b453..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.non_standard_events.enabled", - Constructor(DOMString type, optional GamepadAxisMoveEventInit eventInitDict)] -interface GamepadAxisMoveEvent : GamepadEvent -{ - readonly attribute unsigned long axis; - readonly attribute double value; -}; - -dictionary GamepadAxisMoveEventInit : GamepadEventInit -{ - unsigned long axis = 0; - double value = 0; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl b/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl deleted file mode 100644 index b8a9e086bfc..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.non_standard_events.enabled", - Constructor(DOMString type, optional GamepadButtonEventInit eventInitDict)] -interface GamepadButtonEvent : GamepadEvent -{ - readonly attribute unsigned long button; -}; - -dictionary GamepadButtonEventInit : GamepadEventInit -{ - unsigned long button = 0; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadEvent.webidl b/crates/web-sys/webidls/enabled/GamepadEvent.webidl deleted file mode 100644 index f4c3092ac1b..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.enabled", - Constructor(DOMString type, optional GamepadEventInit eventInitDict)] -interface GamepadEvent : Event -{ - readonly attribute Gamepad? gamepad; -}; - -dictionary GamepadEventInit : EventInit -{ - Gamepad? gamepad = null; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadExtensions.webidl b/crates/web-sys/webidls/enabled/GamepadExtensions.webidl new file mode 100644 index 00000000000..09806f65f5d --- /dev/null +++ b/crates/web-sys/webidls/enabled/GamepadExtensions.webidl @@ -0,0 +1,38 @@ +// https://w3c.github.io/gamepad/extensions.html + +enum GamepadHand { + "", /* unknown, both hands, or not applicable */ + "left", + "right" +}; + +[Exposed=Window] +interface GamepadPose { + readonly attribute boolean hasOrientation; + readonly attribute boolean hasPosition; + + [Throws] // TODO: remove + readonly attribute Float32Array? position; + [Throws] // TODO: remove + readonly attribute Float32Array? linearVelocity; + [Throws] // TODO: remove + readonly attribute Float32Array? linearAcceleration; + [Throws] // TODO: remove + readonly attribute Float32Array? orientation; + [Throws] // TODO: remove + readonly attribute Float32Array? angularVelocity; + [Throws] // TODO: remove + readonly attribute Float32Array? angularAcceleration; +}; + +partial interface Gamepad { + readonly attribute GamepadHand hand; + readonly attribute FrozenArray hapticActuators; + readonly attribute GamepadPose? pose; +}; + +[Exposed=Window] +partial interface GamepadHapticActuator { + [Throws] // TODO: remove + Promise pulse(double value, double duration); +}; diff --git a/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl b/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl deleted file mode 100644 index 9255debe34b..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuator-interface - */ - -enum GamepadHapticActuatorType { - "vibration" -}; - -[Pref="dom.gamepad.extensions.enabled", - HeaderFile="mozilla/dom/GamepadHapticActuator.h"] -interface GamepadHapticActuator -{ - readonly attribute GamepadHapticActuatorType type; - [Throws, NewObject] - Promise pulse(double value, double duration); -}; diff --git a/crates/web-sys/webidls/enabled/GamepadPose.webidl b/crates/web-sys/webidls/enabled/GamepadPose.webidl deleted file mode 100644 index 4bc2086984e..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadPose.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/extensions.html#gamepadpose-interface - */ - -[Pref="dom.gamepad.extensions.enabled"] -interface GamepadPose -{ - readonly attribute boolean hasOrientation; - readonly attribute boolean hasPosition; - - /** - * position, linearVelocity, and linearAcceleration are 3-component vectors. - * position is relative to a sitting space. Transforming this point with - * VRStageParameters.sittingToStandingTransform converts this to standing space. - */ - [Constant, Throws] readonly attribute Float32Array? position; - [Constant, Throws] readonly attribute Float32Array? linearVelocity; - [Constant, Throws] readonly attribute Float32Array? linearAcceleration; - - /* orientation is a 4-entry array representing the components of a quaternion. */ - [Constant, Throws] readonly attribute Float32Array? orientation; - /* angularVelocity and angularAcceleration are the components of 3-dimensional vectors. */ - [Constant, Throws] readonly attribute Float32Array? angularVelocity; - [Constant, Throws] readonly attribute Float32Array? angularAcceleration; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl b/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl deleted file mode 100644 index bebce4de19a..00000000000 --- a/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -[Pref="dom.gamepad.test.enabled"] -interface GamepadServiceTest -{ - readonly attribute GamepadMappingType noMapping; - readonly attribute GamepadMappingType standardMapping; - readonly attribute GamepadHand noHand; - readonly attribute GamepadHand leftHand; - readonly attribute GamepadHand rightHand; - - [Throws] - Promise addGamepad(DOMString id, - GamepadMappingType mapping, - GamepadHand hand, - unsigned long numButtons, - unsigned long numAxes, - unsigned long numHaptics); - - undefined removeGamepad(unsigned long index); - - undefined newButtonEvent(unsigned long index, - unsigned long button, - boolean pressed, - boolean touched); - - undefined newButtonValueEvent(unsigned long index, - unsigned long button, - boolean pressed, - boolean touched, - double value); - - undefined newAxisMoveEvent(unsigned long index, - unsigned long axis, - double value); - undefined newPoseMove(unsigned long index, - Float32Array? orient, - Float32Array? pos, - Float32Array? angVelocity, - Float32Array? angAcceleration, - Float32Array? linVelocity, - Float32Array? linAcceleration); -}; \ No newline at end of file diff --git a/crates/web-sys/webidls/enabled/Navigator.webidl b/crates/web-sys/webidls/enabled/Navigator.webidl index 0d116932b01..f6e67ebe1d8 100644 --- a/crates/web-sys/webidls/enabled/Navigator.webidl +++ b/crates/web-sys/webidls/enabled/Navigator.webidl @@ -153,16 +153,6 @@ partial interface Navigator { readonly attribute NetworkInformation connection; }; -// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension -partial interface Navigator { - [Throws, Pref="dom.gamepad.enabled"] - sequence getGamepads(); -}; -partial interface Navigator { - [Pref="dom.gamepad.test.enabled"] - GamepadServiceTest requestGamepadServiceTest(); -}; - partial interface Navigator { [Throws, Pref="dom.vr.enabled"] Promise> getVRDisplays(); diff --git a/crates/web-sys/webidls/unstable/Gamepad.webidl b/crates/web-sys/webidls/unstable/Gamepad.webidl new file mode 100644 index 00000000000..ac537ef5e46 --- /dev/null +++ b/crates/web-sys/webidls/unstable/Gamepad.webidl @@ -0,0 +1,44 @@ +// https://www.w3.org/TR/gamepad + +partial interface Gamepad { + [SameObject] readonly attribute GamepadHapticActuator vibrationActuator; +}; + +/* TODO: requires partial or extend support. +enum GamepadMappingType { + "xr-standard", +}; +*/ + +partial interface GamepadHapticActuator { + [SameObject] readonly attribute FrozenArray effects; + Promise playEffect( + GamepadHapticEffectType type, + optional GamepadEffectParameters params = {} + ); + Promise reset(); +}; + +enum GamepadHapticsResult { + "complete", + "preempted" +}; + +enum GamepadHapticEffectType { + "dual-rumble", + "trigger-rumble" +}; + +dictionary GamepadEffectParameters { + unsigned long long duration = 0; + unsigned long long startDelay = 0; + double strongMagnitude = 0.0; + double weakMagnitude = 0.0; + double leftTrigger = 0.0; + double rightTrigger = 0.0; +}; + +partial interface mixin WindowEventHandlers { + attribute EventHandler ongamepadconnected; + attribute EventHandler ongamepaddisconnected; +}; diff --git a/crates/web-sys/webidls/unstable/GamepadExtensions.webidl b/crates/web-sys/webidls/unstable/GamepadExtensions.webidl new file mode 100644 index 00000000000..d5c904671a9 --- /dev/null +++ b/crates/web-sys/webidls/unstable/GamepadExtensions.webidl @@ -0,0 +1,13 @@ +// https://w3c.github.io/gamepad/extensions.html + +[Exposed=Window, SecureContext] +interface GamepadTouch { + readonly attribute unsigned long touchId; + readonly attribute octet surfaceId; + readonly attribute Float32Array position; + readonly attribute Uint32Array? surfaceDimensions; +}; + +partial interface Gamepad { + readonly attribute FrozenArray? touchEvents; +}; From 7b4bb186fb7d02b4a14e12d69277202ddd4c6f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=85=E5=B8=83=E4=B8=81?= Date: Mon, 7 Oct 2024 17:03:44 +0800 Subject: [PATCH 494/641] Remove mutable `input` requirement on `TextDecoder.decode()` (#4141) --- CHANGELOG.md | 3 ++ crates/cli/tests/reference/raw.js | 48 +++++++++---------- .../web-sys/src/features/gen_TextDecoder.rs | 4 +- crates/webidl/src/constants.rs | 2 + 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57639df10ed..7ee3a7d10fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,9 @@ * Removed `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`, `GamepadButtonEvent`, `GamepadButtonEventInit` and `GamepadServiceTest`, which were seemingly never implemented by any JS environment. [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) +* Changed `TextDecoder.decode()` `input` parameter type from `&mut [u8]` to `&[u8]`. + [#4141](https://github.com/rustwasm/wasm-bindgen/pull/4141) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 3432d150366..6b831debb89 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -45,6 +25,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -110,11 +110,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/web-sys/src/features/gen_TextDecoder.rs b/crates/web-sys/src/features/gen_TextDecoder.rs index c1f55c93ad0..a8f4eb3f54e 100644 --- a/crates/web-sys/src/features/gen_TextDecoder.rs +++ b/crates/web-sys/src/features/gen_TextDecoder.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] - pub fn decode_with_u8_array(this: &TextDecoder, input: &mut [u8]) -> Result; + pub fn decode_with_u8_array(this: &TextDecoder, input: &[u8]) -> Result; #[cfg(feature = "TextDecodeOptions")] # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] @@ -96,7 +96,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`, `TextDecoder`*"] pub fn decode_with_u8_array_and_options( this: &TextDecoder, - input: &mut [u8], + input: &[u8], options: &TextDecodeOptions, ) -> Result; } diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 779e0d40f96..ad1de70a0fd 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -102,6 +102,8 @@ pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy "sign", "unwrapKey", "verify", + // TextDecoder + "decode", ]) }); From 6505bf494eab359a3d63aa714c9f91dbda251ffd Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 7 Oct 2024 11:36:56 +0200 Subject: [PATCH 495/641] Fixed enum variant name collisions with object prototype fields (#4137) - Fixed returning `Option` now correctly has the `| undefined` type in TS bindings. - Improve enum Wasm to JS conversion code. --- CHANGELOG.md | 6 ++ crates/cli-support/src/js/binding.rs | 105 ++++++++++--------------- crates/cli-support/src/wit/outgoing.rs | 2 +- crates/cli/tests/reference/enums.d.ts | 10 +++ crates/cli/tests/reference/enums.js | 18 +++++ crates/cli/tests/reference/enums.rs | 22 ++++++ crates/cli/tests/reference/enums.wat | 4 + 7 files changed, 104 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ee3a7d10fb..266ae464d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,12 @@ * Fixed emitted `package.json` structure to correctly specify its dependencies [#4091](https://github.com/rustwasm/wasm-bindgen/pull/4091) +* Fixed returning `Option` now correctly has the `| undefined` type in TS bindings. + [#4137](https://github.com/rustwasm/wasm-bindgen/pull/4137) + +* Fixed enum variant name collisions with object prototype fields. + [#4137](https://github.com/rustwasm/wasm-bindgen/pull/4137) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index f3d60ccbbd3..cef04592571 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -576,6 +576,40 @@ fn instruction( log_error: &mut bool, constructor: &Option, ) -> Result<(), Error> { + fn wasm_to_string_enum(variant_values: &[String], index: &str) -> String { + // e.g. ["a","b","c"][someIndex] + let mut enum_val_expr = String::new(); + enum_val_expr.push('['); + for variant in variant_values { + enum_val_expr.push_str(&format!("\"{variant}\",")); + } + enum_val_expr.push(']'); + enum_val_expr.push('['); + enum_val_expr.push_str(index); + enum_val_expr.push(']'); + enum_val_expr + } + fn string_enum_to_wasm(variant_values: &[String], invalid: u32, enum_val: &str) -> String { + // e.g. (["a","b","c"].indexOf(someEnumVal) + 1 || 4) - 1 + // | + // invalid + 1 + // + // The idea is that `indexOf` returns -1 if someEnumVal is invalid, + // and with +1 we get 0 which is falsey, so we can use || to + // substitute invalid+1. Finally, we just do -1 to get the correct + // values for everything. + let mut enum_val_expr = String::new(); + enum_val_expr.push_str("(["); + for variant in variant_values.iter() { + enum_val_expr.push_str(&format!("\"{variant}\",")); + } + enum_val_expr.push_str(&format!( + "].indexOf({enum_val}) + 1 || {invalid}) - 1", + invalid = invalid + 1 + )); + enum_val_expr + } + match instr { Instruction::ArgGet(n) => { let arg = js.arg(*n).to_string(); @@ -670,43 +704,15 @@ fn instruction( Instruction::WasmToStringEnum { variant_values } => { let index = js.pop(); - - // e.g. ["a","b","c"][someIndex] - let mut enum_val_expr = String::new(); - enum_val_expr.push('['); - for variant in variant_values { - enum_val_expr.push_str(&format!("\"{variant}\",")); - } - enum_val_expr.push(']'); - enum_val_expr.push('['); - enum_val_expr.push_str(&index); - enum_val_expr.push(']'); - - js.push(enum_val_expr) + js.push(wasm_to_string_enum(variant_values, &index)) } - Instruction::OptionWasmToStringEnum { - variant_values, - hole, - } => { + Instruction::OptionWasmToStringEnum { variant_values, .. } => { + // Since hole is currently variant_count+1 and the lookup is + // ["a","b","c"][index], the lookup will implicitly return map + // the hole to undefined, because OOB indexes will return undefined. let index = js.pop(); - - let mut enum_val_expr = String::new(); - enum_val_expr.push('['); - for variant in variant_values { - enum_val_expr.push_str(&format!("\"{variant}\",")); - } - enum_val_expr.push(']'); - enum_val_expr.push('['); - enum_val_expr.push_str(&index); - enum_val_expr.push(']'); - - // e.g. someIndex === 4 ? undefined : (["a","b","c"][someIndex]) - // | - // currently, hole = variant_count + 1 - js.push(format!( - "{index} === {hole} ? undefined : ({enum_val_expr})" - )) + js.push(wasm_to_string_enum(variant_values, &index)) } Instruction::StringEnumToWasm { @@ -714,22 +720,7 @@ fn instruction( invalid, } => { let enum_val = js.pop(); - - // e.g. {"a":0,"b":1,"c":2}[someEnumVal] ?? 3 - // | - // currently, invalid = variant_count - let mut enum_val_expr = String::new(); - enum_val_expr.push('{'); - for (i, variant) in variant_values.iter().enumerate() { - enum_val_expr.push_str(&format!("\"{variant}\":{i},")); - } - enum_val_expr.push('}'); - enum_val_expr.push('['); - enum_val_expr.push_str(&enum_val); - enum_val_expr.push(']'); - enum_val_expr.push_str(&format!(" ?? {invalid}")); - - js.push(enum_val_expr) + js.push(string_enum_to_wasm(variant_values, *invalid, &enum_val)) } Instruction::OptionStringEnumToWasm { @@ -738,19 +729,9 @@ fn instruction( hole, } => { let enum_val = js.pop(); + let enum_val_expr = string_enum_to_wasm(variant_values, *invalid, &enum_val); - let mut enum_val_expr = String::new(); - enum_val_expr.push('{'); - for (i, variant) in variant_values.iter().enumerate() { - enum_val_expr.push_str(&format!("\"{variant}\":{i},")); - } - enum_val_expr.push('}'); - enum_val_expr.push('['); - enum_val_expr.push_str(&enum_val); - enum_val_expr.push(']'); - enum_val_expr.push_str(&format!(" ?? {invalid}")); - - // e.g. someEnumVal == undefined ? 4 : ({"a":0,"b":1,"c":2}[someEnumVal] ?? 3) + // e.g. someEnumVal == undefined ? 4 : (string_enum_to_wasm(someEnumVal)) // | // double equals here in case it's null js.push(format!( diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index b79a7b68cc6..6bc647cf9c6 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -305,7 +305,7 @@ impl InstructionBuilder<'_, '_> { variant_values: variant_values.to_vec(), hole: *hole, }, - &[AdapterType::StringEnum(String::from(name))], + &[AdapterType::StringEnum(String::from(name)).option()], ); } Descriptor::RustStruct(name) => { diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 14d117668b7..1ffd4249837 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -11,6 +11,16 @@ export function enum_echo(color: Color): Color; */ export function option_enum_echo(color?: Color): Color | undefined; /** +* @param {Color} color +* @returns {ColorName} +*/ +export function get_name(color: Color): ColorName; +/** +* @param {ColorName | undefined} [color] +* @returns {ColorName | undefined} +*/ +export function option_string_enum_echo(color?: ColorName): ColorName | undefined; +/** */ export enum Color { Green = 0, diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index c7446efaa24..07d1cf32427 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -44,6 +44,24 @@ export function option_enum_echo(color) { return ret === 3 ? undefined : ret; } +/** +* @param {Color} color +* @returns {ColorName} +*/ +export function get_name(color) { + const ret = wasm.get_name(color); + return ["green","yellow","red",][ret]; +} + +/** +* @param {ColorName | undefined} [color] +* @returns {ColorName | undefined} +*/ +export function option_string_enum_echo(color) { + const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((["green","yellow","red",].indexOf(color) + 1 || 4) - 1)); + return ["green","yellow","red",][ret]; +} + /** */ export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index 48a58d455ca..e4cc8e9794c 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -17,3 +17,25 @@ pub fn enum_echo(color: Color) -> Color { pub fn option_enum_echo(color: Option) -> Option { color } + +#[wasm_bindgen] +#[derive(PartialEq, Debug)] +pub enum ColorName { + Green = "green", + Yellow = "yellow", + Red = "red", +} + +#[wasm_bindgen] +pub fn get_name(color: Color) -> ColorName { + match color { + Color::Red => ColorName::Red, + Color::Green => ColorName::Green, + Color::Yellow => ColorName::Yellow, + } +} + +#[wasm_bindgen] +pub fn option_string_enum_echo(color: Option) -> Option { + color +} diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index 4c9fd212451..479c1c3ec89 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -2,10 +2,14 @@ (type (;0;) (func (param i32) (result i32))) (func $enum_echo (;0;) (type 0) (param i32) (result i32)) (func $option_enum_echo (;1;) (type 0) (param i32) (result i32)) + (func $get_name (;2;) (type 0) (param i32) (result i32)) + (func $option_string_enum_echo (;3;) (type 0) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "enum_echo" (func $enum_echo)) (export "option_enum_echo" (func $option_enum_echo)) + (export "get_name" (func $get_name)) + (export "option_string_enum_echo" (func $option_string_enum_echo)) (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) From c1acd31a57a7ba1fb258d47ccde30fb2fb812d83 Mon Sep 17 00:00:00 2001 From: Ryan Crisanti Date: Mon, 7 Oct 2024 05:40:10 -0400 Subject: [PATCH 496/641] Add `Debug` implementation to `JsError` (#4136) --- CHANGELOG.md | 3 +++ src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 266ae464d33..5792f38fbc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ * Added bindings for the draft [WebRTC Encoded Transform](https://www.w3.org/TR/webrtc-encoded-transform) spec. [#4125](https://github.com/rustwasm/wasm-bindgen/pull/4125) +* Added `Debug` implementation to `JsError`. + [#4136](https://github.com/rustwasm/wasm-bindgen/pull/4136) + ### Changed * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. diff --git a/src/lib.rs b/src/lib.rs index aa1e7c897f1..6c6961cf942 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2160,7 +2160,7 @@ impl DerefMut for Clamped { /// } /// /// ``` -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct JsError { value: JsValue, } From 98c5e0bac1b1ad82f78b703aba2b071620bd4994 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 7 Oct 2024 12:01:16 +0200 Subject: [PATCH 497/641] Fix multiline doc comment alignment and remove empty ones entirely (#4135) --- CHANGELOG.md | 3 + crates/cli-support/src/js/mod.rs | 19 +++-- crates/cli-support/src/lib.rs | 11 ++- crates/cli/tests/reference/add.d.ts | 16 ++--- crates/cli/tests/reference/add.js | 16 ++--- .../tests/reference/anyref-import-catch.d.ts | 2 - .../tests/reference/anyref-import-catch.js | 3 +- crates/cli/tests/reference/anyref-nop.d.ts | 2 - crates/cli/tests/reference/anyref-nop.js | 3 +- crates/cli/tests/reference/async-number.d.ts | 4 +- crates/cli/tests/reference/async-void.d.ts | 4 +- crates/cli/tests/reference/builder.d.ts | 8 +-- crates/cli/tests/reference/builder.js | 7 +- crates/cli/tests/reference/constructor.d.ts | 4 -- crates/cli/tests/reference/constructor.js | 5 +- crates/cli/tests/reference/enums.d.ts | 26 ++++--- crates/cli/tests/reference/enums.js | 26 ++++--- crates/cli/tests/reference/import-catch.d.ts | 2 - crates/cli/tests/reference/import-catch.js | 3 +- crates/cli/tests/reference/nop.d.ts | 2 - crates/cli/tests/reference/nop.js | 3 +- crates/cli/tests/reference/pointers.d.ts | 12 ++-- crates/cli/tests/reference/pointers.js | 12 ++-- crates/cli/tests/reference/raw.d.ts | 22 +++--- crates/cli/tests/reference/raw.js | 69 +++++++++---------- crates/cli/tests/reference/result-string.d.ts | 4 +- crates/cli/tests/reference/result-string.js | 4 +- crates/cli/tests/reference/skip-jsdoc.d.ts | 10 +-- crates/cli/tests/reference/skip-jsdoc.js | 10 +-- crates/cli/tests/reference/string-arg.d.ts | 4 +- crates/cli/tests/reference/string-arg.js | 4 +- 31 files changed, 156 insertions(+), 164 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5792f38fbc7..f1dde9c0803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,9 @@ * Fixed enum variant name collisions with object prototype fields. [#4137](https://github.com/rustwasm/wasm-bindgen/pull/4137) +* Fixed multiline doc comment alignment and remove empty ones entirely. + [#4135](https://github.com/rustwasm/wasm-bindgen/pull/4135) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index b053bbd526c..b7523e6089e 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -4126,18 +4126,23 @@ fn check_duplicated_getter_and_setter_names( fn format_doc_comments(comments: &str, js_doc_comments: Option) -> String { let body: String = comments.lines().fold(String::new(), |mut output, c| { - let _ = writeln!(output, "*{}", c); + let _ = writeln!(output, " *{}", c); output }); let doc = if let Some(docs) = js_doc_comments { docs.lines().fold(String::new(), |mut output: String, l| { - let _ = writeln!(output, "* {}", l); + let _ = writeln!(output, " * {}", l); output }) } else { String::new() }; - format!("/**\n{}{}*/\n", body, doc) + if body.is_empty() && doc.is_empty() { + // don't emit empty doc comments + String::new() + } else { + format!("/**\n{}{} */\n", body, doc) + } } fn require_class<'a>( @@ -4222,7 +4227,13 @@ impl ExportedClass { self.contents.push_str(js); self.contents.push('\n'); if let Some(ts) = ts { - self.typescript.push_str(docs); + if !docs.is_empty() { + for line in docs.lines() { + self.typescript.push_str(" "); + self.typescript.push_str(line); + self.typescript.push('\n'); + } + } self.typescript.push_str(" "); self.typescript.push_str(function_prefix); self.typescript.push_str(function_name); diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 8c49ddbc1a6..bd47dfc43b0 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -492,9 +492,13 @@ fn reset_indentation(s: &str) -> String { let mut indent: u32 = 0; let mut dst = String::new(); + fn is_doc_comment(line: &str) -> bool { + line.starts_with("*") + } + for line in s.lines() { let line = line.trim(); - if line.starts_with('}') || (line.ends_with('}') && !line.starts_with('*')) { + if line.starts_with('}') || (line.ends_with('}') && !is_doc_comment(line)) { indent = indent.saturating_sub(1); } let extra = if line.starts_with(':') || line.starts_with('?') { @@ -506,11 +510,14 @@ fn reset_indentation(s: &str) -> String { for _ in 0..indent + extra { dst.push_str(" "); } + if is_doc_comment(line) { + dst.push(' '); + } dst.push_str(line); } dst.push('\n'); // Ignore { inside of comments and if it's an exported enum - if line.ends_with('{') && !line.starts_with('*') && !line.ends_with("Object.freeze({") { + if line.ends_with('{') && !is_doc_comment(line) && !line.ends_with("Object.freeze({") { indent += 1; } } diff --git a/crates/cli/tests/reference/add.d.ts b/crates/cli/tests/reference/add.d.ts index a8ee5f2e475..73827342908 100644 --- a/crates/cli/tests/reference/add.d.ts +++ b/crates/cli/tests/reference/add.d.ts @@ -1,14 +1,14 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {number} a -* @param {number} b -* @returns {number} -*/ + * @param {number} a + * @param {number} b + * @returns {number} + */ export function add_u32(a: number, b: number): number; /** -* @param {number} a -* @param {number} b -* @returns {number} -*/ + * @param {number} a + * @param {number} b + * @returns {number} + */ export function add_i32(a: number, b: number): number; diff --git a/crates/cli/tests/reference/add.js b/crates/cli/tests/reference/add.js index 4828d396ae5..51914d7d296 100644 --- a/crates/cli/tests/reference/add.js +++ b/crates/cli/tests/reference/add.js @@ -4,20 +4,20 @@ export function __wbg_set_wasm(val) { } /** -* @param {number} a -* @param {number} b -* @returns {number} -*/ + * @param {number} a + * @param {number} b + * @returns {number} + */ export function add_u32(a, b) { const ret = wasm.add_u32(a, b); return ret >>> 0; } /** -* @param {number} a -* @param {number} b -* @returns {number} -*/ + * @param {number} a + * @param {number} b + * @returns {number} + */ export function add_i32(a, b) { const ret = wasm.add_i32(a, b); return ret; diff --git a/crates/cli/tests/reference/anyref-import-catch.d.ts b/crates/cli/tests/reference/anyref-import-catch.d.ts index 3e2ffc07207..091dbcc51a6 100644 --- a/crates/cli/tests/reference/anyref-import-catch.d.ts +++ b/crates/cli/tests/reference/anyref-import-catch.d.ts @@ -1,5 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export function exported(): void; diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index 9fb5c31b135..d89f629f896 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -53,8 +53,7 @@ function takeFromExternrefTable0(idx) { wasm.__externref_table_dealloc(idx); return value; } -/** -*/ + export function exported() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); diff --git a/crates/cli/tests/reference/anyref-nop.d.ts b/crates/cli/tests/reference/anyref-nop.d.ts index b9f9648536e..b7f28e8f7af 100644 --- a/crates/cli/tests/reference/anyref-nop.d.ts +++ b/crates/cli/tests/reference/anyref-nop.d.ts @@ -1,5 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export function foo(): void; diff --git a/crates/cli/tests/reference/anyref-nop.js b/crates/cli/tests/reference/anyref-nop.js index 236d93eaf93..48574501fbc 100644 --- a/crates/cli/tests/reference/anyref-nop.js +++ b/crates/cli/tests/reference/anyref-nop.js @@ -3,8 +3,7 @@ export function __wbg_set_wasm(val) { wasm = val; } -/** -*/ + export function foo() { wasm.foo(); } diff --git a/crates/cli/tests/reference/async-number.d.ts b/crates/cli/tests/reference/async-number.d.ts index d7204543623..bc2b7e88a3c 100644 --- a/crates/cli/tests/reference/async-number.d.ts +++ b/crates/cli/tests/reference/async-number.d.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ /** -* @returns {Promise} -*/ + * @returns {Promise} + */ export function foo(): Promise; diff --git a/crates/cli/tests/reference/async-void.d.ts b/crates/cli/tests/reference/async-void.d.ts index 83335802b7e..b5b19290f13 100644 --- a/crates/cli/tests/reference/async-void.d.ts +++ b/crates/cli/tests/reference/async-void.d.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ /** -* @returns {Promise} -*/ + * @returns {Promise} + */ export function foo(): Promise; diff --git a/crates/cli/tests/reference/builder.d.ts b/crates/cli/tests/reference/builder.d.ts index ede348c9632..3a92bacdb43 100644 --- a/crates/cli/tests/reference/builder.d.ts +++ b/crates/cli/tests/reference/builder.d.ts @@ -1,11 +1,9 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export class ClassBuilder { free(): void; -/** -* @returns {ClassBuilder} -*/ + /** + * @returns {ClassBuilder} + */ static builder(): ClassBuilder; } diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js index b491793222a..1781b4dbe06 100644 --- a/crates/cli/tests/reference/builder.js +++ b/crates/cli/tests/reference/builder.js @@ -27,8 +27,7 @@ function getStringFromWasm0(ptr, len) { const ClassBuilderFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_classbuilder_free(ptr >>> 0, 1)); -/** -*/ + export class ClassBuilder { static __wrap(ptr) { @@ -51,8 +50,8 @@ export class ClassBuilder { wasm.__wbg_classbuilder_free(ptr, 0); } /** - * @returns {ClassBuilder} - */ + * @returns {ClassBuilder} + */ static builder() { const ret = wasm.classbuilder_builder(); return ClassBuilder.__wrap(ret); diff --git a/crates/cli/tests/reference/constructor.d.ts b/crates/cli/tests/reference/constructor.d.ts index f35e8c72fa1..f2ac36f4b25 100644 --- a/crates/cli/tests/reference/constructor.d.ts +++ b/crates/cli/tests/reference/constructor.d.ts @@ -1,10 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export class ClassConstructor { free(): void; -/** -*/ constructor(); } diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js index ffac02b997a..e55a1e9e9bf 100644 --- a/crates/cli/tests/reference/constructor.js +++ b/crates/cli/tests/reference/constructor.js @@ -27,8 +27,7 @@ function getStringFromWasm0(ptr, len) { const ClassConstructorFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_classconstructor_free(ptr >>> 0, 1)); -/** -*/ + export class ClassConstructor { __destroy_into_raw() { @@ -42,8 +41,6 @@ export class ClassConstructor { const ptr = this.__destroy_into_raw(); wasm.__wbg_classconstructor_free(ptr, 0); } - /** - */ constructor() { const ret = wasm.classconstructor_new(); this.__wbg_ptr = ret >>> 0; diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 1ffd4249837..556f8085651 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -1,27 +1,25 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {Color} color -* @returns {Color} -*/ + * @param {Color} color + * @returns {Color} + */ export function enum_echo(color: Color): Color; /** -* @param {Color | undefined} [color] -* @returns {Color | undefined} -*/ + * @param {Color | undefined} [color] + * @returns {Color | undefined} + */ export function option_enum_echo(color?: Color): Color | undefined; /** -* @param {Color} color -* @returns {ColorName} -*/ + * @param {Color} color + * @returns {ColorName} + */ export function get_name(color: Color): ColorName; /** -* @param {ColorName | undefined} [color] -* @returns {ColorName | undefined} -*/ + * @param {ColorName | undefined} [color] + * @returns {ColorName | undefined} + */ export function option_string_enum_echo(color?: ColorName): ColorName | undefined; -/** -*/ export enum Color { Green = 0, Yellow = 1, diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 07d1cf32427..bbfdc2c5859 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -24,9 +24,9 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } /** -* @param {Color} color -* @returns {Color} -*/ + * @param {Color} color + * @returns {Color} + */ export function enum_echo(color) { const ret = wasm.enum_echo(color); return ret; @@ -36,34 +36,32 @@ function isLikeNone(x) { return x === undefined || x === null; } /** -* @param {Color | undefined} [color] -* @returns {Color | undefined} -*/ + * @param {Color | undefined} [color] + * @returns {Color | undefined} + */ export function option_enum_echo(color) { const ret = wasm.option_enum_echo(isLikeNone(color) ? 3 : color); return ret === 3 ? undefined : ret; } /** -* @param {Color} color -* @returns {ColorName} -*/ + * @param {Color} color + * @returns {ColorName} + */ export function get_name(color) { const ret = wasm.get_name(color); return ["green","yellow","red",][ret]; } /** -* @param {ColorName | undefined} [color] -* @returns {ColorName | undefined} -*/ + * @param {ColorName | undefined} [color] + * @returns {ColorName | undefined} + */ export function option_string_enum_echo(color) { const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((["green","yellow","red",].indexOf(color) + 1 || 4) - 1)); return ["green","yellow","red",][ret]; } -/** -*/ export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); export function __wbindgen_throw(arg0, arg1) { diff --git a/crates/cli/tests/reference/import-catch.d.ts b/crates/cli/tests/reference/import-catch.d.ts index 3e2ffc07207..091dbcc51a6 100644 --- a/crates/cli/tests/reference/import-catch.d.ts +++ b/crates/cli/tests/reference/import-catch.d.ts @@ -1,5 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export function exported(): void; diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index ad340f07bbd..4c4d0284851 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -49,8 +49,7 @@ function takeObject(idx) { dropObject(idx); return ret; } -/** -*/ + export function exported() { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); diff --git a/crates/cli/tests/reference/nop.d.ts b/crates/cli/tests/reference/nop.d.ts index c285bc0f2f6..be1200f247d 100644 --- a/crates/cli/tests/reference/nop.d.ts +++ b/crates/cli/tests/reference/nop.d.ts @@ -1,5 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** -*/ export function nop(): void; diff --git a/crates/cli/tests/reference/nop.js b/crates/cli/tests/reference/nop.js index 86488ff66d1..7369fb615be 100644 --- a/crates/cli/tests/reference/nop.js +++ b/crates/cli/tests/reference/nop.js @@ -3,8 +3,7 @@ export function __wbg_set_wasm(val) { wasm = val; } -/** -*/ + export function nop() { wasm.nop(); } diff --git a/crates/cli/tests/reference/pointers.d.ts b/crates/cli/tests/reference/pointers.d.ts index 2ce096435b5..145577b8753 100644 --- a/crates/cli/tests/reference/pointers.d.ts +++ b/crates/cli/tests/reference/pointers.d.ts @@ -1,12 +1,12 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {number} input -* @returns {number} -*/ + * @param {number} input + * @returns {number} + */ export function const_pointer(input: number): number; /** -* @param {number} input -* @returns {number} -*/ + * @param {number} input + * @returns {number} + */ export function mut_pointer(input: number): number; diff --git a/crates/cli/tests/reference/pointers.js b/crates/cli/tests/reference/pointers.js index cf088c2e711..45fb0349a22 100644 --- a/crates/cli/tests/reference/pointers.js +++ b/crates/cli/tests/reference/pointers.js @@ -4,18 +4,18 @@ export function __wbg_set_wasm(val) { } /** -* @param {number} input -* @returns {number} -*/ + * @param {number} input + * @returns {number} + */ export function const_pointer(input) { const ret = wasm.const_pointer(input); return ret >>> 0; } /** -* @param {number} input -* @returns {number} -*/ + * @param {number} input + * @returns {number} + */ export function mut_pointer(input) { const ret = wasm.mut_pointer(input); return ret >>> 0; diff --git a/crates/cli/tests/reference/raw.d.ts b/crates/cli/tests/reference/raw.d.ts index 944af97ab04..fb474c2fabd 100644 --- a/crates/cli/tests/reference/raw.d.ts +++ b/crates/cli/tests/reference/raw.d.ts @@ -1,21 +1,19 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {number} test -* @returns {number} -*/ + * @param {number} test + * @returns {number} + */ export function test1(test: number): number; -/** -*/ export class Test { free(): void; -/** -* @param {number} test -* @returns {Test} -*/ + /** + * @param {number} test + * @returns {Test} + */ static test1(test: number): Test; -/** -* @param {number} test -*/ + /** + * @param {number} test + */ test2(test: number): void; } diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6b831debb89..65e2bdccd73 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -45,10 +25,30 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} /** -* @param {number} test -* @returns {number} -*/ + * @param {number} test + * @returns {number} + */ export function test1(test) { const ret = wasm.test1(test); return ret >>> 0; @@ -66,8 +66,7 @@ function addHeapObject(obj) { const TestFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_test_free(ptr >>> 0, 1)); -/** -*/ + export class Test { static __wrap(ptr) { @@ -90,26 +89,21 @@ export class Test { wasm.__wbg_test_free(ptr, 0); } /** - * @param {number} test - * @returns {Test} - */ + * @param {number} test + * @returns {Test} + */ static test1(test) { const ret = wasm.test_test1(test); return Test.__wrap(ret); } /** - * @param {number} test - */ + * @param {number} test + */ test2(test) { wasm.test_test2(this.__wbg_ptr, test); } } -export function __wbg_test2_39fe629b9aa739cf() { - const ret = test2(); - return addHeapObject(ret); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; @@ -118,3 +112,8 @@ export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +export function __wbg_test2_39fe629b9aa739cf() { + const ret = test2(); + return addHeapObject(ret); +}; + diff --git a/crates/cli/tests/reference/result-string.d.ts b/crates/cli/tests/reference/result-string.d.ts index 50967eed5cf..2e707cffa43 100644 --- a/crates/cli/tests/reference/result-string.d.ts +++ b/crates/cli/tests/reference/result-string.d.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ /** -* @returns {string} -*/ + * @returns {string} + */ export function exported(): string; diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index 6d3c47f400b..caa17738225 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -62,8 +62,8 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } /** -* @returns {string} -*/ + * @returns {string} + */ export function exported() { let deferred2_0; let deferred2_1; diff --git a/crates/cli/tests/reference/skip-jsdoc.d.ts b/crates/cli/tests/reference/skip-jsdoc.d.ts index dda14e231eb..f295e357377 100644 --- a/crates/cli/tests/reference/skip-jsdoc.d.ts +++ b/crates/cli/tests/reference/skip-jsdoc.d.ts @@ -1,9 +1,9 @@ /* tslint:disable */ /* eslint-disable */ /** -* Manually documented function -* -* @param {number} arg - This is my arg. It is mine. -* @returns to whence I came -*/ + * Manually documented function + * + * @param {number} arg - This is my arg. It is mine. + * @returns to whence I came + */ export function docme(arg: number): number; diff --git a/crates/cli/tests/reference/skip-jsdoc.js b/crates/cli/tests/reference/skip-jsdoc.js index a617a8f3098..66a9f7870d1 100644 --- a/crates/cli/tests/reference/skip-jsdoc.js +++ b/crates/cli/tests/reference/skip-jsdoc.js @@ -4,11 +4,11 @@ export function __wbg_set_wasm(val) { } /** -* Manually documented function -* -* @param {number} arg - This is my arg. It is mine. -* @returns to whence I came -*/ + * Manually documented function + * + * @param {number} arg - This is my arg. It is mine. + * @returns to whence I came + */ export function docme(arg) { const ret = wasm.docme(arg); return ret >>> 0; diff --git a/crates/cli/tests/reference/string-arg.d.ts b/crates/cli/tests/reference/string-arg.d.ts index 701afc6b2d4..d103e1337e1 100644 --- a/crates/cli/tests/reference/string-arg.d.ts +++ b/crates/cli/tests/reference/string-arg.d.ts @@ -1,6 +1,6 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {string} a -*/ + * @param {string} a + */ export function foo(a: string): void; diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index 62d6ce47201..cc037461669 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -82,8 +82,8 @@ function passStringToWasm0(arg, malloc, realloc) { return ptr; } /** -* @param {string} a -*/ + * @param {string} a + */ export function foo(a) { const ptr0 = passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; From e6e098d78701b51b9f43900fd656d5b6290d3a07 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 8 Oct 2024 11:58:20 +0200 Subject: [PATCH 498/641] Update WebGPU API to draft 2024-10-07 (#4145) --- CHANGELOG.md | 3 +++ crates/cli/tests/reference/raw.js | 10 ++++---- crates/web-sys/src/features/gen_GpuAdapter.rs | 12 ---------- .../src/features/gen_GpuCanvasContext.rs | 12 ++++++++++ crates/web-sys/src/features/gen_GpuDevice.rs | 4 ++-- .../src/features/gen_GpuFeatureName.rs | 1 + .../features/gen_GpuRequestAdapterOptions.rs | 24 +++++++++++++++++++ .../features/gen_GpuShaderModuleDescriptor.rs | 24 ------------------- .../src/features/gen_GpuSupportedLimits.rs | 11 --------- .../features/gen_GpuTextureViewDescriptor.rs | 24 +++++++++++++++++++ crates/web-sys/webidls/unstable/WebGPU.webidl | 15 ++++++------ 11 files changed, 79 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1dde9c0803..2d143880df3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ * Changed `TextDecoder.decode()` `input` parameter type from `&mut [u8]` to `&[u8]`. [#4141](https://github.com/rustwasm/wasm-bindgen/pull/4141) +* Updated the WebGPU API to the current draft as of 2024-10-07. + [#4145](https://github.com/rustwasm/wasm-bindgen/pull/4145) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 65e2bdccd73..6c6e36065ee 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -104,16 +104,16 @@ export class Test { } } -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); +export function __wbg_test2_39fe629b9aa739cf() { + const ret = test2(); + return addHeapObject(ret); }; export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; -export function __wbg_test2_39fe629b9aa739cf() { - const ret = test2(); - return addHeapObject(ret); +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); }; diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 53ac082e5b9..f9cc0511177 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -64,18 +64,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn is_fallback_adapter(this: &GpuAdapter) -> bool; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)] - #[doc = "The `requestAdapterInfo()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - #[deprecated] - pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCanvasContext.rs b/crates/web-sys/src/features/gen_GpuCanvasContext.rs index 11b819b44c7..232fb7fe5b8 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasContext.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasContext.rs @@ -43,6 +43,18 @@ extern "C" { configuration: &GpuCanvasConfiguration, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuCanvasConfiguration")] + # [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getConfiguration)] + #[doc = "The `getConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasContext`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_configuration(this: &GpuCanvasContext) -> Option; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] # [wasm_bindgen (catch , method , structural , js_class = "GPUCanvasContext" , js_name = getCurrentTexture)] #[doc = "The `getCurrentTexture()` method."] diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 0a06252b1d2..382f67eaceb 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -320,7 +320,7 @@ extern "C" { ) -> GpuSampler; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuShaderModule", feature = "GpuShaderModuleDescriptor",))] - # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createShaderModule)] + # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createShaderModule)] #[doc = "The `createShaderModule()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createShaderModule)"] @@ -332,7 +332,7 @@ extern "C" { pub fn create_shader_module( this: &GpuDevice, descriptor: &GpuShaderModuleDescriptor, - ) -> Result; + ) -> GpuShaderModule; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuTexture", feature = "GpuTextureDescriptor",))] # [wasm_bindgen (catch , method , structural , js_class = "GPUDevice" , js_name = createTexture)] diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index 82603e3f165..4f30f43434c 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -17,6 +17,7 @@ pub enum GpuFeatureName { TextureCompressionBcSliced3d = "texture-compression-bc-sliced-3d", TextureCompressionEtc2 = "texture-compression-etc2", TextureCompressionAstc = "texture-compression-astc", + TextureCompressionAstcSliced3d = "texture-compression-astc-sliced-3d", TimestampQuery = "timestamp-query", IndirectFirstInstance = "indirect-first-instance", ShaderF16 = "shader-f16", diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index 6fe27f97fb8..68627083d06 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -15,6 +15,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type GpuRequestAdapterOptions; #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `featureLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "featureLevel")] + pub fn get_feature_level(this: &GpuRequestAdapterOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `featureLevel` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "featureLevel")] + pub fn set_feature_level(this: &GpuRequestAdapterOptions, val: &str); + #[cfg(web_sys_unstable_apis)] #[doc = "Get the `forceFallbackAdapter` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] @@ -67,6 +85,12 @@ impl GpuRequestAdapterOptions { ret } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_feature_level()` instead."] + pub fn feature_level(&mut self, val: &str) -> &mut Self { + self.set_feature_level(val); + self + } + #[cfg(web_sys_unstable_apis)] #[deprecated = "Use `set_force_fallback_adapter()` instead."] pub fn force_fallback_adapter(&mut self, val: bool) -> &mut Self { self.set_force_fallback_adapter(val); diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index 69c2204e7a9..b1fc639181b 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -68,24 +68,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "compilationHints")] pub fn set_compilation_hints(this: &GpuShaderModuleDescriptor, val: &::wasm_bindgen::JsValue); - #[cfg(web_sys_unstable_apis)] - #[doc = "Get the `sourceMap` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - #[wasm_bindgen(method, getter = "sourceMap")] - pub fn get_source_map(this: &GpuShaderModuleDescriptor) -> Option<::js_sys::Object>; - #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `sourceMap` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - #[wasm_bindgen(method, setter = "sourceMap")] - pub fn set_source_map(this: &GpuShaderModuleDescriptor, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] impl GpuShaderModuleDescriptor { @@ -119,10 +101,4 @@ impl GpuShaderModuleDescriptor { self.set_compilation_hints(val); self } - #[cfg(web_sys_unstable_apis)] - #[deprecated = "Use `set_source_map()` instead."] - pub fn source_map(&mut self, val: &::js_sys::Object) -> &mut Self { - self.set_source_map(val); - self - } } diff --git a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs index be5a6e02cab..14ecf5c115a 100644 --- a/crates/web-sys/src/features/gen_GpuSupportedLimits.rs +++ b/crates/web-sys/src/features/gen_GpuSupportedLimits.rs @@ -259,17 +259,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn max_vertex_buffer_array_stride(this: &GpuSupportedLimits) -> u32; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxInterStageShaderComponents)] - #[doc = "Getter for the `maxInterStageShaderComponents` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUSupportedLimits/maxInterStageShaderComponents)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuSupportedLimits`*"] - #[doc = ""] - #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] - #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn max_inter_stage_shader_components(this: &GpuSupportedLimits) -> u32; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUSupportedLimits" , js_name = maxInterStageShaderVariables)] #[doc = "Getter for the `maxInterStageShaderVariables` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs index 2a2b4014f45..a618b9b2f96 100644 --- a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs @@ -164,6 +164,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mipLevelCount")] pub fn set_mip_level_count(this: &GpuTextureViewDescriptor, val: u32); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "usage")] + pub fn get_usage(this: &GpuTextureViewDescriptor) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `usage` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureViewDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "usage")] + pub fn set_usage(this: &GpuTextureViewDescriptor, val: u32); } #[cfg(web_sys_unstable_apis)] impl GpuTextureViewDescriptor { @@ -229,6 +247,12 @@ impl GpuTextureViewDescriptor { self.set_mip_level_count(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_usage()` instead."] + pub fn usage(&mut self, val: u32) -> &mut Self { + self.set_usage(val); + self + } } #[cfg(web_sys_unstable_apis)] impl Default for GpuTextureViewDescriptor { diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 96fa115992e..c5b6912b231 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -1,3 +1,5 @@ +// https://www.w3.org/TR/2024/WD-webgpu-20241007 + interface mixin GPUObjectBase { attribute USVString label; }; @@ -30,7 +32,6 @@ interface GPUSupportedLimits { readonly attribute unsigned long long maxBufferSize; readonly attribute unsigned long maxVertexAttributes; readonly attribute unsigned long maxVertexBufferArrayStride; - readonly attribute unsigned long maxInterStageShaderComponents; readonly attribute unsigned long maxInterStageShaderVariables; readonly attribute unsigned long maxColorAttachments; readonly attribute unsigned long maxColorAttachmentBytesPerSample; @@ -74,6 +75,7 @@ interface GPU { }; dictionary GPURequestAdapterOptions { + DOMString featureLevel; GPUPowerPreference powerPreference; boolean forceFallbackAdapter = false; }; @@ -91,14 +93,12 @@ interface GPUAdapter { readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); - [RustDeprecated] - Promise requestAdapterInfo(); }; dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { sequence requiredFeatures = []; - record requiredLimits = {}; + record requiredLimits = {}; GPUQueueDescriptor defaultQueue = {}; }; @@ -109,6 +109,7 @@ enum GPUFeatureName { "texture-compression-bc-sliced-3d", "texture-compression-etc2", "texture-compression-astc", + "texture-compression-astc-sliced-3d", "timestamp-query", "indirect-first-instance", "shader-f16", @@ -141,7 +142,6 @@ interface GPUDevice : EventTarget { GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); - [Throws] GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); [Throws] @@ -263,6 +263,7 @@ dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase { GPUTextureFormat format; GPUTextureViewDimension dimension; + GPUTextureUsageFlags usage = 0; GPUTextureAspect aspect = "all"; GPUIntegerCoordinate baseMipLevel = 0; GPUIntegerCoordinate mipLevelCount; @@ -586,7 +587,6 @@ GPUShaderModule includes GPUObjectBase; dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; - object sourceMap; sequence compilationHints = []; }; @@ -647,7 +647,7 @@ interface mixin GPUPipelineBase { dictionary GPUProgrammableStage { required GPUShaderModule module; USVString entryPoint; - record constants; + record constants = {}; }; typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled. @@ -1199,6 +1199,7 @@ interface GPUCanvasContext { undefined configure(GPUCanvasConfiguration configuration); undefined unconfigure(); + GPUCanvasConfiguration? getConfiguration(); [Throws] GPUTexture getCurrentTexture(); }; From 8a8f65c456cbc76dc6f311d93e579a8169438548 Mon Sep 17 00:00:00 2001 From: kawaemon Date: Tue, 8 Oct 2024 20:53:46 +0900 Subject: [PATCH 499/641] Fix `experimental-nodejs-module` target with `#[wasm_bindgen(start)]` (#4093) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 19 +++++++++++++++++++ crates/cli-support/src/lib.rs | 8 ++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d143880df3..f579eb1b17b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,9 @@ * Fixed multiline doc comment alignment and remove empty ones entirely. [#4135](https://github.com/rustwasm/wasm-bindgen/pull/4135) +* Fixed `experimental-nodejs-module` target when used with `#[wasm_bindgen(start)]`. + [#4093](https://github.com/rustwasm/wasm-bindgen/pull/4093) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index b7523e6089e..6256679021c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -483,6 +483,25 @@ impl<'a> Context<'a> { module_name )))); } + + match self.config.mode { + OutputMode::Bundler { .. } => { + start.get_or_insert_with(String::new).push_str(&format!( + "\ +import {{ __wbg_set_wasm }} from \"./{module_name}_bg.js\"; +__wbg_set_wasm(wasm);" + )); + } + + OutputMode::Node { module: true } => { + start.get_or_insert_with(String::new).push_str(&format!( + "imports[\"./{module_name}_bg.js\"].__wbg_set_wasm(wasm);" + )); + } + + _ => {} + } + if needs_manual_start { start .get_or_insert_with(String::new) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index bd47dfc43b0..188d674df9c 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -701,10 +701,8 @@ impl Output { write( &js_path, format!( - " -import {{ __wbg_set_wasm }} from \"./{js_name}\"; + "\ {start} -__wbg_set_wasm(wasm); export * from \"./{js_name}\";", ), )?; @@ -712,10 +710,8 @@ export * from \"./{js_name}\";", write( &js_path, format!( - " + "\ import * as wasm from \"./{wasm_name}.wasm\"; -import {{ __wbg_set_wasm }} from \"./{js_name}\"; -__wbg_set_wasm(wasm); export * from \"./{js_name}\"; {start}" ), From 9725988db74823007a6667e0c17dbeb686b7e6fd Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 8 Oct 2024 14:47:32 +0200 Subject: [PATCH 500/641] Fix error when importing very large JS files (#4146) --- CHANGELOG.md | 3 +++ crates/backend/src/codegen.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f579eb1b17b..655801b76bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,9 @@ * Fixed `experimental-nodejs-module` target when used with `#[wasm_bindgen(start)]`. [#4093](https://github.com/rustwasm/wasm-bindgen/pull/4093) +* Fixed error when importing very large JS files. + [#4146](https://github.com/rustwasm/wasm-bindgen/pull/4146) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 11daf2ccc15..89c543e257b 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -133,11 +133,14 @@ impl TryToTokens for ast::Program { const _CHUNK_SLICES: [&[u8]; #chunk_len] = [ #(#encoded_chunks,)* ]; + #[allow(long_running_const_eval)] const _CHUNK_LEN: usize = flat_len(_CHUNK_SLICES); + #[allow(long_running_const_eval)] const _CHUNKS: [u8; _CHUNK_LEN] = flat_byte_slices(_CHUNK_SLICES); const _LEN_BYTES: [u8; 4] = (_CHUNK_LEN as u32).to_le_bytes(); const _ENCODED_BYTES_LEN: usize = _CHUNK_LEN + 4; + #[allow(long_running_const_eval)] const _ENCODED_BYTES: [u8; _ENCODED_BYTES_LEN] = flat_byte_slices([&_LEN_BYTES, &_CHUNKS]); &_ENCODED_BYTES }); @@ -174,6 +177,7 @@ impl TryToTokens for ast::Program { const _LEN: usize = _PREFIX_JSON_BYTES_LEN + _ENCODED_BYTES_LEN; #[link_section = "__wasm_bindgen_unstable"] + #[allow(long_running_const_eval)] static _GENERATED: [u8; _LEN] = flat_byte_slices([_PREFIX_JSON_BYTES, _ENCODED_BYTES]); }; }) From 2a0022a1031adfd3dea694df6667d9eb754022b7 Mon Sep 17 00:00:00 2001 From: kawaemon Date: Tue, 8 Oct 2024 22:18:41 +0900 Subject: [PATCH 501/641] Specify `"type": "module"` when deploying to nodejs-module (#4092) --- CHANGELOG.md | 3 +++ crates/cli-support/src/lib.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 655801b76bd..f1714b743e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,9 @@ * Fixed error when importing very large JS files. [#4146](https://github.com/rustwasm/wasm-bindgen/pull/4146) +* Specify `"type": "module"` when deploying to nodejs-module + [#4092](https://github.com/rustwasm/wasm-bindgen/pull/4092) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 188d674df9c..7e8e417615f 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -661,12 +661,16 @@ impl Output { .with_context(|| format!("failed to write `{}`", path.display()))?; } - if !gen.npm_dependencies.is_empty() { + let is_genmode_nodemodule = matches!(gen.mode, OutputMode::Node { module: true }); + if !gen.npm_dependencies.is_empty() || is_genmode_nodemodule { #[derive(serde::Serialize)] struct PackageJson<'a> { + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + ty: Option<&'static str>, dependencies: BTreeMap<&'a str, &'a str>, } let pj = PackageJson { + ty: is_genmode_nodemodule.then_some("module"), dependencies: gen .npm_dependencies .iter() From 0be2fe5f54739db09981055359726a085b0d5ebe Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 8 Oct 2024 23:16:09 +0200 Subject: [PATCH 502/641] Improved support for string enums (#4147) --- CHANGELOG.md | 6 ++ crates/backend/src/ast.rs | 6 ++ crates/backend/src/codegen.rs | 12 +--- crates/backend/src/encode.rs | 10 +++- crates/cli-support/src/descriptor.rs | 3 - crates/cli-support/src/js/binding.rs | 46 +++++---------- crates/cli-support/src/js/mod.rs | 43 +++++++++++++- crates/cli-support/src/wit/incoming.rs | 7 +-- crates/cli-support/src/wit/mod.rs | 29 ++++++++- crates/cli-support/src/wit/nonstandard.rs | 17 ++++++ crates/cli-support/src/wit/outgoing.rs | 20 ++----- crates/cli-support/src/wit/standard.rs | 8 +-- crates/cli/tests/reference/enums.d.ts | 12 ++++ crates/cli/tests/reference/enums.js | 15 ++++- crates/cli/tests/reference/enums.rs | 17 ++++++ crates/macro-support/src/parser.rs | 68 +++++++++++++--------- crates/macro/ui-tests/invalid-enums.rs | 19 ++++++ crates/macro/ui-tests/invalid-enums.stderr | 32 +++++++--- crates/shared/src/lib.rs | 10 +++- crates/shared/src/schema_hash_approval.rs | 2 +- 20 files changed, 268 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1714b743e7..9ca69427762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ * Added `Debug` implementation to `JsError`. [#4136](https://github.com/rustwasm/wasm-bindgen/pull/4136) +* Added support for `js_name` and `skip_typescript` attributes for string enums. + [#4147](https://github.com/rustwasm/wasm-bindgen/pull/4147) + ### Changed * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. @@ -79,6 +82,9 @@ * Specify `"type": "module"` when deploying to nodejs-module [#4092](https://github.com/rustwasm/wasm-bindgen/pull/4092) +* Fixed string enums not generating TypeScript types. + [#4147](https://github.com/rustwasm/wasm-bindgen/pull/4147) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index d27e1e746b8..d745f325f9e 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -337,12 +337,18 @@ pub struct StringEnum { pub vis: syn::Visibility, /// The Rust enum's identifiers pub name: Ident, + /// The name of this string enum in JS/TS code + pub js_name: String, /// The Rust identifiers for the variants pub variants: Vec, /// The JS string values of the variants pub variant_values: Vec, + /// The doc comments on this enum, if any + pub comments: Vec, /// Attributes to apply to the Rust enum pub rust_attrs: Vec, + /// Whether to generate a typescript definition for this enum + pub generate_typescript: bool, /// Path to wasm_bindgen pub wasm_bindgen: Path, } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 89c543e257b..b6371d65974 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1144,7 +1144,7 @@ impl ToTokens for ast::StringEnum { fn to_tokens(&self, tokens: &mut TokenStream) { let vis = &self.vis; let enum_name = &self.name; - let name_str = enum_name.to_string(); + let name_str = self.js_name.to_string(); let name_len = name_str.len() as u32; let name_chars = name_str.chars().map(u32::from); let variants = &self.variants; @@ -1172,15 +1172,6 @@ impl ToTokens for ast::StringEnum { let wasm_bindgen = &self.wasm_bindgen; - let describe_variants = self.variant_values.iter().map(|variant_value| { - let length = variant_value.len() as u32; - let chars = variant_value.chars().map(u32::from); - quote! { - inform(#length); - #(inform(#chars);)* - } - }); - (quote! { #(#attrs)* #[non_exhaustive] @@ -1257,7 +1248,6 @@ impl ToTokens for ast::StringEnum { inform(#name_len); #(inform(#name_chars);)* inform(#variant_count); - #(#describe_variants)* } } diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 44f36942b36..8e89e58a81e 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -359,8 +359,14 @@ fn shared_import_type<'a>(i: &'a ast::ImportType, intern: &'a Interner) -> Impor } } -fn shared_import_enum<'a>(_i: &'a ast::StringEnum, _intern: &'a Interner) -> StringEnum { - StringEnum {} +fn shared_import_enum<'a>(i: &'a ast::StringEnum, _intern: &'a Interner) -> StringEnum<'a> { + StringEnum { + name: &i.js_name, + public: matches!(i.vis, syn::Visibility::Public(_)), + generate_typescript: i.generate_typescript, + variant_values: i.variant_values.iter().map(|x| &**x).collect(), + comments: i.comments.iter().map(|s| &**s).collect(), + } } fn shared_struct<'a>(s: &'a ast::Struct, intern: &'a Interner) -> Struct<'a> { diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index 6a35786eba5..5dec8d86d71 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -76,7 +76,6 @@ pub enum Descriptor { name: String, invalid: u32, hole: u32, - variant_values: Vec, }, RustStruct(String), Char, @@ -171,12 +170,10 @@ impl Descriptor { let variant_count = get(data); let invalid = variant_count; let hole = variant_count + 1; - let variant_values = (0..variant_count).map(|_| get_string(data)).collect(); Descriptor::StringEnum { name, invalid, hole, - variant_values, } } RUST_STRUCT => { diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index cef04592571..bb4864e54a8 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -576,20 +576,11 @@ fn instruction( log_error: &mut bool, constructor: &Option, ) -> Result<(), Error> { - fn wasm_to_string_enum(variant_values: &[String], index: &str) -> String { + fn wasm_to_string_enum(name: &str, index: &str) -> String { // e.g. ["a","b","c"][someIndex] - let mut enum_val_expr = String::new(); - enum_val_expr.push('['); - for variant in variant_values { - enum_val_expr.push_str(&format!("\"{variant}\",")); - } - enum_val_expr.push(']'); - enum_val_expr.push('['); - enum_val_expr.push_str(index); - enum_val_expr.push(']'); - enum_val_expr + format!("__wbindgen_enum_{name}[{index}]") } - fn string_enum_to_wasm(variant_values: &[String], invalid: u32, enum_val: &str) -> String { + fn string_enum_to_wasm(name: &str, invalid: u32, enum_val: &str) -> String { // e.g. (["a","b","c"].indexOf(someEnumVal) + 1 || 4) - 1 // | // invalid + 1 @@ -598,16 +589,10 @@ fn instruction( // and with +1 we get 0 which is falsey, so we can use || to // substitute invalid+1. Finally, we just do -1 to get the correct // values for everything. - let mut enum_val_expr = String::new(); - enum_val_expr.push_str("(["); - for variant in variant_values.iter() { - enum_val_expr.push_str(&format!("\"{variant}\",")); - } - enum_val_expr.push_str(&format!( - "].indexOf({enum_val}) + 1 || {invalid}) - 1", + format!( + "(__wbindgen_enum_{name}.indexOf({enum_val}) + 1 || {invalid}) - 1", invalid = invalid + 1 - )); - enum_val_expr + ) } match instr { @@ -702,34 +687,31 @@ fn instruction( } } - Instruction::WasmToStringEnum { variant_values } => { + Instruction::WasmToStringEnum { name } => { let index = js.pop(); - js.push(wasm_to_string_enum(variant_values, &index)) + js.push(wasm_to_string_enum(name, &index)) } - Instruction::OptionWasmToStringEnum { variant_values, .. } => { + Instruction::OptionWasmToStringEnum { name, .. } => { // Since hole is currently variant_count+1 and the lookup is // ["a","b","c"][index], the lookup will implicitly return map // the hole to undefined, because OOB indexes will return undefined. let index = js.pop(); - js.push(wasm_to_string_enum(variant_values, &index)) + js.push(wasm_to_string_enum(name, &index)) } - Instruction::StringEnumToWasm { - variant_values, - invalid, - } => { + Instruction::StringEnumToWasm { name, invalid } => { let enum_val = js.pop(); - js.push(string_enum_to_wasm(variant_values, *invalid, &enum_val)) + js.push(string_enum_to_wasm(name, *invalid, &enum_val)) } Instruction::OptionStringEnumToWasm { - variant_values, + name, invalid, hole, } => { let enum_val = js.pop(); - let enum_val_expr = string_enum_to_wasm(variant_values, *invalid, &enum_val); + let enum_val_expr = string_enum_to_wasm(name, *invalid, &enum_val); // e.g. someEnumVal == undefined ? 4 : (string_enum_to_wasm(someEnumVal)) // | diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 6256679021c..8a150de5816 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2,7 +2,7 @@ use crate::descriptor::VectorKind; use crate::intrinsic::Intrinsic; use crate::wit::{ Adapter, AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, AuxReceiverKind, - AuxValue, + AuxStringEnum, AuxValue, }; use crate::wit::{AdapterKind, Instruction, InstructionData}; use crate::wit::{AuxEnum, AuxExport, AuxExportKind, AuxImport, AuxStruct}; @@ -2529,9 +2529,12 @@ __wbg_set_wasm(wasm);" pairs.sort_by_key(|(k, _)| *k); check_duplicated_getter_and_setter_names(&pairs)?; - for (_, e) in self.aux.enums.iter() { + for (_, e) in crate::sorted_iter(&self.aux.enums) { self.generate_enum(e)?; } + for (_, e) in crate::sorted_iter(&self.aux.string_enums) { + self.generate_string_enum(e)?; + } for s in self.aux.structs.iter() { self.generate_struct(s)?; @@ -3808,6 +3811,42 @@ __wbg_set_wasm(wasm);" Ok(()) } + fn generate_string_enum(&mut self, string_enum: &AuxStringEnum) -> Result<(), Error> { + let docs = format_doc_comments(&string_enum.comments, None); + + let variants: Vec<_> = string_enum + .variant_values + .iter() + .map(|v| format!("\"{v}\"")) + .collect(); + + if string_enum.generate_typescript { + self.typescript.push_str(&docs); + if string_enum.public { + self.typescript.push_str("export "); + } + self.typescript.push_str("type "); + self.typescript.push_str(&string_enum.name); + self.typescript.push_str(" = "); + + if variants.is_empty() { + self.typescript.push_str("never"); + } else { + self.typescript.push_str(&variants.join(" | ")); + } + + self.typescript.push_str(";\n"); + } + + self.global(&format!( + "const __wbindgen_enum_{name} = [{values}];\n", + name = string_enum.name, + values = variants.join(", ") + )); + + Ok(()) + } + fn generate_struct(&mut self, struct_: &AuxStruct) -> Result<(), Error> { let class = require_class(&mut self.exported_classes, &struct_.name); class.comments = format_doc_comments(&struct_.comments, None); diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 73571763834..a1a6ee196b4 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -108,11 +108,11 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); }, - Descriptor::StringEnum { name, variant_values, invalid, .. } => { + Descriptor::StringEnum { name, invalid, .. } => { self.instruction( &[AdapterType::StringEnum(name.clone())], Instruction::StringEnumToWasm { - variant_values: variant_values.clone(), + name: name.clone(), invalid: *invalid, }, &[AdapterType::I32], @@ -308,14 +308,13 @@ impl InstructionBuilder<'_, '_> { } Descriptor::StringEnum { name, - variant_values, invalid, hole, } => { self.instruction( &[AdapterType::StringEnum(name.clone()).option()], Instruction::OptionStringEnumToWasm { - variant_values: variant_values.clone(), + name: name.clone(), invalid: *invalid, hole: *hole, }, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index fb1825e01d7..ce573ff64ff 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -573,7 +573,7 @@ impl<'a> Context<'a> { decode::ImportKind::Static(s) => self.import_static(&import, s), decode::ImportKind::String(s) => self.import_string(s), decode::ImportKind::Type(t) => self.import_type(&import, t), - decode::ImportKind::Enum(_) => Ok(()), + decode::ImportKind::Enum(e) => self.string_enum(e), } } @@ -865,6 +865,33 @@ impl<'a> Context<'a> { Ok(()) } + fn string_enum(&mut self, string_enum: &decode::StringEnum<'_>) -> Result<(), Error> { + let aux = AuxStringEnum { + name: string_enum.name.to_string(), + public: string_enum.public, + comments: concatenate_comments(&string_enum.comments), + variant_values: string_enum + .variant_values + .iter() + .map(|v| v.to_string()) + .collect(), + generate_typescript: string_enum.generate_typescript, + }; + let mut result = Ok(()); + self.aux + .string_enums + .entry(aux.name.clone()) + .and_modify(|existing| { + result = Err(anyhow!( + "duplicate string enums:\n{:?}\n{:?}", + existing, + aux + )); + }) + .or_insert(aux); + result + } + fn enum_(&mut self, enum_: decode::Enum<'_>) -> Result<(), Error> { let aux = AuxEnum { name: enum_.name.to_string(), diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 5099a72098c..b7777c906bf 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -42,6 +42,9 @@ pub struct WasmBindgenAux { /// Auxiliary information to go into JS/TypeScript bindings describing the /// exported enums from Rust. pub enums: HashMap, + /// Auxiliary information to go into JS/TypeScript bindings describing the + /// exported string enums from Rust. + pub string_enums: HashMap, /// Auxiliary information to go into JS/TypeScript bindings describing the /// exported structs from Rust and their fields they've got exported. @@ -172,6 +175,20 @@ pub struct AuxEnum { pub generate_typescript: bool, } +#[derive(Debug)] +pub struct AuxStringEnum { + /// The name of this enum + pub name: String, + /// Whether this enum is public + pub public: bool, + /// The copied Rust comments to forward to JS + pub comments: String, + /// A list of variants values + pub variant_values: Vec, + /// Whether typescript bindings should be generated for this enum. + pub generate_typescript: bool, +} + #[derive(Debug)] pub struct AuxStruct { /// The name of this struct diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 6bc647cf9c6..020d8b1702f 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -74,12 +74,7 @@ impl InstructionBuilder<'_, '_> { self.output.push(AdapterType::F64); } Descriptor::Enum { name, .. } => self.outgoing_i32(AdapterType::Enum(name.clone())), - Descriptor::StringEnum { - name, - variant_values, - invalid: _, - hole: _, - } => self.outgoing_string_enum(name, variant_values), + Descriptor::StringEnum { name, .. } => self.outgoing_string_enum(name), Descriptor::Char => { self.instruction( @@ -293,16 +288,11 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::Enum(name.clone()).option()], ); } - Descriptor::StringEnum { - name, - invalid: _, - hole, - variant_values, - } => { + Descriptor::StringEnum { name, hole, .. } => { self.instruction( &[AdapterType::I32], Instruction::OptionWasmToStringEnum { - variant_values: variant_values.to_vec(), + name: name.clone(), hole: *hole, }, &[AdapterType::StringEnum(String::from(name)).option()], @@ -542,11 +532,11 @@ impl InstructionBuilder<'_, '_> { self.instruction(&[AdapterType::I32], instr, &[output]); } - fn outgoing_string_enum(&mut self, name: &str, variant_values: &[String]) { + fn outgoing_string_enum(&mut self, name: &str) { self.instruction( &[AdapterType::I32], Instruction::WasmToStringEnum { - variant_values: variant_values.to_vec(), + name: name.to_string(), }, &[AdapterType::StringEnum(String::from(name))], ); diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index c93c4ef4d3f..c96430c6411 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -143,22 +143,22 @@ pub enum Instruction { /// Pops a Wasm `i32` and pushes the enum variant as a string WasmToStringEnum { - variant_values: Vec, + name: String, }, OptionWasmToStringEnum { - variant_values: Vec, + name: String, hole: u32, }, /// pops a string and pushes the enum variant as an `i32` StringEnumToWasm { - variant_values: Vec, + name: String, invalid: u32, }, OptionStringEnumToWasm { - variant_values: Vec, + name: String, invalid: u32, hole: u32, }, diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 556f8085651..e6c6229b926 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -20,8 +20,20 @@ export function get_name(color: Color): ColorName; * @returns {ColorName | undefined} */ export function option_string_enum_echo(color?: ColorName): ColorName | undefined; +/** + * A color. + */ export enum Color { Green = 0, Yellow = 1, Red = 2, } +/** + * The name of a color. + */ +export type ColorName = "green" | "yellow" | "red"; +/** + * An unused string enum. + */ +export type FooBar = "foo" | "bar"; +type PrivateStringEnum = "foo" | "bar"; diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index bbfdc2c5859..a2ef36d4aaf 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -50,7 +50,7 @@ export function option_enum_echo(color) { */ export function get_name(color) { const ret = wasm.get_name(color); - return ["green","yellow","red",][ret]; + return __wbindgen_enum_ColorName[ret]; } /** @@ -58,12 +58,21 @@ export function get_name(color) { * @returns {ColorName | undefined} */ export function option_string_enum_echo(color) { - const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((["green","yellow","red",].indexOf(color) + 1 || 4) - 1)); - return ["green","yellow","red",][ret]; + const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((__wbindgen_enum_ColorName.indexOf(color) + 1 || 4) - 1)); + return __wbindgen_enum_ColorName[ret]; } +/** + * A color. + */ export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); +const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; + +const __wbindgen_enum_FooBar = ["foo", "bar"]; + +const __wbindgen_enum_PrivateStringEnum = ["foo", "bar"]; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index e4cc8e9794c..7e588df0f4d 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -1,5 +1,6 @@ use wasm_bindgen::prelude::*; +/// A color. #[wasm_bindgen] #[derive(PartialEq, Debug)] pub enum Color { @@ -18,6 +19,7 @@ pub fn option_enum_echo(color: Option) -> Option { color } +/// The name of a color. #[wasm_bindgen] #[derive(PartialEq, Debug)] pub enum ColorName { @@ -39,3 +41,18 @@ pub fn get_name(color: Color) -> ColorName { pub fn option_string_enum_echo(color: Option) -> Option { color } + +/// An unused string enum. +#[wasm_bindgen(js_name = "FooBar")] +#[derive(PartialEq, Debug)] +pub enum UnusedStringEnum { + Foo = "foo", + Bar = "bar", +} + +#[wasm_bindgen] +#[derive(PartialEq, Debug)] +enum PrivateStringEnum { + Foo = "foo", + Bar = "bar", +} diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 338c931c598..b1bf4e1295f 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1303,20 +1303,21 @@ impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn { } } -fn string_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), Diagnostic> { +fn string_enum( + enum_: syn::ItemEnum, + program: &mut ast::Program, + js_name: String, + generate_typescript: bool, + comments: Vec, +) -> Result<(), Diagnostic> { let mut variants = vec![]; let mut variant_values = vec![]; for v in enum_.variants.iter() { - match v.fields { - syn::Fields::Unit => (), - _ => bail_span!(v.fields, "only C-Style enums allowed with #[wasm_bindgen]"), - } - let (_, expr) = match &v.discriminant { Some(pair) => pair, None => { - bail_span!(v, "all variants must have a value"); + bail_span!(v, "all variants of a string enum must have a string value"); } }; match get_expr(expr) { @@ -1340,9 +1341,12 @@ fn string_enum(enum_: syn::ItemEnum, program: &mut ast::Program) -> Result<(), D kind: ast::ImportKind::Enum(ast::StringEnum { vis: enum_.vis, name: enum_.ident, + js_name, variants, variant_values, + comments, rust_attrs: enum_.attrs, + generate_typescript, wasm_bindgen: program.wasm_bindgen.clone(), }), }); @@ -1359,25 +1363,42 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { if self.variants.is_empty() { bail_span!(self, "cannot export empty enums to JS"); } - let generate_typescript = opts.skip_typescript().is_none(); - - // Check if the first value is a string literal - if let Some((_, expr)) = &self.variants[0].discriminant { - if let syn::Expr::Lit(syn::ExprLit { - lit: syn::Lit::Str(_), - .. - }) = get_expr(expr) - { - opts.check_used(); - return string_enum(self, program); + for variant in self.variants.iter() { + match variant.fields { + syn::Fields::Unit => (), + _ => bail_span!( + variant.fields, + "enum variants with associated data are not supported with #[wasm_bindgen]" + ), } } + + let generate_typescript = opts.skip_typescript().is_none(); let js_name = opts .js_name() .map(|s| s.0) .map_or_else(|| self.ident.to_string(), |s| s.to_string()); + let comments = extract_doc_comments(&self.attrs); + opts.check_used(); + // Check if the enum is a string enum, by checking whether any variant has a string discriminant. + let is_string_enum = self.variants.iter().any(|v| { + if let Some((_, expr)) = &v.discriminant { + if let syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Str(_), + .. + }) = get_expr(expr) + { + return true; + } + } + false + }); + if is_string_enum { + return string_enum(self, program, js_name, generate_typescript, comments); + } + let has_discriminant = self.variants[0].discriminant.is_some(); match self.vis { @@ -1390,11 +1411,6 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { .iter() .enumerate() .map(|(i, v)| { - match v.fields { - syn::Fields::Unit => (), - _ => bail_span!(v.fields, "only C-Style enums allowed with #[wasm_bindgen]"), - } - // Require that everything either has a discriminant or doesn't. // We don't really want to get in the business of emulating how // rustc assigns values to enums. @@ -1415,14 +1431,14 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { Err(_) => { bail_span!( int_lit, - "enums with #[wasm_bindgen] can only support \ + "C-style enums with #[wasm_bindgen] can only support \ numbers that can be represented as u32" ); } }, expr => bail_span!( expr, - "enums with #[wasm_bindgen] may only have \ + "C-style enums with #[wasm_bindgen] may only have \ number literal values", ), }, @@ -1454,8 +1470,6 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { assert!(hole != value); } - let comments = extract_doc_comments(&self.attrs); - self.to_tokens(tokens); program.enums.push(ast::Enum { diff --git a/crates/macro/ui-tests/invalid-enums.rs b/crates/macro/ui-tests/invalid-enums.rs index abea3fa6712..3ddd5e17487 100644 --- a/crates/macro/ui-tests/invalid-enums.rs +++ b/crates/macro/ui-tests/invalid-enums.rs @@ -18,4 +18,23 @@ pub enum D { X = 4294967296, } +#[wasm_bindgen] +pub enum E { + A = 1, + B = "foo", +} + +#[wasm_bindgen] +pub enum F { + A = "foo", + B = 1, +} + +#[wasm_bindgen] +enum G { + A = "foo", + B = "bar", + C, +} + fn main() {} diff --git a/crates/macro/ui-tests/invalid-enums.stderr b/crates/macro/ui-tests/invalid-enums.stderr index 7ad51f9a5a2..13199f8f868 100644 --- a/crates/macro/ui-tests/invalid-enums.stderr +++ b/crates/macro/ui-tests/invalid-enums.stderr @@ -1,23 +1,41 @@ error: cannot export empty enums to JS - --> $DIR/invalid-enums.rs:4:1 + --> ui-tests/invalid-enums.rs:4:1 | 4 | enum A {} | ^^^^^^^^^ -error: only C-Style enums allowed with #[wasm_bindgen] - --> $DIR/invalid-enums.rs:8:6 +error: enum variants with associated data are not supported with #[wasm_bindgen] + --> ui-tests/invalid-enums.rs:8:6 | 8 | D(u32), | ^^^^^ -error: enums with #[wasm_bindgen] may only have number literal values - --> $DIR/invalid-enums.rs:13:9 +error: C-style enums with #[wasm_bindgen] may only have number literal values + --> ui-tests/invalid-enums.rs:13:9 | 13 | X = 1 + 3, | ^^^^^ -error: enums with #[wasm_bindgen] can only support numbers that can be represented as u32 - --> $DIR/invalid-enums.rs:18:9 +error: C-style enums with #[wasm_bindgen] can only support numbers that can be represented as u32 + --> ui-tests/invalid-enums.rs:18:9 | 18 | X = 4294967296, | ^^^^^^^^^^ + +error: enums with #[wasm_bindgen] cannot mix string and non-string values + --> ui-tests/invalid-enums.rs:23:9 + | +23 | A = 1, + | ^ + +error: enums with #[wasm_bindgen] cannot mix string and non-string values + --> ui-tests/invalid-enums.rs:30:9 + | +30 | B = 1, + | ^ + +error: all variants of a string enum must have a string value + --> ui-tests/invalid-enums.rs:37:5 + | +37 | C, + | ^ diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 0b9af3b581b..aa3964ec0a4 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -51,7 +51,7 @@ macro_rules! shared_api { Static(ImportStatic<'a>), String(ImportString<'a>), Type(ImportType<'a>), - Enum(StringEnum), + Enum(StringEnum<'a>), } struct ImportFunction<'a> { @@ -104,7 +104,13 @@ macro_rules! shared_api { vendor_prefixes: Vec<&'a str>, } - struct StringEnum {} + struct StringEnum<'a> { + name: &'a str, + public: bool, + variant_values: Vec<&'a str>, + comments: Vec<&'a str>, + generate_typescript: bool, + } struct Export<'a> { class: Option<&'a str>, diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 1de5ee31cd3..ad4af57a09e 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "9336383503182818021"; +const APPROVED_SCHEMA_FILE_HASH: &str = "9179028021460341559"; #[test] fn schema_version() { From 3f4545e58e924c3d6a5085ca8e3a4cdf0004dcc8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 9 Oct 2024 00:10:32 +0200 Subject: [PATCH 503/641] Add `wasm_bindgen_test(unsupported = test)` (#4150) --- CHANGELOG.md | 3 +++ Cargo.toml | 4 +++- crates/test-macro/Cargo.toml | 1 + crates/test-macro/src/lib.rs | 8 ++++++++ crates/test-macro/ui-tests/crate.rs | 3 +++ guide/src/wasm-bindgen-test/usage.md | 7 +++++++ tests/non_wasm_test.rs | 25 +++++++++++++++++++++++++ 7 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/non_wasm_test.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ca69427762..8f8fecd34af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ * Added support for `js_name` and `skip_typescript` attributes for string enums. [#4147](https://github.com/rustwasm/wasm-bindgen/pull/4147) +* Added `unsupported` crate to `wasm_bindgen_test(unsupported = test)` as a way of running tests on non-Wasm targets as well. + [#4150](https://github.com/rustwasm/wasm-bindgen/pull/4150) + ### Changed * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. diff --git a/Cargo.toml b/Cargo.toml index ac38d0504d9..c5707b56c2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,11 +47,13 @@ serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.93" } +[dev-dependencies] +wasm-bindgen-test = { path = 'crates/test' } + [target.'cfg(target_arch = "wasm32")'.dev-dependencies] js-sys = { path = 'crates/js-sys' } serde_derive = "1.0" wasm-bindgen-futures = { path = 'crates/futures' } -wasm-bindgen-test = { path = 'crates/test' } wasm-bindgen-test-crate-a = { path = 'tests/crates/a' } wasm-bindgen-test-crate-b = { path = 'tests/crates/b' } diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 87e55ad1e13..2c67d591021 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -23,6 +23,7 @@ syn = { version = "2.0", default-features = false, features = [ ] } [dev-dependencies] +tokio = { version = "1", features = ["macros"] } trybuild = "1.0" wasm-bindgen-test = { path = "../test" } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index d9bd781481a..27f21988a44 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -120,6 +120,10 @@ pub fn wasm_bindgen_test( }, ); + if let Some(path) = attributes.unsupported { + tokens.extend(quote! { #[#path] }); + } + tokens.extend(leading_tokens); tokens.push(ident.into()); tokens.extend(body); @@ -281,6 +285,7 @@ fn compile_error(span: Span, msg: &str) -> proc_macro::TokenStream { struct Attributes { r#async: bool, wasm_bindgen_path: syn::Path, + unsupported: Option, } impl Default for Attributes { @@ -288,6 +293,7 @@ impl Default for Attributes { Self { r#async: false, wasm_bindgen_path: syn::parse_quote!(::wasm_bindgen_test), + unsupported: None, } } } @@ -298,6 +304,8 @@ impl Attributes { self.r#async = true; } else if meta.path.is_ident("crate") { self.wasm_bindgen_path = meta.value()?.parse::()?; + } else if meta.path.is_ident("unsupported") { + self.unsupported = Some(meta.value()?.parse::()?); } else { return Err(meta.error("unknown attribute")); } diff --git a/crates/test-macro/ui-tests/crate.rs b/crates/test-macro/ui-tests/crate.rs index 2087f7575b6..d7f0a33f878 100644 --- a/crates/test-macro/ui-tests/crate.rs +++ b/crates/test-macro/ui-tests/crate.rs @@ -17,4 +17,7 @@ fn success_2() {} #[wasm_bindgen_test(crate = foo)] fn failure_1() {} +#[wasm_bindgen_test(unsupported = tokio::test(flavor = "multi_thread", worker_threads = 1))] +fn success_3() {} + fn main() {} diff --git a/guide/src/wasm-bindgen-test/usage.md b/guide/src/wasm-bindgen-test/usage.md index 3ba7aa97d52..18912049281 100644 --- a/guide/src/wasm-bindgen-test/usage.md +++ b/guide/src/wasm-bindgen-test/usage.md @@ -27,6 +27,13 @@ fn pass() { fn fail() { assert_eq!(1, 2); } + +// On a target other then `wasm32-unknown-unknown`, the `#[test]` attribute +// will be used instead, allowing this test to run on any target. +#[wasm_bindgen_test(unsupported = test)] +fn all_targets() { + assert_eq!(1, 2); +} ``` Writing tests is the same as normal Rust `#[test]`s, except we are using the diff --git a/tests/non_wasm_test.rs b/tests/non_wasm_test.rs new file mode 100644 index 00000000000..784fa8cf6a3 --- /dev/null +++ b/tests/non_wasm_test.rs @@ -0,0 +1,25 @@ +#![cfg(not(target_family = "wasm"))] + +use std::sync::{Arc, Condvar, Mutex}; + +use once_cell::sync::Lazy; +use wasm_bindgen_test::wasm_bindgen_test; + +static TEST: Lazy, Condvar)>> = + Lazy::new(|| Arc::new((Mutex::new(false), Condvar::new()))); + +#[wasm_bindgen_test(unsupported = test)] +fn test_success() { + let mut success = TEST.0.lock().unwrap(); + *success = true; + // We notify the condvar that the value has changed. + TEST.1.notify_one(); +} + +#[test] +fn test() { + let mut success = TEST.0.lock().unwrap(); + while !*success { + success = TEST.1.wait(success).unwrap(); + } +} From e575aba1ef8b7595feb88fdefc9567a2c48a3a54 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 9 Oct 2024 00:37:09 +0200 Subject: [PATCH 504/641] Fix `wasm_bindgen_test(unsupported = test)` (#4151) --- crates/test-macro/Cargo.toml | 2 +- crates/test-macro/src/lib.rs | 5 ++++- crates/test-macro/ui-tests/crate.rs | 5 +---- crates/test-macro/ui-tests/crate.stderr | 13 ++++--------- crates/test-macro/ui-tests/unsupported.rs | 17 +++++++++++++++++ crates/test-macro/ui-tests/unsupported.stderr | 13 +++++++++++++ 6 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 crates/test-macro/ui-tests/unsupported.rs create mode 100644 crates/test-macro/ui-tests/unsupported.stderr diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 2c67d591021..c5f7c61e70e 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -23,7 +23,7 @@ syn = { version = "2.0", default-features = false, features = [ ] } [dev-dependencies] -tokio = { version = "1", features = ["macros"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } trybuild = "1.0" wasm-bindgen-test = { path = "../test" } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 27f21988a44..0f86888fc33 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -112,6 +112,7 @@ pub fn wasm_bindgen_test( tokens.extend( quote! { #[no_mangle] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); @@ -121,7 +122,9 @@ pub fn wasm_bindgen_test( ); if let Some(path) = attributes.unsupported { - tokens.extend(quote! { #[#path] }); + tokens.extend( + quote! { #[cfg_attr(not(all(target_arch = "wasm32", target_os = "unknown")), #path)] }, + ); } tokens.extend(leading_tokens); diff --git a/crates/test-macro/ui-tests/crate.rs b/crates/test-macro/ui-tests/crate.rs index d7f0a33f878..d7d2d3fd908 100644 --- a/crates/test-macro/ui-tests/crate.rs +++ b/crates/test-macro/ui-tests/crate.rs @@ -14,10 +14,7 @@ fn success_1() {} #[wasm_bindgen_test(crate = crate::wasm::test)] fn success_2() {} -#[wasm_bindgen_test(crate = foo)] +#[wasm_bindgen_test(crate(foo))] fn failure_1() {} -#[wasm_bindgen_test(unsupported = tokio::test(flavor = "multi_thread", worker_threads = 1))] -fn success_3() {} - fn main() {} diff --git a/crates/test-macro/ui-tests/crate.stderr b/crates/test-macro/ui-tests/crate.stderr index e256cb3f4fe..88ba023c969 100644 --- a/crates/test-macro/ui-tests/crate.stderr +++ b/crates/test-macro/ui-tests/crate.stderr @@ -1,10 +1,5 @@ -error[E0433]: failed to resolve: use of undeclared crate or module `foo` - --> ui-tests/crate.rs:17:29 - | -17 | #[wasm_bindgen_test(crate = foo)] - | ^^^ use of undeclared crate or module `foo` - | -help: consider importing this module - | -5 + use wasm_bindgen_test::__rt; +error: expected `=` + --> ui-tests/crate.rs:17:26 | +17 | #[wasm_bindgen_test(crate(foo))] + | ^ diff --git a/crates/test-macro/ui-tests/unsupported.rs b/crates/test-macro/ui-tests/unsupported.rs new file mode 100644 index 00000000000..f4c70c7fc40 --- /dev/null +++ b/crates/test-macro/ui-tests/unsupported.rs @@ -0,0 +1,17 @@ +#![no_implicit_prelude] + +extern crate wasm_bindgen_test_macro; +extern crate tokio; +// +use wasm_bindgen_test_macro::wasm_bindgen_test; + +#[wasm_bindgen_test(unsupported = tokio::test(flavor = "multi_thread", worker_threads = 1))] +async fn success() {} + +#[wasm_bindgen_test(unsupported)] +fn failure_1() {} + +#[wasm_bindgen_test(unsupported(test))] +fn failure_2() {} + +fn main() {} diff --git a/crates/test-macro/ui-tests/unsupported.stderr b/crates/test-macro/ui-tests/unsupported.stderr new file mode 100644 index 00000000000..0bc93ec5b90 --- /dev/null +++ b/crates/test-macro/ui-tests/unsupported.stderr @@ -0,0 +1,13 @@ +error: expected `=` + --> ui-tests/unsupported.rs:11:1 + | +11 | #[wasm_bindgen_test(unsupported)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the attribute macro `wasm_bindgen_test` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `=` + --> ui-tests/unsupported.rs:14:32 + | +14 | #[wasm_bindgen_test(unsupported(test))] + | ^ From 95bf437f35eaef8ee0756dba8685b2ff2278536c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 9 Oct 2024 20:55:08 +0200 Subject: [PATCH 505/641] Account for `[AllowShared]` and improve setters generated from interface attributes (#4156) --- CHANGELOG.md | 12 + .../web-sys/src/features/gen_AnalyserNode.rs | 37 + .../web-sys/src/features/gen_AudioBuffer.rs | 46 + .../web-sys/src/features/gen_AudioContext.rs | 75 + crates/web-sys/src/features/gen_AudioData.rs | 18 +- crates/web-sys/src/features/gen_AudioParam.rs | 12 + .../src/features/gen_BaseAudioContext.rs | 75 + .../src/features/gen_BiquadFilterNode.rs | 84 + crates/web-sys/src/features/gen_Blob.rs | 20 + .../gen_BluetoothRemoteGattCharacteristic.rs | 72 +- .../gen_BluetoothRemoteGattDescriptor.rs | 24 +- .../features/gen_CanvasRenderingContext2d.rs | 51 + crates/web-sys/src/features/gen_Crypto.rs | 10 + crates/web-sys/src/features/gen_DomMatrix.rs | 14 + .../src/features/gen_EncodedAudioChunk.rs | 16 +- .../src/features/gen_EncodedVideoChunk.rs | 16 +- .../gen_FetchReadableStreamReadDataArray.rs | 15 + crates/web-sys/src/features/gen_File.rs | 22 + .../gen_FileSystemSyncAccessHandle.rs | 44 + .../gen_FileSystemWritableFileStream.rs | 10 + crates/web-sys/src/features/gen_FontFace.rs | 22 + .../src/features/gen_GpuComputePassEncoder.rs | 42 +- crates/web-sys/src/features/gen_GpuQueue.rs | 330 +++- .../features/gen_GpuRenderBundleEncoder.rs | 42 +- .../src/features/gen_GpuRenderPassEncoder.rs | 42 +- crates/web-sys/src/features/gen_HidDevice.rs | 50 +- .../web-sys/src/features/gen_IdbFileHandle.rs | 40 + .../web-sys/src/features/gen_IirFilterNode.rs | 84 + crates/web-sys/src/features/gen_ImageData.rs | 21 + .../src/features/gen_KeyframeEffect.rs | 20 + .../src/features/gen_MediaKeySession.rs | 21 + .../src/features/gen_MediaKeyStatusMap.rs | 17 + crates/web-sys/src/features/gen_MediaKeys.rs | 10 + .../src/features/gen_MidiMessageEventInit.rs | 15 + crates/web-sys/src/features/gen_Navigator.rs | 11 + .../src/features/gen_OfflineAudioContext.rs | 75 + .../gen_OffscreenCanvasRenderingContext2d.rs | 60 + .../features/gen_PresentationConnection.rs | 10 + .../gen_ReadableByteStreamController.rs | 10 + .../features/gen_ReadableStreamByobRequest.rs | 10 + crates/web-sys/src/features/gen_Response.rs | 20 + .../src/features/gen_RtcDataChannel.rs | 10 + .../src/features/gen_RtcRtpReceiver.rs | 29 +- .../web-sys/src/features/gen_RtcRtpSender.rs | 29 +- .../web-sys/src/features/gen_SourceBuffer.rs | 20 + .../web-sys/src/features/gen_SubtleCrypto.rs | 308 ++++ .../web-sys/src/features/gen_TextDecoder.rs | 22 + crates/web-sys/src/features/gen_UsbDevice.rs | 77 +- crates/web-sys/src/features/gen_VideoFrame.rs | 51 +- .../src/features/gen_VrMockController.rs | 945 ++++++++++ .../web-sys/src/features/gen_VrMockDisplay.rs | 945 ++++++++++ crates/web-sys/src/features/gen_VttCue.rs | 32 + .../src/features/gen_WaveShaperNode.rs | 21 + .../features/gen_WebGl2RenderingContext.rs | 1626 ++++++++++++++++- .../src/features/gen_WebGlRenderingContext.rs | 300 +++ crates/web-sys/src/features/gen_WebSocket.rs | 10 + .../src/features/gen_WebglMultiDraw.rs | 1006 +++++++++- .../src/features/gen_XmlHttpRequest.rs | 10 + crates/web-sys/src/features/gen_XrFrame.rs | 44 +- .../webidls/enabled/KeyAlgorithm.webidl | 12 - .../webidls/enabled/SubtleCrypto.webidl | 16 - crates/webidl-tests/array.rs | 21 +- .../webidl-tests/webidls/enabled/array.webidl | 16 +- crates/webidl/src/constants.rs | 769 +++++++- crates/webidl/src/first_pass.rs | 19 +- crates/webidl/src/idl_type.rs | 358 +++- crates/webidl/src/lib.rs | 81 +- crates/webidl/src/util.rs | 129 +- 68 files changed, 8167 insertions(+), 364 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f8fecd34af..ce09f93e9a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,12 @@ * Added `unsupported` crate to `wasm_bindgen_test(unsupported = test)` as a way of running tests on non-Wasm targets as well. [#4150](https://github.com/rustwasm/wasm-bindgen/pull/4150) +* Added additional bindings for methods taking buffer view types (e.g. `&[u8]`) with corresponding JS types (e.g. `Uint8Array`). + [#4156](https://github.com/rustwasm/wasm-bindgen/pull/4156) + +* Added additional bindings for setters from WebIDL interface attributes with applicaple parameter types of just `JsValue`. + [#4156](https://github.com/rustwasm/wasm-bindgen/pull/4156) + ### Changed * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. @@ -49,6 +55,9 @@ * Updated the WebGPU API to the current draft as of 2024-10-07. [#4145](https://github.com/rustwasm/wasm-bindgen/pull/4145) +* Deprecated generated setters from WebIDL interface attribute taking `JsValue` in favor of newer bindings with specific parameter types. + [#4156](https://github.com/rustwasm/wasm-bindgen/pull/4156) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. @@ -88,6 +97,9 @@ * Fixed string enums not generating TypeScript types. [#4147](https://github.com/rustwasm/wasm-bindgen/pull/4147) +* Bindings that take buffer view types (e.g. `&[u8]`) as parameters will now correctly return a `Result` when they might not support a backing `SharedArrayBuffer`. This only applies to new and unstable APIs, which won't cause a breaking in the API. + [#4156](https://github.com/rustwasm/wasm-bindgen/pull/4156) + -------------------------------------------------------------------------------- ## [0.2.93](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93) diff --git a/crates/web-sys/src/features/gen_AnalyserNode.rs b/crates/web-sys/src/features/gen_AnalyserNode.rs index 32c74dbc06b..6db762035de 100644 --- a/crates/web-sys/src/features/gen_AnalyserNode.rs +++ b/crates/web-sys/src/features/gen_AnalyserNode.rs @@ -101,6 +101,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] pub fn get_byte_frequency_data(this: &AnalyserNode, array: &mut [u8]); + # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getByteFrequencyData)] + #[doc = "The `getByteFrequencyData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] + pub fn get_byte_frequency_data_with_u8_array(this: &AnalyserNode, array: &::js_sys::Uint8Array); # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getByteTimeDomainData)] #[doc = "The `getByteTimeDomainData()` method."] #[doc = ""] @@ -108,6 +115,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] pub fn get_byte_time_domain_data(this: &AnalyserNode, array: &mut [u8]); + # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getByteTimeDomainData)] + #[doc = "The `getByteTimeDomainData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteTimeDomainData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] + pub fn get_byte_time_domain_data_with_u8_array( + this: &AnalyserNode, + array: &::js_sys::Uint8Array, + ); # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getFloatFrequencyData)] #[doc = "The `getFloatFrequencyData()` method."] #[doc = ""] @@ -115,6 +132,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] pub fn get_float_frequency_data(this: &AnalyserNode, array: &mut [f32]); + # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getFloatFrequencyData)] + #[doc = "The `getFloatFrequencyData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getFloatFrequencyData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] + pub fn get_float_frequency_data_with_f32_array( + this: &AnalyserNode, + array: &::js_sys::Float32Array, + ); # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getFloatTimeDomainData)] #[doc = "The `getFloatTimeDomainData()` method."] #[doc = ""] @@ -122,4 +149,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] pub fn get_float_time_domain_data(this: &AnalyserNode, array: &mut [f32]); + # [wasm_bindgen (method , structural , js_class = "AnalyserNode" , js_name = getFloatTimeDomainData)] + #[doc = "The `getFloatTimeDomainData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getFloatTimeDomainData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AnalyserNode`*"] + pub fn get_float_time_domain_data_with_f32_array( + this: &AnalyserNode, + array: &::js_sys::Float32Array, + ); } diff --git a/crates/web-sys/src/features/gen_AudioBuffer.rs b/crates/web-sys/src/features/gen_AudioBuffer.rs index d609a165f8e..2ae5bc16000 100644 --- a/crates/web-sys/src/features/gen_AudioBuffer.rs +++ b/crates/web-sys/src/features/gen_AudioBuffer.rs @@ -65,12 +65,35 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] + pub fn copy_from_channel_with_f32_array( + this: &AudioBuffer, + destination: &::js_sys::Float32Array, + channel_number: i32, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = copyFromChannel)] + #[doc = "The `copyFromChannel()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] pub fn copy_from_channel_with_start_in_channel( this: &AudioBuffer, destination: &mut [f32], channel_number: i32, start_in_channel: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = copyFromChannel)] + #[doc = "The `copyFromChannel()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyFromChannel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] + pub fn copy_from_channel_with_f32_array_and_start_in_channel( + this: &AudioBuffer, + destination: &::js_sys::Float32Array, + channel_number: i32, + start_in_channel: u32, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = copyToChannel)] #[doc = "The `copyToChannel()` method."] #[doc = ""] @@ -88,12 +111,35 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] + pub fn copy_to_channel_with_f32_array( + this: &AudioBuffer, + source: &::js_sys::Float32Array, + channel_number: i32, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = copyToChannel)] + #[doc = "The `copyToChannel()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] pub fn copy_to_channel_with_start_in_channel( this: &AudioBuffer, source: &[f32], channel_number: i32, start_in_channel: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = copyToChannel)] + #[doc = "The `copyToChannel()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/copyToChannel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] + pub fn copy_to_channel_with_f32_array_and_start_in_channel( + this: &AudioBuffer, + source: &::js_sys::Float32Array, + channel_number: i32, + start_in_channel: u32, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "AudioBuffer" , js_name = getChannelData)] #[doc = "The `getChannelData()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AudioContext.rs b/crates/web-sys/src/features/gen_AudioContext.rs index 4ebd6dd11af..95d16bfa8e9 100644 --- a/crates/web-sys/src/features/gen_AudioContext.rs +++ b/crates/web-sys/src/features/gen_AudioContext.rs @@ -362,6 +362,42 @@ extern "C" { real: &mut [f32], imag: &mut [f32], ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice( + this: &AudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array( + this: &AudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array( + this: &AudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + ) -> Result; #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] #[doc = "The `createPeriodicWave()` method."] @@ -375,6 +411,45 @@ extern "C" { imag: &mut [f32], constraints: &PeriodicWaveConstraints, ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice_and_constraints( + this: &AudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array_and_constraints( + this: &AudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array_and_constraints( + this: &AudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "AudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] diff --git a/crates/web-sys/src/features/gen_AudioData.rs b/crates/web-sys/src/features/gen_AudioData.rs index 91a1e8bc534..3cc08dd7e70 100644 --- a/crates/web-sys/src/features/gen_AudioData.rs +++ b/crates/web-sys/src/features/gen_AudioData.rs @@ -159,9 +159,25 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array( + pub fn copy_to_with_u8_slice( this: &AudioData, destination: &mut [u8], options: &AudioDataCopyToOptions, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "AudioDataCopyToOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "AudioData" , js_name = copyTo)] + #[doc = "The `copyTo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioData`, `AudioDataCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn copy_to_with_u8_array( + this: &AudioData, + destination: &::js_sys::Uint8Array, + options: &AudioDataCopyToOptions, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_AudioParam.rs b/crates/web-sys/src/features/gen_AudioParam.rs index 3cc533d2dfa..8c5e9f94b99 100644 --- a/crates/web-sys/src/features/gen_AudioParam.rs +++ b/crates/web-sys/src/features/gen_AudioParam.rs @@ -114,4 +114,16 @@ extern "C" { start_time: f64, duration: f64, ) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "AudioParam" , js_name = setValueCurveAtTime)] + #[doc = "The `setValueCurveAtTime()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueCurveAtTime)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AudioParam`*"] + pub fn set_value_curve_at_time_with_f32_array( + this: &AudioParam, + values: &::js_sys::Float32Array, + start_time: f64, + duration: f64, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_BaseAudioContext.rs b/crates/web-sys/src/features/gen_BaseAudioContext.rs index 73fbefabbae..3d3b6c95a69 100644 --- a/crates/web-sys/src/features/gen_BaseAudioContext.rs +++ b/crates/web-sys/src/features/gen_BaseAudioContext.rs @@ -241,6 +241,42 @@ extern "C" { real: &mut [f32], imag: &mut [f32], ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice( + this: &BaseAudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array( + this: &BaseAudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array( + this: &BaseAudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + ) -> Result; #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] #[doc = "The `createPeriodicWave()` method."] @@ -254,6 +290,45 @@ extern "C" { imag: &mut [f32], constraints: &PeriodicWaveConstraints, ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice_and_constraints( + this: &BaseAudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array_and_constraints( + this: &BaseAudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BaseAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array_and_constraints( + this: &BaseAudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "BaseAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] diff --git a/crates/web-sys/src/features/gen_BiquadFilterNode.rs b/crates/web-sys/src/features/gen_BiquadFilterNode.rs index a83d8276843..5ffe71836ad 100644 --- a/crates/web-sys/src/features/gen_BiquadFilterNode.rs +++ b/crates/web-sys/src/features/gen_BiquadFilterNode.rs @@ -91,4 +91,88 @@ extern "C" { mag_response: &mut [f32], phase_response: &mut [f32], ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_slice_and_f32_slice( + this: &BiquadFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &mut [f32], + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_array_and_f32_slice( + this: &BiquadFilterNode, + frequency_hz: &mut [f32], + mag_response: &::js_sys::Float32Array, + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_array_and_f32_slice( + this: &BiquadFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &::js_sys::Float32Array, + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_slice_and_f32_array( + this: &BiquadFilterNode, + frequency_hz: &mut [f32], + mag_response: &mut [f32], + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_slice_and_f32_array( + this: &BiquadFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &mut [f32], + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_array_and_f32_array( + this: &BiquadFilterNode, + frequency_hz: &mut [f32], + mag_response: &::js_sys::Float32Array, + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "BiquadFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BiquadFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_array_and_f32_array( + this: &BiquadFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &::js_sys::Float32Array, + phase_response: &::js_sys::Float32Array, + ); } diff --git a/crates/web-sys/src/features/gen_Blob.rs b/crates/web-sys/src/features/gen_Blob.rs index 681bd089b8b..f63dbaadef8 100644 --- a/crates/web-sys/src/features/gen_Blob.rs +++ b/crates/web-sys/src/features/gen_Blob.rs @@ -48,6 +48,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`*"] + pub fn new_with_u8_slice_sequence( + blob_parts: &::wasm_bindgen::JsValue, + ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "Blob")] + #[doc = "The `new Blob(..)` constructor, creating a new instance of `Blob`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`*"] pub fn new_with_u8_array_sequence( blob_parts: &::wasm_bindgen::JsValue, ) -> Result; @@ -83,6 +92,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobPropertyBag`*"] + pub fn new_with_u8_slice_sequence_and_options( + blob_parts: &::wasm_bindgen::JsValue, + options: &BlobPropertyBag, + ) -> Result; + #[cfg(feature = "BlobPropertyBag")] + #[wasm_bindgen(catch, constructor, js_class = "Blob")] + #[doc = "The `new Blob(..)` constructor, creating a new instance of `Blob`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `BlobPropertyBag`*"] pub fn new_with_u8_array_sequence_and_options( blob_parts: &::wasm_bindgen::JsValue, options: &BlobPropertyBag, diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs index bc6164995d1..f185f07bc63 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs @@ -192,7 +192,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn stop_notifications(this: &BluetoothRemoteGattCharacteristic) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValue)"] @@ -204,9 +204,9 @@ extern "C" { pub fn write_value_with_buffer_source( this: &BluetoothRemoteGattCharacteristic, value: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValue)"] @@ -215,12 +215,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_value_with_u8_array( + pub fn write_value_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValue)] + #[doc = "The `writeValue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattCharacteristic`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_value_with_u8_array( + this: &BluetoothRemoteGattCharacteristic, + value: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] #[doc = "The `writeValueWithResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithResponse)"] @@ -232,9 +246,9 @@ extern "C" { pub fn write_value_with_response_with_buffer_source( this: &BluetoothRemoteGattCharacteristic, value: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] #[doc = "The `writeValueWithResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithResponse)"] @@ -243,12 +257,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_value_with_response_with_u8_array( + pub fn write_value_with_response_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithResponse)] + #[doc = "The `writeValueWithResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattCharacteristic`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_value_with_response_with_u8_array( + this: &BluetoothRemoteGattCharacteristic, + value: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] #[doc = "The `writeValueWithoutResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithoutResponse)"] @@ -260,9 +288,9 @@ extern "C" { pub fn write_value_without_response_with_buffer_source( this: &BluetoothRemoteGattCharacteristic, value: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] #[doc = "The `writeValueWithoutResponse()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithoutResponse)"] @@ -271,8 +299,22 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_value_without_response_with_u8_array( + pub fn write_value_without_response_with_u8_slice( this: &BluetoothRemoteGattCharacteristic, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = writeValueWithoutResponse)] + #[doc = "The `writeValueWithoutResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTCharacteristic/writeValueWithoutResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattCharacteristic`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_value_without_response_with_u8_array( + this: &BluetoothRemoteGattCharacteristic, + value: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; } diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs index 0b264457c10..76e5709586e 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs @@ -64,7 +64,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn read_value(this: &BluetoothRemoteGattDescriptor) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTDescriptor/writeValue)"] @@ -76,9 +76,9 @@ extern "C" { pub fn write_value_with_buffer_source( this: &BluetoothRemoteGattDescriptor, value: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] #[doc = "The `writeValue()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTDescriptor/writeValue)"] @@ -87,8 +87,22 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_value_with_u8_array( + pub fn write_value_with_u8_slice( this: &BluetoothRemoteGattDescriptor, value: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "BluetoothRemoteGATTDescriptor" , js_name = writeValue)] + #[doc = "The `writeValue()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTDescriptor/writeValue)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `BluetoothRemoteGattDescriptor`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_value_with_u8_array( + this: &BluetoothRemoteGattDescriptor, + value: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; } diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index 5d4a7f79c27..9eecfa51b3a 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -64,7 +64,34 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + #[deprecated] pub fn set_stroke_style(this: &CanvasRenderingContext2d, value: &::wasm_bindgen::JsValue); + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleStr)] + #[doc = "Setter for the `strokeStyleStr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleStr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn set_stroke_style_str(this: &CanvasRenderingContext2d, value: &str); + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleCanvasGradient)] + #[doc = "Setter for the `strokeStyleCanvasGradient` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleCanvasGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `CanvasRenderingContext2d`*"] + pub fn set_stroke_style_canvas_gradient( + this: &CanvasRenderingContext2d, + value: &CanvasGradient, + ); + #[cfg(feature = "CanvasPattern")] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleCanvasPattern)] + #[doc = "Setter for the `strokeStyleCanvasPattern` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleCanvasPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`*"] + pub fn set_stroke_style_canvas_pattern(this: &CanvasRenderingContext2d, value: &CanvasPattern); # [wasm_bindgen (structural , method , getter , js_class = "CanvasRenderingContext2D" , js_name = fillStyle)] #[doc = "Getter for the `fillStyle` field of this object."] #[doc = ""] @@ -78,7 +105,31 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + #[deprecated] pub fn set_fill_style(this: &CanvasRenderingContext2d, value: &::wasm_bindgen::JsValue); + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleStr)] + #[doc = "Setter for the `fillStyleStr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleStr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn set_fill_style_str(this: &CanvasRenderingContext2d, value: &str); + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleCanvasGradient)] + #[doc = "Setter for the `fillStyleCanvasGradient` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleCanvasGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `CanvasRenderingContext2d`*"] + pub fn set_fill_style_canvas_gradient(this: &CanvasRenderingContext2d, value: &CanvasGradient); + #[cfg(feature = "CanvasPattern")] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleCanvasPattern)] + #[doc = "Setter for the `fillStyleCanvasPattern` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleCanvasPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`*"] + pub fn set_fill_style_canvas_pattern(this: &CanvasRenderingContext2d, value: &CanvasPattern); # [wasm_bindgen (structural , method , getter , js_class = "CanvasRenderingContext2D" , js_name = filter)] #[doc = "Getter for the `filter` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Crypto.rs b/crates/web-sys/src/features/gen_Crypto.rs index 723636ffc3c..44734501c78 100644 --- a/crates/web-sys/src/features/gen_Crypto.rs +++ b/crates/web-sys/src/features/gen_Crypto.rs @@ -40,6 +40,16 @@ extern "C" { this: &Crypto, array: &mut [u8], ) -> Result<::js_sys::Object, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "Crypto" , js_name = getRandomValues)] + #[doc = "The `getRandomValues()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Crypto`*"] + pub fn get_random_values_with_js_u8_array( + this: &Crypto, + array: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Object, JsValue>; # [wasm_bindgen (method , structural , js_class = "Crypto" , js_name = randomUUID)] #[doc = "The `randomUUID()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomMatrix.rs b/crates/web-sys/src/features/gen_DomMatrix.rs index db541f0d162..1ed0b27be1e 100644 --- a/crates/web-sys/src/features/gen_DomMatrix.rs +++ b/crates/web-sys/src/features/gen_DomMatrix.rs @@ -354,6 +354,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix/DOMMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix`*"] + pub fn new_with_f32_array(array32: &::js_sys::Float32Array) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "DOMMatrix")] + #[doc = "The `new DomMatrix(..)` constructor, creating a new instance of `DomMatrix`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix/DOMMatrix)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix`*"] pub fn new_with_array64(array64: &mut [f64]) -> Result; #[wasm_bindgen(catch, constructor, js_class = "DOMMatrix")] #[doc = "The `new DomMatrix(..)` constructor, creating a new instance of `DomMatrix`."] @@ -361,6 +368,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix/DOMMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrix`*"] + pub fn new_with_f64_array(array64: &::js_sys::Float64Array) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "DOMMatrix")] + #[doc = "The `new DomMatrix(..)` constructor, creating a new instance of `DomMatrix`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix/DOMMatrix)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix`*"] pub fn new_with_number_sequence( number_sequence: &::wasm_bindgen::JsValue, ) -> Result; diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunk.rs b/crates/web-sys/src/features/gen_EncodedAudioChunk.rs index 5947f9de091..12f42400716 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunk.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunk.rs @@ -97,8 +97,22 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array( + pub fn copy_to_with_u8_slice( this: &EncodedAudioChunk, destination: &mut [u8], ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedAudioChunk" , js_name = copyTo)] + #[doc = "The `copyTo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk/copyTo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunk`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn copy_to_with_u8_array( + this: &EncodedAudioChunk, + destination: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunk.rs b/crates/web-sys/src/features/gen_EncodedVideoChunk.rs index 735112f30d6..b4372e5716c 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunk.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunk.rs @@ -97,8 +97,22 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array( + pub fn copy_to_with_u8_slice( this: &EncodedVideoChunk, destination: &mut [u8], ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "EncodedVideoChunk" , js_name = copyTo)] + #[doc = "The `copyTo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk/copyTo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `EncodedVideoChunk`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn copy_to_with_u8_array( + this: &EncodedVideoChunk, + destination: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs index 42499f45b31..3305164bc57 100644 --- a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs +++ b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs @@ -10,6 +10,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataArray`*"] pub type FetchReadableStreamReadDataArray; + #[doc = "Get the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataArray`*"] + #[wasm_bindgen(method, getter = "value")] + pub fn get_value(this: &FetchReadableStreamReadDataArray) -> Option>; + #[doc = "Change the `value` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataArray`*"] + #[wasm_bindgen(method, setter = "value")] + pub fn set_value(this: &FetchReadableStreamReadDataArray, val: &::js_sys::Uint8Array); } impl FetchReadableStreamReadDataArray { #[doc = "Construct a new `FetchReadableStreamReadDataArray`."] @@ -20,6 +30,11 @@ impl FetchReadableStreamReadDataArray { let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } + #[deprecated = "Use `set_value()` instead."] + pub fn value(&mut self, val: &::js_sys::Uint8Array) -> &mut Self { + self.set_value(val); + self + } } impl Default for FetchReadableStreamReadDataArray { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_File.rs b/crates/web-sys/src/features/gen_File.rs index bd97907da7e..61b67ec8d23 100644 --- a/crates/web-sys/src/features/gen_File.rs +++ b/crates/web-sys/src/features/gen_File.rs @@ -42,6 +42,16 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/File/File)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `File`*"] + pub fn new_with_u8_slice_sequence( + file_bits: &::wasm_bindgen::JsValue, + file_name: &str, + ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "File")] + #[doc = "The `new File(..)` constructor, creating a new instance of `File`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/File/File)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `File`*"] pub fn new_with_u8_array_sequence( file_bits: &::wasm_bindgen::JsValue, file_name: &str, @@ -85,6 +95,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/File/File)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `File`, `FilePropertyBag`*"] + pub fn new_with_u8_slice_sequence_and_options( + file_bits: &::wasm_bindgen::JsValue, + file_name: &str, + options: &FilePropertyBag, + ) -> Result; + #[cfg(feature = "FilePropertyBag")] + #[wasm_bindgen(catch, constructor, js_class = "File")] + #[doc = "The `new File(..)` constructor, creating a new instance of `File`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/File/File)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `File`, `FilePropertyBag`*"] pub fn new_with_u8_array_sequence_and_options( file_bits: &::wasm_bindgen::JsValue, file_name: &str, diff --git a/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs b/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs index beaac4a129d..aff3405c116 100644 --- a/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs +++ b/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs @@ -53,6 +53,16 @@ extern "C" { this: &FileSystemSyncAccessHandle, buffer: &mut [u8], ) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + pub fn read_with_js_u8_array( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Uint8Array, + ) -> Result; #[cfg(feature = "FileSystemReadWriteOptions")] # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] #[doc = "The `read()` method."] @@ -77,6 +87,18 @@ extern "C" { buffer: &mut [u8], options: &FileSystemReadWriteOptions, ) -> Result; + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + pub fn read_with_js_u8_array_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Uint8Array, + options: &FileSystemReadWriteOptions, + ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = truncate)] #[doc = "The `truncate()` method."] #[doc = ""] @@ -117,6 +139,16 @@ extern "C" { this: &FileSystemSyncAccessHandle, buffer: &[u8], ) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + pub fn write_with_js_u8_array( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Uint8Array, + ) -> Result; #[cfg(feature = "FileSystemReadWriteOptions")] # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] #[doc = "The `write()` method."] @@ -141,4 +173,16 @@ extern "C" { buffer: &[u8], options: &FileSystemReadWriteOptions, ) -> Result; + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + pub fn write_with_js_u8_array_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Uint8Array, + options: &FileSystemReadWriteOptions, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs b/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs index 8732dfc2721..9de810e62ef 100644 --- a/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs +++ b/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs @@ -72,6 +72,16 @@ extern "C" { this: &FileSystemWritableFileStream, data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + pub fn write_with_js_u8_array( + this: &FileSystemWritableFileStream, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] #[doc = "The `write()` method."] diff --git a/crates/web-sys/src/features/gen_FontFace.rs b/crates/web-sys/src/features/gen_FontFace.rs index 529713b2de0..0fc7544437f 100644 --- a/crates/web-sys/src/features/gen_FontFace.rs +++ b/crates/web-sys/src/features/gen_FontFace.rs @@ -187,6 +187,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] pub fn new_with_u8_array(family: &str, source: &[u8]) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "FontFace")] + #[doc = "The `new FontFace(..)` constructor, creating a new instance of `FontFace`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] + pub fn new_with_js_u8_array( + family: &str, + source: &::js_sys::Uint8Array, + ) -> Result; #[cfg(feature = "FontFaceDescriptors")] #[wasm_bindgen(catch, constructor, js_class = "FontFace")] #[doc = "The `new FontFace(..)` constructor, creating a new instance of `FontFace`."] @@ -235,6 +245,18 @@ extern "C" { source: &[u8], descriptors: &FontFaceDescriptors, ) -> Result; + #[cfg(feature = "FontFaceDescriptors")] + #[wasm_bindgen(catch, constructor, js_class = "FontFace")] + #[doc = "The `new FontFace(..)` constructor, creating a new instance of `FontFace`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FontFace`, `FontFaceDescriptors`*"] + pub fn new_with_js_u8_array_and_descriptors( + family: &str, + source: &::js_sys::Uint8Array, + descriptors: &FontFaceDescriptors, + ) -> Result; # [wasm_bindgen (catch , method , structural , js_class = "FontFace" , js_name = load)] #[doc = "The `load()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs index 899ecbc8bcb..9542ee8a414 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs @@ -179,7 +179,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_slice_and_u32_and_dynamic_offsets_data_length( this: &GpuComputePassEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -198,7 +198,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + this: &GpuComputePassEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: u32, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuComputePassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_slice_and_f64_and_dynamic_offsets_data_length( this: &GpuComputePassEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -207,6 +226,25 @@ extern "C" { dynamic_offsets_data_length: u32, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuComputePassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + this: &GpuComputePassEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: f64, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index 501aedbd2fa..116378e02ea 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -146,7 +146,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array( + pub fn write_buffer_with_u32_and_u8_slice( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -163,7 +163,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array( + pub fn write_buffer_with_f64_and_u8_slice( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -180,6 +180,40 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_u32( this: &GpuQueue, buffer: &GpuBuffer, @@ -216,7 +250,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_u32( + pub fn write_buffer_with_u32_and_u8_slice_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -234,7 +268,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_u32( + pub fn write_buffer_with_f64_and_u8_slice_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -252,6 +286,42 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_f64( this: &GpuQueue, buffer: &GpuBuffer, @@ -288,7 +358,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_f64( + pub fn write_buffer_with_u32_and_u8_slice_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -306,7 +376,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_f64( + pub fn write_buffer_with_f64_and_u8_slice_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -324,6 +394,42 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_u32_and_u32( this: &GpuQueue, buffer: &GpuBuffer, @@ -362,7 +468,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_u32_and_u32( + pub fn write_buffer_with_u32_and_u8_slice_and_u32_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -381,7 +487,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_u32_and_u32( + pub fn write_buffer_with_f64_and_u8_slice_and_u32_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -400,6 +506,44 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_u32_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: u32, + size: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_u32_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: u32, + size: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_f64_and_u32( this: &GpuQueue, buffer: &GpuBuffer, @@ -438,7 +582,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_f64_and_u32( + pub fn write_buffer_with_u32_and_u8_slice_and_f64_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -457,7 +601,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_f64_and_u32( + pub fn write_buffer_with_f64_and_u8_slice_and_f64_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -476,6 +620,44 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_f64_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: f64, + size: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_f64_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: f64, + size: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, @@ -514,7 +696,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_u32_and_f64( + pub fn write_buffer_with_u32_and_u8_slice_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -533,7 +715,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_u32_and_f64( + pub fn write_buffer_with_f64_and_u8_slice_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -552,6 +734,44 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_u32_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: u32, + size: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_u32_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: u32, + size: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_buffer_with_u32_and_buffer_source_and_f64_and_f64( this: &GpuQueue, buffer: &GpuBuffer, @@ -590,7 +810,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_u32_and_u8_array_and_f64_and_f64( + pub fn write_buffer_with_u32_and_u8_slice_and_f64_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, @@ -609,7 +829,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_buffer_with_f64_and_u8_array_and_f64_and_f64( + pub fn write_buffer_with_f64_and_u8_slice_and_f64_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, @@ -618,6 +838,44 @@ extern "C" { size: f64, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_u32_and_u8_array_and_f64_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Uint8Array, + data_offset: f64, + size: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_buffer_with_f64_and_u8_array_and_f64_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Uint8Array, + data_offset: f64, + size: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] @@ -646,7 +904,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_texture_with_u8_array_and_u32_sequence( + pub fn write_texture_with_u8_slice_and_u32_sequence( this: &GpuQueue, destination: &GpuImageCopyTexture, data: &[u8], @@ -654,6 +912,24 @@ extern "C" { size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + #[doc = "The `writeTexture()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_texture_with_u8_array_and_u32_sequence( + this: &GpuQueue, + destination: &GpuImageCopyTexture, + data: &::js_sys::Uint8Array, + data_layout: &GpuImageDataLayout, + size: &::wasm_bindgen::JsValue, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture", @@ -690,11 +966,33 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn write_texture_with_u8_array_and_gpu_extent_3d_dict( + pub fn write_texture_with_u8_slice_and_gpu_extent_3d_dict( this: &GpuQueue, destination: &GpuImageCopyTexture, data: &[u8], data_layout: &GpuImageDataLayout, size: &GpuExtent3dDict, ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "GpuExtent3dDict", + feature = "GpuImageCopyTexture", + feature = "GpuImageDataLayout", + ))] + # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + #[doc = "The `writeTexture()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_texture_with_u8_array_and_gpu_extent_3d_dict( + this: &GpuQueue, + destination: &GpuImageCopyTexture, + data: &::js_sys::Uint8Array, + data_layout: &GpuImageDataLayout, + size: &GpuExtent3dDict, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs index 355f86931f8..b57bec64474 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs @@ -109,7 +109,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_slice_and_u32_and_dynamic_offsets_data_length( this: &GpuRenderBundleEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -128,7 +128,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + this: &GpuRenderBundleEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: u32, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuRenderBundleEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_slice_and_f64_and_dynamic_offsets_data_length( this: &GpuRenderBundleEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -137,6 +156,25 @@ extern "C" { dynamic_offsets_data_length: u32, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderBundleEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuRenderBundleEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + this: &GpuRenderBundleEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: f64, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderBundleEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs index 131609d43e0..cb1e6499c26 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs @@ -196,7 +196,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_slice_and_u32_and_dynamic_offsets_data_length( this: &GpuRenderPassEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -215,7 +215,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length( + this: &GpuRenderPassEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: u32, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuRenderPassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_slice_and_f64_and_dynamic_offsets_data_length( this: &GpuRenderPassEncoder, index: u32, bind_group: Option<&GpuBindGroup>, @@ -224,6 +243,25 @@ extern "C" { dynamic_offsets_data_length: u32, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBindGroup")] + # [wasm_bindgen (catch , method , structural , js_class = "GPURenderPassEncoder" , js_name = setBindGroup)] + #[doc = "The `setBindGroup()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBindGroup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBindGroup`, `GpuRenderPassEncoder`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length( + this: &GpuRenderPassEncoder, + index: u32, + bind_group: Option<&GpuBindGroup>, + dynamic_offsets_data: &::js_sys::Uint32Array, + dynamic_offsets_data_start: f64, + dynamic_offsets_data_length: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPURenderPassEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HidDevice.rs b/crates/web-sys/src/features/gen_HidDevice.rs index 3a24d5d9607..51bc70e5f2f 100644 --- a/crates/web-sys/src/features/gen_HidDevice.rs +++ b/crates/web-sys/src/features/gen_HidDevice.rs @@ -127,7 +127,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn receive_feature_report(this: &HidDevice, report_id: u8) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] #[doc = "The `sendFeatureReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendFeatureReport)"] @@ -140,9 +140,9 @@ extern "C" { this: &HidDevice, report_id: u8, data: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] #[doc = "The `sendFeatureReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendFeatureReport)"] @@ -151,13 +151,28 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn send_feature_report_with_u8_array( + pub fn send_feature_report_with_u8_slice( this: &HidDevice, report_id: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendFeatureReport)] + #[doc = "The `sendFeatureReport()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendFeatureReport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn send_feature_report_with_u8_array( + this: &HidDevice, + report_id: u8, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendReport)] #[doc = "The `sendReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport)"] @@ -170,9 +185,9 @@ extern "C" { this: &HidDevice, report_id: u8, data: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "HIDDevice" , js_name = sendReport)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendReport)] #[doc = "The `sendReport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport)"] @@ -181,9 +196,24 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn send_report_with_u8_array( + pub fn send_report_with_u8_slice( this: &HidDevice, report_id: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "HIDDevice" , js_name = sendReport)] + #[doc = "The `sendReport()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HidDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn send_report_with_u8_array( + this: &HidDevice, + report_id: u8, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; } diff --git a/crates/web-sys/src/features/gen_IdbFileHandle.rs b/crates/web-sys/src/features/gen_IdbFileHandle.rs index 2c679fa388b..250f3c233e3 100644 --- a/crates/web-sys/src/features/gen_IdbFileHandle.rs +++ b/crates/web-sys/src/features/gen_IdbFileHandle.rs @@ -55,6 +55,22 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] #[deprecated] pub fn set_location(this: &IdbFileHandle, value: Option); + # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = locationOptU32)] + #[doc = "Setter for the `locationOptU32` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/locationOptU32)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] + pub fn set_location_opt_u32(this: &IdbFileHandle, value: Option); + # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = locationOptF64)] + #[doc = "Setter for the `locationOptF64` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/locationOptF64)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] + #[deprecated] + pub fn set_location_opt_f64(this: &IdbFileHandle, value: Option); # [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = oncomplete)] #[doc = "Getter for the `oncomplete` field of this object."] #[doc = ""] @@ -159,6 +175,18 @@ extern "C" { this: &IdbFileHandle, value: &mut [u8], ) -> Result, JsValue>; + #[cfg(feature = "IdbFileRequest")] + # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = append)] + #[doc = "The `append()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] + pub fn append_with_js_u8_array( + this: &IdbFileHandle, + value: &::js_sys::Uint8Array, + ) -> Result, JsValue>; #[cfg(all(feature = "Blob", feature = "IdbFileRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = append)] #[doc = "The `append()` method."] @@ -356,6 +384,18 @@ extern "C" { this: &IdbFileHandle, value: &[u8], ) -> Result, JsValue>; + #[cfg(feature = "IdbFileRequest")] + # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"] + #[deprecated] + pub fn write_with_js_u8_array( + this: &IdbFileHandle, + value: &::js_sys::Uint8Array, + ) -> Result, JsValue>; #[cfg(all(feature = "Blob", feature = "IdbFileRequest",))] # [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = write)] #[doc = "The `write()` method."] diff --git a/crates/web-sys/src/features/gen_IirFilterNode.rs b/crates/web-sys/src/features/gen_IirFilterNode.rs index b84c9f12f02..90fa7b187d6 100644 --- a/crates/web-sys/src/features/gen_IirFilterNode.rs +++ b/crates/web-sys/src/features/gen_IirFilterNode.rs @@ -35,4 +35,88 @@ extern "C" { mag_response: &mut [f32], phase_response: &mut [f32], ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_slice_and_f32_slice( + this: &IirFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &mut [f32], + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_array_and_f32_slice( + this: &IirFilterNode, + frequency_hz: &mut [f32], + mag_response: &::js_sys::Float32Array, + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_array_and_f32_slice( + this: &IirFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &::js_sys::Float32Array, + phase_response: &mut [f32], + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_slice_and_f32_array( + this: &IirFilterNode, + frequency_hz: &mut [f32], + mag_response: &mut [f32], + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_slice_and_f32_array( + this: &IirFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &mut [f32], + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_slice_and_f32_array_and_f32_array( + this: &IirFilterNode, + frequency_hz: &mut [f32], + mag_response: &::js_sys::Float32Array, + phase_response: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "IIRFilterNode" , js_name = getFrequencyResponse)] + #[doc = "The `getFrequencyResponse()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IIRFilterNode/getFrequencyResponse)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `IirFilterNode`*"] + pub fn get_frequency_response_with_f32_array_and_f32_array_and_f32_array( + this: &IirFilterNode, + frequency_hz: &::js_sys::Float32Array, + mag_response: &::js_sys::Float32Array, + phase_response: &::js_sys::Float32Array, + ); } diff --git a/crates/web-sys/src/features/gen_ImageData.rs b/crates/web-sys/src/features/gen_ImageData.rs index a7d624a75a6..71081d12b86 100644 --- a/crates/web-sys/src/features/gen_ImageData.rs +++ b/crates/web-sys/src/features/gen_ImageData.rs @@ -56,9 +56,30 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageData`*"] + pub fn new_with_js_u8_clamped_array( + data: &::js_sys::Uint8ClampedArray, + sw: u32, + ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "ImageData")] + #[doc = "The `new ImageData(..)` constructor, creating a new instance of `ImageData`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`*"] pub fn new_with_u8_clamped_array_and_sh( data: ::wasm_bindgen::Clamped<&[u8]>, sw: u32, sh: u32, ) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "ImageData")] + #[doc = "The `new ImageData(..)` constructor, creating a new instance of `ImageData`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageData`*"] + pub fn new_with_js_u8_clamped_array_and_sh( + data: &::js_sys::Uint8ClampedArray, + sw: u32, + sh: u32, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_KeyframeEffect.rs b/crates/web-sys/src/features/gen_KeyframeEffect.rs index 5492193500d..fd899dfeba7 100644 --- a/crates/web-sys/src/features/gen_KeyframeEffect.rs +++ b/crates/web-sys/src/features/gen_KeyframeEffect.rs @@ -25,7 +25,27 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffect`*"] + #[deprecated] pub fn set_target(this: &KeyframeEffect, value: Option<&::js_sys::Object>); + #[cfg(feature = "Element")] + # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = targetOptElement)] + #[doc = "Setter for the `targetOptElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/targetOptElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `KeyframeEffect`*"] + pub fn set_target_opt_element(this: &KeyframeEffect, value: Option<&Element>); + #[cfg(feature = "CssPseudoElement")] + # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = targetOptCssPseudoElement)] + #[doc = "Setter for the `targetOptCssPseudoElement` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/targetOptCssPseudoElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssPseudoElement`, `KeyframeEffect`*"] + pub fn set_target_opt_css_pseudo_element( + this: &KeyframeEffect, + value: Option<&CssPseudoElement>, + ); #[cfg(feature = "IterationCompositeOperation")] # [wasm_bindgen (structural , method , getter , js_class = "KeyframeEffect" , js_name = iterationComposite)] #[doc = "Getter for the `iterationComposite` field of this object."] diff --git a/crates/web-sys/src/features/gen_MediaKeySession.rs b/crates/web-sys/src/features/gen_MediaKeySession.rs index 8f639f8a6fd..e44f671b90e 100644 --- a/crates/web-sys/src/features/gen_MediaKeySession.rs +++ b/crates/web-sys/src/features/gen_MediaKeySession.rs @@ -106,6 +106,17 @@ extern "C" { init_data_type: &str, init_data: &mut [u8], ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "MediaKeySession" , js_name = generateRequest)] + #[doc = "The `generateRequest()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/generateRequest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySession`*"] + pub fn generate_request_with_js_u8_array( + this: &MediaKeySession, + init_data_type: &str, + init_data: &::js_sys::Uint8Array, + ) -> ::js_sys::Promise; # [wasm_bindgen (method , structural , js_class = "MediaKeySession" , js_name = load)] #[doc = "The `load()` method."] #[doc = ""] @@ -137,4 +148,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySession`*"] pub fn update_with_u8_array(this: &MediaKeySession, response: &mut [u8]) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "MediaKeySession" , js_name = update)] + #[doc = "The `update()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/update)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeySession`*"] + pub fn update_with_js_u8_array( + this: &MediaKeySession, + response: &::js_sys::Uint8Array, + ) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs b/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs index f753b5a98e2..630b356b373 100644 --- a/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs +++ b/crates/web-sys/src/features/gen_MediaKeyStatusMap.rs @@ -54,6 +54,16 @@ extern "C" { this: &MediaKeyStatusMap, key_id: &mut [u8], ) -> Result<::wasm_bindgen::JsValue, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "MediaKeyStatusMap" , js_name = get)] + #[doc = "The `get()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/get)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn get_with_js_u8_array( + this: &MediaKeyStatusMap, + key_id: &::js_sys::Uint8Array, + ) -> Result<::wasm_bindgen::JsValue, JsValue>; # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = has)] #[doc = "The `has()` method."] #[doc = ""] @@ -68,6 +78,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] pub fn has_with_u8_array(this: &MediaKeyStatusMap, key_id: &mut [u8]) -> bool; + # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = has)] + #[doc = "The `has()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeyStatusMap/has)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeyStatusMap`*"] + pub fn has_with_js_u8_array(this: &MediaKeyStatusMap, key_id: &::js_sys::Uint8Array) -> bool; # [wasm_bindgen (method , structural , js_class = "MediaKeyStatusMap" , js_name = keys)] #[doc = "The `keys()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaKeys.rs b/crates/web-sys/src/features/gen_MediaKeys.rs index 6386a769ae8..2bd7edacca7 100644 --- a/crates/web-sys/src/features/gen_MediaKeys.rs +++ b/crates/web-sys/src/features/gen_MediaKeys.rs @@ -76,4 +76,14 @@ extern "C" { this: &MediaKeys, server_certificate: &mut [u8], ) -> ::js_sys::Promise; + # [wasm_bindgen (method , structural , js_class = "MediaKeys" , js_name = setServerCertificate)] + #[doc = "The `setServerCertificate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeys/setServerCertificate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaKeys`*"] + pub fn set_server_certificate_with_js_u8_array( + this: &MediaKeys, + server_certificate: &::js_sys::Uint8Array, + ) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs index 9ea620bda4a..aa5489fcabb 100644 --- a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs @@ -40,6 +40,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] #[wasm_bindgen(method, setter = "composed")] pub fn set_composed(this: &MidiMessageEventInit, val: bool); + #[doc = "Get the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[wasm_bindgen(method, getter = "data")] + pub fn get_data(this: &MidiMessageEventInit) -> Option>; + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] + #[wasm_bindgen(method, setter = "data")] + pub fn set_data(this: &MidiMessageEventInit, val: &::js_sys::Uint8Array); } impl MidiMessageEventInit { #[doc = "Construct a new `MidiMessageEventInit`."] @@ -65,6 +75,11 @@ impl MidiMessageEventInit { self.set_composed(val); self } + #[deprecated = "Use `set_data()` instead."] + pub fn data(&mut self, val: &::js_sys::Uint8Array) -> &mut Self { + self.set_data(val); + self + } } impl Default for MidiMessageEventInit { fn default() -> Self { diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 114e7faf128..374cd3a4cf6 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -457,6 +457,17 @@ extern "C" { url: &str, data: Option<&mut [u8]>, ) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "Navigator" , js_name = sendBeacon)] + #[doc = "The `sendBeacon()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] + pub fn send_beacon_with_opt_js_u8_array( + this: &Navigator, + url: &str, + data: Option<&::js_sys::Uint8Array>, + ) -> Result; #[cfg(feature = "FormData")] # [wasm_bindgen (catch , method , structural , js_class = "Navigator" , js_name = sendBeacon)] #[doc = "The `sendBeacon()` method."] diff --git a/crates/web-sys/src/features/gen_OfflineAudioContext.rs b/crates/web-sys/src/features/gen_OfflineAudioContext.rs index 52e392a76fd..6d535cea967 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioContext.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioContext.rs @@ -295,6 +295,42 @@ extern "C" { real: &mut [f32], imag: &mut [f32], ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice( + this: &OfflineAudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array( + this: &OfflineAudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + ) -> Result; + #[cfg(feature = "PeriodicWave")] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array( + this: &OfflineAudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + ) -> Result; #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] #[doc = "The `createPeriodicWave()` method."] @@ -308,6 +344,45 @@ extern "C" { imag: &mut [f32], constraints: &PeriodicWaveConstraints, ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_slice_and_constraints( + this: &OfflineAudioContext, + real: &::js_sys::Float32Array, + imag: &mut [f32], + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_slice_and_f32_array_and_constraints( + this: &OfflineAudioContext, + real: &mut [f32], + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; + #[cfg(all(feature = "PeriodicWave", feature = "PeriodicWaveConstraints",))] + # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createPeriodicWave)] + #[doc = "The `createPeriodicWave()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext/createPeriodicWave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OfflineAudioContext`, `PeriodicWave`, `PeriodicWaveConstraints`*"] + pub fn create_periodic_wave_with_f32_array_and_f32_array_and_constraints( + this: &OfflineAudioContext, + real: &::js_sys::Float32Array, + imag: &::js_sys::Float32Array, + constraints: &PeriodicWaveConstraints, + ) -> Result; #[cfg(feature = "ScriptProcessorNode")] # [wasm_bindgen (catch , method , structural , js_class = "OfflineAudioContext" , js_name = createScriptProcessor)] #[doc = "The `createScriptProcessor()` method."] diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index c795d1a8659..407c3ea01de 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -66,10 +66,40 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[deprecated] pub fn set_stroke_style( this: &OffscreenCanvasRenderingContext2d, value: &::wasm_bindgen::JsValue, ); + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleStr)] + #[doc = "Setter for the `strokeStyleStr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleStr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn set_stroke_style_str(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleCanvasGradient)] + #[doc = "Setter for the `strokeStyleCanvasGradient` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleCanvasGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_stroke_style_canvas_gradient( + this: &OffscreenCanvasRenderingContext2d, + value: &CanvasGradient, + ); + #[cfg(feature = "CanvasPattern")] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleCanvasPattern)] + #[doc = "Setter for the `strokeStyleCanvasPattern` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleCanvasPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_stroke_style_canvas_pattern( + this: &OffscreenCanvasRenderingContext2d, + value: &CanvasPattern, + ); # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] #[doc = "Getter for the `fillStyle` field of this object."] #[doc = ""] @@ -83,10 +113,40 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + #[deprecated] pub fn set_fill_style( this: &OffscreenCanvasRenderingContext2d, value: &::wasm_bindgen::JsValue, ); + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleStr)] + #[doc = "Setter for the `fillStyleStr` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleStr)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn set_fill_style_str(this: &OffscreenCanvasRenderingContext2d, value: &str); + #[cfg(feature = "CanvasGradient")] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleCanvasGradient)] + #[doc = "Setter for the `fillStyleCanvasGradient` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleCanvasGradient)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_fill_style_canvas_gradient( + this: &OffscreenCanvasRenderingContext2d, + value: &CanvasGradient, + ); + #[cfg(feature = "CanvasPattern")] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleCanvasPattern)] + #[doc = "Setter for the `fillStyleCanvasPattern` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleCanvasPattern)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_fill_style_canvas_pattern( + this: &OffscreenCanvasRenderingContext2d, + value: &CanvasPattern, + ); # [wasm_bindgen (structural , method , getter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = filter)] #[doc = "Getter for the `filter` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PresentationConnection.rs b/crates/web-sys/src/features/gen_PresentationConnection.rs index 23e950cbc30..f7099833a71 100644 --- a/crates/web-sys/src/features/gen_PresentationConnection.rs +++ b/crates/web-sys/src/features/gen_PresentationConnection.rs @@ -155,6 +155,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`*"] pub fn send_with_u8_array(this: &PresentationConnection, data: &[u8]) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "PresentationConnection" , js_name = send)] + #[doc = "The `send()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PresentationConnection/send)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`*"] + pub fn send_with_js_u8_array( + this: &PresentationConnection, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "PresentationConnection" , js_name = terminate)] #[doc = "The `terminate()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs index 5ca98c246a2..016d9436e5c 100644 --- a/crates/web-sys/src/features/gen_ReadableByteStreamController.rs +++ b/crates/web-sys/src/features/gen_ReadableByteStreamController.rs @@ -54,6 +54,16 @@ extern "C" { this: &ReadableByteStreamController, chunk: &mut [u8], ) -> 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_js_u8_array( + this: &ReadableByteStreamController, + chunk: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = error)] #[doc = "The `error()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs index 7040254c927..5a8863bc90d 100644 --- a/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs +++ b/crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs @@ -59,4 +59,14 @@ extern "C" { this: &ReadableStreamByobRequest, view: &mut [u8], ) -> 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_js_u8_array( + this: &ReadableStreamByobRequest, + view: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_Response.rs b/crates/web-sys/src/features/gen_Response.rs index 90f0fcb5d58..942fb9cb56c 100644 --- a/crates/web-sys/src/features/gen_Response.rs +++ b/crates/web-sys/src/features/gen_Response.rs @@ -108,6 +108,15 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] pub fn new_with_opt_u8_array(body: Option<&mut [u8]>) -> Result; + #[wasm_bindgen(catch, constructor, js_class = "Response")] + #[doc = "The `new Response(..)` constructor, creating a new instance of `Response`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Response`*"] + pub fn new_with_opt_js_u8_array( + body: Option<&::js_sys::Uint8Array>, + ) -> Result; #[cfg(feature = "FormData")] #[wasm_bindgen(catch, constructor, js_class = "Response")] #[doc = "The `new Response(..)` constructor, creating a new instance of `Response`."] @@ -175,6 +184,17 @@ extern "C" { body: Option<&mut [u8]>, init: &ResponseInit, ) -> Result; + #[cfg(feature = "ResponseInit")] + #[wasm_bindgen(catch, constructor, js_class = "Response")] + #[doc = "The `new Response(..)` constructor, creating a new instance of `Response`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Response`, `ResponseInit`*"] + pub fn new_with_opt_js_u8_array_and_init( + body: Option<&::js_sys::Uint8Array>, + init: &ResponseInit, + ) -> Result; #[cfg(all(feature = "FormData", feature = "ResponseInit",))] #[wasm_bindgen(catch, constructor, js_class = "Response")] #[doc = "The `new Response(..)` constructor, creating a new instance of `Response`."] diff --git a/crates/web-sys/src/features/gen_RtcDataChannel.rs b/crates/web-sys/src/features/gen_RtcDataChannel.rs index 09913d28b0a..9aac13cf490 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannel.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannel.rs @@ -211,4 +211,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`*"] pub fn send_with_u8_array(this: &RtcDataChannel, data: &[u8]) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "RTCDataChannel" , js_name = send)] + #[doc = "The `send()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`*"] + pub fn send_with_js_u8_array( + this: &RtcDataChannel, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 8bc85580089..91c758f6b67 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -57,16 +57,35 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transform(this: &RtcRtpReceiver) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transform)] - #[doc = "Setter for the `transform` field of this object."] + #[cfg(feature = "SFrameTransform")] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transformOptSFrameTransform)] + #[doc = "Setter for the `transformOptSFrameTransform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transformOptSFrameTransform)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`*"] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_transform_opt_s_frame_transform( + this: &RtcRtpReceiver, + value: Option<&SFrameTransform>, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcRtpScriptTransform")] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transformOptRtcRtpScriptTransform)] + #[doc = "Setter for the `transformOptRtcRtpScriptTransform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transformOptRtcRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcRtpScriptTransform`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_transform(this: &RtcRtpReceiver, value: Option<&::js_sys::Object>); + pub fn set_transform_opt_rtc_rtp_script_transform( + this: &RtcRtpReceiver, + value: Option<&RtcRtpScriptTransform>, + ); #[cfg(feature = "RtcRtpCapabilities")] # [wasm_bindgen (static_method_of = RtcRtpReceiver , js_class = "RTCRtpReceiver" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 7aa2057004f..9f72d14788e 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -40,16 +40,35 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transform(this: &RtcRtpSender) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transform)] - #[doc = "Setter for the `transform` field of this object."] + #[cfg(feature = "SFrameTransform")] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transformOptSFrameTransform)] + #[doc = "Setter for the `transformOptSFrameTransform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transformOptSFrameTransform)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`*"] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`, `SFrameTransform`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_transform_opt_s_frame_transform( + this: &RtcRtpSender, + value: Option<&SFrameTransform>, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcRtpScriptTransform")] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transformOptRtcRtpScriptTransform)] + #[doc = "Setter for the `transformOptRtcRtpScriptTransform` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transformOptRtcRtpScriptTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`, `RtcRtpSender`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn set_transform(this: &RtcRtpSender, value: Option<&::js_sys::Object>); + pub fn set_transform_opt_rtc_rtp_script_transform( + this: &RtcRtpSender, + value: Option<&RtcRtpScriptTransform>, + ); #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = generateKeyFrame)] #[doc = "The `generateKeyFrame()` method."] diff --git a/crates/web-sys/src/features/gen_SourceBuffer.rs b/crates/web-sys/src/features/gen_SourceBuffer.rs index a67b53271cf..a205b4827ac 100644 --- a/crates/web-sys/src/features/gen_SourceBuffer.rs +++ b/crates/web-sys/src/features/gen_SourceBuffer.rs @@ -214,6 +214,16 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `SourceBuffer`*"] pub fn append_buffer_with_u8_array(this: &SourceBuffer, data: &mut [u8]) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "SourceBuffer" , js_name = appendBuffer)] + #[doc = "The `appendBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/appendBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SourceBuffer`*"] + pub fn append_buffer_with_js_u8_array( + this: &SourceBuffer, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SourceBuffer" , js_name = appendBufferAsync)] #[doc = "The `appendBufferAsync()` method."] #[doc = ""] @@ -244,6 +254,16 @@ extern "C" { this: &SourceBuffer, data: &mut [u8], ) -> Result<::js_sys::Promise, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "SourceBuffer" , js_name = appendBufferAsync)] + #[doc = "The `appendBufferAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/appendBufferAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SourceBuffer`*"] + pub fn append_buffer_async_with_js_u8_array( + this: &SourceBuffer, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SourceBuffer" , js_name = changeType)] #[doc = "The `changeType()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SubtleCrypto.rs b/crates/web-sys/src/features/gen_SubtleCrypto.rs index b32159f5420..3a9cdbf5b95 100644 --- a/crates/web-sys/src/features/gen_SubtleCrypto.rs +++ b/crates/web-sys/src/features/gen_SubtleCrypto.rs @@ -65,6 +65,32 @@ extern "C" { data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = decrypt)] + #[doc = "The `decrypt()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn decrypt_with_object_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = decrypt)] + #[doc = "The `decrypt()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn decrypt_with_str_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = deriveBits)] #[doc = "The `deriveBits()` method."] #[doc = ""] @@ -194,6 +220,28 @@ extern "C" { algorithm: &str, data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = digest)] + #[doc = "The `digest()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubtleCrypto`*"] + pub fn digest_with_object_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = digest)] + #[doc = "The `digest()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SubtleCrypto`*"] + pub fn digest_with_str_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = encrypt)] #[doc = "The `encrypt()` method."] @@ -247,6 +295,32 @@ extern "C" { data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = encrypt)] + #[doc = "The `encrypt()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn encrypt_with_object_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = encrypt)] + #[doc = "The `encrypt()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn encrypt_with_str_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = exportKey)] #[doc = "The `exportKey()` method."] #[doc = ""] @@ -363,6 +437,32 @@ extern "C" { data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = sign)] + #[doc = "The `sign()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn sign_with_object_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = sign)] + #[doc = "The `sign()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn sign_with_str_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = unwrapKey)] #[doc = "The `unwrapKey()` method."] #[doc = ""] @@ -403,6 +503,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn unwrap_key_with_js_u8_array_and_object_and_object( + this: &SubtleCrypto, + format: &str, + wrapped_key: &::js_sys::Uint8Array, + unwrapping_key: &CryptoKey, + unwrap_algorithm: &::js_sys::Object, + unwrapped_key_algorithm: &::js_sys::Object, + extractable: bool, + key_usages: &::wasm_bindgen::JsValue, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = unwrapKey)] + #[doc = "The `unwrapKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] pub fn unwrap_key_with_buffer_source_and_str_and_object( this: &SubtleCrypto, format: &str, @@ -437,6 +554,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn unwrap_key_with_js_u8_array_and_str_and_object( + this: &SubtleCrypto, + format: &str, + wrapped_key: &::js_sys::Uint8Array, + unwrapping_key: &CryptoKey, + unwrap_algorithm: &str, + unwrapped_key_algorithm: &::js_sys::Object, + extractable: bool, + key_usages: &::wasm_bindgen::JsValue, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = unwrapKey)] + #[doc = "The `unwrapKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] pub fn unwrap_key_with_buffer_source_and_object_and_str( this: &SubtleCrypto, format: &str, @@ -471,6 +605,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn unwrap_key_with_js_u8_array_and_object_and_str( + this: &SubtleCrypto, + format: &str, + wrapped_key: &::js_sys::Uint8Array, + unwrapping_key: &CryptoKey, + unwrap_algorithm: &::js_sys::Object, + unwrapped_key_algorithm: &str, + extractable: bool, + key_usages: &::wasm_bindgen::JsValue, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = unwrapKey)] + #[doc = "The `unwrapKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] pub fn unwrap_key_with_buffer_source_and_str_and_str( this: &SubtleCrypto, format: &str, @@ -499,6 +650,23 @@ extern "C" { key_usages: &::wasm_bindgen::JsValue, ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = unwrapKey)] + #[doc = "The `unwrapKey()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/unwrapKey)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn unwrap_key_with_js_u8_array_and_str_and_str( + this: &SubtleCrypto, + format: &str, + wrapped_key: &::js_sys::Uint8Array, + unwrapping_key: &CryptoKey, + unwrap_algorithm: &str, + unwrapped_key_algorithm: &str, + extractable: bool, + key_usages: &::wasm_bindgen::JsValue, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] #[doc = "The `verify()` method."] #[doc = ""] @@ -561,6 +729,34 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_object_and_js_u8_array_and_buffer_source( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &::js_sys::Object, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_str_and_js_u8_array_and_buffer_source( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &::js_sys::Object, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] pub fn verify_with_object_and_buffer_source_and_u8_array( this: &SubtleCrypto, algorithm: &::js_sys::Object, @@ -611,6 +807,118 @@ extern "C" { data: &[u8], ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_object_and_u8_array_and_u8_slice( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &[u8], + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_str_and_u8_array_and_u8_slice( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &[u8], + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_object_and_buffer_source_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + signature: &::js_sys::Object, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_str_and_buffer_source_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + signature: &::js_sys::Object, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_object_and_u8_slice_and_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + signature: &[u8], + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_str_and_u8_slice_and_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + signature: &[u8], + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_object_and_js_u8_array_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &::js_sys::Object, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] + # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = verify)] + #[doc = "The `verify()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CryptoKey`, `SubtleCrypto`*"] + pub fn verify_with_str_and_js_u8_array_and_js_u8_array( + this: &SubtleCrypto, + algorithm: &str, + key: &CryptoKey, + signature: &::js_sys::Uint8Array, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(feature = "CryptoKey")] # [wasm_bindgen (catch , method , structural , js_class = "SubtleCrypto" , js_name = wrapKey)] #[doc = "The `wrapKey()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TextDecoder.rs b/crates/web-sys/src/features/gen_TextDecoder.rs index a8f4eb3f54e..823e8ad20e2 100644 --- a/crates/web-sys/src/features/gen_TextDecoder.rs +++ b/crates/web-sys/src/features/gen_TextDecoder.rs @@ -75,6 +75,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] pub fn decode_with_u8_array(this: &TextDecoder, input: &[u8]) -> Result; + # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] + #[doc = "The `decode()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] + pub fn decode_with_js_u8_array( + this: &TextDecoder, + input: &::js_sys::Uint8Array, + ) -> Result; #[cfg(feature = "TextDecodeOptions")] # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] @@ -99,4 +109,16 @@ extern "C" { input: &[u8], options: &TextDecodeOptions, ) -> Result; + #[cfg(feature = "TextDecodeOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] + #[doc = "The `decode()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `TextDecodeOptions`, `TextDecoder`*"] + pub fn decode_with_js_u8_array_and_options( + this: &TextDecoder, + input: &::js_sys::Uint8Array, + options: &TextDecodeOptions, + ) -> Result; } diff --git a/crates/web-sys/src/features/gen_UsbDevice.rs b/crates/web-sys/src/features/gen_UsbDevice.rs index 5bedd76cc51..8ac1f4737b6 100644 --- a/crates/web-sys/src/features/gen_UsbDevice.rs +++ b/crates/web-sys/src/features/gen_UsbDevice.rs @@ -275,7 +275,7 @@ extern "C" { ) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbControlTransferParameters")] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] #[doc = "The `controlTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/controlTransferOut)"] @@ -288,10 +288,10 @@ extern "C" { this: &UsbDevice, setup: &UsbControlTransferParameters, data: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbControlTransferParameters")] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] #[doc = "The `controlTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/controlTransferOut)"] @@ -300,11 +300,27 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn control_transfer_out_with_u8_array( + pub fn control_transfer_out_with_u8_slice( this: &UsbDevice, setup: &UsbControlTransferParameters, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "UsbControlTransferParameters")] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = controlTransferOut)] + #[doc = "The `controlTransferOut()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/controlTransferOut)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn control_transfer_out_with_u8_array( + this: &UsbDevice, + setup: &UsbControlTransferParameters, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = forget)] #[doc = "The `forget()` method."] @@ -332,7 +348,7 @@ extern "C" { packet_lengths: &::wasm_bindgen::JsValue, ) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] #[doc = "The `isochronousTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/isochronousTransferOut)"] @@ -346,9 +362,9 @@ extern "C" { endpoint_number: u8, data: &::js_sys::Object, packet_lengths: &::wasm_bindgen::JsValue, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] #[doc = "The `isochronousTransferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/isochronousTransferOut)"] @@ -357,12 +373,28 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn isochronous_transfer_out_with_u8_array( + pub fn isochronous_transfer_out_with_u8_slice( this: &UsbDevice, endpoint_number: u8, data: &mut [u8], packet_lengths: &::wasm_bindgen::JsValue, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = isochronousTransferOut)] + #[doc = "The `isochronousTransferOut()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/isochronousTransferOut)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn isochronous_transfer_out_with_u8_array( + this: &UsbDevice, + endpoint_number: u8, + data: &::js_sys::Uint8Array, + packet_lengths: &::wasm_bindgen::JsValue, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = open)] #[doc = "The `open()` method."] @@ -434,7 +466,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn transfer_in(this: &UsbDevice, endpoint_number: u8, length: u32) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = transferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = transferOut)] #[doc = "The `transferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/transferOut)"] @@ -447,9 +479,9 @@ extern "C" { this: &UsbDevice, endpoint_number: u8, data: &::js_sys::Object, - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "USBDevice" , js_name = transferOut)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = transferOut)] #[doc = "The `transferOut()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/transferOut)"] @@ -458,9 +490,24 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn transfer_out_with_u8_array( + pub fn transfer_out_with_u8_slice( this: &UsbDevice, endpoint_number: u8, data: &mut [u8], - ) -> ::js_sys::Promise; + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "USBDevice" , js_name = transferOut)] + #[doc = "The `transferOut()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/USBDevice/transferOut)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `UsbDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn transfer_out_with_u8_array( + this: &UsbDevice, + endpoint_number: u8, + data: &::js_sys::Uint8Array, + ) -> Result<::js_sys::Promise, JsValue>; } diff --git a/crates/web-sys/src/features/gen_VideoFrame.rs b/crates/web-sys/src/features/gen_VideoFrame.rs index 7ae9be362f7..962c353b1b5 100644 --- a/crates/web-sys/src/features/gen_VideoFrame.rs +++ b/crates/web-sys/src/features/gen_VideoFrame.rs @@ -344,11 +344,26 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn new_with_u8_array_and_video_frame_buffer_init( + pub fn new_with_u8_slice_and_video_frame_buffer_init( data: &mut [u8], init: &VideoFrameBufferInit, ) -> Result; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrameBufferInit")] + #[wasm_bindgen(catch, constructor, js_class = "VideoFrame")] + #[doc = "The `new VideoFrame(..)` constructor, creating a new instance of `VideoFrame`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/VideoFrame)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `VideoFrameBufferInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new_with_u8_array_and_video_frame_buffer_init( + data: &::js_sys::Uint8Array, + init: &VideoFrameBufferInit, + ) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "VideoFrame" , js_name = allocationSize)] #[doc = "The `allocationSize()` method."] #[doc = ""] @@ -420,7 +435,21 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array(this: &VideoFrame, destination: &mut [u8]) -> ::js_sys::Promise; + pub fn copy_to_with_u8_slice(this: &VideoFrame, destination: &mut [u8]) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = copyTo)] + #[doc = "The `copyTo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/copyTo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn copy_to_with_u8_array( + this: &VideoFrame, + destination: &::js_sys::Uint8Array, + ) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "VideoFrameCopyToOptions")] # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = copyTo)] @@ -448,9 +477,25 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn copy_to_with_u8_array_and_options( + pub fn copy_to_with_u8_slice_and_options( this: &VideoFrame, destination: &mut [u8], options: &VideoFrameCopyToOptions, ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "VideoFrameCopyToOptions")] + # [wasm_bindgen (method , structural , js_class = "VideoFrame" , js_name = copyTo)] + #[doc = "The `copyTo()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/copyTo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `VideoFrameCopyToOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn copy_to_with_u8_array_and_options( + this: &VideoFrame, + destination: &::js_sys::Uint8Array, + options: &VideoFrameCopyToOptions, + ) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_VrMockController.rs b/crates/web-sys/src/features/gen_VrMockController.rs index 134a3b529ea..dfc048210fd 100644 --- a/crates/web-sys/src/features/gen_VrMockController.rs +++ b/crates/web-sys/src/features/gen_VrMockController.rs @@ -41,4 +41,949 @@ extern "C" { angular_velocity: Option<&mut [f32]>, angular_acceleration: Option<&mut [f32]>, ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockController" , js_name = newPoseMove)] + #[doc = "The `newPoseMove()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockController/newPoseMove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockController`*"] + pub fn new_pose_move_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockController, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); } diff --git a/crates/web-sys/src/features/gen_VrMockDisplay.rs b/crates/web-sys/src/features/gen_VrMockDisplay.rs index 82fb1298cd4..d5ad55d899d 100644 --- a/crates/web-sys/src/features/gen_VrMockDisplay.rs +++ b/crates/web-sys/src/features/gen_VrMockDisplay.rs @@ -59,6 +59,951 @@ extern "C" { angular_velocity: Option<&mut [f32]>, angular_acceleration: Option<&mut [f32]>, ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&mut [f32]>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&mut [f32]>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&mut [f32]>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&mut [f32]>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&mut [f32]>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_slice_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&mut [f32]>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); + # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = setPose)] + #[doc = "The `setPose()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRMockDisplay/setPose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VrMockDisplay`*"] + pub fn set_pose_with_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array_and_opt_f32_array( + this: &VrMockDisplay, + position: Option<&::js_sys::Float32Array>, + linear_velocity: Option<&::js_sys::Float32Array>, + linear_acceleration: Option<&::js_sys::Float32Array>, + orientation: Option<&::js_sys::Float32Array>, + angular_velocity: Option<&::js_sys::Float32Array>, + angular_acceleration: Option<&::js_sys::Float32Array>, + ); # [wasm_bindgen (method , structural , js_class = "VRMockDisplay" , js_name = update)] #[doc = "The `update()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VttCue.rs b/crates/web-sys/src/features/gen_VttCue.rs index e3b014809fc..e454160eb41 100644 --- a/crates/web-sys/src/features/gen_VttCue.rs +++ b/crates/web-sys/src/features/gen_VttCue.rs @@ -71,7 +71,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] + #[deprecated] pub fn set_line(this: &VttCue, value: &::wasm_bindgen::JsValue); + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = lineF64)] + #[doc = "Setter for the `lineF64` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineF64)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] + pub fn set_line_f64(this: &VttCue, value: f64); + #[cfg(feature = "AutoKeyword")] + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = lineAutoKeyword)] + #[doc = "Setter for the `lineAutoKeyword` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAutoKeyword)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutoKeyword`, `VttCue`*"] + pub fn set_line_auto_keyword(this: &VttCue, value: AutoKeyword); #[cfg(feature = "LineAlignSetting")] # [wasm_bindgen (structural , method , getter , js_class = "VTTCue" , js_name = lineAlign)] #[doc = "Getter for the `lineAlign` field of this object."] @@ -101,7 +117,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] + #[deprecated] pub fn set_position(this: &VttCue, value: &::wasm_bindgen::JsValue); + # [wasm_bindgen (structural , catch , method , setter , js_class = "VTTCue" , js_name = positionF64)] + #[doc = "Setter for the `positionF64` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionF64)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] + pub fn set_position_f64(this: &VttCue, value: f64) -> Result<(), JsValue>; + #[cfg(feature = "AutoKeyword")] + # [wasm_bindgen (structural , catch , method , setter , js_class = "VTTCue" , js_name = positionAutoKeyword)] + #[doc = "Setter for the `positionAutoKeyword` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAutoKeyword)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `AutoKeyword`, `VttCue`*"] + pub fn set_position_auto_keyword(this: &VttCue, value: AutoKeyword) -> Result<(), JsValue>; #[cfg(feature = "PositionAlignSetting")] # [wasm_bindgen (structural , method , getter , js_class = "VTTCue" , js_name = positionAlign)] #[doc = "Getter for the `positionAlign` field of this object."] diff --git a/crates/web-sys/src/features/gen_WaveShaperNode.rs b/crates/web-sys/src/features/gen_WaveShaperNode.rs index 4d1673c6e5a..875ecc61ec6 100644 --- a/crates/web-sys/src/features/gen_WaveShaperNode.rs +++ b/crates/web-sys/src/features/gen_WaveShaperNode.rs @@ -25,7 +25,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] + #[deprecated] pub fn set_curve(this: &WaveShaperNode, value: Option<&mut [f32]>); + # [wasm_bindgen (structural , catch , method , setter , js_class = "WaveShaperNode" , js_name = curveOptF32Slice)] + #[doc = "Setter for the `curveOptF32Slice` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curveOptF32Slice)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] + pub fn set_curve_opt_f32_slice( + this: &WaveShaperNode, + value: Option<&mut [f32]>, + ) -> Result<(), JsValue>; + # [wasm_bindgen (structural , catch , method , setter , js_class = "WaveShaperNode" , js_name = curveOptF32Array)] + #[doc = "Setter for the `curveOptF32Array` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curveOptF32Array)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] + pub fn set_curve_opt_f32_array( + this: &WaveShaperNode, + value: Option<&::js_sys::Float32Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "OverSampleType")] # [wasm_bindgen (structural , method , getter , js_class = "WaveShaperNode" , js_name = oversample)] #[doc = "Getter for the `oversample` field of this object."] diff --git a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs index a0330978eb5..32e59caa273 100644 --- a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs @@ -224,6 +224,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_data_with_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + src_data: &::js_sys::Uint8Array, + usage: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferData)] + #[doc = "The `bufferData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn buffer_data_with_array_buffer_view_and_src_offset( this: &WebGl2RenderingContext, target: u32, @@ -250,6 +262,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_data_with_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + src_data: &::js_sys::Uint8Array, + usage: u32, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferData)] + #[doc = "The `bufferData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn buffer_data_with_array_buffer_view_and_src_offset_and_length( this: &WebGl2RenderingContext, target: u32, @@ -272,6 +297,20 @@ extern "C" { src_offset: u32, length: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferData)] + #[doc = "The `bufferData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_data_with_js_u8_array_and_src_offset_and_length( + this: &WebGl2RenderingContext, + target: u32, + src_data: &::js_sys::Uint8Array, + usage: u32, + src_offset: u32, + length: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] #[doc = "The `bufferSubData()` method."] #[doc = ""] @@ -350,6 +389,30 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_i32_and_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + offset: i32, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_f64_and_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + offset: f64, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn buffer_sub_data_with_i32_and_array_buffer_view_and_src_offset( this: &WebGl2RenderingContext, target: u32, @@ -402,6 +465,32 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_i32_and_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + dst_byte_offset: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_f64_and_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + dst_byte_offset: f64, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn buffer_sub_data_with_i32_and_array_buffer_view_and_src_offset_and_length( this: &WebGl2RenderingContext, target: u32, @@ -452,6 +541,34 @@ extern "C" { src_offset: u32, length: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_i32_and_js_u8_array_and_src_offset_and_length( + this: &WebGl2RenderingContext, + target: u32, + dst_byte_offset: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + length: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn buffer_sub_data_with_f64_and_js_u8_array_and_src_offset_and_length( + this: &WebGl2RenderingContext, + target: u32, + dst_byte_offset: f64, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + length: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferfi)] #[doc = "The `clearBufferfi()` method."] #[doc = ""] @@ -483,6 +600,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferfv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferfv_with_js_f32_array( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferfv)] + #[doc = "The `clearBufferfv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferfv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferfv_with_f32_sequence( this: &WebGl2RenderingContext, buffer: u32, @@ -508,6 +637,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferfv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferfv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Float32Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferfv)] + #[doc = "The `clearBufferfv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferfv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferfv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, buffer: u32, @@ -533,6 +675,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferiv_with_js_i32_array( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Int32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferiv)] + #[doc = "The `clearBufferiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferiv_with_i32_sequence( this: &WebGl2RenderingContext, buffer: u32, @@ -558,6 +712,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferiv_with_js_i32_array_and_src_offset( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Int32Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferiv)] + #[doc = "The `clearBufferiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferiv_with_i32_sequence_and_src_offset( this: &WebGl2RenderingContext, buffer: u32, @@ -583,6 +750,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferuiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferuiv_with_js_u32_array( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Uint32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferuiv)] + #[doc = "The `clearBufferuiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferuiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferuiv_with_u32_sequence( this: &WebGl2RenderingContext, buffer: u32, @@ -608,6 +787,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferuiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn clear_bufferuiv_with_js_u32_array_and_src_offset( + this: &WebGl2RenderingContext, + buffer: u32, + drawbuffer: i32, + values: &::js_sys::Uint32Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = clearBufferuiv)] + #[doc = "The `clearBufferuiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBufferuiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn clear_bufferuiv_with_u32_sequence_and_src_offset( this: &WebGl2RenderingContext, buffer: u32, @@ -713,6 +905,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage2D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_2d_with_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage2D)] + #[doc = "The `compressedTexImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_image_2d_with_array_buffer_view_and_u32( this: &WebGl2RenderingContext, target: u32, @@ -747,6 +955,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage2D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_2d_with_js_u8_array_and_u32( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage2D)] + #[doc = "The `compressedTexImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_image_2d_with_array_buffer_view_and_u32_and_src_length_override( this: &WebGl2RenderingContext, target: u32, @@ -777,6 +1002,24 @@ extern "C" { src_offset: u32, src_length_override: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage2D)] + #[doc = "The `compressedTexImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_2d_with_js_u8_array_and_u32_and_src_length_override( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + src_length_override: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage3D)] #[doc = "The `compressedTexImage3D()` method."] #[doc = ""] @@ -853,6 +1096,23 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_3d_with_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + depth: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage3D)] + #[doc = "The `compressedTexImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_image_3d_with_array_buffer_view_and_u32( this: &WebGl2RenderingContext, target: u32, @@ -889,6 +1149,24 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_3d_with_js_u8_array_and_u32( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + depth: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage3D)] + #[doc = "The `compressedTexImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_image_3d_with_array_buffer_view_and_u32_and_src_length_override( this: &WebGl2RenderingContext, target: u32, @@ -921,6 +1199,25 @@ extern "C" { src_offset: u32, src_length_override: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexImage3D)] + #[doc = "The `compressedTexImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_image_3d_with_js_u8_array_and_u32_and_src_length_override( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + depth: i32, + border: i32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + src_length_override: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage2D)] #[doc = "The `compressedTexSubImage2D()` method."] #[doc = ""] @@ -997,7 +1294,24 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage2D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] - pub fn compressed_tex_sub_image_2d_with_array_buffer_view_and_u32( + pub fn compressed_tex_sub_image_2d_with_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage2D)] + #[doc = "The `compressedTexSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_2d_with_array_buffer_view_and_u32( this: &WebGl2RenderingContext, target: u32, level: i32, @@ -1033,6 +1347,24 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage2D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_2d_with_js_u8_array_and_u32( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage2D)] + #[doc = "The `compressedTexSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_sub_image_2d_with_array_buffer_view_and_u32_and_src_length_override( this: &WebGl2RenderingContext, target: u32, @@ -1065,6 +1397,25 @@ extern "C" { src_offset: u32, src_length_override: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage2D)] + #[doc = "The `compressedTexSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_2d_with_js_u8_array_and_u32_and_src_length_override( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + src_length_override: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage3D)] #[doc = "The `compressedTexSubImage3D()` method."] #[doc = ""] @@ -1149,6 +1500,25 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_3d_with_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage3D)] + #[doc = "The `compressedTexSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_sub_image_3d_with_array_buffer_view_and_u32( this: &WebGl2RenderingContext, target: u32, @@ -1189,6 +1559,26 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_3d_with_js_u8_array_and_u32( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage3D)] + #[doc = "The `compressedTexSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn compressed_tex_sub_image_3d_with_array_buffer_view_and_u32_and_src_length_override( this: &WebGl2RenderingContext, target: u32, @@ -1225,6 +1615,27 @@ extern "C" { src_offset: u32, src_length_override: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = compressedTexSubImage3D)] + #[doc = "The `compressedTexSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn compressed_tex_sub_image_3d_with_js_u8_array_and_u32_and_src_length_override( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + src_length_override: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = copyBufferSubData)] #[doc = "The `copyBufferSubData()` method."] #[doc = ""] @@ -1646,6 +2057,30 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_i32_and_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: i32, + dst_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_f64_and_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: f64, + dst_data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn get_buffer_sub_data_with_i32_and_array_buffer_view_and_dst_offset( this: &WebGl2RenderingContext, target: u32, @@ -1698,6 +2133,32 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_i32_and_js_u8_array_and_dst_offset( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: i32, + dst_data: &::js_sys::Uint8Array, + dst_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_f64_and_js_u8_array_and_dst_offset( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: f64, + dst_data: &::js_sys::Uint8Array, + dst_offset: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn get_buffer_sub_data_with_i32_and_array_buffer_view_and_dst_offset_and_length( this: &WebGl2RenderingContext, target: u32, @@ -1748,6 +2209,34 @@ extern "C" { dst_offset: u32, length: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_i32_and_js_u8_array_and_dst_offset_and_length( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: i32, + dst_data: &::js_sys::Uint8Array, + dst_offset: u32, + length: u32, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getBufferSubData)] + #[doc = "The `getBufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getBufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn get_buffer_sub_data_with_f64_and_js_u8_array_and_dst_offset_and_length( + this: &WebGl2RenderingContext, + target: u32, + src_byte_offset: f64, + dst_data: &::js_sys::Uint8Array, + dst_offset: u32, + length: u32, + ); #[cfg(feature = "WebGlProgram")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getFragDataLocation)] #[doc = "The `getFragDataLocation()` method."] @@ -1990,6 +2479,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/readPixels)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn read_pixels_with_opt_js_u8_array( + this: &WebGl2RenderingContext, + x: i32, + y: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + dst_data: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = readPixels)] + #[doc = "The `readPixels()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/readPixels)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn read_pixels_with_i32( this: &WebGl2RenderingContext, x: i32, @@ -2050,6 +2555,23 @@ extern "C" { dst_data: &mut [u8], dst_offset: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = readPixels)] + #[doc = "The `readPixels()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/readPixels)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn read_pixels_with_js_u8_array_and_dst_offset( + this: &WebGl2RenderingContext, + x: i32, + y: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + dst_data: &::js_sys::Uint8Array, + dst_offset: u32, + ) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = renderbufferStorageMultisample)] #[doc = "The `renderbufferStorageMultisample()` method."] #[doc = ""] @@ -2133,6 +2655,24 @@ extern "C" { type_: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + border: i32, + format: u32, + type_: u32, + pixels: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "HtmlCanvasElement")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] #[doc = "The `texImage2D()` method."] @@ -2425,6 +2965,25 @@ extern "C" { src_data: &[u8], src_offset: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + border: i32, + format: u32, + type_: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)] #[doc = "The `texImage3D()` method."] #[doc = ""] @@ -2631,6 +3190,25 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_image_3d_with_opt_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + depth: i32, + border: i32, + format: u32, + type_: u32, + src_data: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)] + #[doc = "The `texImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn tex_image_3d_with_array_buffer_view_and_src_offset( this: &WebGl2RenderingContext, target: u32, @@ -2665,16 +3243,36 @@ extern "C" { src_data: &[u8], src_offset: u32, ) -> Result<(), JsValue>; - # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = texStorage2D)] - #[doc = "The `texStorage2D()` method."] + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)] + #[doc = "The `texImage3D()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texStorage2D)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] - pub fn tex_storage_2d( + pub fn tex_image_3d_with_js_u8_array_and_src_offset( this: &WebGl2RenderingContext, target: u32, - levels: i32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + depth: i32, + border: i32, + format: u32, + type_: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ) -> Result<(), JsValue>; + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = texStorage2D)] + #[doc = "The `texStorage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texStorage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_storage_2d( + this: &WebGl2RenderingContext, + target: u32, + levels: i32, internalformat: u32, width: i32, height: i32, @@ -2730,6 +3328,24 @@ extern "C" { type_: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + pixels: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "HtmlCanvasElement")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] #[doc = "The `texSubImage2D()` method."] @@ -3028,6 +3644,25 @@ extern "C" { src_data: &[u8], src_offset: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + src_data: &::js_sys::Uint8Array, + src_offset: u32, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)] #[doc = "The `texSubImage3D()` method."] #[doc = ""] @@ -3244,6 +3879,26 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_sub_image_3d_with_opt_js_u8_array( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + type_: u32, + src_data: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)] + #[doc = "The `texSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn tex_sub_image_3d_with_opt_array_buffer_view_and_src_offset( this: &WebGl2RenderingContext, target: u32, @@ -3280,6 +3935,27 @@ extern "C" { src_data: Option<&[u8]>, src_offset: u32, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)] + #[doc = "The `texSubImage3D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn tex_sub_image_3d_with_opt_js_u8_array_and_src_offset( + this: &WebGl2RenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + zoffset: i32, + width: i32, + height: i32, + depth: i32, + format: u32, + type_: u32, + src_data: Option<&::js_sys::Uint8Array>, + src_offset: u32, + ) -> Result<(), JsValue>; #[cfg(feature = "WebGlProgram")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = transformFeedbackVaryings)] #[doc = "The `transformFeedbackVaryings()` method."] @@ -3312,6 +3988,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1fv)] + #[doc = "The `uniform1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3337,6 +4025,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1fv)] + #[doc = "The `uniform1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3364,6 +4065,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1fv)] + #[doc = "The `uniform1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3390,6 +4105,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1iv_with_js_i32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1iv)] + #[doc = "The `uniform1iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1iv_with_i32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3415,6 +4142,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1iv_with_js_i32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1iv)] + #[doc = "The `uniform1iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1iv_with_i32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3442,6 +4182,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1iv_with_js_i32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1iv)] + #[doc = "The `uniform1iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1iv_with_i32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3480,6 +4234,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1uiv_with_js_u32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1uiv)] + #[doc = "The `uniform1uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1uiv_with_u32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3505,6 +4271,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1uiv_with_js_u32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1uiv)] + #[doc = "The `uniform1uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1uiv_with_u32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3532,6 +4311,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1uiv_with_js_u32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform1uiv)] + #[doc = "The `uniform1uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform1uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1uiv_with_u32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3558,6 +4351,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2fv)] + #[doc = "The `uniform2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3583,6 +4388,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2fv)] + #[doc = "The `uniform2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3610,6 +4428,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2fv)] + #[doc = "The `uniform2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3636,6 +4468,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2iv_with_js_i32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2iv)] + #[doc = "The `uniform2iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2iv_with_i32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3661,6 +4505,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2iv_with_js_i32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2iv)] + #[doc = "The `uniform2iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2iv_with_i32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3688,6 +4545,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2iv_with_js_i32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2iv)] + #[doc = "The `uniform2iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2iv_with_i32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3727,7 +4598,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform2uiv_with_u32_sequence( + pub fn uniform2uiv_with_js_u32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2uiv)] + #[doc = "The `uniform2uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2uiv_with_u32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, data: &::wasm_bindgen::JsValue, @@ -3752,6 +4635,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2uiv_with_js_u32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2uiv)] + #[doc = "The `uniform2uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2uiv_with_u32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3779,6 +4675,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2uiv_with_js_u32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform2uiv)] + #[doc = "The `uniform2uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform2uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2uiv_with_u32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3805,6 +4715,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3fv)] + #[doc = "The `uniform3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3830,6 +4752,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3fv)] + #[doc = "The `uniform3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3857,6 +4792,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3fv)] + #[doc = "The `uniform3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3883,6 +4832,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3iv_with_js_i32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3iv)] + #[doc = "The `uniform3iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3iv_with_i32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3908,6 +4869,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3iv_with_js_i32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3iv)] + #[doc = "The `uniform3iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3iv_with_i32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3935,6 +4909,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3iv_with_js_i32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3iv)] + #[doc = "The `uniform3iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3iv_with_i32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -3975,6 +4963,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3uiv_with_js_u32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3uiv)] + #[doc = "The `uniform3uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3uiv_with_u32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4000,6 +5000,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3uiv_with_js_u32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3uiv)] + #[doc = "The `uniform3uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3uiv_with_u32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4027,6 +5040,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3uiv_with_js_u32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform3uiv)] + #[doc = "The `uniform3uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform3uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3uiv_with_u32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4053,6 +5080,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4fv)] + #[doc = "The `uniform4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4078,6 +5117,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4fv)] + #[doc = "The `uniform4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4105,6 +5157,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4fv)] + #[doc = "The `uniform4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4131,6 +5197,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4iv_with_js_i32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4iv)] + #[doc = "The `uniform4iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4iv_with_i32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4156,6 +5234,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4iv_with_js_i32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4iv)] + #[doc = "The `uniform4iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4iv_with_i32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4183,6 +5274,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4iv_with_js_i32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4iv)] + #[doc = "The `uniform4iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4iv_with_i32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4224,6 +5329,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4uiv_with_js_u32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4uiv)] + #[doc = "The `uniform4uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4uiv_with_u32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4249,6 +5366,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4uiv_with_js_u32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4uiv)] + #[doc = "The `uniform4uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4uiv_with_u32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4276,6 +5406,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4uiv_with_js_u32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Uint32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniform4uiv)] + #[doc = "The `uniform4uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniform4uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4uiv_with_u32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4316,6 +5460,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2fv)] + #[doc = "The `uniformMatrix2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4343,6 +5500,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2fv)] + #[doc = "The `uniformMatrix2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4372,6 +5543,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2fv)] + #[doc = "The `uniformMatrix2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4400,6 +5586,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x3fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x3fv)] + #[doc = "The `uniformMatrix2x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2x3fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4427,6 +5626,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x3fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x3fv)] + #[doc = "The `uniformMatrix2x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2x3fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4456,6 +5669,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x3fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x3fv)] + #[doc = "The `uniformMatrix2x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2x3fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4484,6 +5712,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x4fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x4fv)] + #[doc = "The `uniformMatrix2x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2x4fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4511,6 +5752,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x4fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x4fv)] + #[doc = "The `uniformMatrix2x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2x4fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4540,13 +5795,67 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix2x4fv_with_f32_sequence_and_src_offset_and_src_length( + pub fn uniform_matrix2x4fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix2x4fv)] + #[doc = "The `uniformMatrix2x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix2x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2x4fv_with_f32_sequence_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::wasm_bindgen::JsValue, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] + #[doc = "The `uniformMatrix3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3fv_with_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &[f32], + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] + #[doc = "The `uniformMatrix3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] + #[doc = "The `uniformMatrix3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, data: &::wasm_bindgen::JsValue, - src_offset: u32, - src_length: u32, ); #[cfg(feature = "WebGlUniformLocation")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] @@ -4555,11 +5864,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix3fv_with_f32_array( + pub fn uniform_matrix3fv_with_f32_array_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, data: &[f32], + src_offset: u32, ); #[cfg(feature = "WebGlUniformLocation")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] @@ -4568,11 +5878,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix3fv_with_f32_sequence( + pub fn uniform_matrix3fv_with_js_f32_array_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, - data: &::wasm_bindgen::JsValue, + data: &::js_sys::Float32Array, + src_offset: u32, ); #[cfg(feature = "WebGlUniformLocation")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] @@ -4581,11 +5892,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix3fv_with_f32_array_and_src_offset( + pub fn uniform_matrix3fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, - data: &[f32], + data: &::wasm_bindgen::JsValue, src_offset: u32, ); #[cfg(feature = "WebGlUniformLocation")] @@ -4595,12 +5906,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix3fv_with_f32_sequence_and_src_offset( + pub fn uniform_matrix3fv_with_f32_array_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, - data: &::wasm_bindgen::JsValue, + data: &[f32], src_offset: u32, + src_length: u32, ); #[cfg(feature = "WebGlUniformLocation")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3fv)] @@ -4609,11 +5921,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] - pub fn uniform_matrix3fv_with_f32_array_and_src_offset_and_src_length( + pub fn uniform_matrix3fv_with_js_f32_array_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, transpose: bool, - data: &[f32], + data: &::js_sys::Float32Array, src_offset: u32, src_length: u32, ); @@ -4652,6 +5964,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x2fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x2fv)] + #[doc = "The `uniformMatrix3x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x2fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4679,6 +6004,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x2fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x2fv)] + #[doc = "The `uniformMatrix3x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x2fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4708,6 +6047,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x2fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x2fv)] + #[doc = "The `uniformMatrix3x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x2fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4736,6 +6090,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x4fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x4fv)] + #[doc = "The `uniformMatrix3x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x4fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4763,6 +6130,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x4fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x4fv)] + #[doc = "The `uniformMatrix3x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x4fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4792,6 +6173,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3x4fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix3x4fv)] + #[doc = "The `uniformMatrix3x4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix3x4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3x4fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4820,6 +6216,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4fv)] + #[doc = "The `uniformMatrix4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4847,6 +6256,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4fv)] + #[doc = "The `uniformMatrix4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4876,6 +6299,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4fv)] + #[doc = "The `uniformMatrix4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4904,6 +6342,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x2fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x2fv)] + #[doc = "The `uniformMatrix4x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x2fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4931,6 +6382,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x2fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x2fv)] + #[doc = "The `uniformMatrix4x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x2fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4960,6 +6425,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x2fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x2fv)] + #[doc = "The `uniformMatrix4x2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x2fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -4988,6 +6468,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x3fv_with_js_f32_array( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x3fv)] + #[doc = "The `uniformMatrix4x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x3fv_with_f32_sequence( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -5015,6 +6508,20 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x3fv_with_js_f32_array_and_src_offset( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x3fv)] + #[doc = "The `uniformMatrix4x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x3fv_with_f32_sequence_and_src_offset( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -5044,6 +6551,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4x3fv_with_js_f32_array_and_src_offset_and_src_length( + this: &WebGl2RenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + src_offset: u32, + src_length: u32, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = uniformMatrix4x3fv)] + #[doc = "The `uniformMatrix4x3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/uniformMatrix4x3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4x3fv_with_f32_sequence_and_src_offset_and_src_length( this: &WebGl2RenderingContext, location: Option<&WebGlUniformLocation>, @@ -5090,6 +6612,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttribI4iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib_i4iv_with_js_i32_array( + this: &WebGl2RenderingContext, + index: u32, + values: &::js_sys::Int32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttribI4iv)] + #[doc = "The `vertexAttribI4iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttribI4iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib_i4iv_with_i32_sequence( this: &WebGl2RenderingContext, index: u32, @@ -5126,6 +6659,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttribI4uiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib_i4uiv_with_js_u32_array( + this: &WebGl2RenderingContext, + index: u32, + values: &::js_sys::Uint32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttribI4uiv)] + #[doc = "The `vertexAttribI4uiv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttribI4uiv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib_i4uiv_with_u32_sequence( this: &WebGl2RenderingContext, index: u32, @@ -6257,6 +7801,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib1fv_with_js_f32_array( + this: &WebGl2RenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttrib1fv)] + #[doc = "The `vertexAttrib1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib1fv_with_f32_sequence( this: &WebGl2RenderingContext, indx: u32, @@ -6286,6 +7841,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib2fv_with_js_f32_array( + this: &WebGl2RenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttrib2fv)] + #[doc = "The `vertexAttrib2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib2fv_with_f32_sequence( this: &WebGl2RenderingContext, indx: u32, @@ -6315,6 +7881,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib3fv_with_js_f32_array( + this: &WebGl2RenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttrib3fv)] + #[doc = "The `vertexAttrib3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib3fv_with_f32_sequence( this: &WebGl2RenderingContext, indx: u32, @@ -6351,6 +7928,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] + pub fn vertex_attrib4fv_with_js_f32_array( + this: &WebGl2RenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = vertexAttrib4fv)] + #[doc = "The `vertexAttrib4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/vertexAttrib4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"] pub fn vertex_attrib4fv_with_f32_sequence( this: &WebGl2RenderingContext, indx: u32, diff --git a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs index f403ef1db08..9d570035a01 100644 --- a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs @@ -83,6 +83,18 @@ extern "C" { data: &[u8], usage: u32, ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = bufferData)] + #[doc = "The `bufferData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn buffer_data_with_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + data: &::js_sys::Uint8Array, + usage: u32, + ); # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = bufferSubData)] #[doc = "The `bufferSubData()` method."] #[doc = ""] @@ -155,6 +167,30 @@ extern "C" { offset: f64, data: &[u8], ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn buffer_sub_data_with_i32_and_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + offset: i32, + data: &::js_sys::Uint8Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = bufferSubData)] + #[doc = "The `bufferSubData()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferSubData)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn buffer_sub_data_with_f64_and_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + offset: f64, + data: &::js_sys::Uint8Array, + ); # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = commit)] #[doc = "The `commit()` method."] #[doc = ""] @@ -194,6 +230,22 @@ extern "C" { border: i32, data: &[u8], ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = compressedTexImage2D)] + #[doc = "The `compressedTexImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/compressedTexImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn compressed_tex_image_2d_with_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + level: i32, + internalformat: u32, + width: i32, + height: i32, + border: i32, + data: &::js_sys::Uint8Array, + ); # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = compressedTexSubImage2D)] #[doc = "The `compressedTexSubImage2D()` method."] #[doc = ""] @@ -228,6 +280,23 @@ extern "C" { format: u32, data: &mut [u8], ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = compressedTexSubImage2D)] + #[doc = "The `compressedTexSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/compressedTexSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn compressed_tex_sub_image_2d_with_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + data: &::js_sys::Uint8Array, + ); # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = readPixels)] #[doc = "The `readPixels()` method."] #[doc = ""] @@ -260,6 +329,22 @@ extern "C" { type_: u32, pixels: Option<&mut [u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = readPixels)] + #[doc = "The `readPixels()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn read_pixels_with_opt_js_u8_array( + this: &WebGlRenderingContext, + x: i32, + y: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + pixels: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texImage2D)] #[doc = "The `texImage2D()` method."] #[doc = ""] @@ -296,6 +381,24 @@ extern "C" { type_: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texImage2D)] + #[doc = "The `texImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + level: i32, + internalformat: i32, + width: i32, + height: i32, + border: i32, + format: u32, + type_: u32, + pixels: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texImage2D)] #[doc = "The `texImage2D()` method."] @@ -432,6 +535,24 @@ extern "C" { type_: u32, pixels: Option<&[u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)] + #[doc = "The `texSubImage2D()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_js_u8_array( + this: &WebGlRenderingContext, + target: u32, + level: i32, + xoffset: i32, + yoffset: i32, + width: i32, + height: i32, + format: u32, + type_: u32, + pixels: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "ImageBitmap")] # [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)] #[doc = "The `texSubImage2D()` method."] @@ -557,6 +678,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform1fv)] + #[doc = "The `uniform1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -581,6 +714,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform1iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform1iv_with_js_i32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform1iv)] + #[doc = "The `uniform1iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform1iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform1iv_with_i32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -605,6 +750,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform2fv)] + #[doc = "The `uniform2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -629,6 +786,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform2iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform2iv_with_js_i32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform2iv)] + #[doc = "The `uniform2iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform2iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform2iv_with_i32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -653,6 +822,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform3fv)] + #[doc = "The `uniform3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -677,6 +858,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform3iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform3iv_with_js_i32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform3iv)] + #[doc = "The `uniform3iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform3iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform3iv_with_i32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -701,6 +894,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform4fv)] + #[doc = "The `uniform4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -725,6 +930,18 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform4iv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform4iv_with_js_i32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + data: &::js_sys::Int32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform4iv)] + #[doc = "The `uniform4iv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform4iv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform4iv_with_i32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -750,6 +967,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix2fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniformMatrix2fv)] + #[doc = "The `uniformMatrix2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix2fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -776,6 +1006,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix3fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniformMatrix3fv)] + #[doc = "The `uniformMatrix3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix3fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -802,6 +1045,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] + pub fn uniform_matrix4fv_with_js_f32_array( + this: &WebGlRenderingContext, + location: Option<&WebGlUniformLocation>, + transpose: bool, + data: &::js_sys::Float32Array, + ); + #[cfg(feature = "WebGlUniformLocation")] + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniformMatrix4fv)] + #[doc = "The `uniformMatrix4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlUniformLocation`*"] pub fn uniform_matrix4fv_with_f32_sequence( this: &WebGlRenderingContext, location: Option<&WebGlUniformLocation>, @@ -1864,6 +2120,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib1fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn vertex_attrib1fv_with_js_f32_array( + this: &WebGlRenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = vertexAttrib1fv)] + #[doc = "The `vertexAttrib1fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib1fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] pub fn vertex_attrib1fv_with_f32_sequence( this: &WebGlRenderingContext, indx: u32, @@ -1889,6 +2156,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib2fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn vertex_attrib2fv_with_js_f32_array( + this: &WebGlRenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = vertexAttrib2fv)] + #[doc = "The `vertexAttrib2fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib2fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] pub fn vertex_attrib2fv_with_f32_sequence( this: &WebGlRenderingContext, indx: u32, @@ -1914,6 +2192,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib3fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn vertex_attrib3fv_with_js_f32_array( + this: &WebGlRenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = vertexAttrib3fv)] + #[doc = "The `vertexAttrib3fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib3fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] pub fn vertex_attrib3fv_with_f32_sequence( this: &WebGlRenderingContext, indx: u32, @@ -1939,6 +2228,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib4fv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] + pub fn vertex_attrib4fv_with_js_f32_array( + this: &WebGlRenderingContext, + indx: u32, + values: &::js_sys::Float32Array, + ); + # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = vertexAttrib4fv)] + #[doc = "The `vertexAttrib4fv()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttrib4fv)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`*"] pub fn vertex_attrib4fv_with_f32_sequence( this: &WebGlRenderingContext, indx: u32, diff --git a/crates/web-sys/src/features/gen_WebSocket.rs b/crates/web-sys/src/features/gen_WebSocket.rs index dfa43aa8db5..5f57a3c735a 100644 --- a/crates/web-sys/src/features/gen_WebSocket.rs +++ b/crates/web-sys/src/features/gen_WebSocket.rs @@ -210,6 +210,16 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocket`*"] pub fn send_with_u8_array(this: &WebSocket, data: &[u8]) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "WebSocket" , js_name = send)] + #[doc = "The `send()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebSocket`*"] + pub fn send_with_js_u8_array( + this: &WebSocket, + data: &::js_sys::Uint8Array, + ) -> Result<(), JsValue>; } impl WebSocket { #[doc = "The `WebSocket.CONNECTING` const."] diff --git a/crates/web-sys/src/features/gen_WebglMultiDraw.rs b/crates/web-sys/src/features/gen_WebglMultiDraw.rs index cf669c5221a..d2c5c7a4e4d 100644 --- a/crates/web-sys/src/features/gen_WebglMultiDraw.rs +++ b/crates/web-sys/src/features/gen_WebglMultiDraw.rs @@ -35,177 +35,899 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_slice_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, - counts_list: &mut [i32], + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_slice_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_js_i32_array_and_js_i32_array_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_js_i32_array_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_js_i32_array_and_i32_sequence_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_slice_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_js_i32_array_and_js_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_js_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_js_i32_array_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] + #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &mut [i32], + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_slice_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_js_i32_array_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_sequence_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &mut [i32], + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_js_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::js_sys::Int32Array, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] + #[doc = "The `multiDrawArraysWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + firsts_list: &::wasm_bindgen::JsValue, + firsts_offset: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_slice_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &mut [i32], + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, instance_counts_list: &mut [i32], instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &mut [i32], - firsts_offset: u32, counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, instance_counts_list: &mut [i32], instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &mut [i32], counts_offset: u32, - instance_counts_list: &mut [i32], + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_slice_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &mut [i32], - firsts_offset: u32, - counts_list: &mut [i32], + counts_list: &::js_sys::Int32Array, counts_offset: u32, - instance_counts_list: &::wasm_bindgen::JsValue, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, - counts_list: &mut [i32], + counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, - instance_counts_list: &::wasm_bindgen::JsValue, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_array_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &mut [i32], - firsts_offset: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &mut [i32], counts_offset: u32, - instance_counts_list: &::wasm_bindgen::JsValue, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysInstancedWEBGL)] - #[doc = "The `multiDrawArraysInstancedWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_js_i32_array_and_js_i32_array_and_js_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &::js_sys::Int32Array, counts_offset: u32, - instance_counts_list: &::wasm_bindgen::JsValue, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] - #[doc = "The `multiDrawArraysWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_js_i32_array_and_js_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &mut [i32], - firsts_offset: u32, - counts_list: &mut [i32], + counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] - #[doc = "The `multiDrawArraysWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, counts_list: &mut [i32], counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] - #[doc = "The `multiDrawArraysWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_webgl_with_i32_array_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_js_i32_array_and_i32_sequence_and_js_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &mut [i32], - firsts_offset: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &::js_sys::Int32Array, counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, drawcount: i32, ); - # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawArraysWEBGL)] - #[doc = "The `multiDrawArraysWEBGL()` method."] + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_arrays_webgl_with_i32_sequence_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_js_i32_array( this: &WebglMultiDraw, mode: u32, - firsts_list: &::wasm_bindgen::JsValue, - firsts_offset: u32, counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::js_sys::Int32Array, + instance_counts_offset: u32, drawcount: i32, ); # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] @@ -214,7 +936,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, counts_list: &mut [i32], @@ -222,7 +944,7 @@ extern "C" { type_: u32, offsets_list: &mut [i32], offsets_offset: u32, - instance_counts_list: &mut [i32], + instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, drawcount: i32, ); @@ -232,15 +954,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_slice_and_i32_sequence( this: &WebglMultiDraw, mode: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &::js_sys::Int32Array, counts_offset: u32, type_: u32, offsets_list: &mut [i32], offsets_offset: u32, - instance_counts_list: &mut [i32], + instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, drawcount: i32, ); @@ -250,15 +972,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, - counts_list: &mut [i32], + counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, type_: u32, - offsets_list: &::wasm_bindgen::JsValue, + offsets_list: &mut [i32], offsets_offset: u32, - instance_counts_list: &mut [i32], + instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, drawcount: i32, ); @@ -268,15 +990,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array( + pub fn multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, - counts_list: &::wasm_bindgen::JsValue, + counts_list: &mut [i32], counts_offset: u32, type_: u32, - offsets_list: &::wasm_bindgen::JsValue, + offsets_list: &::js_sys::Int32Array, offsets_offset: u32, - instance_counts_list: &mut [i32], + instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, drawcount: i32, ); @@ -286,13 +1008,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_js_i32_array_and_js_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, - counts_list: &mut [i32], + counts_list: &::js_sys::Int32Array, counts_offset: u32, type_: u32, - offsets_list: &mut [i32], + offsets_list: &::js_sys::Int32Array, offsets_offset: u32, instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, @@ -304,13 +1026,13 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] - pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence( + pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_js_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, counts_list: &::wasm_bindgen::JsValue, counts_offset: u32, type_: u32, - offsets_list: &mut [i32], + offsets_list: &::js_sys::Int32Array, offsets_offset: u32, instance_counts_list: &::wasm_bindgen::JsValue, instance_counts_offset: u32, @@ -340,6 +1062,24 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_instanced_webgl_with_js_i32_array_and_i32_sequence_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + instance_counts_list: &::wasm_bindgen::JsValue, + instance_counts_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsInstancedWEBGL)] + #[doc = "The `multiDrawElementsInstancedWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] pub fn multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_sequence( this: &WebglMultiDraw, mode: u32, @@ -374,6 +1114,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_array_and_i32_slice( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &mut [i32], + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] pub fn multi_draw_elements_webgl_with_i32_sequence_and_i32_array( this: &WebglMultiDraw, mode: u32, @@ -390,6 +1146,54 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_slice_and_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &mut [i32], + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_js_i32_array_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_i32_sequence_and_js_i32_array( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::wasm_bindgen::JsValue, + counts_offset: u32, + type_: u32, + offsets_list: &::js_sys::Int32Array, + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] pub fn multi_draw_elements_webgl_with_i32_array_and_i32_sequence( this: &WebglMultiDraw, mode: u32, @@ -406,6 +1210,22 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] + pub fn multi_draw_elements_webgl_with_js_i32_array_and_i32_sequence( + this: &WebglMultiDraw, + mode: u32, + counts_list: &::js_sys::Int32Array, + counts_offset: u32, + type_: u32, + offsets_list: &::wasm_bindgen::JsValue, + offsets_offset: u32, + drawcount: i32, + ); + # [wasm_bindgen (method , structural , js_class = "WEBGL_multi_draw" , js_name = multiDrawElementsWEBGL)] + #[doc = "The `multiDrawElementsWEBGL()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WebglMultiDraw`*"] pub fn multi_draw_elements_webgl_with_i32_sequence_and_i32_sequence( this: &WebglMultiDraw, mode: u32, diff --git a/crates/web-sys/src/features/gen_XmlHttpRequest.rs b/crates/web-sys/src/features/gen_XmlHttpRequest.rs index fc95ec5882d..fa745611743 100644 --- a/crates/web-sys/src/features/gen_XmlHttpRequest.rs +++ b/crates/web-sys/src/features/gen_XmlHttpRequest.rs @@ -265,6 +265,16 @@ extern "C" { this: &XmlHttpRequest, body: Option<&[u8]>, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "XMLHttpRequest" , js_name = send)] + #[doc = "The `send()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XmlHttpRequest`*"] + pub fn send_with_opt_js_u8_array( + this: &XmlHttpRequest, + body: Option<&::js_sys::Uint8Array>, + ) -> Result<(), JsValue>; #[cfg(feature = "FormData")] # [wasm_bindgen (catch , method , structural , js_class = "XMLHttpRequest" , js_name = send)] #[doc = "The `send()` method."] diff --git a/crates/web-sys/src/features/gen_XrFrame.rs b/crates/web-sys/src/features/gen_XrFrame.rs index 84d4d5d7855..1122bae9f22 100644 --- a/crates/web-sys/src/features/gen_XrFrame.rs +++ b/crates/web-sys/src/features/gen_XrFrame.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn predicted_display_time(this: &XrFrame) -> f64; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] #[doc = "The `fillJointRadii()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillJointRadii)"] @@ -49,14 +49,29 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn fill_joint_radii( + pub fn fill_joint_radii_with_f32_slice( this: &XrFrame, joint_spaces: &::wasm_bindgen::JsValue, radii: &mut [f32], - ) -> bool; + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillJointRadii)] + #[doc = "The `fillJointRadii()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillJointRadii)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_joint_radii_with_f32_array( + this: &XrFrame, + joint_spaces: &::wasm_bindgen::JsValue, + radii: &::js_sys::Float32Array, + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSpace")] - # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = fillPoses)] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillPoses)] #[doc = "The `fillPoses()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillPoses)"] @@ -65,12 +80,29 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn fill_poses( + pub fn fill_poses_with_f32_slice( this: &XrFrame, spaces: &::wasm_bindgen::JsValue, base_space: &XrSpace, transforms: &mut [f32], - ) -> bool; + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "XrSpace")] + # [wasm_bindgen (catch , method , structural , js_class = "XRFrame" , js_name = fillPoses)] + #[doc = "The `fillPoses()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillPoses)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `XrFrame`, `XrSpace`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn fill_poses_with_f32_array( + this: &XrFrame, + spaces: &::wasm_bindgen::JsValue, + base_space: &XrSpace, + transforms: &::js_sys::Float32Array, + ) -> Result; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "XrJointPose", feature = "XrJointSpace", feature = "XrSpace",))] # [wasm_bindgen (method , structural , js_class = "XRFrame" , js_name = getJointPose)] diff --git a/crates/web-sys/webidls/enabled/KeyAlgorithm.webidl b/crates/web-sys/webidls/enabled/KeyAlgorithm.webidl index 260b1e624b2..e3725f5114f 100644 --- a/crates/web-sys/webidls/enabled/KeyAlgorithm.webidl +++ b/crates/web-sys/webidls/enabled/KeyAlgorithm.webidl @@ -23,15 +23,3 @@ dictionary HmacKeyAlgorithm : KeyAlgorithm { required KeyAlgorithm hash; required unsigned long length; }; - -dictionary RsaHashedKeyAlgorithm : KeyAlgorithm { - required unsigned short modulusLength; - required Uint8Array publicExponent; - required KeyAlgorithm hash; -}; - -dictionary DhKeyAlgorithm : KeyAlgorithm { - required Uint8Array prime; - required Uint8Array generator; -}; - diff --git a/crates/web-sys/webidls/enabled/SubtleCrypto.webidl b/crates/web-sys/webidls/enabled/SubtleCrypto.webidl index 328447ee7b0..995ad07e942 100644 --- a/crates/web-sys/webidls/enabled/SubtleCrypto.webidl +++ b/crates/web-sys/webidls/enabled/SubtleCrypto.webidl @@ -56,12 +56,6 @@ dictionary HmacKeyGenParams : Algorithm { [EnforceRange] unsigned long length; }; -dictionary RsaHashedKeyGenParams : Algorithm { - [EnforceRange] required unsigned long modulusLength; - required BigInteger publicExponent; - required AlgorithmIdentifier hash; -}; - dictionary RsaOaepParams : Algorithm { BufferSource label; }; @@ -70,11 +64,6 @@ dictionary RsaPssParams : Algorithm { [EnforceRange] required unsigned long saltLength; }; -dictionary DhKeyGenParams : Algorithm { - required BigInteger prime; - required BigInteger generator; -}; - dictionary EcKeyGenParams : Algorithm { required NamedCurve namedCurve; }; @@ -95,11 +84,6 @@ dictionary DhKeyDeriveParams : Algorithm { required CryptoKey public; }; -dictionary DhImportKeyParams : Algorithm { - required BigInteger prime; - required BigInteger generator; -}; - dictionary EcdsaParams : Algorithm { required AlgorithmIdentifier hash; }; diff --git a/crates/webidl-tests/array.rs b/crates/webidl-tests/array.rs index 58730001bad..78f357159a8 100644 --- a/crates/webidl-tests/array.rs +++ b/crates/webidl-tests/array.rs @@ -8,15 +8,18 @@ fn take_and_return_a_bunch_of_slices() { assert_eq!(f.strings("y"), "x"); assert_eq!(f.byte_strings("yz"), "xx"); assert_eq!(f.usv_strings("abc"), "efg"); - assert_eq!(f.f32(&mut [1.0, 2.0]), [3.0, 4.0, 5.0]); - assert_eq!(f.f64(&mut [1.0, 2.0]), [3.0, 4.0, 5.0]); - assert_eq!(f.i8(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.i16(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.i32(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.u8(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.u16(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.u32(&mut [1, 2]), [3, 4, 5]); - assert_eq!(f.u8_clamped(Clamped(&mut [1, 2])).0, [3, 4, 5]); + assert_eq!(f.f32_with_f32_slice(&mut [1.0, 2.0]), [3.0, 4.0, 5.0]); + assert_eq!(f.f64_with_f64_slice(&mut [1.0, 2.0]), [3.0, 4.0, 5.0]); + assert_eq!(f.i8_with_i8_slice(&mut [1, 2]), [3, 4, 5]); + assert_eq!(f.i16_with_i16_slice(&mut [1, 2]), [3, 4, 5]); + assert_eq!(f.i32_with_i32_slice(&mut [1, 2]), [3, 4, 5]); + assert_eq!(f.u8_with_u8_slice(&mut [1, 2]), [3, 4, 5]); + assert_eq!(f.u16_with_u16_slice(&mut [1, 2]), [3, 4, 5]); + assert_eq!(f.u32_with_u32_slice(&mut [1, 2]), Ok(vec![3, 4, 5])); + assert_eq!( + f.u8_clamped_with_u8_clamped_slice(Clamped(&mut [1, 2])).0, + [3, 4, 5] + ); assert_eq!( f.octet_array() .iter() diff --git a/crates/webidl-tests/webidls/enabled/array.webidl b/crates/webidl-tests/webidls/enabled/array.webidl index bbebf010c22..9586f1ad175 100644 --- a/crates/webidl-tests/webidls/enabled/array.webidl +++ b/crates/webidl-tests/webidls/enabled/array.webidl @@ -4,14 +4,14 @@ interface TestArrays { ByteString byteStrings(ByteString arg1); USVString usvStrings(USVString arg1); - Float32Array f32(Float32Array a); - Float64Array f64(Float64Array a); - Int8Array i8(Int8Array a); - Int16Array i16(Int16Array a); - Int32Array i32(Int32Array a); - Uint8Array u8(Uint8Array a); - Uint8ClampedArray u8Clamped(Uint8ClampedArray a); - Uint16Array u16(Uint16Array a); + Float32Array f32([AllowShared] Float32Array a); + Float64Array f64([AllowShared] Float64Array a); + Int8Array i8([AllowShared] Int8Array a); + Int16Array i16([AllowShared] Int16Array a); + Int32Array i32([AllowShared] Int32Array a); + Uint8Array u8([AllowShared] Uint8Array a); + Uint8ClampedArray u8Clamped([AllowShared] Uint8ClampedArray a); + Uint16Array u16([AllowShared] Uint16Array a); Uint32Array u32(Uint32Array a); readonly attribute FrozenArray octetArray; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index ad1de70a0fd..416ca4e7cfa 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -34,6 +34,15 @@ pub(crate) static BUILTIN_IDENTS: Lazy> = Lazy::new(|| { "DataView", "Iterator", "AsyncIterator", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", ]) }); @@ -157,14 +166,8 @@ pub(crate) static FIXED_INTERFACES: Lazy< ( "AudioBufferSourceNode", BTreeMap::from_iter([ - ( - "start_with_when_and_offset", - "start_with_when_and_grain_offset", - ), - ( - "start_with_when_and_offset_and_duration", - "start_with_when_and_grain_offset_and_grain_duration", - ), + ("start_with_when_and_offset", "start_with_when_and_grain_offset"), + ("start_with_when_and_offset_and_duration", "start_with_when_and_grain_offset_and_grain_duration"), ]), ), ( @@ -182,31 +185,16 @@ pub(crate) static FIXED_INTERFACES: Lazy< "IdbObjectStore", BTreeMap::from_iter([ ("count_with_query", "count_with_key"), - ( - "create_index_with_str_and_options", - "create_index_with_str_and_optional_parameters", - ), - ( - "create_index_with_str_sequence_and_options", - "create_index_with_str_sequence_and_optional_parameters", - ), + ("create_index_with_str_and_options", "create_index_with_str_and_optional_parameters"), + ("create_index_with_str_sequence_and_options", "create_index_with_str_sequence_and_optional_parameters"), ("open_cursor_with_query", "open_cursor_with_range"), - ( - "open_cursor_with_query_and_direction", - "open_cursor_with_range_and_direction", - ), + ("open_cursor_with_query_and_direction", "open_cursor_with_range_and_direction"), ("open_key_cursor_with_query", "open_key_cursor_with_range"), - ( - "open_key_cursor_with_query_and_direction", - "open_key_cursor_with_range_and_direction", - ), + ("open_key_cursor_with_query_and_direction", "open_key_cursor_with_range_and_direction"), ("get_all_with_query", "get_all_with_key"), ("get_all_with_query_and_count", "get_all_with_key_and_limit"), ("get_all_keys_with_query", "get_all_keys_with_key"), - ( - "get_all_keys_with_query_and_count", - "get_all_keys_with_key_and_limit", - ), + ("get_all_keys_with_query_and_count", "get_all_keys_with_key_and_limit"), ]), ), ( @@ -214,22 +202,13 @@ pub(crate) static FIXED_INTERFACES: Lazy< BTreeMap::from_iter([ ("count_with_query", "count_with_key"), ("open_cursor_with_query", "open_cursor_with_range"), - ( - "open_cursor_with_query_and_direction", - "open_cursor_with_range_and_direction", - ), + ("open_cursor_with_query_and_direction", "open_cursor_with_range_and_direction"), ("open_key_cursor_with_query", "open_key_cursor_with_range"), - ( - "open_key_cursor_with_query_and_direction", - "open_key_cursor_with_range_and_direction", - ), + ("open_key_cursor_with_query_and_direction", "open_key_cursor_with_range_and_direction"), ("get_all_with_query", "get_all_with_key"), ("get_all_with_query_and_count", "get_all_with_key_and_limit"), ("get_all_keys_with_query", "get_all_keys_with_key"), - ( - "get_all_keys_with_query_and_count", - "get_all_keys_with_key_and_limit", - ), + ("get_all_keys_with_query_and_count", "get_all_keys_with_key_and_limit"), ]), ), ( @@ -237,6 +216,603 @@ pub(crate) static FIXED_INTERFACES: Lazy< BTreeMap::from_iter([ ("vibrate_with_u32", "vibrate_with_duration"), ("vibrate_with_u32_sequence", "vibrate_with_pattern"), + ("send_beacon_with_opt_u8_slice", "send_beacon_with_opt_u8_array"), + ("send_beacon_with_opt_u8_array", "send_beacon_with_opt_js_u8_array"), + ]), + ), + ( + "AnalyserNode", + BTreeMap::from_iter([ + ("get_byte_frequency_data_with_u8_slice", "get_byte_frequency_data"), + ("get_byte_time_domain_data_with_u8_slice", "get_byte_time_domain_data"), + ("get_float_frequency_data_with_f32_slice", "get_float_frequency_data"), + ("get_float_time_domain_data_with_f32_slice", "get_float_time_domain_data"), + ]), + ), + ( + "AudioBuffer", + BTreeMap::from_iter([ + ("copy_from_channel_with_f32_slice", "copy_from_channel"), + ("copy_from_channel_with_f32_slice_and_start_in_channel", "copy_from_channel_with_start_in_channel"), + ("copy_to_channel_with_f32_slice", "copy_to_channel"), + ("copy_to_channel_with_f32_slice_and_start_in_channel", "copy_to_channel_with_start_in_channel"), + ]), + ), + ( + "AudioContext", + BTreeMap::from_iter([ + ("create_periodic_wave_with_f32_slice_and_f32_slice", "create_periodic_wave"), + ("create_periodic_wave_with_f32_slice_and_f32_slice_and_constraints", "create_periodic_wave_with_constraints"), + ]), + ), + ( + "AudioParam", + BTreeMap::from_iter([( + "set_value_curve_at_time_with_f32_slice", + "set_value_curve_at_time", + )]), + ), + ( + "BaseAudioContext", + BTreeMap::from_iter([ + ("create_periodic_wave_with_f32_slice_and_f32_slice", "create_periodic_wave"), + ("create_periodic_wave_with_f32_slice_and_f32_slice_and_constraints", "create_periodic_wave_with_constraints"), + ]), + ), + ( + "BiquadFilterNode", + BTreeMap::from_iter([( + "get_frequency_response_with_f32_slice_and_f32_slice_and_f32_slice", + "get_frequency_response", + )]), + ), + ( + "Crypto", + BTreeMap::from_iter([ + ("get_random_values_with_u8_slice", "get_random_values_with_u8_array"), + ("get_random_values_with_u8_array", "get_random_values_with_js_u8_array"), + ]), + ), + ( + "DomMatrix", + BTreeMap::from_iter([ + ("new_with_f32_slice", "new_with_array32"), + ("new_with_f64_slice", "new_with_array64"), + ]), + ), + ( + "FileSystemSyncAccessHandle", + BTreeMap::from_iter([ + ("read_with_u8_slice", "read_with_u8_array"), + ("read_with_u8_array", "read_with_js_u8_array"), + ("read_with_u8_slice_and_options", "read_with_u8_array_and_options"), + ("read_with_u8_array_and_options", "read_with_js_u8_array_and_options"), + ("write_with_u8_slice", "write_with_u8_array"), + ("write_with_u8_array", "write_with_js_u8_array"), + ("write_with_u8_slice_and_options", "write_with_u8_array_and_options"), + ("write_with_u8_array_and_options", "write_with_js_u8_array_and_options"), + ]), + ), + ( + "FileSystemWritableFileStream", + BTreeMap::from_iter([ + ("write_with_u8_slice", "write_with_u8_array"), + ("write_with_u8_array", "write_with_js_u8_array"), + ]), + ), + ( + "FontFace", + BTreeMap::from_iter([ + ("new_with_u8_slice", "new_with_u8_array"), + ("new_with_u8_array", "new_with_js_u8_array"), + ("new_with_u8_slice_and_descriptors", "new_with_u8_array_and_descriptors"), + ("new_with_u8_array_and_descriptors", "new_with_js_u8_array_and_descriptors"), + ]), + ), + ( + "IdbFileHandle", + BTreeMap::from_iter([ + ("append_with_u8_slice", "append_with_u8_array"), + ("append_with_u8_array", "append_with_js_u8_array"), + ("write_with_u8_slice", "write_with_u8_array"), + ("write_with_u8_array", "write_with_js_u8_array"), + ]), + ), + ( + "IirFilterNode", + BTreeMap::from_iter([( + "get_frequency_response_with_f32_slice_and_f32_slice_and_f32_slice", + "get_frequency_response", + )]), + ), + ( + "ImageData", + BTreeMap::from_iter([ + ("new_with_u8_clamped_slice", "new_with_u8_clamped_array"), + ("new_with_u8_clamped_array", "new_with_js_u8_clamped_array"), + ("new_with_u8_clamped_slice_and_sh", "new_with_u8_clamped_array_and_sh"), + ("new_with_u8_clamped_array_and_sh", "new_with_js_u8_clamped_array_and_sh"), + ]), + ), + ( + "MediaKeys", + BTreeMap::from_iter([ + ("set_server_certificate_with_u8_slice", "set_server_certificate_with_u8_array"), + ("set_server_certificate_with_u8_array", "set_server_certificate_with_js_u8_array"), + ]), + ), + ( + "MediaKeySession", + BTreeMap::from_iter([ + ("generate_request_with_u8_slice", "generate_request_with_u8_array"), + ("generate_request_with_u8_array", "generate_request_with_js_u8_array"), + ("update_with_u8_slice", "update_with_u8_array"), + ("update_with_u8_array", "update_with_js_u8_array"), + ]), + ), + ( + "MediaKeyStatusMap", + BTreeMap::from_iter([ + ("get_with_u8_slice", "get_with_u8_array"), + ("get_with_u8_array", "get_with_js_u8_array"), + ("has_with_u8_slice", "has_with_u8_array"), + ("has_with_u8_array", "has_with_js_u8_array"), + ]), + ), + ( + "OfflineAudioContext", + BTreeMap::from_iter([ + ("create_periodic_wave_with_f32_slice_and_f32_slice", "create_periodic_wave"), + ("create_periodic_wave_with_f32_slice_and_f32_slice_and_constraints", "create_periodic_wave_with_constraints"), + ]), + ), + ( + "PresentationConnection", + BTreeMap::from_iter([ + ("send_with_u8_slice", "send_with_u8_array"), + ("send_with_u8_array", "send_with_js_u8_array"), + ]), + ), + ( + "ReadableByteStreamController", + BTreeMap::from_iter([ + ("enqueue_with_u8_slice", "enqueue_with_u8_array"), + ("enqueue_with_u8_array", "enqueue_with_js_u8_array"), + ]), + ), + ( + "ReadableStreamByobRequest", + BTreeMap::from_iter([ + ("respond_with_new_view_with_u8_slice", "respond_with_new_view_with_u8_array"), + ("respond_with_new_view_with_u8_array", "respond_with_new_view_with_js_u8_array"), + ]), + ), + ( + "Response", + BTreeMap::from_iter([ + ("new_with_opt_u8_slice", "new_with_opt_u8_array"), + ("new_with_opt_u8_array", "new_with_opt_js_u8_array"), + ("new_with_opt_u8_slice_and_init", "new_with_opt_u8_array_and_init"), + ("new_with_opt_u8_array_and_init", "new_with_opt_js_u8_array_and_init"), + ]), + ), + ( + "RtcDataChannel", + BTreeMap::from_iter([ + ("send_with_u8_slice", "send_with_u8_array"), + ("send_with_u8_array", "send_with_js_u8_array"), + ]), + ), + ( + "SourceBuffer", + BTreeMap::from_iter([ + ("append_buffer_with_u8_slice", "append_buffer_with_u8_array"), + ("append_buffer_with_u8_array", "append_buffer_with_js_u8_array"), + ("append_buffer_async_with_u8_slice", "append_buffer_async_with_u8_array"), + ("append_buffer_async_with_u8_array", "append_buffer_async_with_js_u8_array"), + ]), + ), + ( + "SubtleCrypto", + BTreeMap::from_iter([ + ("decrypt_with_object_and_u8_slice", "decrypt_with_object_and_u8_array"), + ("decrypt_with_object_and_u8_array", "decrypt_with_object_and_js_u8_array"), + ("decrypt_with_str_and_u8_slice", "decrypt_with_str_and_u8_array"), + ("decrypt_with_str_and_u8_array", "decrypt_with_str_and_js_u8_array"), + ("digest_with_object_and_u8_slice", "digest_with_object_and_u8_array"), + ("digest_with_object_and_u8_array", "digest_with_object_and_js_u8_array"), + ("digest_with_str_and_u8_slice", "digest_with_str_and_u8_array"), + ("digest_with_str_and_u8_array", "digest_with_str_and_js_u8_array"), + ("encrypt_with_object_and_u8_slice", "encrypt_with_object_and_u8_array"), + ("encrypt_with_object_and_u8_array", "encrypt_with_object_and_js_u8_array"), + ("encrypt_with_str_and_u8_slice", "encrypt_with_str_and_u8_array"), + ("encrypt_with_str_and_u8_array", "encrypt_with_str_and_js_u8_array"), + ("sign_with_object_and_u8_slice", "sign_with_object_and_u8_array"), + ("sign_with_object_and_u8_array", "sign_with_object_and_js_u8_array"), + ("sign_with_str_and_u8_slice", "sign_with_str_and_u8_array"), + ("sign_with_str_and_u8_array", "sign_with_str_and_js_u8_array"), + ("unwrap_key_with_u8_slice_and_object_and_object", "unwrap_key_with_u8_array_and_object_and_object"), + ("unwrap_key_with_u8_array_and_object_and_object", "unwrap_key_with_js_u8_array_and_object_and_object"), + ("unwrap_key_with_u8_slice_and_str_and_object", "unwrap_key_with_u8_array_and_str_and_object"), + ("unwrap_key_with_u8_array_and_str_and_object", "unwrap_key_with_js_u8_array_and_str_and_object"), + ("unwrap_key_with_u8_slice_and_object_and_str", "unwrap_key_with_u8_array_and_object_and_str"), + ("unwrap_key_with_u8_array_and_object_and_str", "unwrap_key_with_js_u8_array_and_object_and_str"), + ("unwrap_key_with_u8_slice_and_str_and_str", "unwrap_key_with_u8_array_and_str_and_str"), + ("unwrap_key_with_u8_array_and_str_and_str", "unwrap_key_with_js_u8_array_and_str_and_str"), + ("unwrap_key_with_u8_slice_and_buffer_source", "unwrap_key_with_u8_array_and_buffer_source"), + ("unwrap_key_with_u8_array_and_buffer_source", "unwrap_key_with_js_u8_array_and_buffer_source"), + ("verify_with_object_and_u8_slice_and_buffer_source", "verify_with_object_and_u8_array_and_buffer_source"), + ("verify_with_object_and_u8_array_and_buffer_source", "verify_with_object_and_js_u8_array_and_buffer_source"), + ("verify_with_str_and_u8_slice_and_buffer_source", "verify_with_str_and_u8_array_and_buffer_source"), + ("verify_with_str_and_u8_array_and_buffer_source", "verify_with_str_and_js_u8_array_and_buffer_source"), + ("verify_with_object_and_buffer_source_and_u8_slice", "verify_with_object_and_buffer_source_and_u8_array"), + ("verify_with_object_and_buffer_source_and_u8_array", "verify_with_object_and_buffer_source_and_js_u8_array"), + ("verify_with_str_and_buffer_source_and_u8_slice", "verify_with_str_and_buffer_source_and_u8_array"), + ("verify_with_str_and_buffer_source_and_u8_array", "verify_with_str_and_buffer_source_and_js_u8_array"), + ("verify_with_object_and_u8_slice_and_u8_slice", "verify_with_object_and_u8_array_and_u8_array"), + ("verify_with_object_and_u8_array_and_u8_array", "verify_with_object_and_js_u8_array_and_js_u8_array"), + ("verify_with_str_and_u8_slice_and_u8_slice", "verify_with_str_and_u8_array_and_u8_array"), + ("verify_with_str_and_u8_array_and_u8_array", "verify_with_str_and_js_u8_array_and_js_u8_array"), + ]), + ), + ( + "TextDecoder", + BTreeMap::from_iter([ + ("decode_with_u8_slice", "decode_with_u8_array"), + ("decode_with_u8_array", "decode_with_js_u8_array"), + ("decode_with_u8_slice_and_options", "decode_with_u8_array_and_options"), + ("decode_with_u8_array_and_options", "decode_with_js_u8_array_and_options"), + ]), + ), + ( + "VrMockController", + BTreeMap::from_iter([ + ("new_pose_move_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice", "new_pose_move"), + ]), + ), + ( + "VrMockDisplay", + BTreeMap::from_iter([ + ("set_pose_with_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice_and_opt_f32_slice", "set_pose"), + ]), + ), + ( + "WebGl2RenderingContext", + BTreeMap::from_iter([ + ("buffer_data_with_u8_slice", "buffer_data_with_u8_array"), + ("buffer_data_with_u8_array", "buffer_data_with_js_u8_array"), + ("buffer_data_with_u8_slice_and_src_offset", "buffer_data_with_u8_array_and_src_offset"), + ("buffer_data_with_u8_array_and_src_offset", "buffer_data_with_js_u8_array_and_src_offset"), + ("buffer_data_with_u8_slice_and_src_offset_and_length", "buffer_data_with_u8_array_and_src_offset_and_length"), + ("buffer_data_with_u8_array_and_src_offset_and_length", "buffer_data_with_js_u8_array_and_src_offset_and_length"), + ("buffer_sub_data_with_i32_and_u8_slice", "buffer_sub_data_with_i32_and_u8_array"), + ("buffer_sub_data_with_i32_and_u8_array", "buffer_sub_data_with_i32_and_js_u8_array"), + ("buffer_sub_data_with_f64_and_u8_slice", "buffer_sub_data_with_f64_and_u8_array"), + ("buffer_sub_data_with_f64_and_u8_array", "buffer_sub_data_with_f64_and_js_u8_array"), + ("buffer_sub_data_with_i32_and_u8_slice_and_src_offset", "buffer_sub_data_with_i32_and_u8_array_and_src_offset"), + ("buffer_sub_data_with_i32_and_u8_array_and_src_offset", "buffer_sub_data_with_i32_and_js_u8_array_and_src_offset"), + ("buffer_sub_data_with_f64_and_u8_slice_and_src_offset", "buffer_sub_data_with_f64_and_u8_array_and_src_offset"), + ("buffer_sub_data_with_f64_and_u8_array_and_src_offset", "buffer_sub_data_with_f64_and_js_u8_array_and_src_offset"), + ("buffer_sub_data_with_i32_and_u8_slice_and_src_offset_and_length", "buffer_sub_data_with_i32_and_u8_array_and_src_offset_and_length"), + ("buffer_sub_data_with_i32_and_u8_array_and_src_offset_and_length", "buffer_sub_data_with_i32_and_js_u8_array_and_src_offset_and_length"), + ("buffer_sub_data_with_f64_and_u8_slice_and_src_offset_and_length", "buffer_sub_data_with_f64_and_u8_array_and_src_offset_and_length"), + ("buffer_sub_data_with_f64_and_u8_array_and_src_offset_and_length", "buffer_sub_data_with_f64_and_js_u8_array_and_src_offset_and_length"), + ("clear_bufferfv_with_f32_slice", "clear_bufferfv_with_f32_array"), + ("clear_bufferfv_with_f32_array", "clear_bufferfv_with_js_f32_array"), + ("clear_bufferfv_with_f32_slice_and_src_offset", "clear_bufferfv_with_f32_array_and_src_offset"), + ("clear_bufferfv_with_f32_array_and_src_offset", "clear_bufferfv_with_js_f32_array_and_src_offset"), + ("clear_bufferiv_with_i32_slice", "clear_bufferiv_with_i32_array"), + ("clear_bufferiv_with_i32_array", "clear_bufferiv_with_js_i32_array"), + ("clear_bufferiv_with_i32_slice_and_src_offset", "clear_bufferiv_with_i32_array_and_src_offset"), + ("clear_bufferiv_with_i32_array_and_src_offset", "clear_bufferiv_with_js_i32_array_and_src_offset"), + ("clear_bufferuiv_with_u32_slice", "clear_bufferuiv_with_u32_array"), + ("clear_bufferuiv_with_u32_array", "clear_bufferuiv_with_js_u32_array"), + ("clear_bufferuiv_with_u32_slice_and_src_offset", "clear_bufferuiv_with_u32_array_and_src_offset"), + ("clear_bufferuiv_with_u32_array_and_src_offset", "clear_bufferuiv_with_js_u32_array_and_src_offset"), + ("compressed_tex_image_2d_with_u8_slice", "compressed_tex_image_2d_with_u8_array"), + ("compressed_tex_image_2d_with_u8_array", "compressed_tex_image_2d_with_js_u8_array"), + ("compressed_tex_image_2d_with_u8_slice_and_u32", "compressed_tex_image_2d_with_u8_array_and_u32"), + ("compressed_tex_image_2d_with_u8_array_and_u32", "compressed_tex_image_2d_with_js_u8_array_and_u32"), + ("compressed_tex_image_2d_with_u8_slice_and_u32_and_src_length_override", "compressed_tex_image_2d_with_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_image_2d_with_u8_array_and_u32_and_src_length_override", "compressed_tex_image_2d_with_js_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_image_3d_with_u8_slice", "compressed_tex_image_3d_with_u8_array"), + ("compressed_tex_image_3d_with_u8_array", "compressed_tex_image_3d_with_js_u8_array"), + ("compressed_tex_image_3d_with_u8_slice_and_u32", "compressed_tex_image_3d_with_u8_array_and_u32"), + ("compressed_tex_image_3d_with_u8_array_and_u32", "compressed_tex_image_3d_with_js_u8_array_and_u32"), + ("compressed_tex_image_3d_with_u8_slice_and_u32_and_src_length_override", "compressed_tex_image_3d_with_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_image_3d_with_u8_array_and_u32_and_src_length_override", "compressed_tex_image_3d_with_js_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_sub_image_2d_with_u8_slice", "compressed_tex_sub_image_2d_with_u8_array"), + ("compressed_tex_sub_image_2d_with_u8_array", "compressed_tex_sub_image_2d_with_js_u8_array"), + ("compressed_tex_sub_image_2d_with_u8_slice_and_u32", "compressed_tex_sub_image_2d_with_u8_array_and_u32"), + ("compressed_tex_sub_image_2d_with_u8_array_and_u32", "compressed_tex_sub_image_2d_with_js_u8_array_and_u32"), + ("compressed_tex_sub_image_2d_with_u8_slice_and_u32_and_src_length_override", "compressed_tex_sub_image_2d_with_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_sub_image_2d_with_u8_array_and_u32_and_src_length_override", "compressed_tex_sub_image_2d_with_js_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_sub_image_3d_with_u8_slice", "compressed_tex_sub_image_3d_with_u8_array"), + ("compressed_tex_sub_image_3d_with_u8_array", "compressed_tex_sub_image_3d_with_js_u8_array"), + ("compressed_tex_sub_image_3d_with_u8_slice_and_u32", "compressed_tex_sub_image_3d_with_u8_array_and_u32"), + ("compressed_tex_sub_image_3d_with_u8_array_and_u32", "compressed_tex_sub_image_3d_with_js_u8_array_and_u32"), + ("compressed_tex_sub_image_3d_with_u8_slice_and_u32_and_src_length_override", "compressed_tex_sub_image_3d_with_u8_array_and_u32_and_src_length_override"), + ("compressed_tex_sub_image_3d_with_u8_array_and_u32_and_src_length_override", "compressed_tex_sub_image_3d_with_js_u8_array_and_u32_and_src_length_override"), + ("get_buffer_sub_data_with_i32_and_u8_slice", "get_buffer_sub_data_with_i32_and_u8_array"), + ("get_buffer_sub_data_with_i32_and_u8_array", "get_buffer_sub_data_with_i32_and_js_u8_array"), + ("get_buffer_sub_data_with_f64_and_u8_slice", "get_buffer_sub_data_with_f64_and_u8_array"), + ("get_buffer_sub_data_with_f64_and_u8_array", "get_buffer_sub_data_with_f64_and_js_u8_array"), + ("get_buffer_sub_data_with_i32_and_u8_slice_and_dst_offset", "get_buffer_sub_data_with_i32_and_u8_array_and_dst_offset"), + ("get_buffer_sub_data_with_i32_and_u8_array_and_dst_offset", "get_buffer_sub_data_with_i32_and_js_u8_array_and_dst_offset"), + ("get_buffer_sub_data_with_f64_and_u8_slice_and_dst_offset", "get_buffer_sub_data_with_f64_and_u8_array_and_dst_offset"), + ("get_buffer_sub_data_with_f64_and_u8_array_and_dst_offset", "get_buffer_sub_data_with_f64_and_js_u8_array_and_dst_offset"), + ("get_buffer_sub_data_with_i32_and_u8_slice_and_dst_offset_and_length", "get_buffer_sub_data_with_i32_and_u8_array_and_dst_offset_and_length"), + ("get_buffer_sub_data_with_i32_and_u8_array_and_dst_offset_and_length", "get_buffer_sub_data_with_i32_and_js_u8_array_and_dst_offset_and_length"), + ("get_buffer_sub_data_with_f64_and_u8_slice_and_dst_offset_and_length", "get_buffer_sub_data_with_f64_and_u8_array_and_dst_offset_and_length"), + ("get_buffer_sub_data_with_f64_and_u8_array_and_dst_offset_and_length", "get_buffer_sub_data_with_f64_and_js_u8_array_and_dst_offset_and_length"), + ("read_pixels_with_opt_u8_slice", "read_pixels_with_opt_u8_array"), + ("read_pixels_with_opt_u8_array", "read_pixels_with_opt_js_u8_array"), + ("read_pixels_with_u8_slice_and_dst_offset", "read_pixels_with_u8_array_and_dst_offset"), + ("read_pixels_with_u8_array_and_dst_offset", "read_pixels_with_js_u8_array_and_dst_offset"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_slice", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_js_u8_array"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_u8_slice_and_src_offset", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_u8_array_and_src_offset"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_u8_array_and_src_offset", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_js_u8_array_and_src_offset"), + ("tex_image_3d_with_opt_u8_slice", "tex_image_3d_with_opt_u8_array"), + ("tex_image_3d_with_opt_u8_array", "tex_image_3d_with_opt_js_u8_array"), + ("tex_image_3d_with_u8_slice_and_src_offset", "tex_image_3d_with_u8_array_and_src_offset"), + ("tex_image_3d_with_u8_array_and_src_offset", "tex_image_3d_with_js_u8_array_and_src_offset"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_slice", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_js_u8_array"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_u8_slice_and_src_offset", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_u8_array_and_src_offset"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_u8_array_and_src_offset", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_js_u8_array_and_src_offset"), + ("tex_sub_image_3d_with_opt_u8_slice", "tex_sub_image_3d_with_opt_u8_array"), + ("tex_sub_image_3d_with_opt_u8_array", "tex_sub_image_3d_with_opt_js_u8_array"), + ("tex_sub_image_3d_with_opt_u8_slice_and_src_offset", "tex_sub_image_3d_with_opt_u8_array_and_src_offset"), + ("tex_sub_image_3d_with_opt_u8_array_and_src_offset", "tex_sub_image_3d_with_opt_js_u8_array_and_src_offset"), + ("uniform1fv_with_f32_slice", "uniform1fv_with_f32_array"), + ("uniform1fv_with_f32_array", "uniform1fv_with_js_f32_array"), + ("uniform1fv_with_f32_slice_and_src_offset", "uniform1fv_with_f32_array_and_src_offset"), + ("uniform1fv_with_f32_array_and_src_offset", "uniform1fv_with_js_f32_array_and_src_offset"), + ("uniform1fv_with_f32_slice_and_src_offset_and_src_length", "uniform1fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform1fv_with_f32_array_and_src_offset_and_src_length", "uniform1fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform1iv_with_i32_slice", "uniform1iv_with_i32_array"), + ("uniform1iv_with_i32_array", "uniform1iv_with_js_i32_array"), + ("uniform1iv_with_i32_slice_and_src_offset", "uniform1iv_with_i32_array_and_src_offset"), + ("uniform1iv_with_i32_array_and_src_offset", "uniform1iv_with_js_i32_array_and_src_offset"), + ("uniform1iv_with_i32_slice_and_src_offset_and_src_length", "uniform1iv_with_i32_array_and_src_offset_and_src_length"), + ("uniform1iv_with_i32_array_and_src_offset_and_src_length", "uniform1iv_with_js_i32_array_and_src_offset_and_src_length"), + ("uniform1uiv_with_u32_slice", "uniform1uiv_with_u32_array"), + ("uniform1uiv_with_u32_array", "uniform1uiv_with_js_u32_array"), + ("uniform1uiv_with_u32_slice_and_src_offset", "uniform1uiv_with_u32_array_and_src_offset"), + ("uniform1uiv_with_u32_array_and_src_offset", "uniform1uiv_with_js_u32_array_and_src_offset"), + ("uniform1uiv_with_u32_slice_and_src_offset_and_src_length", "uniform1uiv_with_u32_array_and_src_offset_and_src_length"), + ("uniform1uiv_with_u32_array_and_src_offset_and_src_length", "uniform1uiv_with_js_u32_array_and_src_offset_and_src_length"), + ("uniform2fv_with_f32_slice", "uniform2fv_with_f32_array"), + ("uniform2fv_with_f32_array", "uniform2fv_with_js_f32_array"), + ("uniform2fv_with_f32_slice_and_src_offset", "uniform2fv_with_f32_array_and_src_offset"), + ("uniform2fv_with_f32_array_and_src_offset", "uniform2fv_with_js_f32_array_and_src_offset"), + ("uniform2fv_with_f32_slice_and_src_offset_and_src_length", "uniform2fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform2fv_with_f32_array_and_src_offset_and_src_length", "uniform2fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform2iv_with_i32_slice", "uniform2iv_with_i32_array"), + ("uniform2iv_with_i32_array", "uniform2iv_with_js_i32_array"), + ("uniform2iv_with_i32_slice_and_src_offset", "uniform2iv_with_i32_array_and_src_offset"), + ("uniform2iv_with_i32_array_and_src_offset", "uniform2iv_with_js_i32_array_and_src_offset"), + ("uniform2iv_with_i32_slice_and_src_offset_and_src_length", "uniform2iv_with_i32_array_and_src_offset_and_src_length"), + ("uniform2iv_with_i32_array_and_src_offset_and_src_length", "uniform2iv_with_js_i32_array_and_src_offset_and_src_length"), + ("uniform2uiv_with_u32_slice", "uniform2uiv_with_u32_array"), + ("uniform2uiv_with_u32_array", "uniform2uiv_with_js_u32_array"), + ("uniform2uiv_with_u32_slice_and_src_offset", "uniform2uiv_with_u32_array_and_src_offset"), + ("uniform2uiv_with_u32_array_and_src_offset", "uniform2uiv_with_js_u32_array_and_src_offset"), + ("uniform2uiv_with_u32_slice_and_src_offset_and_src_length", "uniform2uiv_with_u32_array_and_src_offset_and_src_length"), + ("uniform2uiv_with_u32_array_and_src_offset_and_src_length", "uniform2uiv_with_js_u32_array_and_src_offset_and_src_length"), + ("uniform3fv_with_f32_slice", "uniform3fv_with_f32_array"), + ("uniform3fv_with_f32_array", "uniform3fv_with_js_f32_array"), + ("uniform3fv_with_f32_slice_and_src_offset", "uniform3fv_with_f32_array_and_src_offset"), + ("uniform3fv_with_f32_array_and_src_offset", "uniform3fv_with_js_f32_array_and_src_offset"), + ("uniform3fv_with_f32_slice_and_src_offset_and_src_length", "uniform3fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform3fv_with_f32_array_and_src_offset_and_src_length", "uniform3fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform3iv_with_i32_slice", "uniform3iv_with_i32_array"), + ("uniform3iv_with_i32_array", "uniform3iv_with_js_i32_array"), + ("uniform3iv_with_i32_slice_and_src_offset", "uniform3iv_with_i32_array_and_src_offset"), + ("uniform3iv_with_i32_array_and_src_offset", "uniform3iv_with_js_i32_array_and_src_offset"), + ("uniform3iv_with_i32_slice_and_src_offset_and_src_length", "uniform3iv_with_i32_array_and_src_offset_and_src_length"), + ("uniform3iv_with_i32_array_and_src_offset_and_src_length", "uniform3iv_with_js_i32_array_and_src_offset_and_src_length"), + ("uniform3uiv_with_u32_slice", "uniform3uiv_with_u32_array"), + ("uniform3uiv_with_u32_array", "uniform3uiv_with_js_u32_array"), + ("uniform3uiv_with_u32_slice_and_src_offset", "uniform3uiv_with_u32_array_and_src_offset"), + ("uniform3uiv_with_u32_array_and_src_offset", "uniform3uiv_with_js_u32_array_and_src_offset"), + ("uniform3uiv_with_u32_slice_and_src_offset_and_src_length", "uniform3uiv_with_u32_array_and_src_offset_and_src_length"), + ("uniform3uiv_with_u32_array_and_src_offset_and_src_length", "uniform3uiv_with_js_u32_array_and_src_offset_and_src_length"), + ("uniform4fv_with_f32_slice", "uniform4fv_with_f32_array"), + ("uniform4fv_with_f32_array", "uniform4fv_with_js_f32_array"), + ("uniform4fv_with_f32_slice_and_src_offset", "uniform4fv_with_f32_array_and_src_offset"), + ("uniform4fv_with_f32_array_and_src_offset", "uniform4fv_with_js_f32_array_and_src_offset"), + ("uniform4fv_with_f32_slice_and_src_offset_and_src_length", "uniform4fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform4fv_with_f32_array_and_src_offset_and_src_length", "uniform4fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform4iv_with_i32_slice", "uniform4iv_with_i32_array"), + ("uniform4iv_with_i32_array", "uniform4iv_with_js_i32_array"), + ("uniform4iv_with_i32_slice_and_src_offset", "uniform4iv_with_i32_array_and_src_offset"), + ("uniform4iv_with_i32_array_and_src_offset", "uniform4iv_with_js_i32_array_and_src_offset"), + ("uniform4iv_with_i32_slice_and_src_offset_and_src_length", "uniform4iv_with_i32_array_and_src_offset_and_src_length"), + ("uniform4iv_with_i32_array_and_src_offset_and_src_length", "uniform4iv_with_js_i32_array_and_src_offset_and_src_length"), + ("uniform4uiv_with_u32_slice", "uniform4uiv_with_u32_array"), + ("uniform4uiv_with_u32_array", "uniform4uiv_with_js_u32_array"), + ("uniform4uiv_with_u32_slice_and_src_offset", "uniform4uiv_with_u32_array_and_src_offset"), + ("uniform4uiv_with_u32_array_and_src_offset", "uniform4uiv_with_js_u32_array_and_src_offset"), + ("uniform4uiv_with_u32_slice_and_src_offset_and_src_length", "uniform4uiv_with_u32_array_and_src_offset_and_src_length"), + ("uniform4uiv_with_u32_array_and_src_offset_and_src_length", "uniform4uiv_with_js_u32_array_and_src_offset_and_src_length"), + ("uniform_matrix2fv_with_f32_slice", "uniform_matrix2fv_with_f32_array"), + ("uniform_matrix2fv_with_f32_array", "uniform_matrix2fv_with_js_f32_array"), + ("uniform_matrix2fv_with_f32_slice_and_src_offset", "uniform_matrix2fv_with_f32_array_and_src_offset"), + ("uniform_matrix2fv_with_f32_array_and_src_offset", "uniform_matrix2fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix2fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix2fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix2fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix2fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix2x3fv_with_f32_slice", "uniform_matrix2x3fv_with_f32_array"), + ("uniform_matrix2x3fv_with_f32_array", "uniform_matrix2x3fv_with_js_f32_array"), + ("uniform_matrix2x3fv_with_f32_slice_and_src_offset", "uniform_matrix2x3fv_with_f32_array_and_src_offset"), + ("uniform_matrix2x3fv_with_f32_array_and_src_offset", "uniform_matrix2x3fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix2x3fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix2x3fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix2x3fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix2x3fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix2x4fv_with_f32_slice", "uniform_matrix2x4fv_with_f32_array"), + ("uniform_matrix2x4fv_with_f32_array", "uniform_matrix2x4fv_with_js_f32_array"), + ("uniform_matrix2x4fv_with_f32_slice_and_src_offset", "uniform_matrix2x4fv_with_f32_array_and_src_offset"), + ("uniform_matrix2x4fv_with_f32_array_and_src_offset", "uniform_matrix2x4fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix2x4fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix2x4fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix2x4fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix2x4fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3fv_with_f32_slice", "uniform_matrix3fv_with_f32_array"), + ("uniform_matrix3fv_with_f32_array", "uniform_matrix3fv_with_js_f32_array"), + ("uniform_matrix3fv_with_f32_slice_and_src_offset", "uniform_matrix3fv_with_f32_array_and_src_offset"), + ("uniform_matrix3fv_with_f32_array_and_src_offset", "uniform_matrix3fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix3fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix3fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix3fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3x2fv_with_f32_slice", "uniform_matrix3x2fv_with_f32_array"), + ("uniform_matrix3x2fv_with_f32_array", "uniform_matrix3x2fv_with_js_f32_array"), + ("uniform_matrix3x2fv_with_f32_slice_and_src_offset", "uniform_matrix3x2fv_with_f32_array_and_src_offset"), + ("uniform_matrix3x2fv_with_f32_array_and_src_offset", "uniform_matrix3x2fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix3x2fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix3x2fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3x2fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix3x2fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3x4fv_with_f32_slice", "uniform_matrix3x4fv_with_f32_array"), + ("uniform_matrix3x4fv_with_f32_array", "uniform_matrix3x4fv_with_js_f32_array"), + ("uniform_matrix3x4fv_with_f32_slice_and_src_offset", "uniform_matrix3x4fv_with_f32_array_and_src_offset"), + ("uniform_matrix3x4fv_with_f32_array_and_src_offset", "uniform_matrix3x4fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix3x4fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix3x4fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix3x4fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix3x4fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4fv_with_f32_slice", "uniform_matrix4fv_with_f32_array"), + ("uniform_matrix4fv_with_f32_array", "uniform_matrix4fv_with_js_f32_array"), + ("uniform_matrix4fv_with_f32_slice_and_src_offset", "uniform_matrix4fv_with_f32_array_and_src_offset"), + ("uniform_matrix4fv_with_f32_array_and_src_offset", "uniform_matrix4fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix4fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix4fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix4fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4x2fv_with_f32_slice", "uniform_matrix4x2fv_with_f32_array"), + ("uniform_matrix4x2fv_with_f32_array", "uniform_matrix4x2fv_with_js_f32_array"), + ("uniform_matrix4x2fv_with_f32_slice_and_src_offset", "uniform_matrix4x2fv_with_f32_array_and_src_offset"), + ("uniform_matrix4x2fv_with_f32_array_and_src_offset", "uniform_matrix4x2fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix4x2fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix4x2fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4x2fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix4x2fv_with_js_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4x3fv_with_f32_slice", "uniform_matrix4x3fv_with_f32_array"), + ("uniform_matrix4x3fv_with_f32_array", "uniform_matrix4x3fv_with_js_f32_array"), + ("uniform_matrix4x3fv_with_f32_slice_and_src_offset", "uniform_matrix4x3fv_with_f32_array_and_src_offset"), + ("uniform_matrix4x3fv_with_f32_array_and_src_offset", "uniform_matrix4x3fv_with_js_f32_array_and_src_offset"), + ("uniform_matrix4x3fv_with_f32_slice_and_src_offset_and_src_length", "uniform_matrix4x3fv_with_f32_array_and_src_offset_and_src_length"), + ("uniform_matrix4x3fv_with_f32_array_and_src_offset_and_src_length", "uniform_matrix4x3fv_with_js_f32_array_and_src_offset_and_src_length"), + ("vertex_attrib_i4iv_with_i32_slice", "vertex_attrib_i4iv_with_i32_array"), + ("vertex_attrib_i4iv_with_i32_array", "vertex_attrib_i4iv_with_js_i32_array"), + ("vertex_attrib_i4uiv_with_u32_slice", "vertex_attrib_i4uiv_with_u32_array"), + ("vertex_attrib_i4uiv_with_u32_array", "vertex_attrib_i4uiv_with_js_u32_array"), + ("vertex_attrib1fv_with_f32_slice", "vertex_attrib1fv_with_f32_array"), + ("vertex_attrib1fv_with_f32_array", "vertex_attrib1fv_with_js_f32_array"), + ("vertex_attrib2fv_with_f32_slice", "vertex_attrib2fv_with_f32_array"), + ("vertex_attrib2fv_with_f32_array", "vertex_attrib2fv_with_js_f32_array"), + ("vertex_attrib3fv_with_f32_slice", "vertex_attrib3fv_with_f32_array"), + ("vertex_attrib3fv_with_f32_array", "vertex_attrib3fv_with_js_f32_array"), + ("vertex_attrib4fv_with_f32_slice", "vertex_attrib4fv_with_f32_array"), + ("vertex_attrib4fv_with_f32_array", "vertex_attrib4fv_with_js_f32_array"), + ]), + ), + ( + "WebglMultiDraw", + BTreeMap::from_iter([ + ("multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_slice", "multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_array", "multi_draw_arrays_instanced_webgl_with_js_i32_array_and_js_i32_array_and_js_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_slice", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_js_i32_array_and_js_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_slice", "multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array", "multi_draw_arrays_instanced_webgl_with_js_i32_array_and_i32_sequence_and_js_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_slice", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_sequence_and_js_i32_array"), + ("multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence"), + ("multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_js_i32_array_and_js_i32_array_and_i32_sequence"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence"), + ("multi_draw_arrays_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_i32_sequence_and_js_i32_array_and_i32_sequence"), + ("multi_draw_arrays_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence"), + ("multi_draw_arrays_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence", "multi_draw_arrays_instanced_webgl_with_js_i32_array_and_i32_sequence_and_i32_sequence"), + ("multi_draw_arrays_webgl_with_i32_slice_and_i32_slice", "multi_draw_arrays_webgl_with_i32_array_and_i32_array"), + ("multi_draw_arrays_webgl_with_i32_array_and_i32_array", "multi_draw_arrays_webgl_with_js_i32_array_and_js_i32_array"), + ("multi_draw_arrays_webgl_with_i32_sequence_and_i32_slice", "multi_draw_arrays_webgl_with_i32_sequence_and_i32_array"), + ("multi_draw_arrays_webgl_with_i32_sequence_and_i32_array", "multi_draw_arrays_webgl_with_i32_sequence_and_js_i32_array"), + ("multi_draw_arrays_webgl_with_i32_slice_and_i32_sequence", "multi_draw_arrays_webgl_with_i32_array_and_i32_sequence"), + ("multi_draw_arrays_webgl_with_i32_array_and_i32_sequence", "multi_draw_arrays_webgl_with_js_i32_array_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_slice", "multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_array", "multi_draw_elements_instanced_webgl_with_js_i32_array_and_js_i32_array_and_js_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_slice", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_array", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_js_i32_array_and_js_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_slice", "multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_array", "multi_draw_elements_instanced_webgl_with_js_i32_array_and_i32_sequence_and_js_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_slice", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_i32_array", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_sequence_and_js_i32_array"), + ("multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_slice_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_array_and_i32_array_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_js_i32_array_and_js_i32_array_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_slice_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_sequence_and_i32_array_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_i32_sequence_and_js_i32_array_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_slice_and_i32_sequence_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence"), + ("multi_draw_elements_instanced_webgl_with_i32_array_and_i32_sequence_and_i32_sequence", "multi_draw_elements_instanced_webgl_with_js_i32_array_and_i32_sequence_and_i32_sequence"), + ("multi_draw_elements_webgl_with_i32_slice_and_i32_slice", "multi_draw_elements_webgl_with_i32_array_and_i32_array"), + ("multi_draw_elements_webgl_with_i32_array_and_i32_array", "multi_draw_elements_webgl_with_js_i32_array_and_js_i32_array"), + ("multi_draw_elements_webgl_with_i32_sequence_and_i32_slice", "multi_draw_elements_webgl_with_i32_sequence_and_i32_array"), + ("multi_draw_elements_webgl_with_i32_sequence_and_i32_array", "multi_draw_elements_webgl_with_i32_sequence_and_js_i32_array"), + ("multi_draw_elements_webgl_with_i32_slice_and_i32_sequence", "multi_draw_elements_webgl_with_i32_array_and_i32_sequence"), + ("multi_draw_elements_webgl_with_i32_array_and_i32_sequence", "multi_draw_elements_webgl_with_js_i32_array_and_i32_sequence"), + ]), + ), + ( + "WebGlRenderingContext", + BTreeMap::from_iter([ + ("buffer_data_with_u8_slice", "buffer_data_with_u8_array"), + ("buffer_data_with_u8_array", "buffer_data_with_js_u8_array"), + ("buffer_sub_data_with_i32_and_u8_slice", "buffer_sub_data_with_i32_and_u8_array"), + ("buffer_sub_data_with_i32_and_u8_array", "buffer_sub_data_with_i32_and_js_u8_array"), + ("buffer_sub_data_with_f64_and_u8_slice", "buffer_sub_data_with_f64_and_u8_array"), + ("buffer_sub_data_with_f64_and_u8_array", "buffer_sub_data_with_f64_and_js_u8_array"), + ("compressed_tex_image_2d_with_u8_slice", "compressed_tex_image_2d_with_u8_array"), + ("compressed_tex_image_2d_with_u8_array", "compressed_tex_image_2d_with_js_u8_array"), + ("compressed_tex_sub_image_2d_with_u8_slice", "compressed_tex_sub_image_2d_with_u8_array"), + ("compressed_tex_sub_image_2d_with_u8_array", "compressed_tex_sub_image_2d_with_js_u8_array"), + ("read_pixels_with_opt_u8_slice", "read_pixels_with_opt_u8_array"), + ("read_pixels_with_opt_u8_array", "read_pixels_with_opt_js_u8_array"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_slice", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array"), + ("tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array", "tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_js_u8_array"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_slice", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array"), + ("tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array", "tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_js_u8_array"), + ("uniform1fv_with_f32_slice", "uniform1fv_with_f32_array"), + ("uniform1fv_with_f32_array", "uniform1fv_with_js_f32_array"), + ("uniform1iv_with_i32_slice", "uniform1iv_with_i32_array"), + ("uniform1iv_with_i32_array", "uniform1iv_with_js_i32_array"), + ("uniform2fv_with_f32_slice", "uniform2fv_with_f32_array"), + ("uniform2fv_with_f32_array", "uniform2fv_with_js_f32_array"), + ("uniform2iv_with_i32_slice", "uniform2iv_with_i32_array"), + ("uniform2iv_with_i32_array", "uniform2iv_with_js_i32_array"), + ("uniform3fv_with_f32_slice", "uniform3fv_with_f32_array"), + ("uniform3fv_with_f32_array", "uniform3fv_with_js_f32_array"), + ("uniform3iv_with_i32_slice", "uniform3iv_with_i32_array"), + ("uniform3iv_with_i32_array", "uniform3iv_with_js_i32_array"), + ("uniform4fv_with_f32_slice", "uniform4fv_with_f32_array"), + ("uniform4fv_with_f32_array", "uniform4fv_with_js_f32_array"), + ("uniform4iv_with_i32_slice", "uniform4iv_with_i32_array"), + ("uniform4iv_with_i32_array", "uniform4iv_with_js_i32_array"), + ("uniform_matrix2fv_with_f32_slice", "uniform_matrix2fv_with_f32_array"), + ("uniform_matrix2fv_with_f32_array", "uniform_matrix2fv_with_js_f32_array"), + ("uniform_matrix3fv_with_f32_slice", "uniform_matrix3fv_with_f32_array"), + ("uniform_matrix3fv_with_f32_array", "uniform_matrix3fv_with_js_f32_array"), + ("uniform_matrix4fv_with_f32_slice", "uniform_matrix4fv_with_f32_array"), + ("uniform_matrix4fv_with_f32_array", "uniform_matrix4fv_with_js_f32_array"), + ("vertex_attrib1fv_with_f32_slice", "vertex_attrib1fv_with_f32_array"), + ("vertex_attrib1fv_with_f32_array", "vertex_attrib1fv_with_js_f32_array"), + ("vertex_attrib2fv_with_f32_slice", "vertex_attrib2fv_with_f32_array"), + ("vertex_attrib2fv_with_f32_array", "vertex_attrib2fv_with_js_f32_array"), + ("vertex_attrib3fv_with_f32_slice", "vertex_attrib3fv_with_f32_array"), + ("vertex_attrib3fv_with_f32_array", "vertex_attrib3fv_with_js_f32_array"), + ("vertex_attrib4fv_with_f32_slice", "vertex_attrib4fv_with_f32_array"), + ("vertex_attrib4fv_with_f32_array", "vertex_attrib4fv_with_js_f32_array"), + ]), + ), + ( + "WebSocket", + BTreeMap::from_iter([ + ("send_with_u8_slice", "send_with_u8_array"), + ("send_with_u8_array", "send_with_js_u8_array"), + ]), + ), + ( + "XmlHttpRequest", + BTreeMap::from_iter([ + ("send_with_opt_u8_slice", "send_with_opt_u8_array"), + ("send_with_opt_u8_array", "send_with_opt_js_u8_array"), ]), ), ]) @@ -795,3 +1371,116 @@ pub(crate) static BREAKING_SETTER_THROWS: Lazy>> = + Lazy::new(|| { + BTreeMap::from_iter([ + ( + "AnalyserNode", + vec![ + "getByteFrequencyData", + "getByteTimeDomainData", + "getFloatFrequencyData", + "getFloatTimeDomainData", + ], + ), + ("BiquadFilterNode", vec!["getFrequencyResponse"]), + ("IirFilterNode", vec!["getFrequencyResponse"]), + ("MediaKeys", vec!["setServerCertificate"]), + ("MediaKeySession", vec!["generateRequest", "update"]), + ("MediaKeyStatusMap", vec!["has"]), + ("ReadableStreamByobReader", vec!["read"]), + ("VrMockController", vec!["newPoseMove"]), + ("VrMockDisplay", vec!["setPose"]), + ( + "WebGl2RenderingContext", + vec![ + "bufferData", + "bufferSubData", + "clearBufferfv", + "clearBufferiv", + "clearBufferuiv", + "compressedTexImage2D", + "compressedTexImage3D", + "compressedTexSubImage2D", + "compressedTexSubImage3D", + "getBufferSubData", + "uniform1fv", + "uniform1iv", + "uniform1uiv", + "uniform2fv", + "uniform2iv", + "uniform2uiv", + "uniform3fv", + "uniform3iv", + "uniform3uiv", + "uniform4fv", + "uniform4iv", + "uniform4uiv", + "uniformMatrix2fv", + "uniformMatrix2x3fv", + "uniformMatrix2x4fv", + "uniformMatrix3fv", + "uniformMatrix3x2fv", + "uniformMatrix3x4fv", + "uniformMatrix4fv", + "uniformMatrix4x2fv", + "uniformMatrix4x3fv", + "vertexAttribI4iv", + "vertexAttribI4uiv", + "vertexAttrib1fv", + "vertexAttrib2fv", + "vertexAttrib3fv", + "vertexAttrib4fv", + ], + ), + ( + "WebglMultiDraw", + vec![ + "multiDrawArraysInstancedWEBGL", + "multiDrawArraysWEBGL", + "multiDrawElementsInstancedWEBGL", + "multiDrawElementsWEBGL", + ], + ), + ( + "WebGlRenderingContext", + vec![ + "bufferData", + "bufferSubData", + "compressedTexImage2D", + "compressedTexSubImage2D", + "uniform1fv", + "uniform1iv", + "uniform2fv", + "uniform2iv", + "uniform3fv", + "uniform3iv", + "uniform4fv", + "uniform4iv", + "uniformMatrix2fv", + "uniformMatrix3fv", + "uniformMatrix4fv", + "vertexAttrib1fv", + "vertexAttrib2fv", + "vertexAttrib3fv", + "vertexAttrib4fv", + ], + ), + ]) + }); + +pub(crate) static UNFLATTENED_ATTRIBUTES: Lazy>> = + Lazy::new(|| { + BTreeMap::from_iter([ + ("CanvasRenderingContext2D", vec!["strokeStyle", "fillStyle"]), + ("IDBFileHandle", vec!["location"]), + ("KeyframeEffect", vec!["target"]), + ( + "OffscreenCanvasRenderingContext2D", + vec!["strokeStyle", "fillStyle"], + ), + ("VTTCue", vec!["line", "position"]), + ("WaveShaperNode", vec!["curve"]), + ]) + }); diff --git a/crates/webidl/src/first_pass.rs b/crates/webidl/src/first_pass.rs index ef111f574bc..d0fc297814f 100644 --- a/crates/webidl/src/first_pass.rs +++ b/crates/webidl/src/first_pass.rs @@ -185,6 +185,7 @@ pub(crate) struct Signature<'src> { #[derive(Clone, Debug)] pub(crate) struct Arg<'src> { + pub(crate) attributes: &'src Option>, pub(crate) name: &'src str, pub(crate) ty: &'src weedle::types::Type<'src>, pub(crate) optional: bool, @@ -193,17 +194,25 @@ pub(crate) struct Arg<'src> { impl<'a> From<&'a Argument<'a>> for Arg<'a> { fn from(arg: &'a Argument<'a>) -> Self { - let (name, ty, optional, variadic) = match arg { + let (attributes, name, ty, optional, variadic) = match arg { Argument::Single(single) => ( + &single.attributes, single.identifier.0, &single.type_.type_, single.optional.is_some(), false, ), - Argument::Variadic(variadic) => (variadic.identifier.0, &variadic.type_, false, true), + Argument::Variadic(variadic) => ( + &variadic.attributes, + variadic.identifier.0, + &variadic.type_, + false, + true, + ), }; Self { + attributes, name, ty, optional, @@ -645,12 +654,14 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> let key_ty = &self.generics.body.0; let value_ty = &self.generics.body.2; let key_arg = || Arg { + attributes: &None, name: "key", ty: &key_ty.type_, optional: false, variadic: false, }; let value_arg = || Arg { + attributes: &None, name: "value", ty: &value_ty.type_, optional: false, @@ -721,6 +732,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> // callback MapLikeForEachCallback = undefined (V value, K key); // TODO: the signature of the callback is erased, could we keep it? let foreach_callback_arg = Arg { + attributes: &None, name: "callback", ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { type_: Identifier("MapLikeForEachCallback"), @@ -871,6 +883,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> ) -> Result<()> { let value_ty = &self.generics.body; let value_arg = || Arg { + attributes: &None, name: "value", ty: &value_ty.type_, optional: false, @@ -928,6 +941,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> // callback SetlikeForEachCallback = undefined (V value); // TODO: the signature of the callback is erased, could we keep it? let foreach_callback_arg = Arg { + attributes: &None, name: "callback", ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { type_: Identifier("SetlikeForEachCallback"), @@ -1136,6 +1150,7 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> // callback SetlikeForEachCallback = undefined (V value); // TODO: the signature of the callback is erased, could we keep it? let foreach_callback_arg = Arg { + attributes: &None, name: "callback", ty: &Type::Single(SingleType::NonAny(NonAnyType::Identifier(MayBeNull { type_: Identifier("IterableForEachCallback"), diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 750649f65c9..43a70604d07 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -33,38 +33,51 @@ pub(crate) enum IdlType<'a> { Error, ArrayBuffer, - DataView, + DataView { + allow_shared: bool, + }, Int8Array { + allow_shared: bool, immutable: bool, }, Uint8Array { + allow_shared: bool, immutable: bool, }, Uint8ClampedArray { + allow_shared: bool, immutable: bool, }, Int16Array { + allow_shared: bool, immutable: bool, }, Uint16Array { + allow_shared: bool, immutable: bool, }, Int32Array { + allow_shared: bool, immutable: bool, }, Uint32Array { + allow_shared: bool, immutable: bool, }, Float32Array { + allow_shared: bool, immutable: bool, }, Float64Array { + allow_shared: bool, immutable: bool, }, ArrayBufferView { + allow_shared: bool, immutable: bool, }, BufferSource { + allow_shared: bool, immutable: bool, }, @@ -101,7 +114,43 @@ pub(crate) enum IdentifierType<'a> { // DOMTimeStamp UnsignedLongLong, // AllowSharedBufferSource - BufferSource { + AllowSharedBufferSource { + immutable: bool, + }, + Int8Slice { + allow_shared: bool, + immutable: bool, + }, + Uint8Slice { + allow_shared: bool, + immutable: bool, + }, + Uint8ClampedSlice { + allow_shared: bool, + immutable: bool, + }, + Int16Slice { + allow_shared: bool, + immutable: bool, + }, + Uint16Slice { + allow_shared: bool, + immutable: bool, + }, + Int32Slice { + allow_shared: bool, + immutable: bool, + }, + Uint32Slice { + allow_shared: bool, + immutable: bool, + }, + Float32Slice { + allow_shared: bool, + immutable: bool, + }, + Float64Slice { + allow_shared: bool, immutable: bool, }, } @@ -341,7 +390,7 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { // https://heycam.github.io/webidl/#DOMTimeStamp IdentifierType::UnsignedLongLong } else if self.0 == "AllowSharedBufferSource" { - IdentifierType::BufferSource { immutable: false } + IdentifierType::AllowSharedBufferSource { immutable: false } } else if let Some(idl_type) = record.typedefs.get(&self.0) { return idl_type.to_idl_type(record); } else if record.interfaces.contains_key(self.0) { @@ -378,6 +427,14 @@ impl<'a> ToIdlType<'a> for Identifier<'a> { } } +impl<'a> ToIdlType<'a> for term::DataView { + fn to_idl_type(&self, _record: &FirstPassRecord<'a>) -> IdlType<'a> { + IdlType::DataView { + allow_shared: false, + } + } +} + macro_rules! terms_to_idl_type { ($($t:tt => $r:tt)*) => ($( impl<'a> ToIdlType<'a> for term::$t { @@ -395,7 +452,7 @@ macro_rules! terms_to_idl_type_maybe_immutable { ($($t:tt => $r:tt)*) => ($( impl<'a> ToIdlType<'a> for term::$t { fn to_idl_type(&self, _record: &FirstPassRecord<'a>) -> IdlType<'a> { - IdlType::$r { immutable: false } + IdlType::$r { allow_shared: false, immutable: false } } } )*); @@ -417,7 +474,6 @@ terms_to_idl_type! { Short => Short Undefined => Undefined ArrayBuffer => ArrayBuffer - DataView => DataView Error => Error } @@ -465,7 +521,7 @@ impl<'a> IdlType<'a> { IdlType::Error => dst.push_str("error"), IdlType::ArrayBuffer => dst.push_str("array_buffer"), - IdlType::DataView => dst.push_str("data_view"), + IdlType::DataView { .. } => dst.push_str("data_view"), IdlType::Int8Array { .. } => dst.push_str("i8_array"), IdlType::Uint8Array { .. } => dst.push_str("u8_array"), IdlType::Uint8ClampedArray { .. } => dst.push_str("u8_clamped_array"), @@ -531,16 +587,30 @@ impl<'a> IdlType<'a> { IdentifierType::UnsignedLongLong => { IdlType::UnsignedLongLong.push_snake_case_name(dst) } - IdentifierType::BufferSource { immutable } => IdlType::BufferSource { + IdentifierType::AllowSharedBufferSource { immutable } => IdlType::BufferSource { + allow_shared: true, immutable: *immutable, } .push_snake_case_name(dst), + IdentifierType::Int8Slice { .. } => dst.push_str("i8_slice"), + IdentifierType::Uint8Slice { .. } => dst.push_str("u8_slice"), + IdentifierType::Uint8ClampedSlice { .. } => dst.push_str("u8_clamped_slice"), + IdentifierType::Int16Slice { .. } => dst.push_str("i16_slice"), + IdentifierType::Uint16Slice { .. } => dst.push_str("u16_slice"), + IdentifierType::Int32Slice { .. } => dst.push_str("i32_slice"), + IdentifierType::Uint32Slice { .. } => dst.push_str("u32_slice"), + IdentifierType::Float32Slice { .. } => dst.push_str("f32_slice"), + IdentifierType::Float64Slice { .. } => dst.push_str("f64_slice"), }, } } /// Converts to syn type if possible. - pub(crate) fn to_syn_type(&self, pos: TypePosition) -> Result, TypeError> { + pub(crate) fn to_syn_type( + &self, + pos: TypePosition, + legacy: bool, + ) -> Result, TypeError> { let externref = |ty| { Some(match pos { TypePosition::Argument => shared_ref(ty, false), @@ -592,23 +662,50 @@ impl<'a> IdlType<'a> { IdlType::Error => Err(TypeError::CannotConvert), IdlType::ArrayBuffer => Ok(js_sys("ArrayBuffer")), - IdlType::DataView => Ok(js_sys("DataView")), - IdlType::Int8Array { immutable } => Ok(Some(array("i8", pos, *immutable))), - IdlType::Uint8Array { immutable } => Ok(Some(array("u8", pos, *immutable))), - IdlType::Uint8ClampedArray { immutable } => { - Ok(Some(clamped(array("u8", pos, *immutable)))) - } - IdlType::Int16Array { immutable } => Ok(Some(array("i16", pos, *immutable))), - IdlType::Uint16Array { immutable } => Ok(Some(array("u16", pos, *immutable))), - IdlType::Int32Array { immutable } => Ok(Some(array("i32", pos, *immutable))), - IdlType::Uint32Array { immutable } => Ok(Some(array("u32", pos, *immutable))), - IdlType::Float32Array { immutable } => Ok(Some(array("f32", pos, *immutable))), - IdlType::Float64Array { immutable } => Ok(Some(array("f64", pos, *immutable))), + IdlType::DataView { .. } => Ok(js_sys("DataView")), + IdlType::Int8Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("i8", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Int8Array")), + }, + IdlType::Uint8Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("u8", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Uint8Array")), + }, + IdlType::Uint8ClampedArray { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => { + Ok(Some(clamped(array("u8", pos, *immutable)))) + } + (false, TypePosition::Argument) => Ok(js_sys("Uint8ClampedArray")), + }, + IdlType::Int16Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("i16", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Int16Array")), + }, + IdlType::Uint16Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("u16", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Uint16Array")), + }, + IdlType::Int32Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("i32", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Int32Array")), + }, + IdlType::Uint32Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("u32", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Uint32Array")), + }, + IdlType::Float32Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("f32", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Float32Array")), + }, + IdlType::Float64Array { immutable, .. } => match (legacy, pos) { + (true, _) | (_, TypePosition::Return) => Ok(Some(array("f64", pos, *immutable))), + (false, TypePosition::Argument) => Ok(js_sys("Float64Array")), + }, IdlType::ArrayBufferView { .. } | IdlType::BufferSource { .. } => Ok(js_sys("Object")), IdlType::Nullable(idl_type) => { - let inner = idl_type.to_syn_type(pos)?; + let inner = idl_type.to_syn_type(pos, legacy)?; match inner { Some(inner) => { @@ -678,15 +775,15 @@ impl<'a> IdlType<'a> { } ) }) { - IdlType::Object.to_syn_type(pos) + IdlType::Object.to_syn_type(pos, legacy) } else { - IdlType::Any.to_syn_type(pos) + IdlType::Any.to_syn_type(pos, legacy) } } IdlType::Any => Ok(js_value), IdlType::Undefined => Ok(None), - IdlType::Identifier { ty, .. } => ty.to_syn_type(pos), + IdlType::Identifier { ty, .. } => ty.to_syn_type(pos, legacy), IdlType::UnknownIdentifier(_) => Err(TypeError::CannotConvert), } } @@ -739,8 +836,12 @@ impl<'a> IdlType<'a> { .iter() .flat_map(|idl_type| idl_type.flatten(attrs)) .collect(), - IdlType::ArrayBufferView { immutable } => { + IdlType::ArrayBufferView { + allow_shared, + immutable, + } => { let view = IdlType::ArrayBufferView { + allow_shared: *allow_shared, immutable: *immutable, }; @@ -756,21 +857,185 @@ impl<'a> IdlType<'a> { vec![ view, + IdlType::Identifier { + name: "Uint8Array", + ty: IdentifierType::Uint8Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, IdlType::Uint8Array { + allow_shared: *allow_shared, immutable: *immutable, }, ] } - IdlType::BufferSource { immutable } => vec![ + IdlType::BufferSource { + allow_shared, + immutable, + } => vec![ IdlType::BufferSource { + allow_shared: *allow_shared, immutable: *immutable, }, + IdlType::Identifier { + name: "Uint8Array", + ty: IdentifierType::Uint8Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, IdlType::Uint8Array { + allow_shared: *allow_shared, immutable: *immutable, }, ], IdlType::LongLong => vec![IdlType::Long, IdlType::Double], IdlType::UnsignedLongLong => vec![IdlType::UnsignedLong, IdlType::Double], + IdlType::Int8Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Int8Array", + ty: IdentifierType::Int8Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Int8Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Uint8Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Uint8Array", + ty: IdentifierType::Uint8Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Uint8Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Uint8ClampedArray { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Uint8ClampedArray", + ty: IdentifierType::Uint8ClampedSlice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Uint8ClampedArray { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Int16Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Int16Array", + ty: IdentifierType::Int16Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Int16Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Uint16Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Uint16Array", + ty: IdentifierType::Uint16Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Uint16Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Int32Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Int32Array", + ty: IdentifierType::Int32Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Int32Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Uint32Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Uint32Array", + ty: IdentifierType::Uint32Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Uint32Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Float32Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Float32Array", + ty: IdentifierType::Float32Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Float32Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], + IdlType::Float64Array { + allow_shared, + immutable, + } => vec![ + IdlType::Identifier { + name: "Float64Array", + ty: IdentifierType::Float64Slice { + allow_shared: *allow_shared, + immutable: *immutable, + }, + }, + IdlType::Float64Array { + allow_shared: *allow_shared, + immutable: *immutable, + }, + ], idl_type @ IdlType::Identifier { name: identifier, ty, @@ -797,10 +1062,13 @@ impl<'a> IdlType<'a> { ] } IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.flatten(attrs), - IdentifierType::BufferSource { immutable } => IdlType::BufferSource { - immutable: *immutable, + IdentifierType::AllowSharedBufferSource { immutable } => { + IdlType::BufferSource { + allow_shared: true, + immutable: *immutable, + } + .flatten(attrs) } - .flatten(attrs), _ => vec![idl_type.clone()], } } @@ -819,7 +1087,11 @@ impl<'a> IdlType<'a> { impl<'a> IdentifierType<'a> { /// Converts to syn type if possible. - pub(crate) fn to_syn_type(&self, pos: TypePosition) -> Result, TypeError> { + pub(crate) fn to_syn_type( + &self, + pos: TypePosition, + legacy: bool, + ) -> Result, TypeError> { let externref = |ty| { Some(match pos { TypePosition::Argument => shared_ref(ty, false), @@ -844,11 +1116,31 @@ impl<'a> IdentifierType<'a> { IdentifierType::Enum(name) => { Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str())))) } - IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.to_syn_type(pos), - IdentifierType::BufferSource { immutable } => IdlType::BufferSource { + IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.to_syn_type(pos, legacy), + IdentifierType::AllowSharedBufferSource { immutable } => IdlType::BufferSource { + allow_shared: true, immutable: *immutable, } - .to_syn_type(pos), + .to_syn_type(pos, legacy), + IdentifierType::Int8Slice { immutable, .. } => Ok(Some(array("i8", pos, *immutable))), + IdentifierType::Uint8Slice { immutable, .. } => Ok(Some(array("u8", pos, *immutable))), + IdentifierType::Uint8ClampedSlice { immutable, .. } => { + Ok(Some(clamped(array("u8", pos, *immutable)))) + } + IdentifierType::Int16Slice { immutable, .. } => Ok(Some(array("i16", pos, *immutable))), + IdentifierType::Uint16Slice { immutable, .. } => { + Ok(Some(array("u16", pos, *immutable))) + } + IdentifierType::Int32Slice { immutable, .. } => Ok(Some(array("i32", pos, *immutable))), + IdentifierType::Uint32Slice { immutable, .. } => { + Ok(Some(array("u32", pos, *immutable))) + } + IdentifierType::Float32Slice { immutable, .. } => { + Ok(Some(array("f32", pos, *immutable))) + } + IdentifierType::Float64Slice { immutable, .. } => { + Ok(Some(array("f64", pos, *immutable))) + } } } } diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index 372fe4b0851..f13c3558273 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -31,6 +31,7 @@ use crate::util::{ }; use anyhow::Context; use anyhow::Result; +use constants::UNFLATTENED_ATTRIBUTES; use idl_type::{IdentifierType, IdlType}; use proc_macro2::{Ident, TokenStream}; use quote::ToTokens; @@ -419,10 +420,13 @@ impl<'src> FirstPassRecord<'src> { // use argument position now as we're just binding setters let ty = idl_type - .to_syn_type(TypePosition::Argument) + .to_syn_type(TypePosition::Argument, false) .unwrap_or(None)?; - let mut return_ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); + let mut return_ty = idl_type + .to_syn_type(TypePosition::Return, false) + .unwrap() + .unwrap(); if field.required.is_none() { return_ty = optional_return_ty(return_ty); @@ -518,7 +522,10 @@ impl<'src> FirstPassRecord<'src> { unstable: bool, ) { let idl_type = member.definition.const_type.to_idl_type(self); - let ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); + let ty = idl_type + .to_syn_type(TypePosition::Return, false) + .unwrap() + .unwrap(); let js_name = member.definition.identifier.0; let name = rust_ident(shouty_snake_case_ident(js_name).as_str()); @@ -573,7 +580,10 @@ impl<'src> FirstPassRecord<'src> { unstable: bool, ) { let idl_type = member.const_type.to_idl_type(self); - let ty = idl_type.to_syn_type(TypePosition::Return).unwrap().unwrap(); + let ty = idl_type + .to_syn_type(TypePosition::Return, false) + .unwrap() + .unwrap(); let js_name = member.identifier.0; let name = rust_ident(shouty_snake_case_ident(js_name).as_str()); @@ -727,7 +737,7 @@ impl<'src> FirstPassRecord<'src> { let ty = type_ .type_ .to_idl_type(self) - .to_syn_type(TypePosition::Return) + .to_syn_type(TypePosition::Return, false) .unwrap_or(None); // Skip types which can't be converted @@ -746,23 +756,58 @@ impl<'src> FirstPassRecord<'src> { } if !readonly { - let ty = type_ - .type_ - .to_idl_type(self) - .to_syn_type(TypePosition::Argument) - .unwrap_or(None); - - // Skip types which can't be converted - if let Some(ty) = ty { - let kind = InterfaceAttributeKind::Setter; + let idls = type_.type_.to_idl_type(self).flatten(attrs.as_ref()); + let any_different_type = idls.len() > 1; + + if any_different_type + && UNFLATTENED_ATTRIBUTES + .get(parent_js_name) + .filter(|list| list.contains(&js_name.as_str())) + .is_some() + { + let ty = type_ + .type_ + .to_idl_type(self) + .to_syn_type(TypePosition::Argument, true) + .unwrap_or(None); + + // Skip types which can't be converted + if let Some(ty) = ty { + attributes.push(InterfaceAttribute { + is_static, + structural, + catch: catch || setter_throws(parent_js_name, &js_name, attrs), + ty, + js_name: js_name.clone(), + deprecated: Some(None), + kind: InterfaceAttributeKind::Setter, + unstable, + }); + } + } + + for (idl, ty) in idls.into_iter().filter_map(|idl| { + idl.to_syn_type(TypePosition::Argument, false) + .ok() + .flatten() + .map(|ty| (idl, ty)) + }) { + let mut js_name = js_name.clone(); + + if any_different_type { + let mut ext = String::new(); + idl.push_snake_case_name(&mut ext); + js_name.push_str(&util::camel_case_ident(&ext)); + } + attributes.push(InterfaceAttribute { is_static, structural, catch: catch || setter_throws(parent_js_name, &js_name, attrs), ty, js_name, - deprecated, - kind, + deprecated: deprecated.clone(), + kind: InterfaceAttributeKind::Setter, unstable, }); } @@ -830,12 +875,12 @@ impl<'src> FirstPassRecord<'src> { name: snake_case_ident(identifier), js_name: identifier.to_string(), ty: idl_type::IdentifierType::Callback - .to_syn_type(pos) + .to_syn_type(pos, false) .unwrap() .unwrap(), return_ty: optional_return_ty( idl_type::IdentifierType::Callback - .to_syn_type(TypePosition::Return) + .to_syn_type(TypePosition::Return, false) .unwrap() .unwrap(), ), diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index c103def4165..df7808fb3a8 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -17,7 +17,8 @@ use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{MayBeNull, NonAnyType, SingleType}; use crate::constants::{ - BREAKING_GETTER_THROWS, BREAKING_SETTER_THROWS, FIXED_INTERFACES, IMMUTABLE_SLICE_WHITELIST, + BREAKING_ALLOW_SHARED, BREAKING_GETTER_THROWS, BREAKING_SETTER_THROWS, FIXED_INTERFACES, + IMMUTABLE_SLICE_WHITELIST, }; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; @@ -259,7 +260,7 @@ impl<'src> FirstPassRecord<'src> { } let idl_type = arg.ty.to_idl_type(this); - let idl_type = this.maybe_adjust(idl_type, id); + let idl_type = this.maybe_adjust(arg.attributes, idl_type, id); idl_args.push(Some(idl_type)); } signatures.push((signature, idl_args)); @@ -430,7 +431,17 @@ impl<'src> FirstPassRecord<'src> { } let structural = force_structural || is_structural(signature.orig.attrs.as_ref(), container_attrs); - let catch = force_throws || throws(signature.orig.attrs); + let catch = force_throws + || throws(signature.orig.attrs) + || (signature + .args + .iter() + .filter_map(Option::as_ref) + .any(arg_throws) + && type_name + .and_then(|type_name| BREAKING_ALLOW_SHARED.get(type_name)) + .filter(|list| list.contains(&js_name)) + .is_none()); let deprecated = get_rust_deprecated(signature.orig.attrs); let ret_ty = if id == &OperationId::IndexingGetter { // All indexing getters should return optional values (or @@ -462,7 +473,7 @@ impl<'src> FirstPassRecord<'src> { let mut output = vec![]; for (name, idl_type) in args { - let ty = match idl_type.to_syn_type(TypePosition::Argument) { + let ty = match idl_type.to_syn_type(TypePosition::Argument, false) { Ok(ty) => ty.unwrap(), Err(_) => { return None; @@ -499,7 +510,7 @@ impl<'src> FirstPassRecord<'src> { let unstable = unstable || data.stability.is_unstable() || has_unstable_args; if let Some(arguments) = arguments { - if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) { + if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return, false) { let mut rust_name = rust_name.clone(); if let Some(map) = @@ -546,7 +557,7 @@ impl<'src> FirstPassRecord<'src> { ); if let Some(arguments) = arguments { - if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) { + if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return, false) { let mut rust_name = format!("{}_{}", &rust_name, i); if let Some(map) = @@ -589,7 +600,16 @@ impl<'src> FirstPassRecord<'src> { /// maintained by hand. /// /// When adding to this whitelist add tests to crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs - fn maybe_adjust<'a>(&self, mut idl_type: IdlType<'a>, id: &'a OperationId) -> IdlType<'a> { + fn maybe_adjust<'a>( + &self, + attributes: &'src Option>, + mut idl_type: IdlType<'a>, + id: &'a OperationId, + ) -> IdlType<'a> { + if has_named_attribute(attributes.as_ref(), "AllowShared") { + flag_slices_allow_shared(&mut idl_type) + } + let op = match id { OperationId::Operation(Some(op)) => op, OperationId::Constructor(Some(op)) => op, @@ -699,6 +719,40 @@ pub fn throws(attrs: &Option) -> bool { has_named_attribute(attrs.as_ref(), "Throws") } +fn arg_throws(ty: &IdlType<'_>) -> bool { + match ty { + IdlType::DataView { allow_shared } + | IdlType::Int8Array { allow_shared, .. } + | IdlType::Uint8Array { allow_shared, .. } + | IdlType::Uint8ClampedArray { allow_shared, .. } + | IdlType::Int16Array { allow_shared, .. } + | IdlType::Uint16Array { allow_shared, .. } + | IdlType::Int32Array { allow_shared, .. } + | IdlType::Uint32Array { allow_shared, .. } + | IdlType::Float32Array { allow_shared, .. } + | IdlType::Float64Array { allow_shared, .. } + | IdlType::ArrayBufferView { allow_shared, .. } + | IdlType::BufferSource { allow_shared, .. } + | IdlType::Identifier { + ty: + IdentifierType::Int8Slice { allow_shared, .. } + | IdentifierType::Uint8Slice { allow_shared, .. } + | IdentifierType::Uint8ClampedSlice { allow_shared, .. } + | IdentifierType::Int16Slice { allow_shared, .. } + | IdentifierType::Uint16Slice { allow_shared, .. } + | IdentifierType::Int32Slice { allow_shared, .. } + | IdentifierType::Uint32Slice { allow_shared, .. } + | IdentifierType::Float32Slice { allow_shared, .. } + | IdentifierType::Float64Slice { allow_shared, .. }, + .. + } => !allow_shared, + IdlType::Nullable(item) => arg_throws(item), + IdlType::Union(list) => list.iter().any(arg_throws), + // catch-all for everything else like Object + _ => false, + } +} + /// Whether a getter is marked as throwing. pub fn getter_throws( parent_js_name: &str, @@ -731,32 +785,57 @@ pub fn setter_throws( fn flag_slices_immutable(ty: &mut IdlType) { match ty { - IdlType::Int8Array { immutable } - | IdlType::Uint8Array { immutable } - | IdlType::Uint8ClampedArray { immutable } - | IdlType::Int16Array { immutable } - | IdlType::Uint16Array { immutable } - | IdlType::Int32Array { immutable } - | IdlType::Uint32Array { immutable } - | IdlType::Float32Array { immutable } - | IdlType::Float64Array { immutable } - | IdlType::ArrayBufferView { immutable } - | IdlType::BufferSource { immutable } + IdlType::Int8Array { immutable, .. } + | IdlType::Uint8Array { immutable, .. } + | IdlType::Uint8ClampedArray { immutable, .. } + | IdlType::Int16Array { immutable, .. } + | IdlType::Uint16Array { immutable, .. } + | IdlType::Int32Array { immutable, .. } + | IdlType::Uint32Array { immutable, .. } + | IdlType::Float32Array { immutable, .. } + | IdlType::Float64Array { immutable, .. } + | IdlType::ArrayBufferView { immutable, .. } + | IdlType::BufferSource { immutable, .. } | IdlType::Identifier { - ty: IdentifierType::BufferSource { immutable }, + ty: IdentifierType::AllowSharedBufferSource { immutable }, .. } => *immutable = true, IdlType::Nullable(item) => flag_slices_immutable(item), - IdlType::FrozenArray(item) => flag_slices_immutable(item), - IdlType::Sequence(item) => flag_slices_immutable(item), - IdlType::Promise(item) => flag_slices_immutable(item), + IdlType::Union(list) => { + for item in list { + flag_slices_immutable(item); + } + } + // catch-all for everything else like Object + _ => {} + } +} + +fn flag_slices_allow_shared(ty: &mut IdlType) { + match ty { + IdlType::DataView { allow_shared } + | IdlType::Int8Array { allow_shared, .. } + | IdlType::Uint8Array { allow_shared, .. } + | IdlType::Uint8ClampedArray { allow_shared, .. } + | IdlType::Int16Array { allow_shared, .. } + | IdlType::Uint16Array { allow_shared, .. } + | IdlType::Int32Array { allow_shared, .. } + | IdlType::Uint32Array { allow_shared, .. } + | IdlType::Float32Array { allow_shared, .. } + | IdlType::Float64Array { allow_shared, .. } + | IdlType::ArrayBufferView { allow_shared, .. } + | IdlType::BufferSource { allow_shared, .. } => *allow_shared = true, + IdlType::Nullable(item) => flag_slices_allow_shared(item), + IdlType::FrozenArray(item) => flag_slices_allow_shared(item), + IdlType::Sequence(item) => flag_slices_allow_shared(item), + IdlType::Promise(item) => flag_slices_allow_shared(item), IdlType::Record(item1, item2) => { - flag_slices_immutable(item1); - flag_slices_immutable(item2); + flag_slices_allow_shared(item1); + flag_slices_allow_shared(item2); } IdlType::Union(list) => { for item in list { - flag_slices_immutable(item); + flag_slices_allow_shared(item); } } // catch-all for everything else like Object From b1500201df2f51dc7f0f652d777e42c6958ec1df Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 9 Oct 2024 20:56:33 +0200 Subject: [PATCH 506/641] Properly indent the doc comments of enum variants (#4153) --- crates/cli-support/src/js/mod.rs | 6 +++++- crates/cli/tests/reference/enums.d.ts | 9 +++++++++ crates/cli/tests/reference/enums.js | 14 +++++++++++++- crates/cli/tests/reference/enums.rs | 3 +++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8a150de5816..9be761ac818 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3794,7 +3794,11 @@ __wbg_set_wasm(wasm);" if enum_.generate_typescript { self.typescript.push('\n'); if !variant_docs.is_empty() { - self.typescript.push_str(&variant_docs); + for line in variant_docs.lines() { + self.typescript.push_str(" "); + self.typescript.push_str(line); + self.typescript.push('\n'); + } } self.typescript.push_str(&format!(" {name} = {value},")); } diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index e6c6229b926..42169b11fd1 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -24,8 +24,17 @@ export function option_string_enum_echo(color?: ColorName): ColorName | undefine * A color. */ export enum Color { + /** + * Green as a leaf. + */ Green = 0, + /** + * Yellow as the sun. + */ Yellow = 1, + /** + * Red as a rose. + */ Red = 2, } /** diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index a2ef36d4aaf..22e4110c15e 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -65,7 +65,19 @@ export function option_string_enum_echo(color) { /** * A color. */ -export const Color = Object.freeze({ Green:0,"0":"Green",Yellow:1,"1":"Yellow",Red:2,"2":"Red", }); +export const Color = Object.freeze({ +/** + * Green as a leaf. + */ +Green:0,"0":"Green", +/** + * Yellow as the sun. + */ +Yellow:1,"1":"Yellow", +/** + * Red as a rose. + */ +Red:2,"2":"Red", }); const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index 7e588df0f4d..a7e5f0b0ca8 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -4,8 +4,11 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] #[derive(PartialEq, Debug)] pub enum Color { + /// Green as a leaf. Green, + /// Yellow as the sun. Yellow, + /// Red as a rose. Red, } From e6c82f5f58fb47c4320e7b926f70480c7c887a93 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 9 Oct 2024 21:53:38 +0200 Subject: [PATCH 507/641] Prepare v0.2.94 release (#4158) --- CHANGELOG.md | 4 +- Cargo.toml | 4 +- crates/backend/Cargo.toml | 4 +- crates/cli-support/Cargo.toml | 14 +++---- crates/cli/Cargo.toml | 6 +-- crates/cli/tests/reference/raw.js | 48 +++++++++++------------ crates/externref-xform/Cargo.toml | 4 +- crates/futures/Cargo.toml | 6 +-- crates/js-sys/Cargo.toml | 4 +- crates/macro-support/Cargo.toml | 6 +-- crates/macro/Cargo.toml | 4 +- crates/multi-value-xform/Cargo.toml | 4 +- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 ++--- crates/threads-xform/Cargo.toml | 4 +- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 +- crates/web-sys/Cargo.toml | 6 +-- 21 files changed, 72 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce09f93e9a0..7488ff1876e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) + +Released 2024-10-09 ### Added diff --git a/Cargo.toml b/Cargo.toml index c5707b56c2e..d38d318ef8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.93" +version = "0.2.94" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,7 +45,7 @@ cfg-if = "1.0.0" once_cell = "1.12" serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.93" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.94" } [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index dbc404c1a32..7eed099b2f5 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.93" +version = "0.2.94" [features] extra-traits = ["syn/extra-traits"] @@ -24,4 +24,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index b7680d17fc9..e0c4b9e1c66 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] anyhow = "1.0" @@ -23,9 +23,9 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = "0.22" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.93' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.93' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.93' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.93' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.93' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.93' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.94' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.94' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.94' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.94' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.94' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.94' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index e51011a7a85..db87e877cf1 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.22", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.93" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.94" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6c6e36065ee..02dcddad344 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -45,6 +25,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -109,11 +109,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 6a3b744dd8c..e9fbaa68f35 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 0899a830a5c..8b21e2b666a 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.43" +version = "0.4.44" [package.metadata.docs.rs] all-features = true @@ -19,8 +19,8 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '0.3.70' } -wasm-bindgen = { path = "../..", version = '0.2.93' } +js-sys = { path = "../js-sys", version = '0.3.71' } +wasm-bindgen = { path = "../..", version = '0.2.94' } [features] futures-core-03-stream = ['futures-core'] diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index ff8c6581d01..bbc4dc5bf74 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,14 +14,14 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.70" +version = "0.3.71" [lib] doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.93" } +wasm-bindgen = { path = "../..", version = "0.2.94" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 26ae4a4c5a8..1756250ac18 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.93" +version = "0.2.94" [features] extra-traits = ["syn/extra-traits"] @@ -22,5 +22,5 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.93" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.93" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.94" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index eb5bd214212..ad63bd3eccb 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.93" +version = "0.2.94" [lib] proc-macro = true @@ -23,7 +23,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.93" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.94" } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 450ca40aad2..5f22f5feeaf 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 46672e2dad8..abf1a410fdc 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.93" +version = "0.2.94" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index aa3964ec0a4..5bb6a51d435 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.93"; +pub const SCHEMA_VERSION: &str = "0.2.94"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index ad4af57a09e..bc796aed76f 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "9179028021460341559"; +const APPROVED_SCHEMA_FILE_HASH: &str = "950257602071279980"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index c5f7c61e70e..b6b3c0583a4 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.43" +version = "0.3.44" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 33e987b0963..7e367a88ed1 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,16 +7,16 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.43" +version = "0.3.44" [dependencies] console_error_panic_hook = '0.1' gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '0.3.70' } +js-sys = { path = '../js-sys', version = '0.3.71' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.93' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.43' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.43' } +wasm-bindgen = { path = '../..', version = '0.2.94' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.44' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.44' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 54ae6e9f15b..03f8be5f1df 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.93" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 5d1ae31bc37..74e3026b809 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 25f34d53074..43b5f17e622 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.93" +version = "0.2.94" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.93" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.94" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 0dd64d2cd34..489d070e47c 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.70" +version = "0.3.71" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '0.3.70' } -wasm-bindgen = { path = "../..", version = "0.2.93" } +js-sys = { path = '../js-sys', version = '0.3.71' } +wasm-bindgen = { path = "../..", version = "0.2.94" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 35d1c63732a531dd38495ff979b8e49efb7ac831 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:16:06 +0200 Subject: [PATCH 508/641] Bump denoland/setup-deno to v2 (#4160) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 975837793a0..20b261e6eaa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -284,7 +284,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - uses: denoland/setup-deno@v1 + - uses: denoland/setup-deno@v2 with: deno-version: v1.x - run: cd examples/deno && ./build.sh && deno run --allow-read test.ts From 02679e1b95cb52dd6f0a9ccbd76d925277fde6d3 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 10 Oct 2024 16:53:42 +0200 Subject: [PATCH 509/641] Add support for C-style enums with implicit discriminants (#4152) --- CHANGELOG.md | 9 +++ crates/cli/tests/reference/enums.d.ts | 6 ++ crates/cli/tests/reference/enums.js | 2 + crates/cli/tests/reference/enums.rs | 10 +++- crates/macro-support/src/parser.rs | 64 ++++++++++++---------- crates/macro/ui-tests/invalid-enums.rs | 26 +++++++++ crates/macro/ui-tests/invalid-enums.stderr | 24 ++++++++ 7 files changed, 109 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7488ff1876e..8172661675f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Added + +* Added support for implicit discriminants in enums. + [#4152](https://github.com/rustwasm/wasm-bindgen/pull/4152) + +-------------------------------------------------------------------------------- + ## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) Released 2024-10-09 diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 42169b11fd1..00939f01763 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -37,6 +37,12 @@ export enum Color { */ Red = 2, } +export enum ImplicitDiscriminant { + A = 0, + B = 1, + C = 42, + D = 43, +} /** * The name of a color. */ diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 22e4110c15e..65ef4045711 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -79,6 +79,8 @@ Yellow:1,"1":"Yellow", */ Red:2,"2":"Red", }); +export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42,"42":"C",D:43,"43":"D", }); + const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; const __wbindgen_enum_FooBar = ["foo", "bar"]; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index a7e5f0b0ca8..480dba7ce89 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -47,15 +47,21 @@ pub fn option_string_enum_echo(color: Option) -> Option { /// An unused string enum. #[wasm_bindgen(js_name = "FooBar")] -#[derive(PartialEq, Debug)] pub enum UnusedStringEnum { Foo = "foo", Bar = "bar", } #[wasm_bindgen] -#[derive(PartialEq, Debug)] enum PrivateStringEnum { Foo = "foo", Bar = "bar", } + +#[wasm_bindgen] +pub enum ImplicitDiscriminant { + A, + B, + C = 42, + D, +} diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index b1bf4e1295f..3a36d139d5a 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1,5 +1,6 @@ use std::cell::{Cell, RefCell}; use std::char; +use std::collections::HashMap; use std::str::Chars; use ast::OperationKind; @@ -1399,28 +1400,18 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { return string_enum(self, program, js_name, generate_typescript, comments); } - let has_discriminant = self.variants[0].discriminant.is_some(); - match self.vis { syn::Visibility::Public(_) => {} _ => bail_span!(self, "only public enums are allowed with #[wasm_bindgen]"), } + let mut last_discriminant: Option = None; + let mut discriminate_map: HashMap = HashMap::new(); + let variants = self .variants .iter() - .enumerate() - .map(|(i, v)| { - // Require that everything either has a discriminant or doesn't. - // We don't really want to get in the business of emulating how - // rustc assigns values to enums. - if v.discriminant.is_some() != has_discriminant { - bail_span!( - v, - "must either annotate discriminant of all variants or none" - ); - } - + .map(|v| { let value = match &v.discriminant { Some((_, expr)) => match get_expr(expr) { syn::Expr::Lit(syn::ExprLit { @@ -1442,8 +1433,33 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { number literal values", ), }, - None => i as u32, + None => { + // Use the same algorithm as rustc to determine the next discriminant + // https://doc.rust-lang.org/reference/items/enumerations.html#implicit-discriminants + if let Some(last) = last_discriminant { + if let Some(value) = last.checked_add(1) { + value + } else { + bail_span!( + v, + "the discriminants of C-style enums with #[wasm_bindgen] must be representable as u32" + ); + } + } else { + 0 + } + } }; + last_discriminant = Some(value); + + if let Some(old) = discriminate_map.insert(value, v) { + bail_span!( + v, + "discriminant value `{}` is already used by {} in this enum", + value, + old.ident + ); + } let comments = extract_doc_comments(&v.attrs); Ok(ast::Variant { @@ -1454,21 +1470,9 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { }) .collect::, Diagnostic>>()?; - let mut values = variants.iter().map(|v| v.value).collect::>(); - values.sort(); - let hole = values - .windows(2) - .find_map(|window| { - if window[0] + 1 != window[1] { - Some(window[0] + 1) - } else { - None - } - }) - .unwrap_or(*values.last().unwrap() + 1); - for value in values { - assert!(hole != value); - } + let hole = (0..=u32::MAX) + .find(|v| !discriminate_map.contains_key(v)) + .unwrap(); self.to_tokens(tokens); diff --git a/crates/macro/ui-tests/invalid-enums.rs b/crates/macro/ui-tests/invalid-enums.rs index 3ddd5e17487..e0241f1eedb 100644 --- a/crates/macro/ui-tests/invalid-enums.rs +++ b/crates/macro/ui-tests/invalid-enums.rs @@ -37,4 +37,30 @@ enum G { C, } +#[wasm_bindgen] +pub enum H { + A = 1, + B = 1, // collision +} + +#[wasm_bindgen] +pub enum I { + A = 4294967294, // = u32::MAX - 1 + B, // would be u32::MAX + C, // would be u32::MAX + 1 +} + +#[wasm_bindgen] +pub enum J { + A, // = 0 + B = 0, // collision +} + +#[wasm_bindgen] +pub enum K { + A = 3, + B = 2, + C, // = 3 -> collision +} + fn main() {} diff --git a/crates/macro/ui-tests/invalid-enums.stderr b/crates/macro/ui-tests/invalid-enums.stderr index 13199f8f868..e2e5b1a6c04 100644 --- a/crates/macro/ui-tests/invalid-enums.stderr +++ b/crates/macro/ui-tests/invalid-enums.stderr @@ -39,3 +39,27 @@ error: all variants of a string enum must have a string value | 37 | C, | ^ + +error: discriminant value `1` is already used by A in this enum + --> ui-tests/invalid-enums.rs:43:5 + | +43 | B = 1, // collision + | ^^^^^ + +error: the discriminants of C-style enums with #[wasm_bindgen] must be representable as u32 + --> ui-tests/invalid-enums.rs:50:5 + | +50 | C, // would be u32::MAX + 1 + | ^ + +error: discriminant value `0` is already used by A in this enum + --> ui-tests/invalid-enums.rs:56:5 + | +56 | B = 0, // collision + | ^^^^^ + +error: discriminant value `3` is already used by A in this enum + --> ui-tests/invalid-enums.rs:63:5 + | +63 | C, // = 3 -> collision + | ^ From 0e89a29719c13a496716764ee9f4259a0caeb5ef Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 10 Oct 2024 21:08:30 +0200 Subject: [PATCH 510/641] Replace all `Self` identifiers in method argument and return types (#4155) Co-authored-by: Oliver T --- CHANGELOG.md | 3 ++ crates/macro-support/Cargo.toml | 2 +- crates/macro-support/src/parser.rs | 49 +++++++++++++++++++----------- tests/wasm/inner_self.rs | 28 +++++++++++++++++ tests/wasm/main.rs | 1 + 5 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 tests/wasm/inner_self.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 8172661675f..02cd460fd0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Added support for implicit discriminants in enums. [#4152](https://github.com/rustwasm/wasm-bindgen/pull/4152) +* Added support for `Self` in complex type expressions in methods. + [#4155](https://github.com/rustwasm/wasm-bindgen/pull/4155) + -------------------------------------------------------------------------------- ## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 1756250ac18..0f369e2e978 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -21,6 +21,6 @@ strict-macro = [] [dependencies] proc-macro2 = "1.0" quote = '1.0' -syn = { version = '2.0', features = ['visit', 'full'] } +syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } wasm-bindgen-backend = { path = "../backend", version = "=0.2.94" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 3a36d139d5a..859422c65d2 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -12,6 +12,7 @@ use quote::ToTokens; use syn::ext::IdentExt; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; +use syn::visit_mut::VisitMut; use syn::{ItemFn, Lit, MacroDelimiter, ReturnType}; use crate::ClassMarker; @@ -912,26 +913,33 @@ fn function_from_decl( let syn::Signature { inputs, output, .. } = sig; - let replace_self = |t: syn::Type| { - let self_ty = match self_ty { - Some(i) => i, - None => return t, - }; - let path = match get_ty(&t) { - syn::Type::Path(syn::TypePath { qself: None, path }) => path.clone(), - other => return other.clone(), - }; - let new_path = if path.segments.len() == 1 && path.segments[0].ident == "Self" { - self_ty.clone().into() - } else { - path - }; - syn::Type::Path(syn::TypePath { - qself: None, - path: new_path, - }) + // A helper function to replace `Self` in the function signature of methods. + // E.g. `fn get(&self) -> Option` to `fn get(&self) -> Option` + // The following comment explains why this is necessary: + // https://github.com/rustwasm/wasm-bindgen/issues/3105#issuecomment-1275160744 + let replace_self = |mut t: syn::Type| { + if let Some(self_ty) = self_ty { + // This uses a visitor to replace all occurrences of `Self` with + // the actual type identifier. The visitor guarantees that we find + // all occurrences of `Self`, even if deeply nested and even if + // future Rust versions add more places where `Self` can appear. + struct SelfReplace(Ident); + impl VisitMut for SelfReplace { + fn visit_ident_mut(&mut self, i: &mut proc_macro2::Ident) { + if i == "Self" { + *i = self.0.clone(); + } + } + } + + let mut replace = SelfReplace(self_ty.clone()); + replace.visit_type_mut(&mut t); + } + t }; + // A helper function to replace argument names that are JS keywords. + // E.g. this will replace `fn foo(class: u32)` to `fn foo(_class: u32)` let replace_colliding_arg = |i: &mut syn::PatType| { if let syn::Pat::Ident(ref mut i) = *i.pat { let ident = i.ident.to_string(); @@ -946,14 +954,18 @@ fn function_from_decl( .into_iter() .filter_map(|arg| match arg { syn::FnArg::Typed(mut c) => { + // typical arguments like foo: u32 replace_colliding_arg(&mut c); c.ty = Box::new(replace_self(*c.ty)); Some(c) } syn::FnArg::Receiver(r) => { + // the self argument, so self, &self, &mut self, self: Box, etc. if !allow_self { panic!("arguments cannot be `self`") } + + // write down the way in which `self` is passed for later assert!(method_self.is_none()); if r.reference.is_none() { method_self = Some(ast::MethodSelf::ByValue); @@ -962,6 +974,7 @@ fn function_from_decl( } else { method_self = Some(ast::MethodSelf::RefShared); } + None } }) diff --git a/tests/wasm/inner_self.rs b/tests/wasm/inner_self.rs new file mode 100644 index 00000000000..b1dd9d68cc4 --- /dev/null +++ b/tests/wasm/inner_self.rs @@ -0,0 +1,28 @@ +//! This tests that the `wasm_bindgen` macro produces code that compiles for these use cases. +//! `cargo test --target wasm32-unknown-unknown` will not run if any of these tests breaks. +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct A; + +#[wasm_bindgen] +pub struct SelfPortrait; + +#[wasm_bindgen] +impl A { + pub fn test_only_self() -> Self { + A + } + pub fn test_option_self() -> Option { + None + } + pub fn test_nested_self() -> Result, String> { + Ok(None) + } + pub fn test_self_slice() -> Box<[Self]> { + Box::new([]) + } + pub fn test_selfish() -> Result { + Ok(A) + } +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index fdef95f23d7..a496aa1a3d0 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -36,6 +36,7 @@ pub mod getters_and_setters; pub mod ignore; pub mod import_class; pub mod imports; +pub mod inner_self; pub mod intrinsics; pub mod js_keywords; pub mod js_objects; From 76013f200cf2c78ded49a0d8be7203d4922881cb Mon Sep 17 00:00:00 2001 From: James Lindsay <78500760+0HyperCube@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:33:46 +0100 Subject: [PATCH 511/641] Fix interface attributes setters using wrong JS method names (#4170) --- CHANGELOG.md | 5 +++ .../features/gen_CanvasRenderingContext2d.rs | 36 +++++++++---------- .../web-sys/src/features/gen_IdbFileHandle.rs | 12 +++---- .../src/features/gen_KeyframeEffect.rs | 12 +++---- .../gen_OffscreenCanvasRenderingContext2d.rs | 36 +++++++++---------- .../src/features/gen_RtcRtpReceiver.rs | 12 +++---- .../web-sys/src/features/gen_RtcRtpSender.rs | 12 +++---- crates/web-sys/src/features/gen_VttCue.rs | 28 +++++++-------- .../src/features/gen_WaveShaperNode.rs | 22 +++++------- crates/webidl/src/generator.rs | 12 ++++--- crates/webidl/src/lib.rs | 10 ++++-- 11 files changed, 101 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cd460fd0b..a86f27bb3f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ * Added support for `Self` in complex type expressions in methods. [#4155](https://github.com/rustwasm/wasm-bindgen/pull/4155) +### Fixed + +* Fixed generated setters from WebIDL interface attributes binding to wrong JS method names. + [#4170](https://github.com/rustwasm/wasm-bindgen/pull/4170) + -------------------------------------------------------------------------------- ## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index 9eecfa51b3a..bbdf299b9b9 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -66,18 +66,18 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] #[deprecated] pub fn set_stroke_style(this: &CanvasRenderingContext2d, value: &::wasm_bindgen::JsValue); - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleStr)] - #[doc = "Setter for the `strokeStyleStr` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleStr)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn set_stroke_style_str(this: &CanvasRenderingContext2d, value: &str); #[cfg(feature = "CanvasGradient")] - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleCanvasGradient)] - #[doc = "Setter for the `strokeStyleCanvasGradient` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleCanvasGradient)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `CanvasRenderingContext2d`*"] pub fn set_stroke_style_canvas_gradient( @@ -85,10 +85,10 @@ extern "C" { value: &CanvasGradient, ); #[cfg(feature = "CanvasPattern")] - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyleCanvasPattern)] - #[doc = "Setter for the `strokeStyleCanvasPattern` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyleCanvasPattern)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`*"] pub fn set_stroke_style_canvas_pattern(this: &CanvasRenderingContext2d, value: &CanvasPattern); @@ -107,26 +107,26 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] #[deprecated] pub fn set_fill_style(this: &CanvasRenderingContext2d, value: &::wasm_bindgen::JsValue); - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleStr)] - #[doc = "Setter for the `fillStyleStr` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleStr)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn set_fill_style_str(this: &CanvasRenderingContext2d, value: &str); #[cfg(feature = "CanvasGradient")] - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleCanvasGradient)] - #[doc = "Setter for the `fillStyleCanvasGradient` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleCanvasGradient)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `CanvasRenderingContext2d`*"] pub fn set_fill_style_canvas_gradient(this: &CanvasRenderingContext2d, value: &CanvasGradient); #[cfg(feature = "CanvasPattern")] - # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyleCanvasPattern)] - #[doc = "Setter for the `fillStyleCanvasPattern` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyleCanvasPattern)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `CanvasRenderingContext2d`*"] pub fn set_fill_style_canvas_pattern(this: &CanvasRenderingContext2d, value: &CanvasPattern); diff --git a/crates/web-sys/src/features/gen_IdbFileHandle.rs b/crates/web-sys/src/features/gen_IdbFileHandle.rs index 250f3c233e3..6c1b4e10a23 100644 --- a/crates/web-sys/src/features/gen_IdbFileHandle.rs +++ b/crates/web-sys/src/features/gen_IdbFileHandle.rs @@ -55,18 +55,18 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] #[deprecated] pub fn set_location(this: &IdbFileHandle, value: Option); - # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = locationOptU32)] - #[doc = "Setter for the `locationOptU32` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = location)] + #[doc = "Setter for the `location` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/locationOptU32)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] #[deprecated] pub fn set_location_opt_u32(this: &IdbFileHandle, value: Option); - # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = locationOptF64)] - #[doc = "Setter for the `locationOptF64` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = location)] + #[doc = "Setter for the `location` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/locationOptF64)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"] #[deprecated] diff --git a/crates/web-sys/src/features/gen_KeyframeEffect.rs b/crates/web-sys/src/features/gen_KeyframeEffect.rs index fd899dfeba7..d69ca13c44f 100644 --- a/crates/web-sys/src/features/gen_KeyframeEffect.rs +++ b/crates/web-sys/src/features/gen_KeyframeEffect.rs @@ -28,18 +28,18 @@ extern "C" { #[deprecated] pub fn set_target(this: &KeyframeEffect, value: Option<&::js_sys::Object>); #[cfg(feature = "Element")] - # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = targetOptElement)] - #[doc = "Setter for the `targetOptElement` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = target)] + #[doc = "Setter for the `target` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/targetOptElement)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `KeyframeEffect`*"] pub fn set_target_opt_element(this: &KeyframeEffect, value: Option<&Element>); #[cfg(feature = "CssPseudoElement")] - # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = targetOptCssPseudoElement)] - #[doc = "Setter for the `targetOptCssPseudoElement` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "KeyframeEffect" , js_name = target)] + #[doc = "Setter for the `target` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/targetOptCssPseudoElement)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssPseudoElement`, `KeyframeEffect`*"] pub fn set_target_opt_css_pseudo_element( diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index 407c3ea01de..9e94597e350 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -71,18 +71,18 @@ extern "C" { this: &OffscreenCanvasRenderingContext2d, value: &::wasm_bindgen::JsValue, ); - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleStr)] - #[doc = "Setter for the `strokeStyleStr` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleStr)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn set_stroke_style_str(this: &OffscreenCanvasRenderingContext2d, value: &str); #[cfg(feature = "CanvasGradient")] - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleCanvasGradient)] - #[doc = "Setter for the `strokeStyleCanvasGradient` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleCanvasGradient)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] pub fn set_stroke_style_canvas_gradient( @@ -90,10 +90,10 @@ extern "C" { value: &CanvasGradient, ); #[cfg(feature = "CanvasPattern")] - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyleCanvasPattern)] - #[doc = "Setter for the `strokeStyleCanvasPattern` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = strokeStyle)] + #[doc = "Setter for the `strokeStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyleCanvasPattern)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/strokeStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`*"] pub fn set_stroke_style_canvas_pattern( @@ -118,18 +118,18 @@ extern "C" { this: &OffscreenCanvasRenderingContext2d, value: &::wasm_bindgen::JsValue, ); - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleStr)] - #[doc = "Setter for the `fillStyleStr` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleStr)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn set_fill_style_str(this: &OffscreenCanvasRenderingContext2d, value: &str); #[cfg(feature = "CanvasGradient")] - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleCanvasGradient)] - #[doc = "Setter for the `fillStyleCanvasGradient` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleCanvasGradient)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasGradient`, `OffscreenCanvasRenderingContext2d`*"] pub fn set_fill_style_canvas_gradient( @@ -137,10 +137,10 @@ extern "C" { value: &CanvasGradient, ); #[cfg(feature = "CanvasPattern")] - # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyleCanvasPattern)] - #[doc = "Setter for the `fillStyleCanvasPattern` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillStyle)] + #[doc = "Setter for the `fillStyle` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyleCanvasPattern)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillStyle)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `OffscreenCanvasRenderingContext2d`*"] pub fn set_fill_style_canvas_pattern( diff --git a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs index 91c758f6b67..424f32a5ada 100644 --- a/crates/web-sys/src/features/gen_RtcRtpReceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpReceiver.rs @@ -58,10 +58,10 @@ extern "C" { pub fn transform(this: &RtcRtpReceiver) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "SFrameTransform")] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transformOptSFrameTransform)] - #[doc = "Setter for the `transformOptSFrameTransform` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transformOptSFrameTransform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `SFrameTransform`*"] #[doc = ""] @@ -73,10 +73,10 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "RtcRtpScriptTransform")] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transformOptRtcRtpScriptTransform)] - #[doc = "Setter for the `transformOptRtcRtpScriptTransform` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpReceiver" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transformOptRtcRtpScriptTransform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpReceiver/transform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpReceiver`, `RtcRtpScriptTransform`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 9f72d14788e..f01fbedf868 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -41,10 +41,10 @@ extern "C" { pub fn transform(this: &RtcRtpSender) -> Option<::js_sys::Object>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "SFrameTransform")] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transformOptSFrameTransform)] - #[doc = "Setter for the `transformOptSFrameTransform` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transformOptSFrameTransform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`, `SFrameTransform`*"] #[doc = ""] @@ -56,10 +56,10 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "RtcRtpScriptTransform")] - # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transformOptRtcRtpScriptTransform)] - #[doc = "Setter for the `transformOptRtcRtpScriptTransform` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "RTCRtpSender" , js_name = transform)] + #[doc = "Setter for the `transform` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transformOptRtcRtpScriptTransform)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpScriptTransform`, `RtcRtpSender`*"] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VttCue.rs b/crates/web-sys/src/features/gen_VttCue.rs index e454160eb41..e97a4326b5f 100644 --- a/crates/web-sys/src/features/gen_VttCue.rs +++ b/crates/web-sys/src/features/gen_VttCue.rs @@ -73,18 +73,18 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] #[deprecated] pub fn set_line(this: &VttCue, value: &::wasm_bindgen::JsValue); - # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = lineF64)] - #[doc = "Setter for the `lineF64` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = line)] + #[doc = "Setter for the `line` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineF64)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] pub fn set_line_f64(this: &VttCue, value: f64); #[cfg(feature = "AutoKeyword")] - # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = lineAutoKeyword)] - #[doc = "Setter for the `lineAutoKeyword` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = line)] + #[doc = "Setter for the `line` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAutoKeyword)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutoKeyword`, `VttCue`*"] pub fn set_line_auto_keyword(this: &VttCue, value: AutoKeyword); @@ -119,21 +119,21 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] #[deprecated] pub fn set_position(this: &VttCue, value: &::wasm_bindgen::JsValue); - # [wasm_bindgen (structural , catch , method , setter , js_class = "VTTCue" , js_name = positionF64)] - #[doc = "Setter for the `positionF64` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = position)] + #[doc = "Setter for the `position` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionF64)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] - pub fn set_position_f64(this: &VttCue, value: f64) -> Result<(), JsValue>; + pub fn set_position_f64(this: &VttCue, value: f64); #[cfg(feature = "AutoKeyword")] - # [wasm_bindgen (structural , catch , method , setter , js_class = "VTTCue" , js_name = positionAutoKeyword)] - #[doc = "Setter for the `positionAutoKeyword` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = position)] + #[doc = "Setter for the `position` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAutoKeyword)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutoKeyword`, `VttCue`*"] - pub fn set_position_auto_keyword(this: &VttCue, value: AutoKeyword) -> Result<(), JsValue>; + pub fn set_position_auto_keyword(this: &VttCue, value: AutoKeyword); #[cfg(feature = "PositionAlignSetting")] # [wasm_bindgen (structural , method , getter , js_class = "VTTCue" , js_name = positionAlign)] #[doc = "Getter for the `positionAlign` field of this object."] diff --git a/crates/web-sys/src/features/gen_WaveShaperNode.rs b/crates/web-sys/src/features/gen_WaveShaperNode.rs index 875ecc61ec6..88c2eaa017b 100644 --- a/crates/web-sys/src/features/gen_WaveShaperNode.rs +++ b/crates/web-sys/src/features/gen_WaveShaperNode.rs @@ -27,26 +27,20 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] #[deprecated] pub fn set_curve(this: &WaveShaperNode, value: Option<&mut [f32]>); - # [wasm_bindgen (structural , catch , method , setter , js_class = "WaveShaperNode" , js_name = curveOptF32Slice)] - #[doc = "Setter for the `curveOptF32Slice` field of this object."] + # [wasm_bindgen (structural , method , setter , js_class = "WaveShaperNode" , js_name = curve)] + #[doc = "Setter for the `curve` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curveOptF32Slice)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] - pub fn set_curve_opt_f32_slice( - this: &WaveShaperNode, - value: Option<&mut [f32]>, - ) -> Result<(), JsValue>; - # [wasm_bindgen (structural , catch , method , setter , js_class = "WaveShaperNode" , js_name = curveOptF32Array)] - #[doc = "Setter for the `curveOptF32Array` field of this object."] + pub fn set_curve_opt_f32_slice(this: &WaveShaperNode, value: Option<&mut [f32]>); + # [wasm_bindgen (structural , method , setter , js_class = "WaveShaperNode" , js_name = curve)] + #[doc = "Setter for the `curve` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curveOptF32Array)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] - pub fn set_curve_opt_f32_array( - this: &WaveShaperNode, - value: Option<&::js_sys::Float32Array>, - ) -> Result<(), JsValue>; + pub fn set_curve_opt_f32_array(this: &WaveShaperNode, value: Option<&::js_sys::Float32Array>); #[cfg(feature = "OverSampleType")] # [wasm_bindgen (structural , method , getter , js_class = "WaveShaperNode" , js_name = oversample)] #[doc = "Getter for the `oversample` field of this object."] diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index 2dd2bb33680..aa7b9e26bbb 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -11,7 +11,7 @@ use crate::constants::{BUILTIN_IDENTS, POLYFILL_INTERFACES}; use crate::idl_type::IdlType; use crate::traverse::TraverseType; use crate::util::shared_ref; -use crate::util::{get_cfg_features, mdn_doc, required_doc_string, snake_case_ident}; +use crate::util::{get_cfg_features, mdn_doc, required_doc_string}; use crate::Options; fn add_features(features: &mut BTreeSet, ty: &impl TraverseType) { @@ -236,6 +236,7 @@ pub enum InterfaceAttributeKind { pub struct InterfaceAttribute { pub js_name: String, + pub rust_name: String, pub deprecated: Option>, pub ty: Type, pub is_static: bool, @@ -256,6 +257,7 @@ impl InterfaceAttribute { ) -> TokenStream { let InterfaceAttribute { js_name, + rust_name, deprecated, ty, is_static, @@ -300,7 +302,7 @@ impl InterfaceAttribute { let (prefix, attr, def) = match kind { InterfaceAttributeKind::Getter => { - let name = rust_ident(&snake_case_ident(js_name)); + let rust_name = rust_ident(rust_name); let ty = if *catch { quote!( Result<#ty, JsValue> ) @@ -311,12 +313,12 @@ impl InterfaceAttribute { ( "Getter", quote!(getter,), - quote!( pub fn #name(#this) -> #ty; ), + quote!( pub fn #rust_name(#this) -> #ty; ), ) } InterfaceAttributeKind::Setter => { - let name = rust_ident(&format!("set_{}", snake_case_ident(js_name))); + let rust_name = rust_ident(rust_name); let ret_ty = if *catch { Some(quote!( -> Result<(), JsValue> )) @@ -327,7 +329,7 @@ impl InterfaceAttribute { ( "Setter", quote!(setter,), - quote!( pub fn #name(#this value: #ty) #ret_ty; ), + quote!( pub fn #rust_name(#this value: #ty) #ret_ty; ), ) } }; diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index f13c3558273..a6caa7d5145 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -749,6 +749,7 @@ impl<'src> FirstPassRecord<'src> { catch: catch || getter_throws(parent_js_name, &js_name, attrs), ty, js_name: js_name.clone(), + rust_name: snake_case_ident(&js_name), deprecated: deprecated.clone(), kind, unstable, @@ -779,6 +780,7 @@ impl<'src> FirstPassRecord<'src> { catch: catch || setter_throws(parent_js_name, &js_name, attrs), ty, js_name: js_name.clone(), + rust_name: format!("set_{}", snake_case_ident(&js_name)), deprecated: Some(None), kind: InterfaceAttributeKind::Setter, unstable, @@ -792,12 +794,13 @@ impl<'src> FirstPassRecord<'src> { .flatten() .map(|ty| (idl, ty)) }) { - let mut js_name = js_name.clone(); + let mut rust_name = format!("set_{}", snake_case_ident(&js_name)); if any_different_type { let mut ext = String::new(); idl.push_snake_case_name(&mut ext); - js_name.push_str(&util::camel_case_ident(&ext)); + rust_name.push('_'); + rust_name.push_str(&snake_case_ident(&ext)); } attributes.push(InterfaceAttribute { @@ -805,7 +808,8 @@ impl<'src> FirstPassRecord<'src> { structural, catch: catch || setter_throws(parent_js_name, &js_name, attrs), ty, - js_name, + js_name: js_name.clone(), + rust_name, deprecated: deprecated.clone(), kind: InterfaceAttributeKind::Setter, unstable, From bdcbc58f82593726e0cdb6d75d038e7a2d22dbfc Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 10 Oct 2024 21:50:10 +0200 Subject: [PATCH 512/641] Reintroduce reading snippets and modules in `cli-support` (#4172) --- crates/cli-support/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 7e8e417615f..0602beb5d2b 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -616,6 +616,14 @@ impl Output { self.generated.start.as_ref() } + pub fn snippets(&self) -> &HashMap> { + &self.generated.snippets + } + + pub fn local_modules(&self) -> &HashMap { + &self.generated.local_modules + } + pub fn npm_dependencies(&self) -> &HashMap { &self.generated.npm_dependencies } From c6256440e50e5c65c8f1ed486f1aedae947590d5 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 10 Oct 2024 23:36:40 +0200 Subject: [PATCH 513/641] Revert TS string enum generation (#4174) --- CHANGELOG.md | 5 +++++ crates/backend/src/ast.rs | 4 ---- crates/backend/src/codegen.rs | 2 +- crates/backend/src/encode.rs | 3 --- crates/cli-support/src/js/mod.rs | 20 -------------------- crates/cli-support/src/wit/mod.rs | 3 --- crates/cli-support/src/wit/nonstandard.rs | 6 ------ crates/cli/tests/reference/enums.d.ts | 9 --------- crates/cli/tests/reference/enums.js | 4 ---- crates/cli/tests/reference/enums.rs | 13 ------------- crates/macro-support/src/parser.rs | 6 +----- crates/shared/src/lib.rs | 3 --- crates/shared/src/schema_hash_approval.rs | 2 +- 13 files changed, 8 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a86f27bb3f8..0540bf5bab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ * Added support for `Self` in complex type expressions in methods. [#4155](https://github.com/rustwasm/wasm-bindgen/pull/4155) +### Changed + +* Sting enums are no longer generate TypeScript types. + [#4174](https://github.com/rustwasm/wasm-bindgen/pull/4174) + ### Fixed * Fixed generated setters from WebIDL interface attributes binding to wrong JS method names. diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index d745f325f9e..5e93346aea9 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -343,12 +343,8 @@ pub struct StringEnum { pub variants: Vec, /// The JS string values of the variants pub variant_values: Vec, - /// The doc comments on this enum, if any - pub comments: Vec, /// Attributes to apply to the Rust enum pub rust_attrs: Vec, - /// Whether to generate a typescript definition for this enum - pub generate_typescript: bool, /// Path to wasm_bindgen pub wasm_bindgen: Path, } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index b6371d65974..e5f3cfb9dd9 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1144,7 +1144,7 @@ impl ToTokens for ast::StringEnum { fn to_tokens(&self, tokens: &mut TokenStream) { let vis = &self.vis; let enum_name = &self.name; - let name_str = self.js_name.to_string(); + let name_str = &self.js_name; let name_len = name_str.len() as u32; let name_chars = name_str.chars().map(u32::from); let variants = &self.variants; diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index 8e89e58a81e..b617efd027d 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -362,10 +362,7 @@ fn shared_import_type<'a>(i: &'a ast::ImportType, intern: &'a Interner) -> Impor fn shared_import_enum<'a>(i: &'a ast::StringEnum, _intern: &'a Interner) -> StringEnum<'a> { StringEnum { name: &i.js_name, - public: matches!(i.vis, syn::Visibility::Public(_)), - generate_typescript: i.generate_typescript, variant_values: i.variant_values.iter().map(|x| &**x).collect(), - comments: i.comments.iter().map(|s| &**s).collect(), } } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 9be761ac818..d4088ea00d2 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3816,32 +3816,12 @@ __wbg_set_wasm(wasm);" } fn generate_string_enum(&mut self, string_enum: &AuxStringEnum) -> Result<(), Error> { - let docs = format_doc_comments(&string_enum.comments, None); - let variants: Vec<_> = string_enum .variant_values .iter() .map(|v| format!("\"{v}\"")) .collect(); - if string_enum.generate_typescript { - self.typescript.push_str(&docs); - if string_enum.public { - self.typescript.push_str("export "); - } - self.typescript.push_str("type "); - self.typescript.push_str(&string_enum.name); - self.typescript.push_str(" = "); - - if variants.is_empty() { - self.typescript.push_str("never"); - } else { - self.typescript.push_str(&variants.join(" | ")); - } - - self.typescript.push_str(";\n"); - } - self.global(&format!( "const __wbindgen_enum_{name} = [{values}];\n", name = string_enum.name, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index ce573ff64ff..0a5b9138e0f 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -868,14 +868,11 @@ impl<'a> Context<'a> { fn string_enum(&mut self, string_enum: &decode::StringEnum<'_>) -> Result<(), Error> { let aux = AuxStringEnum { name: string_enum.name.to_string(), - public: string_enum.public, - comments: concatenate_comments(&string_enum.comments), variant_values: string_enum .variant_values .iter() .map(|v| v.to_string()) .collect(), - generate_typescript: string_enum.generate_typescript, }; let mut result = Ok(()); self.aux diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index b7777c906bf..a90381f9bbd 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -179,14 +179,8 @@ pub struct AuxEnum { pub struct AuxStringEnum { /// The name of this enum pub name: String, - /// Whether this enum is public - pub public: bool, - /// The copied Rust comments to forward to JS - pub comments: String, /// A list of variants values pub variant_values: Vec, - /// Whether typescript bindings should be generated for this enum. - pub generate_typescript: bool, } #[derive(Debug)] diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 00939f01763..412cac3fe21 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -43,12 +43,3 @@ export enum ImplicitDiscriminant { C = 42, D = 43, } -/** - * The name of a color. - */ -export type ColorName = "green" | "yellow" | "red"; -/** - * An unused string enum. - */ -export type FooBar = "foo" | "bar"; -type PrivateStringEnum = "foo" | "bar"; diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 65ef4045711..58eb0460b81 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -83,10 +83,6 @@ export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42 const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; -const __wbindgen_enum_FooBar = ["foo", "bar"]; - -const __wbindgen_enum_PrivateStringEnum = ["foo", "bar"]; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index 480dba7ce89..ea98a9c60a9 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -45,19 +45,6 @@ pub fn option_string_enum_echo(color: Option) -> Option { color } -/// An unused string enum. -#[wasm_bindgen(js_name = "FooBar")] -pub enum UnusedStringEnum { - Foo = "foo", - Bar = "bar", -} - -#[wasm_bindgen] -enum PrivateStringEnum { - Foo = "foo", - Bar = "bar", -} - #[wasm_bindgen] pub enum ImplicitDiscriminant { A, diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 859422c65d2..e51ebf001cc 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1321,8 +1321,6 @@ fn string_enum( enum_: syn::ItemEnum, program: &mut ast::Program, js_name: String, - generate_typescript: bool, - comments: Vec, ) -> Result<(), Diagnostic> { let mut variants = vec![]; let mut variant_values = vec![]; @@ -1358,9 +1356,7 @@ fn string_enum( js_name, variants, variant_values, - comments, rust_attrs: enum_.attrs, - generate_typescript, wasm_bindgen: program.wasm_bindgen.clone(), }), }); @@ -1410,7 +1406,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { false }); if is_string_enum { - return string_enum(self, program, js_name, generate_typescript, comments); + return string_enum(self, program, js_name); } match self.vis { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 5bb6a51d435..c5909fd3d74 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -106,10 +106,7 @@ macro_rules! shared_api { struct StringEnum<'a> { name: &'a str, - public: bool, variant_values: Vec<&'a str>, - comments: Vec<&'a str>, - generate_typescript: bool, } struct Export<'a> { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index bc796aed76f..be07faa3826 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "950257602071279980"; +const APPROVED_SCHEMA_FILE_HASH: &str = "2837603620805312754"; #[test] fn schema_version() { From 32da2116237b17ef8fbbd379c1c7b7b510972105 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 10 Oct 2024 23:49:27 +0200 Subject: [PATCH 514/641] Remove string enum type mentions from JS & TS (#4175) --- CHANGELOG.md | 5 ++++- crates/cli-support/src/js/binding.rs | 2 +- crates/cli-support/src/wit/incoming.rs | 4 ++-- crates/cli-support/src/wit/outgoing.rs | 4 ++-- crates/cli-support/src/wit/standard.rs | 2 +- crates/cli/tests/reference/enums.d.ts | 10 +++++----- crates/cli/tests/reference/enums.js | 6 +++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0540bf5bab7..ae459e0cab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ ### Changed -* Sting enums are no longer generate TypeScript types. +* String enums are no longer generate TypeScript types. [#4174](https://github.com/rustwasm/wasm-bindgen/pull/4174) ### Fixed @@ -21,6 +21,9 @@ * Fixed generated setters from WebIDL interface attributes binding to wrong JS method names. [#4170](https://github.com/rustwasm/wasm-bindgen/pull/4170) +* Fix string enums showing up in JS documentation and TypeScript bindings without corresponding types. + [#4175](https://github.com/rustwasm/wasm-bindgen/pull/4175) + -------------------------------------------------------------------------------- ## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index bb4864e54a8..27d58549ba6 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -1441,7 +1441,7 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String) { AdapterType::NamedExternref(name) => dst.push_str(name), AdapterType::Struct(name) => dst.push_str(name), AdapterType::Enum(name) => dst.push_str(name), - AdapterType::StringEnum(name) => dst.push_str(name), + AdapterType::StringEnum => dst.push_str("any"), AdapterType::Function => dst.push_str("any"), } } diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index a1a6ee196b4..06c7160cb63 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> { }, Descriptor::StringEnum { name, invalid, .. } => { self.instruction( - &[AdapterType::StringEnum(name.clone())], + &[AdapterType::StringEnum], Instruction::StringEnumToWasm { name: name.clone(), invalid: *invalid, @@ -312,7 +312,7 @@ impl InstructionBuilder<'_, '_> { hole, } => { self.instruction( - &[AdapterType::StringEnum(name.clone()).option()], + &[AdapterType::StringEnum.option()], Instruction::OptionStringEnumToWasm { name: name.clone(), invalid: *invalid, diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 020d8b1702f..a3563551bb5 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -295,7 +295,7 @@ impl InstructionBuilder<'_, '_> { name: name.clone(), hole: *hole, }, - &[AdapterType::StringEnum(String::from(name)).option()], + &[AdapterType::StringEnum.option()], ); } Descriptor::RustStruct(name) => { @@ -538,7 +538,7 @@ impl InstructionBuilder<'_, '_> { Instruction::WasmToStringEnum { name: name.to_string(), }, - &[AdapterType::StringEnum(String::from(name))], + &[AdapterType::StringEnum], ); } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index c96430c6411..aee0e0845e9 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -86,7 +86,7 @@ pub enum AdapterType { Option(Box), Struct(String), Enum(String), - StringEnum(String), + StringEnum, NamedExternref(String), Function, NonNull, diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 412cac3fe21..86e3e28d560 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -12,14 +12,14 @@ export function enum_echo(color: Color): Color; export function option_enum_echo(color?: Color): Color | undefined; /** * @param {Color} color - * @returns {ColorName} + * @returns {any} */ -export function get_name(color: Color): ColorName; +export function get_name(color: Color): any; /** - * @param {ColorName | undefined} [color] - * @returns {ColorName | undefined} + * @param {any | undefined} [color] + * @returns {any | undefined} */ -export function option_string_enum_echo(color?: ColorName): ColorName | undefined; +export function option_string_enum_echo(color?: any): any | undefined; /** * A color. */ diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 58eb0460b81..e69baa01e95 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -46,7 +46,7 @@ export function option_enum_echo(color) { /** * @param {Color} color - * @returns {ColorName} + * @returns {any} */ export function get_name(color) { const ret = wasm.get_name(color); @@ -54,8 +54,8 @@ export function get_name(color) { } /** - * @param {ColorName | undefined} [color] - * @returns {ColorName | undefined} + * @param {any | undefined} [color] + * @returns {any | undefined} */ export function option_string_enum_echo(color) { const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((__wbindgen_enum_ColorName.indexOf(color) + 1 || 4) - 1)); From aaad79838f5f0475e78183c40b83952cb75b9717 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 10 Oct 2024 23:53:13 +0200 Subject: [PATCH 515/641] Prepare v0.2.95 release (#4176) --- CHANGELOG.md | 8 +++++--- Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 6 +++--- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- 20 files changed, 50 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae459e0cab8..e4535f9a886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) + +Released 2024-10-10 ### Added @@ -26,7 +28,7 @@ -------------------------------------------------------------------------------- -## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) +## [0.2.94](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.94) (YANKED) Released 2024-10-09 @@ -492,7 +494,7 @@ Released 2023-11-27. -------------------------------------------------------------------------------- -## [0.2.88](https://github.com/rustwasm/wasm-bindgen/compare/0.2.87...0.2.88) +## [0.2.88](https://github.com/rustwasm/wasm-bindgen/compare/0.2.87...0.2.88) (YANKED) Released 2023-11-01 diff --git a/Cargo.toml b/Cargo.toml index d38d318ef8e..e5d52b98ce4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.94" +version = "0.2.95" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,7 +45,7 @@ cfg-if = "1.0.0" once_cell = "1.12" serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.94" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95" } [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 7eed099b2f5..3b8d2d39020 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.94" +version = "0.2.95" [features] extra-traits = ["syn/extra-traits"] @@ -24,4 +24,4 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index e0c4b9e1c66..67c554a5c24 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] anyhow = "1.0" @@ -23,9 +23,9 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = "0.22" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.94' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.94' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.94' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.94' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.94' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.94' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.95' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.95' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.95' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.95' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.95' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.95' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index db87e877cf1..b326c60da4f 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.22", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.94" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.95" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index e9fbaa68f35..dd7e6cc5bfe 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 8b21e2b666a..15abdd740f1 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.44" +version = "0.4.45" [package.metadata.docs.rs] all-features = true @@ -19,8 +19,8 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '0.3.71' } -wasm-bindgen = { path = "../..", version = '0.2.94' } +js-sys = { path = "../js-sys", version = '0.3.72' } +wasm-bindgen = { path = "../..", version = '0.2.95' } [features] futures-core-03-stream = ['futures-core'] diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index bbc4dc5bf74..6c7e68885e7 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,14 +14,14 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.71" +version = "0.3.72" [lib] doctest = false test = false [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.94" } +wasm-bindgen = { path = "../..", version = "0.2.95" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 0f369e2e978..5df475b0e7c 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.94" +version = "0.2.95" [features] extra-traits = ["syn/extra-traits"] @@ -22,5 +22,5 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.94" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.94" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.95" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index ad63bd3eccb..432c4c77866 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.94" +version = "0.2.95" [lib] proc-macro = true @@ -23,7 +23,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.94" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.95" } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 5f22f5feeaf..fe89ee332b4 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index abf1a410fdc..2e5fe6b1a78 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.94" +version = "0.2.95" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index c5909fd3d74..916b1ce0f31 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.94"; +pub const SCHEMA_VERSION: &str = "0.2.95"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index be07faa3826..9765cc798db 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "2837603620805312754"; +const APPROVED_SCHEMA_FILE_HASH: &str = "89356342330161978"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index b6b3c0583a4..e79d2a77e04 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.44" +version = "0.3.45" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 7e367a88ed1..f4344ec316c 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,16 +7,16 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.44" +version = "0.3.45" [dependencies] console_error_panic_hook = '0.1' gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '0.3.71' } +js-sys = { path = '../js-sys', version = '0.3.72' } scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.94' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.44' } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.44' } +wasm-bindgen = { path = '../..', version = '0.2.95' } +wasm-bindgen-futures = { path = '../futures', version = '0.4.45' } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 03f8be5f1df..6c1d32e06ee 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] anyhow = "1.0" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.94" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 74e3026b809..52a1e8ffb9c 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 43b5f17e622..38393c38a28 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.94" +version = "0.2.95" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.22" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.94" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.95" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 489d070e47c..20af4112013 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.71" +version = "0.3.72" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '0.3.71' } -wasm-bindgen = { path = "../..", version = "0.2.94" } +js-sys = { path = '../js-sys', version = '0.3.72' } +wasm-bindgen = { path = "../..", version = "0.2.95" } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 3a8da7cb8842d4cb9918871179b6b7d3c77df5a0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 11 Oct 2024 00:02:44 +0200 Subject: [PATCH 516/641] Fix CI (#4177) --- crates/cli/tests/reference/raw.js | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 02dcddad344..6c6e36065ee 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,26 +6,6 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -45,6 +25,26 @@ function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} /** * @param {number} test * @returns {number} @@ -109,11 +109,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); -}; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + From bc85317a2c65df462a548c16875b0c8eb56d6ea9 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 12 Oct 2024 21:22:47 +0200 Subject: [PATCH 517/641] Add test for code gen with `web-sys` (#4179) --- crates/cli/tests/reference.rs | 41 ++++- crates/cli/tests/reference/web-sys.d.ts | 10 + crates/cli/tests/reference/web-sys.js | 235 ++++++++++++++++++++++++ crates/cli/tests/reference/web-sys.rs | 15 ++ crates/cli/tests/reference/web-sys.wat | 20 ++ 5 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 crates/cli/tests/reference/web-sys.d.ts create mode 100644 crates/cli/tests/reference/web-sys.js create mode 100644 crates/cli/tests/reference/web-sys.rs create mode 100644 crates/cli/tests/reference/web-sys.wat diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index 6a4c57956df..df9c7d27399 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -8,6 +8,27 @@ //! `*.js` files and `*.wat` files with the expected output of the `*.rs` //! compilation. Use `BLESS=1` in the environment to automatically update all //! tests. +//! +//! ## Dependencies +//! +//! By default, tests only have access to the `wasm-bindgen` and +//! `wasm-bindgen-futures` crates. Additional crates can be used by declaring +//! them as dependencies using a comment at the top of the test file. +//! For example: +//! +//! ```rust +//! // DEPENDENCY: web-sys = { path = '{root}/crates/web-sys', features = ['console', 'Url', 'MediaSourceReadyState'] } +//! ``` +//! +//! This will add the `web-sys` crate as a dependency to the test, allowing the +//! test to use the `console`, `Url`, and `MediaSourceReadyState` features, as +//! well as the `web-sys` crate itself. +//! +//! Note that the `{root}` placeholder will be replaced with the path to the +//! root of the `wasm-bindgen` repository. +//! +//! Multiple dependencies can be declared in a single test file using multiple +//! `DEPENDENCY:` comments. use anyhow::{bail, Result}; use assert_cmd::prelude::*; @@ -55,6 +76,15 @@ fn main() -> Result<()> { fn runtest(test: &Path) -> Result<()> { let contents = fs::read_to_string(test)?; let td = tempfile::TempDir::new()?; + let root = repo_root(); + let root = root.display(); + + // parse additional dependency declarations + let dependencies = contents + .lines() + .filter_map(|l| l.strip_prefix("// DEPENDENCY: ")) + .map(|l| "\n ".to_string() + &l.trim().replace("{root}", &root.to_string())) + .fold(String::new(), |a, b| a + &b); let manifest = format!( " @@ -65,16 +95,15 @@ fn runtest(test: &Path) -> Result<()> { edition = '2021' [dependencies] - wasm-bindgen = {{ path = '{}' }} - wasm-bindgen-futures = {{ path = '{}/crates/futures' }} + wasm-bindgen = {{ path = '{root}' }} + wasm-bindgen-futures = {{ path = '{root}/crates/futures' }} + {dependencies} [lib] crate-type = ['cdylib'] - path = '{}' + path = '{test}' ", - repo_root().display(), - repo_root().display(), - test.display(), + test = test.display(), ); fs::write(td.path().join("Cargo.toml"), manifest)?; diff --git a/crates/cli/tests/reference/web-sys.d.ts b/crates/cli/tests/reference/web-sys.d.ts new file mode 100644 index 00000000000..317ce71a92b --- /dev/null +++ b/crates/cli/tests/reference/web-sys.d.ts @@ -0,0 +1,10 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * @returns {URL} + */ +export function get_url(): URL; +/** + * @returns {any} + */ +export function get_media_source(): any; diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js new file mode 100644 index 00000000000..58229dc66a1 --- /dev/null +++ b/crates/cli/tests/reference/web-sys.js @@ -0,0 +1,235 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +let WASM_VECTOR_LEN = 0; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; + +let cachedTextEncoder = new lTextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} +/** + * @returns {URL} + */ +export function get_url() { + const ret = wasm.get_url(); + return takeObject(ret); +} + +/** + * @returns {any} + */ +export function get_media_source() { + const ret = wasm.get_media_source(); + return __wbindgen_enum_MediaSourceEnum[ret]; +} + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } +} + +const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; + +const __wbindgen_enum_MediaSourceReadyState = ["closed", "open", "ended"]; + +export function __wbg_new_1cabf49927794f50() { return handleError(function (arg0, arg1) { + const ret = new URL(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); +}, arguments) }; + +export function __wbindgen_debug_string(arg0, arg1) { + const ret = debugString(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + diff --git a/crates/cli/tests/reference/web-sys.rs b/crates/cli/tests/reference/web-sys.rs new file mode 100644 index 00000000000..6ad4315c2ed --- /dev/null +++ b/crates/cli/tests/reference/web-sys.rs @@ -0,0 +1,15 @@ +// DEPENDENCY: web-sys = { path = '{root}/crates/web-sys', features = ['console', 'Url', 'MediaSourceEnum', 'MediaSourceReadyState'] } + +use wasm_bindgen::prelude::wasm_bindgen; +use web_sys::{Url, MediaSourceEnum, MediaSourceReadyState}; + +#[wasm_bindgen] +pub fn get_url() -> Url { + assert_eq!(MediaSourceReadyState::Closed, MediaSourceReadyState::Closed); + Url::new("https://example.com").unwrap() +} + +#[wasm_bindgen] +pub fn get_media_source() -> MediaSourceEnum { + MediaSourceEnum::Camera +} diff --git a/crates/cli/tests/reference/web-sys.wat b/crates/cli/tests/reference/web-sys.wat new file mode 100644 index 00000000000..eefb7ad3e97 --- /dev/null +++ b/crates/cli/tests/reference/web-sys.wat @@ -0,0 +1,20 @@ +(module $reference_test.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32 i32 i32 i32) (result i32))) + (func $__wbindgen_realloc (;0;) (type 3) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;1;) (type 2) (param i32 i32) (result i32)) + (func $get_url (;2;) (type 0) (result i32)) + (func $get_media_source (;3;) (type 0) (result i32)) + (func $__wbindgen_exn_store (;4;) (type 1) (param i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "get_url" (func $get_url)) + (export "get_media_source" (func $get_media_source)) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") +) + From 724b4477d6777c75a61834789d90a10158cc2188 Mon Sep 17 00:00:00 2001 From: Zhizhou Ma <69104171+zhiz-m@users.noreply.github.com> Date: Sun, 13 Oct 2024 04:08:00 +0800 Subject: [PATCH 518/641] Use new `web_sys` `Uint8ClampedArray` bindings (#4184) --- examples/raytrace-parallel/src/lib.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/examples/raytrace-parallel/src/lib.rs b/examples/raytrace-parallel/src/lib.rs index 91db0906c57..5e7a6e546d1 100644 --- a/examples/raytrace-parallel/src/lib.rs +++ b/examples/raytrace-parallel/src/lib.rs @@ -2,6 +2,7 @@ use futures_channel::oneshot; use js_sys::{Promise, Uint8ClampedArray, WebAssembly}; use rayon::prelude::*; use wasm_bindgen::prelude::*; +use web_sys::ImageData; macro_rules! console_log { ($($t:tt)*) => (crate::log(&format_args!($($t)*).to_string())) @@ -117,16 +118,6 @@ pub struct RenderingScene { height: u32, } -// Inline the definition of `ImageData` here because `web_sys` uses -// `&Clamped>`, whereas we want to pass in a JS object here. -#[wasm_bindgen] -extern "C" { - pub type ImageData; - - #[wasm_bindgen(constructor, catch)] - fn new(data: &Uint8ClampedArray, width: f64, height: f64) -> Result; -} - #[wasm_bindgen] impl RenderingScene { /// Returns the JS promise object which resolves when the render is complete @@ -157,5 +148,5 @@ fn image_data(base: usize, len: usize, width: u32, height: u32) -> ImageData { // could ensure that even on the Rust side of things it's not UB. let mem = wasm_bindgen::memory().unchecked_into::(); let mem = Uint8ClampedArray::new(&mem.buffer()).slice(base as u32, (base + len) as u32); - ImageData::new(&mem, width as f64, height as f64).unwrap() + ImageData::new_with_js_u8_clamped_array_and_sh(&mem, width, height).unwrap() } From 61f1d968e20aacd8c0c3518e4877af4337283979 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 12 Oct 2024 22:13:52 +0200 Subject: [PATCH 519/641] Use `isLikeNone` to detect null/undefined for string enums (#4186) --- crates/cli-support/src/js/binding.rs | 7 +++---- crates/cli/tests/reference/enums.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 27d58549ba6..29f32e1e7c5 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -712,12 +712,11 @@ fn instruction( } => { let enum_val = js.pop(); let enum_val_expr = string_enum_to_wasm(name, *invalid, &enum_val); + js.cx.expose_is_like_none(); - // e.g. someEnumVal == undefined ? 4 : (string_enum_to_wasm(someEnumVal)) - // | - // double equals here in case it's null + // e.g. isLikeNone(someEnumVal) ? 4 : (string_enum_to_wasm(someEnumVal)) js.push(format!( - "{enum_val} == undefined ? {hole} : ({enum_val_expr})" + "isLikeNone({enum_val}) ? {hole} : ({enum_val_expr})" )) } diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index e69baa01e95..63fbeb3fe86 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -58,7 +58,7 @@ export function get_name(color) { * @returns {any | undefined} */ export function option_string_enum_echo(color) { - const ret = wasm.option_string_enum_echo(color == undefined ? 4 : ((__wbindgen_enum_ColorName.indexOf(color) + 1 || 4) - 1)); + const ret = wasm.option_string_enum_echo(isLikeNone(color) ? 4 : ((__wbindgen_enum_ColorName.indexOf(color) + 1 || 4) - 1)); return __wbindgen_enum_ColorName[ret]; } From 03c8e2d8f411e0931c24f4902979b867b56f5381 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 12 Oct 2024 22:56:21 +0200 Subject: [PATCH 520/641] Fixed methods with `self: &Self` consuming the object (#4178) --- CHANGELOG.md | 9 +++ crates/cli/tests/reference/self-type.d.ts | 12 ++++ crates/cli/tests/reference/self-type.js | 75 +++++++++++++++++++++++ crates/cli/tests/reference/self-type.rs | 20 ++++++ crates/cli/tests/reference/self-type.wat | 25 ++++++++ crates/macro-support/src/parser.rs | 31 +++++++--- 6 files changed, 164 insertions(+), 8 deletions(-) create mode 100644 crates/cli/tests/reference/self-type.d.ts create mode 100644 crates/cli/tests/reference/self-type.js create mode 100644 crates/cli/tests/reference/self-type.rs create mode 100644 crates/cli/tests/reference/self-type.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index e4535f9a886..f7340b9c76f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Fixed + +* Fixed methods with `self: &Self` consuming the object + [#4178](https://github.com/rustwasm/wasm-bindgen/pull/4178) + +-------------------------------------------------------------------------------- + ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) Released 2024-10-10 diff --git a/crates/cli/tests/reference/self-type.d.ts b/crates/cli/tests/reference/self-type.d.ts new file mode 100644 index 00000000000..b2e2f6e7f85 --- /dev/null +++ b/crates/cli/tests/reference/self-type.d.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/* eslint-disable */ +export class Test { + free(): void; + constructor(); + consume_self(): void; + ref_self(): void; + ref_mut_self(): void; + self_Self(): void; + self_ref_Self(): void; + self_ref_mut_Self(): void; +} diff --git a/crates/cli/tests/reference/self-type.js b/crates/cli/tests/reference/self-type.js new file mode 100644 index 00000000000..ba2f992bc57 --- /dev/null +++ b/crates/cli/tests/reference/self-type.js @@ -0,0 +1,75 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const TestFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_test_free(ptr >>> 0, 1)); + +export class Test { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + TestFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_test_free(ptr, 0); + } + constructor() { + const ret = wasm.test_new(); + this.__wbg_ptr = ret >>> 0; + TestFinalization.register(this, this.__wbg_ptr, this); + return this; + } + consume_self() { + const ptr = this.__destroy_into_raw(); + wasm.test_consume_self(ptr); + } + ref_self() { + wasm.test_ref_self(this.__wbg_ptr); + } + ref_mut_self() { + wasm.test_ref_mut_self(this.__wbg_ptr); + } + self_Self() { + const ptr = this.__destroy_into_raw(); + wasm.test_self_Self(ptr); + } + self_ref_Self() { + wasm.test_self_ref_Self(this.__wbg_ptr); + } + self_ref_mut_Self() { + wasm.test_self_ref_mut_Self(this.__wbg_ptr); + } +} + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/self-type.rs b/crates/cli/tests/reference/self-type.rs new file mode 100644 index 00000000000..4ed15e88270 --- /dev/null +++ b/crates/cli/tests/reference/self-type.rs @@ -0,0 +1,20 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct Test; + +#[wasm_bindgen] +impl Test { + #[wasm_bindgen(constructor)] + pub fn new() -> Test { + Test + } + + pub fn consume_self(self) {} + pub fn ref_self(&self) {} + pub fn ref_mut_self(&mut self) {} + + pub fn self_Self(self: Self) {} + pub fn self_ref_Self(self: &Self) {} + pub fn self_ref_mut_Self(self: &mut Self) {} +} diff --git a/crates/cli/tests/reference/self-type.wat b/crates/cli/tests/reference/self-type.wat new file mode 100644 index 00000000000..546667f8a53 --- /dev/null +++ b/crates/cli/tests/reference/self-type.wat @@ -0,0 +1,25 @@ +(module $reference_test.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) + (func $test_ref_self (;0;) (type 1) (param i32)) + (func $test_ref_mut_self (;1;) (type 1) (param i32)) + (func $test_self_ref_Self (;2;) (type 1) (param i32)) + (func $test_self_ref_mut_Self (;3;) (type 1) (param i32)) + (func $__wbg_test_free (;4;) (type 2) (param i32 i32)) + (func $test_new (;5;) (type 0) (result i32)) + (func $test_consume_self (;6;) (type 1) (param i32)) + (func $test_self_Self (;7;) (type 1) (param i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_test_free" (func $__wbg_test_free)) + (export "test_new" (func $test_new)) + (export "test_consume_self" (func $test_consume_self)) + (export "test_ref_self" (func $test_ref_self)) + (export "test_ref_mut_self" (func $test_ref_mut_self)) + (export "test_self_Self" (func $test_self_Self)) + (export "test_self_ref_Self" (func $test_self_ref_Self)) + (export "test_self_ref_mut_Self" (func $test_self_ref_mut_Self)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") +) + diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index e51ebf001cc..107488151d7 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -886,6 +886,26 @@ pub(crate) fn is_js_keyword(keyword: &str, skip: Option<&[&str]>) -> bool { .any(|this| *this == keyword) } +/// Returns whether `self` is passed by reference or by value. +fn get_self_method(r: syn::Receiver) -> ast::MethodSelf { + // The tricky part here is that `r` can have many forms. E.g. `self`, + // `&self`, `&mut self`, `self: Self`, `self: &Self`, `self: &mut Self`, + // `self: Box`, `self: Rc`, etc. + // Luckily, syn always populates the `ty` field with the type of `self`, so + // e.g. `&self` gets the type `&Self`. So we only have check whether the + // type is a reference or not. + match &*r.ty { + syn::Type::Reference(ty) => { + if ty.mutability.is_some() { + ast::MethodSelf::RefMutable + } else { + ast::MethodSelf::RefShared + } + } + _ => ast::MethodSelf::ByValue, + } +} + /// Construct a function (and gets the self type if appropriate) for our AST from a syn function. #[allow(clippy::too_many_arguments)] fn function_from_decl( @@ -965,15 +985,10 @@ fn function_from_decl( panic!("arguments cannot be `self`") } - // write down the way in which `self` is passed for later + // We need to know *how* `self` is passed to the method (by + // value or by reference) to generate the correct JS shim. assert!(method_self.is_none()); - if r.reference.is_none() { - method_self = Some(ast::MethodSelf::ByValue); - } else if r.mutability.is_some() { - method_self = Some(ast::MethodSelf::RefMutable); - } else { - method_self = Some(ast::MethodSelf::RefShared); - } + method_self = Some(get_self_method(r)); None } From 4c2e9238a0527fd8218f01266ad062d4179d89d8 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 12 Oct 2024 23:37:29 +0200 Subject: [PATCH 521/641] Generate TS types for string enums (#4180) --- CHANGELOG.md | 7 +++- crates/backend/src/ast.rs | 4 +++ crates/backend/src/encode.rs | 2 ++ crates/cli-support/src/js/binding.rs | 40 ++++++++++++++++------- crates/cli-support/src/js/mod.rs | 30 +++++++++++++++++ crates/cli-support/src/wit/incoming.rs | 4 +-- crates/cli-support/src/wit/mod.rs | 2 ++ crates/cli-support/src/wit/nonstandard.rs | 4 +++ crates/cli-support/src/wit/outgoing.rs | 4 +-- crates/cli-support/src/wit/standard.rs | 2 +- crates/cli/tests/reference/enums.d.ts | 14 +++++--- crates/cli/tests/reference/enums.js | 10 ++++-- crates/cli/tests/reference/enums.rs | 13 ++++++++ crates/cli/tests/reference/web-sys.d.ts | 10 ++++-- crates/cli/tests/reference/web-sys.js | 2 +- crates/macro-support/src/parser.rs | 6 +++- crates/shared/src/lib.rs | 2 ++ crates/shared/src/schema_hash_approval.rs | 2 +- 18 files changed, 128 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7340b9c76f..745e56ecbab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,14 @@ ## Unreleased +### Changed + +* String enums now generate private TypeScript types but only if used. + [#4174](https://github.com/rustwasm/wasm-bindgen/pull/4174) + ### Fixed -* Fixed methods with `self: &Self` consuming the object +* Fixed methods with `self: &Self` consuming the object. [#4178](https://github.com/rustwasm/wasm-bindgen/pull/4178) -------------------------------------------------------------------------------- diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 5e93346aea9..d745f325f9e 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -343,8 +343,12 @@ pub struct StringEnum { pub variants: Vec, /// The JS string values of the variants pub variant_values: Vec, + /// The doc comments on this enum, if any + pub comments: Vec, /// Attributes to apply to the Rust enum pub rust_attrs: Vec, + /// Whether to generate a typescript definition for this enum + pub generate_typescript: bool, /// Path to wasm_bindgen pub wasm_bindgen: Path, } diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index b617efd027d..bc82ba5c336 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -362,7 +362,9 @@ fn shared_import_type<'a>(i: &'a ast::ImportType, intern: &'a Interner) -> Impor fn shared_import_enum<'a>(i: &'a ast::StringEnum, _intern: &'a Interner) -> StringEnum<'a> { StringEnum { name: &i.js_name, + generate_typescript: i.generate_typescript, variant_values: i.variant_values.iter().map(|x| &**x).collect(), + comments: i.comments.iter().map(|s| &**s).collect(), } } diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 29f32e1e7c5..50d993c3f9f 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -8,6 +8,7 @@ use crate::js::Context; use crate::wit::InstructionData; use crate::wit::{Adapter, AdapterId, AdapterKind, AdapterType, Instruction}; use anyhow::{anyhow, bail, Error}; +use std::collections::HashSet; use std::fmt::Write; use walrus::{Module, ValType}; @@ -68,6 +69,7 @@ pub struct JsFunction { pub js_doc: String, pub ts_arg_tys: Vec, pub ts_ret_ty: Option, + pub ts_refs: HashSet, /// Whether this function has a single optional argument. /// /// If the function is a setter, that means that the field it sets is optional. @@ -76,6 +78,14 @@ pub struct JsFunction { pub log_error: bool, } +/// A references to an (likely) exported symbol used in TS type expression. +/// +/// Right now, only string enum require this type of anaylsis. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum TsReference { + StringEnum(String), +} + impl<'a, 'b> Builder<'a, 'b> { pub fn new(cx: &'a mut Context<'b>) -> Builder<'a, 'b> { Builder { @@ -246,7 +256,7 @@ impl<'a, 'b> Builder<'a, 'b> { // should start from here. Struct fields(Getter) only have one arg, and // this is the clue we can infer if a function might be a field. let mut might_be_optional_field = false; - let (ts_sig, ts_arg_tys, ts_ret_ty) = self.typescript_signature( + let (ts_sig, ts_arg_tys, ts_ret_ty, ts_refs) = self.typescript_signature( &function_args, &arg_tys, &adapter.inner_results, @@ -266,6 +276,7 @@ impl<'a, 'b> Builder<'a, 'b> { js_doc, ts_arg_tys, ts_ret_ty, + ts_refs, might_be_optional_field, catch: self.catch, log_error: self.log_error, @@ -285,11 +296,12 @@ impl<'a, 'b> Builder<'a, 'b> { might_be_optional_field: &mut bool, asyncness: bool, variadic: bool, - ) -> (String, Vec, Option) { + ) -> (String, Vec, Option, HashSet) { // Build up the typescript signature as well let mut omittable = true; let mut ts_args = Vec::new(); let mut ts_arg_tys = Vec::new(); + let mut ts_refs = HashSet::new(); for (name, ty) in arg_names.iter().zip(arg_tys).rev() { // In TypeScript, we can mark optional parameters as omittable // using the `?` suffix, but only if they're not followed by @@ -301,12 +313,12 @@ impl<'a, 'b> Builder<'a, 'b> { match ty { AdapterType::Option(ty) if omittable => { arg.push_str("?: "); - adapter2ts(ty, &mut ts); + adapter2ts(ty, &mut ts, Some(&mut ts_refs)); } ty => { omittable = false; arg.push_str(": "); - adapter2ts(ty, &mut ts); + adapter2ts(ty, &mut ts, Some(&mut ts_refs)); } } arg.push_str(&ts); @@ -342,7 +354,7 @@ impl<'a, 'b> Builder<'a, 'b> { let mut ret = String::new(); match result_tys.len() { 0 => ret.push_str("void"), - 1 => adapter2ts(&result_tys[0], &mut ret), + 1 => adapter2ts(&result_tys[0], &mut ret, Some(&mut ts_refs)), _ => ret.push_str("[any]"), } if asyncness { @@ -351,7 +363,7 @@ impl<'a, 'b> Builder<'a, 'b> { ts.push_str(&ret); ts_ret = Some(ret); } - (ts, ts_arg_tys, ts_ret) + (ts, ts_arg_tys, ts_ret, ts_refs) } /// Returns a helpful JS doc comment which lists types for all parameters @@ -374,7 +386,7 @@ impl<'a, 'b> Builder<'a, 'b> { for (name, ty) in fn_arg_names.iter().zip(arg_tys).rev() { let mut arg = "@param {".to_string(); - adapter2ts(ty, &mut arg); + adapter2ts(ty, &mut arg, None); arg.push_str("} "); match ty { AdapterType::Option(..) if omittable => { @@ -395,7 +407,7 @@ impl<'a, 'b> Builder<'a, 'b> { if let (Some(name), Some(ty)) = (variadic_arg, arg_tys.last()) { ret.push_str("@param {..."); - adapter2ts(ty, &mut ret); + adapter2ts(ty, &mut ret, None); ret.push_str("} "); ret.push_str(name); ret.push('\n'); @@ -1416,7 +1428,7 @@ impl Invocation { } } -fn adapter2ts(ty: &AdapterType, dst: &mut String) { +fn adapter2ts(ty: &AdapterType, dst: &mut String, refs: Option<&mut HashSet>) { match ty { AdapterType::I32 | AdapterType::S8 @@ -1434,13 +1446,19 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String) { AdapterType::Bool => dst.push_str("boolean"), AdapterType::Vector(kind) => dst.push_str(&kind.js_ty()), AdapterType::Option(ty) => { - adapter2ts(ty, dst); + adapter2ts(ty, dst, refs); dst.push_str(" | undefined"); } AdapterType::NamedExternref(name) => dst.push_str(name), AdapterType::Struct(name) => dst.push_str(name), AdapterType::Enum(name) => dst.push_str(name), - AdapterType::StringEnum => dst.push_str("any"), + AdapterType::StringEnum(name) => { + if let Some(refs) = refs { + refs.insert(TsReference::StringEnum(name.clone())); + } + + dst.push_str(name); + } AdapterType::Function => dst.push_str("any"), } } diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index d4088ea00d2..e23e3190c39 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -9,6 +9,7 @@ use crate::wit::{AuxEnum, AuxExport, AuxExportKind, AuxImport, AuxStruct}; use crate::wit::{JsImport, JsImportName, NonstandardWitSection, WasmBindgenAux}; use crate::{reset_indentation, Bindgen, EncodeInto, OutputMode, PLACEHOLDER_MODULE}; use anyhow::{anyhow, bail, Context as _, Error}; +use binding::TsReference; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::fmt; @@ -47,6 +48,10 @@ pub struct Context<'a> { /// identifiers. defined_identifiers: HashMap, + /// A set of all (tracked) symbols referenced from within type definitions, + /// function signatures, etc. + typescript_refs: HashSet, + exported_classes: Option>, /// A map of the name of npm dependencies we've loaded so far to the path @@ -108,6 +113,7 @@ impl<'a> Context<'a> { js_imports: Default::default(), defined_identifiers: Default::default(), wasm_import_definitions: Default::default(), + typescript_refs: Default::default(), exported_classes: Some(Default::default()), config, threads_enabled: config.threads.is_enabled(module), @@ -2662,6 +2668,7 @@ __wbg_set_wasm(wasm);" ts_sig, ts_arg_tys, ts_ret_ty, + ts_refs, js_doc, code, might_be_optional_field, @@ -2688,6 +2695,8 @@ __wbg_set_wasm(wasm);" Kind::Adapter => "failed to generates bindings for adapter".to_string(), })?; + self.typescript_refs.extend(ts_refs); + // Once we've got all the JS then put it in the right location depending // on what's being exported. match kind { @@ -3822,6 +3831,27 @@ __wbg_set_wasm(wasm);" .map(|v| format!("\"{v}\"")) .collect(); + if string_enum.generate_typescript + && self + .typescript_refs + .contains(&TsReference::StringEnum(string_enum.name.clone())) + { + let docs = format_doc_comments(&string_enum.comments, None); + + self.typescript.push_str(&docs); + self.typescript.push_str("type "); + self.typescript.push_str(&string_enum.name); + self.typescript.push_str(" = "); + + if variants.is_empty() { + self.typescript.push_str("never"); + } else { + self.typescript.push_str(&variants.join(" | ")); + } + + self.typescript.push_str(";\n"); + } + self.global(&format!( "const __wbindgen_enum_{name} = [{values}];\n", name = string_enum.name, diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 06c7160cb63..a1a6ee196b4 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> { }, Descriptor::StringEnum { name, invalid, .. } => { self.instruction( - &[AdapterType::StringEnum], + &[AdapterType::StringEnum(name.clone())], Instruction::StringEnumToWasm { name: name.clone(), invalid: *invalid, @@ -312,7 +312,7 @@ impl InstructionBuilder<'_, '_> { hole, } => { self.instruction( - &[AdapterType::StringEnum.option()], + &[AdapterType::StringEnum(name.clone()).option()], Instruction::OptionStringEnumToWasm { name: name.clone(), invalid: *invalid, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 0a5b9138e0f..f6b3e413712 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -868,11 +868,13 @@ impl<'a> Context<'a> { fn string_enum(&mut self, string_enum: &decode::StringEnum<'_>) -> Result<(), Error> { let aux = AuxStringEnum { name: string_enum.name.to_string(), + comments: concatenate_comments(&string_enum.comments), variant_values: string_enum .variant_values .iter() .map(|v| v.to_string()) .collect(), + generate_typescript: string_enum.generate_typescript, }; let mut result = Ok(()); self.aux diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index a90381f9bbd..ac0f6d6eb6b 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -179,8 +179,12 @@ pub struct AuxEnum { pub struct AuxStringEnum { /// The name of this enum pub name: String, + /// The copied Rust comments to forward to JS + pub comments: String, /// A list of variants values pub variant_values: Vec, + /// Whether typescript bindings should be generated for this enum. + pub generate_typescript: bool, } #[derive(Debug)] diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index a3563551bb5..8f545ffaba9 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -295,7 +295,7 @@ impl InstructionBuilder<'_, '_> { name: name.clone(), hole: *hole, }, - &[AdapterType::StringEnum.option()], + &[AdapterType::StringEnum(name.clone()).option()], ); } Descriptor::RustStruct(name) => { @@ -538,7 +538,7 @@ impl InstructionBuilder<'_, '_> { Instruction::WasmToStringEnum { name: name.to_string(), }, - &[AdapterType::StringEnum], + &[AdapterType::StringEnum(name.to_string())], ); } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index aee0e0845e9..c96430c6411 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -86,7 +86,7 @@ pub enum AdapterType { Option(Box), Struct(String), Enum(String), - StringEnum, + StringEnum(String), NamedExternref(String), Function, NonNull, diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 86e3e28d560..2eb6f824e83 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -12,14 +12,14 @@ export function enum_echo(color: Color): Color; export function option_enum_echo(color?: Color): Color | undefined; /** * @param {Color} color - * @returns {any} + * @returns {ColorName} */ -export function get_name(color: Color): any; +export function get_name(color: Color): ColorName; /** - * @param {any | undefined} [color] - * @returns {any | undefined} + * @param {ColorName | undefined} [color] + * @returns {ColorName | undefined} */ -export function option_string_enum_echo(color?: any): any | undefined; +export function option_string_enum_echo(color?: ColorName): ColorName | undefined; /** * A color. */ @@ -43,3 +43,7 @@ export enum ImplicitDiscriminant { C = 42, D = 43, } +/** + * The name of a color. + */ +type ColorName = "green" | "yellow" | "red"; diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 63fbeb3fe86..0af1ffd6404 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -46,7 +46,7 @@ export function option_enum_echo(color) { /** * @param {Color} color - * @returns {any} + * @returns {ColorName} */ export function get_name(color) { const ret = wasm.get_name(color); @@ -54,8 +54,8 @@ export function get_name(color) { } /** - * @param {any | undefined} [color] - * @returns {any | undefined} + * @param {ColorName | undefined} [color] + * @returns {ColorName | undefined} */ export function option_string_enum_echo(color) { const ret = wasm.option_string_enum_echo(isLikeNone(color) ? 4 : ((__wbindgen_enum_ColorName.indexOf(color) + 1 || 4) - 1)); @@ -83,6 +83,10 @@ export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42 const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; +const __wbindgen_enum_FooBar = ["foo", "bar"]; + +const __wbindgen_enum_PrivateStringEnum = ["foo", "bar"]; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index ea98a9c60a9..480dba7ce89 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -45,6 +45,19 @@ pub fn option_string_enum_echo(color: Option) -> Option { color } +/// An unused string enum. +#[wasm_bindgen(js_name = "FooBar")] +pub enum UnusedStringEnum { + Foo = "foo", + Bar = "bar", +} + +#[wasm_bindgen] +enum PrivateStringEnum { + Foo = "foo", + Bar = "bar", +} + #[wasm_bindgen] pub enum ImplicitDiscriminant { A, diff --git a/crates/cli/tests/reference/web-sys.d.ts b/crates/cli/tests/reference/web-sys.d.ts index 317ce71a92b..b60ab59ae5b 100644 --- a/crates/cli/tests/reference/web-sys.d.ts +++ b/crates/cli/tests/reference/web-sys.d.ts @@ -5,6 +5,12 @@ */ export function get_url(): URL; /** - * @returns {any} + * @returns {MediaSourceEnum} */ -export function get_media_source(): any; +export function get_media_source(): MediaSourceEnum; +/** + *The `MediaSourceEnum` enum. + * + **This API requires the following crate features to be activated: `MediaSourceEnum`* + */ +type MediaSourceEnum = "camera" | "screen" | "application" | "window" | "browser" | "microphone" | "audioCapture" | "other"; diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 58229dc66a1..7e4cc173aa7 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -184,7 +184,7 @@ export function get_url() { } /** - * @returns {any} + * @returns {MediaSourceEnum} */ export function get_media_source() { const ret = wasm.get_media_source(); diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 107488151d7..39638bca4fc 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1336,6 +1336,8 @@ fn string_enum( enum_: syn::ItemEnum, program: &mut ast::Program, js_name: String, + generate_typescript: bool, + comments: Vec, ) -> Result<(), Diagnostic> { let mut variants = vec![]; let mut variant_values = vec![]; @@ -1371,7 +1373,9 @@ fn string_enum( js_name, variants, variant_values, + comments, rust_attrs: enum_.attrs, + generate_typescript, wasm_bindgen: program.wasm_bindgen.clone(), }), }); @@ -1421,7 +1425,7 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { false }); if is_string_enum { - return string_enum(self, program, js_name); + return string_enum(self, program, js_name, generate_typescript, comments); } match self.vis { diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 916b1ce0f31..57faecfcd84 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -107,6 +107,8 @@ macro_rules! shared_api { struct StringEnum<'a> { name: &'a str, variant_values: Vec<&'a str>, + comments: Vec<&'a str>, + generate_typescript: bool, } struct Export<'a> { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 9765cc798db..4edb55c791c 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "89356342330161978"; +const APPROVED_SCHEMA_FILE_HASH: &str = "18290232323238297705"; #[test] fn schema_version() { From ec6b04231329f99e085611703cda37f304003591 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 13 Oct 2024 00:08:59 +0200 Subject: [PATCH 522/641] Remove JSDoc type annotations in TS files (#4187) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 15 ++++++++------- crates/cli/tests/reference/add.d.ts | 10 ---------- crates/cli/tests/reference/async-number.d.ts | 3 --- crates/cli/tests/reference/async-void.d.ts | 3 --- crates/cli/tests/reference/builder.d.ts | 3 --- crates/cli/tests/reference/enums.d.ts | 16 ---------------- crates/cli/tests/reference/pointers.d.ts | 8 -------- crates/cli/tests/reference/raw.d.ts | 11 ----------- crates/cli/tests/reference/result-string.d.ts | 3 --- crates/cli/tests/reference/skip-jsdoc.d.ts | 4 ++++ crates/cli/tests/reference/skip-jsdoc.js | 10 ++++++++++ crates/cli/tests/reference/skip-jsdoc.rs | 6 ++++++ crates/cli/tests/reference/skip-jsdoc.wat | 2 ++ crates/cli/tests/reference/string-arg.d.ts | 3 --- crates/cli/tests/reference/web-sys.d.ts | 6 ------ 16 files changed, 33 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 745e56ecbab..d28bef07beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * String enums now generate private TypeScript types but only if used. [#4174](https://github.com/rustwasm/wasm-bindgen/pull/4174) +* Remove unnecessary JSDoc type annotations from generated `.d.ts` files + [#4187](https://github.com/rustwasm/wasm-bindgen/pull/4187) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index e23e3190c39..22bd9246e6a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2712,7 +2712,7 @@ __wbg_set_wasm(wasm);" match &export.kind { AuxExportKind::Function(name) => { if let Some(ts_sig) = ts_sig { - self.typescript.push_str(&js_docs); + self.typescript.push_str(&ts_docs); self.typescript.push_str("export function "); self.typescript.push_str(name); self.typescript.push_str(ts_sig); @@ -2730,7 +2730,7 @@ __wbg_set_wasm(wasm);" } exported.has_constructor = true; - exported.push(&js_docs, "constructor", "", &code, ts_sig); + exported.push("constructor", "", &js_docs, &code, &ts_docs, ts_sig); } AuxExportKind::Method { class, @@ -2783,7 +2783,7 @@ __wbg_set_wasm(wasm);" } }; - exported.push(&js_docs, name, &prefix, &code, ts); + exported.push(name, &prefix, &js_docs, &code, &ts_docs, ts); } } } @@ -4287,20 +4287,21 @@ fn property_accessor(name: &str) -> String { impl ExportedClass { fn push( &mut self, - docs: &str, function_name: &str, function_prefix: &str, + js_docs: &str, js: &str, + ts_docs: &str, ts: Option<&str>, ) { - self.contents.push_str(docs); + self.contents.push_str(js_docs); self.contents.push_str(function_prefix); self.contents.push_str(function_name); self.contents.push_str(js); self.contents.push('\n'); if let Some(ts) = ts { - if !docs.is_empty() { - for line in docs.lines() { + if !ts_docs.is_empty() { + for line in ts_docs.lines() { self.typescript.push_str(" "); self.typescript.push_str(line); self.typescript.push('\n'); diff --git a/crates/cli/tests/reference/add.d.ts b/crates/cli/tests/reference/add.d.ts index 73827342908..f11140413c4 100644 --- a/crates/cli/tests/reference/add.d.ts +++ b/crates/cli/tests/reference/add.d.ts @@ -1,14 +1,4 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @param {number} a - * @param {number} b - * @returns {number} - */ export function add_u32(a: number, b: number): number; -/** - * @param {number} a - * @param {number} b - * @returns {number} - */ export function add_i32(a: number, b: number): number; diff --git a/crates/cli/tests/reference/async-number.d.ts b/crates/cli/tests/reference/async-number.d.ts index bc2b7e88a3c..e1bf9ff0bcc 100644 --- a/crates/cli/tests/reference/async-number.d.ts +++ b/crates/cli/tests/reference/async-number.d.ts @@ -1,6 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @returns {Promise} - */ export function foo(): Promise; diff --git a/crates/cli/tests/reference/async-void.d.ts b/crates/cli/tests/reference/async-void.d.ts index b5b19290f13..e1866a433c0 100644 --- a/crates/cli/tests/reference/async-void.d.ts +++ b/crates/cli/tests/reference/async-void.d.ts @@ -1,6 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @returns {Promise} - */ export function foo(): Promise; diff --git a/crates/cli/tests/reference/builder.d.ts b/crates/cli/tests/reference/builder.d.ts index 3a92bacdb43..032da9dcf73 100644 --- a/crates/cli/tests/reference/builder.d.ts +++ b/crates/cli/tests/reference/builder.d.ts @@ -2,8 +2,5 @@ /* eslint-disable */ export class ClassBuilder { free(): void; - /** - * @returns {ClassBuilder} - */ static builder(): ClassBuilder; } diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 2eb6f824e83..1c830d483f9 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -1,24 +1,8 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @param {Color} color - * @returns {Color} - */ export function enum_echo(color: Color): Color; -/** - * @param {Color | undefined} [color] - * @returns {Color | undefined} - */ export function option_enum_echo(color?: Color): Color | undefined; -/** - * @param {Color} color - * @returns {ColorName} - */ export function get_name(color: Color): ColorName; -/** - * @param {ColorName | undefined} [color] - * @returns {ColorName | undefined} - */ export function option_string_enum_echo(color?: ColorName): ColorName | undefined; /** * A color. diff --git a/crates/cli/tests/reference/pointers.d.ts b/crates/cli/tests/reference/pointers.d.ts index 145577b8753..314eae5938b 100644 --- a/crates/cli/tests/reference/pointers.d.ts +++ b/crates/cli/tests/reference/pointers.d.ts @@ -1,12 +1,4 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @param {number} input - * @returns {number} - */ export function const_pointer(input: number): number; -/** - * @param {number} input - * @returns {number} - */ export function mut_pointer(input: number): number; diff --git a/crates/cli/tests/reference/raw.d.ts b/crates/cli/tests/reference/raw.d.ts index fb474c2fabd..6dc3f5c628f 100644 --- a/crates/cli/tests/reference/raw.d.ts +++ b/crates/cli/tests/reference/raw.d.ts @@ -1,19 +1,8 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @param {number} test - * @returns {number} - */ export function test1(test: number): number; export class Test { free(): void; - /** - * @param {number} test - * @returns {Test} - */ static test1(test: number): Test; - /** - * @param {number} test - */ test2(test: number): void; } diff --git a/crates/cli/tests/reference/result-string.d.ts b/crates/cli/tests/reference/result-string.d.ts index 2e707cffa43..561576d42cb 100644 --- a/crates/cli/tests/reference/result-string.d.ts +++ b/crates/cli/tests/reference/result-string.d.ts @@ -1,6 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @returns {string} - */ export function exported(): string; diff --git a/crates/cli/tests/reference/skip-jsdoc.d.ts b/crates/cli/tests/reference/skip-jsdoc.d.ts index f295e357377..0d908f65acc 100644 --- a/crates/cli/tests/reference/skip-jsdoc.d.ts +++ b/crates/cli/tests/reference/skip-jsdoc.d.ts @@ -7,3 +7,7 @@ * @returns to whence I came */ export function docme(arg: number): number; +/** + * Regular documentation. + */ +export function i_has_docs(arg: number): number; diff --git a/crates/cli/tests/reference/skip-jsdoc.js b/crates/cli/tests/reference/skip-jsdoc.js index 66a9f7870d1..f3c1bc442c2 100644 --- a/crates/cli/tests/reference/skip-jsdoc.js +++ b/crates/cli/tests/reference/skip-jsdoc.js @@ -14,3 +14,13 @@ export function docme(arg) { return ret >>> 0; } +/** + * Regular documentation. + * @param {number} arg + * @returns {number} + */ +export function i_has_docs(arg) { + const ret = wasm.i_has_docs(arg); + return ret >>> 0; +} + diff --git a/crates/cli/tests/reference/skip-jsdoc.rs b/crates/cli/tests/reference/skip-jsdoc.rs index b4a131615c1..2aa14eb1359 100644 --- a/crates/cli/tests/reference/skip-jsdoc.rs +++ b/crates/cli/tests/reference/skip-jsdoc.rs @@ -8,3 +8,9 @@ use wasm_bindgen::prelude::*; pub fn docme(arg: u32) -> u32 { arg + 1 } + +/// Regular documentation. +#[wasm_bindgen] +pub fn i_has_docs(arg: u32) -> u32 { + arg + 1 +} diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index e81e8942422..0179e135da5 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -1,9 +1,11 @@ (module $reference_test.wasm (type (;0;) (func (param i32) (result i32))) (func $docme (;0;) (type 0) (param i32) (result i32)) + (func $i_has_docs (;1;) (type 0) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "docme" (func $docme)) + (export "i_has_docs" (func $i_has_docs)) (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) diff --git a/crates/cli/tests/reference/string-arg.d.ts b/crates/cli/tests/reference/string-arg.d.ts index d103e1337e1..a03bca0b63b 100644 --- a/crates/cli/tests/reference/string-arg.d.ts +++ b/crates/cli/tests/reference/string-arg.d.ts @@ -1,6 +1,3 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @param {string} a - */ export function foo(a: string): void; diff --git a/crates/cli/tests/reference/web-sys.d.ts b/crates/cli/tests/reference/web-sys.d.ts index b60ab59ae5b..b9ec2febe5b 100644 --- a/crates/cli/tests/reference/web-sys.d.ts +++ b/crates/cli/tests/reference/web-sys.d.ts @@ -1,12 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -/** - * @returns {URL} - */ export function get_url(): URL; -/** - * @returns {MediaSourceEnum} - */ export function get_media_source(): MediaSourceEnum; /** *The `MediaSourceEnum` enum. From 5e98a17da61dcc59b16b6fcb52f9d96517518025 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 13 Oct 2024 22:15:40 +0200 Subject: [PATCH 523/641] Only generate JS values for string enums if used (#4193) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/binding.rs | 4 ++++ crates/cli-support/src/js/mod.rs | 25 ++++++++++++++++++++----- crates/cli/tests/reference/enums.js | 4 ---- crates/cli/tests/reference/web-sys.js | 2 -- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d28bef07beb..1d0fb027cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ * Fixed methods with `self: &Self` consuming the object. [#4178](https://github.com/rustwasm/wasm-bindgen/pull/4178) +* Fixed unused string enums generating JS values. + [#4193](https://github.com/rustwasm/wasm-bindgen/pull/4193) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 50d993c3f9f..ccbfea09141 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -701,6 +701,7 @@ fn instruction( Instruction::WasmToStringEnum { name } => { let index = js.pop(); + js.cx.expose_string_enum(name); js.push(wasm_to_string_enum(name, &index)) } @@ -709,11 +710,13 @@ fn instruction( // ["a","b","c"][index], the lookup will implicitly return map // the hole to undefined, because OOB indexes will return undefined. let index = js.pop(); + js.cx.expose_string_enum(name); js.push(wasm_to_string_enum(name, &index)) } Instruction::StringEnumToWasm { name, invalid } => { let enum_val = js.pop(); + js.cx.expose_string_enum(name); js.push(string_enum_to_wasm(name, *invalid, &enum_val)) } @@ -723,6 +726,7 @@ fn instruction( hole, } => { let enum_val = js.pop(); + js.cx.expose_string_enum(name); let enum_val_expr = string_enum_to_wasm(name, *invalid, &enum_val); js.cx.expose_is_like_none(); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 22bd9246e6a..1055cf43905 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -52,6 +52,13 @@ pub struct Context<'a> { /// function signatures, etc. typescript_refs: HashSet, + /// String enums that are used internally by the generated bindings. + /// + /// This tracks which string enums are used independently from whether their + /// type is used, because users may only use them in a way that doesn't + /// require the type or requires only the type. + used_string_enums: HashSet, + exported_classes: Option>, /// A map of the name of npm dependencies we've loaded so far to the path @@ -114,6 +121,7 @@ impl<'a> Context<'a> { defined_identifiers: Default::default(), wasm_import_definitions: Default::default(), typescript_refs: Default::default(), + used_string_enums: Default::default(), exported_classes: Some(Default::default()), config, threads_enabled: config.threads.is_enabled(module), @@ -3852,15 +3860,22 @@ __wbg_set_wasm(wasm);" self.typescript.push_str(";\n"); } - self.global(&format!( - "const __wbindgen_enum_{name} = [{values}];\n", - name = string_enum.name, - values = variants.join(", ") - )); + if self.used_string_enums.contains(&string_enum.name) { + // only generate the internal string enum array if it's actually used + self.global(&format!( + "const __wbindgen_enum_{name} = [{values}];\n", + name = string_enum.name, + values = variants.join(", ") + )); + } Ok(()) } + fn expose_string_enum(&mut self, string_enum_name: &str) { + self.used_string_enums.insert(string_enum_name.to_string()); + } + fn generate_struct(&mut self, struct_: &AuxStruct) -> Result<(), Error> { let class = require_class(&mut self.exported_classes, &struct_.name); class.comments = format_doc_comments(&struct_.comments, None); diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 0af1ffd6404..dd9d482ce6b 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -83,10 +83,6 @@ export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42 const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; -const __wbindgen_enum_FooBar = ["foo", "bar"]; - -const __wbindgen_enum_PrivateStringEnum = ["foo", "bar"]; - export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 7e4cc173aa7..12bc6777d2e 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -210,8 +210,6 @@ function handleError(f, args) { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -const __wbindgen_enum_MediaSourceReadyState = ["closed", "open", "ended"]; - export function __wbg_new_1cabf49927794f50() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); From 3b46cbe5b26011d4eb705d1344242d93c61f0545 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 13 Oct 2024 23:30:22 +0200 Subject: [PATCH 524/641] Fix triggering lints in testing facilities (#4195) --- CHANGELOG.md | 3 ++ crates/test-macro/src/lib.rs | 16 +++++----- crates/test/src/lib.rs | 60 +++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0fb027cb7..511f27575be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * Fixed unused string enums generating JS values. [#4193](https://github.com/rustwasm/wasm-bindgen/pull/4193) +* Fixed triggering lints in testing facilities. + [#4195](https://github.com/rustwasm/wasm-bindgen/pull/4195) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 0f86888fc33..094427f2deb 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -111,13 +111,15 @@ pub fn wasm_bindgen_test( let wasm_bindgen_path = attributes.wasm_bindgen_path; tokens.extend( quote! { - #[no_mangle] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] - pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { - let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); - #test_body - } + const _: () = { + #[no_mangle] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { + let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); + #test_body + } + }; }, ); diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index 2827dbcbe4d..b5219fbf76c 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -56,40 +56,52 @@ macro_rules! console_log { #[macro_export] macro_rules! wasm_bindgen_test_configure { (run_in_browser $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_RUN_IN_BROWSER: [u8; 1] = [0x01]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_BROWSER: [u8; 1] = [0x01]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); (run_in_worker $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_RUN_IN_DEDICATED_WORKER: [u8; 1] = [0x02]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_DEDICATED_WORKER: [u8; 1] = [0x02]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); (run_in_dedicated_worker $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_RUN_IN_DEDICATED_WORKER: [u8; 1] = [0x02]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_DEDICATED_WORKER: [u8; 1] = [0x02]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); (run_in_shared_worker $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_RUN_IN_SHARED_WORKER: [u8; 1] = [0x03]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_SHARED_WORKER: [u8; 1] = [0x03]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); (run_in_service_worker $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_RUN_IN_SERVICE_WORKER: [u8; 1] = [0x04]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_RUN_IN_SERVICE_WORKER: [u8; 1] = [0x04]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); (run_in_node_experimental $($others:tt)*) => ( - #[link_section = "__wasm_bindgen_test_unstable"] - #[cfg(target_arch = "wasm32")] - pub static __WBG_TEST_run_in_node_experimental: [u8; 1] = [0x05]; - $crate::wasm_bindgen_test_configure!($($others)*); + const _: () = { + #[link_section = "__wasm_bindgen_test_unstable"] + #[cfg(target_arch = "wasm32")] + pub static __WBG_TEST_run_in_node_experimental: [u8; 1] = [0x05]; + $crate::wasm_bindgen_test_configure!($($others)*); + }; ); () => () } From a69e9cc1b731705341e50c68c33882bc05eab399 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 14 Oct 2024 00:00:24 +0200 Subject: [PATCH 525/641] Fix `#[should_panic]` with `unsupported` tests (#4196) --- CHANGELOG.md | 3 +++ crates/test-macro/src/lib.rs | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 511f27575be..d066a6eddde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ * Fixed triggering lints in testing facilities. [#4195](https://github.com/rustwasm/wasm-bindgen/pull/4195) +* Fixed `#[should_panic]` not working with `#[wasm_bindgen_test(unsupported = ...)]`. + [#4196](https://github.com/rustwasm/wasm-bindgen/pull/4196) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 094427f2deb..d0cd7a5fc2c 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -82,7 +82,7 @@ pub fn wasm_bindgen_test( let mut tokens = Vec::::new(); - let should_panic = match should_panic { + let should_panic_par = match &should_panic { Some(Some(lit)) => { quote! { ::core::option::Option::Some(::core::option::Option::Some(#lit)) } } @@ -99,9 +99,9 @@ pub fn wasm_bindgen_test( }; let test_body = if attributes.r#async { - quote! { cx.execute_async(test_name, #ident, #should_panic, #ignore); } + quote! { cx.execute_async(test_name, #ident, #should_panic_par, #ignore); } } else { - quote! { cx.execute_sync(test_name, #ident, #should_panic, #ignore); } + quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore); } }; // We generate a `#[no_mangle]` with a known prefix so the test harness can @@ -127,6 +127,18 @@ pub fn wasm_bindgen_test( tokens.extend( quote! { #[cfg_attr(not(all(target_arch = "wasm32", target_os = "unknown")), #path)] }, ); + + if let Some(should_panic) = should_panic { + let should_panic = if let Some(lit) = should_panic { + quote! { should_panic = #lit } + } else { + quote! { should_panic } + }; + + tokens.extend( + quote! { #[cfg_attr(not(all(target_arch = "wasm32", target_os = "unknown")), #should_panic)] } + ) + } } tokens.extend(leading_tokens); From ae1d1055758a8b3fb9b7294e67b59067992756df Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 14 Oct 2024 09:52:47 +0200 Subject: [PATCH 526/641] Make CI deterministic try 2 (#4190) --- crates/cli-support/src/externref.rs | 4 +- crates/cli-support/src/js/mod.rs | 157 ++++++++++++++---- crates/cli-support/src/multivalue.rs | 2 +- crates/cli-support/src/wit/mod.rs | 6 +- crates/cli-support/src/wit/standard.rs | 8 +- .../tests/reference/anyref-import-catch.js | 42 ++--- .../tests/reference/anyref-import-catch.wat | 2 +- crates/cli/tests/reference/raw.js | 66 ++++---- crates/cli/tests/reference/web-sys.js | 86 +++++----- crates/cli/tests/reference/web-sys.wat | 2 +- 10 files changed, 233 insertions(+), 142 deletions(-) diff --git a/crates/cli-support/src/externref.rs b/crates/cli-support/src/externref.rs index a7803313541..845780c844f 100644 --- a/crates/cli-support/src/externref.rs +++ b/crates/cli-support/src/externref.rs @@ -26,7 +26,7 @@ pub fn process(module: &mut Module) -> Result<()> { // Transform all exported functions in the module, using the bindings listed // for each exported function. - for (id, adapter) in crate::sorted_iter_mut(&mut section.adapters) { + for (id, adapter) in &mut section.adapters { let instructions = match &mut adapter.kind { AdapterKind::Local { instructions } => instructions, AdapterKind::Import { .. } => continue, @@ -78,7 +78,7 @@ pub fn process(module: &mut Module) -> Result<()> { // Additionally we may need to update some adapter instructions other than // those found for the externref pass. These are some general "fringe support" // things necessary to get absolutely everything working. - for (_, adapter) in crate::sorted_iter_mut(&mut section.adapters) { + for adapter in &mut section.adapters.values_mut() { let instrs = match &mut adapter.kind { AdapterKind::Local { instructions } => instructions, AdapterKind::Import { .. } => continue, diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 1055cf43905..a0adfe4e627 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -325,7 +325,7 @@ impl<'a> Context<'a> { wasm_import_object.push_str(&format!(" {}: {{\n", crate::PLACEHOLDER_MODULE)); - for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { + for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { let import = self.module.imports.get(*id); wasm_import_object.push_str(&format!("{}: {},\n", &import.name, js.trim())); } @@ -424,8 +424,8 @@ impl<'a> Context<'a> { js.push_str("let wasm;\n"); - for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { - let import = self.module.imports.get_mut(*id); + for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { + let import = self.module.imports.get(*id); footer.push_str("\nmodule.exports."); footer.push_str(&import.name); footer.push_str(" = "); @@ -463,7 +463,7 @@ impl<'a> Context<'a> { // and let the bundler/runtime take care of it. // With Node we manually read the Wasm file from the filesystem and instantiate it. OutputMode::Bundler { .. } | OutputMode::Node { module: true } => { - for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { + for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { let import = self.module.imports.get_mut(*id); import.module = format!("./{}_bg.js", module_name); if let Some(body) = js.strip_prefix("function") { @@ -791,7 +791,7 @@ __wbg_set_wasm(wasm);" imports_init.push_str(module_name); imports_init.push_str(" = {};\n"); - for (id, js) in crate::sorted_iter(&self.wasm_import_definitions) { + for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { let import = self.module.imports.get_mut(*id); import.module = module_name.to_string(); imports_init.push_str("imports."); @@ -2531,12 +2531,13 @@ __wbg_set_wasm(wasm);" if self.config.symbol_dispose && !self.aux.structs.is_empty() { self.expose_symbol_dispose()?; } - for (id, adapter) in crate::sorted_iter(&self.wit.adapters) { + + for (id, adapter, kind) in iter_adapeter(self.aux, self.wit, self.module) { let instrs = match &adapter.kind { AdapterKind::Import { .. } => continue, AdapterKind::Local { instructions } => instructions, }; - self.generate_adapter(*id, adapter, instrs)?; + self.generate_adapter(id, adapter, instrs, kind)?; } let mut pairs = self.aux.export_map.iter().collect::>(); @@ -2614,26 +2615,10 @@ __wbg_set_wasm(wasm);" id: AdapterId, adapter: &Adapter, instrs: &[InstructionData], + kind: ContextAdapterKind, ) -> Result<(), Error> { - enum Kind<'a> { - Export(&'a AuxExport), - Import(walrus::ImportId), - Adapter, - } - - let kind = match self.aux.export_map.get(&id) { - Some(export) => Kind::Export(export), - None => { - let core = self.wit.implements.iter().find(|pair| pair.2 == id); - match core { - Some((core, _, _)) => Kind::Import(*core), - None => Kind::Adapter, - } - } - }; - let catch = self.aux.imports_with_catch.contains(&id); - if let Kind::Import(core) = kind { + if let ContextAdapterKind::Import(core) = kind { if !catch && self.attempt_direct_import(core, instrs)? { return Ok(()); } @@ -2643,8 +2628,8 @@ __wbg_set_wasm(wasm);" // export that we're generating. let mut builder = binding::Builder::new(self); builder.log_error(match kind { - Kind::Export(_) | Kind::Adapter => false, - Kind::Import(_) => builder.cx.config.debug, + ContextAdapterKind::Export(_) | ContextAdapterKind::Adapter => false, + ContextAdapterKind::Import(_) => builder.cx.config.debug, }); builder.catch(catch); let mut arg_names = &None; @@ -2652,7 +2637,7 @@ __wbg_set_wasm(wasm);" let mut variadic = false; let mut generate_jsdoc = false; match kind { - Kind::Export(export) => { + ContextAdapterKind::Export(export) => { arg_names = &export.arg_names; asyncness = export.asyncness; variadic = export.variadic; @@ -2667,8 +2652,8 @@ __wbg_set_wasm(wasm);" }, } } - Kind::Import(_) => {} - Kind::Adapter => {} + ContextAdapterKind::Import(_) => {} + ContextAdapterKind::Adapter => {} } // Process the `binding` and generate a bunch of JS/TypeScript/etc. @@ -2692,15 +2677,19 @@ __wbg_set_wasm(wasm);" generate_jsdoc, ) .with_context(|| match kind { - Kind::Export(e) => format!("failed to generate bindings for `{}`", e.debug_name), - Kind::Import(i) => { + ContextAdapterKind::Export(e) => { + format!("failed to generate bindings for `{}`", e.debug_name) + } + ContextAdapterKind::Import(i) => { let i = builder.cx.module.imports.get(i); format!( "failed to generate bindings for import of `{}::{}`", i.module, i.name ) } - Kind::Adapter => "failed to generates bindings for adapter".to_string(), + ContextAdapterKind::Adapter => { + "failed to generates bindings for adapter".to_string() + } })?; self.typescript_refs.extend(ts_refs); @@ -2708,7 +2697,7 @@ __wbg_set_wasm(wasm);" // Once we've got all the JS then put it in the right location depending // on what's being exported. match kind { - Kind::Export(export) => { + ContextAdapterKind::Export(export) => { assert!(!catch); assert!(!log_error); @@ -2795,7 +2784,7 @@ __wbg_set_wasm(wasm);" } } } - Kind::Import(core) => { + ContextAdapterKind::Import(core) => { let code = if catch { format!( "function() {{ return handleError(function {}, arguments) }}", @@ -2812,7 +2801,7 @@ __wbg_set_wasm(wasm);" self.wasm_import_definitions.insert(core, code); } - Kind::Adapter => { + ContextAdapterKind::Adapter => { assert!(!catch); assert!(!log_error); @@ -4137,6 +4126,102 @@ __wbg_set_wasm(wasm);" } } +/// A categorization of adapters for the purpose of code generation. +/// +/// This is different from [`AdapterKind`] and is only used internally in the +/// code generation process. +enum ContextAdapterKind<'a> { + /// An exported function, method, constrctor, or getter/setter. + Export(&'a AuxExport), + /// An imported function or intrinsic. + Import(walrus::ImportId), + Adapter, +} +impl<'a> ContextAdapterKind<'a> { + fn get(id: AdapterId, aux: &'a WasmBindgenAux, wit: &'a NonstandardWitSection) -> Self { + match aux.export_map.get(&id) { + Some(export) => ContextAdapterKind::Export(export), + None => { + let core = wit.implements.iter().find(|pair| pair.2 == id); + match core { + Some((core, _, _)) => ContextAdapterKind::Import(*core), + None => ContextAdapterKind::Adapter, + } + } + } + } +} + +/// Iterate over the adapters in a deterministic order. +fn iter_adapeter<'a>( + aux: &'a WasmBindgenAux, + wit: &'a NonstandardWitSection, + module: &Module, +) -> Vec<(AdapterId, &'a Adapter, ContextAdapterKind<'a>)> { + let mut adapters: Vec<_> = wit + .adapters + .iter() + .map(|(id, adapter)| { + // we need the kind of the adapter to properly sort them + let kind = ContextAdapterKind::get(*id, aux, wit); + (*id, adapter, kind) + }) + .collect(); + + // Since `wit.adapters` is a BTreeMap, the adapters are already sorted by + // their ID. This is good enough for exports and adapters, but imports need + // to be sorted by their name. + // + // Note: we do *NOT* want to sort exports by name. By default, exports are + // the order in which they were defined in the Rust code. Sorting them by + // name would break that order and take away control from the user. + + adapters.sort_by(|(_, _, a), (_, _, b)| { + fn get_kind_order(kind: &ContextAdapterKind) -> u8 { + match kind { + ContextAdapterKind::Import(_) => 0, + ContextAdapterKind::Export(_) => 1, + ContextAdapterKind::Adapter => 2, + } + } + + match (a, b) { + (ContextAdapterKind::Import(a), ContextAdapterKind::Import(b)) => { + let a = module.imports.get(*a); + let b = module.imports.get(*b); + a.name.cmp(&b.name) + } + _ => get_kind_order(a).cmp(&get_kind_order(b)), + } + }); + + adapters +} + +/// Iterate over the imports in a deterministic order. +fn iter_by_import<'a, T>( + map: &'a HashMap, + module: &Module, +) -> Vec<(&'a ImportId, &'a T)> { + let mut items: Vec<_> = map.iter().collect(); + + // Sort by import name. + // + // Imports have a name and a module, and it's important that we *ignore* + // the module. The module of an import is set to its final value *during* + // code generation, so using it here would cause the imports to be sorted + // differently depending on which part of the code generation process we're + // in. + items.sort_by(|&(a, _), &(b, _)| { + let a = module.imports.get(*a); + let b = module.imports.get(*b); + + a.name.cmp(&b.name) + }); + + items +} + fn check_duplicated_getter_and_setter_names( exports: &[(&AdapterId, &AuxExport)], ) -> Result<(), Error> { diff --git a/crates/cli-support/src/multivalue.rs b/crates/cli-support/src/multivalue.rs index a49875381bf..cc0194a6aea 100644 --- a/crates/cli-support/src/multivalue.rs +++ b/crates/cli-support/src/multivalue.rs @@ -14,7 +14,7 @@ pub fn run(module: &mut Module) -> Result<(), Error> { let mut to_xform = Vec::new(); let mut slots = Vec::new(); - for (_, adapter) in crate::sorted_iter_mut(&mut adapters.adapters) { + for adapter in adapters.adapters.values_mut() { extract_xform(module, adapter, &mut to_xform, &mut slots); } if to_xform.is_empty() { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index f6b3e413712..3e3e355c366 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -4,7 +4,7 @@ use crate::descriptors::WasmBindgenDescriptorsSection; use crate::intrinsic::Intrinsic; use crate::{decode, Bindgen, PLACEHOLDER_MODULE}; use anyhow::{anyhow, bail, Error}; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeSet, HashMap}; use std::str; use walrus::MemoryId; use walrus::{ExportId, FunctionId, ImportId, Module}; @@ -106,7 +106,9 @@ impl<'a> Context<'a> { // location listed of what to import there for each item. let mut intrinsics = Vec::new(); let mut duplicate_import_map = HashMap::new(); - let mut imports_to_delete = HashSet::new(); + // The order in which imports are deleted later might matter, so we + // use an ordered set here to make everything deterministic. + let mut imports_to_delete = BTreeSet::new(); for import in self.module.imports.iter() { if import.module != PLACEHOLDER_MODULE { continue; diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index c96430c6411..eeadd1a69f8 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -1,13 +1,17 @@ use crate::descriptor::VectorKind; use crate::wit::{AuxImport, WasmBindgenAux}; use std::borrow::Cow; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, HashSet}; use walrus::{FunctionId, ImportId, RefType, TypedCustomSectionId}; #[derive(Default, Debug)] pub struct NonstandardWitSection { /// A list of adapter functions, keyed by their id. - pub adapters: HashMap, + /// + /// This map is iterated over in multiple places, so we use an ordered map + /// to ensure that the order of iteration is deterministic. This map affects + /// all parts of the generated code, so it's important to get this right. + pub adapters: BTreeMap, /// A list of pairs for adapter functions that implement core Wasm imports. pub implements: Vec<(ImportId, FunctionId, AdapterId)>, diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index d89f629f896..f8e28d8db96 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -4,6 +4,21 @@ export function __wbg_set_wasm(val) { } +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); + } +} + const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -24,21 +39,6 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -function addToExternrefTable0(obj) { - const idx = wasm.__externref_table_alloc(); - wasm.__wbindgen_export_0.set(idx, obj); - return idx; -} - -function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - const idx = addToExternrefTable0(e); - wasm.__wbindgen_exn_store(idx); - } -} - let cachedDataViewMemory0 = null; function getDataViewMemory0() { @@ -49,7 +49,7 @@ function getDataViewMemory0() { } function takeFromExternrefTable0(idx) { - const value = wasm.__wbindgen_export_0.get(idx); + const value = wasm.__wbindgen_export_2.get(idx); wasm.__externref_table_dealloc(idx); return value; } @@ -72,12 +72,8 @@ export function __wbg_foo_95fe1a04017077db() { return handleError(function () { foo(); }, arguments) }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_init_externref_table() { - const table = wasm.__wbindgen_export_0; + const table = wasm.__wbindgen_export_2; const offset = table.grow(4); table.set(0, undefined); table.set(offset + 0, undefined); @@ -87,3 +83,7 @@ export function __wbindgen_init_externref_table() { ; }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index fd4ba663d5e..7338f544d0a 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -13,9 +13,9 @@ (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) - (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__wbindgen_export_2" (table 0)) (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__externref_table_dealloc" (func $__externref_table_dealloc)) (export "__wbindgen_start" (func 0)) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index 6c6e36065ee..d81276a6816 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -6,34 +6,23 @@ export function __wbg_set_wasm(val) { } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); +const heap = new Array(128).fill(undefined); -cachedTextDecoder.decode(); +heap.push(undefined, null, true, false); -let cachedUint8ArrayMemory0 = null; +let heap_next = heap.length; -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); + heap[idx] = obj; + return idx; } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - function getObject(idx) { return heap[idx]; } -let heap_next = heap.length; - function dropObject(idx) { if (idx < 132) return; heap[idx] = heap_next; @@ -45,6 +34,26 @@ function takeObject(idx) { dropObject(idx); return ret; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {number} test * @returns {number} @@ -54,15 +63,6 @@ export function test1(test) { return ret >>> 0; } -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - const TestFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_test_free(ptr >>> 0, 1)); @@ -109,11 +109,11 @@ export function __wbg_test2_39fe629b9aa739cf() { return addHeapObject(ret); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 12bc6777d2e..a1f36a5d0f0 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -4,10 +4,49 @@ export function __wbg_set_wasm(val) { } +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); +let heap_next = heap.length; + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } +} + function getObject(idx) { return heap[idx]; } function debugString(val) { @@ -77,15 +116,6 @@ function debugString(val) { let WASM_VECTOR_LEN = 0; -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; let cachedTextEncoder = new lTextEncoder('utf-8'); @@ -151,19 +181,6 @@ function getDataViewMemory0() { return cachedDataViewMemory0; } -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - -let heap_next = heap.length; - function dropObject(idx) { if (idx < 132) return; heap[idx] = heap_next; @@ -191,23 +208,6 @@ export function get_media_source() { return __wbindgen_enum_MediaSourceEnum[ret]; } -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); - } -} - const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; export function __wbg_new_1cabf49927794f50() { return handleError(function (arg0, arg1) { @@ -223,11 +223,11 @@ export function __wbindgen_debug_string(arg0, arg1) { getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; -export function __wbindgen_throw(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); -}; - export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/web-sys.wat b/crates/cli/tests/reference/web-sys.wat index eefb7ad3e97..b4993ed4ac3 100644 --- a/crates/cli/tests/reference/web-sys.wat +++ b/crates/cli/tests/reference/web-sys.wat @@ -12,9 +12,9 @@ (export "memory" (memory 0)) (export "get_url" (func $get_url)) (export "get_media_source" (func $get_media_source)) + (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) - (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") ) From d6406e12fd385f33eee54686ec9130928cbe6e8b Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 14 Oct 2024 10:05:19 +0200 Subject: [PATCH 527/641] Fix potential `null` error in `JsValue::as_debug_string()` (#4192) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 3 +-- crates/cli/tests/reference/web-sys.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d066a6eddde..2593781fb3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ * Fixed `#[should_panic]` not working with `#[wasm_bindgen_test(unsupported = ...)]`. [#4196](https://github.com/rustwasm/wasm-bindgen/pull/4196) +* Fixed potential `null` error when using `JsValue::as_debug_string()`. + [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index a0adfe4e627..8b8cc9aaf50 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1958,7 +1958,6 @@ __wbg_set_wasm(wasm);" if (!(instance instanceof klass)) { throw new Error(`expected instance of ${klass.name}`); } - return instance.ptr; } ", ); @@ -3986,7 +3985,7 @@ __wbg_set_wasm(wasm);" // Test for built-in const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val)); let className; - if (builtInMatches.length > 1) { + if (builtInMatches && builtInMatches.length > 1) { className = builtInMatches[1]; } else { // Failed to match the standard '[object ClassName]' diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index a1f36a5d0f0..4ef9ffbab71 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -90,7 +90,7 @@ function debugString(val) { // Test for built-in const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); let className; - if (builtInMatches.length > 1) { + if (builtInMatches && builtInMatches.length > 1) { className = builtInMatches[1]; } else { // Failed to match the standard '[object ClassName]' From edf30811d31fe7a35bbc4adb759eee5d7a2f0663 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 14 Oct 2024 10:25:03 +0200 Subject: [PATCH 528/641] Fix link to Node.js module documentation (#4197) --- guide/src/reference/deployment.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guide/src/reference/deployment.md b/guide/src/reference/deployment.md index fd6f5f23390..37a3923dda0 100644 --- a/guide/src/reference/deployment.md +++ b/guide/src/reference/deployment.md @@ -22,6 +22,7 @@ The methods of deployment and integration here are primarily tied to the [`no-modules`]: #without-a-bundler [`nodejs`]: #nodejs [`deno`]: #deno +[`experimental-nodejs-module`]: #nodejs-module ## Bundlers From 959330026b7e5d0445ab8886c81f952e510f6281 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 15 Oct 2024 22:12:56 +0200 Subject: [PATCH 529/641] Added missing space in doc comments (#4200) --- crates/cli-support/src/js/mod.rs | 7 ++++++- crates/cli/tests/reference/web-sys.d.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 8b8cc9aaf50..929f2787f7f 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -4297,7 +4297,12 @@ fn check_duplicated_getter_and_setter_names( fn format_doc_comments(comments: &str, js_doc_comments: Option) -> String { let body: String = comments.lines().fold(String::new(), |mut output, c| { - let _ = writeln!(output, " *{}", c); + output.push_str(" *"); + if !c.is_empty() && !c.starts_with(' ') { + output.push(' '); + } + output.push_str(c); + output.push('\n'); output }); let doc = if let Some(docs) = js_doc_comments { diff --git a/crates/cli/tests/reference/web-sys.d.ts b/crates/cli/tests/reference/web-sys.d.ts index b9ec2febe5b..4ba47beb695 100644 --- a/crates/cli/tests/reference/web-sys.d.ts +++ b/crates/cli/tests/reference/web-sys.d.ts @@ -3,8 +3,8 @@ export function get_url(): URL; export function get_media_source(): MediaSourceEnum; /** - *The `MediaSourceEnum` enum. + * The `MediaSourceEnum` enum. * - **This API requires the following crate features to be activated: `MediaSourceEnum`* + * *This API requires the following crate features to be activated: `MediaSourceEnum`* */ type MediaSourceEnum = "camera" | "screen" | "application" | "window" | "browser" | "microphone" | "audioCapture" | "other"; From e37a1ddc183fb8186ecb26dc31320cb13431e23a Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Wed, 16 Oct 2024 00:04:39 +0200 Subject: [PATCH 530/641] Add `MathMLElement` and `HTMLOrSVGElement` bindings (#4143) --- CHANGELOG.md | 11 + crates/web-sys/Cargo.toml | 1 + .../src/features/gen_HtmlButtonElement.rs | 6 + .../web-sys/src/features/gen_HtmlElement.rs | 88 +- .../src/features/gen_HtmlInputElement.rs | 6 + .../src/features/gen_HtmlSelectElement.rs | 6 + .../src/features/gen_HtmlTextAreaElement.rs | 6 + .../web-sys/src/features/gen_MathMlElement.rs | 1327 +++++++++++++++++ crates/web-sys/src/features/gen_SvgElement.rs | 96 +- crates/web-sys/src/features/mod.rs | 7 + crates/web-sys/webidls/enabled/Element.webidl | 17 + .../webidls/enabled/HTMLButtonElement.webidl | 2 +- .../webidls/enabled/HTMLElement.webidl | 11 +- .../webidls/enabled/HTMLInputElement.webidl | 2 +- .../webidls/enabled/HTMLSelectElement.webidl | 2 +- .../enabled/HTMLTextAreaElement.webidl | 2 +- .../webidls/enabled/MathMLElement.webidl | 14 + .../web-sys/webidls/enabled/SVGElement.webidl | 10 +- 18 files changed, 1534 insertions(+), 80 deletions(-) create mode 100644 crates/web-sys/src/features/gen_MathMlElement.rs create mode 100644 crates/web-sys/webidls/enabled/MathMLElement.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index 2593781fb3c..17f22e7337e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ ## Unreleased +### Added + +* Added support for the [`HTMLOrSVGElement`](https://html.spec.whatwg.org/#htmlorsvgelement) `mixin`, which is used for all interfaces deriving from `Element`. + [#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143) + +* Added bindings for [MathMLElement](https://www.w3.org/TR/MathML3). + [#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143) + ### Changed * String enums now generate private TypeScript types but only if used. @@ -11,6 +19,9 @@ * Remove unnecessary JSDoc type annotations from generated `.d.ts` files [#4187](https://github.com/rustwasm/wasm-bindgen/pull/4187) +* Deprecate `autofocus`, `tabIndex`, `focus()` and `blur()` bindings in favor of bindings on the inherited `Element` class. + [#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 20af4112013..f8929d4865b 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -790,6 +790,7 @@ LockManager = [] LockManagerSnapshot = [] LockMode = [] LockOptions = [] +MathMlElement = ["Element", "EventTarget", "Node"] MediaCapabilities = [] MediaCapabilitiesInfo = [] MediaConfiguration = [] diff --git a/crates/web-sys/src/features/gen_HtmlButtonElement.rs b/crates/web-sys/src/features/gen_HtmlButtonElement.rs index 70127fbb0c7..b5c9fef4aac 100644 --- a/crates/web-sys/src/features/gen_HtmlButtonElement.rs +++ b/crates/web-sys/src/features/gen_HtmlButtonElement.rs @@ -18,6 +18,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn autofocus(this: &HtmlButtonElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = autofocus)] #[doc = "Setter for the `autofocus` field of this object."] @@ -25,6 +28,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn set_autofocus(this: &HtmlButtonElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = disabled)] #[doc = "Getter for the `disabled` field of this object."] diff --git a/crates/web-sys/src/features/gen_HtmlElement.rs b/crates/web-sys/src/features/gen_HtmlElement.rs index 0de35b5e951..51738e1ba88 100644 --- a/crates/web-sys/src/features/gen_HtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlElement.rs @@ -82,14 +82,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_dir(this: &HtmlElement, value: &str); - #[cfg(feature = "DomStringMap")] - # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = dataset)] - #[doc = "Getter for the `dataset` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `HtmlElement`*"] - pub fn dataset(this: &HtmlElement) -> DomStringMap; # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = innerText)] #[doc = "Getter for the `innerText` field of this object."] #[doc = ""] @@ -132,20 +124,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_inert(this: &HtmlElement, value: bool); - # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = tabIndex)] - #[doc = "Getter for the `tabIndex` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn tab_index(this: &HtmlElement) -> i32; - # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = tabIndex)] - #[doc = "Setter for the `tabIndex` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn set_tab_index(this: &HtmlElement, value: i32); # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = accessKey)] #[doc = "Getter for the `accessKey` field of this object."] #[doc = ""] @@ -230,14 +208,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_spellcheck(this: &HtmlElement, value: bool); - #[cfg(feature = "CssStyleDeclaration")] - # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = style)] - #[doc = "Getter for the `style` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`, `HtmlElement`*"] - pub fn style(this: &HtmlElement) -> CssStyleDeclaration; # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = offsetParent)] #[doc = "Getter for the `offsetParent` field of this object."] #[doc = ""] @@ -315,6 +285,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_onpaste(this: &HtmlElement, value: Option<&::js_sys::Function>); + #[cfg(feature = "CssStyleDeclaration")] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = style)] + #[doc = "Getter for the `style` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`, `HtmlElement`*"] + pub fn style(this: &HtmlElement) -> CssStyleDeclaration; # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = onabort)] #[doc = "Getter for the `onabort` field of this object."] #[doc = ""] @@ -1477,6 +1455,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] pub fn set_onwebkittransitionend(this: &HtmlElement, value: Option<&::js_sys::Function>); + #[cfg(feature = "DomStringMap")] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = dataset)] + #[doc = "Getter for the `dataset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `HtmlElement`*"] + pub fn dataset(this: &HtmlElement) -> DomStringMap; + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = nonce)] + #[doc = "Getter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn nonce(this: &HtmlElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = nonce)] + #[doc = "Setter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_nonce(this: &HtmlElement, value: &str); + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = autofocus)] + #[doc = "Getter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn autofocus(this: &HtmlElement) -> bool; + # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLElement" , js_name = autofocus)] + #[doc = "Setter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_autofocus(this: &HtmlElement, value: bool) -> Result<(), JsValue>; + # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = tabIndex)] + #[doc = "Getter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn tab_index(this: &HtmlElement) -> i32; + # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = tabIndex)] + #[doc = "Setter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] + pub fn set_tab_index(this: &HtmlElement, value: i32); # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = onerror)] #[doc = "Getter for the `onerror` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlInputElement.rs b/crates/web-sys/src/features/gen_HtmlInputElement.rs index e91e812b561..3e787c52a25 100644 --- a/crates/web-sys/src/features/gen_HtmlInputElement.rs +++ b/crates/web-sys/src/features/gen_HtmlInputElement.rs @@ -60,6 +60,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn autofocus(this: &HtmlInputElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = autofocus)] #[doc = "Setter for the `autofocus` field of this object."] @@ -67,6 +70,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn set_autofocus(this: &HtmlInputElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = defaultChecked)] #[doc = "Getter for the `defaultChecked` field of this object."] diff --git a/crates/web-sys/src/features/gen_HtmlSelectElement.rs b/crates/web-sys/src/features/gen_HtmlSelectElement.rs index f1124eca407..0cac37fcf46 100644 --- a/crates/web-sys/src/features/gen_HtmlSelectElement.rs +++ b/crates/web-sys/src/features/gen_HtmlSelectElement.rs @@ -18,6 +18,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn autofocus(this: &HtmlSelectElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSelectElement" , js_name = autofocus)] #[doc = "Setter for the `autofocus` field of this object."] @@ -25,6 +28,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn set_autofocus(this: &HtmlSelectElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLSelectElement" , js_name = autocomplete)] #[doc = "Getter for the `autocomplete` field of this object."] diff --git a/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs b/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs index 343281e153e..3192dda1955 100644 --- a/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs @@ -32,6 +32,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn autofocus(this: &HtmlTextAreaElement) -> bool; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = autofocus)] #[doc = "Setter for the `autofocus` field of this object."] @@ -39,6 +42,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/autofocus)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] + #[deprecated( + note = "Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead." + )] pub fn set_autofocus(this: &HtmlTextAreaElement, value: bool); # [wasm_bindgen (structural , method , getter , js_class = "HTMLTextAreaElement" , js_name = cols)] #[doc = "Getter for the `cols` field of this object."] diff --git a/crates/web-sys/src/features/gen_MathMlElement.rs b/crates/web-sys/src/features/gen_MathMlElement.rs new file mode 100644 index 00000000000..cd2ae11fa92 --- /dev/null +++ b/crates/web-sys/src/features/gen_MathMlElement.rs @@ -0,0 +1,1327 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = Element , extends = Node , extends = EventTarget , extends = :: js_sys :: Object , js_name = MathMLElement , typescript_type = "MathMLElement")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `MathMlElement` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub type MathMlElement; + #[cfg(feature = "CssStyleDeclaration")] + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = style)] + #[doc = "Getter for the `style` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/style)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`, `MathMlElement`*"] + pub fn style(this: &MathMlElement) -> CssStyleDeclaration; + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onabort)] + #[doc = "Getter for the `onabort` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onabort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onabort(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onabort)] + #[doc = "Setter for the `onabort` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onabort)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onabort(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onblur)] + #[doc = "Getter for the `onblur` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onblur)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onblur(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onblur)] + #[doc = "Setter for the `onblur` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onblur)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onblur(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onfocus)] + #[doc = "Getter for the `onfocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onfocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onfocus(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onfocus)] + #[doc = "Setter for the `onfocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onfocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onfocus(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onauxclick)] + #[doc = "Getter for the `onauxclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onauxclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onauxclick(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onauxclick)] + #[doc = "Setter for the `onauxclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onauxclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onauxclick(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onbeforetoggle)] + #[doc = "Getter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onbeforetoggle(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onbeforetoggle)] + #[doc = "Setter for the `onbeforetoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onbeforetoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onbeforetoggle(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = oncanplay)] + #[doc = "Getter for the `oncanplay` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncanplay)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn oncanplay(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = oncanplay)] + #[doc = "Setter for the `oncanplay` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncanplay)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_oncanplay(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = oncanplaythrough)] + #[doc = "Getter for the `oncanplaythrough` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncanplaythrough)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn oncanplaythrough(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = oncanplaythrough)] + #[doc = "Setter for the `oncanplaythrough` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncanplaythrough)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_oncanplaythrough(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onchange)] + #[doc = "Getter for the `onchange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onchange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onchange(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onchange)] + #[doc = "Setter for the `onchange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onchange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onchange(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onclick)] + #[doc = "Getter for the `onclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onclick(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onclick)] + #[doc = "Setter for the `onclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onclick(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onclose)] + #[doc = "Getter for the `onclose` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onclose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onclose(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onclose)] + #[doc = "Setter for the `onclose` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onclose)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onclose(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = oncontextmenu)] + #[doc = "Getter for the `oncontextmenu` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncontextmenu)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn oncontextmenu(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = oncontextmenu)] + #[doc = "Setter for the `oncontextmenu` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oncontextmenu)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_oncontextmenu(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondblclick)] + #[doc = "Getter for the `ondblclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondblclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondblclick(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondblclick)] + #[doc = "Setter for the `ondblclick` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondblclick)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondblclick(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondrag)] + #[doc = "Getter for the `ondrag` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondrag)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondrag(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondrag)] + #[doc = "Setter for the `ondrag` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondrag)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondrag(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragend)] + #[doc = "Getter for the `ondragend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragend)] + #[doc = "Setter for the `ondragend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragenter)] + #[doc = "Getter for the `ondragenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragenter(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragenter)] + #[doc = "Setter for the `ondragenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragenter(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragexit)] + #[doc = "Getter for the `ondragexit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragexit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragexit(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragexit)] + #[doc = "Setter for the `ondragexit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragexit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragexit(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragleave)] + #[doc = "Getter for the `ondragleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragleave(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragleave)] + #[doc = "Setter for the `ondragleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragleave(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragover)] + #[doc = "Getter for the `ondragover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragover(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragover)] + #[doc = "Setter for the `ondragover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragover(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondragstart)] + #[doc = "Getter for the `ondragstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondragstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondragstart)] + #[doc = "Setter for the `ondragstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondragstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondragstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondrop)] + #[doc = "Getter for the `ondrop` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondrop)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondrop(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondrop)] + #[doc = "Setter for the `ondrop` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondrop)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondrop(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ondurationchange)] + #[doc = "Getter for the `ondurationchange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondurationchange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ondurationchange(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ondurationchange)] + #[doc = "Setter for the `ondurationchange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ondurationchange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ondurationchange(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onemptied)] + #[doc = "Getter for the `onemptied` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onemptied)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onemptied(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onemptied)] + #[doc = "Setter for the `onemptied` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onemptied)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onemptied(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onended)] + #[doc = "Getter for the `onended` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onended)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onended(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onended)] + #[doc = "Setter for the `onended` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onended)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onended(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = oninput)] + #[doc = "Getter for the `oninput` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oninput)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn oninput(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = oninput)] + #[doc = "Setter for the `oninput` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oninput)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_oninput(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = oninvalid)] + #[doc = "Getter for the `oninvalid` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oninvalid)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn oninvalid(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = oninvalid)] + #[doc = "Setter for the `oninvalid` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/oninvalid)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_oninvalid(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onkeydown)] + #[doc = "Getter for the `onkeydown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeydown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onkeydown(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onkeydown)] + #[doc = "Setter for the `onkeydown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeydown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onkeydown(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onkeypress)] + #[doc = "Getter for the `onkeypress` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeypress)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onkeypress(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onkeypress)] + #[doc = "Setter for the `onkeypress` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeypress)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onkeypress(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onkeyup)] + #[doc = "Getter for the `onkeyup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeyup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onkeyup(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onkeyup)] + #[doc = "Setter for the `onkeyup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onkeyup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onkeyup(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onload)] + #[doc = "Getter for the `onload` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onload)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onload(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onload)] + #[doc = "Setter for the `onload` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onload)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onload(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onloadeddata)] + #[doc = "Getter for the `onloadeddata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadeddata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onloadeddata(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onloadeddata)] + #[doc = "Setter for the `onloadeddata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadeddata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onloadeddata(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onloadedmetadata)] + #[doc = "Getter for the `onloadedmetadata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadedmetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onloadedmetadata(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onloadedmetadata)] + #[doc = "Setter for the `onloadedmetadata` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadedmetadata)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onloadedmetadata(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onloadend)] + #[doc = "Getter for the `onloadend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onloadend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onloadend)] + #[doc = "Setter for the `onloadend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onloadend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onloadstart)] + #[doc = "Getter for the `onloadstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onloadstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onloadstart)] + #[doc = "Setter for the `onloadstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onloadstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onloadstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmousedown)] + #[doc = "Getter for the `onmousedown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmousedown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmousedown(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmousedown)] + #[doc = "Setter for the `onmousedown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmousedown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmousedown(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmouseenter)] + #[doc = "Getter for the `onmouseenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmouseenter(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmouseenter)] + #[doc = "Setter for the `onmouseenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmouseenter(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmouseleave)] + #[doc = "Getter for the `onmouseleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmouseleave(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmouseleave)] + #[doc = "Setter for the `onmouseleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmouseleave(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmousemove)] + #[doc = "Getter for the `onmousemove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmousemove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmousemove(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmousemove)] + #[doc = "Setter for the `onmousemove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmousemove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmousemove(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmouseout)] + #[doc = "Getter for the `onmouseout` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseout)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmouseout(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmouseout)] + #[doc = "Setter for the `onmouseout` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseout)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmouseout(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmouseover)] + #[doc = "Getter for the `onmouseover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmouseover(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmouseover)] + #[doc = "Setter for the `onmouseover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmouseover(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onmouseup)] + #[doc = "Getter for the `onmouseup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onmouseup(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onmouseup)] + #[doc = "Setter for the `onmouseup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onmouseup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onmouseup(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwheel)] + #[doc = "Getter for the `onwheel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwheel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwheel(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwheel)] + #[doc = "Setter for the `onwheel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwheel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwheel(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpause)] + #[doc = "Getter for the `onpause` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpause)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpause(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpause)] + #[doc = "Setter for the `onpause` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpause)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpause(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onplay)] + #[doc = "Getter for the `onplay` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onplay)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onplay(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onplay)] + #[doc = "Setter for the `onplay` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onplay)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onplay(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onplaying)] + #[doc = "Getter for the `onplaying` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onplaying)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onplaying(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onplaying)] + #[doc = "Setter for the `onplaying` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onplaying)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onplaying(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onprogress)] + #[doc = "Getter for the `onprogress` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onprogress)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onprogress(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onprogress)] + #[doc = "Setter for the `onprogress` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onprogress)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onprogress(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onratechange)] + #[doc = "Getter for the `onratechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onratechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onratechange(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onratechange)] + #[doc = "Setter for the `onratechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onratechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onratechange(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onreset)] + #[doc = "Getter for the `onreset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onreset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onreset(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onreset)] + #[doc = "Setter for the `onreset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onreset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onreset(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onresize)] + #[doc = "Getter for the `onresize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onresize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onresize(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onresize)] + #[doc = "Setter for the `onresize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onresize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onresize(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onscroll)] + #[doc = "Getter for the `onscroll` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onscroll)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onscroll(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onscroll)] + #[doc = "Setter for the `onscroll` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onscroll)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onscroll(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onseeked)] + #[doc = "Getter for the `onseeked` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onseeked)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onseeked(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onseeked)] + #[doc = "Setter for the `onseeked` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onseeked)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onseeked(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onseeking)] + #[doc = "Getter for the `onseeking` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onseeking)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onseeking(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onseeking)] + #[doc = "Setter for the `onseeking` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onseeking)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onseeking(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onselect)] + #[doc = "Getter for the `onselect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onselect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onselect(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onselect)] + #[doc = "Setter for the `onselect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onselect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onselect(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onshow)] + #[doc = "Getter for the `onshow` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onshow)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onshow(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onshow)] + #[doc = "Setter for the `onshow` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onshow)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onshow(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onstalled)] + #[doc = "Getter for the `onstalled` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onstalled)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onstalled(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onstalled)] + #[doc = "Setter for the `onstalled` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onstalled)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onstalled(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onsubmit)] + #[doc = "Getter for the `onsubmit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onsubmit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onsubmit(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onsubmit)] + #[doc = "Setter for the `onsubmit` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onsubmit)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onsubmit(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onsuspend)] + #[doc = "Getter for the `onsuspend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onsuspend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onsuspend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onsuspend)] + #[doc = "Setter for the `onsuspend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onsuspend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onsuspend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontimeupdate)] + #[doc = "Getter for the `ontimeupdate` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontimeupdate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontimeupdate(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontimeupdate)] + #[doc = "Setter for the `ontimeupdate` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontimeupdate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontimeupdate(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onvolumechange)] + #[doc = "Getter for the `onvolumechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onvolumechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onvolumechange(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onvolumechange)] + #[doc = "Setter for the `onvolumechange` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onvolumechange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onvolumechange(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwaiting)] + #[doc = "Getter for the `onwaiting` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwaiting)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwaiting(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwaiting)] + #[doc = "Setter for the `onwaiting` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwaiting)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwaiting(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onselectstart)] + #[doc = "Getter for the `onselectstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onselectstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onselectstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onselectstart)] + #[doc = "Setter for the `onselectstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onselectstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onselectstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontoggle)] + #[doc = "Getter for the `ontoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontoggle(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontoggle)] + #[doc = "Setter for the `ontoggle` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontoggle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontoggle(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointercancel)] + #[doc = "Getter for the `onpointercancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointercancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointercancel(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointercancel)] + #[doc = "Setter for the `onpointercancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointercancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointercancel(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerdown)] + #[doc = "Getter for the `onpointerdown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerdown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerdown(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerdown)] + #[doc = "Setter for the `onpointerdown` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerdown)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerdown(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerup)] + #[doc = "Getter for the `onpointerup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerup(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerup)] + #[doc = "Setter for the `onpointerup` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerup)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerup(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointermove)] + #[doc = "Getter for the `onpointermove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointermove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointermove(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointermove)] + #[doc = "Setter for the `onpointermove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointermove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointermove(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerout)] + #[doc = "Getter for the `onpointerout` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerout)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerout(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerout)] + #[doc = "Setter for the `onpointerout` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerout)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerout(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerover)] + #[doc = "Getter for the `onpointerover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerover(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerover)] + #[doc = "Setter for the `onpointerover` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerover)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerover(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerenter)] + #[doc = "Getter for the `onpointerenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerenter(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerenter)] + #[doc = "Setter for the `onpointerenter` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerenter)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerenter(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onpointerleave)] + #[doc = "Getter for the `onpointerleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onpointerleave(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onpointerleave)] + #[doc = "Setter for the `onpointerleave` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onpointerleave)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onpointerleave(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ongotpointercapture)] + #[doc = "Getter for the `ongotpointercapture` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ongotpointercapture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ongotpointercapture(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ongotpointercapture)] + #[doc = "Setter for the `ongotpointercapture` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ongotpointercapture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ongotpointercapture(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onlostpointercapture)] + #[doc = "Getter for the `onlostpointercapture` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onlostpointercapture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onlostpointercapture(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onlostpointercapture)] + #[doc = "Setter for the `onlostpointercapture` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onlostpointercapture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onlostpointercapture(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onanimationcancel)] + #[doc = "Getter for the `onanimationcancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationcancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onanimationcancel(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onanimationcancel)] + #[doc = "Setter for the `onanimationcancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationcancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onanimationcancel(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onanimationend)] + #[doc = "Getter for the `onanimationend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onanimationend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onanimationend)] + #[doc = "Setter for the `onanimationend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onanimationend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onanimationiteration)] + #[doc = "Getter for the `onanimationiteration` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationiteration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onanimationiteration(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onanimationiteration)] + #[doc = "Setter for the `onanimationiteration` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationiteration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onanimationiteration(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onanimationstart)] + #[doc = "Getter for the `onanimationstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onanimationstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onanimationstart)] + #[doc = "Setter for the `onanimationstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onanimationstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onanimationstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontransitioncancel)] + #[doc = "Getter for the `ontransitioncancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitioncancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontransitioncancel(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontransitioncancel)] + #[doc = "Setter for the `ontransitioncancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitioncancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontransitioncancel(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontransitionend)] + #[doc = "Getter for the `ontransitionend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontransitionend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontransitionend)] + #[doc = "Setter for the `ontransitionend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontransitionend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontransitionrun)] + #[doc = "Getter for the `ontransitionrun` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionrun)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontransitionrun(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontransitionrun)] + #[doc = "Setter for the `ontransitionrun` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionrun)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontransitionrun(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontransitionstart)] + #[doc = "Getter for the `ontransitionstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontransitionstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontransitionstart)] + #[doc = "Setter for the `ontransitionstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontransitionstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontransitionstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwebkitanimationend)] + #[doc = "Getter for the `onwebkitanimationend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwebkitanimationend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwebkitanimationend)] + #[doc = "Setter for the `onwebkitanimationend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwebkitanimationend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwebkitanimationiteration)] + #[doc = "Getter for the `onwebkitanimationiteration` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationiteration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwebkitanimationiteration(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwebkitanimationiteration)] + #[doc = "Setter for the `onwebkitanimationiteration` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationiteration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwebkitanimationiteration(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwebkitanimationstart)] + #[doc = "Getter for the `onwebkitanimationstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwebkitanimationstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwebkitanimationstart)] + #[doc = "Setter for the `onwebkitanimationstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkitanimationstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwebkitanimationstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onwebkittransitionend)] + #[doc = "Getter for the `onwebkittransitionend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkittransitionend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onwebkittransitionend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onwebkittransitionend)] + #[doc = "Setter for the `onwebkittransitionend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onwebkittransitionend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onwebkittransitionend(this: &MathMlElement, value: Option<&::js_sys::Function>); + #[cfg(feature = "DomStringMap")] + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = dataset)] + #[doc = "Getter for the `dataset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/dataset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `MathMlElement`*"] + pub fn dataset(this: &MathMlElement) -> DomStringMap; + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = nonce)] + #[doc = "Getter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn nonce(this: &MathMlElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = nonce)] + #[doc = "Setter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_nonce(this: &MathMlElement, value: &str); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = autofocus)] + #[doc = "Getter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn autofocus(this: &MathMlElement) -> bool; + # [wasm_bindgen (structural , catch , method , setter , js_class = "MathMLElement" , js_name = autofocus)] + #[doc = "Setter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_autofocus(this: &MathMlElement, value: bool) -> Result<(), JsValue>; + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = tabIndex)] + #[doc = "Getter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn tab_index(this: &MathMlElement) -> i32; + # [wasm_bindgen (structural , catch , method , setter , js_class = "MathMLElement" , js_name = tabIndex)] + #[doc = "Setter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_tab_index(this: &MathMlElement, value: i32) -> Result<(), JsValue>; + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = onerror)] + #[doc = "Getter for the `onerror` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onerror)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn onerror(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = onerror)] + #[doc = "Setter for the `onerror` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/onerror)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_onerror(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontouchstart)] + #[doc = "Getter for the `ontouchstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontouchstart(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontouchstart)] + #[doc = "Setter for the `ontouchstart` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchstart)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontouchstart(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontouchend)] + #[doc = "Getter for the `ontouchend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontouchend(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontouchend)] + #[doc = "Setter for the `ontouchend` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchend)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontouchend(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontouchmove)] + #[doc = "Getter for the `ontouchmove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchmove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontouchmove(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontouchmove)] + #[doc = "Setter for the `ontouchmove` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchmove)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontouchmove(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = ontouchcancel)] + #[doc = "Getter for the `ontouchcancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchcancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn ontouchcancel(this: &MathMlElement) -> Option<::js_sys::Function>; + # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = ontouchcancel)] + #[doc = "Setter for the `ontouchcancel` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/ontouchcancel)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn set_ontouchcancel(this: &MathMlElement, value: Option<&::js_sys::Function>); + # [wasm_bindgen (catch , method , structural , js_class = "MathMLElement" , js_name = blur)] + #[doc = "The `blur()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/blur)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn blur(this: &MathMlElement) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "MathMLElement" , js_name = focus)] + #[doc = "The `focus()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/focus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] + pub fn focus(this: &MathMlElement) -> Result<(), JsValue>; + #[cfg(feature = "FocusOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "MathMLElement" , js_name = focus)] + #[doc = "The `focus()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/focus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`, `MathMlElement`*"] + pub fn focus_with_options(this: &MathMlElement, options: &FocusOptions) -> Result<(), JsValue>; +} diff --git a/crates/web-sys/src/features/gen_SvgElement.rs b/crates/web-sys/src/features/gen_SvgElement.rs index 03c837ed1d2..484e6be2bc1 100644 --- a/crates/web-sys/src/features/gen_SvgElement.rs +++ b/crates/web-sys/src/features/gen_SvgElement.rs @@ -34,22 +34,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgAnimatedString`, `SvgElement`*"] pub fn class_name(this: &SvgElement) -> SvgAnimatedString; - #[cfg(feature = "DomStringMap")] - # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = dataset)] - #[doc = "Getter for the `dataset` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/dataset)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `SvgElement`*"] - pub fn dataset(this: &SvgElement) -> DomStringMap; - #[cfg(feature = "CssStyleDeclaration")] - # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = style)] - #[doc = "Getter for the `style` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/style)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`, `SvgElement`*"] - pub fn style(this: &SvgElement) -> CssStyleDeclaration; #[cfg(feature = "SvgsvgElement")] # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = ownerSVGElement)] #[doc = "Getter for the `ownerSVGElement` field of this object."] @@ -65,20 +49,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] pub fn viewport_element(this: &SvgElement) -> Option; - # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = tabIndex)] - #[doc = "Getter for the `tabIndex` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/tabIndex)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] - pub fn tab_index(this: &SvgElement) -> i32; - # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = tabIndex)] - #[doc = "Setter for the `tabIndex` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/tabIndex)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] - pub fn set_tab_index(this: &SvgElement, value: i32); # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = oncopy)] #[doc = "Getter for the `oncopy` field of this object."] #[doc = ""] @@ -121,6 +91,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] pub fn set_onpaste(this: &SvgElement, value: Option<&::js_sys::Function>); + #[cfg(feature = "CssStyleDeclaration")] + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = style)] + #[doc = "Getter for the `style` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/style)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`, `SvgElement`*"] + pub fn style(this: &SvgElement) -> CssStyleDeclaration; # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = onabort)] #[doc = "Getter for the `onabort` field of this object."] #[doc = ""] @@ -1283,6 +1261,56 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] pub fn set_onwebkittransitionend(this: &SvgElement, value: Option<&::js_sys::Function>); + #[cfg(feature = "DomStringMap")] + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = dataset)] + #[doc = "Getter for the `dataset` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/dataset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `SvgElement`*"] + pub fn dataset(this: &SvgElement) -> DomStringMap; + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = nonce)] + #[doc = "Getter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn nonce(this: &SvgElement) -> String; + # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = nonce)] + #[doc = "Setter for the `nonce` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/nonce)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn set_nonce(this: &SvgElement, value: &str); + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = autofocus)] + #[doc = "Getter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn autofocus(this: &SvgElement) -> bool; + # [wasm_bindgen (structural , catch , method , setter , js_class = "SVGElement" , js_name = autofocus)] + #[doc = "Setter for the `autofocus` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/autofocus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn set_autofocus(this: &SvgElement, value: bool) -> Result<(), JsValue>; + # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = tabIndex)] + #[doc = "Getter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn tab_index(this: &SvgElement) -> i32; + # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = tabIndex)] + #[doc = "Setter for the `tabIndex` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/tabIndex)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] + pub fn set_tab_index(this: &SvgElement, value: i32); # [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = onerror)] #[doc = "Getter for the `onerror` field of this object."] #[doc = ""] @@ -1367,4 +1395,12 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] pub fn focus(this: &SvgElement) -> Result<(), JsValue>; + #[cfg(feature = "FocusOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "SVGElement" , js_name = focus)] + #[doc = "The `focus()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/focus)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FocusOptions`, `SvgElement`*"] + pub fn focus_with_options(this: &SvgElement, options: &FocusOptions) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 6568633cec0..a22df0488a5 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -5276,6 +5276,13 @@ mod gen_LockOptions; #[allow(unused_imports)] pub use gen_LockOptions::*; +#[cfg(feature = "MathMlElement")] +#[allow(non_snake_case)] +mod gen_MathMlElement; +#[cfg(feature = "MathMlElement")] +#[allow(unused_imports)] +pub use gen_MathMlElement::*; + #[cfg(feature = "MediaCapabilities")] #[allow(non_snake_case)] mod gen_MediaCapabilities; diff --git a/crates/web-sys/webidls/enabled/Element.webidl b/crates/web-sys/webidls/enabled/Element.webidl index 2aa383a2a43..7a4a6731527 100644 --- a/crates/web-sys/webidls/enabled/Element.webidl +++ b/crates/web-sys/webidls/enabled/Element.webidl @@ -263,3 +263,20 @@ partial interface Element { [NeedsCallerType] undefined requestPointerLock(); }; + +// https://html.spec.whatwg.org/#htmlorsvgelement +interface mixin HTMLOrSVGElement { + [SameObject] readonly attribute DOMStringMap dataset; + + attribute DOMString nonce; // intentionally no [CEReactions] + [CEReactions, SetterThrows] attribute boolean autofocus; + [CEReactions, SetterThrows] attribute long tabIndex; + [Throws] undefined focus(optional FocusOptions options = {}); + [Throws] undefined blur(); +}; + +// https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-mixin +interface mixin ElementCSSInlineStyle { + [SameObject, PutForwards=cssText] + readonly attribute CSSStyleDeclaration style; +}; diff --git a/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl b/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl index 2097cd06904..c0d96695499 100644 --- a/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLButtonElement.webidl @@ -13,7 +13,7 @@ // http://www.whatwg.org/specs/web-apps/current-work/#the-button-element [HTMLConstructor] interface HTMLButtonElement : HTMLElement { - [CEReactions, SetterThrows, Pure] + [CEReactions, SetterThrows, Pure, RustDeprecated="Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead."] attribute boolean autofocus; [CEReactions, SetterThrows, Pure] attribute boolean disabled; diff --git a/crates/web-sys/webidls/enabled/HTMLElement.webidl b/crates/web-sys/webidls/enabled/HTMLElement.webidl index e0b70802e72..29d927ef006 100644 --- a/crates/web-sys/webidls/enabled/HTMLElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLElement.webidl @@ -26,8 +26,6 @@ interface HTMLElement : Element { // attribute boolean translate; [CEReactions, SetterThrows, Pure] attribute DOMString dir; - [Constant] - readonly attribute DOMStringMap dataset; [CEReactions, GetterThrows, Pure, TreatNullAs=EmptyString] attribute DOMString innerText; @@ -39,8 +37,6 @@ interface HTMLElement : Element { attribute boolean inert; [NeedsCallerType] undefined click(); - [CEReactions, SetterThrows, Pure] - attribute long tabIndex; [Throws] undefined focus(optional FocusOptions options = {}); [Throws] @@ -79,10 +75,6 @@ interface HTMLElement : Element { undefined hidePopover(); [Throws, Pref="dom.element.popover.enabled"] boolean togglePopover(optional boolean force); - - // styling - [PutForwards=cssText, Constant] - readonly attribute CSSStyleDeclaration style; }; // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface @@ -95,6 +87,7 @@ partial interface HTMLElement { readonly attribute long offsetHeight; }; +// https://w3c.github.io/touch-events/#extensions-to-the-globaleventhandlers-mixin interface mixin TouchEventHandlers { [Func="nsGenericHTMLElement::TouchEventsEnabled"] attribute EventHandler ontouchstart; @@ -106,6 +99,8 @@ interface mixin TouchEventHandlers { attribute EventHandler ontouchcancel; }; +HTMLElement includes HTMLOrSVGElement; +HTMLElement includes ElementCSSInlineStyle; HTMLElement includes GlobalEventHandlers; HTMLElement includes DocumentAndElementEventHandlers; HTMLElement includes TouchEventHandlers; diff --git a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl index 11c15761d14..b7ed6bfcc18 100644 --- a/crates/web-sys/webidls/enabled/HTMLInputElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLInputElement.webidl @@ -31,7 +31,7 @@ interface HTMLInputElement : HTMLElement { attribute DOMString alt; [CEReactions, Pure, SetterThrows] attribute DOMString autocomplete; - [CEReactions, Pure, SetterThrows] + [CEReactions, Pure, SetterThrows, RustDeprecated="Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead."] attribute boolean autofocus; [CEReactions, Pure, SetterThrows] attribute boolean defaultChecked; diff --git a/crates/web-sys/webidls/enabled/HTMLSelectElement.webidl b/crates/web-sys/webidls/enabled/HTMLSelectElement.webidl index 045f69577c1..968d93f20b4 100644 --- a/crates/web-sys/webidls/enabled/HTMLSelectElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLSelectElement.webidl @@ -9,7 +9,7 @@ [HTMLConstructor] interface HTMLSelectElement : HTMLElement { - [CEReactions, SetterThrows, Pure] + [CEReactions, SetterThrows, Pure, RustDeprecated="Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead."] attribute boolean autofocus; [CEReactions, SetterThrows, Pure] attribute DOMString autocomplete; diff --git a/crates/web-sys/webidls/enabled/HTMLTextAreaElement.webidl b/crates/web-sys/webidls/enabled/HTMLTextAreaElement.webidl index c3487ff69bf..525337c2146 100644 --- a/crates/web-sys/webidls/enabled/HTMLTextAreaElement.webidl +++ b/crates/web-sys/webidls/enabled/HTMLTextAreaElement.webidl @@ -19,7 +19,7 @@ interface XULControllers; interface HTMLTextAreaElement : HTMLElement { [CEReactions, SetterThrows, Pure] attribute DOMString autocomplete; - [CEReactions, SetterThrows, Pure] + [CEReactions, SetterThrows, Pure, RustDeprecated="Use `HtmlElement::autofocus()` or `HtmlElement::set_autofocus()` instead."] attribute boolean autofocus; [CEReactions, SetterThrows, Pure] attribute unsigned long cols; diff --git a/crates/web-sys/webidls/enabled/MathMLElement.webidl b/crates/web-sys/webidls/enabled/MathMLElement.webidl new file mode 100644 index 00000000000..c5d9474b713 --- /dev/null +++ b/crates/web-sys/webidls/enabled/MathMLElement.webidl @@ -0,0 +1,14 @@ +// https://www.w3.org/TR/mathml-core + +[Exposed=Window] +interface MathMLElement : Element { }; +// https://www.w3.org/TR/mathml-core/#dom-and-javascript +MathMLElement includes GlobalEventHandlers; +MathMLElement includes HTMLOrSVGElement; +// https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-mixin +MathMLElement includes ElementCSSInlineStyle; +// TODO: Deprecated, add to `GlobalEventHandlers` via mixin: +// https://w3c.github.io/touch-events/#extensions-to-the-globaleventhandlers-mixin +MathMLElement includes TouchEventHandlers; +// TODO: See `OnErrorEventHandlerForNodes` definition in `EventHandler.webidl`. +MathMLElement includes OnErrorEventHandlerForNodes; diff --git a/crates/web-sys/webidls/enabled/SVGElement.webidl b/crates/web-sys/webidls/enabled/SVGElement.webidl index 24161ee735d..48e86dbc4bc 100644 --- a/crates/web-sys/webidls/enabled/SVGElement.webidl +++ b/crates/web-sys/webidls/enabled/SVGElement.webidl @@ -15,19 +15,13 @@ interface SVGElement : Element { [Constant] readonly attribute SVGAnimatedString className; - [SameObject] readonly attribute DOMStringMap dataset; - [PutForwards=cssText, Constant] - readonly attribute CSSStyleDeclaration style; readonly attribute SVGSVGElement? ownerSVGElement; readonly attribute SVGElement? viewportElement; - - [SetterThrows, Pure] - attribute long tabIndex; - [Throws] undefined focus(); - [Throws] undefined blur(); }; +SVGElement includes HTMLOrSVGElement; +SVGElement includes ElementCSSInlineStyle; SVGElement includes GlobalEventHandlers; SVGElement includes DocumentAndElementEventHandlers; SVGElement includes TouchEventHandlers; From 7c7cd51360942acffed1f31eeffa5d3e6d34aaf9 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 16 Oct 2024 09:43:56 +0200 Subject: [PATCH 531/641] Optimized ABI performance for `Option<[all 32-bit primitives]>` (#4183) --- CHANGELOG.md | 3 + crates/cli-support/src/js/binding.rs | 64 +++++++++++++- crates/cli-support/src/js/mod.rs | 27 +++--- crates/cli-support/src/wit/incoming.rs | 30 +++++-- crates/cli-support/src/wit/outgoing.rs | 24 ++++-- crates/cli-support/src/wit/standard.rs | 10 +++ src/convert/impls.rs | 111 ++++++++++++++++++++----- tests/wasm/optional_primitives.js | 10 +++ 8 files changed, 223 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f22e7337e..ae36c874f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ * Deprecate `autofocus`, `tabIndex`, `focus()` and `blur()` bindings in favor of bindings on the inherited `Element` class. [#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143) +* Optimized ABI performance for `Option<{i32,u32,isize,usize,f32,*const T,*mut T}>`. + [#4183](https://github.com/rustwasm/wasm-bindgen/pull/4183) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index ccbfea09141..000634297d3 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -37,6 +37,9 @@ pub struct JsBuilder<'a, 'b> { /// JS functions, etc. cx: &'a mut Context<'b>, + /// A debug name for the function being generated, used for error messages + debug_name: &'a str, + /// The "prelude" of the function, or largely just the JS function we've /// built so far. prelude: String, @@ -121,6 +124,7 @@ impl<'a, 'b> Builder<'a, 'b> { asyncness: bool, variadic: bool, generate_jsdoc: bool, + debug_name: &str, ) -> Result { if self .cx @@ -138,7 +142,7 @@ impl<'a, 'b> Builder<'a, 'b> { // If this is a method then we're generating this as part of a class // method, so the leading parameter is the this pointer stored on // the JS object, so synthesize that here. - let mut js = JsBuilder::new(self.cx); + let mut js = JsBuilder::new(self.cx, debug_name); if let Some(consumes_self) = self.method { let _ = params.next(); if js.cx.config.debug { @@ -184,7 +188,12 @@ impl<'a, 'b> Builder<'a, 'b> { )?; } - assert_eq!(js.stack.len(), adapter.results.len()); + assert_eq!( + js.stack.len(), + adapter.results.len(), + "stack size mismatch for {}", + debug_name + ); match js.stack.len() { 0 => {} 1 => { @@ -422,9 +431,10 @@ impl<'a, 'b> Builder<'a, 'b> { } impl<'a, 'b> JsBuilder<'a, 'b> { - pub fn new(cx: &'a mut Context<'b>) -> JsBuilder<'a, 'b> { + pub fn new(cx: &'a mut Context<'b>, debug_name: &'a str) -> JsBuilder<'a, 'b> { JsBuilder { cx, + debug_name, args: Vec::new(), tmp: 0, pre_try: String::new(), @@ -463,7 +473,10 @@ impl<'a, 'b> JsBuilder<'a, 'b> { } fn pop(&mut self) -> String { - self.stack.pop().unwrap() + match self.stack.pop() { + Some(s) => s, + None => panic!("popping an empty stack in {}", self.debug_name), + } } fn push(&mut self, arg: String) { @@ -920,6 +933,44 @@ fn instruction( js.push(format!("isLikeNone({0}) ? {1} : {0}", val, hole)); } + Instruction::F64FromOptionSentinelInt { signed } => { + let val = js.pop(); + js.cx.expose_is_like_none(); + js.assert_optional_number(&val); + + // We need to convert the given number to a 32-bit integer before + // passing it to the ABI for 2 reasons: + // 1. Rust's behavior for `value_f64 as i32/u32` is different from + // the WebAssembly behavior for values outside the 32-bit range. + // We could implement this behavior in Rust too, but it's easier + // to do it in JS. + // 2. If we allowed values outside the 32-bit range, the sentinel + // value itself would be allowed. This would make it impossible + // to distinguish between the sentinel value and a valid value. + // + // To perform the actual conversion, we use JS bit shifts. Handily, + // >> and >>> perform a conversion to i32 and u32 respectively + // to apply the bit shift, so we can use e.g. x >>> 0 to convert to + // u32. + + let op = if *signed { ">>" } else { ">>>" }; + js.push(format!("isLikeNone({val}) ? 0x100000001 : ({val}) {op} 0")); + } + Instruction::F64FromOptionSentinelF32 => { + let val = js.pop(); + js.cx.expose_is_like_none(); + js.assert_optional_number(&val); + + // Similar to the above 32-bit integer variant, we convert the + // number to a 32-bit *float* before passing it to the ABI. This + // ensures consistent behavior with WebAssembly and makes it + // possible to use a sentinel value. + + js.push(format!( + "isLikeNone({val}) ? 0x100000001 : Math.fround({val})" + )); + } + Instruction::FromOptionNative { ty } => { let val = js.pop(); js.cx.expose_is_like_none(); @@ -1277,6 +1328,11 @@ fn instruction( )); } + Instruction::OptionF64Sentinel => { + let val = js.pop(); + js.push(format!("{0} === 0x100000001 ? undefined : {0}", val)); + } + Instruction::OptionU32Sentinel => { let val = js.pop(); js.push(format!("{0} === 0xFFFFFF ? undefined : {0}", val)); diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 929f2787f7f..eafd6ccf5ab 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2655,6 +2655,16 @@ __wbg_set_wasm(wasm);" ContextAdapterKind::Adapter => {} } + // an internal debug name to help with error messages + let debug_name = match kind { + ContextAdapterKind::Import(i) => { + let i = builder.cx.module.imports.get(i); + format!("import of `{}::{}`", i.module, i.name) + } + ContextAdapterKind::Export(e) => format!("`{}`", e.debug_name), + ContextAdapterKind::Adapter => format!("adapter {}", id.0), + }; + // Process the `binding` and generate a bunch of JS/TypeScript/etc. let binding::JsFunction { ts_sig, @@ -2674,22 +2684,9 @@ __wbg_set_wasm(wasm);" asyncness, variadic, generate_jsdoc, + &debug_name, ) - .with_context(|| match kind { - ContextAdapterKind::Export(e) => { - format!("failed to generate bindings for `{}`", e.debug_name) - } - ContextAdapterKind::Import(i) => { - let i = builder.cx.module.imports.get(i); - format!( - "failed to generate bindings for import of `{}::{}`", - i.module, i.name - ) - } - ContextAdapterKind::Adapter => { - "failed to generates bindings for adapter".to_string() - } - })?; + .with_context(|| "failed to generates bindings for ".to_string() + &debug_name)?; self.typescript_refs.extend(ts_refs); diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index a1a6ee196b4..5c2a2c4874e 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -276,13 +276,13 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); } - Descriptor::I8 => self.in_option_sentinel(AdapterType::S8), - Descriptor::U8 => self.in_option_sentinel(AdapterType::U8), - Descriptor::I16 => self.in_option_sentinel(AdapterType::S16), - Descriptor::U16 => self.in_option_sentinel(AdapterType::U16), - Descriptor::I32 => self.in_option_native(ValType::I32), - Descriptor::U32 => self.in_option_native(ValType::I32), - Descriptor::F32 => self.in_option_native(ValType::F32), + Descriptor::I8 => self.in_option_sentinel32(AdapterType::S8), + Descriptor::U8 => self.in_option_sentinel32(AdapterType::U8), + Descriptor::I16 => self.in_option_sentinel32(AdapterType::S16), + Descriptor::U16 => self.in_option_sentinel32(AdapterType::U16), + Descriptor::I32 => self.in_option_sentinel64_int(AdapterType::I32, true), + Descriptor::U32 => self.in_option_sentinel64_int(AdapterType::U32, false), + Descriptor::F32 => self.in_option_sentinel64_f32(AdapterType::F32), Descriptor::F64 => self.in_option_native(ValType::F64), Descriptor::I64 | Descriptor::U64 => self.in_option_native(ValType::I64), Descriptor::Boolean => { @@ -459,11 +459,25 @@ impl InstructionBuilder<'_, '_> { ); } - fn in_option_sentinel(&mut self, ty: AdapterType) { + fn in_option_sentinel32(&mut self, ty: AdapterType) { self.instruction( &[ty.option()], Instruction::I32FromOptionU32Sentinel, &[AdapterType::I32], ); } + fn in_option_sentinel64_int(&mut self, ty: AdapterType, signed: bool) { + self.instruction( + &[ty.option()], + Instruction::F64FromOptionSentinelInt { signed }, + &[AdapterType::F64], + ); + } + fn in_option_sentinel64_f32(&mut self, ty: AdapterType) { + self.instruction( + &[ty.option()], + Instruction::F64FromOptionSentinelF32, + &[AdapterType::F64], + ); + } } diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 8f545ffaba9..7a39af67d2a 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -257,15 +257,15 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::NamedExternref(name.clone()).option()], ); } - Descriptor::I8 => self.out_option_sentinel(AdapterType::S8), - Descriptor::U8 => self.out_option_sentinel(AdapterType::U8), - Descriptor::I16 => self.out_option_sentinel(AdapterType::S16), - Descriptor::U16 => self.out_option_sentinel(AdapterType::U16), - Descriptor::I32 => self.option_native(true, ValType::I32), - Descriptor::U32 => self.option_native(false, ValType::I32), + Descriptor::I8 => self.out_option_sentinel32(AdapterType::S8), + Descriptor::U8 => self.out_option_sentinel32(AdapterType::U8), + Descriptor::I16 => self.out_option_sentinel32(AdapterType::S16), + Descriptor::U16 => self.out_option_sentinel32(AdapterType::U16), + Descriptor::I32 => self.out_option_sentinel64(AdapterType::S32), + Descriptor::U32 => self.out_option_sentinel64(AdapterType::U32), Descriptor::I64 => self.option_native(true, ValType::I64), Descriptor::U64 => self.option_native(false, ValType::I64), - Descriptor::F32 => self.option_native(true, ValType::F32), + Descriptor::F32 => self.out_option_sentinel64(AdapterType::F32), Descriptor::F64 => self.option_native(true, ValType::F64), Descriptor::Boolean => { self.instruction( @@ -576,11 +576,19 @@ impl InstructionBuilder<'_, '_> { ); } - fn out_option_sentinel(&mut self, ty: AdapterType) { + fn out_option_sentinel32(&mut self, ty: AdapterType) { self.instruction( &[AdapterType::I32], Instruction::OptionU32Sentinel, &[ty.option()], ); } + + fn out_option_sentinel64(&mut self, ty: AdapterType) { + self.instruction( + &[AdapterType::F64], + Instruction::OptionF64Sentinel, + &[ty.option()], + ); + } } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index eeadd1a69f8..8d8c7bc99d7 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -214,6 +214,14 @@ pub enum Instruction { I32FromOptionEnum { hole: u32, }, + /// Pops an `externref` from the stack, pushes either a sentinel value if it's + /// "none" or the integer value of it if it's "some" + F64FromOptionSentinelInt { + signed: bool, + }, + /// Pops an `externref` from the stack, pushes either a sentinel value if it's + /// "none" or the f32 value of it if it's "some" + F64FromOptionSentinelF32, /// Pops any externref from the stack and then pushes two values. First is a /// 0/1 if it's none/some and second is `ty` value if it was there or 0 if /// it wasn't there. @@ -324,6 +332,8 @@ pub enum Instruction { kind: VectorKind, mem: walrus::MemoryId, }, + /// pops f64, pushes it viewed as an optional value with a known sentinel + OptionF64Sentinel, /// pops i32, pushes it viewed as an optional value with a known sentinel OptionU32Sentinel, /// pops an i32, then `ty`, then pushes externref diff --git a/src/convert/impls.rs b/src/convert/impls.rs index e54f0669c5a..28dac9cfd83 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -99,16 +99,75 @@ macro_rules! type_wasm_native { } type_wasm_native!( + i64 as i64 + u64 as u64 + f64 as f64 +); + +/// The sentinel value is 2^32 + 1 for 32-bit primitive types. +/// +/// 2^32 + 1 is used, because it's the smallest positive integer that cannot be +/// represented by any 32-bit primitive. While any value >= 2^32 works as a +/// sentinel value for 32-bit integers, it's a bit more tricky for `f32`. `f32` +/// can represent all powers of 2 up to 2^127 exactly. And between 2^32 and 2^33, +/// `f32` can represent all integers 2^32+512*k exactly. +const F64_ABI_OPTION_SENTINEL: f64 = 4294967297_f64; + +macro_rules! type_wasm_native_f64_option { + ($($t:tt as $c:tt)*) => ($( + impl IntoWasmAbi for $t { + type Abi = $c; + + #[inline] + fn into_abi(self) -> $c { self as $c } + } + + impl FromWasmAbi for $t { + type Abi = $c; + + #[inline] + unsafe fn from_abi(js: $c) -> Self { js as $t } + } + + impl IntoWasmAbi for Option<$t> { + type Abi = f64; + + #[inline] + fn into_abi(self) -> Self::Abi { + self.map(|v| v as $c as f64).unwrap_or(F64_ABI_OPTION_SENTINEL) + } + } + + impl FromWasmAbi for Option<$t> { + type Abi = f64; + + #[inline] + unsafe fn from_abi(js: Self::Abi) -> Self { + if js == F64_ABI_OPTION_SENTINEL { + None + } else { + Some(js as $c as $t) + } + } + } + )*) +} + +type_wasm_native_f64_option!( i32 as i32 isize as i32 u32 as u32 usize as u32 - i64 as i64 - u64 as u64 f32 as f32 - f64 as f64 ); +/// The sentinel value is 0xFF_FFFF for primitives with less than 32 bits. +/// +/// This value is used, so all small primitive types (`bool`, `i8`, `u8`, +/// `i16`, `u16`, `char`) can use the same JS glue code. `char::MAX` is +/// 0x10_FFFF btw. +const U32_ABI_OPTION_SENTINEL: u32 = 0x00FF_FFFFu32; + macro_rules! type_abi_as_u32 { ($($t:tt)*) => ($( impl IntoWasmAbi for $t { @@ -127,12 +186,12 @@ macro_rules! type_abi_as_u32 { impl OptionIntoWasmAbi for $t { #[inline] - fn none() -> u32 { 0x00FF_FFFFu32 } + fn none() -> u32 { U32_ABI_OPTION_SENTINEL } } impl OptionFromWasmAbi for $t { #[inline] - fn is_none(js: &u32) -> bool { *js == 0x00FF_FFFFu32 } + fn is_none(js: &u32) -> bool { *js == U32_ABI_OPTION_SENTINEL } } )*) } @@ -160,14 +219,14 @@ impl FromWasmAbi for bool { impl OptionIntoWasmAbi for bool { #[inline] fn none() -> u32 { - 0x00FF_FFFFu32 + U32_ABI_OPTION_SENTINEL } } impl OptionFromWasmAbi for bool { #[inline] fn is_none(js: &u32) -> bool { - *js == 0x00FF_FFFFu32 + *js == U32_ABI_OPTION_SENTINEL } } @@ -193,14 +252,14 @@ impl FromWasmAbi for char { impl OptionIntoWasmAbi for char { #[inline] fn none() -> u32 { - 0x00FF_FFFFu32 + U32_ABI_OPTION_SENTINEL } } impl OptionFromWasmAbi for char { #[inline] fn is_none(js: &u32) -> bool { - *js == 0x00FF_FFFFu32 + *js == U32_ABI_OPTION_SENTINEL } } @@ -223,20 +282,25 @@ impl FromWasmAbi for *const T { } impl IntoWasmAbi for Option<*const T> { - type Abi = Option; + type Abi = f64; #[inline] - fn into_abi(self) -> Option { - self.map(|ptr| ptr as u32) + fn into_abi(self) -> f64 { + self.map(|ptr| ptr as u32 as f64) + .unwrap_or(F64_ABI_OPTION_SENTINEL) } } impl FromWasmAbi for Option<*const T> { - type Abi = Option; + type Abi = f64; #[inline] - unsafe fn from_abi(js: Option) -> Option<*const T> { - js.map(|ptr| ptr as *const T) + unsafe fn from_abi(js: f64) -> Option<*const T> { + if js == F64_ABI_OPTION_SENTINEL { + None + } else { + Some(js as u32 as *const T) + } } } @@ -259,20 +323,25 @@ impl FromWasmAbi for *mut T { } impl IntoWasmAbi for Option<*mut T> { - type Abi = Option; + type Abi = f64; #[inline] - fn into_abi(self) -> Option { - self.map(|ptr| ptr as u32) + fn into_abi(self) -> f64 { + self.map(|ptr| ptr as u32 as f64) + .unwrap_or(F64_ABI_OPTION_SENTINEL) } } impl FromWasmAbi for Option<*mut T> { - type Abi = Option; + type Abi = f64; #[inline] - unsafe fn from_abi(js: Option) -> Option<*mut T> { - js.map(|ptr| ptr as *mut T) + unsafe fn from_abi(js: f64) -> Option<*mut T> { + if js == F64_ABI_OPTION_SENTINEL { + None + } else { + Some(js as u32 as *mut T) + } } } diff --git a/tests/wasm/optional_primitives.js b/tests/wasm/optional_primitives.js index 89bf4df7eab..d6755144a20 100644 --- a/tests/wasm/optional_primitives.js +++ b/tests/wasm/optional_primitives.js @@ -23,12 +23,16 @@ exports.js_works = () => { assert.strictEqual(wasm.optional_i32_identity(wasm.optional_i32_neg_one()), -1); assert.strictEqual(wasm.optional_i32_identity(wasm.optional_i32_min()), -2147483648); assert.strictEqual(wasm.optional_i32_identity(wasm.optional_i32_max()), 2147483647); + assert.strictEqual(wasm.optional_i32_identity(2 ** 32), 0); // overflows 32 bits + assert.strictEqual(wasm.optional_i32_identity(2 ** 32 + 1), 1); // overflows and wraps back around assert.strictEqual(wasm.optional_u32_identity(wasm.optional_u32_none()), undefined); assert.strictEqual(wasm.optional_u32_identity(wasm.optional_u32_zero()), 0); assert.strictEqual(wasm.optional_u32_identity(wasm.optional_u32_one()), 1); assert.strictEqual(wasm.optional_u32_identity(wasm.optional_u32_min()), 0); assert.strictEqual(wasm.optional_u32_identity(wasm.optional_u32_max()), 4294967295); + assert.strictEqual(wasm.optional_u32_identity(2 ** 32), 0); // overflows 32 bits + assert.strictEqual(wasm.optional_u32_identity(2 ** 32 + 1), 1); // overflows and wraps back around assert.strictEqual(wasm.optional_isize_identity(wasm.optional_isize_none()), undefined); assert.strictEqual(wasm.optional_isize_identity(wasm.optional_isize_zero()), 0); @@ -36,17 +40,23 @@ exports.js_works = () => { assert.strictEqual(wasm.optional_isize_identity(wasm.optional_isize_neg_one()), -1); assert.strictEqual(wasm.optional_isize_identity(wasm.optional_isize_min()), -2147483648); assert.strictEqual(wasm.optional_isize_identity(wasm.optional_isize_max()), 2147483647); + assert.strictEqual(wasm.optional_isize_identity(2 ** 32), 0); // isize is 32 bit, so it behaves the same as i32 + assert.strictEqual(wasm.optional_isize_identity(2 ** 32 + 1), 1); assert.strictEqual(wasm.optional_usize_identity(wasm.optional_usize_none()), undefined); assert.strictEqual(wasm.optional_usize_identity(wasm.optional_usize_zero()), 0); assert.strictEqual(wasm.optional_usize_identity(wasm.optional_usize_one()), 1); assert.strictEqual(wasm.optional_usize_identity(wasm.optional_usize_min()), 0); assert.strictEqual(wasm.optional_usize_identity(wasm.optional_usize_max()), 4294967295); + assert.strictEqual(wasm.optional_usize_identity(2 ** 32), 0); // usize is 32 bit, so it behaves the same as i32 + assert.strictEqual(wasm.optional_usize_identity(2 ** 32 + 1), 1); assert.strictEqual(wasm.optional_f32_identity(wasm.optional_f32_none()), undefined); assert.strictEqual(wasm.optional_f32_identity(wasm.optional_f32_zero()), 0); assert.strictEqual(wasm.optional_f32_identity(wasm.optional_f32_one()), 1); assert.strictEqual(wasm.optional_f32_identity(wasm.optional_f32_neg_one()), -1); + assert.strictEqual(wasm.optional_f32_identity(2 ** 32), 2 ** 32); // 2^32 is exactly representable + assert.strictEqual(wasm.optional_f32_identity(2 ** 32 + 1), 2 ** 32); // 2^32 + 1 is not and gets rounded assert.strictEqual(wasm.optional_f64_identity(wasm.optional_f64_none()), undefined); assert.strictEqual(wasm.optional_f64_identity(wasm.optional_f64_zero()), 0); From 76776ef54cce17f1c7442b010e26d7eadaea3cd0 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 16 Oct 2024 11:10:14 +0200 Subject: [PATCH 532/641] Add JSDoc type annotations to C-style enums (#4157) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 29 ++++++++++++++++++++--------- crates/cli/tests/reference/enums.js | 5 ++++- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae36c874f90..fd9e743e065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Added bindings for [MathMLElement](https://www.w3.org/TR/MathML3). [#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143) +* Added JSDoc type annotations to C-style enums. + [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) + ### Changed * String enums now generate private TypeScript types but only if used. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index eafd6ccf5ab..10658f37f3a 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3773,11 +3773,11 @@ __wbg_set_wasm(wasm);" } fn generate_enum(&mut self, enum_: &AuxEnum) -> Result<(), Error> { - let docs = format_doc_comments(&enum_.comments, None); let mut variants = String::new(); if enum_.generate_typescript { - self.typescript.push_str(&docs); + self.typescript + .push_str(&format_doc_comments(&enum_.comments, None)); self.typescript .push_str(&format!("export enum {} {{", enum_.name)); } @@ -3808,6 +3808,18 @@ __wbg_set_wasm(wasm);" if enum_.generate_typescript { self.typescript.push_str("\n}\n"); } + + // add an `@enum {1 | 2 | 3}` to ensure that enums type-check even without .d.ts + let mut at_enum = "@enum {".to_string(); + for (i, (_, value, _)) in enum_.variants.iter().enumerate() { + if i != 0 { + at_enum.push_str(" | "); + } + at_enum.push_str(&value.to_string()); + } + at_enum.push('}'); + let docs = format_doc_comments(&enum_.comments, Some(at_enum)); + self.export( &enum_.name, &format!("Object.freeze({{ {} }})", variants), @@ -3830,18 +3842,17 @@ __wbg_set_wasm(wasm);" .contains(&TsReference::StringEnum(string_enum.name.clone())) { let docs = format_doc_comments(&string_enum.comments, None); + let type_expr = if variants.is_empty() { + "never".to_string() + } else { + variants.join(" | ") + }; self.typescript.push_str(&docs); self.typescript.push_str("type "); self.typescript.push_str(&string_enum.name); self.typescript.push_str(" = "); - - if variants.is_empty() { - self.typescript.push_str("never"); - } else { - self.typescript.push_str(&variants.join(" | ")); - } - + self.typescript.push_str(&type_expr); self.typescript.push_str(";\n"); } diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index dd9d482ce6b..ab820abbc3f 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -64,6 +64,7 @@ export function option_string_enum_echo(color) { /** * A color. + * @enum {0 | 1 | 2} */ export const Color = Object.freeze({ /** @@ -78,7 +79,9 @@ Yellow:1,"1":"Yellow", * Red as a rose. */ Red:2,"2":"Red", }); - +/** + * @enum {0 | 1 | 42 | 43} + */ export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42,"42":"C",D:43,"43":"D", }); const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; From 2f2ac1a825f871f54bbd30912ac0655f0167978e Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 29 Oct 2024 09:33:30 +0100 Subject: [PATCH 533/641] Fixed generated types for getters and setters (#4202) --- CHANGELOG.md | 6 + crates/cli-support/src/js/mod.rs | 244 +++++++++++++----- crates/cli/tests/reference/getter-setter.d.ts | 25 ++ crates/cli/tests/reference/getter-setter.js | 227 ++++++++++++++++ crates/cli/tests/reference/getter-setter.rs | 48 ++++ crates/cli/tests/reference/getter-setter.wat | 45 ++++ 6 files changed, 536 insertions(+), 59 deletions(-) create mode 100644 crates/cli/tests/reference/getter-setter.d.ts create mode 100644 crates/cli/tests/reference/getter-setter.js create mode 100644 crates/cli/tests/reference/getter-setter.rs create mode 100644 crates/cli/tests/reference/getter-setter.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9e743e065..17cdcc7261b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,12 @@ * Fixed potential `null` error when using `JsValue::as_debug_string()`. [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) +* Fixed generated types when the getter and setter of a property have different types. + [#4202](https://github.com/rustwasm/wasm-bindgen/pull/4202) + +* Fixed generated types when a static getter/setter has the same name as an instance getter/setter. + [#4202](https://github.com/rustwasm/wasm-bindgen/pull/4202) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 10658f37f3a..f1c81b61c8b 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -81,7 +81,7 @@ pub struct Context<'a> { } #[derive(Default)] -pub struct ExportedClass { +struct ExportedClass { comments: String, contents: String, /// The TypeScript for the class's methods. @@ -95,9 +95,29 @@ pub struct ExportedClass { is_inspectable: bool, /// All readable properties of the class readable_properties: Vec, - /// Map from field name to type as a string, docs plus whether it has a setter, - /// whether it's optional and whether it's static. - typescript_fields: HashMap, + /// Map from field to information about those fields + typescript_fields: HashMap, +} + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +struct FieldLocation { + name: String, + is_static: bool, +} +#[derive(Debug)] +struct FieldInfo { + name: String, + is_static: bool, + order: usize, + getter: Option, + setter: Option, +} +/// A getter or setter for a field. +#[derive(Debug)] +struct FieldAccessor { + ty: String, + docs: String, + is_optional: bool, } const INITIAL_HEAP_VALUES: &[&str] = &["undefined", "null", "true", "false"]; @@ -1130,27 +1150,8 @@ __wbg_set_wasm(wasm);" dst.push_str(&class.contents); ts_dst.push_str(&class.typescript); - let mut fields = class.typescript_fields.keys().collect::>(); - fields.sort(); // make sure we have deterministic output - for name in fields { - let (ty, docs, has_setter, is_optional, is_static) = &class.typescript_fields[name]; - ts_dst.push_str(docs); - ts_dst.push_str(" "); - if *is_static { - ts_dst.push_str("static "); - } - if !has_setter { - ts_dst.push_str("readonly "); - } - ts_dst.push_str(name); - if *is_optional { - ts_dst.push_str("?: "); - } else { - ts_dst.push_str(": "); - } - ts_dst.push_str(ty); - ts_dst.push_str(";\n"); - } + self.write_class_field_types(class, &mut ts_dst); + dst.push_str("}\n"); ts_dst.push_str("}\n"); @@ -1164,6 +1165,124 @@ __wbg_set_wasm(wasm);" Ok(()) } + fn write_class_field_types(&mut self, class: &ExportedClass, ts_dst: &mut String) { + let mut fields: Vec<&FieldInfo> = class.typescript_fields.values().collect(); + fields.sort_by_key(|f| f.order); // make sure we have deterministic output + + for FieldInfo { + name, + is_static, + getter, + setter, + .. + } in fields + { + let is_static = if *is_static { "static " } else { "" }; + + let write_docs = |ts_dst: &mut String, docs: &str| { + if docs.is_empty() { + return; + } + // indent by 2 spaces + for line in docs.lines() { + ts_dst.push_str(" "); + ts_dst.push_str(line); + ts_dst.push('\n'); + } + }; + let write_getter = |ts_dst: &mut String, getter: &FieldAccessor| { + write_docs(ts_dst, &getter.docs); + ts_dst.push_str(" "); + ts_dst.push_str(is_static); + ts_dst.push_str("get "); + ts_dst.push_str(name); + ts_dst.push_str("(): "); + ts_dst.push_str(&getter.ty); + ts_dst.push_str(";\n"); + }; + let write_setter = |ts_dst: &mut String, setter: &FieldAccessor| { + write_docs(ts_dst, &setter.docs); + ts_dst.push_str(" "); + ts_dst.push_str(is_static); + ts_dst.push_str("set "); + ts_dst.push_str(name); + ts_dst.push_str("(value: "); + ts_dst.push_str(&setter.ty); + if setter.is_optional { + ts_dst.push_str(" | undefined"); + } + ts_dst.push_str(");\n"); + }; + + match (getter, setter) { + (None, None) => unreachable!("field without getter or setter"), + (Some(getter), None) => { + // readonly property + write_docs(ts_dst, &getter.docs); + ts_dst.push_str(" "); + ts_dst.push_str(is_static); + ts_dst.push_str("readonly "); + ts_dst.push_str(name); + ts_dst.push_str(if getter.is_optional { "?: " } else { ": " }); + ts_dst.push_str(&getter.ty); + ts_dst.push_str(";\n"); + } + (None, Some(setter)) => { + // write-only property + + // Note: TypeScript does not handle the types of write-only + // properties correctly and will allow reads from write-only + // properties. This isn't a wasm-bindgen issue, but a + // TypeScript issue. + write_setter(ts_dst, setter); + } + (Some(getter), Some(setter)) => { + // read-write property + + // Here's the tricky part. The getter and setter might have + // different types. Obviously, we can only declare a + // property as `foo: T` if both the getter and setter have + // the same type `T`. If they don't, we have to declare the + // getter and setter separately. + + // We current generate types for optional arguments and + // return values differently. This is why for the field + // `foo: Option`, the setter will have type `T` with + // `is_optional` set, while the getter has type + // `T | undefined`. Because of this difference, we have to + // "normalize" the type of the setter. + let same_type = if setter.is_optional { + getter.ty == setter.ty.clone() + " | undefined" + } else { + getter.ty == setter.ty + }; + + if same_type { + // simple property, e.g. foo: T + + // Prefer the docs of the getter over the setter's + let docs = if !getter.docs.is_empty() { + &getter.docs + } else { + &setter.docs + }; + write_docs(ts_dst, docs); + ts_dst.push_str(" "); + ts_dst.push_str(is_static); + ts_dst.push_str(name); + ts_dst.push_str(if setter.is_optional { "?: " } else { ": " }); + ts_dst.push_str(&setter.ty); + ts_dst.push_str(";\n"); + } else { + // separate getter and setter + write_getter(ts_dst, getter); + write_setter(ts_dst, setter); + } + } + }; + } + } + fn expose_drop_ref(&mut self) { if !self.should_write_global("drop_ref") { return; @@ -2743,16 +2862,18 @@ __wbg_set_wasm(wasm);" prefix += "get "; // For getters and setters, we generate a separate TypeScript definition. if export.generate_typescript { - exported.push_accessor_ts( - &ts_docs, - name, + let location = FieldLocation { + name: name.clone(), + is_static: receiver.is_static(), + }; + let accessor = FieldAccessor { // This is only set to `None` when generating a constructor. - ts_ret_ty - .as_deref() - .expect("missing return type for getter"), - false, - receiver.is_static(), - ); + ty: ts_ret_ty.expect("missing return type for getter"), + docs: ts_docs.clone(), + is_optional: false, + }; + + exported.push_accessor_ts(location, accessor, false); } // Add the getter to the list of readable fields (used to generate `toJSON`) exported.readable_properties.push(name.clone()); @@ -2762,15 +2883,17 @@ __wbg_set_wasm(wasm);" AuxExportedMethodKind::Setter => { prefix += "set "; if export.generate_typescript { - let is_optional = exported.push_accessor_ts( - &ts_docs, - name, - &ts_arg_tys[0], - true, - receiver.is_static(), - ); - // Set whether the field is optional. - *is_optional = might_be_optional_field; + let location = FieldLocation { + name: name.clone(), + is_static: receiver.is_static(), + }; + let accessor = FieldAccessor { + ty: ts_arg_tys[0].clone(), + docs: ts_docs.clone(), + is_optional: might_be_optional_field, + }; + + exported.push_accessor_ts(location, accessor, true); } None } @@ -4427,26 +4550,29 @@ impl ExportedClass { } } - #[allow(clippy::assigning_clones)] // Clippy's suggested fix doesn't work at MSRV. fn push_accessor_ts( &mut self, - docs: &str, - field: &str, - ty: &str, + location: FieldLocation, + accessor: FieldAccessor, is_setter: bool, - is_static: bool, - ) -> &mut bool { - let (ty_dst, accessor_docs, has_setter, is_optional, is_static_dst) = - self.typescript_fields.entry(field.to_string()).or_default(); - - *ty_dst = ty.to_string(); - // Deterministic output: always use the getter's docs if available - if !docs.is_empty() && (accessor_docs.is_empty() || !is_setter) { - *accessor_docs = docs.to_owned(); + ) { + let size = self.typescript_fields.len(); + let field = self + .typescript_fields + .entry(location) + .or_insert_with_key(|location| FieldInfo { + name: location.name.to_string(), + is_static: location.is_static, + order: size, + getter: None, + setter: None, + }); + + if is_setter { + field.setter = Some(accessor); + } else { + field.getter = Some(accessor); } - *has_setter |= is_setter; - *is_static_dst = is_static; - is_optional } } diff --git a/crates/cli/tests/reference/getter-setter.d.ts b/crates/cli/tests/reference/getter-setter.d.ts new file mode 100644 index 00000000000..4c207c3c7e6 --- /dev/null +++ b/crates/cli/tests/reference/getter-setter.d.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +export class Foo { + free(): void; + x: number; + y?: number; + z?: number; + readonly lone_getter: number | undefined; + set lone_setter(value: number | undefined); + /** + * You will only read numbers. + */ + get weird(): number; + /** + * But you must write strings. + * + * Yes, this is totally fine in JS. + */ + set weird(value: string | undefined); + /** + * There can be static getters and setters too, and they can even have the + * same name as instance getters and setters. + */ + static x?: boolean; +} diff --git a/crates/cli/tests/reference/getter-setter.js b/crates/cli/tests/reference/getter-setter.js new file mode 100644 index 00000000000..789dfb2787e --- /dev/null +++ b/crates/cli/tests/reference/getter-setter.js @@ -0,0 +1,227 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +let WASM_VECTOR_LEN = 0; + +const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; + +let cachedTextEncoder = new lTextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +const FooFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_foo_free(ptr >>> 0, 1)); + +export class Foo { + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + FooFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_foo_free(ptr, 0); + } + /** + * @returns {number} + */ + get x() { + const ret = wasm.__wbg_get_foo_x(this.__wbg_ptr); + return ret >>> 0; + } + /** + * @param {number} arg0 + */ + set x(arg0) { + wasm.__wbg_set_foo_x(this.__wbg_ptr, arg0); + } + /** + * @returns {number | undefined} + */ + get y() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.__wbg_get_foo_y(retptr, this.__wbg_ptr); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + return r0 === 0 ? undefined : r1 >>> 0; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + /** + * @param {number | undefined} [arg0] + */ + set y(arg0) { + wasm.__wbg_set_foo_y(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0); + } + /** + * @returns {number | undefined} + */ + get z() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.foo_z(retptr, this.__wbg_ptr); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + return r0 === 0 ? undefined : r1 >>> 0; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + /** + * @param {number | undefined} [z] + */ + set z(z) { + wasm.foo_set_z(this.__wbg_ptr, !isLikeNone(z), isLikeNone(z) ? 0 : z); + } + /** + * @returns {number | undefined} + */ + get lone_getter() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.foo_lone_getter(retptr, this.__wbg_ptr); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + return r0 === 0 ? undefined : r1 >>> 0; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + /** + * @param {number | undefined} [value] + */ + set lone_setter(value) { + wasm.foo_set_lone_setter(this.__wbg_ptr, !isLikeNone(value), isLikeNone(value) ? 0 : value); + } + /** + * You will only read numbers. + * @returns {number} + */ + get weird() { + const ret = wasm.foo_weird(this.__wbg_ptr); + return ret >>> 0; + } + /** + * But you must write strings. + * + * Yes, this is totally fine in JS. + * @param {string | undefined} [value] + */ + set weird(value) { + var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + wasm.foo_set_weird(this.__wbg_ptr, ptr0, len0); + } + /** + * There can be static getters and setters too, and they can even have the + * same name as instance getters and setters. + * @returns {boolean | undefined} + */ + static get x() { + const ret = wasm.foo_x_static(); + return ret === 0xFFFFFF ? undefined : ret !== 0; + } + /** + * @param {boolean | undefined} [value] + */ + static set x(value) { + wasm.foo_set_x_static(isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0); + } +} + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/getter-setter.rs b/crates/cli/tests/reference/getter-setter.rs new file mode 100644 index 00000000000..184d34b0790 --- /dev/null +++ b/crates/cli/tests/reference/getter-setter.rs @@ -0,0 +1,48 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +struct Foo { + pub x: u32, + pub y: Option, + z: Option, +} + +#[wasm_bindgen] +impl Foo { + #[wasm_bindgen(getter)] + pub fn z(&self) -> Option { + self.z + } + #[wasm_bindgen(setter)] + pub fn set_z(&mut self, z: Option) { + self.z = z; + } + + #[wasm_bindgen(getter)] + pub fn lone_getter(&self) -> Option { + self.z + } + + #[wasm_bindgen(setter)] + pub fn set_lone_setter(&mut self, value: Option) {} + + /// You will only read numbers. + #[wasm_bindgen(getter)] + pub fn weird(&self) -> u32 { + 42 + } + /// But you must write strings. + /// + /// Yes, this is totally fine in JS. + #[wasm_bindgen(setter)] + pub fn set_weird(&mut self, value: Option) {} + + /// There can be static getters and setters too, and they can even have the + /// same name as instance getters and setters. + #[wasm_bindgen(getter = x)] + pub fn x_static() -> Option { + None + } + #[wasm_bindgen(setter = x)] + pub fn set_x_static(value: Option) {} +} diff --git a/crates/cli/tests/reference/getter-setter.wat b/crates/cli/tests/reference/getter-setter.wat new file mode 100644 index 00000000000..9688f99b7f2 --- /dev/null +++ b/crates/cli/tests/reference/getter-setter.wat @@ -0,0 +1,45 @@ +(module $reference_test.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32) (result i32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32))) + (type (;6;) (func (param i32 i32 i32 i32) (result i32))) + (func $__wbindgen_realloc (;0;) (type 6) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;1;) (type 4) (param i32 i32) (result i32)) + (func $__wbg_set_foo_y (;2;) (type 5) (param i32 i32 i32)) + (func $__wbg_get_foo_y (;3;) (type 3) (param i32 i32)) + (func $foo_z (;4;) (type 3) (param i32 i32)) + (func $foo_lone_getter (;5;) (type 3) (param i32 i32)) + (func $foo_set_weird (;6;) (type 5) (param i32 i32 i32)) + (func $foo_set_z (;7;) (type 5) (param i32 i32 i32)) + (func $foo_set_lone_setter (;8;) (type 5) (param i32 i32 i32)) + (func $__wbg_get_foo_x (;9;) (type 2) (param i32) (result i32)) + (func $__wbg_set_foo_x (;10;) (type 3) (param i32 i32)) + (func $foo_weird (;11;) (type 2) (param i32) (result i32)) + (func $foo_x_static (;12;) (type 0) (result i32)) + (func $__wbg_foo_free (;13;) (type 3) (param i32 i32)) + (func $foo_set_x_static (;14;) (type 1) (param i32)) + (func $__wbindgen_add_to_stack_pointer (;15;) (type 2) (param i32) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_foo_free" (func $__wbg_foo_free)) + (export "__wbg_get_foo_x" (func $__wbg_get_foo_x)) + (export "__wbg_set_foo_x" (func $__wbg_set_foo_x)) + (export "__wbg_get_foo_y" (func $__wbg_get_foo_y)) + (export "__wbg_set_foo_y" (func $__wbg_set_foo_y)) + (export "foo_z" (func $foo_z)) + (export "foo_set_z" (func $foo_set_z)) + (export "foo_lone_getter" (func $foo_lone_getter)) + (export "foo_set_lone_setter" (func $foo_set_lone_setter)) + (export "foo_weird" (func $foo_weird)) + (export "foo_set_weird" (func $foo_set_weird)) + (export "foo_x_static" (func $foo_x_static)) + (export "foo_set_x_static" (func $foo_set_x_static)) + (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") +) + From 04d508beb9d2295e60ad47b291b3b170130e62ae Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 31 Oct 2024 13:55:39 +0100 Subject: [PATCH 534/641] Disable enabling reference types by default with the bundler target (#4235) Update reference files to Rust v1.82. --- CHANGELOG.md | 3 ++ crates/cli-support/src/lib.rs | 5 +- crates/cli/tests/reference/add.wat | 2 +- crates/cli/tests/reference/anyref-empty.wat | 2 +- .../tests/reference/anyref-import-catch.js | 22 ++------- .../tests/reference/anyref-import-catch.wat | 18 ++++--- crates/cli/tests/reference/anyref-nop.wat | 2 +- crates/cli/tests/reference/builder.wat | 2 +- crates/cli/tests/reference/constructor.wat | 2 +- crates/cli/tests/reference/empty.wat | 2 +- crates/cli/tests/reference/enums.wat | 2 +- crates/cli/tests/reference/getter-setter.js | 48 ++++--------------- crates/cli/tests/reference/getter-setter.wat | 38 +++++++-------- crates/cli/tests/reference/import-catch.js | 22 ++------- crates/cli/tests/reference/import-catch.wat | 14 +++--- crates/cli/tests/reference/nop.wat | 2 +- crates/cli/tests/reference/pointers.wat | 2 +- crates/cli/tests/reference/raw.wat | 2 +- crates/cli/tests/reference/result-string.js | 25 ++-------- crates/cli/tests/reference/result-string.wat | 15 +++--- crates/cli/tests/reference/self-type.wat | 2 +- crates/cli/tests/reference/skip-jsdoc.wat | 2 +- crates/cli/tests/reference/string-arg.wat | 2 +- crates/cli/tests/reference/web-sys.wat | 2 +- 24 files changed, 80 insertions(+), 158 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17cdcc7261b..8bc3bdba01b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Optimized ABI performance for `Option<{i32,u32,isize,usize,f32,*const T,*mut T}>`. [#4183](https://github.com/rustwasm/wasm-bindgen/pull/4183) +* Reference type proposal transformations are not applied by default when detecting it in the Wasm module for the bundler target because currently `webpack` doesn't support it. + [#4235](https://github.com/rustwasm/wasm-bindgen/pull/4235) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 0602beb5d2b..b4f3f9c5b12 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -324,7 +324,10 @@ impl Bindgen { }; // Enable reference type transformations if the module is already using it. - if let Ok(true) = wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types") + // Currently `webpack` does not support reference types. + if !matches!(self.mode, OutputMode::Bundler { .. }) + && wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types").ok() + == Some(true) { self.externref = true; } diff --git a/crates/cli/tests/reference/add.wat b/crates/cli/tests/reference/add.wat index 62ab9c0876b..ea9d635ecc4 100644 --- a/crates/cli/tests/reference/add.wat +++ b/crates/cli/tests/reference/add.wat @@ -6,6 +6,6 @@ (export "memory" (memory 0)) (export "add_u32" (func $add_u32)) (export "add_i32" (func $add_i32)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/anyref-empty.wat b/crates/cli/tests/reference/anyref-empty.wat index 2ff9975bfff..1044fd51d5e 100644 --- a/crates/cli/tests/reference/anyref-empty.wat +++ b/crates/cli/tests/reference/anyref-empty.wat @@ -6,6 +6,6 @@ (export "memory" (memory 0)) (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_start" (func 0)) - (@custom "target_features" (after export) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") + (@custom "target_features" (after export) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index f8e28d8db96..b9a96c382b8 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -39,15 +39,6 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -let cachedDataViewMemory0 = null; - -function getDataViewMemory0() { - if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; -} - function takeFromExternrefTable0(idx) { const value = wasm.__wbindgen_export_2.get(idx); wasm.__externref_table_dealloc(idx); @@ -55,16 +46,9 @@ function takeFromExternrefTable0(idx) { } export function exported() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.exported(retptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - if (r1) { - throw takeFromExternrefTable0(r0); - } - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); + const ret = wasm.exported(); + if (ret[1]) { + throw takeFromExternrefTable0(ret[0]); } } diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index 7338f544d0a..c0bd0b51b81 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -1,24 +1,22 @@ (module $reference_test.wasm (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32))) - (type (;3;) (func (param i32) (result i32))) + (type (;2;) (func (result i32 i32))) + (type (;3;) (func (param i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $exported (;1;) (type 2) (param i32)) - (func $__externref_table_dealloc (;2;) (type 2) (param i32)) - (func $__externref_table_alloc (;3;) (type 1) (result i32)) - (func $__wbindgen_exn_store (;4;) (type 2) (param i32)) - (func $__wbindgen_add_to_stack_pointer (;5;) (type 3) (param i32) (result i32)) + (func $__externref_table_dealloc (;1;) (type 3) (param i32)) + (func $__externref_table_alloc (;2;) (type 1) (result i32)) + (func $__wbindgen_exn_store (;3;) (type 3) (param i32)) + (func $"exported multivalue shim" (;4;) (type 2) (result i32 i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) - (export "exported" (func $exported)) + (export "exported" (func $"exported multivalue shim")) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (export "__externref_table_alloc" (func $__externref_table_alloc)) (export "__wbindgen_export_2" (table 0)) - (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__externref_table_dealloc" (func $__externref_table_dealloc)) (export "__wbindgen_start" (func 0)) - (@custom "target_features" (after code) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/anyref-nop.wat b/crates/cli/tests/reference/anyref-nop.wat index 5b10a28d750..cc829fa21e9 100644 --- a/crates/cli/tests/reference/anyref-nop.wat +++ b/crates/cli/tests/reference/anyref-nop.wat @@ -8,6 +8,6 @@ (export "foo" (func $foo)) (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_start" (func 0)) - (@custom "target_features" (after code) "\03+\0fmutable-globals+\08sign-ext+\0freference-types") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index 47c4a031437..04ee04ef6b5 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -7,6 +7,6 @@ (export "memory" (memory 0)) (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) (export "classbuilder_builder" (func $classbuilder_builder)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index 08eb4887660..27bb6d6781c 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -7,6 +7,6 @@ (export "memory" (memory 0)) (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) (export "classconstructor_new" (func $classconstructor_new)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/empty.wat b/crates/cli/tests/reference/empty.wat index b2199f956b4..3cd6ac87a09 100644 --- a/crates/cli/tests/reference/empty.wat +++ b/crates/cli/tests/reference/empty.wat @@ -1,6 +1,6 @@ (module $reference_test.wasm (memory (;0;) 16) (export "memory" (memory 0)) - (@custom "target_features" (after export) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after export) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index 479c1c3ec89..cc9bb74b586 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -10,6 +10,6 @@ (export "option_enum_echo" (func $option_enum_echo)) (export "get_name" (func $get_name)) (export "option_string_enum_echo" (func $option_string_enum_echo)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/getter-setter.js b/crates/cli/tests/reference/getter-setter.js index 789dfb2787e..6c05b3065a9 100644 --- a/crates/cli/tests/reference/getter-setter.js +++ b/crates/cli/tests/reference/getter-setter.js @@ -24,15 +24,6 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -let cachedDataViewMemory0 = null; - -function getDataViewMemory0() { - if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; -} - function isLikeNone(x) { return x === undefined || x === null; } @@ -129,61 +120,40 @@ export class Foo { * @returns {number | undefined} */ get y() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.__wbg_get_foo_y(retptr, this.__wbg_ptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - return r0 === 0 ? undefined : r1 >>> 0; - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } + const ret = wasm.__wbg_get_foo_y(this.__wbg_ptr); + return ret === 0x100000001 ? undefined : ret; } /** * @param {number | undefined} [arg0] */ set y(arg0) { - wasm.__wbg_set_foo_y(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0); + wasm.__wbg_set_foo_y(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : (arg0) >>> 0); } /** * @returns {number | undefined} */ get z() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.foo_z(retptr, this.__wbg_ptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - return r0 === 0 ? undefined : r1 >>> 0; - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } + const ret = wasm.foo_z(this.__wbg_ptr); + return ret === 0x100000001 ? undefined : ret; } /** * @param {number | undefined} [z] */ set z(z) { - wasm.foo_set_z(this.__wbg_ptr, !isLikeNone(z), isLikeNone(z) ? 0 : z); + wasm.foo_set_z(this.__wbg_ptr, isLikeNone(z) ? 0x100000001 : (z) >>> 0); } /** * @returns {number | undefined} */ get lone_getter() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.foo_lone_getter(retptr, this.__wbg_ptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - return r0 === 0 ? undefined : r1 >>> 0; - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } + const ret = wasm.foo_lone_getter(this.__wbg_ptr); + return ret === 0x100000001 ? undefined : ret; } /** * @param {number | undefined} [value] */ set lone_setter(value) { - wasm.foo_set_lone_setter(this.__wbg_ptr, !isLikeNone(value), isLikeNone(value) ? 0 : value); + wasm.foo_set_lone_setter(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0); } /** * You will only read numbers. diff --git a/crates/cli/tests/reference/getter-setter.wat b/crates/cli/tests/reference/getter-setter.wat index 9688f99b7f2..3daf51bf7a5 100644 --- a/crates/cli/tests/reference/getter-setter.wat +++ b/crates/cli/tests/reference/getter-setter.wat @@ -2,26 +2,27 @@ (type (;0;) (func (result i32))) (type (;1;) (func (param i32))) (type (;2;) (func (param i32) (result i32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32 i32) (result i32))) - (type (;5;) (func (param i32 i32 i32))) - (type (;6;) (func (param i32 i32 i32 i32) (result i32))) - (func $__wbindgen_realloc (;0;) (type 6) (param i32 i32 i32 i32) (result i32)) - (func $__wbindgen_malloc (;1;) (type 4) (param i32 i32) (result i32)) - (func $__wbg_set_foo_y (;2;) (type 5) (param i32 i32 i32)) - (func $__wbg_get_foo_y (;3;) (type 3) (param i32 i32)) - (func $foo_z (;4;) (type 3) (param i32 i32)) - (func $foo_lone_getter (;5;) (type 3) (param i32 i32)) - (func $foo_set_weird (;6;) (type 5) (param i32 i32 i32)) - (func $foo_set_z (;7;) (type 5) (param i32 i32 i32)) - (func $foo_set_lone_setter (;8;) (type 5) (param i32 i32 i32)) - (func $__wbg_get_foo_x (;9;) (type 2) (param i32) (result i32)) - (func $__wbg_set_foo_x (;10;) (type 3) (param i32 i32)) + (type (;3;) (func (param i32) (result f64))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func (param i32 i32) (result i32))) + (type (;6;) (func (param i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32) (result i32))) + (type (;8;) (func (param i32 f64))) + (func $__wbindgen_realloc (;0;) (type 7) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;1;) (type 5) (param i32 i32) (result i32)) + (func $foo_set_weird (;2;) (type 6) (param i32 i32 i32)) + (func $__wbg_set_foo_y (;3;) (type 8) (param i32 f64)) + (func $__wbg_get_foo_y (;4;) (type 3) (param i32) (result f64)) + (func $__wbg_get_foo_x (;5;) (type 2) (param i32) (result i32)) + (func $foo_set_z (;6;) (type 8) (param i32 f64)) + (func $foo_set_lone_setter (;7;) (type 8) (param i32 f64)) + (func $foo_z (;8;) (type 3) (param i32) (result f64)) + (func $foo_lone_getter (;9;) (type 3) (param i32) (result f64)) + (func $__wbg_set_foo_x (;10;) (type 4) (param i32 i32)) (func $foo_weird (;11;) (type 2) (param i32) (result i32)) (func $foo_x_static (;12;) (type 0) (result i32)) - (func $__wbg_foo_free (;13;) (type 3) (param i32 i32)) + (func $__wbg_foo_free (;13;) (type 4) (param i32 i32)) (func $foo_set_x_static (;14;) (type 1) (param i32)) - (func $__wbindgen_add_to_stack_pointer (;15;) (type 2) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_foo_free" (func $__wbg_foo_free)) @@ -37,9 +38,8 @@ (export "foo_set_weird" (func $foo_set_weird)) (export "foo_x_static" (func $foo_x_static)) (export "foo_set_x_static" (func $foo_set_x_static)) - (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js index 4c4d0284851..3f6f772e0ae 100644 --- a/crates/cli/tests/reference/import-catch.js +++ b/crates/cli/tests/reference/import-catch.js @@ -27,15 +27,6 @@ function handleError(f, args) { } } -let cachedDataViewMemory0 = null; - -function getDataViewMemory0() { - if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; -} - function getObject(idx) { return heap[idx]; } function dropObject(idx) { @@ -51,16 +42,9 @@ function takeObject(idx) { } export function exported() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.exported(retptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - if (r1) { - throw takeObject(r0); - } - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); + const ret = wasm.exported(); + if (ret[1]) { + throw takeObject(ret[0]); } } diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import-catch.wat index 2189e238a2e..1645ae59dbc 100644 --- a/crates/cli/tests/reference/import-catch.wat +++ b/crates/cli/tests/reference/import-catch.wat @@ -1,14 +1,12 @@ (module $reference_test.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32) (result i32))) - (func $exported (;0;) (type 0) (param i32)) - (func $__wbindgen_exn_store (;1;) (type 0) (param i32)) - (func $__wbindgen_add_to_stack_pointer (;2;) (type 1) (param i32) (result i32)) + (type (;0;) (func (result i32 i32))) + (type (;1;) (func (param i32))) + (func $__wbindgen_exn_store (;0;) (type 1) (param i32)) + (func $"exported multivalue shim" (;1;) (type 0) (result i32 i32)) (memory (;0;) 17) (export "memory" (memory 0)) - (export "exported" (func $exported)) + (export "exported" (func $"exported multivalue shim")) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) - (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/nop.wat b/crates/cli/tests/reference/nop.wat index 211418dd944..1b0d33a23f5 100644 --- a/crates/cli/tests/reference/nop.wat +++ b/crates/cli/tests/reference/nop.wat @@ -4,6 +4,6 @@ (memory (;0;) 17) (export "memory" (memory 0)) (export "nop" (func $nop)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/pointers.wat b/crates/cli/tests/reference/pointers.wat index 5d64739088d..954d8a7ff1c 100644 --- a/crates/cli/tests/reference/pointers.wat +++ b/crates/cli/tests/reference/pointers.wat @@ -6,6 +6,6 @@ (export "memory" (memory 0)) (export "const_pointer" (func $const_pointer)) (export "mut_pointer" (func $mut_pointer)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/raw.wat b/crates/cli/tests/reference/raw.wat index d3589ef5dba..3d459092f0b 100644 --- a/crates/cli/tests/reference/raw.wat +++ b/crates/cli/tests/reference/raw.wat @@ -11,6 +11,6 @@ (export "__wbg_test_free" (func $__wbg_test_free)) (export "test_test1" (func $test_test1)) (export "test_test2" (func $test_test2)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result-string.js index caa17738225..ca996f741a9 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result-string.js @@ -19,15 +19,6 @@ function addHeapObject(obj) { return idx; } -let cachedDataViewMemory0 = null; - -function getDataViewMemory0() { - if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; -} - function getObject(idx) { return heap[idx]; } function dropObject(idx) { @@ -68,23 +59,17 @@ export function exported() { let deferred2_0; let deferred2_1; try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.exported(retptr); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); - var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); - var ptr1 = r0; - var len1 = r1; - if (r3) { + const ret = wasm.exported(); + var ptr1 = ret[0]; + var len1 = ret[1]; + if (ret[3]) { ptr1 = 0; len1 = 0; - throw takeObject(r2); + throw takeObject(ret[2]); } deferred2_0 = ptr1; deferred2_1 = len1; return getStringFromWasm0(ptr1, len1); } finally { - wasm.__wbindgen_add_to_stack_pointer(16); wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); } } diff --git a/crates/cli/tests/reference/result-string.wat b/crates/cli/tests/reference/result-string.wat index c7f63576bbd..591d80c3bc6 100644 --- a/crates/cli/tests/reference/result-string.wat +++ b/crates/cli/tests/reference/result-string.wat @@ -1,15 +1,12 @@ (module $reference_test.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32) (result i32))) - (type (;2;) (func (param i32 i32 i32))) - (func $exported (;0;) (type 0) (param i32)) - (func $__wbindgen_free (;1;) (type 2) (param i32 i32 i32)) - (func $__wbindgen_add_to_stack_pointer (;2;) (type 1) (param i32) (result i32)) + (type (;0;) (func (result i32 i32 i32 i32))) + (type (;1;) (func (param i32 i32 i32))) + (func $__wbindgen_free (;0;) (type 1) (param i32 i32 i32)) + (func $"exported multivalue shim" (;1;) (type 0) (result i32 i32 i32 i32)) (memory (;0;) 17) (export "memory" (memory 0)) - (export "exported" (func $exported)) - (export "__wbindgen_add_to_stack_pointer" (func $__wbindgen_add_to_stack_pointer)) + (export "exported" (func $"exported multivalue shim")) (export "__wbindgen_free" (func $__wbindgen_free)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/self-type.wat b/crates/cli/tests/reference/self-type.wat index 546667f8a53..667e060b4c9 100644 --- a/crates/cli/tests/reference/self-type.wat +++ b/crates/cli/tests/reference/self-type.wat @@ -20,6 +20,6 @@ (export "test_self_Self" (func $test_self_Self)) (export "test_self_ref_Self" (func $test_self_ref_Self)) (export "test_self_ref_mut_Self" (func $test_self_ref_mut_Self)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index 0179e135da5..2b7cadc23ee 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -6,6 +6,6 @@ (export "memory" (memory 0)) (export "docme" (func $docme)) (export "i_has_docs" (func $i_has_docs)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/string-arg.wat b/crates/cli/tests/reference/string-arg.wat index 1ce4e8ca28a..fae75cfbcba 100644 --- a/crates/cli/tests/reference/string-arg.wat +++ b/crates/cli/tests/reference/string-arg.wat @@ -10,6 +10,6 @@ (export "foo" (func $foo)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/web-sys.wat b/crates/cli/tests/reference/web-sys.wat index b4993ed4ac3..06265263889 100644 --- a/crates/cli/tests/reference/web-sys.wat +++ b/crates/cli/tests/reference/web-sys.wat @@ -15,6 +15,6 @@ (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) - (@custom "target_features" (after code) "\02+\0fmutable-globals+\08sign-ext") + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) From 37b9aa56bcea5f4d6c05302f4e4c46c4ca4e7a1a Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 31 Oct 2024 14:20:15 +0100 Subject: [PATCH 535/641] Fix invalid TS return types for multivalue signatures (#4210) --- CHANGELOG.md | 3 +++ crates/cli-support/src/wasm2es6js.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bc3bdba01b..3acfc5e262c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,9 @@ * Fixed generated types when a static getter/setter has the same name as an instance getter/setter. [#4202](https://github.com/rustwasm/wasm-bindgen/pull/4202) +* Fixed invalid TypeScript return types for multivalue signatures. + [#4210](https://github.com/rustwasm/wasm-bindgen/pull/4210) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/wasm2es6js.rs b/crates/cli-support/src/wasm2es6js.rs index 36298fdd54e..bdf6f020f68 100644 --- a/crates/cli-support/src/wasm2es6js.rs +++ b/crates/cli-support/src/wasm2es6js.rs @@ -99,7 +99,7 @@ pub fn interface(module: &Module) -> Result { ret = match ty.results().len() { 0 => "void", 1 => "number", - _ => "Array", + _ => "number[]", }, )); } @@ -147,7 +147,7 @@ pub fn typescript(module: &Module) -> Result { ret = match ty.results().len() { 0 => "void", 1 => "number", - _ => "Array", + _ => "number[]", }, )); } From 74353cc724503e579bcb8134e2c85d90a4af1f79 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 31 Oct 2024 15:04:57 +0100 Subject: [PATCH 536/641] Deprecate `--reference-types` (#4237) --- CHANGELOG.md | 6 ++++ crates/cli/src/bin/wasm-bindgen.rs | 2 +- crates/externref-xform/src/lib.rs | 28 ++++++++++++++++--- crates/externref-xform/tests/anyref-param.wat | 3 +- crates/externref-xform/tests/mixed-export.wat | 3 +- guide/src/reference/cli.md | 8 ------ guide/src/reference/reference-types.md | 3 +- 7 files changed, 35 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3acfc5e262c..0d026e54c1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ * Reference type proposal transformations are not applied by default when detecting it in the Wasm module for the bundler target because currently `webpack` doesn't support it. [#4235](https://github.com/rustwasm/wasm-bindgen/pull/4235) +* Deprecate `--reference-types` in favor of automatic target feature detection. + [#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237) + ### Fixed * Fixed methods with `self: &Self` consuming the object. @@ -57,6 +60,9 @@ * Fixed invalid TypeScript return types for multivalue signatures. [#4210](https://github.com/rustwasm/wasm-bindgen/pull/4210) +* Only emit `table.fill` instructions if the bulk-memory proposal is enabled. + [#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index 6076641c138..bcea1495b3e 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -40,7 +40,7 @@ Options: --web Deprecated, use `--target web` --no-modules Deprecated, use `--target no-modules` --weak-refs Deprecated, is runtime-detected - --reference-types Enable usage of WebAssembly reference types + --reference-types Deprecated, use `-Ctarget-feature=+reference-types` -V --version Print the version number of wasm-bindgen Additional documentation: https://rustwasm.github.io/wasm-bindgen/reference/cli.html diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index dae449264c0..018f2f96716 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -52,6 +52,9 @@ pub struct Context { // The externref table we'll be using, injected after construction table: Option, + + // If the bulk memory proposal is enabled. + bulk_memory: bool, } pub struct Meta { @@ -105,6 +108,11 @@ impl Context { wasm_bindgen_wasm_conventions::insert_target_feature(module, "reference-types") .context("failed to parse `target_features` custom section")?; + self.bulk_memory = matches!( + wasm_bindgen_wasm_conventions::target_feature(module, "bulk-memory"), + Ok(true) + ); + // Figure out what the maximum index of functions pointers are. We'll // be adding new entries to the function table later (maybe) so // precalculate this ahead of time. @@ -671,11 +679,23 @@ impl Transform<'_> { // that the table doesn't accidentally hold a strong reference to items // no longer in use by our Wasm instance. if externref_stack > 0 { + if self.cx.bulk_memory { + body.local_get(fp) + .ref_null(RefType::Externref) + .i32_const(externref_stack) + .table_fill(self.table); + } else { + for i in 0..externref_stack { + body.local_get(fp); + if i > 0 { + body.i32_const(i).binop(BinaryOp::I32Add); + } + body.ref_null(RefType::Externref); + body.table_set(self.table); + } + } + body.local_get(fp) - .ref_null(RefType::Externref) - .i32_const(externref_stack) - .table_fill(self.table) - .local_get(fp) .i32_const(externref_stack) .binop(BinaryOp::I32Add) .global_set(self.stack_pointer); diff --git a/crates/externref-xform/tests/anyref-param.wat b/crates/externref-xform/tests/anyref-param.wat index d36133fc763..27310bd8024 100644 --- a/crates/externref-xform/tests/anyref-param.wat +++ b/crates/externref-xform/tests/anyref-param.wat @@ -25,8 +25,7 @@ call $foo local.get 1 ref.null extern - i32.const 1 - table.fill 0 + table.set 0 local.get 1 i32.const 1 i32.add diff --git a/crates/externref-xform/tests/mixed-export.wat b/crates/externref-xform/tests/mixed-export.wat index 26a08f2c249..f67601c03e2 100644 --- a/crates/externref-xform/tests/mixed-export.wat +++ b/crates/externref-xform/tests/mixed-export.wat @@ -34,8 +34,7 @@ call $a local.get 5 ref.null extern - i32.const 1 - table.fill 0 + table.set 0 local.get 5 i32.const 1 i32.add diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index ad300bdca5e..b6f6746988f 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -84,14 +84,6 @@ When generating bundler-compatible code (see the section on [deployment]) this indicates that the bundled code is always intended to go into a browser so a few checks for Node.js can be elided. -### `--reference-types` - -Enables usage of the [WebAssembly References Types -proposal](https://github.com/webassembly/reference-types) proposal, meaning that -the WebAssembly binary will use `externref` when importing and exporting -functions that work with `JsValue`. For more information see the [documentation -about reference types](./reference-types.md). - ### `--omit-default-module-path` Don't add WebAssembly fallback imports in generated JavaScript. diff --git a/guide/src/reference/reference-types.md b/guide/src/reference/reference-types.md index c5315d6a97e..5b950427ca3 100644 --- a/guide/src/reference/reference-types.md +++ b/guide/src/reference/reference-types.md @@ -42,7 +42,8 @@ export function takes_js_value(a) { We can see here how under the hood the JS is managing a table of JS values which are passed to the Wasm binary, so Wasm actually only works in indices. If we -pass the `--reference-types` flag to the CLI, however, the generated JS looks like: +compile with `-Ctarget-feature=+reference-types` (by default since Rust v1.82), +however, the generated JS looks like: ```js export function takes_js_value(a) { From e41d601017ed165d677132a242336a5cf75bbc5e Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 31 Oct 2024 15:18:47 +0100 Subject: [PATCH 537/641] Improved indentation and enum formatting (#4205) --- crates/cli-support/src/js/mod.rs | 11 ++++------ crates/cli-support/src/lib.rs | 22 ++++++++++++++------ crates/cli/tests/reference/enums.js | 32 +++++++++++++++++------------ 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index f1c81b61c8b..5ab61f3c4bc 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3910,12 +3910,9 @@ __wbg_set_wasm(wasm);" } else { format_doc_comments(comments, None) }; - if !variant_docs.is_empty() { - variants.push('\n'); - variants.push_str(&variant_docs); - } - variants.push_str(&format!("{}:{},", name, value)); - variants.push_str(&format!("\"{}\":\"{}\",", value, name)); + variants.push_str(&variant_docs); + variants.push_str(&format!("{}: {}, ", name, value)); + variants.push_str(&format!("\"{}\": \"{}\",\n", value, name)); if enum_.generate_typescript { self.typescript.push('\n'); if !variant_docs.is_empty() { @@ -3945,7 +3942,7 @@ __wbg_set_wasm(wasm);" self.export( &enum_.name, - &format!("Object.freeze({{ {} }})", variants), + &format!("Object.freeze({{\n{}}})", variants), Some(&docs), )?; diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index b4f3f9c5b12..75c39152f20 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -501,9 +501,22 @@ fn reset_indentation(s: &str) -> String { for line in s.lines() { let line = line.trim(); - if line.starts_with('}') || (line.ends_with('}') && !is_doc_comment(line)) { + + // handle doc comments separately + if is_doc_comment(line) { + for _ in 0..indent { + dst.push_str(" "); + } + dst.push(' '); + dst.push_str(line); + dst.push('\n'); + continue; + } + + if line.starts_with('}') { indent = indent.saturating_sub(1); } + let extra = if line.starts_with(':') || line.starts_with('?') { 1 } else { @@ -513,14 +526,11 @@ fn reset_indentation(s: &str) -> String { for _ in 0..indent + extra { dst.push_str(" "); } - if is_doc_comment(line) { - dst.push(' '); - } dst.push_str(line); } dst.push('\n'); - // Ignore { inside of comments and if it's an exported enum - if line.ends_with('{') && !is_doc_comment(line) && !line.ends_with("Object.freeze({") { + + if line.ends_with('{') { indent += 1; } } diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index ab820abbc3f..a425ef2874f 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -67,22 +67,28 @@ export function option_string_enum_echo(color) { * @enum {0 | 1 | 2} */ export const Color = Object.freeze({ -/** - * Green as a leaf. - */ -Green:0,"0":"Green", -/** - * Yellow as the sun. - */ -Yellow:1,"1":"Yellow", -/** - * Red as a rose. - */ -Red:2,"2":"Red", }); + /** + * Green as a leaf. + */ + Green: 0, "0": "Green", + /** + * Yellow as the sun. + */ + Yellow: 1, "1": "Yellow", + /** + * Red as a rose. + */ + Red: 2, "2": "Red", +}); /** * @enum {0 | 1 | 42 | 43} */ -export const ImplicitDiscriminant = Object.freeze({ A:0,"0":"A",B:1,"1":"B",C:42,"42":"C",D:43,"43":"D", }); +export const ImplicitDiscriminant = Object.freeze({ + A: 0, "0": "A", + B: 1, "1": "B", + C: 42, "42": "C", + D: 43, "43": "D", +}); const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; From ff8b6838d0ecc418bd84d5eec0b2d7defca41707 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 31 Oct 2024 15:43:08 +0100 Subject: [PATCH 538/641] Deprecate `Bindgen::reference_types()` (#4238) --- crates/cli-support/src/lib.rs | 1 + crates/cli/src/bin/wasm-bindgen.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 75c39152f20..963cc5fbf6c 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -125,6 +125,7 @@ impl Bindgen { self } + #[deprecated = "automatically detected via `-Ctarget-feature=+reference-types`"] pub fn reference_types(&mut self, enable: bool) -> &mut Bindgen { self.externref = enable; self diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index bcea1495b3e..e3d89b32272 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -129,6 +129,7 @@ fn rmain(args: &Args) -> Result<(), Error> { .omit_default_module_path(args.flag_omit_default_module_path) .split_linked_modules(args.flag_split_linked_modules); if let Some(true) = args.flag_reference_types { + #[allow(deprecated)] b.reference_types(true); } if let Some(ref name) = args.flag_no_modules_global { From 9f1763565e1d576599e5c111e2f6cd12646c879f Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 31 Oct 2024 20:04:49 +0100 Subject: [PATCH 539/641] More tests for result type (#4208) --- crates/cli/tests/reference/result-string.d.ts | 3 - crates/cli/tests/reference/result-string.rs | 6 -- crates/cli/tests/reference/result-string.wat | 12 ---- crates/cli/tests/reference/result.d.ts | 5 ++ .../reference/{result-string.js => result.js} | 67 +++++++++++++------ crates/cli/tests/reference/result.rs | 16 +++++ crates/cli/tests/reference/result.wat | 18 +++++ 7 files changed, 84 insertions(+), 43 deletions(-) delete mode 100644 crates/cli/tests/reference/result-string.d.ts delete mode 100644 crates/cli/tests/reference/result-string.rs delete mode 100644 crates/cli/tests/reference/result-string.wat create mode 100644 crates/cli/tests/reference/result.d.ts rename crates/cli/tests/reference/{result-string.js => result.js} (77%) create mode 100644 crates/cli/tests/reference/result.rs create mode 100644 crates/cli/tests/reference/result.wat diff --git a/crates/cli/tests/reference/result-string.d.ts b/crates/cli/tests/reference/result-string.d.ts deleted file mode 100644 index 561576d42cb..00000000000 --- a/crates/cli/tests/reference/result-string.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export function exported(): string; diff --git a/crates/cli/tests/reference/result-string.rs b/crates/cli/tests/reference/result-string.rs deleted file mode 100644 index eb965cbde2b..00000000000 --- a/crates/cli/tests/reference/result-string.rs +++ /dev/null @@ -1,6 +0,0 @@ -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub fn exported() -> Result { - Err(JsValue::from(5i32)) -} diff --git a/crates/cli/tests/reference/result-string.wat b/crates/cli/tests/reference/result-string.wat deleted file mode 100644 index 591d80c3bc6..00000000000 --- a/crates/cli/tests/reference/result-string.wat +++ /dev/null @@ -1,12 +0,0 @@ -(module $reference_test.wasm - (type (;0;) (func (result i32 i32 i32 i32))) - (type (;1;) (func (param i32 i32 i32))) - (func $__wbindgen_free (;0;) (type 1) (param i32 i32 i32)) - (func $"exported multivalue shim" (;1;) (type 0) (result i32 i32 i32 i32)) - (memory (;0;) 17) - (export "memory" (memory 0)) - (export "exported" (func $"exported multivalue shim")) - (export "__wbindgen_free" (func $__wbindgen_free)) - (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") -) - diff --git a/crates/cli/tests/reference/result.d.ts b/crates/cli/tests/reference/result.d.ts new file mode 100644 index 00000000000..b2cb99de65e --- /dev/null +++ b/crates/cli/tests/reference/result.d.ts @@ -0,0 +1,5 @@ +/* tslint:disable */ +/* eslint-disable */ +export function result_string(): string; +export function result_void(): void; +export function result_i32(): number; diff --git a/crates/cli/tests/reference/result-string.js b/crates/cli/tests/reference/result.js similarity index 77% rename from crates/cli/tests/reference/result-string.js rename to crates/cli/tests/reference/result.js index ca996f741a9..62b1b902c59 100644 --- a/crates/cli/tests/reference/result-string.js +++ b/crates/cli/tests/reference/result.js @@ -4,6 +4,26 @@ export function __wbg_set_wasm(val) { } +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + const heap = new Array(128).fill(undefined); heap.push(undefined, null, true, false); @@ -32,34 +52,14 @@ function takeObject(idx) { dropObject(idx); return ret; } - -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} /** * @returns {string} */ -export function exported() { +export function result_string() { let deferred2_0; let deferred2_1; try { - const ret = wasm.exported(); + const ret = wasm.result_string(); var ptr1 = ret[0]; var len1 = ret[1]; if (ret[3]) { @@ -74,6 +74,29 @@ export function exported() { } } +export function result_void() { + const ret = wasm.result_void(); + if (ret[1]) { + throw takeObject(ret[0]); + } +} + +/** + * @returns {number} + */ +export function result_i32() { + const ret = wasm.result_i32(); + if (ret[2]) { + throw takeObject(ret[1]); + } + return ret[0]; +} + +export function __wbindgen_error_new(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); +}; + export function __wbindgen_number_new(arg0) { const ret = arg0; return addHeapObject(ret); diff --git a/crates/cli/tests/reference/result.rs b/crates/cli/tests/reference/result.rs new file mode 100644 index 00000000000..2ac0ba0d977 --- /dev/null +++ b/crates/cli/tests/reference/result.rs @@ -0,0 +1,16 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn result_string() -> Result { + Err(JsValue::from(5i32)) +} + +#[wasm_bindgen] +pub fn result_void() -> Result<(), JsError> { + Err(JsError::new("message")) +} + +#[wasm_bindgen] +pub fn result_i32() -> Result { + Ok(1) +} diff --git a/crates/cli/tests/reference/result.wat b/crates/cli/tests/reference/result.wat new file mode 100644 index 00000000000..59dddf4af66 --- /dev/null +++ b/crates/cli/tests/reference/result.wat @@ -0,0 +1,18 @@ +(module $reference_test.wasm + (type (;0;) (func (result i32 i32))) + (type (;1;) (func (result i32 i32 i32))) + (type (;2;) (func (result i32 i32 i32 i32))) + (type (;3;) (func (param i32 i32 i32))) + (func $__wbindgen_free (;0;) (type 3) (param i32 i32 i32)) + (func $"result_string multivalue shim" (;1;) (type 2) (result i32 i32 i32 i32)) + (func $"result_i32 multivalue shim" (;2;) (type 1) (result i32 i32 i32)) + (func $"result_void multivalue shim" (;3;) (type 0) (result i32 i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "result_string" (func $"result_string multivalue shim")) + (export "result_void" (func $"result_void multivalue shim")) + (export "result_i32" (func $"result_i32 multivalue shim")) + (export "__wbindgen_free" (func $__wbindgen_free)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + From 5926c8750954e63a2226e95d4a580c3e22827cce Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com> Date: Fri, 1 Nov 2024 00:11:27 +0300 Subject: [PATCH 540/641] wasm-bindgen-webidl: use `clap` instead of `structopt` (#4219) structopt is unmaintained, it uses very old version of clap, which pulls some old dependencies --- crates/webidl/Cargo.toml | 2 +- crates/webidl/src/main.rs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index fecfcb7c973..fde8c524d39 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -7,6 +7,7 @@ version = "0.0.0" [dependencies] anyhow = "1.0" +clap = { version = "4.5", features = ["derive"] } env_logger = "0.11.5" heck = "0.5" lazy_static = "1.4.0" @@ -15,7 +16,6 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' sourcefile = "0.2" -structopt = "0.3.9" syn = { version = '2.0', features = ['extra-traits', 'full'] } wasm-bindgen-backend = { path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } diff --git a/crates/webidl/src/main.rs b/crates/webidl/src/main.rs index 57960a2cc66..4f70bb9bdba 100644 --- a/crates/webidl/src/main.rs +++ b/crates/webidl/src/main.rs @@ -1,33 +1,30 @@ mod update_cargo_toml; use anyhow::Result; +use clap::Parser; use std::path::PathBuf; -use structopt::StructOpt; use update_cargo_toml::update_cargo_toml_features; -#[derive(StructOpt, Debug)] +#[derive(Parser, Debug)] #[structopt( name = "wasm-bindgen-webidl", about = "Converts WebIDL into wasm-bindgen compatible code." )] struct Opt { - #[structopt(parse(from_os_str))] input_dir: PathBuf, - #[structopt(parse(from_os_str))] output_dir: PathBuf, - #[structopt(long)] + #[clap(long)] no_features: bool, - #[structopt(parse(from_os_str))] cargo_toml_path: Option, } fn main() -> Result<()> { env_logger::init(); - let opt = Opt::from_args(); + let opt = Opt::parse(); let features = !opt.no_features; From f1d60abe8244eceff2d08d0e7e9b55b07a8b2e1f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 31 Oct 2024 23:22:02 +0100 Subject: [PATCH 541/641] Fix `JsCast::instanceof()` not respecting JS namespaces (#4241) --- CHANGELOG.md | 3 +++ crates/macro-support/src/parser.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d026e54c1d..f010e99fb8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,9 @@ * Only emit `table.fill` instructions if the bulk-memory proposal is enabled. [#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237) +* Fixed calls to `JsCast::instanceof()` not respecting JavaScript namespaces. + [#4241](https://github.com/rustwasm/wasm-bindgen/pull/4241) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 39638bca4fc..a2be7045d05 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -708,7 +708,11 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType { .map_or_else(|| self.ident.to_string(), |s| s.to_string()); let typescript_type = attrs.typescript_type().map(|s| s.0.to_string()); let is_type_of = attrs.is_type_of().cloned(); - let shim = format!("__wbg_instanceof_{}_{}", self.ident, ShortHash(&self.ident)); + let shim = format!( + "__wbg_instanceof_{}_{}", + self.ident, + ShortHash((attrs.js_namespace().map(|(ns, _)| ns), &self.ident)) + ); let mut extends = Vec::new(); let mut vendor_prefixes = Vec::new(); let no_deref = attrs.no_deref().is_some(); From 61e50b662bc505318350f403f4ef6e5cd9ee8dd1 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 7 Nov 2024 22:18:01 +0100 Subject: [PATCH 542/641] Improved how references test handles paths (#4242) --- crates/cli/tests/reference.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index df9c7d27399..76d9a4a9756 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -42,7 +42,7 @@ fn main() -> Result<()> { let filter = env::args().nth(1); let mut tests = Vec::new(); - let dir = env::current_dir()?.join("tests/reference"); + let dir = repo_root().join("crates/cli/tests/reference"); for entry in dir.read_dir()? { let path = entry?.path(); if path.extension().and_then(|s| s.to_str()) != Some("rs") { @@ -224,19 +224,15 @@ fn diff(a: &str, b: &str) -> Result<()> { } fn target_dir() -> PathBuf { - let mut dir = env::current_exe().unwrap(); - dir.pop(); // current exe - if dir.ends_with("deps") { - dir.pop(); - } - dir.pop(); // debug and/or release - dir + repo_root().join("target/tests/reference") } fn repo_root() -> PathBuf { let mut repo_root = env::current_dir().unwrap(); - repo_root.pop(); // remove 'cli' - repo_root.pop(); // remove 'crates' + if repo_root.file_name() == Some("cli".as_ref()) { + repo_root.pop(); // remove 'cli' + repo_root.pop(); // remove 'crates' + } repo_root } From dcf25667aee85d0d2e264122f289e4ab4612e134 Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:27:24 +0300 Subject: [PATCH 543/641] webidl: fix structopt macro to be clap (#4244) --- crates/webidl/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/webidl/src/main.rs b/crates/webidl/src/main.rs index 4f70bb9bdba..3c7e869bf48 100644 --- a/crates/webidl/src/main.rs +++ b/crates/webidl/src/main.rs @@ -6,10 +6,7 @@ use std::path::PathBuf; use update_cargo_toml::update_cargo_toml_features; #[derive(Parser, Debug)] -#[structopt( - name = "wasm-bindgen-webidl", - about = "Converts WebIDL into wasm-bindgen compatible code." -)] +#[clap(about = "Converts WebIDL into wasm-bindgen compatible code.")] struct Opt { input_dir: PathBuf, From 1f739b61d6735fa61f6d6668c1fc034e79efa1bc Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 7 Nov 2024 23:09:50 +0100 Subject: [PATCH 544/641] Fixed imports with late binding and `this` (#4225) --- CHANGELOG.md | 3 + crates/cli-support/src/js/mod.rs | 15 +++ crates/cli/tests/reference/import-catch.js | 54 ----------- crates/cli/tests/reference/import-catch.rs | 12 --- .../{import-catch.d.ts => import.d.ts} | 0 crates/cli/tests/reference/import.js | 95 +++++++++++++++++++ crates/cli/tests/reference/import.rs | 34 +++++++ .../{import-catch.wat => import.wat} | 0 8 files changed, 147 insertions(+), 66 deletions(-) delete mode 100644 crates/cli/tests/reference/import-catch.js delete mode 100644 crates/cli/tests/reference/import-catch.rs rename crates/cli/tests/reference/{import-catch.d.ts => import.d.ts} (100%) create mode 100644 crates/cli/tests/reference/import.js create mode 100644 crates/cli/tests/reference/import.rs rename crates/cli/tests/reference/{import-catch.wat => import.wat} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f010e99fb8f..a0327e42a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,9 @@ * Fixed calls to `JsCast::instanceof()` not respecting JavaScript namespaces. [#4241](https://github.com/rustwasm/wasm-bindgen/pull/4241) +* Fixed imports for functions using `this` and late binding. + [#4225](https://github.com/rustwasm/wasm-bindgen/pull/4225) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 5ab61f3c4bc..aff91c6cfcc 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -3062,6 +3062,21 @@ __wbg_set_wasm(wasm);" } } + if let JsImportName::Global { .. } | JsImportName::VendorPrefixed { .. } = js.name { + // We generally cannot import globals directly, because users can + // change most globals at runtime. + // + // An obvious example of this when the object literally changes + // (e.g. binding `foo.bar`), but polyfills can also change the + // object or fundtion. + // + // Late binding is another issue. The function might not even be + // defined when the Wasm module is instantiated. In such cases, + // there is an observable difference between a direct import and a + // JS shim calling the function. + return Ok(false); + } + self.expose_not_defined(); let name = self.import_name(js)?; let js = format!( diff --git a/crates/cli/tests/reference/import-catch.js b/crates/cli/tests/reference/import-catch.js deleted file mode 100644 index 3f6f772e0ae..00000000000 --- a/crates/cli/tests/reference/import-catch.js +++ /dev/null @@ -1,54 +0,0 @@ -let wasm; -export function __wbg_set_wasm(val) { - wasm = val; -} - - -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); - } -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - -export function exported() { - const ret = wasm.exported(); - if (ret[1]) { - throw takeObject(ret[0]); - } -} - -export function __wbg_foo_95fe1a04017077db() { return handleError(function () { - foo(); -}, arguments) }; - diff --git a/crates/cli/tests/reference/import-catch.rs b/crates/cli/tests/reference/import-catch.rs deleted file mode 100644 index b6a6e58fbf9..00000000000 --- a/crates/cli/tests/reference/import-catch.rs +++ /dev/null @@ -1,12 +0,0 @@ -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -extern "C" { - #[wasm_bindgen(catch)] - fn foo() -> Result<(), JsValue>; -} - -#[wasm_bindgen] -pub fn exported() -> Result<(), JsValue> { - foo() -} diff --git a/crates/cli/tests/reference/import-catch.d.ts b/crates/cli/tests/reference/import.d.ts similarity index 100% rename from crates/cli/tests/reference/import-catch.d.ts rename to crates/cli/tests/reference/import.d.ts diff --git a/crates/cli/tests/reference/import.js b/crates/cli/tests/reference/import.js new file mode 100644 index 00000000000..229dd246115 --- /dev/null +++ b/crates/cli/tests/reference/import.js @@ -0,0 +1,95 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +let heap_next = heap.length; + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +function getObject(idx) { return heap[idx]; } + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +export function exported() { + const ret = wasm.exported(); + if (ret[1]) { + throw takeObject(ret[0]); + } +} + +export function __wbg_add_dd5307a7ca6818d5(arg0, arg1) { + const ret = add(arg0, arg1); + return ret; +}; + +export function __wbg_barfromfoo_d097f3ec35aab47c() { + bar_from_foo(); +}; + +export function __wbg_catchme_a7bca7f3d5a5f319() { return handleError(function () { + catch_me(); +}, arguments) }; + +export function __wbg_nocatch_62552fa42a58590b() { + no_catch(); +}; + +export function __wbg_reload_90d82b22b83c1d99() { + window.location.reload(); +}; + +export function __wbg_write_d258674ff6f0ea8d(arg0, arg1) { + window.document.write(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/import.rs b/crates/cli/tests/reference/import.rs new file mode 100644 index 00000000000..a7bea1953ed --- /dev/null +++ b/crates/cli/tests/reference/import.rs @@ -0,0 +1,34 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + // Both `catch_me` and `no_catch` should be defined in the JS and invoke + // their respective JS function inside a JS shim function. This is + // important, because these 2 function may not be defined when the WASM + // module is instantiated. + #[wasm_bindgen(catch)] + fn catch_me() -> Result<(), JsValue>; + fn no_catch(); + + // Reload needs to be passed the right `this` parameter in JS. + #[wasm_bindgen(js_namespace = ["window", "location"])] + fn reload(); + #[wasm_bindgen(js_namespace = ["window", "document"])] + fn write(s: &str); + + // module import + #[wasm_bindgen(module = "./foo.js")] + fn bar_from_foo(); + #[wasm_bindgen(inline_js = "export function add(a,b) { return a + b; }")] + fn add(a: f64, b: f64) -> f64; +} + +#[wasm_bindgen] +pub fn exported() -> Result<(), JsValue> { + bar_from_foo(); + let _ = add(1.0, 2.0); + reload(); + write(""); + no_catch(); + catch_me() +} diff --git a/crates/cli/tests/reference/import-catch.wat b/crates/cli/tests/reference/import.wat similarity index 100% rename from crates/cli/tests/reference/import-catch.wat rename to crates/cli/tests/reference/import.wat From 89fef8cb016c96bca910a6b5a07a3391749ff5f7 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 7 Nov 2024 23:10:04 +0100 Subject: [PATCH 545/641] Added more documentation for `bool`, `char`, and numeric types (#4245) --- guide/src/reference/types/bool.md | 4 ++ .../reference/types/boxed-number-slices.md | 2 +- guide/src/reference/types/char.md | 8 +++ .../reference/types/exported-rust-types.md | 5 +- guide/src/reference/types/numbers.md | 53 ++++++++++++++++++- 5 files changed, 68 insertions(+), 4 deletions(-) diff --git a/guide/src/reference/types/bool.md b/guide/src/reference/types/bool.md index 6859de8c249..0ef43029250 100644 --- a/guide/src/reference/types/bool.md +++ b/guide/src/reference/types/bool.md @@ -4,6 +4,10 @@ |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | Yes | No | No | Yes | Yes | Yes | A JavaScript boolean value | +> **Note**: Only [JavaScript `Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) values (`true` or `false`) are supported when calling into Rust. If you want to pass truthy or falsy values to Rust, convert them to a boolean using `Boolean(value)` first. +> +> If you are using TypeScript, you don't have to worry about this, as TypeScript will emit a compiler error if you try to pass a non-`boolean` value. + ## Example Rust Usage ```rust diff --git a/guide/src/reference/types/boxed-number-slices.md b/guide/src/reference/types/boxed-number-slices.md index 73cbf0d1891..6df85e18287 100644 --- a/guide/src/reference/types/boxed-number-slices.md +++ b/guide/src/reference/types/boxed-number-slices.md @@ -4,7 +4,7 @@ |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | Yes | No | No | Yes | Yes | Yes | A JavaScript `TypedArray` of the appropriate type (`Int32Array`, `Uint8Array`, etc...) | -Note that the contents of the slice are copied into the JavaScript `TypedArray` +> **Note:** The contents of the slice are copied into a JavaScript [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) from the Wasm linear memory when returning a boxed slice to JavaScript, and vice versa when receiving a JavaScript `TypedArray` as a boxed slice in Rust. diff --git a/guide/src/reference/types/char.md b/guide/src/reference/types/char.md index 168f93191b3..c8e726ac6ab 100644 --- a/guide/src/reference/types/char.md +++ b/guide/src/reference/types/char.md @@ -4,6 +4,14 @@ |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | Yes | No | No | Yes | No | No | A JavaScript string value | +Since JavaScript doesn't have a character type, `char` is represented as a JavaScript string with one Unicode code point. + +> **Note**: [JavaScript strings uses UTF-16 encoding](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#utf-16_characters_unicode_code_points_and_grapheme_clusters). This means that a single `char` may be represented by a string of length 1 or 2 in JavaScript, depending on the Unicode code point. See [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) for more information. + +When passed into Rust, the `char` value of a JavaScript string is determined using [`codePointAt(0)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt). If the JavaScript string is empty or starts with an unpaired surrogate, a runtime error will be thrown. + +> **Note**: For more information about unpaired surrogates, see the [documentation for `str`](str.html). + ## Example Rust Usage ```rust diff --git a/guide/src/reference/types/exported-rust-types.md b/guide/src/reference/types/exported-rust-types.md index deaad2fb359..2e190db43ae 100644 --- a/guide/src/reference/types/exported-rust-types.md +++ b/guide/src/reference/types/exported-rust-types.md @@ -4,9 +4,10 @@ |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | Yes | Yes | Yes | Yes | Yes | Yes | Instances of a `wasm-bindgen`-generated JavaScript `class Whatever { ... }` | -> **Note**: Public fields implementing Copy have automatically generated getters/setters. -> To generate getters/setters for non-Copy public fields, use #[wasm_bindgen(getter_with_clone)] for the struct +> **Note**: Public fields implementing `Copy` have automatically generated getters/setters. +> To generate getters/setters for non-`Copy` public fields, use `#[wasm_bindgen(getter_with_clone)]` for the struct > or [implement getters/setters manually](https://rustwasm.github.io/wasm-bindgen/reference/attributes/on-rust-exports/getter-and-setter.html). + ## Example Rust Usage ```rust diff --git a/guide/src/reference/types/numbers.md b/guide/src/reference/types/numbers.md index 13742f53fd2..0444fdc82c5 100644 --- a/guide/src/reference/types/numbers.md +++ b/guide/src/reference/types/numbers.md @@ -2,7 +2,58 @@ | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| Yes | No | No | Yes | Yes | Yes | A JavaScript number value | +| Yes | No | No | Yes | Yes | Yes | A JavaScript number or bigint value | + +[JavaScript `Number`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding) are 64-bit floating point value under the hood and cannot accurately represent all of Rust's numeric types. `wasm-bindgen` will automatically use either [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) or `Number` to accurately represent Rust's numeric types in JavaScript: + +- `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `isize`, `usize`, `f32`, and `f64` will be represented as `Number` in JavaScript. +- `u64` and `i64` will be represented as `BigInt` in JavaScript. + +> **Note**: Wasm is currently a 32-bit architecture, so `isize` and `usize` are 32-bit integers and "fit" into a JavaScript `Number`. + +## Converting from JavaScript to Rust + +`wasm-bindgen` will automatically handle the conversion of JavaScript numbers to Rust numeric types. The conversion rules are as follows: + +### `Number` to `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `isize`, and `usize` + +If the JavaScript number is `Infinity`, `-Infinity`, or `NaN`, then the Rust value will be 0. Otherwise, the JavaScript number will rounded towards zero (see [`Math.trunc`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) or [`f64::trunc`](https://doc.rust-lang.org/std/primitive.f64.html#method.trunc)). If the rounded number is too large or too small for the target integer type, it will wrap around. + +For example, if the target type is `i8`, Rust will see the following values for the following inputs: + +| JS input number | Rust value (`i8`) | +| --------------: | :---------------- | +| 42 | 42 | +| -42 | -42 | +| 1.999 | 1 | +| -1.999 | -1 | +| 127 | 127 | +| 128 | -128 | +| 255 | -1 | +| 256 | 0 | +| -0 | 0 | +| `±Infinity` | 0 | +| `NaN` | 0 | + +This is the same behavior as assigning the JavaScript `Number` to a [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of the appropriate integer type in JavaScript, i.e. `new Uint8Array([value])[0]`. + +Except for the handling of `Infinity` and `-Infinity`, this is the same behavior as [casting](https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast) `f64` to the appropriate integer type in Rust, i.e. `value_f64 as u32`. + +### `BigInt` to `u64` and `i64` + +If the JavaScript `BigInt` is too large or too small for the target integer type, it will wrap around. + +This is the same behavior as assigning the JavaScript `BigInt` to a [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of the appropriate integer type in JavaScript, i.e. `new Int64Array([value])[0]`. + +### `Number` to `f32` + +The JavaScript `Number` is converted to a Rust `f32` using the same rules as [casting](https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast) `f64` to `f32` in Rust, i.e. `value_f64 as f32`. + +This is the same behavior as [`Math.fround`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround) or assigning the JavaScript `Number` to a [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) in JavaScript, i.e. `new Float32Array([value])[0]`. + +### `Number` to `f64` + +Since JavaScript numbers are 64-bit floating point values, converting a JavaScript `Number` to a Rust `f64` is a no-op. ## Example Rust Usage From f2888bb912eed9e3856a9c53dfa15760c30f409a Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 8 Nov 2024 13:28:40 +0100 Subject: [PATCH 546/641] Fix docs on `Option` (#4226) --- guide/src/reference/types/char.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/types/char.md b/guide/src/reference/types/char.md index c8e726ac6ab..650adffa342 100644 --- a/guide/src/reference/types/char.md +++ b/guide/src/reference/types/char.md @@ -2,7 +2,7 @@ | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| Yes | No | No | Yes | No | No | A JavaScript string value | +| Yes | No | No | Yes | Yes | Yes | A JavaScript string value | Since JavaScript doesn't have a character type, `char` is represented as a JavaScript string with one Unicode code point. From 1d4965c8da2cc03be50be60720aa16a427398e46 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 9 Nov 2024 19:51:55 +0100 Subject: [PATCH 547/641] Make it clearer which versions are affected by the constructor bug (#4249) --- guide/src/reference/attributes/on-rust-exports/constructor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/attributes/on-rust-exports/constructor.md b/guide/src/reference/attributes/on-rust-exports/constructor.md index 3e5fc2d4deb..d37d4674bdf 100644 --- a/guide/src/reference/attributes/on-rust-exports/constructor.md +++ b/guide/src/reference/attributes/on-rust-exports/constructor.md @@ -35,7 +35,7 @@ console.log(f.get_contents()); ## Caveats -Starting from v0.2.48 there is a bug in `wasm-bindgen` which breaks inheritance of exported Rust structs from JavaScript side (see [#3213](https://github.com/rustwasm/wasm-bindgen/issues/3213)). If you want to inherit from a Rust struct such as: +In versions `>=v0.2.48, <0.2.88` of `wasm-bindgen`, there is a bug which breaks inheritance of exported Rust structs from JavaScript side (see [#3213](https://github.com/rustwasm/wasm-bindgen/issues/3213)). If you want to inherit from a Rust struct such as: ```rust use wasm_bindgen::prelude::*; From 5f70a71d2ad9bed9c19cbff5ff651e8e8f1ed851 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 9 Nov 2024 20:51:54 +0100 Subject: [PATCH 548/641] Fix Rust edition 2024 compatibility (#4259) --- crates/backend/src/codegen.rs | 4 ++-- crates/macro/ui-tests/missing-catch.stderr | 4 ++++ crates/macro/ui-tests/pub-not-copy.stderr | 3 +++ crates/macro/ui-tests/struct-fields.stderr | 3 +++ crates/macro/ui-tests/unknown-type-in-import.stderr | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index e5f3cfb9dd9..d5d14743322 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1894,9 +1894,9 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { for (i, token) in spans.into_iter().enumerate() { if i == 0 { - first_span = token.span(); + first_span = Span::call_site().located_at(token.span()); } - last_span = token.span(); + last_span = Span::call_site().located_at(token.span()); } let mut new_tokens = Vec::new(); diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index 02a74e62f00..b669a0d5702 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -1,6 +1,9 @@ error[E0277]: the trait bound `Result: FromWasmAbi` is not satisfied --> ui-tests/missing-catch.rs:6:9 | +3 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... 6 | pub fn foo() -> Result; | ^^^ the trait `FromWasmAbi` is not implemented for `Result` | @@ -14,3 +17,4 @@ error[E0277]: the trait bound `Result $DIR/pub-not-copy.rs:5:16 | +3 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +4 | pub struct A { 5 | pub field: String, | ^^^^^^ the trait `std::marker::Copy` is not implemented for `String` | diff --git a/crates/macro/ui-tests/struct-fields.stderr b/crates/macro/ui-tests/struct-fields.stderr index 6e402b2d6ab..f38391b27d8 100644 --- a/crates/macro/ui-tests/struct-fields.stderr +++ b/crates/macro/ui-tests/struct-fields.stderr @@ -1,6 +1,9 @@ error[E0277]: the trait bound `Foo: std::marker::Copy` is not satisfied --> ui-tests/struct-fields.rs:10:12 | +8 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +9 | struct Bar { 10 | pub a: Foo, | ^^^ the trait `std::marker::Copy` is not implemented for `Foo` | diff --git a/crates/macro/ui-tests/unknown-type-in-import.stderr b/crates/macro/ui-tests/unknown-type-in-import.stderr index af11dc2c64e..9dc814804d0 100644 --- a/crates/macro/ui-tests/unknown-type-in-import.stderr +++ b/crates/macro/ui-tests/unknown-type-in-import.stderr @@ -8,3 +8,9 @@ help: you might be missing a type parameter | 6 | pub fn foo(a: A); | +++ + +error[E0412]: cannot find type `A` in this scope + --> ui-tests/unknown-type-in-import.rs:6:19 + | +6 | pub fn foo(a: A); + | ^ not found in this scope From a8b1a09f1a901a0570990181f150317760ffeaa9 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 9 Nov 2024 21:28:39 +0100 Subject: [PATCH 549/641] Add support for enums with negative discriminants (#4204) --- CHANGELOG.md | 3 + crates/backend/src/ast.rs | 3 + crates/backend/src/codegen.rs | 25 ++-- crates/backend/src/encode.rs | 1 + crates/cli-support/src/wit/mod.rs | 12 +- crates/cli-support/src/wit/nonstandard.rs | 2 +- crates/cli/tests/reference/enums.d.ts | 9 ++ crates/cli/tests/reference/enums.js | 18 +++ crates/cli/tests/reference/enums.rs | 13 ++ crates/cli/tests/reference/enums.wat | 2 + crates/macro-support/src/parser.rs | 136 +++++++++++++++------ crates/macro/ui-tests/invalid-enums.rs | 18 ++- crates/macro/ui-tests/invalid-enums.stderr | 24 +++- crates/shared/src/lib.rs | 1 + crates/shared/src/schema_hash_approval.rs | 2 +- 15 files changed, 207 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0327e42a33..8775f9660a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Added JSDoc type annotations to C-style enums. [#4192](https://github.com/rustwasm/wasm-bindgen/pull/4192) +* Added support for C-style enums with negative discriminants. + [#4204](https://github.com/rustwasm/wasm-bindgen/pull/4204) + ### Changed * String enums now generate private TypeScript types but only if used. diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index d745f325f9e..0991dac66cf 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -445,6 +445,9 @@ pub struct Enum { pub rust_name: Ident, /// The name of this enum in JS code pub js_name: String, + /// Whether the variant values and hole are signed, meaning that they + /// represent the bits of a `i32` value. + pub signed: bool, /// The variants provided by this enum pub variants: Vec, /// The doc comments on this enum, if any diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index d5d14743322..0cb52f3472c 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1535,10 +1535,15 @@ impl ToTokens for ast::Enum { let name_len = name_str.len() as u32; let name_chars = name_str.chars().map(|c| c as u32); let hole = &self.hole; + let underlying = if self.signed { + quote! { i32 } + } else { + quote! { u32 } + }; let cast_clauses = self.variants.iter().map(|variant| { let variant_name = &variant.name; quote! { - if js == #enum_name::#variant_name as u32 { + if js == #enum_name::#variant_name as #underlying { #enum_name::#variant_name } } @@ -1548,20 +1553,20 @@ impl ToTokens for ast::Enum { (quote! { #[automatically_derived] impl #wasm_bindgen::convert::IntoWasmAbi for #enum_name { - type Abi = u32; + type Abi = #underlying; #[inline] - fn into_abi(self) -> u32 { - self as u32 + fn into_abi(self) -> #underlying { + self as #underlying } } #[automatically_derived] impl #wasm_bindgen::convert::FromWasmAbi for #enum_name { - type Abi = u32; + type Abi = #underlying; #[inline] - unsafe fn from_abi(js: u32) -> Self { + unsafe fn from_abi(js: #underlying) -> Self { #(#cast_clauses else)* { #wasm_bindgen::throw_str("invalid enum value passed") } @@ -1571,13 +1576,13 @@ impl ToTokens for ast::Enum { #[automatically_derived] impl #wasm_bindgen::convert::OptionFromWasmAbi for #enum_name { #[inline] - fn is_none(val: &u32) -> bool { *val == #hole } + fn is_none(val: &Self::Abi) -> bool { *val == #hole as #underlying } } #[automatically_derived] impl #wasm_bindgen::convert::OptionIntoWasmAbi for #enum_name { #[inline] - fn none() -> Self::Abi { #hole } + fn none() -> Self::Abi { #hole as #underlying } } #[automatically_derived] @@ -1597,7 +1602,7 @@ impl ToTokens for ast::Enum { #wasm_bindgen::JsValue { fn from(value: #enum_name) -> Self { - #wasm_bindgen::JsValue::from_f64((value as u32).into()) + #wasm_bindgen::JsValue::from_f64((value as #underlying).into()) } } @@ -1608,7 +1613,7 @@ impl ToTokens for ast::Enum { fn try_from_js_value(value: #wasm_bindgen::JsValue) -> #wasm_bindgen::__rt::core::result::Result::Error> { use #wasm_bindgen::__rt::core::convert::TryFrom; - let js = f64::try_from(&value)? as u32; + let js = f64::try_from(&value)? as #underlying; #wasm_bindgen::__rt::core::result::Result::Ok( #(#try_from_cast_clauses else)* { diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index bc82ba5c336..baae8d72533 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -239,6 +239,7 @@ fn shared_function<'a>(func: &'a ast::Function, _intern: &'a Interner) -> Functi fn shared_enum<'a>(e: &'a ast::Enum, intern: &'a Interner) -> Enum<'a> { Enum { name: &e.js_name, + signed: e.signed, variants: e .variants .iter() diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 3e3e355c366..07a09860e0c 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -894,6 +894,7 @@ impl<'a> Context<'a> { } fn enum_(&mut self, enum_: decode::Enum<'_>) -> Result<(), Error> { + let signed = enum_.signed; let aux = AuxEnum { name: enum_.name.to_string(), comments: concatenate_comments(&enum_.comments), @@ -901,11 +902,12 @@ impl<'a> Context<'a> { .variants .iter() .map(|v| { - ( - v.name.to_string(), - v.value, - concatenate_comments(&v.comments), - ) + let value = if signed { + v.value as i32 as i64 + } else { + v.value as i64 + }; + (v.name.to_string(), value, concatenate_comments(&v.comments)) }) .collect(), generate_typescript: enum_.generate_typescript, diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index ac0f6d6eb6b..e43a49988df 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -170,7 +170,7 @@ pub struct AuxEnum { pub comments: String, /// A list of variants with their name, value and comments /// and whether typescript bindings should be generated for each variant - pub variants: Vec<(String, u32, String)>, + pub variants: Vec<(String, i64, String)>, /// Whether typescript bindings should be generated for this enum. pub generate_typescript: bool, } diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index 1c830d483f9..da84bbb7740 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -4,6 +4,7 @@ export function enum_echo(color: Color): Color; export function option_enum_echo(color?: Color): Color | undefined; export function get_name(color: Color): ColorName; export function option_string_enum_echo(color?: ColorName): ColorName | undefined; +export function option_order(order?: Ordering): Ordering | undefined; /** * A color. */ @@ -27,6 +28,14 @@ export enum ImplicitDiscriminant { C = 42, D = 43, } +/** + * A C-style enum with negative discriminants. + */ +export enum Ordering { + Less = -1, + Equal = 0, + Greater = 1, +} /** * The name of a color. */ diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index a425ef2874f..76feae96525 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -62,6 +62,15 @@ export function option_string_enum_echo(color) { return __wbindgen_enum_ColorName[ret]; } +/** + * @param {Ordering | undefined} [order] + * @returns {Ordering | undefined} + */ +export function option_order(order) { + const ret = wasm.option_order(isLikeNone(order) ? 2 : order); + return ret === 2 ? undefined : ret; +} + /** * A color. * @enum {0 | 1 | 2} @@ -89,6 +98,15 @@ export const ImplicitDiscriminant = Object.freeze({ C: 42, "42": "C", D: 43, "43": "D", }); +/** + * A C-style enum with negative discriminants. + * @enum {-1 | 0 | 1} + */ +export const Ordering = Object.freeze({ + Less: -1, "-1": "Less", + Equal: 0, "0": "Equal", + Greater: 1, "1": "Greater", +}); const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; diff --git a/crates/cli/tests/reference/enums.rs b/crates/cli/tests/reference/enums.rs index 480dba7ce89..553d63d9a4d 100644 --- a/crates/cli/tests/reference/enums.rs +++ b/crates/cli/tests/reference/enums.rs @@ -65,3 +65,16 @@ pub enum ImplicitDiscriminant { C = 42, D, } + +/// A C-style enum with negative discriminants. +#[wasm_bindgen] +pub enum Ordering { + Less = -1, + Equal = 0, + Greater = 1, +} + +#[wasm_bindgen] +pub fn option_order(order: Option) -> Option { + order +} diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index cc9bb74b586..dced57440b0 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -4,12 +4,14 @@ (func $option_enum_echo (;1;) (type 0) (param i32) (result i32)) (func $get_name (;2;) (type 0) (param i32) (result i32)) (func $option_string_enum_echo (;3;) (type 0) (param i32) (result i32)) + (func $option_order (;4;) (type 0) (param i32) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "enum_echo" (func $enum_echo)) (export "option_enum_echo" (func $option_enum_echo)) (export "get_name" (func $get_name)) (export "option_string_enum_echo" (func $option_string_enum_echo)) + (export "option_order" (func $option_order)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a2be7045d05..72bd849d859 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1387,6 +1387,46 @@ fn string_enum( Ok(()) } +/// Represents a possibly negative numeric value as base 10 digits. +struct NumericValue<'a> { + negative: bool, + base10_digits: &'a str, +} +impl<'a> NumericValue<'a> { + fn from_expr(expr: &'a syn::Expr) -> Option { + match get_expr(expr) { + syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Int(int_lit), + .. + }) => Some(Self { + negative: false, + base10_digits: int_lit.base10_digits(), + }), + syn::Expr::Unary(syn::ExprUnary { + op: syn::UnOp::Neg(_), + expr, + .. + }) => Self::from_expr(expr).map(|n| n.neg()), + _ => None, + } + } + + fn parse(&self) -> Option { + let mut value = self.base10_digits.parse::().ok()?; + if self.negative { + value = -value; + } + Some(value) + } + + fn neg(self) -> Self { + Self { + negative: !self.negative, + base10_digits: self.base10_digits, + } + } +} + impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { fn macro_parse( self, @@ -1437,54 +1477,73 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { _ => bail_span!(self, "only public enums are allowed with #[wasm_bindgen]"), } - let mut last_discriminant: Option = None; - let mut discriminate_map: HashMap = HashMap::new(); + // Go through all variants once first to determine whether the enum is + // signed or unsigned. We don't need to actually parse the discriminant + // values yet, we just need to know their sign. The actual parsing is + // done in a second pass. + let signed = self.variants.iter().any(|v| match &v.discriminant { + Some((_, expr)) => NumericValue::from_expr(expr).map_or(false, |n| n.negative), + None => false, + }); + let underlying_min = if signed { i32::MIN as i64 } else { 0 }; + let underlying_max = if signed { + i32::MAX as i64 + } else { + u32::MAX as i64 + }; + + let mut last_discriminant: Option = None; + let mut discriminant_map: HashMap = HashMap::new(); let variants = self .variants .iter() .map(|v| { - let value = match &v.discriminant { - Some((_, expr)) => match get_expr(expr) { - syn::Expr::Lit(syn::ExprLit { - attrs: _, - lit: syn::Lit::Int(int_lit), - }) => match int_lit.base10_digits().parse::() { - Ok(v) => v, - Err(_) => { - bail_span!( - int_lit, - "C-style enums with #[wasm_bindgen] can only support \ - numbers that can be represented as u32" - ); - } - }, - expr => bail_span!( + let value: i64 = match &v.discriminant { + Some((_, expr)) => match NumericValue::from_expr(expr).and_then(|n| n.parse()) { + Some(value) => value, + _ => bail_span!( expr, "C-style enums with #[wasm_bindgen] may only have \ - number literal values", + numeric literal values that fit in a 32-bit integer as discriminants. \ + Expressions or variables are not supported.", ), }, None => { // Use the same algorithm as rustc to determine the next discriminant // https://doc.rust-lang.org/reference/items/enumerations.html#implicit-discriminants - if let Some(last) = last_discriminant { - if let Some(value) = last.checked_add(1) { - value - } else { - bail_span!( - v, - "the discriminants of C-style enums with #[wasm_bindgen] must be representable as u32" - ); - } - } else { - 0 - } + last_discriminant.map_or(0, |last| last + 1) } }; + last_discriminant = Some(value); - if let Some(old) = discriminate_map.insert(value, v) { + // check that the value fits within the underlying type + let underlying = if signed { "i32" } else { "u32" }; + let numbers = if signed { "signed numbers" } else { "unsigned numbers" }; + if value < underlying_min { + bail_span!( + v, + "C-style enums with #[wasm_bindgen] can only support {0} that can be represented by `{2}`, \ + but `{1}` is too small for `{2}`", + numbers, + value, + underlying + ); + } + if value > underlying_max { + bail_span!( + v, + "C-style enums with #[wasm_bindgen] can only support {0} that can be represented by `{2}`, \ + but `{1}` is too large for `{2}`", + numbers, + value, + underlying + ); + } + + // detect duplicate discriminants + if let Some(old) = discriminant_map.insert(value, v) { bail_span!( v, "discriminant value `{}` is already used by {} in this enum", @@ -1496,21 +1555,26 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { let comments = extract_doc_comments(&v.attrs); Ok(ast::Variant { name: v.ident.clone(), - value, + // due to the above checks, we know that the value fits + // within 32 bits, so this cast doesn't lose any information + value: value as u32, comments, }) }) .collect::, Diagnostic>>()?; - let hole = (0..=u32::MAX) - .find(|v| !discriminate_map.contains_key(v)) - .unwrap(); + // To make all the code handling holes simpler, we only consider + // non-negative holes. This allows us to use `u32` to represent holes. + let hole = (0..=underlying_max) + .find(|v| !discriminant_map.contains_key(v)) + .unwrap() as u32; self.to_tokens(tokens); program.enums.push(ast::Enum { rust_name: self.ident, js_name, + signed, variants, comments, hole, diff --git a/crates/macro/ui-tests/invalid-enums.rs b/crates/macro/ui-tests/invalid-enums.rs index e0241f1eedb..571a39fb7c9 100644 --- a/crates/macro/ui-tests/invalid-enums.rs +++ b/crates/macro/ui-tests/invalid-enums.rs @@ -46,13 +46,13 @@ pub enum H { #[wasm_bindgen] pub enum I { A = 4294967294, // = u32::MAX - 1 - B, // would be u32::MAX - C, // would be u32::MAX + 1 + B, // = u32::MAX + C, // = u32::MAX + 1 } #[wasm_bindgen] pub enum J { - A, // = 0 + A, // = 0 B = 0, // collision } @@ -63,4 +63,16 @@ pub enum K { C, // = 3 -> collision } +#[wasm_bindgen] +pub enum L { + A = -2147483648, // i32::MIN + B = -2147483649, // i32::MIN - 1 +} + +#[wasm_bindgen] +pub enum M { + A = -1, + B = 2147483648, // i32::MAX + 1 +} + fn main() {} diff --git a/crates/macro/ui-tests/invalid-enums.stderr b/crates/macro/ui-tests/invalid-enums.stderr index e2e5b1a6c04..270de3b54b1 100644 --- a/crates/macro/ui-tests/invalid-enums.stderr +++ b/crates/macro/ui-tests/invalid-enums.stderr @@ -10,17 +10,17 @@ error: enum variants with associated data are not supported with #[wasm_bindgen] 8 | D(u32), | ^^^^^ -error: C-style enums with #[wasm_bindgen] may only have number literal values +error: C-style enums with #[wasm_bindgen] may only have numeric literal values that fit in a 32-bit integer as discriminants. Expressions or variables are not supported. --> ui-tests/invalid-enums.rs:13:9 | 13 | X = 1 + 3, | ^^^^^ -error: C-style enums with #[wasm_bindgen] can only support numbers that can be represented as u32 - --> ui-tests/invalid-enums.rs:18:9 +error: C-style enums with #[wasm_bindgen] can only support unsigned numbers that can be represented by `u32`, but `4294967296` is too large for `u32` + --> ui-tests/invalid-enums.rs:18:5 | 18 | X = 4294967296, - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^ error: enums with #[wasm_bindgen] cannot mix string and non-string values --> ui-tests/invalid-enums.rs:23:9 @@ -46,10 +46,10 @@ error: discriminant value `1` is already used by A in this enum 43 | B = 1, // collision | ^^^^^ -error: the discriminants of C-style enums with #[wasm_bindgen] must be representable as u32 +error: C-style enums with #[wasm_bindgen] can only support unsigned numbers that can be represented by `u32`, but `4294967296` is too large for `u32` --> ui-tests/invalid-enums.rs:50:5 | -50 | C, // would be u32::MAX + 1 +50 | C, // = u32::MAX + 1 | ^ error: discriminant value `0` is already used by A in this enum @@ -63,3 +63,15 @@ error: discriminant value `3` is already used by A in this enum | 63 | C, // = 3 -> collision | ^ + +error: C-style enums with #[wasm_bindgen] can only support signed numbers that can be represented by `i32`, but `-2147483649` is too small for `i32` + --> ui-tests/invalid-enums.rs:69:5 + | +69 | B = -2147483649, // i32::MIN - 1 + | ^^^^^^^^^^^^^^^ + +error: C-style enums with #[wasm_bindgen] can only support signed numbers that can be represented by `i32`, but `2147483648` is too large for `i32` + --> ui-tests/invalid-enums.rs:75:5 + | +75 | B = 2147483648, // i32::MAX + 1 + | ^^^^^^^^^^^^^^ diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 57faecfcd84..13b893e4685 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -122,6 +122,7 @@ macro_rules! shared_api { struct Enum<'a> { name: &'a str, + signed: bool, variants: Vec>, comments: Vec<&'a str>, generate_typescript: bool, diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 4edb55c791c..ebc7341bb3c 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "18290232323238297705"; +const APPROVED_SCHEMA_FILE_HASH: &str = "211103844299778814"; #[test] fn schema_version() { From 3dc8c29c5c926e42b3b4d2b500e468890a2c5e17 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 9 Nov 2024 21:32:43 +0100 Subject: [PATCH 550/641] Update testing docs for `wasm-bindgen-macro` (#4256) --- crates/macro/README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/macro/README.md b/crates/macro/README.md index 353829869f2..71e35ab29ff 100644 --- a/crates/macro/README.md +++ b/crates/macro/README.md @@ -17,12 +17,10 @@ To add a test: * Create `ui-tests/my-awesome-test.rs` * Write an invalid `#[wasm_bindgen]` invocation, testing the error you're generating -* Execute `cargo test -p ui-tests`, the test will fail +* Execute `cargo test -p wasm-bindgen-macro --test ui`, the test will fail * From within the `ui-tests` folder, execute `./update-all-references.sh`. This should create a `my-awesome-test.stderr` file. -* Inspect `my-awesome-test.stderr` to make sure it looks ok -* Rerun `cargo test -p ui-tests` and your tests should pass! -Testing here is a work in progress, see -[#601](https://github.com/rustwasm/wasm-bindgen/issues/601) for more -information. + OR if you are on Windows, set the `TRYBUILD=overwrite` environment variable (this is done as `$env:TRYBUILD="overwrite"` [in powershell](https://stackoverflow.com/a/1333717/7595472)) and run the command again. +* Inspect `my-awesome-test.stderr` to make sure it looks ok +* Rerun `cargo test -p wasm-bindgen-macro --test ui` and your tests should pass! From 97c05b502cf5d0c2dfb29b1a6ac146172fad29db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 11 Nov 2024 10:10:58 +0100 Subject: [PATCH 551/641] Add bindings for `MediaStreamTrack.getCapabilities` (#4236) --- CHANGELOG.md | 3 +++ .../src/features/gen_MediaStreamTrack.rs | 12 ++++++++++ .../features/gen_MediaTrackCapabilities.rs | 24 +++++++++++++++++++ .../unstable/MediaTrackCapabilities.webidl | 5 ++++ 4 files changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8775f9660a8..c7abe1c111c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Added support for C-style enums with negative discriminants. [#4204](https://github.com/rustwasm/wasm-bindgen/pull/4204) +* Added bindings for `MediaStreamTrack.getCapabilities`. + [#4236](https://github.com/rustwasm/wasm-bindgen/pull/4236) + ### Changed * String enums now generate private TypeScript types but only if used. diff --git a/crates/web-sys/src/features/gen_MediaStreamTrack.rs b/crates/web-sys/src/features/gen_MediaStreamTrack.rs index 1e7007ffc23..bb8ac52e15f 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrack.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrack.rs @@ -129,6 +129,18 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`*"] pub fn clone(this: &MediaStreamTrack) -> MediaStreamTrack; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "MediaTrackCapabilities")] + # [wasm_bindgen (method , structural , js_class = "MediaStreamTrack" , js_name = getCapabilities)] + #[doc = "The `getCapabilities()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getCapabilities)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_capabilities(this: &MediaStreamTrack) -> MediaTrackCapabilities; #[cfg(feature = "MediaTrackConstraints")] # [wasm_bindgen (method , structural , js_class = "MediaStreamTrack" , js_name = getConstraints)] #[doc = "The `getConstraints()` method."] diff --git a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs index 1c6d82c5cb9..85d23016f20 100644 --- a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs +++ b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs @@ -53,6 +53,24 @@ extern "C" { #[wasm_bindgen(method, setter = "autoGainControl")] pub fn set_auto_gain_control(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `backgroundBlur` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "backgroundBlur")] + pub fn get_background_blur(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `backgroundBlur` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "backgroundBlur")] + pub fn set_background_blur(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[doc = "Get the `channelCount` field of this object."] #[doc = ""] @@ -328,6 +346,12 @@ impl MediaTrackCapabilities { self } #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_background_blur()` instead."] + pub fn background_blur(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + self.set_background_blur(val); + self + } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ULongRange")] #[deprecated = "Use `set_channel_count()` instead."] pub fn channel_count(&mut self, val: &ULongRange) -> &mut Self { diff --git a/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl b/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl index ba6bd9c4607..e3f08031142 100644 --- a/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl +++ b/crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl @@ -7,6 +7,10 @@ * https://w3c.github.io/mediacapture-main/#dom-mediatrackcapabilities */ +partial interface MediaStreamTrack { + MediaTrackCapabilities getCapabilities (); +}; + dictionary ULongRange { [Clamp] unsigned long max; [Clamp] unsigned long min; @@ -33,4 +37,5 @@ dictionary MediaTrackCapabilities { ULongRange channelCount; DOMString deviceId; DOMString groupId; + sequence backgroundBlur; }; From 2463d0da5749c64b1ae7bada5d81c57ef6720ce0 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 11 Nov 2024 10:39:12 +0100 Subject: [PATCH 552/641] Faster local testing with `reference.rs` (#4255) --- crates/cli/tests/reference.rs | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index 76d9a4a9756..cd7604062d9 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -9,6 +9,11 @@ //! compilation. Use `BLESS=1` in the environment to automatically update all //! tests. //! +//! Note: Tests are run sequentially. In CI, tests are run ordered by name and +//! all tests will be run to show all errors. Outside of CI, recently modified +//! tests are run first and the runner will stop on the first failure. This is +//! done to make it faster to iterate on tests. +//! //! ## Dependencies //! //! By default, tests only have access to the `wasm-bindgen` and @@ -57,15 +62,32 @@ fn main() -> Result<()> { } tests.sort(); - let errs = tests - .iter() - .filter_map(|t| runtest(t).err().map(|e| (t, e))) - .collect::>(); + let is_ci = env::var("CI").is_ok(); + if !is_ci { + // sort test files by when they were last modified, so that we run the most + // recently modified tests first. This just makes iterating on tests a bit + // easier. + tests.sort_by_cached_key(|p| fs::metadata(p).unwrap().modified().unwrap()); + tests.reverse(); + } - if errs.is_empty() { + let mut errs_iter = tests.iter().filter_map(|t| { + println!(" {}", t.file_name().unwrap().to_string_lossy()); + runtest(t).err().map(|e| (t, e)) + }); + + let Some(first_error) = errs_iter.next() else { println!("{} tests passed", tests.len()); return Ok(()); + }; + + let mut errs = vec![first_error]; + if is_ci { + // one error should be enough for local testing to ensure fast iteration + // only find all errors in CI + errs.extend(errs_iter); } + eprintln!("failed tests:\n"); for (test, err) in errs { eprintln!("{} failure\n{}", test.display(), tab(&format!("{:?}", err))); From df9893bd2000f62e9098e54a7e16298fd5a0f011 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 11 Nov 2024 14:34:04 +0100 Subject: [PATCH 553/641] Add support for i128 and u128 (#4222) --- CHANGELOG.md | 3 + crates/cli-support/src/descriptor.rs | 6 ++ crates/cli-support/src/js/binding.rs | 55 +++++++++++++- crates/cli-support/src/wit/incoming.rs | 28 +++++++ crates/cli-support/src/wit/outgoing.rs | 30 ++++++++ crates/cli-support/src/wit/standard.rs | 14 ++++ crates/cli/tests/reference/int128.d.ts | 7 ++ crates/cli/tests/reference/int128.js | 74 +++++++++++++++++++ crates/cli/tests/reference/int128.rs | 28 +++++++ crates/cli/tests/reference/int128.wat | 19 +++++ crates/macro/ui-tests/missing-catch.stderr | 2 +- .../ui-tests/traits-not-implemented.stderr | 2 +- guide/src/reference/types/numbers.md | 8 +- src/convert/impls.rs | 39 ++++++++++ src/describe.rs | 4 + tests/wasm/optional_primitives.js | 18 +++++ tests/wasm/optional_primitives.rs | 67 +++++++++++++++++ 17 files changed, 397 insertions(+), 7 deletions(-) create mode 100644 crates/cli/tests/reference/int128.d.ts create mode 100644 crates/cli/tests/reference/int128.js create mode 100644 crates/cli/tests/reference/int128.rs create mode 100644 crates/cli/tests/reference/int128.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index c7abe1c111c..351468dce62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ * Added bindings for `MediaStreamTrack.getCapabilities`. [#4236](https://github.com/rustwasm/wasm-bindgen/pull/4236) +* Added WASM ABI support for `u128` and `i128` + [#4222](https://github.com/rustwasm/wasm-bindgen/pull/4222) + ### Changed * String enums now generate private TypeScript types but only if used. diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index 5dec8d86d71..d1b129ed77a 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -19,6 +19,8 @@ tys! { U32 I64 U64 + I128 + U128 F32 F64 BOOLEAN @@ -55,6 +57,8 @@ pub enum Descriptor { U32, I64, U64, + I128, + U128, F32, F64, Boolean, @@ -132,11 +136,13 @@ impl Descriptor { I16 => Descriptor::I16, I32 => Descriptor::I32, I64 => Descriptor::I64, + I128 => Descriptor::I128, U8 if clamped => Descriptor::ClampedU8, U8 => Descriptor::U8, U16 => Descriptor::U16, U32 => Descriptor::U32, U64 => Descriptor::U64, + U128 => Descriptor::U128, F32 => Descriptor::F32, F64 => Descriptor::F64, BOOLEAN => Descriptor::Boolean, diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 000634297d3..f79936e1985 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -620,6 +620,23 @@ fn instruction( ) } + fn int128_to_int64x2(val: &str) -> (String, String) { + // we don't need to perform any conversion here, because the JS + // WebAssembly API will automatically convert the bigints to 64 bits + // for us. This even allows us to ignore signedness. + let low = val.to_owned(); + let high = format!("{val} >> BigInt(64)"); + (low, high) + } + fn int64x2_to_int128(low: String, high: String, signed: bool) -> String { + let low = format!("BigInt.asUintN(64, {low})"); + if signed { + format!("({low} | ({high} << BigInt(64)))") + } else { + format!("({low} | (BigInt.asUintN(64, {high}) << BigInt(64)))") + } + } + match instr { Instruction::ArgGet(n) => { let arg = js.arg(*n).to_string(); @@ -712,6 +729,36 @@ fn instruction( } } + Instruction::Int128ToWasm => { + let val = js.pop(); + js.assert_bigint(&val); + let (low, high) = int128_to_int64x2(&val); + js.push(low); + js.push(high); + } + Instruction::WasmToInt128 { signed } => { + let high = js.pop(); + let low = js.pop(); + js.push(int64x2_to_int128(low, high, *signed)); + } + + Instruction::OptionInt128ToWasm => { + let val = js.pop(); + js.cx.expose_is_like_none(); + js.assert_optional_bigint(&val); + let (low, high) = int128_to_int64x2(&val); + js.push(format!("!isLikeNone({val})")); + js.push(format!("isLikeNone({val}) ? BigInt(0) : {low}")); + js.push(format!("isLikeNone({val}) ? BigInt(0) : {high}")); + } + Instruction::OptionWasmToInt128 { signed } => { + let high = js.pop(); + let low = js.pop(); + let present = js.pop(); + let val = int64x2_to_int128(low, high, *signed); + js.push(format!("{present} === 0 ? undefined : {val}")); + } + Instruction::WasmToStringEnum { name } => { let index = js.pop(); js.cx.expose_string_enum(name); @@ -983,6 +1030,8 @@ fn instruction( js.push(format!( "isLikeNone({val}) ? {zero} : {val}", zero = if *ty == ValType::I64 { + // We can't use bigint literals for now. See: + // https://github.com/rustwasm/wasm-bindgen/issues/4246 "BigInt(0)" } else { "0" @@ -1500,7 +1549,11 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String, refs: Option<&mut HashSet dst.push_str("number"), - AdapterType::I64 | AdapterType::S64 | AdapterType::U64 => dst.push_str("bigint"), + AdapterType::I64 + | AdapterType::S64 + | AdapterType::U64 + | AdapterType::S128 + | AdapterType::U128 => dst.push_str("bigint"), AdapterType::String => dst.push_str("string"), AdapterType::Externref => dst.push_str("any"), AdapterType::Bool => dst.push_str("boolean"), diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index 5c2a2c4874e..c0ad9ad34bf 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -90,6 +90,20 @@ impl InstructionBuilder<'_, '_> { Descriptor::U32 => self.number(AdapterType::U32, WasmVT::I32), Descriptor::I64 => self.number(AdapterType::S64, WasmVT::I64), Descriptor::U64 => self.number(AdapterType::U64, WasmVT::I64), + Descriptor::I128 => { + self.instruction( + &[AdapterType::S128], + Instruction::Int128ToWasm, + &[AdapterType::I64, AdapterType::I64], + ); + } + Descriptor::U128 => { + self.instruction( + &[AdapterType::U128], + Instruction::Int128ToWasm, + &[AdapterType::I64, AdapterType::I64], + ); + } Descriptor::F32 => { self.get(AdapterType::F32); self.output.push(AdapterType::F32); @@ -285,6 +299,20 @@ impl InstructionBuilder<'_, '_> { Descriptor::F32 => self.in_option_sentinel64_f32(AdapterType::F32), Descriptor::F64 => self.in_option_native(ValType::F64), Descriptor::I64 | Descriptor::U64 => self.in_option_native(ValType::I64), + Descriptor::I128 => { + self.instruction( + &[AdapterType::S128.option()], + Instruction::OptionInt128ToWasm, + &[AdapterType::I32, AdapterType::I64, AdapterType::I64], + ); + } + Descriptor::U128 => { + self.instruction( + &[AdapterType::U128.option()], + Instruction::OptionInt128ToWasm, + &[AdapterType::I32, AdapterType::I64, AdapterType::I64], + ); + } Descriptor::Boolean => { self.instruction( &[AdapterType::Bool.option()], diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 7a39af67d2a..2e34dd0d324 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -65,6 +65,20 @@ impl InstructionBuilder<'_, '_> { Descriptor::U32 => self.outgoing_i32(AdapterType::U32), Descriptor::I64 => self.outgoing_i64(AdapterType::I64), Descriptor::U64 => self.outgoing_i64(AdapterType::U64), + Descriptor::I128 => { + self.instruction( + &[AdapterType::I64, AdapterType::I64], + Instruction::WasmToInt128 { signed: true }, + &[AdapterType::S128], + ); + } + Descriptor::U128 => { + self.instruction( + &[AdapterType::I64, AdapterType::I64], + Instruction::WasmToInt128 { signed: false }, + &[AdapterType::U128], + ); + } Descriptor::F32 => { self.get(AdapterType::F32); self.output.push(AdapterType::F32); @@ -267,6 +281,20 @@ impl InstructionBuilder<'_, '_> { Descriptor::U64 => self.option_native(false, ValType::I64), Descriptor::F32 => self.out_option_sentinel64(AdapterType::F32), Descriptor::F64 => self.option_native(true, ValType::F64), + Descriptor::I128 => { + self.instruction( + &[AdapterType::I32, AdapterType::I64, AdapterType::I64], + Instruction::OptionWasmToInt128 { signed: true }, + &[AdapterType::S128.option()], + ); + } + Descriptor::U128 => { + self.instruction( + &[AdapterType::I32, AdapterType::I64, AdapterType::I64], + Instruction::OptionWasmToInt128 { signed: false }, + &[AdapterType::U128.option()], + ); + } Descriptor::Boolean => { self.instruction( &[AdapterType::I32], @@ -360,6 +388,8 @@ impl InstructionBuilder<'_, '_> { | Descriptor::F64 | Descriptor::I64 | Descriptor::U64 + | Descriptor::I128 + | Descriptor::U128 | Descriptor::Boolean | Descriptor::Char | Descriptor::Enum { .. } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 8d8c7bc99d7..7feee8986a2 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -75,10 +75,12 @@ pub enum AdapterType { S16, S32, S64, + S128, U8, U16, U32, U64, + U128, F32, F64, String, @@ -145,6 +147,18 @@ pub enum Instruction { output: AdapterType, }, + /// Pops a 128-bit integer and pushes 2 Wasm 64-bit ints. + Int128ToWasm, + /// Pops 2 Wasm 64-bit ints and pushes a 128-bit integer. + WasmToInt128 { + signed: bool, + }, + + OptionInt128ToWasm, + OptionWasmToInt128 { + signed: bool, + }, + /// Pops a Wasm `i32` and pushes the enum variant as a string WasmToStringEnum { name: String, diff --git a/crates/cli/tests/reference/int128.d.ts b/crates/cli/tests/reference/int128.d.ts new file mode 100644 index 00000000000..183cef4758a --- /dev/null +++ b/crates/cli/tests/reference/int128.d.ts @@ -0,0 +1,7 @@ +/* tslint:disable */ +/* eslint-disable */ +export function echo_i128(a: bigint): bigint; +export function echo_u128(a: bigint): bigint; +export function echo_option_i128(a?: bigint): bigint | undefined; +export function echo_option_u128(a?: bigint): bigint | undefined; +export function throw_i128(): bigint; diff --git a/crates/cli/tests/reference/int128.js b/crates/cli/tests/reference/int128.js new file mode 100644 index 00000000000..04b865d7fb1 --- /dev/null +++ b/crates/cli/tests/reference/int128.js @@ -0,0 +1,74 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_i128(a) { + const ret = wasm.echo_i128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64))); +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_u128(a) { + const ret = wasm.echo_u128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64))); +} + +function isLikeNone(x) { + return x === undefined || x === null; +} +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_i128(a) { + const ret = wasm.echo_option_i128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (ret[2] << BigInt(64))); +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_u128(a) { + const ret = wasm.echo_option_u128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); +} + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} +/** + * @returns {bigint} + */ +export function throw_i128() { + const ret = wasm.throw_i128(); + if (ret[3]) { + throw takeObject(ret[2]); + } + return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64))); +} + diff --git a/crates/cli/tests/reference/int128.rs b/crates/cli/tests/reference/int128.rs new file mode 100644 index 00000000000..350faa34a43 --- /dev/null +++ b/crates/cli/tests/reference/int128.rs @@ -0,0 +1,28 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn echo_i128(a: i128) -> i128 { + a +} +#[wasm_bindgen] +pub fn echo_u128(a: u128) -> u128 { + a +} + +#[wasm_bindgen] +pub fn echo_option_i128(a: Option) -> Option { + a +} +#[wasm_bindgen] +pub fn echo_option_u128(a: Option) -> Option { + a +} + +#[wasm_bindgen] +pub fn throw_i128() -> Result { + Ok(0_i128) +} +// #[wasm_bindgen] +// pub fn throw_option_i128() -> Result, JsError> { +// Ok(None) +// } diff --git a/crates/cli/tests/reference/int128.wat b/crates/cli/tests/reference/int128.wat new file mode 100644 index 00000000000..61c7eab3ea3 --- /dev/null +++ b/crates/cli/tests/reference/int128.wat @@ -0,0 +1,19 @@ +(module $reference_test.wasm + (type (;0;) (func (result i64 i64 i32 i32))) + (type (;1;) (func (param i32 i64 i64) (result i32 i64 i64))) + (type (;2;) (func (param i64 i64) (result i64 i64))) + (func $"echo_option_i128 multivalue shim" (;0;) (type 1) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_option_u128 multivalue shim" (;1;) (type 1) (param i32 i64 i64) (result i32 i64 i64)) + (func $"throw_i128 multivalue shim" (;2;) (type 0) (result i64 i64 i32 i32)) + (func $"echo_i128 multivalue shim" (;3;) (type 2) (param i64 i64) (result i64 i64)) + (func $"echo_u128 multivalue shim" (;4;) (type 2) (param i64 i64) (result i64 i64)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "echo_i128" (func $"echo_i128 multivalue shim")) + (export "echo_u128" (func $"echo_u128 multivalue shim")) + (export "echo_option_i128" (func $"echo_option_i128 multivalue shim")) + (export "echo_option_u128" (func $"echo_option_u128 multivalue shim")) + (export "throw_i128" (func $"throw_i128 multivalue shim")) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index b669a0d5702..4fc6b3ed6de 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -15,6 +15,6 @@ error[E0277]: the trait bound `Result` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -7,7 +7,7 @@ [JavaScript `Number`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding) are 64-bit floating point value under the hood and cannot accurately represent all of Rust's numeric types. `wasm-bindgen` will automatically use either [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) or `Number` to accurately represent Rust's numeric types in JavaScript: - `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `isize`, `usize`, `f32`, and `f64` will be represented as `Number` in JavaScript. -- `u64` and `i64` will be represented as `BigInt` in JavaScript. +- `u64`, `i64`, `u128`, and `i128` will be represented as `BigInt` in JavaScript. > **Note**: Wasm is currently a 32-bit architecture, so `isize` and `usize` are 32-bit integers and "fit" into a JavaScript `Number`. @@ -39,11 +39,11 @@ This is the same behavior as assigning the JavaScript `Number` to a [typed array Except for the handling of `Infinity` and `-Infinity`, this is the same behavior as [casting](https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast) `f64` to the appropriate integer type in Rust, i.e. `value_f64 as u32`. -### `BigInt` to `u64` and `i64` +### `BigInt` to `u64`, `i64`, `u128`, and `i128` If the JavaScript `BigInt` is too large or too small for the target integer type, it will wrap around. -This is the same behavior as assigning the JavaScript `BigInt` to a [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of the appropriate integer type in JavaScript, i.e. `new Int64Array([value])[0]`. +This is the same behavior as assigning the JavaScript `BigInt` to a [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) for 64-bit integer types in JavaScript, i.e. `new Int64Array([value])[0]`. ### `Number` to `f32` diff --git a/src/convert/impls.rs b/src/convert/impls.rs index 28dac9cfd83..c4827ddf5ad 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -29,6 +29,43 @@ impl WasmAbi for T { } } +impl WasmAbi for i128 { + type Prim1 = u64; + type Prim2 = u64; + type Prim3 = (); + type Prim4 = (); + + #[inline] + fn split(self) -> (u64, u64, (), ()) { + let low = self as u64; + let high = (self >> 64) as u64; + (low, high, (), ()) + } + + #[inline] + fn join(low: u64, high: u64, _: (), _: ()) -> Self { + ((high as u128) << 64 | low as u128) as i128 + } +} +impl WasmAbi for u128 { + type Prim1 = u64; + type Prim2 = u64; + type Prim3 = (); + type Prim4 = (); + + #[inline] + fn split(self) -> (u64, u64, (), ()) { + let low = self as u64; + let high = (self >> 64) as u64; + (low, high, (), ()) + } + + #[inline] + fn join(low: u64, high: u64, _: (), _: ()) -> Self { + (high as u128) << 64 | low as u128 + } +} + impl> WasmAbi for Option { /// Whether this `Option` is a `Some` value. type Prim1 = u32; @@ -101,6 +138,8 @@ macro_rules! type_wasm_native { type_wasm_native!( i64 as i64 u64 as u64 + i128 as i128 + u128 as u128 f64 as f64 ); diff --git a/src/describe.rs b/src/describe.rs index f7e9e83d2cf..ac78848d222 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -30,6 +30,8 @@ tys! { U32 I64 U64 + I128 + U128 F32 F64 BOOLEAN @@ -89,6 +91,8 @@ simple! { u32 => U32 i64 => I64 u64 => U64 + i128 => I128 + u128 => U128 isize => I32 usize => U32 f32 => F32 diff --git a/tests/wasm/optional_primitives.js b/tests/wasm/optional_primitives.js index d6755144a20..499dd236d30 100644 --- a/tests/wasm/optional_primitives.js +++ b/tests/wasm/optional_primitives.js @@ -13,6 +13,8 @@ exports.optional_i16_js_identity = a => a; exports.optional_u16_js_identity = a => a; exports.optional_i64_js_identity = a => a; exports.optional_u64_js_identity = a => a; +exports.optional_i128_js_identity = a => a; +exports.optional_u128_js_identity = a => a; exports.optional_bool_js_identity = a => a; exports.optional_char_js_identity = a => a; @@ -102,6 +104,22 @@ exports.js_works = () => { assert.strictEqual(wasm.optional_u64_identity(wasm.optional_u64_min()), BigInt('0')); assert.strictEqual(wasm.optional_u64_identity(wasm.optional_u64_max()), BigInt('18446744073709551615')); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_none()), undefined); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_zero()), BigInt('0')); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_one()), BigInt('1')); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_neg_one()), BigInt('-1')); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_min()), -0x8000_0000_0000_0000_0000_0000_0000_0000n); + assert.strictEqual(wasm.optional_i128_identity(wasm.optional_i128_max()), 0x7FFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn); + assert.strictEqual(wasm.optional_i128_identity(0x3_1415_9265_3598_7932_3846n), 0x3_1415_9265_3598_7932_3846n); + assert.strictEqual(wasm.optional_i128_identity(-0x3_1415_9265_3598_7932_3846n), -0x3_1415_9265_3598_7932_3846n); + + assert.strictEqual(wasm.optional_u128_identity(wasm.optional_u128_none()), undefined); + assert.strictEqual(wasm.optional_u128_identity(wasm.optional_u128_zero()), BigInt('0')); + assert.strictEqual(wasm.optional_u128_identity(wasm.optional_u128_one()), BigInt('1')); + assert.strictEqual(wasm.optional_u128_identity(wasm.optional_u128_min()), BigInt('0')); + assert.strictEqual(wasm.optional_u128_identity(wasm.optional_u128_max()), 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn); + assert.strictEqual(wasm.optional_u128_identity(0x3_1415_9265_3598_7932_3846n), 0x3_1415_9265_3598_7932_3846n); + assert.strictEqual(wasm.optional_bool_identity(wasm.optional_bool_none()), undefined); assert.strictEqual(wasm.optional_bool_identity(wasm.optional_bool_false()), false); assert.strictEqual(wasm.optional_bool_identity(wasm.optional_bool_true()), true); diff --git a/tests/wasm/optional_primitives.rs b/tests/wasm/optional_primitives.rs index 027bc18c99f..c3cd1e9fc95 100644 --- a/tests/wasm/optional_primitives.rs +++ b/tests/wasm/optional_primitives.rs @@ -15,6 +15,8 @@ extern "C" { fn optional_u16_js_identity(a: Option) -> Option; fn optional_i64_js_identity(a: Option) -> Option; fn optional_u64_js_identity(a: Option) -> Option; + fn optional_i128_js_identity(a: Option) -> Option; + fn optional_u128_js_identity(a: Option) -> Option; fn optional_bool_js_identity(a: Option) -> Option; fn optional_char_js_identity(a: Option) -> Option; @@ -396,6 +398,71 @@ pub fn optional_u64_identity(a: Option) -> Option { optional_u64_js_identity(a) } +#[wasm_bindgen] +pub fn optional_i128_none() -> Option { + None +} + +#[wasm_bindgen] +pub fn optional_i128_zero() -> Option { + Some(0) +} + +#[wasm_bindgen] +pub fn optional_i128_one() -> Option { + Some(1) +} + +#[wasm_bindgen] +pub fn optional_i128_neg_one() -> Option { + Some(-1) +} + +#[wasm_bindgen] +pub fn optional_i128_min() -> Option { + Some(i128::MIN) +} + +#[wasm_bindgen] +pub fn optional_i128_max() -> Option { + Some(i128::MAX) +} + +#[wasm_bindgen] +pub fn optional_i128_identity(a: Option) -> Option { + optional_i128_js_identity(a) +} + +#[wasm_bindgen] +pub fn optional_u128_none() -> Option { + None +} + +#[wasm_bindgen] +pub fn optional_u128_zero() -> Option { + Some(0) +} + +#[wasm_bindgen] +pub fn optional_u128_one() -> Option { + Some(1) +} + +#[wasm_bindgen] +pub fn optional_u128_min() -> Option { + Some(u128::MIN) +} + +#[wasm_bindgen] +pub fn optional_u128_max() -> Option { + Some(u128::MAX) +} + +#[wasm_bindgen] +pub fn optional_u128_identity(a: Option) -> Option { + optional_u128_js_identity(a) +} + #[wasm_bindgen] pub fn optional_bool_none() -> Option { None From 87719072b2df13bb2d31b84be9181d8aa37d367a Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 12 Nov 2024 08:47:27 +0100 Subject: [PATCH 554/641] Added note for which versions of wasm-bindgen support i128 (#4262) --- guide/src/reference/types/numbers.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/src/reference/types/numbers.md b/guide/src/reference/types/numbers.md index 79b031b6af8..5cf376569ec 100644 --- a/guide/src/reference/types/numbers.md +++ b/guide/src/reference/types/numbers.md @@ -11,6 +11,8 @@ > **Note**: Wasm is currently a 32-bit architecture, so `isize` and `usize` are 32-bit integers and "fit" into a JavaScript `Number`. +> **Note**: `u128` and `i128` require `wasm-bindgen` version 0.2.96 or later. + ## Converting from JavaScript to Rust `wasm-bindgen` will automatically handle the conversion of JavaScript numbers to Rust numeric types. The conversion rules are as follows: From 2a1c7acc295ad77d3fd36179a34b9573f724c7a1 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 12 Nov 2024 21:57:51 +0100 Subject: [PATCH 555/641] Test different CLI flags in reference tests (#4264) --- crates/cli/tests/reference.rs | 95 ++++++++++++--- crates/cli/tests/reference/targets-0.d.ts | 3 + crates/cli/tests/reference/targets-0.js | 20 ++++ crates/cli/tests/reference/targets-0.wat | 9 ++ crates/cli/tests/reference/targets-1.d.ts | 33 +++++ crates/cli/tests/reference/targets-1.js | 132 ++++++++++++++++++++ crates/cli/tests/reference/targets-1.wat | 14 +++ crates/cli/tests/reference/targets-2.d.ts | 25 ++++ crates/cli/tests/reference/targets-2.js | 139 ++++++++++++++++++++++ crates/cli/tests/reference/targets-2.wat | 14 +++ crates/cli/tests/reference/targets-3.d.ts | 3 + crates/cli/tests/reference/targets-3.js | 40 +++++++ crates/cli/tests/reference/targets-3.wat | 14 +++ crates/cli/tests/reference/targets-4.d.ts | 3 + crates/cli/tests/reference/targets-4.js | 50 ++++++++ crates/cli/tests/reference/targets-4.wat | 14 +++ crates/cli/tests/reference/targets.rs | 19 +++ 17 files changed, 610 insertions(+), 17 deletions(-) create mode 100644 crates/cli/tests/reference/targets-0.d.ts create mode 100644 crates/cli/tests/reference/targets-0.js create mode 100644 crates/cli/tests/reference/targets-0.wat create mode 100644 crates/cli/tests/reference/targets-1.d.ts create mode 100644 crates/cli/tests/reference/targets-1.js create mode 100644 crates/cli/tests/reference/targets-1.wat create mode 100644 crates/cli/tests/reference/targets-2.d.ts create mode 100644 crates/cli/tests/reference/targets-2.js create mode 100644 crates/cli/tests/reference/targets-2.wat create mode 100644 crates/cli/tests/reference/targets-3.d.ts create mode 100644 crates/cli/tests/reference/targets-3.js create mode 100644 crates/cli/tests/reference/targets-3.wat create mode 100644 crates/cli/tests/reference/targets-4.d.ts create mode 100644 crates/cli/tests/reference/targets-4.js create mode 100644 crates/cli/tests/reference/targets-4.wat create mode 100644 crates/cli/tests/reference/targets.rs diff --git a/crates/cli/tests/reference.rs b/crates/cli/tests/reference.rs index cd7604062d9..190df67b541 100644 --- a/crates/cli/tests/reference.rs +++ b/crates/cli/tests/reference.rs @@ -34,6 +34,24 @@ //! //! Multiple dependencies can be declared in a single test file using multiple //! `DEPENDENCY:` comments. +//! +//! ## Custom CLI flags +//! +//! By default, tests will use the `bundler` target. Custom CLI flags can be +//! passed to the `wasm-bindgen` CLI by declaring them in a comment at the top +//! of the test file. For example: +//! +//! ```rust +//! // FLAGS: --target=web --reference-types +//! ``` +//! +//! Multiple comments can be used to run the test multiple times with different +//! flags. +//! +//! ```rust +//! // FLAGS: --target=web +//! // FLAGS: --target=nodejs +//! ``` use anyhow::{bail, Result}; use assert_cmd::prelude::*; @@ -101,6 +119,16 @@ fn runtest(test: &Path) -> Result<()> { let root = repo_root(); let root = root.display(); + // parse target declarations + let mut all_flags: Vec<_> = contents + .lines() + .filter_map(|l| l.strip_prefix("// FLAGS: ")) + .map(|l| l.trim()) + .collect(); + if all_flags.is_empty() { + all_flags.push(""); + } + // parse additional dependency declarations let dependencies = contents .lines() @@ -144,25 +172,58 @@ fn runtest(test: &Path) -> Result<()> { .join("debug") .join("reference_test.wasm"); - let mut bindgen = Command::cargo_bin("wasm-bindgen")?; - bindgen - .arg("--out-dir") - .arg(td.path()) - .arg(&wasm) - .arg("--remove-producers-section"); - if contents.contains("// enable-externref") { - bindgen.env("WASM_BINDGEN_EXTERNREF", "1"); - } - exec(&mut bindgen)?; + for (flags_index, &flags) in all_flags.iter().enumerate() { + // extract the target from the flags + let target = flags + .split_whitespace() + .find_map(|f| f.strip_prefix("--target=")) + .unwrap_or("bundler"); + + let out_dir = &td.path().join(target); + fs::create_dir(out_dir)?; + + let mut bindgen = Command::cargo_bin("wasm-bindgen")?; + bindgen + .arg("--out-dir") + .arg(out_dir) + .arg(&wasm) + .arg("--remove-producers-section"); + for flag in flags.split_whitespace() { + bindgen.arg(flag); + } + if contents.contains("// enable-externref") { + bindgen.env("WASM_BINDGEN_EXTERNREF", "1"); + } + exec(&mut bindgen)?; - if !contents.contains("async") { - let js = fs::read_to_string(td.path().join("reference_test_bg.js"))?; - assert_same(&js, &test.with_extension("js"))?; - let wat = sanitize_wasm(&td.path().join("reference_test_bg.wasm"))?; - assert_same(&wat, &test.with_extension("wat"))?; + // suffix the file name with the target + let test = if all_flags.len() > 1 { + let base_file_name = format!( + "{}-{}.rs", + test.file_stem().unwrap().to_string_lossy(), + flags_index + ); + test.with_file_name(base_file_name) + } else { + test.to_owned() + }; + + // bundler uses a different main JS file, because its + // reference_test.js just imports the reference_test_bg.js + let main_js_file = match target { + "bundler" => "reference_test_bg.js", + _ => "reference_test.js", + }; + + if !contents.contains("async") { + let js = fs::read_to_string(out_dir.join(main_js_file))?; + assert_same(&js, &test.with_extension("js"))?; + let wat = sanitize_wasm(&out_dir.join("reference_test_bg.wasm"))?; + assert_same(&wat, &test.with_extension("wat"))?; + } + let d_ts = fs::read_to_string(out_dir.join("reference_test.d.ts"))?; + assert_same(&d_ts, &test.with_extension("d.ts"))?; } - let d_ts = fs::read_to_string(td.path().join("reference_test.d.ts"))?; - assert_same(&d_ts, &test.with_extension("d.ts"))?; Ok(()) } diff --git a/crates/cli/tests/reference/targets-0.d.ts b/crates/cli/tests/reference/targets-0.d.ts new file mode 100644 index 00000000000..a01199843fc --- /dev/null +++ b/crates/cli/tests/reference/targets-0.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function add_that_might_fail(a: number, b: number): number; diff --git a/crates/cli/tests/reference/targets-0.js b/crates/cli/tests/reference/targets-0.js new file mode 100644 index 00000000000..5e2b7e8959b --- /dev/null +++ b/crates/cli/tests/reference/targets-0.js @@ -0,0 +1,20 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + +/** + * @param {number} a + * @param {number} b + * @returns {number} + */ +export function add_that_might_fail(a, b) { + const ret = wasm.add_that_might_fail(a, b); + return ret >>> 0; +} + +export function __wbg_random_5d40be260a2cfbac() { + const ret = Math.random(); + return ret; +}; + diff --git a/crates/cli/tests/reference/targets-0.wat b/crates/cli/tests/reference/targets-0.wat new file mode 100644 index 00000000000..b8d3e4b8c61 --- /dev/null +++ b/crates/cli/tests/reference/targets-0.wat @@ -0,0 +1,9 @@ +(module $reference_test.wasm + (type (;0;) (func (param i32 i32) (result i32))) + (func $add_that_might_fail (;0;) (type 0) (param i32 i32) (result i32)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "add_that_might_fail" (func $add_that_might_fail)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/targets-1.d.ts b/crates/cli/tests/reference/targets-1.d.ts new file mode 100644 index 00000000000..67e807819b3 --- /dev/null +++ b/crates/cli/tests/reference/targets-1.d.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +export function add_that_might_fail(a: number, b: number): number; + +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly add_that_might_fail: (a: number, b: number) => number; + readonly __wbindgen_export_0: WebAssembly.Table; + readonly __wbindgen_start: () => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. +* +* @returns {InitOutput} +*/ +export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; + +/** +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. +* +* @returns {Promise} +*/ +export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise; diff --git a/crates/cli/tests/reference/targets-1.js b/crates/cli/tests/reference/targets-1.js new file mode 100644 index 00000000000..69dc3f36f14 --- /dev/null +++ b/crates/cli/tests/reference/targets-1.js @@ -0,0 +1,132 @@ +let wasm; + +/** + * @param {number} a + * @param {number} b + * @returns {number} + */ +export function add_that_might_fail(a, b) { + const ret = wasm.add_that_might_fail(a, b); + return ret >>> 0; +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbg_random_5d40be260a2cfbac = function() { + const ret = Math.random(); + return ret; + }; + imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }; + + return imports; +} + +function __wbg_init_memory(imports, memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined') { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('reference_test_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync }; +export default __wbg_init; diff --git a/crates/cli/tests/reference/targets-1.wat b/crates/cli/tests/reference/targets-1.wat new file mode 100644 index 00000000000..db2cb5a6b2e --- /dev/null +++ b/crates/cli/tests/reference/targets-1.wat @@ -0,0 +1,14 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "wbg" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_that_might_fail (;1;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "add_that_might_fail" (func $add_that_might_fail)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/targets-2.d.ts b/crates/cli/tests/reference/targets-2.d.ts new file mode 100644 index 00000000000..9e1c41bd645 --- /dev/null +++ b/crates/cli/tests/reference/targets-2.d.ts @@ -0,0 +1,25 @@ +declare namespace wasm_bindgen { + /* tslint:disable */ + /* eslint-disable */ + export function add_that_might_fail(a: number, b: number): number; + +} + +declare type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +declare interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly add_that_might_fail: (a: number, b: number) => number; + readonly __wbindgen_export_0: WebAssembly.Table; + readonly __wbindgen_start: () => void; +} + +/** +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. +* +* @returns {Promise} +*/ +declare function wasm_bindgen (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise; diff --git a/crates/cli/tests/reference/targets-2.js b/crates/cli/tests/reference/targets-2.js new file mode 100644 index 00000000000..f1d867286d5 --- /dev/null +++ b/crates/cli/tests/reference/targets-2.js @@ -0,0 +1,139 @@ +let wasm_bindgen; +(function() { + const __exports = {}; + let script_src; + if (typeof document !== 'undefined' && document.currentScript !== null) { + script_src = new URL(document.currentScript.src, location.href).toString(); + } + let wasm = undefined; + /** + * @param {number} a + * @param {number} b + * @returns {number} + */ + __exports.add_that_might_fail = function(a, b) { + const ret = wasm.add_that_might_fail(a, b); + return ret >>> 0; + }; + + async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } + } + + function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbg_random_5d40be260a2cfbac = function() { + const ret = Math.random(); + return ret; + }; + imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }; + + return imports; + } + + function __wbg_init_memory(imports, memory) { + + } + + function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + + + wasm.__wbindgen_start(); + return wasm; + } + + function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined') { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); + } + + async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') { + module_or_path = script_src.replace(/\.js$/, '_bg.wasm'); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); + } + + wasm_bindgen = Object.assign(__wbg_init, { initSync }, __exports); + +})(); diff --git a/crates/cli/tests/reference/targets-2.wat b/crates/cli/tests/reference/targets-2.wat new file mode 100644 index 00000000000..db2cb5a6b2e --- /dev/null +++ b/crates/cli/tests/reference/targets-2.wat @@ -0,0 +1,14 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "wbg" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_that_might_fail (;1;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "add_that_might_fail" (func $add_that_might_fail)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/targets-3.d.ts b/crates/cli/tests/reference/targets-3.d.ts new file mode 100644 index 00000000000..a01199843fc --- /dev/null +++ b/crates/cli/tests/reference/targets-3.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function add_that_might_fail(a: number, b: number): number; diff --git a/crates/cli/tests/reference/targets-3.js b/crates/cli/tests/reference/targets-3.js new file mode 100644 index 00000000000..92291a18bb0 --- /dev/null +++ b/crates/cli/tests/reference/targets-3.js @@ -0,0 +1,40 @@ + +let imports = {}; +imports['__wbindgen_placeholder__'] = module.exports; +let wasm; +/** + * @param {number} a + * @param {number} b + * @returns {number} + */ +module.exports.add_that_might_fail = function(a, b) { + const ret = wasm.add_that_might_fail(a, b); + return ret >>> 0; +}; + +module.exports.__wbg_random_5d40be260a2cfbac = function() { + const ret = Math.random(); + return ret; +}; + +module.exports.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +const path = require('path').join(__dirname, 'reference_test_bg.wasm'); +const bytes = require('fs').readFileSync(path); + +const wasmModule = new WebAssembly.Module(bytes); +const wasmInstance = new WebAssembly.Instance(wasmModule, imports); +wasm = wasmInstance.exports; +module.exports.__wasm = wasm; + +wasm.__wbindgen_start(); + diff --git a/crates/cli/tests/reference/targets-3.wat b/crates/cli/tests/reference/targets-3.wat new file mode 100644 index 00000000000..ec8996a0fd3 --- /dev/null +++ b/crates/cli/tests/reference/targets-3.wat @@ -0,0 +1,14 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "__wbindgen_placeholder__" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_that_might_fail (;1;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "add_that_might_fail" (func $add_that_might_fail)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/targets-4.d.ts b/crates/cli/tests/reference/targets-4.d.ts new file mode 100644 index 00000000000..a01199843fc --- /dev/null +++ b/crates/cli/tests/reference/targets-4.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function add_that_might_fail(a: number, b: number): number; diff --git a/crates/cli/tests/reference/targets-4.js b/crates/cli/tests/reference/targets-4.js new file mode 100644 index 00000000000..9dd2431bb72 --- /dev/null +++ b/crates/cli/tests/reference/targets-4.js @@ -0,0 +1,50 @@ +/** + * @param {number} a + * @param {number} b + * @returns {number} + */ +export function add_that_might_fail(a, b) { + const ret = wasm.add_that_might_fail(a, b); + return ret >>> 0; +} + +const imports = { + __wbindgen_placeholder__: { + __wbg_random_5d40be260a2cfbac: function() { + const ret = Math.random(); + return ret; + }, + __wbindgen_init_externref_table: function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }, + }, + +}; + +const wasm_url = new URL('reference_test_bg.wasm', import.meta.url); +let wasmCode = ''; +switch (wasm_url.protocol) { + case 'file:': + wasmCode = await Deno.readFile(wasm_url); + break + case 'https:': + case 'http:': + wasmCode = await (await fetch(wasm_url)).arrayBuffer(); + break + default: + throw new Error(`Unsupported protocol: ${wasm_url.protocol}`); +} + +const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)).instance; +const wasm = wasmInstance.exports; +export const __wasm = wasm; + +wasm.__wbindgen_start(); + diff --git a/crates/cli/tests/reference/targets-4.wat b/crates/cli/tests/reference/targets-4.wat new file mode 100644 index 00000000000..ec8996a0fd3 --- /dev/null +++ b/crates/cli/tests/reference/targets-4.wat @@ -0,0 +1,14 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "__wbindgen_placeholder__" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_that_might_fail (;1;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "add_that_might_fail" (func $add_that_might_fail)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/targets.rs b/crates/cli/tests/reference/targets.rs new file mode 100644 index 00000000000..86e22ada3b7 --- /dev/null +++ b/crates/cli/tests/reference/targets.rs @@ -0,0 +1,19 @@ +// FLAGS: --target=bundler +// FLAGS: --target=web +// FLAGS: --target=no-modules +// FLAGS: --target=nodejs +// FLAGS: --target=deno + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = Math)] + fn random() -> f64; +} + +#[wasm_bindgen] +pub fn add_that_might_fail(a: u32, b: u32) -> u32 { + assert!(random() > 0.5); + a + b +} From 03207b3bc0aa409a9550b707c89b842d6e71287f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 13 Nov 2024 09:40:49 +0100 Subject: [PATCH 556/641] Update test coverage documentation to LLVM 19 (#4265) --- guide/src/wasm-bindgen-test/coverage.md | 26 +++++++------------------ 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/guide/src/wasm-bindgen-test/coverage.md b/guide/src/wasm-bindgen-test/coverage.md index f445a61700a..fb5a9c92d84 100644 --- a/guide/src/wasm-bindgen-test/coverage.md +++ b/guide/src/wasm-bindgen-test/coverage.md @@ -22,11 +22,7 @@ Currently it is particularly difficult to [deliver compile-line arguments to pro Make sure you are using `RUSTFLAGS=-Cinstrument-coverage -Zno-profiler-runtime`. -Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted. - -At the time of writing Rust Nightly uses LLVM v19, however [minicov] only supports LLVM v18. Usage of Clang or any LLVM tools must match the version used by [minicov]. - -[minicov]: https://crates.io/crates/minicov +Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Usage of Clang or any LLVM tools must match the LLVM version used by Rust. ### Arguments to the test runner @@ -58,11 +54,9 @@ CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner \ cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests -# Adjust the LLVM IR and compile to object files: +# Compile to object files: # - Extract a list of compiled artifacts from Cargo and filter them with `jq`. # - Figure out the path to the LLVM IR file corresponding to an artifact. -# - Replace every function body with `unreachable`. -# - Remove Rust-specific `range` annotations from function signatures. # - Compile to object file with Clang and store for later usage with `llvm-cov`. crate_name=name_of_the_tested_crate_in_snake_case objects=() @@ -81,20 +75,14 @@ do file=$(dirname $file)/$(basename $file .wasm).ll fi - perl -i -p0e 's/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file - counter=1 - while (( counter != 0 )); do - counter=$(perl -i -p0e '$c+= s/(^(define|declare)(,? [^\n ]+)*),? range\(.*?\)/$1/gm; END{print "$c"}' $file) - done - - output = $(basename $file .ll).o - clang-18 $input -Wno-override-module -c -o $output - objects+=(-object $output) + output = $(basename $file .ll).o + clang-19 $file -Wno-override-module -c -o $output + objects+=(-object $output) done # Merge all generated raw profiling data. -llvm-profdata-18 merge -sparse *.profraw -o coverage.profdata +llvm-profdata-19 merge -sparse *.profraw -o coverage.profdata # Produce test coverage data in the HTML format and pass the object files we generated earlier. -llvm-cov-18 show -show-instantiations=false -Xdemangler=rustfilt -output-dir coverage -format=html -instr-profile=coverage.profdata ${objects[@]} -sources src +llvm-cov-19 show -show-instantiations=false -Xdemangler=rustfilt -output-dir coverage -format=html -instr-profile=coverage.profdata ${objects[@]} -sources src ``` [rustc book]: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html From 539ea4323cedf62e2a64f8855791b9449f3b1d94 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 14 Nov 2024 09:45:18 +0100 Subject: [PATCH 557/641] Restart WebDriver on failure (#4267) --- CHANGELOG.md | 3 + .../bin/wasm-bindgen-test-runner/headless.rs | 71 ++++++++++++------- 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 351468dce62..5e85f5ddf6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ * Deprecate `--reference-types` in favor of automatic target feature detection. [#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237) +* `wasm-bindgen-test-runner` now tries to restart the WebDriver on failure, instead of spending its timeout period trying to connect to a non-existing WebDriver. + [#4267](https://github.com/rustwasm/wasm-bindgen/pull/4267) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 38a94d4b87d..e614999aead 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -61,36 +61,49 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error let driver_url = match driver.location() { Locate::Remote(url) => Ok(url.clone()), Locate::Local((path, args)) => { - // Allow tests to run in parallel (in theory) by finding any open port - // available for our driver. We can't bind the port for the driver, but - // hopefully the OS gives this invocation unique ports across processes - let driver_addr = TcpListener::bind("127.0.0.1:0")?.local_addr()?; - - // Spawn the driver binary, collecting its stdout/stderr in separate - // threads. We'll print this output later. - let mut cmd = Command::new(path); - cmd.args(args).arg(format!("--port={}", driver_addr.port())); - let mut child = BackgroundChild::spawn(path, &mut cmd, shell)?; - drop_log = Box::new(move || { - let _ = &child; - child.print_stdio_on_drop = false; - }); - // Wait for the driver to come online and bind its port before we try to // connect to it. let start = Instant::now(); let max = Duration::new(5, 0); - let mut bound = false; - while start.elapsed() < max { - if TcpStream::connect(driver_addr).is_ok() { - bound = true; - break; + + let (driver_addr, mut child) = 'outer: loop { + // Allow tests to run in parallel (in theory) by finding any open port + // available for our driver. We can't bind the port for the driver, but + // hopefully the OS gives this invocation unique ports across processes + let driver_addr = TcpListener::bind("127.0.0.1:0")?.local_addr()?; + // Spawn the driver binary, collecting its stdout/stderr in separate + // threads. We'll print this output later. + let mut cmd = Command::new(path); + cmd.args(args).arg(format!("--port={}", driver_addr.port())); + let mut child = BackgroundChild::spawn(path, &mut cmd, shell)?; + + // Wait for the driver to come online and bind its port before we try to + // connect to it. + loop { + if child.has_failed() { + if start.elapsed() >= max { + bail!("driver failed to start") + } + + println!("Failed to start driver, trying again ..."); + + thread::sleep(Duration::from_millis(100)); + break; + } else if TcpStream::connect(driver_addr).is_ok() { + break 'outer (driver_addr, child); + } else if start.elapsed() >= max { + bail!("driver failed to bind port during startup") + } else { + thread::sleep(Duration::from_millis(100)); + } } - thread::sleep(Duration::from_millis(100)); - } - if !bound { - bail!("driver failed to bind port during startup") - } + }; + + drop_log = Box::new(move || { + let _ = &child; + child.print_stdio_on_drop = false; + }); + Url::parse(&format!("http://{}", driver_addr)).map_err(Error::from) } }?; @@ -646,6 +659,14 @@ impl<'a> BackgroundChild<'a> { print_stdio_on_drop: true, }) } + + fn has_failed(&mut self) -> bool { + match self.child.try_wait() { + Ok(Some(status)) => !status.success(), + Ok(None) => false, + Err(_) => true, + } + } } impl<'a> Drop for BackgroundChild<'a> { From 50c7504af51aba3b8943d166c7e5f82b1a161fee Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 14 Nov 2024 09:50:40 +0100 Subject: [PATCH 558/641] Improved TS type generation from WASM (#4229) --- crates/cli-support/src/wasm2es6js.rs | 149 ++++++------ .../tests/reference/wasm-export-types.d.ts | 38 +++ .../cli/tests/reference/wasm-export-types.js | 226 ++++++++++++++++++ .../cli/tests/reference/wasm-export-types.rs | 17 ++ .../cli/tests/reference/wasm-export-types.wat | 26 ++ 5 files changed, 380 insertions(+), 76 deletions(-) create mode 100644 crates/cli/tests/reference/wasm-export-types.d.ts create mode 100644 crates/cli/tests/reference/wasm-export-types.js create mode 100644 crates/cli/tests/reference/wasm-export-types.rs create mode 100644 crates/cli/tests/reference/wasm-export-types.wat diff --git a/crates/cli-support/src/wasm2es6js.rs b/crates/cli-support/src/wasm2es6js.rs index bdf6f020f68..c16eb0a4504 100644 --- a/crates/cli-support/src/wasm2es6js.rs +++ b/crates/cli-support/src/wasm2es6js.rs @@ -62,97 +62,94 @@ fn args_are_optional(name: &str) -> bool { pub fn interface(module: &Module) -> Result { let mut exports = String::new(); + module_export_types(module, |name, ty| { + writeln!(exports, " readonly {}: {};", name, ty).unwrap(); + }); + Ok(exports) +} + +pub fn typescript(module: &Module) -> Result { + let mut exports = "/* tslint:disable */\n/* eslint-disable */\n".to_string(); + module_export_types(module, |name, ty| { + writeln!(exports, "export const {}: {};", name, ty).unwrap(); + }); + Ok(exports) +} +/// Iterates over all the exports in a module and generates TypeScript types. All +/// name-type pairs are passed to the `export` function. +fn module_export_types(module: &Module, mut export: impl FnMut(&str, &str)) { for entry in module.exports.iter() { - let id = match entry.item { - walrus::ExportItem::Function(i) => i, - walrus::ExportItem::Memory(_) => { - exports.push_str(&format!(" readonly {}: WebAssembly.Memory;\n", entry.name,)); - continue; - } - walrus::ExportItem::Table(_) => { - exports.push_str(&format!(" readonly {}: WebAssembly.Table;\n", entry.name,)); - continue; + match entry.item { + walrus::ExportItem::Function(id) => { + let func = module.funcs.get(id); + let ty = module.types.get(func.ty()); + let ts_type = function_type_to_ts(ty, args_are_optional(&entry.name)); + export(&entry.name, &ts_type); } + walrus::ExportItem::Memory(_) => export(&entry.name, "WebAssembly.Memory"), + walrus::ExportItem::Table(_) => export(&entry.name, "WebAssembly.Table"), walrus::ExportItem::Global(_) => continue, }; + } +} +fn val_type_to_ts(ty: walrus::ValType) -> &'static str { + // see https://webassembly.github.io/spec/js-api/index.html#towebassemblyvalue + // and https://webassembly.github.io/spec/js-api/index.html#tojsvalue + match ty { + walrus::ValType::I32 | walrus::ValType::F32 | walrus::ValType::F64 => "number", + walrus::ValType::I64 => "bigint", + // there could be anything behind a reference + walrus::ValType::Ref(_) => "any", + // V128 currently isn't supported in JS and therefore doesn't have a + // specific type in the spec. When it does get support, this type will + // still be technically correct, but should be updated to something more + // specific. + walrus::ValType::V128 => "any", + } +} +fn function_type_to_ts(function: &walrus::Type, all_args_optional: bool) -> String { + let mut out = String::new(); - let func = module.funcs.get(id); - let ty = module.types.get(func.ty()); - let mut args = String::new(); - for (i, _) in ty.params().iter().enumerate() { - if i > 0 { - args.push_str(", "); - } - - push_index_identifier(i, &mut args); - if args_are_optional(&entry.name) { - args.push('?'); - } - args.push_str(": number"); + // parameters + out.push('('); + for (i, arg_type) in function.params().iter().enumerate() { + if i > 0 { + out.push_str(", "); } - exports.push_str(&format!( - " readonly {name}: ({args}) => {ret};\n", - name = entry.name, - args = args, - ret = match ty.results().len() { - 0 => "void", - 1 => "number", - _ => "number[]", - }, - )); + push_index_identifier(i, &mut out); + if all_args_optional { + out.push('?'); + } + out.push_str(": "); + out.push_str(val_type_to_ts(*arg_type)); } + out.push(')'); - Ok(exports) -} - -pub fn typescript(module: &Module) -> Result { - let mut exports = "/* tslint:disable */\n/* eslint-disable */\n".to_string(); - for entry in module.exports.iter() { - let id = match entry.item { - walrus::ExportItem::Function(i) => i, - walrus::ExportItem::Memory(_) => { - exports.push_str(&format!( - "export const {}: WebAssembly.Memory;\n", - entry.name, - )); - continue; - } - walrus::ExportItem::Table(_) => { - exports.push_str(&format!( - "export const {}: WebAssembly.Table;\n", - entry.name, - )); - continue; - } - walrus::ExportItem::Global(_) => continue, - }; + // arrow + out.push_str(" => "); - let func = module.funcs.get(id); - let ty = module.types.get(func.ty()); - let mut args = String::new(); - for (i, _) in ty.params().iter().enumerate() { - if i > 0 { - args.push_str(", "); + // results + let results = function.results(); + // this match follows the spec: + // https://webassembly.github.io/spec/js-api/index.html#exported-function-exotic-objects + match results.len() { + 0 => out.push_str("void"), + 1 => out.push_str(val_type_to_ts(results[0])), + _ => { + out.push('['); + for (i, result) in results.iter().enumerate() { + if i > 0 { + out.push_str(", "); + } + out.push_str(val_type_to_ts(*result)); } - push_index_identifier(i, &mut args); - args.push_str(": number"); + out.push(']'); } - - exports.push_str(&format!( - "export function {name}({args}): {ret};\n", - name = entry.name, - args = args, - ret = match ty.results().len() { - 0 => "void", - 1 => "number", - _ => "number[]", - }, - )); } - Ok(exports) + out } impl Output { diff --git a/crates/cli/tests/reference/wasm-export-types.d.ts b/crates/cli/tests/reference/wasm-export-types.d.ts new file mode 100644 index 00000000000..a5f399db59d --- /dev/null +++ b/crates/cli/tests/reference/wasm-export-types.d.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +export function example(a: number, b: bigint, c: any, d: string): string; +export function example_128(a: bigint): bigint | undefined; + +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly example: (a: number, b: bigint, c: any, d: number, e: number) => [number, number]; + readonly example_128: (a: bigint, b: bigint) => [number, bigint, bigint]; + readonly __wbindgen_export_0: WebAssembly.Table; + readonly __wbindgen_malloc: (a: number, b: number) => number; + readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; + readonly __wbindgen_free: (a: number, b: number, c: number) => void; + readonly __wbindgen_start: () => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. +* +* @returns {InitOutput} +*/ +export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; + +/** +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. +* +* @returns {Promise} +*/ +export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise; diff --git a/crates/cli/tests/reference/wasm-export-types.js b/crates/cli/tests/reference/wasm-export-types.js new file mode 100644 index 00000000000..de290e90502 --- /dev/null +++ b/crates/cli/tests/reference/wasm-export-types.js @@ -0,0 +1,226 @@ +let wasm; + +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +let WASM_VECTOR_LEN = 0; + +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} +/** + * @param {number} a + * @param {bigint} b + * @param {any} c + * @param {string} d + * @returns {string} + */ +export function example(a, b, c, d) { + let deferred2_0; + let deferred2_1; + try { + const ptr0 = passStringToWasm0(d, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.example(a, b, c, ptr0, len0); + deferred2_0 = ret[0]; + deferred2_1 = ret[1]; + return getStringFromWasm0(ret[0], ret[1]); + } finally { + wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); + } +} + +/** + * @param {bigint} a + * @returns {bigint | undefined} + */ +export function example_128(a) { + const ret = wasm.example_128(a, a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }; + imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }; + + return imports; +} + +function __wbg_init_memory(imports, memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8ArrayMemory0 = null; + + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined') { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('reference_test_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync }; +export default __wbg_init; diff --git a/crates/cli/tests/reference/wasm-export-types.rs b/crates/cli/tests/reference/wasm-export-types.rs new file mode 100644 index 00000000000..06f89d912e0 --- /dev/null +++ b/crates/cli/tests/reference/wasm-export-types.rs @@ -0,0 +1,17 @@ +// FLAGS: --target=web + +use wasm_bindgen::prelude::*; + +// This is for testing the type generation of the wasm-exported functions. +// Here, example should be exported as `(arg0: number, arg1: bigint, arg2: any, arg3: number, arg4: number) => [number, number]`. +// Notes: `arg2: any` is an external reference to a JS value, and the ABI of strings is `number, number` (pointer, length). + +#[wasm_bindgen] +pub fn example(a: u32, b: u64, c: JsValue, d: &str) -> String { + todo!() +} + +#[wasm_bindgen] +pub fn example_128(a: u128) -> Option { + None +} diff --git a/crates/cli/tests/reference/wasm-export-types.wat b/crates/cli/tests/reference/wasm-export-types.wat new file mode 100644 index 00000000000..195c25a5723 --- /dev/null +++ b/crates/cli/tests/reference/wasm-export-types.wat @@ -0,0 +1,26 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (param i32 i32 i32 i32) (result i32))) + (type (;4;) (func (param i32 i64 externref i32 i32) (result i32 i32))) + (type (;5;) (func (param i64 i64) (result i32 i64 i64))) + (import "wbg" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 3) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 1) (param i32 i32) (result i32)) + (func $__wbindgen_free (;3;) (type 2) (param i32 i32 i32)) + (func $"example externref shim multivalue shim" (;4;) (type 4) (param i32 i64 externref i32 i32) (result i32 i32)) + (func $"example_128 multivalue shim" (;5;) (type 5) (param i64 i64) (result i32 i64 i64)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "example" (func $"example externref shim multivalue shim")) + (export "example_128" (func $"example_128 multivalue shim")) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_free" (func $__wbindgen_free)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + From 9eda4ae169ad488d3d6f9af52981b5c5ceb46c11 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 14 Nov 2024 16:08:08 +0100 Subject: [PATCH 559/641] Hash full signature for imported functions (#4269) --- .../tests/reference/anyref-import-catch.js | 2 +- crates/cli/tests/reference/import.js | 12 +-- crates/cli/tests/reference/modules.d.ts | 3 + crates/cli/tests/reference/modules.js | 78 +++++++++++++++++++ crates/cli/tests/reference/modules.rs | 38 +++++++++ crates/cli/tests/reference/modules.wat | 9 +++ crates/cli/tests/reference/raw.js | 2 +- crates/cli/tests/reference/targets-0.js | 2 +- crates/cli/tests/reference/targets-1.js | 2 +- crates/cli/tests/reference/targets-2.js | 2 +- crates/cli/tests/reference/targets-3.js | 2 +- crates/cli/tests/reference/targets-4.js | 2 +- crates/cli/tests/reference/web-sys.js | 2 +- crates/macro-support/src/parser.rs | 2 +- 14 files changed, 143 insertions(+), 15 deletions(-) create mode 100644 crates/cli/tests/reference/modules.d.ts create mode 100644 crates/cli/tests/reference/modules.js create mode 100644 crates/cli/tests/reference/modules.rs create mode 100644 crates/cli/tests/reference/modules.wat diff --git a/crates/cli/tests/reference/anyref-import-catch.js b/crates/cli/tests/reference/anyref-import-catch.js index b9a96c382b8..97101e26dba 100644 --- a/crates/cli/tests/reference/anyref-import-catch.js +++ b/crates/cli/tests/reference/anyref-import-catch.js @@ -52,7 +52,7 @@ export function exported() { } } -export function __wbg_foo_95fe1a04017077db() { return handleError(function () { +export function __wbg_foo_4e8309b1aa95a4ac() { return handleError(function () { foo(); }, arguments) }; diff --git a/crates/cli/tests/reference/import.js b/crates/cli/tests/reference/import.js index 229dd246115..c868faf90d5 100644 --- a/crates/cli/tests/reference/import.js +++ b/crates/cli/tests/reference/import.js @@ -68,28 +68,28 @@ export function exported() { } } -export function __wbg_add_dd5307a7ca6818d5(arg0, arg1) { +export function __wbg_add_7fbfb2c172506d12(arg0, arg1) { const ret = add(arg0, arg1); return ret; }; -export function __wbg_barfromfoo_d097f3ec35aab47c() { +export function __wbg_barfromfoo_29614885590bfb6f() { bar_from_foo(); }; -export function __wbg_catchme_a7bca7f3d5a5f319() { return handleError(function () { +export function __wbg_catchme_f7d87ea824a61e87() { return handleError(function () { catch_me(); }, arguments) }; -export function __wbg_nocatch_62552fa42a58590b() { +export function __wbg_nocatch_be850a8dddd9599d() { no_catch(); }; -export function __wbg_reload_90d82b22b83c1d99() { +export function __wbg_reload_84c12f152ad689f0() { window.location.reload(); }; -export function __wbg_write_d258674ff6f0ea8d(arg0, arg1) { +export function __wbg_write_c2ce0ce33a6087d5(arg0, arg1) { window.document.write(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/modules.d.ts b/crates/cli/tests/reference/modules.d.ts new file mode 100644 index 00000000000..091dbcc51a6 --- /dev/null +++ b/crates/cli/tests/reference/modules.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function exported(): void; diff --git a/crates/cli/tests/reference/modules.js b/crates/cli/tests/reference/modules.js new file mode 100644 index 00000000000..aa2adf82604 --- /dev/null +++ b/crates/cli/tests/reference/modules.js @@ -0,0 +1,78 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +export function exported() { + wasm.exported(); +} + +export function __wbg_parseFloat_2be7f01c31025438(arg0, arg1) { + const ret = parseFloat(getStringFromWasm0(arg0, arg1)); + return ret; +}; + +export function __wbg_parseFloat_7bc8aecd47f33642(arg0) { + const ret = parseFloat(getObject(arg0)); + return ret; +}; + +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + +export function __wbindgen_string_new(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); +}; + diff --git a/crates/cli/tests/reference/modules.rs b/crates/cli/tests/reference/modules.rs new file mode 100644 index 00000000000..79a9384dfc5 --- /dev/null +++ b/crates/cli/tests/reference/modules.rs @@ -0,0 +1,38 @@ +use wasm_bindgen::prelude::*; + +mod a { + use wasm_bindgen::prelude::*; + + #[wasm_bindgen] + extern "C" { + #[wasm_bindgen(js_name = parseFloat)] + pub fn parse_float(text: &JsValue) -> f64; + } +} + +mod b { + use wasm_bindgen::prelude::*; + + #[wasm_bindgen] + extern "C" { + #[wasm_bindgen(js_name = parseFloat)] + pub fn parse_float(text: &str) -> f64; + } +} + +mod a_again { + use wasm_bindgen::prelude::*; + + #[wasm_bindgen] + extern "C" { + #[wasm_bindgen(js_name = parseFloat)] + pub fn parse_float(text: &JsValue) -> f64; + } +} + +#[wasm_bindgen] +pub fn exported() { + let _ = a::parse_float(&JsValue::from_str("3.14")); + let _ = b::parse_float("3.14"); + let _ = a_again::parse_float(&JsValue::from_str("3.14")); +} diff --git a/crates/cli/tests/reference/modules.wat b/crates/cli/tests/reference/modules.wat new file mode 100644 index 00000000000..e05a3a8c0ac --- /dev/null +++ b/crates/cli/tests/reference/modules.wat @@ -0,0 +1,9 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (func $exported (;0;) (type 0)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "exported" (func $exported)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index d81276a6816..e9dcaf4cccb 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -104,7 +104,7 @@ export class Test { } } -export function __wbg_test2_39fe629b9aa739cf() { +export function __wbg_test2_ae36e154b7589768() { const ret = test2(); return addHeapObject(ret); }; diff --git a/crates/cli/tests/reference/targets-0.js b/crates/cli/tests/reference/targets-0.js index 5e2b7e8959b..0d920b61eb9 100644 --- a/crates/cli/tests/reference/targets-0.js +++ b/crates/cli/tests/reference/targets-0.js @@ -13,7 +13,7 @@ export function add_that_might_fail(a, b) { return ret >>> 0; } -export function __wbg_random_5d40be260a2cfbac() { +export function __wbg_random_8be0a899673d8681() { const ret = Math.random(); return ret; }; diff --git a/crates/cli/tests/reference/targets-1.js b/crates/cli/tests/reference/targets-1.js index 69dc3f36f14..50322fbdbb5 100644 --- a/crates/cli/tests/reference/targets-1.js +++ b/crates/cli/tests/reference/targets-1.js @@ -44,7 +44,7 @@ async function __wbg_load(module, imports) { function __wbg_get_imports() { const imports = {}; imports.wbg = {}; - imports.wbg.__wbg_random_5d40be260a2cfbac = function() { + imports.wbg.__wbg_random_8be0a899673d8681 = function() { const ret = Math.random(); return ret; }; diff --git a/crates/cli/tests/reference/targets-2.js b/crates/cli/tests/reference/targets-2.js index f1d867286d5..2ba5298fa52 100644 --- a/crates/cli/tests/reference/targets-2.js +++ b/crates/cli/tests/reference/targets-2.js @@ -50,7 +50,7 @@ let wasm_bindgen; function __wbg_get_imports() { const imports = {}; imports.wbg = {}; - imports.wbg.__wbg_random_5d40be260a2cfbac = function() { + imports.wbg.__wbg_random_8be0a899673d8681 = function() { const ret = Math.random(); return ret; }; diff --git a/crates/cli/tests/reference/targets-3.js b/crates/cli/tests/reference/targets-3.js index 92291a18bb0..9f6ad77ef51 100644 --- a/crates/cli/tests/reference/targets-3.js +++ b/crates/cli/tests/reference/targets-3.js @@ -12,7 +12,7 @@ module.exports.add_that_might_fail = function(a, b) { return ret >>> 0; }; -module.exports.__wbg_random_5d40be260a2cfbac = function() { +module.exports.__wbg_random_8be0a899673d8681 = function() { const ret = Math.random(); return ret; }; diff --git a/crates/cli/tests/reference/targets-4.js b/crates/cli/tests/reference/targets-4.js index 9dd2431bb72..ca25cd83ff4 100644 --- a/crates/cli/tests/reference/targets-4.js +++ b/crates/cli/tests/reference/targets-4.js @@ -10,7 +10,7 @@ export function add_that_might_fail(a, b) { const imports = { __wbindgen_placeholder__: { - __wbg_random_5d40be260a2cfbac: function() { + __wbg_random_8be0a899673d8681: function() { const ret = Math.random(); return ret; }, diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 4ef9ffbab71..8332315d32d 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -210,7 +210,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_1cabf49927794f50() { return handleError(function (arg0, arg1) { +export function __wbg_new_561a91ce53f10a66() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }, arguments) }; diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 72bd849d859..a6934c876f8 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -618,7 +618,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option (0, "n"), ast::ImportFunctionKind::Method { ref class, .. } => (1, &class[..]), }; - let data = (ns, &self.sig.ident, module); + let data = (ns, self.sig.to_token_stream().to_string(), module); format!( "__wbg_{}_{}", wasm.name From 5df8ebffa3698e7e90195b30e4c3e1a6bbab8f57 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 17 Nov 2024 08:45:48 +0100 Subject: [PATCH 560/641] Add test for imported getters and setters (#4270) --- .../tests/reference/import-getter-setter.d.ts | 3 + .../tests/reference/import-getter-setter.js | 102 ++++++++++++++++++ .../tests/reference/import-getter-setter.rs | 59 ++++++++++ .../tests/reference/import-getter-setter.wat | 9 ++ 4 files changed, 173 insertions(+) create mode 100644 crates/cli/tests/reference/import-getter-setter.d.ts create mode 100644 crates/cli/tests/reference/import-getter-setter.js create mode 100644 crates/cli/tests/reference/import-getter-setter.rs create mode 100644 crates/cli/tests/reference/import-getter-setter.wat diff --git a/crates/cli/tests/reference/import-getter-setter.d.ts b/crates/cli/tests/reference/import-getter-setter.d.ts new file mode 100644 index 00000000000..091dbcc51a6 --- /dev/null +++ b/crates/cli/tests/reference/import-getter-setter.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function exported(): void; diff --git a/crates/cli/tests/reference/import-getter-setter.js b/crates/cli/tests/reference/import-getter-setter.js new file mode 100644 index 00000000000..0f62dbdb2e0 --- /dev/null +++ b/crates/cli/tests/reference/import-getter-setter.js @@ -0,0 +1,102 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +function getObject(idx) { return heap[idx]; } + +let heap_next = heap.length; + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; +} + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +export function exported() { + wasm.exported(); +} + +export function __wbg_another_edf1002f8e41a5da(arg0) { + const ret = getObject(arg0).prop2; + return ret; +}; + +export function __wbg_b_f17802a22332a667(arg0) { + const ret = getObject(arg0).a; + return ret; +}; + +export function __wbg_bar2_84566b6bcf547b19() { + const ret = Bar.bar2(); + return ret; +}; + +export function __wbg_getfoo_eae0175044c62418() { + const ret = Bar.get_foo(); + return ret; +}; + +export function __wbg_new_d728785ba7e8df96() { + const ret = new SomeClass(); + return addHeapObject(ret); +}; + +export function __wbg_setanother_2d160a2b6600e990(arg0, arg1) { + getObject(arg0).prop2 = arg1 >>> 0; +}; + +export function __wbg_setb_40f909ae19a05c10(arg0, arg1) { + getObject(arg0).a = arg1 >>> 0; +}; + +export function __wbg_setbar2_c8b4a150c6accea2(arg0) { + Bar.set_bar2(arg0 >>> 0); +}; + +export function __wbg_setfoo_6c6b6af72f779234(arg0) { + Bar.set_foo(arg0 >>> 0); +}; + +export function __wbg_setsignal_d386d151e7775c3f(arg0, arg1) { + getObject(arg0).signal = arg1 >>> 0; +}; + +export function __wbg_setsomeprop_afbca63b5d0f4c92(arg0, arg1) { + getObject(arg0).some_prop = arg1 >>> 0; +}; + +export function __wbg_signal_b82e5486ce265c55(arg0) { + const ret = getObject(arg0).signal; + return ret; +}; + +export function __wbg_someprop_26178791e2719528(arg0) { + const ret = getObject(arg0).some_prop; + return ret; +}; + +export function __wbindgen_object_drop_ref(arg0) { + takeObject(arg0); +}; + diff --git a/crates/cli/tests/reference/import-getter-setter.rs b/crates/cli/tests/reference/import-getter-setter.rs new file mode 100644 index 00000000000..413616b7600 --- /dev/null +++ b/crates/cli/tests/reference/import-getter-setter.rs @@ -0,0 +1,59 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(js_namespace = Bar, getter = bar)] + fn get_foo() -> u32; + #[wasm_bindgen(js_namespace = Bar, setter = bar)] + fn set_foo(value: u32); + #[wasm_bindgen(js_namespace = Bar, getter, js_name = bar2)] + fn get_foo2() -> u32; + #[wasm_bindgen(js_namespace = Bar, setter, js_name = bar2)] + fn set_foo2(value: u32); + + #[wasm_bindgen] + #[derive(Debug, Clone, PartialEq)] + pub type SomeClass; + + #[wasm_bindgen(method, getter, js_class = "SomeClass", js_name = signal)] + pub fn signal(this: &SomeClass) -> u32; + #[wasm_bindgen(method, setter, js_class = "SomeClass", js_name = signal)] + pub fn set_signal(this: &SomeClass, value: u32); + + #[wasm_bindgen(method, getter, js_class = "SomeClass")] + pub fn some_prop(this: &SomeClass) -> u32; + #[wasm_bindgen(method, setter, js_class = "SomeClass")] + pub fn set_some_prop(this: &SomeClass, value: u32); + + #[wasm_bindgen(method, getter = prop2, js_class = "SomeClass")] + pub fn another(this: &SomeClass) -> u32; + #[wasm_bindgen(method, setter = prop2, js_class = "SomeClass")] + pub fn set_another(this: &SomeClass, value: u32); + + // #[wasm_bindgen(getter, js_class = "SomeClass")] + // pub fn static_controller() -> SomeClass; + // #[wasm_bindgen(getter, js_class = "SomeClass")] + // pub fn set_static_controller(value: &SomeClass); + + #[wasm_bindgen(constructor, js_class = "SomeClass")] + pub fn new() -> SomeClass; + + // js_name conflicts with the getter/setter name + #[wasm_bindgen(method, getter = a, js_class = "SomeClass", js_name = b)] + pub fn c(this: &SomeClass) -> u32; + #[wasm_bindgen(method, setter = a, js_class = "SomeClass", js_name = b)] + pub fn set_c(this: &SomeClass, value: u32); +} + +#[wasm_bindgen] +pub fn exported() { + set_foo(get_foo()); + set_foo2(get_foo2()); + + let a = SomeClass::new(); + a.set_signal(a.signal()); + a.set_some_prop(a.some_prop()); + a.set_another(a.another()); + a.set_c(a.c()); + // let _ = static_signal(); +} diff --git a/crates/cli/tests/reference/import-getter-setter.wat b/crates/cli/tests/reference/import-getter-setter.wat new file mode 100644 index 00000000000..e05a3a8c0ac --- /dev/null +++ b/crates/cli/tests/reference/import-getter-setter.wat @@ -0,0 +1,9 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (func $exported (;0;) (type 0)) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "exported" (func $exported)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + From fe5d89fcf5c0f947d16f23304843f8907c5aafed Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 17 Nov 2024 09:03:05 +0100 Subject: [PATCH 561/641] Update reference tests (#4275) --- .../tests/reference/import-getter-setter.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/cli/tests/reference/import-getter-setter.js b/crates/cli/tests/reference/import-getter-setter.js index 0f62dbdb2e0..a261e7f8d01 100644 --- a/crates/cli/tests/reference/import-getter-setter.js +++ b/crates/cli/tests/reference/import-getter-setter.js @@ -37,61 +37,61 @@ export function exported() { wasm.exported(); } -export function __wbg_another_edf1002f8e41a5da(arg0) { +export function __wbg_another_79dcbfe47962d7a7(arg0) { const ret = getObject(arg0).prop2; return ret; }; -export function __wbg_b_f17802a22332a667(arg0) { +export function __wbg_b_266c81b129cbc216(arg0) { const ret = getObject(arg0).a; return ret; }; -export function __wbg_bar2_84566b6bcf547b19() { +export function __wbg_bar2_38c86771c0e03476() { const ret = Bar.bar2(); return ret; }; -export function __wbg_getfoo_eae0175044c62418() { +export function __wbg_getfoo_690459206923b526() { const ret = Bar.get_foo(); return ret; }; -export function __wbg_new_d728785ba7e8df96() { +export function __wbg_new_98ff9abc2a3e2736() { const ret = new SomeClass(); return addHeapObject(ret); }; -export function __wbg_setanother_2d160a2b6600e990(arg0, arg1) { +export function __wbg_setanother_51e596d4d035bc4d(arg0, arg1) { getObject(arg0).prop2 = arg1 >>> 0; }; -export function __wbg_setb_40f909ae19a05c10(arg0, arg1) { +export function __wbg_setb_eda0c18669c4ad53(arg0, arg1) { getObject(arg0).a = arg1 >>> 0; }; -export function __wbg_setbar2_c8b4a150c6accea2(arg0) { +export function __wbg_setbar2_d99cb80edd0e1959(arg0) { Bar.set_bar2(arg0 >>> 0); }; -export function __wbg_setfoo_6c6b6af72f779234(arg0) { +export function __wbg_setfoo_029452b4d4645d79(arg0) { Bar.set_foo(arg0 >>> 0); }; -export function __wbg_setsignal_d386d151e7775c3f(arg0, arg1) { +export function __wbg_setsignal_bd536e517c35da41(arg0, arg1) { getObject(arg0).signal = arg1 >>> 0; }; -export function __wbg_setsomeprop_afbca63b5d0f4c92(arg0, arg1) { +export function __wbg_setsomeprop_965004b0138eb32c(arg0, arg1) { getObject(arg0).some_prop = arg1 >>> 0; }; -export function __wbg_signal_b82e5486ce265c55(arg0) { +export function __wbg_signal_89fe6c5b19fec3df(arg0) { const ret = getObject(arg0).signal; return ret; }; -export function __wbg_someprop_26178791e2719528(arg0) { +export function __wbg_someprop_fd4fc05f44bf5de2(arg0) { const ret = getObject(arg0).some_prop; return ret; }; From f071c7eb4ca4a2b119ce375b02d2ff01eda916a3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 09:21:18 +0100 Subject: [PATCH 562/641] Added support for the `wasm32v1-none` target (#4277) This PR adds support for the `wasm32v1-none` target and should enable all features previously behind `cfg(feature = "std")` for both `wasm32-unknown-unknown` and `wasm32v1-none`. Additionally, now `js-sys`, `web-sys`, `wasm-bindgen-futures` and `wasm-bindgen-test` support `no_std`. Changes: - Use `any(target_os = "unknown", target_os = "none")` instead of `target_os = "unknown"`. - For globals: - Continue to use `once_cell::sync::Lazy` when targeting `std`. - Use `Send + Sync` wrapped `once_cell::unsync::Lazy` when targeting `no_std` without `target_feature = "atomics"`. - Use `once_cell/critical_section` when targeting `no_std` with `target_feature = "atomics"`. As recommended by `critical_section`, this is something the user has to enable. Notable this only affects `link_to!`, any other feature will work as expected with no additional work required from the user. - For thread locals: - Continue to use `std::thread_local!` when targeting `std`. - Use `static mut` when targeting `no_std` without `target_feature = "atomics"`. - Use `#[thread_local]` when targeting `no_std` with `target_feature = "atomics"`. - Add `std` crate feature to `js-sys`, `web-sys`, `wasm-bindgen-futures` and `wasm-bindgen-test` and enable by default. This makes it possible to use these crates with `no_std` for both targets as well. - Inlined [`console_error_panic_hook`](https://crates.io/crates/console_error_panic_hook) and a `no_std` version of [`scoped_tls`](https://crates.io/crates/scoped-tls). Missing: - Add `wasm32v1-none` to CI. Probably in a follow-up when its stable, ergo Rust v1.84. --- .cargo/config.toml | 2 +- .github/workflows/main.yml | 32 ++- CHANGELOG.md | 12 + Cargo.toml | 11 +- crates/backend/Cargo.toml | 3 + crates/backend/src/ast.rs | 15 +- crates/backend/src/codegen.rs | 92 +++++--- .../tests/reference/anyref-import-catch.wat | 6 +- crates/cli/tests/reference/web-sys.wat | 6 +- crates/futures/Cargo.toml | 8 +- crates/futures/src/lib.rs | 20 +- crates/futures/src/queue.rs | 28 ++- crates/futures/src/task/multithread.rs | 23 +- crates/futures/src/task/singlethread.rs | 17 +- .../futures/src/task/wait_async_polyfill.rs | 33 ++- crates/js-sys/Cargo.toml | 6 +- crates/js-sys/src/lib.rs | 87 +++++--- crates/js-sys/tests/wasm/Function.rs | 4 +- crates/js-sys/tests/wasm/Object.rs | 8 +- crates/macro-support/Cargo.toml | 5 +- crates/macro-support/src/parser.rs | 31 ++- crates/macro/Cargo.toml | 5 +- crates/macro/src/lib.rs | 9 +- crates/macro/ui-tests/invalid-items.rs | 2 +- crates/macro/ui-tests/invalid-items.stderr | 8 +- .../macro/ui-tests/invalid-static-string.rs | 2 +- crates/test-macro/src/lib.rs | 6 +- crates/test/Cargo.toml | 14 +- crates/test/src/coverage.rs | 1 + crates/test/src/lib.rs | 5 + crates/test/src/rt/browser.rs | 4 +- crates/test/src/rt/detect.rs | 1 + crates/test/src/rt/mod.rs | 79 +++++-- crates/test/src/rt/node.rs | 2 + crates/test/src/rt/scoped_tls.rs | 85 +++++++ crates/test/src/rt/worker.rs | 2 + crates/web-sys/Cargo.toml | 6 +- .../web-sys/src/features/gen_AesCbcParams.rs | 2 +- .../web-sys/src/features/gen_AesCtrParams.rs | 2 +- .../src/features/gen_AesDerivedKeyParams.rs | 2 +- .../web-sys/src/features/gen_AesGcmParams.rs | 2 +- .../src/features/gen_AesKeyAlgorithm.rs | 2 +- .../src/features/gen_AesKeyGenParams.rs | 2 +- crates/web-sys/src/features/gen_Algorithm.rs | 2 +- .../features/gen_AllowedBluetoothDevice.rs | 2 +- .../src/features/gen_AllowedUsbDevice.rs | 2 +- crates/web-sys/src/features/gen_Animation.rs | 2 +- .../src/features/gen_AnimationEvent.rs | 4 +- .../src/features/gen_AnimationEventInit.rs | 4 +- .../features/gen_AnimationPropertyDetails.rs | 4 +- .../gen_AnimationPropertyValueDetails.rs | 4 +- crates/web-sys/src/features/gen_Attr.rs | 10 +- .../src/features/gen_AttributeNameValue.rs | 4 +- .../src/features/gen_AudioConfiguration.rs | 4 +- .../src/features/gen_AudioDecoderConfig.rs | 2 +- .../src/features/gen_AudioEncoderConfig.rs | 2 +- crates/web-sys/src/features/gen_AudioTrack.rs | 8 +- ...en_AuthenticationExtensionsClientInputs.rs | 8 +- ...ticationExtensionsDevicePublicKeyInputs.rs | 4 +- ...AuthenticationExtensionsLargeBlobInputs.rs | 4 +- .../gen_AuthenticationResponseJson.rs | 10 +- .../gen_AuthenticatorAssertionResponseJson.rs | 18 +- ...en_AuthenticatorAttestationResponseJson.rs | 16 +- .../gen_AuthenticatorSelectionCriteria.rs | 4 +- .../src/features/gen_AutocompleteInfo.rs | 8 +- .../src/features/gen_BaseComputedKeyframe.rs | 2 +- .../web-sys/src/features/gen_BaseKeyframe.rs | 2 +- .../src/features/gen_BasicCardResponse.rs | 10 +- .../src/features/gen_BeforeUnloadEvent.rs | 2 +- crates/web-sys/src/features/gen_Blob.rs | 2 +- .../src/features/gen_BlobPropertyBag.rs | 2 +- .../features/gen_BluetoothAdvertisingEvent.rs | 2 +- .../gen_BluetoothAdvertisingEventInit.rs | 2 +- .../src/features/gen_BluetoothDevice.rs | 4 +- .../features/gen_BluetoothLeScanFilterInit.rs | 4 +- .../gen_BluetoothPermissionDescriptor.rs | 2 +- .../gen_BluetoothRemoteGattCharacteristic.rs | 2 +- .../gen_BluetoothRemoteGattDescriptor.rs | 2 +- .../gen_BluetoothRemoteGattService.rs | 2 +- .../web-sys/src/features/gen_BluetoothUuid.rs | 14 +- .../src/features/gen_BroadcastChannel.rs | 2 +- .../gen_BrowserElementDownloadOptions.rs | 4 +- .../gen_BrowserElementExecuteScriptOptions.rs | 5 +- .../src/features/gen_CacheBatchOperation.rs | 2 +- .../src/features/gen_CacheQueryOptions.rs | 2 +- .../features/gen_CanvasRenderingContext2d.rs | 18 +- .../gen_CaretStateChangedEventInit.rs | 4 +- .../web-sys/src/features/gen_CharacterData.rs | 9 +- .../src/features/gen_CheckerboardReport.rs | 2 +- .../src/features/gen_ChromeFilePropertyBag.rs | 4 +- crates/web-sys/src/features/gen_Client.rs | 4 +- crates/web-sys/src/features/gen_CloseEvent.rs | 2 +- .../src/features/gen_CloseEventInit.rs | 2 +- .../src/features/gen_CollectedClientData.rs | 10 +- .../src/features/gen_CompositionEvent.rs | 4 +- .../src/features/gen_CompositionEventInit.rs | 2 +- .../src/features/gen_ComputedEffectTiming.rs | 2 +- .../src/features/gen_ConnStatusDict.rs | 2 +- .../src/features/gen_ConsoleCounter.rs | 2 +- .../src/features/gen_ConsoleCounterError.rs | 4 +- .../web-sys/src/features/gen_ConsoleEvent.rs | 14 +- .../features/gen_ConsoleInstanceOptions.rs | 9 +- .../src/features/gen_ConsoleProfileEvent.rs | 2 +- .../src/features/gen_ConsoleStackEntry.rs | 6 +- .../src/features/gen_ConsoleTimerError.rs | 4 +- .../src/features/gen_ConsoleTimerLogOrEnd.rs | 2 +- .../src/features/gen_ConsoleTimerStart.rs | 2 +- crates/web-sys/src/features/gen_Credential.rs | 4 +- crates/web-sys/src/features/gen_Crypto.rs | 2 +- crates/web-sys/src/features/gen_CryptoKey.rs | 2 +- .../web-sys/src/features/gen_CssAnimation.rs | 2 +- .../src/features/gen_CssConditionRule.rs | 2 +- .../src/features/gen_CssCounterStyleRule.rs | 22 +- .../features/gen_CssFontFeatureValuesRule.rs | 4 +- .../web-sys/src/features/gen_CssImportRule.rs | 2 +- .../src/features/gen_CssKeyframeRule.rs | 2 +- .../src/features/gen_CssKeyframesRule.rs | 2 +- .../src/features/gen_CssNamespaceRule.rs | 4 +- .../src/features/gen_CssPseudoElement.rs | 2 +- crates/web-sys/src/features/gen_CssRule.rs | 2 +- .../src/features/gen_CssStyleDeclaration.rs | 18 +- .../web-sys/src/features/gen_CssStyleRule.rs | 2 +- .../web-sys/src/features/gen_CssTransition.rs | 2 +- .../web-sys/src/features/gen_DataTransfer.rs | 6 +- .../src/features/gen_DataTransferItem.rs | 4 +- .../features/gen_DecoderDoctorNotification.rs | 12 +- .../gen_DedicatedWorkerGlobalScope.rs | 2 +- .../src/features/gen_DhKeyDeriveParams.rs | 2 +- crates/web-sys/src/features/gen_Directory.rs | 4 +- .../features/gen_DirectoryPickerOptions.rs | 2 +- .../src/features/gen_DisplayNameOptions.rs | 2 +- .../src/features/gen_DisplayNameResult.rs | 4 +- .../web-sys/src/features/gen_DnsCacheEntry.rs | 4 +- .../web-sys/src/features/gen_DnsLookupDict.rs | 2 +- crates/web-sys/src/features/gen_Document.rs | 30 +-- .../web-sys/src/features/gen_DocumentType.rs | 6 +- crates/web-sys/src/features/gen_DomError.rs | 4 +- .../web-sys/src/features/gen_DomException.rs | 8 +- .../web-sys/src/features/gen_DomStringList.rs | 4 +- .../web-sys/src/features/gen_DomStringMap.rs | 2 +- .../web-sys/src/features/gen_DomTokenList.rs | 6 +- .../src/features/gen_EcKeyAlgorithm.rs | 4 +- .../src/features/gen_EcKeyGenParams.rs | 4 +- .../src/features/gen_EcKeyImportParams.rs | 4 +- .../src/features/gen_EcdhKeyDeriveParams.rs | 2 +- .../web-sys/src/features/gen_EcdsaParams.rs | 2 +- .../web-sys/src/features/gen_EffectTiming.rs | 2 +- crates/web-sys/src/features/gen_Element.rs | 22 +- .../features/gen_ElementCreationOptions.rs | 4 +- .../features/gen_ElementDefinitionOptions.rs | 2 +- crates/web-sys/src/features/gen_ErrorEvent.rs | 4 +- .../src/features/gen_ErrorEventInit.rs | 4 +- crates/web-sys/src/features/gen_Event.rs | 2 +- .../web-sys/src/features/gen_EventSource.rs | 2 +- crates/web-sys/src/features/gen_Exception.rs | 8 +- .../features/gen_ExtendableMessageEvent.rs | 4 +- .../gen_ExtendableMessageEventInit.rs | 4 +- .../src/features/gen_FakePluginMimeEntry.rs | 6 +- .../src/features/gen_FakePluginTagInit.rs | 16 +- crates/web-sys/src/features/gen_FetchEvent.rs | 2 +- .../src/features/gen_FetchEventInit.rs | 2 +- crates/web-sys/src/features/gen_File.rs | 2 +- .../src/features/gen_FilePickerAcceptType.rs | 2 +- .../src/features/gen_FilePickerOptions.rs | 2 +- .../src/features/gen_FilePropertyBag.rs | 2 +- .../src/features/gen_FileReaderSync.rs | 17 +- crates/web-sys/src/features/gen_FileSystem.rs | 2 +- .../src/features/gen_FileSystemEntry.rs | 4 +- .../src/features/gen_FileSystemHandle.rs | 2 +- crates/web-sys/src/features/gen_FontData.rs | 8 +- crates/web-sys/src/features/gen_FontFace.rs | 18 +- .../src/features/gen_FontFaceDescriptors.rs | 16 +- crates/web-sys/src/features/gen_Gamepad.rs | 2 +- .../src/features/gen_GetUserMediaRequest.rs | 6 +- .../src/features/gen_GpuAdapterInfo.rs | 8 +- .../web-sys/src/features/gen_GpuBindGroup.rs | 2 +- .../features/gen_GpuBindGroupDescriptor.rs | 2 +- .../src/features/gen_GpuBindGroupLayout.rs | 2 +- .../gen_GpuBindGroupLayoutDescriptor.rs | 2 +- crates/web-sys/src/features/gen_GpuBuffer.rs | 2 +- .../src/features/gen_GpuBufferDescriptor.rs | 2 +- .../src/features/gen_GpuCommandBuffer.rs | 2 +- .../gen_GpuCommandBufferDescriptor.rs | 2 +- .../src/features/gen_GpuCommandEncoder.rs | 2 +- .../gen_GpuCommandEncoderDescriptor.rs | 2 +- .../src/features/gen_GpuCompilationMessage.rs | 2 +- .../features/gen_GpuComputePassDescriptor.rs | 2 +- .../src/features/gen_GpuComputePassEncoder.rs | 2 +- .../src/features/gen_GpuComputePipeline.rs | 2 +- .../gen_GpuComputePipelineDescriptor.rs | 2 +- crates/web-sys/src/features/gen_GpuDevice.rs | 2 +- .../src/features/gen_GpuDeviceDescriptor.rs | 2 +- .../src/features/gen_GpuDeviceLostInfo.rs | 2 +- crates/web-sys/src/features/gen_GpuError.rs | 2 +- .../src/features/gen_GpuExternalTexture.rs | 2 +- .../gen_GpuExternalTextureDescriptor.rs | 2 +- .../src/features/gen_GpuFragmentState.rs | 2 +- .../features/gen_GpuObjectDescriptorBase.rs | 2 +- .../features/gen_GpuPipelineDescriptorBase.rs | 2 +- .../src/features/gen_GpuPipelineLayout.rs | 2 +- .../gen_GpuPipelineLayoutDescriptor.rs | 2 +- .../src/features/gen_GpuProgrammableStage.rs | 2 +- .../web-sys/src/features/gen_GpuQuerySet.rs | 2 +- .../src/features/gen_GpuQuerySetDescriptor.rs | 2 +- crates/web-sys/src/features/gen_GpuQueue.rs | 2 +- .../src/features/gen_GpuQueueDescriptor.rs | 2 +- .../src/features/gen_GpuRenderBundle.rs | 2 +- .../features/gen_GpuRenderBundleDescriptor.rs | 2 +- .../features/gen_GpuRenderBundleEncoder.rs | 2 +- .../gen_GpuRenderBundleEncoderDescriptor.rs | 2 +- .../features/gen_GpuRenderPassDescriptor.rs | 2 +- .../src/features/gen_GpuRenderPassEncoder.rs | 2 +- .../src/features/gen_GpuRenderPassLayout.rs | 2 +- .../src/features/gen_GpuRenderPipeline.rs | 2 +- .../gen_GpuRenderPipelineDescriptor.rs | 2 +- .../features/gen_GpuRequestAdapterOptions.rs | 2 +- crates/web-sys/src/features/gen_GpuSampler.rs | 2 +- .../src/features/gen_GpuSamplerDescriptor.rs | 2 +- .../src/features/gen_GpuShaderModule.rs | 2 +- .../gen_GpuShaderModuleCompilationHint.rs | 2 +- .../features/gen_GpuShaderModuleDescriptor.rs | 4 +- crates/web-sys/src/features/gen_GpuTexture.rs | 2 +- .../src/features/gen_GpuTextureDescriptor.rs | 2 +- .../src/features/gen_GpuTextureView.rs | 2 +- .../features/gen_GpuTextureViewDescriptor.rs | 2 +- .../src/features/gen_GpuVertexState.rs | 2 +- .../src/features/gen_HashChangeEvent.rs | 4 +- .../src/features/gen_HashChangeEventInit.rs | 4 +- crates/web-sys/src/features/gen_Headers.rs | 2 +- crates/web-sys/src/features/gen_HidDevice.rs | 2 +- .../src/features/gen_HitRegionOptions.rs | 2 +- crates/web-sys/src/features/gen_HkdfParams.rs | 2 +- .../src/features/gen_HmacDerivedKeyParams.rs | 2 +- .../src/features/gen_HmacImportParams.rs | 2 +- .../src/features/gen_HmacKeyAlgorithm.rs | 2 +- .../src/features/gen_HmacKeyGenParams.rs | 2 +- .../src/features/gen_HtmlAnchorElement.rs | 48 ++-- .../src/features/gen_HtmlAreaElement.rs | 38 ++-- .../src/features/gen_HtmlBaseElement.rs | 4 +- .../src/features/gen_HtmlBodyElement.rs | 12 +- .../web-sys/src/features/gen_HtmlBrElement.rs | 2 +- .../src/features/gen_HtmlButtonElement.rs | 19 +- .../src/features/gen_HtmlCanvasElement.rs | 9 +- .../src/features/gen_HtmlDataElement.rs | 2 +- .../src/features/gen_HtmlDialogElement.rs | 2 +- .../src/features/gen_HtmlDivElement.rs | 2 +- .../web-sys/src/features/gen_HtmlDocument.rs | 21 +- .../web-sys/src/features/gen_HtmlElement.rs | 18 +- .../src/features/gen_HtmlEmbedElement.rs | 12 +- .../src/features/gen_HtmlFieldSetElement.rs | 8 +- .../src/features/gen_HtmlFontElement.rs | 6 +- .../src/features/gen_HtmlFormElement.rs | 16 +- .../src/features/gen_HtmlFrameElement.rs | 14 +- .../src/features/gen_HtmlFrameSetElement.rs | 4 +- .../src/features/gen_HtmlHeadingElement.rs | 2 +- .../web-sys/src/features/gen_HtmlHrElement.rs | 8 +- .../src/features/gen_HtmlHtmlElement.rs | 2 +- .../src/features/gen_HtmlIFrameElement.rs | 24 +- .../src/features/gen_HtmlImageElement.rs | 26 +-- .../src/features/gen_HtmlInputElement.rs | 48 ++-- .../src/features/gen_HtmlLabelElement.rs | 2 +- .../src/features/gen_HtmlLegendElement.rs | 2 +- .../web-sys/src/features/gen_HtmlLiElement.rs | 2 +- .../src/features/gen_HtmlLinkElement.rs | 24 +- .../src/features/gen_HtmlMapElement.rs | 2 +- .../src/features/gen_HtmlMediaElement.rs | 10 +- .../src/features/gen_HtmlMenuElement.rs | 4 +- .../src/features/gen_HtmlMenuItemElement.rs | 8 +- .../src/features/gen_HtmlMetaElement.rs | 8 +- .../src/features/gen_HtmlModElement.rs | 4 +- .../src/features/gen_HtmlOListElement.rs | 2 +- .../src/features/gen_HtmlObjectElement.rs | 29 +-- .../src/features/gen_HtmlOptGroupElement.rs | 2 +- .../src/features/gen_HtmlOptionElement.rs | 6 +- .../src/features/gen_HtmlOutputElement.rs | 11 +- .../src/features/gen_HtmlParagraphElement.rs | 2 +- .../src/features/gen_HtmlParamElement.rs | 8 +- .../src/features/gen_HtmlQuoteElement.rs | 2 +- .../src/features/gen_HtmlScriptElement.rs | 16 +- .../src/features/gen_HtmlSelectElement.rs | 11 +- .../src/features/gen_HtmlSlotElement.rs | 2 +- .../src/features/gen_HtmlSourceElement.rs | 10 +- .../src/features/gen_HtmlStyleElement.rs | 4 +- .../features/gen_HtmlTableCaptionElement.rs | 2 +- .../src/features/gen_HtmlTableCellElement.rs | 22 +- .../src/features/gen_HtmlTableColElement.rs | 10 +- .../src/features/gen_HtmlTableElement.rs | 18 +- .../src/features/gen_HtmlTableRowElement.rs | 10 +- .../features/gen_HtmlTableSectionElement.rs | 8 +- .../src/features/gen_HtmlTextAreaElement.rs | 22 +- .../src/features/gen_HtmlTimeElement.rs | 2 +- .../src/features/gen_HtmlTitleElement.rs | 2 +- .../src/features/gen_HtmlTrackElement.rs | 8 +- .../src/features/gen_HtmlUListElement.rs | 2 +- .../src/features/gen_HtmlVideoElement.rs | 2 +- .../web-sys/src/features/gen_HttpConnInfo.rs | 2 +- .../src/features/gen_HttpConnectionElement.rs | 2 +- .../web-sys/src/features/gen_IdbDatabase.rs | 2 +- crates/web-sys/src/features/gen_IdbIndex.rs | 4 +- .../src/features/gen_IdbIndexParameters.rs | 2 +- .../src/features/gen_IdbMutableFile.rs | 4 +- .../src/features/gen_IdbObjectStore.rs | 2 +- .../src/features/gen_ImageCaptureError.rs | 2 +- .../web-sys/src/features/gen_ImageDecoder.rs | 2 +- .../src/features/gen_ImageDecoderInit.rs | 2 +- .../src/features/gen_ImageEncodeOptions.rs | 2 +- crates/web-sys/src/features/gen_InputEvent.rs | 4 +- .../src/features/gen_InputEventInit.rs | 4 +- .../src/features/gen_IntersectionObserver.rs | 2 +- .../features/gen_IntersectionObserverInit.rs | 2 +- crates/web-sys/src/features/gen_JsonWebKey.rs | 30 +-- .../web-sys/src/features/gen_KeyAlgorithm.rs | 2 +- .../src/features/gen_KeyFrameRequestEvent.rs | 2 +- .../web-sys/src/features/gen_KeyboardEvent.rs | 4 +- .../src/features/gen_KeyboardEventInit.rs | 4 +- .../features/gen_KeyframeAnimationOptions.rs | 4 +- .../src/features/gen_KeyframeEffectOptions.rs | 2 +- .../web-sys/src/features/gen_L10nElement.rs | 10 +- crates/web-sys/src/features/gen_L10nValue.rs | 2 +- crates/web-sys/src/features/gen_LocaleInfo.rs | 4 +- crates/web-sys/src/features/gen_Location.rs | 18 +- crates/web-sys/src/features/gen_Lock.rs | 2 +- crates/web-sys/src/features/gen_LockInfo.rs | 4 +- .../web-sys/src/features/gen_MathMlElement.rs | 2 +- .../src/features/gen_MediaDeviceInfo.rs | 6 +- .../src/features/gen_MediaEncryptedEvent.rs | 2 +- crates/web-sys/src/features/gen_MediaError.rs | 2 +- crates/web-sys/src/features/gen_MediaImage.rs | 6 +- .../features/gen_MediaKeyNeededEventInit.rs | 2 +- .../src/features/gen_MediaKeySession.rs | 2 +- .../src/features/gen_MediaKeySystemAccess.rs | 2 +- .../gen_MediaKeySystemConfiguration.rs | 2 +- .../gen_MediaKeySystemMediaCapability.rs | 6 +- crates/web-sys/src/features/gen_MediaKeys.rs | 2 +- .../src/features/gen_MediaKeysPolicy.rs | 2 +- crates/web-sys/src/features/gen_MediaList.rs | 6 +- .../web-sys/src/features/gen_MediaMetadata.rs | 6 +- .../src/features/gen_MediaMetadataInit.rs | 6 +- .../src/features/gen_MediaQueryList.rs | 2 +- .../src/features/gen_MediaQueryListEvent.rs | 2 +- .../features/gen_MediaQueryListEventInit.rs | 2 +- .../web-sys/src/features/gen_MediaRecorder.rs | 2 +- .../src/features/gen_MediaRecorderOptions.rs | 2 +- .../web-sys/src/features/gen_MediaStream.rs | 2 +- .../features/gen_MediaStreamConstraints.rs | 2 +- .../src/features/gen_MediaStreamError.rs | 6 +- .../src/features/gen_MediaStreamTrack.rs | 6 +- .../gen_MediaStreamTrackGeneratorInit.rs | 2 +- .../features/gen_MediaTrackCapabilities.rs | 4 +- .../features/gen_MediaTrackConstraintSet.rs | 2 +- .../src/features/gen_MediaTrackConstraints.rs | 2 +- .../src/features/gen_MediaTrackSettings.rs | 4 +- .../src/features/gen_MemoryAttribution.rs | 4 +- .../gen_MemoryAttributionContainer.rs | 4 +- .../web-sys/src/features/gen_MessageEvent.rs | 4 +- .../src/features/gen_MessageEventInit.rs | 4 +- crates/web-sys/src/features/gen_MidiPort.rs | 8 +- crates/web-sys/src/features/gen_MimeType.rs | 6 +- crates/web-sys/src/features/gen_MouseEvent.rs | 2 +- .../web-sys/src/features/gen_MutationEvent.rs | 6 +- .../src/features/gen_MutationRecord.rs | 8 +- .../features/gen_NativeOsFileReadOptions.rs | 2 +- .../gen_NativeOsFileWriteAtomicOptions.rs | 4 +- crates/web-sys/src/features/gen_Navigator.rs | 16 +- .../features/gen_NavigatorUaBrandVersion.rs | 4 +- .../src/features/gen_NavigatorUaData.rs | 2 +- .../src/features/gen_NetworkCommandOptions.rs | 62 +++--- .../src/features/gen_NetworkResultOptions.rs | 36 +-- crates/web-sys/src/features/gen_Node.rs | 15 +- .../web-sys/src/features/gen_Notification.rs | 14 +- .../src/features/gen_NotificationAction.rs | 6 +- .../src/features/gen_NotificationOptions.rs | 12 +- .../gen_OffscreenCanvasRenderingContext2d.rs | 16 +- .../src/features/gen_OpenFilePickerOptions.rs | 2 +- .../src/features/gen_OpenWindowEventDetail.rs | 6 +- .../src/features/gen_OptionalEffectTiming.rs | 2 +- .../web-sys/src/features/gen_PaintRequest.rs | 2 +- .../src/features/gen_PaymentAddress.rs | 20 +- .../features/gen_PaymentMethodChangeEvent.rs | 2 +- .../gen_PaymentMethodChangeEventInit.rs | 2 +- .../src/features/gen_PaymentResponse.rs | 12 +- .../web-sys/src/features/gen_Pbkdf2Params.rs | 2 +- .../src/features/gen_PerformanceEntry.rs | 4 +- .../features/gen_PerformanceEntryEventInit.rs | 6 +- .../gen_PerformanceEntryFilterOptions.rs | 8 +- .../features/gen_PerformanceResourceTiming.rs | 4 +- .../features/gen_PerformanceServerTiming.rs | 4 +- crates/web-sys/src/features/gen_Plugin.rs | 8 +- .../features/gen_PluginCrashedEventInit.rs | 8 +- .../web-sys/src/features/gen_PointerEvent.rs | 2 +- .../src/features/gen_PointerEventInit.rs | 2 +- .../src/features/gen_PopupBlockedEvent.rs | 4 +- .../src/features/gen_PopupBlockedEventInit.rs | 6 +- .../web-sys/src/features/gen_PositionError.rs | 2 +- .../features/gen_PresentationConnection.rs | 4 +- .../gen_PresentationConnectionCloseEvent.rs | 2 +- ...en_PresentationConnectionCloseEventInit.rs | 4 +- .../src/features/gen_ProcessingInstruction.rs | 2 +- .../src/features/gen_ProfileTimelineMarker.rs | 6 +- .../features/gen_ProfileTimelineStackFrame.rs | 8 +- .../src/features/gen_PublicKeyCredential.rs | 2 +- ..._PublicKeyCredentialCreationOptionsJson.rs | 6 +- .../gen_PublicKeyCredentialDescriptorJson.rs | 4 +- .../features/gen_PublicKeyCredentialEntity.rs | 4 +- .../gen_PublicKeyCredentialRequestOptions.rs | 6 +- ...n_PublicKeyCredentialRequestOptionsJson.rs | 14 +- .../gen_PublicKeyCredentialRpEntity.rs | 6 +- .../gen_PublicKeyCredentialUserEntity.rs | 6 +- .../gen_PublicKeyCredentialUserEntityJson.rs | 6 +- .../src/features/gen_PushMessageData.rs | 2 +- .../src/features/gen_PushSubscription.rs | 2 +- .../src/features/gen_PushSubscriptionInit.rs | 4 +- .../src/features/gen_PushSubscriptionJson.rs | 2 +- .../src/features/gen_PushSubscriptionKeys.rs | 4 +- .../web-sys/src/features/gen_RadioNodeList.rs | 2 +- .../src/features/gen_RegisterRequest.rs | 4 +- .../src/features/gen_RegisterResponse.rs | 8 +- .../web-sys/src/features/gen_RegisteredKey.rs | 6 +- .../src/features/gen_RegistrationOptions.rs | 4 +- .../features/gen_RegistrationResponseJson.rs | 10 +- crates/web-sys/src/features/gen_Request.rs | 8 +- .../web-sys/src/features/gen_RequestInit.rs | 6 +- ...RequestMediaKeySystemAccessNotification.rs | 4 +- crates/web-sys/src/features/gen_Response.rs | 4 +- .../web-sys/src/features/gen_ResponseInit.rs | 2 +- .../web-sys/src/features/gen_RsaOaepParams.rs | 2 +- .../src/features/gen_RsaOtherPrimesInfo.rs | 6 +- .../web-sys/src/features/gen_RsaPssParams.rs | 2 +- .../web-sys/src/features/gen_RtcCodecStats.rs | 6 +- .../src/features/gen_RtcConfiguration.rs | 2 +- .../src/features/gen_RtcDataChannel.rs | 2 +- .../src/features/gen_RtcDataChannelInit.rs | 2 +- .../gen_RtcEncodedAudioFrameMetadata.rs | 2 +- .../gen_RtcEncodedVideoFrameMetadata.rs | 2 +- .../src/features/gen_RtcIceCandidate.rs | 4 +- .../src/features/gen_RtcIceCandidateInit.rs | 4 +- .../features/gen_RtcIceCandidatePairStats.rs | 12 +- .../src/features/gen_RtcIceCandidateStats.rs | 10 +- .../src/features/gen_RtcIceComponentStats.rs | 4 +- .../web-sys/src/features/gen_RtcIceServer.rs | 6 +- .../src/features/gen_RtcIdentityAssertion.rs | 4 +- .../gen_RtcIdentityAssertionResult.rs | 2 +- .../gen_RtcIdentityProviderDetails.rs | 4 +- .../gen_RtcIdentityProviderOptions.rs | 6 +- .../gen_RtcIdentityValidationResult.rs | 4 +- .../features/gen_RtcInboundRtpStreamStats.rs | 14 +- .../src/features/gen_RtcMediaStreamStats.rs | 4 +- .../features/gen_RtcMediaStreamTrackStats.rs | 5 +- .../features/gen_RtcOutboundRtpStreamStats.rs | 14 +- .../src/features/gen_RtcPeerConnection.rs | 2 +- .../gen_RtcPeerConnectionIceErrorEvent.rs | 6 +- .../src/features/gen_RtcRtcpParameters.rs | 2 +- .../src/features/gen_RtcRtpCodecCapability.rs | 4 +- .../src/features/gen_RtcRtpCodecParameters.rs | 4 +- .../features/gen_RtcRtpEncodingParameters.rs | 5 +- .../gen_RtcRtpHeaderExtensionCapability.rs | 2 +- .../gen_RtcRtpHeaderExtensionParameters.rs | 2 +- .../src/features/gen_RtcRtpTransceiver.rs | 4 +- .../src/features/gen_RtcSessionDescription.rs | 2 +- .../features/gen_RtcSessionDescriptionInit.rs | 2 +- crates/web-sys/src/features/gen_RtcStats.rs | 2 +- .../features/gen_RtcStatsReportInternal.rs | 6 +- .../src/features/gen_RtcTransportStats.rs | 2 +- .../web-sys/src/features/gen_RtcdtmfSender.rs | 2 +- .../features/gen_RtcdtmfToneChangeEvent.rs | 2 +- .../gen_RtcdtmfToneChangeEventInit.rs | 2 +- .../gen_RtcrtpContributingSourceStats.rs | 6 +- .../src/features/gen_RtcrtpStreamStats.rs | 14 +- .../src/features/gen_SaveFilePickerOptions.rs | 4 +- .../gen_SecurityPolicyViolationEvent.rs | 16 +- .../gen_SecurityPolicyViolationEventInit.rs | 29 ++- crates/web-sys/src/features/gen_Selection.rs | 2 +- .../web-sys/src/features/gen_ServiceWorker.rs | 2 +- .../features/gen_ServiceWorkerContainer.rs | 5 +- .../features/gen_ServiceWorkerRegistration.rs | 2 +- crates/web-sys/src/features/gen_ShadowRoot.rs | 2 +- crates/web-sys/src/features/gen_ShareData.rs | 6 +- .../features/gen_SharedWorkerGlobalScope.rs | 2 +- .../web-sys/src/features/gen_SignResponse.rs | 8 +- .../web-sys/src/features/gen_SocketElement.rs | 2 +- .../web-sys/src/features/gen_SpeechGrammar.rs | 2 +- .../src/features/gen_SpeechRecognition.rs | 4 +- .../gen_SpeechRecognitionAlternative.rs | 2 +- .../features/gen_SpeechRecognitionError.rs | 2 +- .../gen_SpeechRecognitionErrorInit.rs | 2 +- .../gen_SpeechSynthesisErrorEventInit.rs | 2 +- .../src/features/gen_SpeechSynthesisEvent.rs | 2 +- .../features/gen_SpeechSynthesisEventInit.rs | 2 +- .../features/gen_SpeechSynthesisUtterance.rs | 4 +- .../src/features/gen_SpeechSynthesisVoice.rs | 6 +- crates/web-sys/src/features/gen_Storage.rs | 6 +- .../web-sys/src/features/gen_StorageEvent.rs | 8 +- .../src/features/gen_StorageEventInit.rs | 8 +- crates/web-sys/src/features/gen_StyleSheet.rs | 6 +- crates/web-sys/src/features/gen_SvgAngle.rs | 2 +- .../src/features/gen_SvgAnimatedString.rs | 4 +- crates/web-sys/src/features/gen_SvgElement.rs | 4 +- crates/web-sys/src/features/gen_SvgLength.rs | 2 +- crates/web-sys/src/features/gen_SvgPathSeg.rs | 2 +- .../src/features/gen_SvgScriptElement.rs | 4 +- .../web-sys/src/features/gen_SvgStringList.rs | 23 +- .../src/features/gen_SvgStyleElement.rs | 8 +- .../web-sys/src/features/gen_SvgaElement.rs | 14 +- crates/web-sys/src/features/gen_TcpSocket.rs | 2 +- .../src/features/gen_TcpSocketErrorEvent.rs | 4 +- .../features/gen_TcpSocketErrorEventInit.rs | 4 +- crates/web-sys/src/features/gen_Text.rs | 2 +- .../web-sys/src/features/gen_TextDecoder.rs | 19 +- .../web-sys/src/features/gen_TextEncoder.rs | 2 +- crates/web-sys/src/features/gen_TextTrack.rs | 8 +- .../web-sys/src/features/gen_TextTrackCue.rs | 2 +- .../web-sys/src/features/gen_ToggleEvent.rs | 4 +- .../src/features/gen_ToggleEventInit.rs | 4 +- .../web-sys/src/features/gen_TokenBinding.rs | 4 +- .../src/features/gen_TransitionEvent.rs | 4 +- .../src/features/gen_TransitionEventInit.rs | 4 +- .../web-sys/src/features/gen_TreeCellInfo.rs | 2 +- crates/web-sys/src/features/gen_TreeView.rs | 5 +- .../web-sys/src/features/gen_U2fClientData.rs | 6 +- .../web-sys/src/features/gen_UaDataValues.rs | 10 +- .../src/features/gen_UaLowEntropyJson.rs | 2 +- .../src/features/gen_UdpMessageEventInit.rs | 2 +- crates/web-sys/src/features/gen_UdpOptions.rs | 4 +- crates/web-sys/src/features/gen_Url.rs | 30 +-- .../src/features/gen_UrlSearchParams.rs | 2 +- .../src/features/gen_UsbAlternateInterface.rs | 2 +- .../src/features/gen_UsbConfiguration.rs | 2 +- crates/web-sys/src/features/gen_UsbDevice.rs | 6 +- .../src/features/gen_UsbDeviceFilter.rs | 2 +- .../src/features/gen_VideoConfiguration.rs | 4 +- .../src/features/gen_VideoDecoderConfig.rs | 2 +- .../src/features/gen_VideoEncoderConfig.rs | 4 +- crates/web-sys/src/features/gen_VideoTrack.rs | 8 +- crates/web-sys/src/features/gen_VrDisplay.rs | 2 +- .../src/features/gen_VrSubmitFrameResult.rs | 2 +- crates/web-sys/src/features/gen_VttCue.rs | 2 +- crates/web-sys/src/features/gen_VttRegion.rs | 2 +- .../features/gen_WebGl2RenderingContext.rs | 12 +- .../src/features/gen_WebGlActiveInfo.rs | 2 +- .../src/features/gen_WebGlContextEvent.rs | 2 +- .../src/features/gen_WebGlContextEventInit.rs | 2 +- .../src/features/gen_WebGlRenderingContext.rs | 9 +- crates/web-sys/src/features/gen_WebSocket.rs | 6 +- .../src/features/gen_WebSocketElement.rs | 2 +- .../src/features/gen_WebTransportCloseInfo.rs | 2 +- .../src/features/gen_WebTransportHash.rs | 2 +- .../src/features/gen_WebglDebugShaders.rs | 5 +- .../src/features/gen_WidevineCdmManifest.rs | 14 +- crates/web-sys/src/features/gen_Window.rs | 19 +- .../src/features/gen_WorkerGlobalScope.rs | 6 +- .../src/features/gen_WorkerLocation.rs | 18 +- .../src/features/gen_WorkerNavigator.rs | 14 +- .../web-sys/src/features/gen_WorkerOptions.rs | 2 +- .../web-sys/src/features/gen_XPathResult.rs | 2 +- .../src/features/gen_XmlHttpRequest.rs | 13 +- .../web-sys/src/features/gen_XmlSerializer.rs | 5 +- crates/web-sys/src/features/gen_css.rs | 2 +- crates/web-sys/src/lib.rs | 4 + crates/web-sys/tests/wasm/history.rs | 2 +- crates/web-sys/tests/wasm/performance.rs | 2 +- crates/webidl-tests/main.rs | 2 + crates/webidl/src/idl_type.rs | 10 +- crates/webidl/src/update_cargo_toml.rs | 6 +- .../src/dependent_module.rs | 2 +- .../indexing-getter-setter-deleter.md | 2 +- guide/src/reference/static-js-objects.md | 15 +- src/convert/mod.rs | 2 + src/externref.rs | 9 +- src/lib.rs | 208 +++++++++++++++--- taplo.toml | 2 +- tests/headless/strings.rs | 2 +- tests/non_wasm.rs | 2 +- tests/wasm/duplicates.rs | 8 +- tests/wasm/imports.rs | 8 +- tests/wasm/node.rs | 2 +- 575 files changed, 2254 insertions(+), 1565 deletions(-) create mode 100644 crates/test/src/rt/scoped_tls.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index 59337eed45f..11543229379 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,4 @@ -[target.wasm32-unknown-unknown] +[target.'cfg(target_arch = "wasm32")'] runner = 'cargo run -p wasm-bindgen-cli --bin wasm-bindgen-test-runner --' [target.'cfg(all())'] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20b261e6eaa..d18aac7b127 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,6 +92,37 @@ jobs: - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings + # Run `cargo clippy` over crates that support `no_std` + clippy_no_std: + name: Clippy `no_std` + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update stable && rustup default stable + - run: rustup target add wasm32-unknown-unknown + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings + + # Run `cargo clippy` over crates that support `no_std` with `target_feature = "atomics"` support. + clippy_no_std_atomics: + name: Clippy `no_std` with `atomics` + runs-on: ubuntu-latest + env: + CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory + steps: + - uses: actions/checkout@v4 + - run: rustup default nightly-2024-07-06 + - run: rustup target add wasm32-unknown-unknown + - run: rustup component add clippy rust-src + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings + # Run `cargo clippy` over the project clippy_project: name: Clippy (project) @@ -100,7 +131,6 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings - run: for i in examples/*/; do cd "$i"; cargo +stable clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings || exit 1; cd ../..; done diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e85f5ddf6a..88340abe3df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,15 @@ * Added WASM ABI support for `u128` and `i128` [#4222](https://github.com/rustwasm/wasm-bindgen/pull/4222) +* Added support for the `wasm32v1-none` target. + [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) + +* Added support for `no_std` to `js-sys`, `web-sys`, `wasm-bindgen-futures` and `wasm-bindgen-test`. + [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) + +* Added support for `no_std` to `link_to!`, `static_string` (via `thread_local_v2`) and `throw`. + [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) + ### Changed * String enums now generate private TypeScript types but only if used. @@ -46,6 +55,9 @@ * `wasm-bindgen-test-runner` now tries to restart the WebDriver on failure, instead of spending its timeout period trying to connect to a non-existing WebDriver. [#4267](https://github.com/rustwasm/wasm-bindgen/pull/4267) +* Deprecated `#[wasm_bindgen(thread_local)]` in favor of `#[wasm_bindgen(thread_local_v2)]`, which creates a `wasm_bindgen::JsThreadLocal`. It is similar to `std::thread::LocalKey` but supports `no_std`. + [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/Cargo.toml b/Cargo.toml index e5d52b98ce4..153a7306e31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ default = ["spans", "std"] enable-interning = ["std"] serde-serialize = ["serde", "serde_json", "std"] spans = ["wasm-bindgen-macro/spans"] -std = [] +std = ["wasm-bindgen-macro/std", "once_cell/std"] # Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on # all unused attributes @@ -42,10 +42,15 @@ xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_ [dependencies] cfg-if = "1.0.0" -once_cell = "1.12" +once_cell = { version = "1.12", default-features = false } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false } + +[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies] +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false, features = [ + "atomics", +] } [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 3b8d2d39020..4ff518442d9 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -14,8 +14,11 @@ rust-version = "1.57" version = "0.2.95" [features] +atomics = [] +default = ["std"] extra-traits = ["syn/extra-traits"] spans = [] +std = [] [dependencies] bumpalo = "3.0.0" diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 0991dac66cf..0507f055306 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -275,8 +275,17 @@ pub struct ImportStatic { pub js_name: String, /// Path to wasm_bindgen pub wasm_bindgen: Path, - /// [`true`] if using the new `thread_local` representation. - pub thread_local: bool, + /// Version of `thread_local`, if any. + pub thread_local: Option, +} + +/// Which version of the `thread_local` attribute is enabled. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum ThreadLocal { + /// V1. + V1, + /// V2. + V2, } /// The type of a static string being imported @@ -297,6 +306,8 @@ pub struct ImportString { pub js_sys: Path, /// The string to export. pub string: String, + /// Version of `thread_local`. + pub thread_local: ThreadLocal, } /// The metadata for a type being imported diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 0cb52f3472c..13349eec53b 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -163,7 +163,7 @@ impl TryToTokens for ast::Program { let prefix_json_bytes = syn::LitByteStr::new(&prefix_json_bytes, Span::call_site()); (quote! { - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { use #wasm_bindgen::__rt::{flat_len, flat_byte_slices}; @@ -201,9 +201,10 @@ impl TryToTokens for ast::LinkToModule { #program #extern_fn - static __VAL: #wasm_bindgen::__rt::Lazy = #wasm_bindgen::__rt::Lazy::new(|| unsafe { - <#wasm_bindgen::__rt::alloc::string::String as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#name().join()) - }); + static __VAL: #wasm_bindgen::__rt::once_cell::sync::Lazy<#wasm_bindgen::__rt::alloc::string::String> = + #wasm_bindgen::__rt::once_cell::sync::Lazy::new(|| unsafe { + <#wasm_bindgen::__rt::alloc::string::String as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#name().join()) + }); #wasm_bindgen::__rt::alloc::string::String::clone(&__VAL) } @@ -275,12 +276,12 @@ impl ToTokens for ast::Struct { let ptr = #wasm_bindgen::convert::IntoWasmAbi::into_abi(value); #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] extern "C" { fn #new_fn(ptr: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] unsafe fn #new_fn(_: u32) -> u32 { panic!("cannot convert to JsValue outside of the Wasm target") } @@ -292,7 +293,7 @@ impl ToTokens for ast::Struct { } } - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { #[no_mangle] @@ -381,12 +382,12 @@ impl ToTokens for ast::Struct { let idx = #wasm_bindgen::convert::IntoWasmAbi::into_abi(&value); #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] extern "C" { fn #unwrap_fn(ptr: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] unsafe fn #unwrap_fn(_: u32) -> u32 { panic!("cannot convert from JsValue outside of the Wasm target") } @@ -493,7 +494,7 @@ impl ToTokens for ast::StructField { (quote! { #[automatically_derived] const _: () = { - #[cfg_attr(all(target_arch = "wasm32", target_os = "unknown"), no_mangle)] + #[cfg_attr(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), no_mangle)] #[doc(hidden)] #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub unsafe extern "C" fn #getter(js: u32) @@ -532,7 +533,7 @@ impl ToTokens for ast::StructField { let (args, names) = splat(wasm_bindgen, &Ident::new("val", rust_name.span()), &abi); (quote! { - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { #[no_mangle] @@ -791,7 +792,7 @@ impl TryToTokens for ast::Export { const _: () = { #(#attrs)* #[cfg_attr( - all(target_arch = "wasm32", target_os = "unknown"), + all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), export_name = #export_name, )] #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] @@ -1066,11 +1067,11 @@ impl ToTokens for ast::ImportType { impl JsCast for #rust_name { fn instanceof(val: &JsValue) -> bool { #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] extern "C" { fn #instanceof_shim(val: u32) -> u32; } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] unsafe fn #instanceof_shim(_: u32) -> u32 { panic!("cannot check instanceof on non-wasm targets"); } @@ -1675,7 +1676,7 @@ impl ToTokens for ast::ImportStatic { fn to_tokens(&self, into: &mut TokenStream) { let ty = &self.ty; - if self.thread_local { + if let Some(thread_local) = self.thread_local { thread_local_import( &self.vis, &self.rust_name, @@ -1683,6 +1684,7 @@ impl ToTokens for ast::ImportStatic { ty, ty, &self.shim, + thread_local, ) .to_tokens(into) } else { @@ -1695,7 +1697,7 @@ impl ToTokens for ast::ImportStatic { into.extend(quote! { #[automatically_derived] - #[deprecated = "use with `#[wasm_bindgen(thread_local)]` instead"] + #[deprecated = "use with `#[wasm_bindgen(thread_local_v2)]` instead"] }); into.extend( quote_spanned! { name.span() => #vis static #name: #wasm_bindgen::JsStatic<#ty> = { @@ -1735,6 +1737,7 @@ impl ToTokens for ast::ImportString { &actual_ty, &self.ty, &self.shim, + self.thread_local, ) .to_tokens(into); } @@ -1747,15 +1750,52 @@ fn thread_local_import( actual_ty: &syn::Type, ty: &syn::Type, shim_name: &Ident, + thread_local: ast::ThreadLocal, ) -> TokenStream { let init = static_init(wasm_bindgen, ty, shim_name); - quote! { - thread_local! { - #[automatically_derived] - #vis static #name: #actual_ty = { - #init + match thread_local { + ast::ThreadLocal::V1 => quote! { + thread_local! { + #[automatically_derived] + #[deprecated = "use with `#[wasm_bindgen(thread_local_v2)]` instead"] + #vis static #name: #actual_ty = { + #init + }; + } + }, + ast::ThreadLocal::V2 => { + #[cfg(feature = "std")] + let inner = quote! { + thread_local!(static _VAL: #actual_ty = init();); + #wasm_bindgen::JsThreadLocal { + __inner: &_VAL, + } + }; + #[cfg(all(not(feature = "std"), not(feature = "atomics")))] + let inner = quote! { + static _VAL: #wasm_bindgen::__rt::LazyCell<#actual_ty> = #wasm_bindgen::__rt::LazyCell::new(init); + #wasm_bindgen::JsThreadLocal { + __inner: &_VAL, + } + }; + #[cfg(all(not(feature = "std"), feature = "atomics"))] + let inner = quote! { + #[thread_local] + static _VAL: #wasm_bindgen::__rt::LazyCell<#actual_ty> = #wasm_bindgen::__rt::LazyCell::new(init); + #wasm_bindgen::JsThreadLocal { + __inner: || unsafe { #wasm_bindgen::__rt::LazyCell::force(&_VAL) as *const #actual_ty }, + } }; + + quote! { + #vis static #name: #wasm_bindgen::JsThreadLocal<#actual_ty> = { + fn init() -> #actual_ty { + #init + } + #inner + }; + } } } } @@ -1766,12 +1806,12 @@ fn static_init(wasm_bindgen: &syn::Path, ty: &syn::Type, shim_name: &Ident) -> T }; quote! { #[link(wasm_import_module = "__wbindgen_placeholder__")] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] extern "C" { fn #shim_name() -> #abi_ret; } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] unsafe fn #shim_name() -> #abi_ret { panic!("cannot access imported statics on non-wasm targets") } @@ -1818,7 +1858,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { let attrs = &self.attrs; let wasm_bindgen = &self.wasm_bindgen; (quote! { - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { #(#attrs)* @@ -1845,14 +1885,14 @@ fn extern_fn( abi_ret: TokenStream, ) -> TokenStream { quote! { - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #(#attrs)* #[link(wasm_import_module = "__wbindgen_placeholder__")] extern "C" { fn #import_name(#(#abi_arguments),*) -> #abi_ret; } - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] unsafe fn #import_name(#(#abi_arguments),*) -> #abi_ret { #( drop(#abi_argument_names); diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index c0bd0b51b81..d5c8b26e7c0 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -4,9 +4,9 @@ (type (;2;) (func (result i32 i32))) (type (;3;) (func (param i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $__externref_table_dealloc (;1;) (type 3) (param i32)) - (func $__externref_table_alloc (;2;) (type 1) (result i32)) - (func $__wbindgen_exn_store (;3;) (type 3) (param i32)) + (func $__wbindgen_exn_store (;1;) (type 3) (param i32)) + (func $__externref_table_dealloc (;2;) (type 3) (param i32)) + (func $__externref_table_alloc (;3;) (type 1) (result i32)) (func $"exported multivalue shim" (;4;) (type 2) (result i32 i32)) (table (;0;) 128 externref) (memory (;0;) 17) diff --git a/crates/cli/tests/reference/web-sys.wat b/crates/cli/tests/reference/web-sys.wat index 06265263889..564a4afd324 100644 --- a/crates/cli/tests/reference/web-sys.wat +++ b/crates/cli/tests/reference/web-sys.wat @@ -5,9 +5,9 @@ (type (;3;) (func (param i32 i32 i32 i32) (result i32))) (func $__wbindgen_realloc (;0;) (type 3) (param i32 i32 i32 i32) (result i32)) (func $__wbindgen_malloc (;1;) (type 2) (param i32 i32) (result i32)) - (func $get_url (;2;) (type 0) (result i32)) - (func $get_media_source (;3;) (type 0) (result i32)) - (func $__wbindgen_exn_store (;4;) (type 1) (param i32)) + (func $__wbindgen_exn_store (;2;) (type 1) (param i32)) + (func $get_url (;3;) (type 0) (result i32)) + (func $get_media_source (;4;) (type 0) (result i32)) (memory (;0;) 17) (export "memory" (memory 0)) (export "get_url" (func $get_url)) diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 15abdd740f1..f162cdf8f30 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -19,13 +19,17 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '0.3.72' } -wasm-bindgen = { path = "../..", version = '0.2.95' } +js-sys = { path = "../js-sys", version = '0.3.72', default-features = false } +once_cell = { version = "1.12", default-features = false } +wasm-bindgen = { path = "../..", version = '0.2.95', default-features = false } [features] +default = ["std"] futures-core-03-stream = ['futures-core'] +std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] [target.'cfg(target_feature = "atomics")'.dependencies.web-sys] +default-features = false features = ["MessageEvent", "Worker"] path = "../web-sys" version = "0.3.24" diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 2c1eb3db6ee..6b6ba72e86e 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -30,17 +30,25 @@ //! systems and make sure that Rust/JavaScript can work together with //! asynchronous and I/O work. +#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(target_feature = "atomics", feature(stdarch_wasm_atomic_wait))] +#![cfg_attr( + all(not(feature = "std"), target_feature = "atomics"), + feature(thread_local) +)] #![deny(missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] +extern crate alloc; + +use alloc::boxed::Box; +use alloc::rc::Rc; +use core::cell::RefCell; +use core::fmt; +use core::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll, Waker}; use js_sys::Promise; -use std::cell::RefCell; -use std::fmt; -use std::future::Future; -use std::pin::Pin; -use std::rc::Rc; -use std::task::{Context, Poll, Waker}; use wasm_bindgen::prelude::*; mod queue; diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index 2e17eb5ecf1..fe438cb1929 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -1,7 +1,7 @@ +use alloc::collections::VecDeque; +use alloc::rc::Rc; +use core::cell::{Cell, RefCell}; use js_sys::Promise; -use std::cell::{Cell, RefCell}; -use std::collections::VecDeque; -use std::rc::Rc; use wasm_bindgen::prelude::*; #[wasm_bindgen] @@ -71,6 +71,7 @@ impl Queue { } } // Append a task to the currently running queue, or schedule it + #[cfg(not(target_feature = "atomics"))] pub(crate) fn push_task(&self, task: Rc) { // It would make sense to run this task on the same tick. For now, we // make the simplifying choice of always scheduling tasks for a future tick. @@ -105,8 +106,23 @@ impl Queue { has_queue_microtask, } } -} -thread_local! { - pub(crate) static QUEUE: Queue = Queue::new(); + #[cfg(feature = "std")] + pub(crate) fn with(f: impl FnOnce(&Self) -> R) -> R { + thread_local! { + static QUEUE: Queue = Queue::new(); + } + + QUEUE.with(f) + } + + #[cfg(not(feature = "std"))] + pub(crate) fn with(f: impl FnOnce(&Self) -> R) -> R { + use wasm_bindgen::__rt::LazyCell; + + #[cfg_attr(target_feature = "atomics", thread_local)] + static QUEUE: LazyCell = LazyCell::new(Queue::new); + + f(&QUEUE) + } } diff --git a/crates/futures/src/task/multithread.rs b/crates/futures/src/task/multithread.rs index 2f00fad81a5..e66de91fd3c 100644 --- a/crates/futures/src/task/multithread.rs +++ b/crates/futures/src/task/multithread.rs @@ -1,12 +1,15 @@ -use std::cell::RefCell; -use std::future::Future; -use std::mem::ManuallyDrop; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::atomic::AtomicI32; -use std::sync::atomic::Ordering::SeqCst; -use std::sync::Arc; -use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; +#![allow(clippy::incompatible_msrv)] + +use alloc::boxed::Box; +use alloc::rc::Rc; +use alloc::sync::Arc; +use core::cell::RefCell; +use core::future::Future; +use core::mem::ManuallyDrop; +use core::pin::Pin; +use core::sync::atomic::AtomicI32; +use core::sync::atomic::Ordering::SeqCst; +use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; use wasm_bindgen::prelude::*; const SLEEPING: i32 = 0; @@ -101,7 +104,7 @@ impl Task { *this.inner.borrow_mut() = Some(Inner { future, closure }); // Queue up the Future's work to happen on the next microtask tick. - crate::queue::QUEUE.with(move |queue| queue.schedule_task(this)); + crate::queue::Queue::with(move |queue| queue.schedule_task(this)); } pub(crate) fn run(&self) { diff --git a/crates/futures/src/task/singlethread.rs b/crates/futures/src/task/singlethread.rs index ad52f552400..733a0407510 100644 --- a/crates/futures/src/task/singlethread.rs +++ b/crates/futures/src/task/singlethread.rs @@ -1,9 +1,10 @@ -use std::cell::{Cell, RefCell}; -use std::future::Future; -use std::mem::ManuallyDrop; -use std::pin::Pin; -use std::rc::Rc; -use std::task::{Context, RawWaker, RawWakerVTable, Waker}; +use alloc::boxed::Box; +use alloc::rc::Rc; +use core::cell::{Cell, RefCell}; +use core::future::Future; +use core::mem::ManuallyDrop; +use core::pin::Pin; +use core::task::{Context, RawWaker, RawWakerVTable, Waker}; struct Inner { future: Pin + 'static>>, @@ -32,11 +33,11 @@ impl Task { *this.inner.borrow_mut() = Some(Inner { future, waker }); - crate::queue::QUEUE.with(|queue| queue.schedule_task(this)); + crate::queue::Queue::with(|queue| queue.schedule_task(this)); } fn force_wake(this: Rc) { - crate::queue::QUEUE.with(|queue| { + crate::queue::Queue::with(|queue| { queue.push_task(this); }); } diff --git a/crates/futures/src/task/wait_async_polyfill.rs b/crates/futures/src/task/wait_async_polyfill.rs index ff0a8f5aa19..757b5d56106 100644 --- a/crates/futures/src/task/wait_async_polyfill.rs +++ b/crates/futures/src/task/wait_async_polyfill.rs @@ -3,6 +3,8 @@ //! and ported to Rust //! +#![allow(clippy::incompatible_msrv)] + /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -36,18 +38,37 @@ * when possible. The worker communicates with its parent using postMessage. */ +use alloc::vec; +use alloc::vec::Vec; +use core::cell::RefCell; +use core::sync::atomic::AtomicI32; use js_sys::{Array, Promise}; -use std::cell::RefCell; -use std::sync::atomic::AtomicI32; use wasm_bindgen::prelude::*; use web_sys::{MessageEvent, Worker}; -thread_local! { - static HELPERS: RefCell> = RefCell::new(vec![]); +struct Helpers; + +impl Helpers { + #[cfg(feature = "std")] + pub(crate) fn with(f: impl FnOnce(&RefCell>) -> R) -> R { + thread_local! { + static HELPERS: RefCell> = RefCell::new(vec![]); + } + + HELPERS.with(f) + } + + #[cfg(not(feature = "std"))] + pub(crate) fn with(f: impl FnOnce(&RefCell>) -> R) -> R { + #[thread_local] + static HELPERS: RefCell> = RefCell::new(vec![]); + + f(&HELPERS) + } } fn alloc_helper() -> Worker { - HELPERS.with(|helpers| { + Helpers::with(|helpers| { if let Some(helper) = helpers.borrow_mut().pop() { return helper; } @@ -58,7 +79,7 @@ fn alloc_helper() -> Worker { } fn free_helper(helper: Worker) { - HELPERS.with(move |helpers| { + Helpers::with(move |helpers| { let mut helpers = helpers.borrow_mut(); helpers.push(helper.clone()); helpers.truncate(10); // random arbitrary limit chosen here diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 6c7e68885e7..b34977b50c5 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -20,8 +20,12 @@ version = "0.3.72" doctest = false test = false +[features] +default = ["std"] +std = ["wasm-bindgen/std"] + [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.95" } +wasm-bindgen = { path = "../..", version = "0.2.95", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 1833cd5d77a..20abcbef379 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -17,16 +17,25 @@ //! bindings. #![doc(html_root_url = "https://docs.rs/js-sys/0.2")] - +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr( + all(not(feature = "std"), target_feature = "atomics"), + feature(thread_local) +)] + +extern crate alloc; + +use alloc::string::String; +use alloc::vec::Vec; +use core::cmp::Ordering; +use core::convert::{self, Infallible, TryFrom}; +use core::f64; +use core::fmt; +use core::iter::{self, Product, Sum}; +use core::mem; use core::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub}; -use std::cmp::Ordering; -use std::convert::{self, Infallible, TryFrom}; -use std::f64; -use std::fmt; -use std::iter::{self, Product, Sum}; -use std::mem; -use std::str; -use std::str::FromStr; +use core::str; +use core::str::FromStr; pub use wasm_bindgen; use wasm_bindgen::prelude::*; @@ -636,11 +645,11 @@ extern "C" { /// Iterator returned by `Array::into_iter` #[derive(Debug, Clone)] pub struct ArrayIntoIter { - range: std::ops::Range, + range: core::ops::Range, array: Array, } -impl std::iter::Iterator for ArrayIntoIter { +impl core::iter::Iterator for ArrayIntoIter { type Item = JsValue; fn next(&mut self) -> Option { @@ -676,7 +685,7 @@ impl std::iter::Iterator for ArrayIntoIter { } } -impl std::iter::DoubleEndedIterator for ArrayIntoIter { +impl core::iter::DoubleEndedIterator for ArrayIntoIter { fn next_back(&mut self) -> Option { let index = self.range.next_back()?; Some(self.array.get(index)) @@ -687,18 +696,18 @@ impl std::iter::DoubleEndedIterator for ArrayIntoIter { } } -impl std::iter::FusedIterator for ArrayIntoIter {} +impl core::iter::FusedIterator for ArrayIntoIter {} -impl std::iter::ExactSizeIterator for ArrayIntoIter {} +impl core::iter::ExactSizeIterator for ArrayIntoIter {} /// Iterator returned by `Array::iter` #[derive(Debug, Clone)] pub struct ArrayIter<'a> { - range: std::ops::Range, + range: core::ops::Range, array: &'a Array, } -impl<'a> std::iter::Iterator for ArrayIter<'a> { +impl<'a> core::iter::Iterator for ArrayIter<'a> { type Item = JsValue; fn next(&mut self) -> Option { @@ -734,7 +743,7 @@ impl<'a> std::iter::Iterator for ArrayIter<'a> { } } -impl<'a> std::iter::DoubleEndedIterator for ArrayIter<'a> { +impl<'a> core::iter::DoubleEndedIterator for ArrayIter<'a> { fn next_back(&mut self) -> Option { let index = self.range.next_back()?; Some(self.array.get(index)) @@ -745,9 +754,9 @@ impl<'a> std::iter::DoubleEndedIterator for ArrayIter<'a> { } } -impl<'a> std::iter::FusedIterator for ArrayIter<'a> {} +impl<'a> core::iter::FusedIterator for ArrayIter<'a> {} -impl<'a> std::iter::ExactSizeIterator for ArrayIter<'a> {} +impl<'a> core::iter::ExactSizeIterator for ArrayIter<'a> {} impl Array { /// Returns an iterator over the values of the JS array. @@ -772,7 +781,7 @@ impl Array { } } -impl std::iter::IntoIterator for Array { +impl core::iter::IntoIterator for Array { type Item = JsValue; type IntoIter = ArrayIntoIter; @@ -785,7 +794,7 @@ impl std::iter::IntoIterator for Array { } // TODO pre-initialize the Array with the correct length using TrustedLen -impl std::iter::FromIterator for Array +impl core::iter::FromIterator for Array where A: AsRef, { @@ -799,7 +808,7 @@ where } } -impl std::iter::Extend for Array +impl core::iter::Extend for Array where A: AsRef, { @@ -2302,7 +2311,7 @@ impl<'a> IntoIterator for &'a Iterator { } } -impl<'a> std::iter::Iterator for Iter<'a> { +impl<'a> core::iter::Iterator for Iter<'a> { type Item = Result; fn next(&mut self) -> Option { @@ -2322,7 +2331,7 @@ impl IntoIterator for Iterator { } } -impl std::iter::Iterator for IntoIter { +impl core::iter::Iterator for IntoIter { type Item = Result; fn next(&mut self) -> Option { @@ -2836,6 +2845,7 @@ impl fmt::Display for TryFromIntError { } } +#[cfg(feature = "std")] impl std::error::Error for TryFromIntError {} macro_rules! number_try_from { @@ -5340,7 +5350,7 @@ impl JsString { /// /// [docs]: https://rustwasm.github.io/docs/wasm-bindgen/reference/types/str.html pub fn is_valid_utf16(&self) -> bool { - std::char::decode_utf16(self.iter()).all(|i| i.is_ok()) + core::char::decode_utf16(self.iter()).all(|i| i.is_ok()) } /// Returns an iterator over the `u16` character codes that make up this JS @@ -5375,7 +5385,7 @@ impl JsString { // https://github.com/rustwasm/wasm-bindgen/issues/1362 let cp = self.code_point_at(0).as_f64().unwrap_throw() as u32; - let c = std::char::from_u32(cp)?; + let c = core::char::from_u32(cp)?; if c.len_utf16() as u32 == len { Some(c) @@ -6021,9 +6031,20 @@ extern "C" { /// This allows access to the global properties and global names by accessing /// the `Object` returned. pub fn global() -> Object { - thread_local!(static GLOBAL: Object = get_global_object()); + #[cfg(feature = "std")] + { + thread_local!(static GLOBAL: Object = get_global_object()); + return GLOBAL.with(|g| g.clone()); + } + #[cfg(not(feature = "std"))] + { + use wasm_bindgen::__rt::LazyCell; + + #[cfg_attr(target_feature = "atomics", thread_local)] + static GLOBAL: LazyCell = LazyCell::new(get_global_object); - return GLOBAL.with(|g| g.clone()); + return GLOBAL.clone(); + } fn get_global_object() -> Object { // This is a bit wonky, but we're basically using `#[wasm_bindgen]` @@ -6230,7 +6251,7 @@ macro_rules! arrays { /// This function returns a new typed array which is a view into /// wasm's memory. This view does not copy the underlying data. /// - /// # Unsafety + /// # Safety /// /// Views into WebAssembly memory are only valid so long as the /// backing buffer isn't resized in JS. Once this function is called @@ -6259,7 +6280,7 @@ macro_rules! arrays { /// This function returns a new typed array which is a view into /// wasm's memory. This view does not copy the underlying data. /// - /// # Unsafety + /// # Safety /// /// Views into WebAssembly memory are only valid so long as the /// backing buffer isn't resized in JS. Once this function is called @@ -6286,7 +6307,7 @@ macro_rules! arrays { /// array into this Wasm module's own linear memory, initializing /// the memory destination provided. /// - /// # Unsafety + /// # Safety /// /// This function requires `dst` to point to a buffer /// large enough to fit this array's contents. @@ -6310,7 +6331,7 @@ macro_rules! arrays { /// This function will panic if this typed array's length is /// different than the length of the provided `dst` array. pub fn copy_to(&self, dst: &mut [$ty]) { - assert_eq!(self.length() as usize, dst.len()); + core::assert_eq!(self.length() as usize, dst.len()); unsafe { self.raw_copy_to_ptr(dst.as_mut_ptr()); } } @@ -6325,7 +6346,7 @@ macro_rules! arrays { /// This function will panic if this typed array's length is /// different than the length of the provided `src` array. pub fn copy_from(&self, src: &[$ty]) { - assert_eq!(self.length() as usize, src.len()); + core::assert_eq!(self.length() as usize, src.len()); // This is safe because the `set` function copies from its TypedArray argument unsafe { self.set(&$name::view(src), 0) } } diff --git a/crates/js-sys/tests/wasm/Function.rs b/crates/js-sys/tests/wasm/Function.rs index f0f27dca123..e9e2ad3acc1 100644 --- a/crates/js-sys/tests/wasm/Function.rs +++ b/crates/js-sys/tests/wasm/Function.rs @@ -5,13 +5,13 @@ use wasm_bindgen_test::*; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(thread_local, js_name = max, js_namespace = Math)] + #[wasm_bindgen(thread_local_v2, js_name = max, js_namespace = Math)] static MAX: Function; type ArrayPrototype; #[wasm_bindgen(method, getter, structural)] pub fn push(this: &ArrayPrototype) -> Function; - #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Array)] + #[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Array)] static ARRAY_PROTOTYPE2: ArrayPrototype; } diff --git a/crates/js-sys/tests/wasm/Object.rs b/crates/js-sys/tests/wasm/Object.rs index b97c31d0fbf..460fe0f77ce 100644 --- a/crates/js-sys/tests/wasm/Object.rs +++ b/crates/js-sys/tests/wasm/Object.rs @@ -9,9 +9,9 @@ extern "C" { #[wasm_bindgen(method, setter, structural)] fn set_foo(this: &Foo42, val: JsValue); - #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Object)] + #[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Object)] static OBJECT_PROTOTYPE: JsValue; - #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Array)] + #[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Array)] static ARRAY_PROTOTYPE: JsValue; type DefinePropertyAttrs; @@ -32,9 +32,9 @@ extern "C" { #[wasm_bindgen(constructor)] fn new() -> Foo; - #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Foo)] + #[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Foo)] static FOO_PROTOTYPE: Object; - #[wasm_bindgen(thread_local, js_name = prototype, js_namespace = Bar)] + #[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Bar)] static BAR_PROTOTYPE: Object; } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 5df475b0e7c..ba169d4cb92 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -14,13 +14,16 @@ rust-version = "1.57" version = "0.2.95" [features] +atomics = ["wasm-bindgen-backend/atomics"] +default = ["std"] extra-traits = ["syn/extra-traits"] spans = ["wasm-bindgen-backend/spans"] +std = ["wasm-bindgen-backend/std"] strict-macro = [] [dependencies] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.95" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.95", default-features = false } wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a6934c876f8..cca8bffb416 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use std::str::Chars; use ast::OperationKind; -use backend::ast; +use backend::ast::{self, ThreadLocal}; use backend::util::{ident_ty, ShortHash}; use backend::Diagnostic; use proc_macro2::{Ident, Span, TokenStream, TokenTree}; @@ -96,6 +96,7 @@ macro_rules! attrgen { (getter_with_clone, GetterWithClone(Span)), (static_string, StaticString(Span)), (thread_local, ThreadLocal(Span)), + (thread_local_v2, ThreadLocalV2(Span)), // For testing purposes only. (assert_no_shim, AssertNoShim(Span)), @@ -236,6 +237,23 @@ impl BindgenAttrs { } } + fn get_thread_local(&self) -> Result, Diagnostic> { + let mut thread_local = self.thread_local_v2().map(|_| ThreadLocal::V2); + + if let Some(span) = self.thread_local() { + if thread_local.is_some() { + return Err(Diagnostic::span_error( + *span, + "`thread_local` can't be used with `thread_local_v2`", + )); + } else { + thread_local = Some(ThreadLocal::V1) + } + } + + Ok(thread_local) + } + attrgen!(methods); } @@ -778,7 +796,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option TokenStream { match wasm_bindgen_macro_support::expand(attr.into(), input.into()) { Ok(tokens) => { diff --git a/crates/macro/ui-tests/invalid-items.rs b/crates/macro/ui-tests/invalid-items.rs index 9ab441c0c0a..96a91f1da7a 100644 --- a/crates/macro/ui-tests/invalid-items.rs +++ b/crates/macro/ui-tests/invalid-items.rs @@ -17,7 +17,7 @@ extern "C" { #[wasm_bindgen(static_string)] static FOO2: JsString; - #[wasm_bindgen(thread_local, static_string)] + #[wasm_bindgen(thread_local_v2, static_string)] static FOO3: JsString; static FOO4: JsString = "test"; diff --git a/crates/macro/ui-tests/invalid-items.stderr b/crates/macro/ui-tests/invalid-items.stderr index f985c96c070..f1600b1fda7 100644 --- a/crates/macro/ui-tests/invalid-items.stderr +++ b/crates/macro/ui-tests/invalid-items.stderr @@ -29,10 +29,10 @@ error: static strings require a string literal | ^^^^^^^^^^^^^ error: static strings require a string literal - --> $DIR/invalid-items.rs:20:34 + --> $DIR/invalid-items.rs:20:37 | -20 | #[wasm_bindgen(thread_local, static_string)] - | ^^^^^^^^^^^^^ +20 | #[wasm_bindgen(thread_local_v2, static_string)] + | ^^^^^^^^^^^^^ error: static strings require `#[wasm_bindgen(static_string)]` --> $DIR/invalid-items.rs:23:5 @@ -40,7 +40,7 @@ error: static strings require `#[wasm_bindgen(static_string)]` 23 | static FOO4: JsString = "test"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: static strings require `#[wasm_bindgen(thread_local)]` +error: static strings require `#[wasm_bindgen(thread_local_v2)]` --> $DIR/invalid-items.rs:26:5 | 26 | static FOO5: JsString = "test"; diff --git a/crates/macro/ui-tests/invalid-static-string.rs b/crates/macro/ui-tests/invalid-static-string.rs index 7b50b1079b0..ddb0a9a62d7 100644 --- a/crates/macro/ui-tests/invalid-static-string.rs +++ b/crates/macro/ui-tests/invalid-static-string.rs @@ -3,7 +3,7 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] #[rustfmt::skip] extern "C" { - #[wasm_bindgen(thread_local, static_string)] + #[wasm_bindgen(thread_local_v2, static_string)] static FOO: JsValue = "test"; } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index d0cd7a5fc2c..c18b8ecad8b 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -113,7 +113,7 @@ pub fn wasm_bindgen_test( quote! { const _: () = { #[no_mangle] - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); @@ -125,7 +125,7 @@ pub fn wasm_bindgen_test( if let Some(path) = attributes.unsupported { tokens.extend( - quote! { #[cfg_attr(not(all(target_arch = "wasm32", target_os = "unknown")), #path)] }, + quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #path)] }, ); if let Some(should_panic) = should_panic { @@ -136,7 +136,7 @@ pub fn wasm_bindgen_test( }; tokens.extend( - quote! { #[cfg_attr(not(all(target_arch = "wasm32", target_os = "unknown")), #should_panic)] } + quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #should_panic)] } ) } } diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index f4344ec316c..70c9e2131c8 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -9,13 +9,17 @@ repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" version = "0.3.45" +[features] +default = ["std"] +std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "once_cell/std", "scoped-tls"] + [dependencies] -console_error_panic_hook = '0.1' gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '0.3.72' } -scoped-tls = "1.0" -wasm-bindgen = { path = '../..', version = '0.2.95' } -wasm-bindgen-futures = { path = '../futures', version = '0.4.45' } +js-sys = { path = '../js-sys', version = '0.3.72', default-features = false } +once_cell = { version = "1.12", default-features = false } +scoped-tls = { version = "1.0", optional = true } +wasm-bindgen = { path = '../..', version = '0.2.95', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '0.4.45', default-features = false } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] diff --git a/crates/test/src/coverage.rs b/crates/test/src/coverage.rs index 855e6a3d1e3..2fe38443ccf 100644 --- a/crates/test/src/coverage.rs +++ b/crates/test/src/coverage.rs @@ -1,3 +1,4 @@ +use alloc::vec::Vec; use wasm_bindgen::prelude::wasm_bindgen; #[cfg(wasm_bindgen_unstable_test_coverage)] diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index b5219fbf76c..f20ca2d82e3 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -2,8 +2,13 @@ //! //! More documentation can be found in the README for this crate! +#![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] +extern crate alloc; + +#[cfg(feature = "std")] +use scoped_tls::scoped_thread_local; pub use wasm_bindgen_test_macro::wasm_bindgen_test; // Custom allocator that only returns pointers in the 2GB-4GB range diff --git a/crates/test/src/rt/browser.rs b/crates/test/src/rt/browser.rs index 49b27725e75..39c4666c6c2 100644 --- a/crates/test/src/rt/browser.rs +++ b/crates/test/src/rt/browser.rs @@ -3,6 +3,8 @@ //! Currently this is quite simple, rendering the same as the console tests in //! node.js. Output here is rendered in a `pre`, however. +use alloc::format; +use alloc::string::String; use js_sys::Error; use wasm_bindgen::prelude::*; @@ -19,7 +21,7 @@ pub struct Browser { #[wasm_bindgen] extern "C" { type HTMLDocument; - #[wasm_bindgen(thread_local, js_name = document)] + #[wasm_bindgen(thread_local_v2, js_name = document)] static DOCUMENT: HTMLDocument; #[wasm_bindgen(method, structural)] fn getElementById(this: &HTMLDocument, id: &str) -> Element; diff --git a/crates/test/src/rt/detect.rs b/crates/test/src/rt/detect.rs index f4cdd988d59..b2b6af2d496 100644 --- a/crates/test/src/rt/detect.rs +++ b/crates/test/src/rt/detect.rs @@ -1,5 +1,6 @@ //! Runtime detection of whether we're in node.js or a browser. +use alloc::string::String; use wasm_bindgen::prelude::*; #[wasm_bindgen] diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index a4343787149..5489e19bf8f 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -87,14 +87,18 @@ // Overall this is all somewhat in flux as it's pretty new, and feedback is // always of course welcome! +use alloc::borrow::ToOwned; +use alloc::boxed::Box; +use alloc::format; +use alloc::rc::Rc; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::cell::{Cell, RefCell}; +use core::fmt::{self, Display}; +use core::future::Future; +use core::pin::Pin; +use core::task::{self, Poll}; use js_sys::{Array, Function, Promise}; -use std::cell::{Cell, RefCell}; -use std::fmt::{self, Display}; -use std::future::Future; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::Once; -use std::task::{self, Poll}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; @@ -109,6 +113,8 @@ const CONCURRENCY: usize = 1; pub mod browser; pub mod detect; pub mod node; +#[cfg(not(feature = "std"))] +mod scoped_tls; pub mod worker; /// Runtime test harness support instantiated in JS. @@ -266,21 +272,56 @@ impl Context { /// coordinated, and this will collect output and results for all executed /// tests. #[wasm_bindgen(constructor)] + #[allow(clippy::new_without_default)] pub fn new() -> Context { - static SET_HOOK: Once = Once::new(); + fn panic_handling(mut message: String) { + let should_panic = CURRENT_OUTPUT.with(|output| { + let mut output = output.borrow_mut(); + output.panic.push_str(&message); + output.should_panic + }); + + // See https://github.com/rustwasm/console_error_panic_hook/blob/4dc30a5448ed3ffcfb961b1ad54d000cca881b84/src/lib.rs#L83-L123. + if !should_panic { + #[wasm_bindgen] + extern "C" { + type Error; + + #[wasm_bindgen(constructor)] + fn new() -> Error; + + #[wasm_bindgen(method, getter)] + fn stack(error: &Error) -> String; + } + + message.push_str("\n\nStack:\n\n"); + let e = Error::new(); + let stack = e.stack(); + message.push_str(&stack); + + message.push_str("\n\n"); + + js_console_error(&message); + } + } + #[cfg(feature = "std")] + static SET_HOOK: std::sync::Once = std::sync::Once::new(); + #[cfg(feature = "std")] SET_HOOK.call_once(|| { std::panic::set_hook(Box::new(|panic_info| { - let should_panic = CURRENT_OUTPUT.with(|output| { - let mut output = output.borrow_mut(); - output.panic.push_str(&panic_info.to_string()); - output.should_panic - }); - - if !should_panic { - console_error_panic_hook::hook(panic_info); - } + panic_handling(panic_info.to_string()); })); }); + #[cfg(all( + not(feature = "std"), + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + ))] + #[panic_handler] + fn panic_handler(panic_info: &core::panic::PanicInfo<'_>) -> ! { + panic_handling(panic_info.to_string()); + core::arch::wasm32::unreachable(); + } let formatter = match detect::detect() { detect::Runtime::Browser => Box::new(browser::Browser::new()) as Box, @@ -379,7 +420,7 @@ impl Context { } } -scoped_tls::scoped_thread_local!(static CURRENT_OUTPUT: RefCell); +crate::scoped_thread_local!(static CURRENT_OUTPUT: RefCell); /// Handler for `console.log` invocations. /// @@ -452,7 +493,7 @@ impl Termination for () { } } -impl Termination for Result<(), E> { +impl Termination for Result<(), E> { fn into_js_result(self) -> Result<(), JsValue> { self.map_err(|e| JsError::new(&format!("{:?}", e)).into()) } diff --git a/crates/test/src/rt/node.rs b/crates/test/src/rt/node.rs index 67b7646c61f..a505564f1e8 100644 --- a/crates/test/src/rt/node.rs +++ b/crates/test/src/rt/node.rs @@ -3,6 +3,8 @@ //! This currently uses the same output as `libtest`, only reimplemented here //! for node itself. +use alloc::format; +use alloc::string::String; use wasm_bindgen::prelude::*; use super::TestResult; diff --git a/crates/test/src/rt/scoped_tls.rs b/crates/test/src/rt/scoped_tls.rs new file mode 100644 index 00000000000..871a1c541b2 --- /dev/null +++ b/crates/test/src/rt/scoped_tls.rs @@ -0,0 +1,85 @@ +//! See . + +use core::cell::Cell; +use core::marker::PhantomData; + +/// `no_std` polyfill for [`scoped_tls`](https://crates.io/crates/scoped-tls). +#[macro_export] +macro_rules! scoped_thread_local { + (static $name:ident: $ty:ty) => { + static $name: scoped_tls::ScopedKey<$ty> = unsafe { + static FOO: scoped_tls::Wrapper<::core::cell::Cell<*const ()>> = + scoped_tls::Wrapper::new(::core::cell::Cell::new(::core::ptr::null())); + // Safety: nothing else can access FOO since it's hidden in its own scope + scoped_tls::ScopedKey::new(&FOO) + }; + }; +} + +pub(super) struct Wrapper(T); + +impl Wrapper { + pub(super) const fn new(value: T) -> Self { + Self(value) + } +} + +unsafe impl Sync for Wrapper {} + +pub struct ScopedKey { + inner: &'static Wrapper>, + _marker: PhantomData, +} + +unsafe impl Sync for ScopedKey {} + +impl ScopedKey { + #[doc(hidden)] + /// # Safety + /// `inner` must only be accessed through `ScopedKey`'s API + pub const unsafe fn new(inner: &'static Wrapper>) -> Self { + Self { + inner, + _marker: PhantomData, + } + } + + pub fn set(&'static self, t: &T, f: F) -> R + where + F: FnOnce() -> R, + { + struct Reset { + key: &'static Wrapper>, + val: *const (), + } + impl Drop for Reset { + fn drop(&mut self) { + self.key.0.set(self.val); + } + } + let prev = self.inner.0.get(); + self.inner.0.set(t as *const T as *const ()); + let _reset = Reset { + key: self.inner, + val: prev, + }; + f() + } + + pub fn with(&'static self, f: F) -> R + where + F: FnOnce(&T) -> R, + { + let val = self.inner.0.get(); + assert!( + !val.is_null(), + "cannot access a scoped thread local variable without calling `set` first" + ); + unsafe { f(&*(val as *const T)) } + } + + /// Test whether this TLS key has been `set` for the current thread. + pub fn is_set(&'static self) -> bool { + !self.inner.0.get().is_null() + } +} diff --git a/crates/test/src/rt/worker.rs b/crates/test/src/rt/worker.rs index 94bc3c5e892..e9a35242615 100644 --- a/crates/test/src/rt/worker.rs +++ b/crates/test/src/rt/worker.rs @@ -3,6 +3,8 @@ //! Currently this is quite simple, rendering the same as the console tests in //! node.js. Output here is rendered in a `pre`, however. +use alloc::format; +use alloc::string::String; use js_sys::Error; use wasm_bindgen::prelude::*; diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index f8929d4865b..2f758f4f727 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '0.3.72' } -wasm-bindgen = { path = "../..", version = "0.2.95" } +js-sys = { path = '../js-sys', version = '0.3.72', default-features = false } +wasm-bindgen = { path = "../..", version = "0.2.95", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" @@ -36,6 +36,8 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } # This list is auto-generated by the wasm-bindgen-webidl program [features] +default = ["std"] +std = ["wasm-bindgen/std", "js-sys/std"] AbortController = [] AbortSignal = ["EventTarget"] AddEventListenerOptions = [] diff --git a/crates/web-sys/src/features/gen_AesCbcParams.rs b/crates/web-sys/src/features/gen_AesCbcParams.rs index d4bcce9127e..28ccbbd17c3 100644 --- a/crates/web-sys/src/features/gen_AesCbcParams.rs +++ b/crates/web-sys/src/features/gen_AesCbcParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesCbcParams) -> String; + pub fn get_name(this: &AesCbcParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCbcParams`*"] diff --git a/crates/web-sys/src/features/gen_AesCtrParams.rs b/crates/web-sys/src/features/gen_AesCtrParams.rs index 6a8e17f3bb7..e45d80ac7ad 100644 --- a/crates/web-sys/src/features/gen_AesCtrParams.rs +++ b/crates/web-sys/src/features/gen_AesCtrParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesCtrParams) -> String; + pub fn get_name(this: &AesCtrParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesCtrParams`*"] diff --git a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs index e36567f1bc1..a79081cd6b7 100644 --- a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesDerivedKeyParams) -> String; + pub fn get_name(this: &AesDerivedKeyParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesDerivedKeyParams`*"] diff --git a/crates/web-sys/src/features/gen_AesGcmParams.rs b/crates/web-sys/src/features/gen_AesGcmParams.rs index 94918a67623..1496770798f 100644 --- a/crates/web-sys/src/features/gen_AesGcmParams.rs +++ b/crates/web-sys/src/features/gen_AesGcmParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesGcmParams) -> String; + pub fn get_name(this: &AesGcmParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesGcmParams`*"] diff --git a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs index d202b081c0c..9378c3aeb95 100644 --- a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesKeyAlgorithm) -> String; + pub fn get_name(this: &AesKeyAlgorithm) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyAlgorithm`*"] diff --git a/crates/web-sys/src/features/gen_AesKeyGenParams.rs b/crates/web-sys/src/features/gen_AesKeyGenParams.rs index 9b9debe146c..7695ca8c66c 100644 --- a/crates/web-sys/src/features/gen_AesKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_AesKeyGenParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AesKeyGenParams) -> String; + pub fn get_name(this: &AesKeyGenParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AesKeyGenParams`*"] diff --git a/crates/web-sys/src/features/gen_Algorithm.rs b/crates/web-sys/src/features/gen_Algorithm.rs index 18164738e02..7ca3479fe6c 100644 --- a/crates/web-sys/src/features/gen_Algorithm.rs +++ b/crates/web-sys/src/features/gen_Algorithm.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &Algorithm) -> String; + pub fn get_name(this: &Algorithm) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Algorithm`*"] diff --git a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs index c04735b5385..ae72c136ea2 100644 --- a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "deviceId")] - pub fn get_device_id(this: &AllowedBluetoothDevice) -> String; + pub fn get_device_id(this: &AllowedBluetoothDevice) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `deviceId` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs index 24c4c4c2db0..c3cdc696b5d 100644 --- a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "serialNumber")] - pub fn get_serial_number(this: &AllowedUsbDevice) -> Option; + pub fn get_serial_number(this: &AllowedUsbDevice) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `serialNumber` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Animation.rs b/crates/web-sys/src/features/gen_Animation.rs index fa094471737..02df2ead1ec 100644 --- a/crates/web-sys/src/features/gen_Animation.rs +++ b/crates/web-sys/src/features/gen_Animation.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Animation/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Animation`*"] - pub fn id(this: &Animation) -> String; + pub fn id(this: &Animation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Animation" , js_name = id)] #[doc = "Setter for the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AnimationEvent.rs b/crates/web-sys/src/features/gen_AnimationEvent.rs index 78a3d97c2be..199d4297ee1 100644 --- a/crates/web-sys/src/features/gen_AnimationEvent.rs +++ b/crates/web-sys/src/features/gen_AnimationEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent/animationName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEvent`*"] - pub fn animation_name(this: &AnimationEvent) -> String; + pub fn animation_name(this: &AnimationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "AnimationEvent" , js_name = elapsedTime)] #[doc = "Getter for the `elapsedTime` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent/pseudoElement)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEvent`*"] - pub fn pseudo_element(this: &AnimationEvent) -> String; + pub fn pseudo_element(this: &AnimationEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "AnimationEvent")] #[doc = "The `new AnimationEvent(..)` constructor, creating a new instance of `AnimationEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AnimationEventInit.rs b/crates/web-sys/src/features/gen_AnimationEventInit.rs index 23b8e75af68..fcb7f97b1b8 100644 --- a/crates/web-sys/src/features/gen_AnimationEventInit.rs +++ b/crates/web-sys/src/features/gen_AnimationEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, getter = "animationName")] - pub fn get_animation_name(this: &AnimationEventInit) -> Option; + pub fn get_animation_name(this: &AnimationEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `animationName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] #[wasm_bindgen(method, getter = "pseudoElement")] - pub fn get_pseudo_element(this: &AnimationEventInit) -> Option; + pub fn get_pseudo_element(this: &AnimationEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pseudoElement` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationEventInit`*"] diff --git a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs index 5ce5566996d..9778d60dcba 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, getter = "property")] - pub fn get_property(this: &AnimationPropertyDetails) -> String; + pub fn get_property(this: &AnimationPropertyDetails) -> ::alloc::string::String; #[doc = "Change the `property` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] #[wasm_bindgen(method, getter = "warning")] - pub fn get_warning(this: &AnimationPropertyDetails) -> Option; + pub fn get_warning(this: &AnimationPropertyDetails) -> Option<::alloc::string::String>; #[doc = "Change the `warning` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyDetails`*"] diff --git a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs index acb03d52d82..e29fadce259 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &AnimationPropertyValueDetails) -> Option; + pub fn get_easing(this: &AnimationPropertyValueDetails) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &AnimationPropertyValueDetails) -> Option; + pub fn get_value(this: &AnimationPropertyValueDetails) -> Option<::alloc::string::String>; #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AnimationPropertyValueDetails`*"] diff --git a/crates/web-sys/src/features/gen_Attr.rs b/crates/web-sys/src/features/gen_Attr.rs index 5ca63056943..752f6d76513 100644 --- a/crates/web-sys/src/features/gen_Attr.rs +++ b/crates/web-sys/src/features/gen_Attr.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Attr`*"] - pub fn local_name(this: &Attr) -> String; + pub fn local_name(this: &Attr) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Attr" , js_name = value)] #[doc = "Getter for the `value` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Attr/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Attr`*"] - pub fn value(this: &Attr) -> String; + pub fn value(this: &Attr) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Attr" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -39,21 +39,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Attr/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Attr`*"] - pub fn name(this: &Attr) -> String; + pub fn name(this: &Attr) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Attr" , js_name = namespaceURI)] #[doc = "Getter for the `namespaceURI` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Attr`*"] - pub fn namespace_uri(this: &Attr) -> Option; + pub fn namespace_uri(this: &Attr) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Attr" , js_name = prefix)] #[doc = "Getter for the `prefix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Attr`*"] - pub fn prefix(this: &Attr) -> Option; + pub fn prefix(this: &Attr) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Attr" , js_name = specified)] #[doc = "Getter for the `specified` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AttributeNameValue.rs b/crates/web-sys/src/features/gen_AttributeNameValue.rs index 9d4cff6cd3b..36fd820d932 100644 --- a/crates/web-sys/src/features/gen_AttributeNameValue.rs +++ b/crates/web-sys/src/features/gen_AttributeNameValue.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &AttributeNameValue) -> String; + pub fn get_name(this: &AttributeNameValue) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &AttributeNameValue) -> String; + pub fn get_value(this: &AttributeNameValue) -> ::alloc::string::String; #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AttributeNameValue`*"] diff --git a/crates/web-sys/src/features/gen_AudioConfiguration.rs b/crates/web-sys/src/features/gen_AudioConfiguration.rs index decab4a0fef..fa0af991c4a 100644 --- a/crates/web-sys/src/features/gen_AudioConfiguration.rs +++ b/crates/web-sys/src/features/gen_AudioConfiguration.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, getter = "channels")] - pub fn get_channels(this: &AudioConfiguration) -> Option; + pub fn get_channels(this: &AudioConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `channels` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] #[wasm_bindgen(method, getter = "contentType")] - pub fn get_content_type(this: &AudioConfiguration) -> Option; + pub fn get_content_type(this: &AudioConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `contentType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioConfiguration`*"] diff --git a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs index 7b4c8eddb02..bdf5b716027 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "codec")] - pub fn get_codec(this: &AudioDecoderConfig) -> String; + pub fn get_codec(this: &AudioDecoderConfig) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs index 4e15edfcb1a..94444878caa 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "codec")] - pub fn get_codec(this: &AudioEncoderConfig) -> String; + pub fn get_codec(this: &AudioEncoderConfig) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AudioTrack.rs b/crates/web-sys/src/features/gen_AudioTrack.rs index 7b04ddd0c66..391abe9ba88 100644 --- a/crates/web-sys/src/features/gen_AudioTrack.rs +++ b/crates/web-sys/src/features/gen_AudioTrack.rs @@ -18,28 +18,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioTrack`*"] - pub fn id(this: &AudioTrack) -> String; + pub fn id(this: &AudioTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "AudioTrack" , js_name = kind)] #[doc = "Getter for the `kind` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/kind)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioTrack`*"] - pub fn kind(this: &AudioTrack) -> String; + pub fn kind(this: &AudioTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "AudioTrack" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioTrack`*"] - pub fn label(this: &AudioTrack) -> String; + pub fn label(this: &AudioTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "AudioTrack" , js_name = language)] #[doc = "Getter for the `language` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/language)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioTrack`*"] - pub fn language(this: &AudioTrack) -> String; + pub fn language(this: &AudioTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "AudioTrack" , js_name = enabled)] #[doc = "Getter for the `enabled` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs index 6a01870170f..e0a6ad252f6 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsClientInputs.rs @@ -14,7 +14,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] #[wasm_bindgen(method, getter = "appid")] - pub fn get_appid(this: &AuthenticationExtensionsClientInputs) -> Option; + pub fn get_appid( + this: &AuthenticationExtensionsClientInputs, + ) -> Option<::alloc::string::String>; #[doc = "Change the `appid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] @@ -24,7 +26,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] #[wasm_bindgen(method, getter = "appidExclude")] - pub fn get_appid_exclude(this: &AuthenticationExtensionsClientInputs) -> Option; + pub fn get_appid_exclude( + this: &AuthenticationExtensionsClientInputs, + ) -> Option<::alloc::string::String>; #[doc = "Change the `appidExclude` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`*"] diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs index a03cb380b6a..ac5ee5c72da 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsDevicePublicKeyInputs.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestation")] - pub fn get_attestation(this: &AuthenticationExtensionsDevicePublicKeyInputs) -> Option; + pub fn get_attestation( + this: &AuthenticationExtensionsDevicePublicKeyInputs, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestation` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs index 288681845e5..b08ad745dff 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsLargeBlobInputs.rs @@ -24,7 +24,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] #[wasm_bindgen(method, getter = "support")] - pub fn get_support(this: &AuthenticationExtensionsLargeBlobInputs) -> Option; + pub fn get_support( + this: &AuthenticationExtensionsLargeBlobInputs, + ) -> Option<::alloc::string::String>; #[doc = "Change the `support` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsLargeBlobInputs`*"] diff --git a/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs index 62c2f9c1f02..55d75060c88 100644 --- a/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "authenticatorAttachment")] - pub fn get_authenticator_attachment(this: &AuthenticationResponseJson) -> Option; + pub fn get_authenticator_attachment( + this: &AuthenticationResponseJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `authenticatorAttachment` field of this object."] #[doc = ""] @@ -65,7 +67,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &AuthenticationResponseJson) -> String; + pub fn get_id(this: &AuthenticationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -83,7 +85,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "rawId")] - pub fn get_raw_id(this: &AuthenticationResponseJson) -> String; + pub fn get_raw_id(this: &AuthenticationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rawId` field of this object."] #[doc = ""] @@ -124,7 +126,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &AuthenticationResponseJson) -> String; + pub fn get_type(this: &AuthenticationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs index d1a87b56980..731de3744c1 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestationObject")] - pub fn get_attestation_object(this: &AuthenticatorAssertionResponseJson) -> Option; + pub fn get_attestation_object( + this: &AuthenticatorAssertionResponseJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestationObject` field of this object."] #[doc = ""] @@ -40,7 +42,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "authenticatorData")] - pub fn get_authenticator_data(this: &AuthenticatorAssertionResponseJson) -> String; + pub fn get_authenticator_data( + this: &AuthenticatorAssertionResponseJson, + ) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `authenticatorData` field of this object."] #[doc = ""] @@ -58,7 +62,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "clientDataJSON")] - pub fn get_client_data_json(this: &AuthenticatorAssertionResponseJson) -> String; + pub fn get_client_data_json( + this: &AuthenticatorAssertionResponseJson, + ) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `clientDataJSON` field of this object."] #[doc = ""] @@ -76,7 +82,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "signature")] - pub fn get_signature(this: &AuthenticatorAssertionResponseJson) -> String; + pub fn get_signature(this: &AuthenticatorAssertionResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `signature` field of this object."] #[doc = ""] @@ -94,7 +100,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "userHandle")] - pub fn get_user_handle(this: &AuthenticatorAssertionResponseJson) -> Option; + pub fn get_user_handle( + this: &AuthenticatorAssertionResponseJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `userHandle` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs index e591e05f032..633f699fb39 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestationObject")] - pub fn get_attestation_object(this: &AuthenticatorAttestationResponseJson) -> String; + pub fn get_attestation_object( + this: &AuthenticatorAttestationResponseJson, + ) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestationObject` field of this object."] #[doc = ""] @@ -40,7 +42,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "authenticatorData")] - pub fn get_authenticator_data(this: &AuthenticatorAttestationResponseJson) -> String; + pub fn get_authenticator_data( + this: &AuthenticatorAttestationResponseJson, + ) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `authenticatorData` field of this object."] #[doc = ""] @@ -58,7 +62,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "clientDataJSON")] - pub fn get_client_data_json(this: &AuthenticatorAttestationResponseJson) -> String; + pub fn get_client_data_json( + this: &AuthenticatorAttestationResponseJson, + ) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `clientDataJSON` field of this object."] #[doc = ""] @@ -76,7 +82,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "publicKey")] - pub fn get_public_key(this: &AuthenticatorAttestationResponseJson) -> Option; + pub fn get_public_key( + this: &AuthenticatorAttestationResponseJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `publicKey` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs index 26409cbf27d..c3188c86d43 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorSelectionCriteria.rs @@ -41,7 +41,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] #[wasm_bindgen(method, getter = "residentKey")] - pub fn get_resident_key(this: &AuthenticatorSelectionCriteria) -> Option; + pub fn get_resident_key( + this: &AuthenticatorSelectionCriteria, + ) -> Option<::alloc::string::String>; #[doc = "Change the `residentKey` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AuthenticatorSelectionCriteria`*"] diff --git a/crates/web-sys/src/features/gen_AutocompleteInfo.rs b/crates/web-sys/src/features/gen_AutocompleteInfo.rs index a1da9bb5b11..d10e1094aa2 100644 --- a/crates/web-sys/src/features/gen_AutocompleteInfo.rs +++ b/crates/web-sys/src/features/gen_AutocompleteInfo.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, getter = "addressType")] - pub fn get_address_type(this: &AutocompleteInfo) -> Option; + pub fn get_address_type(this: &AutocompleteInfo) -> Option<::alloc::string::String>; #[doc = "Change the `addressType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, getter = "contactType")] - pub fn get_contact_type(this: &AutocompleteInfo) -> Option; + pub fn get_contact_type(this: &AutocompleteInfo) -> Option<::alloc::string::String>; #[doc = "Change the `contactType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, getter = "fieldName")] - pub fn get_field_name(this: &AutocompleteInfo) -> Option; + pub fn get_field_name(this: &AutocompleteInfo) -> Option<::alloc::string::String>; #[doc = "Change the `fieldName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] #[wasm_bindgen(method, getter = "section")] - pub fn get_section(this: &AutocompleteInfo) -> Option; + pub fn get_section(this: &AutocompleteInfo) -> Option<::alloc::string::String>; #[doc = "Change the `section` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AutocompleteInfo`*"] diff --git a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs index 8626547052e..57fa7006021 100644 --- a/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseComputedKeyframe.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &BaseComputedKeyframe) -> Option; + pub fn get_easing(this: &BaseComputedKeyframe) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseComputedKeyframe`*"] diff --git a/crates/web-sys/src/features/gen_BaseKeyframe.rs b/crates/web-sys/src/features/gen_BaseKeyframe.rs index 1c37af7631c..e7aa2583119 100644 --- a/crates/web-sys/src/features/gen_BaseKeyframe.rs +++ b/crates/web-sys/src/features/gen_BaseKeyframe.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &BaseKeyframe) -> Option; + pub fn get_easing(this: &BaseKeyframe) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BaseKeyframe`*"] diff --git a/crates/web-sys/src/features/gen_BasicCardResponse.rs b/crates/web-sys/src/features/gen_BasicCardResponse.rs index b5fff5306b0..b97e50d4de9 100644 --- a/crates/web-sys/src/features/gen_BasicCardResponse.rs +++ b/crates/web-sys/src/features/gen_BasicCardResponse.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, getter = "cardNumber")] - pub fn get_card_number(this: &BasicCardResponse) -> String; + pub fn get_card_number(this: &BasicCardResponse) -> ::alloc::string::String; #[doc = "Change the `cardNumber` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, getter = "cardSecurityCode")] - pub fn get_card_security_code(this: &BasicCardResponse) -> Option; + pub fn get_card_security_code(this: &BasicCardResponse) -> Option<::alloc::string::String>; #[doc = "Change the `cardSecurityCode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, getter = "cardholderName")] - pub fn get_cardholder_name(this: &BasicCardResponse) -> Option; + pub fn get_cardholder_name(this: &BasicCardResponse) -> Option<::alloc::string::String>; #[doc = "Change the `cardholderName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] @@ -56,7 +56,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, getter = "expiryMonth")] - pub fn get_expiry_month(this: &BasicCardResponse) -> Option; + pub fn get_expiry_month(this: &BasicCardResponse) -> Option<::alloc::string::String>; #[doc = "Change the `expiryMonth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] #[wasm_bindgen(method, getter = "expiryYear")] - pub fn get_expiry_year(this: &BasicCardResponse) -> Option; + pub fn get_expiry_year(this: &BasicCardResponse) -> Option<::alloc::string::String>; #[doc = "Change the `expiryYear` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BasicCardResponse`*"] diff --git a/crates/web-sys/src/features/gen_BeforeUnloadEvent.rs b/crates/web-sys/src/features/gen_BeforeUnloadEvent.rs index c5392a6e8e3..0a8069a20d6 100644 --- a/crates/web-sys/src/features/gen_BeforeUnloadEvent.rs +++ b/crates/web-sys/src/features/gen_BeforeUnloadEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BeforeUnloadEvent/returnValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BeforeUnloadEvent`*"] - pub fn return_value(this: &BeforeUnloadEvent) -> String; + pub fn return_value(this: &BeforeUnloadEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "BeforeUnloadEvent" , js_name = returnValue)] #[doc = "Setter for the `returnValue` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Blob.rs b/crates/web-sys/src/features/gen_Blob.rs index f63dbaadef8..6cad214b381 100644 --- a/crates/web-sys/src/features/gen_Blob.rs +++ b/crates/web-sys/src/features/gen_Blob.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`*"] - pub fn type_(this: &Blob) -> String; + pub fn type_(this: &Blob) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "Blob")] #[doc = "The `new Blob(..)` constructor, creating a new instance of `Blob`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BlobPropertyBag.rs b/crates/web-sys/src/features/gen_BlobPropertyBag.rs index c9f3853f33e..c1e3196c82f 100644 --- a/crates/web-sys/src/features/gen_BlobPropertyBag.rs +++ b/crates/web-sys/src/features/gen_BlobPropertyBag.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &BlobPropertyBag) -> Option; + pub fn get_type(this: &BlobPropertyBag) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BlobPropertyBag`*"] diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs index 1bb43d7d24e..528dc366590 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs @@ -49,7 +49,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(this: &BluetoothAdvertisingEvent) -> Option; + pub fn name(this: &BluetoothAdvertisingEvent) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = appearance)] #[doc = "Getter for the `appearance` field of this object."] diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs index 38c8e66dc5c..21605f3214d 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs @@ -139,7 +139,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &BluetoothAdvertisingEventInit) -> Option; + pub fn get_name(this: &BluetoothAdvertisingEventInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BluetoothDevice.rs b/crates/web-sys/src/features/gen_BluetoothDevice.rs index 290effe3ff4..f764a96d54e 100644 --- a/crates/web-sys/src/features/gen_BluetoothDevice.rs +++ b/crates/web-sys/src/features/gen_BluetoothDevice.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn id(this: &BluetoothDevice) -> String; + pub fn id(this: &BluetoothDevice) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothDevice" , js_name = name)] #[doc = "Getter for the `name` field of this object."] @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(this: &BluetoothDevice) -> Option; + pub fn name(this: &BluetoothDevice) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "BluetoothRemoteGattServer")] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothDevice" , js_name = gatt)] diff --git a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs index 8f7db520c1e..7ed69962541 100644 --- a/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothLeScanFilterInit.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &BluetoothLeScanFilterInit) -> Option; + pub fn get_name(this: &BluetoothLeScanFilterInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] @@ -58,7 +58,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "namePrefix")] - pub fn get_name_prefix(this: &BluetoothLeScanFilterInit) -> Option; + pub fn get_name_prefix(this: &BluetoothLeScanFilterInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `namePrefix` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs index 61715c45bf0..1792f5dc535 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "deviceId")] - pub fn get_device_id(this: &BluetoothPermissionDescriptor) -> Option; + pub fn get_device_id(this: &BluetoothPermissionDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `deviceId` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs index f185f07bc63..558acf559ec 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattCharacteristic.rs @@ -38,7 +38,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn uuid(this: &BluetoothRemoteGattCharacteristic) -> String; + pub fn uuid(this: &BluetoothRemoteGattCharacteristic) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "BluetoothCharacteristicProperties")] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTCharacteristic" , js_name = properties)] diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs index 76e5709586e..3bcaa2710d6 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattDescriptor.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn uuid(this: &BluetoothRemoteGattDescriptor) -> String; + pub fn uuid(this: &BluetoothRemoteGattDescriptor) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTDescriptor" , js_name = value)] #[doc = "Getter for the `value` field of this object."] diff --git a/crates/web-sys/src/features/gen_BluetoothRemoteGattService.rs b/crates/web-sys/src/features/gen_BluetoothRemoteGattService.rs index 15dbccb8d73..5e98ade8f1c 100644 --- a/crates/web-sys/src/features/gen_BluetoothRemoteGattService.rs +++ b/crates/web-sys/src/features/gen_BluetoothRemoteGattService.rs @@ -38,7 +38,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn uuid(this: &BluetoothRemoteGattService) -> String; + pub fn uuid(this: &BluetoothRemoteGattService) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "BluetoothRemoteGATTService" , js_name = isPrimary)] #[doc = "Getter for the `isPrimary` field of this object."] diff --git a/crates/web-sys/src/features/gen_BluetoothUuid.rs b/crates/web-sys/src/features/gen_BluetoothUuid.rs index 7e2d6310f54..722f9cc6a1a 100644 --- a/crates/web-sys/src/features/gen_BluetoothUuid.rs +++ b/crates/web-sys/src/features/gen_BluetoothUuid.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn canonical_uuid(alias: u32) -> String; + pub fn canonical_uuid(alias: u32) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getCharacteristic)] #[doc = "The `getCharacteristic()` method."] @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_characteristic_with_str(name: &str) -> String; + pub fn get_characteristic_with_str(name: &str) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getCharacteristic)] #[doc = "The `getCharacteristic()` method."] @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_characteristic_with_u32(name: u32) -> String; + pub fn get_characteristic_with_u32(name: u32) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getDescriptor)] #[doc = "The `getDescriptor()` method."] @@ -59,7 +59,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_descriptor_with_str(name: &str) -> String; + pub fn get_descriptor_with_str(name: &str) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getDescriptor)] #[doc = "The `getDescriptor()` method."] @@ -70,7 +70,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_descriptor_with_u32(name: u32) -> String; + pub fn get_descriptor_with_u32(name: u32) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getService)] #[doc = "The `getService()` method."] @@ -81,7 +81,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_service_with_str(name: &str) -> String; + pub fn get_service_with_str(name: &str) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (static_method_of = BluetoothUuid , js_class = "BluetoothUUID" , js_name = getService)] #[doc = "The `getService()` method."] @@ -92,5 +92,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn get_service_with_u32(name: u32) -> String; + pub fn get_service_with_u32(name: u32) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_BroadcastChannel.rs b/crates/web-sys/src/features/gen_BroadcastChannel.rs index 5f607d07d82..aa52f8205da 100644 --- a/crates/web-sys/src/features/gen_BroadcastChannel.rs +++ b/crates/web-sys/src/features/gen_BroadcastChannel.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BroadcastChannel`*"] - pub fn name(this: &BroadcastChannel) -> String; + pub fn name(this: &BroadcastChannel) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "BroadcastChannel" , js_name = onmessage)] #[doc = "Getter for the `onmessage` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs index d41ec3553ef..2d4fe5e2311 100644 --- a/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementDownloadOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] #[wasm_bindgen(method, getter = "filename")] - pub fn get_filename(this: &BrowserElementDownloadOptions) -> Option; + pub fn get_filename(this: &BrowserElementDownloadOptions) -> Option<::alloc::string::String>; #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] #[wasm_bindgen(method, getter = "referrer")] - pub fn get_referrer(this: &BrowserElementDownloadOptions) -> Option; + pub fn get_referrer(this: &BrowserElementDownloadOptions) -> Option<::alloc::string::String>; #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementDownloadOptions`*"] diff --git a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs index d5cb2dbd650..04424595cb3 100644 --- a/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs +++ b/crates/web-sys/src/features/gen_BrowserElementExecuteScriptOptions.rs @@ -14,7 +14,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &BrowserElementExecuteScriptOptions) -> Option; + pub fn get_origin(this: &BrowserElementExecuteScriptOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] @@ -24,7 +25,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &BrowserElementExecuteScriptOptions) -> Option; + pub fn get_url(this: &BrowserElementExecuteScriptOptions) -> Option<::alloc::string::String>; #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `BrowserElementExecuteScriptOptions`*"] diff --git a/crates/web-sys/src/features/gen_CacheBatchOperation.rs b/crates/web-sys/src/features/gen_CacheBatchOperation.rs index 3712535a7b8..4a1f6b009fa 100644 --- a/crates/web-sys/src/features/gen_CacheBatchOperation.rs +++ b/crates/web-sys/src/features/gen_CacheBatchOperation.rs @@ -50,7 +50,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &CacheBatchOperation) -> Option; + pub fn get_type(this: &CacheBatchOperation) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheBatchOperation`*"] diff --git a/crates/web-sys/src/features/gen_CacheQueryOptions.rs b/crates/web-sys/src/features/gen_CacheQueryOptions.rs index 3497a49e5f8..18ff89a31c1 100644 --- a/crates/web-sys/src/features/gen_CacheQueryOptions.rs +++ b/crates/web-sys/src/features/gen_CacheQueryOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] #[wasm_bindgen(method, getter = "cacheName")] - pub fn get_cache_name(this: &CacheQueryOptions) -> Option; + pub fn get_cache_name(this: &CacheQueryOptions) -> Option<::alloc::string::String>; #[doc = "Change the `cacheName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CacheQueryOptions`*"] diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index bbdf299b9b9..6fcc8018793 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -40,7 +40,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn global_composite_operation(this: &CanvasRenderingContext2d) -> Result; + pub fn global_composite_operation( + this: &CanvasRenderingContext2d, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "CanvasRenderingContext2D" , js_name = globalCompositeOperation)] #[doc = "Setter for the `globalCompositeOperation` field of this object."] #[doc = ""] @@ -136,7 +138,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn filter(this: &CanvasRenderingContext2d) -> String; + pub fn filter(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = filter)] #[doc = "Setter for the `filter` field of this object."] #[doc = ""] @@ -178,7 +180,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn line_cap(this: &CanvasRenderingContext2d) -> String; + pub fn line_cap(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = lineCap)] #[doc = "Setter for the `lineCap` field of this object."] #[doc = ""] @@ -192,7 +194,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn line_join(this: &CanvasRenderingContext2d) -> String; + pub fn line_join(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = lineJoin)] #[doc = "Setter for the `lineJoin` field of this object."] #[doc = ""] @@ -276,7 +278,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn shadow_color(this: &CanvasRenderingContext2d) -> String; + pub fn shadow_color(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = shadowColor)] #[doc = "Setter for the `shadowColor` field of this object."] #[doc = ""] @@ -290,7 +292,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn font(this: &CanvasRenderingContext2d) -> String; + pub fn font(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = font)] #[doc = "Setter for the `font` field of this object."] #[doc = ""] @@ -304,7 +306,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn text_align(this: &CanvasRenderingContext2d) -> String; + pub fn text_align(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = textAlign)] #[doc = "Setter for the `textAlign` field of this object."] #[doc = ""] @@ -318,7 +320,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn text_baseline(this: &CanvasRenderingContext2d) -> String; + pub fn text_baseline(this: &CanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CanvasRenderingContext2D" , js_name = textBaseline)] #[doc = "Setter for the `textBaseline` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs index 093dd71087f..4ae63a8fc6e 100644 --- a/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs +++ b/crates/web-sys/src/features/gen_CaretStateChangedEventInit.rs @@ -101,7 +101,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] #[wasm_bindgen(method, getter = "selectedTextContent")] - pub fn get_selected_text_content(this: &CaretStateChangedEventInit) -> Option; + pub fn get_selected_text_content( + this: &CaretStateChangedEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `selectedTextContent` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CaretStateChangedEventInit`*"] diff --git a/crates/web-sys/src/features/gen_CharacterData.rs b/crates/web-sys/src/features/gen_CharacterData.rs index 78820080b9f..39e417042ec 100644 --- a/crates/web-sys/src/features/gen_CharacterData.rs +++ b/crates/web-sys/src/features/gen_CharacterData.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CharacterData`*"] - pub fn data(this: &CharacterData) -> String; + pub fn data(this: &CharacterData) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CharacterData" , js_name = data)] #[doc = "Setter for the `data` field of this object."] #[doc = ""] @@ -88,8 +88,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/substringData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CharacterData`*"] - pub fn substring_data(this: &CharacterData, offset: u32, count: u32) - -> Result; + pub fn substring_data( + this: &CharacterData, + offset: u32, + count: u32, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , variadic , js_class = "CharacterData" , js_name = after)] #[doc = "The `after()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CheckerboardReport.rs b/crates/web-sys/src/features/gen_CheckerboardReport.rs index 68840404323..465660a3021 100644 --- a/crates/web-sys/src/features/gen_CheckerboardReport.rs +++ b/crates/web-sys/src/features/gen_CheckerboardReport.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] #[wasm_bindgen(method, getter = "log")] - pub fn get_log(this: &CheckerboardReport) -> Option; + pub fn get_log(this: &CheckerboardReport) -> Option<::alloc::string::String>; #[doc = "Change the `log` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CheckerboardReport`*"] diff --git a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs index 7ab4711ab1c..822f3d11b90 100644 --- a/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_ChromeFilePropertyBag.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &ChromeFilePropertyBag) -> Option; + pub fn get_type(this: &ChromeFilePropertyBag) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &ChromeFilePropertyBag) -> Option; + pub fn get_name(this: &ChromeFilePropertyBag) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ChromeFilePropertyBag`*"] diff --git a/crates/web-sys/src/features/gen_Client.rs b/crates/web-sys/src/features/gen_Client.rs index 28af0c18680..081745cf069 100644 --- a/crates/web-sys/src/features/gen_Client.rs +++ b/crates/web-sys/src/features/gen_Client.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Client/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Client`*"] - pub fn url(this: &Client) -> String; + pub fn url(this: &Client) -> ::alloc::string::String; #[cfg(feature = "FrameType")] # [wasm_bindgen (structural , method , getter , js_class = "Client" , js_name = frameType)] #[doc = "Getter for the `frameType` field of this object."] @@ -41,7 +41,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Client/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Client`*"] - pub fn id(this: &Client) -> String; + pub fn id(this: &Client) -> ::alloc::string::String; # [wasm_bindgen (catch , method , structural , js_class = "Client" , js_name = postMessage)] #[doc = "The `postMessage()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CloseEvent.rs b/crates/web-sys/src/features/gen_CloseEvent.rs index 5a4d403608f..0826d7980f6 100644 --- a/crates/web-sys/src/features/gen_CloseEvent.rs +++ b/crates/web-sys/src/features/gen_CloseEvent.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/reason)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEvent`*"] - pub fn reason(this: &CloseEvent) -> String; + pub fn reason(this: &CloseEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "CloseEvent")] #[doc = "The `new CloseEvent(..)` constructor, creating a new instance of `CloseEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CloseEventInit.rs b/crates/web-sys/src/features/gen_CloseEventInit.rs index 841376c6536..6c6ba233506 100644 --- a/crates/web-sys/src/features/gen_CloseEventInit.rs +++ b/crates/web-sys/src/features/gen_CloseEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] #[wasm_bindgen(method, getter = "reason")] - pub fn get_reason(this: &CloseEventInit) -> Option; + pub fn get_reason(this: &CloseEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `reason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CloseEventInit`*"] diff --git a/crates/web-sys/src/features/gen_CollectedClientData.rs b/crates/web-sys/src/features/gen_CollectedClientData.rs index 0631b9bb553..cedc2994107 100644 --- a/crates/web-sys/src/features/gen_CollectedClientData.rs +++ b/crates/web-sys/src/features/gen_CollectedClientData.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, getter = "challenge")] - pub fn get_challenge(this: &CollectedClientData) -> String; + pub fn get_challenge(this: &CollectedClientData) -> ::alloc::string::String; #[doc = "Change the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[deprecated] #[wasm_bindgen(method, getter = "hashAlgorithm")] - pub fn get_hash_algorithm(this: &CollectedClientData) -> String; + pub fn get_hash_algorithm(this: &CollectedClientData) -> ::alloc::string::String; #[doc = "Change the `hashAlgorithm` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] @@ -65,7 +65,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &CollectedClientData) -> String; + pub fn get_origin(this: &CollectedClientData) -> ::alloc::string::String; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] @@ -88,7 +88,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[deprecated] #[wasm_bindgen(method, getter = "tokenBindingId")] - pub fn get_token_binding_id(this: &CollectedClientData) -> Option; + pub fn get_token_binding_id(this: &CollectedClientData) -> Option<::alloc::string::String>; #[doc = "Change the `tokenBindingId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] @@ -99,7 +99,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &CollectedClientData) -> String; + pub fn get_type(this: &CollectedClientData) -> ::alloc::string::String; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CollectedClientData`*"] diff --git a/crates/web-sys/src/features/gen_CompositionEvent.rs b/crates/web-sys/src/features/gen_CompositionEvent.rs index b68af4ec04f..c9b9b70beb9 100644 --- a/crates/web-sys/src/features/gen_CompositionEvent.rs +++ b/crates/web-sys/src/features/gen_CompositionEvent.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEvent`*"] - pub fn data(this: &CompositionEvent) -> Option; + pub fn data(this: &CompositionEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "CompositionEvent" , js_name = locale)] #[doc = "Getter for the `locale` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/locale)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEvent`*"] - pub fn locale(this: &CompositionEvent) -> String; + pub fn locale(this: &CompositionEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "CompositionEvent")] #[doc = "The `new CompositionEvent(..)` constructor, creating a new instance of `CompositionEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CompositionEventInit.rs b/crates/web-sys/src/features/gen_CompositionEventInit.rs index 79acc2f4d53..bfdf96dc739 100644 --- a/crates/web-sys/src/features/gen_CompositionEventInit.rs +++ b/crates/web-sys/src/features/gen_CompositionEventInit.rs @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] #[wasm_bindgen(method, getter = "data")] - pub fn get_data(this: &CompositionEventInit) -> Option; + pub fn get_data(this: &CompositionEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CompositionEventInit`*"] diff --git a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs index a079e830f73..fa4e8bb9660 100644 --- a/crates/web-sys/src/features/gen_ComputedEffectTiming.rs +++ b/crates/web-sys/src/features/gen_ComputedEffectTiming.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &ComputedEffectTiming) -> Option; + pub fn get_easing(this: &ComputedEffectTiming) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ComputedEffectTiming`*"] diff --git a/crates/web-sys/src/features/gen_ConnStatusDict.rs b/crates/web-sys/src/features/gen_ConnStatusDict.rs index e30dac419c1..b17e323e2db 100644 --- a/crates/web-sys/src/features/gen_ConnStatusDict.rs +++ b/crates/web-sys/src/features/gen_ConnStatusDict.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] #[wasm_bindgen(method, getter = "status")] - pub fn get_status(this: &ConnStatusDict) -> Option; + pub fn get_status(this: &ConnStatusDict) -> Option<::alloc::string::String>; #[doc = "Change the `status` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConnStatusDict`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleCounter.rs b/crates/web-sys/src/features/gen_ConsoleCounter.rs index 324e055fd0f..fba207d2fa0 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounter.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounter.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &ConsoleCounter) -> Option; + pub fn get_label(this: &ConsoleCounter) -> Option<::alloc::string::String>; #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounter`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleCounterError.rs b/crates/web-sys/src/features/gen_ConsoleCounterError.rs index bbc0a56a2f8..b4c247d7835 100644 --- a/crates/web-sys/src/features/gen_ConsoleCounterError.rs +++ b/crates/web-sys/src/features/gen_ConsoleCounterError.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] #[wasm_bindgen(method, getter = "error")] - pub fn get_error(this: &ConsoleCounterError) -> Option; + pub fn get_error(this: &ConsoleCounterError) -> Option<::alloc::string::String>; #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &ConsoleCounterError) -> Option; + pub fn get_label(this: &ConsoleCounterError) -> Option<::alloc::string::String>; #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleCounterError`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleEvent.rs b/crates/web-sys/src/features/gen_ConsoleEvent.rs index 1ab9de14dd2..84437d969a8 100644 --- a/crates/web-sys/src/features/gen_ConsoleEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleEvent.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "addonId")] - pub fn get_addon_id(this: &ConsoleEvent) -> Option; + pub fn get_addon_id(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `addonId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "consoleID")] - pub fn get_console_id(this: &ConsoleEvent) -> Option; + pub fn get_console_id(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `consoleID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "filename")] - pub fn get_filename(this: &ConsoleEvent) -> Option; + pub fn get_filename(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "functionName")] - pub fn get_function_name(this: &ConsoleEvent) -> Option; + pub fn get_function_name(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `functionName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "groupName")] - pub fn get_group_name(this: &ConsoleEvent) -> Option; + pub fn get_group_name(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `groupName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -114,7 +114,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "level")] - pub fn get_level(this: &ConsoleEvent) -> Option; + pub fn get_level(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `level` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] @@ -134,7 +134,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] #[wasm_bindgen(method, getter = "prefix")] - pub fn get_prefix(this: &ConsoleEvent) -> Option; + pub fn get_prefix(this: &ConsoleEvent) -> Option<::alloc::string::String>; #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleEvent`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs index 49f01a0f33e..367bbe939a7 100644 --- a/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs +++ b/crates/web-sys/src/features/gen_ConsoleInstanceOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, getter = "consoleID")] - pub fn get_console_id(this: &ConsoleInstanceOptions) -> Option; + pub fn get_console_id(this: &ConsoleInstanceOptions) -> Option<::alloc::string::String>; #[doc = "Change the `consoleID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, getter = "innerID")] - pub fn get_inner_id(this: &ConsoleInstanceOptions) -> Option; + pub fn get_inner_id(this: &ConsoleInstanceOptions) -> Option<::alloc::string::String>; #[doc = "Change the `innerID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] @@ -56,7 +56,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, getter = "maxLogLevelPref")] - pub fn get_max_log_level_pref(this: &ConsoleInstanceOptions) -> Option; + pub fn get_max_log_level_pref(this: &ConsoleInstanceOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `maxLogLevelPref` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] @@ -66,7 +67,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] #[wasm_bindgen(method, getter = "prefix")] - pub fn get_prefix(this: &ConsoleInstanceOptions) -> Option; + pub fn get_prefix(this: &ConsoleInstanceOptions) -> Option<::alloc::string::String>; #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleInstanceOptions`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs index a845e746dc1..a72113f54eb 100644 --- a/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs +++ b/crates/web-sys/src/features/gen_ConsoleProfileEvent.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] #[wasm_bindgen(method, getter = "action")] - pub fn get_action(this: &ConsoleProfileEvent) -> Option; + pub fn get_action(this: &ConsoleProfileEvent) -> Option<::alloc::string::String>; #[doc = "Change the `action` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleProfileEvent`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs index b1ffa84f6de..17b77e97c40 100644 --- a/crates/web-sys/src/features/gen_ConsoleStackEntry.rs +++ b/crates/web-sys/src/features/gen_ConsoleStackEntry.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, getter = "asyncCause")] - pub fn get_async_cause(this: &ConsoleStackEntry) -> Option; + pub fn get_async_cause(this: &ConsoleStackEntry) -> Option<::alloc::string::String>; #[doc = "Change the `asyncCause` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, getter = "filename")] - pub fn get_filename(this: &ConsoleStackEntry) -> Option; + pub fn get_filename(this: &ConsoleStackEntry) -> Option<::alloc::string::String>; #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] #[wasm_bindgen(method, getter = "functionName")] - pub fn get_function_name(this: &ConsoleStackEntry) -> Option; + pub fn get_function_name(this: &ConsoleStackEntry) -> Option<::alloc::string::String>; #[doc = "Change the `functionName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleStackEntry`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleTimerError.rs b/crates/web-sys/src/features/gen_ConsoleTimerError.rs index b23bcbf3963..f77827833f8 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerError.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerError.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] #[wasm_bindgen(method, getter = "error")] - pub fn get_error(this: &ConsoleTimerError) -> Option; + pub fn get_error(this: &ConsoleTimerError) -> Option<::alloc::string::String>; #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &ConsoleTimerError) -> Option; + pub fn get_name(this: &ConsoleTimerError) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerError`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs index 7e74b760b0a..dde9cc9ade7 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerLogOrEnd.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &ConsoleTimerLogOrEnd) -> Option; + pub fn get_name(this: &ConsoleTimerLogOrEnd) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerLogOrEnd`*"] diff --git a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs index 5d3bd715226..a915ed10f00 100644 --- a/crates/web-sys/src/features/gen_ConsoleTimerStart.rs +++ b/crates/web-sys/src/features/gen_ConsoleTimerStart.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &ConsoleTimerStart) -> Option; + pub fn get_name(this: &ConsoleTimerStart) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ConsoleTimerStart`*"] diff --git a/crates/web-sys/src/features/gen_Credential.rs b/crates/web-sys/src/features/gen_Credential.rs index 3df07adfc6d..7be4b17fd59 100644 --- a/crates/web-sys/src/features/gen_Credential.rs +++ b/crates/web-sys/src/features/gen_Credential.rs @@ -18,12 +18,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Credential/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Credential`*"] - pub fn id(this: &Credential) -> String; + pub fn id(this: &Credential) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Credential" , js_name = type)] #[doc = "Getter for the `type` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Credential/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Credential`*"] - pub fn type_(this: &Credential) -> String; + pub fn type_(this: &Credential) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_Crypto.rs b/crates/web-sys/src/features/gen_Crypto.rs index 44734501c78..6cc25458687 100644 --- a/crates/web-sys/src/features/gen_Crypto.rs +++ b/crates/web-sys/src/features/gen_Crypto.rs @@ -56,5 +56,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Crypto`*"] - pub fn random_uuid(this: &Crypto) -> String; + pub fn random_uuid(this: &Crypto) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_CryptoKey.rs b/crates/web-sys/src/features/gen_CryptoKey.rs index d040b14e9e5..f538e966c8f 100644 --- a/crates/web-sys/src/features/gen_CryptoKey.rs +++ b/crates/web-sys/src/features/gen_CryptoKey.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CryptoKey`*"] - pub fn type_(this: &CryptoKey) -> String; + pub fn type_(this: &CryptoKey) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "CryptoKey" , js_name = extractable)] #[doc = "Getter for the `extractable` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssAnimation.rs b/crates/web-sys/src/features/gen_CssAnimation.rs index 8ea86613744..f55ebbdf4ee 100644 --- a/crates/web-sys/src/features/gen_CssAnimation.rs +++ b/crates/web-sys/src/features/gen_CssAnimation.rs @@ -18,5 +18,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSAnimation/animationName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssAnimation`*"] - pub fn animation_name(this: &CssAnimation) -> String; + pub fn animation_name(this: &CssAnimation) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_CssConditionRule.rs b/crates/web-sys/src/features/gen_CssConditionRule.rs index caf51a6bff7..3df4d77159d 100644 --- a/crates/web-sys/src/features/gen_CssConditionRule.rs +++ b/crates/web-sys/src/features/gen_CssConditionRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSConditionRule/conditionText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssConditionRule`*"] - pub fn condition_text(this: &CssConditionRule) -> String; + pub fn condition_text(this: &CssConditionRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSConditionRule" , js_name = conditionText)] #[doc = "Setter for the `conditionText` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssCounterStyleRule.rs b/crates/web-sys/src/features/gen_CssCounterStyleRule.rs index 905e57b5481..79d6e842610 100644 --- a/crates/web-sys/src/features/gen_CssCounterStyleRule.rs +++ b/crates/web-sys/src/features/gen_CssCounterStyleRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn name(this: &CssCounterStyleRule) -> String; + pub fn name(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/system)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn system(this: &CssCounterStyleRule) -> String; + pub fn system(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = system)] #[doc = "Setter for the `system` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/symbols)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn symbols(this: &CssCounterStyleRule) -> String; + pub fn symbols(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = symbols)] #[doc = "Setter for the `symbols` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/additiveSymbols)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn additive_symbols(this: &CssCounterStyleRule) -> String; + pub fn additive_symbols(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = additiveSymbols)] #[doc = "Setter for the `additiveSymbols` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/negative)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn negative(this: &CssCounterStyleRule) -> String; + pub fn negative(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = negative)] #[doc = "Setter for the `negative` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/prefix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn prefix(this: &CssCounterStyleRule) -> String; + pub fn prefix(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = prefix)] #[doc = "Setter for the `prefix` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/suffix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn suffix(this: &CssCounterStyleRule) -> String; + pub fn suffix(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = suffix)] #[doc = "Setter for the `suffix` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/range)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn range(this: &CssCounterStyleRule) -> String; + pub fn range(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = range)] #[doc = "Setter for the `range` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/pad)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn pad(this: &CssCounterStyleRule) -> String; + pub fn pad(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = pad)] #[doc = "Setter for the `pad` field of this object."] #[doc = ""] @@ -144,7 +144,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/speakAs)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn speak_as(this: &CssCounterStyleRule) -> String; + pub fn speak_as(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = speakAs)] #[doc = "Setter for the `speakAs` field of this object."] #[doc = ""] @@ -158,7 +158,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSCounterStyleRule/fallback)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssCounterStyleRule`*"] - pub fn fallback(this: &CssCounterStyleRule) -> String; + pub fn fallback(this: &CssCounterStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSCounterStyleRule" , js_name = fallback)] #[doc = "Setter for the `fallback` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssFontFeatureValuesRule.rs b/crates/web-sys/src/features/gen_CssFontFeatureValuesRule.rs index fdbdebb4ade..73399c5efab 100644 --- a/crates/web-sys/src/features/gen_CssFontFeatureValuesRule.rs +++ b/crates/web-sys/src/features/gen_CssFontFeatureValuesRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSFontFeatureValuesRule/fontFamily)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssFontFeatureValuesRule`*"] - pub fn font_family(this: &CssFontFeatureValuesRule) -> String; + pub fn font_family(this: &CssFontFeatureValuesRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSFontFeatureValuesRule" , js_name = fontFamily)] #[doc = "Setter for the `fontFamily` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSFontFeatureValuesRule/valueText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssFontFeatureValuesRule`*"] - pub fn value_text(this: &CssFontFeatureValuesRule) -> String; + pub fn value_text(this: &CssFontFeatureValuesRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSFontFeatureValuesRule" , js_name = valueText)] #[doc = "Setter for the `valueText` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssImportRule.rs b/crates/web-sys/src/features/gen_CssImportRule.rs index 729cbdeb1c0..335c6ed55f7 100644 --- a/crates/web-sys/src/features/gen_CssImportRule.rs +++ b/crates/web-sys/src/features/gen_CssImportRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSImportRule/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssImportRule`*"] - pub fn href(this: &CssImportRule) -> String; + pub fn href(this: &CssImportRule) -> ::alloc::string::String; #[cfg(feature = "MediaList")] # [wasm_bindgen (structural , method , getter , js_class = "CSSImportRule" , js_name = media)] #[doc = "Getter for the `media` field of this object."] diff --git a/crates/web-sys/src/features/gen_CssKeyframeRule.rs b/crates/web-sys/src/features/gen_CssKeyframeRule.rs index 3b9039e79cd..7ca5caacf9f 100644 --- a/crates/web-sys/src/features/gen_CssKeyframeRule.rs +++ b/crates/web-sys/src/features/gen_CssKeyframeRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframeRule/keyText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssKeyframeRule`*"] - pub fn key_text(this: &CssKeyframeRule) -> String; + pub fn key_text(this: &CssKeyframeRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSKeyframeRule" , js_name = keyText)] #[doc = "Setter for the `keyText` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssKeyframesRule.rs b/crates/web-sys/src/features/gen_CssKeyframesRule.rs index f71fbc641ca..2526fb3e576 100644 --- a/crates/web-sys/src/features/gen_CssKeyframesRule.rs +++ b/crates/web-sys/src/features/gen_CssKeyframesRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframesRule/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssKeyframesRule`*"] - pub fn name(this: &CssKeyframesRule) -> String; + pub fn name(this: &CssKeyframesRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSKeyframesRule" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssNamespaceRule.rs b/crates/web-sys/src/features/gen_CssNamespaceRule.rs index b3b14b21c19..d21e37b678a 100644 --- a/crates/web-sys/src/features/gen_CssNamespaceRule.rs +++ b/crates/web-sys/src/features/gen_CssNamespaceRule.rs @@ -18,12 +18,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSNamespaceRule/namespaceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssNamespaceRule`*"] - pub fn namespace_uri(this: &CssNamespaceRule) -> String; + pub fn namespace_uri(this: &CssNamespaceRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "CSSNamespaceRule" , js_name = prefix)] #[doc = "Getter for the `prefix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSNamespaceRule/prefix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssNamespaceRule`*"] - pub fn prefix(this: &CssNamespaceRule) -> String; + pub fn prefix(this: &CssNamespaceRule) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_CssPseudoElement.rs b/crates/web-sys/src/features/gen_CssPseudoElement.rs index ccd8c3a9b91..7e5fe8f9e47 100644 --- a/crates/web-sys/src/features/gen_CssPseudoElement.rs +++ b/crates/web-sys/src/features/gen_CssPseudoElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssPseudoElement`*"] - pub fn type_(this: &CssPseudoElement) -> String; + pub fn type_(this: &CssPseudoElement) -> ::alloc::string::String; #[cfg(feature = "Element")] # [wasm_bindgen (structural , method , getter , js_class = "CSSPseudoElement" , js_name = parentElement)] #[doc = "Getter for the `parentElement` field of this object."] diff --git a/crates/web-sys/src/features/gen_CssRule.rs b/crates/web-sys/src/features/gen_CssRule.rs index 07c5ac757f3..91c4a8a8505 100644 --- a/crates/web-sys/src/features/gen_CssRule.rs +++ b/crates/web-sys/src/features/gen_CssRule.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule/cssText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssRule`*"] - pub fn css_text(this: &CssRule) -> String; + pub fn css_text(this: &CssRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSRule" , js_name = cssText)] #[doc = "Setter for the `cssText` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssStyleDeclaration.rs b/crates/web-sys/src/features/gen_CssStyleDeclaration.rs index 6e4f9b00e5b..dfe0ea7cdce 100644 --- a/crates/web-sys/src/features/gen_CssStyleDeclaration.rs +++ b/crates/web-sys/src/features/gen_CssStyleDeclaration.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/cssText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`*"] - pub fn css_text(this: &CssStyleDeclaration) -> String; + pub fn css_text(this: &CssStyleDeclaration) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSStyleDeclaration" , js_name = cssText)] #[doc = "Setter for the `cssText` field of this object."] #[doc = ""] @@ -47,7 +47,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/getPropertyPriority)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`*"] - pub fn get_property_priority(this: &CssStyleDeclaration, property: &str) -> String; + pub fn get_property_priority( + this: &CssStyleDeclaration, + property: &str, + ) -> ::alloc::string::String; # [wasm_bindgen (catch , method , structural , js_class = "CSSStyleDeclaration" , js_name = getPropertyValue)] #[doc = "The `getPropertyValue()` method."] #[doc = ""] @@ -57,21 +60,24 @@ extern "C" { pub fn get_property_value( this: &CssStyleDeclaration, property: &str, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "CSSStyleDeclaration" , js_name = item)] #[doc = "The `item()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/item)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`*"] - pub fn item(this: &CssStyleDeclaration, index: u32) -> String; + pub fn item(this: &CssStyleDeclaration, index: u32) -> ::alloc::string::String; # [wasm_bindgen (catch , method , structural , js_class = "CSSStyleDeclaration" , js_name = removeProperty)] #[doc = "The `removeProperty()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/removeProperty)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`*"] - pub fn remove_property(this: &CssStyleDeclaration, property: &str) -> Result; + pub fn remove_property( + this: &CssStyleDeclaration, + property: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "CSSStyleDeclaration" , js_name = setProperty)] #[doc = "The `setProperty()` method."] #[doc = ""] @@ -101,5 +107,5 @@ extern "C" { #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleDeclaration`*"] - pub fn get(this: &CssStyleDeclaration, index: u32) -> Option; + pub fn get(this: &CssStyleDeclaration, index: u32) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_CssStyleRule.rs b/crates/web-sys/src/features/gen_CssStyleRule.rs index 09caa515165..c96d34cc5d0 100644 --- a/crates/web-sys/src/features/gen_CssStyleRule.rs +++ b/crates/web-sys/src/features/gen_CssStyleRule.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleRule/selectorText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssStyleRule`*"] - pub fn selector_text(this: &CssStyleRule) -> String; + pub fn selector_text(this: &CssStyleRule) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "CSSStyleRule" , js_name = selectorText)] #[doc = "Setter for the `selectorText` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_CssTransition.rs b/crates/web-sys/src/features/gen_CssTransition.rs index 65844e9b6e2..3654703b497 100644 --- a/crates/web-sys/src/features/gen_CssTransition.rs +++ b/crates/web-sys/src/features/gen_CssTransition.rs @@ -18,5 +18,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSSTransition/transitionProperty)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CssTransition`*"] - pub fn transition_property(this: &CssTransition) -> String; + pub fn transition_property(this: &CssTransition) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_DataTransfer.rs b/crates/web-sys/src/features/gen_DataTransfer.rs index 131bba60bec..763633bfa7d 100644 --- a/crates/web-sys/src/features/gen_DataTransfer.rs +++ b/crates/web-sys/src/features/gen_DataTransfer.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/dropEffect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransfer`*"] - pub fn drop_effect(this: &DataTransfer) -> String; + pub fn drop_effect(this: &DataTransfer) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "DataTransfer" , js_name = dropEffect)] #[doc = "Setter for the `dropEffect` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/effectAllowed)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransfer`*"] - pub fn effect_allowed(this: &DataTransfer) -> String; + pub fn effect_allowed(this: &DataTransfer) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "DataTransfer" , js_name = effectAllowed)] #[doc = "Setter for the `effectAllowed` field of this object."] #[doc = ""] @@ -90,7 +90,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/getData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransfer`*"] - pub fn get_data(this: &DataTransfer, format: &str) -> Result; + pub fn get_data(this: &DataTransfer, format: &str) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "DataTransfer" , js_name = getFiles)] #[doc = "The `getFiles()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DataTransferItem.rs b/crates/web-sys/src/features/gen_DataTransferItem.rs index 98f4e8dba94..5942032ce5c 100644 --- a/crates/web-sys/src/features/gen_DataTransferItem.rs +++ b/crates/web-sys/src/features/gen_DataTransferItem.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/kind)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransferItem`*"] - pub fn kind(this: &DataTransferItem) -> String; + pub fn kind(this: &DataTransferItem) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DataTransferItem" , js_name = type)] #[doc = "Getter for the `type` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DataTransferItem`*"] - pub fn type_(this: &DataTransferItem) -> String; + pub fn type_(this: &DataTransferItem) -> ::alloc::string::String; #[cfg(feature = "File")] # [wasm_bindgen (catch , method , structural , js_class = "DataTransferItem" , js_name = getAsFile)] #[doc = "The `getAsFile()` method."] diff --git a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs index bbd77e5cfeb..71185fca1ff 100644 --- a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs +++ b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, getter = "decodeIssue")] - pub fn get_decode_issue(this: &DecoderDoctorNotification) -> Option; + pub fn get_decode_issue(this: &DecoderDoctorNotification) -> Option<::alloc::string::String>; #[doc = "Change the `decodeIssue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] @@ -24,7 +24,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, getter = "decoderDoctorReportId")] - pub fn get_decoder_doctor_report_id(this: &DecoderDoctorNotification) -> String; + pub fn get_decoder_doctor_report_id( + this: &DecoderDoctorNotification, + ) -> ::alloc::string::String; #[doc = "Change the `decoderDoctorReportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] @@ -34,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, getter = "docURL")] - pub fn get_doc_url(this: &DecoderDoctorNotification) -> Option; + pub fn get_doc_url(this: &DecoderDoctorNotification) -> Option<::alloc::string::String>; #[doc = "Change the `docURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] @@ -44,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, getter = "formats")] - pub fn get_formats(this: &DecoderDoctorNotification) -> Option; + pub fn get_formats(this: &DecoderDoctorNotification) -> Option<::alloc::string::String>; #[doc = "Change the `formats` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] @@ -64,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] #[wasm_bindgen(method, getter = "resourceURL")] - pub fn get_resource_url(this: &DecoderDoctorNotification) -> Option; + pub fn get_resource_url(this: &DecoderDoctorNotification) -> Option<::alloc::string::String>; #[doc = "Change the `resourceURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DecoderDoctorNotification`*"] diff --git a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs index fff3988a169..79d14f2a6f8 100644 --- a/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"] - pub fn name(this: &DedicatedWorkerGlobalScope) -> String; + pub fn name(this: &DedicatedWorkerGlobalScope) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DedicatedWorkerGlobalScope" , js_name = onmessage)] #[doc = "Getter for the `onmessage` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs index 323ac4159d7..54f4bb8119d 100644 --- a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &DhKeyDeriveParams) -> String; + pub fn get_name(this: &DhKeyDeriveParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DhKeyDeriveParams`*"] diff --git a/crates/web-sys/src/features/gen_Directory.rs b/crates/web-sys/src/features/gen_Directory.rs index 53d3eb022dd..81f41df7cf4 100644 --- a/crates/web-sys/src/features/gen_Directory.rs +++ b/crates/web-sys/src/features/gen_Directory.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Directory/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Directory`*"] - pub fn name(this: &Directory) -> Result; + pub fn name(this: &Directory) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Directory" , js_name = path)] #[doc = "Getter for the `path` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Directory/path)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Directory`*"] - pub fn path(this: &Directory) -> Result; + pub fn path(this: &Directory) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Directory" , js_name = getFiles)] #[doc = "The `getFiles()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs index ba0c9ee0569..45ac3c7cf9c 100644 --- a/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs +++ b/crates/web-sys/src/features/gen_DirectoryPickerOptions.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &DirectoryPickerOptions) -> Option; + pub fn get_id(this: &DirectoryPickerOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DisplayNameOptions.rs b/crates/web-sys/src/features/gen_DisplayNameOptions.rs index 837d9ecad1a..7795b4be0e8 100644 --- a/crates/web-sys/src/features/gen_DisplayNameOptions.rs +++ b/crates/web-sys/src/features/gen_DisplayNameOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] #[wasm_bindgen(method, getter = "style")] - pub fn get_style(this: &DisplayNameOptions) -> Option; + pub fn get_style(this: &DisplayNameOptions) -> Option<::alloc::string::String>; #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameOptions`*"] diff --git a/crates/web-sys/src/features/gen_DisplayNameResult.rs b/crates/web-sys/src/features/gen_DisplayNameResult.rs index ccfe023c9ae..66934ee6be9 100644 --- a/crates/web-sys/src/features/gen_DisplayNameResult.rs +++ b/crates/web-sys/src/features/gen_DisplayNameResult.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] #[wasm_bindgen(method, getter = "locale")] - pub fn get_locale(this: &DisplayNameResult) -> Option; + pub fn get_locale(this: &DisplayNameResult) -> Option<::alloc::string::String>; #[doc = "Change the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] #[wasm_bindgen(method, getter = "style")] - pub fn get_style(this: &DisplayNameResult) -> Option; + pub fn get_style(this: &DisplayNameResult) -> Option<::alloc::string::String>; #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DisplayNameResult`*"] diff --git a/crates/web-sys/src/features/gen_DnsCacheEntry.rs b/crates/web-sys/src/features/gen_DnsCacheEntry.rs index 54d837685fc..ef4dfa82670 100644 --- a/crates/web-sys/src/features/gen_DnsCacheEntry.rs +++ b/crates/web-sys/src/features/gen_DnsCacheEntry.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, getter = "family")] - pub fn get_family(this: &DnsCacheEntry) -> Option; + pub fn get_family(this: &DnsCacheEntry) -> Option<::alloc::string::String>; #[doc = "Change the `family` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] #[wasm_bindgen(method, getter = "hostname")] - pub fn get_hostname(this: &DnsCacheEntry) -> Option; + pub fn get_hostname(this: &DnsCacheEntry) -> Option<::alloc::string::String>; #[doc = "Change the `hostname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsCacheEntry`*"] diff --git a/crates/web-sys/src/features/gen_DnsLookupDict.rs b/crates/web-sys/src/features/gen_DnsLookupDict.rs index 3a40b3dac60..1c2a0a874d6 100644 --- a/crates/web-sys/src/features/gen_DnsLookupDict.rs +++ b/crates/web-sys/src/features/gen_DnsLookupDict.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] #[wasm_bindgen(method, getter = "error")] - pub fn get_error(this: &DnsLookupDict) -> Option; + pub fn get_error(this: &DnsLookupDict) -> Option<::alloc::string::String>; #[doc = "Change the `error` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DnsLookupDict`*"] diff --git a/crates/web-sys/src/features/gen_Document.rs b/crates/web-sys/src/features/gen_Document.rs index 1ca915c769e..648c2b0cbb5 100644 --- a/crates/web-sys/src/features/gen_Document.rs +++ b/crates/web-sys/src/features/gen_Document.rs @@ -26,49 +26,49 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/URL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn url(this: &Document) -> Result; + pub fn url(this: &Document) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Document" , js_name = documentURI)] #[doc = "Getter for the `documentURI` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn document_uri(this: &Document) -> Result; + pub fn document_uri(this: &Document) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = compatMode)] #[doc = "Getter for the `compatMode` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn compat_mode(this: &Document) -> String; + pub fn compat_mode(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = characterSet)] #[doc = "Getter for the `characterSet` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/characterSet)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn character_set(this: &Document) -> String; + pub fn character_set(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = charset)] #[doc = "Getter for the `charset` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/charset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn charset(this: &Document) -> String; + pub fn charset(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = inputEncoding)] #[doc = "Getter for the `inputEncoding` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/inputEncoding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn input_encoding(this: &Document) -> String; + pub fn input_encoding(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = contentType)] #[doc = "Getter for the `contentType` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn content_type(this: &Document) -> String; + pub fn content_type(this: &Document) -> ::alloc::string::String; #[cfg(feature = "DocumentType")] # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = doctype)] #[doc = "Getter for the `doctype` field of this object."] @@ -99,28 +99,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn referrer(this: &Document) -> String; + pub fn referrer(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = lastModified)] #[doc = "Getter for the `lastModified` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/lastModified)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn last_modified(this: &Document) -> String; + pub fn last_modified(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = readyState)] #[doc = "Getter for the `readyState` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn ready_state(this: &Document) -> String; + pub fn ready_state(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = title)] #[doc = "Getter for the `title` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/title)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn title(this: &Document) -> String; + pub fn title(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Document" , js_name = title)] #[doc = "Setter for the `title` field of this object."] #[doc = ""] @@ -134,7 +134,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/dir)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn dir(this: &Document) -> String; + pub fn dir(this: &Document) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Document" , js_name = dir)] #[doc = "Setter for the `dir` field of this object."] #[doc = ""] @@ -407,7 +407,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/selectedStyleSheetSet)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn selected_style_sheet_set(this: &Document) -> Option; + pub fn selected_style_sheet_set(this: &Document) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "Document" , js_name = selectedStyleSheetSet)] #[doc = "Setter for the `selectedStyleSheetSet` field of this object."] #[doc = ""] @@ -421,14 +421,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/lastStyleSheetSet)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn last_style_sheet_set(this: &Document) -> Option; + pub fn last_style_sheet_set(this: &Document) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = preferredStyleSheetSet)] #[doc = "Getter for the `preferredStyleSheetSet` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/preferredStyleSheetSet)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Document`*"] - pub fn preferred_style_sheet_set(this: &Document) -> Option; + pub fn preferred_style_sheet_set(this: &Document) -> Option<::alloc::string::String>; #[cfg(feature = "DomStringList")] # [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = styleSheetSets)] #[doc = "Getter for the `styleSheetSets` field of this object."] diff --git a/crates/web-sys/src/features/gen_DocumentType.rs b/crates/web-sys/src/features/gen_DocumentType.rs index f77d3cebf89..9203a78f242 100644 --- a/crates/web-sys/src/features/gen_DocumentType.rs +++ b/crates/web-sys/src/features/gen_DocumentType.rs @@ -18,21 +18,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentType`*"] - pub fn name(this: &DocumentType) -> String; + pub fn name(this: &DocumentType) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DocumentType" , js_name = publicId)] #[doc = "Getter for the `publicId` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/publicId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentType`*"] - pub fn public_id(this: &DocumentType) -> String; + pub fn public_id(this: &DocumentType) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DocumentType" , js_name = systemId)] #[doc = "Getter for the `systemId` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/systemId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DocumentType`*"] - pub fn system_id(this: &DocumentType) -> String; + pub fn system_id(this: &DocumentType) -> ::alloc::string::String; # [wasm_bindgen (catch , method , structural , variadic , js_class = "DocumentType" , js_name = after)] #[doc = "The `after()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomError.rs b/crates/web-sys/src/features/gen_DomError.rs index ba94c8d15fe..7052c88a6b9 100644 --- a/crates/web-sys/src/features/gen_DomError.rs +++ b/crates/web-sys/src/features/gen_DomError.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMError/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomError`*"] - pub fn name(this: &DomError) -> String; + pub fn name(this: &DomError) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DOMError" , js_name = message)] #[doc = "Getter for the `message` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomError`*"] - pub fn message(this: &DomError) -> String; + pub fn message(this: &DomError) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "DOMError")] #[doc = "The `new DomError(..)` constructor, creating a new instance of `DomError`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomException.rs b/crates/web-sys/src/features/gen_DomException.rs index 760f1135099..7fa5ad37c3c 100644 --- a/crates/web-sys/src/features/gen_DomException.rs +++ b/crates/web-sys/src/features/gen_DomException.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMException/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomException`*"] - pub fn name(this: &DomException) -> String; + pub fn name(this: &DomException) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DOMException" , js_name = message)] #[doc = "Getter for the `message` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMException/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomException`*"] - pub fn message(this: &DomException) -> String; + pub fn message(this: &DomException) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DOMException" , js_name = code)] #[doc = "Getter for the `code` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMException/filename)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomException`*"] - pub fn filename(this: &DomException) -> String; + pub fn filename(this: &DomException) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "DOMException" , js_name = lineNumber)] #[doc = "Getter for the `lineNumber` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMException/stack)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomException`*"] - pub fn stack(this: &DomException) -> String; + pub fn stack(this: &DomException) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "DOMException")] #[doc = "The `new DomException(..)` constructor, creating a new instance of `DomException`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomStringList.rs b/crates/web-sys/src/features/gen_DomStringList.rs index c91f557740a..2f8dcd72f28 100644 --- a/crates/web-sys/src/features/gen_DomStringList.rs +++ b/crates/web-sys/src/features/gen_DomStringList.rs @@ -32,12 +32,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMStringList/item)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomStringList`*"] - pub fn item(this: &DomStringList, index: u32) -> Option; + pub fn item(this: &DomStringList, index: u32) -> Option<::alloc::string::String>; #[wasm_bindgen(method, structural, js_class = "DOMStringList", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] #[doc = ""] #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomStringList`*"] - pub fn get(this: &DomStringList, index: u32) -> Option; + pub fn get(this: &DomStringList, index: u32) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_DomStringMap.rs b/crates/web-sys/src/features/gen_DomStringMap.rs index e7e1c3ae580..0d7a007b1f6 100644 --- a/crates/web-sys/src/features/gen_DomStringMap.rs +++ b/crates/web-sys/src/features/gen_DomStringMap.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomStringMap`*"] - pub fn get(this: &DomStringMap, name: &str) -> Option; + pub fn get(this: &DomStringMap, name: &str) -> Option<::alloc::string::String>; #[wasm_bindgen(catch, method, structural, js_class = "DOMStringMap", indexing_setter)] #[doc = "Indexing setter. As in the literal Javascript `this[key] = value`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomTokenList.rs b/crates/web-sys/src/features/gen_DomTokenList.rs index 742a389ddc5..a4a58a5f98e 100644 --- a/crates/web-sys/src/features/gen_DomTokenList.rs +++ b/crates/web-sys/src/features/gen_DomTokenList.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] - pub fn value(this: &DomTokenList) -> String; + pub fn value(this: &DomTokenList) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "DOMTokenList" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -158,7 +158,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/item)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] - pub fn item(this: &DomTokenList, index: u32) -> Option; + pub fn item(this: &DomTokenList, index: u32) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "DOMTokenList" , js_name = keys)] #[doc = "The `keys()` method."] #[doc = ""] @@ -309,5 +309,5 @@ extern "C" { #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomTokenList`*"] - pub fn get(this: &DomTokenList, index: u32) -> Option; + pub fn get(this: &DomTokenList, index: u32) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs index e45951c04b1..04f512d8bd9 100644 --- a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &EcKeyAlgorithm) -> String; + pub fn get_name(this: &EcKeyAlgorithm) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] #[wasm_bindgen(method, getter = "namedCurve")] - pub fn get_named_curve(this: &EcKeyAlgorithm) -> String; + pub fn get_named_curve(this: &EcKeyAlgorithm) -> ::alloc::string::String; #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyAlgorithm`*"] diff --git a/crates/web-sys/src/features/gen_EcKeyGenParams.rs b/crates/web-sys/src/features/gen_EcKeyGenParams.rs index 8992f7851b3..464905fd8ad 100644 --- a/crates/web-sys/src/features/gen_EcKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyGenParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &EcKeyGenParams) -> String; + pub fn get_name(this: &EcKeyGenParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] #[wasm_bindgen(method, getter = "namedCurve")] - pub fn get_named_curve(this: &EcKeyGenParams) -> String; + pub fn get_named_curve(this: &EcKeyGenParams) -> ::alloc::string::String; #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyGenParams`*"] diff --git a/crates/web-sys/src/features/gen_EcKeyImportParams.rs b/crates/web-sys/src/features/gen_EcKeyImportParams.rs index ed789023459..c6265856695 100644 --- a/crates/web-sys/src/features/gen_EcKeyImportParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyImportParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &EcKeyImportParams) -> String; + pub fn get_name(this: &EcKeyImportParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] #[wasm_bindgen(method, getter = "namedCurve")] - pub fn get_named_curve(this: &EcKeyImportParams) -> Option; + pub fn get_named_curve(this: &EcKeyImportParams) -> Option<::alloc::string::String>; #[doc = "Change the `namedCurve` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcKeyImportParams`*"] diff --git a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs index a061a19b0ec..be62df0958b 100644 --- a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &EcdhKeyDeriveParams) -> String; + pub fn get_name(this: &EcdhKeyDeriveParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdhKeyDeriveParams`*"] diff --git a/crates/web-sys/src/features/gen_EcdsaParams.rs b/crates/web-sys/src/features/gen_EcdsaParams.rs index 14fe80e857b..481fad7fe2a 100644 --- a/crates/web-sys/src/features/gen_EcdsaParams.rs +++ b/crates/web-sys/src/features/gen_EcdsaParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &EcdsaParams) -> String; + pub fn get_name(this: &EcdsaParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EcdsaParams`*"] diff --git a/crates/web-sys/src/features/gen_EffectTiming.rs b/crates/web-sys/src/features/gen_EffectTiming.rs index 7a43b7a75c0..2db703049ff 100644 --- a/crates/web-sys/src/features/gen_EffectTiming.rs +++ b/crates/web-sys/src/features/gen_EffectTiming.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &EffectTiming) -> Option; + pub fn get_easing(this: &EffectTiming) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EffectTiming`*"] diff --git a/crates/web-sys/src/features/gen_Element.rs b/crates/web-sys/src/features/gen_Element.rs index 4f8180e96fe..afd3417789e 100644 --- a/crates/web-sys/src/features/gen_Element.rs +++ b/crates/web-sys/src/features/gen_Element.rs @@ -18,35 +18,35 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn namespace_uri(this: &Element) -> Option; + pub fn namespace_uri(this: &Element) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Element" , js_name = prefix)] #[doc = "Getter for the `prefix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn prefix(this: &Element) -> Option; + pub fn prefix(this: &Element) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Element" , js_name = localName)] #[doc = "Getter for the `localName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/localName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn local_name(this: &Element) -> String; + pub fn local_name(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Element" , js_name = tagName)] #[doc = "Getter for the `tagName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn tag_name(this: &Element) -> String; + pub fn tag_name(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Element" , js_name = id)] #[doc = "Getter for the `id` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn id(this: &Element) -> String; + pub fn id(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Element" , js_name = id)] #[doc = "Setter for the `id` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn class_name(this: &Element) -> String; + pub fn class_name(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Element" , js_name = className)] #[doc = "Setter for the `className` field of this object."] #[doc = ""] @@ -160,7 +160,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn inner_html(this: &Element) -> String; + pub fn inner_html(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Element" , js_name = innerHTML)] #[doc = "Setter for the `innerHTML` field of this object."] #[doc = ""] @@ -174,7 +174,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn outer_html(this: &Element) -> String; + pub fn outer_html(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Element" , js_name = outerHTML)] #[doc = "Setter for the `outerHTML` field of this object."] #[doc = ""] @@ -204,7 +204,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/slot)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn slot(this: &Element) -> String; + pub fn slot(this: &Element) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "Element" , js_name = slot)] #[doc = "Setter for the `slot` field of this object."] #[doc = ""] @@ -279,7 +279,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`*"] - pub fn get_attribute(this: &Element, name: &str) -> Option; + pub fn get_attribute(this: &Element, name: &str) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "Element" , js_name = getAttributeNS)] #[doc = "The `getAttributeNS()` method."] #[doc = ""] @@ -290,7 +290,7 @@ extern "C" { this: &Element, namespace: Option<&str>, local_name: &str, - ) -> Option; + ) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "Element" , js_name = getAttributeNames)] #[doc = "The `getAttributeNames()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ElementCreationOptions.rs b/crates/web-sys/src/features/gen_ElementCreationOptions.rs index d9d29bca20d..479004ff3ab 100644 --- a/crates/web-sys/src/features/gen_ElementCreationOptions.rs +++ b/crates/web-sys/src/features/gen_ElementCreationOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] #[wasm_bindgen(method, getter = "is")] - pub fn get_is(this: &ElementCreationOptions) -> Option; + pub fn get_is(this: &ElementCreationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `is` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] #[wasm_bindgen(method, getter = "pseudo")] - pub fn get_pseudo(this: &ElementCreationOptions) -> Option; + pub fn get_pseudo(this: &ElementCreationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `pseudo` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementCreationOptions`*"] diff --git a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs index 086ab7bc6d3..3e043c61657 100644 --- a/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs +++ b/crates/web-sys/src/features/gen_ElementDefinitionOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] #[wasm_bindgen(method, getter = "extends")] - pub fn get_extends(this: &ElementDefinitionOptions) -> Option; + pub fn get_extends(this: &ElementDefinitionOptions) -> Option<::alloc::string::String>; #[doc = "Change the `extends` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ElementDefinitionOptions`*"] diff --git a/crates/web-sys/src/features/gen_ErrorEvent.rs b/crates/web-sys/src/features/gen_ErrorEvent.rs index e9288b44779..9e6f3247952 100644 --- a/crates/web-sys/src/features/gen_ErrorEvent.rs +++ b/crates/web-sys/src/features/gen_ErrorEvent.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEvent`*"] - pub fn message(this: &ErrorEvent) -> String; + pub fn message(this: &ErrorEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "ErrorEvent" , js_name = filename)] #[doc = "Getter for the `filename` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent/filename)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEvent`*"] - pub fn filename(this: &ErrorEvent) -> String; + pub fn filename(this: &ErrorEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "ErrorEvent" , js_name = lineno)] #[doc = "Getter for the `lineno` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ErrorEventInit.rs b/crates/web-sys/src/features/gen_ErrorEventInit.rs index da240ac4c11..b29df968ebf 100644 --- a/crates/web-sys/src/features/gen_ErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_ErrorEventInit.rs @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, getter = "filename")] - pub fn get_filename(this: &ErrorEventInit) -> Option; + pub fn get_filename(this: &ErrorEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `filename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] #[wasm_bindgen(method, getter = "message")] - pub fn get_message(this: &ErrorEventInit) -> Option; + pub fn get_message(this: &ErrorEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ErrorEventInit`*"] diff --git a/crates/web-sys/src/features/gen_Event.rs b/crates/web-sys/src/features/gen_Event.rs index d2e29c958a5..b3ede1b6707 100644 --- a/crates/web-sys/src/features/gen_Event.rs +++ b/crates/web-sys/src/features/gen_Event.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Event`*"] - pub fn type_(this: &Event) -> String; + pub fn type_(this: &Event) -> ::alloc::string::String; #[cfg(feature = "EventTarget")] # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = target)] #[doc = "Getter for the `target` field of this object."] diff --git a/crates/web-sys/src/features/gen_EventSource.rs b/crates/web-sys/src/features/gen_EventSource.rs index 3a1ecfa27bc..c9a9abf49c4 100644 --- a/crates/web-sys/src/features/gen_EventSource.rs +++ b/crates/web-sys/src/features/gen_EventSource.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `EventSource`*"] - pub fn url(this: &EventSource) -> String; + pub fn url(this: &EventSource) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = withCredentials)] #[doc = "Getter for the `withCredentials` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Exception.rs b/crates/web-sys/src/features/gen_Exception.rs index d8a046ba1f9..da7168bf738 100644 --- a/crates/web-sys/src/features/gen_Exception.rs +++ b/crates/web-sys/src/features/gen_Exception.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Exception/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Exception`*"] - pub fn name(this: &Exception) -> String; + pub fn name(this: &Exception) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Exception" , js_name = message)] #[doc = "Getter for the `message` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Exception/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Exception`*"] - pub fn message(this: &Exception) -> String; + pub fn message(this: &Exception) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Exception" , js_name = result)] #[doc = "Getter for the `result` field of this object."] #[doc = ""] @@ -39,7 +39,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Exception/filename)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Exception`*"] - pub fn filename(this: &Exception) -> String; + pub fn filename(this: &Exception) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Exception" , js_name = lineNumber)] #[doc = "Getter for the `lineNumber` field of this object."] #[doc = ""] @@ -67,5 +67,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Exception/stack)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Exception`*"] - pub fn stack(this: &Exception) -> String; + pub fn stack(this: &Exception) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_ExtendableMessageEvent.rs b/crates/web-sys/src/features/gen_ExtendableMessageEvent.rs index a660231a1de..4cf19b6ac21 100644 --- a/crates/web-sys/src/features/gen_ExtendableMessageEvent.rs +++ b/crates/web-sys/src/features/gen_ExtendableMessageEvent.rs @@ -25,14 +25,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ExtendableMessageEvent/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEvent`*"] - pub fn origin(this: &ExtendableMessageEvent) -> String; + pub fn origin(this: &ExtendableMessageEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "ExtendableMessageEvent" , js_name = lastEventId)] #[doc = "Getter for the `lastEventId` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ExtendableMessageEvent/lastEventId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEvent`*"] - pub fn last_event_id(this: &ExtendableMessageEvent) -> String; + pub fn last_event_id(this: &ExtendableMessageEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "ExtendableMessageEvent" , js_name = source)] #[doc = "Getter for the `source` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs index 745d1f041f8..ba05aee789e 100644 --- a/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_ExtendableMessageEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, getter = "lastEventId")] - pub fn get_last_event_id(this: &ExtendableMessageEventInit) -> Option; + pub fn get_last_event_id(this: &ExtendableMessageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `lastEventId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &ExtendableMessageEventInit) -> Option; + pub fn get_origin(this: &ExtendableMessageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ExtendableMessageEventInit`*"] diff --git a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs index f1209b12a9e..84c0894867e 100644 --- a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs +++ b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, getter = "description")] - pub fn get_description(this: &FakePluginMimeEntry) -> Option; + pub fn get_description(this: &FakePluginMimeEntry) -> Option<::alloc::string::String>; #[doc = "Change the `description` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, getter = "extension")] - pub fn get_extension(this: &FakePluginMimeEntry) -> Option; + pub fn get_extension(this: &FakePluginMimeEntry) -> Option<::alloc::string::String>; #[doc = "Change the `extension` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &FakePluginMimeEntry) -> String; + pub fn get_type(this: &FakePluginMimeEntry) -> ::alloc::string::String; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginMimeEntry`*"] diff --git a/crates/web-sys/src/features/gen_FakePluginTagInit.rs b/crates/web-sys/src/features/gen_FakePluginTagInit.rs index 43ab5067c1a..6dbd3fca415 100644 --- a/crates/web-sys/src/features/gen_FakePluginTagInit.rs +++ b/crates/web-sys/src/features/gen_FakePluginTagInit.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "description")] - pub fn get_description(this: &FakePluginTagInit) -> Option; + pub fn get_description(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `description` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "fileName")] - pub fn get_file_name(this: &FakePluginTagInit) -> Option; + pub fn get_file_name(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `fileName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "fullPath")] - pub fn get_full_path(this: &FakePluginTagInit) -> Option; + pub fn get_full_path(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `fullPath` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "handlerURI")] - pub fn get_handler_uri(this: &FakePluginTagInit) -> String; + pub fn get_handler_uri(this: &FakePluginTagInit) -> ::alloc::string::String; #[doc = "Change the `handlerURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &FakePluginTagInit) -> Option; + pub fn get_name(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "niceName")] - pub fn get_nice_name(this: &FakePluginTagInit) -> Option; + pub fn get_nice_name(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `niceName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "sandboxScript")] - pub fn get_sandbox_script(this: &FakePluginTagInit) -> Option; + pub fn get_sandbox_script(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `sandboxScript` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &FakePluginTagInit) -> Option; + pub fn get_version(this: &FakePluginTagInit) -> Option<::alloc::string::String>; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FakePluginTagInit`*"] diff --git a/crates/web-sys/src/features/gen_FetchEvent.rs b/crates/web-sys/src/features/gen_FetchEvent.rs index c3aa140c988..46005abafe9 100644 --- a/crates/web-sys/src/features/gen_FetchEvent.rs +++ b/crates/web-sys/src/features/gen_FetchEvent.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/clientId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEvent`*"] - pub fn client_id(this: &FetchEvent) -> Option; + pub fn client_id(this: &FetchEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "FetchEvent" , js_name = isReload)] #[doc = "Getter for the `isReload` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FetchEventInit.rs b/crates/web-sys/src/features/gen_FetchEventInit.rs index 0041cb59450..f86eb2c96ee 100644 --- a/crates/web-sys/src/features/gen_FetchEventInit.rs +++ b/crates/web-sys/src/features/gen_FetchEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] #[wasm_bindgen(method, getter = "clientId")] - pub fn get_client_id(this: &FetchEventInit) -> Option; + pub fn get_client_id(this: &FetchEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `clientId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchEventInit`*"] diff --git a/crates/web-sys/src/features/gen_File.rs b/crates/web-sys/src/features/gen_File.rs index 61b67ec8d23..9b12f29675c 100644 --- a/crates/web-sys/src/features/gen_File.rs +++ b/crates/web-sys/src/features/gen_File.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/File/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `File`*"] - pub fn name(this: &File) -> String; + pub fn name(this: &File) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "File" , js_name = lastModified)] #[doc = "Getter for the `lastModified` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs index 63c010f5f8e..364fd367c5e 100644 --- a/crates/web-sys/src/features/gen_FilePickerAcceptType.rs +++ b/crates/web-sys/src/features/gen_FilePickerAcceptType.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "description")] - pub fn get_description(this: &FilePickerAcceptType) -> Option; + pub fn get_description(this: &FilePickerAcceptType) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `description` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FilePickerOptions.rs b/crates/web-sys/src/features/gen_FilePickerOptions.rs index deb857f4ce4..74b1bda1cb8 100644 --- a/crates/web-sys/src/features/gen_FilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_FilePickerOptions.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &FilePickerOptions) -> Option; + pub fn get_id(this: &FilePickerOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FilePropertyBag.rs b/crates/web-sys/src/features/gen_FilePropertyBag.rs index 0b5c3ad8751..674fb53292d 100644 --- a/crates/web-sys/src/features/gen_FilePropertyBag.rs +++ b/crates/web-sys/src/features/gen_FilePropertyBag.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &FilePropertyBag) -> Option; + pub fn get_type(this: &FilePropertyBag) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FilePropertyBag`*"] diff --git a/crates/web-sys/src/features/gen_FileReaderSync.rs b/crates/web-sys/src/features/gen_FileReaderSync.rs index 97987b4c7d1..5602ccd1bde 100644 --- a/crates/web-sys/src/features/gen_FileReaderSync.rs +++ b/crates/web-sys/src/features/gen_FileReaderSync.rs @@ -37,7 +37,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync/readAsBinaryString)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReaderSync`*"] - pub fn read_as_binary_string(this: &FileReaderSync, blob: &Blob) -> Result; + pub fn read_as_binary_string( + this: &FileReaderSync, + blob: &Blob, + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "FileReaderSync" , js_name = readAsDataURL)] #[doc = "The `readAsDataURL()` method."] @@ -45,7 +48,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync/readAsDataURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReaderSync`*"] - pub fn read_as_data_url(this: &FileReaderSync, blob: &Blob) -> Result; + pub fn read_as_data_url( + this: &FileReaderSync, + blob: &Blob, + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "FileReaderSync" , js_name = readAsText)] #[doc = "The `readAsText()` method."] @@ -53,7 +59,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync/readAsText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReaderSync`*"] - pub fn read_as_text(this: &FileReaderSync, blob: &Blob) -> Result; + pub fn read_as_text( + this: &FileReaderSync, + blob: &Blob, + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "Blob")] # [wasm_bindgen (catch , method , structural , js_class = "FileReaderSync" , js_name = readAsText)] #[doc = "The `readAsText()` method."] @@ -65,5 +74,5 @@ extern "C" { this: &FileReaderSync, blob: &Blob, encoding: &str, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; } diff --git a/crates/web-sys/src/features/gen_FileSystem.rs b/crates/web-sys/src/features/gen_FileSystem.rs index 15eb5af8889..84ae4b461d2 100644 --- a/crates/web-sys/src/features/gen_FileSystem.rs +++ b/crates/web-sys/src/features/gen_FileSystem.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystem/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystem`*"] - pub fn name(this: &FileSystem) -> String; + pub fn name(this: &FileSystem) -> ::alloc::string::String; #[cfg(feature = "FileSystemDirectoryEntry")] # [wasm_bindgen (structural , method , getter , js_class = "FileSystem" , js_name = root)] #[doc = "Getter for the `root` field of this object."] diff --git a/crates/web-sys/src/features/gen_FileSystemEntry.rs b/crates/web-sys/src/features/gen_FileSystemEntry.rs index 885bf591573..835fef7e02f 100644 --- a/crates/web-sys/src/features/gen_FileSystemEntry.rs +++ b/crates/web-sys/src/features/gen_FileSystemEntry.rs @@ -32,14 +32,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntry`*"] - pub fn name(this: &FileSystemEntry) -> String; + pub fn name(this: &FileSystemEntry) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "FileSystemEntry" , js_name = fullPath)] #[doc = "Getter for the `fullPath` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/fullPath)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemEntry`*"] - pub fn full_path(this: &FileSystemEntry) -> String; + pub fn full_path(this: &FileSystemEntry) -> ::alloc::string::String; #[cfg(feature = "FileSystem")] # [wasm_bindgen (structural , method , getter , js_class = "FileSystemEntry" , js_name = filesystem)] #[doc = "Getter for the `filesystem` field of this object."] diff --git a/crates/web-sys/src/features/gen_FileSystemHandle.rs b/crates/web-sys/src/features/gen_FileSystemHandle.rs index b29a9d2eea0..ebfdfd64e38 100644 --- a/crates/web-sys/src/features/gen_FileSystemHandle.rs +++ b/crates/web-sys/src/features/gen_FileSystemHandle.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] - pub fn name(this: &FileSystemHandle) -> String; + pub fn name(this: &FileSystemHandle) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = isSameEntry)] #[doc = "The `isSameEntry()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FontData.rs b/crates/web-sys/src/features/gen_FontData.rs index c1bebfa28a2..512ee1a219c 100644 --- a/crates/web-sys/src/features/gen_FontData.rs +++ b/crates/web-sys/src/features/gen_FontData.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn postscript_name(this: &FontData) -> String; + pub fn postscript_name(this: &FontData) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "FontData" , js_name = fullName)] #[doc = "Getter for the `fullName` field of this object."] @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn full_name(this: &FontData) -> String; + pub fn full_name(this: &FontData) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "FontData" , js_name = family)] #[doc = "Getter for the `family` field of this object."] @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn family(this: &FontData) -> String; + pub fn family(this: &FontData) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "FontData" , js_name = style)] #[doc = "Getter for the `style` field of this object."] @@ -59,7 +59,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn style(this: &FontData) -> String; + pub fn style(this: &FontData) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "FontData" , js_name = blob)] #[doc = "The `blob()` method."] diff --git a/crates/web-sys/src/features/gen_FontFace.rs b/crates/web-sys/src/features/gen_FontFace.rs index 0fc7544437f..88fd885ff89 100644 --- a/crates/web-sys/src/features/gen_FontFace.rs +++ b/crates/web-sys/src/features/gen_FontFace.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/family)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn family(this: &FontFace) -> String; + pub fn family(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = family)] #[doc = "Setter for the `family` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/style)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn style(this: &FontFace) -> String; + pub fn style(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = style)] #[doc = "Setter for the `style` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/weight)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn weight(this: &FontFace) -> String; + pub fn weight(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = weight)] #[doc = "Setter for the `weight` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/stretch)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn stretch(this: &FontFace) -> String; + pub fn stretch(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = stretch)] #[doc = "Setter for the `stretch` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/unicodeRange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn unicode_range(this: &FontFace) -> String; + pub fn unicode_range(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = unicodeRange)] #[doc = "Setter for the `unicodeRange` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variant)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn variant(this: &FontFace) -> String; + pub fn variant(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = variant)] #[doc = "Setter for the `variant` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/featureSettings)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn feature_settings(this: &FontFace) -> String; + pub fn feature_settings(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = featureSettings)] #[doc = "Setter for the `featureSettings` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/variationSettings)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn variation_settings(this: &FontFace) -> String; + pub fn variation_settings(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = variationSettings)] #[doc = "Setter for the `variationSettings` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFace`*"] - pub fn display(this: &FontFace) -> String; + pub fn display(this: &FontFace) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "FontFace" , js_name = display)] #[doc = "Setter for the `display` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs index 3598c4f11dd..c9a1690045f 100644 --- a/crates/web-sys/src/features/gen_FontFaceDescriptors.rs +++ b/crates/web-sys/src/features/gen_FontFaceDescriptors.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "display")] - pub fn get_display(this: &FontFaceDescriptors) -> Option; + pub fn get_display(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `display` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "featureSettings")] - pub fn get_feature_settings(this: &FontFaceDescriptors) -> Option; + pub fn get_feature_settings(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `featureSettings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "stretch")] - pub fn get_stretch(this: &FontFaceDescriptors) -> Option; + pub fn get_stretch(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `stretch` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "style")] - pub fn get_style(this: &FontFaceDescriptors) -> Option; + pub fn get_style(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `style` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "unicodeRange")] - pub fn get_unicode_range(this: &FontFaceDescriptors) -> Option; + pub fn get_unicode_range(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `unicodeRange` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "variant")] - pub fn get_variant(this: &FontFaceDescriptors) -> Option; + pub fn get_variant(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `variant` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "variationSettings")] - pub fn get_variation_settings(this: &FontFaceDescriptors) -> Option; + pub fn get_variation_settings(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `variationSettings` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] #[wasm_bindgen(method, getter = "weight")] - pub fn get_weight(this: &FontFaceDescriptors) -> Option; + pub fn get_weight(this: &FontFaceDescriptors) -> Option<::alloc::string::String>; #[doc = "Change the `weight` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FontFaceDescriptors`*"] diff --git a/crates/web-sys/src/features/gen_Gamepad.rs b/crates/web-sys/src/features/gen_Gamepad.rs index cb20fdf2e18..1347d62a6c9 100644 --- a/crates/web-sys/src/features/gen_Gamepad.rs +++ b/crates/web-sys/src/features/gen_Gamepad.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn id(this: &Gamepad) -> String; + pub fn id(this: &Gamepad) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = index)] #[doc = "Getter for the `index` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GetUserMediaRequest.rs b/crates/web-sys/src/features/gen_GetUserMediaRequest.rs index 64718909a3b..94b9b1dbadb 100644 --- a/crates/web-sys/src/features/gen_GetUserMediaRequest.rs +++ b/crates/web-sys/src/features/gen_GetUserMediaRequest.rs @@ -32,21 +32,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GetUserMediaRequest/callID)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetUserMediaRequest`*"] - pub fn call_id(this: &GetUserMediaRequest) -> String; + pub fn call_id(this: &GetUserMediaRequest) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "GetUserMediaRequest" , js_name = rawID)] #[doc = "Getter for the `rawID` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GetUserMediaRequest/rawID)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetUserMediaRequest`*"] - pub fn raw_id(this: &GetUserMediaRequest) -> String; + pub fn raw_id(this: &GetUserMediaRequest) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "GetUserMediaRequest" , js_name = mediaSource)] #[doc = "Getter for the `mediaSource` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GetUserMediaRequest/mediaSource)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GetUserMediaRequest`*"] - pub fn media_source(this: &GetUserMediaRequest) -> String; + pub fn media_source(this: &GetUserMediaRequest) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "GetUserMediaRequest" , js_name = isSecure)] #[doc = "Getter for the `isSecure` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuAdapterInfo.rs b/crates/web-sys/src/features/gen_GpuAdapterInfo.rs index b2f41510943..8152dc1f896 100644 --- a/crates/web-sys/src/features/gen_GpuAdapterInfo.rs +++ b/crates/web-sys/src/features/gen_GpuAdapterInfo.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn vendor(this: &GpuAdapterInfo) -> String; + pub fn vendor(this: &GpuAdapterInfo) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = architecture)] #[doc = "Getter for the `architecture` field of this object."] @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn architecture(this: &GpuAdapterInfo) -> String; + pub fn architecture(this: &GpuAdapterInfo) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = device)] #[doc = "Getter for the `device` field of this object."] @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn device(this: &GpuAdapterInfo) -> String; + pub fn device(this: &GpuAdapterInfo) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapterInfo" , js_name = description)] #[doc = "Getter for the `description` field of this object."] @@ -59,5 +59,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn description(this: &GpuAdapterInfo) -> String; + pub fn description(this: &GpuAdapterInfo) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_GpuBindGroup.rs b/crates/web-sys/src/features/gen_GpuBindGroup.rs index 149b5191dea..44bd4e3250f 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroup.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroup.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBindGroup) -> String; + pub fn label(this: &GpuBindGroup) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroup" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs index 9f1ad18daf3..9286c1e5bc7 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuBindGroupDescriptor) -> Option; + pub fn get_label(this: &GpuBindGroupDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs index 40e00c0f142..a49305da88d 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayout.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBindGroupLayout) -> String; + pub fn label(this: &GpuBindGroupLayout) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroupLayout" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs index b7747d5d756..e79a77fa15e 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuBindGroupLayoutDescriptor) -> Option; + pub fn get_label(this: &GpuBindGroupLayoutDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index 2b51482df29..b06cf363cdb 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuBuffer) -> String; + pub fn label(this: &GpuBuffer) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUBuffer" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs index 536aa9c409d..47db1c0629f 100644 --- a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuBufferDescriptor) -> Option; + pub fn get_label(this: &GpuBufferDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCommandBuffer.rs b/crates/web-sys/src/features/gen_GpuCommandBuffer.rs index d7054cece23..f5c24baa66a 100644 --- a/crates/web-sys/src/features/gen_GpuCommandBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuCommandBuffer.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuCommandBuffer) -> String; + pub fn label(this: &GpuCommandBuffer) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUCommandBuffer" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs index af0d4b1455b..1db6b1097db 100644 --- a/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandBufferDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuCommandBufferDescriptor) -> Option; + pub fn get_label(this: &GpuCommandBufferDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index 6b1ceef6815..7fb2fb756a2 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuCommandEncoder) -> String; + pub fn label(this: &GpuCommandEncoder) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUCommandEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs index e883bd9c31e..51632a57feb 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoderDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuCommandEncoderDescriptor) -> Option; + pub fn get_label(this: &GpuCommandEncoderDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCompilationMessage.rs b/crates/web-sys/src/features/gen_GpuCompilationMessage.rs index 227fa2314d6..83c01717793 100644 --- a/crates/web-sys/src/features/gen_GpuCompilationMessage.rs +++ b/crates/web-sys/src/features/gen_GpuCompilationMessage.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn message(this: &GpuCompilationMessage) -> String; + pub fn message(this: &GpuCompilationMessage) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCompilationMessageType")] # [wasm_bindgen (structural , method , getter , js_class = "GPUCompilationMessage" , js_name = type)] diff --git a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs index 0da84742aa8..e7ba89476d1 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuComputePassDescriptor) -> Option; + pub fn get_label(this: &GpuComputePassDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs index 9542ee8a414..7f9daed5033 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassEncoder.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuComputePassEncoder) -> String; + pub fn label(this: &GpuComputePassEncoder) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUComputePassEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuComputePipeline.rs b/crates/web-sys/src/features/gen_GpuComputePipeline.rs index cb6d1728344..64f33cd44da 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipeline.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipeline.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuComputePipeline) -> String; + pub fn label(this: &GpuComputePipeline) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUComputePipeline" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs index 0dc1e1a0423..ad3e703eeec 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuComputePipelineDescriptor) -> Option; + pub fn get_label(this: &GpuComputePipelineDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 382f67eaceb..5ad2483befc 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -95,7 +95,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuDevice) -> String; + pub fn label(this: &GpuDevice) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUDevice" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index b6090cf7454..dd7c58ffca3 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuDeviceDescriptor) -> Option; + pub fn get_label(this: &GpuDeviceDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuDeviceLostInfo.rs b/crates/web-sys/src/features/gen_GpuDeviceLostInfo.rs index 2e5e15a85e3..2929b7b4acb 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceLostInfo.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceLostInfo.rs @@ -38,5 +38,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn message(this: &GpuDeviceLostInfo) -> String; + pub fn message(this: &GpuDeviceLostInfo) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_GpuError.rs b/crates/web-sys/src/features/gen_GpuError.rs index 1d089421591..8354754aeda 100644 --- a/crates/web-sys/src/features/gen_GpuError.rs +++ b/crates/web-sys/src/features/gen_GpuError.rs @@ -26,5 +26,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn message(this: &GpuError) -> String; + pub fn message(this: &GpuError) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_GpuExternalTexture.rs b/crates/web-sys/src/features/gen_GpuExternalTexture.rs index 5aea010a4eb..011cc5be316 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTexture.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTexture.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuExternalTexture) -> String; + pub fn label(this: &GpuExternalTexture) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUExternalTexture" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs index 913093af5c6..d63e3ca9ffd 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuExternalTextureDescriptor) -> Option; + pub fn get_label(this: &GpuExternalTextureDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 200758fd892..6dd9656413b 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "entryPoint")] - pub fn get_entry_point(this: &GpuFragmentState) -> Option; + pub fn get_entry_point(this: &GpuFragmentState) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `entryPoint` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs index 37e3d9fa7b0..c14221bc4c3 100644 --- a/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuObjectDescriptorBase.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuObjectDescriptorBase) -> Option; + pub fn get_label(this: &GpuObjectDescriptorBase) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs index 05a2206a33c..6f3b7a5746f 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuPipelineDescriptorBase) -> Option; + pub fn get_label(this: &GpuPipelineDescriptorBase) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayout.rs b/crates/web-sys/src/features/gen_GpuPipelineLayout.rs index b2ca2d974d4..339e6d3582a 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayout.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayout.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuPipelineLayout) -> String; + pub fn label(this: &GpuPipelineLayout) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUPipelineLayout" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs index cff6b220139..e62aecd6cc7 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuPipelineLayoutDescriptor) -> Option; + pub fn get_label(this: &GpuPipelineLayoutDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index 164b2e2f701..0daa32340d8 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "entryPoint")] - pub fn get_entry_point(this: &GpuProgrammableStage) -> Option; + pub fn get_entry_point(this: &GpuProgrammableStage) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `entryPoint` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuQuerySet.rs b/crates/web-sys/src/features/gen_GpuQuerySet.rs index 6bce0840c99..0d08c58eb33 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySet.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySet.rs @@ -49,7 +49,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuQuerySet) -> String; + pub fn label(this: &GpuQuerySet) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUQuerySet" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs index 36f3383a7e8..f853728775d 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuQuerySetDescriptor) -> Option; + pub fn get_label(this: &GpuQuerySetDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index 116378e02ea..e33c2394648 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuQueue) -> String; + pub fn label(this: &GpuQueue) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUQueue" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs index e07e624f8a5..c7d599625bc 100644 --- a/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQueueDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuQueueDescriptor) -> Option; + pub fn get_label(this: &GpuQueueDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderBundle.rs b/crates/web-sys/src/features/gen_GpuRenderBundle.rs index ff40728a67d..4871f17f0a8 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundle.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundle.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderBundle) -> String; + pub fn label(this: &GpuRenderBundle) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderBundle" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs index a250f0fe19f..ac6b825b6a3 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuRenderBundleDescriptor) -> Option; + pub fn get_label(this: &GpuRenderBundleDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs index b57bec64474..de06739ca0f 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoder.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderBundleEncoder) -> String; + pub fn label(this: &GpuRenderBundleEncoder) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderBundleEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs index 895ff703e51..0f9da7016bc 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuRenderBundleEncoderDescriptor) -> Option; + pub fn get_label(this: &GpuRenderBundleEncoderDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 4d388ca356e..13cdb794998 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuRenderPassDescriptor) -> Option; + pub fn get_label(this: &GpuRenderPassDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs index cb1e6499c26..b8451ad632d 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassEncoder.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderPassEncoder) -> String; + pub fn label(this: &GpuRenderPassEncoder) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderPassEncoder" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs index 7977ece02ea..2d1b53744c5 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuRenderPassLayout) -> Option; + pub fn get_label(this: &GpuRenderPassLayout) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRenderPipeline.rs b/crates/web-sys/src/features/gen_GpuRenderPipeline.rs index b4f94c5e69d..357a4107aaf 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipeline.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipeline.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuRenderPipeline) -> String; + pub fn label(this: &GpuRenderPipeline) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPURenderPipeline" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs index 5db5163d669..d9fe1b72344 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuRenderPipelineDescriptor) -> Option; + pub fn get_label(this: &GpuRenderPipelineDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index 68627083d06..cba26922c2b 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "featureLevel")] - pub fn get_feature_level(this: &GpuRequestAdapterOptions) -> Option; + pub fn get_feature_level(this: &GpuRequestAdapterOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `featureLevel` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuSampler.rs b/crates/web-sys/src/features/gen_GpuSampler.rs index c332f4deca7..21a43a1c82d 100644 --- a/crates/web-sys/src/features/gen_GpuSampler.rs +++ b/crates/web-sys/src/features/gen_GpuSampler.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuSampler) -> String; + pub fn label(this: &GpuSampler) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUSampler" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs index c8dcfc7f50f..6165b01c039 100644 --- a/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuSamplerDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuSamplerDescriptor) -> Option; + pub fn get_label(this: &GpuSamplerDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuShaderModule.rs b/crates/web-sys/src/features/gen_GpuShaderModule.rs index 8bb9cab8cbf..caa0cfba4ff 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModule.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModule.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuShaderModule) -> String; + pub fn label(this: &GpuShaderModule) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUShaderModule" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index f2c1369207e..69108e9b950 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "entryPoint")] - pub fn get_entry_point(this: &GpuShaderModuleCompilationHint) -> String; + pub fn get_entry_point(this: &GpuShaderModuleCompilationHint) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `entryPoint` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index b1fc639181b..b6c3a7b2433 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuShaderModuleDescriptor) -> Option; + pub fn get_label(this: &GpuShaderModuleDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "code")] - pub fn get_code(this: &GpuShaderModuleDescriptor) -> String; + pub fn get_code(this: &GpuShaderModuleDescriptor) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `code` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuTexture.rs b/crates/web-sys/src/features/gen_GpuTexture.rs index d1d72cd0b65..519516bbbf7 100644 --- a/crates/web-sys/src/features/gen_GpuTexture.rs +++ b/crates/web-sys/src/features/gen_GpuTexture.rs @@ -116,7 +116,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuTexture) -> String; + pub fn label(this: &GpuTexture) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUTexture" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs index ff3a096540f..c889e583bc1 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuTextureDescriptor) -> Option; + pub fn get_label(this: &GpuTextureDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuTextureView.rs b/crates/web-sys/src/features/gen_GpuTextureView.rs index c15f9650457..1fcc6ff6cf5 100644 --- a/crates/web-sys/src/features/gen_GpuTextureView.rs +++ b/crates/web-sys/src/features/gen_GpuTextureView.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn label(this: &GpuTextureView) -> String; + pub fn label(this: &GpuTextureView) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "GPUTextureView" , js_name = label)] #[doc = "Setter for the `label` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs index a618b9b2f96..6668927eee0 100644 --- a/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureViewDescriptor.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &GpuTextureViewDescriptor) -> Option; + pub fn get_label(this: &GpuTextureViewDescriptor) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index 5f8901ee638..f2dc669628a 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "entryPoint")] - pub fn get_entry_point(this: &GpuVertexState) -> Option; + pub fn get_entry_point(this: &GpuVertexState) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `entryPoint` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HashChangeEvent.rs b/crates/web-sys/src/features/gen_HashChangeEvent.rs index a697b2bd9bf..9e538f081cc 100644 --- a/crates/web-sys/src/features/gen_HashChangeEvent.rs +++ b/crates/web-sys/src/features/gen_HashChangeEvent.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent/oldURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEvent`*"] - pub fn old_url(this: &HashChangeEvent) -> String; + pub fn old_url(this: &HashChangeEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "HashChangeEvent" , js_name = newURL)] #[doc = "Getter for the `newURL` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent/newURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEvent`*"] - pub fn new_url(this: &HashChangeEvent) -> String; + pub fn new_url(this: &HashChangeEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "HashChangeEvent")] #[doc = "The `new HashChangeEvent(..)` constructor, creating a new instance of `HashChangeEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HashChangeEventInit.rs b/crates/web-sys/src/features/gen_HashChangeEventInit.rs index a4b951d4c92..90bf0ee6b35 100644 --- a/crates/web-sys/src/features/gen_HashChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_HashChangeEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, getter = "newURL")] - pub fn get_new_url(this: &HashChangeEventInit) -> Option; + pub fn get_new_url(this: &HashChangeEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `newURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] #[wasm_bindgen(method, getter = "oldURL")] - pub fn get_old_url(this: &HashChangeEventInit) -> Option; + pub fn get_old_url(this: &HashChangeEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `oldURL` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HashChangeEventInit`*"] diff --git a/crates/web-sys/src/features/gen_Headers.rs b/crates/web-sys/src/features/gen_Headers.rs index 28556d47b01..bdf068dde31 100644 --- a/crates/web-sys/src/features/gen_Headers.rs +++ b/crates/web-sys/src/features/gen_Headers.rs @@ -76,7 +76,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Headers/get)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Headers`*"] - pub fn get(this: &Headers, name: &str) -> Result, JsValue>; + pub fn get(this: &Headers, name: &str) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Headers" , js_name = has)] #[doc = "The `has()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HidDevice.rs b/crates/web-sys/src/features/gen_HidDevice.rs index 51bc70e5f2f..8a11a1bf741 100644 --- a/crates/web-sys/src/features/gen_HidDevice.rs +++ b/crates/web-sys/src/features/gen_HidDevice.rs @@ -81,7 +81,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn product_name(this: &HidDevice) -> String; + pub fn product_name(this: &HidDevice) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "HIDDevice" , js_name = collections)] #[doc = "Getter for the `collections` field of this object."] diff --git a/crates/web-sys/src/features/gen_HitRegionOptions.rs b/crates/web-sys/src/features/gen_HitRegionOptions.rs index fa0ea9ed78e..c8e6fbdd5c7 100644 --- a/crates/web-sys/src/features/gen_HitRegionOptions.rs +++ b/crates/web-sys/src/features/gen_HitRegionOptions.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &HitRegionOptions) -> Option; + pub fn get_id(this: &HitRegionOptions) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HitRegionOptions`*"] diff --git a/crates/web-sys/src/features/gen_HkdfParams.rs b/crates/web-sys/src/features/gen_HkdfParams.rs index e0b6f86a332..bd0211c11d1 100644 --- a/crates/web-sys/src/features/gen_HkdfParams.rs +++ b/crates/web-sys/src/features/gen_HkdfParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &HkdfParams) -> String; + pub fn get_name(this: &HkdfParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HkdfParams`*"] diff --git a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs index 40047b3e4a9..e8968782451 100644 --- a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &HmacDerivedKeyParams) -> String; + pub fn get_name(this: &HmacDerivedKeyParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacDerivedKeyParams`*"] diff --git a/crates/web-sys/src/features/gen_HmacImportParams.rs b/crates/web-sys/src/features/gen_HmacImportParams.rs index 685b5ff5e7a..cb02e69a836 100644 --- a/crates/web-sys/src/features/gen_HmacImportParams.rs +++ b/crates/web-sys/src/features/gen_HmacImportParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &HmacImportParams) -> String; + pub fn get_name(this: &HmacImportParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacImportParams`*"] diff --git a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs index de8a8cac708..8982dde472b 100644 --- a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &HmacKeyAlgorithm) -> String; + pub fn get_name(this: &HmacKeyAlgorithm) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyAlgorithm`*"] diff --git a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs index 7363659e1de..d051e11f672 100644 --- a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &HmacKeyGenParams) -> String; + pub fn get_name(this: &HmacKeyGenParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HmacKeyGenParams`*"] diff --git a/crates/web-sys/src/features/gen_HtmlAnchorElement.rs b/crates/web-sys/src/features/gen_HtmlAnchorElement.rs index 03fb3e54d41..6fafd95835b 100644 --- a/crates/web-sys/src/features/gen_HtmlAnchorElement.rs +++ b/crates/web-sys/src/features/gen_HtmlAnchorElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn target(this: &HtmlAnchorElement) -> String; + pub fn target(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = target)] #[doc = "Setter for the `target` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn download(this: &HtmlAnchorElement) -> String; + pub fn download(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = download)] #[doc = "Setter for the `download` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/ping)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn ping(this: &HtmlAnchorElement) -> String; + pub fn ping(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = ping)] #[doc = "Setter for the `ping` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/rel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn rel(this: &HtmlAnchorElement) -> String; + pub fn rel(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = rel)] #[doc = "Setter for the `rel` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn referrer_policy(this: &HtmlAnchorElement) -> String; + pub fn referrer_policy(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/hreflang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn hreflang(this: &HtmlAnchorElement) -> String; + pub fn hreflang(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = hreflang)] #[doc = "Setter for the `hreflang` field of this object."] #[doc = ""] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn type_(this: &HtmlAnchorElement) -> String; + pub fn type_(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -124,7 +124,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn text(this: &HtmlAnchorElement) -> Result; + pub fn text(this: &HtmlAnchorElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLAnchorElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] @@ -138,7 +138,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/coords)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn coords(this: &HtmlAnchorElement) -> String; + pub fn coords(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = coords)] #[doc = "Setter for the `coords` field of this object."] #[doc = ""] @@ -152,7 +152,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/charset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn charset(this: &HtmlAnchorElement) -> String; + pub fn charset(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = charset)] #[doc = "Setter for the `charset` field of this object."] #[doc = ""] @@ -166,7 +166,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn name(this: &HtmlAnchorElement) -> String; + pub fn name(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -180,7 +180,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/rev)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn rev(this: &HtmlAnchorElement) -> String; + pub fn rev(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = rev)] #[doc = "Setter for the `rev` field of this object."] #[doc = ""] @@ -194,7 +194,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/shape)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn shape(this: &HtmlAnchorElement) -> String; + pub fn shape(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = shape)] #[doc = "Setter for the `shape` field of this object."] #[doc = ""] @@ -208,7 +208,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn href(this: &HtmlAnchorElement) -> String; + pub fn href(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -222,14 +222,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn origin(this: &HtmlAnchorElement) -> String; + pub fn origin(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "HTMLAnchorElement" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn protocol(this: &HtmlAnchorElement) -> String; + pub fn protocol(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = protocol)] #[doc = "Setter for the `protocol` field of this object."] #[doc = ""] @@ -243,7 +243,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/username)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn username(this: &HtmlAnchorElement) -> String; + pub fn username(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = username)] #[doc = "Setter for the `username` field of this object."] #[doc = ""] @@ -257,7 +257,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/password)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn password(this: &HtmlAnchorElement) -> String; + pub fn password(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = password)] #[doc = "Setter for the `password` field of this object."] #[doc = ""] @@ -271,7 +271,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn host(this: &HtmlAnchorElement) -> String; + pub fn host(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = host)] #[doc = "Setter for the `host` field of this object."] #[doc = ""] @@ -285,7 +285,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/hostname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn hostname(this: &HtmlAnchorElement) -> String; + pub fn hostname(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = hostname)] #[doc = "Setter for the `hostname` field of this object."] #[doc = ""] @@ -299,7 +299,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/port)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn port(this: &HtmlAnchorElement) -> String; + pub fn port(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = port)] #[doc = "Setter for the `port` field of this object."] #[doc = ""] @@ -313,7 +313,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/pathname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn pathname(this: &HtmlAnchorElement) -> String; + pub fn pathname(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = pathname)] #[doc = "Setter for the `pathname` field of this object."] #[doc = ""] @@ -327,7 +327,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/search)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn search(this: &HtmlAnchorElement) -> String; + pub fn search(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = search)] #[doc = "Setter for the `search` field of this object."] #[doc = ""] @@ -341,7 +341,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/hash)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAnchorElement`*"] - pub fn hash(this: &HtmlAnchorElement) -> String; + pub fn hash(this: &HtmlAnchorElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAnchorElement" , js_name = hash)] #[doc = "Setter for the `hash` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlAreaElement.rs b/crates/web-sys/src/features/gen_HtmlAreaElement.rs index 4b8560faf65..2e4e2eee37e 100644 --- a/crates/web-sys/src/features/gen_HtmlAreaElement.rs +++ b/crates/web-sys/src/features/gen_HtmlAreaElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/alt)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn alt(this: &HtmlAreaElement) -> String; + pub fn alt(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = alt)] #[doc = "Setter for the `alt` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/coords)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn coords(this: &HtmlAreaElement) -> String; + pub fn coords(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = coords)] #[doc = "Setter for the `coords` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/shape)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn shape(this: &HtmlAreaElement) -> String; + pub fn shape(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = shape)] #[doc = "Setter for the `shape` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn target(this: &HtmlAreaElement) -> String; + pub fn target(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = target)] #[doc = "Setter for the `target` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/download)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn download(this: &HtmlAreaElement) -> String; + pub fn download(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = download)] #[doc = "Setter for the `download` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/ping)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn ping(this: &HtmlAreaElement) -> String; + pub fn ping(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = ping)] #[doc = "Setter for the `ping` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/rel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn rel(this: &HtmlAreaElement) -> String; + pub fn rel(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = rel)] #[doc = "Setter for the `rel` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn referrer_policy(this: &HtmlAreaElement) -> String; + pub fn referrer_policy(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -152,7 +152,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn href(this: &HtmlAreaElement) -> String; + pub fn href(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -166,14 +166,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn origin(this: &HtmlAreaElement) -> String; + pub fn origin(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "HTMLAreaElement" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn protocol(this: &HtmlAreaElement) -> String; + pub fn protocol(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = protocol)] #[doc = "Setter for the `protocol` field of this object."] #[doc = ""] @@ -187,7 +187,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/username)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn username(this: &HtmlAreaElement) -> String; + pub fn username(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = username)] #[doc = "Setter for the `username` field of this object."] #[doc = ""] @@ -201,7 +201,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/password)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn password(this: &HtmlAreaElement) -> String; + pub fn password(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = password)] #[doc = "Setter for the `password` field of this object."] #[doc = ""] @@ -215,7 +215,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn host(this: &HtmlAreaElement) -> String; + pub fn host(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = host)] #[doc = "Setter for the `host` field of this object."] #[doc = ""] @@ -229,7 +229,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/hostname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn hostname(this: &HtmlAreaElement) -> String; + pub fn hostname(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = hostname)] #[doc = "Setter for the `hostname` field of this object."] #[doc = ""] @@ -243,7 +243,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/port)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn port(this: &HtmlAreaElement) -> String; + pub fn port(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = port)] #[doc = "Setter for the `port` field of this object."] #[doc = ""] @@ -257,7 +257,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/pathname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn pathname(this: &HtmlAreaElement) -> String; + pub fn pathname(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = pathname)] #[doc = "Setter for the `pathname` field of this object."] #[doc = ""] @@ -271,7 +271,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/search)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn search(this: &HtmlAreaElement) -> String; + pub fn search(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = search)] #[doc = "Setter for the `search` field of this object."] #[doc = ""] @@ -285,7 +285,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/hash)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlAreaElement`*"] - pub fn hash(this: &HtmlAreaElement) -> String; + pub fn hash(this: &HtmlAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLAreaElement" , js_name = hash)] #[doc = "Setter for the `hash` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlBaseElement.rs b/crates/web-sys/src/features/gen_HtmlBaseElement.rs index 7c495bd1ab9..4f4aadc75a7 100644 --- a/crates/web-sys/src/features/gen_HtmlBaseElement.rs +++ b/crates/web-sys/src/features/gen_HtmlBaseElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBaseElement/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBaseElement`*"] - pub fn href(this: &HtmlBaseElement) -> String; + pub fn href(this: &HtmlBaseElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBaseElement" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBaseElement/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBaseElement`*"] - pub fn target(this: &HtmlBaseElement) -> String; + pub fn target(this: &HtmlBaseElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBaseElement" , js_name = target)] #[doc = "Setter for the `target` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlBodyElement.rs b/crates/web-sys/src/features/gen_HtmlBodyElement.rs index 9f1e6ed6bbc..9b902aeb351 100644 --- a/crates/web-sys/src/features/gen_HtmlBodyElement.rs +++ b/crates/web-sys/src/features/gen_HtmlBodyElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn text(this: &HtmlBodyElement) -> String; + pub fn text(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/link)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn link(this: &HtmlBodyElement) -> String; + pub fn link(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = link)] #[doc = "Setter for the `link` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/vLink)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn v_link(this: &HtmlBodyElement) -> String; + pub fn v_link(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = vLink)] #[doc = "Setter for the `vLink` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/aLink)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn a_link(this: &HtmlBodyElement) -> String; + pub fn a_link(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = aLink)] #[doc = "Setter for the `aLink` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/bgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn bg_color(this: &HtmlBodyElement) -> String; + pub fn bg_color(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = bgColor)] #[doc = "Setter for the `bgColor` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/background)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] - pub fn background(this: &HtmlBodyElement) -> String; + pub fn background(this: &HtmlBodyElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = background)] #[doc = "Setter for the `background` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlBrElement.rs b/crates/web-sys/src/features/gen_HtmlBrElement.rs index 0c239d02f6f..4e882f6f2eb 100644 --- a/crates/web-sys/src/features/gen_HtmlBrElement.rs +++ b/crates/web-sys/src/features/gen_HtmlBrElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBRElement/clear)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBrElement`*"] - pub fn clear(this: &HtmlBrElement) -> String; + pub fn clear(this: &HtmlBrElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLBRElement" , js_name = clear)] #[doc = "Setter for the `clear` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlButtonElement.rs b/crates/web-sys/src/features/gen_HtmlButtonElement.rs index b5c9fef4aac..047b47bfdb5 100644 --- a/crates/web-sys/src/features/gen_HtmlButtonElement.rs +++ b/crates/web-sys/src/features/gen_HtmlButtonElement.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formAction)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn form_action(this: &HtmlButtonElement) -> String; + pub fn form_action(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = formAction)] #[doc = "Setter for the `formAction` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formEnctype)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn form_enctype(this: &HtmlButtonElement) -> String; + pub fn form_enctype(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = formEnctype)] #[doc = "Setter for the `formEnctype` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formMethod)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn form_method(this: &HtmlButtonElement) -> String; + pub fn form_method(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = formMethod)] #[doc = "Setter for the `formMethod` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formTarget)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn form_target(this: &HtmlButtonElement) -> String; + pub fn form_target(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = formTarget)] #[doc = "Setter for the `formTarget` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn name(this: &HtmlButtonElement) -> String; + pub fn name(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -144,7 +144,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn type_(this: &HtmlButtonElement) -> String; + pub fn type_(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -158,7 +158,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn value(this: &HtmlButtonElement) -> String; + pub fn value(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -187,7 +187,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn validation_message(this: &HtmlButtonElement) -> Result; + pub fn validation_message(this: &HtmlButtonElement) + -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "NodeList")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = labels)] #[doc = "Getter for the `labels` field of this object."] @@ -216,7 +217,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetAction)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"] - pub fn popover_target_action(this: &HtmlButtonElement) -> String; + pub fn popover_target_action(this: &HtmlButtonElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = popoverTargetAction)] #[doc = "Setter for the `popoverTargetAction` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlCanvasElement.rs b/crates/web-sys/src/features/gen_HtmlCanvasElement.rs index 5b35060ab53..542e1dbf7ef 100644 --- a/crates/web-sys/src/features/gen_HtmlCanvasElement.rs +++ b/crates/web-sys/src/features/gen_HtmlCanvasElement.rs @@ -116,14 +116,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"] - pub fn to_data_url(this: &HtmlCanvasElement) -> Result; + pub fn to_data_url(this: &HtmlCanvasElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toDataURL)] #[doc = "The `toDataURL()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`*"] - pub fn to_data_url_with_type(this: &HtmlCanvasElement, type_: &str) -> Result; + pub fn to_data_url_with_type( + this: &HtmlCanvasElement, + type_: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = toDataURL)] #[doc = "The `toDataURL()` method."] #[doc = ""] @@ -134,7 +137,7 @@ extern "C" { this: &HtmlCanvasElement, type_: &str, encoder_options: &::wasm_bindgen::JsValue, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "OffscreenCanvas")] # [wasm_bindgen (catch , method , structural , js_class = "HTMLCanvasElement" , js_name = transferControlToOffscreen)] #[doc = "The `transferControlToOffscreen()` method."] diff --git a/crates/web-sys/src/features/gen_HtmlDataElement.rs b/crates/web-sys/src/features/gen_HtmlDataElement.rs index 07d7b8b800a..c9569fbb6c6 100644 --- a/crates/web-sys/src/features/gen_HtmlDataElement.rs +++ b/crates/web-sys/src/features/gen_HtmlDataElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDataElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDataElement`*"] - pub fn value(this: &HtmlDataElement) -> String; + pub fn value(this: &HtmlDataElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDataElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlDialogElement.rs b/crates/web-sys/src/features/gen_HtmlDialogElement.rs index 3df73705190..100d491d135 100644 --- a/crates/web-sys/src/features/gen_HtmlDialogElement.rs +++ b/crates/web-sys/src/features/gen_HtmlDialogElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDialogElement`*"] - pub fn return_value(this: &HtmlDialogElement) -> String; + pub fn return_value(this: &HtmlDialogElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDialogElement" , js_name = returnValue)] #[doc = "Setter for the `returnValue` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlDivElement.rs b/crates/web-sys/src/features/gen_HtmlDivElement.rs index e293b01448c..90faef9902d 100644 --- a/crates/web-sys/src/features/gen_HtmlDivElement.rs +++ b/crates/web-sys/src/features/gen_HtmlDivElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDivElement`*"] - pub fn align(this: &HtmlDivElement) -> String; + pub fn align(this: &HtmlDivElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDivElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlDocument.rs b/crates/web-sys/src/features/gen_HtmlDocument.rs index 8d16141c5dd..fb18ad852a6 100644 --- a/crates/web-sys/src/features/gen_HtmlDocument.rs +++ b/crates/web-sys/src/features/gen_HtmlDocument.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/domain)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn domain(this: &HtmlDocument) -> String; + pub fn domain(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = domain)] #[doc = "Setter for the `domain` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/cookie)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn cookie(this: &HtmlDocument) -> Result; + pub fn cookie(this: &HtmlDocument) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLDocument" , js_name = cookie)] #[doc = "Setter for the `cookie` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/designMode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn design_mode(this: &HtmlDocument) -> String; + pub fn design_mode(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = designMode)] #[doc = "Setter for the `designMode` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/fgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn fg_color(this: &HtmlDocument) -> String; + pub fn fg_color(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = fgColor)] #[doc = "Setter for the `fgColor` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/linkColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn link_color(this: &HtmlDocument) -> String; + pub fn link_color(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = linkColor)] #[doc = "Setter for the `linkColor` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/vlinkColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn vlink_color(this: &HtmlDocument) -> String; + pub fn vlink_color(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = vlinkColor)] #[doc = "Setter for the `vlinkColor` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/alinkColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn alink_color(this: &HtmlDocument) -> String; + pub fn alink_color(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = alinkColor)] #[doc = "Setter for the `alinkColor` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/bgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn bg_color(this: &HtmlDocument) -> String; + pub fn bg_color(this: &HtmlDocument) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLDocument" , js_name = bgColor)] #[doc = "Setter for the `bgColor` field of this object."] #[doc = ""] @@ -269,7 +269,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument/queryCommandValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlDocument`*"] - pub fn query_command_value(this: &HtmlDocument, command_id: &str) -> Result; + pub fn query_command_value( + this: &HtmlDocument, + command_id: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "HTMLDocument" , js_name = releaseEvents)] #[doc = "The `releaseEvents()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlElement.rs b/crates/web-sys/src/features/gen_HtmlElement.rs index 51738e1ba88..c8995e759a1 100644 --- a/crates/web-sys/src/features/gen_HtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/title)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn title(this: &HtmlElement) -> String; + pub fn title(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = title)] #[doc = "Setter for the `title` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/lang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn lang(this: &HtmlElement) -> String; + pub fn lang(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = lang)] #[doc = "Setter for the `lang` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dir)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn dir(this: &HtmlElement) -> String; + pub fn dir(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = dir)] #[doc = "Setter for the `dir` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn inner_text(this: &HtmlElement) -> String; + pub fn inner_text(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = innerText)] #[doc = "Setter for the `innerText` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKey)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn access_key(this: &HtmlElement) -> String; + pub fn access_key(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = accessKey)] #[doc = "Setter for the `accessKey` field of this object."] #[doc = ""] @@ -144,7 +144,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKeyLabel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn access_key_label(this: &HtmlElement) -> String; + pub fn access_key_label(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = draggable)] #[doc = "Getter for the `draggable` field of this object."] #[doc = ""] @@ -165,7 +165,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn content_editable(this: &HtmlElement) -> String; + pub fn content_editable(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = contentEditable)] #[doc = "Setter for the `contentEditable` field of this object."] #[doc = ""] @@ -186,7 +186,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn popover(this: &HtmlElement) -> Option; + pub fn popover(this: &HtmlElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLElement" , js_name = popover)] #[doc = "Setter for the `popover` field of this object."] #[doc = ""] @@ -1469,7 +1469,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"] - pub fn nonce(this: &HtmlElement) -> String; + pub fn nonce(this: &HtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = nonce)] #[doc = "Setter for the `nonce` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlEmbedElement.rs b/crates/web-sys/src/features/gen_HtmlEmbedElement.rs index ab89c6e3180..805ae985df3 100644 --- a/crates/web-sys/src/features/gen_HtmlEmbedElement.rs +++ b/crates/web-sys/src/features/gen_HtmlEmbedElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn src(this: &HtmlEmbedElement) -> String; + pub fn src(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn type_(this: &HtmlEmbedElement) -> String; + pub fn type_(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn width(this: &HtmlEmbedElement) -> String; + pub fn width(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/height)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn height(this: &HtmlEmbedElement) -> String; + pub fn height(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = height)] #[doc = "Setter for the `height` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn align(this: &HtmlEmbedElement) -> String; + pub fn align(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLEmbedElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlEmbedElement`*"] - pub fn name(this: &HtmlEmbedElement) -> String; + pub fn name(this: &HtmlEmbedElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLEmbedElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlFieldSetElement.rs b/crates/web-sys/src/features/gen_HtmlFieldSetElement.rs index 45ca9d2c1f6..79f533b6f49 100644 --- a/crates/web-sys/src/features/gen_HtmlFieldSetElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFieldSetElement.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFieldSetElement`*"] - pub fn name(this: &HtmlFieldSetElement) -> String; + pub fn name(this: &HtmlFieldSetElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFieldSetElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -54,7 +54,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFieldSetElement`*"] - pub fn type_(this: &HtmlFieldSetElement) -> String; + pub fn type_(this: &HtmlFieldSetElement) -> ::alloc::string::String; #[cfg(feature = "HtmlCollection")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLFieldSetElement" , js_name = elements)] #[doc = "Getter for the `elements` field of this object."] @@ -84,7 +84,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFieldSetElement`*"] - pub fn validation_message(this: &HtmlFieldSetElement) -> Result; + pub fn validation_message( + this: &HtmlFieldSetElement, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "HTMLFieldSetElement" , js_name = checkValidity)] #[doc = "The `checkValidity()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlFontElement.rs b/crates/web-sys/src/features/gen_HtmlFontElement.rs index bd7fe716142..40f4a144ec2 100644 --- a/crates/web-sys/src/features/gen_HtmlFontElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFontElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFontElement/color)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFontElement`*"] - pub fn color(this: &HtmlFontElement) -> String; + pub fn color(this: &HtmlFontElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFontElement" , js_name = color)] #[doc = "Setter for the `color` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFontElement/face)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFontElement`*"] - pub fn face(this: &HtmlFontElement) -> String; + pub fn face(this: &HtmlFontElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFontElement" , js_name = face)] #[doc = "Setter for the `face` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFontElement/size)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFontElement`*"] - pub fn size(this: &HtmlFontElement) -> String; + pub fn size(this: &HtmlFontElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFontElement" , js_name = size)] #[doc = "Setter for the `size` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlFormElement.rs b/crates/web-sys/src/features/gen_HtmlFormElement.rs index 4745000980e..9b3b03f4ea3 100644 --- a/crates/web-sys/src/features/gen_HtmlFormElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFormElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/acceptCharset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn accept_charset(this: &HtmlFormElement) -> String; + pub fn accept_charset(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = acceptCharset)] #[doc = "Setter for the `acceptCharset` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/action)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn action(this: &HtmlFormElement) -> String; + pub fn action(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = action)] #[doc = "Setter for the `action` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/autocomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn autocomplete(this: &HtmlFormElement) -> String; + pub fn autocomplete(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = autocomplete)] #[doc = "Setter for the `autocomplete` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn enctype(this: &HtmlFormElement) -> String; + pub fn enctype(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = enctype)] #[doc = "Setter for the `enctype` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/encoding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn encoding(this: &HtmlFormElement) -> String; + pub fn encoding(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = encoding)] #[doc = "Setter for the `encoding` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/method)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn method(this: &HtmlFormElement) -> String; + pub fn method(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = method)] #[doc = "Setter for the `method` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn name(this: &HtmlFormElement) -> String; + pub fn name(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFormElement`*"] - pub fn target(this: &HtmlFormElement) -> String; + pub fn target(this: &HtmlFormElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFormElement" , js_name = target)] #[doc = "Setter for the `target` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlFrameElement.rs b/crates/web-sys/src/features/gen_HtmlFrameElement.rs index 2fc4d2e982d..3bb1c2e8f79 100644 --- a/crates/web-sys/src/features/gen_HtmlFrameElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFrameElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn name(this: &HtmlFrameElement) -> String; + pub fn name(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/scrolling)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn scrolling(this: &HtmlFrameElement) -> String; + pub fn scrolling(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = scrolling)] #[doc = "Setter for the `scrolling` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn src(this: &HtmlFrameElement) -> String; + pub fn src(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/frameBorder)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn frame_border(this: &HtmlFrameElement) -> String; + pub fn frame_border(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = frameBorder)] #[doc = "Setter for the `frameBorder` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/longDesc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn long_desc(this: &HtmlFrameElement) -> String; + pub fn long_desc(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = longDesc)] #[doc = "Setter for the `longDesc` field of this object."] #[doc = ""] @@ -118,7 +118,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/marginHeight)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn margin_height(this: &HtmlFrameElement) -> String; + pub fn margin_height(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = marginHeight)] #[doc = "Setter for the `marginHeight` field of this object."] #[doc = ""] @@ -132,7 +132,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameElement/marginWidth)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameElement`*"] - pub fn margin_width(this: &HtmlFrameElement) -> String; + pub fn margin_width(this: &HtmlFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameElement" , js_name = marginWidth)] #[doc = "Setter for the `marginWidth` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs index ed44859b390..72a89f3d1ce 100644 --- a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/cols)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] - pub fn cols(this: &HtmlFrameSetElement) -> String; + pub fn cols(this: &HtmlFrameSetElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = cols)] #[doc = "Setter for the `cols` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/rows)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] - pub fn rows(this: &HtmlFrameSetElement) -> String; + pub fn rows(this: &HtmlFrameSetElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = rows)] #[doc = "Setter for the `rows` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlHeadingElement.rs b/crates/web-sys/src/features/gen_HtmlHeadingElement.rs index 28900782157..7bf7f08dc3e 100644 --- a/crates/web-sys/src/features/gen_HtmlHeadingElement.rs +++ b/crates/web-sys/src/features/gen_HtmlHeadingElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHeadingElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHeadingElement`*"] - pub fn align(this: &HtmlHeadingElement) -> String; + pub fn align(this: &HtmlHeadingElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHeadingElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlHrElement.rs b/crates/web-sys/src/features/gen_HtmlHrElement.rs index 911e385f59e..9eb61fd2f95 100644 --- a/crates/web-sys/src/features/gen_HtmlHrElement.rs +++ b/crates/web-sys/src/features/gen_HtmlHrElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHRElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHrElement`*"] - pub fn align(this: &HtmlHrElement) -> String; + pub fn align(this: &HtmlHrElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHRElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHRElement/color)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHrElement`*"] - pub fn color(this: &HtmlHrElement) -> String; + pub fn color(this: &HtmlHrElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHRElement" , js_name = color)] #[doc = "Setter for the `color` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHRElement/size)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHrElement`*"] - pub fn size(this: &HtmlHrElement) -> String; + pub fn size(this: &HtmlHrElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHRElement" , js_name = size)] #[doc = "Setter for the `size` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHRElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHrElement`*"] - pub fn width(this: &HtmlHrElement) -> String; + pub fn width(this: &HtmlHrElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHRElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlHtmlElement.rs b/crates/web-sys/src/features/gen_HtmlHtmlElement.rs index 57a0f68fba2..9cb7b3a5111 100644 --- a/crates/web-sys/src/features/gen_HtmlHtmlElement.rs +++ b/crates/web-sys/src/features/gen_HtmlHtmlElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHtmlElement/version)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlHtmlElement`*"] - pub fn version(this: &HtmlHtmlElement) -> String; + pub fn version(this: &HtmlHtmlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLHtmlElement" , js_name = version)] #[doc = "Setter for the `version` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlIFrameElement.rs b/crates/web-sys/src/features/gen_HtmlIFrameElement.rs index 8d0eab984cd..ff4a1c8122e 100644 --- a/crates/web-sys/src/features/gen_HtmlIFrameElement.rs +++ b/crates/web-sys/src/features/gen_HtmlIFrameElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn src(this: &HtmlIFrameElement) -> String; + pub fn src(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/srcdoc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn srcdoc(this: &HtmlIFrameElement) -> String; + pub fn srcdoc(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = srcdoc)] #[doc = "Setter for the `srcdoc` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn name(this: &HtmlIFrameElement) -> String; + pub fn name(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn width(this: &HtmlIFrameElement) -> String; + pub fn width(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/height)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn height(this: &HtmlIFrameElement) -> String; + pub fn height(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = height)] #[doc = "Setter for the `height` field of this object."] #[doc = ""] @@ -124,7 +124,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn referrer_policy(this: &HtmlIFrameElement) -> String; + pub fn referrer_policy(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -154,7 +154,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn align(this: &HtmlIFrameElement) -> String; + pub fn align(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -168,7 +168,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/scrolling)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn scrolling(this: &HtmlIFrameElement) -> String; + pub fn scrolling(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = scrolling)] #[doc = "Setter for the `scrolling` field of this object."] #[doc = ""] @@ -182,7 +182,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/frameBorder)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn frame_border(this: &HtmlIFrameElement) -> String; + pub fn frame_border(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = frameBorder)] #[doc = "Setter for the `frameBorder` field of this object."] #[doc = ""] @@ -196,7 +196,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/longDesc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn long_desc(this: &HtmlIFrameElement) -> String; + pub fn long_desc(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = longDesc)] #[doc = "Setter for the `longDesc` field of this object."] #[doc = ""] @@ -210,7 +210,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/marginHeight)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn margin_height(this: &HtmlIFrameElement) -> String; + pub fn margin_height(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = marginHeight)] #[doc = "Setter for the `marginHeight` field of this object."] #[doc = ""] @@ -224,7 +224,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/marginWidth)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlIFrameElement`*"] - pub fn margin_width(this: &HtmlIFrameElement) -> String; + pub fn margin_width(this: &HtmlIFrameElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLIFrameElement" , js_name = marginWidth)] #[doc = "Setter for the `marginWidth` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlImageElement.rs b/crates/web-sys/src/features/gen_HtmlImageElement.rs index ca486278d60..4ac489fd9a6 100644 --- a/crates/web-sys/src/features/gen_HtmlImageElement.rs +++ b/crates/web-sys/src/features/gen_HtmlImageElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn alt(this: &HtmlImageElement) -> String; + pub fn alt(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = alt)] #[doc = "Setter for the `alt` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn src(this: &HtmlImageElement) -> String; + pub fn src(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn srcset(this: &HtmlImageElement) -> String; + pub fn srcset(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = srcset)] #[doc = "Setter for the `srcset` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn cross_origin(this: &HtmlImageElement) -> Option; + pub fn cross_origin(this: &HtmlImageElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = crossOrigin)] #[doc = "Setter for the `crossOrigin` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/useMap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn use_map(this: &HtmlImageElement) -> String; + pub fn use_map(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = useMap)] #[doc = "Setter for the `useMap` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn referrer_policy(this: &HtmlImageElement) -> String; + pub fn referrer_policy(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -144,7 +144,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn decoding(this: &HtmlImageElement) -> String; + pub fn decoding(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = decoding)] #[doc = "Setter for the `decoding` field of this object."] #[doc = ""] @@ -179,7 +179,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn name(this: &HtmlImageElement) -> String; + pub fn name(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -193,7 +193,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn align(this: &HtmlImageElement) -> String; + pub fn align(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -235,7 +235,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/longDesc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn long_desc(this: &HtmlImageElement) -> String; + pub fn long_desc(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = longDesc)] #[doc = "Setter for the `longDesc` field of this object."] #[doc = ""] @@ -249,7 +249,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/border)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn border(this: &HtmlImageElement) -> String; + pub fn border(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = border)] #[doc = "Setter for the `border` field of this object."] #[doc = ""] @@ -263,7 +263,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn sizes(this: &HtmlImageElement) -> String; + pub fn sizes(this: &HtmlImageElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLImageElement" , js_name = sizes)] #[doc = "Setter for the `sizes` field of this object."] #[doc = ""] @@ -277,7 +277,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/currentSrc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`*"] - pub fn current_src(this: &HtmlImageElement) -> String; + pub fn current_src(this: &HtmlImageElement) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "Image")] #[doc = "The `new HtmlImageElement(..)` constructor, creating a new instance of `HtmlImageElement`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlInputElement.rs b/crates/web-sys/src/features/gen_HtmlInputElement.rs index 3e787c52a25..8d250cac379 100644 --- a/crates/web-sys/src/features/gen_HtmlInputElement.rs +++ b/crates/web-sys/src/features/gen_HtmlInputElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/accept)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn accept(this: &HtmlInputElement) -> String; + pub fn accept(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = accept)] #[doc = "Setter for the `accept` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/alt)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn alt(this: &HtmlInputElement) -> String; + pub fn alt(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = alt)] #[doc = "Setter for the `alt` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn autocomplete(this: &HtmlInputElement) -> String; + pub fn autocomplete(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = autocomplete)] #[doc = "Setter for the `autocomplete` field of this object."] #[doc = ""] @@ -146,7 +146,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/formAction)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn form_action(this: &HtmlInputElement) -> String; + pub fn form_action(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = formAction)] #[doc = "Setter for the `formAction` field of this object."] #[doc = ""] @@ -160,7 +160,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/formEnctype)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn form_enctype(this: &HtmlInputElement) -> String; + pub fn form_enctype(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = formEnctype)] #[doc = "Setter for the `formEnctype` field of this object."] #[doc = ""] @@ -174,7 +174,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/formMethod)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn form_method(this: &HtmlInputElement) -> String; + pub fn form_method(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = formMethod)] #[doc = "Setter for the `formMethod` field of this object."] #[doc = ""] @@ -202,7 +202,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/formTarget)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn form_target(this: &HtmlInputElement) -> String; + pub fn form_target(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = formTarget)] #[doc = "Setter for the `formTarget` field of this object."] #[doc = ""] @@ -244,7 +244,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/inputMode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn input_mode(this: &HtmlInputElement) -> String; + pub fn input_mode(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = inputMode)] #[doc = "Setter for the `inputMode` field of this object."] #[doc = ""] @@ -265,7 +265,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/max)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn max(this: &HtmlInputElement) -> String; + pub fn max(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = max)] #[doc = "Setter for the `max` field of this object."] #[doc = ""] @@ -293,7 +293,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/min)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn min(this: &HtmlInputElement) -> String; + pub fn min(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = min)] #[doc = "Setter for the `min` field of this object."] #[doc = ""] @@ -335,7 +335,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn name(this: &HtmlInputElement) -> String; + pub fn name(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -349,7 +349,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/pattern)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn pattern(this: &HtmlInputElement) -> String; + pub fn pattern(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = pattern)] #[doc = "Setter for the `pattern` field of this object."] #[doc = ""] @@ -363,7 +363,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/placeholder)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn placeholder(this: &HtmlInputElement) -> String; + pub fn placeholder(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = placeholder)] #[doc = "Setter for the `placeholder` field of this object."] #[doc = ""] @@ -419,7 +419,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn src(this: &HtmlInputElement) -> String; + pub fn src(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -433,7 +433,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/step)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn step(this: &HtmlInputElement) -> String; + pub fn step(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = step)] #[doc = "Setter for the `step` field of this object."] #[doc = ""] @@ -447,7 +447,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn type_(this: &HtmlInputElement) -> String; + pub fn type_(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -461,7 +461,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/defaultValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn default_value(this: &HtmlInputElement) -> String; + pub fn default_value(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = defaultValue)] #[doc = "Setter for the `defaultValue` field of this object."] #[doc = ""] @@ -475,7 +475,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn value(this: &HtmlInputElement) -> String; + pub fn value(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -532,7 +532,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn validation_message(this: &HtmlInputElement) -> Result; + pub fn validation_message(this: &HtmlInputElement) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "NodeList")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = labels)] #[doc = "Getter for the `labels` field of this object."] @@ -575,7 +575,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/selectionDirection)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn selection_direction(this: &HtmlInputElement) -> Result, JsValue>; + pub fn selection_direction( + this: &HtmlInputElement, + ) -> Result, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLInputElement" , js_name = selectionDirection)] #[doc = "Setter for the `selectionDirection` field of this object."] #[doc = ""] @@ -592,7 +594,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn align(this: &HtmlInputElement) -> String; + pub fn align(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -606,7 +608,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/useMap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn use_map(this: &HtmlInputElement) -> String; + pub fn use_map(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = useMap)] #[doc = "Setter for the `useMap` field of this object."] #[doc = ""] @@ -655,7 +657,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"] - pub fn popover_target_action(this: &HtmlInputElement) -> String; + pub fn popover_target_action(this: &HtmlInputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = popoverTargetAction)] #[doc = "Setter for the `popoverTargetAction` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlLabelElement.rs b/crates/web-sys/src/features/gen_HtmlLabelElement.rs index bde3c7fba6e..1c0bb33d08b 100644 --- a/crates/web-sys/src/features/gen_HtmlLabelElement.rs +++ b/crates/web-sys/src/features/gen_HtmlLabelElement.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/htmlFor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLabelElement`*"] - pub fn html_for(this: &HtmlLabelElement) -> String; + pub fn html_for(this: &HtmlLabelElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLabelElement" , js_name = htmlFor)] #[doc = "Setter for the `htmlFor` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlLegendElement.rs b/crates/web-sys/src/features/gen_HtmlLegendElement.rs index 76b9bb70773..d2fb9fede5a 100644 --- a/crates/web-sys/src/features/gen_HtmlLegendElement.rs +++ b/crates/web-sys/src/features/gen_HtmlLegendElement.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLegendElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLegendElement`*"] - pub fn align(this: &HtmlLegendElement) -> String; + pub fn align(this: &HtmlLegendElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLegendElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlLiElement.rs b/crates/web-sys/src/features/gen_HtmlLiElement.rs index 07056913c1a..dc41b1ddc8b 100644 --- a/crates/web-sys/src/features/gen_HtmlLiElement.rs +++ b/crates/web-sys/src/features/gen_HtmlLiElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLIElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLiElement`*"] - pub fn type_(this: &HtmlLiElement) -> String; + pub fn type_(this: &HtmlLiElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLIElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlLinkElement.rs b/crates/web-sys/src/features/gen_HtmlLinkElement.rs index 8e3ab52258b..da121ef8b53 100644 --- a/crates/web-sys/src/features/gen_HtmlLinkElement.rs +++ b/crates/web-sys/src/features/gen_HtmlLinkElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn href(this: &HtmlLinkElement) -> String; + pub fn href(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/crossOrigin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn cross_origin(this: &HtmlLinkElement) -> Option; + pub fn cross_origin(this: &HtmlLinkElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = crossOrigin)] #[doc = "Setter for the `crossOrigin` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn rel(this: &HtmlLinkElement) -> String; + pub fn rel(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = rel)] #[doc = "Setter for the `rel` field of this object."] #[doc = ""] @@ -82,7 +82,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn media(this: &HtmlLinkElement) -> String; + pub fn media(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = media)] #[doc = "Setter for the `media` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/hreflang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn hreflang(this: &HtmlLinkElement) -> String; + pub fn hreflang(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = hreflang)] #[doc = "Setter for the `hreflang` field of this object."] #[doc = ""] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn type_(this: &HtmlLinkElement) -> String; + pub fn type_(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -124,7 +124,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn referrer_policy(this: &HtmlLinkElement) -> String; + pub fn referrer_policy(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -146,7 +146,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/charset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn charset(this: &HtmlLinkElement) -> String; + pub fn charset(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = charset)] #[doc = "Setter for the `charset` field of this object."] #[doc = ""] @@ -160,7 +160,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rev)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn rev(this: &HtmlLinkElement) -> String; + pub fn rev(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = rev)] #[doc = "Setter for the `rev` field of this object."] #[doc = ""] @@ -174,7 +174,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn target(this: &HtmlLinkElement) -> String; + pub fn target(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = target)] #[doc = "Setter for the `target` field of this object."] #[doc = ""] @@ -188,7 +188,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/integrity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn integrity(this: &HtmlLinkElement) -> String; + pub fn integrity(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = integrity)] #[doc = "Setter for the `integrity` field of this object."] #[doc = ""] @@ -202,7 +202,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/as)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlLinkElement`*"] - pub fn as_(this: &HtmlLinkElement) -> String; + pub fn as_(this: &HtmlLinkElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLLinkElement" , js_name = as)] #[doc = "Setter for the `as` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlMapElement.rs b/crates/web-sys/src/features/gen_HtmlMapElement.rs index f1bf0950966..ce5b76b0a92 100644 --- a/crates/web-sys/src/features/gen_HtmlMapElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMapElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMapElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMapElement`*"] - pub fn name(this: &HtmlMapElement) -> String; + pub fn name(this: &HtmlMapElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMapElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlMediaElement.rs b/crates/web-sys/src/features/gen_HtmlMediaElement.rs index 51746c49fe4..c4558a13a48 100644 --- a/crates/web-sys/src/features/gen_HtmlMediaElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMediaElement.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`*"] - pub fn src(this: &HtmlMediaElement) -> String; + pub fn src(this: &HtmlMediaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMediaElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentSrc)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`*"] - pub fn current_src(this: &HtmlMediaElement) -> String; + pub fn current_src(this: &HtmlMediaElement) -> ::alloc::string::String; #[cfg(feature = "MediaStream")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLMediaElement" , js_name = srcObject)] #[doc = "Getter for the `srcObject` field of this object."] @@ -63,7 +63,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/crossOrigin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`*"] - pub fn cross_origin(this: &HtmlMediaElement) -> Option; + pub fn cross_origin(this: &HtmlMediaElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMediaElement" , js_name = crossOrigin)] #[doc = "Setter for the `crossOrigin` field of this object."] #[doc = ""] @@ -84,7 +84,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/preload)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`*"] - pub fn preload(this: &HtmlMediaElement) -> String; + pub fn preload(this: &HtmlMediaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMediaElement" , js_name = preload)] #[doc = "Setter for the `preload` field of this object."] #[doc = ""] @@ -376,7 +376,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMediaElement`*"] - pub fn can_play_type(this: &HtmlMediaElement, type_: &str) -> String; + pub fn can_play_type(this: &HtmlMediaElement, type_: &str) -> ::alloc::string::String; # [wasm_bindgen (catch , method , structural , js_class = "HTMLMediaElement" , js_name = fastSeek)] #[doc = "The `fastSeek()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlMenuElement.rs b/crates/web-sys/src/features/gen_HtmlMenuElement.rs index 083cdf453cd..983feb8c13c 100644 --- a/crates/web-sys/src/features/gen_HtmlMenuElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMenuElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuElement`*"] - pub fn type_(this: &HtmlMenuElement) -> String; + pub fn type_(this: &HtmlMenuElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuElement`*"] - pub fn label(this: &HtmlMenuElement) -> String; + pub fn label(this: &HtmlMenuElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs b/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs index e4d713f353a..6f98ed6b2e7 100644 --- a/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMenuItemElement.rs @@ -20,7 +20,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] #[deprecated(note = "Absent in all major browsers")] - pub fn type_(this: &HtmlMenuItemElement) -> String; + pub fn type_(this: &HtmlMenuItemElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] #[deprecated(note = "Absent in all major browsers")] - pub fn label(this: &HtmlMenuItemElement) -> String; + pub fn label(this: &HtmlMenuItemElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] @@ -52,7 +52,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] #[deprecated(note = "Absent in all major browsers")] - pub fn icon(this: &HtmlMenuItemElement) -> String; + pub fn icon(this: &HtmlMenuItemElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = icon)] #[doc = "Setter for the `icon` field of this object."] #[doc = ""] @@ -100,7 +100,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"] #[deprecated(note = "Absent in all major browsers")] - pub fn radiogroup(this: &HtmlMenuItemElement) -> String; + pub fn radiogroup(this: &HtmlMenuItemElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = radiogroup)] #[doc = "Setter for the `radiogroup` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlMetaElement.rs b/crates/web-sys/src/features/gen_HtmlMetaElement.rs index db16bee0f69..d11561d4ea9 100644 --- a/crates/web-sys/src/features/gen_HtmlMetaElement.rs +++ b/crates/web-sys/src/features/gen_HtmlMetaElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMetaElement`*"] - pub fn name(this: &HtmlMetaElement) -> String; + pub fn name(this: &HtmlMetaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMetaElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement/httpEquiv)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMetaElement`*"] - pub fn http_equiv(this: &HtmlMetaElement) -> String; + pub fn http_equiv(this: &HtmlMetaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMetaElement" , js_name = httpEquiv)] #[doc = "Setter for the `httpEquiv` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement/content)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMetaElement`*"] - pub fn content(this: &HtmlMetaElement) -> String; + pub fn content(this: &HtmlMetaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMetaElement" , js_name = content)] #[doc = "Setter for the `content` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement/scheme)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlMetaElement`*"] - pub fn scheme(this: &HtmlMetaElement) -> String; + pub fn scheme(this: &HtmlMetaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLMetaElement" , js_name = scheme)] #[doc = "Setter for the `scheme` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlModElement.rs b/crates/web-sys/src/features/gen_HtmlModElement.rs index e47d87a7bbd..07de5ebb2ca 100644 --- a/crates/web-sys/src/features/gen_HtmlModElement.rs +++ b/crates/web-sys/src/features/gen_HtmlModElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLModElement/cite)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlModElement`*"] - pub fn cite(this: &HtmlModElement) -> String; + pub fn cite(this: &HtmlModElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLModElement" , js_name = cite)] #[doc = "Setter for the `cite` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLModElement/dateTime)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlModElement`*"] - pub fn date_time(this: &HtmlModElement) -> String; + pub fn date_time(this: &HtmlModElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLModElement" , js_name = dateTime)] #[doc = "Setter for the `dateTime` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlOListElement.rs b/crates/web-sys/src/features/gen_HtmlOListElement.rs index 380f753c832..a4c50da984e 100644 --- a/crates/web-sys/src/features/gen_HtmlOListElement.rs +++ b/crates/web-sys/src/features/gen_HtmlOListElement.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOListElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOListElement`*"] - pub fn type_(this: &HtmlOListElement) -> String; + pub fn type_(this: &HtmlOListElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOListElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlObjectElement.rs b/crates/web-sys/src/features/gen_HtmlObjectElement.rs index bc5dfbd9c2f..1f14bea4bed 100644 --- a/crates/web-sys/src/features/gen_HtmlObjectElement.rs +++ b/crates/web-sys/src/features/gen_HtmlObjectElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn data(this: &HtmlObjectElement) -> String; + pub fn data(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = data)] #[doc = "Setter for the `data` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn type_(this: &HtmlObjectElement) -> String; + pub fn type_(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn name(this: &HtmlObjectElement) -> String; + pub fn name(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/useMap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn use_map(this: &HtmlObjectElement) -> String; + pub fn use_map(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = useMap)] #[doc = "Setter for the `useMap` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn width(this: &HtmlObjectElement) -> String; + pub fn width(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/height)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn height(this: &HtmlObjectElement) -> String; + pub fn height(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = height)] #[doc = "Setter for the `height` field of this object."] #[doc = ""] @@ -155,14 +155,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn validation_message(this: &HtmlObjectElement) -> Result; + pub fn validation_message(this: &HtmlObjectElement) + -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "HTMLObjectElement" , js_name = align)] #[doc = "Getter for the `align` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn align(this: &HtmlObjectElement) -> String; + pub fn align(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -176,7 +177,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/archive)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn archive(this: &HtmlObjectElement) -> String; + pub fn archive(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = archive)] #[doc = "Setter for the `archive` field of this object."] #[doc = ""] @@ -190,7 +191,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/code)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn code(this: &HtmlObjectElement) -> String; + pub fn code(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = code)] #[doc = "Setter for the `code` field of this object."] #[doc = ""] @@ -232,7 +233,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/standby)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn standby(this: &HtmlObjectElement) -> String; + pub fn standby(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = standby)] #[doc = "Setter for the `standby` field of this object."] #[doc = ""] @@ -260,7 +261,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/codeBase)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn code_base(this: &HtmlObjectElement) -> String; + pub fn code_base(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = codeBase)] #[doc = "Setter for the `codeBase` field of this object."] #[doc = ""] @@ -274,7 +275,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/codeType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn code_type(this: &HtmlObjectElement) -> String; + pub fn code_type(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = codeType)] #[doc = "Setter for the `codeType` field of this object."] #[doc = ""] @@ -288,7 +289,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/border)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlObjectElement`*"] - pub fn border(this: &HtmlObjectElement) -> String; + pub fn border(this: &HtmlObjectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLObjectElement" , js_name = border)] #[doc = "Setter for the `border` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlOptGroupElement.rs b/crates/web-sys/src/features/gen_HtmlOptGroupElement.rs index 0f90bd36dbb..025d700f59d 100644 --- a/crates/web-sys/src/features/gen_HtmlOptGroupElement.rs +++ b/crates/web-sys/src/features/gen_HtmlOptGroupElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptGroupElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOptGroupElement`*"] - pub fn label(this: &HtmlOptGroupElement) -> String; + pub fn label(this: &HtmlOptGroupElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOptGroupElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlOptionElement.rs b/crates/web-sys/src/features/gen_HtmlOptionElement.rs index d87adc273cb..68b864ef567 100644 --- a/crates/web-sys/src/features/gen_HtmlOptionElement.rs +++ b/crates/web-sys/src/features/gen_HtmlOptionElement.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOptionElement`*"] - pub fn label(this: &HtmlOptionElement) -> String; + pub fn label(this: &HtmlOptionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOptionElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] @@ -82,7 +82,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOptionElement`*"] - pub fn value(this: &HtmlOptionElement) -> String; + pub fn value(this: &HtmlOptionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOptionElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOptionElement`*"] - pub fn text(this: &HtmlOptionElement) -> String; + pub fn text(this: &HtmlOptionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOptionElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlOutputElement.rs b/crates/web-sys/src/features/gen_HtmlOutputElement.rs index 90f162967cd..4e26e222ec9 100644 --- a/crates/web-sys/src/features/gen_HtmlOutputElement.rs +++ b/crates/web-sys/src/features/gen_HtmlOutputElement.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOutputElement`*"] - pub fn name(this: &HtmlOutputElement) -> String; + pub fn name(this: &HtmlOutputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOutputElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -48,14 +48,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOutputElement`*"] - pub fn type_(this: &HtmlOutputElement) -> String; + pub fn type_(this: &HtmlOutputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "HTMLOutputElement" , js_name = defaultValue)] #[doc = "Getter for the `defaultValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/defaultValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOutputElement`*"] - pub fn default_value(this: &HtmlOutputElement) -> String; + pub fn default_value(this: &HtmlOutputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOutputElement" , js_name = defaultValue)] #[doc = "Setter for the `defaultValue` field of this object."] #[doc = ""] @@ -69,7 +69,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOutputElement`*"] - pub fn value(this: &HtmlOutputElement) -> String; + pub fn value(this: &HtmlOutputElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLOutputElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -98,7 +98,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlOutputElement`*"] - pub fn validation_message(this: &HtmlOutputElement) -> Result; + pub fn validation_message(this: &HtmlOutputElement) + -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "NodeList")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLOutputElement" , js_name = labels)] #[doc = "Getter for the `labels` field of this object."] diff --git a/crates/web-sys/src/features/gen_HtmlParagraphElement.rs b/crates/web-sys/src/features/gen_HtmlParagraphElement.rs index 25f7c050106..905e8735b01 100644 --- a/crates/web-sys/src/features/gen_HtmlParagraphElement.rs +++ b/crates/web-sys/src/features/gen_HtmlParagraphElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLParagraphElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlParagraphElement`*"] - pub fn align(this: &HtmlParagraphElement) -> String; + pub fn align(this: &HtmlParagraphElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLParagraphElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlParamElement.rs b/crates/web-sys/src/features/gen_HtmlParamElement.rs index 00cee244ff2..88d3136bfc8 100644 --- a/crates/web-sys/src/features/gen_HtmlParamElement.rs +++ b/crates/web-sys/src/features/gen_HtmlParamElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLParamElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlParamElement`*"] - pub fn name(this: &HtmlParamElement) -> String; + pub fn name(this: &HtmlParamElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLParamElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLParamElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlParamElement`*"] - pub fn value(this: &HtmlParamElement) -> String; + pub fn value(this: &HtmlParamElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLParamElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLParamElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlParamElement`*"] - pub fn type_(this: &HtmlParamElement) -> String; + pub fn type_(this: &HtmlParamElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLParamElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLParamElement/valueType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlParamElement`*"] - pub fn value_type(this: &HtmlParamElement) -> String; + pub fn value_type(this: &HtmlParamElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLParamElement" , js_name = valueType)] #[doc = "Setter for the `valueType` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlQuoteElement.rs b/crates/web-sys/src/features/gen_HtmlQuoteElement.rs index 723bc2582b4..3e21831ee83 100644 --- a/crates/web-sys/src/features/gen_HtmlQuoteElement.rs +++ b/crates/web-sys/src/features/gen_HtmlQuoteElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLQuoteElement/cite)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlQuoteElement`*"] - pub fn cite(this: &HtmlQuoteElement) -> String; + pub fn cite(this: &HtmlQuoteElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLQuoteElement" , js_name = cite)] #[doc = "Setter for the `cite` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlScriptElement.rs b/crates/web-sys/src/features/gen_HtmlScriptElement.rs index ce910c24194..d044c1ea6c0 100644 --- a/crates/web-sys/src/features/gen_HtmlScriptElement.rs +++ b/crates/web-sys/src/features/gen_HtmlScriptElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn src(this: &HtmlScriptElement) -> String; + pub fn src(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn type_(this: &HtmlScriptElement) -> String; + pub fn type_(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/charset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn charset(this: &HtmlScriptElement) -> String; + pub fn charset(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = charset)] #[doc = "Setter for the `charset` field of this object."] #[doc = ""] @@ -102,7 +102,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/crossOrigin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn cross_origin(this: &HtmlScriptElement) -> Option; + pub fn cross_origin(this: &HtmlScriptElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = crossOrigin)] #[doc = "Setter for the `crossOrigin` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn text(this: &HtmlScriptElement) -> Result; + pub fn text(this: &HtmlScriptElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLScriptElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/event)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn event(this: &HtmlScriptElement) -> String; + pub fn event(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = event)] #[doc = "Setter for the `event` field of this object."] #[doc = ""] @@ -144,7 +144,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/htmlFor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn html_for(this: &HtmlScriptElement) -> String; + pub fn html_for(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = htmlFor)] #[doc = "Setter for the `htmlFor` field of this object."] #[doc = ""] @@ -158,7 +158,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/integrity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlScriptElement`*"] - pub fn integrity(this: &HtmlScriptElement) -> String; + pub fn integrity(this: &HtmlScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLScriptElement" , js_name = integrity)] #[doc = "Setter for the `integrity` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlSelectElement.rs b/crates/web-sys/src/features/gen_HtmlSelectElement.rs index 0cac37fcf46..67d30eb6e72 100644 --- a/crates/web-sys/src/features/gen_HtmlSelectElement.rs +++ b/crates/web-sys/src/features/gen_HtmlSelectElement.rs @@ -38,7 +38,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/autocomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] - pub fn autocomplete(this: &HtmlSelectElement) -> String; + pub fn autocomplete(this: &HtmlSelectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSelectElement" , js_name = autocomplete)] #[doc = "Setter for the `autocomplete` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] - pub fn name(this: &HtmlSelectElement) -> String; + pub fn name(this: &HtmlSelectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSelectElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] - pub fn type_(this: &HtmlSelectElement) -> String; + pub fn type_(this: &HtmlSelectElement) -> ::alloc::string::String; #[cfg(feature = "HtmlOptionsCollection")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLSelectElement" , js_name = options)] #[doc = "Getter for the `options` field of this object."] @@ -181,7 +181,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] - pub fn value(this: &HtmlSelectElement) -> String; + pub fn value(this: &HtmlSelectElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSelectElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -210,7 +210,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSelectElement`*"] - pub fn validation_message(this: &HtmlSelectElement) -> Result; + pub fn validation_message(this: &HtmlSelectElement) + -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "NodeList")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLSelectElement" , js_name = labels)] #[doc = "Getter for the `labels` field of this object."] diff --git a/crates/web-sys/src/features/gen_HtmlSlotElement.rs b/crates/web-sys/src/features/gen_HtmlSlotElement.rs index 04b96da24fd..2924e7be8b9 100644 --- a/crates/web-sys/src/features/gen_HtmlSlotElement.rs +++ b/crates/web-sys/src/features/gen_HtmlSlotElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSlotElement`*"] - pub fn name(this: &HtmlSlotElement) -> String; + pub fn name(this: &HtmlSlotElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSlotElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlSourceElement.rs b/crates/web-sys/src/features/gen_HtmlSourceElement.rs index 8fb7dee9dea..b37d1d14719 100644 --- a/crates/web-sys/src/features/gen_HtmlSourceElement.rs +++ b/crates/web-sys/src/features/gen_HtmlSourceElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSourceElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSourceElement`*"] - pub fn src(this: &HtmlSourceElement) -> String; + pub fn src(this: &HtmlSourceElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSourceElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSourceElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSourceElement`*"] - pub fn type_(this: &HtmlSourceElement) -> String; + pub fn type_(this: &HtmlSourceElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSourceElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSourceElement/srcset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSourceElement`*"] - pub fn srcset(this: &HtmlSourceElement) -> String; + pub fn srcset(this: &HtmlSourceElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSourceElement" , js_name = srcset)] #[doc = "Setter for the `srcset` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSourceElement/sizes)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSourceElement`*"] - pub fn sizes(this: &HtmlSourceElement) -> String; + pub fn sizes(this: &HtmlSourceElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSourceElement" , js_name = sizes)] #[doc = "Setter for the `sizes` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSourceElement/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlSourceElement`*"] - pub fn media(this: &HtmlSourceElement) -> String; + pub fn media(this: &HtmlSourceElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLSourceElement" , js_name = media)] #[doc = "Setter for the `media` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlStyleElement.rs b/crates/web-sys/src/features/gen_HtmlStyleElement.rs index e7ca11f0d9e..57530860a64 100644 --- a/crates/web-sys/src/features/gen_HtmlStyleElement.rs +++ b/crates/web-sys/src/features/gen_HtmlStyleElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlStyleElement`*"] - pub fn media(this: &HtmlStyleElement) -> String; + pub fn media(this: &HtmlStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLStyleElement" , js_name = media)] #[doc = "Setter for the `media` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLStyleElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlStyleElement`*"] - pub fn type_(this: &HtmlStyleElement) -> String; + pub fn type_(this: &HtmlStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLStyleElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableCaptionElement.rs b/crates/web-sys/src/features/gen_HtmlTableCaptionElement.rs index 7a19986f7ee..d6eef313db1 100644 --- a/crates/web-sys/src/features/gen_HtmlTableCaptionElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableCaptionElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCaptionElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCaptionElement`*"] - pub fn align(this: &HtmlTableCaptionElement) -> String; + pub fn align(this: &HtmlTableCaptionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCaptionElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableCellElement.rs b/crates/web-sys/src/features/gen_HtmlTableCellElement.rs index 9a4f0556e1d..a1c998d5599 100644 --- a/crates/web-sys/src/features/gen_HtmlTableCellElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableCellElement.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/headers)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn headers(this: &HtmlTableCellElement) -> String; + pub fn headers(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = headers)] #[doc = "Setter for the `headers` field of this object."] #[doc = ""] @@ -67,7 +67,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/abbr)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn abbr(this: &HtmlTableCellElement) -> String; + pub fn abbr(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = abbr)] #[doc = "Setter for the `abbr` field of this object."] #[doc = ""] @@ -81,7 +81,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/scope)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn scope(this: &HtmlTableCellElement) -> String; + pub fn scope(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = scope)] #[doc = "Setter for the `scope` field of this object."] #[doc = ""] @@ -95,7 +95,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn align(this: &HtmlTableCellElement) -> String; + pub fn align(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -109,7 +109,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/axis)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn axis(this: &HtmlTableCellElement) -> String; + pub fn axis(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = axis)] #[doc = "Setter for the `axis` field of this object."] #[doc = ""] @@ -123,7 +123,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/height)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn height(this: &HtmlTableCellElement) -> String; + pub fn height(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = height)] #[doc = "Setter for the `height` field of this object."] #[doc = ""] @@ -137,7 +137,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn width(this: &HtmlTableCellElement) -> String; + pub fn width(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] @@ -151,7 +151,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/ch)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn ch(this: &HtmlTableCellElement) -> String; + pub fn ch(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = ch)] #[doc = "Setter for the `ch` field of this object."] #[doc = ""] @@ -165,7 +165,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/chOff)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn ch_off(this: &HtmlTableCellElement) -> String; + pub fn ch_off(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = chOff)] #[doc = "Setter for the `chOff` field of this object."] #[doc = ""] @@ -193,7 +193,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/vAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn v_align(this: &HtmlTableCellElement) -> String; + pub fn v_align(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = vAlign)] #[doc = "Setter for the `vAlign` field of this object."] #[doc = ""] @@ -207,7 +207,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/bgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableCellElement`*"] - pub fn bg_color(this: &HtmlTableCellElement) -> String; + pub fn bg_color(this: &HtmlTableCellElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableCellElement" , js_name = bgColor)] #[doc = "Setter for the `bgColor` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableColElement.rs b/crates/web-sys/src/features/gen_HtmlTableColElement.rs index 91febc5a80b..0319ad7aef0 100644 --- a/crates/web-sys/src/features/gen_HtmlTableColElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableColElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableColElement`*"] - pub fn align(this: &HtmlTableColElement) -> String; + pub fn align(this: &HtmlTableColElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableColElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement/ch)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableColElement`*"] - pub fn ch(this: &HtmlTableColElement) -> String; + pub fn ch(this: &HtmlTableColElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableColElement" , js_name = ch)] #[doc = "Setter for the `ch` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement/chOff)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableColElement`*"] - pub fn ch_off(this: &HtmlTableColElement) -> String; + pub fn ch_off(this: &HtmlTableColElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableColElement" , js_name = chOff)] #[doc = "Setter for the `chOff` field of this object."] #[doc = ""] @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement/vAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableColElement`*"] - pub fn v_align(this: &HtmlTableColElement) -> String; + pub fn v_align(this: &HtmlTableColElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableColElement" , js_name = vAlign)] #[doc = "Setter for the `vAlign` field of this object."] #[doc = ""] @@ -88,7 +88,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableColElement`*"] - pub fn width(this: &HtmlTableColElement) -> String; + pub fn width(this: &HtmlTableColElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableColElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableElement.rs b/crates/web-sys/src/features/gen_HtmlTableElement.rs index 2a63f76da97..4f05718b8a4 100644 --- a/crates/web-sys/src/features/gen_HtmlTableElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableElement.rs @@ -82,7 +82,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn align(this: &HtmlTableElement) -> String; + pub fn align(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/border)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn border(this: &HtmlTableElement) -> String; + pub fn border(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = border)] #[doc = "Setter for the `border` field of this object."] #[doc = ""] @@ -110,7 +110,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/frame)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn frame(this: &HtmlTableElement) -> String; + pub fn frame(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = frame)] #[doc = "Setter for the `frame` field of this object."] #[doc = ""] @@ -124,7 +124,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/rules)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn rules(this: &HtmlTableElement) -> String; + pub fn rules(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = rules)] #[doc = "Setter for the `rules` field of this object."] #[doc = ""] @@ -138,7 +138,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/summary)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn summary(this: &HtmlTableElement) -> String; + pub fn summary(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = summary)] #[doc = "Setter for the `summary` field of this object."] #[doc = ""] @@ -152,7 +152,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/width)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn width(this: &HtmlTableElement) -> String; + pub fn width(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = width)] #[doc = "Setter for the `width` field of this object."] #[doc = ""] @@ -166,7 +166,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/bgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn bg_color(this: &HtmlTableElement) -> String; + pub fn bg_color(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = bgColor)] #[doc = "Setter for the `bgColor` field of this object."] #[doc = ""] @@ -180,7 +180,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellPadding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn cell_padding(this: &HtmlTableElement) -> String; + pub fn cell_padding(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = cellPadding)] #[doc = "Setter for the `cellPadding` field of this object."] #[doc = ""] @@ -194,7 +194,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellSpacing)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableElement`*"] - pub fn cell_spacing(this: &HtmlTableElement) -> String; + pub fn cell_spacing(this: &HtmlTableElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableElement" , js_name = cellSpacing)] #[doc = "Setter for the `cellSpacing` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableRowElement.rs b/crates/web-sys/src/features/gen_HtmlTableRowElement.rs index 287cdcc53e7..71124635d98 100644 --- a/crates/web-sys/src/features/gen_HtmlTableRowElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableRowElement.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableRowElement`*"] - pub fn align(this: &HtmlTableRowElement) -> String; + pub fn align(this: &HtmlTableRowElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableRowElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -54,7 +54,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/ch)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableRowElement`*"] - pub fn ch(this: &HtmlTableRowElement) -> String; + pub fn ch(this: &HtmlTableRowElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableRowElement" , js_name = ch)] #[doc = "Setter for the `ch` field of this object."] #[doc = ""] @@ -68,7 +68,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/chOff)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableRowElement`*"] - pub fn ch_off(this: &HtmlTableRowElement) -> String; + pub fn ch_off(this: &HtmlTableRowElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableRowElement" , js_name = chOff)] #[doc = "Setter for the `chOff` field of this object."] #[doc = ""] @@ -82,7 +82,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/vAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableRowElement`*"] - pub fn v_align(this: &HtmlTableRowElement) -> String; + pub fn v_align(this: &HtmlTableRowElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableRowElement" , js_name = vAlign)] #[doc = "Setter for the `vAlign` field of this object."] #[doc = ""] @@ -96,7 +96,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/bgColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableRowElement`*"] - pub fn bg_color(this: &HtmlTableRowElement) -> String; + pub fn bg_color(this: &HtmlTableRowElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableRowElement" , js_name = bgColor)] #[doc = "Setter for the `bgColor` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTableSectionElement.rs b/crates/web-sys/src/features/gen_HtmlTableSectionElement.rs index ee7cfa136c6..1c820e814a5 100644 --- a/crates/web-sys/src/features/gen_HtmlTableSectionElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTableSectionElement.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableSectionElement/align)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableSectionElement`*"] - pub fn align(this: &HtmlTableSectionElement) -> String; + pub fn align(this: &HtmlTableSectionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableSectionElement" , js_name = align)] #[doc = "Setter for the `align` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableSectionElement/ch)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableSectionElement`*"] - pub fn ch(this: &HtmlTableSectionElement) -> String; + pub fn ch(this: &HtmlTableSectionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableSectionElement" , js_name = ch)] #[doc = "Setter for the `ch` field of this object."] #[doc = ""] @@ -54,7 +54,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableSectionElement/chOff)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableSectionElement`*"] - pub fn ch_off(this: &HtmlTableSectionElement) -> String; + pub fn ch_off(this: &HtmlTableSectionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableSectionElement" , js_name = chOff)] #[doc = "Setter for the `chOff` field of this object."] #[doc = ""] @@ -68,7 +68,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableSectionElement/vAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTableSectionElement`*"] - pub fn v_align(this: &HtmlTableSectionElement) -> String; + pub fn v_align(this: &HtmlTableSectionElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTableSectionElement" , js_name = vAlign)] #[doc = "Setter for the `vAlign` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs b/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs index 3192dda1955..d954e7887b3 100644 --- a/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTextAreaElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/autocomplete)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn autocomplete(this: &HtmlTextAreaElement) -> String; + pub fn autocomplete(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = autocomplete)] #[doc = "Setter for the `autocomplete` field of this object."] #[doc = ""] @@ -116,7 +116,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn name(this: &HtmlTextAreaElement) -> String; + pub fn name(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/placeholder)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn placeholder(this: &HtmlTextAreaElement) -> String; + pub fn placeholder(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = placeholder)] #[doc = "Setter for the `placeholder` field of this object."] #[doc = ""] @@ -186,7 +186,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/wrap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn wrap(this: &HtmlTextAreaElement) -> String; + pub fn wrap(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = wrap)] #[doc = "Setter for the `wrap` field of this object."] #[doc = ""] @@ -200,14 +200,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn type_(this: &HtmlTextAreaElement) -> String; + pub fn type_(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "HTMLTextAreaElement" , js_name = defaultValue)] #[doc = "Getter for the `defaultValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/defaultValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn default_value(this: &HtmlTextAreaElement) -> Result; + pub fn default_value(this: &HtmlTextAreaElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLTextAreaElement" , js_name = defaultValue)] #[doc = "Setter for the `defaultValue` field of this object."] #[doc = ""] @@ -221,7 +221,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn value(this: &HtmlTextAreaElement) -> String; + pub fn value(this: &HtmlTextAreaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTextAreaElement" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] @@ -257,7 +257,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/validationMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn validation_message(this: &HtmlTextAreaElement) -> Result; + pub fn validation_message( + this: &HtmlTextAreaElement, + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "NodeList")] # [wasm_bindgen (structural , method , getter , js_class = "HTMLTextAreaElement" , js_name = labels)] #[doc = "Getter for the `labels` field of this object."] @@ -304,7 +306,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement/selectionDirection)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTextAreaElement`*"] - pub fn selection_direction(this: &HtmlTextAreaElement) -> Result, JsValue>; + pub fn selection_direction( + this: &HtmlTextAreaElement, + ) -> Result, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLTextAreaElement" , js_name = selectionDirection)] #[doc = "Setter for the `selectionDirection` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTimeElement.rs b/crates/web-sys/src/features/gen_HtmlTimeElement.rs index bb83d28e15f..fdf149a9c5a 100644 --- a/crates/web-sys/src/features/gen_HtmlTimeElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTimeElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTimeElement`*"] - pub fn date_time(this: &HtmlTimeElement) -> String; + pub fn date_time(this: &HtmlTimeElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTimeElement" , js_name = dateTime)] #[doc = "Setter for the `dateTime` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTitleElement.rs b/crates/web-sys/src/features/gen_HtmlTitleElement.rs index 5d515078e50..93c7797da4c 100644 --- a/crates/web-sys/src/features/gen_HtmlTitleElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTitleElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTitleElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTitleElement`*"] - pub fn text(this: &HtmlTitleElement) -> Result; + pub fn text(this: &HtmlTitleElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLTitleElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlTrackElement.rs b/crates/web-sys/src/features/gen_HtmlTrackElement.rs index 0d388db953c..f61b159b8ca 100644 --- a/crates/web-sys/src/features/gen_HtmlTrackElement.rs +++ b/crates/web-sys/src/features/gen_HtmlTrackElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement/kind)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTrackElement`*"] - pub fn kind(this: &HtmlTrackElement) -> String; + pub fn kind(this: &HtmlTrackElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTrackElement" , js_name = kind)] #[doc = "Setter for the `kind` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTrackElement`*"] - pub fn src(this: &HtmlTrackElement) -> String; + pub fn src(this: &HtmlTrackElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTrackElement" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement/srclang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTrackElement`*"] - pub fn srclang(this: &HtmlTrackElement) -> String; + pub fn srclang(this: &HtmlTrackElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTrackElement" , js_name = srclang)] #[doc = "Setter for the `srclang` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlTrackElement`*"] - pub fn label(this: &HtmlTrackElement) -> String; + pub fn label(this: &HtmlTrackElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLTrackElement" , js_name = label)] #[doc = "Setter for the `label` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlUListElement.rs b/crates/web-sys/src/features/gen_HtmlUListElement.rs index aae4b944ae8..7aa4b93ae66 100644 --- a/crates/web-sys/src/features/gen_HtmlUListElement.rs +++ b/crates/web-sys/src/features/gen_HtmlUListElement.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLUListElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlUListElement`*"] - pub fn type_(this: &HtmlUListElement) -> String; + pub fn type_(this: &HtmlUListElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLUListElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HtmlVideoElement.rs b/crates/web-sys/src/features/gen_HtmlVideoElement.rs index c76989ab1b7..3aa5cf6e175 100644 --- a/crates/web-sys/src/features/gen_HtmlVideoElement.rs +++ b/crates/web-sys/src/features/gen_HtmlVideoElement.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/poster)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`*"] - pub fn poster(this: &HtmlVideoElement) -> String; + pub fn poster(this: &HtmlVideoElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "HTMLVideoElement" , js_name = poster)] #[doc = "Setter for the `poster` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_HttpConnInfo.rs b/crates/web-sys/src/features/gen_HttpConnInfo.rs index 21819e6a530..59d9539ce6a 100644 --- a/crates/web-sys/src/features/gen_HttpConnInfo.rs +++ b/crates/web-sys/src/features/gen_HttpConnInfo.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] #[wasm_bindgen(method, getter = "protocolVersion")] - pub fn get_protocol_version(this: &HttpConnInfo) -> Option; + pub fn get_protocol_version(this: &HttpConnInfo) -> Option<::alloc::string::String>; #[doc = "Change the `protocolVersion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnInfo`*"] diff --git a/crates/web-sys/src/features/gen_HttpConnectionElement.rs b/crates/web-sys/src/features/gen_HttpConnectionElement.rs index 8488fc9d2bc..c9efd25a24f 100644 --- a/crates/web-sys/src/features/gen_HttpConnectionElement.rs +++ b/crates/web-sys/src/features/gen_HttpConnectionElement.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] #[wasm_bindgen(method, getter = "host")] - pub fn get_host(this: &HttpConnectionElement) -> Option; + pub fn get_host(this: &HttpConnectionElement) -> Option<::alloc::string::String>; #[doc = "Change the `host` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HttpConnectionElement`*"] diff --git a/crates/web-sys/src/features/gen_IdbDatabase.rs b/crates/web-sys/src/features/gen_IdbDatabase.rs index d7cdae29364..b0460f925ad 100644 --- a/crates/web-sys/src/features/gen_IdbDatabase.rs +++ b/crates/web-sys/src/features/gen_IdbDatabase.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbDatabase`*"] - pub fn name(this: &IdbDatabase) -> String; + pub fn name(this: &IdbDatabase) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "IDBDatabase" , js_name = version)] #[doc = "Getter for the `version` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_IdbIndex.rs b/crates/web-sys/src/features/gen_IdbIndex.rs index 0a2eeebc174..f2689e4cbf2 100644 --- a/crates/web-sys/src/features/gen_IdbIndex.rs +++ b/crates/web-sys/src/features/gen_IdbIndex.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"] - pub fn name(this: &IdbIndex) -> String; + pub fn name(this: &IdbIndex) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "IDBIndex" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -62,7 +62,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"] #[deprecated] - pub fn locale(this: &IdbIndex) -> Option; + pub fn locale(this: &IdbIndex) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "IDBIndex" , js_name = isAutoLocale)] #[doc = "Getter for the `isAutoLocale` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_IdbIndexParameters.rs b/crates/web-sys/src/features/gen_IdbIndexParameters.rs index 87f7c4b228d..a505954bc37 100644 --- a/crates/web-sys/src/features/gen_IdbIndexParameters.rs +++ b/crates/web-sys/src/features/gen_IdbIndexParameters.rs @@ -15,7 +15,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] #[deprecated] #[wasm_bindgen(method, getter = "locale")] - pub fn get_locale(this: &IdbIndexParameters) -> Option; + pub fn get_locale(this: &IdbIndexParameters) -> Option<::alloc::string::String>; #[doc = "Change the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"] diff --git a/crates/web-sys/src/features/gen_IdbMutableFile.rs b/crates/web-sys/src/features/gen_IdbMutableFile.rs index cabc735391a..13a46d5ee34 100644 --- a/crates/web-sys/src/features/gen_IdbMutableFile.rs +++ b/crates/web-sys/src/features/gen_IdbMutableFile.rs @@ -20,7 +20,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] #[deprecated] - pub fn name(this: &IdbMutableFile) -> String; + pub fn name(this: &IdbMutableFile) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = type)] #[doc = "Getter for the `type` field of this object."] #[doc = ""] @@ -28,7 +28,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"] #[deprecated] - pub fn type_(this: &IdbMutableFile) -> String; + pub fn type_(this: &IdbMutableFile) -> ::alloc::string::String; #[cfg(feature = "IdbDatabase")] # [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = database)] #[doc = "Getter for the `database` field of this object."] diff --git a/crates/web-sys/src/features/gen_IdbObjectStore.rs b/crates/web-sys/src/features/gen_IdbObjectStore.rs index 3d3ab9609e6..cc48afb53e5 100644 --- a/crates/web-sys/src/features/gen_IdbObjectStore.rs +++ b/crates/web-sys/src/features/gen_IdbObjectStore.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`*"] - pub fn name(this: &IdbObjectStore) -> String; + pub fn name(this: &IdbObjectStore) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "IDBObjectStore" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ImageCaptureError.rs b/crates/web-sys/src/features/gen_ImageCaptureError.rs index 1147848898f..35877f2b025 100644 --- a/crates/web-sys/src/features/gen_ImageCaptureError.rs +++ b/crates/web-sys/src/features/gen_ImageCaptureError.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageCaptureError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageCaptureError`*"] - pub fn message(this: &ImageCaptureError) -> String; + pub fn message(this: &ImageCaptureError) -> ::alloc::string::String; } impl ImageCaptureError { #[doc = "The `ImageCaptureError.FRAME_GRAB_ERROR` const."] diff --git a/crates/web-sys/src/features/gen_ImageDecoder.rs b/crates/web-sys/src/features/gen_ImageDecoder.rs index a0ffcac1111..202451a030a 100644 --- a/crates/web-sys/src/features/gen_ImageDecoder.rs +++ b/crates/web-sys/src/features/gen_ImageDecoder.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn type_(this: &ImageDecoder) -> String; + pub fn type_(this: &ImageDecoder) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ImageDecoder" , js_name = complete)] #[doc = "Getter for the `complete` field of this object."] diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index af6e189d3a0..50dbd0d18c9 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -134,7 +134,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &ImageDecoderInit) -> String; + pub fn get_type(this: &ImageDecoderInit) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs index acc724aa9b9..943ba8fa089 100644 --- a/crates/web-sys/src/features/gen_ImageEncodeOptions.rs +++ b/crates/web-sys/src/features/gen_ImageEncodeOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &ImageEncodeOptions) -> Option; + pub fn get_type(this: &ImageEncodeOptions) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageEncodeOptions`*"] diff --git a/crates/web-sys/src/features/gen_InputEvent.rs b/crates/web-sys/src/features/gen_InputEvent.rs index dddf6af1303..82056476aca 100644 --- a/crates/web-sys/src/features/gen_InputEvent.rs +++ b/crates/web-sys/src/features/gen_InputEvent.rs @@ -25,14 +25,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/inputType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEvent`*"] - pub fn input_type(this: &InputEvent) -> String; + pub fn input_type(this: &InputEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "InputEvent" , js_name = data)] #[doc = "Getter for the `data` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEvent`*"] - pub fn data(this: &InputEvent) -> Option; + pub fn data(this: &InputEvent) -> Option<::alloc::string::String>; #[cfg(feature = "DataTransfer")] # [wasm_bindgen (structural , method , getter , js_class = "InputEvent" , js_name = dataTransfer)] #[doc = "Getter for the `dataTransfer` field of this object."] diff --git a/crates/web-sys/src/features/gen_InputEventInit.rs b/crates/web-sys/src/features/gen_InputEventInit.rs index 0c0423a1461..7ff44de646c 100644 --- a/crates/web-sys/src/features/gen_InputEventInit.rs +++ b/crates/web-sys/src/features/gen_InputEventInit.rs @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, getter = "data")] - pub fn get_data(this: &InputEventInit) -> Option; + pub fn get_data(this: &InputEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] @@ -88,7 +88,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] #[wasm_bindgen(method, getter = "inputType")] - pub fn get_input_type(this: &InputEventInit) -> Option; + pub fn get_input_type(this: &InputEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `inputType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `InputEventInit`*"] diff --git a/crates/web-sys/src/features/gen_IntersectionObserver.rs b/crates/web-sys/src/features/gen_IntersectionObserver.rs index 8cd9ae34abe..371e3d76b3b 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserver.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserver.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserver`*"] - pub fn root_margin(this: &IntersectionObserver) -> String; + pub fn root_margin(this: &IntersectionObserver) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "IntersectionObserver" , js_name = thresholds)] #[doc = "Getter for the `thresholds` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs index 115d8359ff6..d959f7e4e72 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverInit.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] #[wasm_bindgen(method, getter = "rootMargin")] - pub fn get_root_margin(this: &IntersectionObserverInit) -> Option; + pub fn get_root_margin(this: &IntersectionObserverInit) -> Option<::alloc::string::String>; #[doc = "Change the `rootMargin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `IntersectionObserverInit`*"] diff --git a/crates/web-sys/src/features/gen_JsonWebKey.rs b/crates/web-sys/src/features/gen_JsonWebKey.rs index 7969e461a34..c3ebdda3d67 100644 --- a/crates/web-sys/src/features/gen_JsonWebKey.rs +++ b/crates/web-sys/src/features/gen_JsonWebKey.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "alg")] - pub fn get_alg(this: &JsonWebKey) -> Option; + pub fn get_alg(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `alg` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "crv")] - pub fn get_crv(this: &JsonWebKey) -> Option; + pub fn get_crv(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `crv` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "d")] - pub fn get_d(this: &JsonWebKey) -> Option; + pub fn get_d(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `d` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "dp")] - pub fn get_dp(this: &JsonWebKey) -> Option; + pub fn get_dp(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `dp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "dq")] - pub fn get_dq(this: &JsonWebKey) -> Option; + pub fn get_dq(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `dq` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "e")] - pub fn get_e(this: &JsonWebKey) -> Option; + pub fn get_e(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `e` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "k")] - pub fn get_k(this: &JsonWebKey) -> Option; + pub fn get_k(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `k` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -104,7 +104,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "kty")] - pub fn get_kty(this: &JsonWebKey) -> String; + pub fn get_kty(this: &JsonWebKey) -> ::alloc::string::String; #[doc = "Change the `kty` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -114,7 +114,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "n")] - pub fn get_n(this: &JsonWebKey) -> Option; + pub fn get_n(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `n` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -134,7 +134,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "p")] - pub fn get_p(this: &JsonWebKey) -> Option; + pub fn get_p(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `p` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -144,7 +144,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "q")] - pub fn get_q(this: &JsonWebKey) -> Option; + pub fn get_q(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `q` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -154,7 +154,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "qi")] - pub fn get_qi(this: &JsonWebKey) -> Option; + pub fn get_qi(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `qi` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -164,7 +164,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "use")] - pub fn get_use(this: &JsonWebKey) -> Option; + pub fn get_use(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `use` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -174,7 +174,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "x")] - pub fn get_x(this: &JsonWebKey) -> Option; + pub fn get_x(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `x` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] @@ -184,7 +184,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] #[wasm_bindgen(method, getter = "y")] - pub fn get_y(this: &JsonWebKey) -> Option; + pub fn get_y(this: &JsonWebKey) -> Option<::alloc::string::String>; #[doc = "Change the `y` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `JsonWebKey`*"] diff --git a/crates/web-sys/src/features/gen_KeyAlgorithm.rs b/crates/web-sys/src/features/gen_KeyAlgorithm.rs index d7523f2da73..b68a4801f8f 100644 --- a/crates/web-sys/src/features/gen_KeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_KeyAlgorithm.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &KeyAlgorithm) -> String; + pub fn get_name(this: &KeyAlgorithm) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyAlgorithm`*"] diff --git a/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs b/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs index 537a35063ac..17595b6c55b 100644 --- a/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs +++ b/crates/web-sys/src/features/gen_KeyFrameRequestEvent.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn rid(this: &KeyFrameRequestEvent) -> Option; + pub fn rid(this: &KeyFrameRequestEvent) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "KeyFrameRequestEvent")] #[doc = "The `new KeyFrameRequestEvent(..)` constructor, creating a new instance of `KeyFrameRequestEvent`."] diff --git a/crates/web-sys/src/features/gen_KeyboardEvent.rs b/crates/web-sys/src/features/gen_KeyboardEvent.rs index fbd20821366..fafaffc0c9b 100644 --- a/crates/web-sys/src/features/gen_KeyboardEvent.rs +++ b/crates/web-sys/src/features/gen_KeyboardEvent.rs @@ -81,14 +81,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"] - pub fn key(this: &KeyboardEvent) -> String; + pub fn key(this: &KeyboardEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = code)] #[doc = "Getter for the `code` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"] - pub fn code(this: &KeyboardEvent) -> String; + pub fn code(this: &KeyboardEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "KeyboardEvent")] #[doc = "The `new KeyboardEvent(..)` constructor, creating a new instance of `KeyboardEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_KeyboardEventInit.rs b/crates/web-sys/src/features/gen_KeyboardEventInit.rs index a7701695929..6321debf9ab 100644 --- a/crates/web-sys/src/features/gen_KeyboardEventInit.rs +++ b/crates/web-sys/src/features/gen_KeyboardEventInit.rs @@ -206,7 +206,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, getter = "code")] - pub fn get_code(this: &KeyboardEventInit) -> Option; + pub fn get_code(this: &KeyboardEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `code` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] @@ -226,7 +226,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] #[wasm_bindgen(method, getter = "key")] - pub fn get_key(this: &KeyboardEventInit) -> Option; + pub fn get_key(this: &KeyboardEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"] diff --git a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs index 8777d27a77b..17a15a0c694 100644 --- a/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeAnimationOptions.rs @@ -78,7 +78,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &KeyframeAnimationOptions) -> Option; + pub fn get_easing(this: &KeyframeAnimationOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `easing` field of this object."] #[doc = ""] @@ -215,7 +215,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &KeyframeAnimationOptions) -> Option; + pub fn get_id(this: &KeyframeAnimationOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs index 4424b0391e4..2d16182a56d 100644 --- a/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs +++ b/crates/web-sys/src/features/gen_KeyframeEffectOptions.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &KeyframeEffectOptions) -> Option; + pub fn get_easing(this: &KeyframeEffectOptions) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `KeyframeEffectOptions`*"] diff --git a/crates/web-sys/src/features/gen_L10nElement.rs b/crates/web-sys/src/features/gen_L10nElement.rs index 38942a7baef..3547a5b1455 100644 --- a/crates/web-sys/src/features/gen_L10nElement.rs +++ b/crates/web-sys/src/features/gen_L10nElement.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, getter = "l10nAttrs")] - pub fn get_l10n_attrs(this: &L10nElement) -> Option; + pub fn get_l10n_attrs(this: &L10nElement) -> Option<::alloc::string::String>; #[doc = "Change the `l10nAttrs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, getter = "l10nId")] - pub fn get_l10n_id(this: &L10nElement) -> String; + pub fn get_l10n_id(this: &L10nElement) -> ::alloc::string::String; #[doc = "Change the `l10nId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, getter = "localName")] - pub fn get_local_name(this: &L10nElement) -> String; + pub fn get_local_name(this: &L10nElement) -> ::alloc::string::String; #[doc = "Change the `localName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, getter = "namespaceURI")] - pub fn get_namespace_uri(this: &L10nElement) -> String; + pub fn get_namespace_uri(this: &L10nElement) -> ::alloc::string::String; #[doc = "Change the `namespaceURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &L10nElement) -> Option; + pub fn get_type(this: &L10nElement) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nElement`*"] diff --git a/crates/web-sys/src/features/gen_L10nValue.rs b/crates/web-sys/src/features/gen_L10nValue.rs index 9c09c9aa438..11658dacb23 100644 --- a/crates/web-sys/src/features/gen_L10nValue.rs +++ b/crates/web-sys/src/features/gen_L10nValue.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &L10nValue) -> Option; + pub fn get_value(this: &L10nValue) -> Option<::alloc::string::String>; #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `L10nValue`*"] diff --git a/crates/web-sys/src/features/gen_LocaleInfo.rs b/crates/web-sys/src/features/gen_LocaleInfo.rs index b7c86104dd5..f48406db4fa 100644 --- a/crates/web-sys/src/features/gen_LocaleInfo.rs +++ b/crates/web-sys/src/features/gen_LocaleInfo.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] #[wasm_bindgen(method, getter = "direction")] - pub fn get_direction(this: &LocaleInfo) -> Option; + pub fn get_direction(this: &LocaleInfo) -> Option<::alloc::string::String>; #[doc = "Change the `direction` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] #[wasm_bindgen(method, getter = "locale")] - pub fn get_locale(this: &LocaleInfo) -> Option; + pub fn get_locale(this: &LocaleInfo) -> Option<::alloc::string::String>; #[doc = "Change the `locale` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `LocaleInfo`*"] diff --git a/crates/web-sys/src/features/gen_Location.rs b/crates/web-sys/src/features/gen_Location.rs index f33f7471481..3b485fcba0e 100644 --- a/crates/web-sys/src/features/gen_Location.rs +++ b/crates/web-sys/src/features/gen_Location.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn href(this: &Location) -> Result; + pub fn href(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -32,14 +32,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn origin(this: &Location) -> Result; + pub fn origin(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Location" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn protocol(this: &Location) -> Result; + pub fn protocol(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = protocol)] #[doc = "Setter for the `protocol` field of this object."] #[doc = ""] @@ -53,7 +53,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn host(this: &Location) -> Result; + pub fn host(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = host)] #[doc = "Setter for the `host` field of this object."] #[doc = ""] @@ -67,7 +67,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/hostname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn hostname(this: &Location) -> Result; + pub fn hostname(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = hostname)] #[doc = "Setter for the `hostname` field of this object."] #[doc = ""] @@ -81,7 +81,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/port)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn port(this: &Location) -> Result; + pub fn port(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = port)] #[doc = "Setter for the `port` field of this object."] #[doc = ""] @@ -95,7 +95,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn pathname(this: &Location) -> Result; + pub fn pathname(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = pathname)] #[doc = "Setter for the `pathname` field of this object."] #[doc = ""] @@ -109,7 +109,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/search)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn search(this: &Location) -> Result; + pub fn search(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = search)] #[doc = "Setter for the `search` field of this object."] #[doc = ""] @@ -123,7 +123,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Location/hash)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Location`*"] - pub fn hash(this: &Location) -> Result; + pub fn hash(this: &Location) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Location" , js_name = hash)] #[doc = "Setter for the `hash` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Lock.rs b/crates/web-sys/src/features/gen_Lock.rs index 98b93739a91..785dc9d1801 100644 --- a/crates/web-sys/src/features/gen_Lock.rs +++ b/crates/web-sys/src/features/gen_Lock.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn name(this: &Lock) -> String; + pub fn name(this: &Lock) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "LockMode")] # [wasm_bindgen (structural , method , getter , js_class = "Lock" , js_name = mode)] diff --git a/crates/web-sys/src/features/gen_LockInfo.rs b/crates/web-sys/src/features/gen_LockInfo.rs index aa37143fa48..961a4dfe383 100644 --- a/crates/web-sys/src/features/gen_LockInfo.rs +++ b/crates/web-sys/src/features/gen_LockInfo.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "clientId")] - pub fn get_client_id(this: &LockInfo) -> Option; + pub fn get_client_id(this: &LockInfo) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `clientId` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &LockInfo) -> Option; + pub fn get_name(this: &LockInfo) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MathMlElement.rs b/crates/web-sys/src/features/gen_MathMlElement.rs index cd2ae11fa92..78824e3e751 100644 --- a/crates/web-sys/src/features/gen_MathMlElement.rs +++ b/crates/web-sys/src/features/gen_MathMlElement.rs @@ -1196,7 +1196,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/nonce)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"] - pub fn nonce(this: &MathMlElement) -> String; + pub fn nonce(this: &MathMlElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = nonce)] #[doc = "Setter for the `nonce` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaDeviceInfo.rs b/crates/web-sys/src/features/gen_MediaDeviceInfo.rs index e108c87544b..9de3988588e 100644 --- a/crates/web-sys/src/features/gen_MediaDeviceInfo.rs +++ b/crates/web-sys/src/features/gen_MediaDeviceInfo.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDeviceInfo`*"] - pub fn device_id(this: &MediaDeviceInfo) -> String; + pub fn device_id(this: &MediaDeviceInfo) -> ::alloc::string::String; #[cfg(feature = "MediaDeviceKind")] # [wasm_bindgen (structural , method , getter , js_class = "MediaDeviceInfo" , js_name = kind)] #[doc = "Getter for the `kind` field of this object."] @@ -33,14 +33,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDeviceInfo`*"] - pub fn label(this: &MediaDeviceInfo) -> String; + pub fn label(this: &MediaDeviceInfo) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaDeviceInfo" , js_name = groupId)] #[doc = "Getter for the `groupId` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/groupId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaDeviceInfo`*"] - pub fn group_id(this: &MediaDeviceInfo) -> String; + pub fn group_id(this: &MediaDeviceInfo) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "MediaDeviceInfo" , js_name = toJSON)] #[doc = "The `toJSON()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaEncryptedEvent.rs b/crates/web-sys/src/features/gen_MediaEncryptedEvent.rs index 296da0e21a1..f353c147a00 100644 --- a/crates/web-sys/src/features/gen_MediaEncryptedEvent.rs +++ b/crates/web-sys/src/features/gen_MediaEncryptedEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaEncryptedEvent/initDataType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaEncryptedEvent`*"] - pub fn init_data_type(this: &MediaEncryptedEvent) -> String; + pub fn init_data_type(this: &MediaEncryptedEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "MediaEncryptedEvent" , js_name = initData)] #[doc = "Getter for the `initData` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaError.rs b/crates/web-sys/src/features/gen_MediaError.rs index e9427d21241..20bf3982829 100644 --- a/crates/web-sys/src/features/gen_MediaError.rs +++ b/crates/web-sys/src/features/gen_MediaError.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaError`*"] - pub fn message(this: &MediaError) -> String; + pub fn message(this: &MediaError) -> ::alloc::string::String; } impl MediaError { #[doc = "The `MediaError.MEDIA_ERR_ABORTED` const."] diff --git a/crates/web-sys/src/features/gen_MediaImage.rs b/crates/web-sys/src/features/gen_MediaImage.rs index 151349e85ea..d09ff96418b 100644 --- a/crates/web-sys/src/features/gen_MediaImage.rs +++ b/crates/web-sys/src/features/gen_MediaImage.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "sizes")] - pub fn get_sizes(this: &MediaImage) -> Option; + pub fn get_sizes(this: &MediaImage) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `sizes` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "src")] - pub fn get_src(this: &MediaImage) -> String; + pub fn get_src(this: &MediaImage) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `src` field of this object."] #[doc = ""] @@ -58,7 +58,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &MediaImage) -> Option; + pub fn get_type(this: &MediaImage) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs index 33419e081c3..cb666ee08ea 100644 --- a/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyNeededEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] #[wasm_bindgen(method, getter = "initDataType")] - pub fn get_init_data_type(this: &MediaKeyNeededEventInit) -> Option; + pub fn get_init_data_type(this: &MediaKeyNeededEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `initDataType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeyNeededEventInit`*"] diff --git a/crates/web-sys/src/features/gen_MediaKeySession.rs b/crates/web-sys/src/features/gen_MediaKeySession.rs index e44f671b90e..310943dc192 100644 --- a/crates/web-sys/src/features/gen_MediaKeySession.rs +++ b/crates/web-sys/src/features/gen_MediaKeySession.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/sessionId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySession`*"] - pub fn session_id(this: &MediaKeySession) -> String; + pub fn session_id(this: &MediaKeySession) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaKeySession" , js_name = expiration)] #[doc = "Getter for the `expiration` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaKeySystemAccess.rs b/crates/web-sys/src/features/gen_MediaKeySystemAccess.rs index fd61076c4ac..d5f7d0b1017 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemAccess.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemAccess.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemAccess/keySystem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemAccess`*"] - pub fn key_system(this: &MediaKeySystemAccess) -> String; + pub fn key_system(this: &MediaKeySystemAccess) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "MediaKeySystemAccess" , js_name = createMediaKeys)] #[doc = "The `createMediaKeys()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs index e110b3e1ec1..ef8f2e3c915 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemConfiguration.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] #[wasm_bindgen(method, getter = "label")] - pub fn get_label(this: &MediaKeySystemConfiguration) -> Option; + pub fn get_label(this: &MediaKeySystemConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `label` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemConfiguration`*"] diff --git a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs index 7740ba74e30..ebdb9451d47 100644 --- a/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs +++ b/crates/web-sys/src/features/gen_MediaKeySystemMediaCapability.rs @@ -14,7 +14,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] #[wasm_bindgen(method, getter = "contentType")] - pub fn get_content_type(this: &MediaKeySystemMediaCapability) -> Option; + pub fn get_content_type( + this: &MediaKeySystemMediaCapability, + ) -> Option<::alloc::string::String>; #[doc = "Change the `contentType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] @@ -24,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] #[wasm_bindgen(method, getter = "robustness")] - pub fn get_robustness(this: &MediaKeySystemMediaCapability) -> Option; + pub fn get_robustness(this: &MediaKeySystemMediaCapability) -> Option<::alloc::string::String>; #[doc = "Change the `robustness` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeySystemMediaCapability`*"] diff --git a/crates/web-sys/src/features/gen_MediaKeys.rs b/crates/web-sys/src/features/gen_MediaKeys.rs index 2bd7edacca7..c9df498a7d5 100644 --- a/crates/web-sys/src/features/gen_MediaKeys.rs +++ b/crates/web-sys/src/features/gen_MediaKeys.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaKeys/keySystem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeys`*"] - pub fn key_system(this: &MediaKeys) -> String; + pub fn key_system(this: &MediaKeys) -> ::alloc::string::String; #[cfg(feature = "MediaKeySession")] # [wasm_bindgen (catch , method , structural , js_class = "MediaKeys" , js_name = createSession)] #[doc = "The `createSession()` method."] diff --git a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs index 26f5b184200..99c26cb234b 100644 --- a/crates/web-sys/src/features/gen_MediaKeysPolicy.rs +++ b/crates/web-sys/src/features/gen_MediaKeysPolicy.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] #[wasm_bindgen(method, getter = "minHdcpVersion")] - pub fn get_min_hdcp_version(this: &MediaKeysPolicy) -> Option; + pub fn get_min_hdcp_version(this: &MediaKeysPolicy) -> Option<::alloc::string::String>; #[doc = "Change the `minHdcpVersion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaKeysPolicy`*"] diff --git a/crates/web-sys/src/features/gen_MediaList.rs b/crates/web-sys/src/features/gen_MediaList.rs index a06c69e6f38..4416d737d62 100644 --- a/crates/web-sys/src/features/gen_MediaList.rs +++ b/crates/web-sys/src/features/gen_MediaList.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaList/mediaText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaList`*"] - pub fn media_text(this: &MediaList) -> String; + pub fn media_text(this: &MediaList) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "MediaList" , js_name = mediaText)] #[doc = "Setter for the `mediaText` field of this object."] #[doc = ""] @@ -53,12 +53,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaList/item)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaList`*"] - pub fn item(this: &MediaList, index: u32) -> Option; + pub fn item(this: &MediaList, index: u32) -> Option<::alloc::string::String>; #[wasm_bindgen(method, structural, js_class = "MediaList", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] #[doc = ""] #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaList`*"] - pub fn get(this: &MediaList, index: u32) -> Option; + pub fn get(this: &MediaList, index: u32) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_MediaMetadata.rs b/crates/web-sys/src/features/gen_MediaMetadata.rs index 57174ef7c5f..3825e029d87 100644 --- a/crates/web-sys/src/features/gen_MediaMetadata.rs +++ b/crates/web-sys/src/features/gen_MediaMetadata.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn title(this: &MediaMetadata) -> String; + pub fn title(this: &MediaMetadata) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = title)] #[doc = "Setter for the `title` field of this object."] @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn artist(this: &MediaMetadata) -> String; + pub fn artist(this: &MediaMetadata) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = artist)] #[doc = "Setter for the `artist` field of this object."] @@ -70,7 +70,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn album(this: &MediaMetadata) -> String; + pub fn album(this: &MediaMetadata) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , setter , js_class = "MediaMetadata" , js_name = album)] #[doc = "Setter for the `album` field of this object."] diff --git a/crates/web-sys/src/features/gen_MediaMetadataInit.rs b/crates/web-sys/src/features/gen_MediaMetadataInit.rs index f2deaff2ec3..45f5cf4fcb9 100644 --- a/crates/web-sys/src/features/gen_MediaMetadataInit.rs +++ b/crates/web-sys/src/features/gen_MediaMetadataInit.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "album")] - pub fn get_album(this: &MediaMetadataInit) -> Option; + pub fn get_album(this: &MediaMetadataInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `album` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "artist")] - pub fn get_artist(this: &MediaMetadataInit) -> Option; + pub fn get_artist(this: &MediaMetadataInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `artist` field of this object."] #[doc = ""] @@ -76,7 +76,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "title")] - pub fn get_title(this: &MediaMetadataInit) -> Option; + pub fn get_title(this: &MediaMetadataInit) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `title` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaQueryList.rs b/crates/web-sys/src/features/gen_MediaQueryList.rs index 9465c38278b..938c30aba8f 100644 --- a/crates/web-sys/src/features/gen_MediaQueryList.rs +++ b/crates/web-sys/src/features/gen_MediaQueryList.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryList`*"] - pub fn media(this: &MediaQueryList) -> String; + pub fn media(this: &MediaQueryList) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaQueryList" , js_name = matches)] #[doc = "Getter for the `matches` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaQueryListEvent.rs b/crates/web-sys/src/features/gen_MediaQueryListEvent.rs index 8733d985bd2..80f51a83391 100644 --- a/crates/web-sys/src/features/gen_MediaQueryListEvent.rs +++ b/crates/web-sys/src/features/gen_MediaQueryListEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryListEvent/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEvent`*"] - pub fn media(this: &MediaQueryListEvent) -> String; + pub fn media(this: &MediaQueryListEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaQueryListEvent" , js_name = matches)] #[doc = "Getter for the `matches` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs index b656e13b75a..bd8d9554b3c 100644 --- a/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaQueryListEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] #[wasm_bindgen(method, getter = "media")] - pub fn get_media(this: &MediaQueryListEventInit) -> Option; + pub fn get_media(this: &MediaQueryListEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `media` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaQueryListEventInit`*"] diff --git a/crates/web-sys/src/features/gen_MediaRecorder.rs b/crates/web-sys/src/features/gen_MediaRecorder.rs index af36d2e65f7..7cb779d4c65 100644 --- a/crates/web-sys/src/features/gen_MediaRecorder.rs +++ b/crates/web-sys/src/features/gen_MediaRecorder.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/mimeType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorder`*"] - pub fn mime_type(this: &MediaRecorder) -> String; + pub fn mime_type(this: &MediaRecorder) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaRecorder" , js_name = ondataavailable)] #[doc = "Getter for the `ondataavailable` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs index 2cadbaa05ac..7346fa75627 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderOptions.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderOptions.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] #[wasm_bindgen(method, getter = "mimeType")] - pub fn get_mime_type(this: &MediaRecorderOptions) -> Option; + pub fn get_mime_type(this: &MediaRecorderOptions) -> Option<::alloc::string::String>; #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaRecorderOptions`*"] diff --git a/crates/web-sys/src/features/gen_MediaStream.rs b/crates/web-sys/src/features/gen_MediaStream.rs index 9e78ed07848..788c2bf7f4e 100644 --- a/crates/web-sys/src/features/gen_MediaStream.rs +++ b/crates/web-sys/src/features/gen_MediaStream.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStream`*"] - pub fn id(this: &MediaStream) -> String; + pub fn id(this: &MediaStream) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaStream" , js_name = active)] #[doc = "Getter for the `active` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs index 0a666f793b5..509442d58cb 100644 --- a/crates/web-sys/src/features/gen_MediaStreamConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaStreamConstraints.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] #[wasm_bindgen(method, getter = "peerIdentity")] - pub fn get_peer_identity(this: &MediaStreamConstraints) -> Option; + pub fn get_peer_identity(this: &MediaStreamConstraints) -> Option<::alloc::string::String>; #[doc = "Change the `peerIdentity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamConstraints`*"] diff --git a/crates/web-sys/src/features/gen_MediaStreamError.rs b/crates/web-sys/src/features/gen_MediaStreamError.rs index 7c4a544d89c..971f801b6b0 100644 --- a/crates/web-sys/src/features/gen_MediaStreamError.rs +++ b/crates/web-sys/src/features/gen_MediaStreamError.rs @@ -18,19 +18,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamError/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamError`*"] - pub fn name(this: &MediaStreamError) -> String; + pub fn name(this: &MediaStreamError) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamError" , js_name = message)] #[doc = "Getter for the `message` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamError`*"] - pub fn message(this: &MediaStreamError) -> Option; + pub fn message(this: &MediaStreamError) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamError" , js_name = constraint)] #[doc = "Getter for the `constraint` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamError/constraint)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamError`*"] - pub fn constraint(this: &MediaStreamError) -> Option; + pub fn constraint(this: &MediaStreamError) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_MediaStreamTrack.rs b/crates/web-sys/src/features/gen_MediaStreamTrack.rs index bb8ac52e15f..369b58a7d8c 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrack.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrack.rs @@ -18,21 +18,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/kind)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`*"] - pub fn kind(this: &MediaStreamTrack) -> String; + pub fn kind(this: &MediaStreamTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamTrack" , js_name = id)] #[doc = "Getter for the `id` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`*"] - pub fn id(this: &MediaStreamTrack) -> String; + pub fn id(this: &MediaStreamTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamTrack" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`*"] - pub fn label(this: &MediaStreamTrack) -> String; + pub fn label(this: &MediaStreamTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MediaStreamTrack" , js_name = enabled)] #[doc = "Getter for the `enabled` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs index 67d0fcd0431..6c943531a80 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "kind")] - pub fn get_kind(this: &MediaStreamTrackGeneratorInit) -> String; + pub fn get_kind(this: &MediaStreamTrackGeneratorInit) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `kind` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs index 85d23016f20..08378bdcecf 100644 --- a/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs +++ b/crates/web-sys/src/features/gen_MediaTrackCapabilities.rs @@ -98,7 +98,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "deviceId")] - pub fn get_device_id(this: &MediaTrackCapabilities) -> Option; + pub fn get_device_id(this: &MediaTrackCapabilities) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `deviceId` field of this object."] #[doc = ""] @@ -172,7 +172,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "groupId")] - pub fn get_group_id(this: &MediaTrackCapabilities) -> Option; + pub fn get_group_id(this: &MediaTrackCapabilities) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `groupId` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs index 2624e64f81a..3654baba0bf 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraintSet.rs @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] #[wasm_bindgen(method, getter = "mediaSource")] - pub fn get_media_source(this: &MediaTrackConstraintSet) -> Option; + pub fn get_media_source(this: &MediaTrackConstraintSet) -> Option<::alloc::string::String>; #[doc = "Change the `mediaSource` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraintSet`*"] diff --git a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs index 6d40272de64..f73bee2e8b0 100644 --- a/crates/web-sys/src/features/gen_MediaTrackConstraints.rs +++ b/crates/web-sys/src/features/gen_MediaTrackConstraints.rs @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] #[wasm_bindgen(method, getter = "mediaSource")] - pub fn get_media_source(this: &MediaTrackConstraints) -> Option; + pub fn get_media_source(this: &MediaTrackConstraints) -> Option<::alloc::string::String>; #[doc = "Change the `mediaSource` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackConstraints`*"] diff --git a/crates/web-sys/src/features/gen_MediaTrackSettings.rs b/crates/web-sys/src/features/gen_MediaTrackSettings.rs index 455fcad4822..d7b63e11026 100644 --- a/crates/web-sys/src/features/gen_MediaTrackSettings.rs +++ b/crates/web-sys/src/features/gen_MediaTrackSettings.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, getter = "deviceId")] - pub fn get_device_id(this: &MediaTrackSettings) -> Option; + pub fn get_device_id(this: &MediaTrackSettings) -> Option<::alloc::string::String>; #[doc = "Change the `deviceId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] #[wasm_bindgen(method, getter = "facingMode")] - pub fn get_facing_mode(this: &MediaTrackSettings) -> Option; + pub fn get_facing_mode(this: &MediaTrackSettings) -> Option<::alloc::string::String>; #[doc = "Change the `facingMode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaTrackSettings`*"] diff --git a/crates/web-sys/src/features/gen_MemoryAttribution.rs b/crates/web-sys/src/features/gen_MemoryAttribution.rs index be7056aa458..1bee0c80767 100644 --- a/crates/web-sys/src/features/gen_MemoryAttribution.rs +++ b/crates/web-sys/src/features/gen_MemoryAttribution.rs @@ -42,7 +42,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "scope")] - pub fn get_scope(this: &MemoryAttribution) -> Option; + pub fn get_scope(this: &MemoryAttribution) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `scope` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &MemoryAttribution) -> Option; + pub fn get_url(this: &MemoryAttribution) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `url` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs index c7a6bb4c1e8..07dcd7828b3 100644 --- a/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs +++ b/crates/web-sys/src/features/gen_MemoryAttributionContainer.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &MemoryAttributionContainer) -> Option; + pub fn get_id(this: &MemoryAttributionContainer) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "src")] - pub fn get_src(this: &MemoryAttributionContainer) -> Option; + pub fn get_src(this: &MemoryAttributionContainer) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `src` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MessageEvent.rs b/crates/web-sys/src/features/gen_MessageEvent.rs index 38843a95b19..1afdf3413f1 100644 --- a/crates/web-sys/src/features/gen_MessageEvent.rs +++ b/crates/web-sys/src/features/gen_MessageEvent.rs @@ -25,14 +25,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEvent`*"] - pub fn origin(this: &MessageEvent) -> String; + pub fn origin(this: &MessageEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MessageEvent" , js_name = lastEventId)] #[doc = "Getter for the `lastEventId` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/lastEventId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEvent`*"] - pub fn last_event_id(this: &MessageEvent) -> String; + pub fn last_event_id(this: &MessageEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MessageEvent" , js_name = source)] #[doc = "Getter for the `source` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MessageEventInit.rs b/crates/web-sys/src/features/gen_MessageEventInit.rs index 82a6cfe5cec..4f96b0cc6c3 100644 --- a/crates/web-sys/src/features/gen_MessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MessageEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, getter = "lastEventId")] - pub fn get_last_event_id(this: &MessageEventInit) -> Option; + pub fn get_last_event_id(this: &MessageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `lastEventId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &MessageEventInit) -> Option; + pub fn get_origin(this: &MessageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MessageEventInit`*"] diff --git a/crates/web-sys/src/features/gen_MidiPort.rs b/crates/web-sys/src/features/gen_MidiPort.rs index e34ef80680c..9a8393546ca 100644 --- a/crates/web-sys/src/features/gen_MidiPort.rs +++ b/crates/web-sys/src/features/gen_MidiPort.rs @@ -18,28 +18,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIPort/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiPort`*"] - pub fn id(this: &MidiPort) -> String; + pub fn id(this: &MidiPort) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MIDIPort" , js_name = manufacturer)] #[doc = "Getter for the `manufacturer` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIPort/manufacturer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiPort`*"] - pub fn manufacturer(this: &MidiPort) -> Option; + pub fn manufacturer(this: &MidiPort) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MIDIPort" , js_name = name)] #[doc = "Getter for the `name` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIPort/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiPort`*"] - pub fn name(this: &MidiPort) -> Option; + pub fn name(this: &MidiPort) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MIDIPort" , js_name = version)] #[doc = "Getter for the `version` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIPort/version)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiPort`*"] - pub fn version(this: &MidiPort) -> Option; + pub fn version(this: &MidiPort) -> Option<::alloc::string::String>; #[cfg(feature = "MidiPortType")] # [wasm_bindgen (structural , method , getter , js_class = "MIDIPort" , js_name = type)] #[doc = "Getter for the `type` field of this object."] diff --git a/crates/web-sys/src/features/gen_MimeType.rs b/crates/web-sys/src/features/gen_MimeType.rs index 02abadddd17..93f6664bfac 100644 --- a/crates/web-sys/src/features/gen_MimeType.rs +++ b/crates/web-sys/src/features/gen_MimeType.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MimeType/description)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MimeType`*"] - pub fn description(this: &MimeType) -> String; + pub fn description(this: &MimeType) -> ::alloc::string::String; #[cfg(feature = "Plugin")] # [wasm_bindgen (structural , method , getter , js_class = "MimeType" , js_name = enabledPlugin)] #[doc = "Getter for the `enabledPlugin` field of this object."] @@ -33,12 +33,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MimeType/suffixes)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MimeType`*"] - pub fn suffixes(this: &MimeType) -> String; + pub fn suffixes(this: &MimeType) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MimeType" , js_name = type)] #[doc = "Getter for the `type` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MimeType/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MimeType`*"] - pub fn type_(this: &MimeType) -> String; + pub fn type_(this: &MimeType) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_MouseEvent.rs b/crates/web-sys/src/features/gen_MouseEvent.rs index ad7826a20d4..96f448f165b 100644 --- a/crates/web-sys/src/features/gen_MouseEvent.rs +++ b/crates/web-sys/src/features/gen_MouseEvent.rs @@ -124,7 +124,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/region)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MouseEvent`*"] - pub fn region(this: &MouseEvent) -> Option; + pub fn region(this: &MouseEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MouseEvent" , js_name = movementX)] #[doc = "Getter for the `movementX` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MutationEvent.rs b/crates/web-sys/src/features/gen_MutationEvent.rs index b21ae79eefc..cd3b3d34aed 100644 --- a/crates/web-sys/src/features/gen_MutationEvent.rs +++ b/crates/web-sys/src/features/gen_MutationEvent.rs @@ -26,21 +26,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent/prevValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationEvent`*"] - pub fn prev_value(this: &MutationEvent) -> String; + pub fn prev_value(this: &MutationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MutationEvent" , js_name = newValue)] #[doc = "Getter for the `newValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent/newValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationEvent`*"] - pub fn new_value(this: &MutationEvent) -> String; + pub fn new_value(this: &MutationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MutationEvent" , js_name = attrName)] #[doc = "Getter for the `attrName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent/attrName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationEvent`*"] - pub fn attr_name(this: &MutationEvent) -> String; + pub fn attr_name(this: &MutationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "MutationEvent" , js_name = attrChange)] #[doc = "Getter for the `attrChange` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MutationRecord.rs b/crates/web-sys/src/features/gen_MutationRecord.rs index 3d6ca83da94..f898c07d02c 100644 --- a/crates/web-sys/src/features/gen_MutationRecord.rs +++ b/crates/web-sys/src/features/gen_MutationRecord.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationRecord`*"] - pub fn type_(this: &MutationRecord) -> String; + pub fn type_(this: &MutationRecord) -> ::alloc::string::String; #[cfg(feature = "Node")] # [wasm_bindgen (structural , method , getter , js_class = "MutationRecord" , js_name = target)] #[doc = "Getter for the `target` field of this object."] @@ -65,19 +65,19 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/attributeName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationRecord`*"] - pub fn attribute_name(this: &MutationRecord) -> Option; + pub fn attribute_name(this: &MutationRecord) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MutationRecord" , js_name = attributeNamespace)] #[doc = "Getter for the `attributeNamespace` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/attributeNamespace)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationRecord`*"] - pub fn attribute_namespace(this: &MutationRecord) -> Option; + pub fn attribute_namespace(this: &MutationRecord) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "MutationRecord" , js_name = oldValue)] #[doc = "Getter for the `oldValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/oldValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MutationRecord`*"] - pub fn old_value(this: &MutationRecord) -> Option; + pub fn old_value(this: &MutationRecord) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs index 7f8f52c40f6..733fed4acbd 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileReadOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] #[wasm_bindgen(method, getter = "encoding")] - pub fn get_encoding(this: &NativeOsFileReadOptions) -> Option; + pub fn get_encoding(this: &NativeOsFileReadOptions) -> Option<::alloc::string::String>; #[doc = "Change the `encoding` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileReadOptions`*"] diff --git a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs index 6215a0b8529..44e685503ed 100644 --- a/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs +++ b/crates/web-sys/src/features/gen_NativeOsFileWriteAtomicOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, getter = "backupTo")] - pub fn get_backup_to(this: &NativeOsFileWriteAtomicOptions) -> Option; + pub fn get_backup_to(this: &NativeOsFileWriteAtomicOptions) -> Option<::alloc::string::String>; #[doc = "Change the `backupTo` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] #[wasm_bindgen(method, getter = "tmpPath")] - pub fn get_tmp_path(this: &NativeOsFileWriteAtomicOptions) -> Option; + pub fn get_tmp_path(this: &NativeOsFileWriteAtomicOptions) -> Option<::alloc::string::String>; #[doc = "Change the `tmpPath` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NativeOsFileWriteAtomicOptions`*"] diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index 374cd3a4cf6..fa2913ade18 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -50,7 +50,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn do_not_track(this: &Navigator) -> String; + pub fn do_not_track(this: &Navigator) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = maxTouchPoints)] #[doc = "Getter for the `maxTouchPoints` field of this object."] #[doc = ""] @@ -261,49 +261,49 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appCodeName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn app_code_name(this: &Navigator) -> Result; + pub fn app_code_name(this: &Navigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = appName)] #[doc = "Getter for the `appName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn app_name(this: &Navigator) -> String; + pub fn app_name(this: &Navigator) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "Navigator" , js_name = appVersion)] #[doc = "Getter for the `appVersion` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appVersion)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn app_version(this: &Navigator) -> Result; + pub fn app_version(this: &Navigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Navigator" , js_name = platform)] #[doc = "Getter for the `platform` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn platform(this: &Navigator) -> Result; + pub fn platform(this: &Navigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Navigator" , js_name = userAgent)] #[doc = "Getter for the `userAgent` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn user_agent(this: &Navigator) -> Result; + pub fn user_agent(this: &Navigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = product)] #[doc = "Getter for the `product` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/product)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn product(this: &Navigator) -> String; + pub fn product(this: &Navigator) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = language)] #[doc = "Getter for the `language` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] - pub fn language(this: &Navigator) -> Option; + pub fn language(this: &Navigator) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Navigator" , js_name = languages)] #[doc = "Getter for the `languages` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs index 05be8c4f94f..b78201b704a 100644 --- a/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs +++ b/crates/web-sys/src/features/gen_NavigatorUaBrandVersion.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "brand")] - pub fn get_brand(this: &NavigatorUaBrandVersion) -> Option; + pub fn get_brand(this: &NavigatorUaBrandVersion) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `brand` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &NavigatorUaBrandVersion) -> Option; + pub fn get_version(this: &NavigatorUaBrandVersion) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `version` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_NavigatorUaData.rs b/crates/web-sys/src/features/gen_NavigatorUaData.rs index 8dc54746be6..c1a93668363 100644 --- a/crates/web-sys/src/features/gen_NavigatorUaData.rs +++ b/crates/web-sys/src/features/gen_NavigatorUaData.rs @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn platform(this: &NavigatorUaData) -> String; + pub fn platform(this: &NavigatorUaData) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "NavigatorUAData" , js_name = getHighEntropyValues)] #[doc = "The `getHighEntropyValues()` method."] diff --git a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs index 0bac6a26bec..1cb911575c8 100644 --- a/crates/web-sys/src/features/gen_NetworkCommandOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkCommandOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "cmd")] - pub fn get_cmd(this: &NetworkCommandOptions) -> Option; + pub fn get_cmd(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `cmd` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -24,7 +24,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "curExternalIfname")] - pub fn get_cur_external_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_cur_external_ifname(this: &NetworkCommandOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `curExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -34,7 +35,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "curInternalIfname")] - pub fn get_cur_internal_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_cur_internal_ifname(this: &NetworkCommandOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `curInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -44,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "dns1")] - pub fn get_dns1(this: &NetworkCommandOptions) -> Option; + pub fn get_dns1(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `dns1` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -64,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "dns2")] - pub fn get_dns2(this: &NetworkCommandOptions) -> Option; + pub fn get_dns2(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `dns2` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -94,7 +96,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "domain")] - pub fn get_domain(this: &NetworkCommandOptions) -> Option; + pub fn get_domain(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `domain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -124,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "endIp")] - pub fn get_end_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_end_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `endIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -134,7 +136,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "externalIfname")] - pub fn get_external_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_external_ifname(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `externalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -144,7 +146,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "gateway")] - pub fn get_gateway(this: &NetworkCommandOptions) -> Option; + pub fn get_gateway(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `gateway` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -184,7 +186,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "ifname")] - pub fn get_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_ifname(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `ifname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -204,7 +206,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "internalIfname")] - pub fn get_internal_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_internal_ifname(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `internalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -214,7 +216,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "ip")] - pub fn get_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `ip` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -234,7 +236,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "key")] - pub fn get_key(this: &NetworkCommandOptions) -> Option; + pub fn get_key(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -244,7 +246,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "link")] - pub fn get_link(this: &NetworkCommandOptions) -> Option; + pub fn get_link(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `link` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -264,7 +266,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "maskLength")] - pub fn get_mask_length(this: &NetworkCommandOptions) -> Option; + pub fn get_mask_length(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `maskLength` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -274,7 +276,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "mode")] - pub fn get_mode(this: &NetworkCommandOptions) -> Option; + pub fn get_mode(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `mode` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -294,7 +296,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "preExternalIfname")] - pub fn get_pre_external_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_pre_external_ifname(this: &NetworkCommandOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `preExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -304,7 +307,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "preInternalIfname")] - pub fn get_pre_internal_ifname(this: &NetworkCommandOptions) -> Option; + pub fn get_pre_internal_ifname(this: &NetworkCommandOptions) + -> Option<::alloc::string::String>; #[doc = "Change the `preInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -314,7 +318,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "prefix")] - pub fn get_prefix(this: &NetworkCommandOptions) -> Option; + pub fn get_prefix(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `prefix` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -344,7 +348,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "security")] - pub fn get_security(this: &NetworkCommandOptions) -> Option; + pub fn get_security(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `security` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -354,7 +358,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "serverIp")] - pub fn get_server_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_server_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `serverIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -364,7 +368,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "ssid")] - pub fn get_ssid(this: &NetworkCommandOptions) -> Option; + pub fn get_ssid(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `ssid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -374,7 +378,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "startIp")] - pub fn get_start_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_start_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `startIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -394,7 +398,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "usbEndIp")] - pub fn get_usb_end_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_usb_end_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `usbEndIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -404,7 +408,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "usbStartIp")] - pub fn get_usb_start_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_usb_start_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `usbStartIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -414,7 +418,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "wifiEndIp")] - pub fn get_wifi_end_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_wifi_end_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `wifiEndIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -424,7 +428,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "wifiStartIp")] - pub fn get_wifi_start_ip(this: &NetworkCommandOptions) -> Option; + pub fn get_wifi_start_ip(this: &NetworkCommandOptions) -> Option<::alloc::string::String>; #[doc = "Change the `wifiStartIp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] @@ -434,7 +438,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] #[wasm_bindgen(method, getter = "wifictrlinterfacename")] - pub fn get_wifictrlinterfacename(this: &NetworkCommandOptions) -> Option; + pub fn get_wifictrlinterfacename( + this: &NetworkCommandOptions, + ) -> Option<::alloc::string::String>; #[doc = "Change the `wifictrlinterfacename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkCommandOptions`*"] diff --git a/crates/web-sys/src/features/gen_NetworkResultOptions.rs b/crates/web-sys/src/features/gen_NetworkResultOptions.rs index 4f456605968..4d508d47c06 100644 --- a/crates/web-sys/src/features/gen_NetworkResultOptions.rs +++ b/crates/web-sys/src/features/gen_NetworkResultOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "curExternalIfname")] - pub fn get_cur_external_ifname(this: &NetworkResultOptions) -> Option; + pub fn get_cur_external_ifname(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `curExternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "curInternalIfname")] - pub fn get_cur_internal_ifname(this: &NetworkResultOptions) -> Option; + pub fn get_cur_internal_ifname(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `curInternalIfname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "dns1_str")] - pub fn get_dns1_str(this: &NetworkResultOptions) -> Option; + pub fn get_dns1_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `dns1_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "dns2_str")] - pub fn get_dns2_str(this: &NetworkResultOptions) -> Option; + pub fn get_dns2_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `dns2_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -104,7 +104,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "flag")] - pub fn get_flag(this: &NetworkResultOptions) -> Option; + pub fn get_flag(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `flag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -124,7 +124,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "gateway_str")] - pub fn get_gateway_str(this: &NetworkResultOptions) -> Option; + pub fn get_gateway_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `gateway_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -154,7 +154,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "ipAddr")] - pub fn get_ip_addr(this: &NetworkResultOptions) -> Option; + pub fn get_ip_addr(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `ipAddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -174,7 +174,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "ipaddr_str")] - pub fn get_ipaddr_str(this: &NetworkResultOptions) -> Option; + pub fn get_ipaddr_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `ipaddr_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -194,7 +194,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "macAddr")] - pub fn get_mac_addr(this: &NetworkResultOptions) -> Option; + pub fn get_mac_addr(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `macAddr` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -214,7 +214,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "mask_str")] - pub fn get_mask_str(this: &NetworkResultOptions) -> Option; + pub fn get_mask_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `mask_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -224,7 +224,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "netId")] - pub fn get_net_id(this: &NetworkResultOptions) -> Option; + pub fn get_net_id(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `netId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -244,7 +244,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "reason")] - pub fn get_reason(this: &NetworkResultOptions) -> Option; + pub fn get_reason(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `reason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -254,7 +254,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "reply")] - pub fn get_reply(this: &NetworkResultOptions) -> Option; + pub fn get_reply(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `reply` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -284,7 +284,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "resultReason")] - pub fn get_result_reason(this: &NetworkResultOptions) -> Option; + pub fn get_result_reason(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `resultReason` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -304,7 +304,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "route")] - pub fn get_route(this: &NetworkResultOptions) -> Option; + pub fn get_route(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `route` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -324,7 +324,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "server_str")] - pub fn get_server_str(this: &NetworkResultOptions) -> Option; + pub fn get_server_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `server_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -344,7 +344,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "topic")] - pub fn get_topic(this: &NetworkResultOptions) -> Option; + pub fn get_topic(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `topic` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] @@ -354,7 +354,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] #[wasm_bindgen(method, getter = "vendor_str")] - pub fn get_vendor_str(this: &NetworkResultOptions) -> Option; + pub fn get_vendor_str(this: &NetworkResultOptions) -> Option<::alloc::string::String>; #[doc = "Change the `vendor_str` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NetworkResultOptions`*"] diff --git a/crates/web-sys/src/features/gen_Node.rs b/crates/web-sys/src/features/gen_Node.rs index 32c5b8d7b25..a2a0ad51b64 100644 --- a/crates/web-sys/src/features/gen_Node.rs +++ b/crates/web-sys/src/features/gen_Node.rs @@ -25,14 +25,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn node_name(this: &Node) -> String; + pub fn node_name(this: &Node) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "Node" , js_name = baseURI)] #[doc = "Getter for the `baseURI` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn base_uri(this: &Node) -> Result, JsValue>; + pub fn base_uri(this: &Node) -> Result, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "Node" , js_name = isConnected)] #[doc = "Getter for the `isConnected` field of this object."] #[doc = ""] @@ -105,7 +105,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn node_value(this: &Node) -> Option; + pub fn node_value(this: &Node) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "Node" , js_name = nodeValue)] #[doc = "Setter for the `nodeValue` field of this object."] #[doc = ""] @@ -119,7 +119,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn text_content(this: &Node) -> Option; + pub fn text_content(this: &Node) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "Node" , js_name = textContent)] #[doc = "Setter for the `textContent` field of this object."] #[doc = ""] @@ -218,14 +218,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupNamespaceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn lookup_namespace_uri(this: &Node, prefix: Option<&str>) -> Option; + pub fn lookup_namespace_uri( + this: &Node, + prefix: Option<&str>, + ) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "Node" , js_name = lookupPrefix)] #[doc = "The `lookupPrefix()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupPrefix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`*"] - pub fn lookup_prefix(this: &Node, namespace: Option<&str>) -> Option; + pub fn lookup_prefix(this: &Node, namespace: Option<&str>) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "Node" , js_name = normalize)] #[doc = "The `normalize()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Notification.rs b/crates/web-sys/src/features/gen_Notification.rs index e5f9024a5a4..b2d9394677f 100644 --- a/crates/web-sys/src/features/gen_Notification.rs +++ b/crates/web-sys/src/features/gen_Notification.rs @@ -89,7 +89,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/title)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn title(this: &Notification) -> String; + pub fn title(this: &Notification) -> ::alloc::string::String; #[cfg(feature = "NotificationDirection")] # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = dir)] #[doc = "Getter for the `dir` field of this object."] @@ -104,42 +104,42 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/lang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn lang(this: &Notification) -> Option; + pub fn lang(this: &Notification) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = body)] #[doc = "Getter for the `body` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/body)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn body(this: &Notification) -> Option; + pub fn body(this: &Notification) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = tag)] #[doc = "Getter for the `tag` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/tag)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn tag(this: &Notification) -> Option; + pub fn tag(this: &Notification) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = image)] #[doc = "Getter for the `image` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/image)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn image(this: &Notification) -> String; + pub fn image(this: &Notification) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = icon)] #[doc = "Getter for the `icon` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/icon)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn icon(this: &Notification) -> Option; + pub fn icon(this: &Notification) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = badge)] #[doc = "Getter for the `badge` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/badge)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Notification`*"] - pub fn badge(this: &Notification) -> String; + pub fn badge(this: &Notification) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Notification" , js_name = vibrate)] #[doc = "Getter for the `vibrate` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_NotificationAction.rs b/crates/web-sys/src/features/gen_NotificationAction.rs index f8fee81d848..4e129c3c83d 100644 --- a/crates/web-sys/src/features/gen_NotificationAction.rs +++ b/crates/web-sys/src/features/gen_NotificationAction.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, getter = "action")] - pub fn get_action(this: &NotificationAction) -> String; + pub fn get_action(this: &NotificationAction) -> ::alloc::string::String; #[doc = "Change the `action` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, getter = "icon")] - pub fn get_icon(this: &NotificationAction) -> Option; + pub fn get_icon(this: &NotificationAction) -> Option<::alloc::string::String>; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] #[wasm_bindgen(method, getter = "title")] - pub fn get_title(this: &NotificationAction) -> String; + pub fn get_title(this: &NotificationAction) -> ::alloc::string::String; #[doc = "Change the `title` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationAction`*"] diff --git a/crates/web-sys/src/features/gen_NotificationOptions.rs b/crates/web-sys/src/features/gen_NotificationOptions.rs index d3ec99545d0..96a3472919d 100644 --- a/crates/web-sys/src/features/gen_NotificationOptions.rs +++ b/crates/web-sys/src/features/gen_NotificationOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "badge")] - pub fn get_badge(this: &NotificationOptions) -> Option; + pub fn get_badge(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `badge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "body")] - pub fn get_body(this: &NotificationOptions) -> Option; + pub fn get_body(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `body` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "icon")] - pub fn get_icon(this: &NotificationOptions) -> Option; + pub fn get_icon(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] @@ -76,7 +76,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "image")] - pub fn get_image(this: &NotificationOptions) -> Option; + pub fn get_image(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `image` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] @@ -86,7 +86,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "lang")] - pub fn get_lang(this: &NotificationOptions) -> Option; + pub fn get_lang(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `lang` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] @@ -126,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] #[wasm_bindgen(method, getter = "tag")] - pub fn get_tag(this: &NotificationOptions) -> Option; + pub fn get_tag(this: &NotificationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `tag` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `NotificationOptions`*"] diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index 9e94597e350..7b756a15e59 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -42,7 +42,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn global_composite_operation( this: &OffscreenCanvasRenderingContext2d, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = globalCompositeOperation)] #[doc = "Setter for the `globalCompositeOperation` field of this object."] #[doc = ""] @@ -153,7 +153,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/filter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn filter(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn filter(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = filter)] #[doc = "Setter for the `filter` field of this object."] #[doc = ""] @@ -195,7 +195,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineCap)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn line_cap(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn line_cap(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineCap)] #[doc = "Setter for the `lineCap` field of this object."] #[doc = ""] @@ -209,7 +209,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/lineJoin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn line_join(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn line_join(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = lineJoin)] #[doc = "Setter for the `lineJoin` field of this object."] #[doc = ""] @@ -293,7 +293,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/shadowColor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn shadow_color(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn shadow_color(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = shadowColor)] #[doc = "Setter for the `shadowColor` field of this object."] #[doc = ""] @@ -307,7 +307,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/font)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn font(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn font(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = font)] #[doc = "Setter for the `font` field of this object."] #[doc = ""] @@ -321,7 +321,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textAlign)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn text_align(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn text_align(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textAlign)] #[doc = "Setter for the `textAlign` field of this object."] #[doc = ""] @@ -335,7 +335,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/textBaseline)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn text_baseline(this: &OffscreenCanvasRenderingContext2d) -> String; + pub fn text_baseline(this: &OffscreenCanvasRenderingContext2d) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "OffscreenCanvasRenderingContext2D" , js_name = textBaseline)] #[doc = "Setter for the `textBaseline` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs index 512cc7bcace..8fc7269e414 100644 --- a/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_OpenFilePickerOptions.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &OpenFilePickerOptions) -> Option; + pub fn get_id(this: &OpenFilePickerOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs index 442c35d3a4a..2d21350c17b 100644 --- a/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs +++ b/crates/web-sys/src/features/gen_OpenWindowEventDetail.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, getter = "features")] - pub fn get_features(this: &OpenWindowEventDetail) -> Option; + pub fn get_features(this: &OpenWindowEventDetail) -> Option<::alloc::string::String>; #[doc = "Change the `features` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &OpenWindowEventDetail) -> Option; + pub fn get_name(this: &OpenWindowEventDetail) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &OpenWindowEventDetail) -> Option; + pub fn get_url(this: &OpenWindowEventDetail) -> Option<::alloc::string::String>; #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OpenWindowEventDetail`*"] diff --git a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs index 195e6e3e2a5..c469d425415 100644 --- a/crates/web-sys/src/features/gen_OptionalEffectTiming.rs +++ b/crates/web-sys/src/features/gen_OptionalEffectTiming.rs @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] #[wasm_bindgen(method, getter = "easing")] - pub fn get_easing(this: &OptionalEffectTiming) -> Option; + pub fn get_easing(this: &OptionalEffectTiming) -> Option<::alloc::string::String>; #[doc = "Change the `easing` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OptionalEffectTiming`*"] diff --git a/crates/web-sys/src/features/gen_PaintRequest.rs b/crates/web-sys/src/features/gen_PaintRequest.rs index e4fa793de3b..73a849fd73e 100644 --- a/crates/web-sys/src/features/gen_PaintRequest.rs +++ b/crates/web-sys/src/features/gen_PaintRequest.rs @@ -26,5 +26,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaintRequest/reason)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaintRequest`*"] - pub fn reason(this: &PaintRequest) -> String; + pub fn reason(this: &PaintRequest) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_PaymentAddress.rs b/crates/web-sys/src/features/gen_PaymentAddress.rs index 367f8076bab..8e32be7f44c 100644 --- a/crates/web-sys/src/features/gen_PaymentAddress.rs +++ b/crates/web-sys/src/features/gen_PaymentAddress.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/country)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn country(this: &PaymentAddress) -> String; + pub fn country(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = addressLine)] #[doc = "Getter for the `addressLine` field of this object."] #[doc = ""] @@ -32,63 +32,63 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/region)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn region(this: &PaymentAddress) -> String; + pub fn region(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = city)] #[doc = "Getter for the `city` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/city)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn city(this: &PaymentAddress) -> String; + pub fn city(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = dependentLocality)] #[doc = "Getter for the `dependentLocality` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/dependentLocality)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn dependent_locality(this: &PaymentAddress) -> String; + pub fn dependent_locality(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = postalCode)] #[doc = "Getter for the `postalCode` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/postalCode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn postal_code(this: &PaymentAddress) -> String; + pub fn postal_code(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = sortingCode)] #[doc = "Getter for the `sortingCode` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/sortingCode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn sorting_code(this: &PaymentAddress) -> String; + pub fn sorting_code(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = languageCode)] #[doc = "Getter for the `languageCode` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/languageCode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn language_code(this: &PaymentAddress) -> String; + pub fn language_code(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = organization)] #[doc = "Getter for the `organization` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/organization)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn organization(this: &PaymentAddress) -> String; + pub fn organization(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = recipient)] #[doc = "Getter for the `recipient` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/recipient)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn recipient(this: &PaymentAddress) -> String; + pub fn recipient(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentAddress" , js_name = phone)] #[doc = "Getter for the `phone` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentAddress/phone)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentAddress`*"] - pub fn phone(this: &PaymentAddress) -> String; + pub fn phone(this: &PaymentAddress) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "PaymentAddress" , js_name = toJSON)] #[doc = "The `toJSON()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PaymentMethodChangeEvent.rs b/crates/web-sys/src/features/gen_PaymentMethodChangeEvent.rs index cfd9aa62104..540a249d493 100644 --- a/crates/web-sys/src/features/gen_PaymentMethodChangeEvent.rs +++ b/crates/web-sys/src/features/gen_PaymentMethodChangeEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentMethodChangeEvent/methodName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEvent`*"] - pub fn method_name(this: &PaymentMethodChangeEvent) -> String; + pub fn method_name(this: &PaymentMethodChangeEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentMethodChangeEvent" , js_name = methodDetails)] #[doc = "Getter for the `methodDetails` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs index 704c8b3e6de..87c5f878523 100644 --- a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] #[wasm_bindgen(method, getter = "methodName")] - pub fn get_method_name(this: &PaymentMethodChangeEventInit) -> String; + pub fn get_method_name(this: &PaymentMethodChangeEventInit) -> ::alloc::string::String; #[doc = "Change the `methodName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentMethodChangeEventInit`*"] diff --git a/crates/web-sys/src/features/gen_PaymentResponse.rs b/crates/web-sys/src/features/gen_PaymentResponse.rs index 7b425575896..bcf13501191 100644 --- a/crates/web-sys/src/features/gen_PaymentResponse.rs +++ b/crates/web-sys/src/features/gen_PaymentResponse.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/requestId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn request_id(this: &PaymentResponse) -> String; + pub fn request_id(this: &PaymentResponse) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentResponse" , js_name = methodName)] #[doc = "Getter for the `methodName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/methodName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn method_name(this: &PaymentResponse) -> String; + pub fn method_name(this: &PaymentResponse) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PaymentResponse" , js_name = details)] #[doc = "Getter for the `details` field of this object."] #[doc = ""] @@ -47,28 +47,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/shippingOption)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn shipping_option(this: &PaymentResponse) -> Option; + pub fn shipping_option(this: &PaymentResponse) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "PaymentResponse" , js_name = payerName)] #[doc = "Getter for the `payerName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/payerName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn payer_name(this: &PaymentResponse) -> Option; + pub fn payer_name(this: &PaymentResponse) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "PaymentResponse" , js_name = payerEmail)] #[doc = "Getter for the `payerEmail` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/payerEmail)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn payer_email(this: &PaymentResponse) -> Option; + pub fn payer_email(this: &PaymentResponse) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "PaymentResponse" , js_name = payerPhone)] #[doc = "Getter for the `payerPhone` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PaymentResponse/payerPhone)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PaymentResponse`*"] - pub fn payer_phone(this: &PaymentResponse) -> Option; + pub fn payer_phone(this: &PaymentResponse) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "PaymentResponse" , js_name = complete)] #[doc = "The `complete()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Pbkdf2Params.rs b/crates/web-sys/src/features/gen_Pbkdf2Params.rs index 63318841580..ad375504af1 100644 --- a/crates/web-sys/src/features/gen_Pbkdf2Params.rs +++ b/crates/web-sys/src/features/gen_Pbkdf2Params.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &Pbkdf2Params) -> String; + pub fn get_name(this: &Pbkdf2Params) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Pbkdf2Params`*"] diff --git a/crates/web-sys/src/features/gen_PerformanceEntry.rs b/crates/web-sys/src/features/gen_PerformanceEntry.rs index 5427e6b8dca..3b261b8bb4c 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntry.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntry.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntry`*"] - pub fn name(this: &PerformanceEntry) -> String; + pub fn name(this: &PerformanceEntry) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PerformanceEntry" , js_name = entryType)] #[doc = "Getter for the `entryType` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntry`*"] - pub fn entry_type(this: &PerformanceEntry) -> String; + pub fn entry_type(this: &PerformanceEntry) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PerformanceEntry" , js_name = startTime)] #[doc = "Getter for the `startTime` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs index a8c4e2a9e28..54ac82a5611 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, getter = "entryType")] - pub fn get_entry_type(this: &PerformanceEntryEventInit) -> Option; + pub fn get_entry_type(this: &PerformanceEntryEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `entryType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PerformanceEntryEventInit) -> Option; + pub fn get_name(this: &PerformanceEntryEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] @@ -84,7 +84,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &PerformanceEntryEventInit) -> Option; + pub fn get_origin(this: &PerformanceEntryEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryEventInit`*"] diff --git a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs index 9300c84489a..8a39f177022 100644 --- a/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs +++ b/crates/web-sys/src/features/gen_PerformanceEntryFilterOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, getter = "entryType")] - pub fn get_entry_type(this: &PerformanceEntryFilterOptions) -> Option; + pub fn get_entry_type(this: &PerformanceEntryFilterOptions) -> Option<::alloc::string::String>; #[doc = "Change the `entryType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] @@ -24,7 +24,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, getter = "initiatorType")] - pub fn get_initiator_type(this: &PerformanceEntryFilterOptions) -> Option; + pub fn get_initiator_type( + this: &PerformanceEntryFilterOptions, + ) -> Option<::alloc::string::String>; #[doc = "Change the `initiatorType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] @@ -34,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PerformanceEntryFilterOptions) -> Option; + pub fn get_name(this: &PerformanceEntryFilterOptions) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceEntryFilterOptions`*"] diff --git a/crates/web-sys/src/features/gen_PerformanceResourceTiming.rs b/crates/web-sys/src/features/gen_PerformanceResourceTiming.rs index 765234d6f9a..1f46626b3b4 100644 --- a/crates/web-sys/src/features/gen_PerformanceResourceTiming.rs +++ b/crates/web-sys/src/features/gen_PerformanceResourceTiming.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/initiatorType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceResourceTiming`*"] - pub fn initiator_type(this: &PerformanceResourceTiming) -> String; + pub fn initiator_type(this: &PerformanceResourceTiming) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PerformanceResourceTiming" , js_name = nextHopProtocol)] #[doc = "Getter for the `nextHopProtocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/nextHopProtocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceResourceTiming`*"] - pub fn next_hop_protocol(this: &PerformanceResourceTiming) -> String; + pub fn next_hop_protocol(this: &PerformanceResourceTiming) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PerformanceResourceTiming" , js_name = workerStart)] #[doc = "Getter for the `workerStart` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PerformanceServerTiming.rs b/crates/web-sys/src/features/gen_PerformanceServerTiming.rs index 130c6fe229b..46a4dbb76c9 100644 --- a/crates/web-sys/src/features/gen_PerformanceServerTiming.rs +++ b/crates/web-sys/src/features/gen_PerformanceServerTiming.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceServerTiming/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceServerTiming`*"] - pub fn name(this: &PerformanceServerTiming) -> String; + pub fn name(this: &PerformanceServerTiming) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PerformanceServerTiming" , js_name = duration)] #[doc = "Getter for the `duration` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceServerTiming/description)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PerformanceServerTiming`*"] - pub fn description(this: &PerformanceServerTiming) -> String; + pub fn description(this: &PerformanceServerTiming) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "PerformanceServerTiming" , js_name = toJSON)] #[doc = "The `toJSON()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Plugin.rs b/crates/web-sys/src/features/gen_Plugin.rs index dc2e59cd83a..4773f398dc7 100644 --- a/crates/web-sys/src/features/gen_Plugin.rs +++ b/crates/web-sys/src/features/gen_Plugin.rs @@ -18,28 +18,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Plugin/description)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Plugin`*"] - pub fn description(this: &Plugin) -> String; + pub fn description(this: &Plugin) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Plugin" , js_name = filename)] #[doc = "Getter for the `filename` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Plugin/filename)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Plugin`*"] - pub fn filename(this: &Plugin) -> String; + pub fn filename(this: &Plugin) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Plugin" , js_name = version)] #[doc = "Getter for the `version` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Plugin/version)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Plugin`*"] - pub fn version(this: &Plugin) -> String; + pub fn version(this: &Plugin) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Plugin" , js_name = name)] #[doc = "Getter for the `name` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Plugin/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Plugin`*"] - pub fn name(this: &Plugin) -> String; + pub fn name(this: &Plugin) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Plugin" , js_name = length)] #[doc = "Getter for the `length` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs index ec2914c4923..dadfa65101d 100644 --- a/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs +++ b/crates/web-sys/src/features/gen_PluginCrashedEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, getter = "browserDumpID")] - pub fn get_browser_dump_id(this: &PluginCrashedEventInit) -> Option; + pub fn get_browser_dump_id(this: &PluginCrashedEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `browserDumpID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, getter = "pluginDumpID")] - pub fn get_plugin_dump_id(this: &PluginCrashedEventInit) -> Option; + pub fn get_plugin_dump_id(this: &PluginCrashedEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pluginDumpID` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, getter = "pluginFilename")] - pub fn get_plugin_filename(this: &PluginCrashedEventInit) -> Option; + pub fn get_plugin_filename(this: &PluginCrashedEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pluginFilename` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] @@ -94,7 +94,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] #[wasm_bindgen(method, getter = "pluginName")] - pub fn get_plugin_name(this: &PluginCrashedEventInit) -> Option; + pub fn get_plugin_name(this: &PluginCrashedEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pluginName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PluginCrashedEventInit`*"] diff --git a/crates/web-sys/src/features/gen_PointerEvent.rs b/crates/web-sys/src/features/gen_PointerEvent.rs index ddfa8e54683..8fcffa74f08 100644 --- a/crates/web-sys/src/features/gen_PointerEvent.rs +++ b/crates/web-sys/src/features/gen_PointerEvent.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEvent`*"] - pub fn pointer_type(this: &PointerEvent) -> String; + pub fn pointer_type(this: &PointerEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PointerEvent" , js_name = isPrimary)] #[doc = "Getter for the `isPrimary` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PointerEventInit.rs b/crates/web-sys/src/features/gen_PointerEventInit.rs index c07ee4a26d4..6f109e87931 100644 --- a/crates/web-sys/src/features/gen_PointerEventInit.rs +++ b/crates/web-sys/src/features/gen_PointerEventInit.rs @@ -328,7 +328,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] #[wasm_bindgen(method, getter = "pointerType")] - pub fn get_pointer_type(this: &PointerEventInit) -> Option; + pub fn get_pointer_type(this: &PointerEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pointerType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PointerEventInit`*"] diff --git a/crates/web-sys/src/features/gen_PopupBlockedEvent.rs b/crates/web-sys/src/features/gen_PopupBlockedEvent.rs index ee0cf95b5b7..b771da63948 100644 --- a/crates/web-sys/src/features/gen_PopupBlockedEvent.rs +++ b/crates/web-sys/src/features/gen_PopupBlockedEvent.rs @@ -26,14 +26,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PopupBlockedEvent/popupWindowName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEvent`*"] - pub fn popup_window_name(this: &PopupBlockedEvent) -> Option; + pub fn popup_window_name(this: &PopupBlockedEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "PopupBlockedEvent" , js_name = popupWindowFeatures)] #[doc = "Getter for the `popupWindowFeatures` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PopupBlockedEvent/popupWindowFeatures)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEvent`*"] - pub fn popup_window_features(this: &PopupBlockedEvent) -> Option; + pub fn popup_window_features(this: &PopupBlockedEvent) -> Option<::alloc::string::String>; #[wasm_bindgen(catch, constructor, js_class = "PopupBlockedEvent")] #[doc = "The `new PopupBlockedEvent(..)` constructor, creating a new instance of `PopupBlockedEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs index 94ae9d2c24d..045d903b4cc 100644 --- a/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs +++ b/crates/web-sys/src/features/gen_PopupBlockedEventInit.rs @@ -44,7 +44,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, getter = "popupWindowFeatures")] - pub fn get_popup_window_features(this: &PopupBlockedEventInit) -> Option; + pub fn get_popup_window_features( + this: &PopupBlockedEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `popupWindowFeatures` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] @@ -54,7 +56,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] #[wasm_bindgen(method, getter = "popupWindowName")] - pub fn get_popup_window_name(this: &PopupBlockedEventInit) -> Option; + pub fn get_popup_window_name(this: &PopupBlockedEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `popupWindowName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PopupBlockedEventInit`*"] diff --git a/crates/web-sys/src/features/gen_PositionError.rs b/crates/web-sys/src/features/gen_PositionError.rs index c454b7417c6..8c6dc2ace34 100644 --- a/crates/web-sys/src/features/gen_PositionError.rs +++ b/crates/web-sys/src/features/gen_PositionError.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PositionError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PositionError`*"] - pub fn message(this: &PositionError) -> String; + pub fn message(this: &PositionError) -> ::alloc::string::String; } impl PositionError { #[doc = "The `PositionError.PERMISSION_DENIED` const."] diff --git a/crates/web-sys/src/features/gen_PresentationConnection.rs b/crates/web-sys/src/features/gen_PresentationConnection.rs index f7099833a71..c3007756487 100644 --- a/crates/web-sys/src/features/gen_PresentationConnection.rs +++ b/crates/web-sys/src/features/gen_PresentationConnection.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PresentationConnection/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`*"] - pub fn id(this: &PresentationConnection) -> String; + pub fn id(this: &PresentationConnection) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "PresentationConnection" , js_name = url)] #[doc = "Getter for the `url` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PresentationConnection/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnection`*"] - pub fn url(this: &PresentationConnection) -> String; + pub fn url(this: &PresentationConnection) -> ::alloc::string::String; #[cfg(feature = "PresentationConnectionState")] # [wasm_bindgen (structural , method , getter , js_class = "PresentationConnection" , js_name = state)] #[doc = "Getter for the `state` field of this object."] diff --git a/crates/web-sys/src/features/gen_PresentationConnectionCloseEvent.rs b/crates/web-sys/src/features/gen_PresentationConnectionCloseEvent.rs index 3e1ca525f18..338f15698fc 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionCloseEvent.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionCloseEvent.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PresentationConnectionCloseEvent/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEvent`*"] - pub fn message(this: &PresentationConnectionCloseEvent) -> String; + pub fn message(this: &PresentationConnectionCloseEvent) -> ::alloc::string::String; #[cfg(feature = "PresentationConnectionCloseEventInit")] #[wasm_bindgen(catch, constructor, js_class = "PresentationConnectionCloseEvent")] #[doc = "The `new PresentationConnectionCloseEvent(..)` constructor, creating a new instance of `PresentationConnectionCloseEvent`."] diff --git a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs index aef67635b74..3e98fe959de 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs @@ -44,7 +44,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] #[wasm_bindgen(method, getter = "message")] - pub fn get_message(this: &PresentationConnectionCloseEventInit) -> Option; + pub fn get_message( + this: &PresentationConnectionCloseEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PresentationConnectionCloseEventInit`*"] diff --git a/crates/web-sys/src/features/gen_ProcessingInstruction.rs b/crates/web-sys/src/features/gen_ProcessingInstruction.rs index 370b012bfbd..a2487c06d90 100644 --- a/crates/web-sys/src/features/gen_ProcessingInstruction.rs +++ b/crates/web-sys/src/features/gen_ProcessingInstruction.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProcessingInstruction`*"] - pub fn target(this: &ProcessingInstruction) -> String; + pub fn target(this: &ProcessingInstruction) -> ::alloc::string::String; #[cfg(feature = "StyleSheet")] # [wasm_bindgen (structural , method , getter , js_class = "ProcessingInstruction" , js_name = sheet)] #[doc = "Getter for the `sheet` field of this object."] diff --git a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs index 0aa2993c14a..52796342058 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineMarker.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, getter = "causeName")] - pub fn get_cause_name(this: &ProfileTimelineMarker) -> Option; + pub fn get_cause_name(this: &ProfileTimelineMarker) -> Option<::alloc::string::String>; #[doc = "Change the `causeName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] @@ -91,7 +91,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &ProfileTimelineMarker) -> Option; + pub fn get_name(this: &ProfileTimelineMarker) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] @@ -141,7 +141,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &ProfileTimelineMarker) -> Option; + pub fn get_type(this: &ProfileTimelineMarker) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineMarker`*"] diff --git a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs index 0c0181b6eee..7633949b205 100644 --- a/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs +++ b/crates/web-sys/src/features/gen_ProfileTimelineStackFrame.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, getter = "asyncCause")] - pub fn get_async_cause(this: &ProfileTimelineStackFrame) -> Option; + pub fn get_async_cause(this: &ProfileTimelineStackFrame) -> Option<::alloc::string::String>; #[doc = "Change the `asyncCause` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] @@ -44,7 +44,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, getter = "functionDisplayName")] - pub fn get_function_display_name(this: &ProfileTimelineStackFrame) -> Option; + pub fn get_function_display_name( + this: &ProfileTimelineStackFrame, + ) -> Option<::alloc::string::String>; #[doc = "Change the `functionDisplayName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] @@ -74,7 +76,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] #[wasm_bindgen(method, getter = "source")] - pub fn get_source(this: &ProfileTimelineStackFrame) -> Option; + pub fn get_source(this: &ProfileTimelineStackFrame) -> Option<::alloc::string::String>; #[doc = "Change the `source` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ProfileTimelineStackFrame`*"] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredential.rs b/crates/web-sys/src/features/gen_PublicKeyCredential.rs index 90a07419189..0b4a0a929aa 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredential.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredential.rs @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn authenticator_attachment(this: &PublicKeyCredential) -> Option; + pub fn authenticator_attachment(this: &PublicKeyCredential) -> Option<::alloc::string::String>; #[cfg(feature = "AuthenticationExtensionsClientOutputs")] # [wasm_bindgen (method , structural , js_class = "PublicKeyCredential" , js_name = getClientExtensionResults)] #[doc = "The `getClientExtensionResults()` method."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs index b56ce07fa5d..141656b0552 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestation")] - pub fn get_attestation(this: &PublicKeyCredentialCreationOptionsJson) -> Option; + pub fn get_attestation( + this: &PublicKeyCredentialCreationOptionsJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestation` field of this object."] #[doc = ""] @@ -88,7 +90,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "challenge")] - pub fn get_challenge(this: &PublicKeyCredentialCreationOptionsJson) -> String; + pub fn get_challenge(this: &PublicKeyCredentialCreationOptionsJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `challenge` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs index adb9f81e42e..8da096e18c3 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &PublicKeyCredentialDescriptorJson) -> String; + pub fn get_id(this: &PublicKeyCredentialDescriptorJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -58,7 +58,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &PublicKeyCredentialDescriptorJson) -> String; + pub fn get_type(this: &PublicKeyCredentialDescriptorJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs index c27a716f361..86167d5d1af 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs @@ -15,7 +15,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] #[deprecated] #[wasm_bindgen(method, getter = "icon")] - pub fn get_icon(this: &PublicKeyCredentialEntity) -> Option; + pub fn get_icon(this: &PublicKeyCredentialEntity) -> Option<::alloc::string::String>; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PublicKeyCredentialEntity) -> String; + pub fn get_name(this: &PublicKeyCredentialEntity) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialEntity`*"] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs index ddc9c055760..086a6bdf104 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs @@ -33,7 +33,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestation")] - pub fn get_attestation(this: &PublicKeyCredentialRequestOptions) -> Option; + pub fn get_attestation( + this: &PublicKeyCredentialRequestOptions, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestation` field of this object."] #[doc = ""] @@ -115,7 +117,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] #[wasm_bindgen(method, getter = "rpId")] - pub fn get_rp_id(this: &PublicKeyCredentialRequestOptions) -> Option; + pub fn get_rp_id(this: &PublicKeyCredentialRequestOptions) -> Option<::alloc::string::String>; #[doc = "Change the `rpId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs index a7bf1f6c870..2e171f3207a 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs @@ -45,7 +45,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "attestation")] - pub fn get_attestation(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + pub fn get_attestation( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `attestation` field of this object."] #[doc = ""] @@ -86,7 +88,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "challenge")] - pub fn get_challenge(this: &PublicKeyCredentialRequestOptionsJson) -> String; + pub fn get_challenge(this: &PublicKeyCredentialRequestOptionsJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `challenge` field of this object."] #[doc = ""] @@ -147,7 +149,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "rpId")] - pub fn get_rp_id(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + pub fn get_rp_id( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rpId` field of this object."] #[doc = ""] @@ -183,7 +187,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "userVerification")] - pub fn get_user_verification(this: &PublicKeyCredentialRequestOptionsJson) -> Option; + pub fn get_user_verification( + this: &PublicKeyCredentialRequestOptionsJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `userVerification` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs index 17f68408a5d..33bfd85dd57 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs @@ -15,7 +15,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[deprecated] #[wasm_bindgen(method, getter = "icon")] - pub fn get_icon(this: &PublicKeyCredentialRpEntity) -> Option; + pub fn get_icon(this: &PublicKeyCredentialRpEntity) -> Option<::alloc::string::String>; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PublicKeyCredentialRpEntity) -> String; + pub fn get_name(this: &PublicKeyCredentialRpEntity) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &PublicKeyCredentialRpEntity) -> Option; + pub fn get_id(this: &PublicKeyCredentialRpEntity) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRpEntity`*"] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs index d04a2e50fda..9acbacfdaa1 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs @@ -15,7 +15,7 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[deprecated] #[wasm_bindgen(method, getter = "icon")] - pub fn get_icon(this: &PublicKeyCredentialUserEntity) -> Option; + pub fn get_icon(this: &PublicKeyCredentialUserEntity) -> Option<::alloc::string::String>; #[doc = "Change the `icon` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PublicKeyCredentialUserEntity) -> String; + pub fn get_name(this: &PublicKeyCredentialUserEntity) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] #[wasm_bindgen(method, getter = "displayName")] - pub fn get_display_name(this: &PublicKeyCredentialUserEntity) -> String; + pub fn get_display_name(this: &PublicKeyCredentialUserEntity) -> ::alloc::string::String; #[doc = "Change the `displayName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialUserEntity`*"] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs index 7dc46e46b81..80b9176bd88 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "displayName")] - pub fn get_display_name(this: &PublicKeyCredentialUserEntityJson) -> String; + pub fn get_display_name(this: &PublicKeyCredentialUserEntityJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `displayName` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &PublicKeyCredentialUserEntityJson) -> String; + pub fn get_id(this: &PublicKeyCredentialUserEntityJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -58,7 +58,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &PublicKeyCredentialUserEntityJson) -> String; + pub fn get_name(this: &PublicKeyCredentialUserEntityJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `name` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_PushMessageData.rs b/crates/web-sys/src/features/gen_PushMessageData.rs index cd9218376aa..0d09c0d5198 100644 --- a/crates/web-sys/src/features/gen_PushMessageData.rs +++ b/crates/web-sys/src/features/gen_PushMessageData.rs @@ -40,5 +40,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushMessageData/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushMessageData`*"] - pub fn text(this: &PushMessageData) -> String; + pub fn text(this: &PushMessageData) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_PushSubscription.rs b/crates/web-sys/src/features/gen_PushSubscription.rs index 38ffea5c26a..317afa79a4c 100644 --- a/crates/web-sys/src/features/gen_PushSubscription.rs +++ b/crates/web-sys/src/features/gen_PushSubscription.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/endpoint)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscription`*"] - pub fn endpoint(this: &PushSubscription) -> String; + pub fn endpoint(this: &PushSubscription) -> ::alloc::string::String; #[cfg(feature = "PushSubscriptionOptions")] # [wasm_bindgen (structural , method , getter , js_class = "PushSubscription" , js_name = options)] #[doc = "Getter for the `options` field of this object."] diff --git a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs index 5ad982d96ca..846cfcffc04 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, getter = "endpoint")] - pub fn get_endpoint(this: &PushSubscriptionInit) -> String; + pub fn get_endpoint(this: &PushSubscriptionInit) -> ::alloc::string::String; #[doc = "Change the `endpoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] #[wasm_bindgen(method, getter = "scope")] - pub fn get_scope(this: &PushSubscriptionInit) -> String; + pub fn get_scope(this: &PushSubscriptionInit) -> ::alloc::string::String; #[doc = "Change the `scope` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"] diff --git a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs index c3b04f9af29..31e4df5e973 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionJson.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionJson.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] #[wasm_bindgen(method, getter = "endpoint")] - pub fn get_endpoint(this: &PushSubscriptionJson) -> Option; + pub fn get_endpoint(this: &PushSubscriptionJson) -> Option<::alloc::string::String>; #[doc = "Change the `endpoint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionJson`*"] diff --git a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs index 80a07f5ef6c..dadba51e67a 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionKeys.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] #[wasm_bindgen(method, getter = "auth")] - pub fn get_auth(this: &PushSubscriptionKeys) -> Option; + pub fn get_auth(this: &PushSubscriptionKeys) -> Option<::alloc::string::String>; #[doc = "Change the `auth` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] #[wasm_bindgen(method, getter = "p256dh")] - pub fn get_p256dh(this: &PushSubscriptionKeys) -> Option; + pub fn get_p256dh(this: &PushSubscriptionKeys) -> Option<::alloc::string::String>; #[doc = "Change the `p256dh` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionKeys`*"] diff --git a/crates/web-sys/src/features/gen_RadioNodeList.rs b/crates/web-sys/src/features/gen_RadioNodeList.rs index 26ea3fc29cc..062c056c7a5 100644 --- a/crates/web-sys/src/features/gen_RadioNodeList.rs +++ b/crates/web-sys/src/features/gen_RadioNodeList.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RadioNodeList/value)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RadioNodeList`*"] - pub fn value(this: &RadioNodeList) -> String; + pub fn value(this: &RadioNodeList) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "RadioNodeList" , js_name = value)] #[doc = "Setter for the `value` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RegisterRequest.rs b/crates/web-sys/src/features/gen_RegisterRequest.rs index 0b3c741d805..a7cfa8a517b 100644 --- a/crates/web-sys/src/features/gen_RegisterRequest.rs +++ b/crates/web-sys/src/features/gen_RegisterRequest.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] #[wasm_bindgen(method, getter = "challenge")] - pub fn get_challenge(this: &RegisterRequest) -> Option; + pub fn get_challenge(this: &RegisterRequest) -> Option<::alloc::string::String>; #[doc = "Change the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &RegisterRequest) -> Option; + pub fn get_version(this: &RegisterRequest) -> Option<::alloc::string::String>; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterRequest`*"] diff --git a/crates/web-sys/src/features/gen_RegisterResponse.rs b/crates/web-sys/src/features/gen_RegisterResponse.rs index 3ec0f53e6b9..8c638b768de 100644 --- a/crates/web-sys/src/features/gen_RegisterResponse.rs +++ b/crates/web-sys/src/features/gen_RegisterResponse.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, getter = "clientData")] - pub fn get_client_data(this: &RegisterResponse) -> Option; + pub fn get_client_data(this: &RegisterResponse) -> Option<::alloc::string::String>; #[doc = "Change the `clientData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, getter = "errorMessage")] - pub fn get_error_message(this: &RegisterResponse) -> Option; + pub fn get_error_message(this: &RegisterResponse) -> Option<::alloc::string::String>; #[doc = "Change the `errorMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, getter = "registrationData")] - pub fn get_registration_data(this: &RegisterResponse) -> Option; + pub fn get_registration_data(this: &RegisterResponse) -> Option<::alloc::string::String>; #[doc = "Change the `registrationData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &RegisterResponse) -> Option; + pub fn get_version(this: &RegisterResponse) -> Option<::alloc::string::String>; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisterResponse`*"] diff --git a/crates/web-sys/src/features/gen_RegisteredKey.rs b/crates/web-sys/src/features/gen_RegisteredKey.rs index 9698b9c89c3..986374c4ebc 100644 --- a/crates/web-sys/src/features/gen_RegisteredKey.rs +++ b/crates/web-sys/src/features/gen_RegisteredKey.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, getter = "appId")] - pub fn get_app_id(this: &RegisteredKey) -> Option; + pub fn get_app_id(this: &RegisteredKey) -> Option<::alloc::string::String>; #[doc = "Change the `appId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, getter = "keyHandle")] - pub fn get_key_handle(this: &RegisteredKey) -> Option; + pub fn get_key_handle(this: &RegisteredKey) -> Option<::alloc::string::String>; #[doc = "Change the `keyHandle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &RegisteredKey) -> Option; + pub fn get_version(this: &RegisteredKey) -> Option<::alloc::string::String>; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegisteredKey`*"] diff --git a/crates/web-sys/src/features/gen_RegistrationOptions.rs b/crates/web-sys/src/features/gen_RegistrationOptions.rs index fe380286b6f..70f285a09c1 100644 --- a/crates/web-sys/src/features/gen_RegistrationOptions.rs +++ b/crates/web-sys/src/features/gen_RegistrationOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] #[wasm_bindgen(method, getter = "scope")] - pub fn get_scope(this: &RegistrationOptions) -> Option; + pub fn get_scope(this: &RegistrationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `scope` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &RegistrationOptions) -> Option; + pub fn get_type(this: &RegistrationOptions) -> Option<::alloc::string::String>; #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`*"] diff --git a/crates/web-sys/src/features/gen_RegistrationResponseJson.rs b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs index c34df99d37e..7f298fc1e50 100644 --- a/crates/web-sys/src/features/gen_RegistrationResponseJson.rs +++ b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs @@ -22,7 +22,9 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "authenticatorAttachment")] - pub fn get_authenticator_attachment(this: &RegistrationResponseJson) -> Option; + pub fn get_authenticator_attachment( + this: &RegistrationResponseJson, + ) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `authenticatorAttachment` field of this object."] #[doc = ""] @@ -65,7 +67,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RegistrationResponseJson) -> String; + pub fn get_id(this: &RegistrationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -83,7 +85,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "rawId")] - pub fn get_raw_id(this: &RegistrationResponseJson) -> String; + pub fn get_raw_id(this: &RegistrationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rawId` field of this object."] #[doc = ""] @@ -124,7 +126,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "type")] - pub fn get_type(this: &RegistrationResponseJson) -> String; + pub fn get_type(this: &RegistrationResponseJson) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Request.rs b/crates/web-sys/src/features/gen_Request.rs index 3be945fa912..2561fb5dc66 100644 --- a/crates/web-sys/src/features/gen_Request.rs +++ b/crates/web-sys/src/features/gen_Request.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Request/method)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Request`*"] - pub fn method(this: &Request) -> String; + pub fn method(this: &Request) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Request" , js_name = url)] #[doc = "Getter for the `url` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Request/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Request`*"] - pub fn url(this: &Request) -> String; + pub fn url(this: &Request) -> ::alloc::string::String; #[cfg(feature = "Headers")] # [wasm_bindgen (structural , method , getter , js_class = "Request" , js_name = headers)] #[doc = "Getter for the `headers` field of this object."] @@ -48,7 +48,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Request/referrer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Request`*"] - pub fn referrer(this: &Request) -> String; + pub fn referrer(this: &Request) -> ::alloc::string::String; #[cfg(feature = "ReferrerPolicy")] # [wasm_bindgen (structural , method , getter , js_class = "Request" , js_name = referrerPolicy)] #[doc = "Getter for the `referrerPolicy` field of this object."] @@ -95,7 +95,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Request/integrity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Request`*"] - pub fn integrity(this: &Request) -> String; + pub fn integrity(this: &Request) -> ::alloc::string::String; #[cfg(feature = "AbortSignal")] # [wasm_bindgen (structural , method , getter , js_class = "Request" , js_name = signal)] #[doc = "Getter for the `signal` field of this object."] diff --git a/crates/web-sys/src/features/gen_RequestInit.rs b/crates/web-sys/src/features/gen_RequestInit.rs index ed3eb257b7e..83d48276202 100644 --- a/crates/web-sys/src/features/gen_RequestInit.rs +++ b/crates/web-sys/src/features/gen_RequestInit.rs @@ -58,7 +58,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, getter = "integrity")] - pub fn get_integrity(this: &RequestInit) -> Option; + pub fn get_integrity(this: &RequestInit) -> Option<::alloc::string::String>; #[doc = "Change the `integrity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] @@ -68,7 +68,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, getter = "method")] - pub fn get_method(this: &RequestInit) -> Option; + pub fn get_method(this: &RequestInit) -> Option<::alloc::string::String>; #[doc = "Change the `method` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] @@ -114,7 +114,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] #[wasm_bindgen(method, getter = "referrer")] - pub fn get_referrer(this: &RequestInit) -> Option; + pub fn get_referrer(this: &RequestInit) -> Option<::alloc::string::String>; #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestInit`*"] diff --git a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs index 5c0c2f0758b..d1eee89efe3 100644 --- a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs +++ b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs @@ -14,7 +14,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] #[wasm_bindgen(method, getter = "keySystem")] - pub fn get_key_system(this: &RequestMediaKeySystemAccessNotification) -> String; + pub fn get_key_system( + this: &RequestMediaKeySystemAccessNotification, + ) -> ::alloc::string::String; #[doc = "Change the `keySystem` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RequestMediaKeySystemAccessNotification`*"] diff --git a/crates/web-sys/src/features/gen_Response.rs b/crates/web-sys/src/features/gen_Response.rs index 942fb9cb56c..d569ae4df11 100644 --- a/crates/web-sys/src/features/gen_Response.rs +++ b/crates/web-sys/src/features/gen_Response.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] - pub fn url(this: &Response) -> String; + pub fn url(this: &Response) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Response" , js_name = redirected)] #[doc = "Getter for the `redirected` field of this object."] #[doc = ""] @@ -54,7 +54,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Response/statusText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Response`*"] - pub fn status_text(this: &Response) -> String; + pub fn status_text(this: &Response) -> ::alloc::string::String; #[cfg(feature = "Headers")] # [wasm_bindgen (structural , method , getter , js_class = "Response" , js_name = headers)] #[doc = "Getter for the `headers` field of this object."] diff --git a/crates/web-sys/src/features/gen_ResponseInit.rs b/crates/web-sys/src/features/gen_ResponseInit.rs index 0d65c079458..8323983698f 100644 --- a/crates/web-sys/src/features/gen_ResponseInit.rs +++ b/crates/web-sys/src/features/gen_ResponseInit.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] #[wasm_bindgen(method, getter = "statusText")] - pub fn get_status_text(this: &ResponseInit) -> Option; + pub fn get_status_text(this: &ResponseInit) -> Option<::alloc::string::String>; #[doc = "Change the `statusText` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"] diff --git a/crates/web-sys/src/features/gen_RsaOaepParams.rs b/crates/web-sys/src/features/gen_RsaOaepParams.rs index f0ae80e6358..7bf27c6183c 100644 --- a/crates/web-sys/src/features/gen_RsaOaepParams.rs +++ b/crates/web-sys/src/features/gen_RsaOaepParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &RsaOaepParams) -> String; + pub fn get_name(this: &RsaOaepParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOaepParams`*"] diff --git a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs index d31ec101bce..eb9b9fba968 100644 --- a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs +++ b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, getter = "d")] - pub fn get_d(this: &RsaOtherPrimesInfo) -> String; + pub fn get_d(this: &RsaOtherPrimesInfo) -> ::alloc::string::String; #[doc = "Change the `d` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, getter = "r")] - pub fn get_r(this: &RsaOtherPrimesInfo) -> String; + pub fn get_r(this: &RsaOtherPrimesInfo) -> ::alloc::string::String; #[doc = "Change the `r` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] #[wasm_bindgen(method, getter = "t")] - pub fn get_t(this: &RsaOtherPrimesInfo) -> String; + pub fn get_t(this: &RsaOtherPrimesInfo) -> ::alloc::string::String; #[doc = "Change the `t` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaOtherPrimesInfo`*"] diff --git a/crates/web-sys/src/features/gen_RsaPssParams.rs b/crates/web-sys/src/features/gen_RsaPssParams.rs index 1fd87410283..8760c5de791 100644 --- a/crates/web-sys/src/features/gen_RsaPssParams.rs +++ b/crates/web-sys/src/features/gen_RsaPssParams.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &RsaPssParams) -> String; + pub fn get_name(this: &RsaPssParams) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RsaPssParams`*"] diff --git a/crates/web-sys/src/features/gen_RtcCodecStats.rs b/crates/web-sys/src/features/gen_RtcCodecStats.rs index 81bcee55873..e9a3ef90a70 100644 --- a/crates/web-sys/src/features/gen_RtcCodecStats.rs +++ b/crates/web-sys/src/features/gen_RtcCodecStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcCodecStats) -> Option; + pub fn get_id(this: &RtcCodecStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, getter = "codec")] - pub fn get_codec(this: &RtcCodecStats) -> Option; + pub fn get_codec(this: &RtcCodecStats) -> Option<::alloc::string::String>; #[doc = "Change the `codec` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] @@ -76,7 +76,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] #[wasm_bindgen(method, getter = "parameters")] - pub fn get_parameters(this: &RtcCodecStats) -> Option; + pub fn get_parameters(this: &RtcCodecStats) -> Option<::alloc::string::String>; #[doc = "Change the `parameters` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcCodecStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcConfiguration.rs b/crates/web-sys/src/features/gen_RtcConfiguration.rs index 93343f2b14b..3d70b68dbfd 100644 --- a/crates/web-sys/src/features/gen_RtcConfiguration.rs +++ b/crates/web-sys/src/features/gen_RtcConfiguration.rs @@ -58,7 +58,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] #[wasm_bindgen(method, getter = "peerIdentity")] - pub fn get_peer_identity(this: &RtcConfiguration) -> Option; + pub fn get_peer_identity(this: &RtcConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `peerIdentity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`*"] diff --git a/crates/web-sys/src/features/gen_RtcDataChannel.rs b/crates/web-sys/src/features/gen_RtcDataChannel.rs index 9aac13cf490..690721a3c1d 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannel.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannel.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannel`*"] - pub fn label(this: &RtcDataChannel) -> String; + pub fn label(this: &RtcDataChannel) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "RTCDataChannel" , js_name = id)] #[doc = "Getter for the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs index 1e3a9331a66..44f94a1acab 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelInit.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] #[wasm_bindgen(method, getter = "protocol")] - pub fn get_protocol(this: &RtcDataChannelInit) -> Option; + pub fn get_protocol(this: &RtcDataChannelInit) -> Option<::alloc::string::String>; #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] diff --git a/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs index 32eb233b84b..40f1de3bf2c 100644 --- a/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs +++ b/crates/web-sys/src/features/gen_RtcEncodedAudioFrameMetadata.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "mimeType")] - pub fn get_mime_type(this: &RtcEncodedAudioFrameMetadata) -> Option; + pub fn get_mime_type(this: &RtcEncodedAudioFrameMetadata) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mimeType` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs index 9e544e9d4c3..c5cb3e80493 100644 --- a/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs +++ b/crates/web-sys/src/features/gen_RtcEncodedVideoFrameMetadata.rs @@ -98,7 +98,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "mimeType")] - pub fn get_mime_type(this: &RtcEncodedVideoFrameMetadata) -> Option; + pub fn get_mime_type(this: &RtcEncodedVideoFrameMetadata) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mimeType` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcIceCandidate.rs b/crates/web-sys/src/features/gen_RtcIceCandidate.rs index 35b21b74b2b..ef7762e2d04 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidate.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidate.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/candidate)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`*"] - pub fn candidate(this: &RtcIceCandidate) -> String; + pub fn candidate(this: &RtcIceCandidate) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "RTCIceCandidate" , js_name = candidate)] #[doc = "Setter for the `candidate` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/sdpMid)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidate`*"] - pub fn sdp_mid(this: &RtcIceCandidate) -> Option; + pub fn sdp_mid(this: &RtcIceCandidate) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "RTCIceCandidate" , js_name = sdpMid)] #[doc = "Setter for the `sdpMid` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs index 9268c3908da..442d5a9a898 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] #[wasm_bindgen(method, getter = "candidate")] - pub fn get_candidate(this: &RtcIceCandidateInit) -> String; + pub fn get_candidate(this: &RtcIceCandidateInit) -> ::alloc::string::String; #[doc = "Change the `candidate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] #[wasm_bindgen(method, getter = "sdpMid")] - pub fn get_sdp_mid(this: &RtcIceCandidateInit) -> Option; + pub fn get_sdp_mid(this: &RtcIceCandidateInit) -> Option<::alloc::string::String>; #[doc = "Change the `sdpMid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateInit`*"] diff --git a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs index 0ea8f977a5e..09b70f0eb49 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidatePairStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcIceCandidatePairStats) -> Option; + pub fn get_id(this: &RtcIceCandidatePairStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] @@ -96,7 +96,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, getter = "localCandidateId")] - pub fn get_local_candidate_id(this: &RtcIceCandidatePairStats) -> Option; + pub fn get_local_candidate_id( + this: &RtcIceCandidatePairStats, + ) -> Option<::alloc::string::String>; #[doc = "Change the `localCandidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] @@ -136,7 +138,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, getter = "remoteCandidateId")] - pub fn get_remote_candidate_id(this: &RtcIceCandidatePairStats) -> Option; + pub fn get_remote_candidate_id( + this: &RtcIceCandidatePairStats, + ) -> Option<::alloc::string::String>; #[doc = "Change the `remoteCandidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] @@ -168,7 +172,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] #[wasm_bindgen(method, getter = "transportId")] - pub fn get_transport_id(this: &RtcIceCandidatePairStats) -> Option; + pub fn get_transport_id(this: &RtcIceCandidatePairStats) -> Option<::alloc::string::String>; #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidatePairStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs index 6ea9e9880b2..cae28c69282 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcIceCandidateStats) -> Option; + pub fn get_id(this: &RtcIceCandidateStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, getter = "candidateId")] - pub fn get_candidate_id(this: &RtcIceCandidateStats) -> Option; + pub fn get_candidate_id(this: &RtcIceCandidateStats) -> Option<::alloc::string::String>; #[doc = "Change the `candidateId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] @@ -68,7 +68,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, getter = "componentId")] - pub fn get_component_id(this: &RtcIceCandidateStats) -> Option; + pub fn get_component_id(this: &RtcIceCandidateStats) -> Option<::alloc::string::String>; #[doc = "Change the `componentId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] @@ -78,7 +78,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, getter = "ipAddress")] - pub fn get_ip_address(this: &RtcIceCandidateStats) -> Option; + pub fn get_ip_address(this: &RtcIceCandidateStats) -> Option<::alloc::string::String>; #[doc = "Change the `ipAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] @@ -98,7 +98,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] #[wasm_bindgen(method, getter = "transport")] - pub fn get_transport(this: &RtcIceCandidateStats) -> Option; + pub fn get_transport(this: &RtcIceCandidateStats) -> Option<::alloc::string::String>; #[doc = "Change the `transport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceCandidateStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs index ffdf6a5ec07..33f5d6f6af7 100644 --- a/crates/web-sys/src/features/gen_RtcIceComponentStats.rs +++ b/crates/web-sys/src/features/gen_RtcIceComponentStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcIceComponentStats) -> Option; + pub fn get_id(this: &RtcIceComponentStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] @@ -86,7 +86,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] #[wasm_bindgen(method, getter = "transportId")] - pub fn get_transport_id(this: &RtcIceComponentStats) -> Option; + pub fn get_transport_id(this: &RtcIceComponentStats) -> Option<::alloc::string::String>; #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceComponentStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcIceServer.rs b/crates/web-sys/src/features/gen_RtcIceServer.rs index 9d68913411a..cc3e8785725 100644 --- a/crates/web-sys/src/features/gen_RtcIceServer.rs +++ b/crates/web-sys/src/features/gen_RtcIceServer.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, getter = "credential")] - pub fn get_credential(this: &RtcIceServer) -> Option; + pub fn get_credential(this: &RtcIceServer) -> Option<::alloc::string::String>; #[doc = "Change the `credential` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] @@ -36,7 +36,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &RtcIceServer) -> Option; + pub fn get_url(this: &RtcIceServer) -> Option<::alloc::string::String>; #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] @@ -56,7 +56,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] #[wasm_bindgen(method, getter = "username")] - pub fn get_username(this: &RtcIceServer) -> Option; + pub fn get_username(this: &RtcIceServer) -> Option<::alloc::string::String>; #[doc = "Change the `username` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIceServer`*"] diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs index 7458c2702a8..0b38bd9d8c5 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertion.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] #[wasm_bindgen(method, getter = "idp")] - pub fn get_idp(this: &RtcIdentityAssertion) -> Option; + pub fn get_idp(this: &RtcIdentityAssertion) -> Option<::alloc::string::String>; #[doc = "Change the `idp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &RtcIdentityAssertion) -> Option; + pub fn get_name(this: &RtcIdentityAssertion) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertion`*"] diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs index 8a7503430a2..8219c790013 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] #[wasm_bindgen(method, getter = "assertion")] - pub fn get_assertion(this: &RtcIdentityAssertionResult) -> String; + pub fn get_assertion(this: &RtcIdentityAssertionResult) -> ::alloc::string::String; #[doc = "Change the `assertion` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityAssertionResult`*"] diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs index e00b757903b..d085ff7d511 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] #[wasm_bindgen(method, getter = "domain")] - pub fn get_domain(this: &RtcIdentityProviderDetails) -> String; + pub fn get_domain(this: &RtcIdentityProviderDetails) -> ::alloc::string::String; #[doc = "Change the `domain` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] #[wasm_bindgen(method, getter = "protocol")] - pub fn get_protocol(this: &RtcIdentityProviderDetails) -> Option; + pub fn get_protocol(this: &RtcIdentityProviderDetails) -> Option<::alloc::string::String>; #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderDetails`*"] diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs index 2dc6811ef44..4b6e6cb03b0 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderOptions.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, getter = "peerIdentity")] - pub fn get_peer_identity(this: &RtcIdentityProviderOptions) -> Option; + pub fn get_peer_identity(this: &RtcIdentityProviderOptions) -> Option<::alloc::string::String>; #[doc = "Change the `peerIdentity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, getter = "protocol")] - pub fn get_protocol(this: &RtcIdentityProviderOptions) -> Option; + pub fn get_protocol(this: &RtcIdentityProviderOptions) -> Option<::alloc::string::String>; #[doc = "Change the `protocol` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] #[wasm_bindgen(method, getter = "usernameHint")] - pub fn get_username_hint(this: &RtcIdentityProviderOptions) -> Option; + pub fn get_username_hint(this: &RtcIdentityProviderOptions) -> Option<::alloc::string::String>; #[doc = "Change the `usernameHint` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityProviderOptions`*"] diff --git a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs index fd417af730f..6319985e688 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] #[wasm_bindgen(method, getter = "contents")] - pub fn get_contents(this: &RtcIdentityValidationResult) -> String; + pub fn get_contents(this: &RtcIdentityValidationResult) -> ::alloc::string::String; #[doc = "Change the `contents` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] #[wasm_bindgen(method, getter = "identity")] - pub fn get_identity(this: &RtcIdentityValidationResult) -> String; + pub fn get_identity(this: &RtcIdentityValidationResult) -> ::alloc::string::String; #[doc = "Change the `identity` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcIdentityValidationResult`*"] diff --git a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs index 21580dcb493..c1d37aac0cf 100644 --- a/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcInboundRtpStreamStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_id(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "codecId")] - pub fn get_codec_id(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_codec_id(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -116,7 +116,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaTrackId")] - pub fn get_media_track_id(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_media_track_id(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -126,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaType")] - pub fn get_media_type(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_media_type(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -156,7 +156,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "remoteId")] - pub fn get_remote_id(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_remote_id(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -166,7 +166,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "ssrc")] - pub fn get_ssrc(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_ssrc(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] @@ -176,7 +176,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "transportId")] - pub fn get_transport_id(this: &RtcInboundRtpStreamStats) -> Option; + pub fn get_transport_id(this: &RtcInboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcInboundRtpStreamStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs index 8dc44254a10..7ffbb3b8fc5 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcMediaStreamStats) -> Option; + pub fn get_id(this: &RtcMediaStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] @@ -46,7 +46,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] #[wasm_bindgen(method, getter = "streamIdentifier")] - pub fn get_stream_identifier(this: &RtcMediaStreamStats) -> Option; + pub fn get_stream_identifier(this: &RtcMediaStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `streamIdentifier` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs index 0ba64d2a16b..093c30d645a 100644 --- a/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs +++ b/crates/web-sys/src/features/gen_RtcMediaStreamTrackStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcMediaStreamTrackStats) -> Option; + pub fn get_id(this: &RtcMediaStreamTrackStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] @@ -176,7 +176,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] #[wasm_bindgen(method, getter = "trackIdentifier")] - pub fn get_track_identifier(this: &RtcMediaStreamTrackStats) -> Option; + pub fn get_track_identifier(this: &RtcMediaStreamTrackStats) + -> Option<::alloc::string::String>; #[doc = "Change the `trackIdentifier` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcMediaStreamTrackStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs index 093c0b0af22..06ebf0bcd0f 100644 --- a/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcOutboundRtpStreamStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_id(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "codecId")] - pub fn get_codec_id(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_codec_id(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -116,7 +116,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaTrackId")] - pub fn get_media_track_id(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_media_track_id(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -126,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaType")] - pub fn get_media_type(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_media_type(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -156,7 +156,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "remoteId")] - pub fn get_remote_id(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_remote_id(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -166,7 +166,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "ssrc")] - pub fn get_ssrc(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_ssrc(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] @@ -176,7 +176,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] #[wasm_bindgen(method, getter = "transportId")] - pub fn get_transport_id(this: &RtcOutboundRtpStreamStats) -> Option; + pub fn get_transport_id(this: &RtcOutboundRtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcOutboundRtpStreamStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcPeerConnection.rs b/crates/web-sys/src/features/gen_RtcPeerConnection.rs index 5c98c638706..9a96c5b3e7b 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnection.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnection.rs @@ -112,7 +112,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/idpLoginUrl)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] - pub fn idp_login_url(this: &RtcPeerConnection) -> Option; + pub fn idp_login_url(this: &RtcPeerConnection) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnection" , js_name = onnegotiationneeded)] #[doc = "Getter for the `onnegotiationneeded` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs index fd0fc4a29ac..c5200370741 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnectionIceErrorEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/address)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] - pub fn address(this: &RtcPeerConnectionIceErrorEvent) -> Option; + pub fn address(this: &RtcPeerConnectionIceErrorEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = port)] #[doc = "Getter for the `port` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] - pub fn url(this: &RtcPeerConnectionIceErrorEvent) -> String; + pub fn url(this: &RtcPeerConnectionIceErrorEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "RTCPeerConnectionIceErrorEvent" , js_name = errorCode)] #[doc = "Getter for the `errorCode` field of this object."] #[doc = ""] @@ -46,5 +46,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnectionIceErrorEvent`*"] - pub fn error_text(this: &RtcPeerConnectionIceErrorEvent) -> String; + pub fn error_text(this: &RtcPeerConnectionIceErrorEvent) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs index 08bcfc0e6ee..2810d163ab8 100644 --- a/crates/web-sys/src/features/gen_RtcRtcpParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtcpParameters.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] #[wasm_bindgen(method, getter = "cname")] - pub fn get_cname(this: &RtcRtcpParameters) -> Option; + pub fn get_cname(this: &RtcRtcpParameters) -> Option<::alloc::string::String>; #[doc = "Change the `cname` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtcpParameters`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs index c398df3fdb6..c919b20766f 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, getter = "mimeType")] - pub fn get_mime_type(this: &RtcRtpCodecCapability) -> String; + pub fn get_mime_type(this: &RtcRtpCodecCapability) -> ::alloc::string::String; #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] #[wasm_bindgen(method, getter = "sdpFmtpLine")] - pub fn get_sdp_fmtp_line(this: &RtcRtpCodecCapability) -> Option; + pub fn get_sdp_fmtp_line(this: &RtcRtpCodecCapability) -> Option<::alloc::string::String>; #[doc = "Change the `sdpFmtpLine` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs index eefd4a90474..c4a0aa007ee 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, getter = "mimeType")] - pub fn get_mime_type(this: &RtcRtpCodecParameters) -> Option; + pub fn get_mime_type(this: &RtcRtpCodecParameters) -> Option<::alloc::string::String>; #[doc = "Change the `mimeType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] #[wasm_bindgen(method, getter = "sdpFmtpLine")] - pub fn get_sdp_fmtp_line(this: &RtcRtpCodecParameters) -> Option; + pub fn get_sdp_fmtp_line(this: &RtcRtpCodecParameters) -> Option<::alloc::string::String>; #[doc = "Change the `sdpFmtpLine` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index e9a65e07012..f9779b34757 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -75,7 +75,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] #[wasm_bindgen(method, getter = "rid")] - pub fn get_rid(this: &RtcRtpEncodingParameters) -> Option; + pub fn get_rid(this: &RtcRtpEncodingParameters) -> Option<::alloc::string::String>; #[doc = "Change the `rid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] @@ -101,7 +101,8 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "scalabilityMode")] - pub fn get_scalability_mode(this: &RtcRtpEncodingParameters) -> Option; + pub fn get_scalability_mode(this: &RtcRtpEncodingParameters) + -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `scalabilityMode` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs index 9372c5da79a..f7baf8c29ab 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] #[wasm_bindgen(method, getter = "uri")] - pub fn get_uri(this: &RtcRtpHeaderExtensionCapability) -> String; + pub fn get_uri(this: &RtcRtpHeaderExtensionCapability) -> ::alloc::string::String; #[doc = "Change the `uri` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs index aeeeb11cc80..c4818dc3e5f 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionParameters.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] #[wasm_bindgen(method, getter = "uri")] - pub fn get_uri(this: &RtcRtpHeaderExtensionParameters) -> Option; + pub fn get_uri(this: &RtcRtpHeaderExtensionParameters) -> Option<::alloc::string::String>; #[doc = "Change the `uri` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionParameters`*"] diff --git a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs index 8b8fca690bb..1f7ddb8ceff 100644 --- a/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs +++ b/crates/web-sys/src/features/gen_RtcRtpTransceiver.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/mid)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"] - pub fn mid(this: &RtcRtpTransceiver) -> Option; + pub fn mid(this: &RtcRtpTransceiver) -> Option<::alloc::string::String>; #[cfg(feature = "RtcRtpSender")] # [wasm_bindgen (structural , method , getter , js_class = "RTCRtpTransceiver" , js_name = sender)] #[doc = "Getter for the `sender` field of this object."] @@ -72,7 +72,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/getRemoteTrackId)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpTransceiver`*"] - pub fn get_remote_track_id(this: &RtcRtpTransceiver) -> String; + pub fn get_remote_track_id(this: &RtcRtpTransceiver) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "RTCRtpTransceiver" , js_name = setCodecPreferences)] #[doc = "The `setCodecPreferences()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcSessionDescription.rs b/crates/web-sys/src/features/gen_RtcSessionDescription.rs index d61eb1f2eb6..6f3df92d131 100644 --- a/crates/web-sys/src/features/gen_RtcSessionDescription.rs +++ b/crates/web-sys/src/features/gen_RtcSessionDescription.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription/sdp)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescription`*"] - pub fn sdp(this: &RtcSessionDescription) -> String; + pub fn sdp(this: &RtcSessionDescription) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "RTCSessionDescription" , js_name = sdp)] #[doc = "Setter for the `sdp` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs index 7c159a09ef2..3418582c993 100644 --- a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs +++ b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] #[wasm_bindgen(method, getter = "sdp")] - pub fn get_sdp(this: &RtcSessionDescriptionInit) -> Option; + pub fn get_sdp(this: &RtcSessionDescriptionInit) -> Option<::alloc::string::String>; #[doc = "Change the `sdp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"] diff --git a/crates/web-sys/src/features/gen_RtcStats.rs b/crates/web-sys/src/features/gen_RtcStats.rs index 76e02fe410b..3c9d2245f87 100644 --- a/crates/web-sys/src/features/gen_RtcStats.rs +++ b/crates/web-sys/src/features/gen_RtcStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcStats) -> Option; + pub fn get_id(this: &RtcStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs index 620270ec598..1f363bf7bcf 100644 --- a/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs +++ b/crates/web-sys/src/features/gen_RtcStatsReportInternal.rs @@ -100,7 +100,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, getter = "localSdp")] - pub fn get_local_sdp(this: &RtcStatsReportInternal) -> Option; + pub fn get_local_sdp(this: &RtcStatsReportInternal) -> Option<::alloc::string::String>; #[doc = "Change the `localSdp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] @@ -156,7 +156,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, getter = "pcid")] - pub fn get_pcid(this: &RtcStatsReportInternal) -> Option; + pub fn get_pcid(this: &RtcStatsReportInternal) -> Option<::alloc::string::String>; #[doc = "Change the `pcid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] @@ -186,7 +186,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] #[wasm_bindgen(method, getter = "remoteSdp")] - pub fn get_remote_sdp(this: &RtcStatsReportInternal) -> Option; + pub fn get_remote_sdp(this: &RtcStatsReportInternal) -> Option<::alloc::string::String>; #[doc = "Change the `remoteSdp` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcStatsReportInternal`*"] diff --git a/crates/web-sys/src/features/gen_RtcTransportStats.rs b/crates/web-sys/src/features/gen_RtcTransportStats.rs index 6564b4c1fab..b0ef75d0eba 100644 --- a/crates/web-sys/src/features/gen_RtcTransportStats.rs +++ b/crates/web-sys/src/features/gen_RtcTransportStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcTransportStats) -> Option; + pub fn get_id(this: &RtcTransportStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcTransportStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcdtmfSender.rs b/crates/web-sys/src/features/gen_RtcdtmfSender.rs index 3d66c3f5fe0..78a92e9db17 100644 --- a/crates/web-sys/src/features/gen_RtcdtmfSender.rs +++ b/crates/web-sys/src/features/gen_RtcdtmfSender.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCDTMFSender/toneBuffer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfSender`*"] - pub fn tone_buffer(this: &RtcdtmfSender) -> String; + pub fn tone_buffer(this: &RtcdtmfSender) -> ::alloc::string::String; # [wasm_bindgen (method , structural , js_class = "RTCDTMFSender" , js_name = insertDTMF)] #[doc = "The `insertDTMF()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEvent.rs b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEvent.rs index 55772916caf..c85f9982f22 100644 --- a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEvent.rs +++ b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCDTMFToneChangeEvent/tone)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEvent`*"] - pub fn tone(this: &RtcdtmfToneChangeEvent) -> String; + pub fn tone(this: &RtcdtmfToneChangeEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "RTCDTMFToneChangeEvent")] #[doc = "The `new RtcdtmfToneChangeEvent(..)` constructor, creating a new instance of `RtcdtmfToneChangeEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs index 760ea9dceff..40d76056c2b 100644 --- a/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcdtmfToneChangeEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] #[wasm_bindgen(method, getter = "tone")] - pub fn get_tone(this: &RtcdtmfToneChangeEventInit) -> Option; + pub fn get_tone(this: &RtcdtmfToneChangeEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `tone` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcdtmfToneChangeEventInit`*"] diff --git a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs index c072f988065..cfc4afcd035 100644 --- a/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpContributingSourceStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcrtpContributingSourceStats) -> Option; + pub fn get_id(this: &RtcrtpContributingSourceStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] @@ -56,7 +56,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] #[wasm_bindgen(method, getter = "inboundRtpStreamId")] - pub fn get_inbound_rtp_stream_id(this: &RtcrtpContributingSourceStats) -> Option; + pub fn get_inbound_rtp_stream_id( + this: &RtcrtpContributingSourceStats, + ) -> Option<::alloc::string::String>; #[doc = "Change the `inboundRtpStreamId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpContributingSourceStats`*"] diff --git a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs index 8348f7fecff..c2941657c1a 100644 --- a/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs +++ b/crates/web-sys/src/features/gen_RtcrtpStreamStats.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &RtcrtpStreamStats) -> Option; + pub fn get_id(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -66,7 +66,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "codecId")] - pub fn get_codec_id(this: &RtcrtpStreamStats) -> Option; + pub fn get_codec_id(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `codecId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -116,7 +116,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaTrackId")] - pub fn get_media_track_id(this: &RtcrtpStreamStats) -> Option; + pub fn get_media_track_id(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaTrackId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -126,7 +126,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "mediaType")] - pub fn get_media_type(this: &RtcrtpStreamStats) -> Option; + pub fn get_media_type(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `mediaType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -156,7 +156,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "remoteId")] - pub fn get_remote_id(this: &RtcrtpStreamStats) -> Option; + pub fn get_remote_id(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `remoteId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -166,7 +166,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "ssrc")] - pub fn get_ssrc(this: &RtcrtpStreamStats) -> Option; + pub fn get_ssrc(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `ssrc` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] @@ -176,7 +176,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] #[wasm_bindgen(method, getter = "transportId")] - pub fn get_transport_id(this: &RtcrtpStreamStats) -> Option; + pub fn get_transport_id(this: &RtcrtpStreamStats) -> Option<::alloc::string::String>; #[doc = "Change the `transportId` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcrtpStreamStats`*"] diff --git a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs index 3e310a60ca1..efff6185b3a 100644 --- a/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs +++ b/crates/web-sys/src/features/gen_SaveFilePickerOptions.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &SaveFilePickerOptions) -> Option; + pub fn get_id(this: &SaveFilePickerOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `id` field of this object."] #[doc = ""] @@ -94,7 +94,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "suggestedName")] - pub fn get_suggested_name(this: &SaveFilePickerOptions) -> Option; + pub fn get_suggested_name(this: &SaveFilePickerOptions) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `suggestedName` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SecurityPolicyViolationEvent.rs b/crates/web-sys/src/features/gen_SecurityPolicyViolationEvent.rs index f8c29a91147..139a7501f34 100644 --- a/crates/web-sys/src/features/gen_SecurityPolicyViolationEvent.rs +++ b/crates/web-sys/src/features/gen_SecurityPolicyViolationEvent.rs @@ -18,56 +18,56 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/documentURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn document_uri(this: &SecurityPolicyViolationEvent) -> String; + pub fn document_uri(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = referrer)] #[doc = "Getter for the `referrer` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/referrer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn referrer(this: &SecurityPolicyViolationEvent) -> String; + pub fn referrer(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = blockedURI)] #[doc = "Getter for the `blockedURI` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/blockedURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn blocked_uri(this: &SecurityPolicyViolationEvent) -> String; + pub fn blocked_uri(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = violatedDirective)] #[doc = "Getter for the `violatedDirective` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/violatedDirective)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn violated_directive(this: &SecurityPolicyViolationEvent) -> String; + pub fn violated_directive(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = effectiveDirective)] #[doc = "Getter for the `effectiveDirective` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/effectiveDirective)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn effective_directive(this: &SecurityPolicyViolationEvent) -> String; + pub fn effective_directive(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = originalPolicy)] #[doc = "Getter for the `originalPolicy` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/originalPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn original_policy(this: &SecurityPolicyViolationEvent) -> String; + pub fn original_policy(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = sourceFile)] #[doc = "Getter for the `sourceFile` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/sourceFile)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn source_file(this: &SecurityPolicyViolationEvent) -> String; + pub fn source_file(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = sample)] #[doc = "Getter for the `sample` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent/sample)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEvent`*"] - pub fn sample(this: &SecurityPolicyViolationEvent) -> String; + pub fn sample(this: &SecurityPolicyViolationEvent) -> ::alloc::string::String; #[cfg(feature = "SecurityPolicyViolationEventDisposition")] # [wasm_bindgen (structural , method , getter , js_class = "SecurityPolicyViolationEvent" , js_name = disposition)] #[doc = "Getter for the `disposition` field of this object."] diff --git a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs index 5176921a837..4a798b55318 100644 --- a/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs +++ b/crates/web-sys/src/features/gen_SecurityPolicyViolationEventInit.rs @@ -44,7 +44,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "blockedURI")] - pub fn get_blocked_uri(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_blocked_uri( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `blockedURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -81,7 +83,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "documentURI")] - pub fn get_document_uri(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_document_uri( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `documentURI` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -91,7 +95,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "effectiveDirective")] - pub fn get_effective_directive(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_effective_directive( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `effectiveDirective` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -111,7 +117,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "originalPolicy")] - pub fn get_original_policy(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_original_policy( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `originalPolicy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -121,7 +129,8 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "referrer")] - pub fn get_referrer(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_referrer(this: &SecurityPolicyViolationEventInit) + -> Option<::alloc::string::String>; #[doc = "Change the `referrer` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -131,7 +140,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "sample")] - pub fn get_sample(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_sample(this: &SecurityPolicyViolationEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `sample` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -141,7 +150,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "sourceFile")] - pub fn get_source_file(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_source_file( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `sourceFile` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] @@ -161,7 +172,9 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] #[wasm_bindgen(method, getter = "violatedDirective")] - pub fn get_violated_directive(this: &SecurityPolicyViolationEventInit) -> Option; + pub fn get_violated_directive( + this: &SecurityPolicyViolationEventInit, + ) -> Option<::alloc::string::String>; #[doc = "Change the `violatedDirective` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"] diff --git a/crates/web-sys/src/features/gen_Selection.rs b/crates/web-sys/src/features/gen_Selection.rs index ae14db54120..bd361871871 100644 --- a/crates/web-sys/src/features/gen_Selection.rs +++ b/crates/web-sys/src/features/gen_Selection.rs @@ -62,7 +62,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Selection`*"] - pub fn type_(this: &Selection) -> String; + pub fn type_(this: &Selection) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "Selection" , js_name = caretBidiLevel)] #[doc = "Getter for the `caretBidiLevel` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ServiceWorker.rs b/crates/web-sys/src/features/gen_ServiceWorker.rs index 3cd41e6c865..268362b6443 100644 --- a/crates/web-sys/src/features/gen_ServiceWorker.rs +++ b/crates/web-sys/src/features/gen_ServiceWorker.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"] - pub fn script_url(this: &ServiceWorker) -> String; + pub fn script_url(this: &ServiceWorker) -> ::alloc::string::String; #[cfg(feature = "ServiceWorkerState")] # [wasm_bindgen (structural , method , getter , js_class = "ServiceWorker" , js_name = state)] #[doc = "Getter for the `state` field of this object."] diff --git a/crates/web-sys/src/features/gen_ServiceWorkerContainer.rs b/crates/web-sys/src/features/gen_ServiceWorkerContainer.rs index de92b4cf282..ba2036d5b84 100644 --- a/crates/web-sys/src/features/gen_ServiceWorkerContainer.rs +++ b/crates/web-sys/src/features/gen_ServiceWorkerContainer.rs @@ -102,7 +102,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/getScopeForUrl)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"] - pub fn get_scope_for_url(this: &ServiceWorkerContainer, url: &str) -> Result; + pub fn get_scope_for_url( + this: &ServiceWorkerContainer, + url: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "ServiceWorkerContainer" , js_name = register)] #[doc = "The `register()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ServiceWorkerRegistration.rs b/crates/web-sys/src/features/gen_ServiceWorkerRegistration.rs index 5556ea0303b..12aaee05c68 100644 --- a/crates/web-sys/src/features/gen_ServiceWorkerRegistration.rs +++ b/crates/web-sys/src/features/gen_ServiceWorkerRegistration.rs @@ -42,7 +42,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/scope)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerRegistration`*"] - pub fn scope(this: &ServiceWorkerRegistration) -> String; + pub fn scope(this: &ServiceWorkerRegistration) -> ::alloc::string::String; #[cfg(feature = "ServiceWorkerUpdateViaCache")] # [wasm_bindgen (structural , catch , method , getter , js_class = "ServiceWorkerRegistration" , js_name = updateViaCache)] #[doc = "Getter for the `updateViaCache` field of this object."] diff --git a/crates/web-sys/src/features/gen_ShadowRoot.rs b/crates/web-sys/src/features/gen_ShadowRoot.rs index 529ee182e59..500db8ef42c 100644 --- a/crates/web-sys/src/features/gen_ShadowRoot.rs +++ b/crates/web-sys/src/features/gen_ShadowRoot.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/innerHTML)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShadowRoot`*"] - pub fn inner_html(this: &ShadowRoot) -> String; + pub fn inner_html(this: &ShadowRoot) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "ShadowRoot" , js_name = innerHTML)] #[doc = "Setter for the `innerHTML` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ShareData.rs b/crates/web-sys/src/features/gen_ShareData.rs index 2f366fb822c..dfd1d3591bf 100644 --- a/crates/web-sys/src/features/gen_ShareData.rs +++ b/crates/web-sys/src/features/gen_ShareData.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, getter = "text")] - pub fn get_text(this: &ShareData) -> Option; + pub fn get_text(this: &ShareData) -> Option<::alloc::string::String>; #[doc = "Change the `text` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, getter = "title")] - pub fn get_title(this: &ShareData) -> Option; + pub fn get_title(this: &ShareData) -> Option<::alloc::string::String>; #[doc = "Change the `title` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &ShareData) -> Option; + pub fn get_url(this: &ShareData) -> Option<::alloc::string::String>; #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ShareData`*"] diff --git a/crates/web-sys/src/features/gen_SharedWorkerGlobalScope.rs b/crates/web-sys/src/features/gen_SharedWorkerGlobalScope.rs index 9c680418c9c..fe6938b61d8 100644 --- a/crates/web-sys/src/features/gen_SharedWorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_SharedWorkerGlobalScope.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SharedWorkerGlobalScope`*"] - pub fn name(this: &SharedWorkerGlobalScope) -> String; + pub fn name(this: &SharedWorkerGlobalScope) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SharedWorkerGlobalScope" , js_name = onconnect)] #[doc = "Getter for the `onconnect` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SignResponse.rs b/crates/web-sys/src/features/gen_SignResponse.rs index 248bfe60512..7a16596b9f9 100644 --- a/crates/web-sys/src/features/gen_SignResponse.rs +++ b/crates/web-sys/src/features/gen_SignResponse.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, getter = "clientData")] - pub fn get_client_data(this: &SignResponse) -> Option; + pub fn get_client_data(this: &SignResponse) -> Option<::alloc::string::String>; #[doc = "Change the `clientData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, getter = "errorMessage")] - pub fn get_error_message(this: &SignResponse) -> Option; + pub fn get_error_message(this: &SignResponse) -> Option<::alloc::string::String>; #[doc = "Change the `errorMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, getter = "keyHandle")] - pub fn get_key_handle(this: &SignResponse) -> Option; + pub fn get_key_handle(this: &SignResponse) -> Option<::alloc::string::String>; #[doc = "Change the `keyHandle` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] #[wasm_bindgen(method, getter = "signatureData")] - pub fn get_signature_data(this: &SignResponse) -> Option; + pub fn get_signature_data(this: &SignResponse) -> Option<::alloc::string::String>; #[doc = "Change the `signatureData` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SignResponse`*"] diff --git a/crates/web-sys/src/features/gen_SocketElement.rs b/crates/web-sys/src/features/gen_SocketElement.rs index e1270b6a247..083f219d32b 100644 --- a/crates/web-sys/src/features/gen_SocketElement.rs +++ b/crates/web-sys/src/features/gen_SocketElement.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] #[wasm_bindgen(method, getter = "host")] - pub fn get_host(this: &SocketElement) -> Option; + pub fn get_host(this: &SocketElement) -> Option<::alloc::string::String>; #[doc = "Change the `host` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SocketElement`*"] diff --git a/crates/web-sys/src/features/gen_SpeechGrammar.rs b/crates/web-sys/src/features/gen_SpeechGrammar.rs index 346430e2146..c50b179daee 100644 --- a/crates/web-sys/src/features/gen_SpeechGrammar.rs +++ b/crates/web-sys/src/features/gen_SpeechGrammar.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechGrammar/src)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechGrammar`*"] - pub fn src(this: &SpeechGrammar) -> Result; + pub fn src(this: &SpeechGrammar) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "SpeechGrammar" , js_name = src)] #[doc = "Setter for the `src` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SpeechRecognition.rs b/crates/web-sys/src/features/gen_SpeechRecognition.rs index c2e1d9f81d4..f446bd30fb9 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognition.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognition.rs @@ -34,7 +34,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/lang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"] - pub fn lang(this: &SpeechRecognition) -> String; + pub fn lang(this: &SpeechRecognition) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SpeechRecognition" , js_name = lang)] #[doc = "Setter for the `lang` field of this object."] #[doc = ""] @@ -90,7 +90,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/serviceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognition`*"] - pub fn service_uri(this: &SpeechRecognition) -> Result; + pub fn service_uri(this: &SpeechRecognition) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "SpeechRecognition" , js_name = serviceURI)] #[doc = "Setter for the `serviceURI` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionAlternative.rs b/crates/web-sys/src/features/gen_SpeechRecognitionAlternative.rs index 957b5c85a62..037beaf8133 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionAlternative.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionAlternative.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionAlternative/transcript)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionAlternative`*"] - pub fn transcript(this: &SpeechRecognitionAlternative) -> String; + pub fn transcript(this: &SpeechRecognitionAlternative) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SpeechRecognitionAlternative" , js_name = confidence)] #[doc = "Getter for the `confidence` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionError.rs b/crates/web-sys/src/features/gen_SpeechRecognitionError.rs index d297aad3477..c6dbea27575 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionError.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionError.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionError/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionError`*"] - pub fn message(this: &SpeechRecognitionError) -> Option; + pub fn message(this: &SpeechRecognitionError) -> Option<::alloc::string::String>; #[wasm_bindgen(catch, constructor, js_class = "SpeechRecognitionError")] #[doc = "The `new SpeechRecognitionError(..)` constructor, creating a new instance of `SpeechRecognitionError`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs index bc5e60a4e8e..cb7e52d934c 100644 --- a/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs +++ b/crates/web-sys/src/features/gen_SpeechRecognitionErrorInit.rs @@ -56,7 +56,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] #[wasm_bindgen(method, getter = "message")] - pub fn get_message(this: &SpeechRecognitionErrorInit) -> Option; + pub fn get_message(this: &SpeechRecognitionErrorInit) -> Option<::alloc::string::String>; #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechRecognitionErrorInit`*"] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs index 5ffb6825037..78cf097557c 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &SpeechSynthesisErrorEventInit) -> Option; + pub fn get_name(this: &SpeechSynthesisErrorEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisErrorEventInit`*"] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisEvent.rs b/crates/web-sys/src/features/gen_SpeechSynthesisEvent.rs index 29b842959a7..8979ba26f8f 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisEvent.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisEvent.rs @@ -47,7 +47,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisEvent/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEvent`*"] - pub fn name(this: &SpeechSynthesisEvent) -> Option; + pub fn name(this: &SpeechSynthesisEvent) -> Option<::alloc::string::String>; #[cfg(feature = "SpeechSynthesisEventInit")] #[wasm_bindgen(catch, constructor, js_class = "SpeechSynthesisEvent")] #[doc = "The `new SpeechSynthesisEvent(..)` constructor, creating a new instance of `SpeechSynthesisEvent`."] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs index e3f4eed47a7..80048f51362 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &SpeechSynthesisEventInit) -> Option; + pub fn get_name(this: &SpeechSynthesisEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisEventInit`*"] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisUtterance.rs b/crates/web-sys/src/features/gen_SpeechSynthesisUtterance.rs index 0bd4f6ecc87..a6005cf5461 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisUtterance.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisUtterance.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisUtterance`*"] - pub fn text(this: &SpeechSynthesisUtterance) -> String; + pub fn text(this: &SpeechSynthesisUtterance) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SpeechSynthesisUtterance" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/lang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisUtterance`*"] - pub fn lang(this: &SpeechSynthesisUtterance) -> String; + pub fn lang(this: &SpeechSynthesisUtterance) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SpeechSynthesisUtterance" , js_name = lang)] #[doc = "Setter for the `lang` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisVoice.rs b/crates/web-sys/src/features/gen_SpeechSynthesisVoice.rs index a03faee42cc..3d4d97dc7a4 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisVoice.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisVoice.rs @@ -18,21 +18,21 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice/voiceURI)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisVoice`*"] - pub fn voice_uri(this: &SpeechSynthesisVoice) -> String; + pub fn voice_uri(this: &SpeechSynthesisVoice) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SpeechSynthesisVoice" , js_name = name)] #[doc = "Getter for the `name` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisVoice`*"] - pub fn name(this: &SpeechSynthesisVoice) -> String; + pub fn name(this: &SpeechSynthesisVoice) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SpeechSynthesisVoice" , js_name = lang)] #[doc = "Getter for the `lang` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice/lang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SpeechSynthesisVoice`*"] - pub fn lang(this: &SpeechSynthesisVoice) -> String; + pub fn lang(this: &SpeechSynthesisVoice) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "SpeechSynthesisVoice" , js_name = localService)] #[doc = "Getter for the `localService` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Storage.rs b/crates/web-sys/src/features/gen_Storage.rs index 412d5997d20..e31ffc87a1f 100644 --- a/crates/web-sys/src/features/gen_Storage.rs +++ b/crates/web-sys/src/features/gen_Storage.rs @@ -32,14 +32,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`*"] - pub fn get_item(this: &Storage, key: &str) -> Result, JsValue>; + pub fn get_item(this: &Storage, key: &str) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Storage" , js_name = key)] #[doc = "The `key()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/key)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`*"] - pub fn key(this: &Storage, index: u32) -> Result, JsValue>; + pub fn key(this: &Storage, index: u32) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Storage" , js_name = removeItem)] #[doc = "The `removeItem()` method."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Storage`*"] - pub fn get(this: &Storage, key: &str) -> Result, JsValue>; + pub fn get(this: &Storage, key: &str) -> Result, JsValue>; #[wasm_bindgen(catch, method, structural, js_class = "Storage", indexing_setter)] #[doc = "Indexing setter. As in the literal Javascript `this[key] = value`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_StorageEvent.rs b/crates/web-sys/src/features/gen_StorageEvent.rs index 55cfc058cba..782000997b6 100644 --- a/crates/web-sys/src/features/gen_StorageEvent.rs +++ b/crates/web-sys/src/features/gen_StorageEvent.rs @@ -18,28 +18,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent/key)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEvent`*"] - pub fn key(this: &StorageEvent) -> Option; + pub fn key(this: &StorageEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "StorageEvent" , js_name = oldValue)] #[doc = "Getter for the `oldValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent/oldValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEvent`*"] - pub fn old_value(this: &StorageEvent) -> Option; + pub fn old_value(this: &StorageEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "StorageEvent" , js_name = newValue)] #[doc = "Getter for the `newValue` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent/newValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEvent`*"] - pub fn new_value(this: &StorageEvent) -> Option; + pub fn new_value(this: &StorageEvent) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "StorageEvent" , js_name = url)] #[doc = "Getter for the `url` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEvent`*"] - pub fn url(this: &StorageEvent) -> Option; + pub fn url(this: &StorageEvent) -> Option<::alloc::string::String>; #[cfg(feature = "Storage")] # [wasm_bindgen (structural , method , getter , js_class = "StorageEvent" , js_name = storageArea)] #[doc = "Getter for the `storageArea` field of this object."] diff --git a/crates/web-sys/src/features/gen_StorageEventInit.rs b/crates/web-sys/src/features/gen_StorageEventInit.rs index 51db6561485..63da9d1abe4 100644 --- a/crates/web-sys/src/features/gen_StorageEventInit.rs +++ b/crates/web-sys/src/features/gen_StorageEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, getter = "key")] - pub fn get_key(this: &StorageEventInit) -> Option; + pub fn get_key(this: &StorageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `key` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, getter = "newValue")] - pub fn get_new_value(this: &StorageEventInit) -> Option; + pub fn get_new_value(this: &StorageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `newValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, getter = "oldValue")] - pub fn get_old_value(this: &StorageEventInit) -> Option; + pub fn get_old_value(this: &StorageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `oldValue` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] @@ -86,7 +86,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] #[wasm_bindgen(method, getter = "url")] - pub fn get_url(this: &StorageEventInit) -> Option; + pub fn get_url(this: &StorageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `url` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageEventInit`*"] diff --git a/crates/web-sys/src/features/gen_StyleSheet.rs b/crates/web-sys/src/features/gen_StyleSheet.rs index f9a896d7668..6455da9a2f9 100644 --- a/crates/web-sys/src/features/gen_StyleSheet.rs +++ b/crates/web-sys/src/features/gen_StyleSheet.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheet`*"] - pub fn type_(this: &StyleSheet) -> String; + pub fn type_(this: &StyleSheet) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "StyleSheet" , js_name = href)] #[doc = "Getter for the `href` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheet`*"] - pub fn href(this: &StyleSheet) -> Result, JsValue>; + pub fn href(this: &StyleSheet) -> Result, JsValue>; #[cfg(feature = "Node")] # [wasm_bindgen (structural , method , getter , js_class = "StyleSheet" , js_name = ownerNode)] #[doc = "Getter for the `ownerNode` field of this object."] @@ -47,7 +47,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/title)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StyleSheet`*"] - pub fn title(this: &StyleSheet) -> Option; + pub fn title(this: &StyleSheet) -> Option<::alloc::string::String>; #[cfg(feature = "MediaList")] # [wasm_bindgen (structural , method , getter , js_class = "StyleSheet" , js_name = media)] #[doc = "Getter for the `media` field of this object."] diff --git a/crates/web-sys/src/features/gen_SvgAngle.rs b/crates/web-sys/src/features/gen_SvgAngle.rs index e845ac6aebb..ba774cec3ce 100644 --- a/crates/web-sys/src/features/gen_SvgAngle.rs +++ b/crates/web-sys/src/features/gen_SvgAngle.rs @@ -53,7 +53,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAngle/valueAsString)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgAngle`*"] - pub fn value_as_string(this: &SvgAngle) -> String; + pub fn value_as_string(this: &SvgAngle) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAngle" , js_name = valueAsString)] #[doc = "Setter for the `valueAsString` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgAnimatedString.rs b/crates/web-sys/src/features/gen_SvgAnimatedString.rs index 921c4e854cb..28db97f2e89 100644 --- a/crates/web-sys/src/features/gen_SvgAnimatedString.rs +++ b/crates/web-sys/src/features/gen_SvgAnimatedString.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedString/baseVal)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgAnimatedString`*"] - pub fn base_val(this: &SvgAnimatedString) -> String; + pub fn base_val(this: &SvgAnimatedString) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAnimatedString" , js_name = baseVal)] #[doc = "Setter for the `baseVal` field of this object."] #[doc = ""] @@ -32,5 +32,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedString/animVal)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgAnimatedString`*"] - pub fn anim_val(this: &SvgAnimatedString) -> String; + pub fn anim_val(this: &SvgAnimatedString) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_SvgElement.rs b/crates/web-sys/src/features/gen_SvgElement.rs index 484e6be2bc1..443755ebbc4 100644 --- a/crates/web-sys/src/features/gen_SvgElement.rs +++ b/crates/web-sys/src/features/gen_SvgElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] - pub fn id(this: &SvgElement) -> String; + pub fn id(this: &SvgElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = id)] #[doc = "Setter for the `id` field of this object."] #[doc = ""] @@ -1275,7 +1275,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/nonce)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgElement`*"] - pub fn nonce(this: &SvgElement) -> String; + pub fn nonce(this: &SvgElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = nonce)] #[doc = "Setter for the `nonce` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgLength.rs b/crates/web-sys/src/features/gen_SvgLength.rs index a2e87fdd829..e365d98e858 100644 --- a/crates/web-sys/src/features/gen_SvgLength.rs +++ b/crates/web-sys/src/features/gen_SvgLength.rs @@ -53,7 +53,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGLength/valueAsString)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgLength`*"] - pub fn value_as_string(this: &SvgLength) -> String; + pub fn value_as_string(this: &SvgLength) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGLength" , js_name = valueAsString)] #[doc = "Setter for the `valueAsString` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgPathSeg.rs b/crates/web-sys/src/features/gen_SvgPathSeg.rs index 57b15fb5f68..de9a214492a 100644 --- a/crates/web-sys/src/features/gen_SvgPathSeg.rs +++ b/crates/web-sys/src/features/gen_SvgPathSeg.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGPathSeg/pathSegTypeAsLetter)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgPathSeg`*"] - pub fn path_seg_type_as_letter(this: &SvgPathSeg) -> String; + pub fn path_seg_type_as_letter(this: &SvgPathSeg) -> ::alloc::string::String; } impl SvgPathSeg { #[doc = "The `SVGPathSeg.PATHSEG_UNKNOWN` const."] diff --git a/crates/web-sys/src/features/gen_SvgScriptElement.rs b/crates/web-sys/src/features/gen_SvgScriptElement.rs index d888f9b5c98..14d016bda1c 100644 --- a/crates/web-sys/src/features/gen_SvgScriptElement.rs +++ b/crates/web-sys/src/features/gen_SvgScriptElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGScriptElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgScriptElement`*"] - pub fn type_(this: &SvgScriptElement) -> String; + pub fn type_(this: &SvgScriptElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGScriptElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGScriptElement/crossOrigin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgScriptElement`*"] - pub fn cross_origin(this: &SvgScriptElement) -> Option; + pub fn cross_origin(this: &SvgScriptElement) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , setter , js_class = "SVGScriptElement" , js_name = crossOrigin)] #[doc = "Setter for the `crossOrigin` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgStringList.rs b/crates/web-sys/src/features/gen_SvgStringList.rs index 774a6360095..9344ea162dc 100644 --- a/crates/web-sys/src/features/gen_SvgStringList.rs +++ b/crates/web-sys/src/features/gen_SvgStringList.rs @@ -32,7 +32,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStringList/appendItem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStringList`*"] - pub fn append_item(this: &SvgStringList, new_item: &str) -> Result; + pub fn append_item( + this: &SvgStringList, + new_item: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "SVGStringList" , js_name = clear)] #[doc = "The `clear()` method."] #[doc = ""] @@ -46,14 +49,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStringList/getItem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStringList`*"] - pub fn get_item(this: &SvgStringList, index: u32) -> Result; + pub fn get_item(this: &SvgStringList, index: u32) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SVGStringList" , js_name = initialize)] #[doc = "The `initialize()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStringList/initialize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStringList`*"] - pub fn initialize(this: &SvgStringList, new_item: &str) -> Result; + pub fn initialize( + this: &SvgStringList, + new_item: &str, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SVGStringList" , js_name = insertItemBefore)] #[doc = "The `insertItemBefore()` method."] #[doc = ""] @@ -64,14 +70,17 @@ extern "C" { this: &SvgStringList, new_item: &str, index: u32, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SVGStringList" , js_name = removeItem)] #[doc = "The `removeItem()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStringList/removeItem)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStringList`*"] - pub fn remove_item(this: &SvgStringList, index: u32) -> Result; + pub fn remove_item( + this: &SvgStringList, + index: u32, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "SVGStringList" , js_name = replaceItem)] #[doc = "The `replaceItem()` method."] #[doc = ""] @@ -82,12 +91,12 @@ extern "C" { this: &SvgStringList, new_item: &str, index: u32, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; #[wasm_bindgen(method, structural, js_class = "SVGStringList", indexing_getter)] #[doc = "Indexing getter. As in the literal Javascript `this[key]`."] #[doc = ""] #[doc = ""] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStringList`*"] - pub fn get(this: &SvgStringList, index: u32) -> Option; + pub fn get(this: &SvgStringList, index: u32) -> Option<::alloc::string::String>; } diff --git a/crates/web-sys/src/features/gen_SvgStyleElement.rs b/crates/web-sys/src/features/gen_SvgStyleElement.rs index 23c0f51dff0..7ee045abfbe 100644 --- a/crates/web-sys/src/features/gen_SvgStyleElement.rs +++ b/crates/web-sys/src/features/gen_SvgStyleElement.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStyleElement/xmlspace)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStyleElement`*"] - pub fn xmlspace(this: &SvgStyleElement) -> String; + pub fn xmlspace(this: &SvgStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGStyleElement" , js_name = xmlspace)] #[doc = "Setter for the `xmlspace` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStyleElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStyleElement`*"] - pub fn type_(this: &SvgStyleElement) -> String; + pub fn type_(this: &SvgStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGStyleElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -46,7 +46,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStyleElement/media)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStyleElement`*"] - pub fn media(this: &SvgStyleElement) -> String; + pub fn media(this: &SvgStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGStyleElement" , js_name = media)] #[doc = "Setter for the `media` field of this object."] #[doc = ""] @@ -60,7 +60,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGStyleElement/title)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgStyleElement`*"] - pub fn title(this: &SvgStyleElement) -> String; + pub fn title(this: &SvgStyleElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGStyleElement" , js_name = title)] #[doc = "Setter for the `title` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_SvgaElement.rs b/crates/web-sys/src/features/gen_SvgaElement.rs index efbf2c93e11..f4bc67cad3f 100644 --- a/crates/web-sys/src/features/gen_SvgaElement.rs +++ b/crates/web-sys/src/features/gen_SvgaElement.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/download)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn download(this: &SvgaElement) -> String; + pub fn download(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = download)] #[doc = "Setter for the `download` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/ping)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn ping(this: &SvgaElement) -> String; + pub fn ping(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = ping)] #[doc = "Setter for the `ping` field of this object."] #[doc = ""] @@ -54,7 +54,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/rel)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn rel(this: &SvgaElement) -> String; + pub fn rel(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = rel)] #[doc = "Setter for the `rel` field of this object."] #[doc = ""] @@ -68,7 +68,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/referrerPolicy)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn referrer_policy(this: &SvgaElement) -> String; + pub fn referrer_policy(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = referrerPolicy)] #[doc = "Setter for the `referrerPolicy` field of this object."] #[doc = ""] @@ -90,7 +90,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/hreflang)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn hreflang(this: &SvgaElement) -> String; + pub fn hreflang(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = hreflang)] #[doc = "Setter for the `hreflang` field of this object."] #[doc = ""] @@ -104,7 +104,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn type_(this: &SvgaElement) -> String; + pub fn type_(this: &SvgaElement) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "SVGAElement" , js_name = type)] #[doc = "Setter for the `type` field of this object."] #[doc = ""] @@ -118,7 +118,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGAElement/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `SvgaElement`*"] - pub fn text(this: &SvgaElement) -> Result; + pub fn text(this: &SvgaElement) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "SVGAElement" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TcpSocket.rs b/crates/web-sys/src/features/gen_TcpSocket.rs index 85c4a55ed0a..86fb34450b2 100644 --- a/crates/web-sys/src/features/gen_TcpSocket.rs +++ b/crates/web-sys/src/features/gen_TcpSocket.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocket`*"] - pub fn host(this: &TcpSocket) -> String; + pub fn host(this: &TcpSocket) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TCPSocket" , js_name = port)] #[doc = "Getter for the `port` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TcpSocketErrorEvent.rs b/crates/web-sys/src/features/gen_TcpSocketErrorEvent.rs index e87fdf448e9..306efd487f2 100644 --- a/crates/web-sys/src/features/gen_TcpSocketErrorEvent.rs +++ b/crates/web-sys/src/features/gen_TcpSocketErrorEvent.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocketErrorEvent/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEvent`*"] - pub fn name(this: &TcpSocketErrorEvent) -> String; + pub fn name(this: &TcpSocketErrorEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TCPSocketErrorEvent" , js_name = message)] #[doc = "Getter for the `message` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TCPSocketErrorEvent/message)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEvent`*"] - pub fn message(this: &TcpSocketErrorEvent) -> String; + pub fn message(this: &TcpSocketErrorEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "TCPSocketErrorEvent")] #[doc = "The `new TcpSocketErrorEvent(..)` constructor, creating a new instance of `TcpSocketErrorEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs index 63c13ff0397..b51f897d895 100644 --- a/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_TcpSocketErrorEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, getter = "message")] - pub fn get_message(this: &TcpSocketErrorEventInit) -> Option; + pub fn get_message(this: &TcpSocketErrorEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `message` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &TcpSocketErrorEventInit) -> Option; + pub fn get_name(this: &TcpSocketErrorEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TcpSocketErrorEventInit`*"] diff --git a/crates/web-sys/src/features/gen_Text.rs b/crates/web-sys/src/features/gen_Text.rs index d6cb82f1b0b..e629e597189 100644 --- a/crates/web-sys/src/features/gen_Text.rs +++ b/crates/web-sys/src/features/gen_Text.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Text/wholeText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Text`*"] - pub fn whole_text(this: &Text) -> Result; + pub fn whole_text(this: &Text) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "HtmlSlotElement")] # [wasm_bindgen (structural , method , getter , js_class = "Text" , js_name = assignedSlot)] #[doc = "Getter for the `assignedSlot` field of this object."] diff --git a/crates/web-sys/src/features/gen_TextDecoder.rs b/crates/web-sys/src/features/gen_TextDecoder.rs index 823e8ad20e2..12bbf6f87cd 100644 --- a/crates/web-sys/src/features/gen_TextDecoder.rs +++ b/crates/web-sys/src/features/gen_TextDecoder.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] - pub fn encoding(this: &TextDecoder) -> String; + pub fn encoding(this: &TextDecoder) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TextDecoder" , js_name = fatal)] #[doc = "Getter for the `fatal` field of this object."] #[doc = ""] @@ -57,7 +57,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] - pub fn decode(this: &TextDecoder) -> Result; + pub fn decode(this: &TextDecoder) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] #[doc = ""] @@ -67,14 +67,17 @@ extern "C" { pub fn decode_with_buffer_source( this: &TextDecoder, input: &::js_sys::Object, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextDecoder`*"] - pub fn decode_with_u8_array(this: &TextDecoder, input: &[u8]) -> Result; + pub fn decode_with_u8_array( + this: &TextDecoder, + input: &[u8], + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] #[doc = ""] @@ -84,7 +87,7 @@ extern "C" { pub fn decode_with_js_u8_array( this: &TextDecoder, input: &::js_sys::Uint8Array, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "TextDecodeOptions")] # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] @@ -96,7 +99,7 @@ extern "C" { this: &TextDecoder, input: &::js_sys::Object, options: &TextDecodeOptions, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "TextDecodeOptions")] # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] @@ -108,7 +111,7 @@ extern "C" { this: &TextDecoder, input: &[u8], options: &TextDecodeOptions, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "TextDecodeOptions")] # [wasm_bindgen (catch , method , structural , js_class = "TextDecoder" , js_name = decode)] #[doc = "The `decode()` method."] @@ -120,5 +123,5 @@ extern "C" { this: &TextDecoder, input: &::js_sys::Uint8Array, options: &TextDecodeOptions, - ) -> Result; + ) -> Result<::alloc::string::String, JsValue>; } diff --git a/crates/web-sys/src/features/gen_TextEncoder.rs b/crates/web-sys/src/features/gen_TextEncoder.rs index 4a7a815b91c..9585b5f87c6 100644 --- a/crates/web-sys/src/features/gen_TextEncoder.rs +++ b/crates/web-sys/src/features/gen_TextEncoder.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encoding)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextEncoder`*"] - pub fn encoding(this: &TextEncoder) -> String; + pub fn encoding(this: &TextEncoder) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "TextEncoder")] #[doc = "The `new TextEncoder(..)` constructor, creating a new instance of `TextEncoder`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TextTrack.rs b/crates/web-sys/src/features/gen_TextTrack.rs index 73443abe3d8..578de269c91 100644 --- a/crates/web-sys/src/features/gen_TextTrack.rs +++ b/crates/web-sys/src/features/gen_TextTrack.rs @@ -26,28 +26,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextTrack`*"] - pub fn label(this: &TextTrack) -> String; + pub fn label(this: &TextTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TextTrack" , js_name = language)] #[doc = "Getter for the `language` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/language)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextTrack`*"] - pub fn language(this: &TextTrack) -> String; + pub fn language(this: &TextTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TextTrack" , js_name = id)] #[doc = "Getter for the `id` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextTrack`*"] - pub fn id(this: &TextTrack) -> String; + pub fn id(this: &TextTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TextTrack" , js_name = inBandMetadataTrackDispatchType)] #[doc = "Getter for the `inBandMetadataTrackDispatchType` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/inBandMetadataTrackDispatchType)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextTrack`*"] - pub fn in_band_metadata_track_dispatch_type(this: &TextTrack) -> String; + pub fn in_band_metadata_track_dispatch_type(this: &TextTrack) -> ::alloc::string::String; #[cfg(feature = "TextTrackMode")] # [wasm_bindgen (structural , method , getter , js_class = "TextTrack" , js_name = mode)] #[doc = "Getter for the `mode` field of this object."] diff --git a/crates/web-sys/src/features/gen_TextTrackCue.rs b/crates/web-sys/src/features/gen_TextTrackCue.rs index c1a1fe72585..08983047b7c 100644 --- a/crates/web-sys/src/features/gen_TextTrackCue.rs +++ b/crates/web-sys/src/features/gen_TextTrackCue.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextTrackCue`*"] - pub fn id(this: &TextTrackCue) -> String; + pub fn id(this: &TextTrackCue) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "TextTrackCue" , js_name = id)] #[doc = "Setter for the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ToggleEvent.rs b/crates/web-sys/src/features/gen_ToggleEvent.rs index 4bd2f383fda..34fa012e458 100644 --- a/crates/web-sys/src/features/gen_ToggleEvent.rs +++ b/crates/web-sys/src/features/gen_ToggleEvent.rs @@ -18,14 +18,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/oldState)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] - pub fn old_state(this: &ToggleEvent) -> String; + pub fn old_state(this: &ToggleEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "ToggleEvent" , js_name = newState)] #[doc = "Getter for the `newState` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/newState)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"] - pub fn new_state(this: &ToggleEvent) -> String; + pub fn new_state(this: &ToggleEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "ToggleEvent")] #[doc = "The `new ToggleEvent(..)` constructor, creating a new instance of `ToggleEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_ToggleEventInit.rs b/crates/web-sys/src/features/gen_ToggleEventInit.rs index cec8e059b99..e9028eb05d9 100644 --- a/crates/web-sys/src/features/gen_ToggleEventInit.rs +++ b/crates/web-sys/src/features/gen_ToggleEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] #[wasm_bindgen(method, getter = "newState")] - pub fn get_new_state(this: &ToggleEventInit) -> Option; + pub fn get_new_state(this: &ToggleEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `newState` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] #[wasm_bindgen(method, getter = "oldState")] - pub fn get_old_state(this: &ToggleEventInit) -> Option; + pub fn get_old_state(this: &ToggleEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `oldState` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"] diff --git a/crates/web-sys/src/features/gen_TokenBinding.rs b/crates/web-sys/src/features/gen_TokenBinding.rs index 3ebc6df4f23..00a5027011c 100644 --- a/crates/web-sys/src/features/gen_TokenBinding.rs +++ b/crates/web-sys/src/features/gen_TokenBinding.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] #[wasm_bindgen(method, getter = "id")] - pub fn get_id(this: &TokenBinding) -> Option; + pub fn get_id(this: &TokenBinding) -> Option<::alloc::string::String>; #[doc = "Change the `id` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] #[wasm_bindgen(method, getter = "status")] - pub fn get_status(this: &TokenBinding) -> String; + pub fn get_status(this: &TokenBinding) -> ::alloc::string::String; #[doc = "Change the `status` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TokenBinding`*"] diff --git a/crates/web-sys/src/features/gen_TransitionEvent.rs b/crates/web-sys/src/features/gen_TransitionEvent.rs index 65b9ab323e0..39ea99fda00 100644 --- a/crates/web-sys/src/features/gen_TransitionEvent.rs +++ b/crates/web-sys/src/features/gen_TransitionEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent/propertyName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEvent`*"] - pub fn property_name(this: &TransitionEvent) -> String; + pub fn property_name(this: &TransitionEvent) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "TransitionEvent" , js_name = elapsedTime)] #[doc = "Getter for the `elapsedTime` field of this object."] #[doc = ""] @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent/pseudoElement)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEvent`*"] - pub fn pseudo_element(this: &TransitionEvent) -> String; + pub fn pseudo_element(this: &TransitionEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "TransitionEvent")] #[doc = "The `new TransitionEvent(..)` constructor, creating a new instance of `TransitionEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_TransitionEventInit.rs b/crates/web-sys/src/features/gen_TransitionEventInit.rs index b3ede75c465..f94c28261cd 100644 --- a/crates/web-sys/src/features/gen_TransitionEventInit.rs +++ b/crates/web-sys/src/features/gen_TransitionEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, getter = "propertyName")] - pub fn get_property_name(this: &TransitionEventInit) -> Option; + pub fn get_property_name(this: &TransitionEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `propertyName` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] #[wasm_bindgen(method, getter = "pseudoElement")] - pub fn get_pseudo_element(this: &TransitionEventInit) -> Option; + pub fn get_pseudo_element(this: &TransitionEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `pseudoElement` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TransitionEventInit`*"] diff --git a/crates/web-sys/src/features/gen_TreeCellInfo.rs b/crates/web-sys/src/features/gen_TreeCellInfo.rs index 75327d1ee85..b87771c1392 100644 --- a/crates/web-sys/src/features/gen_TreeCellInfo.rs +++ b/crates/web-sys/src/features/gen_TreeCellInfo.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] #[wasm_bindgen(method, getter = "childElt")] - pub fn get_child_elt(this: &TreeCellInfo) -> Option; + pub fn get_child_elt(this: &TreeCellInfo) -> Option<::alloc::string::String>; #[doc = "Change the `childElt` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeCellInfo`*"] diff --git a/crates/web-sys/src/features/gen_TreeView.rs b/crates/web-sys/src/features/gen_TreeView.rs index 036e59a3dd2..b5145edf2ac 100644 --- a/crates/web-sys/src/features/gen_TreeView.rs +++ b/crates/web-sys/src/features/gen_TreeView.rs @@ -65,7 +65,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TreeView/getRowProperties)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TreeView`*"] - pub fn get_row_properties(this: &TreeView, row: i32) -> Result; + pub fn get_row_properties( + this: &TreeView, + row: i32, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "TreeView" , js_name = hasNextSibling)] #[doc = "The `hasNextSibling()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_U2fClientData.rs b/crates/web-sys/src/features/gen_U2fClientData.rs index a67f45af5d5..8dd7051e06e 100644 --- a/crates/web-sys/src/features/gen_U2fClientData.rs +++ b/crates/web-sys/src/features/gen_U2fClientData.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, getter = "challenge")] - pub fn get_challenge(this: &U2fClientData) -> Option; + pub fn get_challenge(this: &U2fClientData) -> Option<::alloc::string::String>; #[doc = "Change the `challenge` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &U2fClientData) -> Option; + pub fn get_origin(this: &U2fClientData) -> Option<::alloc::string::String>; #[doc = "Change the `origin` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] #[wasm_bindgen(method, getter = "typ")] - pub fn get_typ(this: &U2fClientData) -> Option; + pub fn get_typ(this: &U2fClientData) -> Option<::alloc::string::String>; #[doc = "Change the `typ` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `U2fClientData`*"] diff --git a/crates/web-sys/src/features/gen_UaDataValues.rs b/crates/web-sys/src/features/gen_UaDataValues.rs index 02cc3e761c1..40057b752da 100644 --- a/crates/web-sys/src/features/gen_UaDataValues.rs +++ b/crates/web-sys/src/features/gen_UaDataValues.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "architecture")] - pub fn get_architecture(this: &UaDataValues) -> Option; + pub fn get_architecture(this: &UaDataValues) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `architecture` field of this object."] #[doc = ""] @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "bitness")] - pub fn get_bitness(this: &UaDataValues) -> Option; + pub fn get_bitness(this: &UaDataValues) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bitness` field of this object."] #[doc = ""] @@ -130,7 +130,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "model")] - pub fn get_model(this: &UaDataValues) -> Option; + pub fn get_model(this: &UaDataValues) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `model` field of this object."] #[doc = ""] @@ -148,7 +148,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "platform")] - pub fn get_platform(this: &UaDataValues) -> Option; + pub fn get_platform(this: &UaDataValues) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platform` field of this object."] #[doc = ""] @@ -166,7 +166,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "platformVersion")] - pub fn get_platform_version(this: &UaDataValues) -> Option; + pub fn get_platform_version(this: &UaDataValues) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platformVersion` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_UaLowEntropyJson.rs b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs index 4a099e10946..b41243775bb 100644 --- a/crates/web-sys/src/features/gen_UaLowEntropyJson.rs +++ b/crates/web-sys/src/features/gen_UaLowEntropyJson.rs @@ -58,7 +58,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "platform")] - pub fn get_platform(this: &UaLowEntropyJson) -> Option; + pub fn get_platform(this: &UaLowEntropyJson) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `platform` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs index 7d8c01cf491..1a3d8596fcd 100644 --- a/crates/web-sys/src/features/gen_UdpMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_UdpMessageEventInit.rs @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] #[wasm_bindgen(method, getter = "remoteAddress")] - pub fn get_remote_address(this: &UdpMessageEventInit) -> Option; + pub fn get_remote_address(this: &UdpMessageEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `remoteAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpMessageEventInit`*"] diff --git a/crates/web-sys/src/features/gen_UdpOptions.rs b/crates/web-sys/src/features/gen_UdpOptions.rs index 99b8f998ea1..71af774a39b 100644 --- a/crates/web-sys/src/features/gen_UdpOptions.rs +++ b/crates/web-sys/src/features/gen_UdpOptions.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, getter = "localAddress")] - pub fn get_local_address(this: &UdpOptions) -> Option; + pub fn get_local_address(this: &UdpOptions) -> Option<::alloc::string::String>; #[doc = "Change the `localAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] #[wasm_bindgen(method, getter = "remoteAddress")] - pub fn get_remote_address(this: &UdpOptions) -> Option; + pub fn get_remote_address(this: &UdpOptions) -> Option<::alloc::string::String>; #[doc = "Change the `remoteAddress` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"] diff --git a/crates/web-sys/src/features/gen_Url.rs b/crates/web-sys/src/features/gen_Url.rs index 7665809b137..e229dc5628c 100644 --- a/crates/web-sys/src/features/gen_Url.rs +++ b/crates/web-sys/src/features/gen_Url.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn href(this: &Url) -> String; + pub fn href(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = href)] #[doc = "Setter for the `href` field of this object."] #[doc = ""] @@ -32,14 +32,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn origin(this: &Url) -> String; + pub fn origin(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "URL" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn protocol(this: &Url) -> String; + pub fn protocol(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = protocol)] #[doc = "Setter for the `protocol` field of this object."] #[doc = ""] @@ -53,7 +53,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/username)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn username(this: &Url) -> String; + pub fn username(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = username)] #[doc = "Setter for the `username` field of this object."] #[doc = ""] @@ -67,7 +67,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/password)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn password(this: &Url) -> String; + pub fn password(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = password)] #[doc = "Setter for the `password` field of this object."] #[doc = ""] @@ -81,7 +81,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn host(this: &Url) -> String; + pub fn host(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = host)] #[doc = "Setter for the `host` field of this object."] #[doc = ""] @@ -95,7 +95,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/hostname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn hostname(this: &Url) -> String; + pub fn hostname(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = hostname)] #[doc = "Setter for the `hostname` field of this object."] #[doc = ""] @@ -109,7 +109,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/port)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn port(this: &Url) -> String; + pub fn port(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = port)] #[doc = "Setter for the `port` field of this object."] #[doc = ""] @@ -123,7 +123,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn pathname(this: &Url) -> String; + pub fn pathname(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = pathname)] #[doc = "Setter for the `pathname` field of this object."] #[doc = ""] @@ -137,7 +137,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/search)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn search(this: &Url) -> String; + pub fn search(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = search)] #[doc = "Setter for the `search` field of this object."] #[doc = ""] @@ -159,7 +159,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn hash(this: &Url) -> String; + pub fn hash(this: &Url) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "URL" , js_name = hash)] #[doc = "Setter for the `hash` field of this object."] #[doc = ""] @@ -188,7 +188,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Blob`, `Url`*"] - pub fn create_object_url_with_blob(blob: &Blob) -> Result; + pub fn create_object_url_with_blob(blob: &Blob) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "MediaSource")] # [wasm_bindgen (catch , static_method_of = Url , js_class = "URL" , js_name = createObjectURL)] #[doc = "The `createObjectURL()` method."] @@ -196,7 +196,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `Url`*"] - pub fn create_object_url_with_source(source: &MediaSource) -> Result; + pub fn create_object_url_with_source( + source: &MediaSource, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , static_method_of = Url , js_class = "URL" , js_name = revokeObjectURL)] #[doc = "The `revokeObjectURL()` method."] #[doc = ""] @@ -210,5 +212,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL/toJSON)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Url`*"] - pub fn to_json(this: &Url) -> String; + pub fn to_json(this: &Url) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_UrlSearchParams.rs b/crates/web-sys/src/features/gen_UrlSearchParams.rs index 0e3132681e6..db83392f4d5 100644 --- a/crates/web-sys/src/features/gen_UrlSearchParams.rs +++ b/crates/web-sys/src/features/gen_UrlSearchParams.rs @@ -78,7 +78,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/get)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `UrlSearchParams`*"] - pub fn get(this: &UrlSearchParams, name: &str) -> Option; + pub fn get(this: &UrlSearchParams, name: &str) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "URLSearchParams" , js_name = getAll)] #[doc = "The `getAll()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_UsbAlternateInterface.rs b/crates/web-sys/src/features/gen_UsbAlternateInterface.rs index 668eae3ca20..1d9b17a2894 100644 --- a/crates/web-sys/src/features/gen_UsbAlternateInterface.rs +++ b/crates/web-sys/src/features/gen_UsbAlternateInterface.rs @@ -70,7 +70,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn interface_name(this: &UsbAlternateInterface) -> Option; + pub fn interface_name(this: &UsbAlternateInterface) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "USBAlternateInterface" , js_name = endpoints)] #[doc = "Getter for the `endpoints` field of this object."] diff --git a/crates/web-sys/src/features/gen_UsbConfiguration.rs b/crates/web-sys/src/features/gen_UsbConfiguration.rs index 02307adbd73..b7fe74c40a7 100644 --- a/crates/web-sys/src/features/gen_UsbConfiguration.rs +++ b/crates/web-sys/src/features/gen_UsbConfiguration.rs @@ -37,7 +37,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn configuration_name(this: &UsbConfiguration) -> Option; + pub fn configuration_name(this: &UsbConfiguration) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "USBConfiguration" , js_name = interfaces)] #[doc = "Getter for the `interfaces` field of this object."] diff --git a/crates/web-sys/src/features/gen_UsbDevice.rs b/crates/web-sys/src/features/gen_UsbDevice.rs index 8ac1f4737b6..4cc4104e9fa 100644 --- a/crates/web-sys/src/features/gen_UsbDevice.rs +++ b/crates/web-sys/src/features/gen_UsbDevice.rs @@ -147,7 +147,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn manufacturer_name(this: &UsbDevice) -> Option; + pub fn manufacturer_name(this: &UsbDevice) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = productName)] #[doc = "Getter for the `productName` field of this object."] @@ -158,7 +158,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn product_name(this: &UsbDevice) -> Option; + pub fn product_name(this: &UsbDevice) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = serialNumber)] #[doc = "Getter for the `serialNumber` field of this object."] @@ -169,7 +169,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn serial_number(this: &UsbDevice) -> Option; + pub fn serial_number(this: &UsbDevice) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "UsbConfiguration")] # [wasm_bindgen (structural , method , getter , js_class = "USBDevice" , js_name = configuration)] diff --git a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs index 411a66a560b..e25da163b83 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceFilter.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceFilter.rs @@ -76,7 +76,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "serialNumber")] - pub fn get_serial_number(this: &UsbDeviceFilter) -> Option; + pub fn get_serial_number(this: &UsbDeviceFilter) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `serialNumber` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VideoConfiguration.rs b/crates/web-sys/src/features/gen_VideoConfiguration.rs index d6467cf6b20..aa6b2a6f3bd 100644 --- a/crates/web-sys/src/features/gen_VideoConfiguration.rs +++ b/crates/web-sys/src/features/gen_VideoConfiguration.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, getter = "contentType")] - pub fn get_content_type(this: &VideoConfiguration) -> Option; + pub fn get_content_type(this: &VideoConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `contentType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] #[wasm_bindgen(method, getter = "framerate")] - pub fn get_framerate(this: &VideoConfiguration) -> Option; + pub fn get_framerate(this: &VideoConfiguration) -> Option<::alloc::string::String>; #[doc = "Change the `framerate` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoConfiguration`*"] diff --git a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs index 44c205a0984..3ff73219975 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "codec")] - pub fn get_codec(this: &VideoDecoderConfig) -> String; + pub fn get_codec(this: &VideoDecoderConfig) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs index b497f718d8b..55400176e0c 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs @@ -60,7 +60,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "codec")] - pub fn get_codec(this: &VideoEncoderConfig) -> String; + pub fn get_codec(this: &VideoEncoderConfig) -> ::alloc::string::String; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `codec` field of this object."] #[doc = ""] @@ -190,7 +190,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "scalabilityMode")] - pub fn get_scalability_mode(this: &VideoEncoderConfig) -> Option; + pub fn get_scalability_mode(this: &VideoEncoderConfig) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `scalabilityMode` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VideoTrack.rs b/crates/web-sys/src/features/gen_VideoTrack.rs index aa62eb051ee..6af0862f1ef 100644 --- a/crates/web-sys/src/features/gen_VideoTrack.rs +++ b/crates/web-sys/src/features/gen_VideoTrack.rs @@ -18,28 +18,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoTrack/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoTrack`*"] - pub fn id(this: &VideoTrack) -> String; + pub fn id(this: &VideoTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "VideoTrack" , js_name = kind)] #[doc = "Getter for the `kind` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoTrack/kind)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoTrack`*"] - pub fn kind(this: &VideoTrack) -> String; + pub fn kind(this: &VideoTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "VideoTrack" , js_name = label)] #[doc = "Getter for the `label` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoTrack/label)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoTrack`*"] - pub fn label(this: &VideoTrack) -> String; + pub fn label(this: &VideoTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "VideoTrack" , js_name = language)] #[doc = "Getter for the `language` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VideoTrack/language)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VideoTrack`*"] - pub fn language(this: &VideoTrack) -> String; + pub fn language(this: &VideoTrack) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "VideoTrack" , js_name = selected)] #[doc = "Getter for the `selected` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VrDisplay.rs b/crates/web-sys/src/features/gen_VrDisplay.rs index 2abf7e140d3..99c27ee51ae 100644 --- a/crates/web-sys/src/features/gen_VrDisplay.rs +++ b/crates/web-sys/src/features/gen_VrDisplay.rs @@ -55,7 +55,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/displayName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrDisplay`*"] - pub fn display_name(this: &VrDisplay) -> String; + pub fn display_name(this: &VrDisplay) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "VRDisplay" , js_name = depthNear)] #[doc = "Getter for the `depthNear` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VrSubmitFrameResult.rs b/crates/web-sys/src/features/gen_VrSubmitFrameResult.rs index 788628127b8..4779638a56a 100644 --- a/crates/web-sys/src/features/gen_VrSubmitFrameResult.rs +++ b/crates/web-sys/src/features/gen_VrSubmitFrameResult.rs @@ -25,7 +25,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRSubmitFrameResult/base64Image)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrSubmitFrameResult`*"] - pub fn base64_image(this: &VrSubmitFrameResult) -> Option; + pub fn base64_image(this: &VrSubmitFrameResult) -> Option<::alloc::string::String>; #[wasm_bindgen(catch, constructor, js_class = "VRSubmitFrameResult")] #[doc = "The `new VrSubmitFrameResult(..)` constructor, creating a new instance of `VrSubmitFrameResult`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VttCue.rs b/crates/web-sys/src/features/gen_VttCue.rs index e97a4326b5f..6598a915ef6 100644 --- a/crates/web-sys/src/features/gen_VttCue.rs +++ b/crates/web-sys/src/features/gen_VttCue.rs @@ -186,7 +186,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/text)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttCue`*"] - pub fn text(this: &VttCue) -> String; + pub fn text(this: &VttCue) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "VTTCue" , js_name = text)] #[doc = "Setter for the `text` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_VttRegion.rs b/crates/web-sys/src/features/gen_VttRegion.rs index 116a3438cab..c5c85a514cb 100644 --- a/crates/web-sys/src/features/gen_VttRegion.rs +++ b/crates/web-sys/src/features/gen_VttRegion.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VTTRegion/id)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VttRegion`*"] - pub fn id(this: &VttRegion) -> String; + pub fn id(this: &VttRegion) -> ::alloc::string::String; # [wasm_bindgen (structural , method , setter , js_class = "VTTRegion" , js_name = id)] #[doc = "Setter for the `id` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs index 32e59caa273..0c854aed654 100644 --- a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs @@ -1976,7 +1976,7 @@ extern "C" { this: &WebGl2RenderingContext, program: &WebGlProgram, uniform_block_index: u32, - ) -> Option; + ) -> Option<::alloc::string::String>; #[cfg(feature = "WebGlProgram")] # [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = getActiveUniformBlockParameter)] #[doc = "The `getActiveUniformBlockParameter()` method."] @@ -7307,7 +7307,7 @@ extern "C" { pub fn get_program_info_log( this: &WebGl2RenderingContext, program: &WebGlProgram, - ) -> Option; + ) -> Option<::alloc::string::String>; #[cfg(feature = "WebGlProgram")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getProgramParameter)] #[doc = "The `getProgramParameter()` method."] @@ -7341,7 +7341,7 @@ extern "C" { pub fn get_shader_info_log( this: &WebGl2RenderingContext, shader: &WebGlShader, - ) -> Option; + ) -> Option<::alloc::string::String>; #[cfg(feature = "WebGlShader")] # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getShaderParameter)] #[doc = "The `getShaderParameter()` method."] @@ -7373,8 +7373,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/getShaderSource)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `WebGlShader`*"] - pub fn get_shader_source(this: &WebGl2RenderingContext, shader: &WebGlShader) - -> Option; + pub fn get_shader_source( + this: &WebGl2RenderingContext, + shader: &WebGlShader, + ) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "WebGL2RenderingContext" , js_name = getSupportedExtensions)] #[doc = "The `getSupportedExtensions()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebGlActiveInfo.rs b/crates/web-sys/src/features/gen_WebGlActiveInfo.rs index 9bc90465d1a..b8572f1a90a 100644 --- a/crates/web-sys/src/features/gen_WebGlActiveInfo.rs +++ b/crates/web-sys/src/features/gen_WebGlActiveInfo.rs @@ -32,5 +32,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLActiveInfo/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlActiveInfo`*"] - pub fn name(this: &WebGlActiveInfo) -> String; + pub fn name(this: &WebGlActiveInfo) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_WebGlContextEvent.rs b/crates/web-sys/src/features/gen_WebGlContextEvent.rs index 62339aa93b3..c0d20858297 100644 --- a/crates/web-sys/src/features/gen_WebGlContextEvent.rs +++ b/crates/web-sys/src/features/gen_WebGlContextEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLContextEvent/statusMessage)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEvent`*"] - pub fn status_message(this: &WebGlContextEvent) -> String; + pub fn status_message(this: &WebGlContextEvent) -> ::alloc::string::String; #[wasm_bindgen(catch, constructor, js_class = "WebGLContextEvent")] #[doc = "The `new WebGlContextEvent(..)` constructor, creating a new instance of `WebGlContextEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs index fff5f4f4790..8afb446b902 100644 --- a/crates/web-sys/src/features/gen_WebGlContextEventInit.rs +++ b/crates/web-sys/src/features/gen_WebGlContextEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] #[wasm_bindgen(method, getter = "statusMessage")] - pub fn get_status_message(this: &WebGlContextEventInit) -> Option; + pub fn get_status_message(this: &WebGlContextEventInit) -> Option<::alloc::string::String>; #[doc = "Change the `statusMessage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlContextEventInit`*"] diff --git a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs index 9d570035a01..dbca228ee67 100644 --- a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs @@ -1639,7 +1639,7 @@ extern "C" { pub fn get_program_info_log( this: &WebGlRenderingContext, program: &WebGlProgram, - ) -> Option; + ) -> Option<::alloc::string::String>; #[cfg(feature = "WebGlProgram")] # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = getProgramParameter)] #[doc = "The `getProgramParameter()` method."] @@ -1673,7 +1673,7 @@ extern "C" { pub fn get_shader_info_log( this: &WebGlRenderingContext, shader: &WebGlShader, - ) -> Option; + ) -> Option<::alloc::string::String>; #[cfg(feature = "WebGlShader")] # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = getShaderParameter)] #[doc = "The `getShaderParameter()` method."] @@ -1705,7 +1705,10 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getShaderSource)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `WebGlShader`*"] - pub fn get_shader_source(this: &WebGlRenderingContext, shader: &WebGlShader) -> Option; + pub fn get_shader_source( + this: &WebGlRenderingContext, + shader: &WebGlShader, + ) -> Option<::alloc::string::String>; # [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = getSupportedExtensions)] #[doc = "The `getSupportedExtensions()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebSocket.rs b/crates/web-sys/src/features/gen_WebSocket.rs index 5f57a3c735a..7b9ef40e532 100644 --- a/crates/web-sys/src/features/gen_WebSocket.rs +++ b/crates/web-sys/src/features/gen_WebSocket.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/url)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocket`*"] - pub fn url(this: &WebSocket) -> String; + pub fn url(this: &WebSocket) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WebSocket" , js_name = readyState)] #[doc = "Getter for the `readyState` field of this object."] #[doc = ""] @@ -81,14 +81,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/extensions)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocket`*"] - pub fn extensions(this: &WebSocket) -> String; + pub fn extensions(this: &WebSocket) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WebSocket" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocket`*"] - pub fn protocol(this: &WebSocket) -> String; + pub fn protocol(this: &WebSocket) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WebSocket" , js_name = onmessage)] #[doc = "Getter for the `onmessage` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebSocketElement.rs b/crates/web-sys/src/features/gen_WebSocketElement.rs index 7c6d3464b56..56de8133975 100644 --- a/crates/web-sys/src/features/gen_WebSocketElement.rs +++ b/crates/web-sys/src/features/gen_WebSocketElement.rs @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] #[wasm_bindgen(method, getter = "hostport")] - pub fn get_hostport(this: &WebSocketElement) -> Option; + pub fn get_hostport(this: &WebSocketElement) -> Option<::alloc::string::String>; #[doc = "Change the `hostport` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebSocketElement`*"] diff --git a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs index d33023f8870..fa1cd6f5c4f 100644 --- a/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs +++ b/crates/web-sys/src/features/gen_WebTransportCloseInfo.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "reason")] - pub fn get_reason(this: &WebTransportCloseInfo) -> Option; + pub fn get_reason(this: &WebTransportCloseInfo) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `reason` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebTransportHash.rs b/crates/web-sys/src/features/gen_WebTransportHash.rs index 0a897b9f611..cf5d1fbfeda 100644 --- a/crates/web-sys/src/features/gen_WebTransportHash.rs +++ b/crates/web-sys/src/features/gen_WebTransportHash.rs @@ -22,7 +22,7 @@ extern "C" { #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "algorithm")] - pub fn get_algorithm(this: &WebTransportHash) -> Option; + pub fn get_algorithm(this: &WebTransportHash) -> Option<::alloc::string::String>; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `algorithm` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WebglDebugShaders.rs b/crates/web-sys/src/features/gen_WebglDebugShaders.rs index c3db2401d80..01131d0d353 100644 --- a/crates/web-sys/src/features/gen_WebglDebugShaders.rs +++ b/crates/web-sys/src/features/gen_WebglDebugShaders.rs @@ -19,5 +19,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_shaders/getTranslatedShaderSource)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlShader`, `WebglDebugShaders`*"] - pub fn get_translated_shader_source(this: &WebglDebugShaders, shader: &WebGlShader) -> String; + pub fn get_translated_shader_source( + this: &WebglDebugShaders, + shader: &WebGlShader, + ) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs index a9ae7990833..d60289d47d4 100644 --- a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs +++ b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "description")] - pub fn get_description(this: &WidevineCdmManifest) -> String; + pub fn get_description(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `description` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -24,7 +24,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &WidevineCdmManifest) -> String; + pub fn get_name(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -34,7 +34,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "version")] - pub fn get_version(this: &WidevineCdmManifest) -> String; + pub fn get_version(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `version` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "x-cdm-codecs")] - pub fn get_x_cdm_codecs(this: &WidevineCdmManifest) -> String; + pub fn get_x_cdm_codecs(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `x-cdm-codecs` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -54,7 +54,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "x-cdm-host-versions")] - pub fn get_x_cdm_host_versions(this: &WidevineCdmManifest) -> String; + pub fn get_x_cdm_host_versions(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `x-cdm-host-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -64,7 +64,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "x-cdm-interface-versions")] - pub fn get_x_cdm_interface_versions(this: &WidevineCdmManifest) -> String; + pub fn get_x_cdm_interface_versions(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `x-cdm-interface-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] @@ -74,7 +74,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] #[wasm_bindgen(method, getter = "x-cdm-module-versions")] - pub fn get_x_cdm_module_versions(this: &WidevineCdmManifest) -> String; + pub fn get_x_cdm_module_versions(this: &WidevineCdmManifest) -> ::alloc::string::String; #[doc = "Change the `x-cdm-module-versions` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WidevineCdmManifest`*"] diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 01a879dc969..cea28074b37 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -40,7 +40,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/name)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn name(this: &Window) -> Result; + pub fn name(this: &Window) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Window" , js_name = name)] #[doc = "Setter for the `name` field of this object."] #[doc = ""] @@ -126,7 +126,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/status)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn status(this: &Window) -> Result; + pub fn status(this: &Window) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , setter , js_class = "Window" , js_name = status)] #[doc = "Setter for the `status` field of this object."] #[doc = ""] @@ -1988,7 +1988,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn origin(this: &Window) -> String; + pub fn origin(this: &Window) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = isSecureContext)] #[doc = "Getter for the `isSecureContext` field of this object."] #[doc = ""] @@ -2213,14 +2213,17 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn prompt(this: &Window) -> Result, JsValue>; + pub fn prompt(this: &Window) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = prompt)] #[doc = "The `prompt()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn prompt_with_message(this: &Window, message: &str) -> Result, JsValue>; + pub fn prompt_with_message( + this: &Window, + message: &str, + ) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = prompt)] #[doc = "The `prompt()` method."] #[doc = ""] @@ -2231,7 +2234,7 @@ extern "C" { this: &Window, message: &str, default: &str, - ) -> Result, JsValue>; + ) -> Result, JsValue>; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = queryLocalFonts)] #[doc = "The `queryLocalFonts()` method."] @@ -2482,14 +2485,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/atob)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn atob(this: &Window, atob: &str) -> Result; + pub fn atob(this: &Window, atob: &str) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = btoa)] #[doc = "The `btoa()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] - pub fn btoa(this: &Window, btoa: &str) -> Result; + pub fn btoa(this: &Window, btoa: &str) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "Window" , js_name = clearInterval)] #[doc = "The `clearInterval()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index ff7518533e5..27ce448e7f7 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -107,7 +107,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn origin(this: &WorkerGlobalScope) -> String; + pub fn origin(this: &WorkerGlobalScope) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = isSecureContext)] #[doc = "Getter for the `isSecureContext` field of this object."] #[doc = ""] @@ -243,14 +243,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/atob)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn atob(this: &WorkerGlobalScope, atob: &str) -> Result; + pub fn atob(this: &WorkerGlobalScope, atob: &str) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = btoa)] #[doc = "The `btoa()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/btoa)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"] - pub fn btoa(this: &WorkerGlobalScope, btoa: &str) -> Result; + pub fn btoa(this: &WorkerGlobalScope, btoa: &str) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = clearInterval)] #[doc = "The `clearInterval()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerLocation.rs b/crates/web-sys/src/features/gen_WorkerLocation.rs index f8c93987d51..2bd6a64a799 100644 --- a/crates/web-sys/src/features/gen_WorkerLocation.rs +++ b/crates/web-sys/src/features/gen_WorkerLocation.rs @@ -18,61 +18,61 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/href)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn href(this: &WorkerLocation) -> String; + pub fn href(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = origin)] #[doc = "Getter for the `origin` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/origin)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn origin(this: &WorkerLocation) -> String; + pub fn origin(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = protocol)] #[doc = "Getter for the `protocol` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/protocol)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn protocol(this: &WorkerLocation) -> String; + pub fn protocol(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = host)] #[doc = "Getter for the `host` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/host)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn host(this: &WorkerLocation) -> String; + pub fn host(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = hostname)] #[doc = "Getter for the `hostname` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/hostname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn hostname(this: &WorkerLocation) -> String; + pub fn hostname(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = port)] #[doc = "Getter for the `port` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/port)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn port(this: &WorkerLocation) -> String; + pub fn port(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = pathname)] #[doc = "Getter for the `pathname` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/pathname)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn pathname(this: &WorkerLocation) -> String; + pub fn pathname(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = search)] #[doc = "Getter for the `search` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/search)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn search(this: &WorkerLocation) -> String; + pub fn search(this: &WorkerLocation) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerLocation" , js_name = hash)] #[doc = "Getter for the `hash` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation/hash)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerLocation`*"] - pub fn hash(this: &WorkerLocation) -> String; + pub fn hash(this: &WorkerLocation) -> ::alloc::string::String; } diff --git a/crates/web-sys/src/features/gen_WorkerNavigator.rs b/crates/web-sys/src/features/gen_WorkerNavigator.rs index 9fbedbbbfbb..45c5d17f898 100644 --- a/crates/web-sys/src/features/gen_WorkerNavigator.rs +++ b/crates/web-sys/src/features/gen_WorkerNavigator.rs @@ -88,49 +88,49 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/appCodeName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn app_code_name(this: &WorkerNavigator) -> Result; + pub fn app_code_name(this: &WorkerNavigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = appName)] #[doc = "Getter for the `appName` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/appName)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn app_name(this: &WorkerNavigator) -> String; + pub fn app_name(this: &WorkerNavigator) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerNavigator" , js_name = appVersion)] #[doc = "Getter for the `appVersion` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/appVersion)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn app_version(this: &WorkerNavigator) -> Result; + pub fn app_version(this: &WorkerNavigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerNavigator" , js_name = platform)] #[doc = "Getter for the `platform` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/platform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn platform(this: &WorkerNavigator) -> Result; + pub fn platform(this: &WorkerNavigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerNavigator" , js_name = userAgent)] #[doc = "Getter for the `userAgent` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/userAgent)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn user_agent(this: &WorkerNavigator) -> Result; + pub fn user_agent(this: &WorkerNavigator) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = product)] #[doc = "Getter for the `product` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/product)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn product(this: &WorkerNavigator) -> String; + pub fn product(this: &WorkerNavigator) -> ::alloc::string::String; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = language)] #[doc = "Getter for the `language` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerNavigator/language)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerNavigator`*"] - pub fn language(this: &WorkerNavigator) -> Option; + pub fn language(this: &WorkerNavigator) -> Option<::alloc::string::String>; # [wasm_bindgen (structural , method , getter , js_class = "WorkerNavigator" , js_name = languages)] #[doc = "Getter for the `languages` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WorkerOptions.rs b/crates/web-sys/src/features/gen_WorkerOptions.rs index e14b81609cc..f21c37085d8 100644 --- a/crates/web-sys/src/features/gen_WorkerOptions.rs +++ b/crates/web-sys/src/features/gen_WorkerOptions.rs @@ -26,7 +26,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] #[wasm_bindgen(method, getter = "name")] - pub fn get_name(this: &WorkerOptions) -> Option; + pub fn get_name(this: &WorkerOptions) -> Option<::alloc::string::String>; #[doc = "Change the `name` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"] diff --git a/crates/web-sys/src/features/gen_XPathResult.rs b/crates/web-sys/src/features/gen_XPathResult.rs index 1ed07af8731..7a99a0e67c7 100644 --- a/crates/web-sys/src/features/gen_XPathResult.rs +++ b/crates/web-sys/src/features/gen_XPathResult.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/stringValue)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XPathResult`*"] - pub fn string_value(this: &XPathResult) -> Result; + pub fn string_value(this: &XPathResult) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "XPathResult" , js_name = booleanValue)] #[doc = "Getter for the `booleanValue` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_XmlHttpRequest.rs b/crates/web-sys/src/features/gen_XmlHttpRequest.rs index fa745611743..7f8b207dbae 100644 --- a/crates/web-sys/src/features/gen_XmlHttpRequest.rs +++ b/crates/web-sys/src/features/gen_XmlHttpRequest.rs @@ -75,7 +75,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XmlHttpRequest`*"] - pub fn response_url(this: &XmlHttpRequest) -> String; + pub fn response_url(this: &XmlHttpRequest) -> ::alloc::string::String; # [wasm_bindgen (structural , catch , method , getter , js_class = "XMLHttpRequest" , js_name = status)] #[doc = "Getter for the `status` field of this object."] #[doc = ""] @@ -89,7 +89,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/statusText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XmlHttpRequest`*"] - pub fn status_text(this: &XmlHttpRequest) -> Result; + pub fn status_text(this: &XmlHttpRequest) -> Result<::alloc::string::String, JsValue>; #[cfg(feature = "XmlHttpRequestResponseType")] # [wasm_bindgen (structural , method , getter , js_class = "XMLHttpRequest" , js_name = responseType)] #[doc = "Getter for the `responseType` field of this object."] @@ -119,7 +119,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XmlHttpRequest`*"] - pub fn response_text(this: &XmlHttpRequest) -> Result, JsValue>; + pub fn response_text(this: &XmlHttpRequest) + -> Result, JsValue>; #[cfg(feature = "Document")] # [wasm_bindgen (structural , catch , method , getter , js_class = "XMLHttpRequest" , js_name = responseXML)] #[doc = "Getter for the `responseXML` field of this object."] @@ -155,7 +156,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XmlHttpRequest`*"] - pub fn get_all_response_headers(this: &XmlHttpRequest) -> Result; + pub fn get_all_response_headers( + this: &XmlHttpRequest, + ) -> Result<::alloc::string::String, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "XMLHttpRequest" , js_name = getResponseHeader)] #[doc = "The `getResponseHeader()` method."] #[doc = ""] @@ -165,7 +168,7 @@ extern "C" { pub fn get_response_header( this: &XmlHttpRequest, header: &str, - ) -> Result, JsValue>; + ) -> Result, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "XMLHttpRequest" , js_name = open)] #[doc = "The `open()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_XmlSerializer.rs b/crates/web-sys/src/features/gen_XmlSerializer.rs index 0d00e952457..af075d62688 100644 --- a/crates/web-sys/src/features/gen_XmlSerializer.rs +++ b/crates/web-sys/src/features/gen_XmlSerializer.rs @@ -26,5 +26,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer/serializeToString)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Node`, `XmlSerializer`*"] - pub fn serialize_to_string(this: &XmlSerializer, root: &Node) -> Result; + pub fn serialize_to_string( + this: &XmlSerializer, + root: &Node, + ) -> Result<::alloc::string::String, JsValue>; } diff --git a/crates/web-sys/src/features/gen_css.rs b/crates/web-sys/src/features/gen_css.rs index 6ec6ff813dc..94613d3f590 100644 --- a/crates/web-sys/src/features/gen_css.rs +++ b/crates/web-sys/src/features/gen_css.rs @@ -11,7 +11,7 @@ pub mod css { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `css`*"] - pub fn escape(ident: &str) -> String; + pub fn escape(ident: &str) -> ::alloc::string::String; # [wasm_bindgen (catch , js_namespace = CSS , js_name = supports)] #[doc = "The `CSS.supports()` function."] #[doc = ""] diff --git a/crates/web-sys/src/lib.rs b/crates/web-sys/src/lib.rs index 01e9aa7999b..bb2e73de44e 100644 --- a/crates/web-sys/src/lib.rs +++ b/crates/web-sys/src/lib.rs @@ -12,9 +12,13 @@ //! require. #![doc(html_root_url = "https://docs.rs/web-sys/0.3")] +#![cfg_attr(not(feature = "std"), no_std)] #![allow(deprecated)] +extern crate alloc; + mod features; +#[allow(unused_imports)] pub use features::*; pub use js_sys; diff --git a/crates/web-sys/tests/wasm/history.rs b/crates/web-sys/tests/wasm/history.rs index e2800520eb9..ba073d85e07 100644 --- a/crates/web-sys/tests/wasm/history.rs +++ b/crates/web-sys/tests/wasm/history.rs @@ -4,7 +4,7 @@ use web_sys::{History, ScrollRestoration}; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(thread_local, js_name = history, js_namespace = window)] + #[wasm_bindgen(thread_local_v2, js_name = history, js_namespace = window)] static HISTORY: History; } diff --git a/crates/web-sys/tests/wasm/performance.rs b/crates/web-sys/tests/wasm/performance.rs index 09fb59a66a1..1be0c7f11f0 100644 --- a/crates/web-sys/tests/wasm/performance.rs +++ b/crates/web-sys/tests/wasm/performance.rs @@ -4,7 +4,7 @@ use web_sys::Performance; #[wasm_bindgen] extern "C" { - #[wasm_bindgen(thread_local, js_name = performance)] + #[wasm_bindgen(thread_local_v2, js_name = performance)] static PERFORMANCE: Performance; } diff --git a/crates/webidl-tests/main.rs b/crates/webidl-tests/main.rs index de1e5046670..cef83d4c65e 100644 --- a/crates/webidl-tests/main.rs +++ b/crates/webidl-tests/main.rs @@ -1,3 +1,5 @@ +extern crate alloc; + use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 43a70604d07..40fa060f1ec 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -626,6 +626,14 @@ impl<'a> IdlType<'a> { let path = vec![rust_ident("wasm_bindgen"), rust_ident("JsValue")]; externref(leading_colon_path_ty(path)) }; + let string = { + let path = vec![ + rust_ident("alloc"), + rust_ident("string"), + rust_ident("String"), + ]; + externref(leading_colon_path_ty(path)) + }; match self { IdlType::Boolean => Ok(Some(ident_ty(raw_ident("bool")))), IdlType::Byte => Ok(Some(ident_ty(raw_ident("i8")))), @@ -655,7 +663,7 @@ impl<'a> IdlType<'a> { IdlType::UnrestrictedDouble => Ok(Some(ident_ty(raw_ident("f64")))), IdlType::DomString | IdlType::ByteString | IdlType::UsvString => match pos { TypePosition::Argument => Ok(Some(shared_ref(ident_ty(raw_ident("str")), false))), - TypePosition::Return => Ok(Some(ident_ty(raw_ident("String")))), + TypePosition::Return => Ok(string), }, IdlType::Object => Ok(js_sys("Object")), IdlType::Symbol => Err(TypeError::CannotConvert), diff --git a/crates/webidl/src/update_cargo_toml.rs b/crates/webidl/src/update_cargo_toml.rs index cc8f6fdc641..7e3abf395e3 100644 --- a/crates/webidl/src/update_cargo_toml.rs +++ b/crates/webidl/src/update_cargo_toml.rs @@ -9,10 +9,12 @@ pub fn update_cargo_toml_features( let comment = "# This list is auto-generated by the wasm-bindgen-webidl program"; let features_head = "[features]"; let features_table = format!( - r"{comment} + r#"{comment} {features_head} +default = ["std"] +std = ["wasm-bindgen/std", "js-sys/std"] {generated_features} -" +"# ); match cargo_toml_text.find(features_head) { diff --git a/examples/wasm-audio-worklet/src/dependent_module.rs b/examples/wasm-audio-worklet/src/dependent_module.rs index 5e074d72b0b..7f5f28eec61 100644 --- a/examples/wasm-audio-worklet/src/dependent_module.rs +++ b/examples/wasm-audio-worklet/src/dependent_module.rs @@ -12,7 +12,7 @@ extern "C" { #[wasm_bindgen(method, getter)] fn url(this: &ImportMeta) -> JsString; - #[wasm_bindgen(thread_local, js_namespace = import, js_name = meta)] + #[wasm_bindgen(thread_local_v2, js_namespace = import, js_name = meta)] static IMPORT_META: ImportMeta; } diff --git a/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md b/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md index 0d0443cb001..9ec96fe7007 100644 --- a/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md +++ b/guide/src/reference/attributes/on-js-imports/indexing-getter-setter-deleter.md @@ -60,7 +60,7 @@ on methods: #[wasm_bindgen] extern "C" { type Foo; - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static FOO: Foo; #[wasm_bindgen(method, structural, indexing_getter)] diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md index 2402098e606..b6aee687dc8 100644 --- a/guide/src/reference/static-js-objects.md +++ b/guide/src/reference/static-js-objects.md @@ -2,9 +2,10 @@ JavaScript modules will often export arbitrary static objects for use with their provided interfaces. These objects can be accessed from Rust by declaring -a named `static` in the `extern` block. `wasm-bindgen` will bind a `JsStatic` -for these objects, which can be cloned into a `JsValue`. For example, given the -following JavaScript: +a named `static` in the `extern` block with an +`#[wasm_bindgen(thread_local_v2)]` attribute. `wasm-bindgen` will bind a +`JsThreadLocal` for these objects, which can be cloned into a `JsValue`. For +example, given the following JavaScript: ```js let COLORS = { @@ -19,7 +20,7 @@ let COLORS = { ```rust #[wasm_bindgen] extern "C" { - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static COLORS; } @@ -50,11 +51,11 @@ The binding for this module: #[wasm_bindgen(module = "/js/some-rollup.js")] extern "C" { // Likewise with the namespace--this refers to the object directly. - #[wasm_bindgen(thread_local, js_name = namespace)] + #[wasm_bindgen(thread_local_v2, js_name = namespace)] static NAMESPACE: JsValue; // Refer to SomeType's class - #[wasm_bindgen(thread_local, js_name = SomeType)] + #[wasm_bindgen(thread_local_v2, js_name = SomeType)] static SOME_TYPE: JsValue; // Other bindings for SomeType @@ -71,7 +72,7 @@ Strings can be imported to avoid going through `TextDecoder/Encoder` when requir ```rust #[wasm_bindgen] extern "C" { - #[wasm_bindgen(thread_local, static_string)] + #[wasm_bindgen(thread_local_v2, static_string)] static STRING: JsString = "a string literal"; } ``` diff --git a/src/convert/mod.rs b/src/convert/mod.rs index 548b42fda05..02fa3d31702 100644 --- a/src/convert/mod.rs +++ b/src/convert/mod.rs @@ -3,6 +3,8 @@ //! This is an internal module, no stability guarantees are provided. Use at //! your own risk. +#![allow(clippy::missing_safety_doc)] + mod closures; mod impls; mod slices; diff --git a/src/externref.rs b/src/externref.rs index 1691bc45892..a708dc5adc2 100644 --- a/src/externref.rs +++ b/src/externref.rs @@ -106,7 +106,7 @@ fn internal_error(msg: &str) -> ! { std::process::abort(); } else if #[cfg(all( target_arch = "wasm32", - target_os = "unknown" + any(target_os = "unknown", target_os = "none") ))] { core::arch::wasm32::unreachable(); } else { @@ -117,7 +117,12 @@ fn internal_error(msg: &str) -> ! { // Management of `externref` is always thread local since an `externref` value // can't cross threads in wasm. Indices as a result are always thread-local. -std::thread_local!(pub static HEAP_SLAB: Cell = Cell::new(Slab::new())); +#[cfg(feature = "std")] +std::thread_local!(static HEAP_SLAB: Cell = Cell::new(Slab::new())); +#[cfg(not(feature = "std"))] +#[cfg_attr(target_feature = "atomics", thread_local)] +static HEAP_SLAB: crate::__rt::LazyCell> = + crate::__rt::LazyCell::new(|| Cell::new(Slab::new())); #[no_mangle] pub extern "C" fn __externref_table_alloc() -> usize { diff --git a/src/lib.rs b/src/lib.rs index 6c6961cf942..a375a5d2acc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,10 @@ #![no_std] #![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] +#![cfg_attr( + all(not(feature = "std"), target_feature = "atomics"), + feature(thread_local) +)] #![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] @@ -33,14 +37,14 @@ macro_rules! if_std { macro_rules! externs { ($(#[$attr:meta])* extern "C" { $(fn $name:ident($($args:tt)*) -> $ret:ty;)* }) => ( - #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] + #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] $(#[$attr])* extern "C" { $(fn $name($($args)*) -> $ret;)* } $( - #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] + #[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))] #[allow(unused_variables)] unsafe extern fn $name($($args)*) -> $ret { panic!("function not implemented on non-wasm32 targets") @@ -71,6 +75,7 @@ pub use wasm_bindgen_macro::link_to; pub mod closure; pub mod convert; pub mod describe; +mod externref; mod link; mod cast; @@ -79,7 +84,6 @@ pub use crate::cast::{JsCast, JsObject}; if_std! { extern crate std; use std::prelude::v1::*; - mod externref; mod cache; pub use cache::intern::{intern, unintern}; } @@ -1186,7 +1190,7 @@ impl Default for JsValue { /// This type implements `Deref` to the inner type so it's typically used as if /// it were `&T`. #[cfg(feature = "std")] -#[deprecated = "use with `#[wasm_bindgen(thread_local)]` instead"] +#[deprecated = "use with `#[wasm_bindgen(thread_local_v2)]` instead"] pub struct JsStatic { #[doc(hidden)] pub __inner: &'static std::thread::LocalKey, @@ -1202,6 +1206,50 @@ impl Deref for JsStatic { } } +/// Wrapper type for imported statics. +/// +/// This type is used whenever a `static` is imported from a JS module, for +/// example this import: +/// +/// ```ignore +/// #[wasm_bindgen] +/// extern "C" { +/// #[wasm_bindgen(thread_local_v2)] +/// static console: JsValue; +/// } +/// ``` +/// +/// will generate in Rust a value that looks like: +/// +/// ```ignore +/// static console: JsThreadLocal = ...; +/// ``` +pub struct JsThreadLocal { + #[doc(hidden)] + #[cfg(feature = "std")] + pub __inner: &'static std::thread::LocalKey, + #[doc(hidden)] + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + pub __inner: &'static __rt::LazyCell, + #[doc(hidden)] + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + pub __inner: fn() -> *const T, +} + +impl JsThreadLocal { + pub fn with(&'static self, f: F) -> R + where + F: FnOnce(&T) -> R, + { + #[cfg(feature = "std")] + return self.__inner.with(f); + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + return f(self.__inner); + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + f(unsafe { &*(self.__inner)() }) + } +} + #[cold] #[inline(never)] #[deprecated(note = "renamed to `throw_str`")] @@ -1336,14 +1384,17 @@ pub trait UnwrapThrowExt: Sized { #[cfg_attr( any( debug_assertions, - not(all(target_arch = "wasm32", target_os = "unknown")) + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))) ), track_caller )] fn unwrap_throw(self) -> T { if cfg!(all( debug_assertions, - all(target_arch = "wasm32", target_os = "unknown") + all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + ) )) { let loc = core::panic::Location::caller(); let msg = alloc::format!( @@ -1365,7 +1416,7 @@ pub trait UnwrapThrowExt: Sized { #[cfg_attr( any( debug_assertions, - not(all(target_arch = "wasm32", target_os = "unknown")) + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))) ), track_caller )] @@ -1376,7 +1427,10 @@ impl UnwrapThrowExt for Option { fn unwrap_throw(self) -> T { const MSG: &str = "called `Option::unwrap_throw()` on a `None` value"; - if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { + if cfg!(all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + )) { if let Some(val) = self { val } else if cfg!(debug_assertions) { @@ -1394,7 +1448,10 @@ impl UnwrapThrowExt for Option { } fn expect_throw(self, message: &str) -> T { - if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { + if cfg!(all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + )) { if let Some(val) = self { val } else if cfg!(debug_assertions) { @@ -1424,7 +1481,10 @@ where fn unwrap_throw(self) -> T { const MSG: &str = "called `Result::unwrap_throw()` on an `Err` value"; - if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { + if cfg!(all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + )) { match self { Ok(val) => val, Err(err) => { @@ -1451,7 +1511,10 @@ where } fn expect_throw(self, message: &str) -> T { - if cfg!(all(target_arch = "wasm32", target_os = "unknown")) { + if cfg!(all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + )) { match self { Ok(val) => val, Err(err) => { @@ -1518,7 +1581,54 @@ pub mod __rt { use alloc::alloc::{alloc, dealloc, realloc, Layout}; use alloc::boxed::Box; use alloc::rc::Rc; - pub use once_cell::sync::Lazy; + + pub mod once_cell { + #[cfg(any(target_feature = "atomics", feature = "std"))] + pub use once_cell::*; + + #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] + pub mod sync { + pub use super::super::LazyCell as Lazy; + } + } + + /// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with + /// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. + #[cfg(not(feature = "std"))] + pub struct LazyCell(::once_cell::unsync::Lazy); + + #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] + unsafe impl Sync for LazyCell {} + + #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] + unsafe impl Send for LazyCell {} + + #[cfg(not(feature = "std"))] + impl LazyCell { + pub const fn new(init: fn() -> T) -> LazyCell { + Self(::once_cell::unsync::Lazy::new(init)) + } + + pub(crate) fn try_with( + &self, + f: impl FnOnce(&T) -> R, + ) -> Result { + Ok(f(&self.0)) + } + + pub fn force(this: &Self) -> &T { + &this.0 + } + } + + #[cfg(not(feature = "std"))] + impl Deref for LazyCell { + type Target = T; + + fn deref(&self) -> &T { + ::once_cell::unsync::Lazy::force(&self.0) + } + } #[macro_export] #[doc(hidden)] @@ -1826,7 +1936,7 @@ pub mod __rt { std::process::abort(); } else if #[cfg(all( target_arch = "wasm32", - target_os = "unknown" + any(target_os = "unknown", target_os = "none") ))] { core::arch::wasm32::unreachable(); } else { @@ -1884,30 +1994,64 @@ pub mod __rt { crate::link::link_intrinsics(); } - if_std! { - std::thread_local! { - static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + #[cfg(feature = "std")] + std::thread_local! { + static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + } + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + static mut GLOBAL_EXNDATA: [u32; 2] = [0; 2]; + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + #[thread_local] + static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + + struct GlobalExndata; + + impl GlobalExndata { + #[cfg(feature = "std")] + fn get() -> [u32; 2] { + GLOBAL_EXNDATA.with(Cell::get) } - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { - GLOBAL_EXNDATA.with(|data| { - debug_assert_eq!(data.get()[0], 0); - data.set([1, idx]); - }); + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + fn get() -> [u32; 2] { + unsafe { GLOBAL_EXNDATA } } - pub fn take_last_exception() -> Result<(), super::JsValue> { - GLOBAL_EXNDATA.with(|data| { - let ret = if data.get()[0] == 1 { - Err(super::JsValue::_new(data.get()[1])) - } else { - Ok(()) - }; - data.set([0, 0]); - ret - }) + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + fn get() -> [u32; 2] { + GLOBAL_EXNDATA.get() + } + + #[cfg(feature = "std")] + fn set(data: [u32; 2]) { + GLOBAL_EXNDATA.with(|d| d.set(data)) + } + + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + fn set(data: [u32; 2]) { + unsafe { GLOBAL_EXNDATA = data }; } + + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + fn set(data: [u32; 2]) { + GLOBAL_EXNDATA.set(data); + } + } + + #[no_mangle] + pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { + debug_assert_eq!(GlobalExndata::get()[0], 0); + GlobalExndata::set([1, idx]); + } + + pub fn take_last_exception() -> Result<(), super::JsValue> { + let ret = if GlobalExndata::get()[0] == 1 { + Err(super::JsValue::_new(GlobalExndata::get()[1])) + } else { + Ok(()) + }; + GlobalExndata::set([0, 0]); + ret } /// An internal helper trait for usage in `#[wasm_bindgen]` on `async` diff --git a/taplo.toml b/taplo.toml index 56bc58a4c7d..e596d98b3c1 100644 --- a/taplo.toml +++ b/taplo.toml @@ -4,6 +4,6 @@ column_width = 100 reorder_keys = true [[rule]] -formatting = { array_auto_expand = false } +formatting = { array_auto_expand = false, reorder_keys = false } include = ["crates/web-sys/Cargo.toml"] keys = ["features"] diff --git a/tests/headless/strings.rs b/tests/headless/strings.rs index baa551b8950..5bf1afcefb4 100644 --- a/tests/headless/strings.rs +++ b/tests/headless/strings.rs @@ -23,6 +23,6 @@ fn string_roundtrip() { // See . #[rustfmt::skip] extern "C" { - #[wasm_bindgen(thread_local, static_string)] + #[wasm_bindgen(thread_local_v2, static_string)] static STRING: JsString = "foo"; } diff --git a/tests/non_wasm.rs b/tests/non_wasm.rs index ca8acad3b58..d67f26d36b8 100644 --- a/tests/non_wasm.rs +++ b/tests/non_wasm.rs @@ -31,7 +31,7 @@ pub fn foo(x: bool) { #[wasm_bindgen] extern "C" { fn some_import(); - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static A: JsValue; } diff --git a/tests/wasm/duplicates.rs b/tests/wasm/duplicates.rs index 348f67b8cd0..e0fa3339730 100644 --- a/tests/wasm/duplicates.rs +++ b/tests/wasm/duplicates.rs @@ -6,7 +6,7 @@ pub mod same_function_different_locations_a { #[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] extern "C" { pub fn foo(); - #[wasm_bindgen(thread_local, js_name = bar)] + #[wasm_bindgen(thread_local_v2, js_name = bar)] pub static BAR: JsValue; } } @@ -17,7 +17,7 @@ pub mod same_function_different_locations_b { #[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] extern "C" { pub fn foo(); - #[wasm_bindgen(thread_local, js_name = bar)] + #[wasm_bindgen(thread_local_v2, js_name = bar)] pub static BAR: JsValue; } } @@ -36,7 +36,7 @@ pub mod same_function_different_modules_a { #[wasm_bindgen(module = "tests/wasm/duplicates_b.js")] extern "C" { pub fn foo() -> bool; - #[wasm_bindgen(thread_local, js_name = bar)] + #[wasm_bindgen(thread_local_v2, js_name = bar)] pub static BAR: JsValue; } } @@ -47,7 +47,7 @@ pub mod same_function_different_modules_b { #[wasm_bindgen(module = "tests/wasm/duplicates_c.js")] extern "C" { pub fn foo() -> bool; - #[wasm_bindgen(thread_local, js_name = bar)] + #[wasm_bindgen(thread_local_v2, js_name = bar)] pub static BAR: JsValue; } } diff --git a/tests/wasm/imports.rs b/tests/wasm/imports.rs index aa5a8b4f038..a6eab0c5e32 100644 --- a/tests/wasm/imports.rs +++ b/tests/wasm/imports.rs @@ -23,7 +23,7 @@ extern "C" { fn assert_valid_error(val: JsValue); - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static IMPORT: JsValue; #[wasm_bindgen(js_name = return_three)] @@ -36,7 +36,7 @@ extern "C" { #[allow(non_camel_case_types)] type bar; - #[wasm_bindgen(thread_local, js_namespace = bar, js_name = foo)] + #[wasm_bindgen(thread_local_v2, js_namespace = bar, js_name = foo)] static FOO: JsValue; fn take_custom_type(f: CustomType) -> CustomType; @@ -47,7 +47,7 @@ extern "C" { #[wasm_bindgen(js_name = "baz$")] fn renamed_with_dollar_sign(); - #[wasm_bindgen(thread_local, js_name = "$foo")] + #[wasm_bindgen(thread_local_v2, js_name = "$foo")] static RENAMED: JsValue; fn unused_import(); @@ -58,7 +58,7 @@ extern "C" { #[wasm_bindgen(static_method_of = StaticMethodCheck)] fn static_method_of_right_this(); - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static STATIC_STRING: String; #[derive(Clone)] diff --git a/tests/wasm/node.rs b/tests/wasm/node.rs index 59f43eb71d9..9ab8ffee32b 100644 --- a/tests/wasm/node.rs +++ b/tests/wasm/node.rs @@ -4,7 +4,7 @@ use wasm_bindgen_test::*; #[wasm_bindgen(module = "tests/wasm/node.js")] extern "C" { fn test_works(); - #[wasm_bindgen(thread_local)] + #[wasm_bindgen(thread_local_v2)] static FOO: JsValue; fn hit(); } From 83c9deb94a4bfa0b79549fff45cd7572e66bcae4 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 10:30:21 +0100 Subject: [PATCH 563/641] Don't emit unexpected cfgs in proc-macros (#4284) This changes when the `#[coverage]` attribute is emitted by adding an internal `coverage` crate feature to the proc-macro and their utility crates. This crate feature is enabled by `wasm-bindgen` and `wasm-bindgen-test` when `cfg(wasm_bindgen_unstable_test_coverage)` is enabled. --- .github/workflows/main.yml | 6 ++--- Cargo.toml | 5 ++++ crates/backend/Cargo.toml | 1 + crates/backend/src/codegen.rs | 30 ++++++++++++++++++------ crates/macro-support/Cargo.toml | 1 + crates/macro/Cargo.toml | 4 +--- crates/macro/src/lib.rs | 20 ++++------------ crates/test-macro/Cargo.toml | 6 ++--- crates/test-macro/src/lib.rs | 14 ++++++----- crates/test/Cargo.toml | 1 + guide/src/wasm-bindgen-test/coverage.md | 31 +++++++++---------------- 11 files changed, 61 insertions(+), 58 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d18aac7b127..de957ca79e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,12 +67,12 @@ jobs: - run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings - - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings - - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings + - run: cargo clippy --no-deps --features spans,strict-macro -p wasm-bindgen-macro -- -D warnings + - run: cargo clippy --no-deps --features extra-traits,spans,strict-macro -p wasm-bindgen-macro-support -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings - - run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings + - run: cargo clippy --no-deps -p wasm-bindgen-test-macro -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 153a7306e31..f7992176e8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,11 @@ wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-featu "atomics", ] } +[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies] +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false, features = [ + "coverage", +] } + [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 4ff518442d9..a19b7812efd 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -15,6 +15,7 @@ version = "0.2.95" [features] atomics = [] +coverage = [] default = ["std"] extra-traits = ["syn/extra-traits"] spans = [] diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 13349eec53b..2a4f8697b40 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -224,6 +224,7 @@ impl ToTokens for ast::Struct { let free_fn = Ident::new(&shared::free_function(&name_str), Span::call_site()); let unwrap_fn = Ident::new(&shared::unwrap_function(&name_str), Span::call_site()); let wasm_bindgen = &self.wasm_bindgen; + let maybe_no_coverage = coverage(); (quote! { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { @@ -300,7 +301,7 @@ impl ToTokens for ast::Struct { #[doc(hidden)] // `allow_delayed` is whether it's ok to not actually free the `ptr` immediately // if it's still borrowed. - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage pub unsafe extern "C" fn #free_fn(ptr: u32, allow_delayed: u32) { use #wasm_bindgen::__rt::alloc::rc::Rc; @@ -476,6 +477,7 @@ impl ToTokens for ast::StructField { quote! { assert_copy::<#ty>() } }; let maybe_assert_copy = respan(maybe_assert_copy, ty); + let maybe_no_coverage = coverage(); // Split this out so that it isn't affected by `quote_spanned!`. // @@ -496,7 +498,7 @@ impl ToTokens for ast::StructField { const _: () = { #[cfg_attr(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), no_mangle)] #[doc(hidden)] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage pub unsafe extern "C" fn #getter(js: u32) -> #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi> { @@ -538,7 +540,7 @@ impl ToTokens for ast::StructField { const _: () = { #[no_mangle] #[doc(hidden)] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage pub unsafe extern "C" fn #setter( js: u32, #(#args,)* @@ -787,6 +789,8 @@ impl TryToTokens for ast::Export { quote! {} }; + let maybe_no_coverage = coverage(); + (quote! { #[automatically_derived] const _: () = { @@ -795,7 +799,7 @@ impl TryToTokens for ast::Export { all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), export_name = #export_name, )] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { #start_check @@ -1156,6 +1160,8 @@ impl ToTokens for ast::StringEnum { let hole = variant_count + 1; let attrs = &self.rust_attrs; + let maybe_no_coverage = coverage(); + let invalid_to_str_msg = format!( "Converting an invalid string enum ({}) back to a string is currently not supported", enum_name @@ -1242,7 +1248,7 @@ impl ToTokens for ast::StringEnum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage fn describe() { use #wasm_bindgen::describe::*; inform(STRING_ENUM); @@ -1541,6 +1547,7 @@ impl ToTokens for ast::Enum { } else { quote! { u32 } }; + let maybe_no_coverage = coverage(); let cast_clauses = self.variants.iter().map(|variant| { let variant_name = &variant.name; quote! { @@ -1588,7 +1595,7 @@ impl ToTokens for ast::Enum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage fn describe() { use #wasm_bindgen::describe::*; inform(ENUM); @@ -1853,6 +1860,8 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { return; } + let maybe_no_coverage = coverage(); + let name = Ident::new(&format!("__wbindgen_describe_{}", ident), ident.span()); let inner = &self.inner; let attrs = &self.attrs; @@ -1864,7 +1873,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { #(#attrs)* #[no_mangle] #[doc(hidden)] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #maybe_no_coverage pub extern "C" fn #name() { use #wasm_bindgen::describe::*; // See definition of `link_mem_intrinsics` for what this is doing @@ -1955,3 +1964,10 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { } new_tokens.into_iter().collect() } + +fn coverage() -> Option { + #[cfg(feature = "coverage")] + return Some(quote! { #[coverage(off)] }); + #[cfg(not(feature = "coverage"))] + None +} diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index ba169d4cb92..61ce9c2b9fc 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -15,6 +15,7 @@ version = "0.2.95" [features] atomics = ["wasm-bindgen-backend/atomics"] +coverage = ["wasm-bindgen-backend/coverage"] default = ["std"] extra-traits = ["syn/extra-traits"] spans = ["wasm-bindgen-backend/spans"] diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 23b4554a83c..d2b699ff2aa 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -18,6 +18,7 @@ proc-macro = true [features] atomics = ["wasm-bindgen-macro-support/atomics"] +coverage = ["wasm-bindgen-macro-support/coverage"] default = ["std"] spans = ["wasm-bindgen-macro-support/spans"] std = ["wasm-bindgen-macro-support/std"] @@ -34,6 +35,3 @@ trybuild = "1.0" wasm-bindgen = { path = "../.." } wasm-bindgen-futures = { path = "../futures" } web-sys = { path = "../web-sys", features = ["Worker"] } - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index ce2229845d7..6dc0cbf1792 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -1,9 +1,6 @@ #![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")] #![cfg_attr( - any( - wasm_bindgen_unstable_test_coverage, - all(not(feature = "std"), feature = "atomics") - ), + any(feature = "coverage", all(not(feature = "std"), feature = "atomics")), feature(allow_internal_unstable), allow(internal_features) )] @@ -14,10 +11,7 @@ use proc_macro::TokenStream; use quote::quote; #[proc_macro_attribute] -#[cfg_attr( - wasm_bindgen_unstable_test_coverage, - allow_internal_unstable(coverage_attribute) -)] +#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] #[cfg_attr( all(not(feature = "std"), feature = "atomics"), allow_internal_unstable(thread_local) @@ -48,10 +42,7 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { /// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js")); /// ``` #[proc_macro] -#[cfg_attr( - wasm_bindgen_unstable_test_coverage, - allow_internal_unstable(coverage_attribute) -)] +#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] pub fn link_to(input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_link_to(input.into()) { Ok(tokens) => { @@ -68,10 +59,7 @@ pub fn link_to(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] -#[cfg_attr( - wasm_bindgen_unstable_test_coverage, - allow_internal_unstable(coverage_attribute) -)] +#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { Ok(tokens) => { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index e79d2a77e04..d43aafe11d8 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -12,6 +12,9 @@ version = "0.3.45" [lib] proc-macro = true +[features] +coverage = [] + [dependencies] proc-macro2 = "1.0" quote = "1.0" @@ -26,6 +29,3 @@ syn = { version = "2.0", default-features = false, features = [ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } trybuild = "1.0" wasm-bindgen-test = { path = "../test" } - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index c18b8ecad8b..3b0f722bc7e 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -2,7 +2,7 @@ //! going on here. #![cfg_attr( - wasm_bindgen_unstable_test_coverage, + feature = "coverage", feature(allow_internal_unstable), allow(internal_features) )] @@ -18,10 +18,7 @@ use std::sync::atomic::*; static CNT: AtomicUsize = AtomicUsize::new(0); #[proc_macro_attribute] -#[cfg_attr( - wasm_bindgen_unstable_test_coverage, - allow_internal_unstable(coverage_attribute) -)] +#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] pub fn wasm_bindgen_test( attr: proc_macro::TokenStream, body: proc_macro::TokenStream, @@ -109,12 +106,17 @@ pub fn wasm_bindgen_test( // main test harness. This is the entry point for all tests. let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); let wasm_bindgen_path = attributes.wasm_bindgen_path; + let coverage = if cfg!(feature = "coverage") { + Some(quote! { #[coverage(off)] }) + } else { + None + }; tokens.extend( quote! { const _: () = { #[no_mangle] #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + #coverage pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 70c9e2131c8..a25128ffcfb 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -24,6 +24,7 @@ wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45', features = ["coverage"] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/guide/src/wasm-bindgen-test/coverage.md b/guide/src/wasm-bindgen-test/coverage.md index fb5a9c92d84..4bd3e6722ce 100644 --- a/guide/src/wasm-bindgen-test/coverage.md +++ b/guide/src/wasm-bindgen-test/coverage.md @@ -9,12 +9,7 @@ You can ask the runner to generate coverage data from functions marked as `#[was ## Enabling the feature -To enable this feature, you need to set `cfg(wasm_bindgen_unstable_test_coverage)` for `wasm-bindgen-test` and its dependencies. - -Currently it is particularly difficult to [deliver compile-line arguments to proc-macros when cross-compiling with Cargo][1]. To circumvent this [host-config] can be used. - -[1]: https://github.com/rust-lang/cargo/issues/4423 -[host-config]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#host-config +To enable this feature, you need to enable `cfg(wasm_bindgen_unstable_test_coverage)`. ## Generating the data @@ -26,18 +21,18 @@ Due to the current limitation of `llvm-cov`, we can't collect profiling symbols ### Arguments to the test runner -The following environment variables can be used to control the coverage output when [executing the test runner][2]: +The following environment variables can be used to control the coverage output when [executing the test runner][1]: -- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT` to control the file name of the profraw or the directory in which it is placed +- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT` to control the file name of the profraw or the directory in which it is placed. It might be necessary to provide the full path if e.g. running tests in a workspace. - `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_PREFIX` to add a custom prefix to the profraw files. This can be useful if you're running the tests automatically in succession. -[2]: usage.html#appendix-using-wasm-bindgen-test-without-wasm-pack +[1]: usage.html#appendix-using-wasm-bindgen-test-without-wasm-pack ### Target features -This feature relies on the [minicov] crate, which provides a profiling runtime for WebAssembly. It in turn uses [cc] to compile the runtime to Wasm, which [currently doesn't support accounting for target feature][3]. Use e.g. `CFLAGS_wasm32_unknown_unknown="-matomics -mbulk-memory"` to account for that. +This feature relies on the [minicov] crate, which provides a profiling runtime for WebAssembly. It in turn uses [cc] to compile the runtime to Wasm, which [currently doesn't support accounting for target feature][2]. Use e.g. `CFLAGS_wasm32_unknown_unknown="-matomics -mbulk-memory"` to account for that. -[3]: https://github.com/rust-lang/cc-rs/issues/268 +[2]: https://github.com/rust-lang/cc-rs/issues/268 [cc]: https://crates.io/crates/cc [minicov]: https://crates.io/crates/minicov @@ -47,13 +42,10 @@ This adapts code taken from the [Rustc book], see that for more examples and gen ```sh # Run the tests: -# - `CARGO_HOST_RUSTFLAGS` to pass the configuration to `wasm-bindgen-macro`. -# - `-Ztarget-applies-to-host -Zhost-config` to enable `CARGO_HOST_RUSTFLAGS`. -# - `--tests` to not run documentation tests, which is currently not supported. -CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ +# `--tests` to not run documentation tests, which is currently not supported. RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner \ -cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests +cargo +nightly test --tests # Compile to object files: # - Extract a list of compiled artifacts from Cargo and filter them with `jq`. # - Figure out the path to the LLVM IR file corresponding to an artifact. @@ -62,9 +54,8 @@ crate_name=name_of_the_tested_crate_in_snake_case objects=() IFS=$'\n' for file in $( - CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \ RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \ - cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \ + cargo +nightly test --tests --no-run --message-format=json | \ jq -r "select(.reason == \"compiler-artifact\") | (select(.target.kind == [\"test\"]) // select(.target.name == \"$crate_name\")) | .filenames[0]" ) do @@ -89,7 +80,7 @@ llvm-cov-19 show -show-instantiations=false -Xdemangler=rustfilt -output-dir cov ## Attribution -These methods have originally been pioneered by [Hacken OÜ], see [their guide][4] as well. +These methods have originally been pioneered by [Hacken OÜ], see [their guide][3] as well. -[4]: https://hknio.github.io/wasmcov +[3]: https://hknio.github.io/wasmcov [Hacken OÜ]: https://hacken.io From c7cab6b8f61cc17346ce8946f41e8000e60eb711 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 13:03:25 +0100 Subject: [PATCH 564/641] Revert bundler target specific default transformations (#4253) --- .github/workflows/main.yml | 4 -- CHANGELOG.md | 3 - Cargo.toml | 1 - crates/cli-support/src/lib.rs | 5 +- crates/cli/tests/reference/add.js | 11 ++++ crates/cli/tests/reference/add.wat | 11 +++- crates/cli/tests/reference/builder.js | 11 ++++ crates/cli/tests/reference/builder.wat | 13 ++-- crates/cli/tests/reference/constructor.js | 11 ++++ crates/cli/tests/reference/constructor.wat | 13 ++-- crates/cli/tests/reference/empty.js | 12 ++++ crates/cli/tests/reference/empty.wat | 5 ++ crates/cli/tests/reference/enums.js | 11 ++++ crates/cli/tests/reference/enums.wat | 17 +++-- crates/cli/tests/reference/getter-setter.js | 11 ++++ crates/cli/tests/reference/getter-setter.wat | 53 ++++++++------- .../tests/reference/import-getter-setter.js | 66 ++++++++++--------- .../tests/reference/import-getter-setter.wat | 6 +- crates/cli/tests/reference/import.js | 51 +++++++------- crates/cli/tests/reference/import.wat | 18 +++-- crates/cli/tests/reference/int128.js | 59 +++++++++++------ crates/cli/tests/reference/int128.wat | 24 ++++--- crates/cli/tests/reference/modules.js | 48 +++++--------- crates/cli/tests/reference/modules.wat | 6 +- crates/cli/tests/reference/nop.js | 11 ++++ crates/cli/tests/reference/nop.wat | 6 +- crates/cli/tests/reference/pointers.js | 11 ++++ crates/cli/tests/reference/pointers.wat | 11 +++- crates/cli/tests/reference/raw.js | 47 +++---------- crates/cli/tests/reference/raw.wat | 17 +++-- crates/cli/tests/reference/result.js | 56 +++++++--------- crates/cli/tests/reference/result.wat | 24 ++++--- crates/cli/tests/reference/self-type.js | 11 ++++ crates/cli/tests/reference/self-type.wat | 27 ++++---- crates/cli/tests/reference/skip-jsdoc.js | 11 ++++ crates/cli/tests/reference/skip-jsdoc.wat | 11 +++- crates/cli/tests/reference/string-arg.js | 11 ++++ crates/cli/tests/reference/string-arg.wat | 17 +++-- crates/cli/tests/reference/targets-0.js | 11 ++++ crates/cli/tests/reference/targets-0.wat | 9 ++- crates/cli/tests/reference/web-sys.js | 49 +++++--------- crates/cli/tests/reference/web-sys.wat | 28 +++++--- crates/example-tests/tests/shell.rs | 2 - examples/add/package.json | 2 +- examples/canvas/package.json | 2 +- examples/char/package.json | 2 +- examples/closures/package.json | 2 +- examples/console_log/package.json | 2 +- examples/dom/package.json | 2 +- examples/duck-typed-interfaces/package.json | 2 +- examples/fetch/package.json | 2 +- .../package.json | 2 +- examples/hello_world/package.json | 2 +- examples/import_js/package.json | 2 +- examples/julia_set/package.json | 2 +- examples/paint/package.json | 2 +- examples/performance/package.json | 2 +- examples/request-animation-frame/package.json | 2 +- examples/todomvc/package.json | 2 +- examples/wasm-in-wasm-imports/package.json | 2 +- examples/wasm-in-wasm/package.json | 2 +- examples/wasm2js/Cargo.toml | 12 ---- examples/wasm2js/README.md | 17 ----- examples/wasm2js/build.sh | 13 ---- examples/wasm2js/index.html | 9 --- examples/wasm2js/index.js | 4 -- examples/wasm2js/src/lib.rs | 13 ---- examples/weather_report/package.json | 2 +- examples/webaudio/package.json | 2 +- examples/webgl/package.json | 2 +- examples/webrtc_datachannel/package.json | 2 +- examples/webxr/package.json | 2 +- guide/src/SUMMARY.md | 1 - guide/src/examples/wasm2js.md | 38 ----------- guide/src/reference/browser-support.md | 7 +- 75 files changed, 535 insertions(+), 465 deletions(-) delete mode 100644 examples/wasm2js/Cargo.toml delete mode 100644 examples/wasm2js/README.md delete mode 100755 examples/wasm2js/build.sh delete mode 100644 examples/wasm2js/index.html delete mode 100644 examples/wasm2js/index.js delete mode 100644 examples/wasm2js/src/lib.rs delete mode 100644 guide/src/examples/wasm2js.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de957ca79e4..1bd6c23676f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -344,10 +344,6 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - - run: | - curl -L https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-linux.tar.gz -sSf > binaryen-version_112-x86_64-linux.tar.gz - tar -xz -f binaryen-version_112-x86_64-linux.tar.gz binaryen-version_112/bin/wasm2js - echo "$PWD/binaryen-version_112/bin" >> $GITHUB_PATH - run: | cargo build -p wasm-bindgen-cli ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen diff --git a/CHANGELOG.md b/CHANGELOG.md index 88340abe3df..66e2dbfd2d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,9 +46,6 @@ * Optimized ABI performance for `Option<{i32,u32,isize,usize,f32,*const T,*mut T}>`. [#4183](https://github.com/rustwasm/wasm-bindgen/pull/4183) -* Reference type proposal transformations are not applied by default when detecting it in the Wasm module for the bundler target because currently `webpack` doesn't support it. - [#4235](https://github.com/rustwasm/wasm-bindgen/pull/4235) - * Deprecate `--reference-types` in favor of automatic target feature detection. [#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237) diff --git a/Cargo.toml b/Cargo.toml index f7992176e8d..e9dba81a41c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,7 +106,6 @@ members = [ "examples/wasm-in-wasm", "examples/wasm-in-wasm-imports", "examples/wasm-in-web-worker", - "examples/wasm2js", "examples/weather_report", "examples/webaudio", "examples/webgl", diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 963cc5fbf6c..6253e89b29a 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -325,10 +325,7 @@ impl Bindgen { }; // Enable reference type transformations if the module is already using it. - // Currently `webpack` does not support reference types. - if !matches!(self.mode, OutputMode::Bundler { .. }) - && wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types").ok() - == Some(true) + if let Ok(true) = wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types") { self.externref = true; } diff --git a/crates/cli/tests/reference/add.js b/crates/cli/tests/reference/add.js index 51914d7d296..f11b75ef83a 100644 --- a/crates/cli/tests/reference/add.js +++ b/crates/cli/tests/reference/add.js @@ -23,3 +23,14 @@ export function add_i32(a, b) { return ret; } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/add.wat b/crates/cli/tests/reference/add.wat index ea9d635ecc4..bc5cbff68cd 100644 --- a/crates/cli/tests/reference/add.wat +++ b/crates/cli/tests/reference/add.wat @@ -1,11 +1,16 @@ (module $reference_test.wasm - (type (;0;) (func (param i32 i32) (result i32))) - (func $add_u32 (;0;) (type 0) (param i32 i32) (result i32)) - (func $add_i32 (;1;) (type 0) (param i32 i32) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_u32 (;1;) (type 1) (param i32 i32) (result i32)) + (func $add_i32 (;2;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "add_u32" (func $add_u32)) (export "add_i32" (func $add_i32)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/builder.js b/crates/cli/tests/reference/builder.js index 1781b4dbe06..b63d64f2f5b 100644 --- a/crates/cli/tests/reference/builder.js +++ b/crates/cli/tests/reference/builder.js @@ -58,6 +58,17 @@ export class ClassBuilder { } } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/builder.wat b/crates/cli/tests/reference/builder.wat index 04ee04ef6b5..fac41751113 100644 --- a/crates/cli/tests/reference/builder.wat +++ b/crates/cli/tests/reference/builder.wat @@ -1,12 +1,17 @@ (module $reference_test.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32 i32))) - (func $__wbg_classbuilder_free (;0;) (type 1) (param i32 i32)) - (func $classbuilder_builder (;1;) (type 0) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbg_classbuilder_free (;1;) (type 2) (param i32 i32)) + (func $classbuilder_builder (;2;) (type 1) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free)) (export "classbuilder_builder" (func $classbuilder_builder)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/constructor.js b/crates/cli/tests/reference/constructor.js index e55a1e9e9bf..c0a781c3c94 100644 --- a/crates/cli/tests/reference/constructor.js +++ b/crates/cli/tests/reference/constructor.js @@ -49,6 +49,17 @@ export class ClassConstructor { } } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/constructor.wat b/crates/cli/tests/reference/constructor.wat index 27bb6d6781c..1e99415e7d6 100644 --- a/crates/cli/tests/reference/constructor.wat +++ b/crates/cli/tests/reference/constructor.wat @@ -1,12 +1,17 @@ (module $reference_test.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32 i32))) - (func $__wbg_classconstructor_free (;0;) (type 1) (param i32 i32)) - (func $classconstructor_new (;1;) (type 0) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbg_classconstructor_free (;1;) (type 2) (param i32 i32)) + (func $classconstructor_new (;2;) (type 1) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free)) (export "classconstructor_new" (func $classconstructor_new)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/empty.js b/crates/cli/tests/reference/empty.js index 95b0793b585..a25c33a1af9 100644 --- a/crates/cli/tests/reference/empty.js +++ b/crates/cli/tests/reference/empty.js @@ -3,3 +3,15 @@ export function __wbg_set_wasm(val) { wasm = val; } + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/empty.wat b/crates/cli/tests/reference/empty.wat index 3cd6ac87a09..1044fd51d5e 100644 --- a/crates/cli/tests/reference/empty.wat +++ b/crates/cli/tests/reference/empty.wat @@ -1,6 +1,11 @@ (module $reference_test.wasm + (type (;0;) (func)) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (table (;0;) 128 externref) (memory (;0;) 16) (export "memory" (memory 0)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after export) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 76feae96525..13459b9c77e 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -110,6 +110,17 @@ export const Ordering = Object.freeze({ const __wbindgen_enum_ColorName = ["green", "yellow", "red"]; +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/enums.wat b/crates/cli/tests/reference/enums.wat index dced57440b0..3688c671785 100644 --- a/crates/cli/tests/reference/enums.wat +++ b/crates/cli/tests/reference/enums.wat @@ -1,10 +1,13 @@ (module $reference_test.wasm - (type (;0;) (func (param i32) (result i32))) - (func $enum_echo (;0;) (type 0) (param i32) (result i32)) - (func $option_enum_echo (;1;) (type 0) (param i32) (result i32)) - (func $get_name (;2;) (type 0) (param i32) (result i32)) - (func $option_string_enum_echo (;3;) (type 0) (param i32) (result i32)) - (func $option_order (;4;) (type 0) (param i32) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $enum_echo (;1;) (type 1) (param i32) (result i32)) + (func $option_enum_echo (;2;) (type 1) (param i32) (result i32)) + (func $get_name (;3;) (type 1) (param i32) (result i32)) + (func $option_string_enum_echo (;4;) (type 1) (param i32) (result i32)) + (func $option_order (;5;) (type 1) (param i32) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "enum_echo" (func $enum_echo)) @@ -12,6 +15,8 @@ (export "get_name" (func $get_name)) (export "option_string_enum_echo" (func $option_string_enum_echo)) (export "option_order" (func $option_order)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/getter-setter.js b/crates/cli/tests/reference/getter-setter.js index 6c05b3065a9..fc0ce4820dd 100644 --- a/crates/cli/tests/reference/getter-setter.js +++ b/crates/cli/tests/reference/getter-setter.js @@ -191,6 +191,17 @@ export class Foo { } } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/getter-setter.wat b/crates/cli/tests/reference/getter-setter.wat index 3daf51bf7a5..7834c0fccf8 100644 --- a/crates/cli/tests/reference/getter-setter.wat +++ b/crates/cli/tests/reference/getter-setter.wat @@ -1,28 +1,31 @@ (module $reference_test.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32) (result i32))) - (type (;3;) (func (param i32) (result f64))) - (type (;4;) (func (param i32 i32))) - (type (;5;) (func (param i32 i32) (result i32))) - (type (;6;) (func (param i32 i32 i32))) - (type (;7;) (func (param i32 i32 i32 i32) (result i32))) - (type (;8;) (func (param i32 f64))) - (func $__wbindgen_realloc (;0;) (type 7) (param i32 i32 i32 i32) (result i32)) - (func $__wbindgen_malloc (;1;) (type 5) (param i32 i32) (result i32)) - (func $foo_set_weird (;2;) (type 6) (param i32 i32 i32)) - (func $__wbg_set_foo_y (;3;) (type 8) (param i32 f64)) - (func $__wbg_get_foo_y (;4;) (type 3) (param i32) (result f64)) - (func $__wbg_get_foo_x (;5;) (type 2) (param i32) (result i32)) - (func $foo_set_z (;6;) (type 8) (param i32 f64)) - (func $foo_set_lone_setter (;7;) (type 8) (param i32 f64)) - (func $foo_z (;8;) (type 3) (param i32) (result f64)) - (func $foo_lone_getter (;9;) (type 3) (param i32) (result f64)) - (func $__wbg_set_foo_x (;10;) (type 4) (param i32 i32)) - (func $foo_weird (;11;) (type 2) (param i32) (result i32)) - (func $foo_x_static (;12;) (type 0) (result i32)) - (func $__wbg_foo_free (;13;) (type 4) (param i32 i32)) - (func $foo_set_x_static (;14;) (type 1) (param i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32) (result i32))) + (type (;4;) (func (param i32) (result f64))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param i32 i32) (result i32))) + (type (;7;) (func (param i32 i32 i32))) + (type (;8;) (func (param i32 i32 i32 i32) (result i32))) + (type (;9;) (func (param i32 f64))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 8) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 6) (param i32 i32) (result i32)) + (func $foo_set_weird (;3;) (type 7) (param i32 i32 i32)) + (func $__wbg_set_foo_y (;4;) (type 9) (param i32 f64)) + (func $__wbg_get_foo_y (;5;) (type 4) (param i32) (result f64)) + (func $__wbg_get_foo_x (;6;) (type 3) (param i32) (result i32)) + (func $foo_set_z (;7;) (type 9) (param i32 f64)) + (func $foo_set_lone_setter (;8;) (type 9) (param i32 f64)) + (func $foo_z (;9;) (type 4) (param i32) (result f64)) + (func $foo_lone_getter (;10;) (type 4) (param i32) (result f64)) + (func $__wbg_set_foo_x (;11;) (type 5) (param i32 i32)) + (func $foo_weird (;12;) (type 3) (param i32) (result i32)) + (func $foo_x_static (;13;) (type 1) (result i32)) + (func $__wbg_foo_free (;14;) (type 5) (param i32 i32)) + (func $foo_set_x_static (;15;) (type 2) (param i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_foo_free" (func $__wbg_foo_free)) @@ -38,8 +41,10 @@ (export "foo_set_weird" (func $foo_set_weird)) (export "foo_x_static" (func $foo_x_static)) (export "foo_set_x_static" (func $foo_set_x_static)) + (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/import-getter-setter.js b/crates/cli/tests/reference/import-getter-setter.js index a261e7f8d01..adaca3bab4d 100644 --- a/crates/cli/tests/reference/import-getter-setter.js +++ b/crates/cli/tests/reference/import-getter-setter.js @@ -4,33 +4,24 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; -heap.push(undefined, null, true, false); +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); -function getObject(idx) { return heap[idx]; } +cachedTextDecoder.decode(); -let heap_next = heap.length; +let cachedUint8ArrayMemory0 = null; -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; } -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } export function exported() { @@ -38,12 +29,12 @@ export function exported() { } export function __wbg_another_79dcbfe47962d7a7(arg0) { - const ret = getObject(arg0).prop2; + const ret = arg0.prop2; return ret; }; export function __wbg_b_266c81b129cbc216(arg0) { - const ret = getObject(arg0).a; + const ret = arg0.a; return ret; }; @@ -59,15 +50,15 @@ export function __wbg_getfoo_690459206923b526() { export function __wbg_new_98ff9abc2a3e2736() { const ret = new SomeClass(); - return addHeapObject(ret); + return ret; }; export function __wbg_setanother_51e596d4d035bc4d(arg0, arg1) { - getObject(arg0).prop2 = arg1 >>> 0; + arg0.prop2 = arg1 >>> 0; }; export function __wbg_setb_eda0c18669c4ad53(arg0, arg1) { - getObject(arg0).a = arg1 >>> 0; + arg0.a = arg1 >>> 0; }; export function __wbg_setbar2_d99cb80edd0e1959(arg0) { @@ -79,24 +70,35 @@ export function __wbg_setfoo_029452b4d4645d79(arg0) { }; export function __wbg_setsignal_bd536e517c35da41(arg0, arg1) { - getObject(arg0).signal = arg1 >>> 0; + arg0.signal = arg1 >>> 0; }; export function __wbg_setsomeprop_965004b0138eb32c(arg0, arg1) { - getObject(arg0).some_prop = arg1 >>> 0; + arg0.some_prop = arg1 >>> 0; }; export function __wbg_signal_89fe6c5b19fec3df(arg0) { - const ret = getObject(arg0).signal; + const ret = arg0.signal; return ret; }; export function __wbg_someprop_fd4fc05f44bf5de2(arg0) { - const ret = getObject(arg0).some_prop; + const ret = arg0.some_prop; return ret; }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/import-getter-setter.wat b/crates/cli/tests/reference/import-getter-setter.wat index e05a3a8c0ac..7bcb1cbffc6 100644 --- a/crates/cli/tests/reference/import-getter-setter.wat +++ b/crates/cli/tests/reference/import-getter-setter.wat @@ -1,9 +1,13 @@ (module $reference_test.wasm (type (;0;) (func)) - (func $exported (;0;) (type 0)) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $exported (;1;) (type 0)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/import.js b/crates/cli/tests/reference/import.js index c868faf90d5..321ae6901fd 100644 --- a/crates/cli/tests/reference/import.js +++ b/crates/cli/tests/reference/import.js @@ -4,18 +4,9 @@ export function __wbg_set_wasm(val) { } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); return idx; } @@ -23,7 +14,8 @@ function handleError(f, args) { try { return f.apply(this, args); } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); } } @@ -47,24 +39,16 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_2.get(idx); + wasm.__externref_table_dealloc(idx); + return value; } export function exported() { const ret = wasm.exported(); if (ret[1]) { - throw takeObject(ret[0]); + throw takeFromExternrefTable0(ret[0]); } } @@ -93,3 +77,18 @@ export function __wbg_write_c2ce0ce33a6087d5(arg0, arg1) { window.document.write(getStringFromWasm0(arg0, arg1)); }; +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/import.wat b/crates/cli/tests/reference/import.wat index 1645ae59dbc..d5c8b26e7c0 100644 --- a/crates/cli/tests/reference/import.wat +++ b/crates/cli/tests/reference/import.wat @@ -1,12 +1,22 @@ (module $reference_test.wasm - (type (;0;) (func (result i32 i32))) - (type (;1;) (func (param i32))) - (func $__wbindgen_exn_store (;0;) (type 1) (param i32)) - (func $"exported multivalue shim" (;1;) (type 0) (result i32 i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (result i32 i32))) + (type (;3;) (func (param i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_exn_store (;1;) (type 3) (param i32)) + (func $__externref_table_dealloc (;2;) (type 3) (param i32)) + (func $__externref_table_alloc (;3;) (type 1) (result i32)) + (func $"exported multivalue shim" (;4;) (type 2) (result i32 i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $"exported multivalue shim")) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__wbindgen_export_2" (table 0)) + (export "__externref_table_dealloc" (func $__externref_table_dealloc)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/int128.js b/crates/cli/tests/reference/int128.js index 04b865d7fb1..1df6bb28c26 100644 --- a/crates/cli/tests/reference/int128.js +++ b/crates/cli/tests/reference/int128.js @@ -3,6 +3,26 @@ export function __wbg_set_wasm(val) { wasm = val; } + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} /** * @param {bigint} a * @returns {bigint} @@ -42,24 +62,10 @@ export function echo_option_u128(a) { return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_0.get(idx); + wasm.__externref_table_dealloc(idx); + return value; } /** * @returns {bigint} @@ -67,8 +73,23 @@ function takeObject(idx) { export function throw_i128() { const ret = wasm.throw_i128(); if (ret[3]) { - throw takeObject(ret[2]); + throw takeFromExternrefTable0(ret[2]); } return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64))); } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/int128.wat b/crates/cli/tests/reference/int128.wat index 61c7eab3ea3..5aa13f6f694 100644 --- a/crates/cli/tests/reference/int128.wat +++ b/crates/cli/tests/reference/int128.wat @@ -1,12 +1,17 @@ (module $reference_test.wasm - (type (;0;) (func (result i64 i64 i32 i32))) - (type (;1;) (func (param i32 i64 i64) (result i32 i64 i64))) - (type (;2;) (func (param i64 i64) (result i64 i64))) - (func $"echo_option_i128 multivalue shim" (;0;) (type 1) (param i32 i64 i64) (result i32 i64 i64)) - (func $"echo_option_u128 multivalue shim" (;1;) (type 1) (param i32 i64 i64) (result i32 i64 i64)) - (func $"throw_i128 multivalue shim" (;2;) (type 0) (result i64 i64 i32 i32)) - (func $"echo_i128 multivalue shim" (;3;) (type 2) (param i64 i64) (result i64 i64)) - (func $"echo_u128 multivalue shim" (;4;) (type 2) (param i64 i64) (result i64 i64)) + (type (;0;) (func)) + (type (;1;) (func (result i64 i64 i32 i32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i64 i64) (result i32 i64 i64))) + (type (;4;) (func (param i64 i64) (result i64 i64))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__externref_table_dealloc (;1;) (type 2) (param i32)) + (func $"echo_option_i128 multivalue shim" (;2;) (type 3) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_option_u128 multivalue shim" (;3;) (type 3) (param i32 i64 i64) (result i32 i64 i64)) + (func $"throw_i128 multivalue shim" (;4;) (type 1) (result i64 i64 i32 i32)) + (func $"echo_i128 multivalue shim" (;5;) (type 4) (param i64 i64) (result i64 i64)) + (func $"echo_u128 multivalue shim" (;6;) (type 4) (param i64 i64) (result i64 i64)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "echo_i128" (func $"echo_i128 multivalue shim")) @@ -14,6 +19,9 @@ (export "echo_option_i128" (func $"echo_option_i128 multivalue shim")) (export "echo_option_u128" (func $"echo_option_u128 multivalue shim")) (export "throw_i128" (func $"throw_i128 multivalue shim")) + (export "__wbindgen_export_0" (table 0)) + (export "__externref_table_dealloc" (func $__externref_table_dealloc)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/modules.js b/crates/cli/tests/reference/modules.js index aa2adf82604..ed323e4f0a9 100644 --- a/crates/cli/tests/reference/modules.js +++ b/crates/cli/tests/reference/modules.js @@ -24,35 +24,6 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - export function exported() { wasm.exported(); } @@ -63,16 +34,27 @@ export function __wbg_parseFloat_2be7f01c31025438(arg0, arg1) { }; export function __wbg_parseFloat_7bc8aecd47f33642(arg0) { - const ret = parseFloat(getObject(arg0)); + const ret = parseFloat(arg0); return ret; }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; }; export function __wbindgen_string_new(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); + return ret; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/modules.wat b/crates/cli/tests/reference/modules.wat index e05a3a8c0ac..7bcb1cbffc6 100644 --- a/crates/cli/tests/reference/modules.wat +++ b/crates/cli/tests/reference/modules.wat @@ -1,9 +1,13 @@ (module $reference_test.wasm (type (;0;) (func)) - (func $exported (;0;) (type 0)) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $exported (;1;) (type 0)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "exported" (func $exported)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/nop.js b/crates/cli/tests/reference/nop.js index 7369fb615be..39f2a0fb3b1 100644 --- a/crates/cli/tests/reference/nop.js +++ b/crates/cli/tests/reference/nop.js @@ -8,3 +8,14 @@ export function nop() { wasm.nop(); } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/nop.wat b/crates/cli/tests/reference/nop.wat index 1b0d33a23f5..8c1452177ae 100644 --- a/crates/cli/tests/reference/nop.wat +++ b/crates/cli/tests/reference/nop.wat @@ -1,9 +1,13 @@ (module $reference_test.wasm (type (;0;) (func)) - (func $nop (;0;) (type 0)) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $nop (;1;) (type 0)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "nop" (func $nop)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/pointers.js b/crates/cli/tests/reference/pointers.js index 45fb0349a22..3b971fd408e 100644 --- a/crates/cli/tests/reference/pointers.js +++ b/crates/cli/tests/reference/pointers.js @@ -21,3 +21,14 @@ export function mut_pointer(input) { return ret >>> 0; } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/pointers.wat b/crates/cli/tests/reference/pointers.wat index 954d8a7ff1c..811cd77533f 100644 --- a/crates/cli/tests/reference/pointers.wat +++ b/crates/cli/tests/reference/pointers.wat @@ -1,11 +1,16 @@ (module $reference_test.wasm - (type (;0;) (func (param i32) (result i32))) - (func $const_pointer (;0;) (type 0) (param i32) (result i32)) - (func $mut_pointer (;1;) (type 0) (param i32) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $const_pointer (;1;) (type 1) (param i32) (result i32)) + (func $mut_pointer (;2;) (type 1) (param i32) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "const_pointer" (func $const_pointer)) (export "mut_pointer" (func $mut_pointer)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/raw.js b/crates/cli/tests/reference/raw.js index e9dcaf4cccb..4e9035bbf26 100644 --- a/crates/cli/tests/reference/raw.js +++ b/crates/cli/tests/reference/raw.js @@ -1,40 +1,9 @@ -import { test2 } from 'test'; - let wasm; export function __wbg_set_wasm(val) { wasm = val; } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); @@ -104,13 +73,15 @@ export class Test { } } -export function __wbg_test2_ae36e154b7589768() { - const ret = test2(); - return addHeapObject(ret); -}; - -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; }; export function __wbindgen_throw(arg0, arg1) { diff --git a/crates/cli/tests/reference/raw.wat b/crates/cli/tests/reference/raw.wat index 3d459092f0b..4c784dcfcbc 100644 --- a/crates/cli/tests/reference/raw.wat +++ b/crates/cli/tests/reference/raw.wat @@ -1,16 +1,21 @@ (module $reference_test.wasm - (type (;0;) (func (param i32) (result i32))) - (type (;1;) (func (param i32 i32))) - (func $test_test2 (;0;) (type 1) (param i32 i32)) - (func $test1 (;1;) (type 0) (param i32) (result i32)) - (func $test_test1 (;2;) (type 0) (param i32) (result i32)) - (func $__wbg_test_free (;3;) (type 1) (param i32 i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32) (result i32))) + (type (;2;) (func (param i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $test_test2 (;1;) (type 2) (param i32 i32)) + (func $test1 (;2;) (type 1) (param i32) (result i32)) + (func $test_test1 (;3;) (type 1) (param i32) (result i32)) + (func $__wbg_test_free (;4;) (type 2) (param i32 i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "test1" (func $test1)) (export "__wbg_test_free" (func $__wbg_test_free)) (export "test_test1" (func $test_test1)) (export "test_test2" (func $test_test2)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/result.js b/crates/cli/tests/reference/result.js index 62b1b902c59..ddc18ed8148 100644 --- a/crates/cli/tests/reference/result.js +++ b/crates/cli/tests/reference/result.js @@ -24,33 +24,10 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_0.get(idx); + wasm.__externref_table_dealloc(idx); + return value; } /** * @returns {string} @@ -64,7 +41,7 @@ export function result_string() { var len1 = ret[1]; if (ret[3]) { ptr1 = 0; len1 = 0; - throw takeObject(ret[2]); + throw takeFromExternrefTable0(ret[2]); } deferred2_0 = ptr1; deferred2_1 = len1; @@ -77,7 +54,7 @@ export function result_string() { export function result_void() { const ret = wasm.result_void(); if (ret[1]) { - throw takeObject(ret[0]); + throw takeFromExternrefTable0(ret[0]); } } @@ -87,18 +64,33 @@ export function result_void() { export function result_i32() { const ret = wasm.result_i32(); if (ret[2]) { - throw takeObject(ret[1]); + throw takeFromExternrefTable0(ret[1]); } return ret[0]; } export function __wbindgen_error_new(arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); + return ret; +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; }; export function __wbindgen_number_new(arg0) { const ret = arg0; - return addHeapObject(ret); + return ret; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/result.wat b/crates/cli/tests/reference/result.wat index 59dddf4af66..58a6e0deb13 100644 --- a/crates/cli/tests/reference/result.wat +++ b/crates/cli/tests/reference/result.wat @@ -1,18 +1,26 @@ (module $reference_test.wasm - (type (;0;) (func (result i32 i32))) - (type (;1;) (func (result i32 i32 i32))) - (type (;2;) (func (result i32 i32 i32 i32))) - (type (;3;) (func (param i32 i32 i32))) - (func $__wbindgen_free (;0;) (type 3) (param i32 i32 i32)) - (func $"result_string multivalue shim" (;1;) (type 2) (result i32 i32 i32 i32)) - (func $"result_i32 multivalue shim" (;2;) (type 1) (result i32 i32 i32)) - (func $"result_void multivalue shim" (;3;) (type 0) (result i32 i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32 i32))) + (type (;2;) (func (result i32 i32 i32))) + (type (;3;) (func (result i32 i32 i32 i32))) + (type (;4;) (func (param i32))) + (type (;5;) (func (param i32 i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__externref_table_dealloc (;1;) (type 4) (param i32)) + (func $__wbindgen_free (;2;) (type 5) (param i32 i32 i32)) + (func $"result_string multivalue shim" (;3;) (type 3) (result i32 i32 i32 i32)) + (func $"result_i32 multivalue shim" (;4;) (type 2) (result i32 i32 i32)) + (func $"result_void multivalue shim" (;5;) (type 1) (result i32 i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "result_string" (func $"result_string multivalue shim")) (export "result_void" (func $"result_void multivalue shim")) (export "result_i32" (func $"result_i32 multivalue shim")) + (export "__wbindgen_export_0" (table 0)) + (export "__externref_table_dealloc" (func $__externref_table_dealloc)) (export "__wbindgen_free" (func $__wbindgen_free)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/self-type.js b/crates/cli/tests/reference/self-type.js index ba2f992bc57..57075362366 100644 --- a/crates/cli/tests/reference/self-type.js +++ b/crates/cli/tests/reference/self-type.js @@ -69,6 +69,17 @@ export class Test { } } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/self-type.wat b/crates/cli/tests/reference/self-type.wat index 667e060b4c9..ec0e2fdec46 100644 --- a/crates/cli/tests/reference/self-type.wat +++ b/crates/cli/tests/reference/self-type.wat @@ -1,15 +1,18 @@ (module $reference_test.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (func $test_ref_self (;0;) (type 1) (param i32)) - (func $test_ref_mut_self (;1;) (type 1) (param i32)) - (func $test_self_ref_Self (;2;) (type 1) (param i32)) - (func $test_self_ref_mut_Self (;3;) (type 1) (param i32)) - (func $__wbg_test_free (;4;) (type 2) (param i32 i32)) - (func $test_new (;5;) (type 0) (result i32)) - (func $test_consume_self (;6;) (type 1) (param i32)) - (func $test_self_Self (;7;) (type 1) (param i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $test_ref_self (;1;) (type 2) (param i32)) + (func $test_ref_mut_self (;2;) (type 2) (param i32)) + (func $test_self_ref_Self (;3;) (type 2) (param i32)) + (func $test_self_ref_mut_Self (;4;) (type 2) (param i32)) + (func $__wbg_test_free (;5;) (type 3) (param i32 i32)) + (func $test_new (;6;) (type 1) (result i32)) + (func $test_consume_self (;7;) (type 2) (param i32)) + (func $test_self_Self (;8;) (type 2) (param i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "__wbg_test_free" (func $__wbg_test_free)) @@ -20,6 +23,8 @@ (export "test_self_Self" (func $test_self_Self)) (export "test_self_ref_Self" (func $test_self_ref_Self)) (export "test_self_ref_mut_Self" (func $test_self_ref_mut_Self)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/skip-jsdoc.js b/crates/cli/tests/reference/skip-jsdoc.js index f3c1bc442c2..1ba307bae00 100644 --- a/crates/cli/tests/reference/skip-jsdoc.js +++ b/crates/cli/tests/reference/skip-jsdoc.js @@ -24,3 +24,14 @@ export function i_has_docs(arg) { return ret >>> 0; } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/skip-jsdoc.wat b/crates/cli/tests/reference/skip-jsdoc.wat index 2b7cadc23ee..99c1443aca1 100644 --- a/crates/cli/tests/reference/skip-jsdoc.wat +++ b/crates/cli/tests/reference/skip-jsdoc.wat @@ -1,11 +1,16 @@ (module $reference_test.wasm - (type (;0;) (func (param i32) (result i32))) - (func $docme (;0;) (type 0) (param i32) (result i32)) - (func $i_has_docs (;1;) (type 0) (param i32) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $docme (;1;) (type 1) (param i32) (result i32)) + (func $i_has_docs (;2;) (type 1) (param i32) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "docme" (func $docme)) (export "i_has_docs" (func $i_has_docs)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/string-arg.js b/crates/cli/tests/reference/string-arg.js index cc037461669..9d52328a50f 100644 --- a/crates/cli/tests/reference/string-arg.js +++ b/crates/cli/tests/reference/string-arg.js @@ -90,6 +90,17 @@ export function foo(a) { wasm.foo(ptr0, len0); } +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + export function __wbindgen_throw(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/string-arg.wat b/crates/cli/tests/reference/string-arg.wat index fae75cfbcba..fa9738c1214 100644 --- a/crates/cli/tests/reference/string-arg.wat +++ b/crates/cli/tests/reference/string-arg.wat @@ -1,15 +1,20 @@ (module $reference_test.wasm - (type (;0;) (func (param i32 i32))) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32 i32) (result i32))) - (func $__wbindgen_realloc (;0;) (type 2) (param i32 i32 i32 i32) (result i32)) - (func $__wbindgen_malloc (;1;) (type 1) (param i32 i32) (result i32)) - (func $foo (;2;) (type 0) (param i32 i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32))) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32 i32 i32 i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 3) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 2) (param i32 i32) (result i32)) + (func $foo (;3;) (type 1) (param i32 i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "foo" (func $foo)) + (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/targets-0.js b/crates/cli/tests/reference/targets-0.js index 0d920b61eb9..a153ca7932d 100644 --- a/crates/cli/tests/reference/targets-0.js +++ b/crates/cli/tests/reference/targets-0.js @@ -18,3 +18,14 @@ export function __wbg_random_8be0a899673d8681() { return ret; }; +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/targets-0.wat b/crates/cli/tests/reference/targets-0.wat index b8d3e4b8c61..551c3e6d9f9 100644 --- a/crates/cli/tests/reference/targets-0.wat +++ b/crates/cli/tests/reference/targets-0.wat @@ -1,9 +1,14 @@ (module $reference_test.wasm - (type (;0;) (func (param i32 i32) (result i32))) - (func $add_that_might_fail (;0;) (type 0) (param i32 i32) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $add_that_might_fail (;1;) (type 1) (param i32 i32) (result i32)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "add_that_might_fail" (func $add_that_might_fail)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 8332315d32d..915a0941e85 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -24,18 +24,9 @@ function getStringFromWasm0(ptr, len) { return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } -const heap = new Array(128).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); return idx; } @@ -43,12 +34,11 @@ function handleError(f, args) { try { return f.apply(this, args); } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); } } -function getObject(idx) { return heap[idx]; } - function debugString(val) { // primitive types const type = typeof val; @@ -180,24 +170,12 @@ function getDataViewMemory0() { } return cachedDataViewMemory0; } - -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} /** * @returns {URL} */ export function get_url() { const ret = wasm.get_url(); - return takeObject(ret); + return ret; } /** @@ -212,19 +190,26 @@ const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "win export function __wbg_new_561a91ce53f10a66() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); + return ret; }, arguments) }; export function __wbindgen_debug_string(arg0, arg1) { - const ret = debugString(getObject(arg1)); + const ret = debugString(arg1); const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; -export function __wbindgen_object_drop_ref(arg0) { - takeObject(arg0); +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; }; export function __wbindgen_throw(arg0, arg1) { diff --git a/crates/cli/tests/reference/web-sys.wat b/crates/cli/tests/reference/web-sys.wat index 564a4afd324..723728e65a8 100644 --- a/crates/cli/tests/reference/web-sys.wat +++ b/crates/cli/tests/reference/web-sys.wat @@ -1,20 +1,28 @@ (module $reference_test.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32) (result i32))) - (type (;3;) (func (param i32 i32 i32 i32) (result i32))) - (func $__wbindgen_realloc (;0;) (type 3) (param i32 i32 i32 i32) (result i32)) - (func $__wbindgen_malloc (;1;) (type 2) (param i32 i32) (result i32)) - (func $__wbindgen_exn_store (;2;) (type 1) (param i32)) - (func $get_url (;3;) (type 0) (result i32)) - (func $get_media_source (;4;) (type 0) (result i32)) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (result externref))) + (type (;3;) (func (param i32))) + (type (;4;) (func (param i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32 i32) (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 5) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 4) (param i32 i32) (result i32)) + (func $__wbindgen_exn_store (;3;) (type 3) (param i32)) + (func $get_media_source (;4;) (type 1) (result i32)) + (func $__externref_table_alloc (;5;) (type 1) (result i32)) + (func $"get_url externref shim" (;6;) (type 2) (result externref)) + (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) - (export "get_url" (func $get_url)) + (export "get_url" (func $"get_url externref shim")) (export "get_media_source" (func $get_media_source)) (export "__wbindgen_exn_store" (func $__wbindgen_exn_store)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__wbindgen_export_2" (table 0)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_start" (func 0)) (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") ) diff --git a/crates/example-tests/tests/shell.rs b/crates/example-tests/tests/shell.rs index f333e3a2058..569fe1334fb 100644 --- a/crates/example-tests/tests/shell.rs +++ b/crates/example-tests/tests/shell.rs @@ -39,8 +39,6 @@ shell_tests! { raytrace_parallel = "raytrace-parallel", #[cfg(feature = "stable")] synchronous_instantiation = "synchronous-instantiation", - #[cfg(feature = "stable")] - wasm2js = "wasm2js", #[cfg(feature = "nightly")] #["RUSTUP_TOOLCHAIN" = "nightly"] wasm_audio_worklet = "wasm-audio-worklet", diff --git a/examples/add/package.json b/examples/add/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/add/package.json +++ b/examples/add/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/canvas/package.json b/examples/canvas/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/canvas/package.json +++ b/examples/canvas/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/char/package.json b/examples/char/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/char/package.json +++ b/examples/char/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/closures/package.json b/examples/closures/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/closures/package.json +++ b/examples/closures/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/console_log/package.json b/examples/console_log/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/console_log/package.json +++ b/examples/console_log/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/dom/package.json b/examples/dom/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/dom/package.json +++ b/examples/dom/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/duck-typed-interfaces/package.json b/examples/duck-typed-interfaces/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/duck-typed-interfaces/package.json +++ b/examples/duck-typed-interfaces/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/fetch/package.json b/examples/fetch/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/fetch/package.json +++ b/examples/fetch/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/guide-supported-types-examples/package.json b/examples/guide-supported-types-examples/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/guide-supported-types-examples/package.json +++ b/examples/guide-supported-types-examples/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/hello_world/package.json b/examples/hello_world/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/hello_world/package.json +++ b/examples/hello_world/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/import_js/package.json b/examples/import_js/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/import_js/package.json +++ b/examples/import_js/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/julia_set/package.json b/examples/julia_set/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/julia_set/package.json +++ b/examples/julia_set/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/paint/package.json b/examples/paint/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/paint/package.json +++ b/examples/paint/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/performance/package.json b/examples/performance/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/performance/package.json +++ b/examples/performance/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/request-animation-frame/package.json b/examples/request-animation-frame/package.json index e9feb6b10f8..5ba95165c46 100644 --- a/examples/request-animation-frame/package.json +++ b/examples/request-animation-frame/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^3.11.3" } diff --git a/examples/todomvc/package.json b/examples/todomvc/package.json index 889bc2b653f..a40f0b4067b 100644 --- a/examples/todomvc/package.json +++ b/examples/todomvc/package.json @@ -8,7 +8,7 @@ "css-loader": "^6.11.0", "html-webpack-plugin": "^5.6.0", "mini-css-extract-plugin": "^2.9.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/wasm-in-wasm-imports/package.json b/examples/wasm-in-wasm-imports/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/wasm-in-wasm-imports/package.json +++ b/examples/wasm-in-wasm-imports/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/wasm-in-wasm/package.json b/examples/wasm-in-wasm/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/wasm-in-wasm/package.json +++ b/examples/wasm-in-wasm/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/wasm2js/Cargo.toml b/examples/wasm2js/Cargo.toml deleted file mode 100644 index 2e19ef01d4e..00000000000 --- a/examples/wasm2js/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -authors = ["The wasm-bindgen Developers"] -edition = "2021" -name = "wasm2js" -publish = false -version = "0.0.0" - -[lib] -crate-type = ["cdylib"] - -[dependencies] -wasm-bindgen = { path = "../../" } diff --git a/examples/wasm2js/README.md b/examples/wasm2js/README.md deleted file mode 100644 index 8a343b13a54..00000000000 --- a/examples/wasm2js/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Converting WebAssembly to JS - -[View documentation for this example online][dox] or [View compiled example -online][compiled] - -[compiled]: https://rustwasm.github.io/wasm-bindgen/exbuild/wasm2js/ -[dox]: https://rustwasm.github.io/docs/wasm-bindgen/examples/wasm2js.html - -You can build the example locally with: - -``` -$ ./build.sh -``` - -(or running the commands on Windows manually) - -and then visiting http://localhost:8000 in a browser should run the example! diff --git a/examples/wasm2js/build.sh b/examples/wasm2js/build.sh deleted file mode 100755 index 9ac5332f1a0..00000000000 --- a/examples/wasm2js/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -ex - -# Compile our Wasm module and run `wasm-bindgen` -wasm-pack build - -# Run the `wasm2js` tool from `binaryen` -wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.wasm.js - -# Update our JS shim to require the JS file instead -sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js.js -sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js_bg.js diff --git a/examples/wasm2js/index.html b/examples/wasm2js/index.html deleted file mode 100644 index cee977295e5..00000000000 --- a/examples/wasm2js/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -

Open up the developer console to see "Hello, World!"

- - - diff --git a/examples/wasm2js/index.js b/examples/wasm2js/index.js deleted file mode 100644 index 3260ea88a28..00000000000 --- a/examples/wasm2js/index.js +++ /dev/null @@ -1,4 +0,0 @@ -// Import our JS shim; will initialize by itself -import { run } from './pkg/wasm2js.js'; -// Run the function a second time -run(); diff --git a/examples/wasm2js/src/lib.rs b/examples/wasm2js/src/lib.rs deleted file mode 100644 index 70f3c510dc8..00000000000 --- a/examples/wasm2js/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -use wasm_bindgen::prelude::*; - -// lifted from the `console_log` example -#[wasm_bindgen] -extern "C" { - #[wasm_bindgen(js_namespace = console)] - fn log(s: &str); -} - -#[wasm_bindgen(start)] -fn run() { - log("Hello, World!"); -} diff --git a/examples/weather_report/package.json b/examples/weather_report/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/weather_report/package.json +++ b/examples/weather_report/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webaudio/package.json b/examples/webaudio/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/webaudio/package.json +++ b/examples/webaudio/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webgl/package.json b/examples/webgl/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/webgl/package.json +++ b/examples/webgl/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webrtc_datachannel/package.json b/examples/webrtc_datachannel/package.json index 5dc619b4a6b..f3e0ededa22 100644 --- a/examples/webrtc_datachannel/package.json +++ b/examples/webrtc_datachannel/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webxr/package.json b/examples/webxr/package.json index ec5924d6f4f..ce2bf74b4f9 100644 --- a/examples/webxr/package.json +++ b/examples/webxr/package.json @@ -9,7 +9,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "^5.93.0", + "webpack": "github:daxpedda/webpack#externref", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 9ef51ede23a..c3b58139d00 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -10,7 +10,6 @@ - [Small Wasm files](./examples/add.md) - [Without a Bundler](./examples/without-a-bundler.md) - [Synchronous Instantiation](./examples/synchronous-instantiation.md) - - [Converting WebAssembly to JS](./examples/wasm2js.md) - [Importing functions from JS](./examples/import-js.md) - [Working with `char`](./examples/char.md) - [js-sys: WebAssembly in WebAssembly](./examples/wasm-in-wasm.md) diff --git a/guide/src/examples/wasm2js.md b/guide/src/examples/wasm2js.md deleted file mode 100644 index 829464845cd..00000000000 --- a/guide/src/examples/wasm2js.md +++ /dev/null @@ -1,38 +0,0 @@ -# Converting WebAssembly to JS - -[View full source code][code] - -[code]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/wasm2js - -Not all browsers have support for `WebAssembly` at this time (although all major -ones do). If you'd like to support older browsers, you probably want a method -that doesn't involve keeping two codebases in sync! - -Thankfully there's a tool from [binaryen] called `wasm2js` to convert a wasm -file to JS. This JS file, if successfully produced, is equivalent to the wasm -file (albeit a little bit larger and slower), and can be loaded into practically -any browser. - -This example is relatively simple (cribbing from the [`console.log` -example](console-log.md)): - -```rust -{{#include ../../../examples/wasm2js/src/lib.rs}} -``` - -The real magic happens when you actually build the app. Just after -`wasm-bindgen` we see here how we execute `wasm2js` in our build script: - -```sh -{{#include ../../../examples/wasm2js/build.sh}} -``` - -Note that the `wasm2js` tool is still pretty early days so there's likely to be -a number of bugs to run into or work around. If any are encountered though -please feel free to report them upstream! - -Also note that eventually this will ideally be automatically done by your -bundler and no action would be needed from you to work in older browsers via -`wasm2js`! - -[binaryen]: https://github.com/WebAssembly/binaryen diff --git a/guide/src/reference/browser-support.md b/guide/src/reference/browser-support.md index aa43c644ade..373b49254e6 100644 --- a/guide/src/reference/browser-support.md +++ b/guide/src/reference/browser-support.md @@ -15,10 +15,9 @@ also like to be aware of it! * **IE 11** - `wasm-bindgen` by default requires support for `WebAssembly`, but no version of IE currently supports `WebAssembly`. You can - support IE by [compiling Wasm files to JS using `wasm2js`][w2js] (you can [see - an example of doing this too](../examples/wasm2js.html)). Note - that at this time no bundler will do this by default, but we'd love to - document plugins which do this if you are aware of one! + support IE by [compiling Wasm files to JS using `wasm2js`][w2js]. Note that + at this time no bundler will do this by default, but we'd love to document + plugins which do this if you are aware of one! If you find other incompatibilities please report them to us! We'd love to either keep this list up-to-date or fix the underlying bugs :) From c195d64ece68d10853173fcf2156018093c52cd3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 14:04:07 +0100 Subject: [PATCH 565/641] All dependencies are now pinned to each other (#4291) --- crates/futures/Cargo.toml | 6 +++--- crates/js-sys/Cargo.toml | 2 +- crates/test/Cargo.toml | 6 +++--- crates/web-sys/Cargo.toml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index f162cdf8f30..6e4c8e1994b 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -19,9 +19,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '0.3.72', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.72', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '0.2.95', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.95', default-features = false } [features] default = ["std"] @@ -32,7 +32,7 @@ std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] default-features = false features = ["MessageEvent", "Worker"] path = "../web-sys" -version = "0.3.24" +version = "=0.3.72" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures-channel-preview = { version = "0.3.0-alpha.18" } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index b34977b50c5..16400a046cf 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -25,7 +25,7 @@ default = ["std"] std = ["wasm-bindgen/std"] [dependencies] -wasm-bindgen = { path = "../..", version = "0.2.95", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.95", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index a25128ffcfb..a51d8ff68ab 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -15,11 +15,11 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "once_cell/ [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '0.3.72', default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.72', default-features = false } once_cell = { version = "1.12", default-features = false } scoped-tls = { version = "1.0", optional = true } -wasm-bindgen = { path = '../..', version = '0.2.95', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '0.4.45', default-features = false } +wasm-bindgen = { path = '../..', version = '=0.2.95', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.45', default-features = false } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 2f758f4f727..e3ddae0c305 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '0.3.72', default-features = false } -wasm-bindgen = { path = "../..", version = "0.2.95", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.72', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.95", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 085f912fe683c3a4f979b62ae1c58161dd179418 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:09:58 +0100 Subject: [PATCH 566/641] Update walrus requirement from 0.22 to 0.23 (#4279) Co-authored-by: daxpedda --- crates/cli-support/Cargo.toml | 2 +- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 6 +++--- crates/multi-value-xform/Cargo.toml | 6 +++--- crates/threads-xform/Cargo.toml | 6 +++--- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 67c554a5c24..6db47660790 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" -walrus = "0.22" +walrus = "0.23" wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.95' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.95' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.95' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index b326c60da4f..4d0891b1136 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } -walrus = { version = "0.22", features = ['parallel'] } +walrus = { version = "0.23", features = ['parallel'] } wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.95" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } @@ -41,8 +41,8 @@ diff = "0.1" predicates = "3" rayon = "1.0" tempfile = "3.0" -wasmparser = "0.212" -wasmprinter = "0.212" +wasmparser = "0.214" +wasmprinter = "0.214" [[test]] harness = false diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index dd7e6cc5bfe..ac3467d3f9d 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -15,13 +15,13 @@ version = "0.2.95" [dependencies] anyhow = "1.0" -walrus = "0.22" +walrus = "0.23" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" -wasmprinter = "0.212" -wast = "212" +wasmprinter = "0.214" +wast = "214" wat = "1.0" [[test]] diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index fe89ee332b4..50a5098eb03 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -15,13 +15,13 @@ version = "0.2.95" [dependencies] anyhow = "1.0" -walrus = "0.22" +walrus = "0.23" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" -wasmprinter = "0.212" -wast = "212" +wasmprinter = "0.214" +wast = "214" wat = "1.0" [[test]] diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 6c1d32e06ee..0658efb8227 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -15,13 +15,13 @@ version = "0.2.95" [dependencies] anyhow = "1.0" -walrus = "0.22" +walrus = "0.23" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } [dev-dependencies] rayon = "1.0" -wasmparser = "0.212" -wasmprinter = "0.212" +wasmparser = "0.214" +wasmprinter = "0.214" wat = "1.0" [[test]] diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 52a1e8ffb9c..f721e22506d 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -13,7 +13,7 @@ version = "0.2.95" [dependencies] leb128 = "0.2" -walrus = "0.22" +walrus = "0.23" # Matching the version `walrus` depends on. anyhow = "1.0" log = "0.4" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 38393c38a28..abffcf6da5b 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -16,7 +16,7 @@ version = "0.2.95" [dependencies] anyhow = "1.0" log = "0.4" -walrus = "0.22" +walrus = "0.23" wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.95" } [dev-dependencies] From 69a626cd748c5fc0a2016b279a0b000c173927db Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 15:49:39 +0100 Subject: [PATCH 567/641] Update to Rust v1.83 (#4293) --- crates/backend/src/codegen.rs | 4 ++-- crates/backend/src/encode.rs | 6 +++--- crates/cli-support/src/decode.rs | 2 +- crates/cli-support/src/descriptors.rs | 2 +- .../src/bin/wasm-bindgen-test-runner/headless.rs | 2 +- crates/js-sys/src/lib.rs | 10 +++++----- crates/macro-support/src/parser.rs | 6 +++--- crates/webidl/src/idl_type.rs | 2 +- src/closure.rs | 4 ++-- src/convert/closures.rs | 8 ++++---- src/convert/impls.rs | 2 +- src/convert/slices.rs | 2 +- src/describe.rs | 4 ++-- src/lib.rs | 16 ++++++++-------- tests/wasm/import_class.rs | 1 + tests/wasm/result.rs | 2 +- tests/wasm/result_jserror.rs | 2 +- 17 files changed, 38 insertions(+), 37 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 2a4f8697b40..d899d9916fa 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1500,7 +1500,7 @@ struct DescribeImport<'a> { wasm_bindgen: &'a syn::Path, } -impl<'a> ToTokens for DescribeImport<'a> { +impl ToTokens for DescribeImport<'_> { fn to_tokens(&self, tokens: &mut TokenStream) { let f = match *self.kind { ast::ImportKind::Function(ref f) => f, @@ -1838,7 +1838,7 @@ struct Descriptor<'a, T> { wasm_bindgen: &'a syn::Path, } -impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> { +impl ToTokens for Descriptor<'_, T> { fn to_tokens(&self, tokens: &mut TokenStream) { // It's possible for the same descriptor to be emitted in two different // modules (aka a value imported twice in a crate, each in a separate diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index baae8d72533..d98fe628450 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -406,7 +406,7 @@ enum LitOrExpr<'a> { Lit(&'a str), } -impl<'a> Encode for LitOrExpr<'a> { +impl Encode for LitOrExpr<'_> { fn encode(&self, dst: &mut Encoder) { match self { LitOrExpr::Expr(expr) => { @@ -468,14 +468,14 @@ impl Encode for usize { } } -impl<'a> Encode for &'a [u8] { +impl Encode for &[u8] { fn encode(&self, dst: &mut Encoder) { self.len().encode(dst); dst.extend_from_slice(self); } } -impl<'a> Encode for &'a str { +impl Encode for &str { fn encode(&self, dst: &mut Encoder) { self.as_bytes().encode(dst); } diff --git a/crates/cli-support/src/decode.rs b/crates/cli-support/src/decode.rs index 4264939f5c4..f527acea2d2 100644 --- a/crates/cli-support/src/decode.rs +++ b/crates/cli-support/src/decode.rs @@ -20,7 +20,7 @@ fn get(b: &mut &[u8]) -> u8 { r } -impl<'src> Deref for LitOrExpr<'src> { +impl Deref for LitOrExpr<'_> { type Target = str; fn deref(&self) -> &Self::Target { self.str diff --git a/crates/cli-support/src/descriptors.rs b/crates/cli-support/src/descriptors.rs index 30cd06db029..6dec401463f 100644 --- a/crates/cli-support/src/descriptors.rs +++ b/crates/cli-support/src/descriptors.rs @@ -193,7 +193,7 @@ impl WasmBindgenDescriptorsSection { found: bool, } - impl<'a> Visitor<'a> for FindDescribeClosure { + impl Visitor<'_> for FindDescribeClosure { fn visit_call(&mut self, call: &Call) { if call.func == self.wbindgen_describe_closure { self.found = true; diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index e614999aead..e1c20ec6229 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -669,7 +669,7 @@ impl<'a> BackgroundChild<'a> { } } -impl<'a> Drop for BackgroundChild<'a> { +impl Drop for BackgroundChild<'_> { fn drop(&mut self) { self.child.kill().unwrap(); let status = self.child.wait().unwrap(); diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 20abcbef379..167e1876262 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -707,7 +707,7 @@ pub struct ArrayIter<'a> { array: &'a Array, } -impl<'a> core::iter::Iterator for ArrayIter<'a> { +impl core::iter::Iterator for ArrayIter<'_> { type Item = JsValue; fn next(&mut self) -> Option { @@ -743,7 +743,7 @@ impl<'a> core::iter::Iterator for ArrayIter<'a> { } } -impl<'a> core::iter::DoubleEndedIterator for ArrayIter<'a> { +impl core::iter::DoubleEndedIterator for ArrayIter<'_> { fn next_back(&mut self) -> Option { let index = self.range.next_back()?; Some(self.array.get(index)) @@ -754,9 +754,9 @@ impl<'a> core::iter::DoubleEndedIterator for ArrayIter<'a> { } } -impl<'a> core::iter::FusedIterator for ArrayIter<'a> {} +impl core::iter::FusedIterator for ArrayIter<'_> {} -impl<'a> core::iter::ExactSizeIterator for ArrayIter<'a> {} +impl core::iter::ExactSizeIterator for ArrayIter<'_> {} impl Array { /// Returns an iterator over the values of the JS array. @@ -2311,7 +2311,7 @@ impl<'a> IntoIterator for &'a Iterator { } } -impl<'a> core::iter::Iterator for Iter<'a> { +impl core::iter::Iterator for Iter<'_> { type Item = Result; fn next(&mut self) -> Option { diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index cca8bffb416..bbf2bf79e02 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -422,7 +422,7 @@ trait ConvertToAst { fn convert(self, context: Ctx) -> Result; } -impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs)> for &'a mut syn::ItemStruct { +impl ConvertToAst<(&ast::Program, BindgenAttrs)> for &mut syn::ItemStruct { type Target = ast::Struct; fn convert( @@ -1188,7 +1188,7 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { } } -impl<'a> MacroParse for &'a mut syn::ItemImpl { +impl MacroParse for &mut syn::ItemImpl { fn macro_parse(self, program: &mut ast::Program, opts: BindgenAttrs) -> Result<(), Diagnostic> { if self.defaultness.is_some() { bail_span!( @@ -1292,7 +1292,7 @@ fn prepare_for_impl_recursion( Ok(()) } -impl<'a> MacroParse<&ClassMarker> for &'a mut syn::ImplItemFn { +impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn { fn macro_parse( self, program: &mut ast::Program, diff --git a/crates/webidl/src/idl_type.rs b/crates/webidl/src/idl_type.rs index 40fa060f1ec..1703a065709 100644 --- a/crates/webidl/src/idl_type.rs +++ b/crates/webidl/src/idl_type.rs @@ -1093,7 +1093,7 @@ impl<'a> IdlType<'a> { } } -impl<'a> IdentifierType<'a> { +impl IdentifierType<'_> { /// Converts to syn type if possible. pub(crate) fn to_syn_type( &self, diff --git a/src/closure.rs b/src/closure.rs index 8cda5f896a7..25186da42cb 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -471,7 +471,7 @@ where } // `Closure` can only be passed by reference to imports. -impl<'a, T> IntoWasmAbi for &'a Closure +impl IntoWasmAbi for &Closure where T: WasmClosure + ?Sized, { @@ -482,7 +482,7 @@ where } } -impl<'a, T> OptionIntoWasmAbi for &'a Closure +impl OptionIntoWasmAbi for &Closure where T: WasmClosure + ?Sized, { diff --git a/src/convert/closures.rs b/src/convert/closures.rs index dbe1318cb72..0e2f59ee5db 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -134,7 +134,7 @@ stack_closures! { (8 invoke8 invoke8_mut A a1 a2 a3 a4 B b1 b2 b3 b4 C c1 c2 c3 c4 D d1 d2 d3 d4 E e1 e2 e3 e4 F f1 f2 f3 f4 G g1 g2 g3 g4 H h1 h2 h3 h4) } -impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(&A) -> R + 'b) +impl IntoWasmAbi for &(dyn Fn(&A) -> R + '_) where A: RefFromWasmAbi, R: ReturnWasmAbi, @@ -175,7 +175,7 @@ unsafe extern "C" fn invoke1_ref( ret.return_abi().into() } -impl<'a, A, R> WasmDescribe for dyn Fn(&A) -> R + 'a +impl WasmDescribe for dyn Fn(&A) -> R + '_ where A: RefFromWasmAbi, R: ReturnWasmAbi, @@ -191,7 +191,7 @@ where } } -impl<'a, 'b, A, R> IntoWasmAbi for &'a mut (dyn FnMut(&A) -> R + 'b) +impl IntoWasmAbi for &mut (dyn FnMut(&A) -> R + '_) where A: RefFromWasmAbi, R: ReturnWasmAbi, @@ -232,7 +232,7 @@ unsafe extern "C" fn invoke1_mut_ref( ret.return_abi().into() } -impl<'a, A, R> WasmDescribe for dyn FnMut(&A) -> R + 'a +impl WasmDescribe for dyn FnMut(&A) -> R + '_ where A: RefFromWasmAbi, R: ReturnWasmAbi, diff --git a/src/convert/impls.rs b/src/convert/impls.rs index c4827ddf5ad..44bd846f683 100644 --- a/src/convert/impls.rs +++ b/src/convert/impls.rs @@ -437,7 +437,7 @@ impl FromWasmAbi for JsValue { } } -impl<'a> IntoWasmAbi for &'a JsValue { +impl IntoWasmAbi for &JsValue { type Abi = u32; #[inline] diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 45ec69bcb5d..249c0326e5b 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -362,7 +362,7 @@ impl<'a> IntoWasmAbi for &'a str { } } -impl<'a> OptionIntoWasmAbi for &'a str { +impl OptionIntoWasmAbi for &str { #[inline] fn none() -> Self::Abi { null_slice() diff --git a/src/describe.rs b/src/describe.rs index ac78848d222..9987449881d 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -144,7 +144,7 @@ impl WasmDescribe for [T] { } } -impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a T { +impl WasmDescribe for &T { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(REF); @@ -152,7 +152,7 @@ impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a T { } } -impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a mut T { +impl WasmDescribe for &mut T { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(REFMUT); diff --git a/src/lib.rs b/src/lib.rs index a375a5d2acc..648dac9d76e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1733,7 +1733,7 @@ pub mod __rt { borrow: &'b Cell, } - impl<'b, T: ?Sized> Deref for Ref<'b, T> { + impl Deref for Ref<'_, T> { type Target = T; #[inline] @@ -1742,14 +1742,14 @@ pub mod __rt { } } - impl<'b, T: ?Sized> Borrow for Ref<'b, T> { + impl Borrow for Ref<'_, T> { #[inline] fn borrow(&self) -> &T { self.value } } - impl<'b, T: ?Sized> Drop for Ref<'b, T> { + impl Drop for Ref<'_, T> { fn drop(&mut self) { self.borrow.set(self.borrow.get() - 1); } @@ -1760,7 +1760,7 @@ pub mod __rt { borrow: &'b Cell, } - impl<'b, T: ?Sized> Deref for RefMut<'b, T> { + impl Deref for RefMut<'_, T> { type Target = T; #[inline] @@ -1769,28 +1769,28 @@ pub mod __rt { } } - impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { + impl DerefMut for RefMut<'_, T> { #[inline] fn deref_mut(&mut self) -> &mut T { self.value } } - impl<'b, T: ?Sized> Borrow for RefMut<'b, T> { + impl Borrow for RefMut<'_, T> { #[inline] fn borrow(&self) -> &T { self.value } } - impl<'b, T: ?Sized> BorrowMut for RefMut<'b, T> { + impl BorrowMut for RefMut<'_, T> { #[inline] fn borrow_mut(&mut self) -> &mut T { self.value } } - impl<'b, T: ?Sized> Drop for RefMut<'b, T> { + impl Drop for RefMut<'_, T> { fn drop(&mut self) { self.borrow.set(0); } diff --git a/tests/wasm/import_class.rs b/tests/wasm/import_class.rs index cd9b4cfb738..44acfcce83b 100644 --- a/tests/wasm/import_class.rs +++ b/tests/wasm/import_class.rs @@ -93,6 +93,7 @@ extern "C" { /// dox pub fn foo(); + /// dox pub type Options; #[wasm_bindgen(constructor)] fn new() -> Options; diff --git a/tests/wasm/result.rs b/tests/wasm/result.rs index 3f30acc02f2..292fe493e67 100644 --- a/tests/wasm/result.rs +++ b/tests/wasm/result.rs @@ -63,7 +63,7 @@ struct ResetOnDrop<'a> { flag: &'a mut bool, } -impl<'a> Drop for ResetOnDrop<'a> { +impl Drop for ResetOnDrop<'_> { fn drop(&mut self) { *self.flag = false; } diff --git a/tests/wasm/result_jserror.rs b/tests/wasm/result_jserror.rs index e0ecbac173c..338e5f13aae 100644 --- a/tests/wasm/result_jserror.rs +++ b/tests/wasm/result_jserror.rs @@ -60,7 +60,7 @@ struct ResetOnDrop<'a> { flag: &'a mut bool, } -impl<'a> Drop for ResetOnDrop<'a> { +impl Drop for ResetOnDrop<'_> { fn drop(&mut self) { *self.flag = false; } From 56f7dec239f91085935e2474ce20b370ae513258 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 16:00:27 +0100 Subject: [PATCH 568/641] Test `no_std` MSRV in CI (#4292) Remove internal crates from MSRV tests, they are tested transitively. --- .github/workflows/main.yml | 13 +++++++++++-- crates/msrv/cli/Cargo.toml | 6 ------ crates/msrv/lib/Cargo.toml | 31 +++++++++++++++++-------------- crates/test/src/rt/scoped_tls.rs | 2 +- src/lib.rs | 13 ++++++++----- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bd6c23676f..9d3f4ef1e86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -540,13 +540,22 @@ jobs: msrv-lib: name: Check MSRV for libraries runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + - wasm32-unknown-unknown + features: + - --no-default-features + - "" defaults: run: working-directory: crates/msrv/lib steps: - uses: actions/checkout@v4 - - run: rustup update --no-self-update 1.57 && rustup default 1.57 - - run: cargo build + - run: rustup update --no-self-update 1.57 && rustup default 1.57 && rustup target add ${{ matrix.target }} + - run: cargo build --target ${{ matrix.target }} ${{ matrix.features }} msrv-cli: name: Check MSRV for CLI tools diff --git a/crates/msrv/cli/Cargo.toml b/crates/msrv/cli/Cargo.toml index 7f7c5e7a686..8bbe4ef76c9 100644 --- a/crates/msrv/cli/Cargo.toml +++ b/crates/msrv/cli/Cargo.toml @@ -6,9 +6,3 @@ version = "0.0.0" [dependencies] wasm-bindgen-cli = { path = "../../cli" } -wasm-bindgen-cli-support = { path = "../../cli-support" } -wasm-bindgen-externref-xform = { path = "../../externref-xform" } -wasm-bindgen-multi-value-xform = { path = "../../multi-value-xform" } -wasm-bindgen-threads-xform = { path = "../../threads-xform" } -wasm-bindgen-wasm-conventions = { path = "../../wasm-conventions" } -wasm-bindgen-wasm-interpreter = { path = "../../wasm-interpreter" } diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index c01fce77871..7cf0a5d4bb5 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -4,21 +4,24 @@ name = "msrv-library-test" publish = false version = "0.0.0" +[features] +default = ["std"] +std = [ + "wasm-bindgen/std", + "js-sys/std", + "wasm-bindgen-futures/std", + "web-sys/std", + "wasm-bindgen-test/std", +] + [dependencies] -js-sys = { path = "../../js-sys" } -wasm-bindgen = { path = "../../../" } -wasm-bindgen-backend = { path = "../../backend" } -wasm-bindgen-futures = { path = "../../futures" } -wasm-bindgen-macro = { path = "../../macro" } -wasm-bindgen-macro-support = { path = "../../macro-support" } -wasm-bindgen-shared = { path = "../../shared" } -wasm-bindgen-test = { path = "../../test" } -wasm-bindgen-test-macro = { path = "../../test-macro" } -web-sys = { path = "../../web-sys" } +js-sys = { path = "../../js-sys", default-features = false } +wasm-bindgen = { path = "../../../", default-features = false } +wasm-bindgen-futures = { path = "../../futures", default-features = false } +wasm-bindgen-test = { path = "../../test", default-features = false } +web-sys = { path = "../../web-sys", default-features = false } +# Pinned sub-dependencies for MSRV bumpalo = "=3.12.0" log = "=0.4.18" -scoped-tls = "=1.0.0" - -[patch.crates-io] -wasm-bindgen = { path = "../../../" } +scoped-tls = { version = "=1.0.0", optional = false } diff --git a/crates/test/src/rt/scoped_tls.rs b/crates/test/src/rt/scoped_tls.rs index 871a1c541b2..042160fb52d 100644 --- a/crates/test/src/rt/scoped_tls.rs +++ b/crates/test/src/rt/scoped_tls.rs @@ -37,7 +37,7 @@ impl ScopedKey { #[doc(hidden)] /// # Safety /// `inner` must only be accessed through `ScopedKey`'s API - pub const unsafe fn new(inner: &'static Wrapper>) -> Self { + pub(super) const unsafe fn new(inner: &'static Wrapper>) -> Self { Self { inner, _marker: PhantomData, diff --git a/src/lib.rs b/src/lib.rs index 648dac9d76e..403a119fa0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1595,20 +1595,23 @@ pub mod __rt { /// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with /// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. #[cfg(not(feature = "std"))] - pub struct LazyCell(::once_cell::unsync::Lazy); + pub struct LazyCell T>(::once_cell::unsync::Lazy); #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - unsafe impl Sync for LazyCell {} + unsafe impl Sync for LazyCell {} #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - unsafe impl Send for LazyCell {} + unsafe impl Send for LazyCell {} #[cfg(not(feature = "std"))] - impl LazyCell { - pub const fn new(init: fn() -> T) -> LazyCell { + impl LazyCell { + pub const fn new(init: F) -> LazyCell { Self(::once_cell::unsync::Lazy::new(init)) } + } + #[cfg(not(feature = "std"))] + impl T> LazyCell { pub(crate) fn try_with( &self, f: impl FnOnce(&T) -> R, From ee7a6b5ac52e66a52867069fa312becbfc77dc3c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 28 Nov 2024 19:32:52 +0100 Subject: [PATCH 569/641] Move lints to workspace (#4294) --- .cargo/config.toml | 13 ---- .github/workflows/main.yml | 7 +- Cargo.toml | 14 ++++ crates/backend/Cargo.toml | 3 + crates/cli-support/Cargo.toml | 3 + crates/cli-support/src/lib.rs | 10 --- crates/cli-support/src/wit/nonstandard.rs | 1 + crates/cli-support/src/wit/standard.rs | 5 ++ crates/cli/Cargo.toml | 3 + crates/externref-xform/Cargo.toml | 3 + crates/futures/Cargo.toml | 3 + crates/js-sys/Cargo.toml | 7 ++ crates/js-sys/tests/wasm/Array.rs | 22 +++--- crates/js-sys/tests/wasm/Boolean.rs | 4 +- crates/js-sys/tests/wasm/Intl.rs | 10 +-- crates/js-sys/tests/wasm/JsString.rs | 75 ++++++++---------- crates/js-sys/tests/wasm/Map.rs | 12 +-- crates/js-sys/tests/wasm/MapIterator.rs | 6 +- crates/js-sys/tests/wasm/Math.rs | 19 +++-- crates/js-sys/tests/wasm/Number.rs | 28 +++---- crates/js-sys/tests/wasm/Object.rs | 13 +++- crates/js-sys/tests/wasm/Reflect.rs | 2 + crates/js-sys/tests/wasm/Set.rs | 2 +- crates/js-sys/tests/wasm/Symbol.rs | 9 ++- crates/js-sys/tests/wasm/WebAssembly.rs | 4 +- crates/js-sys/tests/wasm/global_fns.rs | 17 ++-- crates/macro-support/Cargo.toml | 3 + crates/macro/Cargo.toml | 3 + crates/multi-value-xform/Cargo.toml | 3 + crates/shared/Cargo.toml | 3 + crates/test-macro/Cargo.toml | 3 + crates/test/Cargo.toml | 7 ++ crates/test/src/rt/mod.rs | 1 - crates/threads-xform/Cargo.toml | 3 + crates/typescript-tests/Cargo.toml | 3 + crates/typescript-tests/src/custom_section.rs | 1 + crates/wasm-conventions/Cargo.toml | 3 + crates/wasm-interpreter/Cargo.toml | 3 + crates/web-sys/Cargo.toml | 7 ++ crates/web-sys/tests/wasm/button_element.rs | 21 ++--- crates/web-sys/tests/wasm/element.rs | 77 +++++++------------ crates/web-sys/tests/wasm/head_element.rs | 2 +- crates/web-sys/tests/wasm/headers.rs | 4 +- crates/web-sys/tests/wasm/hr_element.rs | 2 +- crates/web-sys/tests/wasm/html_element.rs | 9 ++- crates/web-sys/tests/wasm/input_element.rs | 16 ++-- crates/web-sys/tests/wasm/menu_element.rs | 8 +- crates/web-sys/tests/wasm/olist_element.rs | 16 ++-- crates/web-sys/tests/wasm/opfs.rs | 17 ++-- crates/web-sys/tests/wasm/optgroup_element.rs | 8 +- crates/web-sys/tests/wasm/option_element.rs | 24 +++--- crates/web-sys/tests/wasm/response.rs | 1 + .../wasm/rtc_rtp_transceiver_direction.rs | 1 + crates/web-sys/tests/wasm/script_element.rs | 2 +- crates/web-sys/tests/wasm/select_element.rs | 46 ++++------- crates/web-sys/tests/wasm/span_element.rs | 2 +- crates/web-sys/tests/wasm/title_element.rs | 2 +- .../wasm/whitelisted_immutable_slices.rs | 16 ++-- crates/web-sys/tests/wasm/xpath_result.rs | 2 +- crates/webidl/Cargo.toml | 3 + examples/add/Cargo.toml | 3 + examples/canvas/Cargo.toml | 3 + examples/char/Cargo.toml | 3 + examples/closures/Cargo.toml | 3 + examples/console_log/Cargo.toml | 3 + examples/deno/Cargo.toml | 3 + examples/dom/Cargo.toml | 3 + examples/duck-typed-interfaces/Cargo.toml | 3 + .../explicit-resource-management/Cargo.toml | 3 + .../explicit-resource-management/src/lib.rs | 8 +- examples/fetch/Cargo.toml | 3 + .../guide-supported-types-examples/Cargo.toml | 3 + examples/hello_world/Cargo.toml | 3 + examples/import_js/crate/Cargo.toml | 3 + examples/julia_set/Cargo.toml | 3 + examples/paint/Cargo.toml | 3 + examples/performance/Cargo.toml | 3 + examples/raytrace-parallel/Cargo.toml | 3 + examples/request-animation-frame/Cargo.toml | 3 + examples/synchronous-instantiation/Cargo.toml | 3 + examples/todomvc/Cargo.toml | 3 + examples/wasm-audio-worklet/Cargo.toml | 3 + examples/wasm-in-wasm-imports/Cargo.toml | 3 + examples/wasm-in-wasm/Cargo.toml | 3 + examples/wasm-in-web-worker/Cargo.toml | 3 + examples/weather_report/Cargo.toml | 3 + examples/webaudio/Cargo.toml | 3 + examples/webgl/Cargo.toml | 3 + examples/webrtc_datachannel/Cargo.toml | 3 + examples/websockets/Cargo.toml | 3 + examples/webxr/Cargo.toml | 7 ++ .../without-a-bundler-no-modules/Cargo.toml | 3 + examples/without-a-bundler/Cargo.toml | 3 + src/closure.rs | 18 ++--- src/convert/closures.rs | 8 +- tests/wasm/classes.rs | 2 +- tests/wasm/closures.rs | 6 +- tests/wasm/simple.rs | 12 +++ 98 files changed, 446 insertions(+), 325 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 11543229379..6440da0591e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,15 +1,2 @@ [target.'cfg(target_arch = "wasm32")'] runner = 'cargo run -p wasm-bindgen-cli --bin wasm-bindgen-test-runner --' - -[target.'cfg(all())'] -rustflags = [ - "-Adead_code", - "-Anon_upper_case_globals", - "-Aunused_doc_comments", - "-Aclippy::large_enum_variant", - "-Aclippy::missing_safety_doc", - "-Aclippy::new_without_default", - "-Aclippy::overly_complex_bool_expr", - "-Aclippy::too_many_arguments", - "-Aclippy::type_complexity", -] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d3f4ef1e86..b5e9de0542a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,6 +62,7 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings + - run: cargo clippy --no-deps --all-features -p wasm-bindgen -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli-support -- -D warnings - run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings @@ -89,8 +90,8 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add wasm32-unknown-unknown - - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings - - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings + - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys --all-targets -- -D warnings + - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys --all-targets -- -D warnings # Run `cargo clippy` over crates that support `no_std` clippy_no_std: @@ -111,7 +112,7 @@ jobs: name: Clippy `no_std` with `atomics` runs-on: ubuntu-latest env: - CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory + RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory steps: - uses: actions/checkout@v4 - run: rustup default nightly-2024-07-06 diff --git a/Cargo.toml b/Cargo.toml index e9dba81a41c..873238e5999 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,20 @@ wasm-bindgen-test-crate-b = { path = 'tests/crates/b' } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } +[lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" + +[workspace.lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" + [workspace] exclude = ["crates/msrv"] members = [ diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index a19b7812efd..50d744bb681 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -29,3 +29,6 @@ proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } + +[lints] +workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 6db47660790..6eed3b636eb 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -29,3 +29,6 @@ wasm-bindgen-shared = { path = "../shared", version = '=0.2.95' } wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.95' } wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.95' } wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.95' } + +[lints] +workspace = true diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 6253e89b29a..fb5b4f02549 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -812,13 +812,3 @@ where pairs.sort_by_key(|(k, _)| *k); pairs.into_iter() } - -/// Like `sorted_iter`, but produces mutable references to the values -fn sorted_iter_mut(map: &mut HashMap) -> impl Iterator -where - K: Ord, -{ - let mut pairs = map.iter_mut().collect::>(); - pairs.sort_by_key(|(k, _)| *k); - pairs.into_iter() -} diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index e43a49988df..4ff93298281 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -244,6 +244,7 @@ pub enum AuxImport { mutable: bool, // whether or not this was a `FnMut` closure dtor: u32, // table element index of the destructor function adapter: AdapterId, // the adapter which translates the types for this closure + #[allow(dead_code)] nargs: usize, }, diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index 7feee8986a2..e34866d2609 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -40,6 +40,7 @@ pub enum AdapterKind { instructions: Vec, }, Import { + #[allow(dead_code)] module: String, name: String, kind: AdapterJsImportKind, @@ -139,10 +140,12 @@ pub enum Instruction { /// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain Wasm `i32` or `i64` equivalent. IntToWasm { input: AdapterType, + #[allow(dead_code)] output: walrus::ValType, }, /// Pops a Wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent. WasmToInt { + #[allow(dead_code)] input: walrus::ValType, output: AdapterType, }, @@ -166,6 +169,7 @@ pub enum Instruction { OptionWasmToStringEnum { name: String, + #[allow(dead_code)] hole: u32, }, @@ -310,6 +314,7 @@ pub enum Instruction { /// pops ptr/length i32, loads string from cache CachedStringLoad { owned: bool, + #[allow(dead_code)] optional: bool, mem: walrus::MemoryId, free: walrus::FunctionId, diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 4d0891b1136..4ee94630eca 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -57,3 +57,6 @@ rustls-tls = ["ureq/tls"] # Legacy support openssl = ["dep:native-tls"] vendored-openssl = ["openssl", "native-tls/vendored"] + +[lints] +workspace = true diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index ac3467d3f9d..ae4dc7f0a3d 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -24,6 +24,9 @@ wasmprinter = "0.214" wast = "214" wat = "1.0" +[lints] +workspace = true + [[test]] harness = false name = "all" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 6e4c8e1994b..d748c4a15f9 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -38,3 +38,6 @@ version = "=0.3.72" futures-channel-preview = { version = "0.3.0-alpha.18" } futures-lite = { version = "1.11.3", default-features = false } wasm-bindgen-test = { path = '../test' } + +[lints] +workspace = true diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 16400a046cf..466598c42f7 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -34,3 +34,10 @@ web-sys = { path = "../web-sys", features = ["Headers", "Response", "ResponseIni [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(js_sys_unstable_apis)'] } + +[lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index b2ff7419d5f..53a4bc0e30b 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -13,9 +13,7 @@ macro_rules! js_array { macro_rules! array { ($($e:expr),*) => ({ - let mut __x = Vec::new(); - $(__x.push(JsValue::from($e));)* - __x + vec![$(JsValue::from($e)),*] }) } @@ -38,7 +36,7 @@ fn from_iter() { assert_eq!( to_rust( - &vec![JsValue::from("a"), JsValue::from("b"), JsValue::from("c"),] + &[JsValue::from("a"), JsValue::from("b"), JsValue::from("c")] .iter() .collect() ), @@ -53,7 +51,7 @@ fn from_iter() { ); assert_eq!( - to_rust(&vec![array.clone(),].iter().collect()), + to_rust(&[array.clone()].iter().collect()), vec![JsValue::from(array)], ); @@ -74,7 +72,7 @@ fn from_iter() { let v = vec!["a", "b", "c"]; assert_eq!( - to_rust(&Array::from_iter(v.into_iter().map(|s| JsValue::from(s)))), + to_rust(&Array::from_iter(v.into_iter().map(JsValue::from))), vec!["a", "b", "c"], ); } @@ -290,6 +288,7 @@ fn sort() { } #[wasm_bindgen_test] +#[allow(clippy::cmp_owned)] fn some() { let array = js_array!["z", 1, "y", 2]; assert!(array.some(&mut |e| e == JsValue::from(2))); @@ -553,7 +552,7 @@ fn find_last_index() { fn to_locale_string() { let output = js_array![1, "a", Date::new(&"21 Dec 1997 14:12:00 UTC".into())] .to_locale_string(&"en".into(), &JsValue::undefined()); - assert!(String::from(output).len() > 0); + assert!(!String::from(output).is_empty()); } #[wasm_bindgen_test] @@ -567,7 +566,7 @@ fn for_each() { res } - assert_eq!(sum_indices_of_evens(&js_array![2, 4, 6, 8]), 0 + 1 + 2 + 3); + assert_eq!(sum_indices_of_evens(&js_array![2, 4, 6, 8]), 1 + 2 + 3); assert_eq!(sum_indices_of_evens(&js_array![1, 3, 5, 7]), 0); assert_eq!(sum_indices_of_evens(&js_array![3, 5, 7, 10]), 3); } @@ -578,7 +577,7 @@ fn set_length() { array.set_length(3); assert_eq!( array.iter().collect::>(), - [1.0, 2.0, 3.0].map(|x| JsValue::from_f64(x)) + [1.0, 2.0, 3.0].map(JsValue::from_f64) ); array.set_length(7); @@ -587,7 +586,7 @@ fn set_length() { [1.0, 2.0, 3.0] .iter() .copied() - .map(|x| JsValue::from_f64(x)) + .map(JsValue::from_f64) .chain([JsValue::UNDEFINED; 4]) .collect::>() ); @@ -620,8 +619,7 @@ fn test_array_view_mut_raw( let start: u8 = 10; let len: usize = 32; let end: u8 = start + len as u8; - let mut buffer: Vec = Vec::new(); - buffer.reserve(len); + let mut buffer: Vec = Vec::with_capacity(len); unsafe { let array: ArrT = sut(buffer.as_mut_ptr(), len); populate_array( diff --git a/crates/js-sys/tests/wasm/Boolean.rs b/crates/js-sys/tests/wasm/Boolean.rs index 2021d10a24c..ed1eddf5465 100644 --- a/crates/js-sys/tests/wasm/Boolean.rs +++ b/crates/js-sys/tests/wasm/Boolean.rs @@ -6,13 +6,13 @@ use wasm_bindgen_test::*; #[allow(deprecated)] #[wasm_bindgen_test] fn new_undefined() { - assert_eq!(Boolean::new(&JsValue::undefined()).value_of(), false); + assert!(!Boolean::new(&JsValue::undefined()).value_of()); } #[allow(deprecated)] #[wasm_bindgen_test] fn new_truly() { - assert_eq!(Boolean::new(&JsValue::from("foo")).value_of(), true); + assert!(Boolean::new(&JsValue::from("foo")).value_of()); } #[allow(deprecated)] diff --git a/crates/js-sys/tests/wasm/Intl.rs b/crates/js-sys/tests/wasm/Intl.rs index a58d12abe27..5d4675e8a5f 100644 --- a/crates/js-sys/tests/wasm/Intl.rs +++ b/crates/js-sys/tests/wasm/Intl.rs @@ -118,15 +118,15 @@ fn relative_time_format() { let opts = Object::new(); let c = Intl::RelativeTimeFormat::new(&locales, &opts); - assert!(c.format(1_f64.into(), &"seconds").is_string()); + assert!(c.format(1_f64, "seconds").is_string()); assert!(c - .format_to_parts(1_f64.into(), &"seconds") + .format_to_parts(1_f64, "seconds") .is_instance_of::()); assert!(c.resolved_options().is_instance_of::()); - assert_eq!(c.format(1_f64.into(), &"seconds"), "in 1 second"); - assert_eq!(c.format(1.5.into(), &"seconds"), "in 1.5 seconds"); - assert_eq!(c.format((-1.5).into(), &"seconds"), "1.5 seconds ago"); + assert_eq!(c.format(1_f64, "seconds"), "in 1 second"); + assert_eq!(c.format(1.5, "seconds"), "in 1.5 seconds"); + assert_eq!(c.format(-1.5, "seconds"), "1.5 seconds ago"); let a = Intl::RelativeTimeFormat::supported_locales_of(&locales, &opts); assert!(a.is_instance_of::()); diff --git a/crates/js-sys/tests/wasm/JsString.rs b/crates/js-sys/tests/wasm/JsString.rs index c96046234b8..31aed27f589 100644 --- a/crates/js-sys/tests/wasm/JsString.rs +++ b/crates/js-sys/tests/wasm/JsString.rs @@ -1,3 +1,5 @@ +#![cfg(test)] + use js_sys::*; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -69,9 +71,9 @@ fn ends_with() { let js = JsString::from(s); // TODO: remove third parameter once we have optional parameters - assert_eq!(js.ends_with("question.", s.len() as i32), true); - assert_eq!(js.ends_with("to be", s.len() as i32), false); - assert_eq!(js.ends_with("to be", 19), true); + assert!(js.ends_with("question.", s.len() as i32)); + assert!(!js.ends_with("to be", s.len() as i32)); + assert!(js.ends_with("to be", 19)); } #[wasm_bindgen_test] @@ -93,7 +95,7 @@ fn from_char_code() { let codes_u16: Vec = codes .into_iter() .map(|code| { - assert!(code <= u32::from(u16::max_value())); + assert!(code <= u32::from(u16::MAX)); code as u16 }) .collect(); @@ -121,9 +123,9 @@ fn from_code_point() { ); assert_eq!(JsString::from_code_point(&codes).unwrap(), "☃★♲你"); - assert!(!JsString::from_code_point1(0x10FFFF).is_err()); + assert!(JsString::from_code_point1(0x10FFFF).is_ok()); assert!(JsString::from_code_point1(0x110000).is_err()); - assert!(JsString::from_code_point1(u32::max_value()).is_err()); + assert!(JsString::from_code_point1(u32::MAX).is_err()); } #[wasm_bindgen_test] @@ -131,13 +133,13 @@ fn includes() { let str = JsString::from("Blue Whale"); // TODO: remove second parameter once we have optional parameters - assert_eq!(str.includes("Blue", 0), true); - assert_eq!(str.includes("Blute", 0), false); - assert_eq!(str.includes("Whale", 0), true); - assert_eq!(str.includes("Whale", 5), true); - assert_eq!(str.includes("Whale", 7), false); - assert_eq!(str.includes("", 0), true); - assert_eq!(str.includes("", 16), true); + assert!(str.includes("Blue", 0)); + assert!(!str.includes("Blute", 0)); + assert!(str.includes("Whale", 0)); + assert!(str.includes("Whale", 5)); + assert!(!str.includes("Whale", 7)); + assert!(str.includes("", 0)); + assert!(str.includes("", 16)); } #[wasm_bindgen_test] @@ -225,12 +227,12 @@ fn match_all() { .unwrap(); let obj = &result[0]; - assert_eq!(Reflect::get(obj.as_ref(), &"0".into()).unwrap(), "The"); - assert_eq!(Reflect::get(obj.as_ref(), &"1".into()).unwrap(), "he"); + assert_eq!(Reflect::get(obj, &"0".into()).unwrap(), "The"); + assert_eq!(Reflect::get(obj, &"1".into()).unwrap(), "he"); let obj = &result[1]; - assert_eq!(Reflect::get(obj.as_ref(), &"0".into()).unwrap(), "It"); - assert_eq!(Reflect::get(obj.as_ref(), &"1".into()).unwrap(), "t"); + assert_eq!(Reflect::get(obj, &"0".into()).unwrap(), "It"); + assert_eq!(Reflect::get(obj, &"1".into()).unwrap(), "t"); let result: Vec<_> = JsString::from("foo") .match_all(&re) @@ -249,29 +251,20 @@ fn match_all() { let obj = &result[0]; assert_eq!( - Reflect::get(obj.as_ref(), &"0".into()).unwrap(), + Reflect::get(obj, &"0".into()).unwrap(), "see Chapter 3.4.5.1" ); - assert_eq!( - Reflect::get(obj.as_ref(), &"1".into()).unwrap(), - "Chapter 3.4.5.1" - ); - assert_eq!(Reflect::get(obj.as_ref(), &"2".into()).unwrap(), ".1"); - assert_eq!(Reflect::get(obj.as_ref(), &"index".into()).unwrap(), 22); - assert_eq!(Reflect::get(obj.as_ref(), &"input".into()).unwrap(), s); + assert_eq!(Reflect::get(obj, &"1".into()).unwrap(), "Chapter 3.4.5.1"); + assert_eq!(Reflect::get(obj, &"2".into()).unwrap(), ".1"); + assert_eq!(Reflect::get(obj, &"index".into()).unwrap(), 22); + assert_eq!(Reflect::get(obj, &"input".into()).unwrap(), s); let obj = &result[1]; - assert_eq!( - Reflect::get(obj.as_ref(), &"0".into()).unwrap(), - "see Chapter 3.1.4" - ); - assert_eq!( - Reflect::get(obj.as_ref(), &"1".into()).unwrap(), - "Chapter 3.1.4" - ); - assert_eq!(Reflect::get(obj.as_ref(), &"2".into()).unwrap(), ".4"); - assert_eq!(Reflect::get(obj.as_ref(), &"index".into()).unwrap(), 48); - assert_eq!(Reflect::get(obj.as_ref(), &"input".into()).unwrap(), s); + assert_eq!(Reflect::get(obj, &"0".into()).unwrap(), "see Chapter 3.1.4"); + assert_eq!(Reflect::get(obj, &"1".into()).unwrap(), "Chapter 3.1.4"); + assert_eq!(Reflect::get(obj, &"2".into()).unwrap(), ".4"); + assert_eq!(Reflect::get(obj, &"index".into()).unwrap(), 48); + assert_eq!(Reflect::get(obj, &"input".into()).unwrap(), s); } #[wasm_bindgen_test] @@ -512,8 +505,8 @@ fn to_locale_lower_case() { let js = JsString::from("Mozilla"); assert_eq!(js.to_locale_lower_case(None), "mozilla"); let s = JsString::from("\u{0130}"); - assert_eq!(s.to_locale_lower_case(Some("tr".into())), "i"); - assert_ne!(s.to_locale_lower_case(Some("en-US".into())), "i"); + assert_eq!(s.to_locale_lower_case(Some("tr")), "i"); + assert_ne!(s.to_locale_lower_case(Some("en-US")), "i"); } #[wasm_bindgen_test] @@ -521,8 +514,8 @@ fn to_locale_upper_case() { let js = JsString::from("mozilla"); assert_eq!(js.to_locale_upper_case(None), "MOZILLA"); let s = JsString::from("i\u{0307}"); - assert_eq!(s.to_locale_upper_case(Some("lt".into())), "I"); - assert_ne!(s.to_locale_upper_case(Some("en-US".into())), "I"); + assert_eq!(s.to_locale_upper_case(Some("lt")), "I"); + assert_ne!(s.to_locale_upper_case(Some("en-US")), "I"); } #[wasm_bindgen_test] @@ -573,7 +566,7 @@ fn value_of() { fn raw() { let call_site = Object::new(); let raw = Array::of3(&"foo".into(), &"bar".into(), &"123".into()); - Reflect::set(&call_site.as_ref(), &"raw".into(), &raw.into()).unwrap(); + Reflect::set(call_site.as_ref(), &"raw".into(), &raw.into()).unwrap(); assert_eq!( JsString::raw_2(&call_site, "5", "JavaScript").unwrap(), "foo5barJavaScript123" diff --git a/crates/js-sys/tests/wasm/Map.rs b/crates/js-sys/tests/wasm/Map.rs index 8223c6e709e..3bdff9b504e 100644 --- a/crates/js-sys/tests/wasm/Map.rs +++ b/crates/js-sys/tests/wasm/Map.rs @@ -19,8 +19,8 @@ fn delete() { let map = Map::new(); map.set(&"foo".into(), &"bar".into()); assert_eq!(map.size(), 1); - assert_eq!(map.delete(&"foo".into()), true); - assert_eq!(map.delete(&"bar".into()), false); + assert!(map.delete(&"foo".into())); + assert!(!map.delete(&"bar".into())); assert_eq!(map.size(), 0); } @@ -63,8 +63,8 @@ fn get() { fn has() { let map = Map::new(); map.set(&"foo".into(), &"bar".into()); - assert_eq!(map.has(&"foo".into()), true); - assert_eq!(map.has(&"bar".into()), false); + assert!(map.has(&"foo".into())); + assert!(!map.has(&"bar".into())); } #[wasm_bindgen_test] @@ -76,8 +76,8 @@ fn new() { fn set() { let map = Map::new(); let new = map.set(&"foo".into(), &"bar".into()); - assert_eq!(map.has(&"foo".into()), true); - assert_eq!(new.has(&"foo".into()), true); + assert!(map.has(&"foo".into())); + assert!(new.has(&"foo".into())); } #[wasm_bindgen_test] diff --git a/crates/js-sys/tests/wasm/MapIterator.rs b/crates/js-sys/tests/wasm/MapIterator.rs index 6a6eec391fb..6b64c0861bd 100644 --- a/crates/js-sys/tests/wasm/MapIterator.rs +++ b/crates/js-sys/tests/wasm/MapIterator.rs @@ -9,7 +9,7 @@ fn entries() { let entries = map.entries(); let next = entries.next().unwrap(); - assert_eq!(next.done(), false); + assert!(!next.done()); assert!(next.value().is_object()); assert_eq!(Reflect::get(&next.value(), &0.into()).unwrap(), "uno"); assert_eq!(Reflect::get(&next.value(), &1.into()).unwrap(), 1); @@ -27,7 +27,7 @@ fn keys() { let keys = map.keys(); let next = keys.next().unwrap(); - assert_eq!(next.done(), false); + assert!(!next.done()); assert_eq!(next.value(), "uno"); let next = keys.next().unwrap(); @@ -43,7 +43,7 @@ fn values() { let values = map.values(); let next = values.next().unwrap(); - assert_eq!(next.done(), false); + assert!(!next.done()); assert_eq!(next.value(), 1); let next = values.next().unwrap(); diff --git a/crates/js-sys/tests/wasm/Math.rs b/crates/js-sys/tests/wasm/Math.rs index 95b70b5c00d..e1e97ee0620 100644 --- a/crates/js-sys/tests/wasm/Math.rs +++ b/crates/js-sys/tests/wasm/Math.rs @@ -1,5 +1,4 @@ -use std::f64::consts::PI; -use std::f64::{NAN, NEG_INFINITY}; +use std::f64::consts::{FRAC_PI_3, LN_2, LOG10_2, PI}; use js_sys::*; use wasm_bindgen_test::*; @@ -30,7 +29,7 @@ fn abs() { #[wasm_bindgen_test] fn acos() { assert_eq!(Math::acos(-1.), PI); - assert_eq!(Math::acos(0.5), 1.0471975511965979); + assert_eq!(Math::acos(0.5), FRAC_PI_3); assert!(Math::acos(2.).is_nan()); } @@ -127,9 +126,9 @@ fn floor() { #[wasm_bindgen_test] fn fround() { assert!(Math::fround(5.5) == 5.5); - assert!(Math::fround(5.05) == 5.050000190734863); + assert!(Math::fround(5.05) == 5.05); assert!(Math::fround(5.) == 5.); - assert!(Math::fround(-5.05) == -5.050000190734863); + assert!(Math::fround(-5.05) == -5.05); } #[wasm_bindgen_test] @@ -157,14 +156,14 @@ fn log() { fn log10() { assert_eq!(Math::log10(100000.), 5.); assert_eq!(Math::log10(1.), 0.); - assert_eq!(Math::log10(2.), 0.3010299956639812); + assert_eq!(Math::log10(2.), LOG10_2); } #[wasm_bindgen_test] fn log1p() { - assert_eq!(Math::log1p(1.), 0.6931471805599453); + assert_eq!(Math::log1p(1.), LN_2); assert_eq!(Math::log1p(0.), 0.); - assert_eq!(Math::log1p(-1.), NEG_INFINITY); + assert_eq!(Math::log1p(-1.), f64::NEG_INFINITY); assert!(Math::log1p(-2.).is_nan()); } @@ -173,7 +172,7 @@ fn log2() { assert_eq!(Math::log2(3.), 1.584962500721156); assert_eq!(Math::log2(2.), 1.); assert_eq!(Math::log2(1.), 0.); - assert_eq!(Math::log2(0.), NEG_INFINITY); + assert_eq!(Math::log2(0.), f64::NEG_INFINITY); } #[wasm_bindgen_test] @@ -222,7 +221,7 @@ fn sign() { assert_eq!(Math::sign(-3.), -1.); assert_eq!(Math::sign(2.3), 1.); assert_eq!(Math::sign(0.), 0.); - assert!(Math::sign(NAN).is_nan()); + assert!(Math::sign(f64::NAN).is_nan()); } #[wasm_bindgen_test] diff --git a/crates/js-sys/tests/wasm/Number.rs b/crates/js-sys/tests/wasm/Number.rs index 31f3f565fe8..55199bfbb83 100644 --- a/crates/js-sys/tests/wasm/Number.rs +++ b/crates/js-sys/tests/wasm/Number.rs @@ -1,7 +1,4 @@ -use std::{ - convert::TryFrom, - f64::{INFINITY, NAN}, -}; +use std::convert::TryFrom; use js_sys::*; use wasm_bindgen::prelude::*; @@ -23,8 +20,8 @@ fn is_finite() { assert!(Number::is_finite(&42.into())); assert!(Number::is_finite(&42.1.into())); assert!(!Number::is_finite(&"42".into())); - assert!(!Number::is_finite(&NAN.into())); - assert!(!Number::is_finite(&INFINITY.into())); + assert!(!Number::is_finite(&f64::NAN.into())); + assert!(!Number::is_finite(&f64::INFINITY.into())); } #[wasm_bindgen_test] @@ -35,7 +32,7 @@ fn is_integer() { #[wasm_bindgen_test] fn is_nan() { - assert!(Number::is_nan(&NAN.into())); + assert!(Number::is_nan(&f64::NAN.into())); assert!(!Number::is_nan(&JsValue::TRUE)); assert!(!Number::is_nan(&JsValue::NULL)); @@ -53,16 +50,13 @@ fn is_nan() { #[wasm_bindgen_test] fn is_safe_integer() { - assert_eq!(Number::is_safe_integer(&42.into()), true); - assert_eq!( - Number::is_safe_integer(&(Math::pow(2., 53.) - 1.).into()), - true - ); - assert_eq!(Number::is_safe_integer(&Math::pow(2., 53.).into()), false); - assert_eq!(Number::is_safe_integer(&"42".into()), false); - assert_eq!(Number::is_safe_integer(&42.1.into()), false); - assert_eq!(Number::is_safe_integer(&NAN.into()), false); - assert_eq!(Number::is_safe_integer(&INFINITY.into()), false); + assert!(Number::is_safe_integer(&42.into())); + assert!(Number::is_safe_integer(&(Math::pow(2., 53.) - 1.).into())); + assert!(!Number::is_safe_integer(&Math::pow(2., 53.).into())); + assert!(!Number::is_safe_integer(&"42".into())); + assert!(!Number::is_safe_integer(&42.1.into())); + assert!(!Number::is_safe_integer(&f64::NAN.into())); + assert!(!Number::is_safe_integer(&f64::INFINITY.into())); } #[allow(deprecated)] diff --git a/crates/js-sys/tests/wasm/Object.rs b/crates/js-sys/tests/wasm/Object.rs index 460fe0f77ce..7388c4e1046 100644 --- a/crates/js-sys/tests/wasm/Object.rs +++ b/crates/js-sys/tests/wasm/Object.rs @@ -1,5 +1,6 @@ +#![cfg(test)] + use js_sys::*; -use std::f64::NAN; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -213,7 +214,10 @@ fn is() { assert!(Object::is(&JsValue::FALSE, &JsValue::FALSE)); assert!(Object::is(&"foo".into(), &"foo".into())); assert!(Object::is(&JsValue::from(42), &JsValue::from(42))); - assert!(Object::is(&JsValue::from(NAN), &JsValue::from(NAN))); + assert!(Object::is( + &JsValue::from(f64::NAN), + &JsValue::from(f64::NAN) + )); let another_object = JsValue::from(Object::new()); assert!(!Object::is(&object, &another_object)); @@ -296,7 +300,10 @@ fn value_of() { let a = JsValue::from(foo_42()); let b = JsValue::from(foo_42()); let a2 = JsValue::from(Object::from(a.clone()).value_of()); - assert_eq!(a, a); + #[allow(clippy::eq_op)] + { + assert_eq!(a, a); + } assert_eq!(a, a2); assert_ne!(a, b); assert_ne!(a2, b); diff --git a/crates/js-sys/tests/wasm/Reflect.rs b/crates/js-sys/tests/wasm/Reflect.rs index d50629ec12b..5936b013d9e 100644 --- a/crates/js-sys/tests/wasm/Reflect.rs +++ b/crates/js-sys/tests/wasm/Reflect.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use js_sys::*; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; diff --git a/crates/js-sys/tests/wasm/Set.rs b/crates/js-sys/tests/wasm/Set.rs index 94905bef1ff..3346de472d0 100644 --- a/crates/js-sys/tests/wasm/Set.rs +++ b/crates/js-sys/tests/wasm/Set.rs @@ -5,7 +5,7 @@ use wasm_bindgen_test::*; fn set2vec(s: &Set) -> Vec { let mut result = Vec::new(); s.for_each(&mut |x, _, _| result.push(x)); - return result; + result } #[wasm_bindgen_test] diff --git a/crates/js-sys/tests/wasm/Symbol.rs b/crates/js-sys/tests/wasm/Symbol.rs index 0f1e3d0f63d..0f7a8868309 100644 --- a/crates/js-sys/tests/wasm/Symbol.rs +++ b/crates/js-sys/tests/wasm/Symbol.rs @@ -1,3 +1,5 @@ +#![cfg(test)] + use js_sys::*; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; @@ -85,8 +87,11 @@ fn to_string_tag() { fn for_() { let foo = JsValue::from(Symbol::for_("foo")); let bar = JsValue::from(Symbol::for_("bar")); - assert_eq!(foo, foo); - assert_eq!(bar, bar); + #[allow(clippy::eq_op)] + { + assert_eq!(foo, foo); + assert_eq!(bar, bar); + } assert_ne!(foo, bar); assert_ne!(bar, foo); diff --git a/crates/js-sys/tests/wasm/WebAssembly.rs b/crates/js-sys/tests/wasm/WebAssembly.rs index 4a236548175..ed28d764137 100644 --- a/crates/js-sys/tests/wasm/WebAssembly.rs +++ b/crates/js-sys/tests/wasm/WebAssembly.rs @@ -101,7 +101,7 @@ fn module_imports() { #[wasm_bindgen_test] fn table_inheritance() { - let table = WebAssembly::Table::new(&get_table_object().into()).unwrap(); + let table = WebAssembly::Table::new(&get_table_object()).unwrap(); assert!(table.is_instance_of::()); assert!(table.is_instance_of::()); @@ -118,7 +118,7 @@ fn table_error() { #[wasm_bindgen_test] fn table() { - let table = WebAssembly::Table::new(&get_table_object().into()).unwrap(); + let table = WebAssembly::Table::new(&get_table_object()).unwrap(); assert_eq!(table.length(), 1); assert!(table.get(0).is_ok()); diff --git a/crates/js-sys/tests/wasm/global_fns.rs b/crates/js-sys/tests/wasm/global_fns.rs index 1a2c5e1c573..b15344bdf4e 100644 --- a/crates/js-sys/tests/wasm/global_fns.rs +++ b/crates/js-sys/tests/wasm/global_fns.rs @@ -1,12 +1,9 @@ -use std::f64::{INFINITY, NAN}; - use js_sys::*; use wasm_bindgen_test::*; #[wasm_bindgen_test] fn test_decode_uri() { let x = decode_uri("https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B") - .ok() .expect("should decode URI OK"); assert_eq!(String::from(x), "https://mozilla.org/?x=шеллы"); @@ -15,9 +12,7 @@ fn test_decode_uri() { #[wasm_bindgen_test] fn test_decode_uri_component() { - let x = decode_uri_component("%3Fx%3Dtest") - .ok() - .expect("should decode URI OK"); + let x = decode_uri_component("%3Fx%3Dtest").expect("should decode URI OK"); assert_eq!(String::from(x), "?x=test"); assert!(decode_uri_component("%E0%A4%A").is_err()); @@ -37,12 +32,10 @@ fn test_encode_uri_component() { #[wasm_bindgen_test] fn test_eval() { - let x = eval("42").ok().expect("should eval OK"); + let x = eval("42").expect("should eval OK"); assert_eq!(x.as_f64().unwrap(), 42.0); - let err = eval("(function () { throw 42; }())") - .err() - .expect("eval should throw"); + let err = eval("(function () { throw 42; }())").expect_err("eval should throw"); assert_eq!(err.as_f64().unwrap(), 42.0); } @@ -51,8 +44,8 @@ fn test_is_finite() { assert!(is_finite(&42.into())); assert!(is_finite(&42.1.into())); assert!(is_finite(&"42".into())); - assert!(!is_finite(&NAN.into())); - assert!(!is_finite(&INFINITY.into())); + assert!(!is_finite(&f64::NAN.into())); + assert!(!is_finite(&f64::INFINITY.into())); } #[wasm_bindgen_test] diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 61ce9c2b9fc..f9f024ac8ee 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -28,3 +28,6 @@ quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } wasm-bindgen-backend = { path = "../backend", version = "=0.2.95", default-features = false } wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } + +[lints] +workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index d2b699ff2aa..bf6c7690a5e 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -35,3 +35,6 @@ trybuild = "1.0" wasm-bindgen = { path = "../.." } wasm-bindgen-futures = { path = "../futures" } web-sys = { path = "../web-sys", features = ["Worker"] } + +[lints] +workspace = true diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 50a5098eb03..05d176cf6b9 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -24,6 +24,9 @@ wasmprinter = "0.214" wast = "214" wat = "1.0" +[lints] +workspace = true + [[test]] harness = false name = "all" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 2e5fe6b1a78..3cc734b74a8 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -18,3 +18,6 @@ version = "0.2.95" # graph, pretend we link a native library so that `cargo` will provide better # error messages than the esoteric linker errors we would otherwise trigger. links = "wasm_bindgen" + +[lints] +workspace = true diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index d43aafe11d8..1d0ecab4815 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -29,3 +29,6 @@ syn = { version = "2.0", default-features = false, features = [ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } trybuild = "1.0" wasm-bindgen-test = { path = "../test" } + +[lints] +workspace = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index a51d8ff68ab..fccd1b96f61 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -29,5 +29,12 @@ wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45', feature [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } +[lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" + [lib] test = false diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 5489e19bf8f..2d508c6e1dc 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -272,7 +272,6 @@ impl Context { /// coordinated, and this will collect output and results for all executed /// tests. #[wasm_bindgen(constructor)] - #[allow(clippy::new_without_default)] pub fn new() -> Context { fn panic_handling(mut message: String) { let should_panic = CURRENT_OUTPUT.with(|output| { diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 0658efb8227..b65754be09d 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -24,6 +24,9 @@ wasmparser = "0.214" wasmprinter = "0.214" wat = "1.0" +[lints] +workspace = true + [[test]] harness = false name = "all" diff --git a/crates/typescript-tests/Cargo.toml b/crates/typescript-tests/Cargo.toml index 90d394bc285..1bd464ffb71 100644 --- a/crates/typescript-tests/Cargo.toml +++ b/crates/typescript-tests/Cargo.toml @@ -15,3 +15,6 @@ web-sys = { path = '../web-sys', features = ['HtmlElement', 'Node', 'Document'] [lib] crate-type = ['cdylib'] + +[lints] +workspace = true diff --git a/crates/typescript-tests/src/custom_section.rs b/crates/typescript-tests/src/custom_section.rs index 68c748c89c7..4ed757c35ca 100644 --- a/crates/typescript-tests/src/custom_section.rs +++ b/crates/typescript-tests/src/custom_section.rs @@ -8,6 +8,7 @@ const TS_INTERFACE_EXPORT: &'static str = r" #[wasm_bindgen(typescript_custom_section)] const TS_INTERFACE_EXPORT1: &'static str = include_str!("./custom_section_types.d.ts"); +#[allow(dead_code)] const TS_INTERFACE_EXPORT2: &str = "interface Person2 { height: number; }"; #[wasm_bindgen(typescript_custom_section)] const _: &str = TS_INTERFACE_EXPORT2; diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index f721e22506d..66ec85f8e34 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -18,3 +18,6 @@ walrus = "0.23" anyhow = "1.0" log = "0.4" wasmparser = "0.212" + +[lints] +workspace = true diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index abffcf6da5b..8c5f1b1d9dd 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -22,3 +22,6 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.9 [dev-dependencies] tempfile = "3" wat = "1.0" + +[lints] +workspace = true diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index e3ddae0c305..b5dea9e5a0b 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -34,6 +34,13 @@ wasm-bindgen-test = { path = '../test' } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } +[lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" + # This list is auto-generated by the wasm-bindgen-webidl program [features] default = ["std"] diff --git a/crates/web-sys/tests/wasm/button_element.rs b/crates/web-sys/tests/wasm/button_element.rs index 5a1296a0899..f46051b3ceb 100644 --- a/crates/web-sys/tests/wasm/button_element.rs +++ b/crates/web-sys/tests/wasm/button_element.rs @@ -9,6 +9,7 @@ extern "C" { } #[wasm_bindgen_test] +#[allow(deprecated)] fn test_button_element() { let element = new_button(); let location = web_sys::window().unwrap().location().href().unwrap(); @@ -21,8 +22,9 @@ fn test_button_element() { assert!(element.disabled(), "Should be disabled"); match element.form() { - None => assert!(true, "Shouldn't have a form"), - _ => assert!(false, "Shouldn't have a form"), + // Shouldn't have a form + None => (), + _ => unreachable!("Shouldn't have a form"), }; assert_eq!( @@ -73,17 +75,17 @@ fn test_button_element() { element.set_value("value1"); assert_eq!(element.value(), "value1", "Should have a value"); - assert_eq!(element.will_validate(), false, "Shouldn't validate"); + assert!(!element.will_validate(), "Shouldn't validate"); assert_eq!( element.validation_message().unwrap(), "", "Shouldn't have a value" ); - assert_eq!(element.check_validity(), true, "Should be valid"); - assert_eq!(element.report_validity(), true, "Should be valid"); + assert!(element.check_validity(), "Should be valid"); + assert!(element.report_validity(), "Should be valid"); element.set_custom_validity("Boop"); // Method exists but doesn't impact validity - assert_eq!(element.check_validity(), true, "Should be valid"); - assert_eq!(element.report_validity(), true, "Should be valid"); + assert!(element.check_validity(), "Should be valid"); + assert!(element.report_validity(), "Should be valid"); assert_eq!( element.labels().length(), @@ -102,9 +104,10 @@ fn test_button_element_in_form() { form.append_child(&button).unwrap(); match button.form() { - None => assert!(false, "Should have a form"), + // Should have a form + None => (), Some(form) => { - assert!(true, "Should have a form"); + // Should have a form assert_eq!( form.name(), "test-form", diff --git a/crates/web-sys/tests/wasm/element.rs b/crates/web-sys/tests/wasm/element.rs index ba4053627a1..8cc1cefc706 100644 --- a/crates/web-sys/tests/wasm/element.rs +++ b/crates/web-sys/tests/wasm/element.rs @@ -14,7 +14,10 @@ fn element() { */ let element = new_div(); - assert_eq!(element, element); + #[allow(clippy::eq_op)] + { + assert_eq!(element, element); + } assert_eq!(element.prefix(), None, "Shouldn't have a prefix"); assert_eq!(element.local_name(), "div", "Should have a div local name"); @@ -24,17 +27,11 @@ fn element() { assert_eq!(element.id(), "beep", "Should have an id of 'beep'"); // must_use is set on this result? - assert_eq!( - element.set_attribute("id", "beep").unwrap(), - (), - "Should set id" - ); + // Should set id + let _: () = element.set_attribute("id", "beep").unwrap(); assert!(element.has_attribute("id"), "Should now have an id"); - assert_eq!( - element.remove_attribute("id").unwrap(), - (), - "Should return nothing if removed" - ); + // Should return nothing if removed + let _: () = element.remove_attribute("id").unwrap(); assert_eq!(element.class_name(), "", "Shouldn't have a class name"); element.set_class_name("test thing"); @@ -48,11 +45,8 @@ fn element() { "test thing", "Should have a class name" ); - assert_eq!( - element.remove_attribute("class").unwrap(), - (), - "Should return nothing if removed" - ); + // Should return nothing if removed + let _: () = element.remove_attribute("class").unwrap(); /* Tests needed for: get_attribute_ns */ @@ -79,71 +73,52 @@ fn element() { assert!(!element.has_attribute("disabled"), "Should not be disabled"); assert!(!element.has_attribute("title"), "Should not have a title"); - assert_eq!( - element.set_attribute("title", "boop").unwrap(), - (), - "Should return nothing if set correctly" - ); + // Should return nothing if set correctly + let _: () = element.set_attribute("title", "boop").unwrap(); assert!(element.has_attribute("title"), "Should have a title"); assert_eq!( element.get_attribute("title").unwrap(), "boop", "Title should be 'boop'" ); - assert_eq!( - element.remove_attribute("title").unwrap(), - (), - "Should return nothing if removed" - ); + // Should return nothing if removed + let _: () = element.remove_attribute("title").unwrap(); assert!(!element.has_attribute("title"), "Should not have a title"); /* Tests needed for: set_attribute_ns */ assert!(!element.has_attributes(), "Should not have any attributes"); - assert_eq!( - element.set_attribute("title", "boop").unwrap(), - (), - "Should return nothing if set correctly" - ); + // Should return nothing if set correctly + let _: () = element.set_attribute("title", "boop").unwrap(); assert!(element.has_attributes(), "Should have attributes"); - assert_eq!( - element.remove_attribute("title").unwrap(), - (), - "Should return nothing if removed" - ); + // Should return nothing if removed + let _: () = element.remove_attribute("title").unwrap(); /* Tests needed for: remove_attribute_ns has_attribute_ns closest */ - assert_eq!( - element.matches(".this-is-a-thing").unwrap(), - false, + assert!( + !element.matches(".this-is-a-thing").unwrap(), "Should not match selector" ); - assert_eq!( - element.webkit_matches_selector(".this-is-a-thing").unwrap(), - false, + assert!( + !element.webkit_matches_selector(".this-is-a-thing").unwrap(), "Should not match selector" ); element.set_class_name("this-is-a-thing"); - assert_eq!( + assert!( element.matches(".this-is-a-thing").unwrap(), - true, "Should match selector" ); - assert_eq!( + assert!( element.webkit_matches_selector(".this-is-a-thing").unwrap(), - true, "Should match selector" ); - assert_eq!( - element.remove_attribute("class").unwrap(), - (), - "Should return nothing if removed" - ); + // Should return nothing if removed + let _: () = element.remove_attribute("class").unwrap(); /* Tests needed for: insert_adjacent_element diff --git a/crates/web-sys/tests/wasm/head_element.rs b/crates/web-sys/tests/wasm/head_element.rs index 4b827335727..7bd2c15eedc 100644 --- a/crates/web-sys/tests/wasm/head_element.rs +++ b/crates/web-sys/tests/wasm/head_element.rs @@ -10,5 +10,5 @@ extern "C" { #[wasm_bindgen_test] fn test_head_element() { let _element = new_head(); - assert!(true, "Head doesn't have an interface"); + // Head doesn't have an interface } diff --git a/crates/web-sys/tests/wasm/headers.rs b/crates/web-sys/tests/wasm/headers.rs index f7cb4f7d7e8..8433ee50e05 100644 --- a/crates/web-sys/tests/wasm/headers.rs +++ b/crates/web-sys/tests/wasm/headers.rs @@ -1,4 +1,4 @@ -use js_sys::{Array, Function, JsString}; +use js_sys::Array; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; use web_sys::Headers; @@ -65,6 +65,6 @@ fn headers_for_each() { } count += 1; }) as Box); - let res = new_headers_2().for_each(&cb.as_ref().unchecked_ref()); + let res = new_headers_2().for_each(cb.as_ref().unchecked_ref()); assert!(res.is_ok()); } diff --git a/crates/web-sys/tests/wasm/hr_element.rs b/crates/web-sys/tests/wasm/hr_element.rs index fe63c14045a..d707b5a5e58 100644 --- a/crates/web-sys/tests/wasm/hr_element.rs +++ b/crates/web-sys/tests/wasm/hr_element.rs @@ -20,5 +20,5 @@ fn test_hr_element() { assert_eq!(hr.width(), "256"); hr.set_no_shade(true); - assert_eq!(hr.no_shade(), true); + assert!(hr.no_shade()); } diff --git a/crates/web-sys/tests/wasm/html_element.rs b/crates/web-sys/tests/wasm/html_element.rs index 4f5173ed02e..710699e76fe 100644 --- a/crates/web-sys/tests/wasm/html_element.rs +++ b/crates/web-sys/tests/wasm/html_element.rs @@ -93,10 +93,10 @@ fn test_html_element() { assert_eq!(element.tab_index(), 1, "Should be tab_index"); // TODO add a focus handler here - assert_eq!(element.focus().unwrap(), (), "No result"); + let _: () = element.focus().unwrap(); // TODO add a blur handler here - assert_eq!(element.blur().unwrap(), (), "No result"); + let _: () = element.blur().unwrap(); assert_eq!(element.access_key(), "", "Shouldn't have a access_key"); element.set_access_key("a"); @@ -128,8 +128,9 @@ fn test_html_element() { // TODO verify case where we have an offset_parent match element.offset_parent() { - None => assert!(true, "Shouldn't have an offset_parent set"), - _ => assert!(false, "Shouldn't have a offset_parent set"), + // Shouldn't have an offset_parent set + None => (), + _ => unreachable!("Shouldn't have a offset_parent set"), }; // TODO verify when we have offsets diff --git a/crates/web-sys/tests/wasm/input_element.rs b/crates/web-sys/tests/wasm/input_element.rs index 30fc4ba7b66..ea2f9c66a56 100644 --- a/crates/web-sys/tests/wasm/input_element.rs +++ b/crates/web-sys/tests/wasm/input_element.rs @@ -8,6 +8,7 @@ extern "C" { } #[wasm_bindgen_test] +#[allow(deprecated)] fn test_input_element() { let element = new_input(); let location = web_sys::window().unwrap().location().href().unwrap(); @@ -49,8 +50,9 @@ fn test_input_element() { assert!(element.disabled(), "Should be disabled"); match element.form() { - None => assert!(true, "Shouldn't have a form"), - _ => assert!(false, "Shouldn't have a form"), + // Shouldn't have a form + None => (), + _ => unreachable!("Shouldn't have a form"), }; assert_eq!( @@ -179,17 +181,17 @@ fn test_input_element() { "The width attribute should be 12" ); - assert_eq!(element.will_validate(), false, "Shouldn't validate"); + assert!(!element.will_validate(), "Shouldn't validate"); assert_eq!( element.validation_message().unwrap(), "", "Shouldn't have a value" ); - assert_eq!(element.check_validity(), true, "Should be valid"); - assert_eq!(element.report_validity(), true, "Should be valid"); + assert!(element.check_validity(), "Should be valid"); + assert!(element.report_validity(), "Should be valid"); element.set_custom_validity("Boop"); // Method exists but doesn't impact validity ?!??! TODO look into - assert_eq!(element.check_validity(), true, "Should be valid"); - assert_eq!(element.report_validity(), true, "Should be valid"); + assert!(element.check_validity(), "Should be valid"); + assert!(element.report_validity(), "Should be valid"); /*TODO add tests pub fn labels(&self) -> Option pub fn select(&self) diff --git a/crates/web-sys/tests/wasm/menu_element.rs b/crates/web-sys/tests/wasm/menu_element.rs index 85df4159997..c1ed7504751 100644 --- a/crates/web-sys/tests/wasm/menu_element.rs +++ b/crates/web-sys/tests/wasm/menu_element.rs @@ -12,16 +12,14 @@ fn test_menu_element() { let menu = new_menu(); menu.set_compact(true); - assert_eq!( + assert!( menu.compact(), - true, "Menu should be compact after we set it to be compact." ); menu.set_compact(false); - assert_eq!( - menu.compact(), - false, + assert!( + !menu.compact(), "Menu should not be compact after we set it to be not-compact." ); } diff --git a/crates/web-sys/tests/wasm/olist_element.rs b/crates/web-sys/tests/wasm/olist_element.rs index 56785c0e796..9108bd24b24 100644 --- a/crates/web-sys/tests/wasm/olist_element.rs +++ b/crates/web-sys/tests/wasm/olist_element.rs @@ -12,16 +12,14 @@ fn test_olist_element() { let olist = new_olist(); olist.set_reversed(true); - assert_eq!( + assert!( olist.reversed(), - true, "Olist should be reversed after we set it to be reversed." ); olist.set_reversed(false); - assert_eq!( - olist.reversed(), - false, + assert!( + !olist.reversed(), "Olist should not be reversed after we set it to be not reversed." ); @@ -47,16 +45,14 @@ fn test_olist_element() { ); olist.set_compact(true); - assert_eq!( + assert!( olist.compact(), - true, "Olist should be compact after we set it to be compact." ); olist.set_compact(false); - assert_eq!( - olist.compact(), - false, + assert!( + !olist.compact(), "Olist should not be compact after we set it to be not compact." ); } diff --git a/crates/web-sys/tests/wasm/opfs.rs b/crates/web-sys/tests/wasm/opfs.rs index 98bd9fc92c6..db679e4f95c 100644 --- a/crates/web-sys/tests/wasm/opfs.rs +++ b/crates/web-sys/tests/wasm/opfs.rs @@ -26,8 +26,9 @@ async fn create_directory( path: &str, ) -> FileSystemDirectoryHandle { let mut opts = FileSystemGetDirectoryOptions::new(); + #[allow(deprecated)] opts.create(true); - JsFuture::from(dir.get_directory_handle_with_options(&path, &opts)) + JsFuture::from(dir.get_directory_handle_with_options(path, &opts)) .await .expect("Couldn't create test directory") .dyn_into::() @@ -41,6 +42,7 @@ async fn create_test_directory(path: &str) -> FileSystemDirectoryHandle { async fn create_file(dir: &FileSystemDirectoryHandle, path: &str) { let mut opts = FileSystemGetFileOptions::new(); + #[allow(deprecated)] opts.create(true); let _ = JsFuture::from(dir.get_file_handle_with_options(path, &opts)).await; } @@ -81,8 +83,9 @@ async fn test_write_to_file() { // create file let mut opts = FileSystemGetFileOptions::new(); + #[allow(deprecated)] opts.create(true); - let file = JsFuture::from(test_dir.get_file_handle_with_options(&"test.txt", &opts)) + let file = JsFuture::from(test_dir.get_file_handle_with_options("test.txt", &opts)) .await .expect("Couldn't create file") .dyn_into::() @@ -95,11 +98,11 @@ async fn test_write_to_file() { .unwrap() .dyn_into::() .unwrap(); - JsFuture::from(write_stream.write_with_str(test_txt).unwrap()).await; + let _ = JsFuture::from(write_stream.write_with_str(test_txt).unwrap()).await; JsFuture::from(write_stream.close()).await.unwrap(); // Read and check contents - let mut values = JsStream::from(test_dir.values()) + let values = JsStream::from(test_dir.values()) .map(|x| x.unwrap().dyn_into::().unwrap()) .collect::>() .await; @@ -140,17 +143,17 @@ async fn test_entries() { assert_eq!(entries.len(), 3); match entries.get("dir") { - Some(handle) => assert!(FileSystemDirectoryHandle::instanceof(&handle)), + Some(handle) => assert!(FileSystemDirectoryHandle::instanceof(handle)), _ => panic!("Didn't find directory"), } match entries.get("file") { - Some(handle) => assert!(FileSystemFileHandle::instanceof(&handle)), + Some(handle) => assert!(FileSystemFileHandle::instanceof(handle)), _ => panic!("Couldn't find file"), } match entries.get("file2") { - Some(handle) => assert!(FileSystemFileHandle::instanceof(&handle)), + Some(handle) => assert!(FileSystemFileHandle::instanceof(handle)), _ => panic!("Couldn't find file2"), } } diff --git a/crates/web-sys/tests/wasm/optgroup_element.rs b/crates/web-sys/tests/wasm/optgroup_element.rs index 99d72dada4a..3e6bea5bf83 100644 --- a/crates/web-sys/tests/wasm/optgroup_element.rs +++ b/crates/web-sys/tests/wasm/optgroup_element.rs @@ -12,16 +12,14 @@ fn test_optgroup_element() { let optgroup = new_optgroup(); optgroup.set_disabled(true); - assert_eq!( + assert!( optgroup.disabled(), - true, "Optgroup should be disabled after we set it to be disabled." ); optgroup.set_disabled(false); - assert_eq!( - optgroup.disabled(), - false, + assert!( + !optgroup.disabled(), "Optgroup should not be disabled after we set it to be not-disabled." ); diff --git a/crates/web-sys/tests/wasm/option_element.rs b/crates/web-sys/tests/wasm/option_element.rs index 10661b29b49..7c060668d04 100644 --- a/crates/web-sys/tests/wasm/option_element.rs +++ b/crates/web-sys/tests/wasm/option_element.rs @@ -12,16 +12,14 @@ fn test_option_element() { .unwrap(); option.set_disabled(true); - assert_eq!( + assert!( option.disabled(), - true, "Option should be disabled after we set it to be disabled." ); option.set_disabled(false); - assert_eq!( - option.disabled(), - false, + assert!( + !option.disabled(), "Option should not be disabled after we set it to be not-disabled." ); @@ -38,30 +36,26 @@ fn test_option_element() { ); option.set_default_selected(true); - assert_eq!( + assert!( option.default_selected(), - true, "Option should be default_selected after we set it to be default_selected." ); option.set_default_selected(false); - assert_eq!( - option.default_selected(), - false, + assert!( + !option.default_selected(), "Option should not be default_selected after we set it to be not default_selected." ); option.set_selected(true); - assert_eq!( + assert!( option.selected(), - true, "Option should be selected after we set it to be selected." ); option.set_selected(false); - assert_eq!( - option.selected(), - false, + assert!( + !option.selected(), "Option should not be selected after we set it to be not selected." ); diff --git a/crates/web-sys/tests/wasm/response.rs b/crates/web-sys/tests/wasm/response.rs index bd172797157..c856be20eaa 100644 --- a/crates/web-sys/tests/wasm/response.rs +++ b/crates/web-sys/tests/wasm/response.rs @@ -53,6 +53,7 @@ async fn wasm_instantiate_streaming() { let headers = Headers::new().unwrap(); headers.append("Content-Type", "application/wasm").unwrap(); + #[allow(deprecated)] let response = Response::new_with_opt_u8_array_and_init( Some(&mut wasm), ResponseInit::new().headers(&headers), diff --git a/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs b/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs index 38b30dd0bee..67e5a20cfe6 100644 --- a/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs +++ b/crates/web-sys/tests/wasm/rtc_rtp_transceiver_direction.rs @@ -25,6 +25,7 @@ async fn rtc_rtp_transceiver_direction() { let pc1: RtcPeerConnection = RtcPeerConnection::new().unwrap(); + #[allow(deprecated)] let tr1: RtcRtpTransceiver = pc1.add_transceiver_with_str_and_init( "audio", tr_init.direction(RtcRtpTransceiverDirection::Sendonly), diff --git a/crates/web-sys/tests/wasm/script_element.rs b/crates/web-sys/tests/wasm/script_element.rs index f8816bd8f2b..afddb7ce54b 100644 --- a/crates/web-sys/tests/wasm/script_element.rs +++ b/crates/web-sys/tests/wasm/script_element.rs @@ -59,7 +59,7 @@ fn test_script_element() { ); assert_eq!(element.text().unwrap(), "", "Shouldn't have text"); - assert_eq!(element.set_text("text").unwrap(), ()); + let _: () = element.set_text("text").unwrap(); assert_eq!(element.text().unwrap(), "text", "Should have text"); assert_eq!(element.event(), "", "Shouldn't have an event"); diff --git a/crates/web-sys/tests/wasm/select_element.rs b/crates/web-sys/tests/wasm/select_element.rs index 18a1a37535a..f5fd865395e 100644 --- a/crates/web-sys/tests/wasm/select_element.rs +++ b/crates/web-sys/tests/wasm/select_element.rs @@ -8,21 +8,20 @@ extern "C" { } #[wasm_bindgen_test] +#[allow(deprecated)] fn test_select_element() { // Creates a select with four options. Options are ["tomato", "potato", "orange", "apple"], where // the string is the .value and .text of each option. let select = new_select_with_food_opts(); select.set_autofocus(true); - assert_eq!( + assert!( select.autofocus(), - true, "Select element should have a true autofocus property." ); select.set_autofocus(false); - assert_eq!( - select.autofocus(), - false, + assert!( + !select.autofocus(), "Select element should have a false autofocus property." ); @@ -34,18 +33,10 @@ fn test_select_element() { ); select.set_disabled(true); - assert_eq!( - select.disabled(), - true, - "Select element should be disabled." - ); + assert!(select.disabled(), "Select element should be disabled."); select.set_disabled(false); - assert_eq!( - select.disabled(), - false, - "Select element should not be disabled." - ); + assert!(!select.disabled(), "Select element should not be disabled."); assert!( select.form().is_none(), @@ -53,16 +44,14 @@ fn test_select_element() { ); select.set_multiple(false); - assert_eq!( - select.multiple(), - false, + assert!( + !select.multiple(), "Select element should have a false multiple property." ); select.set_multiple(true); - assert_eq!( + assert!( select.multiple(), - true, "Select element should have a true multiple property." ); @@ -74,18 +63,10 @@ fn test_select_element() { ); select.set_required(true); - assert_eq!( - select.required(), - true, - "Select element should be required." - ); + assert!(select.required(), "Select element should be required."); select.set_required(false); - assert_eq!( - select.required(), - false, - "Select element should not be required." - ); + assert!(!select.required(), "Select element should not be required."); select.set_size(432); assert_eq!( @@ -97,7 +78,7 @@ fn test_select_element() { // Default type seems to be "select-multiple" for the browsers I tested, but there's no guarantee // on this, so let's just make sure we get back something here. assert!( - select.type_().len() > 0, + !select.type_().is_empty(), "Select element should have some type." ); @@ -143,9 +124,8 @@ fn test_select_element() { ); // This might be browser dependent, potentially rendering this test useless? Worked fine in Chrome and Firefox for now. - assert_eq!( + assert!( select.will_validate(), - true, "Select element should not validate by default." ); diff --git a/crates/web-sys/tests/wasm/span_element.rs b/crates/web-sys/tests/wasm/span_element.rs index 490df42adb1..cc0bd42a411 100644 --- a/crates/web-sys/tests/wasm/span_element.rs +++ b/crates/web-sys/tests/wasm/span_element.rs @@ -10,5 +10,5 @@ extern "C" { #[wasm_bindgen_test] fn test_span_element() { let _element = new_span(); - assert!(true, "Span doesn't have an interface"); + // Span doesn't have an interface } diff --git a/crates/web-sys/tests/wasm/title_element.rs b/crates/web-sys/tests/wasm/title_element.rs index ebc7aa74e6e..4a139d4fea8 100644 --- a/crates/web-sys/tests/wasm/title_element.rs +++ b/crates/web-sys/tests/wasm/title_element.rs @@ -11,6 +11,6 @@ extern "C" { fn title_element() { let element = new_title(); assert_eq!(element.text().unwrap(), "", "Shouldn't have an text"); - assert_eq!(element.set_text("page text").unwrap(), ()); + let _: () = element.set_text("page text").unwrap(); assert_eq!(element.text().unwrap(), "page text", "Should have an text"); } diff --git a/crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs b/crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs index 30d70bf3f6d..9030a161ac7 100644 --- a/crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs +++ b/crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs @@ -18,7 +18,7 @@ use web_sys::{ use web_sys::{WebGl2RenderingContext, WebGlRenderingContext, WebSocket}; // Ensure that our whitelisted WebGlRenderingContext methods compile with immutable slices. -fn test_webgl_rendering_context_immutable_slices() { +pub fn test_webgl_rendering_context_immutable_slices() { let gl = JsValue::null().unchecked_into::(); gl.vertex_attrib1fv_with_f32_array(0, &[1.]); @@ -35,7 +35,7 @@ fn test_webgl_rendering_context_immutable_slices() { gl.uniform_matrix3fv_with_f32_array(None, false, &[1.]); gl.uniform_matrix4fv_with_f32_array(None, false, &[1.]); - gl.tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array( + let _ = gl.tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array( 0, 0, 0, @@ -46,7 +46,7 @@ fn test_webgl_rendering_context_immutable_slices() { 0, Some(&[1]), ); - gl.tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array( + let _ = gl.tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_opt_u8_array( 0, 0, 0, @@ -61,18 +61,18 @@ fn test_webgl_rendering_context_immutable_slices() { } // Ensure that our whitelisted WebGl2RenderingContext methods compile with immutable slices. -fn test_webgl2_rendering_context_immutable_slices() { +pub fn test_webgl2_rendering_context_immutable_slices() { let gl = JsValue::null().unchecked_into::(); - gl.tex_image_3d_with_opt_u8_array(0, 0, 0, 0, 0, 0, 0, 0, 0, Some(&[1])); - gl.tex_sub_image_3d_with_opt_u8_array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Some(&[1])); + let _ = gl.tex_image_3d_with_opt_u8_array(0, 0, 0, 0, 0, 0, 0, 0, 0, Some(&[1])); + let _ = gl.tex_sub_image_3d_with_opt_u8_array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Some(&[1])); gl.compressed_tex_image_3d_with_u8_array(0, 0, 0, 0, 0, 0, 0, &[1]); } // Ensure that our whitelisted WebSocket methods compile with immutable slices. -fn test_websocket_immutable_slices() { +pub fn test_websocket_immutable_slices() { let ws = JsValue::null().unchecked_into::(); - ws.send_with_u8_array(&[0]); + let _ = ws.send_with_u8_array(&[0]); } // Ensure that our whitelisted FileSystemSyncAccessHandle methods compile with immutable slices. diff --git a/crates/web-sys/tests/wasm/xpath_result.rs b/crates/web-sys/tests/wasm/xpath_result.rs index 933ac97ba4a..2c90784464d 100644 --- a/crates/web-sys/tests/wasm/xpath_result.rs +++ b/crates/web-sys/tests/wasm/xpath_result.rs @@ -14,7 +14,7 @@ fn test_xpath_result() { xpath_result.result_type(), XPathResult::UNORDERED_NODE_ITERATOR_TYPE ); - assert_eq!(xpath_result.invalid_iterator_state(), false); + assert!(!xpath_result.invalid_iterator_state()); assert_eq!( xpath_result .iterate_next() diff --git a/crates/webidl/Cargo.toml b/crates/webidl/Cargo.toml index fde8c524d39..2471cb853e1 100644 --- a/crates/webidl/Cargo.toml +++ b/crates/webidl/Cargo.toml @@ -19,3 +19,6 @@ sourcefile = "0.2" syn = { version = '2.0', features = ['extra-traits', 'full'] } wasm-bindgen-backend = { path = "../backend" } weedle = { git = "https://github.com/rustwasm/weedle.git" } + +[lints] +workspace = true diff --git a/examples/add/Cargo.toml b/examples/add/Cargo.toml index 5836f5cc25e..d6bf4247df5 100644 --- a/examples/add/Cargo.toml +++ b/examples/add/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/canvas/Cargo.toml b/examples/canvas/Cargo.toml index 4aec70ddc8d..b0548d0985f 100644 --- a/examples/canvas/Cargo.toml +++ b/examples/canvas/Cargo.toml @@ -15,3 +15,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['CanvasRenderingContext2d', 'Document', 'Element', 'HtmlCanvasElement', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/char/Cargo.toml b/examples/char/Cargo.toml index bc6bf3c363f..dd78108c30a 100644 --- a/examples/char/Cargo.toml +++ b/examples/char/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index 4a70ab8a6da..15641af00f0 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -15,3 +15,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['CssStyleDeclaration', 'Document', 'Element', 'HtmlElement', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/console_log/Cargo.toml b/examples/console_log/Cargo.toml index 165c280c86f..8419ced96c7 100644 --- a/examples/console_log/Cargo.toml +++ b/examples/console_log/Cargo.toml @@ -11,3 +11,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } web-sys = { path = "../../crates/web-sys", features = ['console'] } + +[lints] +workspace = true diff --git a/examples/deno/Cargo.toml b/examples/deno/Cargo.toml index 8268d48e4c8..5ebb011c7c9 100644 --- a/examples/deno/Cargo.toml +++ b/examples/deno/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/dom/Cargo.toml b/examples/dom/Cargo.toml index 0b4b310464b..3b0284db49d 100644 --- a/examples/dom/Cargo.toml +++ b/examples/dom/Cargo.toml @@ -14,3 +14,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/duck-typed-interfaces/Cargo.toml b/examples/duck-typed-interfaces/Cargo.toml index 50f470d2642..a924f2477e2 100644 --- a/examples/duck-typed-interfaces/Cargo.toml +++ b/examples/duck-typed-interfaces/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/explicit-resource-management/Cargo.toml b/examples/explicit-resource-management/Cargo.toml index 1bba26018ff..01787b2279b 100644 --- a/examples/explicit-resource-management/Cargo.toml +++ b/examples/explicit-resource-management/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/explicit-resource-management/src/lib.rs b/examples/explicit-resource-management/src/lib.rs index 67441dd798d..52e49d30ea1 100644 --- a/examples/explicit-resource-management/src/lib.rs +++ b/examples/explicit-resource-management/src/lib.rs @@ -39,8 +39,8 @@ extern "C" { #[wasm_bindgen] pub struct MyStruct { - x: Vec, - y: Vec, + _x: Vec, + _y: Vec, name: String, } @@ -50,8 +50,8 @@ impl MyStruct { pub fn new(name: String) -> MyStruct { Self { name, - x: (0..50).collect(), - y: (0..50).collect(), + _x: (0..50).collect(), + _y: (0..50).collect(), } } } diff --git a/examples/fetch/Cargo.toml b/examples/fetch/Cargo.toml index 27719b43b4a..1f93bcc8fec 100644 --- a/examples/fetch/Cargo.toml +++ b/examples/fetch/Cargo.toml @@ -16,3 +16,6 @@ wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] features = ['Headers', 'Request', 'RequestInit', 'RequestMode', 'Response', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/guide-supported-types-examples/Cargo.toml b/examples/guide-supported-types-examples/Cargo.toml index 5918ea94451..84f15c3539c 100644 --- a/examples/guide-supported-types-examples/Cargo.toml +++ b/examples/guide-supported-types-examples/Cargo.toml @@ -11,3 +11,6 @@ crate-type = ["cdylib"] [dependencies] js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index d1218b0be6d..10721d8e7fc 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/import_js/crate/Cargo.toml b/examples/import_js/crate/Cargo.toml index 5b53eb99be6..449e85308e1 100644 --- a/examples/import_js/crate/Cargo.toml +++ b/examples/import_js/crate/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../../" } + +[lints] +workspace = true diff --git a/examples/julia_set/Cargo.toml b/examples/julia_set/Cargo.toml index 8bdb3ff22af..751aa7d5d89 100644 --- a/examples/julia_set/Cargo.toml +++ b/examples/julia_set/Cargo.toml @@ -14,3 +14,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['ImageData', 'CanvasRenderingContext2d'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 9771b0b413b..ffb7aa13c04 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -26,3 +26,6 @@ features = [ 'Window', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/performance/Cargo.toml b/examples/performance/Cargo.toml index ef3aa683d1f..daeb5299f5a 100644 --- a/examples/performance/Cargo.toml +++ b/examples/performance/Cargo.toml @@ -15,3 +15,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['Window', 'Performance', 'PerformanceTiming'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/raytrace-parallel/Cargo.toml b/examples/raytrace-parallel/Cargo.toml index 79bdebdaf90..384317c8b5f 100644 --- a/examples/raytrace-parallel/Cargo.toml +++ b/examples/raytrace-parallel/Cargo.toml @@ -32,3 +32,6 @@ features = [ 'MessageEvent', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/request-animation-frame/Cargo.toml b/examples/request-animation-frame/Cargo.toml index 3fe83f77730..c9f6b948e25 100644 --- a/examples/request-animation-frame/Cargo.toml +++ b/examples/request-animation-frame/Cargo.toml @@ -14,3 +14,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/synchronous-instantiation/Cargo.toml b/examples/synchronous-instantiation/Cargo.toml index 9eda0ee8692..3af99fe2a49 100644 --- a/examples/synchronous-instantiation/Cargo.toml +++ b/examples/synchronous-instantiation/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = { path = "../../" } + +[lints] +workspace = true diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index 67fe6bcd18d..8cfa60891a0 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -38,3 +38,6 @@ features = [ 'Window', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/wasm-audio-worklet/Cargo.toml b/examples/wasm-audio-worklet/Cargo.toml index 6a0fae91946..0a9306fb468 100644 --- a/examples/wasm-audio-worklet/Cargo.toml +++ b/examples/wasm-audio-worklet/Cargo.toml @@ -31,3 +31,6 @@ features = [ "Window", ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/wasm-in-wasm-imports/Cargo.toml b/examples/wasm-in-wasm-imports/Cargo.toml index ff98763f802..94e385f53a3 100644 --- a/examples/wasm-in-wasm-imports/Cargo.toml +++ b/examples/wasm-in-wasm-imports/Cargo.toml @@ -12,3 +12,6 @@ crate-type = ["cdylib"] js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } + +[lints] +workspace = true diff --git a/examples/wasm-in-wasm/Cargo.toml b/examples/wasm-in-wasm/Cargo.toml index ce9f72ceff8..62babf8d6a4 100644 --- a/examples/wasm-in-wasm/Cargo.toml +++ b/examples/wasm-in-wasm/Cargo.toml @@ -12,3 +12,6 @@ crate-type = ["cdylib"] js-sys = { path = "../../crates/js-sys" } wasm-bindgen = { path = "../../" } wasm-bindgen-futures = { path = "../../crates/futures" } + +[lints] +workspace = true diff --git a/examples/wasm-in-web-worker/Cargo.toml b/examples/wasm-in-web-worker/Cargo.toml index 8d623646fc1..b1fdb41a794 100644 --- a/examples/wasm-in-web-worker/Cargo.toml +++ b/examples/wasm-in-web-worker/Cargo.toml @@ -23,3 +23,6 @@ features = [ 'Worker', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/weather_report/Cargo.toml b/examples/weather_report/Cargo.toml index 1bb0a665c26..e0f59359e01 100644 --- a/examples/weather_report/Cargo.toml +++ b/examples/weather_report/Cargo.toml @@ -19,3 +19,6 @@ wasm-bindgen-futures = { path = "../../crates/futures" } [dependencies.web-sys] features = ["Document", "Element", "HtmlElement", "Window"] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/webaudio/Cargo.toml b/examples/webaudio/Cargo.toml index 4fbea599082..f1bb6757399 100644 --- a/examples/webaudio/Cargo.toml +++ b/examples/webaudio/Cargo.toml @@ -22,3 +22,6 @@ features = [ 'OscillatorType', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/webgl/Cargo.toml b/examples/webgl/Cargo.toml index ebf3967e81f..89ebe247a8d 100644 --- a/examples/webgl/Cargo.toml +++ b/examples/webgl/Cargo.toml @@ -25,3 +25,6 @@ features = [ 'Window', ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/webrtc_datachannel/Cargo.toml b/examples/webrtc_datachannel/Cargo.toml index 9773e0e94c4..dedd4ee1b7d 100644 --- a/examples/webrtc_datachannel/Cargo.toml +++ b/examples/webrtc_datachannel/Cargo.toml @@ -26,3 +26,6 @@ features = [ "RtcDataChannelEvent", ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/websockets/Cargo.toml b/examples/websockets/Cargo.toml index 63f201d35e5..fa72697fc5c 100644 --- a/examples/websockets/Cargo.toml +++ b/examples/websockets/Cargo.toml @@ -23,3 +23,6 @@ features = [ "WebSocket", ] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/webxr/Cargo.toml b/examples/webxr/Cargo.toml index 0e2efb8a65d..69feef041d2 100644 --- a/examples/webxr/Cargo.toml +++ b/examples/webxr/Cargo.toml @@ -67,3 +67,10 @@ path = "../../crates/web-sys" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] } + +[lints.clippy] +large_enum_variant = "allow" +new_without_default = "allow" +overly_complex_bool_expr = "allow" +too_many_arguments = "allow" +type_complexity = "allow" diff --git a/examples/without-a-bundler-no-modules/Cargo.toml b/examples/without-a-bundler-no-modules/Cargo.toml index a5e70744cfe..51699060177 100644 --- a/examples/without-a-bundler-no-modules/Cargo.toml +++ b/examples/without-a-bundler-no-modules/Cargo.toml @@ -14,3 +14,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/examples/without-a-bundler/Cargo.toml b/examples/without-a-bundler/Cargo.toml index 07ccf676c78..a4f2a593c35 100644 --- a/examples/without-a-bundler/Cargo.toml +++ b/examples/without-a-bundler/Cargo.toml @@ -14,3 +14,6 @@ wasm-bindgen = { path = "../../" } [dependencies.web-sys] features = ['Document', 'Element', 'HtmlElement', 'Node', 'Window'] path = "../../crates/web-sys" + +[lints] +workspace = true diff --git a/src/closure.rs b/src/closure.rs index 25186da42cb..95cf2250a89 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -340,7 +340,7 @@ where #[inline(never)] #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe fn breaks_if_inlined(a: usize, b: usize) -> u32 { - super::__wbindgen_describe_closure(a as u32, b as u32, describe:: as u32) + super::__wbindgen_describe_closure(a as u32, b as u32, describe:: as usize as u32) } let idx = unsafe { breaks_if_inlined::(a, b) }; @@ -596,7 +596,7 @@ macro_rules! doit { ret.return_abi().into() } - inform(invoke::<$($var,)* R> as u32); + inform(invoke::<$($var,)* R> as usize as u32); unsafe extern fn destroy<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, @@ -614,7 +614,7 @@ macro_rules! doit { fields: (a, b) }.ptr)); } - inform(destroy::<$($var,)* R> as u32); + inform(destroy::<$($var,)* R> as usize as u32); <&Self>::describe(); } @@ -656,7 +656,7 @@ macro_rules! doit { ret.return_abi().into() } - inform(invoke::<$($var,)* R> as u32); + inform(invoke::<$($var,)* R> as usize as u32); unsafe extern fn destroy<$($var: FromWasmAbi,)* R: ReturnWasmAbi>( a: usize, @@ -670,7 +670,7 @@ macro_rules! doit { fields: (a, b) }.ptr)); } - inform(destroy::<$($var,)* R> as u32); + inform(destroy::<$($var,)* R> as usize as u32); <&mut Self>::describe(); } @@ -793,7 +793,7 @@ where ret.return_abi().into() } - inform(invoke:: as u32); + inform(invoke:: as usize as u32); #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn destroy(a: usize, b: usize) { @@ -805,7 +805,7 @@ where FatPtr:: R> { fields: (a, b) }.ptr, )); } - inform(destroy:: as u32); + inform(destroy:: as usize as u32); <&Self>::describe(); } @@ -843,7 +843,7 @@ where ret.return_abi().into() } - inform(invoke:: as u32); + inform(invoke:: as usize as u32); #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] unsafe extern "C" fn destroy(a: usize, b: usize) { @@ -855,7 +855,7 @@ where FatPtr:: R> { fields: (a, b) }.ptr, )); } - inform(destroy:: as u32); + inform(destroy:: as usize as u32); <&mut Self>::describe(); } diff --git a/src/convert/closures.rs b/src/convert/closures.rs index 0e2f59ee5db..1f45f90f58b 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -57,7 +57,7 @@ macro_rules! stack_closures { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); - inform($invoke::<$($var,)* R> as u32); + inform($invoke::<$($var,)* R> as usize as u32); inform($cnt); $(<$var as WasmDescribe>::describe();)* ::describe(); @@ -112,7 +112,7 @@ macro_rules! stack_closures { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); - inform($invoke_mut::<$($var,)* R> as u32); + inform($invoke_mut::<$($var,)* R> as usize as u32); inform($cnt); $(<$var as WasmDescribe>::describe();)* ::describe(); @@ -183,7 +183,7 @@ where #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); - inform(invoke1_ref:: as u32); + inform(invoke1_ref:: as usize as u32); inform(1); <&A as WasmDescribe>::describe(); ::describe(); @@ -240,7 +240,7 @@ where #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { inform(FUNCTION); - inform(invoke1_mut_ref:: as u32); + inform(invoke1_mut_ref:: as usize as u32); inform(1); <&A as WasmDescribe>::describe(); ::describe(); diff --git a/tests/wasm/classes.rs b/tests/wasm/classes.rs index e590cf7e2eb..d701e2088ed 100644 --- a/tests/wasm/classes.rs +++ b/tests/wasm/classes.rs @@ -533,7 +533,7 @@ mod works_in_module { use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen] - pub struct WorksInModule(u32); + pub struct WorksInModule(#[allow(dead_code)] u32); #[wasm_bindgen] impl WorksInModule { diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index 4cf7b21e737..d8bd2e92357 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -499,7 +499,9 @@ fn test_closure_returner() { js_test_closure_returner(); #[wasm_bindgen] - pub struct ClosureHandle(Closure); + pub struct ClosureHandle { + _closure: Closure, + } #[wasm_bindgen] pub struct BadStruct {} @@ -518,7 +520,7 @@ fn test_closure_returner() { Reflect::set( &o, &JsValue::from("handle"), - &JsValue::from(ClosureHandle(some_fn)), + &JsValue::from(ClosureHandle { _closure: some_fn }), ) .unwrap(); diff --git a/tests/wasm/simple.rs b/tests/wasm/simple.rs index fdef34c68fd..5d060ca8962 100644 --- a/tests/wasm/simple.rs +++ b/tests/wasm/simple.rs @@ -71,6 +71,9 @@ pub fn simple_return_raw_pointer_u8(value: u8) -> *const u8 { Box::into_raw(Box::new(value)) } +/// # Safety +/// +/// Pointers have to be valid. #[wasm_bindgen] pub unsafe fn simple_raw_pointers_work(a: *mut u32, b: *const u8) -> *const u32 { (*a) = (*b) as u32; @@ -82,6 +85,9 @@ pub fn simple_return_option_null_pointer() -> Option<*const u32> { Some(ptr::null()) } +/// # Safety +/// +/// Pointers have to be valid. #[wasm_bindgen] pub unsafe fn simple_option_raw_pointers_work( a: Option<*mut u32>, @@ -113,11 +119,17 @@ pub fn simple_return_option_non_null(value: u32) -> Option> { Some(NonNull::from(Box::leak(Box::new(value)))) } +/// # Safety +/// +/// Pointer has to be generated by [`Box::leak()`] on a `Box`. #[wasm_bindgen] pub unsafe fn simple_nonnull_work(a: NonNull) -> u32 { *Box::from_raw(a.as_ptr()) } +/// # Safety +/// +/// Pointer has to be generated by [`Box::leak()`] on a `Box`. #[wasm_bindgen] pub unsafe fn simple_option_nonnull_work(a: Option>) -> Option { a.map(|ptr| *Box::from_raw(ptr.as_ptr())) From a95536845bf806089696ac4a27a10d6aa02908e5 Mon Sep 17 00:00:00 2001 From: Christofer Nolander Date: Thu, 28 Nov 2024 21:10:45 +0100 Subject: [PATCH 570/641] Update WebGPU API to draft 2024-11-22 (#4290) --- CHANGELOG.md | 3 + crates/web-sys/Cargo.toml | 10 +-- .../src/features/gen_GpuCommandEncoder.rs | 90 ++++++++++--------- ...rs => gen_GpuCopyExternalImageDestInfo.rs} | 54 +++++------ ... => gen_GpuCopyExternalImageSourceInfo.rs} | 38 ++++---- crates/web-sys/src/features/gen_GpuDevice.rs | 12 +++ .../src/features/gen_GpuFeatureName.rs | 1 + crates/web-sys/src/features/gen_GpuQueue.rs | 83 +++++++++-------- .../features/gen_GpuRequestAdapterOptions.rs | 24 +++++ ...uffer.rs => gen_GpuTexelCopyBufferInfo.rs} | 46 +++++----- ...out.rs => gen_GpuTexelCopyBufferLayout.rs} | 40 ++++----- ...ture.rs => gen_GpuTexelCopyTextureInfo.rs} | 46 +++++----- .../src/features/gen_GpuVertexFormat.rs | 10 +++ crates/web-sys/src/features/mod.rs | 70 +++++++-------- crates/web-sys/webidls/unstable/WebGPU.webidl | 59 +++++++----- 15 files changed, 332 insertions(+), 254 deletions(-) rename crates/web-sys/src/features/{gen_GpuImageCopyTextureTagged.rs => gen_GpuCopyExternalImageDestInfo.rs} (80%) rename crates/web-sys/src/features/{gen_GpuImageCopyExternalImage.rs => gen_GpuCopyExternalImageSourceInfo.rs} (79%) rename crates/web-sys/src/features/{gen_GpuImageCopyBuffer.rs => gen_GpuTexelCopyBufferInfo.rs} (82%) rename crates/web-sys/src/features/{gen_GpuImageDataLayout.rs => gen_GpuTexelCopyBufferLayout.rs} (81%) rename crates/web-sys/src/features/{gen_GpuImageCopyTexture.rs => gen_GpuTexelCopyTextureInfo.rs} (81%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66e2dbfd2d3..d430b2891c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,9 @@ * Deprecated `#[wasm_bindgen(thread_local)]` in favor of `#[wasm_bindgen(thread_local_v2)]`, which creates a `wasm_bindgen::JsThreadLocal`. It is similar to `std::thread::LocalKey` but supports `no_std`. [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) +* Updated the WebGPU API to the current draft as of 2024-11-22. + [#4290](https://github.com/rustwasm/wasm-bindgen/pull/4290) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index b5dea9e5a0b..52551c61f1c 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -520,6 +520,8 @@ GpuComputePassEncoder = [] GpuComputePassTimestampWrites = [] GpuComputePipeline = [] GpuComputePipelineDescriptor = [] +GpuCopyExternalImageDestInfo = [] +GpuCopyExternalImageSourceInfo = [] GpuCullMode = [] GpuDepthStencilState = [] GpuDevice = ["EventTarget"] @@ -536,11 +538,6 @@ GpuFeatureName = [] GpuFilterMode = [] GpuFragmentState = [] GpuFrontFace = [] -GpuImageCopyBuffer = [] -GpuImageCopyExternalImage = [] -GpuImageCopyTexture = [] -GpuImageCopyTextureTagged = [] -GpuImageDataLayout = [] GpuIndexFormat = [] GpuInternalError = ["GpuError"] GpuLoadOp = [] @@ -592,6 +589,9 @@ GpuStorageTextureBindingLayout = [] GpuStoreOp = [] GpuSupportedFeatures = [] GpuSupportedLimits = [] +GpuTexelCopyBufferInfo = [] +GpuTexelCopyBufferLayout = [] +GpuTexelCopyTextureInfo = [] GpuTexture = [] GpuTextureAspect = [] GpuTextureBindingLayout = [] diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index 7fb2fb756a2..426b59447fc 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -189,7 +189,7 @@ extern "C" { ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -205,10 +205,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -224,10 +224,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: u32, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -243,10 +243,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -262,10 +262,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: f64, size: u32, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -281,10 +281,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -300,10 +300,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: u32, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -319,10 +319,10 @@ extern "C" { destination: &GpuBuffer, destination_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] + # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)] #[doc = "The `copyBufferToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"] @@ -338,115 +338,121 @@ extern "C" { destination: &GpuBuffer, destination_offset: f64, size: f64, - ); + ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))] + #[cfg(all( + feature = "GpuTexelCopyBufferInfo", + feature = "GpuTexelCopyTextureInfo", + ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] #[doc = "The `copyBufferToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_buffer_to_texture_with_u32_sequence( this: &GpuCommandEncoder, - source: &GpuImageCopyBuffer, - destination: &GpuImageCopyTexture, + source: &GpuTexelCopyBufferInfo, + destination: &GpuTexelCopyTextureInfo, copy_size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", - feature = "GpuImageCopyBuffer", - feature = "GpuImageCopyTexture", + feature = "GpuTexelCopyBufferInfo", + feature = "GpuTexelCopyTextureInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)] #[doc = "The `copyBufferToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_buffer_to_texture_with_gpu_extent_3d_dict( this: &GpuCommandEncoder, - source: &GpuImageCopyBuffer, - destination: &GpuImageCopyTexture, + source: &GpuTexelCopyBufferInfo, + destination: &GpuTexelCopyTextureInfo, copy_size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))] + #[cfg(all( + feature = "GpuTexelCopyBufferInfo", + feature = "GpuTexelCopyTextureInfo", + ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] #[doc = "The `copyTextureToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_texture_to_buffer_with_u32_sequence( this: &GpuCommandEncoder, - source: &GpuImageCopyTexture, - destination: &GpuImageCopyBuffer, + source: &GpuTexelCopyTextureInfo, + destination: &GpuTexelCopyBufferInfo, copy_size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", - feature = "GpuImageCopyBuffer", - feature = "GpuImageCopyTexture", + feature = "GpuTexelCopyBufferInfo", + feature = "GpuTexelCopyTextureInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)] #[doc = "The `copyTextureToBuffer()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_texture_to_buffer_with_gpu_extent_3d_dict( this: &GpuCommandEncoder, - source: &GpuImageCopyTexture, - destination: &GpuImageCopyBuffer, + source: &GpuTexelCopyTextureInfo, + destination: &GpuTexelCopyBufferInfo, copy_size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuImageCopyTexture")] + #[cfg(feature = "GpuTexelCopyTextureInfo")] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] #[doc = "The `copyTextureToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_texture_to_texture_with_u32_sequence( this: &GpuCommandEncoder, - source: &GpuImageCopyTexture, - destination: &GpuImageCopyTexture, + source: &GpuTexelCopyTextureInfo, + destination: &GpuTexelCopyTextureInfo, copy_size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture",))] + #[cfg(all(feature = "GpuExtent3dDict", feature = "GpuTexelCopyTextureInfo",))] # [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)] #[doc = "The `copyTextureToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_texture_to_texture_with_gpu_extent_3d_dict( this: &GpuCommandEncoder, - source: &GpuImageCopyTexture, - destination: &GpuImageCopyTexture, + source: &GpuTexelCopyTextureInfo, + destination: &GpuTexelCopyTextureInfo, copy_size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs b/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs similarity index 80% rename from crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs rename to crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs index d0cc4179b3b..8233e356331 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTextureTagged.rs +++ b/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs @@ -5,116 +5,116 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUImageCopyTextureTagged)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCopyExternalImageDestInfo)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuImageCopyTextureTagged` dictionary."] + #[doc = "The `GpuCopyExternalImageDestInfo` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuImageCopyTextureTagged; + pub type GpuCopyExternalImageDestInfo; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Get the `aspect` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTextureAspect`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuTextureAspect`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "aspect")] - pub fn get_aspect(this: &GpuImageCopyTextureTagged) -> Option; + pub fn get_aspect(this: &GpuCopyExternalImageDestInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Change the `aspect` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTextureAspect`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuTextureAspect`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "aspect")] - pub fn set_aspect(this: &GpuImageCopyTextureTagged, val: GpuTextureAspect); + pub fn set_aspect(this: &GpuCopyExternalImageDestInfo, val: GpuTextureAspect); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `mipLevel` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "mipLevel")] - pub fn get_mip_level(this: &GpuImageCopyTextureTagged) -> Option; + pub fn get_mip_level(this: &GpuCopyExternalImageDestInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mipLevel` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mipLevel")] - pub fn set_mip_level(this: &GpuImageCopyTextureTagged, val: u32); + pub fn set_mip_level(this: &GpuCopyExternalImageDestInfo, val: u32); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &GpuImageCopyTextureTagged) -> ::wasm_bindgen::JsValue; + pub fn get_origin(this: &GpuCopyExternalImageDestInfo) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "origin")] - pub fn set_origin(this: &GpuImageCopyTextureTagged, val: &::wasm_bindgen::JsValue); + pub fn set_origin(this: &GpuCopyExternalImageDestInfo, val: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] #[doc = "Get the `texture` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "texture")] - pub fn get_texture(this: &GpuImageCopyTextureTagged) -> GpuTexture; + pub fn get_texture(this: &GpuCopyExternalImageDestInfo) -> GpuTexture; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] #[doc = "Change the `texture` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "texture")] - pub fn set_texture(this: &GpuImageCopyTextureTagged, val: &GpuTexture); + pub fn set_texture(this: &GpuCopyExternalImageDestInfo, val: &GpuTexture); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `premultipliedAlpha` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "premultipliedAlpha")] - pub fn get_premultiplied_alpha(this: &GpuImageCopyTextureTagged) -> Option; + pub fn get_premultiplied_alpha(this: &GpuCopyExternalImageDestInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `premultipliedAlpha` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "premultipliedAlpha")] - pub fn set_premultiplied_alpha(this: &GpuImageCopyTextureTagged, val: bool); + pub fn set_premultiplied_alpha(this: &GpuCopyExternalImageDestInfo, val: bool); } #[cfg(web_sys_unstable_apis)] -impl GpuImageCopyTextureTagged { +impl GpuCopyExternalImageDestInfo { #[cfg(feature = "GpuTexture")] - #[doc = "Construct a new `GpuImageCopyTextureTagged`."] + #[doc = "Construct a new `GpuCopyExternalImageDestInfo`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTextureTagged`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs b/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs similarity index 79% rename from crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs rename to crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs index c471c154757..6e1ed36f7aa 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyExternalImage.rs +++ b/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs @@ -5,75 +5,75 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUImageCopyExternalImage)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCopyExternalImageSourceInfo)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuImageCopyExternalImage` dictionary."] + #[doc = "The `GpuCopyExternalImageSourceInfo` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuImageCopyExternalImage; + pub type GpuCopyExternalImageSourceInfo; #[cfg(web_sys_unstable_apis)] #[doc = "Get the `flipY` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "flipY")] - pub fn get_flip_y(this: &GpuImageCopyExternalImage) -> Option; + pub fn get_flip_y(this: &GpuCopyExternalImageSourceInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `flipY` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "flipY")] - pub fn set_flip_y(this: &GpuImageCopyExternalImage, val: bool); + pub fn set_flip_y(this: &GpuCopyExternalImageSourceInfo, val: bool); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &GpuImageCopyExternalImage) -> ::wasm_bindgen::JsValue; + pub fn get_origin(this: &GpuCopyExternalImageSourceInfo) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "origin")] - pub fn set_origin(this: &GpuImageCopyExternalImage, val: &::wasm_bindgen::JsValue); + pub fn set_origin(this: &GpuCopyExternalImageSourceInfo, val: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `source` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "source")] - pub fn get_source(this: &GpuImageCopyExternalImage) -> ::js_sys::Object; + pub fn get_source(this: &GpuCopyExternalImageSourceInfo) -> ::js_sys::Object; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `source` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "source")] - pub fn set_source(this: &GpuImageCopyExternalImage, val: &::js_sys::Object); + pub fn set_source(this: &GpuCopyExternalImageSourceInfo, val: &::js_sys::Object); } #[cfg(web_sys_unstable_apis)] -impl GpuImageCopyExternalImage { - #[doc = "Construct a new `GpuImageCopyExternalImage`."] +impl GpuCopyExternalImageSourceInfo { + #[doc = "Construct a new `GpuCopyExternalImageSourceInfo`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageSourceInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index 5ad2483befc..eadade16939 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -41,6 +41,18 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn limits(this: &GpuDevice) -> GpuSupportedLimits; #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuAdapterInfo")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = adapterInfo)] + #[doc = "Getter for the `adapterInfo` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/adapterInfo)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterInfo`, `GpuDevice`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn adapter_info(this: &GpuDevice) -> GpuAdapterInfo; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuQueue")] # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = queue)] #[doc = "Getter for the `queue` field of this object."] diff --git a/crates/web-sys/src/features/gen_GpuFeatureName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs index 4f30f43434c..b4bbf30a2b3 100644 --- a/crates/web-sys/src/features/gen_GpuFeatureName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -24,6 +24,7 @@ pub enum GpuFeatureName { Rg11b10ufloatRenderable = "rg11b10ufloat-renderable", Bgra8unormStorage = "bgra8unorm-storage", Float32Filterable = "float32-filterable", + Float32Blendable = "float32-blendable", ClipDistances = "clip-distances", DualSourceBlending = "dual-source-blending", } diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index e33c2394648..70087a2f665 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -40,43 +40,43 @@ extern "C" { pub fn set_label(this: &GpuQueue, value: &str); #[cfg(web_sys_unstable_apis)] #[cfg(all( - feature = "GpuImageCopyExternalImage", - feature = "GpuImageCopyTextureTagged", + feature = "GpuCopyExternalImageDestInfo", + feature = "GpuCopyExternalImageSourceInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] #[doc = "The `copyExternalImageToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyExternalImage`, `GpuImageCopyTextureTagged`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuCopyExternalImageSourceInfo`, `GpuQueue`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_external_image_to_texture_with_u32_sequence( this: &GpuQueue, - source: &GpuImageCopyExternalImage, - destination: &GpuImageCopyTextureTagged, + source: &GpuCopyExternalImageSourceInfo, + destination: &GpuCopyExternalImageDestInfo, copy_size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( + feature = "GpuCopyExternalImageDestInfo", + feature = "GpuCopyExternalImageSourceInfo", feature = "GpuExtent3dDict", - feature = "GpuImageCopyExternalImage", - feature = "GpuImageCopyTextureTagged", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = copyExternalImageToTexture)] #[doc = "The `copyExternalImageToTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/copyExternalImageToTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuImageCopyExternalImage`, `GpuImageCopyTextureTagged`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuCopyExternalImageDestInfo`, `GpuCopyExternalImageSourceInfo`, `GpuExtent3dDict`, `GpuQueue`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn copy_external_image_to_texture_with_gpu_extent_3d_dict( this: &GpuQueue, - source: &GpuImageCopyExternalImage, - destination: &GpuImageCopyTextureTagged, + source: &GpuCopyExternalImageSourceInfo, + destination: &GpuCopyExternalImageDestInfo, copy_size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] @@ -876,123 +876,132 @@ extern "C" { size: f64, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] + #[cfg(all( + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", + ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_buffer_source_and_u32_sequence( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &::js_sys::Object, - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] + #[cfg(all( + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", + ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_u8_slice_and_u32_sequence( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &[u8], - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] - #[cfg(all(feature = "GpuImageCopyTexture", feature = "GpuImageDataLayout",))] + #[cfg(all( + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", + ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_u8_array_and_u32_sequence( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &::js_sys::Uint8Array, - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &::wasm_bindgen::JsValue, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", - feature = "GpuImageCopyTexture", - feature = "GpuImageDataLayout", + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_buffer_source_and_gpu_extent_3d_dict( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &::js_sys::Object, - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", - feature = "GpuImageCopyTexture", - feature = "GpuImageDataLayout", + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_u8_slice_and_gpu_extent_3d_dict( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &[u8], - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &GpuExtent3dDict, ) -> Result<(), JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "GpuExtent3dDict", - feature = "GpuImageCopyTexture", - feature = "GpuImageDataLayout", + feature = "GpuTexelCopyBufferLayout", + feature = "GpuTexelCopyTextureInfo", ))] # [wasm_bindgen (catch , method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuImageCopyTexture`, `GpuImageDataLayout`, `GpuQueue`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuQueue`, `GpuTexelCopyBufferLayout`, `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn write_texture_with_u8_array_and_gpu_extent_3d_dict( this: &GpuQueue, - destination: &GpuImageCopyTexture, + destination: &GpuTexelCopyTextureInfo, data: &::js_sys::Uint8Array, - data_layout: &GpuImageDataLayout, + data_layout: &GpuTexelCopyBufferLayout, size: &GpuExtent3dDict, ) -> Result<(), JsValue>; } diff --git a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs index cba26922c2b..9148d88bf0e 100644 --- a/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs +++ b/crates/web-sys/src/features/gen_GpuRequestAdapterOptions.rs @@ -70,6 +70,24 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "powerPreference")] pub fn set_power_preference(this: &GpuRequestAdapterOptions, val: GpuPowerPreference); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `xrCompatible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "xrCompatible")] + pub fn get_xr_compatible(this: &GpuRequestAdapterOptions) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `xrCompatible` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "xrCompatible")] + pub fn set_xr_compatible(this: &GpuRequestAdapterOptions, val: bool); } #[cfg(web_sys_unstable_apis)] impl GpuRequestAdapterOptions { @@ -103,6 +121,12 @@ impl GpuRequestAdapterOptions { self.set_power_preference(val); self } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_xr_compatible()` instead."] + pub fn xr_compatible(&mut self, val: bool) -> &mut Self { + self.set_xr_compatible(val); + self + } } #[cfg(web_sys_unstable_apis)] impl Default for GpuRequestAdapterOptions { diff --git a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs b/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs similarity index 82% rename from crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs rename to crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs index 153b4004980..a950be4a318 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs @@ -5,96 +5,96 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUImageCopyBuffer)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUTexelCopyBufferInfo)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuImageCopyBuffer` dictionary."] + #[doc = "The `GpuTexelCopyBufferInfo` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuImageCopyBuffer; + pub type GpuTexelCopyBufferInfo; #[cfg(web_sys_unstable_apis)] #[doc = "Get the `bytesPerRow` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "bytesPerRow")] - pub fn get_bytes_per_row(this: &GpuImageCopyBuffer) -> Option; + pub fn get_bytes_per_row(this: &GpuTexelCopyBufferInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesPerRow` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bytesPerRow")] - pub fn set_bytes_per_row(this: &GpuImageCopyBuffer, val: u32); + pub fn set_bytes_per_row(this: &GpuTexelCopyBufferInfo, val: u32); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `offset` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "offset")] - pub fn get_offset(this: &GpuImageCopyBuffer) -> Option; + pub fn get_offset(this: &GpuTexelCopyBufferInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `offset` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - pub fn set_offset(this: &GpuImageCopyBuffer, val: f64); + pub fn set_offset(this: &GpuTexelCopyBufferInfo, val: f64); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `rowsPerImage` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "rowsPerImage")] - pub fn get_rows_per_image(this: &GpuImageCopyBuffer) -> Option; + pub fn get_rows_per_image(this: &GpuTexelCopyBufferInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rowsPerImage` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "rowsPerImage")] - pub fn set_rows_per_image(this: &GpuImageCopyBuffer, val: u32); + pub fn set_rows_per_image(this: &GpuTexelCopyBufferInfo, val: u32); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] #[doc = "Get the `buffer` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "buffer")] - pub fn get_buffer(this: &GpuImageCopyBuffer) -> GpuBuffer; + pub fn get_buffer(this: &GpuTexelCopyBufferInfo) -> GpuBuffer; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] #[doc = "Change the `buffer` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "buffer")] - pub fn set_buffer(this: &GpuImageCopyBuffer, val: &GpuBuffer); + pub fn set_buffer(this: &GpuTexelCopyBufferInfo, val: &GpuBuffer); } #[cfg(web_sys_unstable_apis)] -impl GpuImageCopyBuffer { +impl GpuTexelCopyBufferInfo { #[cfg(feature = "GpuBuffer")] - #[doc = "Construct a new `GpuImageCopyBuffer`."] + #[doc = "Construct a new `GpuTexelCopyBufferInfo`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuImageCopyBuffer`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuTexelCopyBufferInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs b/crates/web-sys/src/features/gen_GpuTexelCopyBufferLayout.rs similarity index 81% rename from crates/web-sys/src/features/gen_GpuImageDataLayout.rs rename to crates/web-sys/src/features/gen_GpuTexelCopyBufferLayout.rs index c0ecc701835..20d5229944f 100644 --- a/crates/web-sys/src/features/gen_GpuImageDataLayout.rs +++ b/crates/web-sys/src/features/gen_GpuTexelCopyBufferLayout.rs @@ -5,75 +5,75 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUImageDataLayout)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUTexelCopyBufferLayout)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuImageDataLayout` dictionary."] + #[doc = "The `GpuTexelCopyBufferLayout` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuImageDataLayout; + pub type GpuTexelCopyBufferLayout; #[cfg(web_sys_unstable_apis)] #[doc = "Get the `bytesPerRow` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "bytesPerRow")] - pub fn get_bytes_per_row(this: &GpuImageDataLayout) -> Option; + pub fn get_bytes_per_row(this: &GpuTexelCopyBufferLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `bytesPerRow` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "bytesPerRow")] - pub fn set_bytes_per_row(this: &GpuImageDataLayout, val: u32); + pub fn set_bytes_per_row(this: &GpuTexelCopyBufferLayout, val: u32); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `offset` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "offset")] - pub fn get_offset(this: &GpuImageDataLayout) -> Option; + pub fn get_offset(this: &GpuTexelCopyBufferLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `offset` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "offset")] - pub fn set_offset(this: &GpuImageDataLayout, val: f64); + pub fn set_offset(this: &GpuTexelCopyBufferLayout, val: f64); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `rowsPerImage` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "rowsPerImage")] - pub fn get_rows_per_image(this: &GpuImageDataLayout) -> Option; + pub fn get_rows_per_image(this: &GpuTexelCopyBufferLayout) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `rowsPerImage` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "rowsPerImage")] - pub fn set_rows_per_image(this: &GpuImageDataLayout, val: u32); + pub fn set_rows_per_image(this: &GpuTexelCopyBufferLayout, val: u32); } #[cfg(web_sys_unstable_apis)] -impl GpuImageDataLayout { - #[doc = "Construct a new `GpuImageDataLayout`."] +impl GpuTexelCopyBufferLayout { + #[doc = "Construct a new `GpuTexelCopyBufferLayout`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageDataLayout`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyBufferLayout`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] @@ -102,7 +102,7 @@ impl GpuImageDataLayout { } } #[cfg(web_sys_unstable_apis)] -impl Default for GpuImageDataLayout { +impl Default for GpuTexelCopyBufferLayout { fn default() -> Self { Self::new() } diff --git a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs b/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs similarity index 81% rename from crates/web-sys/src/features/gen_GpuImageCopyTexture.rs rename to crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs index 96b81683bf3..b57011e67a5 100644 --- a/crates/web-sys/src/features/gen_GpuImageCopyTexture.rs +++ b/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs @@ -5,98 +5,98 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUImageCopyTexture)] + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUTexelCopyTextureInfo)] #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GpuImageCopyTexture` dictionary."] + #[doc = "The `GpuTexelCopyTextureInfo` dictionary."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub type GpuImageCopyTexture; + pub type GpuTexelCopyTextureInfo; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Get the `aspect` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTextureAspect`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`, `GpuTextureAspect`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "aspect")] - pub fn get_aspect(this: &GpuImageCopyTexture) -> Option; + pub fn get_aspect(this: &GpuTexelCopyTextureInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTextureAspect")] #[doc = "Change the `aspect` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTextureAspect`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`, `GpuTextureAspect`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "aspect")] - pub fn set_aspect(this: &GpuImageCopyTexture, val: GpuTextureAspect); + pub fn set_aspect(this: &GpuTexelCopyTextureInfo, val: GpuTextureAspect); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `mipLevel` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "mipLevel")] - pub fn get_mip_level(this: &GpuImageCopyTexture) -> Option; + pub fn get_mip_level(this: &GpuTexelCopyTextureInfo) -> Option; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `mipLevel` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "mipLevel")] - pub fn set_mip_level(this: &GpuImageCopyTexture, val: u32); + pub fn set_mip_level(this: &GpuTexelCopyTextureInfo, val: u32); #[cfg(web_sys_unstable_apis)] #[doc = "Get the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "origin")] - pub fn get_origin(this: &GpuImageCopyTexture) -> ::wasm_bindgen::JsValue; + pub fn get_origin(this: &GpuTexelCopyTextureInfo) -> ::wasm_bindgen::JsValue; #[cfg(web_sys_unstable_apis)] #[doc = "Change the `origin` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "origin")] - pub fn set_origin(this: &GpuImageCopyTexture, val: &::wasm_bindgen::JsValue); + pub fn set_origin(this: &GpuTexelCopyTextureInfo, val: &::wasm_bindgen::JsValue); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] #[doc = "Get the `texture` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, getter = "texture")] - pub fn get_texture(this: &GpuImageCopyTexture) -> GpuTexture; + pub fn get_texture(this: &GpuTexelCopyTextureInfo) -> GpuTexture; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuTexture")] #[doc = "Change the `texture` field of this object."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[wasm_bindgen(method, setter = "texture")] - pub fn set_texture(this: &GpuImageCopyTexture, val: &GpuTexture); + pub fn set_texture(this: &GpuTexelCopyTextureInfo, val: &GpuTexture); } #[cfg(web_sys_unstable_apis)] -impl GpuImageCopyTexture { +impl GpuTexelCopyTextureInfo { #[cfg(feature = "GpuTexture")] - #[doc = "Construct a new `GpuImageCopyTexture`."] + #[doc = "Construct a new `GpuTexelCopyTextureInfo`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuImageCopyTexture`, `GpuTexture`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuTexelCopyTextureInfo`, `GpuTexture`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] diff --git a/crates/web-sys/src/features/gen_GpuVertexFormat.rs b/crates/web-sys/src/features/gen_GpuVertexFormat.rs index 783adc5387f..9c380d45895 100644 --- a/crates/web-sys/src/features/gen_GpuVertexFormat.rs +++ b/crates/web-sys/src/features/gen_GpuVertexFormat.rs @@ -11,22 +11,31 @@ use wasm_bindgen::prelude::*; #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuVertexFormat { + Uint8 = "uint8", Uint8x2 = "uint8x2", Uint8x4 = "uint8x4", + Sint8 = "sint8", Sint8x2 = "sint8x2", Sint8x4 = "sint8x4", + Unorm8 = "unorm8", Unorm8x2 = "unorm8x2", Unorm8x4 = "unorm8x4", + Snorm8 = "snorm8", Snorm8x2 = "snorm8x2", Snorm8x4 = "snorm8x4", + Uint16 = "uint16", Uint16x2 = "uint16x2", Uint16x4 = "uint16x4", + Sint16 = "sint16", Sint16x2 = "sint16x2", Sint16x4 = "sint16x4", + Unorm16 = "unorm16", Unorm16x2 = "unorm16x2", Unorm16x4 = "unorm16x4", + Snorm16 = "snorm16", Snorm16x2 = "snorm16x2", Snorm16x4 = "snorm16x4", + Float16 = "float16", Float16x2 = "float16x2", Float16x4 = "float16x4", Float32 = "float32", @@ -42,4 +51,5 @@ pub enum GpuVertexFormat { Sint32x3 = "sint32x3", Sint32x4 = "sint32x4", Unorm1010102 = "unorm10-10-10-2", + Unorm8x4Bgra = "unorm8x4-bgra", } diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index a22df0488a5..4ffc9995e6f 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -3323,6 +3323,20 @@ mod gen_GpuComputePipelineDescriptor; #[allow(unused_imports)] pub use gen_GpuComputePipelineDescriptor::*; +#[cfg(feature = "GpuCopyExternalImageDestInfo")] +#[allow(non_snake_case)] +mod gen_GpuCopyExternalImageDestInfo; +#[cfg(feature = "GpuCopyExternalImageDestInfo")] +#[allow(unused_imports)] +pub use gen_GpuCopyExternalImageDestInfo::*; + +#[cfg(feature = "GpuCopyExternalImageSourceInfo")] +#[allow(non_snake_case)] +mod gen_GpuCopyExternalImageSourceInfo; +#[cfg(feature = "GpuCopyExternalImageSourceInfo")] +#[allow(unused_imports)] +pub use gen_GpuCopyExternalImageSourceInfo::*; + #[cfg(feature = "GpuCullMode")] #[allow(non_snake_case)] mod gen_GpuCullMode; @@ -3435,41 +3449,6 @@ mod gen_GpuFrontFace; #[allow(unused_imports)] pub use gen_GpuFrontFace::*; -#[cfg(feature = "GpuImageCopyBuffer")] -#[allow(non_snake_case)] -mod gen_GpuImageCopyBuffer; -#[cfg(feature = "GpuImageCopyBuffer")] -#[allow(unused_imports)] -pub use gen_GpuImageCopyBuffer::*; - -#[cfg(feature = "GpuImageCopyExternalImage")] -#[allow(non_snake_case)] -mod gen_GpuImageCopyExternalImage; -#[cfg(feature = "GpuImageCopyExternalImage")] -#[allow(unused_imports)] -pub use gen_GpuImageCopyExternalImage::*; - -#[cfg(feature = "GpuImageCopyTexture")] -#[allow(non_snake_case)] -mod gen_GpuImageCopyTexture; -#[cfg(feature = "GpuImageCopyTexture")] -#[allow(unused_imports)] -pub use gen_GpuImageCopyTexture::*; - -#[cfg(feature = "GpuImageCopyTextureTagged")] -#[allow(non_snake_case)] -mod gen_GpuImageCopyTextureTagged; -#[cfg(feature = "GpuImageCopyTextureTagged")] -#[allow(unused_imports)] -pub use gen_GpuImageCopyTextureTagged::*; - -#[cfg(feature = "GpuImageDataLayout")] -#[allow(non_snake_case)] -mod gen_GpuImageDataLayout; -#[cfg(feature = "GpuImageDataLayout")] -#[allow(unused_imports)] -pub use gen_GpuImageDataLayout::*; - #[cfg(feature = "GpuIndexFormat")] #[allow(non_snake_case)] mod gen_GpuIndexFormat; @@ -3827,6 +3806,27 @@ mod gen_GpuSupportedLimits; #[allow(unused_imports)] pub use gen_GpuSupportedLimits::*; +#[cfg(feature = "GpuTexelCopyBufferInfo")] +#[allow(non_snake_case)] +mod gen_GpuTexelCopyBufferInfo; +#[cfg(feature = "GpuTexelCopyBufferInfo")] +#[allow(unused_imports)] +pub use gen_GpuTexelCopyBufferInfo::*; + +#[cfg(feature = "GpuTexelCopyBufferLayout")] +#[allow(non_snake_case)] +mod gen_GpuTexelCopyBufferLayout; +#[cfg(feature = "GpuTexelCopyBufferLayout")] +#[allow(unused_imports)] +pub use gen_GpuTexelCopyBufferLayout::*; + +#[cfg(feature = "GpuTexelCopyTextureInfo")] +#[allow(non_snake_case)] +mod gen_GpuTexelCopyTextureInfo; +#[cfg(feature = "GpuTexelCopyTextureInfo")] +#[allow(unused_imports)] +pub use gen_GpuTexelCopyTextureInfo::*; + #[cfg(feature = "GpuTexture")] #[allow(non_snake_case)] mod gen_GpuTexture; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index c5b6912b231..56e8130ab1c 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -1,4 +1,4 @@ -// https://www.w3.org/TR/2024/WD-webgpu-20241007 +// https://www.w3.org/TR/2024/WD-webgpu-20241122/ interface mixin GPUObjectBase { attribute USVString label; @@ -75,9 +75,10 @@ interface GPU { }; dictionary GPURequestAdapterOptions { - DOMString featureLevel; + DOMString featureLevel = "core"; GPUPowerPreference powerPreference; boolean forceFallbackAdapter = false; + boolean xrCompatible = false; }; enum GPUPowerPreference { @@ -116,6 +117,7 @@ enum GPUFeatureName { "rg11b10ufloat-renderable", "bgra8unorm-storage", "float32-filterable", + "float32-blendable", "clip-distances", "dual-source-blending", }; @@ -124,6 +126,7 @@ enum GPUFeatureName { interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; + [SameObject] readonly attribute GPUAdapterInfo adapterInfo; [SameObject] readonly attribute GPUQueue queue; @@ -575,7 +578,7 @@ GPUPipelineLayout includes GPUObjectBase; dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { - required sequence bindGroupLayouts; + required sequence bindGroupLayouts; }; [Exposed=(Window, Worker), SecureContext] @@ -815,22 +818,31 @@ enum GPUIndexFormat { }; enum GPUVertexFormat { + "uint8", "uint8x2", "uint8x4", + "sint8", "sint8x2", "sint8x4", + "unorm8", "unorm8x2", "unorm8x4", + "snorm8", "snorm8x2", "snorm8x4", + "uint16", "uint16x2", "uint16x4", + "sint16", "sint16x2", "sint16x4", + "unorm16", "unorm16x2", "unorm16x4", + "snorm16", "snorm16x2", "snorm16x4", + "float16", "float16x2", "float16x4", "float32", @@ -846,6 +858,7 @@ enum GPUVertexFormat { "sint32x3", "sint32x4", "unorm10-10-10-2", + "unorm8x4-bgra", }; enum GPUVertexStepMode { @@ -871,26 +884,26 @@ dictionary GPUVertexAttribute { required GPUIndex32 shaderLocation; }; -dictionary GPUImageDataLayout { +dictionary GPUTexelCopyBufferLayout { GPUSize64 offset = 0; GPUSize32 bytesPerRow; GPUSize32 rowsPerImage; }; -dictionary GPUImageCopyBuffer - : GPUImageDataLayout { +dictionary GPUTexelCopyBufferInfo + : GPUTexelCopyBufferLayout { required GPUBuffer buffer; }; -dictionary GPUImageCopyTexture { +dictionary GPUTexelCopyTextureInfo { required GPUTexture texture; GPUIntegerCoordinate mipLevel = 0; GPUOrigin3D origin = {}; GPUTextureAspect aspect = "all"; }; -dictionary GPUImageCopyTextureTagged - : GPUImageCopyTexture { +dictionary GPUCopyExternalImageDestInfo + : GPUTexelCopyTextureInfo { PredefinedColorSpace colorSpace = "srgb"; boolean premultipliedAlpha = false; }; @@ -901,10 +914,10 @@ typedef (ImageBitmap or HTMLVideoElement or VideoFrame or HTMLCanvasElement or - OffscreenCanvas) GPUImageCopyExternalImageSource; + OffscreenCanvas) GPUCopyExternalImageSource; -dictionary GPUImageCopyExternalImage { - required GPUImageCopyExternalImageSource source; +dictionary GPUCopyExternalImageSourceInfo { + required GPUCopyExternalImageSource source; GPUOrigin2D origin = {}; boolean flipY = false; }; @@ -927,6 +940,7 @@ interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); + [Throws] undefined copyBufferToBuffer( GPUBuffer source, GPUSize64 sourceOffset, @@ -936,20 +950,20 @@ interface GPUCommandEncoder { [Throws] undefined copyBufferToTexture( - GPUImageCopyBuffer source, - GPUImageCopyTexture destination, + GPUTexelCopyBufferInfo source, + GPUTexelCopyTextureInfo destination, GPUExtent3D copySize); [Throws] undefined copyTextureToBuffer( - GPUImageCopyTexture source, - GPUImageCopyBuffer destination, + GPUTexelCopyTextureInfo source, + GPUTexelCopyBufferInfo destination, GPUExtent3D copySize); [Throws] undefined copyTextureToTexture( - GPUImageCopyTexture source, - GPUImageCopyTexture destination, + GPUTexelCopyTextureInfo source, + GPUTexelCopyTextureInfo destination, GPUExtent3D copySize); undefined clearBuffer( @@ -1158,15 +1172,15 @@ interface GPUQueue { [Throws] undefined writeTexture( - GPUImageCopyTexture destination, + GPUTexelCopyTextureInfo destination, AllowSharedBufferSource data, - GPUImageDataLayout dataLayout, + GPUTexelCopyBufferLayout dataLayout, GPUExtent3D size); [Throws] undefined copyExternalImageToTexture( - GPUImageCopyExternalImage source, - GPUImageCopyTextureTagged destination, + GPUCopyExternalImageSourceInfo source, + GPUCopyExternalImageDestInfo destination, GPUExtent3D copySize); }; GPUQueue includes GPUObjectBase; @@ -1291,7 +1305,6 @@ dictionary GPUUncapturedErrorEventInit : EventInit { }; partial interface GPUDevice { - [Exposed=(Window, Worker)] attribute EventHandler onuncapturederror; }; From bd735142615d81106b434df6648bc3ef0795e371 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 28 Nov 2024 21:32:50 +0100 Subject: [PATCH 571/641] Add test for most data conversions (#4281) --- crates/cli/tests/reference/echo.d.ts | 61 ++ crates/cli/tests/reference/echo.js | 1041 ++++++++++++++++++++++++++ crates/cli/tests/reference/echo.rs | 76 ++ crates/cli/tests/reference/echo.wat | 149 ++++ 4 files changed, 1327 insertions(+) create mode 100644 crates/cli/tests/reference/echo.d.ts create mode 100644 crates/cli/tests/reference/echo.js create mode 100644 crates/cli/tests/reference/echo.rs create mode 100644 crates/cli/tests/reference/echo.wat diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts new file mode 100644 index 00000000000..d5b187aa985 --- /dev/null +++ b/crates/cli/tests/reference/echo.d.ts @@ -0,0 +1,61 @@ +/* tslint:disable */ +/* eslint-disable */ +export function echo_u8(a: number): number; +export function echo_i8(a: number): number; +export function echo_u16(a: number): number; +export function echo_i16(a: number): number; +export function echo_u32(a: number): number; +export function echo_i32(a: number): number; +export function echo_u64(a: bigint): bigint; +export function echo_i64(a: bigint): bigint; +export function echo_u128(a: bigint): bigint; +export function echo_i128(a: bigint): bigint; +export function echo_usize(a: number): number; +export function echo_isize(a: number): number; +export function echo_f32(a: number): number; +export function echo_f64(a: number): number; +export function echo_bool(a: boolean): boolean; +export function echo_char(a: string): string; +export function echo_string(a: string): string; +export function echo_vec_u8(a: Uint8Array): Uint8Array; +export function echo_vec_i8(a: Int8Array): Int8Array; +export function echo_vec_u16(a: Uint16Array): Uint16Array; +export function echo_vec_i16(a: Int16Array): Int16Array; +export function echo_vec_u32(a: Uint32Array): Uint32Array; +export function echo_vec_i32(a: Int32Array): Int32Array; +export function echo_vec_u64(a: BigUint64Array): BigUint64Array; +export function echo_vec_i64(a: BigInt64Array): BigInt64Array; +export function echo_vec_string(a: (string)[]): (string)[]; +export function echo_struct(a: Foo): Foo; +export function echo_vec_struct(a: (Foo)[]): (Foo)[]; +export function echo_option_u8(a?: number): number | undefined; +export function echo_option_i8(a?: number): number | undefined; +export function echo_option_u16(a?: number): number | undefined; +export function echo_option_i16(a?: number): number | undefined; +export function echo_option_u32(a?: number): number | undefined; +export function echo_option_i32(a?: number): number | undefined; +export function echo_option_u64(a?: bigint): bigint | undefined; +export function echo_option_i64(a?: bigint): bigint | undefined; +export function echo_option_u128(a?: bigint): bigint | undefined; +export function echo_option_i128(a?: bigint): bigint | undefined; +export function echo_option_usize(a?: number): number | undefined; +export function echo_option_isize(a?: number): number | undefined; +export function echo_option_f32(a?: number): number | undefined; +export function echo_option_f64(a?: number): number | undefined; +export function echo_option_bool(a?: boolean): boolean | undefined; +export function echo_option_char(a?: string): string | undefined; +export function echo_option_string(a?: string): string | undefined; +export function echo_option_vec_u8(a?: Uint8Array): Uint8Array | undefined; +export function echo_option_vec_i8(a?: Int8Array): Int8Array | undefined; +export function echo_option_vec_u16(a?: Uint16Array): Uint16Array | undefined; +export function echo_option_vec_i16(a?: Int16Array): Int16Array | undefined; +export function echo_option_vec_u32(a?: Uint32Array): Uint32Array | undefined; +export function echo_option_vec_i32(a?: Int32Array): Int32Array | undefined; +export function echo_option_vec_u64(a?: BigUint64Array): BigUint64Array | undefined; +export function echo_option_vec_i64(a?: BigInt64Array): BigInt64Array | undefined; +export function echo_option_vec_string(a?: (string)[]): (string)[] | undefined; +export function echo_option_struct(a?: Foo): Foo | undefined; +export function echo_option_vec_struct(a?: (Foo)[]): (Foo)[] | undefined; +export class Foo { + free(): void; +} diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js new file mode 100644 index 00000000000..f2eb7da3e3b --- /dev/null +++ b/crates/cli/tests/reference/echo.js @@ -0,0 +1,1041 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches && builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +let WASM_VECTOR_LEN = 0; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; + +let cachedTextEncoder = new lTextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} +/** + * @param {number} a + * @returns {number} + */ +export function echo_u8(a) { + const ret = wasm.echo_u8(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i8(a) { + const ret = wasm.echo_i8(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_u16(a) { + const ret = wasm.echo_u16(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i16(a) { + const ret = wasm.echo_i16(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_u32(a) { + const ret = wasm.echo_u32(a); + return ret >>> 0; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i32(a) { + const ret = wasm.echo_i32(a); + return ret; +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_u64(a) { + const ret = wasm.echo_u64(a); + return BigInt.asUintN(64, ret); +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_i64(a) { + const ret = wasm.echo_i64(a); + return ret; +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_u128(a) { + const ret = wasm.echo_u128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64))); +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_i128(a) { + const ret = wasm.echo_i128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64))); +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_usize(a) { + const ret = wasm.echo_usize(a); + return ret >>> 0; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_isize(a) { + const ret = wasm.echo_isize(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_f32(a) { + const ret = wasm.echo_f32(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_f64(a) { + const ret = wasm.echo_f64(a); + return ret; +} + +/** + * @param {boolean} a + * @returns {boolean} + */ +export function echo_bool(a) { + const ret = wasm.echo_bool(a); + return ret !== 0; +} + +function _assertChar(c) { + if (typeof(c) === 'number' && (c >= 0x110000 || (c >= 0xD800 && c < 0xE000))) throw new Error(`expected a valid Unicode scalar value, found ${c}`); +} +/** + * @param {string} a + * @returns {string} + */ +export function echo_char(a) { + const char0 = a.codePointAt(0); + _assertChar(char0); + const ret = wasm.echo_char(char0); + return String.fromCodePoint(ret); +} + +/** + * @param {string} a + * @returns {string} + */ +export function echo_string(a) { + let deferred2_0; + let deferred2_1; + try { + const ptr0 = passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_string(ptr0, len0); + deferred2_0 = ret[0]; + deferred2_1 = ret[1]; + return getStringFromWasm0(ret[0], ret[1]); + } finally { + wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); + } +} + +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} +/** + * @param {Uint8Array} a + * @returns {Uint8Array} + */ +export function echo_vec_u8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u8(ptr0, len0); + var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +let cachedInt8ArrayMemory0 = null; + +function getInt8ArrayMemory0() { + if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) { + cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer); + } + return cachedInt8ArrayMemory0; +} + +function getArrayI8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} +/** + * @param {Int8Array} a + * @returns {Int8Array} + */ +export function echo_vec_i8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i8(ptr0, len0); + var v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +let cachedUint16ArrayMemory0 = null; + +function getUint16ArrayMemory0() { + if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) { + cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer); + } + return cachedUint16ArrayMemory0; +} + +function passArray16ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 2, 2) >>> 0; + getUint16ArrayMemory0().set(arg, ptr / 2); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} +/** + * @param {Uint16Array} a + * @returns {Uint16Array} + */ +export function echo_vec_u16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u16(ptr0, len0); + var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +let cachedInt16ArrayMemory0 = null; + +function getInt16ArrayMemory0() { + if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) { + cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer); + } + return cachedInt16ArrayMemory0; +} + +function getArrayI16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} +/** + * @param {Int16Array} a + * @returns {Int16Array} + */ +export function echo_vec_i16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i16(ptr0, len0); + var v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +let cachedUint32ArrayMemory0 = null; + +function getUint32ArrayMemory0() { + if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) { + cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32ArrayMemory0; +} + +function passArray32ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 4, 4) >>> 0; + getUint32ArrayMemory0().set(arg, ptr / 4); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} +/** + * @param {Uint32Array} a + * @returns {Uint32Array} + */ +export function echo_vec_u32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u32(ptr0, len0); + var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +let cachedInt32ArrayMemory0 = null; + +function getInt32ArrayMemory0() { + if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) { + cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32ArrayMemory0; +} + +function getArrayI32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} +/** + * @param {Int32Array} a + * @returns {Int32Array} + */ +export function echo_vec_i32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i32(ptr0, len0); + var v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +let cachedBigUint64ArrayMemory0 = null; + +function getBigUint64ArrayMemory0() { + if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) { + cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer); + } + return cachedBigUint64ArrayMemory0; +} + +function passArray64ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 8, 8) >>> 0; + getBigUint64ArrayMemory0().set(arg, ptr / 8); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU64FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len); +} +/** + * @param {BigUint64Array} a + * @returns {BigUint64Array} + */ +export function echo_vec_u64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u64(ptr0, len0); + var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + +let cachedBigInt64ArrayMemory0 = null; + +function getBigInt64ArrayMemory0() { + if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) { + cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer); + } + return cachedBigInt64ArrayMemory0; +} + +function getArrayI64FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len); +} +/** + * @param {BigInt64Array} a + * @returns {BigInt64Array} + */ +export function echo_vec_i64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i64(ptr0, len0); + var v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); + return idx; +} + +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i = 0; i < array.length; i++) { + mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true))); + } + wasm.__externref_drop_slice(ptr, len); + return result; +} +/** + * @param {(string)[]} a + * @returns {(string)[]} + */ +export function echo_vec_string(a) { + const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_string(ptr0, len0); + var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +function _assertClass(instance, klass) { + if (!(instance instanceof klass)) { + throw new Error(`expected instance of ${klass.name}`); + } +} +/** + * @param {Foo} a + * @returns {Foo} + */ +export function echo_struct(a) { + _assertClass(a, Foo); + var ptr0 = a.__destroy_into_raw(); + const ret = wasm.echo_struct(ptr0); + return Foo.__wrap(ret); +} + +/** + * @param {(Foo)[]} a + * @returns {(Foo)[]} + */ +export function echo_vec_struct(a) { + const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_struct(ptr0, len0); + var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u8(a) { + const ret = wasm.echo_option_u8(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i8(a) { + const ret = wasm.echo_option_i8(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u16(a) { + const ret = wasm.echo_option_u16(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i16(a) { + const ret = wasm.echo_option_i16(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u32(a) { + const ret = wasm.echo_option_u32(isLikeNone(a) ? 0x100000001 : (a) >>> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i32(a) { + const ret = wasm.echo_option_i32(isLikeNone(a) ? 0x100000001 : (a) >> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_u64(a) { + const ret = wasm.echo_option_u64(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a); + return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]); +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_i64(a) { + const ret = wasm.echo_option_i64(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a); + return ret[0] === 0 ? undefined : ret[1]; +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_u128(a) { + const ret = wasm.echo_option_u128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_i128(a) { + const ret = wasm.echo_option_i128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (ret[2] << BigInt(64))); +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_usize(a) { + const ret = wasm.echo_option_usize(isLikeNone(a) ? 0x100000001 : (a) >>> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_isize(a) { + const ret = wasm.echo_option_isize(isLikeNone(a) ? 0x100000001 : (a) >> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_f32(a) { + const ret = wasm.echo_option_f32(isLikeNone(a) ? 0x100000001 : Math.fround(a)); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_f64(a) { + const ret = wasm.echo_option_f64(!isLikeNone(a), isLikeNone(a) ? 0 : a); + return ret[0] === 0 ? undefined : ret[1]; +} + +/** + * @param {boolean | undefined} [a] + * @returns {boolean | undefined} + */ +export function echo_option_bool(a) { + const ret = wasm.echo_option_bool(isLikeNone(a) ? 0xFFFFFF : a ? 1 : 0); + return ret === 0xFFFFFF ? undefined : ret !== 0; +} + +/** + * @param {string | undefined} [a] + * @returns {string | undefined} + */ +export function echo_option_char(a) { + const char0 = isLikeNone(a) ? 0xFFFFFF : a.codePointAt(0); + if (char0 !== 0xFFFFFF) { _assertChar(char0); } + const ret = wasm.echo_option_char(char0); + return ret === 0xFFFFFF ? undefined : String.fromCodePoint(ret); +} + +/** + * @param {string | undefined} [a] + * @returns {string | undefined} + */ +export function echo_option_string(a) { + var ptr0 = isLikeNone(a) ? 0 : passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_string(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getStringFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Uint8Array | undefined} [a] + * @returns {Uint8Array | undefined} + */ +export function echo_option_vec_u8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Int8Array | undefined} [a] + * @returns {Int8Array | undefined} + */ +export function echo_option_vec_i8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Uint16Array | undefined} [a] + * @returns {Uint16Array | undefined} + */ +export function echo_option_vec_u16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Int16Array | undefined} [a] + * @returns {Int16Array | undefined} + */ +export function echo_option_vec_i16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Uint32Array | undefined} [a] + * @returns {Uint32Array | undefined} + */ +export function echo_option_vec_u32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {Int32Array | undefined} [a] + * @returns {Int32Array | undefined} + */ +export function echo_option_vec_i32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {BigUint64Array | undefined} [a] + * @returns {BigUint64Array | undefined} + */ +export function echo_option_vec_u64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + +/** + * @param {BigInt64Array | undefined} [a] + * @returns {BigInt64Array | undefined} + */ +export function echo_option_vec_i64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + +/** + * @param {(string)[] | undefined} [a] + * @returns {(string)[] | undefined} + */ +export function echo_option_vec_string(a) { + var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_string(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {Foo | undefined} [a] + * @returns {Foo | undefined} + */ +export function echo_option_struct(a) { + let ptr0 = 0; + if (!isLikeNone(a)) { + _assertClass(a, Foo); + ptr0 = a.__destroy_into_raw(); + } + const ret = wasm.echo_option_struct(ptr0); + return ret === 0 ? undefined : Foo.__wrap(ret); +} + +/** + * @param {(Foo)[] | undefined} [a] + * @returns {(Foo)[] | undefined} + */ +export function echo_option_vec_struct(a) { + var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_struct(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +const FooFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_foo_free(ptr >>> 0, 1)); + +export class Foo { + + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(Foo.prototype); + obj.__wbg_ptr = ptr; + FooFinalization.register(obj, obj.__wbg_ptr, obj); + return obj; + } + + static __unwrap(jsValue) { + if (!(jsValue instanceof Foo)) { + return 0; + } + return jsValue.__destroy_into_raw(); + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + FooFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_foo_free(ptr, 0); + } +} + +export function __wbg_foo_new(arg0) { + const ret = Foo.__wrap(arg0); + return ret; +}; + +export function __wbg_foo_unwrap(arg0) { + const ret = Foo.__unwrap(arg0); + return ret; +}; + +export function __wbindgen_debug_string(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_string_get(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_string_new(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return ret; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/echo.rs b/crates/cli/tests/reference/echo.rs new file mode 100644 index 00000000000..bee663ec508 --- /dev/null +++ b/crates/cli/tests/reference/echo.rs @@ -0,0 +1,76 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct Foo { + x: u32, +} + +macro_rules! echo { + ($(($n:ident, $t:ty)),*) => { + $( + #[wasm_bindgen] + pub fn $n(a: $t) -> $t { + a + } + )* + } +} + +echo!( + (echo_u8, u8), + (echo_i8, i8), + (echo_u16, u16), + (echo_i16, i16), + (echo_u32, u32), + (echo_i32, i32), + (echo_u64, u64), + (echo_i64, i64), + (echo_u128, u128), + (echo_i128, i128), + (echo_usize, usize), + (echo_isize, isize), + (echo_f32, f32), + (echo_f64, f64), + (echo_bool, bool), + (echo_char, char), + (echo_string, String), + (echo_vec_u8, Vec), + (echo_vec_i8, Vec), + (echo_vec_u16, Vec), + (echo_vec_i16, Vec), + (echo_vec_u32, Vec), + (echo_vec_i32, Vec), + (echo_vec_u64, Vec), + (echo_vec_i64, Vec), + (echo_vec_string, Vec), + (echo_struct, Foo), + (echo_vec_struct, Vec), + (echo_option_u8, Option), + (echo_option_i8, Option), + (echo_option_u16, Option), + (echo_option_i16, Option), + (echo_option_u32, Option), + (echo_option_i32, Option), + (echo_option_u64, Option), + (echo_option_i64, Option), + (echo_option_u128, Option), + (echo_option_i128, Option), + (echo_option_usize, Option), + (echo_option_isize, Option), + (echo_option_f32, Option), + (echo_option_f64, Option), + (echo_option_bool, Option), + (echo_option_char, Option), + (echo_option_string, Option), + (echo_option_vec_u8, Option>), + (echo_option_vec_i8, Option>), + (echo_option_vec_u16, Option>), + (echo_option_vec_i16, Option>), + (echo_option_vec_u32, Option>), + (echo_option_vec_i32, Option>), + (echo_option_vec_u64, Option>), + (echo_option_vec_i64, Option>), + (echo_option_vec_string, Option>), + (echo_option_struct, Option), + (echo_option_vec_struct, Option>) +); diff --git a/crates/cli/tests/reference/echo.wat b/crates/cli/tests/reference/echo.wat new file mode 100644 index 00000000000..f73b23625f6 --- /dev/null +++ b/crates/cli/tests/reference/echo.wat @@ -0,0 +1,149 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32) (result i32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32 i32) (result i32))) + (type (;5;) (func (param i32 i32) (result i32 i32))) + (type (;6;) (func (param i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32) (result i32))) + (type (;8;) (func (param i32 i64) (result i32 i64))) + (type (;9;) (func (param i32 i64 i64) (result i32 i64 i64))) + (type (;10;) (func (param i32 f64) (result i32 f64))) + (type (;11;) (func (param i64) (result i64))) + (type (;12;) (func (param i64 i64) (result i64 i64))) + (type (;13;) (func (param f32) (result f32))) + (type (;14;) (func (param f64) (result f64))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 7) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 4) (param i32 i32) (result i32)) + (func $__externref_drop_slice (;3;) (type 3) (param i32 i32)) + (func $echo_option_u8 (;4;) (type 2) (param i32) (result i32)) + (func $echo_option_i8 (;5;) (type 2) (param i32) (result i32)) + (func $echo_option_u16 (;6;) (type 2) (param i32) (result i32)) + (func $echo_option_i16 (;7;) (type 2) (param i32) (result i32)) + (func $echo_option_struct (;8;) (type 2) (param i32) (result i32)) + (func $echo_option_u32 (;9;) (type 14) (param f64) (result f64)) + (func $echo_option_i32 (;10;) (type 14) (param f64) (result f64)) + (func $echo_option_usize (;11;) (type 14) (param f64) (result f64)) + (func $echo_option_isize (;12;) (type 14) (param f64) (result f64)) + (func $echo_option_f32 (;13;) (type 14) (param f64) (result f64)) + (func $echo_u8 (;14;) (type 2) (param i32) (result i32)) + (func $echo_i8 (;15;) (type 2) (param i32) (result i32)) + (func $echo_u16 (;16;) (type 2) (param i32) (result i32)) + (func $echo_i16 (;17;) (type 2) (param i32) (result i32)) + (func $echo_u32 (;18;) (type 2) (param i32) (result i32)) + (func $echo_i32 (;19;) (type 2) (param i32) (result i32)) + (func $echo_usize (;20;) (type 2) (param i32) (result i32)) + (func $echo_isize (;21;) (type 2) (param i32) (result i32)) + (func $echo_f32 (;22;) (type 13) (param f32) (result f32)) + (func $echo_bool (;23;) (type 2) (param i32) (result i32)) + (func $echo_char (;24;) (type 2) (param i32) (result i32)) + (func $echo_struct (;25;) (type 2) (param i32) (result i32)) + (func $echo_option_bool (;26;) (type 2) (param i32) (result i32)) + (func $echo_option_char (;27;) (type 2) (param i32) (result i32)) + (func $echo_u64 (;28;) (type 11) (param i64) (result i64)) + (func $echo_i64 (;29;) (type 11) (param i64) (result i64)) + (func $echo_f64 (;30;) (type 14) (param f64) (result f64)) + (func $__wbindgen_free (;31;) (type 6) (param i32 i32 i32)) + (func $__externref_table_alloc (;32;) (type 1) (result i32)) + (func $__wbg_foo_free (;33;) (type 3) (param i32 i32)) + (func $"echo_option_u128 multivalue shim" (;34;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_option_i128 multivalue shim" (;35;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_u128 multivalue shim" (;36;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_i128 multivalue shim" (;37;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_string multivalue shim" (;38;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u8 multivalue shim" (;39;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i8 multivalue shim" (;40;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u16 multivalue shim" (;41;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i16 multivalue shim" (;42;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u32 multivalue shim" (;43;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i32 multivalue shim" (;44;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u64 multivalue shim" (;45;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i64 multivalue shim" (;46;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_string multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_struct multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_u64 multivalue shim" (;49;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_i64 multivalue shim" (;50;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_f64 multivalue shim" (;51;) (type 10) (param i32 f64) (result i32 f64)) + (func $"echo_option_string multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u8 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i8 multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u16 multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i16 multivalue shim" (;56;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u32 multivalue shim" (;57;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i32 multivalue shim" (;58;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u64 multivalue shim" (;59;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i64 multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_string multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_struct multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_foo_free" (func $__wbg_foo_free)) + (export "echo_u8" (func $echo_u8)) + (export "echo_i8" (func $echo_i8)) + (export "echo_u16" (func $echo_u16)) + (export "echo_i16" (func $echo_i16)) + (export "echo_u32" (func $echo_u32)) + (export "echo_i32" (func $echo_i32)) + (export "echo_u64" (func $echo_u64)) + (export "echo_i64" (func $echo_i64)) + (export "echo_u128" (func $"echo_u128 multivalue shim")) + (export "echo_i128" (func $"echo_i128 multivalue shim")) + (export "echo_usize" (func $echo_usize)) + (export "echo_isize" (func $echo_isize)) + (export "echo_f32" (func $echo_f32)) + (export "echo_f64" (func $echo_f64)) + (export "echo_bool" (func $echo_bool)) + (export "echo_char" (func $echo_char)) + (export "echo_string" (func $"echo_string multivalue shim")) + (export "echo_vec_u8" (func $"echo_vec_u8 multivalue shim")) + (export "echo_vec_i8" (func $"echo_vec_i8 multivalue shim")) + (export "echo_vec_u16" (func $"echo_vec_u16 multivalue shim")) + (export "echo_vec_i16" (func $"echo_vec_i16 multivalue shim")) + (export "echo_vec_u32" (func $"echo_vec_u32 multivalue shim")) + (export "echo_vec_i32" (func $"echo_vec_i32 multivalue shim")) + (export "echo_vec_u64" (func $"echo_vec_u64 multivalue shim")) + (export "echo_vec_i64" (func $"echo_vec_i64 multivalue shim")) + (export "echo_vec_string" (func $"echo_vec_string multivalue shim")) + (export "echo_struct" (func $echo_struct)) + (export "echo_vec_struct" (func $"echo_vec_struct multivalue shim")) + (export "echo_option_u8" (func $echo_option_u8)) + (export "echo_option_i8" (func $echo_option_i8)) + (export "echo_option_u16" (func $echo_option_u16)) + (export "echo_option_i16" (func $echo_option_i16)) + (export "echo_option_u32" (func $echo_option_u32)) + (export "echo_option_i32" (func $echo_option_i32)) + (export "echo_option_u64" (func $"echo_option_u64 multivalue shim")) + (export "echo_option_i64" (func $"echo_option_i64 multivalue shim")) + (export "echo_option_u128" (func $"echo_option_u128 multivalue shim")) + (export "echo_option_i128" (func $"echo_option_i128 multivalue shim")) + (export "echo_option_usize" (func $echo_option_usize)) + (export "echo_option_isize" (func $echo_option_isize)) + (export "echo_option_f32" (func $echo_option_f32)) + (export "echo_option_f64" (func $"echo_option_f64 multivalue shim")) + (export "echo_option_bool" (func $echo_option_bool)) + (export "echo_option_char" (func $echo_option_char)) + (export "echo_option_string" (func $"echo_option_string multivalue shim")) + (export "echo_option_vec_u8" (func $"echo_option_vec_u8 multivalue shim")) + (export "echo_option_vec_i8" (func $"echo_option_vec_i8 multivalue shim")) + (export "echo_option_vec_u16" (func $"echo_option_vec_u16 multivalue shim")) + (export "echo_option_vec_i16" (func $"echo_option_vec_i16 multivalue shim")) + (export "echo_option_vec_u32" (func $"echo_option_vec_u32 multivalue shim")) + (export "echo_option_vec_i32" (func $"echo_option_vec_i32 multivalue shim")) + (export "echo_option_vec_u64" (func $"echo_option_vec_u64 multivalue shim")) + (export "echo_option_vec_i64" (func $"echo_option_vec_i64 multivalue shim")) + (export "echo_option_vec_string" (func $"echo_option_vec_string multivalue shim")) + (export "echo_option_struct" (func $echo_option_struct)) + (export "echo_option_vec_struct" (func $"echo_option_vec_struct multivalue shim")) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_export_2" (table 0)) + (export "__wbindgen_free" (func $__wbindgen_free)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__externref_drop_slice" (func $__externref_drop_slice)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + From 9e783472c578b07fc7ab0db92110a1f21199a16c Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 28 Nov 2024 23:47:48 +0100 Subject: [PATCH 572/641] Improved errors for invalid `self` arguments (#4276) --- CHANGELOG.md | 3 ++ crates/macro-support/src/parser.rs | 61 ++++++++++++++--------- crates/macro/ui-tests/invalid-self.rs | 23 +++++++++ crates/macro/ui-tests/invalid-self.stderr | 16 ++++++ 4 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 crates/macro/ui-tests/invalid-self.rs create mode 100644 crates/macro/ui-tests/invalid-self.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index d430b2891c2..9229d4b292c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,9 @@ * Updated the WebGPU API to the current draft as of 2024-11-22. [#4290](https://github.com/rustwasm/wasm-bindgen/pull/4290) +* Improved error messages for `self` arguments in invalid positions. + [#4276](https://github.com/rustwasm/wasm-bindgen/pull/4276) + ### Fixed * Fixed methods with `self: &Self` consuming the object. diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index bbf2bf79e02..9d7ad85a00c 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -530,9 +530,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option for syn::ItemFn { self.sig.clone(), self.attrs, self.vis, - false, - None, - false, + FunctionPosition::Free, Some(&["default"]), )?; attrs.check_used(); @@ -931,6 +927,12 @@ fn get_self_method(r: syn::Receiver) -> ast::MethodSelf { } } +enum FunctionPosition<'a> { + Extern, + Free, + Impl { self_ty: &'a Ident }, +} + /// Construct a function (and gets the self type if appropriate) for our AST from a syn function. #[allow(clippy::too_many_arguments)] fn function_from_decl( @@ -939,9 +941,7 @@ fn function_from_decl( sig: syn::Signature, attrs: Vec, vis: syn::Visibility, - allow_self: bool, - self_ty: Option<&Ident>, - is_from_impl: bool, + position: FunctionPosition, skip_keywords: Option<&[&str]>, ) -> Result<(ast::Function, Option), Diagnostic> { if sig.variadic.is_some() { @@ -963,7 +963,7 @@ fn function_from_decl( // The following comment explains why this is necessary: // https://github.com/rustwasm/wasm-bindgen/issues/3105#issuecomment-1275160744 let replace_self = |mut t: syn::Type| { - if let Some(self_ty) = self_ty { + if let FunctionPosition::Impl { self_ty } = position { // This uses a visitor to replace all occurrences of `Self` with // the actual type identifier. The visitor guarantees that we find // all occurrences of `Self`, even if deeply nested and even if @@ -995,30 +995,45 @@ fn function_from_decl( }; let mut method_self = None; - let arguments = inputs - .into_iter() - .filter_map(|arg| match arg { + let mut arguments = Vec::new(); + for arg in inputs.into_iter() { + match arg { syn::FnArg::Typed(mut c) => { // typical arguments like foo: u32 replace_colliding_arg(&mut c); c.ty = Box::new(replace_self(*c.ty)); - Some(c) + arguments.push(c); } syn::FnArg::Receiver(r) => { // the self argument, so self, &self, &mut self, self: Box, etc. - if !allow_self { - panic!("arguments cannot be `self`") + + // `self` is only allowed for `fn`s inside an `impl` block. + match position { + FunctionPosition::Free => { + bail_span!( + r.self_token, + "the `self` argument is only allowed for functions in `impl` blocks.\n\n\ + If the function is already in an `impl` block, did you perhaps forget to add `#[wasm_bindgen]` to the `impl` block?" + ); + } + FunctionPosition::Extern => { + bail_span!( + r.self_token, + "the `self` argument is not allowed for `extern` functions.\n\n\ + Did you perhaps mean `this`? For more information on importing JavaScript functions, see:\n\ + https://rustwasm.github.io/docs/wasm-bindgen/examples/import-js.html" + ); + } + FunctionPosition::Impl { .. } => {} } // We need to know *how* `self` is passed to the method (by // value or by reference) to generate the correct JS shim. assert!(method_self.is_none()); method_self = Some(get_self_method(r)); - - None } - }) - .collect::>(); + } + } let ret = match output { syn::ReturnType::Default => None, @@ -1042,7 +1057,7 @@ fn function_from_decl( }; (name, js_name_span, true) } else { - let name = if !is_from_impl + let name = if !matches!(position, FunctionPosition::Impl { .. }) && opts.method().is_none() && is_js_keyword(&decl_name.to_string(), skip_keywords) { @@ -1328,9 +1343,7 @@ impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn { self.sig.clone(), self.attrs.clone(), self.vis.clone(), - true, - Some(class), - true, + FunctionPosition::Impl { self_ty: class }, None, )?; let method_kind = if opts.constructor().is_some() { diff --git a/crates/macro/ui-tests/invalid-self.rs b/crates/macro/ui-tests/invalid-self.rs new file mode 100644 index 00000000000..1e6ecd01585 --- /dev/null +++ b/crates/macro/ui-tests/invalid-self.rs @@ -0,0 +1,23 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct A { + data: u32, +} + +// oh no, I forgot to add `#[wasm_bindgen]` to the impl block +impl A { + #[wasm_bindgen(js_name = bar)] + pub fn foo(&self) {} +} + +#[wasm_bindgen] +extern "C" { + type MyClass; + + // oops, I mixed up `self` and `this` + #[wasm_bindgen(method)] + fn render(self: &MyClass) -> String; +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-self.stderr b/crates/macro/ui-tests/invalid-self.stderr new file mode 100644 index 00000000000..7a1c6ff66a6 --- /dev/null +++ b/crates/macro/ui-tests/invalid-self.stderr @@ -0,0 +1,16 @@ +error: the `self` argument is only allowed for functions in `impl` blocks. + + If the function is already in an `impl` block, did you perhaps forget to add `#[wasm_bindgen]` to the `impl` block? + --> ui-tests/invalid-self.rs:11:17 + | +11 | pub fn foo(&self) {} + | ^^^^ + +error: the `self` argument is not allowed for `extern` functions. + + Did you perhaps mean `this`? For more information on importing JavaScript functions, see: + https://rustwasm.github.io/docs/wasm-bindgen/examples/import-js.html + --> ui-tests/invalid-self.rs:20:15 + | +20 | fn render(self: &MyClass) -> String; + | ^^^^ From 2fbee991765388918f1f09d2f7c1786dc5a81bb5 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 29 Nov 2024 00:00:01 +0100 Subject: [PATCH 573/641] Use private constructors in type definitions of structs without an exported constructor (#4282) --- CHANGELOG.md | 3 ++ crates/cli-support/src/js/mod.rs | 21 ++++++++----- crates/cli/tests/reference/builder.d.ts | 1 + crates/cli/tests/reference/echo.d.ts | 1 + crates/cli/tests/reference/getter-setter.d.ts | 1 + crates/cli/tests/reference/raw.d.ts | 1 + crates/typescript-tests/src/custom_section.rs | 8 +++++ .../typescript-tests/src/getters_setters.rs | 30 +++++++++++++++++++ 8 files changed, 58 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9229d4b292c..777d4f60031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,9 @@ * Fixed imports for functions using `this` and late binding. [#4225](https://github.com/rustwasm/wasm-bindgen/pull/4225) +* Don't expose non-functioning implicit constructors to classes when none are provided. + [#4282](https://github.com/rustwasm/wasm-bindgen/pull/4282) + -------------------------------------------------------------------------------- ## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index aff91c6cfcc..babbfc09d93 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1016,14 +1016,19 @@ __wbg_set_wasm(wasm);" let mut dst = format!("class {} {{\n", name); let mut ts_dst = format!("export {}", dst); - if self.config.debug && !class.has_constructor { - dst.push_str( - " - constructor() { - throw new Error('cannot invoke `new` directly'); - } - ", - ); + if !class.has_constructor { + // declare the constructor as private to prevent direct instantiation + ts_dst.push_str(" private constructor();\n"); + + if self.config.debug { + dst.push_str( + " + constructor() { + throw new Error('cannot invoke `new` directly'); + } + ", + ); + } } if class.wrap_needed { diff --git a/crates/cli/tests/reference/builder.d.ts b/crates/cli/tests/reference/builder.d.ts index 032da9dcf73..5a2da02112d 100644 --- a/crates/cli/tests/reference/builder.d.ts +++ b/crates/cli/tests/reference/builder.d.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ export class ClassBuilder { + private constructor(); free(): void; static builder(): ClassBuilder; } diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts index d5b187aa985..7f72b5e2d34 100644 --- a/crates/cli/tests/reference/echo.d.ts +++ b/crates/cli/tests/reference/echo.d.ts @@ -57,5 +57,6 @@ export function echo_option_vec_string(a?: (string)[]): (string)[] | undefined; export function echo_option_struct(a?: Foo): Foo | undefined; export function echo_option_vec_struct(a?: (Foo)[]): (Foo)[] | undefined; export class Foo { + private constructor(); free(): void; } diff --git a/crates/cli/tests/reference/getter-setter.d.ts b/crates/cli/tests/reference/getter-setter.d.ts index 4c207c3c7e6..8222ca2a462 100644 --- a/crates/cli/tests/reference/getter-setter.d.ts +++ b/crates/cli/tests/reference/getter-setter.d.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ export class Foo { + private constructor(); free(): void; x: number; y?: number; diff --git a/crates/cli/tests/reference/raw.d.ts b/crates/cli/tests/reference/raw.d.ts index 6dc3f5c628f..b28681c178f 100644 --- a/crates/cli/tests/reference/raw.d.ts +++ b/crates/cli/tests/reference/raw.d.ts @@ -2,6 +2,7 @@ /* eslint-disable */ export function test1(test: number): number; export class Test { + private constructor(); free(): void; static test1(test: number): Test; test2(test: number): void; diff --git a/crates/typescript-tests/src/custom_section.rs b/crates/typescript-tests/src/custom_section.rs index 4ed757c35ca..294cc9f5b25 100644 --- a/crates/typescript-tests/src/custom_section.rs +++ b/crates/typescript-tests/src/custom_section.rs @@ -17,3 +17,11 @@ const _: &str = TS_INTERFACE_EXPORT2; pub struct Person { pub height: u32, } + +#[wasm_bindgen] +impl Person { + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self { height: 170 } + } +} diff --git a/crates/typescript-tests/src/getters_setters.rs b/crates/typescript-tests/src/getters_setters.rs index b5534fc0111..7bc14119199 100644 --- a/crates/typescript-tests/src/getters_setters.rs +++ b/crates/typescript-tests/src/getters_setters.rs @@ -10,6 +10,16 @@ pub struct ColorWithGetters { #[wasm_bindgen] impl ColorWithGetters { + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self { + r: 0.0, + _g: 0.0, + _b: 0.0, + _a: 0, + } + } + #[wasm_bindgen(getter)] pub fn r(&self) -> f64 { self.r @@ -31,6 +41,16 @@ pub struct ColorWithSetters { #[wasm_bindgen] impl ColorWithSetters { + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self { + r: 0.0, + _g: 0.0, + _b: 0.0, + a: 0, + } + } + #[wasm_bindgen(setter)] pub fn set_r(&mut self, r: f64) { self.r = r; @@ -57,6 +77,16 @@ pub struct ColorWithGetterAndSetter { #[wasm_bindgen] impl ColorWithGetterAndSetter { + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self { + r: 0.0, + _g: 0.0, + _b: 0.0, + a: 0, + } + } + #[wasm_bindgen(getter)] pub fn r(&self) -> f64 { self.r From b3da9dc03639dc6585944d1827152d94e99541ca Mon Sep 17 00:00:00 2001 From: Christofer Nolander Date: Fri, 29 Nov 2024 01:52:19 +0100 Subject: [PATCH 574/641] transition away from deprecated setters internally (#4297) --- crates/web-sys/src/features/gen_AesCbcParams.rs | 4 ++-- crates/web-sys/src/features/gen_AesCtrParams.rs | 6 +++--- .../src/features/gen_AesDerivedKeyParams.rs | 4 ++-- crates/web-sys/src/features/gen_AesGcmParams.rs | 4 ++-- crates/web-sys/src/features/gen_AesKeyAlgorithm.rs | 4 ++-- crates/web-sys/src/features/gen_AesKeyGenParams.rs | 4 ++-- crates/web-sys/src/features/gen_Algorithm.rs | 2 +- .../src/features/gen_AllowedBluetoothDevice.rs | 6 +++--- .../web-sys/src/features/gen_AllowedUsbDevice.rs | 4 ++-- .../src/features/gen_AnimationPropertyDetails.rs | 6 +++--- .../features/gen_AnimationPropertyValueDetails.rs | 4 ++-- .../web-sys/src/features/gen_AttributeNameValue.rs | 4 ++-- .../web-sys/src/features/gen_AudioBufferOptions.rs | 4 ++-- .../src/features/gen_AudioDataCopyToOptions.rs | 2 +- crates/web-sys/src/features/gen_AudioDataInit.rs | 12 ++++++------ .../web-sys/src/features/gen_AudioDecoderConfig.rs | 6 +++--- .../web-sys/src/features/gen_AudioDecoderInit.rs | 4 ++-- .../web-sys/src/features/gen_AudioEncoderConfig.rs | 2 +- .../web-sys/src/features/gen_AudioEncoderInit.rs | 4 ++-- .../web-sys/src/features/gen_AudioSinkOptions.rs | 2 +- .../gen_AuthenticationExtensionsPrfValues.rs | 2 +- .../src/features/gen_AuthenticationResponseJson.rs | 10 +++++----- .../gen_AuthenticatorAssertionResponseJson.rs | 6 +++--- .../gen_AuthenticatorAttestationResponseJson.rs | 10 +++++----- .../web-sys/src/features/gen_BasicCardResponse.rs | 2 +- .../features/gen_BluetoothAdvertisingEventInit.rs | 2 +- .../features/gen_BluetoothPermissionDescriptor.rs | 2 +- .../src/features/gen_BluetoothPermissionStorage.rs | 2 +- .../src/features/gen_ClientRectsAndTexts.rs | 4 ++-- .../features/gen_ClipboardPermissionDescriptor.rs | 2 +- .../src/features/gen_CollectedClientData.rs | 8 ++++---- crates/web-sys/src/features/gen_CryptoKeyPair.rs | 4 ++-- .../src/features/gen_DecoderDoctorNotification.rs | 6 +++--- .../web-sys/src/features/gen_DhKeyDeriveParams.rs | 4 ++-- crates/web-sys/src/features/gen_EcKeyAlgorithm.rs | 4 ++-- crates/web-sys/src/features/gen_EcKeyGenParams.rs | 4 ++-- .../web-sys/src/features/gen_EcKeyImportParams.rs | 2 +- .../src/features/gen_EcdhKeyDeriveParams.rs | 4 ++-- crates/web-sys/src/features/gen_EcdsaParams.rs | 4 ++-- .../src/features/gen_EncodedAudioChunkInit.rs | 6 +++--- .../src/features/gen_EncodedVideoChunkInit.rs | 6 +++--- .../src/features/gen_FakePluginMimeEntry.rs | 2 +- .../web-sys/src/features/gen_FakePluginTagInit.rs | 4 ++-- crates/web-sys/src/features/gen_FetchEventInit.rs | 2 +- .../features/gen_FileSystemPermissionDescriptor.rs | 4 ++-- .../src/features/gen_FontFaceSetIteratorResult.rs | 4 ++-- .../src/features/gen_GpuBindGroupDescriptor.rs | 4 ++-- .../web-sys/src/features/gen_GpuBindGroupEntry.rs | 4 ++-- .../features/gen_GpuBindGroupLayoutDescriptor.rs | 2 +- .../src/features/gen_GpuBindGroupLayoutEntry.rs | 4 ++-- crates/web-sys/src/features/gen_GpuBlendState.rs | 4 ++-- .../web-sys/src/features/gen_GpuBufferBinding.rs | 2 +- .../src/features/gen_GpuBufferDescriptor.rs | 4 ++-- .../src/features/gen_GpuCanvasConfiguration.rs | 4 ++-- crates/web-sys/src/features/gen_GpuColorDict.rs | 8 ++++---- .../src/features/gen_GpuColorTargetState.rs | 2 +- .../features/gen_GpuComputePassTimestampWrites.rs | 2 +- .../features/gen_GpuComputePipelineDescriptor.rs | 4 ++-- .../features/gen_GpuCopyExternalImageDestInfo.rs | 2 +- .../features/gen_GpuCopyExternalImageSourceInfo.rs | 2 +- .../src/features/gen_GpuDepthStencilState.rs | 2 +- crates/web-sys/src/features/gen_GpuExtent3dDict.rs | 2 +- .../features/gen_GpuExternalTextureDescriptor.rs | 2 +- .../web-sys/src/features/gen_GpuFragmentState.rs | 4 ++-- .../src/features/gen_GpuPipelineDescriptorBase.rs | 2 +- .../src/features/gen_GpuPipelineErrorInit.rs | 2 +- .../features/gen_GpuPipelineLayoutDescriptor.rs | 2 +- .../src/features/gen_GpuProgrammableStage.rs | 2 +- .../src/features/gen_GpuQuerySetDescriptor.rs | 4 ++-- .../gen_GpuRenderBundleEncoderDescriptor.rs | 2 +- .../features/gen_GpuRenderPassColorAttachment.rs | 6 +++--- .../gen_GpuRenderPassDepthStencilAttachment.rs | 2 +- .../src/features/gen_GpuRenderPassDescriptor.rs | 2 +- .../src/features/gen_GpuRenderPassLayout.rs | 2 +- .../features/gen_GpuRenderPassTimestampWrites.rs | 2 +- .../features/gen_GpuRenderPipelineDescriptor.rs | 4 ++-- .../features/gen_GpuShaderModuleCompilationHint.rs | 2 +- .../src/features/gen_GpuShaderModuleDescriptor.rs | 2 +- .../features/gen_GpuStorageTextureBindingLayout.rs | 2 +- .../src/features/gen_GpuTexelCopyBufferInfo.rs | 2 +- .../src/features/gen_GpuTexelCopyTextureInfo.rs | 2 +- .../src/features/gen_GpuTextureDescriptor.rs | 6 +++--- .../features/gen_GpuUncapturedErrorEventInit.rs | 2 +- .../web-sys/src/features/gen_GpuVertexAttribute.rs | 6 +++--- .../src/features/gen_GpuVertexBufferLayout.rs | 4 ++-- crates/web-sys/src/features/gen_GpuVertexState.rs | 2 +- .../src/features/gen_HidConnectionEventInit.rs | 2 +- .../src/features/gen_HidDeviceRequestOptions.rs | 2 +- .../src/features/gen_HidInputReportEventInit.rs | 6 +++--- crates/web-sys/src/features/gen_HkdfParams.rs | 8 ++++---- .../src/features/gen_HmacDerivedKeyParams.rs | 4 ++-- .../web-sys/src/features/gen_HmacImportParams.rs | 4 ++-- .../web-sys/src/features/gen_HmacKeyAlgorithm.rs | 6 +++--- .../web-sys/src/features/gen_HmacKeyGenParams.rs | 4 ++-- .../web-sys/src/features/gen_IirFilterOptions.rs | 4 ++-- .../web-sys/src/features/gen_ImageDecodeResult.rs | 4 ++-- .../web-sys/src/features/gen_ImageDecoderInit.rs | 4 ++-- .../features/gen_IntersectionObserverEntryInit.rs | 10 +++++----- crates/web-sys/src/features/gen_JsonWebKey.rs | 2 +- crates/web-sys/src/features/gen_KeyAlgorithm.rs | 2 +- crates/web-sys/src/features/gen_KeyIdsInitData.rs | 2 +- crates/web-sys/src/features/gen_L10nElement.rs | 6 +++--- .../src/features/gen_MediaDecodingConfiguration.rs | 2 +- .../features/gen_MediaElementAudioSourceOptions.rs | 2 +- .../src/features/gen_MediaEncodingConfiguration.rs | 2 +- crates/web-sys/src/features/gen_MediaImage.rs | 2 +- .../src/features/gen_MediaKeyMessageEventInit.rs | 4 ++-- .../features/gen_MediaRecorderErrorEventInit.rs | 2 +- .../src/features/gen_MediaSessionActionDetails.rs | 2 +- .../features/gen_MediaStreamAudioSourceOptions.rs | 2 +- .../src/features/gen_MediaStreamTrackEventInit.rs | 2 +- .../features/gen_MediaStreamTrackGeneratorInit.rs | 2 +- .../features/gen_MediaStreamTrackProcessorInit.rs | 2 +- .../web-sys/src/features/gen_NotificationAction.rs | 4 ++-- .../src/features/gen_NotificationEventInit.rs | 2 +- .../gen_OfflineAudioCompletionEventInit.rs | 2 +- .../src/features/gen_OfflineAudioContextOptions.rs | 4 ++-- .../features/gen_PaymentMethodChangeEventInit.rs | 2 +- crates/web-sys/src/features/gen_Pbkdf2Params.rs | 8 ++++---- .../src/features/gen_PerformanceObserverInit.rs | 2 +- .../src/features/gen_PermissionDescriptor.rs | 2 +- crates/web-sys/src/features/gen_PlaneLayout.rs | 4 ++-- ...gen_PresentationConnectionAvailableEventInit.rs | 2 +- .../gen_PresentationConnectionCloseEventInit.rs | 2 +- .../src/features/gen_PromiseRejectionEventInit.rs | 2 +- .../gen_PublicKeyCredentialCreationOptions.rs | 8 ++++---- .../gen_PublicKeyCredentialCreationOptionsJson.rs | 8 ++++---- .../features/gen_PublicKeyCredentialDescriptor.rs | 4 ++-- .../gen_PublicKeyCredentialDescriptorJson.rs | 4 ++-- .../src/features/gen_PublicKeyCredentialEntity.rs | 2 +- .../features/gen_PublicKeyCredentialParameters.rs | 4 ++-- .../gen_PublicKeyCredentialRequestOptions.rs | 2 +- .../gen_PublicKeyCredentialRequestOptionsJson.rs | 2 +- .../features/gen_PublicKeyCredentialRpEntity.rs | 2 +- .../features/gen_PublicKeyCredentialUserEntity.rs | 6 +++--- .../gen_PublicKeyCredentialUserEntityJson.rs | 6 +++--- .../src/features/gen_PushSubscriptionInit.rs | 4 ++-- .../src/features/gen_QueuingStrategyInit.rs | 2 +- .../src/features/gen_ReadableWritablePair.rs | 4 ++-- .../src/features/gen_RegistrationResponseJson.rs | 10 +++++----- .../gen_RequestMediaKeySystemAccessNotification.rs | 4 ++-- .../src/features/gen_RsaHashedImportParams.rs | 2 +- crates/web-sys/src/features/gen_RsaOaepParams.rs | 2 +- .../web-sys/src/features/gen_RsaOtherPrimesInfo.rs | 6 +++--- crates/web-sys/src/features/gen_RsaPssParams.rs | 4 ++-- .../src/features/gen_RtcDataChannelEventInit.rs | 2 +- .../src/features/gen_RtcIceCandidateInit.rs | 2 +- .../src/features/gen_RtcIdentityAssertionResult.rs | 4 ++-- .../src/features/gen_RtcIdentityProvider.rs | 4 ++-- .../src/features/gen_RtcIdentityProviderDetails.rs | 2 +- .../features/gen_RtcIdentityValidationResult.rs | 4 ++-- .../web-sys/src/features/gen_RtcRtpCapabilities.rs | 4 ++-- .../src/features/gen_RtcRtpCodecCapability.rs | 4 ++-- .../src/features/gen_RtcRtpContributingSource.rs | 4 ++-- .../gen_RtcRtpHeaderExtensionCapability.rs | 2 +- .../web-sys/src/features/gen_RtcRtpSourceEntry.rs | 6 +++--- .../features/gen_RtcRtpSynchronizationSource.rs | 4 ++-- .../src/features/gen_RtcSessionDescriptionInit.rs | 2 +- .../web-sys/src/features/gen_RtcTrackEventInit.rs | 6 +++--- .../features/gen_SFrameTransformErrorEventInit.rs | 4 ++-- .../web-sys/src/features/gen_SerialInputSignals.rs | 8 ++++---- crates/web-sys/src/features/gen_SerialOptions.rs | 2 +- crates/web-sys/src/features/gen_ShadowRootInit.rs | 2 +- .../features/gen_SpeechSynthesisErrorEventInit.rs | 4 ++-- .../src/features/gen_SpeechSynthesisEventInit.rs | 2 +- .../features/gen_TaskPriorityChangeEventInit.rs | 2 +- crates/web-sys/src/features/gen_TokenBinding.rs | 2 +- crates/web-sys/src/features/gen_TouchInit.rs | 4 ++-- .../src/features/gen_UsbConnectionEventInit.rs | 2 +- .../features/gen_UsbControlTransferParameters.rs | 10 +++++----- .../src/features/gen_UsbDeviceRequestOptions.rs | 2 +- .../src/features/gen_UsbPermissionDescriptor.rs | 2 +- .../web-sys/src/features/gen_VideoDecoderConfig.rs | 2 +- .../web-sys/src/features/gen_VideoDecoderInit.rs | 4 ++-- .../web-sys/src/features/gen_VideoEncoderConfig.rs | 6 +++--- .../web-sys/src/features/gen_VideoEncoderInit.rs | 4 ++-- .../src/features/gen_VideoFrameBufferInit.rs | 8 ++++---- .../src/features/gen_WidevineCdmManifest.rs | 14 +++++++------- crates/web-sys/src/features/gen_WriteParams.rs | 2 +- .../src/features/gen_XrInputSourceEventInit.rs | 4 ++-- .../features/gen_XrInputSourcesChangeEventInit.rs | 6 +++--- .../src/features/gen_XrPermissionDescriptor.rs | 2 +- .../src/features/gen_XrReferenceSpaceEventInit.rs | 2 +- .../web-sys/src/features/gen_XrSessionEventInit.rs | 2 +- .../gen_XrSessionSupportedPermissionDescriptor.rs | 2 +- crates/webidl/src/generator.rs | 3 ++- 186 files changed, 346 insertions(+), 345 deletions(-) diff --git a/crates/web-sys/src/features/gen_AesCbcParams.rs b/crates/web-sys/src/features/gen_AesCbcParams.rs index 28ccbbd17c3..b439aa882e0 100644 --- a/crates/web-sys/src/features/gen_AesCbcParams.rs +++ b/crates/web-sys/src/features/gen_AesCbcParams.rs @@ -38,8 +38,8 @@ impl AesCbcParams { pub fn new(name: &str, iv: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.iv(iv); + ret.set_name(name); + ret.set_iv(iv); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AesCtrParams.rs b/crates/web-sys/src/features/gen_AesCtrParams.rs index e45d80ac7ad..c3b84245e2e 100644 --- a/crates/web-sys/src/features/gen_AesCtrParams.rs +++ b/crates/web-sys/src/features/gen_AesCtrParams.rs @@ -48,9 +48,9 @@ impl AesCtrParams { pub fn new(name: &str, counter: &::js_sys::Object, length: u8) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.counter(counter); - ret.length(length); + ret.set_name(name); + ret.set_counter(counter); + ret.set_length(length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs index a79081cd6b7..ccebb265d2d 100644 --- a/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_AesDerivedKeyParams.rs @@ -38,8 +38,8 @@ impl AesDerivedKeyParams { pub fn new(name: &str, length: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.length(length); + ret.set_name(name); + ret.set_length(length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AesGcmParams.rs b/crates/web-sys/src/features/gen_AesGcmParams.rs index 1496770798f..b7a913ee1e8 100644 --- a/crates/web-sys/src/features/gen_AesGcmParams.rs +++ b/crates/web-sys/src/features/gen_AesGcmParams.rs @@ -58,8 +58,8 @@ impl AesGcmParams { pub fn new(name: &str, iv: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.iv(iv); + ret.set_name(name); + ret.set_iv(iv); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs index 9378c3aeb95..a4f34afb3eb 100644 --- a/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_AesKeyAlgorithm.rs @@ -38,8 +38,8 @@ impl AesKeyAlgorithm { pub fn new(name: &str, length: u16) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.length(length); + ret.set_name(name); + ret.set_length(length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AesKeyGenParams.rs b/crates/web-sys/src/features/gen_AesKeyGenParams.rs index 7695ca8c66c..2f699303ee4 100644 --- a/crates/web-sys/src/features/gen_AesKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_AesKeyGenParams.rs @@ -38,8 +38,8 @@ impl AesKeyGenParams { pub fn new(name: &str, length: u16) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.length(length); + ret.set_name(name); + ret.set_length(length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_Algorithm.rs b/crates/web-sys/src/features/gen_Algorithm.rs index 7ca3479fe6c..32103689b95 100644 --- a/crates/web-sys/src/features/gen_Algorithm.rs +++ b/crates/web-sys/src/features/gen_Algorithm.rs @@ -28,7 +28,7 @@ impl Algorithm { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs index ae72c136ea2..2c39cdfc01f 100644 --- a/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedBluetoothDevice.rs @@ -84,9 +84,9 @@ impl AllowedBluetoothDevice { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.allowed_services(allowed_services); - ret.device_id(device_id); - ret.may_use_gatt(may_use_gatt); + ret.set_allowed_services(allowed_services); + ret.set_device_id(device_id); + ret.set_may_use_gatt(may_use_gatt); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs index c3cdc696b5d..b1fa5b8f6e4 100644 --- a/crates/web-sys/src/features/gen_AllowedUsbDevice.rs +++ b/crates/web-sys/src/features/gen_AllowedUsbDevice.rs @@ -80,8 +80,8 @@ impl AllowedUsbDevice { pub fn new(product_id: u8, vendor_id: u8) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.product_id(product_id); - ret.vendor_id(vendor_id); + ret.set_product_id(product_id); + ret.set_vendor_id(vendor_id); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs index 9778d60dcba..d8560f13c17 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyDetails.rs @@ -62,9 +62,9 @@ impl AnimationPropertyDetails { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.property(property); - ret.running_on_compositor(running_on_compositor); - ret.values(values); + ret.set_property(property); + ret.set_running_on_compositor(running_on_compositor); + ret.set_values(values); ret } #[deprecated = "Use `set_property()` instead."] diff --git a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs index e29fadce259..197af6d09ec 100644 --- a/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs +++ b/crates/web-sys/src/features/gen_AnimationPropertyValueDetails.rs @@ -61,8 +61,8 @@ impl AnimationPropertyValueDetails { pub fn new(composite: CompositeOperation, offset: f64) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.composite(composite); - ret.offset(offset); + ret.set_composite(composite); + ret.set_offset(offset); ret } #[cfg(feature = "CompositeOperation")] diff --git a/crates/web-sys/src/features/gen_AttributeNameValue.rs b/crates/web-sys/src/features/gen_AttributeNameValue.rs index 36fd820d932..490d0a3cc5c 100644 --- a/crates/web-sys/src/features/gen_AttributeNameValue.rs +++ b/crates/web-sys/src/features/gen_AttributeNameValue.rs @@ -38,8 +38,8 @@ impl AttributeNameValue { pub fn new(name: &str, value: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.value(value); + ret.set_name(name); + ret.set_value(value); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_AudioBufferOptions.rs b/crates/web-sys/src/features/gen_AudioBufferOptions.rs index d5bbd45fca8..c05257fe91b 100644 --- a/crates/web-sys/src/features/gen_AudioBufferOptions.rs +++ b/crates/web-sys/src/features/gen_AudioBufferOptions.rs @@ -48,8 +48,8 @@ impl AudioBufferOptions { pub fn new(length: u32, sample_rate: f32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.length(length); - ret.sample_rate(sample_rate); + ret.set_length(length); + ret.set_sample_rate(sample_rate); ret } #[deprecated = "Use `set_length()` instead."] diff --git a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs index bf135f78eb8..d83c1b47760 100644 --- a/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs +++ b/crates/web-sys/src/features/gen_AudioDataCopyToOptions.rs @@ -100,7 +100,7 @@ impl AudioDataCopyToOptions { pub fn new(plane_index: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.plane_index(plane_index); + ret.set_plane_index(plane_index); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioDataInit.rs b/crates/web-sys/src/features/gen_AudioDataInit.rs index 29ea0c0183d..251b10110e6 100644 --- a/crates/web-sys/src/features/gen_AudioDataInit.rs +++ b/crates/web-sys/src/features/gen_AudioDataInit.rs @@ -144,12 +144,12 @@ impl AudioDataInit { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.format(format); - ret.number_of_channels(number_of_channels); - ret.number_of_frames(number_of_frames); - ret.sample_rate(sample_rate); - ret.timestamp(timestamp); + ret.set_data(data); + ret.set_format(format); + ret.set_number_of_channels(number_of_channels); + ret.set_number_of_frames(number_of_frames); + ret.set_sample_rate(sample_rate); + ret.set_timestamp(timestamp); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs index bdf5b716027..fb0931e3cfc 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderConfig.rs @@ -98,9 +98,9 @@ impl AudioDecoderConfig { pub fn new(codec: &str, number_of_channels: u32, sample_rate: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); - ret.number_of_channels(number_of_channels); - ret.sample_rate(sample_rate); + ret.set_codec(codec); + ret.set_number_of_channels(number_of_channels); + ret.set_sample_rate(sample_rate); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioDecoderInit.rs b/crates/web-sys/src/features/gen_AudioDecoderInit.rs index 54a467b8bf4..efdd030a82a 100644 --- a/crates/web-sys/src/features/gen_AudioDecoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioDecoderInit.rs @@ -62,8 +62,8 @@ impl AudioDecoderInit { pub fn new(error: &::js_sys::Function, output: &::js_sys::Function) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); - ret.output(output); + ret.set_error(error); + ret.set_output(output); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs index 94444878caa..4553ce74ec4 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderConfig.rs @@ -98,7 +98,7 @@ impl AudioEncoderConfig { pub fn new(codec: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); + ret.set_codec(codec); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioEncoderInit.rs b/crates/web-sys/src/features/gen_AudioEncoderInit.rs index 95ee7e292c9..7aa036edcda 100644 --- a/crates/web-sys/src/features/gen_AudioEncoderInit.rs +++ b/crates/web-sys/src/features/gen_AudioEncoderInit.rs @@ -62,8 +62,8 @@ impl AudioEncoderInit { pub fn new(error: &::js_sys::Function, output: &::js_sys::Function) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); - ret.output(output); + ret.set_error(error); + ret.set_output(output); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AudioSinkOptions.rs b/crates/web-sys/src/features/gen_AudioSinkOptions.rs index 6918a4c0587..a9fbff66f7d 100644 --- a/crates/web-sys/src/features/gen_AudioSinkOptions.rs +++ b/crates/web-sys/src/features/gen_AudioSinkOptions.rs @@ -47,7 +47,7 @@ impl AudioSinkOptions { pub fn new(type_: AudioSinkType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs index c57eb622acc..0888dc5de9b 100644 --- a/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs +++ b/crates/web-sys/src/features/gen_AuthenticationExtensionsPrfValues.rs @@ -62,7 +62,7 @@ impl AuthenticationExtensionsPrfValues { pub fn new(first: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.first(first); + ret.set_first(first); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs index 55d75060c88..cbec2e44320 100644 --- a/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticationResponseJson.rs @@ -158,11 +158,11 @@ impl AuthenticationResponseJson { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.client_extension_results(client_extension_results); - ret.id(id); - ret.raw_id(raw_id); - ret.response(response); - ret.type_(type_); + ret.set_client_extension_results(client_extension_results); + ret.set_id(id); + ret.set_raw_id(raw_id); + ret.set_response(response); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs index 731de3744c1..26051b9688f 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAssertionResponseJson.rs @@ -124,9 +124,9 @@ impl AuthenticatorAssertionResponseJson { pub fn new(authenticator_data: &str, client_data_json: &str, signature: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.authenticator_data(authenticator_data); - ret.client_data_json(client_data_json); - ret.signature(signature); + ret.set_authenticator_data(authenticator_data); + ret.set_client_data_json(client_data_json); + ret.set_signature(signature); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs index 633f699fb39..304316e66ca 100644 --- a/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs +++ b/crates/web-sys/src/features/gen_AuthenticatorAttestationResponseJson.rs @@ -151,11 +151,11 @@ impl AuthenticatorAttestationResponseJson { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.attestation_object(attestation_object); - ret.authenticator_data(authenticator_data); - ret.client_data_json(client_data_json); - ret.public_key_algorithm(public_key_algorithm); - ret.transports(transports); + ret.set_attestation_object(attestation_object); + ret.set_authenticator_data(authenticator_data); + ret.set_client_data_json(client_data_json); + ret.set_public_key_algorithm(public_key_algorithm); + ret.set_transports(transports); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_BasicCardResponse.rs b/crates/web-sys/src/features/gen_BasicCardResponse.rs index b97e50d4de9..d312a238ef4 100644 --- a/crates/web-sys/src/features/gen_BasicCardResponse.rs +++ b/crates/web-sys/src/features/gen_BasicCardResponse.rs @@ -80,7 +80,7 @@ impl BasicCardResponse { pub fn new(card_number: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.card_number(card_number); + ret.set_card_number(card_number); ret } #[cfg(feature = "PaymentAddress")] diff --git a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs index 21605f3214d..de40f5a3828 100644 --- a/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs +++ b/crates/web-sys/src/features/gen_BluetoothAdvertisingEventInit.rs @@ -238,7 +238,7 @@ impl BluetoothAdvertisingEventInit { pub fn new(device: &BluetoothDevice) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.device(device); + ret.set_device(device); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs index 1792f5dc535..525ca9a7ab3 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionDescriptor.rs @@ -122,7 +122,7 @@ impl BluetoothPermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs index ba65406810e..fc4c06813ae 100644 --- a/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs +++ b/crates/web-sys/src/features/gen_BluetoothPermissionStorage.rs @@ -44,7 +44,7 @@ impl BluetoothPermissionStorage { pub fn new(allowed_devices: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.allowed_devices(allowed_devices); + ret.set_allowed_devices(allowed_devices); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs index 0aa0cf48871..475fc5964fe 100644 --- a/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs +++ b/crates/web-sys/src/features/gen_ClientRectsAndTexts.rs @@ -41,8 +41,8 @@ impl ClientRectsAndTexts { pub fn new(rect_list: &DomRectList, text_list: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.rect_list(rect_list); - ret.text_list(text_list); + ret.set_rect_list(rect_list); + ret.set_text_list(text_list); ret } #[cfg(feature = "DomRectList")] diff --git a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs index 541b0a317e6..8ff2d3b954d 100644 --- a/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_ClipboardPermissionDescriptor.rs @@ -65,7 +65,7 @@ impl ClipboardPermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_CollectedClientData.rs b/crates/web-sys/src/features/gen_CollectedClientData.rs index cedc2994107..44f8b48b8fd 100644 --- a/crates/web-sys/src/features/gen_CollectedClientData.rs +++ b/crates/web-sys/src/features/gen_CollectedClientData.rs @@ -113,10 +113,10 @@ impl CollectedClientData { pub fn new(challenge: &str, hash_algorithm: &str, origin: &str, type_: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.challenge(challenge); - ret.hash_algorithm(hash_algorithm); - ret.origin(origin); - ret.type_(type_); + ret.set_challenge(challenge); + ret.set_hash_algorithm(hash_algorithm); + ret.set_origin(origin); + ret.set_type(type_); ret } #[deprecated = "Use `set_challenge()` instead."] diff --git a/crates/web-sys/src/features/gen_CryptoKeyPair.rs b/crates/web-sys/src/features/gen_CryptoKeyPair.rs index fdd078a2e64..029f9d2aa96 100644 --- a/crates/web-sys/src/features/gen_CryptoKeyPair.rs +++ b/crates/web-sys/src/features/gen_CryptoKeyPair.rs @@ -43,8 +43,8 @@ impl CryptoKeyPair { pub fn new(private_key: &CryptoKey, public_key: &CryptoKey) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.private_key(private_key); - ret.public_key(public_key); + ret.set_private_key(private_key); + ret.set_public_key(public_key); ret } #[cfg(feature = "CryptoKey")] diff --git a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs index 71185fca1ff..415a965cad3 100644 --- a/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs +++ b/crates/web-sys/src/features/gen_DecoderDoctorNotification.rs @@ -97,9 +97,9 @@ impl DecoderDoctorNotification { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.decoder_doctor_report_id(decoder_doctor_report_id); - ret.is_solved(is_solved); - ret.type_(type_); + ret.set_decoder_doctor_report_id(decoder_doctor_report_id); + ret.set_is_solved(is_solved); + ret.set_type(type_); ret } #[deprecated = "Use `set_decode_issue()` instead."] diff --git a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs index 54f4bb8119d..f683e249b35 100644 --- a/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_DhKeyDeriveParams.rs @@ -41,8 +41,8 @@ impl DhKeyDeriveParams { pub fn new(name: &str, public: &CryptoKey) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.public(public); + ret.set_name(name); + ret.set_public(public); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs index 04f512d8bd9..98fe59c5dc6 100644 --- a/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_EcKeyAlgorithm.rs @@ -38,8 +38,8 @@ impl EcKeyAlgorithm { pub fn new(name: &str, named_curve: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.named_curve(named_curve); + ret.set_name(name); + ret.set_named_curve(named_curve); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EcKeyGenParams.rs b/crates/web-sys/src/features/gen_EcKeyGenParams.rs index 464905fd8ad..d36d03e69fe 100644 --- a/crates/web-sys/src/features/gen_EcKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyGenParams.rs @@ -38,8 +38,8 @@ impl EcKeyGenParams { pub fn new(name: &str, named_curve: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.named_curve(named_curve); + ret.set_name(name); + ret.set_named_curve(named_curve); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EcKeyImportParams.rs b/crates/web-sys/src/features/gen_EcKeyImportParams.rs index c6265856695..b18737069f8 100644 --- a/crates/web-sys/src/features/gen_EcKeyImportParams.rs +++ b/crates/web-sys/src/features/gen_EcKeyImportParams.rs @@ -38,7 +38,7 @@ impl EcKeyImportParams { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs index be62df0958b..71e9da9d8eb 100644 --- a/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs +++ b/crates/web-sys/src/features/gen_EcdhKeyDeriveParams.rs @@ -41,8 +41,8 @@ impl EcdhKeyDeriveParams { pub fn new(name: &str, public: &CryptoKey) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.public(public); + ret.set_name(name); + ret.set_public(public); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EcdsaParams.rs b/crates/web-sys/src/features/gen_EcdsaParams.rs index 481fad7fe2a..f1f3b22a7ad 100644 --- a/crates/web-sys/src/features/gen_EcdsaParams.rs +++ b/crates/web-sys/src/features/gen_EcdsaParams.rs @@ -38,8 +38,8 @@ impl EcdsaParams { pub fn new(name: &str, hash: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); + ret.set_name(name); + ret.set_hash(hash); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs index 76b491edc45..f0bc1d16885 100644 --- a/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedAudioChunkInit.rs @@ -101,9 +101,9 @@ impl EncodedAudioChunkInit { pub fn new(data: &::js_sys::Object, timestamp: f64, type_: EncodedAudioChunkType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.timestamp(timestamp); - ret.type_(type_); + ret.set_data(data); + ret.set_timestamp(timestamp); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs index 1e523952822..54372df9910 100644 --- a/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs +++ b/crates/web-sys/src/features/gen_EncodedVideoChunkInit.rs @@ -101,9 +101,9 @@ impl EncodedVideoChunkInit { pub fn new(data: &::js_sys::Object, timestamp: f64, type_: EncodedVideoChunkType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.timestamp(timestamp); - ret.type_(type_); + ret.set_data(data); + ret.set_timestamp(timestamp); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs index 84c0894867e..92e2ccef0a8 100644 --- a/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs +++ b/crates/web-sys/src/features/gen_FakePluginMimeEntry.rs @@ -48,7 +48,7 @@ impl FakePluginMimeEntry { pub fn new(type_: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[deprecated = "Use `set_description()` instead."] diff --git a/crates/web-sys/src/features/gen_FakePluginTagInit.rs b/crates/web-sys/src/features/gen_FakePluginTagInit.rs index 6dbd3fca415..f29b10c51a6 100644 --- a/crates/web-sys/src/features/gen_FakePluginTagInit.rs +++ b/crates/web-sys/src/features/gen_FakePluginTagInit.rs @@ -108,8 +108,8 @@ impl FakePluginTagInit { pub fn new(handler_uri: &str, mime_entries: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.handler_uri(handler_uri); - ret.mime_entries(mime_entries); + ret.set_handler_uri(handler_uri); + ret.set_mime_entries(mime_entries); ret } #[deprecated = "Use `set_description()` instead."] diff --git a/crates/web-sys/src/features/gen_FetchEventInit.rs b/crates/web-sys/src/features/gen_FetchEventInit.rs index f86eb2c96ee..505b441d698 100644 --- a/crates/web-sys/src/features/gen_FetchEventInit.rs +++ b/crates/web-sys/src/features/gen_FetchEventInit.rs @@ -81,7 +81,7 @@ impl FetchEventInit { pub fn new(request: &Request) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.request(request); + ret.set_request(request); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs index 4a8c7df1f12..fae34b1c58e 100644 --- a/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_FileSystemPermissionDescriptor.rs @@ -87,8 +87,8 @@ impl FileSystemPermissionDescriptor { pub fn new(name: PermissionName, handle: &FileSystemHandle) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.handle(handle); + ret.set_name(name); + ret.set_handle(handle); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs index 469670809fb..f022a56ec71 100644 --- a/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs +++ b/crates/web-sys/src/features/gen_FontFaceSetIteratorResult.rs @@ -38,8 +38,8 @@ impl FontFaceSetIteratorResult { pub fn new(done: bool, value: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.done(done); - ret.value(value); + ret.set_done(done); + ret.set_value(value); ret } #[deprecated = "Use `set_done()` instead."] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs index 9286c1e5bc7..36c3fab45be 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupDescriptor.rs @@ -83,8 +83,8 @@ impl GpuBindGroupDescriptor { pub fn new(entries: &::wasm_bindgen::JsValue, layout: &GpuBindGroupLayout) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entries(entries); - ret.layout(layout); + ret.set_entries(entries); + ret.set_layout(layout); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs index dff39885718..261e29d9b65 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupEntry.rs @@ -62,8 +62,8 @@ impl GpuBindGroupEntry { pub fn new(binding: u32, resource: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.binding(binding); - ret.resource(resource); + ret.set_binding(binding); + ret.set_resource(resource); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs index e79a77fa15e..d82524670a9 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutDescriptor.rs @@ -62,7 +62,7 @@ impl GpuBindGroupLayoutDescriptor { pub fn new(entries: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entries(entries); + ret.set_entries(entries); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs index 6472b43a32e..7d034cd6d30 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs @@ -172,8 +172,8 @@ impl GpuBindGroupLayoutEntry { pub fn new(binding: u32, visibility: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.binding(binding); - ret.visibility(visibility); + ret.set_binding(binding); + ret.set_visibility(visibility); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBlendState.rs b/crates/web-sys/src/features/gen_GpuBlendState.rs index cdb7dc9f043..19891949998 100644 --- a/crates/web-sys/src/features/gen_GpuBlendState.rs +++ b/crates/web-sys/src/features/gen_GpuBlendState.rs @@ -67,8 +67,8 @@ impl GpuBlendState { pub fn new(alpha: &GpuBlendComponent, color: &GpuBlendComponent) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.alpha(alpha); - ret.color(color); + ret.set_alpha(alpha); + ret.set_color(color); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBufferBinding.rs b/crates/web-sys/src/features/gen_GpuBufferBinding.rs index 312055ad44f..24d42a64e29 100644 --- a/crates/web-sys/src/features/gen_GpuBufferBinding.rs +++ b/crates/web-sys/src/features/gen_GpuBufferBinding.rs @@ -83,7 +83,7 @@ impl GpuBufferBinding { pub fn new(buffer: &GpuBuffer) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.buffer(buffer); + ret.set_buffer(buffer); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs index 47db1c0629f..76717205232 100644 --- a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs @@ -98,8 +98,8 @@ impl GpuBufferDescriptor { pub fn new(size: f64, usage: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.size(size); - ret.usage(usage); + ret.set_size(size); + ret.set_usage(usage); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs index 956cb9494c3..b54672a0a8b 100644 --- a/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs +++ b/crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs @@ -143,8 +143,8 @@ impl GpuCanvasConfiguration { pub fn new(device: &GpuDevice, format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.device(device); - ret.format(format); + ret.set_device(device); + ret.set_format(format); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuColorDict.rs b/crates/web-sys/src/features/gen_GpuColorDict.rs index 38af75d3cb3..382cdee44d1 100644 --- a/crates/web-sys/src/features/gen_GpuColorDict.rs +++ b/crates/web-sys/src/features/gen_GpuColorDict.rs @@ -98,10 +98,10 @@ impl GpuColorDict { pub fn new(a: f64, b: f64, g: f64, r: f64) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.a(a); - ret.b(b); - ret.g(g); - ret.r(r); + ret.set_a(a); + ret.set_b(b); + ret.set_g(g); + ret.set_r(r); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuColorTargetState.rs b/crates/web-sys/src/features/gen_GpuColorTargetState.rs index e4b651285fd..74f0be3bbe4 100644 --- a/crates/web-sys/src/features/gen_GpuColorTargetState.rs +++ b/crates/web-sys/src/features/gen_GpuColorTargetState.rs @@ -85,7 +85,7 @@ impl GpuColorTargetState { pub fn new(format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); + ret.set_format(format); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs index 5ff73d7fd3c..91d78ef3220 100644 --- a/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuComputePassTimestampWrites.rs @@ -83,7 +83,7 @@ impl GpuComputePassTimestampWrites { pub fn new(query_set: &GpuQuerySet) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.query_set(query_set); + ret.set_query_set(query_set); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs index ad3e703eeec..59e45fe7058 100644 --- a/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuComputePipelineDescriptor.rs @@ -83,8 +83,8 @@ impl GpuComputePipelineDescriptor { pub fn new(layout: &::wasm_bindgen::JsValue, compute: &GpuProgrammableStage) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.layout(layout); - ret.compute(compute); + ret.set_layout(layout); + ret.set_compute(compute); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs b/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs index 8233e356331..07556787ff0 100644 --- a/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs +++ b/crates/web-sys/src/features/gen_GpuCopyExternalImageDestInfo.rs @@ -121,7 +121,7 @@ impl GpuCopyExternalImageDestInfo { pub fn new(texture: &GpuTexture) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.texture(texture); + ret.set_texture(texture); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs b/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs index 6e1ed36f7aa..4e66439b2e4 100644 --- a/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs +++ b/crates/web-sys/src/features/gen_GpuCopyExternalImageSourceInfo.rs @@ -80,7 +80,7 @@ impl GpuCopyExternalImageSourceInfo { pub fn new(source: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.source(source); + ret.set_source(source); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs index 0c9a964b7f2..9b7136cd992 100644 --- a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs +++ b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs @@ -215,7 +215,7 @@ impl GpuDepthStencilState { pub fn new(format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); + ret.set_format(format); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs index afe482f277c..9f929493bbb 100644 --- a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs @@ -80,7 +80,7 @@ impl GpuExtent3dDict { pub fn new(width: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.width(width); + ret.set_width(width); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs index d63e3ca9ffd..f37b1fdfafd 100644 --- a/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs @@ -62,7 +62,7 @@ impl GpuExternalTextureDescriptor { pub fn new(source: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.source(source); + ret.set_source(source); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 6dd9656413b..629d5d91457 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -101,8 +101,8 @@ impl GpuFragmentState { pub fn new(module: &GpuShaderModule, targets: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.module(module); - ret.targets(targets); + ret.set_module(module); + ret.set_targets(targets); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs index 6f3b7a5746f..e1c0e767c89 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineDescriptorBase.rs @@ -62,7 +62,7 @@ impl GpuPipelineDescriptorBase { pub fn new(layout: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.layout(layout); + ret.set_layout(layout); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs index cc70a2d1386..0fa5b6ad82b 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineErrorInit.rs @@ -47,7 +47,7 @@ impl GpuPipelineErrorInit { pub fn new(reason: GpuPipelineErrorReason) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.reason(reason); + ret.set_reason(reason); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs index e62aecd6cc7..a3a85ed1f38 100644 --- a/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuPipelineLayoutDescriptor.rs @@ -65,7 +65,7 @@ impl GpuPipelineLayoutDescriptor { pub fn new(bind_group_layouts: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.bind_group_layouts(bind_group_layouts); + ret.set_bind_group_layouts(bind_group_layouts); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index 0daa32340d8..e1c87405e80 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -83,7 +83,7 @@ impl GpuProgrammableStage { pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.module(module); + ret.set_module(module); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs index f853728775d..c632dcd98e1 100644 --- a/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuQuerySetDescriptor.rs @@ -83,8 +83,8 @@ impl GpuQuerySetDescriptor { pub fn new(count: u32, type_: GpuQueryType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.count(count); - ret.type_(type_); + ret.set_count(count); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs index 0f9da7016bc..04a4f6022f9 100644 --- a/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderBundleEncoderDescriptor.rs @@ -141,7 +141,7 @@ impl GpuRenderBundleEncoderDescriptor { pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.color_formats(color_formats); + ret.set_color_formats(color_formats); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index 7df6be14024..e2f6377ae81 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -147,9 +147,9 @@ impl GpuRenderPassColorAttachment { pub fn new(load_op: GpuLoadOp, store_op: GpuStoreOp, view: &GpuTextureView) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.load_op(load_op); - ret.store_op(store_op); - ret.view(view); + ret.set_load_op(load_op); + ret.set_store_op(store_op); + ret.set_view(view); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs index b7748828b22..45858297551 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDepthStencilAttachment.rs @@ -199,7 +199,7 @@ impl GpuRenderPassDepthStencilAttachment { pub fn new(view: &GpuTextureView) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.view(view); + ret.set_view(view); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs index 13cdb794998..e7e581c00ed 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassDescriptor.rs @@ -147,7 +147,7 @@ impl GpuRenderPassDescriptor { pub fn new(color_attachments: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.color_attachments(color_attachments); + ret.set_color_attachments(color_attachments); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs index 2d1b53744c5..0ff32c6eb0e 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassLayout.rs @@ -100,7 +100,7 @@ impl GpuRenderPassLayout { pub fn new(color_formats: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.color_formats(color_formats); + ret.set_color_formats(color_formats); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs index 20f9342c498..d7524eda362 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassTimestampWrites.rs @@ -83,7 +83,7 @@ impl GpuRenderPassTimestampWrites { pub fn new(query_set: &GpuQuerySet) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.query_set(query_set); + ret.set_query_set(query_set); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs index d9fe1b72344..687439e5293 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPipelineDescriptor.rs @@ -163,8 +163,8 @@ impl GpuRenderPipelineDescriptor { pub fn new(layout: &::wasm_bindgen::JsValue, vertex: &GpuVertexState) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.layout(layout); - ret.vertex(vertex); + ret.set_layout(layout); + ret.set_vertex(vertex); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index 69108e9b950..04c95923596 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -62,7 +62,7 @@ impl GpuShaderModuleCompilationHint { pub fn new(entry_point: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); + ret.set_entry_point(entry_point); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index b6c3a7b2433..33291f08ab4 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -80,7 +80,7 @@ impl GpuShaderModuleDescriptor { pub fn new(code: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.code(code); + ret.set_code(code); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs index dfba66d770f..a95ad6cc1b8 100644 --- a/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs +++ b/crates/web-sys/src/features/gen_GpuStorageTextureBindingLayout.rs @@ -89,7 +89,7 @@ impl GpuStorageTextureBindingLayout { pub fn new(format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); + ret.set_format(format); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs b/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs index a950be4a318..c364ceb20c4 100644 --- a/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs +++ b/crates/web-sys/src/features/gen_GpuTexelCopyBufferInfo.rs @@ -101,7 +101,7 @@ impl GpuTexelCopyBufferInfo { pub fn new(buffer: &GpuBuffer) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.buffer(buffer); + ret.set_buffer(buffer); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs b/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs index b57011e67a5..a2274cefc6e 100644 --- a/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs +++ b/crates/web-sys/src/features/gen_GpuTexelCopyTextureInfo.rs @@ -103,7 +103,7 @@ impl GpuTexelCopyTextureInfo { pub fn new(texture: &GpuTexture) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.texture(texture); + ret.set_texture(texture); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs index c889e583bc1..3f6472ba5e6 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDescriptor.rs @@ -175,9 +175,9 @@ impl GpuTextureDescriptor { pub fn new(format: GpuTextureFormat, size: &::wasm_bindgen::JsValue, usage: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); - ret.size(size); - ret.usage(usage); + ret.set_format(format); + ret.set_size(size); + ret.set_usage(usage); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs index ad6aeef6943..b439dcbc638 100644 --- a/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_GpuUncapturedErrorEventInit.rs @@ -101,7 +101,7 @@ impl GpuUncapturedErrorEventInit { pub fn new(error: &GpuError) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); + ret.set_error(error); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs index b2dba6dc8c4..26a132fdb22 100644 --- a/crates/web-sys/src/features/gen_GpuVertexAttribute.rs +++ b/crates/web-sys/src/features/gen_GpuVertexAttribute.rs @@ -83,9 +83,9 @@ impl GpuVertexAttribute { pub fn new(format: GpuVertexFormat, offset: f64, shader_location: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.format(format); - ret.offset(offset); - ret.shader_location(shader_location); + ret.set_format(format); + ret.set_offset(offset); + ret.set_shader_location(shader_location); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs index 267152e982c..102f7a24b33 100644 --- a/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs +++ b/crates/web-sys/src/features/gen_GpuVertexBufferLayout.rs @@ -82,8 +82,8 @@ impl GpuVertexBufferLayout { pub fn new(array_stride: f64, attributes: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.array_stride(array_stride); - ret.attributes(attributes); + ret.set_array_stride(array_stride); + ret.set_attributes(attributes); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index f2dc669628a..41bd609a2b3 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -101,7 +101,7 @@ impl GpuVertexState { pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.module(module); + ret.set_module(module); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs index 3faf25b8854..18f3f222a57 100644 --- a/crates/web-sys/src/features/gen_HidConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_HidConnectionEventInit.rs @@ -101,7 +101,7 @@ impl HidConnectionEventInit { pub fn new(device: &HidDevice) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.device(device); + ret.set_device(device); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs index 81faf1780ef..01af4b0e4a7 100644 --- a/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_HidDeviceRequestOptions.rs @@ -44,7 +44,7 @@ impl HidDeviceRequestOptions { pub fn new(filters: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.filters(filters); + ret.set_filters(filters); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs index b13704deac9..83dfe976813 100644 --- a/crates/web-sys/src/features/gen_HidInputReportEventInit.rs +++ b/crates/web-sys/src/features/gen_HidInputReportEventInit.rs @@ -137,9 +137,9 @@ impl HidInputReportEventInit { pub fn new(data: &::js_sys::DataView, device: &HidDevice, report_id: u8) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.device(device); - ret.report_id(report_id); + ret.set_data(data); + ret.set_device(device); + ret.set_report_id(report_id); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_HkdfParams.rs b/crates/web-sys/src/features/gen_HkdfParams.rs index bd0211c11d1..8222ac9e8e2 100644 --- a/crates/web-sys/src/features/gen_HkdfParams.rs +++ b/crates/web-sys/src/features/gen_HkdfParams.rs @@ -63,10 +63,10 @@ impl HkdfParams { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); - ret.info(info); - ret.salt(salt); + ret.set_name(name); + ret.set_hash(hash); + ret.set_info(info); + ret.set_salt(salt); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs index e8968782451..a750e6e4695 100644 --- a/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs +++ b/crates/web-sys/src/features/gen_HmacDerivedKeyParams.rs @@ -48,8 +48,8 @@ impl HmacDerivedKeyParams { pub fn new(name: &str, hash: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); + ret.set_name(name); + ret.set_hash(hash); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_HmacImportParams.rs b/crates/web-sys/src/features/gen_HmacImportParams.rs index cb02e69a836..8b53b90fa19 100644 --- a/crates/web-sys/src/features/gen_HmacImportParams.rs +++ b/crates/web-sys/src/features/gen_HmacImportParams.rs @@ -38,8 +38,8 @@ impl HmacImportParams { pub fn new(name: &str, hash: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); + ret.set_name(name); + ret.set_hash(hash); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs index 8982dde472b..9d8d531f280 100644 --- a/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_HmacKeyAlgorithm.rs @@ -51,9 +51,9 @@ impl HmacKeyAlgorithm { pub fn new(name: &str, hash: &KeyAlgorithm, length: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); - ret.length(length); + ret.set_name(name); + ret.set_hash(hash); + ret.set_length(length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs index d051e11f672..8fa104cd5f1 100644 --- a/crates/web-sys/src/features/gen_HmacKeyGenParams.rs +++ b/crates/web-sys/src/features/gen_HmacKeyGenParams.rs @@ -48,8 +48,8 @@ impl HmacKeyGenParams { pub fn new(name: &str, hash: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); + ret.set_name(name); + ret.set_hash(hash); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_IirFilterOptions.rs b/crates/web-sys/src/features/gen_IirFilterOptions.rs index 60c8530fbdb..c59d296f33f 100644 --- a/crates/web-sys/src/features/gen_IirFilterOptions.rs +++ b/crates/web-sys/src/features/gen_IirFilterOptions.rs @@ -72,8 +72,8 @@ impl IirFilterOptions { pub fn new(feedback: &::wasm_bindgen::JsValue, feedforward: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.feedback(feedback); - ret.feedforward(feedforward); + ret.set_feedback(feedback); + ret.set_feedforward(feedforward); ret } #[deprecated = "Use `set_channel_count()` instead."] diff --git a/crates/web-sys/src/features/gen_ImageDecodeResult.rs b/crates/web-sys/src/features/gen_ImageDecodeResult.rs index 8810025886c..69eae0cce5f 100644 --- a/crates/web-sys/src/features/gen_ImageDecodeResult.rs +++ b/crates/web-sys/src/features/gen_ImageDecodeResult.rs @@ -65,8 +65,8 @@ impl ImageDecodeResult { pub fn new(complete: bool, image: &VideoFrame) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.complete(complete); - ret.image(image); + ret.set_complete(complete); + ret.set_image(image); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index 50dbd0d18c9..8347a669e0e 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -156,8 +156,8 @@ impl ImageDecoderInit { pub fn new(data: &::wasm_bindgen::JsValue, type_: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.data(data); - ret.type_(type_); + ret.set_data(data); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs index e9588ef123a..040bc7c312d 100644 --- a/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs +++ b/crates/web-sys/src/features/gen_IntersectionObserverEntryInit.rs @@ -83,11 +83,11 @@ impl IntersectionObserverEntryInit { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.bounding_client_rect(bounding_client_rect); - ret.intersection_rect(intersection_rect); - ret.root_bounds(root_bounds); - ret.target(target); - ret.time(time); + ret.set_bounding_client_rect(bounding_client_rect); + ret.set_intersection_rect(intersection_rect); + ret.set_root_bounds(root_bounds); + ret.set_target(target); + ret.set_time(time); ret } #[cfg(feature = "DomRectInit")] diff --git a/crates/web-sys/src/features/gen_JsonWebKey.rs b/crates/web-sys/src/features/gen_JsonWebKey.rs index c3ebdda3d67..c45d21fcd6a 100644 --- a/crates/web-sys/src/features/gen_JsonWebKey.rs +++ b/crates/web-sys/src/features/gen_JsonWebKey.rs @@ -198,7 +198,7 @@ impl JsonWebKey { pub fn new(kty: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.kty(kty); + ret.set_kty(kty); ret } #[deprecated = "Use `set_alg()` instead."] diff --git a/crates/web-sys/src/features/gen_KeyAlgorithm.rs b/crates/web-sys/src/features/gen_KeyAlgorithm.rs index b68a4801f8f..80be162fa90 100644 --- a/crates/web-sys/src/features/gen_KeyAlgorithm.rs +++ b/crates/web-sys/src/features/gen_KeyAlgorithm.rs @@ -28,7 +28,7 @@ impl KeyAlgorithm { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_KeyIdsInitData.rs b/crates/web-sys/src/features/gen_KeyIdsInitData.rs index c05623d59d3..c6f785a3d73 100644 --- a/crates/web-sys/src/features/gen_KeyIdsInitData.rs +++ b/crates/web-sys/src/features/gen_KeyIdsInitData.rs @@ -28,7 +28,7 @@ impl KeyIdsInitData { pub fn new(kids: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.kids(kids); + ret.set_kids(kids); ret } #[deprecated = "Use `set_kids()` instead."] diff --git a/crates/web-sys/src/features/gen_L10nElement.rs b/crates/web-sys/src/features/gen_L10nElement.rs index 3547a5b1455..0ee26b8266c 100644 --- a/crates/web-sys/src/features/gen_L10nElement.rs +++ b/crates/web-sys/src/features/gen_L10nElement.rs @@ -78,9 +78,9 @@ impl L10nElement { pub fn new(l10n_id: &str, local_name: &str, namespace_uri: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.l10n_id(l10n_id); - ret.local_name(local_name); - ret.namespace_uri(namespace_uri); + ret.set_l10n_id(l10n_id); + ret.set_local_name(local_name); + ret.set_namespace_uri(namespace_uri); ret } #[deprecated = "Use `set_l10n_args()` instead."] diff --git a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs index 297dd25ef9c..8fac4291e8f 100644 --- a/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaDecodingConfiguration.rs @@ -55,7 +55,7 @@ impl MediaDecodingConfiguration { pub fn new(type_: MediaDecodingType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[cfg(feature = "AudioConfiguration")] diff --git a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs index 5e5eb4b2621..2c9735b71c5 100644 --- a/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaElementAudioSourceOptions.rs @@ -31,7 +31,7 @@ impl MediaElementAudioSourceOptions { pub fn new(media_element: &HtmlMediaElement) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.media_element(media_element); + ret.set_media_element(media_element); ret } #[cfg(feature = "HtmlMediaElement")] diff --git a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs index 1880ab1d8d3..2b7c56af555 100644 --- a/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs +++ b/crates/web-sys/src/features/gen_MediaEncodingConfiguration.rs @@ -55,7 +55,7 @@ impl MediaEncodingConfiguration { pub fn new(type_: MediaEncodingType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[cfg(feature = "AudioConfiguration")] diff --git a/crates/web-sys/src/features/gen_MediaImage.rs b/crates/web-sys/src/features/gen_MediaImage.rs index d09ff96418b..524dd2ceb52 100644 --- a/crates/web-sys/src/features/gen_MediaImage.rs +++ b/crates/web-sys/src/features/gen_MediaImage.rs @@ -80,7 +80,7 @@ impl MediaImage { pub fn new(src: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.src(src); + ret.set_src(src); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs index 8b64ac9ada6..793bfe30038 100644 --- a/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaKeyMessageEventInit.rs @@ -71,8 +71,8 @@ impl MediaKeyMessageEventInit { pub fn new(message: &::js_sys::ArrayBuffer, message_type: MediaKeyMessageType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.message(message); - ret.message_type(message_type); + ret.set_message(message); + ret.set_message_type(message_type); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs index 0c853852267..1e73b9846a7 100644 --- a/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaRecorderErrorEventInit.rs @@ -61,7 +61,7 @@ impl MediaRecorderErrorEventInit { pub fn new(error: &DomException) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); + ret.set_error(error); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs index 69cc21f6087..679e574a7e2 100644 --- a/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs +++ b/crates/web-sys/src/features/gen_MediaSessionActionDetails.rs @@ -101,7 +101,7 @@ impl MediaSessionActionDetails { pub fn new(action: MediaSessionAction) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.action(action); + ret.set_action(action); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs index 891dbe1e355..f7d58375fa3 100644 --- a/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs +++ b/crates/web-sys/src/features/gen_MediaStreamAudioSourceOptions.rs @@ -31,7 +31,7 @@ impl MediaStreamAudioSourceOptions { pub fn new(media_stream: &MediaStream) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.media_stream(media_stream); + ret.set_media_stream(media_stream); ret } #[cfg(feature = "MediaStream")] diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs index 734dfeede6c..6b8a54383e6 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackEventInit.rs @@ -61,7 +61,7 @@ impl MediaStreamTrackEventInit { pub fn new(track: &MediaStreamTrack) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.track(track); + ret.set_track(track); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs index 6c943531a80..eabbd1f487b 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackGeneratorInit.rs @@ -44,7 +44,7 @@ impl MediaStreamTrackGeneratorInit { pub fn new(kind: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.kind(kind); + ret.set_kind(kind); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs index 76cf12ab2c0..fc9946330d5 100644 --- a/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs +++ b/crates/web-sys/src/features/gen_MediaStreamTrackProcessorInit.rs @@ -65,7 +65,7 @@ impl MediaStreamTrackProcessorInit { pub fn new(track: &MediaStreamTrack) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.track(track); + ret.set_track(track); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_NotificationAction.rs b/crates/web-sys/src/features/gen_NotificationAction.rs index 4e129c3c83d..61f4f408041 100644 --- a/crates/web-sys/src/features/gen_NotificationAction.rs +++ b/crates/web-sys/src/features/gen_NotificationAction.rs @@ -48,8 +48,8 @@ impl NotificationAction { pub fn new(action: &str, title: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.action(action); - ret.title(title); + ret.set_action(action); + ret.set_title(title); ret } #[deprecated = "Use `set_action()` instead."] diff --git a/crates/web-sys/src/features/gen_NotificationEventInit.rs b/crates/web-sys/src/features/gen_NotificationEventInit.rs index c7b748a391f..0cc86bacbfe 100644 --- a/crates/web-sys/src/features/gen_NotificationEventInit.rs +++ b/crates/web-sys/src/features/gen_NotificationEventInit.rs @@ -61,7 +61,7 @@ impl NotificationEventInit { pub fn new(notification: &Notification) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.notification(notification); + ret.set_notification(notification); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs index 45043ee73a7..1d123058e01 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioCompletionEventInit.rs @@ -61,7 +61,7 @@ impl OfflineAudioCompletionEventInit { pub fn new(rendered_buffer: &AudioBuffer) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.rendered_buffer(rendered_buffer); + ret.set_rendered_buffer(rendered_buffer); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs index b1fd7829e6c..db91b726dcb 100644 --- a/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs +++ b/crates/web-sys/src/features/gen_OfflineAudioContextOptions.rs @@ -48,8 +48,8 @@ impl OfflineAudioContextOptions { pub fn new(length: u32, sample_rate: f32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.length(length); - ret.sample_rate(sample_rate); + ret.set_length(length); + ret.set_sample_rate(sample_rate); ret } #[deprecated = "Use `set_length()` instead."] diff --git a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs index 87c5f878523..14249066fad 100644 --- a/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_PaymentMethodChangeEventInit.rs @@ -68,7 +68,7 @@ impl PaymentMethodChangeEventInit { pub fn new(method_name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.method_name(method_name); + ret.set_method_name(method_name); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_Pbkdf2Params.rs b/crates/web-sys/src/features/gen_Pbkdf2Params.rs index ad375504af1..8a44fa1a697 100644 --- a/crates/web-sys/src/features/gen_Pbkdf2Params.rs +++ b/crates/web-sys/src/features/gen_Pbkdf2Params.rs @@ -63,10 +63,10 @@ impl Pbkdf2Params { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.hash(hash); - ret.iterations(iterations); - ret.salt(salt); + ret.set_name(name); + ret.set_hash(hash); + ret.set_iterations(iterations); + ret.set_salt(salt); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs index 5a09e11a391..87721fe39d8 100644 --- a/crates/web-sys/src/features/gen_PerformanceObserverInit.rs +++ b/crates/web-sys/src/features/gen_PerformanceObserverInit.rs @@ -38,7 +38,7 @@ impl PerformanceObserverInit { pub fn new(entry_types: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_types(entry_types); + ret.set_entry_types(entry_types); ret } #[deprecated = "Use `set_buffered()` instead."] diff --git a/crates/web-sys/src/features/gen_PermissionDescriptor.rs b/crates/web-sys/src/features/gen_PermissionDescriptor.rs index 23005e4591f..3dff9f85e49 100644 --- a/crates/web-sys/src/features/gen_PermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_PermissionDescriptor.rs @@ -31,7 +31,7 @@ impl PermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(feature = "PermissionName")] diff --git a/crates/web-sys/src/features/gen_PlaneLayout.rs b/crates/web-sys/src/features/gen_PlaneLayout.rs index 5b6df33cc86..288bd301dbb 100644 --- a/crates/web-sys/src/features/gen_PlaneLayout.rs +++ b/crates/web-sys/src/features/gen_PlaneLayout.rs @@ -62,8 +62,8 @@ impl PlaneLayout { pub fn new(offset: u32, stride: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.offset(offset); - ret.stride(stride); + ret.set_offset(offset); + ret.set_stride(stride); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs index 22ef4de372d..cc0e4689549 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionAvailableEventInit.rs @@ -66,7 +66,7 @@ impl PresentationConnectionAvailableEventInit { pub fn new(connection: &PresentationConnection) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.connection(connection); + ret.set_connection(connection); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs index 3e98fe959de..caed706a7cb 100644 --- a/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs +++ b/crates/web-sys/src/features/gen_PresentationConnectionCloseEventInit.rs @@ -78,7 +78,7 @@ impl PresentationConnectionCloseEventInit { pub fn new(reason: PresentationConnectionClosedReason) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.reason(reason); + ret.set_reason(reason); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs index 328fbe07318..2aa16f55ab4 100644 --- a/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs +++ b/crates/web-sys/src/features/gen_PromiseRejectionEventInit.rs @@ -68,7 +68,7 @@ impl PromiseRejectionEventInit { pub fn new(promise: &::js_sys::Promise) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.promise(promise); + ret.set_promise(promise); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs index 8a4ac9a0f6e..d2ccef27666 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptions.rs @@ -191,10 +191,10 @@ impl PublicKeyCredentialCreationOptions { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.challenge(challenge); - ret.pub_key_cred_params(pub_key_cred_params); - ret.rp(rp); - ret.user(user); + ret.set_challenge(challenge); + ret.set_pub_key_cred_params(pub_key_cred_params); + ret.set_rp(rp); + ret.set_user(user); ret } #[cfg(feature = "AttestationConveyancePreference")] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs index 141656b0552..6f458e7aef4 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialCreationOptionsJson.rs @@ -273,10 +273,10 @@ impl PublicKeyCredentialCreationOptionsJson { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.challenge(challenge); - ret.pub_key_cred_params(pub_key_cred_params); - ret.rp(rp); - ret.user(user); + ret.set_challenge(challenge); + ret.set_pub_key_cred_params(pub_key_cred_params); + ret.set_rp(rp); + ret.set_user(user); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs index 3781622c4b3..e249e9ad90e 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptor.rs @@ -51,8 +51,8 @@ impl PublicKeyCredentialDescriptor { pub fn new(id: &::js_sys::Object, type_: PublicKeyCredentialType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.id(id); - ret.type_(type_); + ret.set_id(id); + ret.set_type(type_); ret } #[deprecated = "Use `set_id()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs index 8da096e18c3..1286331068a 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialDescriptorJson.rs @@ -80,8 +80,8 @@ impl PublicKeyCredentialDescriptorJson { pub fn new(id: &str, type_: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.id(id); - ret.type_(type_); + ret.set_id(id); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs index 86167d5d1af..1ba7d6d33cb 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialEntity.rs @@ -40,7 +40,7 @@ impl PublicKeyCredentialEntity { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_icon()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs index a2903ffb8f2..4ce14e7be70 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialParameters.rs @@ -41,8 +41,8 @@ impl PublicKeyCredentialParameters { pub fn new(alg: i32, type_: PublicKeyCredentialType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.alg(alg); - ret.type_(type_); + ret.set_alg(alg); + ret.set_type(type_); ret } #[deprecated = "Use `set_alg()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs index 086a6bdf104..ba3395948ac 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptions.rs @@ -158,7 +158,7 @@ impl PublicKeyCredentialRequestOptions { pub fn new(challenge: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.challenge(challenge); + ret.set_challenge(challenge); ret } #[deprecated = "Use `set_allow_credentials()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs index 2e171f3207a..69fc82c203c 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRequestOptionsJson.rs @@ -211,7 +211,7 @@ impl PublicKeyCredentialRequestOptionsJson { pub fn new(challenge: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.challenge(challenge); + ret.set_challenge(challenge); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs index 33bfd85dd57..9aa8f351787 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialRpEntity.rs @@ -50,7 +50,7 @@ impl PublicKeyCredentialRpEntity { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_icon()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs index 9acbacfdaa1..f53cbdc6e92 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntity.rs @@ -60,9 +60,9 @@ impl PublicKeyCredentialUserEntity { pub fn new(name: &str, display_name: &str, id: &::js_sys::Object) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.display_name(display_name); - ret.id(id); + ret.set_name(name); + ret.set_display_name(display_name); + ret.set_id(id); ret } #[deprecated = "Use `set_icon()` instead."] diff --git a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs index 80b9176bd88..19793f331b0 100644 --- a/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs +++ b/crates/web-sys/src/features/gen_PublicKeyCredentialUserEntityJson.rs @@ -80,9 +80,9 @@ impl PublicKeyCredentialUserEntityJson { pub fn new(display_name: &str, id: &str, name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.display_name(display_name); - ret.id(id); - ret.name(name); + ret.set_display_name(display_name); + ret.set_id(id); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs index 846cfcffc04..15eeb90b69a 100644 --- a/crates/web-sys/src/features/gen_PushSubscriptionInit.rs +++ b/crates/web-sys/src/features/gen_PushSubscriptionInit.rs @@ -68,8 +68,8 @@ impl PushSubscriptionInit { pub fn new(endpoint: &str, scope: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.endpoint(endpoint); - ret.scope(scope); + ret.set_endpoint(endpoint); + ret.set_scope(scope); ret } #[deprecated = "Use `set_app_server_key()` instead."] diff --git a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs index e917016bf96..4a7917a8ed2 100644 --- a/crates/web-sys/src/features/gen_QueuingStrategyInit.rs +++ b/crates/web-sys/src/features/gen_QueuingStrategyInit.rs @@ -28,7 +28,7 @@ impl QueuingStrategyInit { pub fn new(high_water_mark: f64) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.high_water_mark(high_water_mark); + ret.set_high_water_mark(high_water_mark); ret } #[deprecated = "Use `set_high_water_mark()` instead."] diff --git a/crates/web-sys/src/features/gen_ReadableWritablePair.rs b/crates/web-sys/src/features/gen_ReadableWritablePair.rs index 5b15a0cf997..2c6af13c0fb 100644 --- a/crates/web-sys/src/features/gen_ReadableWritablePair.rs +++ b/crates/web-sys/src/features/gen_ReadableWritablePair.rs @@ -43,8 +43,8 @@ impl ReadableWritablePair { pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.readable(readable); - ret.writable(writable); + ret.set_readable(readable); + ret.set_writable(writable); ret } #[cfg(feature = "ReadableStream")] diff --git a/crates/web-sys/src/features/gen_RegistrationResponseJson.rs b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs index 7f298fc1e50..a4969714478 100644 --- a/crates/web-sys/src/features/gen_RegistrationResponseJson.rs +++ b/crates/web-sys/src/features/gen_RegistrationResponseJson.rs @@ -158,11 +158,11 @@ impl RegistrationResponseJson { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.client_extension_results(client_extension_results); - ret.id(id); - ret.raw_id(raw_id); - ret.response(response); - ret.type_(type_); + ret.set_client_extension_results(client_extension_results); + ret.set_id(id); + ret.set_raw_id(raw_id); + ret.set_response(response); + ret.set_type(type_); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs index d1eee89efe3..41e36acc87a 100644 --- a/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs +++ b/crates/web-sys/src/features/gen_RequestMediaKeySystemAccessNotification.rs @@ -43,8 +43,8 @@ impl RequestMediaKeySystemAccessNotification { pub fn new(key_system: &str, status: MediaKeySystemStatus) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.key_system(key_system); - ret.status(status); + ret.set_key_system(key_system); + ret.set_status(status); ret } #[deprecated = "Use `set_key_system()` instead."] diff --git a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs index f9f3a04a3fb..9914e446111 100644 --- a/crates/web-sys/src/features/gen_RsaHashedImportParams.rs +++ b/crates/web-sys/src/features/gen_RsaHashedImportParams.rs @@ -28,7 +28,7 @@ impl RsaHashedImportParams { pub fn new(hash: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.hash(hash); + ret.set_hash(hash); ret } #[deprecated = "Use `set_hash()` instead."] diff --git a/crates/web-sys/src/features/gen_RsaOaepParams.rs b/crates/web-sys/src/features/gen_RsaOaepParams.rs index 7bf27c6183c..a2e5647fd48 100644 --- a/crates/web-sys/src/features/gen_RsaOaepParams.rs +++ b/crates/web-sys/src/features/gen_RsaOaepParams.rs @@ -38,7 +38,7 @@ impl RsaOaepParams { pub fn new(name: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs index eb9b9fba968..23c1d5cb4ee 100644 --- a/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs +++ b/crates/web-sys/src/features/gen_RsaOtherPrimesInfo.rs @@ -48,9 +48,9 @@ impl RsaOtherPrimesInfo { pub fn new(d: &str, r: &str, t: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.d(d); - ret.r(r); - ret.t(t); + ret.set_d(d); + ret.set_r(r); + ret.set_t(t); ret } #[deprecated = "Use `set_d()` instead."] diff --git a/crates/web-sys/src/features/gen_RsaPssParams.rs b/crates/web-sys/src/features/gen_RsaPssParams.rs index 8760c5de791..85b1e134af0 100644 --- a/crates/web-sys/src/features/gen_RsaPssParams.rs +++ b/crates/web-sys/src/features/gen_RsaPssParams.rs @@ -38,8 +38,8 @@ impl RsaPssParams { pub fn new(name: &str, salt_length: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); - ret.salt_length(salt_length); + ret.set_name(name); + ret.set_salt_length(salt_length); ret } #[deprecated = "Use `set_name()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs index 9f798bbc70e..83d82534274 100644 --- a/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcDataChannelEventInit.rs @@ -61,7 +61,7 @@ impl RtcDataChannelEventInit { pub fn new(channel: &RtcDataChannel) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.channel(channel); + ret.set_channel(channel); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs index 442d5a9a898..0397145de9e 100644 --- a/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs +++ b/crates/web-sys/src/features/gen_RtcIceCandidateInit.rs @@ -48,7 +48,7 @@ impl RtcIceCandidateInit { pub fn new(candidate: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.candidate(candidate); + ret.set_candidate(candidate); ret } #[deprecated = "Use `set_candidate()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs index 8219c790013..bf40c88aff1 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityAssertionResult.rs @@ -41,8 +41,8 @@ impl RtcIdentityAssertionResult { pub fn new(assertion: &str, idp: &RtcIdentityProviderDetails) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.assertion(assertion); - ret.idp(idp); + ret.set_assertion(assertion); + ret.set_idp(idp); ret } #[deprecated = "Use `set_assertion()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs index 2b3fe976406..7a5176f0217 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProvider.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProvider.rs @@ -41,8 +41,8 @@ impl RtcIdentityProvider { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.generate_assertion(generate_assertion); - ret.validate_assertion(validate_assertion); + ret.set_generate_assertion(generate_assertion); + ret.set_validate_assertion(validate_assertion); ret } #[deprecated = "Use `set_generate_assertion()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs index d085ff7d511..b4f33a40ba9 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityProviderDetails.rs @@ -38,7 +38,7 @@ impl RtcIdentityProviderDetails { pub fn new(domain: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.domain(domain); + ret.set_domain(domain); ret } #[deprecated = "Use `set_domain()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs index 6319985e688..545ad230d04 100644 --- a/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs +++ b/crates/web-sys/src/features/gen_RtcIdentityValidationResult.rs @@ -38,8 +38,8 @@ impl RtcIdentityValidationResult { pub fn new(contents: &str, identity: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.contents(contents); - ret.identity(identity); + ret.set_contents(contents); + ret.set_identity(identity); ret } #[deprecated = "Use `set_contents()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs index 512311482ba..462e8835106 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs @@ -41,8 +41,8 @@ impl RtcRtpCapabilities { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codecs(codecs); - ret.header_extensions(header_extensions); + ret.set_codecs(codecs); + ret.set_header_extensions(header_extensions); ret } #[deprecated = "Use `set_codecs()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs index c919b20766f..dd3f9dde19e 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -58,8 +58,8 @@ impl RtcRtpCodecCapability { pub fn new(clock_rate: u32, mime_type: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.clock_rate(clock_rate); - ret.mime_type(mime_type); + ret.set_clock_rate(clock_rate); + ret.set_mime_type(mime_type); ret } #[deprecated = "Use `set_channels()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs index dc78cb31ad8..27e2f10f628 100644 --- a/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpContributingSource.rs @@ -48,8 +48,8 @@ impl RtcRtpContributingSource { pub fn new(source: u32, timestamp: f64) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.source(source); - ret.timestamp(timestamp); + ret.set_source(source); + ret.set_timestamp(timestamp); ret } #[deprecated = "Use `set_audio_level()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs index f7baf8c29ab..d5558465825 100644 --- a/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs @@ -28,7 +28,7 @@ impl RtcRtpHeaderExtensionCapability { pub fn new(uri: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.uri(uri); + ret.set_uri(uri); ret } #[deprecated = "Use `set_uri()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs index 880bb6be41d..49f4cd6976a 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSourceEntry.rs @@ -71,9 +71,9 @@ impl RtcRtpSourceEntry { pub fn new(source: u32, timestamp: f64, source_type: RtcRtpSourceEntryType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.source(source); - ret.timestamp(timestamp); - ret.source_type(source_type); + ret.set_source(source); + ret.set_timestamp(timestamp); + ret.set_source_type(source_type); ret } #[deprecated = "Use `set_audio_level()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs index ad2d27e2feb..df855761ab6 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSynchronizationSource.rs @@ -58,8 +58,8 @@ impl RtcRtpSynchronizationSource { pub fn new(source: u32, timestamp: f64) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.source(source); - ret.timestamp(timestamp); + ret.set_source(source); + ret.set_timestamp(timestamp); ret } #[deprecated = "Use `set_audio_level()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs index 3418582c993..c1ecf69cad2 100644 --- a/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs +++ b/crates/web-sys/src/features/gen_RtcSessionDescriptionInit.rs @@ -41,7 +41,7 @@ impl RtcSessionDescriptionInit { pub fn new(type_: RtcSdpType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[deprecated = "Use `set_sdp()` instead."] diff --git a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs index e76dc70c25d..ef9451b3105 100644 --- a/crates/web-sys/src/features/gen_RtcTrackEventInit.rs +++ b/crates/web-sys/src/features/gen_RtcTrackEventInit.rs @@ -103,9 +103,9 @@ impl RtcTrackEventInit { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.receiver(receiver); - ret.track(track); - ret.transceiver(transceiver); + ret.set_receiver(receiver); + ret.set_track(track); + ret.set_transceiver(transceiver); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs b/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs index 7acce345f2a..790305d64ee 100644 --- a/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_SFrameTransformErrorEventInit.rs @@ -137,8 +137,8 @@ impl SFrameTransformErrorEventInit { pub fn new(error_type: SFrameTransformErrorEventType, frame: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error_type(error_type); - ret.frame(frame); + ret.set_error_type(error_type); + ret.set_frame(frame); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_SerialInputSignals.rs b/crates/web-sys/src/features/gen_SerialInputSignals.rs index 5cabc7a4ba5..74058bb3536 100644 --- a/crates/web-sys/src/features/gen_SerialInputSignals.rs +++ b/crates/web-sys/src/features/gen_SerialInputSignals.rs @@ -103,10 +103,10 @@ impl SerialInputSignals { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.clear_to_send(clear_to_send); - ret.data_carrier_detect(data_carrier_detect); - ret.data_set_ready(data_set_ready); - ret.ring_indicator(ring_indicator); + ret.set_clear_to_send(clear_to_send); + ret.set_data_carrier_detect(data_carrier_detect); + ret.set_data_set_ready(data_set_ready); + ret.set_ring_indicator(ring_indicator); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_SerialOptions.rs b/crates/web-sys/src/features/gen_SerialOptions.rs index a894c952f73..e82d4e7fe15 100644 --- a/crates/web-sys/src/features/gen_SerialOptions.rs +++ b/crates/web-sys/src/features/gen_SerialOptions.rs @@ -138,7 +138,7 @@ impl SerialOptions { pub fn new(baud_rate: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.baud_rate(baud_rate); + ret.set_baud_rate(baud_rate); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_ShadowRootInit.rs b/crates/web-sys/src/features/gen_ShadowRootInit.rs index 995f1541770..9dc8ec93521 100644 --- a/crates/web-sys/src/features/gen_ShadowRootInit.rs +++ b/crates/web-sys/src/features/gen_ShadowRootInit.rs @@ -31,7 +31,7 @@ impl ShadowRootInit { pub fn new(mode: ShadowRootMode) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.mode(mode); + ret.set_mode(mode); ret } #[cfg(feature = "ShadowRootMode")] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs index 78cf097557c..32df173a5cf 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisErrorEventInit.rs @@ -116,8 +116,8 @@ impl SpeechSynthesisErrorEventInit { pub fn new(utterance: &SpeechSynthesisUtterance, error: SpeechSynthesisErrorCode) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.utterance(utterance); - ret.error(error); + ret.set_utterance(utterance); + ret.set_error(error); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs index 80048f51362..9f9058a9614 100644 --- a/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs +++ b/crates/web-sys/src/features/gen_SpeechSynthesisEventInit.rs @@ -101,7 +101,7 @@ impl SpeechSynthesisEventInit { pub fn new(utterance: &SpeechSynthesisUtterance) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.utterance(utterance); + ret.set_utterance(utterance); ret } #[deprecated = "Use `set_bubbles()` instead."] diff --git a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs index 9180af22954..caf66dc02e6 100644 --- a/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_TaskPriorityChangeEventInit.rs @@ -101,7 +101,7 @@ impl TaskPriorityChangeEventInit { pub fn new(previous_priority: TaskPriority) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.previous_priority(previous_priority); + ret.set_previous_priority(previous_priority); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_TokenBinding.rs b/crates/web-sys/src/features/gen_TokenBinding.rs index 00a5027011c..8066eb2216d 100644 --- a/crates/web-sys/src/features/gen_TokenBinding.rs +++ b/crates/web-sys/src/features/gen_TokenBinding.rs @@ -38,7 +38,7 @@ impl TokenBinding { pub fn new(status: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.status(status); + ret.set_status(status); ret } #[deprecated = "Use `set_id()` instead."] diff --git a/crates/web-sys/src/features/gen_TouchInit.rs b/crates/web-sys/src/features/gen_TouchInit.rs index 37c8a7ab01d..62687525e0a 100644 --- a/crates/web-sys/src/features/gen_TouchInit.rs +++ b/crates/web-sys/src/features/gen_TouchInit.rs @@ -141,8 +141,8 @@ impl TouchInit { pub fn new(identifier: i32, target: &EventTarget) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.identifier(identifier); - ret.target(target); + ret.set_identifier(identifier); + ret.set_target(target); ret } #[deprecated = "Use `set_client_x()` instead."] diff --git a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs index 0e7b327a5a1..a39d26e5708 100644 --- a/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs +++ b/crates/web-sys/src/features/gen_UsbConnectionEventInit.rs @@ -101,7 +101,7 @@ impl UsbConnectionEventInit { pub fn new(device: &UsbDevice) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.device(device); + ret.set_device(device); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs index 0c8c87d3cb8..7dee38d02ad 100644 --- a/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs +++ b/crates/web-sys/src/features/gen_UsbControlTransferParameters.rs @@ -127,11 +127,11 @@ impl UsbControlTransferParameters { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.index(index); - ret.recipient(recipient); - ret.request(request); - ret.request_type(request_type); - ret.value(value); + ret.set_index(index); + ret.set_recipient(recipient); + ret.set_request(request); + ret.set_request_type(request_type); + ret.set_value(value); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs index b35430fc377..545cc8b66bb 100644 --- a/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs +++ b/crates/web-sys/src/features/gen_UsbDeviceRequestOptions.rs @@ -44,7 +44,7 @@ impl UsbDeviceRequestOptions { pub fn new(filters: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.filters(filters); + ret.set_filters(filters); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs index 7240f61781f..212e844c66b 100644 --- a/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_UsbPermissionDescriptor.rs @@ -65,7 +65,7 @@ impl UsbPermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs index 3ff73219975..d4e4b427ce6 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderConfig.rs @@ -192,7 +192,7 @@ impl VideoDecoderConfig { pub fn new(codec: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); + ret.set_codec(codec); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_VideoDecoderInit.rs b/crates/web-sys/src/features/gen_VideoDecoderInit.rs index 19413cd55ab..abd00678abe 100644 --- a/crates/web-sys/src/features/gen_VideoDecoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoDecoderInit.rs @@ -62,8 +62,8 @@ impl VideoDecoderInit { pub fn new(error: &::js_sys::Function, output: &::js_sys::Function) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); - ret.output(output); + ret.set_error(error); + ret.set_output(output); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs index 55400176e0c..4251ddf8eba 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderConfig.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderConfig.rs @@ -230,9 +230,9 @@ impl VideoEncoderConfig { pub fn new(codec: &str, height: u32, width: u32) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.codec(codec); - ret.height(height); - ret.width(width); + ret.set_codec(codec); + ret.set_height(height); + ret.set_width(width); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_VideoEncoderInit.rs b/crates/web-sys/src/features/gen_VideoEncoderInit.rs index 47bd0e591d8..9bf0c7f83de 100644 --- a/crates/web-sys/src/features/gen_VideoEncoderInit.rs +++ b/crates/web-sys/src/features/gen_VideoEncoderInit.rs @@ -62,8 +62,8 @@ impl VideoEncoderInit { pub fn new(error: &::js_sys::Function, output: &::js_sys::Function) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.error(error); - ret.output(output); + ret.set_error(error); + ret.set_output(output); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs index 6b595155c23..20c3aa7e845 100644 --- a/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs +++ b/crates/web-sys/src/features/gen_VideoFrameBufferInit.rs @@ -218,10 +218,10 @@ impl VideoFrameBufferInit { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.coded_height(coded_height); - ret.coded_width(coded_width); - ret.format(format); - ret.timestamp(timestamp); + ret.set_coded_height(coded_height); + ret.set_coded_width(coded_width); + ret.set_format(format); + ret.set_timestamp(timestamp); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs index d60289d47d4..8283f251227 100644 --- a/crates/web-sys/src/features/gen_WidevineCdmManifest.rs +++ b/crates/web-sys/src/features/gen_WidevineCdmManifest.rs @@ -96,13 +96,13 @@ impl WidevineCdmManifest { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.description(description); - ret.name(name); - ret.version(version); - ret.x_cdm_codecs(x_cdm_codecs); - ret.x_cdm_host_versions(x_cdm_host_versions); - ret.x_cdm_interface_versions(x_cdm_interface_versions); - ret.x_cdm_module_versions(x_cdm_module_versions); + ret.set_description(description); + ret.set_name(name); + ret.set_version(version); + ret.set_x_cdm_codecs(x_cdm_codecs); + ret.set_x_cdm_host_versions(x_cdm_host_versions); + ret.set_x_cdm_interface_versions(x_cdm_interface_versions); + ret.set_x_cdm_module_versions(x_cdm_module_versions); ret } #[deprecated = "Use `set_description()` instead."] diff --git a/crates/web-sys/src/features/gen_WriteParams.rs b/crates/web-sys/src/features/gen_WriteParams.rs index a8c0ac9c754..2a22546459c 100644 --- a/crates/web-sys/src/features/gen_WriteParams.rs +++ b/crates/web-sys/src/features/gen_WriteParams.rs @@ -61,7 +61,7 @@ impl WriteParams { pub fn new(type_: WriteCommandType) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.type_(type_); + ret.set_type(type_); ret } #[deprecated = "Use `set_data()` instead."] diff --git a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs index fc4d8fa2c01..e1d9f2df4de 100644 --- a/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourceEventInit.rs @@ -121,8 +121,8 @@ impl XrInputSourceEventInit { pub fn new(frame: &XrFrame, input_source: &XrInputSource) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.frame(frame); - ret.input_source(input_source); + ret.set_frame(frame); + ret.set_input_source(input_source); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs index c2d2e32e4bb..03c272480e2 100644 --- a/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs +++ b/crates/web-sys/src/features/gen_XrInputSourcesChangeEventInit.rs @@ -141,9 +141,9 @@ impl XrInputSourcesChangeEventInit { ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.added(added); - ret.removed(removed); - ret.session(session); + ret.set_added(added); + ret.set_removed(removed); + ret.set_session(session); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs index 6884a9b83db..8c443ea5856 100644 --- a/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrPermissionDescriptor.rs @@ -103,7 +103,7 @@ impl XrPermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs index 8d36176b94b..63ccbaac1d8 100644 --- a/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs +++ b/crates/web-sys/src/features/gen_XrReferenceSpaceEventInit.rs @@ -121,7 +121,7 @@ impl XrReferenceSpaceEventInit { pub fn new(reference_space: &XrReferenceSpace) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.reference_space(reference_space); + ret.set_reference_space(reference_space); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_XrSessionEventInit.rs b/crates/web-sys/src/features/gen_XrSessionEventInit.rs index 39cea922779..8bb4f6140ff 100644 --- a/crates/web-sys/src/features/gen_XrSessionEventInit.rs +++ b/crates/web-sys/src/features/gen_XrSessionEventInit.rs @@ -101,7 +101,7 @@ impl XrSessionEventInit { pub fn new(session: &XrSession) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.session(session); + ret.set_session(session); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs index 1c1f76d054f..2c8755d9da4 100644 --- a/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs +++ b/crates/web-sys/src/features/gen_XrSessionSupportedPermissionDescriptor.rs @@ -67,7 +67,7 @@ impl XrSessionSupportedPermissionDescriptor { pub fn new(name: PermissionName) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.name(name); + ret.set_name(name); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/webidl/src/generator.rs b/crates/webidl/src/generator.rs index aa7b9e26bbb..0122807bb8a 100644 --- a/crates/webidl/src/generator.rs +++ b/crates/webidl/src/generator.rs @@ -832,9 +832,10 @@ impl Dictionary { for field in fields.iter() { if field.required { let name = rust_ident(&field.name); + let set_name = rust_ident(&format!("set_{}", field.name)); let ty = &field.ty; required_args.push(quote!( #name: #ty )); - required_calls.push(quote!( ret.#name(#name); )); + required_calls.push(quote!( ret.#set_name(#name); )); add_features(&mut required_features, &field.ty); } } From 473e3db38429523627f5c25d02337699f014e198 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 29 Nov 2024 15:41:40 +0100 Subject: [PATCH 575/641] Add environment variables to configure tests (#4295) --- CHANGELOG.md | 3 + .../src/bin/wasm-bindgen-test-runner/main.rs | 60 +++++++++++++------ guide/src/wasm-bindgen-test/browsers.md | 47 +++++++-------- 3 files changed, 67 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 777d4f60031..20a4fe37ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ * Added support for `no_std` to `link_to!`, `static_string` (via `thread_local_v2`) and `throw`. [#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277) +* Added environment variables to configure tests: `WASM_BINDGEN_USE_BROWSER`, `WASM_BINDGEN_USE_DEDICATED_WORKER`, `WASM_BINDGEN_USE_SHARED_WORKER` `WASM_BINDGEN_USE_SERVICE_WORKER`, `WASM_BINDGEN_USE_DENO` and `WASM_BINDGEN_USE_NODE_EXPERIMENTAL`. The use of `wasm_bindgen_test_configure!` will overwrite any environment variable. + [#4295](https://github.com/rustwasm/wasm-bindgen/pull/4295) + ### Changed * String enums now generate private TypeScript types but only if used. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 919702af026..93cead3c2cd 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -54,6 +54,17 @@ impl TestMode { | Self::ServiceWorker { no_modules } => no_modules, } } + + fn env(self) -> &'static str { + match self { + TestMode::Node { .. } => "WASM_BINDGEN_USE_NODE_EXPERIMENTAL", + TestMode::Deno => "WASM_BINDGEN_USE_DENO", + TestMode::Browser { .. } => "WASM_BINDGEN_USE_BROWSER", + TestMode::DedicatedWorker { .. } => "WASM_BINDGEN_USE_DEDICATED_WORKER", + TestMode::SharedWorker { .. } => "WASM_BINDGEN_USE_SHARED_WORKER", + TestMode::ServiceWorker { .. } => "WASM_BINDGEN_USE_SERVICE_WORKER", + } + } } struct TmpDirDeleteGuard(PathBuf); @@ -138,25 +149,40 @@ fn main() -> anyhow::Result<()> { // to read later on. let custom_section = wasm.customs.remove_raw("__wasm_bindgen_test_unstable"); + let no_modules = std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(); let test_mode = match custom_section { - Some(section) if section.data.contains(&0x01) => TestMode::Browser { - no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), - }, - Some(section) if section.data.contains(&0x02) => TestMode::DedicatedWorker { - no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), - }, - Some(section) if section.data.contains(&0x03) => TestMode::SharedWorker { - no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), - }, - Some(section) if section.data.contains(&0x04) => TestMode::ServiceWorker { - no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), - }, - Some(section) if section.data.contains(&0x05) => TestMode::Node { - no_modules: std::env::var("WASM_BINDGEN_USE_NO_MODULE").is_ok(), - }, + Some(section) if section.data.contains(&0x01) => TestMode::Browser { no_modules }, + Some(section) if section.data.contains(&0x02) => TestMode::DedicatedWorker { no_modules }, + Some(section) if section.data.contains(&0x03) => TestMode::SharedWorker { no_modules }, + Some(section) if section.data.contains(&0x04) => TestMode::ServiceWorker { no_modules }, + Some(section) if section.data.contains(&0x05) => TestMode::Node { no_modules }, Some(_) => bail!("invalid __wasm_bingen_test_unstable value"), - None if std::env::var("WASM_BINDGEN_USE_DENO").is_ok() => TestMode::Deno, - None => TestMode::Node { no_modules: true }, + None => { + let mut modes = Vec::new(); + let mut add_mode = + |mode: TestMode| std::env::var(mode.env()).is_ok().then(|| modes.push(mode)); + add_mode(TestMode::Deno); + add_mode(TestMode::Browser { no_modules }); + add_mode(TestMode::DedicatedWorker { no_modules }); + add_mode(TestMode::SharedWorker { no_modules }); + add_mode(TestMode::ServiceWorker { no_modules }); + add_mode(TestMode::Node { no_modules }); + + match modes.len() { + 0 => TestMode::Node { no_modules: true }, + 1 => modes[0], + _ => { + bail!( + "only one test mode must be set, found: `{}`", + modes + .into_iter() + .map(TestMode::env) + .collect::>() + .join("`, `") + ) + } + } + } }; let headless = env::var("NO_HEADLESS").is_err(); diff --git a/guide/src/wasm-bindgen-test/browsers.md b/guide/src/wasm-bindgen-test/browsers.md index 7028575efc3..812a3b3f53d 100644 --- a/guide/src/wasm-bindgen-test/browsers.md +++ b/guide/src/wasm-bindgen-test/browsers.md @@ -1,46 +1,41 @@ # Testing in Headless Browsers -## Configure Your Test Crate +## Configure via Environment Variables -Add this to the root of your test crate, e.g. `$MY_CRATE/tests/web.rs`: +By default tests run on Node.js. To target browsers you can use the `WASM_BINDGEN_USE_BROWSER` environment variable: -```rust -use wasm_bindgen_test::wasm_bindgen_test_configure; - -wasm_bindgen_test_configure!(run_in_browser); +```sh +WASM_BINDGEN_USE_BROWSER=1 cargo test --target wasm32-unknown-unknown ``` -Or if you need to run your tests inside a web worker, you can also -configured it using the `wasm_bindgen_test_configure` macro as following -snippet. +The following configurations are available: +- `WASM_BINDGEN_USE_DEDICATED_WORKER`: for dedicated workers +- `WASM_BINDGEN_USE_SHARED_WORKER`: for shared workers +- `WASM_BINDGEN_USE_SERVICE_WORKER`: for service workers +- `WASM_BINDGEN_USE_DENO`: for Deno +- `WASM_BINDGEN_USE_NODE_EXPERIMENTAL`: for Node.js but as an ES module + +## Force Configuration + +Tests can also be forced to run in a certain environment by using the +`wasm_bindgen_test_configure!` macro: ```rust use wasm_bindgen_test::wasm_bindgen_test_configure; -// Run in dedicated worker. +// Run in a browser. +wasm_bindgen_test_configure!(run_in_browser); +// Or run in a dedicated worker. wasm_bindgen_test_configure!(run_in_dedicated_worker); -// Or run in shared worker. +// Or run in a shared worker. wasm_bindgen_test_configure!(run_in_shared_worker); -// Or run in service worker. +// Or run in a service worker. wasm_bindgen_test_configure!(run_in_service_worker); // Or run in Node.js but as an ES module. wasm_bindgen_test_configure!(run_in_node_experimental); ``` -Note that although a particular test crate must target either headless browsers -or Node.js, you can have test suites for both Node.js and browsers for your -project by using multiple test crates. For example: - -``` -$MY_CRATE/ -`-- tests - |-- node.rs # The tests in this suite use the default Node.js. - |-- node_module.rs # The tests in this suite are configured for Node.js but as an ES module. - |-- dedicated_worker.rs # The tests in this suite are configured for dedicated workers. - |-- shared_worker.rs # The tests in this suite are configured for shared workers. - |-- service_worker.rs # The tests in this suite are configured for service workers. - `-- web.rs # The tests in this suite are configured for browsers. -``` +Note that this will ignore any environment variable set. ## Configuring Which Browser is Used From 7ad47669b23849e43f048cd75fdfb71cc01db2e8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 29 Nov 2024 17:34:47 +0100 Subject: [PATCH 576/641] Prepare v0.2.96 release (#4298) --- CHANGELOG.md | 4 +++- Cargo.toml | 8 ++++---- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/cli/tests/reference/web-sys.js | 2 +- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 16 ++++++++-------- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 12 ++++++------ crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- 21 files changed, 57 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a4fe37ff0..bbadd8d921a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.96](https://github.com/rustwasm/wasm-bindgen/compare/0.2.95...0.2.96) + +Released 2024-11-29 ### Added diff --git a/Cargo.toml b/Cargo.toml index 873238e5999..79ce037b993 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.95" +version = "0.2.96" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,15 +45,15 @@ cfg-if = "1.0.0" once_cell = { version = "1.12", default-features = false } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false } [target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false, features = [ +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false, features = [ "atomics", ] } [target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.95", default-features = false, features = [ +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false, features = [ "coverage", ] } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 50d744bb681..207dac687ae 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.95" +version = "0.2.96" [features] atomics = [] @@ -28,7 +28,7 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } [lints] workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 6eed3b636eb..f136e9835ff 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] anyhow = "1.0" @@ -23,12 +23,12 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = "0.23" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.95' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.95' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.95' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.95' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.95' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.95' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.96' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.96' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.96' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.96' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.96' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.96' } [lints] workspace = true diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 4ee94630eca..f16b5b6861d 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.23", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.95" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.96" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 915a0941e85..99886e52aac 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -188,7 +188,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_561a91ce53f10a66() { return handleError(function (arg0, arg1) { +export function __wbg_new_dce808fb3f528314() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return ret; }, arguments) }; diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index ae4dc7f0a3d..4615e53b59f 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index d748c4a15f9..c3257bb811c 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.45" +version = "0.4.46" [package.metadata.docs.rs] all-features = true @@ -19,20 +19,20 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '=0.3.72', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.73', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '=0.2.95', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.96', default-features = false } [features] default = ["std"] futures-core-03-stream = ['futures-core'] std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] -[target.'cfg(target_feature = "atomics")'.dependencies.web-sys] -default-features = false -features = ["MessageEvent", "Worker"] -path = "../web-sys" -version = "=0.3.72" +[target.'cfg(target_feature = "atomics")'.dependencies] +web-sys = { path = "../web-sys", version = "=0.3.73", default-features = false, features = [ + "MessageEvent", + "Worker", +] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures-channel-preview = { version = "0.3.0-alpha.18" } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 466598c42f7..62159e87a38 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,7 +14,7 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.72" +version = "0.3.73" [lib] doctest = false @@ -25,7 +25,7 @@ default = ["std"] std = ["wasm-bindgen/std"] [dependencies] -wasm-bindgen = { path = "../..", version = "=0.2.95", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.96", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index f9f024ac8ee..9165e959c44 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.95" +version = "0.2.96" [features] atomics = ["wasm-bindgen-backend/atomics"] @@ -26,8 +26,8 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.95", default-features = false } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.96", default-features = false } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } [lints] workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index bf6c7690a5e..10001c05ced 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.95" +version = "0.2.96" [lib] proc-macro = true @@ -27,7 +27,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.95", default-features = false } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.96", default-features = false } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 05d176cf6b9..9457b807b65 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 3cc734b74a8..168898fd66e 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.95" +version = "0.2.96" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 13b893e4685..cee843079d0 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.95"; +pub const SCHEMA_VERSION: &str = "0.2.96"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index ebc7341bb3c..fa086937c74 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "211103844299778814"; +const APPROVED_SCHEMA_FILE_HASH: &str = "8234561557367848394"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 1d0ecab4815..6428ec851cb 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.45" +version = "0.3.46" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index fccd1b96f61..6140a3d51c1 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.45" +version = "0.3.46" [features] default = ["std"] @@ -15,16 +15,16 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "once_cell/ [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '=0.3.72', default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.73', default-features = false } once_cell = { version = "1.12", default-features = false } scoped-tls = { version = "1.0", optional = true } -wasm-bindgen = { path = '../..', version = '=0.2.95', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '=0.4.45', default-features = false } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45' } +wasm-bindgen = { path = '../..', version = '=0.2.96', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.46', default-features = false } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.46' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45', features = ["coverage"] } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.46', features = ["coverage"] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index b65754be09d..d055fb24862 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.95" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 66ec85f8e34..3f16295fdd5 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 8c5f1b1d9dd..efb22bd8530 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.95" +version = "0.2.96" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.95" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.96" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 52551c61f1c..df11949d9ae 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.72" +version = "0.3.73" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '=0.3.72', default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.95", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.73', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.96", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 32db0f48db8f7111e668f749679e9df462b516bc Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 29 Nov 2024 17:58:43 +0100 Subject: [PATCH 577/641] Removed a few `#[allow(dead_code)]` (#4299) --- crates/cli-support/src/js/binding.rs | 40 +++++++++++++---------- crates/cli-support/src/js/mod.rs | 19 +++++------ crates/cli-support/src/wit/incoming.rs | 33 ++++++++----------- crates/cli-support/src/wit/mod.rs | 2 -- crates/cli-support/src/wit/nonstandard.rs | 11 ++++--- crates/cli-support/src/wit/outgoing.rs | 26 ++++++--------- crates/cli-support/src/wit/standard.rs | 24 +++++++------- 7 files changed, 73 insertions(+), 82 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index f79936e1985..d5ed01363ad 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -704,28 +704,34 @@ fn instruction( } } - Instruction::IntToWasm { input, .. } => { + Instruction::Int32ToWasm => { let val = js.pop(); - if matches!( - input, - AdapterType::I64 | AdapterType::S64 | AdapterType::U64 - ) { - js.assert_bigint(&val); + js.assert_number(&val); + js.push(val); + } + Instruction::WasmToInt32 { unsigned_32 } => { + let val = js.pop(); + if *unsigned_32 { + // When converting to a JS number we need to specially handle the `u32` + // case because if the high bit is set then it comes out as a negative + // number, but we want to switch that to an unsigned representation. + js.push(format!("{} >>> 0", val)) } else { - js.assert_number(&val); + js.push(val) } - js.push(val); } - // When converting to a JS number we need to specially handle the `u32` - // case because if the high bit is set then it comes out as a negative - // number, but we want to switch that to an unsigned representation. - Instruction::WasmToInt { output, .. } => { + Instruction::Int64ToWasm => { let val = js.pop(); - match output { - AdapterType::U32 | AdapterType::NonNull => js.push(format!("{} >>> 0", val)), - AdapterType::U64 => js.push(format!("BigInt.asUintN(64, {val})")), - _ => js.push(val), + js.assert_bigint(&val); + js.push(val); + } + Instruction::WasmToInt64 { unsigned } => { + let val = js.pop(); + if *unsigned { + js.push(format!("BigInt.asUintN(64, {val})")) + } else { + js.push(val) } } @@ -765,7 +771,7 @@ fn instruction( js.push(wasm_to_string_enum(name, &index)) } - Instruction::OptionWasmToStringEnum { name, .. } => { + Instruction::OptionWasmToStringEnum { name } => { // Since hole is currently variant_count+1 and the lookup is // ["a","b","c"][index], the lookup will implicitly return map // the hole to undefined, because OOB indexes will return undefined. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index babbfc09d93..72b0273d71f 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1,8 +1,8 @@ use crate::descriptor::VectorKind; use crate::intrinsic::Intrinsic; use crate::wit::{ - Adapter, AdapterId, AdapterJsImportKind, AdapterType, AuxExportedMethodKind, AuxReceiverKind, - AuxStringEnum, AuxValue, + Adapter, AdapterId, AdapterJsImportKind, AuxExportedMethodKind, AuxReceiverKind, AuxStringEnum, + AuxValue, }; use crate::wit::{AdapterKind, Instruction, InstructionData}; use crate::wit::{AuxEnum, AuxExport, AuxExportKind, AuxImport, AuxStruct}; @@ -3119,16 +3119,14 @@ __wbg_set_wasm(wasm);" // Conversions to Wasm integers are always supported since // they're coerced into i32/f32/f64 appropriately. - IntToWasm { .. } => {} + Int32ToWasm => {} + Int64ToWasm => {} - // Converts from Wasm to JS, however, only supports most - // integers. Converting into a u32 isn't supported because we + // Converting into a u32 isn't supported because we // need to generate glue to change the sign. - WasmToInt { - output: AdapterType::U32, - .. - } => return false, - WasmToInt { .. } => {} + WasmToInt32 { unsigned_32: false } => {} + // A Wasm `i64` is already a signed JS BigInt, so no glue needed. + WasmToInt64 { unsigned: false } => {} // JS spec automatically coerces boolean values to i32 of 0 or 1 // depending on true/false @@ -3279,7 +3277,6 @@ __wbg_set_wasm(wasm);" dtor, mutable, adapter, - nargs: _, } => { assert!(kind == AdapterJsImportKind::Normal); assert!(!variadic); diff --git a/crates/cli-support/src/wit/incoming.rs b/crates/cli-support/src/wit/incoming.rs index c0ad9ad34bf..0309ef8c9c9 100644 --- a/crates/cli-support/src/wit/incoming.rs +++ b/crates/cli-support/src/wit/incoming.rs @@ -43,7 +43,6 @@ impl InstructionBuilder<'_, '_> { } fn _incoming(&mut self, arg: &Descriptor) -> Result<(), Error> { - use walrus::ValType as WasmVT; match arg { Descriptor::Boolean => { self.instruction( @@ -82,14 +81,14 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::I32], ); } - Descriptor::I8 => self.number(AdapterType::S8, WasmVT::I32), - Descriptor::U8 => self.number(AdapterType::U8, WasmVT::I32), - Descriptor::I16 => self.number(AdapterType::S16, WasmVT::I32), - Descriptor::U16 => self.number(AdapterType::U16, WasmVT::I32), - Descriptor::I32 => self.number(AdapterType::S32, WasmVT::I32), - Descriptor::U32 => self.number(AdapterType::U32, WasmVT::I32), - Descriptor::I64 => self.number(AdapterType::S64, WasmVT::I64), - Descriptor::U64 => self.number(AdapterType::U64, WasmVT::I64), + Descriptor::I8 => self.number_i32(AdapterType::S8), + Descriptor::U8 => self.number_i32(AdapterType::U8), + Descriptor::I16 => self.number_i32(AdapterType::S16), + Descriptor::U16 => self.number_i32(AdapterType::U16), + Descriptor::I32 => self.number_i32(AdapterType::S32), + Descriptor::U32 => self.number_i32(AdapterType::U32), + Descriptor::I64 => self.number_i64(AdapterType::S64), + Descriptor::U64 => self.number_i64(AdapterType::U64), Descriptor::I128 => { self.instruction( &[AdapterType::S128], @@ -115,10 +114,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Enum { name, .. } => { self.instruction( &[AdapterType::Enum(name.clone())], - Instruction::IntToWasm { - input: AdapterType::U32, - output: ValType::I32, - }, + Instruction::Int32ToWasm, &[AdapterType::I32], ); }, @@ -470,12 +466,11 @@ impl InstructionBuilder<'_, '_> { self.output.extend_from_slice(outputs); } - fn number(&mut self, input: AdapterType, output: walrus::ValType) { - let instr = Instruction::IntToWasm { - input: input.clone(), - output, - }; - self.instruction(&[input], instr, &[AdapterType::from_wasm(output).unwrap()]); + fn number_i32(&mut self, input: AdapterType) { + self.instruction(&[input], Instruction::Int32ToWasm, &[AdapterType::I32]); + } + fn number_i64(&mut self, input: AdapterType) { + self.instruction(&[input], Instruction::Int64ToWasm, &[AdapterType::I64]); } fn in_option_native(&mut self, wasm: ValType) { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 07a09860e0c..2f1d7f52691 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -197,7 +197,6 @@ impl<'a> Context<'a> { // aren't present in the signature but are present in the wasm // signature. let mut function = descriptor.function.clone(); - let nargs = function.arguments.len(); function.arguments.insert(0, Descriptor::I32); function.arguments.insert(0, Descriptor::I32); let adapter = self.table_element_adapter(descriptor.shim_idx, function)?; @@ -206,7 +205,6 @@ impl<'a> Context<'a> { AuxImport::Closure { dtor: descriptor.dtor_idx, mutable: descriptor.mutable, - nargs, adapter, }, ); diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 4ff93298281..35f30a74497 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -241,11 +241,12 @@ pub enum AuxImport { /// This import is intended to manufacture a JS closure with the given /// signature and then return that back to Rust. Closure { - mutable: bool, // whether or not this was a `FnMut` closure - dtor: u32, // table element index of the destructor function - adapter: AdapterId, // the adapter which translates the types for this closure - #[allow(dead_code)] - nargs: usize, + /// whether or not this was a `FnMut` closure + mutable: bool, + /// table element index of the destructor function + dtor: u32, + /// the adapter which translates the types for this closure + adapter: AdapterId, }, /// This import is expected to be a shim that simply calls the `foo` method diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index 2e34dd0d324..ba15babf5c9 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -316,13 +316,10 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::Enum(name.clone()).option()], ); } - Descriptor::StringEnum { name, hole, .. } => { + Descriptor::StringEnum { name, .. } => { self.instruction( &[AdapterType::I32], - Instruction::OptionWasmToStringEnum { - name: name.clone(), - hole: *hole, - }, + Instruction::OptionWasmToStringEnum { name: name.clone() }, &[AdapterType::StringEnum(name.clone()).option()], ); } @@ -554,14 +551,6 @@ impl InstructionBuilder<'_, '_> { Ok(()) } - fn outgoing_i32(&mut self, output: AdapterType) { - let instr = Instruction::WasmToInt { - input: walrus::ValType::I32, - output: output.clone(), - }; - self.instruction(&[AdapterType::I32], instr, &[output]); - } - fn outgoing_string_enum(&mut self, name: &str) { self.instruction( &[AdapterType::I32], @@ -572,10 +561,15 @@ impl InstructionBuilder<'_, '_> { ); } + fn outgoing_i32(&mut self, output: AdapterType) { + let instr = Instruction::WasmToInt32 { + unsigned_32: output == AdapterType::U32 || output == AdapterType::NonNull, + }; + self.instruction(&[AdapterType::I32], instr, &[output]); + } fn outgoing_i64(&mut self, output: AdapterType) { - let instr = Instruction::WasmToInt { - input: walrus::ValType::I64, - output: output.clone(), + let instr = Instruction::WasmToInt64 { + unsigned: output == AdapterType::U64, }; self.instruction(&[AdapterType::I64], instr, &[output]); } diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index e34866d2609..b0b1cb6832e 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -137,17 +137,19 @@ pub enum Instruction { size: u32, }, - /// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain Wasm `i32` or `i64` equivalent. - IntToWasm { - input: AdapterType, - #[allow(dead_code)] - output: walrus::ValType, + /// Pops a 32/16/8-bit integer (`u8`, `s16`, etc.) and pushes a Wasm `i32`. + Int32ToWasm, + /// Pops a Wasm `i32` and pushes a 32-bit integer. + WasmToInt32 { + /// Whether the integer represents an unsigned 32-bit value. + unsigned_32: bool, }, - /// Pops a Wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent. - WasmToInt { - #[allow(dead_code)] - input: walrus::ValType, - output: AdapterType, + + /// Pops a 64-bit integer and pushes a Wasm `i64`. + Int64ToWasm, + /// Pops a Wasm `i64` and pushes a 64-bit integer. + WasmToInt64 { + unsigned: bool, }, /// Pops a 128-bit integer and pushes 2 Wasm 64-bit ints. @@ -169,8 +171,6 @@ pub enum Instruction { OptionWasmToStringEnum { name: String, - #[allow(dead_code)] - hole: u32, }, /// pops a string and pushes the enum variant as an `i32` From 9fab9ce882fa71a80b996534540b9f95c6583d1e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 30 Nov 2024 08:08:01 +0100 Subject: [PATCH 578/641] Only use `wasm_bindgen::__rt` in proc-macros (#4305) This caused breakage in `js-sys` and `wasm-bindgen-futures` when not enabling the `std` crate feature of `wasm-bindgen` but disabling their own. --- CHANGELOG.md | 9 +++++++++ crates/futures/src/queue.rs | 14 +++++++++++--- crates/js-sys/Cargo.toml | 1 + crates/js-sys/src/lib.rs | 14 +++++++++++--- crates/test/Cargo.toml | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbadd8d921a..eabbddcf402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Fixed + +* Fixed `js-sys` and `wasm-bindgen-futures` relying on internal paths of `wasm-bindgen` that are not crate feature additive. + [#4305](https://github.com/rustwasm/wasm-bindgen/pull/4305) + +-------------------------------------------------------------------------------- + ## [0.2.96](https://github.com/rustwasm/wasm-bindgen/compare/0.2.95...0.2.96) Released 2024-11-29 diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index fe438cb1929..e0eb9e0de8f 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -118,11 +118,19 @@ impl Queue { #[cfg(not(feature = "std"))] pub(crate) fn with(f: impl FnOnce(&Self) -> R) -> R { - use wasm_bindgen::__rt::LazyCell; + use once_cell::unsync::Lazy; + + struct Wrapper(Lazy); + + #[cfg(not(target_feature = "atomics"))] + unsafe impl Sync for Wrapper {} + + #[cfg(not(target_feature = "atomics"))] + unsafe impl Send for Wrapper {} #[cfg_attr(target_feature = "atomics", thread_local)] - static QUEUE: LazyCell = LazyCell::new(Queue::new); + static QUEUE: Wrapper = Wrapper(Lazy::new(Queue::new)); - f(&QUEUE) + f(&QUEUE.0) } } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 62159e87a38..4109ef2ee47 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -25,6 +25,7 @@ default = ["std"] std = ["wasm-bindgen/std"] [dependencies] +once_cell = { version = "1.12", default-features = false } wasm-bindgen = { path = "../..", version = "=0.2.96", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 167e1876262..57b01303cd4 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -6038,12 +6038,20 @@ pub fn global() -> Object { } #[cfg(not(feature = "std"))] { - use wasm_bindgen::__rt::LazyCell; + use once_cell::unsync::Lazy; + + struct Wrapper(Lazy); + + #[cfg(not(target_feature = "atomics"))] + unsafe impl Sync for Wrapper {} + + #[cfg(not(target_feature = "atomics"))] + unsafe impl Send for Wrapper {} #[cfg_attr(target_feature = "atomics", thread_local)] - static GLOBAL: LazyCell = LazyCell::new(get_global_object); + static GLOBAL: Wrapper = Wrapper(Lazy::new(get_global_object)); - return GLOBAL.clone(); + return GLOBAL.0.clone(); } fn get_global_object() -> Object { diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 6140a3d51c1..7a417b5d5fe 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -11,7 +11,7 @@ version = "0.3.46" [features] default = ["std"] -std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "once_cell/std", "scoped-tls"] +std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls"] [dependencies] gg-alloc = { version = "1.0", optional = true } From b9333c55d0b735f5457cd2a1c751d45ad919e2c6 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 30 Nov 2024 08:51:52 +0100 Subject: [PATCH 579/641] Note that feature resolver version 2 is required (#4307) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d8e07bc0952..05266a62785 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ Libraries that are released on [crates.io](https://crates.io) have a MSRV of v1. CLI tools and their corresponding support libraries have a MSRV of v1.76. Changes to the MSRV will be accompanied by a patch version bump. +[Feature resolver version 2](https://doc.rust-lang.org/1.83.0/cargo/reference/resolver.html#feature-resolver-version-2) is required. + ## License This project is licensed under either of From b4428b03e3af5505e385edfbe6e03cd149ed296c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 30 Nov 2024 08:56:43 +0100 Subject: [PATCH 580/641] Prepare v0.2.97 release (#4308) --- CHANGELOG.md | 4 +++- Cargo.toml | 8 ++++---- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 12 ++++++------ crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- 18 files changed, 50 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eabbddcf402..040cad2f847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97) + +Released 2024-11-30 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 79ce037b993..ce538615806 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.96" +version = "0.2.97" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,15 +45,15 @@ cfg-if = "1.0.0" once_cell = { version = "1.12", default-features = false } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false } [target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false, features = [ +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ "atomics", ] } [target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false, features = [ +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ "coverage", ] } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 207dac687ae..9d1b7f71a15 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.96" +version = "0.2.97" [features] atomics = [] @@ -28,7 +28,7 @@ once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } [lints] workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index f136e9835ff..b5c4750dd29 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] anyhow = "1.0" @@ -23,12 +23,12 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = "0.23" -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.96' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.96' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.96' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.96' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.96' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.96' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.97' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.97' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.97' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.97' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.97' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.97' } [lints] workspace = true diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index f16b5b6861d..a171a9586b6 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = { version = "0.23", features = ['parallel'] } -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.96" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.97" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 4615e53b59f..26f5d2c0b51 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index c3257bb811c..b34f429930d 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.46" +version = "0.4.47" [package.metadata.docs.rs] all-features = true @@ -19,9 +19,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '=0.3.73', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.74', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '=0.2.96', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.97', default-features = false } [features] default = ["std"] @@ -29,7 +29,7 @@ futures-core-03-stream = ['futures-core'] std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] [target.'cfg(target_feature = "atomics")'.dependencies] -web-sys = { path = "../web-sys", version = "=0.3.73", default-features = false, features = [ +web-sys = { path = "../web-sys", version = "=0.3.74", default-features = false, features = [ "MessageEvent", "Worker", ] } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 4109ef2ee47..86d074e7ff0 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,7 +14,7 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.73" +version = "0.3.74" [lib] doctest = false @@ -26,7 +26,7 @@ std = ["wasm-bindgen/std"] [dependencies] once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.96", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.97", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 9165e959c44..a33d4e3d750 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.96" +version = "0.2.97" [features] atomics = ["wasm-bindgen-backend/atomics"] @@ -26,8 +26,8 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.96", default-features = false } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.97", default-features = false } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } [lints] workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 10001c05ced..8403fc51463 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.96" +version = "0.2.97" [lib] proc-macro = true @@ -27,7 +27,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.96", default-features = false } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.97", default-features = false } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 9457b807b65..da6e4e87870 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 168898fd66e..4aa1b4ee965 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.96" +version = "0.2.97" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 6428ec851cb..30194d9bc4c 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.46" +version = "0.3.47" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 7a417b5d5fe..aa003a75366 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.46" +version = "0.3.47" [features] default = ["std"] @@ -15,16 +15,16 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '=0.3.73', default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.74', default-features = false } once_cell = { version = "1.12", default-features = false } scoped-tls = { version = "1.0", optional = true } -wasm-bindgen = { path = '../..', version = '=0.2.96', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '=0.4.46', default-features = false } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.46' } +wasm-bindgen = { path = '../..', version = '=0.2.97', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.47', default-features = false } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.46', features = ["coverage"] } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47', features = ["coverage"] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index d055fb24862..18c7e46bf7a 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.96" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 3f16295fdd5..1397181121e 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index efb22bd8530..dae80605d50 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.96" +version = "0.2.97" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.96" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.97" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index df11949d9ae..1ae534fc165 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.73" +version = "0.3.74" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '=0.3.73', default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.96", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.74', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.97", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 7fa2afabdb259516fe8b942ed8353faaa8366da0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 30 Nov 2024 09:18:38 +0100 Subject: [PATCH 581/641] Regenerate reference tests (#4309) --- crates/cli/tests/reference/web-sys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 99886e52aac..071fcab86e9 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -188,7 +188,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_dce808fb3f528314() { return handleError(function (arg0, arg1) { +export function __wbg_new_6684d1d61b5a2140() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return ret; }, arguments) }; From 0d1ae06139a71403621b07467cd092a82a0aa0e5 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 4 Dec 2024 11:55:44 +0100 Subject: [PATCH 582/641] Add clear error message to communicate new feature resolver version requirements (#4312) --- .github/workflows/main.yml | 28 +++++++++++++++++++++++ CHANGELOG.md | 9 ++++++++ Cargo.toml | 5 +++++ crates/backend/Cargo.toml | 1 + crates/backend/src/codegen.rs | 4 ++-- crates/macro-support/Cargo.toml | 1 + crates/macro/Cargo.toml | 1 + crates/macro/src/lib.rs | 32 ++++++++++++++++++++++----- crates/msrv/resolver/Cargo.toml | 23 +++++++++++++++++++ crates/msrv/resolver/error-1.57.txt | 5 +++++ crates/msrv/resolver/error-stable.txt | 4 ++++ crates/msrv/resolver/src/lib.rs | 0 crates/test-macro/Cargo.toml | 1 + crates/test-macro/src/lib.rs | 7 ++++-- crates/test/Cargo.toml | 5 +++++ 15 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 crates/msrv/resolver/Cargo.toml create mode 100644 crates/msrv/resolver/error-1.57.txt create mode 100644 crates/msrv/resolver/error-stable.txt create mode 100644 crates/msrv/resolver/src/lib.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5e9de0542a..d624e791874 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -538,6 +538,34 @@ jobs: name: doc_api path: docs.tar.gz + msrv-resolver: + name: Check for feature resolver v1 error message + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - 1.57 + - stable + target: + - x86_64-unknown-linux-gnu + - wasm32-unknown-unknown + features: + - --no-default-features + - "" + defaults: + run: + working-directory: crates/msrv/resolver + steps: + - uses: actions/checkout@v4 + - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }} + - if: matrix.rust == '1.57' + run: | + cargo update -p bumpalo --precise 3.12.0 + cargo update -p log --precise 0.4.18 + cargo update -p scoped-tls --precise 1.0.0 + - run: diff <(cargo build --target ${{ matrix.target }} ${{ matrix.features }} --message-format json | jq -r "select(.reason == \"compiler-message\") | .message.message") error-${{ matrix.rust }}.txt + msrv-lib: name: Check MSRV for libraries runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 040cad2f847..f1be139c895 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Changed + +* Add clear error message to communicate new feature resolver version requirements. + [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) + +-------------------------------------------------------------------------------- + ## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97) Released 2024-11-30 diff --git a/Cargo.toml b/Cargo.toml index ce538615806..d0aaa348434 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,11 @@ wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-featu "coverage", ] } +[target.'cfg(__wasm_bindgen_resolver_1)'.dependencies] +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ + "xxx_resolver_1", +] } + [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 9d1b7f71a15..703231257f6 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -20,6 +20,7 @@ default = ["std"] extra-traits = ["syn/extra-traits"] spans = [] std = [] +xxx_resolver_1 = [] [dependencies] bumpalo = "3.0.0" diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index d899d9916fa..eb01814ae0a 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1966,8 +1966,8 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { } fn coverage() -> Option { - #[cfg(feature = "coverage")] + #[cfg(all(not(feature = "xxx_resolver_1"), feature = "coverage"))] return Some(quote! { #[coverage(off)] }); - #[cfg(not(feature = "coverage"))] + #[cfg(any(feature = "xxx_resolver_1", not(feature = "coverage")))] None } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index a33d4e3d750..ed92337bfd1 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -21,6 +21,7 @@ extra-traits = ["syn/extra-traits"] spans = ["wasm-bindgen-backend/spans"] std = ["wasm-bindgen-backend/std"] strict-macro = [] +xxx_resolver_1 = ["wasm-bindgen-backend/xxx_resolver_1"] [dependencies] proc-macro2 = "1.0" diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 8403fc51463..ebb4377f3f8 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -24,6 +24,7 @@ spans = ["wasm-bindgen-macro-support/spans"] std = ["wasm-bindgen-macro-support/std"] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] xxx_debug_only_print_generated_code = [] +xxx_resolver_1 = ["wasm-bindgen-macro-support/xxx_resolver_1"] [dependencies] quote = "1.0" diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index 6dc0cbf1792..5ae633035ba 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -1,6 +1,9 @@ #![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")] #![cfg_attr( - any(feature = "coverage", all(not(feature = "std"), feature = "atomics")), + all( + not(feature = "xxx_resolver_1"), + any(feature = "coverage", all(not(feature = "std"), feature = "atomics")) + ), feature(allow_internal_unstable), allow(internal_features) )] @@ -10,10 +13,23 @@ extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; +#[cfg(feature = "xxx_resolver_1")] +compile_error!("Feature resolver version 2 or up is required.\n\ + Please add `resolver = \"2\"` to your `Cargo.toml`.\n\ + \n\ + See ."); + #[proc_macro_attribute] -#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] #[cfg_attr( - all(not(feature = "std"), feature = "atomics"), + all(not(feature = "xxx_resolver_1"), feature = "coverage"), + allow_internal_unstable(coverage_attribute) +)] +#[cfg_attr( + all( + not(feature = "xxx_resolver_1"), + not(feature = "std"), + feature = "atomics" + ), allow_internal_unstable(thread_local) )] pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { @@ -42,7 +58,10 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { /// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js")); /// ``` #[proc_macro] -#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] +#[cfg_attr( + all(not(feature = "xxx_resolver_1"), feature = "coverage"), + allow_internal_unstable(coverage_attribute) +)] pub fn link_to(input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_link_to(input.into()) { Ok(tokens) => { @@ -59,7 +78,10 @@ pub fn link_to(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] -#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] +#[cfg_attr( + all(not(feature = "xxx_resolver_1"), feature = "coverage"), + allow_internal_unstable(coverage_attribute) +)] pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { Ok(tokens) => { diff --git a/crates/msrv/resolver/Cargo.toml b/crates/msrv/resolver/Cargo.toml new file mode 100644 index 00000000000..0f44e15aafa --- /dev/null +++ b/crates/msrv/resolver/Cargo.toml @@ -0,0 +1,23 @@ +[package] +edition = "2021" +name = "msrv-library-test" +publish = false +resolver = "1" +version = "0.0.0" + +[features] +default = ["std"] +std = [ + "wasm-bindgen/std", + "js-sys/std", + "wasm-bindgen-futures/std", + "web-sys/std", + "wasm-bindgen-test/std", +] + +[dependencies] +js-sys = { path = "../../js-sys", default-features = false } +wasm-bindgen = { path = "../../../", default-features = false } +wasm-bindgen-futures = { path = "../../futures", default-features = false } +wasm-bindgen-test = { path = "../../test", default-features = false } +web-sys = { path = "../../web-sys", default-features = false } diff --git a/crates/msrv/resolver/error-1.57.txt b/crates/msrv/resolver/error-1.57.txt new file mode 100644 index 00000000000..5a255fbc9e1 --- /dev/null +++ b/crates/msrv/resolver/error-1.57.txt @@ -0,0 +1,5 @@ +Feature resolver version 2 or up is required. +Please add `resolver = "2"` to your `Cargo.toml`. + +See . +aborting due to previous error diff --git a/crates/msrv/resolver/error-stable.txt b/crates/msrv/resolver/error-stable.txt new file mode 100644 index 00000000000..5dd74366267 --- /dev/null +++ b/crates/msrv/resolver/error-stable.txt @@ -0,0 +1,4 @@ +Feature resolver version 2 or up is required. +Please add `resolver = "2"` to your `Cargo.toml`. + +See . diff --git a/crates/msrv/resolver/src/lib.rs b/crates/msrv/resolver/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 30194d9bc4c..cfbfc74723b 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -14,6 +14,7 @@ proc-macro = true [features] coverage = [] +xxx_resolver_1 = [] [dependencies] proc-macro2 = "1.0" diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 3b0f722bc7e..0916132d2b4 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -2,7 +2,7 @@ //! going on here. #![cfg_attr( - feature = "coverage", + all(not(feature = "xxx_resolver_1"), feature = "coverage"), feature(allow_internal_unstable), allow(internal_features) )] @@ -18,7 +18,10 @@ use std::sync::atomic::*; static CNT: AtomicUsize = AtomicUsize::new(0); #[proc_macro_attribute] -#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))] +#[cfg_attr( + all(not(feature = "xxx_resolver_1"), feature = "coverage"), + allow_internal_unstable(coverage_attribute) +)] pub fn wasm_bindgen_test( attr: proc_macro::TokenStream, body: proc_macro::TokenStream, diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index aa003a75366..8f1fbe35551 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -26,6 +26,11 @@ wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47' } minicov = "0.3" wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47', features = ["coverage"] } +[target.'cfg(__wasm_bindgen_resolver_1)'.dependencies] +wasm-bindgen-test-macro = { path = "../test-macro", version = "=0.3.47", features = [ + "xxx_resolver_1", +] } + [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } From 89f8a423cfc9d4b770be02ac8bc16454b73818dc Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 5 Dec 2024 00:12:18 +0100 Subject: [PATCH 583/641] Fix macro-hygiene for calls to `std::thread_local!` (#4315) --- CHANGELOG.md | 5 +++++ crates/backend/src/codegen.rs | 6 +++--- src/convert/slices.rs | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1be139c895..6b881a0192a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ * Add clear error message to communicate new feature resolver version requirements. [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) +### Fixed + +* Fix macro-hygiene for calls to `std::thread_local!`. + [#4315](https://github.com/rustwasm/wasm-bindgen/pull/4315) + -------------------------------------------------------------------------------- ## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index eb01814ae0a..7aba59c17e7 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1711,7 +1711,7 @@ impl ToTokens for ast::ImportStatic { fn init() -> #ty { #init } - thread_local!(static _VAL: #ty = init();); + #wasm_bindgen::__rt::std::thread_local!(static _VAL: #ty = init();); #wasm_bindgen::JsStatic { __inner: &_VAL, } @@ -1763,7 +1763,7 @@ fn thread_local_import( match thread_local { ast::ThreadLocal::V1 => quote! { - thread_local! { + #wasm_bindgen::__rt::std::thread_local! { #[automatically_derived] #[deprecated = "use with `#[wasm_bindgen(thread_local_v2)]` instead"] #vis static #name: #actual_ty = { @@ -1774,7 +1774,7 @@ fn thread_local_import( ast::ThreadLocal::V2 => { #[cfg(feature = "std")] let inner = quote! { - thread_local!(static _VAL: #actual_ty = init();); + #wasm_bindgen::__rt::std::thread_local!(static _VAL: #actual_ty = init();); #wasm_bindgen::JsThreadLocal { __inner: &_VAL, } diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 249c0326e5b..6c23926ebf9 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -1,6 +1,3 @@ -#[cfg(feature = "std")] -use std::prelude::v1::*; - use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; From 94b2dc65e10e25b9d32d1cc7b40e0fb49b70e10d Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 5 Dec 2024 10:26:59 +0100 Subject: [PATCH 584/641] Add support for multi-threading in Node.js (#4318) --- .github/workflows/main.yml | 5 +++-- CHANGELOG.md | 5 +++++ crates/cli-support/src/js/mod.rs | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d624e791874..3ab44b15023 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -206,15 +206,16 @@ jobs: test_threads: name: "Run wasm-bindgen crate tests with multithreading" runs-on: ubuntu-latest + env: + WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 steps: - uses: actions/checkout@v4 - run: rustup default nightly-2024-07-06 - run: rustup target add wasm32-unknown-unknown - run: rustup component add rust-src - # Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. - run: | RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ - cargo test --target wasm32-unknown-unknown --test headless -Z build-std=std,panic_abort + cargo test --target wasm32-unknown-unknown -Z build-std=std,panic_abort # I don't know why this is failing so comment this out for now, but ideally # this would be figured out at some point and solved. diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b881a0192a..f2f45809930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Unreleased +### Added + +* Add support for multi-threading in Node.js. + [#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318) + ### Changed * Add clear error message to communicate new feature resolver version requirements. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 72b0273d71f..21139dddab3 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -440,6 +440,8 @@ impl<'a> Context<'a> { // With normal CommonJS node we need to defer requiring the wasm // until the end so most of our own exports are hooked up OutputMode::Node { module: false } => { + self.nodejs_memory(); + js.push_str(&self.generate_node_imports()); js.push_str("let wasm;\n"); @@ -483,6 +485,8 @@ impl<'a> Context<'a> { // and let the bundler/runtime take care of it. // With Node we manually read the Wasm file from the filesystem and instantiate it. OutputMode::Bundler { .. } | OutputMode::Node { module: true } => { + self.nodejs_memory(); + for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { let import = self.module.imports.get_mut(*id); import.module = format!("./{}_bg.js", module_name); @@ -1005,6 +1009,14 @@ __wbg_set_wasm(wasm);" Ok((js, ts)) } + fn nodejs_memory(&mut self) { + if let Some(mem) = self.module.memories.iter_mut().next() { + if let Some(id) = mem.import.take() { + self.module.imports.delete(id); + } + } + } + fn write_classes(&mut self) -> Result<(), Error> { for (class, exports) in self.exported_classes.take().unwrap() { self.write_class(&class, &exports)?; From de22141cb2260e429c43e9b5c326b88faa8c311b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 6 Dec 2024 13:29:22 +0100 Subject: [PATCH 585/641] Remove leftover macro (#4326) --- crates/backend/src/codegen.rs | 1 - src/lib.rs | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 7aba59c17e7..2f77b877580 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -229,7 +229,6 @@ impl ToTokens for ast::Struct { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { fn describe() { - use #wasm_bindgen::__wbindgen_if_not_std; use #wasm_bindgen::describe::*; inform(RUST_STRUCT); inform(#name_len); diff --git a/src/lib.rs b/src/lib.rs index 403a119fa0e..35af9084062 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1633,20 +1633,6 @@ pub mod __rt { } } - #[macro_export] - #[doc(hidden)] - #[cfg(feature = "std")] - macro_rules! __wbindgen_if_not_std { - ($($i:item)*) => {}; - } - - #[macro_export] - #[doc(hidden)] - #[cfg(not(feature = "std"))] - macro_rules! __wbindgen_if_not_std { - ($($i:item)*) => ($($i)*) - } - #[inline] pub fn assert_not_null(s: *mut T) { if s.is_null() { From 4e77a613bb1a57d72b7a78fc40f3ace9316cb2a1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 6 Dec 2024 13:51:41 +0100 Subject: [PATCH 586/641] Remove `critical-section` requirement for `no_std` with atomics (#4322) --- .github/workflows/main.yml | 4 +- CHANGELOG.md | 3 ++ crates/backend/src/codegen.rs | 4 +- crates/test/Cargo.toml | 1 - src/lib.rs | 95 +++++++++++++++++++++++++++++++---- 5 files changed, 92 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3ab44b15023..bf6acf42617 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -121,8 +121,8 @@ jobs: - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -Zbuild-std=core,alloc -- -D warnings - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -Zbuild-std=core,alloc -- -D warnings - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -Zbuild-std=core,alloc -- -D warnings - - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings - - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test --features once_cell/critical-section -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -Zbuild-std=core,alloc -- -D warnings + - run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test -Zbuild-std=core,alloc -- -D warnings # Run `cargo clippy` over the project clippy_project: diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f45809930..dece4a6063d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ * Add clear error message to communicate new feature resolver version requirements. [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) +* Remove `once_cell/critical-section` requirement for `no_std` with atomics. + [#4322](https://github.com/rustwasm/wasm-bindgen/pull/4322) + ### Fixed * Fix macro-hygiene for calls to `std::thread_local!`. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 2f77b877580..a715ec756ef 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -201,8 +201,8 @@ impl TryToTokens for ast::LinkToModule { #program #extern_fn - static __VAL: #wasm_bindgen::__rt::once_cell::sync::Lazy<#wasm_bindgen::__rt::alloc::string::String> = - #wasm_bindgen::__rt::once_cell::sync::Lazy::new(|| unsafe { + static __VAL: #wasm_bindgen::__rt::LazyLock<#wasm_bindgen::__rt::alloc::string::String> = + #wasm_bindgen::__rt::LazyLock::new(|| unsafe { <#wasm_bindgen::__rt::alloc::string::String as #wasm_bindgen::convert::FromWasmAbi>::from_abi(#name().join()) }); diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 8f1fbe35551..72825958c42 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -16,7 +16,6 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls [dependencies] gg-alloc = { version = "1.0", optional = true } js-sys = { path = '../js-sys', version = '=0.3.74', default-features = false } -once_cell = { version = "1.12", default-features = false } scoped-tls = { version = "1.0", optional = true } wasm-bindgen = { path = '../..', version = '=0.2.97', default-features = false } wasm-bindgen-futures = { path = '../futures', version = '=0.4.47', default-features = false } diff --git a/src/lib.rs b/src/lib.rs index 35af9084062..6e17e245fc4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1572,6 +1572,8 @@ pub mod __rt { use core::convert::Infallible; use core::mem; use core::ops::{Deref, DerefMut}; + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + use core::sync::atomic::{AtomicU8, Ordering}; pub extern crate alloc; pub extern crate core; @@ -1582,16 +1584,6 @@ pub mod __rt { use alloc::boxed::Box; use alloc::rc::Rc; - pub mod once_cell { - #[cfg(any(target_feature = "atomics", feature = "std"))] - pub use once_cell::*; - - #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - pub mod sync { - pub use super::super::LazyCell as Lazy; - } - } - /// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with /// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. #[cfg(not(feature = "std"))] @@ -1633,6 +1625,89 @@ pub mod __rt { } } + #[cfg(feature = "std")] + pub use once_cell::sync::Lazy as LazyLock; + + #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] + pub use LazyCell as LazyLock; + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + pub struct LazyLock T> { + state: AtomicU8, + data: UnsafeCell>, + } + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + enum Data { + Value(T), + Init(F), + } + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + unsafe impl Sync for LazyLock {} + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + unsafe impl Send for LazyLock {} + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + impl LazyLock { + const STATE_UNINIT: u8 = 0; + const STATE_INITIALIZING: u8 = 1; + const STATE_INIT: u8 = 2; + + pub const fn new(init: F) -> LazyLock { + Self { + state: AtomicU8::new(Self::STATE_UNINIT), + data: UnsafeCell::new(Data::Init(init)), + } + } + } + + #[cfg(all(target_feature = "atomics", not(feature = "std")))] + impl Deref for LazyLock { + type Target = T; + + fn deref(&self) -> &T { + let mut state = self.state.load(Ordering::Acquire); + + loop { + match state { + Self::STATE_INIT => { + let Data::Value(value) = (unsafe { &*self.data.get() }) else { + unreachable!() + }; + return value; + } + Self::STATE_UNINIT => { + if let Err(new_state) = self.state.compare_exchange_weak( + Self::STATE_UNINIT, + Self::STATE_INITIALIZING, + Ordering::Acquire, + Ordering::Relaxed, + ) { + state = new_state; + continue; + } + + let data = unsafe { &mut *self.data.get() }; + let Data::Init(init) = data else { + unreachable!() + }; + *data = Data::Value(init()); + self.state.store(Self::STATE_INIT, Ordering::Release); + state = Self::STATE_INIT; + } + Self::STATE_INITIALIZING => { + // TODO: Block here if possible. This would require + // detecting if we can in the first place. + state = self.state.load(Ordering::Acquire); + } + _ => unreachable!(), + } + } + } + } + #[inline] pub fn assert_not_null(s: *mut T) { if s.is_null() { From 89f2af8f6560364f3cc8f8f097e39ca1ed5e9ee1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 6 Dec 2024 18:49:13 +0100 Subject: [PATCH 587/641] Support `undefined` static imports with `Option` (#4319) Co-authored-by: Michael Schmidt --- CHANGELOG.md | 7 +- crates/cli-support/src/js/mod.rs | 30 +++++++- crates/cli-support/src/wit/mod.rs | 7 +- crates/cli-support/src/wit/nonstandard.rs | 2 +- crates/cli/tests/reference/static.d.ts | 3 + crates/cli/tests/reference/static.js | 85 +++++++++++++++++++++++ crates/cli/tests/reference/static.rs | 30 ++++++++ crates/cli/tests/reference/static.wat | 16 +++++ crates/js-sys/src/lib.rs | 35 ++++------ guide/src/reference/static-js-objects.md | 26 ++++++- tests/wasm/imports.rs | 16 +++++ 11 files changed, 226 insertions(+), 31 deletions(-) create mode 100644 crates/cli/tests/reference/static.d.ts create mode 100644 crates/cli/tests/reference/static.js create mode 100644 crates/cli/tests/reference/static.rs create mode 100644 crates/cli/tests/reference/static.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index dece4a6063d..7181e5310c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,17 @@ * Add support for multi-threading in Node.js. [#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318) -### Changed - * Add clear error message to communicate new feature resolver version requirements. [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) * Remove `once_cell/critical-section` requirement for `no_std` with atomics. [#4322](https://github.com/rustwasm/wasm-bindgen/pull/4322) +### Changed + +* `static FOO: Option` now returns `None` if undeclared in JS instead of throwing an error in JS. + [#4319](https://github.com/rustwasm/wasm-bindgen/pull/4319) + ### Fixed * Fix macro-hygiene for calls to `std::thread_local!`. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 21139dddab3..e26f7a6d2ca 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2578,6 +2578,30 @@ __wbg_set_wasm(wasm);" Ok(name) } + fn import_static(&mut self, import: &JsImport, optional: bool) -> Result { + let mut name = self.import_name(&JsImport { + name: import.name.clone(), + fields: Vec::new(), + })?; + + // After we've got an actual name handle field projections + if optional { + name = format!("typeof {name} === 'undefined' ? null : {name}"); + + for field in import.fields.iter() { + name.push_str("?."); + name.push_str(field); + } + } else { + for field in import.fields.iter() { + name.push('.'); + name.push_str(field); + } + } + + Ok(name) + } + /// If a start function is present, it removes it from the `start` section /// of the Wasm module and then moves it to an exported function, named /// `__wbindgen_start`. @@ -2730,7 +2754,7 @@ __wbg_set_wasm(wasm);" | AuxImport::Value(AuxValue::Setter(js, ..)) | AuxImport::ValueWithThis(js, ..) | AuxImport::Instanceof(js) - | AuxImport::Static(js) + | AuxImport::Static { js, .. } | AuxImport::StructuralClassGetter(js, ..) | AuxImport::StructuralClassSetter(js, ..) | AuxImport::IndexingGetterOfClass(js) @@ -3265,11 +3289,11 @@ __wbg_set_wasm(wasm);" Ok("result".to_owned()) } - AuxImport::Static(js) => { + AuxImport::Static { js, optional } => { assert!(kind == AdapterJsImportKind::Normal); assert!(!variadic); assert_eq!(args.len(), 0); - self.import_name(js) + self.import_static(js, *optional) } AuxImport::String(string) => { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 2f1d7f52691..07fb5090a78 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -788,6 +788,7 @@ impl<'a> Context<'a> { None => return Ok(()), Some(d) => d, }; + let optional = matches!(descriptor, Descriptor::Option(_)); // Register the signature of this imported shim let id = self.import_adapter( @@ -803,8 +804,10 @@ impl<'a> Context<'a> { // And then save off that this function is is an instanceof shim for an // imported item. - let import = self.determine_import(import, static_.name)?; - self.aux.import_map.insert(id, AuxImport::Static(import)); + let js = self.determine_import(import, static_.name)?; + self.aux + .import_map + .insert(id, AuxImport::Static { js, optional }); Ok(()) } diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 35f30a74497..1e9579dc8ba 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -233,7 +233,7 @@ pub enum AuxImport { /// This import is expected to be a shim that returns the JS value named by /// `JsImport`. - Static(JsImport), + Static { js: JsImport, optional: bool }, /// This import is expected to be a shim that returns an exported `JsString`. String(String), diff --git a/crates/cli/tests/reference/static.d.ts b/crates/cli/tests/reference/static.d.ts new file mode 100644 index 00000000000..091dbcc51a6 --- /dev/null +++ b/crates/cli/tests/reference/static.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function exported(): void; diff --git a/crates/cli/tests/reference/static.js b/crates/cli/tests/reference/static.js new file mode 100644 index 00000000000..34aa7975e7a --- /dev/null +++ b/crates/cli/tests/reference/static.js @@ -0,0 +1,85 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_1.set(idx, obj); + return idx; +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +export function exported() { + wasm.exported(); +} + +export function __wbg_static_accessor_NAMESPACE_OPTIONAL_c9a4344c544120f4() { + const ret = typeof test === 'undefined' ? null : test?.NAMESPACE_OPTIONAL; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; + +export function __wbg_static_accessor_NAMESPACE_PLAIN_784c8d7f5bbac62a() { + const ret = test.NAMESPACE_PLAIN; + return ret; +}; + +export function __wbg_static_accessor_NESTED_NAMESPACE_OPTIONAL_a414abbeb018a35a() { + const ret = typeof test1 === 'undefined' ? null : test1?.test2?.NESTED_NAMESPACE_OPTIONAL; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; + +export function __wbg_static_accessor_NESTED_NAMESPACE_PLAIN_1121b285cb8479df() { + const ret = test1.test2.NESTED_NAMESPACE_PLAIN; + return ret; +}; + +export function __wbg_static_accessor_OPTIONAL_ade71b6402851d0c() { + const ret = typeof OPTIONAL === 'undefined' ? null : OPTIONAL; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; + +export function __wbg_static_accessor_PLAIN_c0f08eb2f0db194c() { + const ret = PLAIN; + return ret; +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_1; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/static.rs b/crates/cli/tests/reference/static.rs new file mode 100644 index 00000000000..4437f550e7d --- /dev/null +++ b/crates/cli/tests/reference/static.rs @@ -0,0 +1,30 @@ +// DEPENDENCY: js-sys = { path = '{root}/crates/js-sys' } + +use wasm_bindgen::prelude::*; +use js_sys::Number; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(thread_local_v2)] + static PLAIN: JsValue; + #[wasm_bindgen(thread_local_v2)] + static OPTIONAL: Option; + #[wasm_bindgen(thread_local_v2, js_namespace = test)] + static NAMESPACE_PLAIN: JsValue; + #[wasm_bindgen(thread_local_v2, js_namespace = test)] + static NAMESPACE_OPTIONAL: Option; + #[wasm_bindgen(thread_local_v2, js_namespace = ["test1", "test2"])] + static NESTED_NAMESPACE_PLAIN: JsValue; + #[wasm_bindgen(thread_local_v2, js_namespace = ["test1", "test2"])] + static NESTED_NAMESPACE_OPTIONAL: Option; +} + +#[wasm_bindgen] +pub fn exported() { + let _ = PLAIN.with(JsValue::clone); + let _ = OPTIONAL.with(Option::clone); + let _ = NAMESPACE_PLAIN.with(JsValue::clone); + let _ = NAMESPACE_OPTIONAL.with(Option::clone); + let _ = NESTED_NAMESPACE_PLAIN.with(JsValue::clone); + let _ = NESTED_NAMESPACE_OPTIONAL.with(Option::clone); +} diff --git a/crates/cli/tests/reference/static.wat b/crates/cli/tests/reference/static.wat new file mode 100644 index 00000000000..b4ea3e1c9e8 --- /dev/null +++ b/crates/cli/tests/reference/static.wat @@ -0,0 +1,16 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__externref_table_alloc (;1;) (type 1) (result i32)) + (func $exported (;2;) (type 0)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "exported" (func $exported)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__wbindgen_export_1" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 57b01303cd4..aa2f3a07b3b 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -6055,14 +6055,6 @@ pub fn global() -> Object { } fn get_global_object() -> Object { - // This is a bit wonky, but we're basically using `#[wasm_bindgen]` - // attributes to synthesize imports so we can access properties of the - // form: - // - // * `globalThis.globalThis` - // * `self.self` - // * ... (etc) - // // Accessing the global object is not an easy thing to do, and what we // basically want is `globalThis` but we can't rely on that existing // everywhere. In the meantime we've got the fallbacks mentioned in: @@ -6076,26 +6068,27 @@ pub fn global() -> Object { extern "C" { type Global; - #[wasm_bindgen(getter, catch, static_method_of = Global, js_class = globalThis, js_name = globalThis)] - fn get_global_this() -> Result; + #[wasm_bindgen(thread_local_v2, js_name = globalThis)] + static GLOBAL_THIS: Option; - #[wasm_bindgen(getter, catch, static_method_of = Global, js_class = self, js_name = self)] - fn get_self() -> Result; + #[wasm_bindgen(thread_local_v2, js_name = self)] + static SELF: Option; - #[wasm_bindgen(getter, catch, static_method_of = Global, js_class = window, js_name = window)] - fn get_window() -> Result; + #[wasm_bindgen(thread_local_v2, js_name = window)] + static WINDOW: Option; - #[wasm_bindgen(getter, catch, static_method_of = Global, js_class = global, js_name = global)] - fn get_global() -> Result; + #[wasm_bindgen(thread_local_v2, js_name = global)] + static GLOBAL: Option; } // The order is important: in Firefox Extension Content Scripts `globalThis` // is a Sandbox (not Window), so `globalThis` must be checked after `window`. - let static_object = Global::get_self() - .or_else(|_| Global::get_window()) - .or_else(|_| Global::get_global_this()) - .or_else(|_| Global::get_global()); - if let Ok(obj) = static_object { + let static_object = SELF + .with(Option::clone) + .or_else(|| WINDOW.with(Option::clone)) + .or_else(|| GLOBAL_THIS.with(Option::clone)) + .or_else(|| GLOBAL.with(Option::clone)); + if let Some(obj) = static_object { if !obj.is_undefined() { return obj; } diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md index b6aee687dc8..92b699d57c6 100644 --- a/guide/src/reference/static-js-objects.md +++ b/guide/src/reference/static-js-objects.md @@ -4,8 +4,13 @@ JavaScript modules will often export arbitrary static objects for use with their provided interfaces. These objects can be accessed from Rust by declaring a named `static` in the `extern` block with an `#[wasm_bindgen(thread_local_v2)]` attribute. `wasm-bindgen` will bind a -`JsThreadLocal` for these objects, which can be cloned into a `JsValue`. For -example, given the following JavaScript: +`JsThreadLocal` for these objects, which can be cloned into a `JsValue`. + +These values are cached in a thread-local and are meant to bind static values +or objects only. For getters which can change their return value or throw see +[how to import getters](attributes/on-js-imports/getter-and-setter.md). + +For example, given the following JavaScript: ```js let COLORS = { @@ -65,6 +70,23 @@ extern "C" { } ``` +## Optional statics + +If you expect the JavaScript value you're trying to access to not always be +available you can use `Option` to handle this: + +```rust +extern "C" { + type Crypto; + #[wasm_bindgen(thread_local_v2, js_name = crypto)] + static CRYPTO: Option; +} +``` + +If `crypto` is not declared or nullish (`null` or `undefined`) in JavaScript, +it will simply return `None` in Rust. This will also account for namespaces: it +will return `Some(T)` only if all parts are declared and not nullish. + ## Static strings Strings can be imported to avoid going through `TextDecoder/Encoder` when requiring just a `JsString`. This can be useful when dealing with environments where `TextDecoder/Encoder` is not available, like in audio worklets. diff --git a/tests/wasm/imports.rs b/tests/wasm/imports.rs index a6eab0c5e32..119aefef487 100644 --- a/tests/wasm/imports.rs +++ b/tests/wasm/imports.rs @@ -90,6 +90,15 @@ extern "C" { #[wasm_bindgen(js_name = "\"string'literal\nbreakers\r")] fn string_literal_breakers() -> u32; + + #[wasm_bindgen(thread_local_v2)] + static UNDECLARED: Option; + + #[wasm_bindgen(thread_local_v2, js_namespace = test)] + static UNDECLARED_NAMESPACE: Option; + + #[wasm_bindgen(thread_local_v2, js_namespace = ["test1", "test2"])] + static UNDECLARED_NESTED_NAMESPACE: Option; } #[wasm_bindgen(module = "tests/wasm/imports_2.js")] @@ -336,3 +345,10 @@ fn invalid_idents() { assert_eq!(kebab_case(), 42); assert_eq!(string_literal_breakers(), 42); } + +#[wasm_bindgen_test] +fn undeclared() { + assert_eq!(UNDECLARED.with(Option::clone), None); + assert_eq!(UNDECLARED_NAMESPACE.with(Option::clone), None); + assert_eq!(UNDECLARED_NESTED_NAMESPACE.with(Option::clone), None); +} From 0a0204612cd9a2cc359f0a31afea59dab6487223 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 6 Dec 2024 22:18:18 +0100 Subject: [PATCH 588/641] Improved contributing docs in `web-sys` README (#4302) --- crates/web-sys/README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index ab0cf1a2c63..7693680c6fe 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -2,9 +2,9 @@ Raw bindings to Web APIs for projects using `wasm-bindgen`. -* [The `web-sys` section of the `wasm-bindgen` +- [The `web-sys` section of the `wasm-bindgen` guide](https://rustwasm.github.io/wasm-bindgen/web-sys/index.html) -* [API Documentation](https://rustwasm.github.io/wasm-bindgen/api/web_sys/) +- [API Documentation](https://rustwasm.github.io/wasm-bindgen/api/web_sys/) ## Crate features @@ -30,19 +30,23 @@ If you don't see a particular web API in `web-sys`, here is how to add it. [very bottom](https://w3c.github.io/mediasession/#idl-index) of _that_ page is the IDL. 2. Annotate the functions that can throw with `[Throws]` -3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml` -4. Run `git add .` to add all the generated files into git. -5. Add an entry in CHANGELOG.md like the following +3. `cd crates/web-sys` +4. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml` + + If formatting fails, you can run `cargo fmt` in the `crates/web-sys` directory. On Windows, you might also want to run `cargo fmt -- --config newline_style=Unix` depending on your git configuration. + +5. Run `git add .` to add all the generated files into git. +6. Add an entry in CHANGELOG.md like the following + ```md ... - + ## Unreleased - + ### Added - + ... - + * Added - [#1234](https://github.com/rustwasm/wasm-bindgen/pull/1234) # <- link to your PR + [#1234](https://github.com/rustwasm/wasm-bindgen/pull/1234) # <- link to your PR ``` - From 14acd7d21176635ebe7f560a1ee1692fa95ca93e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 6 Dec 2024 23:49:11 +0100 Subject: [PATCH 589/641] Move `walrus/parallel` to `wasm-bindgen-cli-support` (#4321) --- crates/cli-support/Cargo.toml | 2 +- crates/cli/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index b5c4750dd29..5a21b6f35ae 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -22,7 +22,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" -walrus = "0.23" +walrus = { version = "0.23", features = ['parallel'] } wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.97' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.97' } wasm-bindgen-shared = { path = "../shared", version = '=0.2.97' } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index a171a9586b6..92da9858708 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } -walrus = { version = "0.23", features = ['parallel'] } +walrus = "0.23" wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.97" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } From e021ba473089609265419e70b3f39169f6a5f595 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:06:48 +0100 Subject: [PATCH 590/641] Add `WASM_BINDGEN_TEST_DRIVER_TIMEOUT` (#4320) --- CHANGELOG.md | 11 +++++++---- .../src/bin/wasm-bindgen-test-runner/headless.rs | 11 ++++++++--- .../cli/src/bin/wasm-bindgen-test-runner/main.rs | 14 +++++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7181e5310c1..c2e4d998d8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,17 +5,20 @@ ### Added +* Add clear error message to communicate new feature resolver version requirements. + [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) + * Add support for multi-threading in Node.js. [#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318) -* Add clear error message to communicate new feature resolver version requirements. - [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) +* Add `WASM_BINDGEN_TEST_DRIVER_TIMEOUT` environment variable to control the timeout to start and connect to the test driver. + [#4320](https://github.com/rustwasm/wasm-bindgen/pull/4320) + +### Changed * Remove `once_cell/critical-section` requirement for `no_std` with atomics. [#4322](https://github.com/rustwasm/wasm-bindgen/pull/4322) -### Changed - * `static FOO: Option` now returns `None` if undeclared in JS instead of throwing an error in JS. [#4319](https://github.com/rustwasm/wasm-bindgen/pull/4319) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index e1c20ec6229..9ec6fabe2e9 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -55,7 +55,12 @@ pub struct LegacyNewSessionParameters { /// binary, controlling it, running tests, scraping output, displaying output, /// etc. It will return `Ok` if all tests finish successfully, and otherwise it /// will return an error if some tests failed. -pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error> { +pub fn run( + server: &SocketAddr, + shell: &Shell, + driver_timeout: u64, + test_timeout: u64, +) -> Result<(), Error> { let driver = Driver::find()?; let mut drop_log: Box = Box::new(|| ()); let driver_url = match driver.location() { @@ -64,7 +69,7 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error // Wait for the driver to come online and bind its port before we try to // connect to it. let start = Instant::now(); - let max = Duration::new(5, 0); + let max = Duration::new(driver_timeout, 0); let (driver_addr, mut child) = 'outer: loop { // Allow tests to run in parallel (in theory) by finding any open port @@ -173,7 +178,7 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error // information. shell.status("Waiting for test to finish..."); let start = Instant::now(); - let max = Duration::new(timeout, 0); + let max = Duration::new(test_timeout, 0); while start.elapsed() < max { if client.text(&id, &output)?.contains("test result: ") { break; diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 93cead3c2cd..76259378054 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -214,7 +214,15 @@ fn main() -> anyhow::Result<()> { return Ok(()); } - let timeout = env::var("WASM_BINDGEN_TEST_TIMEOUT") + let driver_timeout = env::var("WASM_BINDGEN_TEST_DRIVER_TIMEOUT") + .map(|timeout| { + timeout + .parse() + .expect("Could not parse 'WASM_BINDGEN_TEST_DRIVER_TIMEOUT'") + }) + .unwrap_or(5); + + let browser_timeout = env::var("WASM_BINDGEN_TEST_TIMEOUT") .map(|timeout| { timeout .parse() @@ -223,7 +231,7 @@ fn main() -> anyhow::Result<()> { .unwrap_or(20); if debug { - println!("Set timeout to {} seconds...", timeout); + println!("Set timeout to {} seconds...", browser_timeout); } // Make the generated bindings available for the tests to execute against. @@ -307,7 +315,7 @@ fn main() -> anyhow::Result<()> { } thread::spawn(|| srv.run()); - headless::run(&addr, &shell, timeout)?; + headless::run(&addr, &shell, driver_timeout, browser_timeout)?; } } Ok(()) From f90ebdae733760235fb1721d75491bb79ca41b6d Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:25:01 +0100 Subject: [PATCH 591/641] Re-establish feature resolver version 1 compatibility (#4327) --- .github/workflows/main.yml | 10 ++-- CHANGELOG.md | 6 +-- Cargo.toml | 17 +------ README.md | 2 - crates/backend/Cargo.toml | 4 -- crates/backend/src/codegen.rs | 61 +++++++---------------- crates/macro-support/Cargo.toml | 3 -- crates/macro/Cargo.toml | 3 -- crates/macro/src/lib.rs | 34 ------------- crates/macro/ui-tests/wasm-bindgen.stderr | 10 +--- crates/msrv/resolver/Cargo.toml | 2 +- crates/msrv/resolver/error-1.57.txt | 5 -- crates/msrv/resolver/error-stable.txt | 4 -- crates/test-macro/Cargo.toml | 4 -- crates/test-macro/src/lib.rs | 18 +------ crates/test/Cargo.toml | 6 --- crates/test/src/rt/mod.rs | 1 + src/lib.rs | 57 ++++++++++++++++++++- 18 files changed, 87 insertions(+), 160 deletions(-) delete mode 100644 crates/msrv/resolver/error-1.57.txt delete mode 100644 crates/msrv/resolver/error-stable.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf6acf42617..5263ee206cb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,12 +68,12 @@ jobs: - run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings - - run: cargo clippy --no-deps --features spans,strict-macro -p wasm-bindgen-macro -- -D warnings - - run: cargo clippy --no-deps --features extra-traits,spans,strict-macro -p wasm-bindgen-macro-support -- -D warnings + - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings + - run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings - - run: cargo clippy --no-deps -p wasm-bindgen-test-macro -- -D warnings + - run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings - run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings - run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings @@ -540,7 +540,7 @@ jobs: path: docs.tar.gz msrv-resolver: - name: Check for feature resolver v1 error message + name: Check feature resolver version 1 compatibility runs-on: ubuntu-latest strategy: fail-fast: false @@ -565,7 +565,7 @@ jobs: cargo update -p bumpalo --precise 3.12.0 cargo update -p log --precise 0.4.18 cargo update -p scoped-tls --precise 1.0.0 - - run: diff <(cargo build --target ${{ matrix.target }} ${{ matrix.features }} --message-format json | jq -r "select(.reason == \"compiler-message\") | .message.message") error-${{ matrix.rust }}.txt + - run: cargo build --target ${{ matrix.target }} ${{ matrix.features }} msrv-lib: name: Check MSRV for libraries diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e4d998d8f..9a10caba3b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,6 @@ ### Added -* Add clear error message to communicate new feature resolver version requirements. - [#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312) - * Add support for multi-threading in Node.js. [#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318) @@ -27,6 +24,9 @@ * Fix macro-hygiene for calls to `std::thread_local!`. [#4315](https://github.com/rustwasm/wasm-bindgen/pull/4315) +* Fix feature resolver version 1 compatibility. + [#4327](https://github.com/rustwasm/wasm-bindgen/pull/4327) + -------------------------------------------------------------------------------- ## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97) diff --git a/Cargo.toml b/Cargo.toml index d0aaa348434..a9597a0fe21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,21 +47,6 @@ serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false } -[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ - "atomics", -] } - -[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ - "coverage", -] } - -[target.'cfg(__wasm_bindgen_resolver_1)'.dependencies] -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false, features = [ - "xxx_resolver_1", -] } - [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } @@ -90,7 +75,7 @@ too_many_arguments = "allow" type_complexity = "allow" [workspace] -exclude = ["crates/msrv"] +exclude = ["crates/msrv/resolver", "crates/msrv/lib", "crates/msrv/cli"] members = [ "benchmarks", "crates/cli", diff --git a/README.md b/README.md index 05266a62785..d8e07bc0952 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,6 @@ Libraries that are released on [crates.io](https://crates.io) have a MSRV of v1. CLI tools and their corresponding support libraries have a MSRV of v1.76. Changes to the MSRV will be accompanied by a patch version bump. -[Feature resolver version 2](https://doc.rust-lang.org/1.83.0/cargo/reference/resolver.html#feature-resolver-version-2) is required. - ## License This project is licensed under either of diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 703231257f6..3e0603b96d5 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -14,18 +14,14 @@ rust-version = "1.57" version = "0.2.97" [features] -atomics = [] -coverage = [] default = ["std"] extra-traits = ["syn/extra-traits"] spans = [] std = [] -xxx_resolver_1 = [] [dependencies] bumpalo = "3.0.0" log = "0.4" -once_cell = "1.12" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index a715ec756ef..23599fc87b0 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -2,13 +2,12 @@ use crate::ast; use crate::encode; use crate::encode::EncodeChunk; use crate::Diagnostic; -use once_cell::sync::Lazy; use proc_macro2::{Ident, Span, TokenStream}; use quote::format_ident; use quote::quote_spanned; use quote::{quote, ToTokens}; +use std::cell::RefCell; use std::collections::{HashMap, HashSet}; -use std::sync::Mutex; use syn::parse_quote; use syn::spanned::Spanned; use wasm_bindgen_shared as shared; @@ -224,7 +223,6 @@ impl ToTokens for ast::Struct { let free_fn = Ident::new(&shared::free_function(&name_str), Span::call_site()); let unwrap_fn = Ident::new(&shared::unwrap_function(&name_str), Span::call_site()); let wasm_bindgen = &self.wasm_bindgen; - let maybe_no_coverage = coverage(); (quote! { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { @@ -296,11 +294,11 @@ impl ToTokens for ast::Struct { #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { + #wasm_bindgen::__wbindgen_coverage! { #[no_mangle] #[doc(hidden)] // `allow_delayed` is whether it's ok to not actually free the `ptr` immediately // if it's still borrowed. - #maybe_no_coverage pub unsafe extern "C" fn #free_fn(ptr: u32, allow_delayed: u32) { use #wasm_bindgen::__rt::alloc::rc::Rc; @@ -315,6 +313,7 @@ impl ToTokens for ast::Struct { let _ = <#name as #wasm_bindgen::convert::FromWasmAbi>::from_abi(ptr); } } + } }; #[automatically_derived] @@ -476,7 +475,6 @@ impl ToTokens for ast::StructField { quote! { assert_copy::<#ty>() } }; let maybe_assert_copy = respan(maybe_assert_copy, ty); - let maybe_no_coverage = coverage(); // Split this out so that it isn't affected by `quote_spanned!`. // @@ -495,9 +493,9 @@ impl ToTokens for ast::StructField { (quote! { #[automatically_derived] const _: () = { + #wasm_bindgen::__wbindgen_coverage! { #[cfg_attr(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), no_mangle)] #[doc(hidden)] - #maybe_no_coverage pub unsafe extern "C" fn #getter(js: u32) -> #wasm_bindgen::convert::WasmRet<<#ty as #wasm_bindgen::convert::IntoWasmAbi>::Abi> { @@ -512,6 +510,7 @@ impl ToTokens for ast::StructField { let val = #val; <#ty as IntoWasmAbi>::into_abi(val).into() } + } }; }) .to_tokens(tokens); @@ -537,9 +536,9 @@ impl ToTokens for ast::StructField { #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { + #wasm_bindgen::__wbindgen_coverage! { #[no_mangle] #[doc(hidden)] - #maybe_no_coverage pub unsafe extern "C" fn #setter( js: u32, #(#args,)* @@ -553,6 +552,7 @@ impl ToTokens for ast::StructField { let val = <#ty as FromWasmAbi>::from_abi(val); (*js).borrow_mut().#rust_name = val; } + } }; }) .to_tokens(tokens); @@ -788,23 +788,22 @@ impl TryToTokens for ast::Export { quote! {} }; - let maybe_no_coverage = coverage(); - (quote! { #[automatically_derived] const _: () = { + #wasm_bindgen::__wbindgen_coverage! { #(#attrs)* #[cfg_attr( all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")), export_name = #export_name, )] - #maybe_no_coverage pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { #start_check let #ret = #call; #convert_ret } + } }; }) .to_tokens(into); @@ -1159,8 +1158,6 @@ impl ToTokens for ast::StringEnum { let hole = variant_count + 1; let attrs = &self.rust_attrs; - let maybe_no_coverage = coverage(); - let invalid_to_str_msg = format!( "Converting an invalid string enum ({}) back to a string is currently not supported", enum_name @@ -1247,7 +1244,6 @@ impl ToTokens for ast::StringEnum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { - #maybe_no_coverage fn describe() { use #wasm_bindgen::describe::*; inform(STRING_ENUM); @@ -1546,7 +1542,6 @@ impl ToTokens for ast::Enum { } else { quote! { u32 } }; - let maybe_no_coverage = coverage(); let cast_clauses = self.variants.iter().map(|variant| { let variant_name = &variant.name; quote! { @@ -1594,7 +1589,6 @@ impl ToTokens for ast::Enum { #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #enum_name { - #maybe_no_coverage fn describe() { use #wasm_bindgen::describe::*; inform(ENUM); @@ -1778,20 +1772,9 @@ fn thread_local_import( __inner: &_VAL, } }; - #[cfg(all(not(feature = "std"), not(feature = "atomics")))] - let inner = quote! { - static _VAL: #wasm_bindgen::__rt::LazyCell<#actual_ty> = #wasm_bindgen::__rt::LazyCell::new(init); - #wasm_bindgen::JsThreadLocal { - __inner: &_VAL, - } - }; - #[cfg(all(not(feature = "std"), feature = "atomics"))] + #[cfg(not(feature = "std"))] let inner = quote! { - #[thread_local] - static _VAL: #wasm_bindgen::__rt::LazyCell<#actual_ty> = #wasm_bindgen::__rt::LazyCell::new(init); - #wasm_bindgen::JsThreadLocal { - __inner: || unsafe { #wasm_bindgen::__rt::LazyCell::force(&_VAL) as *const #actual_ty }, - } + #wasm_bindgen::__wbindgen_thread_local!(#wasm_bindgen, #actual_ty) }; quote! { @@ -1847,20 +1830,16 @@ impl ToTokens for Descriptor<'_, T> { // It's up to the descriptors themselves to ensure they have unique // names for unique items imported, currently done via `ShortHash` and // hashing appropriate data into the symbol name. - static DESCRIPTORS_EMITTED: Lazy>> = Lazy::new(Default::default); + thread_local! { + static DESCRIPTORS_EMITTED: RefCell> = RefCell::default(); + } let ident = self.ident; - if !DESCRIPTORS_EMITTED - .lock() - .unwrap() - .insert(ident.to_string()) - { + if !DESCRIPTORS_EMITTED.with(|list| list.borrow_mut().insert(ident.to_string())) { return; } - let maybe_no_coverage = coverage(); - let name = Ident::new(&format!("__wbindgen_describe_{}", ident), ident.span()); let inner = &self.inner; let attrs = &self.attrs; @@ -1869,16 +1848,17 @@ impl ToTokens for Descriptor<'_, T> { #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] #[automatically_derived] const _: () = { + #wasm_bindgen::__wbindgen_coverage! { #(#attrs)* #[no_mangle] #[doc(hidden)] - #maybe_no_coverage pub extern "C" fn #name() { use #wasm_bindgen::describe::*; // See definition of `link_mem_intrinsics` for what this is doing #wasm_bindgen::__rt::link_mem_intrinsics(); #inner } + } }; }) .to_tokens(tokens); @@ -1963,10 +1943,3 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream { } new_tokens.into_iter().collect() } - -fn coverage() -> Option { - #[cfg(all(not(feature = "xxx_resolver_1"), feature = "coverage"))] - return Some(quote! { #[coverage(off)] }); - #[cfg(any(feature = "xxx_resolver_1", not(feature = "coverage")))] - None -} diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index ed92337bfd1..41c28fc1ae5 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -14,14 +14,11 @@ rust-version = "1.57" version = "0.2.97" [features] -atomics = ["wasm-bindgen-backend/atomics"] -coverage = ["wasm-bindgen-backend/coverage"] default = ["std"] extra-traits = ["syn/extra-traits"] spans = ["wasm-bindgen-backend/spans"] std = ["wasm-bindgen-backend/std"] strict-macro = [] -xxx_resolver_1 = ["wasm-bindgen-backend/xxx_resolver_1"] [dependencies] proc-macro2 = "1.0" diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index ebb4377f3f8..e6a5f56df9c 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -17,14 +17,11 @@ version = "0.2.97" proc-macro = true [features] -atomics = ["wasm-bindgen-macro-support/atomics"] -coverage = ["wasm-bindgen-macro-support/coverage"] default = ["std"] spans = ["wasm-bindgen-macro-support/spans"] std = ["wasm-bindgen-macro-support/std"] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] xxx_debug_only_print_generated_code = [] -xxx_resolver_1 = ["wasm-bindgen-macro-support/xxx_resolver_1"] [dependencies] quote = "1.0" diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index 5ae633035ba..aa4ab3f066b 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -1,37 +1,11 @@ #![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")] -#![cfg_attr( - all( - not(feature = "xxx_resolver_1"), - any(feature = "coverage", all(not(feature = "std"), feature = "atomics")) - ), - feature(allow_internal_unstable), - allow(internal_features) -)] extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; -#[cfg(feature = "xxx_resolver_1")] -compile_error!("Feature resolver version 2 or up is required.\n\ - Please add `resolver = \"2\"` to your `Cargo.toml`.\n\ - \n\ - See ."); - #[proc_macro_attribute] -#[cfg_attr( - all(not(feature = "xxx_resolver_1"), feature = "coverage"), - allow_internal_unstable(coverage_attribute) -)] -#[cfg_attr( - all( - not(feature = "xxx_resolver_1"), - not(feature = "std"), - feature = "atomics" - ), - allow_internal_unstable(thread_local) -)] pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand(attr.into(), input.into()) { Ok(tokens) => { @@ -58,10 +32,6 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { /// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js")); /// ``` #[proc_macro] -#[cfg_attr( - all(not(feature = "xxx_resolver_1"), feature = "coverage"), - allow_internal_unstable(coverage_attribute) -)] pub fn link_to(input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_link_to(input.into()) { Ok(tokens) => { @@ -78,10 +48,6 @@ pub fn link_to(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] -#[cfg_attr( - all(not(feature = "xxx_resolver_1"), feature = "coverage"), - allow_internal_unstable(coverage_attribute) -)] pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) { Ok(tokens) => { diff --git a/crates/macro/ui-tests/wasm-bindgen.stderr b/crates/macro/ui-tests/wasm-bindgen.stderr index 2ec13836be6..2dfacc7b209 100644 --- a/crates/macro/ui-tests/wasm-bindgen.stderr +++ b/crates/macro/ui-tests/wasm-bindgen.stderr @@ -1,16 +1,10 @@ -error[E0433]: failed to resolve: could not find `convert` in `test` +error[E0433]: failed to resolve: could not find `__wbindgen_coverage` in `test` --> ui-tests/wasm-bindgen.rs:37:1 | 37 | #[wasm_bindgen(wasm_bindgen = test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `convert` in `test` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `__wbindgen_coverage` in `test` | = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider importing one of these items - | -3 + use crate::test::test::convert; - | -3 + use wasm_bindgen::convert; - | error[E0425]: cannot find function `future_to_promise` in module `test` --> ui-tests/wasm-bindgen.rs:40:1 diff --git a/crates/msrv/resolver/Cargo.toml b/crates/msrv/resolver/Cargo.toml index 0f44e15aafa..6c7eeffbfc5 100644 --- a/crates/msrv/resolver/Cargo.toml +++ b/crates/msrv/resolver/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2021" -name = "msrv-library-test" +name = "msrv-resolver-test" publish = false resolver = "1" version = "0.0.0" diff --git a/crates/msrv/resolver/error-1.57.txt b/crates/msrv/resolver/error-1.57.txt deleted file mode 100644 index 5a255fbc9e1..00000000000 --- a/crates/msrv/resolver/error-1.57.txt +++ /dev/null @@ -1,5 +0,0 @@ -Feature resolver version 2 or up is required. -Please add `resolver = "2"` to your `Cargo.toml`. - -See . -aborting due to previous error diff --git a/crates/msrv/resolver/error-stable.txt b/crates/msrv/resolver/error-stable.txt deleted file mode 100644 index 5dd74366267..00000000000 --- a/crates/msrv/resolver/error-stable.txt +++ /dev/null @@ -1,4 +0,0 @@ -Feature resolver version 2 or up is required. -Please add `resolver = "2"` to your `Cargo.toml`. - -See . diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index cfbfc74723b..4997340e424 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -12,10 +12,6 @@ version = "0.3.47" [lib] proc-macro = true -[features] -coverage = [] -xxx_resolver_1 = [] - [dependencies] proc-macro2 = "1.0" quote = "1.0" diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 0916132d2b4..510944ccd9a 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -1,12 +1,6 @@ //! See the README for `wasm-bindgen-test` for a bit more info about what's //! going on here. -#![cfg_attr( - all(not(feature = "xxx_resolver_1"), feature = "coverage"), - feature(allow_internal_unstable), - allow(internal_features) -)] - extern crate proc_macro; use proc_macro2::*; @@ -18,10 +12,6 @@ use std::sync::atomic::*; static CNT: AtomicUsize = AtomicUsize::new(0); #[proc_macro_attribute] -#[cfg_attr( - all(not(feature = "xxx_resolver_1"), feature = "coverage"), - allow_internal_unstable(coverage_attribute) -)] pub fn wasm_bindgen_test( attr: proc_macro::TokenStream, body: proc_macro::TokenStream, @@ -109,21 +99,17 @@ pub fn wasm_bindgen_test( // main test harness. This is the entry point for all tests. let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); let wasm_bindgen_path = attributes.wasm_bindgen_path; - let coverage = if cfg!(feature = "coverage") { - Some(quote! { #[coverage(off)] }) - } else { - None - }; tokens.extend( quote! { const _: () = { + #wasm_bindgen_path::__rt::wasm_bindgen::__wbindgen_coverage! { #[no_mangle] #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] - #coverage pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body } + } }; }, ); diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 72825958c42..d3083b0e021 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -23,12 +23,6 @@ wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47', features = ["coverage"] } - -[target.'cfg(__wasm_bindgen_resolver_1)'.dependencies] -wasm-bindgen-test-macro = { path = "../test-macro", version = "=0.3.47", features = [ - "xxx_resolver_1", -] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 2d508c6e1dc..0c28b1344d1 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -99,6 +99,7 @@ use core::future::Future; use core::pin::Pin; use core::task::{self, Poll}; use js_sys::{Array, Function, Promise}; +pub use wasm_bindgen; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; diff --git a/src/lib.rs b/src/lib.rs index 6e17e245fc4..73a6147773f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,10 +6,15 @@ //! interface. #![no_std] -#![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] +#![cfg_attr( + wasm_bindgen_unstable_test_coverage, + feature(coverage_attribute, allow_internal_unstable), + allow(internal_features) +)] #![cfg_attr( all(not(feature = "std"), target_feature = "atomics"), - feature(thread_local) + feature(thread_local, allow_internal_unstable), + allow(internal_features) )] #![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] @@ -1708,6 +1713,54 @@ pub mod __rt { } } + #[macro_export] + #[doc(hidden)] + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + macro_rules! __wbindgen_thread_local { + ($wasm_bindgen:tt, $actual_ty:ty) => {{ + static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = + $wasm_bindgen::__rt::LazyCell::new(init); + $wasm_bindgen::JsThreadLocal { __inner: &_VAL } + }}; + } + + #[macro_export] + #[doc(hidden)] + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + #[allow_internal_unstable(thread_local)] + macro_rules! __wbindgen_thread_local { + ($wasm_bindgen:tt, $actual_ty:ty) => {{ + #[thread_local] + static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = + $wasm_bindgen::__rt::LazyCell::new(init); + $wasm_bindgen::JsThreadLocal { + __inner: || unsafe { + $wasm_bindgen::__rt::LazyCell::force(&_VAL) as *const $actual_ty + }, + } + }}; + } + + #[macro_export] + #[doc(hidden)] + #[cfg(not(wasm_bindgen_unstable_test_coverage))] + macro_rules! __wbindgen_coverage { + ($item:item) => { + $item + }; + } + + #[macro_export] + #[doc(hidden)] + #[cfg(wasm_bindgen_unstable_test_coverage)] + #[allow_internal_unstable(coverage_attribute)] + macro_rules! __wbindgen_coverage { + ($item:item) => { + #[coverage(off)] + $item + }; + } + #[inline] pub fn assert_not_null(s: *mut T) { if s.is_null() { From 8fe5bf1b99b929d7e7c562fa43230d082aa217a2 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:37:50 +0100 Subject: [PATCH 592/641] Add support for number slices of type `MaybeUninit` (#4316) Co-authored-by: Michael Schmidt --- CHANGELOG.md | 3 + Cargo.toml | 1 + crates/cli/tests/reference/echo.d.ts | 16 ++ crates/cli/tests/reference/echo.js | 232 ++++++++++++++++++ crates/cli/tests/reference/echo.rs | 17 ++ crates/cli/tests/reference/echo.wat | 64 +++-- .../reference/types/boxed-number-slices.md | 6 +- guide/src/reference/types/number-slices.md | 6 +- src/convert/slices.rs | 23 +- src/describe.rs | 9 +- tests/wasm/slice.js | 85 +++++++ tests/wasm/slice.rs | 213 ++++++++++------ 12 files changed, 571 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a10caba3b1..205eafe525b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Add `WASM_BINDGEN_TEST_DRIVER_TIMEOUT` environment variable to control the timeout to start and connect to the test driver. [#4320](https://github.com/rustwasm/wasm-bindgen/pull/4320) +* Add support for number slices of type `MaybeUninit`. + [#4316](https://github.com/rustwasm/wasm-bindgen/pull/4316) + ### Changed * Remove `once_cell/critical-section` requirement for `no_std` with atomics. diff --git a/Cargo.toml b/Cargo.toml index a9597a0fe21..dae4e2bd11b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ wasm-bindgen-test = { path = 'crates/test' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] js-sys = { path = 'crates/js-sys' } +paste = "1" serde_derive = "1.0" wasm-bindgen-futures = { path = 'crates/futures' } wasm-bindgen-test-crate-a = { path = 'tests/crates/a' } diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts index 7f72b5e2d34..c318f636c11 100644 --- a/crates/cli/tests/reference/echo.d.ts +++ b/crates/cli/tests/reference/echo.d.ts @@ -25,6 +25,14 @@ export function echo_vec_u32(a: Uint32Array): Uint32Array; export function echo_vec_i32(a: Int32Array): Int32Array; export function echo_vec_u64(a: BigUint64Array): BigUint64Array; export function echo_vec_i64(a: BigInt64Array): BigInt64Array; +export function echo_vec_uninit_u8(a: Uint8Array): Uint8Array; +export function echo_vec_uninit_i8(a: Int8Array): Int8Array; +export function echo_vec_uninit_u16(a: Uint16Array): Uint16Array; +export function echo_vec_uninit_i16(a: Int16Array): Int16Array; +export function echo_vec_uninit_u32(a: Uint32Array): Uint32Array; +export function echo_vec_uninit_i32(a: Int32Array): Int32Array; +export function echo_vec_uninit_u64(a: BigUint64Array): BigUint64Array; +export function echo_vec_uninit_i64(a: BigInt64Array): BigInt64Array; export function echo_vec_string(a: (string)[]): (string)[]; export function echo_struct(a: Foo): Foo; export function echo_vec_struct(a: (Foo)[]): (Foo)[]; @@ -53,6 +61,14 @@ export function echo_option_vec_u32(a?: Uint32Array): Uint32Array | undefined; export function echo_option_vec_i32(a?: Int32Array): Int32Array | undefined; export function echo_option_vec_u64(a?: BigUint64Array): BigUint64Array | undefined; export function echo_option_vec_i64(a?: BigInt64Array): BigInt64Array | undefined; +export function echo_option_vec_uninit_u8(a?: Uint8Array): Uint8Array | undefined; +export function echo_option_vec_uninit_i8(a?: Int8Array): Int8Array | undefined; +export function echo_option_vec_uninit_u16(a?: Uint16Array): Uint16Array | undefined; +export function echo_option_vec_uninit_i16(a?: Int16Array): Int16Array | undefined; +export function echo_option_vec_uninit_u32(a?: Uint32Array): Uint32Array | undefined; +export function echo_option_vec_uninit_i32(a?: Int32Array): Int32Array | undefined; +export function echo_option_vec_uninit_u64(a?: BigUint64Array): BigUint64Array | undefined; +export function echo_option_vec_uninit_i64(a?: BigInt64Array): BigInt64Array | undefined; export function echo_option_vec_string(a?: (string)[]): (string)[] | undefined; export function echo_option_struct(a?: Foo): Foo | undefined; export function echo_option_vec_struct(a?: (Foo)[]): (Foo)[] | undefined; diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js index f2eb7da3e3b..1809b0e8618 100644 --- a/crates/cli/tests/reference/echo.js +++ b/crates/cli/tests/reference/echo.js @@ -554,6 +554,110 @@ export function echo_vec_i64(a) { return v2; } +/** + * @param {Uint8Array} a + * @returns {Uint8Array} + */ +export function echo_vec_uninit_u8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_u8(ptr0, len0); + var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +/** + * @param {Int8Array} a + * @returns {Int8Array} + */ +export function echo_vec_uninit_i8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_i8(ptr0, len0); + var v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +/** + * @param {Uint16Array} a + * @returns {Uint16Array} + */ +export function echo_vec_uninit_u16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_u16(ptr0, len0); + var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +/** + * @param {Int16Array} a + * @returns {Int16Array} + */ +export function echo_vec_uninit_i16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_i16(ptr0, len0); + var v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +/** + * @param {Uint32Array} a + * @returns {Uint32Array} + */ +export function echo_vec_uninit_u32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_u32(ptr0, len0); + var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +/** + * @param {Int32Array} a + * @returns {Int32Array} + */ +export function echo_vec_uninit_i32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_i32(ptr0, len0); + var v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +/** + * @param {BigUint64Array} a + * @returns {BigUint64Array} + */ +export function echo_vec_uninit_u64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_u64(ptr0, len0); + var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + +/** + * @param {BigInt64Array} a + * @returns {BigInt64Array} + */ +export function echo_vec_uninit_i64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_uninit_i64(ptr0, len0); + var v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + function addToExternrefTable0(obj) { const idx = wasm.__externref_table_alloc(); wasm.__wbindgen_export_2.set(idx, obj); @@ -912,6 +1016,134 @@ export function echo_option_vec_i64(a) { return v2; } +/** + * @param {Uint8Array | undefined} [a] + * @returns {Uint8Array | undefined} + */ +export function echo_option_vec_uninit_u8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_u8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Int8Array | undefined} [a] + * @returns {Int8Array | undefined} + */ +export function echo_option_vec_uninit_i8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_i8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Uint16Array | undefined} [a] + * @returns {Uint16Array | undefined} + */ +export function echo_option_vec_uninit_u16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_u16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Int16Array | undefined} [a] + * @returns {Int16Array | undefined} + */ +export function echo_option_vec_uninit_i16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_i16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Uint32Array | undefined} [a] + * @returns {Uint32Array | undefined} + */ +export function echo_option_vec_uninit_u32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_u32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {Int32Array | undefined} [a] + * @returns {Int32Array | undefined} + */ +export function echo_option_vec_uninit_i32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_i32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {BigUint64Array | undefined} [a] + * @returns {BigUint64Array | undefined} + */ +export function echo_option_vec_uninit_u64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_u64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + +/** + * @param {BigInt64Array | undefined} [a] + * @returns {BigInt64Array | undefined} + */ +export function echo_option_vec_uninit_i64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_uninit_i64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + /** * @param {(string)[] | undefined} [a] * @returns {(string)[] | undefined} diff --git a/crates/cli/tests/reference/echo.rs b/crates/cli/tests/reference/echo.rs index bee663ec508..815db98c363 100644 --- a/crates/cli/tests/reference/echo.rs +++ b/crates/cli/tests/reference/echo.rs @@ -1,3 +1,4 @@ +use std::mem::MaybeUninit; use wasm_bindgen::prelude::*; #[wasm_bindgen] @@ -42,6 +43,14 @@ echo!( (echo_vec_i32, Vec), (echo_vec_u64, Vec), (echo_vec_i64, Vec), + (echo_vec_uninit_u8, Vec>), + (echo_vec_uninit_i8, Vec>), + (echo_vec_uninit_u16, Vec>), + (echo_vec_uninit_i16, Vec>), + (echo_vec_uninit_u32, Vec>), + (echo_vec_uninit_i32, Vec>), + (echo_vec_uninit_u64, Vec>), + (echo_vec_uninit_i64, Vec>), (echo_vec_string, Vec), (echo_struct, Foo), (echo_vec_struct, Vec), @@ -70,6 +79,14 @@ echo!( (echo_option_vec_i32, Option>), (echo_option_vec_u64, Option>), (echo_option_vec_i64, Option>), + (echo_option_vec_uninit_u8, Option>>), + (echo_option_vec_uninit_i8, Option>>), + (echo_option_vec_uninit_u16, Option>>), + (echo_option_vec_uninit_i16, Option>>), + (echo_option_vec_uninit_u32, Option>>), + (echo_option_vec_uninit_i32, Option>>), + (echo_option_vec_uninit_u64, Option>>), + (echo_option_vec_uninit_i64, Option>>), (echo_option_vec_string, Option>), (echo_option_struct, Option), (echo_option_vec_struct, Option>) diff --git a/crates/cli/tests/reference/echo.wat b/crates/cli/tests/reference/echo.wat index f73b23625f6..aff42b9dcdc 100644 --- a/crates/cli/tests/reference/echo.wat +++ b/crates/cli/tests/reference/echo.wat @@ -61,22 +61,38 @@ (func $"echo_vec_i32 multivalue shim" (;44;) (type 5) (param i32 i32) (result i32 i32)) (func $"echo_vec_u64 multivalue shim" (;45;) (type 5) (param i32 i32) (result i32 i32)) (func $"echo_vec_i64 multivalue shim" (;46;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_string multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_struct multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_u64 multivalue shim" (;49;) (type 8) (param i32 i64) (result i32 i64)) - (func $"echo_option_i64 multivalue shim" (;50;) (type 8) (param i32 i64) (result i32 i64)) - (func $"echo_option_f64 multivalue shim" (;51;) (type 10) (param i32 f64) (result i32 f64)) - (func $"echo_option_string multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u8 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i8 multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u16 multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i16 multivalue shim" (;56;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u32 multivalue shim" (;57;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i32 multivalue shim" (;58;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u64 multivalue shim" (;59;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i64 multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_string multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_struct multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u8 multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i8 multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u16 multivalue shim" (;49;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i16 multivalue shim" (;50;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u32 multivalue shim" (;51;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i32 multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u64 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i64 multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_string multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_struct multivalue shim" (;56;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_u64 multivalue shim" (;57;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_i64 multivalue shim" (;58;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_f64 multivalue shim" (;59;) (type 10) (param i32 f64) (result i32 f64)) + (func $"echo_option_string multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u8 multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i8 multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u16 multivalue shim" (;63;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i16 multivalue shim" (;64;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u32 multivalue shim" (;65;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i32 multivalue shim" (;66;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u64 multivalue shim" (;67;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i64 multivalue shim" (;68;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u8 multivalue shim" (;69;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i8 multivalue shim" (;70;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u16 multivalue shim" (;71;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i16 multivalue shim" (;72;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u32 multivalue shim" (;73;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i32 multivalue shim" (;74;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u64 multivalue shim" (;75;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i64 multivalue shim" (;76;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_string multivalue shim" (;77;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_struct multivalue shim" (;78;) (type 5) (param i32 i32) (result i32 i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) @@ -106,6 +122,14 @@ (export "echo_vec_i32" (func $"echo_vec_i32 multivalue shim")) (export "echo_vec_u64" (func $"echo_vec_u64 multivalue shim")) (export "echo_vec_i64" (func $"echo_vec_i64 multivalue shim")) + (export "echo_vec_uninit_u8" (func $"echo_vec_uninit_u8 multivalue shim")) + (export "echo_vec_uninit_i8" (func $"echo_vec_uninit_i8 multivalue shim")) + (export "echo_vec_uninit_u16" (func $"echo_vec_uninit_u16 multivalue shim")) + (export "echo_vec_uninit_i16" (func $"echo_vec_uninit_i16 multivalue shim")) + (export "echo_vec_uninit_u32" (func $"echo_vec_uninit_u32 multivalue shim")) + (export "echo_vec_uninit_i32" (func $"echo_vec_uninit_i32 multivalue shim")) + (export "echo_vec_uninit_u64" (func $"echo_vec_uninit_u64 multivalue shim")) + (export "echo_vec_uninit_i64" (func $"echo_vec_uninit_i64 multivalue shim")) (export "echo_vec_string" (func $"echo_vec_string multivalue shim")) (export "echo_struct" (func $echo_struct)) (export "echo_vec_struct" (func $"echo_vec_struct multivalue shim")) @@ -134,6 +158,14 @@ (export "echo_option_vec_i32" (func $"echo_option_vec_i32 multivalue shim")) (export "echo_option_vec_u64" (func $"echo_option_vec_u64 multivalue shim")) (export "echo_option_vec_i64" (func $"echo_option_vec_i64 multivalue shim")) + (export "echo_option_vec_uninit_u8" (func $"echo_option_vec_uninit_u8 multivalue shim")) + (export "echo_option_vec_uninit_i8" (func $"echo_option_vec_uninit_i8 multivalue shim")) + (export "echo_option_vec_uninit_u16" (func $"echo_option_vec_uninit_u16 multivalue shim")) + (export "echo_option_vec_uninit_i16" (func $"echo_option_vec_uninit_i16 multivalue shim")) + (export "echo_option_vec_uninit_u32" (func $"echo_option_vec_uninit_u32 multivalue shim")) + (export "echo_option_vec_uninit_i32" (func $"echo_option_vec_uninit_i32 multivalue shim")) + (export "echo_option_vec_uninit_u64" (func $"echo_option_vec_uninit_u64 multivalue shim")) + (export "echo_option_vec_uninit_i64" (func $"echo_option_vec_uninit_i64 multivalue shim")) (export "echo_option_vec_string" (func $"echo_option_vec_string multivalue shim")) (export "echo_option_struct" (func $echo_option_struct)) (export "echo_option_vec_struct" (func $"echo_option_vec_struct multivalue shim")) diff --git a/guide/src/reference/types/boxed-number-slices.md b/guide/src/reference/types/boxed-number-slices.md index 6df85e18287..4196d48ee06 100644 --- a/guide/src/reference/types/boxed-number-slices.md +++ b/guide/src/reference/types/boxed-number-slices.md @@ -1,4 +1,4 @@ -# Boxed Number Slices: `Box<[u8]>`, `Box<[i8]>`, `Box<[u16]>`, `Box<[i16]>`, `Box<[u32]>`, `Box<[i32]>`, `Box<[u64]>`, `Box<[i64]>`, `Box<[f32]>`, and `Box<[f64]>` +# Boxed Number Slices: `Box<[u8]>`, `Box<[i8]>`, `Box<[u16]>`, `Box<[i16]>`, `Box<[u32]>`, `Box<[i32]>`, `Box<[u64]>`, `Box<[i64]>`, `Box<[f32]>`, `Box<[f64]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, `Box<[MaybeUninit]>`, and `Box<[MaybeUninit]>` | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -8,6 +8,10 @@ from the Wasm linear memory when returning a boxed slice to JavaScript, and vice versa when receiving a JavaScript `TypedArray` as a boxed slice in Rust. +> **Note:** Numeric `MaybeUninit` can always be assumed to be initialized +> upon transmission from Rust to JS and vice-versa. However, uninitialized +> values coming from Rust might contain unspecified values. + ## Example Rust Usage ```rust diff --git a/guide/src/reference/types/number-slices.md b/guide/src/reference/types/number-slices.md index 191430a92ec..11da99673f9 100644 --- a/guide/src/reference/types/number-slices.md +++ b/guide/src/reference/types/number-slices.md @@ -1,9 +1,13 @@ -# Number Slices: `[u8]`, `[i8]`, `[u16]`, `[i16]`, `[u32]`, `[i32]`, `[u64]`, `[i64]`, `[f32]`, and `[f64]` +# Number Slices: `[u8]`, `[i8]`, `[u16]`, `[i16]`, `[u32]`, `[i32]`, `[u64]`, `[i64]`, `[f32]`, `[f64]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, `[MaybeUninit]`, and `[MaybeUninit]` | `T` parameter | `&T` parameter | `&mut T` parameter | `T` return value | `Option<&T>` parameter | `Option` return value | JavaScript representation | |:---:|:---:|:---:|:---:|:---:|:---:|:---:| | No | Yes | Yes | No | No | No | A JavaScript `TypedArray` view of the Wasm memory for the boxed slice of the appropriate type (`Int32Array`, `Uint8Array`, etc) | +> **Note:** Numeric `MaybeUninit` can always be assumed to be initialized +> upon transmission from Rust to JS and vice-versa. However, uninitialized +> values coming from Rust might contain unspecified values. + ## Example Rust Usage ```rust diff --git a/src/convert/slices.rs b/src/convert/slices.rs index 6c23926ebf9..ac9a462475e 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -1,7 +1,7 @@ use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; -use core::mem; +use core::mem::{self, MaybeUninit}; use core::ops::{Deref, DerefMut}; use core::str; @@ -118,12 +118,19 @@ impl DerefMut for MutSlice { } macro_rules! vectors { - ($($t:ident)*) => ($( + ($($t:ty)*) => ($( + vectors_internal!($t); + vectors_internal!(MaybeUninit<$t>); + )*) +} + +macro_rules! vectors_internal { + ($t:ty) => { impl WasmDescribeVector for $t { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe_vector() { inform(VECTOR); - $t::describe(); + <$t>::describe(); } } @@ -167,7 +174,9 @@ macro_rules! vectors { impl<'a> OptionIntoWasmAbi for &'a [$t] { #[inline] - fn none() -> WasmSlice { null_slice() } + fn none() -> WasmSlice { + null_slice() + } } impl<'a> IntoWasmAbi for &'a mut [$t] { @@ -181,7 +190,9 @@ macro_rules! vectors { impl<'a> OptionIntoWasmAbi for &'a mut [$t] { #[inline] - fn none() -> WasmSlice { null_slice() } + fn none() -> WasmSlice { + null_slice() + } } impl RefFromWasmAbi for [$t] { @@ -215,7 +226,7 @@ macro_rules! vectors { Self::ref_from_abi(js) } } - )*) + }; } vectors! { diff --git a/src/describe.rs b/src/describe.rs index 9987449881d..708e1103651 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -6,7 +6,7 @@ use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; -use core::ptr::NonNull; +use core::{mem::MaybeUninit, ptr::NonNull}; use crate::{Clamped, JsError, JsObject, JsValue}; use cfg_if::cfg_if; @@ -229,6 +229,13 @@ impl> WasmDescribe for Result { } } +impl WasmDescribe for MaybeUninit { + #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] + fn describe() { + T::describe(); + } +} + impl WasmDescribe for Clamped { #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] fn describe() { diff --git a/tests/wasm/slice.js b/tests/wasm/slice.js index 3e65dfc5238..e7fac78f817 100644 --- a/tests/wasm/slice.js +++ b/tests/wasm/slice.js @@ -7,22 +7,30 @@ exports.js_export = () => { i8[1] = 2; assert.deepStrictEqual(wasm.export_i8(i8), i8); assert.deepStrictEqual(wasm.export_optional_i8(i8), i8); + assert.deepStrictEqual(wasm.export_uninit_i8(i8), i8); + assert.deepStrictEqual(wasm.export_optional_uninit_i8(i8), i8); const u8 = new Uint8Array(2); u8[0] = 1; u8[1] = 2; assert.deepStrictEqual(wasm.export_u8(u8), u8); assert.deepStrictEqual(wasm.export_optional_u8(u8), u8); + assert.deepStrictEqual(wasm.export_uninit_u8(u8), u8); + assert.deepStrictEqual(wasm.export_optional_uninit_u8(u8), u8); const i16 = new Int16Array(2); i16[0] = 1; i16[1] = 2; assert.deepStrictEqual(wasm.export_i16(i16), i16); assert.deepStrictEqual(wasm.export_optional_i16(i16), i16); + assert.deepStrictEqual(wasm.export_uninit_i16(i16), i16); + assert.deepStrictEqual(wasm.export_optional_uninit_i16(i16), i16); const u16 = new Uint16Array(2); u16[0] = 1; u16[1] = 2; assert.deepStrictEqual(wasm.export_u16(u16), u16); assert.deepStrictEqual(wasm.export_optional_u16(u16), u16); + assert.deepStrictEqual(wasm.export_uninit_u16(u16), u16); + assert.deepStrictEqual(wasm.export_optional_uninit_u16(u16), u16); const i32 = new Int32Array(2); i32[0] = 1; @@ -31,6 +39,10 @@ exports.js_export = () => { assert.deepStrictEqual(wasm.export_optional_i32(i32), i32); assert.deepStrictEqual(wasm.export_isize(i32), i32); assert.deepStrictEqual(wasm.export_optional_isize(i32), i32); + assert.deepStrictEqual(wasm.export_uninit_i32(i32), i32); + assert.deepStrictEqual(wasm.export_optional_uninit_i32(i32), i32); + assert.deepStrictEqual(wasm.export_uninit_isize(i32), i32); + assert.deepStrictEqual(wasm.export_optional_uninit_isize(i32), i32); const u32 = new Uint32Array(2); u32[0] = 1; u32[1] = 2; @@ -38,17 +50,25 @@ exports.js_export = () => { assert.deepStrictEqual(wasm.export_optional_u32(u32), u32); assert.deepStrictEqual(wasm.export_usize(u32), u32); assert.deepStrictEqual(wasm.export_optional_usize(u32), u32); + assert.deepStrictEqual(wasm.export_uninit_u32(u32), u32); + assert.deepStrictEqual(wasm.export_optional_uninit_u32(u32), u32); + assert.deepStrictEqual(wasm.export_uninit_usize(u32), u32); + assert.deepStrictEqual(wasm.export_optional_uninit_usize(u32), u32); const f32 = new Float32Array(2); f32[0] = 1; f32[1] = 2; assert.deepStrictEqual(wasm.export_f32(f32), f32); assert.deepStrictEqual(wasm.export_optional_f32(f32), f32); + assert.deepStrictEqual(wasm.export_uninit_f32(f32), f32); + assert.deepStrictEqual(wasm.export_optional_uninit_f32(f32), f32); const f64 = new Float64Array(2); f64[0] = 1; f64[1] = 2; assert.deepStrictEqual(wasm.export_f64(f64), f64); assert.deepStrictEqual(wasm.export_optional_f64(f64), f64); + assert.deepStrictEqual(wasm.export_uninit_f64(f64), f64); + assert.deepStrictEqual(wasm.export_optional_uninit_f64(f64), f64); assert.strictEqual(wasm.export_optional_i8(undefined), undefined); assert.strictEqual(wasm.export_optional_u8(undefined), undefined); @@ -60,6 +80,17 @@ exports.js_export = () => { assert.strictEqual(wasm.export_optional_usize(undefined), undefined); assert.strictEqual(wasm.export_optional_f32(undefined), undefined); assert.strictEqual(wasm.export_optional_f64(undefined), undefined); + + assert.strictEqual(wasm.export_optional_uninit_i8(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_u8(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_i16(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_u16(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_i32(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_isize(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_u32(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_usize(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_f32(undefined), undefined); + assert.strictEqual(wasm.export_optional_uninit_f64(undefined), undefined); }; const test_import = (a, b, c) => { @@ -84,44 +115,65 @@ exports.import_js_usize = test_import; exports.import_js_f32 = test_import; exports.import_js_f64 = test_import; +exports.import_js_uninit_i8 = test_import; +exports.import_js_uninit_u8 = test_import; +exports.import_js_uninit_i16 = test_import; +exports.import_js_uninit_u16 = test_import; +exports.import_js_uninit_i32 = test_import; +exports.import_js_uninit_isize = test_import; +exports.import_js_uninit_u32 = test_import; +exports.import_js_uninit_usize = test_import; +exports.import_js_uninit_f32 = test_import; +exports.import_js_uninit_f64 = test_import; + exports.js_import = () => { const i8 = new Int8Array(2); i8[0] = 1; i8[1] = 2; assert.deepStrictEqual(wasm.import_rust_i8(i8), i8); + assert.deepStrictEqual(wasm.import_rust_uninit_i8(i8), i8); const u8 = new Uint8Array(2); u8[0] = 1; u8[1] = 2; assert.deepStrictEqual(wasm.import_rust_u8(u8), u8); + assert.deepStrictEqual(wasm.import_rust_uninit_u8(u8), u8); const i16 = new Int16Array(2); i16[0] = 1; i16[1] = 2; assert.deepStrictEqual(wasm.import_rust_i16(i16), i16); + assert.deepStrictEqual(wasm.import_rust_uninit_i16(i16), i16); const u16 = new Uint16Array(2); u16[0] = 1; u16[1] = 2; assert.deepStrictEqual(wasm.import_rust_u16(u16), u16); + assert.deepStrictEqual(wasm.import_rust_uninit_u16(u16), u16); const i32 = new Int32Array(2); i32[0] = 1; i32[1] = 2; assert.deepStrictEqual(wasm.import_rust_i32(i32), i32); assert.deepStrictEqual(wasm.import_rust_isize(i32), i32); + assert.deepStrictEqual(wasm.import_rust_uninit_i32(i32), i32); + assert.deepStrictEqual(wasm.import_rust_uninit_isize(i32), i32); const u32 = new Uint32Array(2); u32[0] = 1; u32[1] = 2; assert.deepStrictEqual(wasm.import_rust_u32(u32), u32); assert.deepStrictEqual(wasm.import_rust_usize(u32), u32); + assert.deepStrictEqual(wasm.import_rust_uninit_u32(u32), u32); + assert.deepStrictEqual(wasm.import_rust_uninit_usize(u32), u32); const f32 = new Float32Array(2); f32[0] = 1; f32[1] = 2; assert.deepStrictEqual(wasm.import_rust_f32(f32), f32); + assert.deepStrictEqual(wasm.import_rust_uninit_f32(f32), f32); const f64 = new Float64Array(2); f64[0] = 1; f64[1] = 2; assert.deepStrictEqual(wasm.import_rust_f64(f64), f64); + assert.deepStrictEqual(wasm.import_rust_uninit_f64(f64), f64); }; exports.js_pass_array = () => { @@ -135,6 +187,17 @@ exports.js_pass_array = () => { wasm.pass_array_rust_usize([1, 2]); wasm.pass_array_rust_f32([1, 2]); wasm.pass_array_rust_f64([1, 2]); + + wasm.pass_array_rust_uninit_i8([1, 2]); + wasm.pass_array_rust_uninit_u8([1, 2]); + wasm.pass_array_rust_uninit_i16([1, 2]); + wasm.pass_array_rust_uninit_u16([1, 2]); + wasm.pass_array_rust_uninit_i32([1, 2]); + wasm.pass_array_rust_uninit_u32([1, 2]); + wasm.pass_array_rust_uninit_isize([1, 2]); + wasm.pass_array_rust_uninit_usize([1, 2]); + wasm.pass_array_rust_uninit_f32([1, 2]); + wasm.pass_array_rust_uninit_f64([1, 2]); }; const import_mut_foo = (a, b, c) => { @@ -163,6 +226,17 @@ exports.import_mut_js_usize = import_mut_foo; exports.import_mut_js_f32 = import_mut_foo; exports.import_mut_js_f64 = import_mut_foo; +exports.import_mut_js_uninit_i8 = import_mut_foo; +exports.import_mut_js_uninit_u8 = import_mut_foo; +exports.import_mut_js_uninit_i16 = import_mut_foo; +exports.import_mut_js_uninit_u16 = import_mut_foo; +exports.import_mut_js_uninit_i32 = import_mut_foo; +exports.import_mut_js_uninit_u32 = import_mut_foo; +exports.import_mut_js_uninit_isize = import_mut_foo; +exports.import_mut_js_uninit_usize = import_mut_foo; +exports.import_mut_js_uninit_f32 = import_mut_foo; +exports.import_mut_js_uninit_f64 = import_mut_foo; + const export_mut_run = (a, rust) => { assert.strictEqual(a.length, 3); a[0] = 1; @@ -188,6 +262,17 @@ exports.js_export_mut = () => { export_mut_run(new Uint32Array(3), wasm.export_mut_usize); export_mut_run(new Float32Array(3), wasm.export_mut_f32); export_mut_run(new Float64Array(3), wasm.export_mut_f64); + + export_mut_run(new Int8Array(3), wasm.export_mut_uninit_i8); + export_mut_run(new Uint8Array(3), wasm.export_mut_uninit_u8); + export_mut_run(new Int16Array(3), wasm.export_mut_uninit_i16); + export_mut_run(new Uint16Array(3), wasm.export_mut_uninit_u16); + export_mut_run(new Int32Array(3), wasm.export_mut_uninit_i32); + export_mut_run(new Uint32Array(3), wasm.export_mut_uninit_u32); + export_mut_run(new Int32Array(3), wasm.export_mut_uninit_isize); + export_mut_run(new Uint32Array(3), wasm.export_mut_uninit_usize); + export_mut_run(new Float32Array(3), wasm.export_mut_uninit_f32); + export_mut_run(new Float64Array(3), wasm.export_mut_uninit_f64); }; exports.js_return_vec = () => { diff --git a/tests/wasm/slice.rs b/tests/wasm/slice.rs index 15e9a9ac2e9..6b18a6345d5 100644 --- a/tests/wasm/slice.rs +++ b/tests/wasm/slice.rs @@ -1,3 +1,7 @@ +#![cfg(test)] + +use paste::paste; +use std::mem::MaybeUninit; use wasm_bindgen::prelude::*; use wasm_bindgen::Clamped; use wasm_bindgen_test::*; @@ -19,12 +23,19 @@ extern "C" { fn js_clamped2(val: Clamped>, offset: u8); #[wasm_bindgen(js_name = js_clamped)] fn js_clamped3(val: Clamped<&mut [u8]>, offset: u8); + + #[wasm_bindgen(js_name = js_clamped)] + fn js_clamped_uninit(val: Clamped<&[MaybeUninit]>, offset: u8); + #[wasm_bindgen(js_name = js_clamped)] + fn js_clamped2_uninit(val: Clamped>>, offset: u8); + #[wasm_bindgen(js_name = js_clamped)] + fn js_clamped3_uninit(val: Clamped<&mut [MaybeUninit]>, offset: u8); } macro_rules! export_macro { - ($(($i:ident, $n:ident, $optional_n:ident))*) => ($( + ($($i:ident),*) => ( paste! { $( #[wasm_bindgen] - pub fn $n(a: &[$i]) -> Vec<$i> { + pub fn [](a: &[$i]) -> Vec<$i> { assert_eq!(a.len(), 2); assert_eq!(a[0], 1 as $i); assert_eq!(a[1], 2 as $i); @@ -32,108 +43,140 @@ macro_rules! export_macro { } #[wasm_bindgen] - pub fn $optional_n(a: Option>) -> Option> { + pub fn [](a: Option>) -> Option> { a.map(|a| { assert_eq!(a.len(), 2); assert_eq!(a[0], 1 as $i); assert_eq!(a[1], 2 as $i); a.to_vec() }) + } - )*) -} -export_macro! { - (i8, export_i8, export_optional_i8) - (u8, export_u8, export_optional_u8) - (i16, export_i16, export_optional_i16) - (u16, export_u16, export_optional_u16) - (i32, export_i32, export_optional_i32) - (u32, export_u32, export_optional_u32) - (isize, export_isize, export_optional_isize) - (usize, export_usize, export_optional_usize) - (f32, export_f32, export_optional_f32) - (f64, export_f64, export_optional_f64) + #[wasm_bindgen] + pub fn [](a: &[MaybeUninit<$i>]) -> Vec> { + assert_eq!(a.len(), 2); + let slice = slice_ref(a); + assert_eq!(slice[0], 1 as $i); + assert_eq!(slice[1], 2 as $i); + a.to_vec() + } + + #[wasm_bindgen] + pub fn [](a: Option>>) -> Option>> { + a.map(|a| { + assert_eq!(a.len(), 2); + let slice = slice_ref(&a); + assert_eq!(slice[0], 1 as $i); + assert_eq!(slice[1], 2 as $i); + a.to_vec() + }) + + } + )* } ); } +export_macro!(i8, u8, i16, u16, i32, u32, isize, usize, f32, f64); + #[wasm_bindgen_test] fn export() { js_export(); } macro_rules! import_macro { - ($(($rust:ident, $js:ident, $i:ident))*) => ($( + ($($i:ident),*) => ( paste! { $( #[wasm_bindgen(module = "tests/wasm/slice.js")] extern "C" { - fn $js(a: &[$i], b: Option<&[$i]>, c: Option<&[$i]>) -> Vec<$i>; + fn [](a: &[$i], b: Option<&[$i]>, c: Option<&[$i]>) -> Vec<$i>; } #[wasm_bindgen] - pub fn $rust(a: &[$i]) -> Vec<$i> { + pub fn [](a: &[$i]) -> Vec<$i> { assert_eq!(a.len(), 2); assert_eq!(a[0], 1 as $i); assert_eq!(a[1], 2 as $i); - $js(a, Some(a), None) + [](a, Some(a), None) } - )*) -} -import_macro! { - (import_rust_i8, import_js_i8, i8) - (import_rust_u8, import_js_u8, u8) - (import_rust_i16, import_js_i16, i16) - (import_rust_u16, import_js_u16, u16) - (import_rust_i32, import_js_i32, i32) - (import_rust_u32, import_js_u32, u32) - (import_rust_isize, import_js_isize, isize) - (import_rust_usize, import_js_usize, usize) - (import_rust_f32, import_js_f32, f32) - (import_rust_f64, import_js_f64, f64) + #[wasm_bindgen(module = "tests/wasm/slice.js")] + extern "C" { + fn [](a: &[MaybeUninit<$i>], b: Option<&[MaybeUninit<$i>]>, c: Option<&[MaybeUninit<$i>]>) -> Vec>; + } + + #[wasm_bindgen] + pub fn [](a: &[MaybeUninit<$i>]) -> Vec> { + assert_eq!(a.len(), 2); + let slice = slice_ref(a); + assert_eq!(slice[0], 1 as $i); + assert_eq!(slice[1], 2 as $i); + [](a, Some(a), None) + } + )* } ) } +import_macro!(i8, u8, i16, u16, i32, u32, isize, usize, f32, f64); + #[wasm_bindgen_test] fn import() { js_import(); } macro_rules! pass_array_marco { - ($(($rust:ident, $i:ident))*) => ($( + ($($i:ident),*) => ( paste! { $( #[wasm_bindgen] - pub fn $rust(a: &[$i]) { + pub fn [](a: &[$i]) { assert_eq!(a.len(), 2); assert_eq!(a[0], 1 as $i); assert_eq!(a[1], 2 as $i); } - )*) -} -pass_array_marco! { - (pass_array_rust_i8, i8) - (pass_array_rust_u8, u8) - (pass_array_rust_i16, i16) - (pass_array_rust_u16, u16) - (pass_array_rust_i32, i32) - (pass_array_rust_u32, u32) - (pass_array_rust_isize, isize) - (pass_array_rust_usize, usize) - (pass_array_rust_f32, f32) - (pass_array_rust_f64, f64) + #[wasm_bindgen] + pub fn [](a: &[MaybeUninit<$i>]) { + assert_eq!(a.len(), 2); + let a = slice_ref(a); + assert_eq!(a[0], 1 as $i); + assert_eq!(a[1], 2 as $i); + } + )* } ) } +pass_array_marco!(i8, u8, i16, u16, i32, u32, isize, usize, f32, f64); + #[wasm_bindgen_test] fn pass_array() { js_pass_array(); } macro_rules! import_mut_macro { - ($(($rust:ident, $js:ident, $i:ident))*) => ( + ($($i:ident),*) => ( paste! { $( #[wasm_bindgen(module = "tests/wasm/slice.js")] extern "C" { - fn $js(a: &mut [$i], b: Option<&mut [$i]>, c: Option<&mut [$i]>); + fn [](a: &mut [$i], b: Option<&mut [$i]>, c: Option<&mut [$i]>); + fn [](a: &mut [MaybeUninit<$i>], b: Option<&mut [MaybeUninit<$i>]>, c: Option<&mut [MaybeUninit<$i>]>); + } + + fn []() { + let mut buf1 = [ + 1 as $i, + 2 as $i, + 3 as $i, + ]; + let mut buf2 = [ + 4 as $i, + 5 as $i, + 6 as $i, + ]; + [](&mut buf1, Some(&mut buf2), None); + assert_eq!(buf1[0], 4 as $i); + assert_eq!(buf1[1], 5 as $i); + assert_eq!(buf1[2], 3 as $i); + assert_eq!(buf2[0], 8 as $i); + assert_eq!(buf2[1], 7 as $i); + assert_eq!(buf2[2], 6 as $i); } - fn $rust() { + fn []() { let mut buf1 = [ 1 as $i, 2 as $i, @@ -144,7 +187,7 @@ macro_rules! import_mut_macro { 5 as $i, 6 as $i, ]; - $js(&mut buf1, Some(&mut buf2), None); + [](slice_uninit_mut(&mut buf1), Some(slice_uninit_mut(&mut buf2)), None); assert_eq!(buf1[0], 4 as $i); assert_eq!(buf1[1], 5 as $i); assert_eq!(buf1[2], 3 as $i); @@ -156,26 +199,18 @@ macro_rules! import_mut_macro { #[wasm_bindgen_test] fn import_mut() { - $($rust();)* + $([]();)* + $([]();)* } - ) + } ) } -import_mut_macro! { - (import_mut_rust_i8, import_mut_js_i8, i8) - (import_mut_rust_u8, import_mut_js_u8, u8) - (import_mut_rust_i16, import_mut_js_i16, i16) - (import_mut_rust_u16, import_mut_js_u16, u16) - (import_mut_rust_i32, import_mut_js_i32, i32) - (import_mut_rust_u32, import_mut_js_u32, u32) - (import_mut_rust_f32, import_mut_js_f32, f32) - (import_mut_rust_f64, import_mut_js_f64, f64) -} +import_mut_macro!(i8, u8, i16, u16, i32, u32, f32, f64); macro_rules! export_mut_macro { - ($(($i:ident, $n:ident))*) => ($( + ($($i:ident),*) => ( paste! { $( #[wasm_bindgen] - pub fn $n(a: &mut [$i]) { + pub fn [](a: &mut [$i]) { assert_eq!(a.len(), 3); assert_eq!(a[0], 1 as $i); assert_eq!(a[1], 2 as $i); @@ -183,22 +218,22 @@ macro_rules! export_mut_macro { a[0] = 4 as $i; a[1] = 5 as $i; } - )*) -} -export_mut_macro! { - (i8, export_mut_i8) - (u8, export_mut_u8) - (i16, export_mut_i16) - (u16, export_mut_u16) - (i32, export_mut_i32) - (u32, export_mut_u32) - (isize, export_mut_isize) - (usize, export_mut_usize) - (f32, export_mut_f32) - (f64, export_mut_f64) + #[wasm_bindgen] + pub fn [](a: &mut [MaybeUninit<$i>]) { + assert_eq!(a.len(), 3); + let a = slice_mut(a); + assert_eq!(a[0], 1 as $i); + assert_eq!(a[1], 2 as $i); + assert_eq!(a[2], 3 as $i); + a[0] = 4 as $i; + a[1] = 5 as $i; + } + )* } ) } +export_mut_macro!(i8, u8, i16, u16, i32, u32, isize, usize, f32, f64); + #[wasm_bindgen_test] fn export_mut() { js_export_mut(); @@ -249,4 +284,24 @@ fn take_clamped() { js_clamped(Clamped(&[1, 2, 3]), 1); js_clamped2(Clamped(vec![4, 5, 6]), 4); js_clamped3(Clamped(&mut [7, 8, 9]), 7); + + js_clamped_uninit(Clamped(slice_uninit_ref(&[1, 2, 3])), 1); + js_clamped2_uninit(Clamped(slice_uninit_ref(&[4, 5, 6]).to_vec()), 4); + js_clamped3_uninit(Clamped(slice_uninit_mut(&mut [7, 8, 9])), 7); +} + +fn slice_ref(slice: &[MaybeUninit]) -> &[T] { + unsafe { &*(std::ptr::from_ref(slice) as *const [T]) } +} + +fn slice_mut(slice: &mut [MaybeUninit]) -> &mut [T] { + unsafe { &mut *(std::ptr::from_mut(slice) as *mut [T]) } +} + +fn slice_uninit_ref(slice: &[T]) -> &[MaybeUninit] { + unsafe { &*(std::ptr::from_ref(slice) as *const [MaybeUninit]) } +} + +fn slice_uninit_mut(slice: &mut [T]) -> &mut [MaybeUninit] { + unsafe { &mut *(std::ptr::from_mut(slice) as *mut [MaybeUninit]) } } From 04edcff48c3b7c37ecd680f0c91baa39088d993a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:38:24 +0100 Subject: [PATCH 593/641] Remove dead code (#4300) --- crates/cli-support/src/js/binding.rs | 1 - crates/cli-support/src/wit/mod.rs | 3 +-- crates/cli-support/src/wit/outgoing.rs | 11 +++++------ crates/cli-support/src/wit/standard.rs | 4 ---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index d5ed01363ad..54be1481163 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -1246,7 +1246,6 @@ fn instruction( Instruction::CachedStringLoad { owned, - optional: _, mem, free, table, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 07fb5090a78..930fddca566 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -1205,7 +1205,7 @@ impl<'a> Context<'a> { kind: AdapterJsImportKind, ) -> Result { let import = self.module.imports.get(import); - let (import_module, import_name) = (import.module.clone(), import.name.clone()); + let import_name = import.name.clone(); let import_id = import.id(); let core_id = match import.kind { walrus::ImportKind::Function(f) => f, @@ -1242,7 +1242,6 @@ impl<'a> Context<'a> { ret.input, vec![], AdapterKind::Import { - module: import_module, name: import_name, kind, }, diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index ba15babf5c9..b5eaeefa84b 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Ref(d) => self.outgoing_ref(false, d)?, Descriptor::RefMut(d) => self.outgoing_ref(true, d)?, - Descriptor::CachedString => self.cached_string(false, true)?, + Descriptor::CachedString => self.cached_string(true)?, Descriptor::String => { // fetch the ptr/length ... @@ -193,7 +193,7 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::NamedExternref(name.clone())], ); } - Descriptor::CachedString => self.cached_string(false, false)?, + Descriptor::CachedString => self.cached_string(false)?, Descriptor::String => { self.instruction( @@ -335,7 +335,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Ref(d) => self.outgoing_option_ref(false, d)?, Descriptor::RefMut(d) => self.outgoing_option_ref(true, d)?, - Descriptor::CachedString => self.cached_string(true, true)?, + Descriptor::CachedString => self.cached_string(true)?, Descriptor::String | Descriptor::Vector(_) => { let kind = arg.vector_kind().ok_or_else(|| { @@ -525,7 +525,7 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::NamedExternref(name.clone()).option()], ); } - Descriptor::CachedString => self.cached_string(true, false)?, + Descriptor::CachedString => self.cached_string(false)?, Descriptor::String | Descriptor::Slice(_) => { let kind = arg.vector_kind().ok_or_else(|| { format_err!( @@ -574,14 +574,13 @@ impl InstructionBuilder<'_, '_> { self.instruction(&[AdapterType::I64], instr, &[output]); } - fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> { + fn cached_string(&mut self, owned: bool) -> Result<(), Error> { let mem = self.cx.memory()?; let free = self.cx.free()?; self.instruction( &[AdapterType::I32, AdapterType::I32], Instruction::CachedStringLoad { owned, - optional, mem, free, table: None, diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index b0b1cb6832e..8b3780f37fb 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -40,8 +40,6 @@ pub enum AdapterKind { instructions: Vec, }, Import { - #[allow(dead_code)] - module: String, name: String, kind: AdapterJsImportKind, }, @@ -314,8 +312,6 @@ pub enum Instruction { /// pops ptr/length i32, loads string from cache CachedStringLoad { owned: bool, - #[allow(dead_code)] - optional: bool, mem: walrus::MemoryId, free: walrus::FunctionId, /// If we're in reference-types mode, the externref table ID to get the cached string from. From dae7bc2aff97ee161b89b82d4604c1a468fd6fa7 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:52:11 +0100 Subject: [PATCH 594/641] Prepare v0.2.98 release (#4330) --- CHANGELOG.md | 4 +++- Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/cli/tests/reference/web-sys.js | 2 +- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- publish.rs | 1 + 20 files changed, 49 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 205eafe525b..85e48fcf561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.98](https://github.com/rustwasm/wasm-bindgen/compare/0.2.97...0.2.98) + +Released 2024-12-07 ### Added diff --git a/Cargo.toml b/Cargo.toml index dae4e2bd11b..8bab80d5ca5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.97" +version = "0.2.98" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,7 +45,7 @@ cfg-if = "1.0.0" once_cell = { version = "1.12", default-features = false } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.97", default-features = false } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.98", default-features = false } [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 3e0603b96d5..372b47c3720 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.97" +version = "0.2.98" [features] default = ["std"] @@ -25,7 +25,7 @@ log = "0.4" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } [lints] workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 5a21b6f35ae..42134b82b92 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] anyhow = "1.0" @@ -23,12 +23,12 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = { version = "0.23", features = ['parallel'] } -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.97' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.97' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.97' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.97' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.97' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.97' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.98' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.98' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.98' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.98' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.98' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.98' } [lints] workspace = true diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 92da9858708..0a7060a0beb 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = "0.23" -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.97" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.98" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 071fcab86e9..34c45c7330e 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -188,7 +188,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_6684d1d61b5a2140() { return handleError(function (arg0, arg1) { +export function __wbg_new_f3433bf7bc73881c() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return ret; }, arguments) }; diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 26f5d2c0b51..95a7640d7a0 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index b34f429930d..35581f2123b 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.47" +version = "0.4.48" [package.metadata.docs.rs] all-features = true @@ -19,9 +19,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '=0.3.74', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.75', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '=0.2.97', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.98', default-features = false } [features] default = ["std"] @@ -29,7 +29,7 @@ futures-core-03-stream = ['futures-core'] std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] [target.'cfg(target_feature = "atomics")'.dependencies] -web-sys = { path = "../web-sys", version = "=0.3.74", default-features = false, features = [ +web-sys = { path = "../web-sys", version = "=0.3.75", default-features = false, features = [ "MessageEvent", "Worker", ] } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 86d074e7ff0..b14fa718328 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,7 +14,7 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.74" +version = "0.3.75" [lib] doctest = false @@ -26,7 +26,7 @@ std = ["wasm-bindgen/std"] [dependencies] once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.97", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.98", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 41c28fc1ae5..736e1c059e2 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.97" +version = "0.2.98" [features] default = ["std"] @@ -24,8 +24,8 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.97", default-features = false } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.97" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.98", default-features = false } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } [lints] workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index e6a5f56df9c..34c5e97cd89 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.97" +version = "0.2.98" [lib] proc-macro = true @@ -25,7 +25,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.97", default-features = false } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.98", default-features = false } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index da6e4e87870..e9227713bd1 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 4aa1b4ee965..ec89a76506f 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.97" +version = "0.2.98" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 4997340e424..55b4ebcaafa 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.47" +version = "0.3.48" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index d3083b0e021..7e15dbacea2 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.47" +version = "0.3.48" [features] default = ["std"] @@ -15,11 +15,11 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '=0.3.74', default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.75', default-features = false } scoped-tls = { version = "1.0", optional = true } -wasm-bindgen = { path = '../..', version = '=0.2.97', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '=0.4.47', default-features = false } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.47' } +wasm-bindgen = { path = '../..', version = '=0.2.98', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.48', default-features = false } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.48' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 18c7e46bf7a..b0cbc872e26 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.97" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 1397181121e..cf20758df27 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index dae80605d50..9c39ddc0669 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.97" +version = "0.2.98" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.97" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.98" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 1ae534fc165..6d1e5efa03f 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.74" +version = "0.3.75" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '=0.3.74', default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.97", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.75', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.98", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" diff --git a/publish.rs b/publish.rs index f60234b03af..e36f3ff2a43 100644 --- a/publish.rs +++ b/publish.rs @@ -49,6 +49,7 @@ const CRATES_TO_AVOID_PUBLISH: &[&str] = &[ "example-tests", "msrv-cli-test", "msrv-library-test", + "msrv-resolver-test", ]; struct Crate { From 04ca6f34ae52454910c7c4fa15c7bfde0126db79 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 01:53:19 +0100 Subject: [PATCH 595/641] Prepare v0.2.99 release (#4331) --- CHANGELOG.md | 11 +++++++++++ Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/cli/tests/reference/web-sys.js | 2 +- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- 21 files changed, 58 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e48fcf561..32405a47e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) + +Released 2024-12-07 + +### Fixed + +- Mark `wasm-bindgen` v0.2.98 only compatible with `wasm-bindgen-cli` of the same version. + [#4331](https://github.com/rustwasm/wasm-bindgen/pull/4331) + +-------------------------------------------------------------------------------- + ## [0.2.98](https://github.com/rustwasm/wasm-bindgen/compare/0.2.97...0.2.98) Released 2024-12-07 diff --git a/Cargo.toml b/Cargo.toml index 8bab80d5ca5..5feb1d22705 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.98" +version = "0.2.99" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -45,7 +45,7 @@ cfg-if = "1.0.0" once_cell = { version = "1.12", default-features = false } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.98", default-features = false } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99", default-features = false } [dev-dependencies] wasm-bindgen-test = { path = 'crates/test' } diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 372b47c3720..7a1eab7008c 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.98" +version = "0.2.99" [features] default = ["std"] @@ -25,7 +25,7 @@ log = "0.4" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } [lints] workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 42134b82b92..6a4a5d94eee 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] anyhow = "1.0" @@ -23,12 +23,12 @@ serde_json = "1.0" tempfile = "3.0" unicode-ident = "1.0.5" walrus = { version = "0.23", features = ['parallel'] } -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.98' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.98' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.98' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.98' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.98' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.98' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.99' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.99' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.99' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.99' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.99' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.99' } [lints] workspace = true diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 0a7060a0beb..b9c88bd1b6f 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -32,8 +32,8 @@ serde_derive = "1.0" serde_json = "1.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = "0.23" -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.98" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.99" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index 34c45c7330e..b8d534c9658 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -188,7 +188,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_f3433bf7bc73881c() { return handleError(function (arg0, arg1) { +export function __wbg_new_17f755666e48d1d8() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return ret; }, arguments) }; diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 95a7640d7a0..e145ee3fa58 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 35581f2123b..3f35dfc300f 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.48" +version = "0.4.49" [package.metadata.docs.rs] all-features = true @@ -19,9 +19,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '=0.3.75', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.76', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '=0.2.98', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.99', default-features = false } [features] default = ["std"] @@ -29,7 +29,7 @@ futures-core-03-stream = ['futures-core'] std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] [target.'cfg(target_feature = "atomics")'.dependencies] -web-sys = { path = "../web-sys", version = "=0.3.75", default-features = false, features = [ +web-sys = { path = "../web-sys", version = "=0.3.76", default-features = false, features = [ "MessageEvent", "Worker", ] } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index b14fa718328..9fdb05f6c8f 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,7 +14,7 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.75" +version = "0.3.76" [lib] doctest = false @@ -26,7 +26,7 @@ std = ["wasm-bindgen/std"] [dependencies] once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.98", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.99", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 736e1c059e2..be26e0ea989 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.98" +version = "0.2.99" [features] default = ["std"] @@ -24,8 +24,8 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.98", default-features = false } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.98" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.99", default-features = false } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } [lints] workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 34c5e97cd89..94ea6e92318 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.98" +version = "0.2.99" [lib] proc-macro = true @@ -25,7 +25,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.98", default-features = false } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.99", default-features = false } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index e9227713bd1..8ff477f071d 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index ec89a76506f..d69ef902539 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.98" +version = "0.2.99" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index cee843079d0..c5d46f1bad1 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -6,7 +6,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.96"; +pub const SCHEMA_VERSION: &str = "0.2.98"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index fa086937c74..be50d273a1f 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "8234561557367848394"; +const APPROVED_SCHEMA_FILE_HASH: &str = "12659088193118507901"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 55b4ebcaafa..9912554d32d 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.48" +version = "0.3.49" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 7e15dbacea2..7303e635a54 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.48" +version = "0.3.49" [features] default = ["std"] @@ -15,11 +15,11 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '=0.3.75', default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.76', default-features = false } scoped-tls = { version = "1.0", optional = true } -wasm-bindgen = { path = '../..', version = '=0.2.98', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '=0.4.48', default-features = false } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.48' } +wasm-bindgen = { path = '../..', version = '=0.2.99', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.49', default-features = false } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.49' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index b0cbc872e26..3f3b5f374aa 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.98" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index cf20758df27..8eb8c2d44ed 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 9c39ddc0669..5bf7010e0f0 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.98" +version = "0.2.99" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.98" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.99" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 6d1e5efa03f..886467ca3ff 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.75" +version = "0.3.76" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '=0.3.75', default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.98", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.76', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.99", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3" From 6e098156fedf7bacdc0b085f64c69714fee266e9 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 7 Dec 2024 21:30:49 +0100 Subject: [PATCH 596/641] Fixed webidl output formatting on Windows (#4335) --- crates/web-sys/README.md | 3 --- crates/webidl/src/lib.rs | 23 +++++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md index 7693680c6fe..53753673564 100644 --- a/crates/web-sys/README.md +++ b/crates/web-sys/README.md @@ -32,9 +32,6 @@ If you don't see a particular web API in `web-sys`, here is how to add it. 2. Annotate the functions that can throw with `[Throws]` 3. `cd crates/web-sys` 4. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml` - - If formatting fails, you can run `cargo fmt` in the `crates/web-sys` directory. On Windows, you might also want to run `cargo fmt -- --config newline_style=Unix` depending on your git configuration. - 5. Run `git add .` to add all the generated files into git. 6. Add an entry in CHANGELOG.md like the following diff --git a/crates/webidl/src/lib.rs b/crates/webidl/src/lib.rs index a6caa7d5145..778b1f40d71 100644 --- a/crates/webidl/src/lib.rs +++ b/crates/webidl/src/lib.rs @@ -997,14 +997,21 @@ pub fn generate(from: &Path, to: &Path, options: Options) -> Result { fn rustfmt(paths: impl IntoIterator) -> Result<()> { // run rustfmt on the generated file - really handy for debugging - let result = Command::new("rustfmt") - .arg("--edition") - .arg("2021") - .args(paths) - .status() - .context("rustfmt failed")?; - - assert!(result.success(), "rustfmt failed"); + + // On Windows, the command line length is limited to 32k characters, so + // we need to split the command into multiple invocations. I've + // arbitrarily chosen to format 400 files at a time, because it works. + let paths: Vec<_> = paths.into_iter().collect(); + for chunk in paths.chunks(400) { + let result = Command::new("rustfmt") + .arg("--edition") + .arg("2021") + .args(chunk) + .status() + .context("rustfmt failed")?; + + assert!(result.success(), "rustfmt failed"); + } Ok(()) } From 720b9fe6315a7783c999375e0f7714ebd55a0b40 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 7 Dec 2024 21:44:39 +0100 Subject: [PATCH 597/641] Make API for exporting JS content more explicit (#4333) --- crates/cli-support/src/js/mod.rs | 76 ++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 27 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index e26f7a6d2ca..9cdd2d7ddb0 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -120,6 +120,18 @@ struct FieldAccessor { is_optional: bool, } +/// Different JS constructs that can be exported. +enum ExportJs<'a> { + /// A class of the form `class Name {...}`. + Class(&'a str), + /// An anonymous function expression of the form `function(...) {...}`. + /// + /// Note that the function name is not included in the string. + Function(&'a str), + /// An arbitrary JS expression. + Expression(&'a str), +} + const INITIAL_HEAP_VALUES: &[&str] = &["undefined", "null", "true", "false"]; // Must be kept in sync with `src/lib.rs` of the `wasm-bindgen` crate const INITIAL_HEAP_OFFSET: usize = 128; @@ -163,38 +175,46 @@ impl<'a> Context<'a> { fn export( &mut self, export_name: &str, - contents: &str, + export: ExportJs, comments: Option<&str>, ) -> Result<(), Error> { let definition_name = self.generate_identifier(export_name); - if contents.starts_with("class") && definition_name != export_name { + if matches!(export, ExportJs::Class(_)) && definition_name != export_name { bail!("cannot shadow already defined class `{}`", export_name); } - let contents = contents.trim(); + // write out comments if let Some(c) = comments { self.globals.push_str(c); } + let global = match self.config.mode { - OutputMode::Node { module: false } => { - if contents.starts_with("class") { - format!("{}\nmodule.exports.{1} = {1};\n", contents, export_name) - } else { - format!("module.exports.{} = {};\n", export_name, contents) + OutputMode::Node { module: false } => match export { + ExportJs::Class(class) => { + format!("{}\nmodule.exports.{1} = {1};\n", class, export_name) } - } - OutputMode::NoModules { .. } => { - if contents.starts_with("class") { - format!("{}\n__exports.{1} = {1};\n", contents, export_name) - } else { - format!("__exports.{} = {};\n", export_name, contents) + ExportJs::Function(expr) | ExportJs::Expression(expr) => { + format!("module.exports.{} = {};\n", export_name, expr) } - } + }, + OutputMode::NoModules { .. } => match export { + ExportJs::Class(class) => { + format!("{}\n__exports.{1} = {1};\n", class, export_name) + } + ExportJs::Function(expr) | ExportJs::Expression(expr) => { + format!("__exports.{} = {};\n", export_name, expr) + } + }, OutputMode::Bundler { .. } | OutputMode::Node { module: true } | OutputMode::Web - | OutputMode::Deno => { - if let Some(body) = contents.strip_prefix("function") { + | OutputMode::Deno => match export { + ExportJs::Class(class) => { + assert_eq!(export_name, definition_name); + format!("export {}\n", class) + } + ExportJs::Function(function) => { + let body = function.strip_prefix("function").unwrap(); if export_name == definition_name { format!("export function {}{}\n", export_name, body) } else { @@ -203,14 +223,12 @@ impl<'a> Context<'a> { definition_name, body, definition_name, export_name, ) } - } else if contents.starts_with("class") { - assert_eq!(export_name, definition_name); - format!("export {}\n", contents) - } else { + } + ExportJs::Expression(expr) => { assert_eq!(export_name, definition_name); - format!("export const {} = {};\n", export_name, contents) + format!("export const {} = {};\n", export_name, expr) } - } + }, }; self.global(&global); Ok(()) @@ -1169,10 +1187,10 @@ __wbg_set_wasm(wasm);" self.write_class_field_types(class, &mut ts_dst); - dst.push_str("}\n"); + dst.push('}'); ts_dst.push_str("}\n"); - self.export(name, &dst, Some(&class.comments))?; + self.export(name, ExportJs::Class(&dst), Some(&class.comments))?; if class.generate_typescript { self.typescript.push_str(&class.comments); @@ -2872,7 +2890,11 @@ __wbg_set_wasm(wasm);" self.typescript.push_str(";\n"); } - self.export(name, &format!("function{}", code), Some(&js_docs))?; + self.export( + name, + ExportJs::Function(&format!("function{}", code)), + Some(&js_docs), + )?; self.globals.push('\n'); } AuxExportKind::Constructor(class) => { @@ -3995,7 +4017,7 @@ __wbg_set_wasm(wasm);" self.export( &enum_.name, - &format!("Object.freeze({{\n{}}})", variants), + ExportJs::Expression(&format!("Object.freeze({{\n{}}})", variants)), Some(&docs), )?; From f93111212e1b13f903d5d3114f219897fe87644e Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 7 Dec 2024 22:20:27 +0100 Subject: [PATCH 598/641] Add `null` to argument types of optional parameters (#4188) --- CHANGELOG.md | 9 +++ crates/cli-support/src/js/binding.rs | 43 ++++++++--- crates/cli/tests/reference/echo.d.ts | 72 +++++++++---------- crates/cli/tests/reference/echo.js | 72 +++++++++---------- crates/cli/tests/reference/enums.d.ts | 6 +- crates/cli/tests/reference/enums.js | 6 +- crates/cli/tests/reference/getter-setter.d.ts | 13 ++-- crates/cli/tests/reference/getter-setter.js | 10 +-- crates/cli/tests/reference/int128.d.ts | 4 +- crates/cli/tests/reference/int128.js | 4 +- crates/cli/tests/reference/optional-args.d.ts | 4 ++ crates/cli/tests/reference/optional-args.js | 38 ++++++++++ crates/cli/tests/reference/optional-args.rs | 7 ++ crates/cli/tests/reference/optional-args.wat | 17 +++++ .../typescript-tests/src/optional_fields.ts | 9 ++- 15 files changed, 211 insertions(+), 103 deletions(-) create mode 100644 crates/cli/tests/reference/optional-args.d.ts create mode 100644 crates/cli/tests/reference/optional-args.js create mode 100644 crates/cli/tests/reference/optional-args.rs create mode 100644 crates/cli/tests/reference/optional-args.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index 32405a47e32..3402f7ae975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- +## Unreleased + +### Changed + +* Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. + [#4188](https://github.com/rustwasm/wasm-bindgen/pull/4188) + +-------------------------------------------------------------------------------- + ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) Released 2024-12-07 diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 54be1481163..637c3a5edf7 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -321,13 +321,15 @@ impl<'a, 'b> Builder<'a, 'b> { let mut ts = String::new(); match ty { AdapterType::Option(ty) if omittable => { + // e.g. `foo?: string | null` arg.push_str("?: "); - adapter2ts(ty, &mut ts, Some(&mut ts_refs)); + adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); + ts.push_str(" | null"); } ty => { omittable = false; arg.push_str(": "); - adapter2ts(ty, &mut ts, Some(&mut ts_refs)); + adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); } } arg.push_str(&ts); @@ -363,7 +365,12 @@ impl<'a, 'b> Builder<'a, 'b> { let mut ret = String::new(); match result_tys.len() { 0 => ret.push_str("void"), - 1 => adapter2ts(&result_tys[0], &mut ret, Some(&mut ts_refs)), + 1 => adapter2ts( + &result_tys[0], + TypePosition::Return, + &mut ret, + Some(&mut ts_refs), + ), _ => ret.push_str("[any]"), } if asyncness { @@ -395,16 +402,18 @@ impl<'a, 'b> Builder<'a, 'b> { for (name, ty) in fn_arg_names.iter().zip(arg_tys).rev() { let mut arg = "@param {".to_string(); - adapter2ts(ty, &mut arg, None); - arg.push_str("} "); match ty { - AdapterType::Option(..) if omittable => { + AdapterType::Option(ty) if omittable => { + adapter2ts(ty, TypePosition::Argument, &mut arg, None); + arg.push_str(" | null} "); arg.push('['); arg.push_str(name); arg.push(']'); } _ => { omittable = false; + adapter2ts(ty, TypePosition::Argument, &mut arg, None); + arg.push_str("} "); arg.push_str(name); } } @@ -416,7 +425,7 @@ impl<'a, 'b> Builder<'a, 'b> { if let (Some(name), Some(ty)) = (variadic_arg, arg_tys.last()) { ret.push_str("@param {..."); - adapter2ts(ty, &mut ret, None); + adapter2ts(ty, TypePosition::Argument, &mut ret, None); ret.push_str("} "); ret.push_str(name); ret.push('\n'); @@ -1542,7 +1551,18 @@ impl Invocation { } } -fn adapter2ts(ty: &AdapterType, dst: &mut String, refs: Option<&mut HashSet>) { +#[derive(Debug, Clone, Copy)] +enum TypePosition { + Argument, + Return, +} + +fn adapter2ts( + ty: &AdapterType, + position: TypePosition, + dst: &mut String, + refs: Option<&mut HashSet>, +) { match ty { AdapterType::I32 | AdapterType::S8 @@ -1564,8 +1584,11 @@ fn adapter2ts(ty: &AdapterType, dst: &mut String, refs: Option<&mut HashSet dst.push_str("boolean"), AdapterType::Vector(kind) => dst.push_str(&kind.js_ty()), AdapterType::Option(ty) => { - adapter2ts(ty, dst, refs); - dst.push_str(" | undefined"); + adapter2ts(ty, position, dst, refs); + dst.push_str(match position { + TypePosition::Argument => " | null | undefined", + TypePosition::Return => " | undefined", + }); } AdapterType::NamedExternref(name) => dst.push_str(name), AdapterType::Struct(name) => dst.push_str(name), diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts index c318f636c11..61fd4a7925e 100644 --- a/crates/cli/tests/reference/echo.d.ts +++ b/crates/cli/tests/reference/echo.d.ts @@ -36,42 +36,42 @@ export function echo_vec_uninit_i64(a: BigInt64Array): BigInt64Array; export function echo_vec_string(a: (string)[]): (string)[]; export function echo_struct(a: Foo): Foo; export function echo_vec_struct(a: (Foo)[]): (Foo)[]; -export function echo_option_u8(a?: number): number | undefined; -export function echo_option_i8(a?: number): number | undefined; -export function echo_option_u16(a?: number): number | undefined; -export function echo_option_i16(a?: number): number | undefined; -export function echo_option_u32(a?: number): number | undefined; -export function echo_option_i32(a?: number): number | undefined; -export function echo_option_u64(a?: bigint): bigint | undefined; -export function echo_option_i64(a?: bigint): bigint | undefined; -export function echo_option_u128(a?: bigint): bigint | undefined; -export function echo_option_i128(a?: bigint): bigint | undefined; -export function echo_option_usize(a?: number): number | undefined; -export function echo_option_isize(a?: number): number | undefined; -export function echo_option_f32(a?: number): number | undefined; -export function echo_option_f64(a?: number): number | undefined; -export function echo_option_bool(a?: boolean): boolean | undefined; -export function echo_option_char(a?: string): string | undefined; -export function echo_option_string(a?: string): string | undefined; -export function echo_option_vec_u8(a?: Uint8Array): Uint8Array | undefined; -export function echo_option_vec_i8(a?: Int8Array): Int8Array | undefined; -export function echo_option_vec_u16(a?: Uint16Array): Uint16Array | undefined; -export function echo_option_vec_i16(a?: Int16Array): Int16Array | undefined; -export function echo_option_vec_u32(a?: Uint32Array): Uint32Array | undefined; -export function echo_option_vec_i32(a?: Int32Array): Int32Array | undefined; -export function echo_option_vec_u64(a?: BigUint64Array): BigUint64Array | undefined; -export function echo_option_vec_i64(a?: BigInt64Array): BigInt64Array | undefined; -export function echo_option_vec_uninit_u8(a?: Uint8Array): Uint8Array | undefined; -export function echo_option_vec_uninit_i8(a?: Int8Array): Int8Array | undefined; -export function echo_option_vec_uninit_u16(a?: Uint16Array): Uint16Array | undefined; -export function echo_option_vec_uninit_i16(a?: Int16Array): Int16Array | undefined; -export function echo_option_vec_uninit_u32(a?: Uint32Array): Uint32Array | undefined; -export function echo_option_vec_uninit_i32(a?: Int32Array): Int32Array | undefined; -export function echo_option_vec_uninit_u64(a?: BigUint64Array): BigUint64Array | undefined; -export function echo_option_vec_uninit_i64(a?: BigInt64Array): BigInt64Array | undefined; -export function echo_option_vec_string(a?: (string)[]): (string)[] | undefined; -export function echo_option_struct(a?: Foo): Foo | undefined; -export function echo_option_vec_struct(a?: (Foo)[]): (Foo)[] | undefined; +export function echo_option_u8(a?: number | null): number | undefined; +export function echo_option_i8(a?: number | null): number | undefined; +export function echo_option_u16(a?: number | null): number | undefined; +export function echo_option_i16(a?: number | null): number | undefined; +export function echo_option_u32(a?: number | null): number | undefined; +export function echo_option_i32(a?: number | null): number | undefined; +export function echo_option_u64(a?: bigint | null): bigint | undefined; +export function echo_option_i64(a?: bigint | null): bigint | undefined; +export function echo_option_u128(a?: bigint | null): bigint | undefined; +export function echo_option_i128(a?: bigint | null): bigint | undefined; +export function echo_option_usize(a?: number | null): number | undefined; +export function echo_option_isize(a?: number | null): number | undefined; +export function echo_option_f32(a?: number | null): number | undefined; +export function echo_option_f64(a?: number | null): number | undefined; +export function echo_option_bool(a?: boolean | null): boolean | undefined; +export function echo_option_char(a?: string | null): string | undefined; +export function echo_option_string(a?: string | null): string | undefined; +export function echo_option_vec_u8(a?: Uint8Array | null): Uint8Array | undefined; +export function echo_option_vec_i8(a?: Int8Array | null): Int8Array | undefined; +export function echo_option_vec_u16(a?: Uint16Array | null): Uint16Array | undefined; +export function echo_option_vec_i16(a?: Int16Array | null): Int16Array | undefined; +export function echo_option_vec_u32(a?: Uint32Array | null): Uint32Array | undefined; +export function echo_option_vec_i32(a?: Int32Array | null): Int32Array | undefined; +export function echo_option_vec_u64(a?: BigUint64Array | null): BigUint64Array | undefined; +export function echo_option_vec_i64(a?: BigInt64Array | null): BigInt64Array | undefined; +export function echo_option_vec_uninit_u8(a?: Uint8Array | null): Uint8Array | undefined; +export function echo_option_vec_uninit_i8(a?: Int8Array | null): Int8Array | undefined; +export function echo_option_vec_uninit_u16(a?: Uint16Array | null): Uint16Array | undefined; +export function echo_option_vec_uninit_i16(a?: Int16Array | null): Int16Array | undefined; +export function echo_option_vec_uninit_u32(a?: Uint32Array | null): Uint32Array | undefined; +export function echo_option_vec_uninit_i32(a?: Int32Array | null): Int32Array | undefined; +export function echo_option_vec_uninit_u64(a?: BigUint64Array | null): BigUint64Array | undefined; +export function echo_option_vec_uninit_i64(a?: BigInt64Array | null): BigInt64Array | undefined; +export function echo_option_vec_string(a?: (string)[] | null): (string)[] | undefined; +export function echo_option_struct(a?: Foo | null): Foo | undefined; +export function echo_option_vec_struct(a?: (Foo)[] | null): (Foo)[] | undefined; export class Foo { private constructor(); free(): void; diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js index 1809b0e8618..c3e9c47f835 100644 --- a/crates/cli/tests/reference/echo.js +++ b/crates/cli/tests/reference/echo.js @@ -727,7 +727,7 @@ export function echo_vec_struct(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_u8(a) { @@ -736,7 +736,7 @@ export function echo_option_u8(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_i8(a) { @@ -745,7 +745,7 @@ export function echo_option_i8(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_u16(a) { @@ -754,7 +754,7 @@ export function echo_option_u16(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_i16(a) { @@ -763,7 +763,7 @@ export function echo_option_i16(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_u32(a) { @@ -772,7 +772,7 @@ export function echo_option_u32(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_i32(a) { @@ -781,7 +781,7 @@ export function echo_option_i32(a) { } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_u64(a) { @@ -790,7 +790,7 @@ export function echo_option_u64(a) { } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_i64(a) { @@ -799,7 +799,7 @@ export function echo_option_i64(a) { } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_u128(a) { @@ -808,7 +808,7 @@ export function echo_option_u128(a) { } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_i128(a) { @@ -817,7 +817,7 @@ export function echo_option_i128(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_usize(a) { @@ -826,7 +826,7 @@ export function echo_option_usize(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_isize(a) { @@ -835,7 +835,7 @@ export function echo_option_isize(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_f32(a) { @@ -844,7 +844,7 @@ export function echo_option_f32(a) { } /** - * @param {number | undefined} [a] + * @param {number | null} [a] * @returns {number | undefined} */ export function echo_option_f64(a) { @@ -853,7 +853,7 @@ export function echo_option_f64(a) { } /** - * @param {boolean | undefined} [a] + * @param {boolean | null} [a] * @returns {boolean | undefined} */ export function echo_option_bool(a) { @@ -862,7 +862,7 @@ export function echo_option_bool(a) { } /** - * @param {string | undefined} [a] + * @param {string | null} [a] * @returns {string | undefined} */ export function echo_option_char(a) { @@ -873,7 +873,7 @@ export function echo_option_char(a) { } /** - * @param {string | undefined} [a] + * @param {string | null} [a] * @returns {string | undefined} */ export function echo_option_string(a) { @@ -889,7 +889,7 @@ export function echo_option_string(a) { } /** - * @param {Uint8Array | undefined} [a] + * @param {Uint8Array | null} [a] * @returns {Uint8Array | undefined} */ export function echo_option_vec_u8(a) { @@ -905,7 +905,7 @@ export function echo_option_vec_u8(a) { } /** - * @param {Int8Array | undefined} [a] + * @param {Int8Array | null} [a] * @returns {Int8Array | undefined} */ export function echo_option_vec_i8(a) { @@ -921,7 +921,7 @@ export function echo_option_vec_i8(a) { } /** - * @param {Uint16Array | undefined} [a] + * @param {Uint16Array | null} [a] * @returns {Uint16Array | undefined} */ export function echo_option_vec_u16(a) { @@ -937,7 +937,7 @@ export function echo_option_vec_u16(a) { } /** - * @param {Int16Array | undefined} [a] + * @param {Int16Array | null} [a] * @returns {Int16Array | undefined} */ export function echo_option_vec_i16(a) { @@ -953,7 +953,7 @@ export function echo_option_vec_i16(a) { } /** - * @param {Uint32Array | undefined} [a] + * @param {Uint32Array | null} [a] * @returns {Uint32Array | undefined} */ export function echo_option_vec_u32(a) { @@ -969,7 +969,7 @@ export function echo_option_vec_u32(a) { } /** - * @param {Int32Array | undefined} [a] + * @param {Int32Array | null} [a] * @returns {Int32Array | undefined} */ export function echo_option_vec_i32(a) { @@ -985,7 +985,7 @@ export function echo_option_vec_i32(a) { } /** - * @param {BigUint64Array | undefined} [a] + * @param {BigUint64Array | null} [a] * @returns {BigUint64Array | undefined} */ export function echo_option_vec_u64(a) { @@ -1001,7 +1001,7 @@ export function echo_option_vec_u64(a) { } /** - * @param {BigInt64Array | undefined} [a] + * @param {BigInt64Array | null} [a] * @returns {BigInt64Array | undefined} */ export function echo_option_vec_i64(a) { @@ -1017,7 +1017,7 @@ export function echo_option_vec_i64(a) { } /** - * @param {Uint8Array | undefined} [a] + * @param {Uint8Array | null} [a] * @returns {Uint8Array | undefined} */ export function echo_option_vec_uninit_u8(a) { @@ -1033,7 +1033,7 @@ export function echo_option_vec_uninit_u8(a) { } /** - * @param {Int8Array | undefined} [a] + * @param {Int8Array | null} [a] * @returns {Int8Array | undefined} */ export function echo_option_vec_uninit_i8(a) { @@ -1049,7 +1049,7 @@ export function echo_option_vec_uninit_i8(a) { } /** - * @param {Uint16Array | undefined} [a] + * @param {Uint16Array | null} [a] * @returns {Uint16Array | undefined} */ export function echo_option_vec_uninit_u16(a) { @@ -1065,7 +1065,7 @@ export function echo_option_vec_uninit_u16(a) { } /** - * @param {Int16Array | undefined} [a] + * @param {Int16Array | null} [a] * @returns {Int16Array | undefined} */ export function echo_option_vec_uninit_i16(a) { @@ -1081,7 +1081,7 @@ export function echo_option_vec_uninit_i16(a) { } /** - * @param {Uint32Array | undefined} [a] + * @param {Uint32Array | null} [a] * @returns {Uint32Array | undefined} */ export function echo_option_vec_uninit_u32(a) { @@ -1097,7 +1097,7 @@ export function echo_option_vec_uninit_u32(a) { } /** - * @param {Int32Array | undefined} [a] + * @param {Int32Array | null} [a] * @returns {Int32Array | undefined} */ export function echo_option_vec_uninit_i32(a) { @@ -1113,7 +1113,7 @@ export function echo_option_vec_uninit_i32(a) { } /** - * @param {BigUint64Array | undefined} [a] + * @param {BigUint64Array | null} [a] * @returns {BigUint64Array | undefined} */ export function echo_option_vec_uninit_u64(a) { @@ -1129,7 +1129,7 @@ export function echo_option_vec_uninit_u64(a) { } /** - * @param {BigInt64Array | undefined} [a] + * @param {BigInt64Array | null} [a] * @returns {BigInt64Array | undefined} */ export function echo_option_vec_uninit_i64(a) { @@ -1145,7 +1145,7 @@ export function echo_option_vec_uninit_i64(a) { } /** - * @param {(string)[] | undefined} [a] + * @param {(string)[] | null} [a] * @returns {(string)[] | undefined} */ export function echo_option_vec_string(a) { @@ -1161,7 +1161,7 @@ export function echo_option_vec_string(a) { } /** - * @param {Foo | undefined} [a] + * @param {Foo | null} [a] * @returns {Foo | undefined} */ export function echo_option_struct(a) { @@ -1175,7 +1175,7 @@ export function echo_option_struct(a) { } /** - * @param {(Foo)[] | undefined} [a] + * @param {(Foo)[] | null} [a] * @returns {(Foo)[] | undefined} */ export function echo_option_vec_struct(a) { diff --git a/crates/cli/tests/reference/enums.d.ts b/crates/cli/tests/reference/enums.d.ts index da84bbb7740..8d1b955c1f9 100644 --- a/crates/cli/tests/reference/enums.d.ts +++ b/crates/cli/tests/reference/enums.d.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ export function enum_echo(color: Color): Color; -export function option_enum_echo(color?: Color): Color | undefined; +export function option_enum_echo(color?: Color | null): Color | undefined; export function get_name(color: Color): ColorName; -export function option_string_enum_echo(color?: ColorName): ColorName | undefined; -export function option_order(order?: Ordering): Ordering | undefined; +export function option_string_enum_echo(color?: ColorName | null): ColorName | undefined; +export function option_order(order?: Ordering | null): Ordering | undefined; /** * A color. */ diff --git a/crates/cli/tests/reference/enums.js b/crates/cli/tests/reference/enums.js index 13459b9c77e..10d698dc7e5 100644 --- a/crates/cli/tests/reference/enums.js +++ b/crates/cli/tests/reference/enums.js @@ -36,7 +36,7 @@ function isLikeNone(x) { return x === undefined || x === null; } /** - * @param {Color | undefined} [color] + * @param {Color | null} [color] * @returns {Color | undefined} */ export function option_enum_echo(color) { @@ -54,7 +54,7 @@ export function get_name(color) { } /** - * @param {ColorName | undefined} [color] + * @param {ColorName | null} [color] * @returns {ColorName | undefined} */ export function option_string_enum_echo(color) { @@ -63,7 +63,7 @@ export function option_string_enum_echo(color) { } /** - * @param {Ordering | undefined} [order] + * @param {Ordering | null} [order] * @returns {Ordering | undefined} */ export function option_order(order) { diff --git a/crates/cli/tests/reference/getter-setter.d.ts b/crates/cli/tests/reference/getter-setter.d.ts index 8222ca2a462..789fb0f279f 100644 --- a/crates/cli/tests/reference/getter-setter.d.ts +++ b/crates/cli/tests/reference/getter-setter.d.ts @@ -4,10 +4,12 @@ export class Foo { private constructor(); free(): void; x: number; - y?: number; - z?: number; + get y(): number | undefined; + set y(value: number | null | undefined); + get z(): number | undefined; + set z(value: number | null | undefined); readonly lone_getter: number | undefined; - set lone_setter(value: number | undefined); + set lone_setter(value: number | null | undefined); /** * You will only read numbers. */ @@ -17,10 +19,11 @@ export class Foo { * * Yes, this is totally fine in JS. */ - set weird(value: string | undefined); + set weird(value: string | null | undefined); /** * There can be static getters and setters too, and they can even have the * same name as instance getters and setters. */ - static x?: boolean; + static get x(): boolean | undefined; + static set x(value: boolean | null | undefined); } diff --git a/crates/cli/tests/reference/getter-setter.js b/crates/cli/tests/reference/getter-setter.js index fc0ce4820dd..a9df5536a5b 100644 --- a/crates/cli/tests/reference/getter-setter.js +++ b/crates/cli/tests/reference/getter-setter.js @@ -124,7 +124,7 @@ export class Foo { return ret === 0x100000001 ? undefined : ret; } /** - * @param {number | undefined} [arg0] + * @param {number | null} [arg0] */ set y(arg0) { wasm.__wbg_set_foo_y(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : (arg0) >>> 0); @@ -137,7 +137,7 @@ export class Foo { return ret === 0x100000001 ? undefined : ret; } /** - * @param {number | undefined} [z] + * @param {number | null} [z] */ set z(z) { wasm.foo_set_z(this.__wbg_ptr, isLikeNone(z) ? 0x100000001 : (z) >>> 0); @@ -150,7 +150,7 @@ export class Foo { return ret === 0x100000001 ? undefined : ret; } /** - * @param {number | undefined} [value] + * @param {number | null} [value] */ set lone_setter(value) { wasm.foo_set_lone_setter(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0); @@ -167,7 +167,7 @@ export class Foo { * But you must write strings. * * Yes, this is totally fine in JS. - * @param {string | undefined} [value] + * @param {string | null} [value] */ set weird(value) { var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); @@ -184,7 +184,7 @@ export class Foo { return ret === 0xFFFFFF ? undefined : ret !== 0; } /** - * @param {boolean | undefined} [value] + * @param {boolean | null} [value] */ static set x(value) { wasm.foo_set_x_static(isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0); diff --git a/crates/cli/tests/reference/int128.d.ts b/crates/cli/tests/reference/int128.d.ts index 183cef4758a..ff5bfb22910 100644 --- a/crates/cli/tests/reference/int128.d.ts +++ b/crates/cli/tests/reference/int128.d.ts @@ -2,6 +2,6 @@ /* eslint-disable */ export function echo_i128(a: bigint): bigint; export function echo_u128(a: bigint): bigint; -export function echo_option_i128(a?: bigint): bigint | undefined; -export function echo_option_u128(a?: bigint): bigint | undefined; +export function echo_option_i128(a?: bigint | null): bigint | undefined; +export function echo_option_u128(a?: bigint | null): bigint | undefined; export function throw_i128(): bigint; diff --git a/crates/cli/tests/reference/int128.js b/crates/cli/tests/reference/int128.js index 1df6bb28c26..32de778621c 100644 --- a/crates/cli/tests/reference/int128.js +++ b/crates/cli/tests/reference/int128.js @@ -45,7 +45,7 @@ function isLikeNone(x) { return x === undefined || x === null; } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_i128(a) { @@ -54,7 +54,7 @@ export function echo_option_i128(a) { } /** - * @param {bigint | undefined} [a] + * @param {bigint | null} [a] * @returns {bigint | undefined} */ export function echo_option_u128(a) { diff --git a/crates/cli/tests/reference/optional-args.d.ts b/crates/cli/tests/reference/optional-args.d.ts new file mode 100644 index 00000000000..4f156949356 --- /dev/null +++ b/crates/cli/tests/reference/optional-args.d.ts @@ -0,0 +1,4 @@ +/* tslint:disable */ +/* eslint-disable */ +export function all_optional(a?: number | null, b?: number | null, c?: number | null): void; +export function some_optional(a: number | null | undefined, b: number, c?: number | null): void; diff --git a/crates/cli/tests/reference/optional-args.js b/crates/cli/tests/reference/optional-args.js new file mode 100644 index 00000000000..43ead5d86c1 --- /dev/null +++ b/crates/cli/tests/reference/optional-args.js @@ -0,0 +1,38 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +function isLikeNone(x) { + return x === undefined || x === null; +} +/** + * @param {number | null} [a] + * @param {number | null} [b] + * @param {number | null} [c] + */ +export function all_optional(a, b, c) { + wasm.all_optional(isLikeNone(a) ? 0x100000001 : (a) >>> 0, isLikeNone(b) ? 0x100000001 : (b) >>> 0, isLikeNone(c) ? 0x100000001 : (c) >>> 0); +} + +/** + * @param {number | null | undefined} a + * @param {number} b + * @param {number | null} [c] + */ +export function some_optional(a, b, c) { + wasm.some_optional(isLikeNone(a) ? 0x100000001 : (a) >>> 0, b, isLikeNone(c) ? 0x100000001 : (c) >>> 0); +} + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + diff --git a/crates/cli/tests/reference/optional-args.rs b/crates/cli/tests/reference/optional-args.rs new file mode 100644 index 00000000000..bbc0fa81e39 --- /dev/null +++ b/crates/cli/tests/reference/optional-args.rs @@ -0,0 +1,7 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn all_optional(a: Option, b: Option, c: Option) {} + +#[wasm_bindgen] +pub fn some_optional(a: Option, b: u32, c: Option) {} diff --git a/crates/cli/tests/reference/optional-args.wat b/crates/cli/tests/reference/optional-args.wat new file mode 100644 index 00000000000..a0f6061efbe --- /dev/null +++ b/crates/cli/tests/reference/optional-args.wat @@ -0,0 +1,17 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param f64 i32 f64))) + (type (;2;) (func (param f64 f64 f64))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $all_optional (;1;) (type 2) (param f64 f64 f64)) + (func $some_optional (;2;) (type 1) (param f64 i32 f64)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "all_optional" (func $all_optional)) + (export "some_optional" (func $some_optional)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/typescript-tests/src/optional_fields.ts b/crates/typescript-tests/src/optional_fields.ts index 61e1fc05b1b..8d1cf90c64c 100644 --- a/crates/typescript-tests/src/optional_fields.ts +++ b/crates/typescript-tests/src/optional_fields.ts @@ -1,3 +1,10 @@ import * as wbg from '../pkg/typescript_tests'; -const fields: wbg.Fields = { spaceboy: true, free: () => { } }; +const fields: wbg.Fields = null as unknown as wbg.Fields; + +// optional fields read T | undefined +const _hallo: boolean | undefined = fields.hallo; + +// and allow writing T | null | undefined +fields.hallo = undefined; +fields.hallo = null; From c345cc8122ac1c4fffe2c396ffbd2330f797bfdf Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 7 Dec 2024 23:00:21 +0100 Subject: [PATCH 599/641] Added missing type annotation in docs (#4332) --- guide/src/reference/static-js-objects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/reference/static-js-objects.md b/guide/src/reference/static-js-objects.md index 92b699d57c6..c78dc3c261e 100644 --- a/guide/src/reference/static-js-objects.md +++ b/guide/src/reference/static-js-objects.md @@ -26,7 +26,7 @@ let COLORS = { #[wasm_bindgen] extern "C" { #[wasm_bindgen(thread_local_v2)] - static COLORS; + static COLORS: JsValue; } fn get_colors() -> JsValue { From 5b38cb1b714450150e5e38991d47bde06a3451e5 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sat, 7 Dec 2024 23:13:21 +0100 Subject: [PATCH 600/641] Use TypeScript to verify CLI reference output (#4311) --- .github/workflows/main.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5263ee206cb..6909d10dd08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup component add rustfmt - run: cargo fmt --all -- --check - + # Check TOML style by using Taplo. taplo: name: Taplo @@ -240,6 +240,22 @@ jobs: # WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 # - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features "Node Window Document" + # This checks that the output of the CLI is actually valid JavaScript and TypeScript + test_cli_reference_typescript: + name: Run CLI reference TypeScript check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - run: npm i -g typescript + - run: npm i --save @types/node @types/deno + - name: Check TypeScript output + run: tsc --noEmit --skipLibCheck --lib esnext,dom $(echo crates/cli/tests/reference/*.d.ts) + - name: Check JavaScript output + run: tsc --noEmit --skipLibCheck --lib esnext,dom --module esnext --allowJs $(echo crates/cli/tests/reference/*.js) + test_native: name: Run native tests runs-on: ubuntu-latest From afea96e83935eb44fea5b48b7b7db3f1bdb472af Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 8 Dec 2024 09:22:15 +0100 Subject: [PATCH 601/641] Fix enabling the same unstable feature twice (#4338) --- src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 73a6147773f..b4e5a6a9b1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,14 +6,17 @@ //! interface. #![no_std] +#![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] #![cfg_attr( - wasm_bindgen_unstable_test_coverage, - feature(coverage_attribute, allow_internal_unstable), - allow(internal_features) + all(not(feature = "std"), target_feature = "atomics"), + feature(thread_local) )] #![cfg_attr( - all(not(feature = "std"), target_feature = "atomics"), - feature(thread_local, allow_internal_unstable), + any( + all(not(feature = "std"), target_feature = "atomics"), + wasm_bindgen_unstable_test_coverage + ), + feature(allow_internal_unstable), allow(internal_features) )] #![allow(coherence_leak_check)] From 54f97c967b194446438a4ea1e899dfd9d2e72cf9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 8 Dec 2024 09:35:37 +0100 Subject: [PATCH 602/641] Limit scope of `allow(coherence_leak_check)` (#4339) --- src/closure.rs | 2 ++ src/convert/closures.rs | 12 ++++++++---- src/lib.rs | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/closure.rs b/src/closure.rs index 95cf2250a89..d5107c34ec9 100644 --- a/src/closure.rs +++ b/src/closure.rs @@ -561,6 +561,7 @@ macro_rules! doit { ($( ($($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*) )*) => ($( + #[allow(coherence_leak_check)] unsafe impl<$($var,)* R> WasmClosure for dyn Fn($($var),*) -> R + 'static where $($var: FromWasmAbi + 'static,)* R: ReturnWasmAbi + 'static, @@ -620,6 +621,7 @@ macro_rules! doit { } } + #[allow(coherence_leak_check)] unsafe impl<$($var,)* R> WasmClosure for dyn FnMut($($var),*) -> R + 'static where $($var: FromWasmAbi + 'static,)* R: ReturnWasmAbi + 'static, diff --git a/src/convert/closures.rs b/src/convert/closures.rs index 1f45f90f58b..536ca686d0a 100644 --- a/src/convert/closures.rs +++ b/src/convert/closures.rs @@ -10,7 +10,8 @@ use crate::throw_str; macro_rules! stack_closures { ($( ($cnt:tt $invoke:ident $invoke_mut:ident $($var:ident $arg1:ident $arg2:ident $arg3:ident $arg4:ident)*) )*) => ($( - impl<'a, 'b, $($var,)* R> IntoWasmAbi for &'a (dyn Fn($($var),*) -> R + 'b) + #[allow(coherence_leak_check)] + impl<$($var,)* R> IntoWasmAbi for &'_ (dyn Fn($($var),*) -> R + '_) where $($var: FromWasmAbi,)* R: ReturnWasmAbi { @@ -50,7 +51,8 @@ macro_rules! stack_closures { ret.return_abi().into() } - impl<'a, $($var,)* R> WasmDescribe for dyn Fn($($var),*) -> R + 'a + #[allow(coherence_leak_check)] + impl<$($var,)* R> WasmDescribe for dyn Fn($($var),*) -> R + '_ where $($var: FromWasmAbi,)* R: ReturnWasmAbi { @@ -65,7 +67,8 @@ macro_rules! stack_closures { } } - impl<'a, 'b, $($var,)* R> IntoWasmAbi for &'a mut (dyn FnMut($($var),*) -> R + 'b) + #[allow(coherence_leak_check)] + impl<$($var,)* R> IntoWasmAbi for &'_ mut (dyn FnMut($($var),*) -> R + '_) where $($var: FromWasmAbi,)* R: ReturnWasmAbi { @@ -105,7 +108,8 @@ macro_rules! stack_closures { ret.return_abi().into() } - impl<'a, $($var,)* R> WasmDescribe for dyn FnMut($($var),*) -> R + 'a + #[allow(coherence_leak_check)] + impl<$($var,)* R> WasmDescribe for dyn FnMut($($var),*) -> R + '_ where $($var: FromWasmAbi,)* R: ReturnWasmAbi { diff --git a/src/lib.rs b/src/lib.rs index b4e5a6a9b1f..3aac1273ae7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,6 @@ feature(allow_internal_unstable), allow(internal_features) )] -#![allow(coherence_leak_check)] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] extern crate alloc; From c60e8071a174489ac9b63ef40fa234f334034f85 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 8 Dec 2024 16:40:03 +0100 Subject: [PATCH 603/641] Add `copy_to_uninit()` to all `TypedArray`s (#4340) --- CHANGELOG.md | 5 +++++ crates/js-sys/src/lib.rs | 19 ++++++++++++++++++- crates/js-sys/tests/wasm/TypedArray.rs | 13 +++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3402f7ae975..afdbc73f5eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Unreleased +### Added + +* Add a `copy_to_uninit()` method to all `TypedArray`s. It takes `&mut [MaybeUninit]` and returns `&mut [T]`. + [#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340) + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index aa2f3a07b3b..e8588bdc24a 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -32,7 +32,7 @@ use core::convert::{self, Infallible, TryFrom}; use core::f64; use core::fmt; use core::iter::{self, Product, Sum}; -use core::mem; +use core::mem::{self, MaybeUninit}; use core::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub}; use core::str; use core::str::FromStr; @@ -6336,6 +6336,23 @@ macro_rules! arrays { unsafe { self.raw_copy_to_ptr(dst.as_mut_ptr()); } } + /// Copy the contents of this JS typed array into the destination + /// Rust slice. + /// + /// This function will efficiently copy the memory from a typed + /// array into this Wasm module's own linear memory, initializing + /// the memory destination provided. + /// + /// # Panics + /// + /// This function will panic if this typed array's length is + /// different than the length of the provided `dst` array. + pub fn copy_to_uninit<'dst>(&self, dst: &'dst mut [MaybeUninit<$ty>]) -> &'dst mut [$ty] { + core::assert_eq!(self.length() as usize, dst.len()); + unsafe { self.raw_copy_to_ptr(dst.as_mut_ptr().cast()); } + unsafe { &mut *(dst as *mut [MaybeUninit<$ty>] as *mut [$ty]) } + } + /// Copy the contents of the source Rust slice into this /// JS typed array. /// diff --git a/crates/js-sys/tests/wasm/TypedArray.rs b/crates/js-sys/tests/wasm/TypedArray.rs index 36459696d68..262021255ac 100644 --- a/crates/js-sys/tests/wasm/TypedArray.rs +++ b/crates/js-sys/tests/wasm/TypedArray.rs @@ -1,3 +1,5 @@ +use std::mem::MaybeUninit; + use js_sys::*; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; @@ -174,6 +176,17 @@ fn copy_to() { } } +#[wasm_bindgen_test] +fn copy_to_uninit() { + let mut x = [MaybeUninit::uninit(); 10]; + let array = Int32Array::new(&10.into()); + array.fill(5, 0, 10); + let x = array.copy_to_uninit(&mut x); + for i in x.iter() { + assert_eq!(*i, 5); + } +} + #[wasm_bindgen_test] fn copy_from() { let x = [1, 2, 3]; From 5f288bde87535146a87685d35c74235e5b320c5f Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 8 Dec 2024 20:24:36 +0100 Subject: [PATCH 604/641] Fix handling of JS keyword when causing invalid code gen (#4329) --- CHANGELOG.md | 12 ++ crates/cli/tests/reference/import.js | 21 ++ crates/cli/tests/reference/import.rs | 26 ++- crates/cli/tests/reference/keyword.d.ts | 6 + crates/cli/tests/reference/keyword.js | 91 ++++++++ crates/cli/tests/reference/keyword.rs | 57 +++++ crates/cli/tests/reference/keyword.wat | 20 ++ crates/macro-support/src/parser.rs | 228 +++++++++++++++----- crates/macro/ui-tests/import-keyword.rs | 68 ++++++ crates/macro/ui-tests/import-keyword.stderr | 59 +++++ 10 files changed, 536 insertions(+), 52 deletions(-) create mode 100644 crates/cli/tests/reference/keyword.d.ts create mode 100644 crates/cli/tests/reference/keyword.js create mode 100644 crates/cli/tests/reference/keyword.rs create mode 100644 crates/cli/tests/reference/keyword.wat create mode 100644 crates/macro/ui-tests/import-keyword.rs create mode 100644 crates/macro/ui-tests/import-keyword.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index afdbc73f5eb..17a86bbfdbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,18 @@ * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. [#4188](https://github.com/rustwasm/wasm-bindgen/pull/4188) +### Fixed + +- Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. + [#4329](https://github.com/rustwasm/wasm-bindgen/pull/4329) + + - Using JS keywords as `struct` and `enum` names will now error at compile time, instead of causing invalid JS code gen. + - Using JS keywords that are not valid to call or access properties on will now error at compile time, instead of causing invalid JS code gen if used as: + 1. The first part of a `js_namespace` on imports. + 2. The name of an imported type or constant if the type or constant does not have a `js_namespace` or `module` attribute. + 3. The name of an imported function if the function is not a method and does not have a `js_namespace` or `module` attribute. + - Using JS keywords on imports in places other than the above will no longer cause the keywords to be escaped as `_{keyword}`. + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli/tests/reference/import.js b/crates/cli/tests/reference/import.js index 321ae6901fd..5fd514c7295 100644 --- a/crates/cli/tests/reference/import.js +++ b/crates/cli/tests/reference/import.js @@ -1,3 +1,5 @@ +import { default as default1 } from 'tests/wasm/import_class.js'; + let wasm; export function __wbg_set_wasm(val) { wasm = val; @@ -65,6 +67,20 @@ export function __wbg_catchme_f7d87ea824a61e87() { return handleError(function ( catch_me(); }, arguments) }; +export function __wbg_get_56ba567010fb9959(arg0) { + const ret = arg0.get(); + return ret; +}; + +export function __wbg_myfunction_8c7b624429f78550() { + b.my_function(); +}; + +export function __wbg_new_d21827b66c7fd25d(arg0) { + const ret = new default1(arg0); + return ret; +}; + export function __wbg_nocatch_be850a8dddd9599d() { no_catch(); }; @@ -73,6 +89,11 @@ export function __wbg_reload_84c12f152ad689f0() { window.location.reload(); }; +export function __wbg_static_accessor_CONST_9e9d5ae758197645() { + const ret = a.CONST; + return ret; +}; + export function __wbg_write_c2ce0ce33a6087d5(arg0, arg1) { window.document.write(getStringFromWasm0(arg0, arg1)); }; diff --git a/crates/cli/tests/reference/import.rs b/crates/cli/tests/reference/import.rs index a7bea1953ed..1299f5eaf83 100644 --- a/crates/cli/tests/reference/import.rs +++ b/crates/cli/tests/reference/import.rs @@ -23,12 +23,36 @@ extern "C" { fn add(a: f64, b: f64) -> f64; } +#[wasm_bindgen(js_namespace = ["a"])] +extern "C" { + // test that namespaces are overwritten and not inherited/concatenated + #[wasm_bindgen(js_namespace = ["b"])] + fn my_function(); + #[wasm_bindgen(thread_local_v2)] + static CONST: f64; +} + +#[wasm_bindgen(module = "tests/wasm/import_class.js")] +extern "C" { + #[wasm_bindgen(js_name = default)] + type RenamedTypes; + #[wasm_bindgen(constructor, js_class = default)] + fn new(arg: i32) -> RenamedTypes; + #[wasm_bindgen(method, js_class = default)] + fn get(this: &RenamedTypes) -> i32; +} + #[wasm_bindgen] pub fn exported() -> Result<(), JsValue> { bar_from_foo(); - let _ = add(1.0, 2.0); + let _ = add(CONST.with(Clone::clone), 2.0); reload(); write(""); no_catch(); + my_function(); + + let f = RenamedTypes::new(1); + assert_eq!(f.get(), 2); + catch_me() } diff --git a/crates/cli/tests/reference/keyword.d.ts b/crates/cli/tests/reference/keyword.d.ts new file mode 100644 index 00000000000..4bc758e17b7 --- /dev/null +++ b/crates/cli/tests/reference/keyword.d.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +export function exported(): void; +export function _function(): void; +export function _var(): void; +export function weird_arguments(_new: number, _var: number, _switch: number, _default: number, _arguments: number): void; diff --git a/crates/cli/tests/reference/keyword.js b/crates/cli/tests/reference/keyword.js new file mode 100644 index 00000000000..bfda76214e4 --- /dev/null +++ b/crates/cli/tests/reference/keyword.js @@ -0,0 +1,91 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +export function exported() { + wasm.exported(); +} + +export function _function() { + wasm._function(); +} + +export function _var() { + wasm._var(); +} + +/** + * @param {number} _new + * @param {number} _var + * @param {number} _switch + * @param {number} _default + * @param {number} _arguments + */ +export function weird_arguments(_new, _var, _switch, _default, _arguments) { + wasm.weird_arguments(_new, _var, _switch, _default, _arguments); +} + +export function __wbg_await_e0a0e75be8b6fef6() { + await(); +}; + +export function __wbg_let_8d461e9e0592bd8c(arg0) { + arg0.let(); +}; + +export function __wbg_new_4b026aaf1c1e4438() { + const ret = A.new(); + return ret; +}; + +export function __wbg_new_d4bfd9add722b492() { + const ret = window.__TAURI__.menu.Menu.new(); + return ret; +}; + +export function __wbg_new_e17dd7c5a1cd57d8() { + B.new(); +}; + +export function __wbg_static_accessor_TRUE_c6b68bf8545d99a3() { + const ret = true; + return ret; +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/keyword.rs b/crates/cli/tests/reference/keyword.rs new file mode 100644 index 00000000000..ee1393b6ff2 --- /dev/null +++ b/crates/cli/tests/reference/keyword.rs @@ -0,0 +1,57 @@ +use wasm_bindgen::prelude::*; + +// Imports with keywords + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen] + pub type A; + + #[wasm_bindgen(static_method_of = A, js_name = "new")] + pub fn static_new() -> A; + #[wasm_bindgen(js_namespace = ["B"], js_name = "new")] + pub fn namespace_new(); + + #[wasm_bindgen(method, js_name = "let")] + pub fn keyword_let(ptr: &A); + + // await is not a reserved keyword in JS + pub fn r#await(); + + // true & false are reserved keywords in JS, but we allow them anyway + #[wasm_bindgen(thread_local_v2, js_name = "true")] + static TRUE: JsValue; +} + +// https://github.com/rustwasm/wasm-bindgen/issues/4317 +#[wasm_bindgen(js_namespace = ["window", "__TAURI__", "menu"])] +extern "C" { + #[wasm_bindgen] + pub type Menu; + + #[wasm_bindgen(static_method_of = Menu)] + pub fn new() -> Menu; +} + +// This function ensures the imported stuff isn't optimized out +#[wasm_bindgen] +pub fn exported() { + let a = A::static_new(); + let _ = a.keyword_let(); + let _ = namespace_new(); + let _ = r#await(); + std::hint::black_box(&TRUE); + + let _ = Menu::new(); +} + +// Exports with keywords that we allow and are renamed automatically. + +#[wasm_bindgen] +pub fn function() {} + +#[wasm_bindgen(js_name = "var")] +pub fn sane_name() {} + +#[wasm_bindgen] +pub fn weird_arguments(new: u32, var: u32, r#switch: u32, default: u32, arguments: u32) {} diff --git a/crates/cli/tests/reference/keyword.wat b/crates/cli/tests/reference/keyword.wat new file mode 100644 index 00000000000..41921ddfb93 --- /dev/null +++ b/crates/cli/tests/reference/keyword.wat @@ -0,0 +1,20 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (param i32 i32 i32 i32 i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $weird_arguments (;1;) (type 1) (param i32 i32 i32 i32 i32)) + (func $exported (;2;) (type 0)) + (func $_function (;3;) (type 0)) + (func $_var (;4;) (type 0)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "exported" (func $exported)) + (export "_function" (func $_function)) + (export "_var" (func $_var)) + (export "weird_arguments" (func $weird_arguments)) + (export "__wbindgen_export_0" (table 0)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 9d7ad85a00c..46c76a1ef21 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -19,29 +19,90 @@ use crate::ClassMarker; thread_local!(static ATTRS: AttributeParseState = Default::default()); -/// Javascript keywords which are not keywords in Rust. -const JS_KEYWORDS: [&str; 20] = [ - "class", +/// Javascript keywords. +/// +/// Note that some of these keywords are only reserved in strict mode. Since we +/// generate strict mode JS code, we treat all of these as reserved. +/// +/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words +const JS_KEYWORDS: [&str; 47] = [ + "arguments", + "break", "case", "catch", + "class", + "const", + "continue", "debugger", "default", "delete", + "do", + "else", + "enum", + "eval", "export", "extends", + "false", "finally", + "for", "function", + "if", + "implements", "import", + "in", "instanceof", + "interface", + "let", "new", "null", + "package", + "private", + "protected", + "public", + "return", + "static", + "super", "switch", "this", "throw", + "true", + "try", + "typeof", "var", "void", + "while", "with", + "yield", ]; + +/// Javascript keywords that behave like values in that they can be called like +/// functions or have properties accessed on them. +/// +/// Naturally, this list is a subset of `JS_KEYWORDS`. +const VALUE_LIKE_JS_KEYWORDS: [&str; 7] = [ + "eval", // eval is a function-like keyword, so e.g. `eval(...)` is valid + "false", // false resolves to a boolean value, so e.g. `false.toString()` is valid + "import", // import.meta and import() + "new", // new.target + "super", // super can be used for a function call (`super(...)`) or property lookup (`super.prop`) + "this", // this obviously can be used as a value + "true", // true resolves to a boolean value, so e.g. `false.toString()` is valid +]; + +/// Returns whether the given string is a JS keyword. +fn is_js_keyword(keyword: &str) -> bool { + JS_KEYWORDS.contains(&keyword) +} +/// Returns whether the given string is a JS keyword that does NOT behave like +/// a value. +/// +/// Value-like keywords can be called like functions or have properties +/// accessed, which makes it possible to use them in imports. In general, +/// imports should use this function to check for reserved keywords. +fn is_non_value_js_keyword(keyword: &str) -> bool { + JS_KEYWORDS.contains(&keyword) && !VALUE_LIKE_JS_KEYWORDS.contains(&keyword) +} + #[derive(Default)] struct AttributeParseState { parsed: Cell, @@ -56,6 +117,14 @@ pub struct BindgenAttrs { pub attrs: Vec<(Cell, BindgenAttr)>, } +/// A list of identifiers representing the namespace prefix of an imported +/// function or constant. +/// +/// The list is guaranteed to be non-empty and not start with a JS keyword. +#[cfg_attr(feature = "extra-traits", derive(Debug))] +#[derive(Clone)] +pub struct JsNamespace(Vec); + macro_rules! attrgen { ($mac:ident) => { $mac! { @@ -63,7 +132,7 @@ macro_rules! attrgen { (constructor, Constructor(Span)), (method, Method(Span)), (static_method_of, StaticMethodOf(Span, Ident)), - (js_namespace, JsNamespace(Span, Vec, Vec)), + (js_namespace, JsNamespace(Span, JsNamespace, Vec)), (module, Module(Span, String, Span)), (raw_module, RawModule(Span, String, Span)), (inline_js, InlineJs(Span, String, Span)), @@ -160,14 +229,14 @@ macro_rules! methods { } }; - (@method $name:ident, $variant:ident(Span, Vec, Vec)) => { - fn $name(&self) -> Option<(&[String], &[Span])> { + (@method $name:ident, $variant:ident(Span, JsNamespace, Vec)) => { + fn $name(&self) -> Option<(JsNamespace, &[Span])> { self.attrs .iter() .find_map(|a| match &a.1 { BindgenAttr::$variant(_, ss, spans) => { a.0.set(true); - Some((&ss[..], &spans[..])) + Some((ss.clone(), &spans[..])) } _ => None, }) @@ -358,7 +427,7 @@ impl Parse for BindgenAttr { return Ok(BindgenAttr::$variant(attr_span, val, span)) }); - (@parser $variant:ident(Span, Vec, Vec)) => ({ + (@parser $variant:ident(Span, JsNamespace, Vec)) => ({ input.parse::()?; let (vals, spans) = match input.parse::() { Ok(exprs) => { @@ -377,6 +446,10 @@ impl Parse for BindgenAttr { } } + if vals.is_empty() { + return Err(syn::Error::new(exprs.span(), "Empty namespace lists are not allowed.")); + } + (vals, spans) }, Err(_) => { @@ -384,7 +457,14 @@ impl Parse for BindgenAttr { (vec![ident.to_string()], vec![ident.span()]) } }; - return Ok(BindgenAttr::$variant(attr_span, vals, spans)) + + let first = &vals[0]; + if is_non_value_js_keyword(first) { + let msg = format!("Namespace cannot start with the JS keyword `{}`", first); + return Err(syn::Error::new(spans[0], msg)); + } + + return Ok(BindgenAttr::$variant(attr_span, JsNamespace(vals), spans)) }); } @@ -441,6 +521,14 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for &mut syn::ItemStruct { .js_name() .map(|s| s.0.to_string()) .unwrap_or(self.ident.unraw().to_string()); + if is_js_keyword(&js_name) { + bail_span!( + self.ident, + "struct cannot use the JS keyword `{}` as its name", + js_name + ); + } + let is_inspectable = attrs.inspectable().is_some(); let getter_with_clone = attrs.getter_with_clone(); for (i, field) in self.fields.iter_mut().enumerate() { @@ -524,16 +612,14 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option), ) -> Result { - let mut wasm = function_from_decl( + let (mut wasm, _) = function_from_decl( &self.sig.ident, &opts, self.sig.clone(), self.attrs.clone(), self.vis.clone(), FunctionPosition::Extern, - Some(&["default"]), - )? - .0; + )?; let catch = opts.catch().is_some(); let variadic = opts.variadic().is_some(); let js_ret = if catch { @@ -727,7 +813,7 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType { let shim = format!( "__wbg_instanceof_{}_{}", self.ident, - ShortHash((attrs.js_namespace().map(|(ns, _)| ns), &self.ident)) + ShortHash((attrs.js_namespace().map(|(ns, _)| ns.0), &self.ident)) ); let mut extends = Vec::new(); let mut vendor_prefixes = Vec::new(); @@ -886,25 +972,24 @@ impl ConvertToAst for syn::ItemFn { ); } - let ret = function_from_decl( + let (mut ret, _) = function_from_decl( &self.sig.ident, &attrs, self.sig.clone(), self.attrs, self.vis, FunctionPosition::Free, - Some(&["default"]), )?; attrs.check_used(); - Ok(ret.0) - } -} -pub(crate) fn is_js_keyword(keyword: &str, skip: Option<&[&str]>) -> bool { - JS_KEYWORDS - .iter() - .filter(|keyword| skip.filter(|skip| skip.contains(keyword)).is_none()) - .any(|this| *this == keyword) + // Due to legacy behavior, we need to escape all keyword identifiers as + // `_keyword`, except `default` + if is_js_keyword(&ret.name) && ret.name != "default" { + ret.name = format!("_{}", ret.name); + } + + Ok(ret) + } } /// Returns whether `self` is passed by reference or by value. @@ -942,7 +1027,6 @@ fn function_from_decl( attrs: Vec, vis: syn::Visibility, position: FunctionPosition, - skip_keywords: Option<&[&str]>, ) -> Result<(ast::Function, Option), Diagnostic> { if sig.variadic.is_some() { bail_span!(sig.variadic, "can't #[wasm_bindgen] variadic functions"); @@ -987,8 +1071,11 @@ fn function_from_decl( // E.g. this will replace `fn foo(class: u32)` to `fn foo(_class: u32)` let replace_colliding_arg = |i: &mut syn::PatType| { if let syn::Pat::Ident(ref mut i) = *i.pat { - let ident = i.ident.to_string(); - if is_js_keyword(ident.as_str(), skip_keywords) { + let ident = i.ident.unraw().to_string(); + // JS keywords are NEVER allowed as argument names. Since argument + // names are considered an implementation detail in JS, we can + // safely rename them to avoid collisions. + if is_js_keyword(&ident) { i.ident = Ident::new(format!("_{}", ident).as_str(), i.ident.span()); } } @@ -1047,26 +1134,11 @@ fn function_from_decl( OperationKind::Setter(_) => "set_", _ => "", }; - let name = if prefix.is_empty() - && opts.method().is_none() - && is_js_keyword(js_name, skip_keywords) - { - format!("_{}", js_name) - } else { - format!("{}{}", prefix, js_name) - }; - (name, js_name_span, true) + (format!("{}{}", prefix, js_name), js_name_span, true) } else { - let name = if !matches!(position, FunctionPosition::Impl { .. }) - && opts.method().is_none() - && is_js_keyword(&decl_name.to_string(), skip_keywords) - { - format!("_{}", decl_name.unraw()) - } else { - decl_name.unraw().to_string() - }; - (name, decl_name.span(), false) + (decl_name.unraw().to_string(), decl_name.span(), false) }; + Ok(( ast::Function { arguments, @@ -1344,7 +1416,6 @@ impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn { self.attrs.clone(), self.vis.clone(), FunctionPosition::Impl { self_ty: class }, - None, )?; let method_kind = if opts.constructor().is_some() { ast::MethodKind::Constructor @@ -1481,11 +1552,18 @@ impl<'a> MacroParse<(&'a mut TokenStream, BindgenAttrs)> for syn::ItemEnum { } let generate_typescript = opts.skip_typescript().is_none(); + let comments = extract_doc_comments(&self.attrs); let js_name = opts .js_name() .map(|s| s.0) .map_or_else(|| self.ident.to_string(), |s| s.to_string()); - let comments = extract_doc_comments(&self.attrs); + if is_js_keyword(&js_name) { + bail_span!( + self.ident, + "enum cannot use the JS keyword `{}` as its name", + js_name + ); + } opts.check_used(); @@ -1653,7 +1731,7 @@ impl MacroParse for syn::ItemForeignMod { "only foreign mods with the `C` ABI are allowed" )); } - let js_namespace = opts.js_namespace().map(|(s, _)| s.to_owned()); + let js_namespace = opts.js_namespace().map(|(s, _)| s); let module = module_from_opts(program, &opts) .map_err(|e| errors.push(e)) .unwrap_or_default(); @@ -1674,7 +1752,7 @@ impl MacroParse for syn::ItemForeignMod { struct ForeignItemCtx { module: Option, - js_namespace: Option>, + js_namespace: Option, } impl MacroParse for syn::ForeignItem { @@ -1709,8 +1787,9 @@ impl MacroParse for syn::ForeignItem { let js_namespace = item_opts .js_namespace() - .map(|(s, _)| s.to_owned()) - .or(ctx.js_namespace); + .map(|(s, _)| s) + .or(ctx.js_namespace) + .map(|s| s.0); let module = ctx.module; let kind = match self { @@ -1720,6 +1799,53 @@ impl MacroParse for syn::ForeignItem { _ => panic!("only foreign functions/types allowed for now"), }; + // check for JS keywords + + // We only need to check if there isn't a JS namespace or module. If + // there is namespace, then we already checked the namespace while + // parsing. If there is a module, we can rename the import symbol to + // avoid using keywords. + let needs_check = js_namespace.is_none() && module.is_none(); + if needs_check { + match &kind { + ast::ImportKind::Function(import_function) => { + if matches!(import_function.kind, ast::ImportFunctionKind::Normal) + && is_non_value_js_keyword(&import_function.function.name) + { + bail_span!( + import_function.rust_name, + "Imported function cannot use the JS keyword `{}` as its name.", + import_function.function.name + ); + } + } + ast::ImportKind::Static(import_static) => { + if is_non_value_js_keyword(&import_static.js_name) { + bail_span!( + import_static.rust_name, + "Imported static cannot use the JS keyword `{}` as its name.", + import_static.js_name + ); + } + } + ast::ImportKind::String(_) => { + // static strings don't have JS names, so we don't need to check for JS keywords + } + ast::ImportKind::Type(import_type) => { + if is_non_value_js_keyword(&import_type.js_name) { + bail_span!( + import_type.rust_name, + "Imported type cannot use the JS keyword `{}` as its name.", + import_type.js_name + ); + } + } + ast::ImportKind::Enum(_) => { + // string enums aren't possible here + } + } + } + program.imports.push(ast::Import { module, js_namespace, diff --git a/crates/macro/ui-tests/import-keyword.rs b/crates/macro/ui-tests/import-keyword.rs new file mode 100644 index 00000000000..3c44a45c84d --- /dev/null +++ b/crates/macro/ui-tests/import-keyword.rs @@ -0,0 +1,68 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + type A; + + // directly import function with reserved keywords + #[wasm_bindgen] + fn function(); + // directly import function with reserved keywords + #[wasm_bindgen(js_name = "var")] + fn keyword_var(); + + // this is fine, because it's a method + #[wasm_bindgen(method, js_name = "let")] + fn keyword_let(arg: &A); + // this is fine, because it's static + #[wasm_bindgen(static_method_of = A, js_name = "let")] + fn static_keyword_let(); + + // directly import static with reserved keywords + #[wasm_bindgen(thread_local_v2, js_name = "const")] + static CONST: u32; + + // directly import type with reserved keywords + #[wasm_bindgen(js_name = "throw")] + type B; + // fine with a namespace + #[wasm_bindgen(js_name = "throw", js_namespace = ["foo"])] + type C; +} + +// Namespaces + +// namespace on extern block +#[wasm_bindgen(js_namespace = ["public", "foo"])] +extern "C" {} + +#[wasm_bindgen] +extern "C" { + // invalid, because of its namespace + #[wasm_bindgen(js_namespace = ["const", "bar"])] + fn function(); + // okay, because it defines its own namespace + #[wasm_bindgen(thread_local_v2, js_name = "const", js_namespace = ["bar", "new"])] + static CONST: u32; +} + +#[wasm_bindgen] +extern "C" { + // empty namespace to be funny + #[wasm_bindgen(js_namespace = [])] + fn function(); +} + +// Classes and enums + +#[wasm_bindgen] +pub struct class; +#[wasm_bindgen] +pub struct r#true; // forbid value-like keywords +#[wasm_bindgen] +pub enum switch { + A, + B, +} + +fn main() {} diff --git a/crates/macro/ui-tests/import-keyword.stderr b/crates/macro/ui-tests/import-keyword.stderr new file mode 100644 index 00000000000..ecc9f087ded --- /dev/null +++ b/crates/macro/ui-tests/import-keyword.stderr @@ -0,0 +1,59 @@ +error: Imported function cannot use the JS keyword `function` as its name. + --> ui-tests/import-keyword.rs:9:8 + | +9 | fn function(); + | ^^^^^^^^ + +error: Imported function cannot use the JS keyword `var` as its name. + --> ui-tests/import-keyword.rs:12:8 + | +12 | fn keyword_var(); + | ^^^^^^^^^^^ + +error: Imported static cannot use the JS keyword `const` as its name. + --> ui-tests/import-keyword.rs:23:12 + | +23 | static CONST: u32; + | ^^^^^ + +error: Imported type cannot use the JS keyword `throw` as its name. + --> ui-tests/import-keyword.rs:27:10 + | +27 | type B; + | ^ + +error: Namespace cannot start with the JS keyword `public` + --> ui-tests/import-keyword.rs:36:32 + | +36 | #[wasm_bindgen(js_namespace = ["public", "foo"])] + | ^^^^^^^^ + +error: Namespace cannot start with the JS keyword `const` + --> ui-tests/import-keyword.rs:42:36 + | +42 | #[wasm_bindgen(js_namespace = ["const", "bar"])] + | ^^^^^^^ + +error: Empty namespace lists are not allowed. + --> ui-tests/import-keyword.rs:52:35 + | +52 | #[wasm_bindgen(js_namespace = [])] + | ^^ + +error: struct cannot use the JS keyword `class` as its name + --> ui-tests/import-keyword.rs:59:12 + | +59 | pub struct class; + | ^^^^^ + +error: struct cannot use the JS keyword `true` as its name + --> ui-tests/import-keyword.rs:61:12 + | +61 | pub struct r#true; // forbid value-like keywords + | ^^^^^^ + +error: enum cannot use the JS keyword `switch` as its name + --> ui-tests/import-keyword.rs:63:10 + | +63 | pub enum switch { + | ^^^^^^ From 0c06e1a482a17e8ce5af809ddc558e092454c793 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 8 Dec 2024 20:28:40 +0100 Subject: [PATCH 605/641] Move the `__rt` module into its own file (#4343) --- src/lib.rs | 771 +---------------------------------------------------- src/rt.rs | 761 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 765 insertions(+), 767 deletions(-) create mode 100644 src/rt.rs diff --git a/src/lib.rs b/src/lib.rs index 3aac1273ae7..19983c54bb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,6 +95,10 @@ if_std! { pub use cache::intern::{intern, unintern}; } +#[doc(hidden)] +#[path = "rt.rs"] +pub mod __rt; + /// Representation of an object owned by JS. /// /// A `JsValue` doesn't actually live in Rust right now but actually in a table @@ -1571,773 +1575,6 @@ pub fn function_table() -> JsValue { unsafe { JsValue::_new(__wbindgen_function_table()) } } -#[doc(hidden)] -pub mod __rt { - use crate::JsValue; - use core::borrow::{Borrow, BorrowMut}; - use core::cell::{Cell, UnsafeCell}; - use core::convert::Infallible; - use core::mem; - use core::ops::{Deref, DerefMut}; - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - use core::sync::atomic::{AtomicU8, Ordering}; - - pub extern crate alloc; - pub extern crate core; - #[cfg(feature = "std")] - pub extern crate std; - - use alloc::alloc::{alloc, dealloc, realloc, Layout}; - use alloc::boxed::Box; - use alloc::rc::Rc; - - /// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with - /// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. - #[cfg(not(feature = "std"))] - pub struct LazyCell T>(::once_cell::unsync::Lazy); - - #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - unsafe impl Sync for LazyCell {} - - #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - unsafe impl Send for LazyCell {} - - #[cfg(not(feature = "std"))] - impl LazyCell { - pub const fn new(init: F) -> LazyCell { - Self(::once_cell::unsync::Lazy::new(init)) - } - } - - #[cfg(not(feature = "std"))] - impl T> LazyCell { - pub(crate) fn try_with( - &self, - f: impl FnOnce(&T) -> R, - ) -> Result { - Ok(f(&self.0)) - } - - pub fn force(this: &Self) -> &T { - &this.0 - } - } - - #[cfg(not(feature = "std"))] - impl Deref for LazyCell { - type Target = T; - - fn deref(&self) -> &T { - ::once_cell::unsync::Lazy::force(&self.0) - } - } - - #[cfg(feature = "std")] - pub use once_cell::sync::Lazy as LazyLock; - - #[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] - pub use LazyCell as LazyLock; - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - pub struct LazyLock T> { - state: AtomicU8, - data: UnsafeCell>, - } - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - enum Data { - Value(T), - Init(F), - } - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - unsafe impl Sync for LazyLock {} - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - unsafe impl Send for LazyLock {} - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - impl LazyLock { - const STATE_UNINIT: u8 = 0; - const STATE_INITIALIZING: u8 = 1; - const STATE_INIT: u8 = 2; - - pub const fn new(init: F) -> LazyLock { - Self { - state: AtomicU8::new(Self::STATE_UNINIT), - data: UnsafeCell::new(Data::Init(init)), - } - } - } - - #[cfg(all(target_feature = "atomics", not(feature = "std")))] - impl Deref for LazyLock { - type Target = T; - - fn deref(&self) -> &T { - let mut state = self.state.load(Ordering::Acquire); - - loop { - match state { - Self::STATE_INIT => { - let Data::Value(value) = (unsafe { &*self.data.get() }) else { - unreachable!() - }; - return value; - } - Self::STATE_UNINIT => { - if let Err(new_state) = self.state.compare_exchange_weak( - Self::STATE_UNINIT, - Self::STATE_INITIALIZING, - Ordering::Acquire, - Ordering::Relaxed, - ) { - state = new_state; - continue; - } - - let data = unsafe { &mut *self.data.get() }; - let Data::Init(init) = data else { - unreachable!() - }; - *data = Data::Value(init()); - self.state.store(Self::STATE_INIT, Ordering::Release); - state = Self::STATE_INIT; - } - Self::STATE_INITIALIZING => { - // TODO: Block here if possible. This would require - // detecting if we can in the first place. - state = self.state.load(Ordering::Acquire); - } - _ => unreachable!(), - } - } - } - } - - #[macro_export] - #[doc(hidden)] - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - macro_rules! __wbindgen_thread_local { - ($wasm_bindgen:tt, $actual_ty:ty) => {{ - static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = - $wasm_bindgen::__rt::LazyCell::new(init); - $wasm_bindgen::JsThreadLocal { __inner: &_VAL } - }}; - } - - #[macro_export] - #[doc(hidden)] - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - #[allow_internal_unstable(thread_local)] - macro_rules! __wbindgen_thread_local { - ($wasm_bindgen:tt, $actual_ty:ty) => {{ - #[thread_local] - static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = - $wasm_bindgen::__rt::LazyCell::new(init); - $wasm_bindgen::JsThreadLocal { - __inner: || unsafe { - $wasm_bindgen::__rt::LazyCell::force(&_VAL) as *const $actual_ty - }, - } - }}; - } - - #[macro_export] - #[doc(hidden)] - #[cfg(not(wasm_bindgen_unstable_test_coverage))] - macro_rules! __wbindgen_coverage { - ($item:item) => { - $item - }; - } - - #[macro_export] - #[doc(hidden)] - #[cfg(wasm_bindgen_unstable_test_coverage)] - #[allow_internal_unstable(coverage_attribute)] - macro_rules! __wbindgen_coverage { - ($item:item) => { - #[coverage(off)] - $item - }; - } - - #[inline] - pub fn assert_not_null(s: *mut T) { - if s.is_null() { - throw_null(); - } - } - - #[cold] - #[inline(never)] - fn throw_null() -> ! { - super::throw_str("null pointer passed to rust"); - } - - /// A vendored version of `RefCell` from the standard library. - /// - /// Now why, you may ask, would we do that? Surely `RefCell` in libstd is - /// quite good. And you're right, it is indeed quite good! Functionally - /// nothing more is needed from `RefCell` in the standard library but for - /// now this crate is also sort of optimizing for compiled code size. - /// - /// One major factor to larger binaries in Rust is when a panic happens. - /// Panicking in the standard library involves a fair bit of machinery - /// (formatting, panic hooks, synchronization, etc). It's all worthwhile if - /// you need it but for something like `WasmRefCell` here we don't actually - /// need all that! - /// - /// This is just a wrapper around all Rust objects passed to JS intended to - /// guard accidental reentrancy, so this vendored version is intended solely - /// to not panic in libstd. Instead when it "panics" it calls our `throw` - /// function in this crate which raises an error in JS. - pub struct WasmRefCell { - borrow: Cell, - value: UnsafeCell, - } - - impl WasmRefCell { - pub fn new(value: T) -> WasmRefCell - where - T: Sized, - { - WasmRefCell { - value: UnsafeCell::new(value), - borrow: Cell::new(0), - } - } - - pub fn get_mut(&mut self) -> &mut T { - unsafe { &mut *self.value.get() } - } - - pub fn borrow(&self) -> Ref { - unsafe { - if self.borrow.get() == usize::MAX { - borrow_fail(); - } - self.borrow.set(self.borrow.get() + 1); - Ref { - value: &*self.value.get(), - borrow: &self.borrow, - } - } - } - - pub fn borrow_mut(&self) -> RefMut { - unsafe { - if self.borrow.get() != 0 { - borrow_fail(); - } - self.borrow.set(usize::MAX); - RefMut { - value: &mut *self.value.get(), - borrow: &self.borrow, - } - } - } - - pub fn into_inner(self) -> T - where - T: Sized, - { - self.value.into_inner() - } - } - - pub struct Ref<'b, T: ?Sized + 'b> { - value: &'b T, - borrow: &'b Cell, - } - - impl Deref for Ref<'_, T> { - type Target = T; - - #[inline] - fn deref(&self) -> &T { - self.value - } - } - - impl Borrow for Ref<'_, T> { - #[inline] - fn borrow(&self) -> &T { - self.value - } - } - - impl Drop for Ref<'_, T> { - fn drop(&mut self) { - self.borrow.set(self.borrow.get() - 1); - } - } - - pub struct RefMut<'b, T: ?Sized + 'b> { - value: &'b mut T, - borrow: &'b Cell, - } - - impl Deref for RefMut<'_, T> { - type Target = T; - - #[inline] - fn deref(&self) -> &T { - self.value - } - } - - impl DerefMut for RefMut<'_, T> { - #[inline] - fn deref_mut(&mut self) -> &mut T { - self.value - } - } - - impl Borrow for RefMut<'_, T> { - #[inline] - fn borrow(&self) -> &T { - self.value - } - } - - impl BorrowMut for RefMut<'_, T> { - #[inline] - fn borrow_mut(&mut self) -> &mut T { - self.value - } - } - - impl Drop for RefMut<'_, T> { - fn drop(&mut self) { - self.borrow.set(0); - } - } - - fn borrow_fail() -> ! { - super::throw_str( - "recursive use of an object detected which would lead to \ - unsafe aliasing in rust", - ); - } - - /// A type that encapsulates an `Rc>` as well as a `Ref` - /// to the contents of that `WasmRefCell`. - /// - /// The `'static` requirement is an unfortunate consequence of how this - /// is implemented. - pub struct RcRef { - // The 'static is a lie. - // - // We could get away without storing this, since we're in the same module as - // `WasmRefCell` and can directly manipulate its `borrow`, but I'm considering - // turning it into a wrapper around `std`'s `RefCell` to reduce `unsafe` in - // which case that would stop working. This also requires less `unsafe` as is. - // - // It's important that this goes before `Rc` so that it gets dropped first. - ref_: Ref<'static, T>, - _rc: Rc>, - } - - impl RcRef { - pub fn new(rc: Rc>) -> Self { - let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow() }; - Self { _rc: rc, ref_ } - } - } - - impl Deref for RcRef { - type Target = T; - - #[inline] - fn deref(&self) -> &T { - &self.ref_ - } - } - - impl Borrow for RcRef { - #[inline] - fn borrow(&self) -> &T { - &self.ref_ - } - } - - /// A type that encapsulates an `Rc>` as well as a - /// `RefMut` to the contents of that `WasmRefCell`. - /// - /// The `'static` requirement is an unfortunate consequence of how this - /// is implemented. - pub struct RcRefMut { - ref_: RefMut<'static, T>, - _rc: Rc>, - } - - impl RcRefMut { - pub fn new(rc: Rc>) -> Self { - let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow_mut() }; - Self { _rc: rc, ref_ } - } - } - - impl Deref for RcRefMut { - type Target = T; - - #[inline] - fn deref(&self) -> &T { - &self.ref_ - } - } - - impl DerefMut for RcRefMut { - #[inline] - fn deref_mut(&mut self) -> &mut T { - &mut self.ref_ - } - } - - impl Borrow for RcRefMut { - #[inline] - fn borrow(&self) -> &T { - &self.ref_ - } - } - - impl BorrowMut for RcRefMut { - #[inline] - fn borrow_mut(&mut self) -> &mut T { - &mut self.ref_ - } - } - - #[no_mangle] - pub extern "C" fn __wbindgen_malloc(size: usize, align: usize) -> *mut u8 { - if let Ok(layout) = Layout::from_size_align(size, align) { - unsafe { - if layout.size() > 0 { - let ptr = alloc(layout); - if !ptr.is_null() { - return ptr; - } - } else { - return align as *mut u8; - } - } - } - - malloc_failure(); - } - - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_realloc( - ptr: *mut u8, - old_size: usize, - new_size: usize, - align: usize, - ) -> *mut u8 { - debug_assert!(old_size > 0); - debug_assert!(new_size > 0); - if let Ok(layout) = Layout::from_size_align(old_size, align) { - let ptr = realloc(ptr, layout, new_size); - if !ptr.is_null() { - return ptr; - } - } - malloc_failure(); - } - - #[cold] - fn malloc_failure() -> ! { - cfg_if::cfg_if! { - if #[cfg(debug_assertions)] { - super::throw_str("invalid malloc request") - } else if #[cfg(feature = "std")] { - std::process::abort(); - } else if #[cfg(all( - target_arch = "wasm32", - any(target_os = "unknown", target_os = "none") - ))] { - core::arch::wasm32::unreachable(); - } else { - unreachable!() - } - } - } - - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_free(ptr: *mut u8, size: usize, align: usize) { - // This happens for zero-length slices, and in that case `ptr` is - // likely bogus so don't actually send this to the system allocator - if size == 0 { - return; - } - let layout = Layout::from_size_align_unchecked(size, align); - dealloc(ptr, layout); - } - - /// This is a curious function necessary to get wasm-bindgen working today, - /// and it's a bit of an unfortunate hack. - /// - /// The general problem is that somehow we need the above two symbols to - /// exist in the final output binary (__wbindgen_malloc and - /// __wbindgen_free). These symbols may be called by JS for various - /// bindings, so we for sure need to make sure they're exported. - /// - /// The problem arises, though, when what if no Rust code uses the symbols? - /// For all intents and purposes it looks to LLVM and the linker like the - /// above two symbols are dead code, so they're completely discarded! - /// - /// Specifically what happens is this: - /// - /// * The above two symbols are generated into some object file inside of - /// libwasm_bindgen.rlib - /// * The linker, LLD, will not load this object file unless *some* symbol - /// is loaded from the object. In this case, if the Rust code never calls - /// __wbindgen_malloc or __wbindgen_free then the symbols never get linked - /// in. - /// * Later when `wasm-bindgen` attempts to use the symbols they don't - /// exist, causing an error. - /// - /// This function is a weird hack for this problem. We inject a call to this - /// function in all generated code. Usage of this function should then - /// ensure that the above two intrinsics are translated. - /// - /// Due to how rustc creates object files this function (and anything inside - /// it) will be placed into the same object file as the two intrinsics - /// above. That means if this function is called and referenced we'll pull - /// in the object file and link the intrinsics. - /// - /// Ideas for how to improve this are most welcome! - #[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] - pub fn link_mem_intrinsics() { - crate::link::link_intrinsics(); - } - - #[cfg(feature = "std")] - std::thread_local! { - static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); - } - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - static mut GLOBAL_EXNDATA: [u32; 2] = [0; 2]; - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - #[thread_local] - static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); - - struct GlobalExndata; - - impl GlobalExndata { - #[cfg(feature = "std")] - fn get() -> [u32; 2] { - GLOBAL_EXNDATA.with(Cell::get) - } - - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - fn get() -> [u32; 2] { - unsafe { GLOBAL_EXNDATA } - } - - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - fn get() -> [u32; 2] { - GLOBAL_EXNDATA.get() - } - - #[cfg(feature = "std")] - fn set(data: [u32; 2]) { - GLOBAL_EXNDATA.with(|d| d.set(data)) - } - - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - fn set(data: [u32; 2]) { - unsafe { GLOBAL_EXNDATA = data }; - } - - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - fn set(data: [u32; 2]) { - GLOBAL_EXNDATA.set(data); - } - } - - #[no_mangle] - pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { - debug_assert_eq!(GlobalExndata::get()[0], 0); - GlobalExndata::set([1, idx]); - } - - pub fn take_last_exception() -> Result<(), super::JsValue> { - let ret = if GlobalExndata::get()[0] == 1 { - Err(super::JsValue::_new(GlobalExndata::get()[1])) - } else { - Ok(()) - }; - GlobalExndata::set([0, 0]); - ret - } - - /// An internal helper trait for usage in `#[wasm_bindgen]` on `async` - /// functions to convert the return value of the function to - /// `Result` which is what we'll return to JS (where an - /// error is a failed future). - pub trait IntoJsResult { - fn into_js_result(self) -> Result; - } - - impl IntoJsResult for () { - fn into_js_result(self) -> Result { - Ok(JsValue::undefined()) - } - } - - impl> IntoJsResult for T { - fn into_js_result(self) -> Result { - Ok(self.into()) - } - } - - impl, E: Into> IntoJsResult for Result { - fn into_js_result(self) -> Result { - match self { - Ok(e) => Ok(e.into()), - Err(e) => Err(e.into()), - } - } - } - - impl> IntoJsResult for Result<(), E> { - fn into_js_result(self) -> Result { - match self { - Ok(()) => Ok(JsValue::undefined()), - Err(e) => Err(e.into()), - } - } - } - - /// An internal helper trait for usage in `#[wasm_bindgen(start)]` - /// functions to throw the error (if it is `Err`). - pub trait Start { - fn start(self); - } - - impl Start for () { - #[inline] - fn start(self) {} - } - - impl> Start for Result<(), E> { - #[inline] - fn start(self) { - if let Err(e) = self { - crate::throw_val(e.into()); - } - } - } - - /// An internal helper struct for usage in `#[wasm_bindgen(main)]` - /// functions to throw the error (if it is `Err`). - pub struct MainWrapper(pub Option); - - pub trait Main { - fn __wasm_bindgen_main(&mut self); - } - - impl Main for &mut &mut MainWrapper<()> { - #[inline] - fn __wasm_bindgen_main(&mut self) {} - } - - impl Main for &mut &mut MainWrapper { - #[inline] - fn __wasm_bindgen_main(&mut self) {} - } - - impl> Main for &mut &mut MainWrapper> { - #[inline] - fn __wasm_bindgen_main(&mut self) { - if let Err(e) = self.0.take().unwrap() { - crate::throw_val(e.into()); - } - } - } - - impl Main for &mut MainWrapper> { - #[inline] - fn __wasm_bindgen_main(&mut self) { - if let Err(e) = self.0.take().unwrap() { - crate::throw_str(&alloc::format!("{:?}", e)); - } - } - } - - pub const fn flat_len(slices: [&[T]; SIZE]) -> usize { - let mut len = 0; - let mut i = 0; - while i < slices.len() { - len += slices[i].len(); - i += 1; - } - len - } - - pub const fn flat_byte_slices( - slices: [&[u8]; SIZE], - ) -> [u8; RESULT_LEN] { - let mut result = [0; RESULT_LEN]; - - let mut slice_index = 0; - let mut result_offset = 0; - - while slice_index < slices.len() { - let mut i = 0; - let slice = slices[slice_index]; - while i < slice.len() { - result[result_offset] = slice[i]; - i += 1; - result_offset += 1; - } - slice_index += 1; - } - - result - } - - // NOTE: This method is used to encode u32 into a variable-length-integer during the compile-time . - // Generally speaking, the length of the encoded variable-length-integer depends on the size of the integer - // but the maximum capacity can be used here to simplify the amount of code during the compile-time . - pub const fn encode_u32_to_fixed_len_bytes(value: u32) -> [u8; 5] { - let mut result: [u8; 5] = [0; 5]; - let mut i = 0; - while i < 4 { - result[i] = ((value >> (7 * i)) | 0x80) as u8; - i += 1; - } - result[4] = (value >> (7 * 4)) as u8; - result - } - - /// Trait for element types to implement `Into` for vectors of - /// themselves, which isn't possible directly thanks to the orphan rule. - pub trait VectorIntoJsValue: Sized { - fn vector_into_jsvalue(vector: Box<[Self]>) -> JsValue; - } - - impl From> for JsValue { - fn from(vector: Box<[T]>) -> Self { - T::vector_into_jsvalue(vector) - } - } - - pub fn js_value_vector_into_jsvalue>(vector: Box<[T]>) -> JsValue { - let result = unsafe { JsValue::_new(super::__wbindgen_array_new()) }; - for value in vector.into_vec() { - let js: JsValue = value.into(); - unsafe { super::__wbindgen_array_push(result.idx, js.idx) } - // `__wbindgen_array_push` takes ownership over `js` and has already dropped it, - // so don't drop it again. - mem::forget(js); - } - result - } -} - /// A wrapper type around slices and vectors for binding the `Uint8ClampedArray` /// array in JS. /// diff --git a/src/rt.rs b/src/rt.rs new file mode 100644 index 00000000000..2aac5ce3a41 --- /dev/null +++ b/src/rt.rs @@ -0,0 +1,761 @@ +use crate::JsValue; +use core::borrow::{Borrow, BorrowMut}; +use core::cell::{Cell, UnsafeCell}; +use core::convert::Infallible; +use core::mem; +use core::ops::{Deref, DerefMut}; +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +use core::sync::atomic::{AtomicU8, Ordering}; + +pub extern crate alloc; +pub extern crate core; +#[cfg(feature = "std")] +pub extern crate std; + +use alloc::alloc::{alloc, dealloc, realloc, Layout}; +use alloc::boxed::Box; +use alloc::rc::Rc; + +/// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with +/// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. +#[cfg(not(feature = "std"))] +pub struct LazyCell T>(::once_cell::unsync::Lazy); + +#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] +unsafe impl Sync for LazyCell {} + +#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] +unsafe impl Send for LazyCell {} + +#[cfg(not(feature = "std"))] +impl LazyCell { + pub const fn new(init: F) -> LazyCell { + Self(::once_cell::unsync::Lazy::new(init)) + } +} + +#[cfg(not(feature = "std"))] +impl T> LazyCell { + pub(crate) fn try_with( + &self, + f: impl FnOnce(&T) -> R, + ) -> Result { + Ok(f(&self.0)) + } + + pub fn force(this: &Self) -> &T { + &this.0 + } +} + +#[cfg(not(feature = "std"))] +impl Deref for LazyCell { + type Target = T; + + fn deref(&self) -> &T { + ::once_cell::unsync::Lazy::force(&self.0) + } +} + +#[cfg(feature = "std")] +pub use once_cell::sync::Lazy as LazyLock; + +#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] +pub use LazyCell as LazyLock; + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +pub struct LazyLock T> { + state: AtomicU8, + data: UnsafeCell>, +} + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +enum Data { + Value(T), + Init(F), +} + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +unsafe impl Sync for LazyLock {} + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +unsafe impl Send for LazyLock {} + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +impl LazyLock { + const STATE_UNINIT: u8 = 0; + const STATE_INITIALIZING: u8 = 1; + const STATE_INIT: u8 = 2; + + pub const fn new(init: F) -> LazyLock { + Self { + state: AtomicU8::new(Self::STATE_UNINIT), + data: UnsafeCell::new(Data::Init(init)), + } + } +} + +#[cfg(all(target_feature = "atomics", not(feature = "std")))] +impl Deref for LazyLock { + type Target = T; + + fn deref(&self) -> &T { + let mut state = self.state.load(Ordering::Acquire); + + loop { + match state { + Self::STATE_INIT => { + let Data::Value(value) = (unsafe { &*self.data.get() }) else { + unreachable!() + }; + return value; + } + Self::STATE_UNINIT => { + if let Err(new_state) = self.state.compare_exchange_weak( + Self::STATE_UNINIT, + Self::STATE_INITIALIZING, + Ordering::Acquire, + Ordering::Relaxed, + ) { + state = new_state; + continue; + } + + let data = unsafe { &mut *self.data.get() }; + let Data::Init(init) = data else { + unreachable!() + }; + *data = Data::Value(init()); + self.state.store(Self::STATE_INIT, Ordering::Release); + state = Self::STATE_INIT; + } + Self::STATE_INITIALIZING => { + // TODO: Block here if possible. This would require + // detecting if we can in the first place. + state = self.state.load(Ordering::Acquire); + } + _ => unreachable!(), + } + } + } +} + +#[macro_export] +#[doc(hidden)] +#[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] +macro_rules! __wbindgen_thread_local { + ($wasm_bindgen:tt, $actual_ty:ty) => {{ + static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = + $wasm_bindgen::__rt::LazyCell::new(init); + $wasm_bindgen::JsThreadLocal { __inner: &_VAL } + }}; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(all(not(feature = "std"), target_feature = "atomics"))] +#[allow_internal_unstable(thread_local)] +macro_rules! __wbindgen_thread_local { + ($wasm_bindgen:tt, $actual_ty:ty) => {{ + #[thread_local] + static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = + $wasm_bindgen::__rt::LazyCell::new(init); + $wasm_bindgen::JsThreadLocal { + __inner: || unsafe { $wasm_bindgen::__rt::LazyCell::force(&_VAL) as *const $actual_ty }, + } + }}; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(not(wasm_bindgen_unstable_test_coverage))] +macro_rules! __wbindgen_coverage { + ($item:item) => { + $item + }; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(wasm_bindgen_unstable_test_coverage)] +#[allow_internal_unstable(coverage_attribute)] +macro_rules! __wbindgen_coverage { + ($item:item) => { + #[coverage(off)] + $item + }; +} + +#[inline] +pub fn assert_not_null(s: *mut T) { + if s.is_null() { + throw_null(); + } +} + +#[cold] +#[inline(never)] +fn throw_null() -> ! { + super::throw_str("null pointer passed to rust"); +} + +/// A vendored version of `RefCell` from the standard library. +/// +/// Now why, you may ask, would we do that? Surely `RefCell` in libstd is +/// quite good. And you're right, it is indeed quite good! Functionally +/// nothing more is needed from `RefCell` in the standard library but for +/// now this crate is also sort of optimizing for compiled code size. +/// +/// One major factor to larger binaries in Rust is when a panic happens. +/// Panicking in the standard library involves a fair bit of machinery +/// (formatting, panic hooks, synchronization, etc). It's all worthwhile if +/// you need it but for something like `WasmRefCell` here we don't actually +/// need all that! +/// +/// This is just a wrapper around all Rust objects passed to JS intended to +/// guard accidental reentrancy, so this vendored version is intended solely +/// to not panic in libstd. Instead when it "panics" it calls our `throw` +/// function in this crate which raises an error in JS. +pub struct WasmRefCell { + borrow: Cell, + value: UnsafeCell, +} + +impl WasmRefCell { + pub fn new(value: T) -> WasmRefCell + where + T: Sized, + { + WasmRefCell { + value: UnsafeCell::new(value), + borrow: Cell::new(0), + } + } + + pub fn get_mut(&mut self) -> &mut T { + unsafe { &mut *self.value.get() } + } + + pub fn borrow(&self) -> Ref { + unsafe { + if self.borrow.get() == usize::MAX { + borrow_fail(); + } + self.borrow.set(self.borrow.get() + 1); + Ref { + value: &*self.value.get(), + borrow: &self.borrow, + } + } + } + + pub fn borrow_mut(&self) -> RefMut { + unsafe { + if self.borrow.get() != 0 { + borrow_fail(); + } + self.borrow.set(usize::MAX); + RefMut { + value: &mut *self.value.get(), + borrow: &self.borrow, + } + } + } + + pub fn into_inner(self) -> T + where + T: Sized, + { + self.value.into_inner() + } +} + +pub struct Ref<'b, T: ?Sized + 'b> { + value: &'b T, + borrow: &'b Cell, +} + +impl Deref for Ref<'_, T> { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + self.value + } +} + +impl Borrow for Ref<'_, T> { + #[inline] + fn borrow(&self) -> &T { + self.value + } +} + +impl Drop for Ref<'_, T> { + fn drop(&mut self) { + self.borrow.set(self.borrow.get() - 1); + } +} + +pub struct RefMut<'b, T: ?Sized + 'b> { + value: &'b mut T, + borrow: &'b Cell, +} + +impl Deref for RefMut<'_, T> { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + self.value + } +} + +impl DerefMut for RefMut<'_, T> { + #[inline] + fn deref_mut(&mut self) -> &mut T { + self.value + } +} + +impl Borrow for RefMut<'_, T> { + #[inline] + fn borrow(&self) -> &T { + self.value + } +} + +impl BorrowMut for RefMut<'_, T> { + #[inline] + fn borrow_mut(&mut self) -> &mut T { + self.value + } +} + +impl Drop for RefMut<'_, T> { + fn drop(&mut self) { + self.borrow.set(0); + } +} + +fn borrow_fail() -> ! { + super::throw_str( + "recursive use of an object detected which would lead to \ + unsafe aliasing in rust", + ); +} + +/// A type that encapsulates an `Rc>` as well as a `Ref` +/// to the contents of that `WasmRefCell`. +/// +/// The `'static` requirement is an unfortunate consequence of how this +/// is implemented. +pub struct RcRef { + // The 'static is a lie. + // + // We could get away without storing this, since we're in the same module as + // `WasmRefCell` and can directly manipulate its `borrow`, but I'm considering + // turning it into a wrapper around `std`'s `RefCell` to reduce `unsafe` in + // which case that would stop working. This also requires less `unsafe` as is. + // + // It's important that this goes before `Rc` so that it gets dropped first. + ref_: Ref<'static, T>, + _rc: Rc>, +} + +impl RcRef { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow() }; + Self { _rc: rc, ref_ } + } +} + +impl Deref for RcRef { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + &self.ref_ + } +} + +impl Borrow for RcRef { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ + } +} + +/// A type that encapsulates an `Rc>` as well as a +/// `RefMut` to the contents of that `WasmRefCell`. +/// +/// The `'static` requirement is an unfortunate consequence of how this +/// is implemented. +pub struct RcRefMut { + ref_: RefMut<'static, T>, + _rc: Rc>, +} + +impl RcRefMut { + pub fn new(rc: Rc>) -> Self { + let ref_ = unsafe { (*Rc::as_ptr(&rc)).borrow_mut() }; + Self { _rc: rc, ref_ } + } +} + +impl Deref for RcRefMut { + type Target = T; + + #[inline] + fn deref(&self) -> &T { + &self.ref_ + } +} + +impl DerefMut for RcRefMut { + #[inline] + fn deref_mut(&mut self) -> &mut T { + &mut self.ref_ + } +} + +impl Borrow for RcRefMut { + #[inline] + fn borrow(&self) -> &T { + &self.ref_ + } +} + +impl BorrowMut for RcRefMut { + #[inline] + fn borrow_mut(&mut self) -> &mut T { + &mut self.ref_ + } +} + +#[no_mangle] +pub extern "C" fn __wbindgen_malloc(size: usize, align: usize) -> *mut u8 { + if let Ok(layout) = Layout::from_size_align(size, align) { + unsafe { + if layout.size() > 0 { + let ptr = alloc(layout); + if !ptr.is_null() { + return ptr; + } + } else { + return align as *mut u8; + } + } + } + + malloc_failure(); +} + +#[no_mangle] +pub unsafe extern "C" fn __wbindgen_realloc( + ptr: *mut u8, + old_size: usize, + new_size: usize, + align: usize, +) -> *mut u8 { + debug_assert!(old_size > 0); + debug_assert!(new_size > 0); + if let Ok(layout) = Layout::from_size_align(old_size, align) { + let ptr = realloc(ptr, layout, new_size); + if !ptr.is_null() { + return ptr; + } + } + malloc_failure(); +} + +#[cold] +fn malloc_failure() -> ! { + cfg_if::cfg_if! { + if #[cfg(debug_assertions)] { + super::throw_str("invalid malloc request") + } else if #[cfg(feature = "std")] { + std::process::abort(); + } else if #[cfg(all( + target_arch = "wasm32", + any(target_os = "unknown", target_os = "none") + ))] { + core::arch::wasm32::unreachable(); + } else { + unreachable!() + } + } +} + +#[no_mangle] +pub unsafe extern "C" fn __wbindgen_free(ptr: *mut u8, size: usize, align: usize) { + // This happens for zero-length slices, and in that case `ptr` is + // likely bogus so don't actually send this to the system allocator + if size == 0 { + return; + } + let layout = Layout::from_size_align_unchecked(size, align); + dealloc(ptr, layout); +} + +/// This is a curious function necessary to get wasm-bindgen working today, +/// and it's a bit of an unfortunate hack. +/// +/// The general problem is that somehow we need the above two symbols to +/// exist in the final output binary (__wbindgen_malloc and +/// __wbindgen_free). These symbols may be called by JS for various +/// bindings, so we for sure need to make sure they're exported. +/// +/// The problem arises, though, when what if no Rust code uses the symbols? +/// For all intents and purposes it looks to LLVM and the linker like the +/// above two symbols are dead code, so they're completely discarded! +/// +/// Specifically what happens is this: +/// +/// * The above two symbols are generated into some object file inside of +/// libwasm_bindgen.rlib +/// * The linker, LLD, will not load this object file unless *some* symbol +/// is loaded from the object. In this case, if the Rust code never calls +/// __wbindgen_malloc or __wbindgen_free then the symbols never get linked +/// in. +/// * Later when `wasm-bindgen` attempts to use the symbols they don't +/// exist, causing an error. +/// +/// This function is a weird hack for this problem. We inject a call to this +/// function in all generated code. Usage of this function should then +/// ensure that the above two intrinsics are translated. +/// +/// Due to how rustc creates object files this function (and anything inside +/// it) will be placed into the same object file as the two intrinsics +/// above. That means if this function is called and referenced we'll pull +/// in the object file and link the intrinsics. +/// +/// Ideas for how to improve this are most welcome! +#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))] +pub fn link_mem_intrinsics() { + crate::link::link_intrinsics(); +} + +#[cfg(feature = "std")] +std::thread_local! { + static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); +} +#[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] +static mut GLOBAL_EXNDATA: [u32; 2] = [0; 2]; +#[cfg(all(not(feature = "std"), target_feature = "atomics"))] +#[thread_local] +static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); + +struct GlobalExndata; + +impl GlobalExndata { + #[cfg(feature = "std")] + fn get() -> [u32; 2] { + GLOBAL_EXNDATA.with(Cell::get) + } + + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + fn get() -> [u32; 2] { + unsafe { GLOBAL_EXNDATA } + } + + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + fn get() -> [u32; 2] { + GLOBAL_EXNDATA.get() + } + + #[cfg(feature = "std")] + fn set(data: [u32; 2]) { + GLOBAL_EXNDATA.with(|d| d.set(data)) + } + + #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + fn set(data: [u32; 2]) { + unsafe { GLOBAL_EXNDATA = data }; + } + + #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + fn set(data: [u32; 2]) { + GLOBAL_EXNDATA.set(data); + } +} + +#[no_mangle] +pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { + debug_assert_eq!(GlobalExndata::get()[0], 0); + GlobalExndata::set([1, idx]); +} + +pub fn take_last_exception() -> Result<(), super::JsValue> { + let ret = if GlobalExndata::get()[0] == 1 { + Err(super::JsValue::_new(GlobalExndata::get()[1])) + } else { + Ok(()) + }; + GlobalExndata::set([0, 0]); + ret +} + +/// An internal helper trait for usage in `#[wasm_bindgen]` on `async` +/// functions to convert the return value of the function to +/// `Result` which is what we'll return to JS (where an +/// error is a failed future). +pub trait IntoJsResult { + fn into_js_result(self) -> Result; +} + +impl IntoJsResult for () { + fn into_js_result(self) -> Result { + Ok(JsValue::undefined()) + } +} + +impl> IntoJsResult for T { + fn into_js_result(self) -> Result { + Ok(self.into()) + } +} + +impl, E: Into> IntoJsResult for Result { + fn into_js_result(self) -> Result { + match self { + Ok(e) => Ok(e.into()), + Err(e) => Err(e.into()), + } + } +} + +impl> IntoJsResult for Result<(), E> { + fn into_js_result(self) -> Result { + match self { + Ok(()) => Ok(JsValue::undefined()), + Err(e) => Err(e.into()), + } + } +} + +/// An internal helper trait for usage in `#[wasm_bindgen(start)]` +/// functions to throw the error (if it is `Err`). +pub trait Start { + fn start(self); +} + +impl Start for () { + #[inline] + fn start(self) {} +} + +impl> Start for Result<(), E> { + #[inline] + fn start(self) { + if let Err(e) = self { + crate::throw_val(e.into()); + } + } +} + +/// An internal helper struct for usage in `#[wasm_bindgen(main)]` +/// functions to throw the error (if it is `Err`). +pub struct MainWrapper(pub Option); + +pub trait Main { + fn __wasm_bindgen_main(&mut self); +} + +impl Main for &mut &mut MainWrapper<()> { + #[inline] + fn __wasm_bindgen_main(&mut self) {} +} + +impl Main for &mut &mut MainWrapper { + #[inline] + fn __wasm_bindgen_main(&mut self) {} +} + +impl> Main for &mut &mut MainWrapper> { + #[inline] + fn __wasm_bindgen_main(&mut self) { + if let Err(e) = self.0.take().unwrap() { + crate::throw_val(e.into()); + } + } +} + +impl Main for &mut MainWrapper> { + #[inline] + fn __wasm_bindgen_main(&mut self) { + if let Err(e) = self.0.take().unwrap() { + crate::throw_str(&alloc::format!("{:?}", e)); + } + } +} + +pub const fn flat_len(slices: [&[T]; SIZE]) -> usize { + let mut len = 0; + let mut i = 0; + while i < slices.len() { + len += slices[i].len(); + i += 1; + } + len +} + +pub const fn flat_byte_slices( + slices: [&[u8]; SIZE], +) -> [u8; RESULT_LEN] { + let mut result = [0; RESULT_LEN]; + + let mut slice_index = 0; + let mut result_offset = 0; + + while slice_index < slices.len() { + let mut i = 0; + let slice = slices[slice_index]; + while i < slice.len() { + result[result_offset] = slice[i]; + i += 1; + result_offset += 1; + } + slice_index += 1; + } + + result +} + +// NOTE: This method is used to encode u32 into a variable-length-integer during the compile-time . +// Generally speaking, the length of the encoded variable-length-integer depends on the size of the integer +// but the maximum capacity can be used here to simplify the amount of code during the compile-time . +pub const fn encode_u32_to_fixed_len_bytes(value: u32) -> [u8; 5] { + let mut result: [u8; 5] = [0; 5]; + let mut i = 0; + while i < 4 { + result[i] = ((value >> (7 * i)) | 0x80) as u8; + i += 1; + } + result[4] = (value >> (7 * 4)) as u8; + result +} + +/// Trait for element types to implement `Into` for vectors of +/// themselves, which isn't possible directly thanks to the orphan rule. +pub trait VectorIntoJsValue: Sized { + fn vector_into_jsvalue(vector: Box<[Self]>) -> JsValue; +} + +impl From> for JsValue { + fn from(vector: Box<[T]>) -> Self { + T::vector_into_jsvalue(vector) + } +} + +pub fn js_value_vector_into_jsvalue>(vector: Box<[T]>) -> JsValue { + let result = unsafe { JsValue::_new(super::__wbindgen_array_new()) }; + for value in vector.into_vec() { + let js: JsValue = value.into(); + unsafe { super::__wbindgen_array_push(result.idx, js.idx) } + // `__wbindgen_array_push` takes ownership over `js` and has already dropped it, + // so don't drop it again. + mem::forget(js); + } + result +} From 1291c006d38878e05805d205da87669e97c82459 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 8 Dec 2024 20:31:54 +0100 Subject: [PATCH 606/641] Document all features of `wasm-bindgen` (#4342) --- Cargo.toml | 4 ++-- src/lib.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5feb1d22705..6333bfb45b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,11 +32,11 @@ std = ["wasm-bindgen-macro/std", "once_cell/std"] # all unused attributes strict-macro = ["wasm-bindgen-macro/strict-macro"] -# Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers +# INTERNAL ONLY: Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers # are handled correctly gg-alloc = ["wasm-bindgen-test/gg-alloc"] -# This is only for debugging wasm-bindgen! No stability guarantees, so enable +# INTERNAL ONLY: This is only for debugging wasm-bindgen! No stability guarantees, so enable # this at your own peril! xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] diff --git a/src/lib.rs b/src/lib.rs index 19983c54bb4..5c22b11b462 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,39 @@ //! attribute and tool. Crates pull in the `#[wasm_bindgen]` attribute through //! this crate and this crate also provides JS bindings through the `JsValue` //! interface. +//! +//! ## Features +//! +//! ### `enable-interning` +//! +//! Enables the internal cache for [`wasm_bindgen::intern`]. +//! +//! This feature currently enables the `std` feature, meaning that it is not +//! compatible with `no_std` environments. +//! +//! ### `std` (default) +//! +//! Enabling this feature will make the crate depend on the Rust standard library. +//! +//! Disable this feature to use this crate in `no_std` environments. +//! +//! ### `strict-macro` +//! +//! All warnings the `#[wasm_bindgen]` macro emits are turned into hard errors. +//! This mainly affects unused attribute options. +//! +//! ### Deprecated features +//! +//! #### `serde-serialize` +//! +//! **Deprecated:** Use the [`serde-wasm-bindgen`](https://docs.rs/serde-wasm-bindgen/latest/serde_wasm_bindgen/) crate instead. +//! +//! Enables the `JsValue::from_serde` and `JsValue::into_serde` methods for +//! serializing and deserializing Rust types to and from JavaScript. +//! +//! #### `spans` +//! +//! **Deprecated:** This feature became a no-op in wasm-bindgen v0.2.20 (Sep 7, 2018). #![no_std] #![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] From b4d590372801f44436a5e5eeb0b15c68d3c6c5c0 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 8 Dec 2024 20:32:55 +0100 Subject: [PATCH 607/641] Deprecate the unused `spans` feature (#4341) --- Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 1 - crates/macro-support/Cargo.toml | 1 - crates/macro/Cargo.toml | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6333bfb45b1..2b4ac7f3f3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,10 @@ features = ["serde-serialize"] test = false [features] -default = ["spans", "std"] +default = ["std"] enable-interning = ["std"] serde-serialize = ["serde", "serde_json", "std"] -spans = ["wasm-bindgen-macro/spans"] +spans = [] std = ["wasm-bindgen-macro/std", "once_cell/std"] # Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 7a1eab7008c..04f9bcdc1e6 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -16,7 +16,6 @@ version = "0.2.99" [features] default = ["std"] extra-traits = ["syn/extra-traits"] -spans = [] std = [] [dependencies] diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index be26e0ea989..19978c98d41 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -16,7 +16,6 @@ version = "0.2.99" [features] default = ["std"] extra-traits = ["syn/extra-traits"] -spans = ["wasm-bindgen-backend/spans"] std = ["wasm-bindgen-backend/std"] strict-macro = [] diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 94ea6e92318..0c7cfcd0709 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -18,7 +18,6 @@ proc-macro = true [features] default = ["std"] -spans = ["wasm-bindgen-macro-support/spans"] std = ["wasm-bindgen-macro-support/std"] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] xxx_debug_only_print_generated_code = [] From af7c10664f3d6e90971e91800f7c9c807862db75 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 8 Dec 2024 20:33:35 +0100 Subject: [PATCH 608/641] Update `webpack` away from personal fork (#4344) --- examples/add/package.json | 2 +- examples/canvas/package.json | 2 +- examples/char/package.json | 2 +- examples/closures/package.json | 2 +- examples/console_log/package.json | 2 +- examples/dom/package.json | 2 +- examples/duck-typed-interfaces/package.json | 2 +- examples/fetch/package.json | 2 +- examples/guide-supported-types-examples/package.json | 2 +- examples/hello_world/package.json | 2 +- examples/import_js/package.json | 2 +- examples/julia_set/package.json | 2 +- examples/paint/package.json | 2 +- examples/performance/package.json | 2 +- examples/request-animation-frame/package.json | 2 +- examples/todomvc/package.json | 2 +- examples/wasm-in-wasm-imports/package.json | 2 +- examples/wasm-in-wasm/package.json | 2 +- examples/weather_report/package.json | 2 +- examples/webaudio/package.json | 2 +- examples/webgl/package.json | 2 +- examples/webrtc_datachannel/package.json | 2 +- examples/webxr/package.json | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/add/package.json b/examples/add/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/add/package.json +++ b/examples/add/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/canvas/package.json b/examples/canvas/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/canvas/package.json +++ b/examples/canvas/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/char/package.json b/examples/char/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/char/package.json +++ b/examples/char/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/closures/package.json b/examples/closures/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/closures/package.json +++ b/examples/closures/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/console_log/package.json b/examples/console_log/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/console_log/package.json +++ b/examples/console_log/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/dom/package.json b/examples/dom/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/dom/package.json +++ b/examples/dom/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/duck-typed-interfaces/package.json b/examples/duck-typed-interfaces/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/duck-typed-interfaces/package.json +++ b/examples/duck-typed-interfaces/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/fetch/package.json b/examples/fetch/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/fetch/package.json +++ b/examples/fetch/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/guide-supported-types-examples/package.json b/examples/guide-supported-types-examples/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/guide-supported-types-examples/package.json +++ b/examples/guide-supported-types-examples/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/hello_world/package.json b/examples/hello_world/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/hello_world/package.json +++ b/examples/hello_world/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/import_js/package.json b/examples/import_js/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/import_js/package.json +++ b/examples/import_js/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/julia_set/package.json b/examples/julia_set/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/julia_set/package.json +++ b/examples/julia_set/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/paint/package.json b/examples/paint/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/paint/package.json +++ b/examples/paint/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/performance/package.json b/examples/performance/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/performance/package.json +++ b/examples/performance/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/request-animation-frame/package.json b/examples/request-animation-frame/package.json index 5ba95165c46..a3e87a915d9 100644 --- a/examples/request-animation-frame/package.json +++ b/examples/request-animation-frame/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^3.11.3" } diff --git a/examples/todomvc/package.json b/examples/todomvc/package.json index a40f0b4067b..cd0bb0231c0 100644 --- a/examples/todomvc/package.json +++ b/examples/todomvc/package.json @@ -8,7 +8,7 @@ "css-loader": "^6.11.0", "html-webpack-plugin": "^5.6.0", "mini-css-extract-plugin": "^2.9.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/wasm-in-wasm-imports/package.json b/examples/wasm-in-wasm-imports/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/wasm-in-wasm-imports/package.json +++ b/examples/wasm-in-wasm-imports/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/wasm-in-wasm/package.json b/examples/wasm-in-wasm/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/wasm-in-wasm/package.json +++ b/examples/wasm-in-wasm/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/weather_report/package.json b/examples/weather_report/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/weather_report/package.json +++ b/examples/weather_report/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webaudio/package.json b/examples/webaudio/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/webaudio/package.json +++ b/examples/webaudio/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webgl/package.json b/examples/webgl/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/webgl/package.json +++ b/examples/webgl/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webrtc_datachannel/package.json b/examples/webrtc_datachannel/package.json index f3e0ededa22..e03f99448ca 100644 --- a/examples/webrtc_datachannel/package.json +++ b/examples/webrtc_datachannel/package.json @@ -6,7 +6,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } diff --git a/examples/webxr/package.json b/examples/webxr/package.json index ce2bf74b4f9..71034285bff 100644 --- a/examples/webxr/package.json +++ b/examples/webxr/package.json @@ -9,7 +9,7 @@ "devDependencies": { "@wasm-tool/wasm-pack-plugin": "1.5.0", "html-webpack-plugin": "^5.6.0", - "webpack": "github:daxpedda/webpack#externref", + "webpack": "^5.97.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" } From 83a2ff45f1e1e78154117a1b15d35c4ec7002d33 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 9 Dec 2024 01:02:59 +0100 Subject: [PATCH 609/641] Make `getter`s, `setter`s, and `constructor`s compiler errors for enums (#4278) --- .github/workflows/main.yml | 6 +- CHANGELOG.md | 3 + Cargo.toml | 10 +- crates/backend/src/codegen.rs | 48 +++++++++- crates/macro/ui-tests/async-errors.stderr | 2 +- crates/macro/ui-tests/main-debug.rs | 2 +- crates/macro/ui-tests/main-infallible.stderr | 17 ++++ crates/macro/ui-tests/missing-catch.stderr | 35 +++++++ .../ui-tests/traits-not-implemented.stderr | 38 ++++++++ crates/macro/ui-tests/unsupported-options.rs | 82 ++++++++++++++++ .../macro/ui-tests/unsupported-options.stderr | 95 +++++++++++++++++++ crates/msrv/lib/Cargo.toml | 9 +- crates/msrv/resolver/Cargo.toml | 9 +- src/lib.rs | 16 +++- src/rt/marker.rs | 47 +++++++++ src/{rt.rs => rt/mod.rs} | 2 + 16 files changed, 406 insertions(+), 15 deletions(-) create mode 100644 crates/macro/ui-tests/unsupported-options.rs create mode 100644 crates/macro/ui-tests/unsupported-options.stderr create mode 100644 src/rt/marker.rs rename src/{rt.rs => rt/mod.rs} (99%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6909d10dd08..c477743eba8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -342,7 +342,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: rustup update --no-self-update 1.76.0 && rustup default 1.76.0 + - run: rustup update --no-self-update 1.78.0 && rustup default 1.78.0 - run: cargo test -p wasm-bindgen-macro - run: cargo test -p wasm-bindgen-test-macro @@ -569,6 +569,8 @@ jobs: - wasm32-unknown-unknown features: - --no-default-features + - --no-default-features --features std + - --no-default-features --features msrv - "" defaults: run: @@ -594,6 +596,8 @@ jobs: - wasm32-unknown-unknown features: - --no-default-features + - --no-default-features --features std + - --no-default-features --features msrv - "" defaults: run: diff --git a/CHANGELOG.md b/CHANGELOG.md index 17a86bbfdbd..95b8f96cbfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. [#4188](https://github.com/rustwasm/wasm-bindgen/pull/4188) +* Adding `getter`, `setter`, and `constructor` methods to enums now results in a compiler error. This was previously erroneously allowed and resulted in invalid JS code gen. + [#4278](https://github.com/rustwasm/wasm-bindgen/pull/4278) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. diff --git a/Cargo.toml b/Cargo.toml index 2b4ac7f3f3d..5956facd64a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,12 +22,19 @@ features = ["serde-serialize"] test = false [features] -default = ["std"] +default = ["std", "msrv"] enable-interning = ["std"] serde-serialize = ["serde", "serde_json", "std"] spans = [] std = ["wasm-bindgen-macro/std", "once_cell/std"] +# Opt-in for Rust language features that require a higher MSRV. +# +# The current rustc version is detected at compile-time, so enabling this +# feature for older compilers will NOT result in a compilation error. Instead, +# any unsupported language feature will not be used. +msrv = ["rustversion"] + # Whether or not the `#[wasm_bindgen]` macro is strict and generates an error on # all unused attributes strict-macro = ["wasm-bindgen-macro/strict-macro"] @@ -43,6 +50,7 @@ xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_ [dependencies] cfg-if = "1.0.0" once_cell = { version = "1.12", default-features = false } +rustversion = { version = "1.0", optional = true } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99", default-features = false } diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 23599fc87b0..63b9376e35d 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -224,6 +224,13 @@ impl ToTokens for ast::Struct { let unwrap_fn = Ident::new(&shared::unwrap_function(&name_str), Span::call_site()); let wasm_bindgen = &self.wasm_bindgen; (quote! { + #[automatically_derived] + impl #wasm_bindgen::__rt::marker::SupportsConstructor for #name {} + #[automatically_derived] + impl #wasm_bindgen::__rt::marker::SupportsInstanceProperty for #name {} + #[automatically_derived] + impl #wasm_bindgen::__rt::marker::SupportsStaticProperty for #name {} + #[automatically_derived] impl #wasm_bindgen::describe::WasmDescribe for #name { fn describe() { @@ -782,12 +789,41 @@ impl TryToTokens for ast::Export { let nargs = self.function.arguments.len() as u32; let attrs = &self.function.rust_attrs; - let start_check = if self.start { - quote! { const _ASSERT: fn() = || -> #projection::Abi { loop {} }; } - } else { - quote! {} + let mut checks = Vec::new(); + if self.start { + checks.push(quote! { const _ASSERT: fn() = || -> #projection::Abi { loop {} }; }); }; + if let Some(class) = self.rust_class.as_ref() { + // little helper function to make sure the check points to the + // location of the function causing the assert to fail + let mut add_check = |token_stream| { + checks.push(respan(token_stream, &self.rust_name)); + }; + + match &self.method_kind { + ast::MethodKind::Constructor => { + add_check(quote! { + let _: #wasm_bindgen::__rt::marker::CheckSupportsConstructor<#class>; + }); + } + ast::MethodKind::Operation(operation) => match operation.kind { + ast::OperationKind::Getter(_) | ast::OperationKind::Setter(_) => { + if operation.is_static { + add_check(quote! { + let _: #wasm_bindgen::__rt::marker::CheckSupportsStaticProperty<#class>; + }); + } else { + add_check(quote! { + let _: #wasm_bindgen::__rt::marker::CheckSupportsInstanceProperty<#class>; + }); + } + } + _ => {} + }, + } + } + (quote! { #[automatically_derived] const _: () = { @@ -798,7 +834,9 @@ impl TryToTokens for ast::Export { export_name = #export_name, )] pub unsafe extern "C" fn #generated_name(#(#args),*) -> #wasm_bindgen::convert::WasmRet<#projection::Abi> { - #start_check + const _: () = { + #(#checks)* + }; let #ret = #call; #convert_ret diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index 5526851f1d3..a13c8fceac8 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -22,7 +22,7 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not sati --> ui-tests/async-errors.rs:35:24 | 35 | pub async fn bad3() -> BadType { loop {} } - | ^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue` + | ^^^^^^^ the trait `From` is not implemented for `wasm_bindgen::JsValue`, which is required by `BadType: IntoJsResult` | = help: the following other types implement trait `From`: > diff --git a/crates/macro/ui-tests/main-debug.rs b/crates/macro/ui-tests/main-debug.rs index 2fc9aa7ca6a..ba163e4cf18 100644 --- a/crates/macro/ui-tests/main-debug.rs +++ b/crates/macro/ui-tests/main-debug.rs @@ -9,7 +9,7 @@ fn main() -> Result<(), Test> { struct Test; impl fmt::Debug for Test { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { unimplemented!() } } diff --git a/crates/macro/ui-tests/main-infallible.stderr b/crates/macro/ui-tests/main-infallible.stderr index fd8c9c99769..4487bdcfcf6 100644 --- a/crates/macro/ui-tests/main-infallible.stderr +++ b/crates/macro/ui-tests/main-infallible.stderr @@ -3,3 +3,20 @@ error: the main function has to be called main | 10 | fn fail() {} | ^^^^ + +warning: unreachable expression + --> ui-tests/main-infallible.rs:4:1 + | +4 | #[wasm_bindgen(main)] + | ^^^^^^^^^^^^^^^^^^^^^ + | | + | unreachable expression + | any code following this expression is unreachable + | +note: this expression has type `Infallible`, which is uninhabited + --> ui-tests/main-infallible.rs:4:1 + | +4 | #[wasm_bindgen(main)] + | ^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(unreachable_code)]` on by default + = note: this warning originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/missing-catch.stderr b/crates/macro/ui-tests/missing-catch.stderr index 4fc6b3ed6de..b420b787da7 100644 --- a/crates/macro/ui-tests/missing-catch.stderr +++ b/crates/macro/ui-tests/missing-catch.stderr @@ -18,3 +18,38 @@ error[E0277]: the trait bound `Result: FromWasmAbi` is not satisfied + --> ui-tests/missing-catch.rs:3:1 + | +3 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ the trait `FromWasmAbi` is not implemented for `Result` + | + = help: the following other types implement trait `FromWasmAbi`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and $N others + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Result: FromWasmAbi` is not satisfied + --> ui-tests/missing-catch.rs:6:18 + | +6 | pub fn foo() -> Result; + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromWasmAbi` is not implemented for `Result` + | + = help: the following other types implement trait `FromWasmAbi`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and $N others diff --git a/crates/macro/ui-tests/traits-not-implemented.stderr b/crates/macro/ui-tests/traits-not-implemented.stderr index 82aeb56b6fe..2f7e9887747 100644 --- a/crates/macro/ui-tests/traits-not-implemented.stderr +++ b/crates/macro/ui-tests/traits-not-implemented.stderr @@ -15,3 +15,41 @@ error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied i128 and $N others = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied + --> ui-tests/traits-not-implemented.rs:8:19 + | +8 | pub fn foo(a: A); + | ^ the trait `IntoWasmAbi` is not implemented for `A` + | + = help: the following other types implement trait `IntoWasmAbi`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and $N others + +error[E0277]: the trait bound `A: IntoWasmAbi` is not satisfied + --> ui-tests/traits-not-implemented.rs:8:12 + | +5 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +8 | pub fn foo(a: A); + | ^^^ the trait `IntoWasmAbi` is not implemented for `A` + | + = help: the following other types implement trait `IntoWasmAbi`: + bool + char + isize + i8 + i16 + i32 + i64 + i128 + and $N others + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/unsupported-options.rs b/crates/macro/ui-tests/unsupported-options.rs new file mode 100644 index 00000000000..1589027f30c --- /dev/null +++ b/crates/macro/ui-tests/unsupported-options.rs @@ -0,0 +1,82 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct RustStruct { + data: u32, +} + +#[wasm_bindgen] +impl RustStruct { + pub fn instance_method(&self) {} + fn priv_instance_method(&self) {} + pub fn static_method() {} + + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self { data: 0 } + } + + #[wasm_bindgen(getter)] + pub fn prop(self) -> u32 { + 32 + } + #[wasm_bindgen(setter)] + pub fn set_prop(self, _value: u32) {} + + #[wasm_bindgen(getter)] + pub fn static_prop() -> u32 { + 32 + } + #[wasm_bindgen(setter)] + pub fn set_static_prop(_value: u32) {} + + #[wasm_bindgen(indexing_getter)] + pub fn indexing_getter(self) -> u32 { + 32 + } + #[wasm_bindgen(indexing_setter)] + pub fn indexing_setter(self, _value: u32) {} + #[wasm_bindgen(indexing_deleter)] + pub fn indexing_deleter(self, _value: u32) {} +} + +#[wasm_bindgen] +pub enum RustEnum { + A = 0, + B = 1, +} + +#[wasm_bindgen] +impl RustEnum { + pub fn instance_method(self) {} + fn priv_instance_method(self) {} + pub fn static_method() {} + + #[wasm_bindgen(constructor)] + pub fn new() -> Self { + Self::A + } + + #[wasm_bindgen(getter)] + pub fn prop(self) -> u32 { + 32 + } + #[wasm_bindgen(setter)] + pub fn set_prop(self, _value: u32) {} + + #[wasm_bindgen(getter)] + pub fn static_prop() -> u32 { + 32 + } + #[wasm_bindgen(setter)] + pub fn set_static_prop(_value: u32) {} +} + +pub struct NonWasmType; + +#[wasm_bindgen] +impl NonWasmType { + pub fn static_method() {} +} + +fn main() {} diff --git a/crates/macro/ui-tests/unsupported-options.stderr b/crates/macro/ui-tests/unsupported-options.stderr new file mode 100644 index 00000000000..7a6dcd70537 --- /dev/null +++ b/crates/macro/ui-tests/unsupported-options.stderr @@ -0,0 +1,95 @@ +error[E0277]: JavaScript constructors are not supported for `RustEnum` + --> ui-tests/unsupported-options.rs:56:12 + | +49 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +56 | pub fn new() -> Self { + | ^^^ this function cannot be the constructor of `RustEnum` + | + = help: the trait `SupportsConstructor` is not implemented for `RustEnum` + = note: `#[wasm_bindgen(constructor)]` is only supported for `struct`s and cannot be used for `enum`s. + = note: Consider removing the `constructor` option and using a regular static method instead. + = help: the trait `SupportsConstructor` is implemented for `RustStruct` +note: required by a bound in `CheckSupportsConstructor` + --> $WORKSPACE/src/rt/marker.rs + | + | pub struct CheckSupportsConstructor(T); + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `CheckSupportsConstructor` + = note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` which comes from the expansion of the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: JavaScript instance getters and setters are not supported for `RustEnum` + --> ui-tests/unsupported-options.rs:61:12 + | +49 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +61 | pub fn prop(self) -> u32 { + | ^^^^ this method cannot be a getter or setter for `RustEnum` + | + = help: the trait `SupportsInstanceProperty` is not implemented for `RustEnum` + = note: `#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s. + = help: the trait `SupportsInstanceProperty` is implemented for `RustStruct` +note: required by a bound in `CheckSupportsInstanceProperty` + --> $WORKSPACE/src/rt/marker.rs + | + | pub struct CheckSupportsInstanceProperty(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CheckSupportsInstanceProperty` + = note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` which comes from the expansion of the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: JavaScript instance getters and setters are not supported for `RustEnum` + --> ui-tests/unsupported-options.rs:65:12 + | +49 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +65 | pub fn set_prop(self, _value: u32) {} + | ^^^^^^^^ this method cannot be a getter or setter for `RustEnum` + | + = help: the trait `SupportsInstanceProperty` is not implemented for `RustEnum` + = note: `#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s. + = help: the trait `SupportsInstanceProperty` is implemented for `RustStruct` +note: required by a bound in `CheckSupportsInstanceProperty` + --> $WORKSPACE/src/rt/marker.rs + | + | pub struct CheckSupportsInstanceProperty(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CheckSupportsInstanceProperty` + = note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` which comes from the expansion of the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: JavaScript static getters and setters are not supported for `RustEnum` + --> ui-tests/unsupported-options.rs:68:12 + | +49 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +68 | pub fn static_prop() -> u32 { + | ^^^^^^^^^^^ this static function cannot be a static getter or setter on `RustEnum` + | + = help: the trait `SupportsStaticProperty` is not implemented for `RustEnum` + = note: `#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s. + = help: the trait `SupportsStaticProperty` is implemented for `RustStruct` +note: required by a bound in `CheckSupportsStaticProperty` + --> $WORKSPACE/src/rt/marker.rs + | + | pub struct CheckSupportsStaticProperty(T); + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CheckSupportsStaticProperty` + = note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` which comes from the expansion of the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: JavaScript static getters and setters are not supported for `RustEnum` + --> ui-tests/unsupported-options.rs:72:12 + | +49 | #[wasm_bindgen] + | --------------- in this procedural macro expansion +... +72 | pub fn set_static_prop(_value: u32) {} + | ^^^^^^^^^^^^^^^ this static function cannot be a static getter or setter on `RustEnum` + | + = help: the trait `SupportsStaticProperty` is not implemented for `RustEnum` + = note: `#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s. + = help: the trait `SupportsStaticProperty` is implemented for `RustStruct` +note: required by a bound in `CheckSupportsStaticProperty` + --> $WORKSPACE/src/rt/marker.rs + | + | pub struct CheckSupportsStaticProperty(T); + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `CheckSupportsStaticProperty` + = note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` which comes from the expansion of the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index 7cf0a5d4bb5..98e95deff10 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -5,7 +5,14 @@ publish = false version = "0.0.0" [features] -default = ["std"] +default = [ + "wasm-bindgen/default", + "js-sys/default", + "wasm-bindgen-futures/default", + "web-sys/default", + "wasm-bindgen-test/default", +] +msrv = ["wasm-bindgen/msrv"] std = [ "wasm-bindgen/std", "js-sys/std", diff --git a/crates/msrv/resolver/Cargo.toml b/crates/msrv/resolver/Cargo.toml index 6c7eeffbfc5..842ce86ec82 100644 --- a/crates/msrv/resolver/Cargo.toml +++ b/crates/msrv/resolver/Cargo.toml @@ -6,7 +6,14 @@ resolver = "1" version = "0.0.0" [features] -default = ["std"] +default = [ + "wasm-bindgen/default", + "js-sys/default", + "wasm-bindgen-futures/default", + "web-sys/default", + "wasm-bindgen-test/default", +] +msrv = ["wasm-bindgen/msrv"] std = [ "wasm-bindgen/std", "js-sys/std", diff --git a/src/lib.rs b/src/lib.rs index 5c22b11b462..810197c3072 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,14 @@ //! This feature currently enables the `std` feature, meaning that it is not //! compatible with `no_std` environments. //! +//! ### `msrv` (default) +//! +//! Enables Rust language features that require a higher MSRV. Enabling this +//! feature on older compilers will NOT result in a compilation error, the newer +//! language features will simply not be used. +//! +//! When compiling with Rust v1.78 or later, this feature enables better error messages for invalid methods on structs and enums. +//! //! ### `std` (default) //! //! Enabling this feature will make the crate depend on the Rust standard library. @@ -60,7 +68,7 @@ use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use core::convert::TryFrom; -use core::marker; +use core::marker::PhantomData; use core::mem; use core::ops::{ Add, BitAnd, BitOr, BitXor, Deref, DerefMut, Div, Mul, Neg, Not, Rem, Shl, Shr, Sub, @@ -129,7 +137,7 @@ if_std! { } #[doc(hidden)] -#[path = "rt.rs"] +#[path = "rt/mod.rs"] pub mod __rt; /// Representation of an object owned by JS. @@ -140,7 +148,7 @@ pub mod __rt; /// but for now it may be slightly slow. pub struct JsValue { idx: u32, - _marker: marker::PhantomData<*mut u8>, // not at all threadsafe + _marker: PhantomData<*mut u8>, // not at all threadsafe } const JSIDX_OFFSET: u32 = 128; // keep in sync with js/mod.rs @@ -167,7 +175,7 @@ impl JsValue { const fn _new(idx: u32) -> JsValue { JsValue { idx, - _marker: marker::PhantomData, + _marker: PhantomData, } } diff --git a/src/rt/marker.rs b/src/rt/marker.rs new file mode 100644 index 00000000000..8d4641b6772 --- /dev/null +++ b/src/rt/marker.rs @@ -0,0 +1,47 @@ +/// Marker trait for types that support `#[wasm_bindgen(constructor)]`. +#[cfg_attr( + feature = "msrv", + rustversion::attr( + since(1.78), + diagnostic::on_unimplemented( + message = "JavaScript constructors are not supported for `{Self}`", + label = "this function cannot be the constructor of `{Self}`", + note = "`#[wasm_bindgen(constructor)]` is only supported for `struct`s and cannot be used for `enum`s.", + note = "Consider removing the `constructor` option and using a regular static method instead." + ) + ) +)] +pub trait SupportsConstructor {} +pub struct CheckSupportsConstructor(T); + +/// Marker trait for types that support `#[wasm_bindgen(getter)]` or +/// `#[wasm_bindgen(Setter)]` on instance methods. +#[cfg_attr( + feature = "msrv", + rustversion::attr( + since(1.78), + diagnostic::on_unimplemented( + message = "JavaScript instance getters and setters are not supported for `{Self}`", + label = "this method cannot be a getter or setter for `{Self}`", + note = "`#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s.", + ) + ) +)] +pub trait SupportsInstanceProperty {} +pub struct CheckSupportsInstanceProperty(T); + +/// Marker trait for types that support `#[wasm_bindgen(getter)]` or +/// `#[wasm_bindgen(Setter)]` on static methods. +#[cfg_attr( + feature = "msrv", + rustversion::attr( + since(1.78), + diagnostic::on_unimplemented( + message = "JavaScript static getters and setters are not supported for `{Self}`", + label = "this static function cannot be a static getter or setter on `{Self}`", + note = "`#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s.", + ) + ) +)] +pub trait SupportsStaticProperty {} +pub struct CheckSupportsStaticProperty(T); diff --git a/src/rt.rs b/src/rt/mod.rs similarity index 99% rename from src/rt.rs rename to src/rt/mod.rs index 2aac5ce3a41..82e97f691f5 100644 --- a/src/rt.rs +++ b/src/rt/mod.rs @@ -16,6 +16,8 @@ use alloc::alloc::{alloc, dealloc, realloc, Layout}; use alloc::boxed::Box; use alloc::rc::Rc; +pub mod marker; + /// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with /// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. #[cfg(not(feature = "std"))] From f1e2d6eb908649f19bf3a1612a5c87d31f2ed096 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 9 Dec 2024 15:26:11 +0100 Subject: [PATCH 610/641] Better TS type formatting for array types (#4346) --- crates/cli-support/src/descriptor.rs | 8 +- crates/cli-support/src/js/identifier.rs | 42 ++++++++++ crates/cli-support/src/js/mod.rs | 44 +--------- crates/cli/tests/reference/echo.d.ts | 8 +- crates/cli/tests/reference/echo.js | 16 ++-- .../cli/tests/reference/typescript-type.d.ts | 4 + crates/cli/tests/reference/typescript-type.js | 82 +++++++++++++++++++ crates/cli/tests/reference/typescript-type.rs | 13 +++ .../cli/tests/reference/typescript-type.wat | 23 ++++++ 9 files changed, 185 insertions(+), 55 deletions(-) create mode 100644 crates/cli-support/src/js/identifier.rs create mode 100644 crates/cli/tests/reference/typescript-type.d.ts create mode 100644 crates/cli/tests/reference/typescript-type.js create mode 100644 crates/cli/tests/reference/typescript-type.rs create mode 100644 crates/cli/tests/reference/typescript-type.wat diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index d1b129ed77a..d9b7fd63eab 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -1,5 +1,7 @@ use std::char; +use crate::js::identifier::is_valid_ident; + macro_rules! tys { ($($a:ident)*) => (tys! { @ ($($a)*) 0 }); (@ () $v:expr) => {}; @@ -306,7 +308,11 @@ impl VectorKind { VectorKind::F64 => "Float64Array".to_string(), VectorKind::Externref => "any[]".to_string(), VectorKind::NamedExternref(ref name) => { - format!("({})[]", name) + if is_valid_ident(name.as_str()) { + format!("{}[]", name) + } else { + format!("({})[]", name) + } } } } diff --git a/crates/cli-support/src/js/identifier.rs b/crates/cli-support/src/js/identifier.rs new file mode 100644 index 00000000000..51ebcc81f58 --- /dev/null +++ b/crates/cli-support/src/js/identifier.rs @@ -0,0 +1,42 @@ +/// Returns whether a character has the Unicode `ID_Start` properly. +/// +/// This is only ever-so-slightly different from `XID_Start` in a few edge +/// cases, so we handle those edge cases manually and delegate everything else +/// to `unicode-ident`. +fn is_id_start(c: char) -> bool { + match c { + '\u{037A}' | '\u{0E33}' | '\u{0EB3}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' + | '\u{FC5F}' | '\u{FC60}' | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' + | '\u{FDFB}' | '\u{FE70}' | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' + | '\u{FE7A}' | '\u{FE7C}' | '\u{FE7E}' | '\u{FF9E}' | '\u{FF9F}' => true, + _ => unicode_ident::is_xid_start(c), + } +} + +/// Returns whether a character has the Unicode `ID_Continue` properly. +/// +/// This is only ever-so-slightly different from `XID_Continue` in a few edge +/// cases, so we handle those edge cases manually and delegate everything else +/// to `unicode-ident`. +fn is_id_continue(c: char) -> bool { + match c { + '\u{037A}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' | '\u{FC5F}' | '\u{FC60}' + | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' | '\u{FDFB}' | '\u{FE70}' + | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' | '\u{FE7A}' | '\u{FE7C}' + | '\u{FE7E}' => true, + _ => unicode_ident::is_xid_continue(c), + } +} + +/// Returns whether a string is a valid JavaScript identifier. +/// Defined at https://tc39.es/ecma262/#prod-IdentifierName. +pub fn is_valid_ident(name: &str) -> bool { + !name.is_empty() + && name.chars().enumerate().all(|(i, char)| { + if i == 0 { + is_id_start(char) || char == '$' || char == '_' + } else { + is_id_continue(char) || char == '$' || char == '\u{200C}' || char == '\u{200D}' + } + }) +} diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 9cdd2d7ddb0..a650ab76772 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -10,6 +10,7 @@ use crate::wit::{JsImport, JsImportName, NonstandardWitSection, WasmBindgenAux}; use crate::{reset_indentation, Bindgen, EncodeInto, OutputMode, PLACEHOLDER_MODULE}; use anyhow::{anyhow, bail, Context as _, Error}; use binding::TsReference; +use identifier::is_valid_ident; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::fmt; @@ -19,6 +20,7 @@ use std::path::{Path, PathBuf}; use walrus::{FunctionId, ImportId, MemoryId, Module, TableId, ValType}; mod binding; +pub mod identifier; pub struct Context<'a> { globals: String, @@ -4535,48 +4537,6 @@ fn require_class<'a>( .or_default() } -/// Returns whether a character has the Unicode `ID_Start` properly. -/// -/// This is only ever-so-slightly different from `XID_Start` in a few edge -/// cases, so we handle those edge cases manually and delegate everything else -/// to `unicode-ident`. -fn is_id_start(c: char) -> bool { - match c { - '\u{037A}' | '\u{0E33}' | '\u{0EB3}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' - | '\u{FC5F}' | '\u{FC60}' | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' - | '\u{FDFB}' | '\u{FE70}' | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' - | '\u{FE7A}' | '\u{FE7C}' | '\u{FE7E}' | '\u{FF9E}' | '\u{FF9F}' => true, - _ => unicode_ident::is_xid_start(c), - } -} - -/// Returns whether a character has the Unicode `ID_Continue` properly. -/// -/// This is only ever-so-slightly different from `XID_Continue` in a few edge -/// cases, so we handle those edge cases manually and delegate everything else -/// to `unicode-ident`. -fn is_id_continue(c: char) -> bool { - match c { - '\u{037A}' | '\u{309B}' | '\u{309C}' | '\u{FC5E}' | '\u{FC5F}' | '\u{FC60}' - | '\u{FC61}' | '\u{FC62}' | '\u{FC63}' | '\u{FDFA}' | '\u{FDFB}' | '\u{FE70}' - | '\u{FE72}' | '\u{FE74}' | '\u{FE76}' | '\u{FE78}' | '\u{FE7A}' | '\u{FE7C}' - | '\u{FE7E}' => true, - _ => unicode_ident::is_xid_continue(c), - } -} - -/// Returns whether a string is a valid JavaScript identifier. -/// Defined at https://tc39.es/ecma262/#prod-IdentifierName. -fn is_valid_ident(name: &str) -> bool { - name.chars().enumerate().all(|(i, char)| { - if i == 0 { - is_id_start(char) || char == '$' || char == '_' - } else { - is_id_continue(char) || char == '$' || char == '\u{200C}' || char == '\u{200D}' - } - }) -} - /// Returns a string to tack on to the end of an expression to access a /// property named `name` of the object that expression resolves to. /// diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts index 61fd4a7925e..5183992234d 100644 --- a/crates/cli/tests/reference/echo.d.ts +++ b/crates/cli/tests/reference/echo.d.ts @@ -33,9 +33,9 @@ export function echo_vec_uninit_u32(a: Uint32Array): Uint32Array; export function echo_vec_uninit_i32(a: Int32Array): Int32Array; export function echo_vec_uninit_u64(a: BigUint64Array): BigUint64Array; export function echo_vec_uninit_i64(a: BigInt64Array): BigInt64Array; -export function echo_vec_string(a: (string)[]): (string)[]; +export function echo_vec_string(a: string[]): string[]; export function echo_struct(a: Foo): Foo; -export function echo_vec_struct(a: (Foo)[]): (Foo)[]; +export function echo_vec_struct(a: Foo[]): Foo[]; export function echo_option_u8(a?: number | null): number | undefined; export function echo_option_i8(a?: number | null): number | undefined; export function echo_option_u16(a?: number | null): number | undefined; @@ -69,9 +69,9 @@ export function echo_option_vec_uninit_u32(a?: Uint32Array | null): Uint32Array export function echo_option_vec_uninit_i32(a?: Int32Array | null): Int32Array | undefined; export function echo_option_vec_uninit_u64(a?: BigUint64Array | null): BigUint64Array | undefined; export function echo_option_vec_uninit_i64(a?: BigInt64Array | null): BigInt64Array | undefined; -export function echo_option_vec_string(a?: (string)[] | null): (string)[] | undefined; +export function echo_option_vec_string(a?: string[] | null): string[] | undefined; export function echo_option_struct(a?: Foo | null): Foo | undefined; -export function echo_option_vec_struct(a?: (Foo)[] | null): (Foo)[] | undefined; +export function echo_option_vec_struct(a?: Foo[] | null): Foo[] | undefined; export class Foo { private constructor(); free(): void; diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js index c3e9c47f835..b48c5e346e6 100644 --- a/crates/cli/tests/reference/echo.js +++ b/crates/cli/tests/reference/echo.js @@ -685,8 +685,8 @@ function getArrayJsValueFromWasm0(ptr, len) { return result; } /** - * @param {(string)[]} a - * @returns {(string)[]} + * @param {string[]} a + * @returns {string[]} */ export function echo_vec_string(a) { const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); @@ -714,8 +714,8 @@ export function echo_struct(a) { } /** - * @param {(Foo)[]} a - * @returns {(Foo)[]} + * @param {Foo[]} a + * @returns {Foo[]} */ export function echo_vec_struct(a) { const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); @@ -1145,8 +1145,8 @@ export function echo_option_vec_uninit_i64(a) { } /** - * @param {(string)[] | null} [a] - * @returns {(string)[] | undefined} + * @param {string[] | null} [a] + * @returns {string[] | undefined} */ export function echo_option_vec_string(a) { var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); @@ -1175,8 +1175,8 @@ export function echo_option_struct(a) { } /** - * @param {(Foo)[] | null} [a] - * @returns {(Foo)[] | undefined} + * @param {Foo[] | null} [a] + * @returns {Foo[] | undefined} */ export function echo_option_vec_struct(a) { var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); diff --git a/crates/cli/tests/reference/typescript-type.d.ts b/crates/cli/tests/reference/typescript-type.d.ts new file mode 100644 index 00000000000..fa398def952 --- /dev/null +++ b/crates/cli/tests/reference/typescript-type.d.ts @@ -0,0 +1,4 @@ +/* tslint:disable */ +/* eslint-disable */ +export function single(a: number | string): void; +export function slice(a: (number | string)[]): void; diff --git a/crates/cli/tests/reference/typescript-type.js b/crates/cli/tests/reference/typescript-type.js new file mode 100644 index 00000000000..c69ecd4a682 --- /dev/null +++ b/crates/cli/tests/reference/typescript-type.js @@ -0,0 +1,82 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} +/** + * @param {number | string} a + */ +export function single(a) { + wasm.single(a); +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +let WASM_VECTOR_LEN = 0; + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_0.set(idx, obj); + return idx; +} + +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i = 0; i < array.length; i++) { + mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} +/** + * @param {(number | string)[]} a + */ +export function slice(a) { + const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + wasm.slice(ptr0, len0); +} + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/typescript-type.rs b/crates/cli/tests/reference/typescript-type.rs new file mode 100644 index 00000000000..2f8b4810947 --- /dev/null +++ b/crates/cli/tests/reference/typescript-type.rs @@ -0,0 +1,13 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(typescript_type = "number | string")] + type CustomType; +} + +#[wasm_bindgen] +pub fn single(a: CustomType) {} + +#[wasm_bindgen] +pub fn slice(a: Vec) {} diff --git a/crates/cli/tests/reference/typescript-type.wat b/crates/cli/tests/reference/typescript-type.wat new file mode 100644 index 00000000000..9327a22ef7b --- /dev/null +++ b/crates/cli/tests/reference/typescript-type.wat @@ -0,0 +1,23 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param externref))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_malloc (;1;) (type 3) (param i32 i32) (result i32)) + (func $slice (;2;) (type 2) (param i32 i32)) + (func $__externref_table_alloc (;3;) (type 1) (result i32)) + (func $"single externref shim" (;4;) (type 4) (param externref)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "single" (func $"single externref shim")) + (export "slice" (func $slice)) + (export "__wbindgen_export_0" (table 0)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + From 8fa299f37ae1078db8dbc24ce79f5f071883c87f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 9 Dec 2024 17:15:59 +0100 Subject: [PATCH 611/641] Simplify `no_std` implementation (#4347) --- .github/workflows/main.yml | 1 - Cargo.toml | 5 +- crates/backend/Cargo.toml | 2 - crates/backend/src/codegen.rs | 14 +- .../tests/reference/anyref-import-catch.wat | 4 +- crates/cli/tests/reference/echo.wat | 94 +++++++------- crates/cli/tests/reference/import.wat | 4 +- crates/cli/tests/reference/static.wat | 4 +- crates/futures/Cargo.toml | 2 +- crates/futures/src/lib.rs | 5 +- crates/futures/src/queue.rs | 10 -- .../futures/src/task/wait_async_polyfill.rs | 42 ++---- crates/js-sys/src/lib.rs | 31 ++--- crates/macro-support/Cargo.toml | 4 +- crates/macro/Cargo.toml | 4 +- crates/msrv/lib/Cargo.toml | 1 - crates/test/Cargo.toml | 3 +- crates/test/src/lib.rs | 2 - crates/test/src/rt/mod.rs | 1 - src/cache/intern.rs | 3 - src/externref.rs | 3 - src/lib.rs | 65 +++------- src/rt/mod.rs | 122 +++++------------- 23 files changed, 136 insertions(+), 290 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c477743eba8..d887cc699b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -582,7 +582,6 @@ jobs: run: | cargo update -p bumpalo --precise 3.12.0 cargo update -p log --precise 0.4.18 - cargo update -p scoped-tls --precise 1.0.0 - run: cargo build --target ${{ matrix.target }} ${{ matrix.features }} msrv-lib: diff --git a/Cargo.toml b/Cargo.toml index 5956facd64a..57536ab1ce9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ default = ["std", "msrv"] enable-interning = ["std"] serde-serialize = ["serde", "serde_json", "std"] spans = [] -std = ["wasm-bindgen-macro/std", "once_cell/std"] +std = [] # Opt-in for Rust language features that require a higher MSRV. # @@ -53,9 +53,10 @@ once_cell = { version = "1.12", default-features = false } rustversion = { version = "1.0", optional = true } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99", default-features = false } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99" } [dev-dependencies] +once_cell = "1" wasm-bindgen-test = { path = 'crates/test' } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 04f9bcdc1e6..ab964ab8ec1 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -14,9 +14,7 @@ rust-version = "1.57" version = "0.2.99" [features] -default = ["std"] extra-traits = ["syn/extra-traits"] -std = [] [dependencies] bumpalo = "3.0.0" diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 63b9376e35d..c8decb4a136 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1803,24 +1803,12 @@ fn thread_local_import( } }, ast::ThreadLocal::V2 => { - #[cfg(feature = "std")] - let inner = quote! { - #wasm_bindgen::__rt::std::thread_local!(static _VAL: #actual_ty = init();); - #wasm_bindgen::JsThreadLocal { - __inner: &_VAL, - } - }; - #[cfg(not(feature = "std"))] - let inner = quote! { - #wasm_bindgen::__wbindgen_thread_local!(#wasm_bindgen, #actual_ty) - }; - quote! { #vis static #name: #wasm_bindgen::JsThreadLocal<#actual_ty> = { fn init() -> #actual_ty { #init } - #inner + #wasm_bindgen::__wbindgen_thread_local!(#wasm_bindgen, #actual_ty) }; } } diff --git a/crates/cli/tests/reference/anyref-import-catch.wat b/crates/cli/tests/reference/anyref-import-catch.wat index d5c8b26e7c0..506e67cca2b 100644 --- a/crates/cli/tests/reference/anyref-import-catch.wat +++ b/crates/cli/tests/reference/anyref-import-catch.wat @@ -6,8 +6,8 @@ (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $__wbindgen_exn_store (;1;) (type 3) (param i32)) (func $__externref_table_dealloc (;2;) (type 3) (param i32)) - (func $__externref_table_alloc (;3;) (type 1) (result i32)) - (func $"exported multivalue shim" (;4;) (type 2) (result i32 i32)) + (func $"exported multivalue shim" (;3;) (type 2) (result i32 i32)) + (func $__externref_table_alloc (;4;) (type 1) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) diff --git a/crates/cli/tests/reference/echo.wat b/crates/cli/tests/reference/echo.wat index aff42b9dcdc..4504528bcc9 100644 --- a/crates/cli/tests/reference/echo.wat +++ b/crates/cli/tests/reference/echo.wat @@ -46,53 +46,53 @@ (func $echo_i64 (;29;) (type 11) (param i64) (result i64)) (func $echo_f64 (;30;) (type 14) (param f64) (result f64)) (func $__wbindgen_free (;31;) (type 6) (param i32 i32 i32)) - (func $__externref_table_alloc (;32;) (type 1) (result i32)) - (func $__wbg_foo_free (;33;) (type 3) (param i32 i32)) - (func $"echo_option_u128 multivalue shim" (;34;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) - (func $"echo_option_i128 multivalue shim" (;35;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) - (func $"echo_u128 multivalue shim" (;36;) (type 12) (param i64 i64) (result i64 i64)) - (func $"echo_i128 multivalue shim" (;37;) (type 12) (param i64 i64) (result i64 i64)) - (func $"echo_string multivalue shim" (;38;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_u8 multivalue shim" (;39;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_i8 multivalue shim" (;40;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_u16 multivalue shim" (;41;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_i16 multivalue shim" (;42;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_u32 multivalue shim" (;43;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_i32 multivalue shim" (;44;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_u64 multivalue shim" (;45;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_i64 multivalue shim" (;46;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_u8 multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_i8 multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_u16 multivalue shim" (;49;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_i16 multivalue shim" (;50;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_u32 multivalue shim" (;51;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_i32 multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_u64 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_uninit_i64 multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_string multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_vec_struct multivalue shim" (;56;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_u64 multivalue shim" (;57;) (type 8) (param i32 i64) (result i32 i64)) - (func $"echo_option_i64 multivalue shim" (;58;) (type 8) (param i32 i64) (result i32 i64)) - (func $"echo_option_f64 multivalue shim" (;59;) (type 10) (param i32 f64) (result i32 f64)) - (func $"echo_option_string multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u8 multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i8 multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u16 multivalue shim" (;63;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i16 multivalue shim" (;64;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u32 multivalue shim" (;65;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i32 multivalue shim" (;66;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_u64 multivalue shim" (;67;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_i64 multivalue shim" (;68;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_u8 multivalue shim" (;69;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_i8 multivalue shim" (;70;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_u16 multivalue shim" (;71;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_i16 multivalue shim" (;72;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_u32 multivalue shim" (;73;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_i32 multivalue shim" (;74;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_u64 multivalue shim" (;75;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_uninit_i64 multivalue shim" (;76;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_string multivalue shim" (;77;) (type 5) (param i32 i32) (result i32 i32)) - (func $"echo_option_vec_struct multivalue shim" (;78;) (type 5) (param i32 i32) (result i32 i32)) + (func $__wbg_foo_free (;32;) (type 3) (param i32 i32)) + (func $"echo_option_u128 multivalue shim" (;33;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_option_i128 multivalue shim" (;34;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_u128 multivalue shim" (;35;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_i128 multivalue shim" (;36;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_string multivalue shim" (;37;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u8 multivalue shim" (;38;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i8 multivalue shim" (;39;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u16 multivalue shim" (;40;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i16 multivalue shim" (;41;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u32 multivalue shim" (;42;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i32 multivalue shim" (;43;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u64 multivalue shim" (;44;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i64 multivalue shim" (;45;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u8 multivalue shim" (;46;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i8 multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u16 multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i16 multivalue shim" (;49;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u32 multivalue shim" (;50;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i32 multivalue shim" (;51;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_u64 multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_uninit_i64 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_string multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_struct multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_u64 multivalue shim" (;56;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_i64 multivalue shim" (;57;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_f64 multivalue shim" (;58;) (type 10) (param i32 f64) (result i32 f64)) + (func $"echo_option_string multivalue shim" (;59;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u8 multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i8 multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u16 multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i16 multivalue shim" (;63;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u32 multivalue shim" (;64;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i32 multivalue shim" (;65;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u64 multivalue shim" (;66;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i64 multivalue shim" (;67;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u8 multivalue shim" (;68;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i8 multivalue shim" (;69;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u16 multivalue shim" (;70;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i16 multivalue shim" (;71;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u32 multivalue shim" (;72;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i32 multivalue shim" (;73;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_u64 multivalue shim" (;74;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_uninit_i64 multivalue shim" (;75;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_string multivalue shim" (;76;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_struct multivalue shim" (;77;) (type 5) (param i32 i32) (result i32 i32)) + (func $__externref_table_alloc (;78;) (type 1) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) diff --git a/crates/cli/tests/reference/import.wat b/crates/cli/tests/reference/import.wat index d5c8b26e7c0..506e67cca2b 100644 --- a/crates/cli/tests/reference/import.wat +++ b/crates/cli/tests/reference/import.wat @@ -6,8 +6,8 @@ (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $__wbindgen_exn_store (;1;) (type 3) (param i32)) (func $__externref_table_dealloc (;2;) (type 3) (param i32)) - (func $__externref_table_alloc (;3;) (type 1) (result i32)) - (func $"exported multivalue shim" (;4;) (type 2) (result i32 i32)) + (func $"exported multivalue shim" (;3;) (type 2) (result i32 i32)) + (func $__externref_table_alloc (;4;) (type 1) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) diff --git a/crates/cli/tests/reference/static.wat b/crates/cli/tests/reference/static.wat index b4ea3e1c9e8..35b905ffffe 100644 --- a/crates/cli/tests/reference/static.wat +++ b/crates/cli/tests/reference/static.wat @@ -2,8 +2,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) - (func $__externref_table_alloc (;1;) (type 1) (result i32)) - (func $exported (;2;) (type 0)) + (func $exported (;1;) (type 0)) + (func $__externref_table_alloc (;2;) (type 1) (result i32)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 3f35dfc300f..6c1f9dcdacf 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -26,7 +26,7 @@ wasm-bindgen = { path = "../..", version = '=0.2.99', default-features = false } [features] default = ["std"] futures-core-03-stream = ['futures-core'] -std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std", "once_cell/std"] +std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std"] [target.'cfg(target_feature = "atomics")'.dependencies] web-sys = { path = "../web-sys", version = "=0.3.76", default-features = false, features = [ diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 6b6ba72e86e..633e023867b 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -31,10 +31,9 @@ //! asynchronous and I/O work. #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(target_feature = "atomics", feature(stdarch_wasm_atomic_wait))] #![cfg_attr( - all(not(feature = "std"), target_feature = "atomics"), - feature(thread_local) + target_feature = "atomics", + feature(thread_local, stdarch_wasm_atomic_wait) )] #![deny(missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] diff --git a/crates/futures/src/queue.rs b/crates/futures/src/queue.rs index e0eb9e0de8f..b7d9c89fb4a 100644 --- a/crates/futures/src/queue.rs +++ b/crates/futures/src/queue.rs @@ -107,16 +107,6 @@ impl Queue { } } - #[cfg(feature = "std")] - pub(crate) fn with(f: impl FnOnce(&Self) -> R) -> R { - thread_local! { - static QUEUE: Queue = Queue::new(); - } - - QUEUE.with(f) - } - - #[cfg(not(feature = "std"))] pub(crate) fn with(f: impl FnOnce(&Self) -> R) -> R { use once_cell::unsync::Lazy; diff --git a/crates/futures/src/task/wait_async_polyfill.rs b/crates/futures/src/task/wait_async_polyfill.rs index 757b5d56106..eed90c7ba6d 100644 --- a/crates/futures/src/task/wait_async_polyfill.rs +++ b/crates/futures/src/task/wait_async_polyfill.rs @@ -46,44 +46,22 @@ use js_sys::{Array, Promise}; use wasm_bindgen::prelude::*; use web_sys::{MessageEvent, Worker}; -struct Helpers; - -impl Helpers { - #[cfg(feature = "std")] - pub(crate) fn with(f: impl FnOnce(&RefCell>) -> R) -> R { - thread_local! { - static HELPERS: RefCell> = RefCell::new(vec![]); - } - - HELPERS.with(f) - } - - #[cfg(not(feature = "std"))] - pub(crate) fn with(f: impl FnOnce(&RefCell>) -> R) -> R { - #[thread_local] - static HELPERS: RefCell> = RefCell::new(vec![]); - - f(&HELPERS) - } -} +#[thread_local] +static HELPERS: RefCell> = RefCell::new(vec![]); fn alloc_helper() -> Worker { - Helpers::with(|helpers| { - if let Some(helper) = helpers.borrow_mut().pop() { - return helper; - } + if let Some(helper) = HELPERS.borrow_mut().pop() { + return helper; + } - let worker_url = wasm_bindgen::link_to!(module = "/src/task/worker.js"); - Worker::new(&worker_url).unwrap_or_else(|js| wasm_bindgen::throw_val(js)) - }) + let worker_url = wasm_bindgen::link_to!(module = "/src/task/worker.js"); + Worker::new(&worker_url).unwrap_or_else(|js| wasm_bindgen::throw_val(js)) } fn free_helper(helper: Worker) { - Helpers::with(move |helpers| { - let mut helpers = helpers.borrow_mut(); - helpers.push(helper.clone()); - helpers.truncate(10); // random arbitrary limit chosen here - }); + let mut helpers = HELPERS.borrow_mut(); + helpers.push(helper.clone()); + helpers.truncate(10); // random arbitrary limit chosen here } pub fn wait_async(ptr: &AtomicI32, value: i32) -> Promise { diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index e8588bdc24a..459e4d93953 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -18,10 +18,7 @@ #![doc(html_root_url = "https://docs.rs/js-sys/0.2")] #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr( - all(not(feature = "std"), target_feature = "atomics"), - feature(thread_local) -)] +#![cfg_attr(target_feature = "atomics", feature(thread_local))] extern crate alloc; @@ -6031,28 +6028,20 @@ extern "C" { /// This allows access to the global properties and global names by accessing /// the `Object` returned. pub fn global() -> Object { - #[cfg(feature = "std")] - { - thread_local!(static GLOBAL: Object = get_global_object()); - return GLOBAL.with(|g| g.clone()); - } - #[cfg(not(feature = "std"))] - { - use once_cell::unsync::Lazy; + use once_cell::unsync::Lazy; - struct Wrapper(Lazy); + struct Wrapper(Lazy); - #[cfg(not(target_feature = "atomics"))] - unsafe impl Sync for Wrapper {} + #[cfg(not(target_feature = "atomics"))] + unsafe impl Sync for Wrapper {} - #[cfg(not(target_feature = "atomics"))] - unsafe impl Send for Wrapper {} + #[cfg(not(target_feature = "atomics"))] + unsafe impl Send for Wrapper {} - #[cfg_attr(target_feature = "atomics", thread_local)] - static GLOBAL: Wrapper = Wrapper(Lazy::new(get_global_object)); + #[cfg_attr(target_feature = "atomics", thread_local)] + static GLOBAL: Wrapper = Wrapper(Lazy::new(get_global_object)); - return GLOBAL.0.clone(); - } + return GLOBAL.0.clone(); fn get_global_object() -> Object { // Accessing the global object is not an easy thing to do, and what we diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 19978c98d41..75eab654bd5 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -14,16 +14,14 @@ rust-version = "1.57" version = "0.2.99" [features] -default = ["std"] extra-traits = ["syn/extra-traits"] -std = ["wasm-bindgen-backend/std"] strict-macro = [] [dependencies] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.99", default-features = false } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.99" } wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } [lints] diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 0c7cfcd0709..1a194c6dcab 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -17,14 +17,12 @@ version = "0.2.99" proc-macro = true [features] -default = ["std"] -std = ["wasm-bindgen-macro-support/std"] strict-macro = ["wasm-bindgen-macro-support/strict-macro"] xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.99", default-features = false } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.99" } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/msrv/lib/Cargo.toml b/crates/msrv/lib/Cargo.toml index 98e95deff10..8bff4349dd4 100644 --- a/crates/msrv/lib/Cargo.toml +++ b/crates/msrv/lib/Cargo.toml @@ -31,4 +31,3 @@ web-sys = { path = "../../web-sys", default-features = false } # Pinned sub-dependencies for MSRV bumpalo = "=3.12.0" log = "=0.4.18" -scoped-tls = { version = "=1.0.0", optional = false } diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 7303e635a54..004e990cac7 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -11,12 +11,11 @@ version = "0.3.49" [features] default = ["std"] -std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std", "scoped-tls"] +std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std"] [dependencies] gg-alloc = { version = "1.0", optional = true } js-sys = { path = '../js-sys', version = '=0.3.76', default-features = false } -scoped-tls = { version = "1.0", optional = true } wasm-bindgen = { path = '../..', version = '=0.2.99', default-features = false } wasm-bindgen-futures = { path = '../futures', version = '=0.4.49', default-features = false } wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.49' } diff --git a/crates/test/src/lib.rs b/crates/test/src/lib.rs index f20ca2d82e3..36ee18248c9 100644 --- a/crates/test/src/lib.rs +++ b/crates/test/src/lib.rs @@ -7,8 +7,6 @@ extern crate alloc; -#[cfg(feature = "std")] -use scoped_tls::scoped_thread_local; pub use wasm_bindgen_test_macro::wasm_bindgen_test; // Custom allocator that only returns pointers in the 2GB-4GB range diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 0c28b1344d1..6b35c145b56 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -114,7 +114,6 @@ const CONCURRENCY: usize = 1; pub mod browser; pub mod detect; pub mod node; -#[cfg(not(feature = "std"))] mod scoped_tls; pub mod worker; diff --git a/src/cache/intern.rs b/src/cache/intern.rs index c8aa51b2caa..b9559a2d213 100644 --- a/src/cache/intern.rs +++ b/src/cache/intern.rs @@ -1,6 +1,5 @@ use cfg_if::cfg_if; - cfg_if! { if #[cfg(feature = "enable-interning")] { use std::thread_local; @@ -51,7 +50,6 @@ cfg_if! { } } - /// Interns Rust strings so that it's much faster to send them to JS. /// /// Sending strings from Rust to JS is slow, because it has to do a full `O(n)` @@ -89,7 +87,6 @@ pub fn intern(s: &str) -> &str { s } - /// Removes a Rust string from the intern cache. /// /// This does the opposite of the [`intern`](fn.intern.html) function. diff --git a/src/externref.rs b/src/externref.rs index a708dc5adc2..e575c12a537 100644 --- a/src/externref.rs +++ b/src/externref.rs @@ -117,9 +117,6 @@ fn internal_error(msg: &str) -> ! { // Management of `externref` is always thread local since an `externref` value // can't cross threads in wasm. Indices as a result are always thread-local. -#[cfg(feature = "std")] -std::thread_local!(static HEAP_SLAB: Cell = Cell::new(Slab::new())); -#[cfg(not(feature = "std"))] #[cfg_attr(target_feature = "atomics", thread_local)] static HEAP_SLAB: crate::__rt::LazyCell> = crate::__rt::LazyCell::new(|| Cell::new(Slab::new())); diff --git a/src/lib.rs b/src/lib.rs index 810197c3072..0c81941bc39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,21 +48,17 @@ #![no_std] #![cfg_attr(wasm_bindgen_unstable_test_coverage, feature(coverage_attribute))] +#![cfg_attr(target_feature = "atomics", feature(thread_local))] #![cfg_attr( - all(not(feature = "std"), target_feature = "atomics"), - feature(thread_local) -)] -#![cfg_attr( - any( - all(not(feature = "std"), target_feature = "atomics"), - wasm_bindgen_unstable_test_coverage - ), + any(target_feature = "atomics", wasm_bindgen_unstable_test_coverage), feature(allow_internal_unstable), allow(internal_features) )] #![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; use alloc::boxed::Box; use alloc::string::String; @@ -77,12 +73,6 @@ use core::ptr::NonNull; use crate::convert::{FromWasmAbi, TryFromJsValue, WasmRet, WasmSlice}; -macro_rules! if_std { - ($($i:item)*) => ($( - #[cfg(feature = "std")] $i - )*) -} - macro_rules! externs { ($(#[$attr:meta])* extern "C" { $(fn $name:ident($($args:tt)*) -> $ret:ty;)* }) => ( #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] @@ -129,12 +119,8 @@ mod link; mod cast; pub use crate::cast::{JsCast, JsObject}; -if_std! { - extern crate std; - use std::prelude::v1::*; - mod cache; - pub use cache::intern::{intern, unintern}; -} +mod cache; +pub use cache::intern::{intern, unintern}; #[doc(hidden)] #[path = "rt/mod.rs"] @@ -447,7 +433,6 @@ impl JsValue { } /// Get a string representation of the JavaScript object for debugging. - #[cfg(feature = "std")] fn as_debug_string(&self) -> String { unsafe { let mut ret = [0; 2]; @@ -1184,20 +1169,12 @@ impl Clone for JsValue { } } -#[cfg(feature = "std")] impl core::fmt::Debug for JsValue { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "JsValue({})", self.as_debug_string()) } } -#[cfg(not(feature = "std"))] -impl core::fmt::Debug for JsValue { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - f.write_str("JsValue") - } -} - impl Drop for JsValue { #[inline] fn drop(&mut self) { @@ -1278,13 +1255,10 @@ impl Deref for JsStatic { /// ``` pub struct JsThreadLocal { #[doc(hidden)] - #[cfg(feature = "std")] - pub __inner: &'static std::thread::LocalKey, - #[doc(hidden)] - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + #[cfg(not(target_feature = "atomics"))] pub __inner: &'static __rt::LazyCell, #[doc(hidden)] - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + #[cfg(target_feature = "atomics")] pub __inner: fn() -> *const T, } @@ -1293,11 +1267,9 @@ impl JsThreadLocal { where F: FnOnce(&T) -> R, { - #[cfg(feature = "std")] - return self.__inner.with(f); - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] + #[cfg(not(target_feature = "atomics"))] return f(self.__inner); - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] + #[cfg(target_feature = "atomics")] f(unsafe { &*(self.__inner)() }) } } @@ -1716,14 +1688,15 @@ impl JsError { } } -if_std! { - impl From for JsError - where - E: std::error::Error, - { - fn from(error: E) -> Self { - JsError::new(&error.to_string()) - } +#[cfg(feature = "std")] +impl From for JsError +where + E: std::error::Error, +{ + fn from(error: E) -> Self { + use std::string::ToString; + + JsError::new(&error.to_string()) } } diff --git a/src/rt/mod.rs b/src/rt/mod.rs index 82e97f691f5..c4b104abf4d 100644 --- a/src/rt/mod.rs +++ b/src/rt/mod.rs @@ -4,86 +4,73 @@ use core::cell::{Cell, UnsafeCell}; use core::convert::Infallible; use core::mem; use core::ops::{Deref, DerefMut}; -#[cfg(all(target_feature = "atomics", not(feature = "std")))] +#[cfg(target_feature = "atomics")] use core::sync::atomic::{AtomicU8, Ordering}; +use alloc::alloc::{alloc, dealloc, realloc, Layout}; +use alloc::boxed::Box; +use alloc::rc::Rc; +use once_cell::unsync::Lazy; + pub extern crate alloc; pub extern crate core; #[cfg(feature = "std")] pub extern crate std; -use alloc::alloc::{alloc, dealloc, realloc, Layout}; -use alloc::boxed::Box; -use alloc::rc::Rc; - pub mod marker; -/// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with -/// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled. -#[cfg(not(feature = "std"))] -pub struct LazyCell T>(::once_cell::unsync::Lazy); +/// Wrapper around [`Lazy`] adding `Send + Sync` when `atomics` is not enabled. +pub struct LazyCell T>(Wrapper>); -#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] -unsafe impl Sync for LazyCell {} +struct Wrapper(T); -#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] -unsafe impl Send for LazyCell {} +unsafe impl Sync for Wrapper {} + +unsafe impl Send for Wrapper {} -#[cfg(not(feature = "std"))] impl LazyCell { pub const fn new(init: F) -> LazyCell { - Self(::once_cell::unsync::Lazy::new(init)) + Self(Wrapper(Lazy::new(init))) } } -#[cfg(not(feature = "std"))] impl T> LazyCell { pub(crate) fn try_with( &self, f: impl FnOnce(&T) -> R, ) -> Result { - Ok(f(&self.0)) + Ok(f(&self.0 .0)) } pub fn force(this: &Self) -> &T { - &this.0 + &this.0 .0 } } -#[cfg(not(feature = "std"))] impl Deref for LazyCell { type Target = T; fn deref(&self) -> &T { - ::once_cell::unsync::Lazy::force(&self.0) + ::once_cell::unsync::Lazy::force(&self.0 .0) } } -#[cfg(feature = "std")] -pub use once_cell::sync::Lazy as LazyLock; - -#[cfg(all(not(target_feature = "atomics"), not(feature = "std")))] +#[cfg(not(target_feature = "atomics"))] pub use LazyCell as LazyLock; -#[cfg(all(target_feature = "atomics", not(feature = "std")))] +#[cfg(target_feature = "atomics")] pub struct LazyLock T> { state: AtomicU8, - data: UnsafeCell>, + data: Wrapper>>, } -#[cfg(all(target_feature = "atomics", not(feature = "std")))] +#[cfg(target_feature = "atomics")] enum Data { Value(T), Init(F), } -#[cfg(all(target_feature = "atomics", not(feature = "std")))] -unsafe impl Sync for LazyLock {} - -#[cfg(all(target_feature = "atomics", not(feature = "std")))] -unsafe impl Send for LazyLock {} - -#[cfg(all(target_feature = "atomics", not(feature = "std")))] +#[cfg(target_feature = "atomics")] impl LazyLock { const STATE_UNINIT: u8 = 0; const STATE_INITIALIZING: u8 = 1; @@ -92,12 +79,12 @@ impl LazyLock { pub const fn new(init: F) -> LazyLock { Self { state: AtomicU8::new(Self::STATE_UNINIT), - data: UnsafeCell::new(Data::Init(init)), + data: Wrapper(UnsafeCell::new(Data::Init(init))), } } } -#[cfg(all(target_feature = "atomics", not(feature = "std")))] +#[cfg(target_feature = "atomics")] impl Deref for LazyLock { type Target = T; @@ -107,7 +94,7 @@ impl Deref for LazyLock { loop { match state { Self::STATE_INIT => { - let Data::Value(value) = (unsafe { &*self.data.get() }) else { + let Data::Value(value) = (unsafe { &*self.data.0.get() }) else { unreachable!() }; return value; @@ -123,7 +110,7 @@ impl Deref for LazyLock { continue; } - let data = unsafe { &mut *self.data.get() }; + let data = unsafe { &mut *self.data.0.get() }; let Data::Init(init) = data else { unreachable!() }; @@ -144,7 +131,7 @@ impl Deref for LazyLock { #[macro_export] #[doc(hidden)] -#[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] +#[cfg(not(target_feature = "atomics"))] macro_rules! __wbindgen_thread_local { ($wasm_bindgen:tt, $actual_ty:ty) => {{ static _VAL: $wasm_bindgen::__rt::LazyCell<$actual_ty> = @@ -155,7 +142,7 @@ macro_rules! __wbindgen_thread_local { #[macro_export] #[doc(hidden)] -#[cfg(all(not(feature = "std"), target_feature = "atomics"))] +#[cfg(target_feature = "atomics")] #[allow_internal_unstable(thread_local)] macro_rules! __wbindgen_thread_local { ($wasm_bindgen:tt, $actual_ty:ty) => {{ @@ -538,63 +525,22 @@ pub fn link_mem_intrinsics() { crate::link::link_intrinsics(); } -#[cfg(feature = "std")] -std::thread_local! { - static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); -} -#[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] -static mut GLOBAL_EXNDATA: [u32; 2] = [0; 2]; -#[cfg(all(not(feature = "std"), target_feature = "atomics"))] -#[thread_local] -static GLOBAL_EXNDATA: Cell<[u32; 2]> = Cell::new([0; 2]); - -struct GlobalExndata; - -impl GlobalExndata { - #[cfg(feature = "std")] - fn get() -> [u32; 2] { - GLOBAL_EXNDATA.with(Cell::get) - } - - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - fn get() -> [u32; 2] { - unsafe { GLOBAL_EXNDATA } - } - - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - fn get() -> [u32; 2] { - GLOBAL_EXNDATA.get() - } - - #[cfg(feature = "std")] - fn set(data: [u32; 2]) { - GLOBAL_EXNDATA.with(|d| d.set(data)) - } - - #[cfg(all(not(feature = "std"), not(target_feature = "atomics")))] - fn set(data: [u32; 2]) { - unsafe { GLOBAL_EXNDATA = data }; - } - - #[cfg(all(not(feature = "std"), target_feature = "atomics"))] - fn set(data: [u32; 2]) { - GLOBAL_EXNDATA.set(data); - } -} +#[cfg_attr(target_feature = "atomics", thread_local)] +static GLOBAL_EXNDATA: Wrapper> = Wrapper(Cell::new([0; 2])); #[no_mangle] pub unsafe extern "C" fn __wbindgen_exn_store(idx: u32) { - debug_assert_eq!(GlobalExndata::get()[0], 0); - GlobalExndata::set([1, idx]); + debug_assert_eq!(GLOBAL_EXNDATA.0.get()[0], 0); + GLOBAL_EXNDATA.0.set([1, idx]); } pub fn take_last_exception() -> Result<(), super::JsValue> { - let ret = if GlobalExndata::get()[0] == 1 { - Err(super::JsValue::_new(GlobalExndata::get()[1])) + let ret = if GLOBAL_EXNDATA.0.get()[0] == 1 { + Err(super::JsValue::_new(GLOBAL_EXNDATA.0.get()[1])) } else { Ok(()) }; - GlobalExndata::set([0, 0]); + GLOBAL_EXNDATA.0.set([0, 0]); ret } From 3c07e864b3310305fd1a0620a65b32570509ead0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 10:10:38 +0100 Subject: [PATCH 612/641] Add test coverage support for Node.js (#4348) --- CHANGELOG.md | 3 +++ .../cli/src/bin/wasm-bindgen-test-runner/main.rs | 2 +- .../cli/src/bin/wasm-bindgen-test-runner/node.rs | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95b8f96cbfa..b0cc02f21a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Add a `copy_to_uninit()` method to all `TypedArray`s. It takes `&mut [MaybeUninit]` and returns `&mut [T]`. [#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340) +* Add test coverage support for Node.js. + [#4348](https://github.com/rustwasm/wasm-bindgen/pull/4348) + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 76259378054..b1ebea28c1e 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -271,7 +271,7 @@ fn main() -> anyhow::Result<()> { match test_mode { TestMode::Node { no_modules } => { - node::execute(module, &tmpdir, &args, &tests, !no_modules)? + node::execute(module, &tmpdir, &args, &tests, !no_modules, coverage)? } TestMode::Deno => deno::execute(module, &tmpdir, &args, &tests)?, TestMode::Browser { .. } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index ba131cf5465..3ac475fcb3e 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -1,7 +1,7 @@ use std::env; use std::ffi::OsString; use std::fs; -use std::path::Path; +use std::path::{Path, PathBuf}; use std::process::Command; use anyhow::{Context, Error}; @@ -44,10 +44,12 @@ pub fn execute( args: &[OsString], tests: &[String], module_format: bool, + coverage: PathBuf, ) -> Result<(), Error> { let mut js_to_execute = format!( r#" {exit}; + {fs}; {wasm}; {console_override} @@ -62,6 +64,11 @@ pub fn execute( cx.args(process.argv.slice(2)); const ok = await cx.run(tests.map(n => wasm.__wasm[n])); + + const coverage = wasm.__wbgtest_cov_dump(); + if (coverage !== undefined) + await fs.writeFile('{coverage}', coverage); + if (!ok) exit(1); }} @@ -78,6 +85,12 @@ pub fn execute( } else { r"import { exit } from 'node:process'".to_string() }, + fs = if !module_format { + r"const fs = require('node:fs/promises')".to_string() + } else { + r"import fs from 'node:fs/promises'".to_string() + }, + coverage = coverage.display(), console_override = SHARED_SETUP, ); From 237babb88356a20d1892489d7a23cd335270bc89 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 10:25:58 +0100 Subject: [PATCH 613/641] Import memory and enable `module()` for Node.js (#4349) --- CHANGELOG.md | 5 +- crates/cli-support/src/js/mod.rs | 103 +++++++++++++++++++------------ crates/cli-support/src/lib.rs | 4 -- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0cc02f21a0..4e7f6771e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Add test coverage support for Node.js. [#4348](https://github.com/rustwasm/wasm-bindgen/pull/4348) +* Support importing memory and using `wasm_bindgen::module()` in Node.js. + [#4349](https://github.com/rustwasm/wasm-bindgen/pull/4349) + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. @@ -50,7 +53,7 @@ Released 2024-12-07 ### Added -* Add support for multi-threading in Node.js. +* Add support for compiling with `atomics` for Node.js. [#4318](https://github.com/rustwasm/wasm-bindgen/pull/4318) * Add `WASM_BINDGEN_TEST_DRIVER_TIMEOUT` environment variable to control the timeout to start and connect to the test driver. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index a650ab76772..d33edbd8128 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -261,7 +261,12 @@ impl<'a> Context<'a> { fn generate_node_imports(&self) -> String { let mut imports = BTreeSet::new(); - for import in self.module.imports.iter() { + for import in self + .module + .imports + .iter() + .filter(|i| !(matches!(i.kind, walrus::ImportKind::Memory(_)))) + { imports.insert(&import.module); } @@ -296,9 +301,27 @@ impl<'a> Context<'a> { reset_indentation(&shim) } - fn generate_node_wasm_loading(&self, path: &Path) -> String { + fn generate_node_wasm_loading(&mut self, path: &Path) -> String { let mut shim = String::new(); + let module_name = "wbg"; + if let Some(mem) = self.module.memories.iter().next() { + if let Some(id) = mem.import { + self.module.imports.get_mut(id).module = module_name.to_string(); + shim.push_str(&format!( + "imports.{module_name} = {{ memory: new WebAssembly.Memory({{" + )); + shim.push_str(&format!("initial:{}", mem.initial)); + if let Some(max) = mem.maximum { + shim.push_str(&format!(",maximum:{}", max)); + } + if mem.shared { + shim.push_str(",shared:true"); + } + shim.push_str("}) };"); + } + } + if self.config.mode.uses_es_modules() { // On windows skip the leading `/` which comes out when we parse a // url to use `C:\...` instead of `\C:\...` @@ -460,8 +483,6 @@ impl<'a> Context<'a> { // With normal CommonJS node we need to defer requiring the wasm // until the end so most of our own exports are hooked up OutputMode::Node { module: false } => { - self.nodejs_memory(); - js.push_str(&self.generate_node_imports()); js.push_str("let wasm;\n"); @@ -505,8 +526,6 @@ impl<'a> Context<'a> { // and let the bundler/runtime take care of it. // With Node we manually read the Wasm file from the filesystem and instantiate it. OutputMode::Bundler { .. } | OutputMode::Node { module: true } => { - self.nodejs_memory(); - for (id, js) in iter_by_import(&self.wasm_import_definitions, self.module) { let import = self.module.imports.get_mut(*id); import.module = format!("./{}_bg.js", module_name); @@ -524,26 +543,17 @@ impl<'a> Context<'a> { } } - self.imports_post.push_str( - "\ - let wasm; - export function __wbg_set_wasm(val) { - wasm = val; - } - ", - ); - - if matches!(self.config.mode, OutputMode::Node { module: true }) { - let start = start.get_or_insert_with(String::new); - start.push_str(&self.generate_node_imports()); - start.push_str(&self.generate_node_wasm_loading(Path::new(&format!( - "./{}_bg.wasm", - module_name - )))); - } - match self.config.mode { OutputMode::Bundler { .. } => { + self.imports_post.push_str( + "\ + let wasm; + export function __wbg_set_wasm(val) { + wasm = val; + } + ", + ); + start.get_or_insert_with(String::new).push_str(&format!( "\ import {{ __wbg_set_wasm }} from \"./{module_name}_bg.js\"; @@ -552,8 +562,26 @@ __wbg_set_wasm(wasm);" } OutputMode::Node { module: true } => { - start.get_or_insert_with(String::new).push_str(&format!( - "imports[\"./{module_name}_bg.js\"].__wbg_set_wasm(wasm);" + self.imports_post.push_str( + "\ + let wasm; + let wasmModule; + export function __wbg_set_wasm(exports, module) { + wasm = exports; + wasmModule = module; + } + ", + ); + + let start = start.get_or_insert_with(String::new); + start.push_str(&self.generate_node_imports()); + start.push_str(&self.generate_node_wasm_loading(Path::new(&format!( + "./{}_bg.wasm", + module_name + )))); + + start.push_str(&format!( + "imports[\"./{module_name}_bg.js\"].__wbg_set_wasm(wasm, wasmModule);" )); } @@ -1029,14 +1057,6 @@ __wbg_set_wasm(wasm);" Ok((js, ts)) } - fn nodejs_memory(&mut self) { - if let Some(mem) = self.module.memories.iter_mut().next() { - if let Some(id) = mem.import.take() { - self.module.imports.delete(id); - } - } - } - fn write_classes(&mut self) -> Result<(), Error> { for (class, exports) in self.exported_classes.take().unwrap() { self.write_class(&class, &exports)?; @@ -3833,13 +3853,18 @@ __wbg_set_wasm(wasm);" Intrinsic::Module => { assert_eq!(args.len(), 0); - if !self.config.mode.no_modules() && !self.config.mode.web() { - bail!( + + match self.config.mode { + OutputMode::Web | OutputMode::NoModules { .. } => { + "__wbg_init.__wbindgen_wasm_module" + } + OutputMode::Node { .. } => "wasmModule", + _ => bail!( "`wasm_bindgen::module` is currently only supported with \ - `--target no-modules` and `--target web`" - ); + `--target no-modules`, `--target web` and `--target nodejs`" + ), } - "__wbg_init.__wbindgen_wasm_module".to_string() + .to_string() } Intrinsic::Exports => { diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index fb5b4f02549..4fa2ad7e6d8 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -580,10 +580,6 @@ impl OutputMode { matches!(self, OutputMode::NoModules { .. }) } - fn web(&self) -> bool { - matches!(self, OutputMode::Web) - } - fn esm_integration(&self) -> bool { matches!( self, From 37f0aa1b4f7ce507f3d778554b32ad2e517a901f Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 10:38:20 +0100 Subject: [PATCH 614/641] Better handle stuck WebDriver processes (#4350) --- CHANGELOG.md | 3 ++ .../bin/wasm-bindgen-test-runner/headless.rs | 41 ++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e7f6771e8f..162bec367ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ * Adding `getter`, `setter`, and `constructor` methods to enums now results in a compiler error. This was previously erroneously allowed and resulted in invalid JS code gen. [#4278](https://github.com/rustwasm/wasm-bindgen/pull/4278) +* Handle stuck and failed WebDriver processes when re-trying to start them. + [#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 9ec6fabe2e9..9692f83fce3 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -6,10 +6,12 @@ use serde::{Deserialize, Serialize}; use serde_json::{json, Map, Value as Json}; use std::env; use std::fs::File; -use std::io::{self, Read}; +use std::io::{self, Cursor, ErrorKind, Read, Write}; use std::net::{SocketAddr, TcpListener, TcpStream}; use std::path::{Path, PathBuf}; use std::process::{Child, Command, Stdio}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; use std::thread; use std::time::{Duration, Instant}; use ureq::Agent; @@ -615,12 +617,6 @@ impl Drop for Client { } } -fn read(r: &mut R) -> io::Result> { - let mut dst = Vec::new(); - r.read_to_end(&mut dst)?; - Ok(dst) -} - fn tab(s: &str) -> String { let mut result = String::new(); for line in s.lines() { @@ -635,6 +631,7 @@ struct BackgroundChild<'a> { child: Child, stdout: Option>>>, stderr: Option>>>, + any_stderr: Arc, shell: &'a Shell, print_stdio_on_drop: bool, } @@ -654,12 +651,36 @@ impl<'a> BackgroundChild<'a> { .context(format!("failed to spawn {:?} binary", path))?; let mut stdout = child.stdout.take().unwrap(); let mut stderr = child.stderr.take().unwrap(); - let stdout = Some(thread::spawn(move || read(&mut stdout))); - let stderr = Some(thread::spawn(move || read(&mut stderr))); + let stdout = Some(thread::spawn(move || { + let mut dst = Vec::new(); + stdout.read_to_end(&mut dst)?; + Ok(dst) + })); + let any_stderr = Arc::new(AtomicBool::new(false)); + let any_stderr_clone = Arc::clone(&any_stderr); + let stderr = Some(thread::spawn(move || { + let mut dst = Cursor::new(Vec::new()); + let mut buffer = [0]; + + match stderr.read_exact(&mut buffer) { + Ok(()) => { + dst.write_all(&buffer).unwrap(); + any_stderr_clone.store(true, Ordering::Relaxed); + } + Err(error) if error.kind() == ErrorKind::UnexpectedEof => { + return Ok(dst.into_inner()) + } + Err(error) => return Err(error), + } + + io::copy(&mut stderr, &mut dst)?; + Ok(dst.into_inner()) + })); Ok(BackgroundChild { child, stdout, stderr, + any_stderr, shell, print_stdio_on_drop: true, }) @@ -668,7 +689,7 @@ impl<'a> BackgroundChild<'a> { fn has_failed(&mut self) -> bool { match self.child.try_wait() { Ok(Some(status)) => !status.success(), - Ok(None) => false, + Ok(None) => self.any_stderr.load(Ordering::Relaxed), Err(_) => true, } } From 033e50a70e3cde6f6de637eccccf2ff3ae77b35c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 10:44:44 +0100 Subject: [PATCH 615/641] Fix passing large arrays with JS values into Wasm detaching memory (#4353) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 12 ++++------ crates/cli/tests/reference/echo.js | 4 ++-- crates/cli/tests/reference/typescript-type.js | 4 ++-- tests/wasm/js_vec.js | 8 +++++++ tests/wasm/js_vec.rs | 24 +++++++++++++++++++ tests/wasm/main.rs | 1 + 7 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 tests/wasm/js_vec.js create mode 100644 tests/wasm/js_vec.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 162bec367ec..524561857fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,9 @@ 3. The name of an imported function if the function is not a method and does not have a `js_namespace` or `module` attribute. - Using JS keywords on imports in places other than the above will no longer cause the keywords to be escaped as `_{keyword}`. +* Fixed passing large arrays into Rust failing because of internal memory allocations invalidating the memory buffer. + [#4353](https://github.com/rustwasm/wasm-bindgen/pull/4353) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index d33edbd8128..e129e1e280c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1641,26 +1641,25 @@ __wbg_set_wasm(wasm);" let add = self.expose_add_to_externref_table(table, alloc)?; self.global(&format!( " - function {}(array, malloc) {{ + function {ret}(array, malloc) {{ const ptr = malloc(array.length * 4, 4) >>> 0; - const mem = {}(); for (let i = 0; i < array.length; i++) {{ - mem.setUint32(ptr + 4 * i, {}(array[i]), true); + const add = {add}(array[i]); + {mem}().setUint32(ptr + 4 * i, add, true); }} WASM_VECTOR_LEN = array.length; return ptr; }} ", - ret, mem, add, )); } _ => { self.expose_add_heap_object(); self.global(&format!( " - function {}(array, malloc) {{ + function {ret}(array, malloc) {{ const ptr = malloc(array.length * 4, 4) >>> 0; - const mem = {}(); + const mem = {mem}(); for (let i = 0; i < array.length; i++) {{ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true); }} @@ -1668,7 +1667,6 @@ __wbg_set_wasm(wasm);" return ptr; }} ", - ret, mem, )); } } diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js index b48c5e346e6..c786581f554 100644 --- a/crates/cli/tests/reference/echo.js +++ b/crates/cli/tests/reference/echo.js @@ -666,9 +666,9 @@ function addToExternrefTable0(obj) { function passArrayJsValueToWasm0(array, malloc) { const ptr = malloc(array.length * 4, 4) >>> 0; - const mem = getDataViewMemory0(); for (let i = 0; i < array.length; i++) { - mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true); + const add = addToExternrefTable0(array[i]); + getDataViewMemory0().setUint32(ptr + 4 * i, add, true); } WASM_VECTOR_LEN = array.length; return ptr; diff --git a/crates/cli/tests/reference/typescript-type.js b/crates/cli/tests/reference/typescript-type.js index c69ecd4a682..0f861886fcf 100644 --- a/crates/cli/tests/reference/typescript-type.js +++ b/crates/cli/tests/reference/typescript-type.js @@ -49,9 +49,9 @@ function addToExternrefTable0(obj) { function passArrayJsValueToWasm0(array, malloc) { const ptr = malloc(array.length * 4, 4) >>> 0; - const mem = getDataViewMemory0(); for (let i = 0; i < array.length; i++) { - mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true); + const add = addToExternrefTable0(array[i]); + getDataViewMemory0().setUint32(ptr + 4 * i, add, true); } WASM_VECTOR_LEN = array.length; return ptr; diff --git a/tests/wasm/js_vec.js b/tests/wasm/js_vec.js new file mode 100644 index 00000000000..2ceeeedb506 --- /dev/null +++ b/tests/wasm/js_vec.js @@ -0,0 +1,8 @@ +const assert = require('assert'); +const wasm = require('wasm-bindgen-test'); + +// Test if passing large arrays which cause allocation in Wasm are properly handled. +exports.pass_array_with_allocation = () => { + const values = new Array(10_000).fill(1) + assert.strictEqual(wasm.test_sum(values), 10_000); +}; diff --git a/tests/wasm/js_vec.rs b/tests/wasm/js_vec.rs new file mode 100644 index 00000000000..bba13561422 --- /dev/null +++ b/tests/wasm/js_vec.rs @@ -0,0 +1,24 @@ +use js_sys::Number; +use wasm_bindgen::prelude::wasm_bindgen; +use wasm_bindgen_test::wasm_bindgen_test; + +#[wasm_bindgen(module = "tests/wasm/js_vec.js")] +extern "C" { + fn pass_array_with_allocation(); +} + +#[wasm_bindgen] +pub fn test_sum(param: Vec) -> f64 { + let mut sum = 0.; + + for data in param { + sum += data.value_of(); + } + + sum +} + +#[wasm_bindgen_test] +fn test() { + pass_array_with_allocation(); +} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index a496aa1a3d0..b5640177fc1 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -40,6 +40,7 @@ pub mod inner_self; pub mod intrinsics; pub mod js_keywords; pub mod js_objects; +pub mod js_vec; pub mod jscast; pub mod link_to; pub mod macro_rules; From 7e5f2f126a8ba9f8113d9664dc55261c89ff05a1 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 20:38:10 +0100 Subject: [PATCH 616/641] Migrate `wasm-bindgen-cli` to `clap` (#4354) --- crates/cli/Cargo.toml | 2 +- .../src/bin/wasm-bindgen-test-runner/deno.rs | 26 +-- .../src/bin/wasm-bindgen-test-runner/main.rs | 167 +++++++++------ .../src/bin/wasm-bindgen-test-runner/node.rs | 15 +- .../bin/wasm-bindgen-test-runner/server.rs | 22 +- crates/cli/src/bin/wasm-bindgen.rs | 201 +++++++++--------- crates/cli/src/bin/wasm2es6js.rs | 74 +++---- crates/cli/tests/wasm-bindgen/main.rs | 2 +- crates/test/src/rt/mod.rs | 42 ++-- 9 files changed, 277 insertions(+), 274 deletions(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index b9c88bd1b6f..56e564ea591 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -22,7 +22,7 @@ pkg-url = "https://github.com/rustwasm/wasm-bindgen/releases/download/{ version [dependencies] anyhow = "1.0" -docopt = "1.0" +clap = { version = "4", features = ["derive"] } env_logger = "0.11.5" log = "0.4" native-tls = { version = "0.2", default-features = false, optional = true } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index 390b2761512..58c824e0b31 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -1,35 +1,28 @@ -use std::ffi::OsString; use std::fs; use std::path::Path; use std::process::Command; use anyhow::{Context, Error}; -use crate::node::{exec, SHARED_SETUP}; +use crate::{ + node::{exec, SHARED_SETUP}, + Cli, +}; -pub fn execute( - module: &str, - tmpdir: &Path, - args: &[OsString], - tests: &[String], -) -> Result<(), Error> { +pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Result<(), Error> { let mut js_to_execute = format!( - r#"import * as wasm from "./{0}.js"; + r#"import * as wasm from "./{module}.js"; {console_override} window.__wbg_test_invoke = f => f(); - // Forward runtime arguments. These arguments are also arguments to the - // `wasm-bindgen-test-runner` which forwards them to deno which we - // forward to the test harness. this is basically only used for test - // filters for now. - cx.args(Deno.args); + {args} const tests = []; "#, - module, console_override = SHARED_SETUP, + args = cli.into_args(), ); for test in tests { @@ -69,7 +62,6 @@ if (!ok) Deno.exit(1);"#, Command::new("deno") .arg("run") .arg("--allow-read") - .arg(&js_path) - .args(args), + .arg(&js_path), ) } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index b1ebea28c1e..7d33d7b4208 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -12,6 +12,7 @@ //! and source code. use anyhow::{anyhow, bail, Context}; +use clap::Parser; use log::error; use std::env; use std::fs; @@ -26,70 +27,61 @@ mod node; mod server; mod shell; -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -enum TestMode { - Node { no_modules: bool }, - Deno, - Browser { no_modules: bool }, - DedicatedWorker { no_modules: bool }, - SharedWorker { no_modules: bool }, - ServiceWorker { no_modules: bool }, +#[derive(Parser)] +#[command(version, about, long_about = None)] +struct Cli { + #[arg( + index = 1, + help = "The file to test. `cargo test` passes this argument for you." + )] + file: PathBuf, + #[arg(long = "include-ignored", help = "Run ignored tests")] + include_ignored: bool, + #[arg( + long = "skip", + value_name = "FILTER", + help = "Skip tests whose names contain FILTER (this flag can be used multiple times)" + )] + skip: Vec, + #[arg( + index = 2, + value_name = "FILTER", + help = "The FILTER string is tested against the name of all tests, and only those tests \ + whose names contain the filter are run." + )] + filter: Option, } -impl TestMode { - fn is_worker(self) -> bool { - matches!( - self, - Self::DedicatedWorker { .. } | Self::SharedWorker { .. } | Self::ServiceWorker { .. } +impl Cli { + fn into_args(self) -> String { + let include_ignored = self.include_ignored; + let skip = self.skip; + let filter = if let Some(filter) = self.filter { + &format!("\"{filter}\"") + } else { + "undefined" + }; + + format!( + r#" + // Forward runtime arguments. + cx.include_ignored({include_ignored:?}); + cx.skip({skip:?}); + cx.filter({filter}); + "# ) } - - fn no_modules(self) -> bool { - match self { - Self::Deno => true, - Self::Browser { no_modules } - | Self::Node { no_modules } - | Self::DedicatedWorker { no_modules } - | Self::SharedWorker { no_modules } - | Self::ServiceWorker { no_modules } => no_modules, - } - } - - fn env(self) -> &'static str { - match self { - TestMode::Node { .. } => "WASM_BINDGEN_USE_NODE_EXPERIMENTAL", - TestMode::Deno => "WASM_BINDGEN_USE_DENO", - TestMode::Browser { .. } => "WASM_BINDGEN_USE_BROWSER", - TestMode::DedicatedWorker { .. } => "WASM_BINDGEN_USE_DEDICATED_WORKER", - TestMode::SharedWorker { .. } => "WASM_BINDGEN_USE_SHARED_WORKER", - TestMode::ServiceWorker { .. } => "WASM_BINDGEN_USE_SERVICE_WORKER", - } - } -} - -struct TmpDirDeleteGuard(PathBuf); - -impl Drop for TmpDirDeleteGuard { - fn drop(&mut self) { - if let Err(e) = fs::remove_dir_all(&self.0) { - error!("failed to remove temporary directory: {}", e); - } - } } fn main() -> anyhow::Result<()> { env_logger::init(); - let mut args = env::args_os().skip(1); - let shell = shell::Shell::new(); - // Currently no flags are supported, and assume there's only one argument - // which is the Wasm file to test. This'll want to improve over time! - let wasm_file_to_test = match args.next() { - Some(file) => PathBuf::from(file), - None => bail!("must have a file to test as first argument"), - }; + let cli = Cli::parse(); - let file_name = wasm_file_to_test + let shell = shell::Shell::new(); + + let file_name = cli + .file .file_name() .and_then(|s| s.to_str()) .context("file to test is not a valid file, can't extract file name")?; @@ -100,12 +92,12 @@ fn main() -> anyhow::Result<()> { // - a tmp directory, generated by rustdoc // we would like a directory we have write access to. if we assume cargo-like directories, // we end up with the path `/wbg-out` - let wasm_file_str = wasm_file_to_test.to_string_lossy(); + let wasm_file_str = cli.file.to_string_lossy(); let tmpdir = if wasm_file_str.starts_with("/tmp/rustdoc") || wasm_file_str.starts_with("/var/folders") { - wasm_file_to_test.parent() // chop off the file name and give us the /tmp/rustdoc directory + cli.file.parent() // chop off the file name and give us the /tmp/rustdoc directory } else { - wasm_file_to_test + cli.file .parent() // chop off file name .and_then(|p| p.parent()) // chop off `deps` .and_then(|p| p.parent()) // chop off `debug` @@ -123,7 +115,7 @@ fn main() -> anyhow::Result<()> { // Collect all tests that the test harness is supposed to run. We assume // that any exported function with the prefix `__wbg_test` is a test we need // to execute. - let wasm = fs::read(&wasm_file_to_test).context("failed to read Wasm file")?; + let wasm = fs::read(&cli.file).context("failed to read Wasm file")?; let mut wasm = walrus::Module::from_buffer(&wasm).context("failed to deserialize Wasm module")?; let mut tests = Vec::new(); @@ -267,13 +259,11 @@ fn main() -> anyhow::Result<()> { .context("executing `wasm-bindgen` over the Wasm file")?; shell.clear(); - let args: Vec<_> = args.collect(); - match test_mode { TestMode::Node { no_modules } => { - node::execute(module, &tmpdir, &args, &tests, !no_modules, coverage)? + node::execute(module, &tmpdir, cli, &tests, !no_modules, coverage)? } - TestMode::Deno => deno::execute(module, &tmpdir, &args, &tests)?, + TestMode::Deno => deno::execute(module, &tmpdir, cli, &tests)?, TestMode::Browser { .. } | TestMode::DedicatedWorker { .. } | TestMode::SharedWorker { .. } @@ -289,7 +279,7 @@ fn main() -> anyhow::Result<()> { headless, module, &tmpdir, - &args, + cli, &tests, test_mode, std::env::var("WASM_BINDGEN_TEST_NO_ORIGIN_ISOLATION").is_err(), @@ -321,6 +311,57 @@ fn main() -> anyhow::Result<()> { Ok(()) } +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +enum TestMode { + Node { no_modules: bool }, + Deno, + Browser { no_modules: bool }, + DedicatedWorker { no_modules: bool }, + SharedWorker { no_modules: bool }, + ServiceWorker { no_modules: bool }, +} + +impl TestMode { + fn is_worker(self) -> bool { + matches!( + self, + Self::DedicatedWorker { .. } | Self::SharedWorker { .. } | Self::ServiceWorker { .. } + ) + } + + fn no_modules(self) -> bool { + match self { + Self::Deno => true, + Self::Browser { no_modules } + | Self::Node { no_modules } + | Self::DedicatedWorker { no_modules } + | Self::SharedWorker { no_modules } + | Self::ServiceWorker { no_modules } => no_modules, + } + } + + fn env(self) -> &'static str { + match self { + TestMode::Node { .. } => "WASM_BINDGEN_USE_NODE_EXPERIMENTAL", + TestMode::Deno => "WASM_BINDGEN_USE_DENO", + TestMode::Browser { .. } => "WASM_BINDGEN_USE_BROWSER", + TestMode::DedicatedWorker { .. } => "WASM_BINDGEN_USE_DEDICATED_WORKER", + TestMode::SharedWorker { .. } => "WASM_BINDGEN_USE_SHARED_WORKER", + TestMode::ServiceWorker { .. } => "WASM_BINDGEN_USE_SERVICE_WORKER", + } + } +} + +struct TmpDirDeleteGuard(PathBuf); + +impl Drop for TmpDirDeleteGuard { + fn drop(&mut self) { + if let Err(e) = fs::remove_dir_all(&self.0) { + error!("failed to remove temporary directory: {}", e); + } + } +} + fn coverage_args(tmpdir: &Path) -> PathBuf { fn generated(tmpdir: &Path, prefix: &str) -> String { let res = format!( diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 3ac475fcb3e..c9bb0a7d4d4 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -1,11 +1,12 @@ use std::env; -use std::ffi::OsString; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; use anyhow::{Context, Error}; +use crate::Cli; + // depends on the variable 'wasm' and initializes te WasmBindgenTestContext cx pub const SHARED_SETUP: &str = r#" const handlers = {}; @@ -41,7 +42,7 @@ handlers.on_console_error = wasm.__wbgtest_console_error; pub fn execute( module: &str, tmpdir: &Path, - args: &[OsString], + cli: Cli, tests: &[String], module_format: bool, coverage: PathBuf, @@ -57,11 +58,7 @@ pub fn execute( global.__wbg_test_invoke = f => f(); async function main(tests) {{ - // Forward runtime arguments. These arguments are also arguments to the - // `wasm-bindgen-test-runner` which forwards them to node which we - // forward to the test harness. this is basically only used for test - // filters for now. - cx.args(process.argv.slice(2)); + {args} const ok = await cx.run(tests.map(n => wasm.__wasm[n])); @@ -92,6 +89,7 @@ pub fn execute( }, coverage = coverage.display(), console_override = SHARED_SETUP, + args = cli.into_args(), ); // Note that we're collecting *JS objects* that represent the functions to @@ -139,8 +137,7 @@ pub fn execute( .env("NODE_PATH", env::join_paths(&path).unwrap()) .arg("--expose-gc") .args(&extra_node_args) - .arg(&js_path) - .args(args), + .arg(&js_path), ) } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index f77768c3c61..cae510afc43 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::ffi::OsString; use std::fs; use std::io::{Read, Write}; use std::net::SocketAddr; @@ -8,14 +7,14 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context, Error}; use rouille::{Request, Response, Server}; -use crate::TestMode; +use crate::{Cli, TestMode}; pub(crate) fn spawn( addr: &SocketAddr, headless: bool, module: &'static str, tmpdir: &Path, - args: &[OsString], + cli: Cli, tests: &[String], test_mode: TestMode, isolate_origin: bool, @@ -71,6 +70,8 @@ pub(crate) fn spawn( ) }; + let args = cli.into_args(); + if test_mode.is_worker() { let mut worker_script = if test_mode.no_modules() { format!(r#"importScripts("{0}.js");"#, module) @@ -125,7 +126,7 @@ pub(crate) fn spawn( wrap("error"); async function run_in_worker(tests) {{ - const wasm = await init("./{0}_bg.wasm"); + const wasm = await init("./{module}_bg.wasm"); const t = self; const cx = new Context(); @@ -134,8 +135,9 @@ pub(crate) fn spawn( self.on_console_info = __wbgtest_console_info; self.on_console_warn = __wbgtest_console_warn; self.on_console_error = __wbgtest_console_error; + + {args} - cx.args({1:?}); await cx.run(tests.map(s => wasm[s])); {cov_dump} }} @@ -145,7 +147,6 @@ pub(crate) fn spawn( run_in_worker(tests); }} "#, - module, args, )); if matches!( @@ -256,7 +257,7 @@ pub(crate) fn spawn( document.getElementById('output').textContent = "Loading Wasm module..."; async function main(test) {{ - const wasm = await init('./{0}_bg.wasm'); + const wasm = await init('./{module}_bg.wasm'); const cx = new Context(); window.on_console_debug = __wbgtest_console_debug; @@ -265,11 +266,7 @@ pub(crate) fn spawn( window.on_console_warn = __wbgtest_console_warn; window.on_console_error = __wbgtest_console_error; - // Forward runtime arguments. These arguments are also arguments to the - // `wasm-bindgen-test-runner` which forwards them to node which we - // forward to the test harness. this is basically only used for test - // filters for now. - cx.args({1:?}); + {args} await cx.run(test.map(s => wasm[s])); {cov_dump} @@ -277,7 +274,6 @@ pub(crate) fn spawn( const tests = []; "#, - module, args, )); } for test in tests { diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index e3d89b32272..fb7bf5462c0 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -1,90 +1,94 @@ use anyhow::{bail, Error}; -use docopt::Docopt; -use serde::Deserialize; +use clap::Parser; use std::path::PathBuf; use std::process; use wasm_bindgen_cli_support::{Bindgen, EncodeInto}; -const USAGE: &str = " -Generating JS bindings for a Wasm file - -Usage: - wasm-bindgen [options] - wasm-bindgen -h | --help - wasm-bindgen -V | --version - -Options: - -h --help Show this screen. - --out-dir DIR Output directory - --out-name VAR Set a custom output filename (Without extension. Defaults to crate name) - --target TARGET What type of output to generate, valid - values are [web, bundler, nodejs, no-modules, deno, experimental-nodejs-module], - and the default is [bundler] - --no-modules-global VAR Name of the global variable to initialize - --browser Hint that JS should only be compatible with a browser - --typescript Output a TypeScript definition file (on by default) - --no-typescript Don't emit a *.d.ts file - --omit-imports Don't emit imports in generated JavaScript - --debug Include otherwise-extraneous debug checks in output - --no-demangle Don't demangle Rust symbol names - --keep-lld-exports Keep exports synthesized by LLD - --keep-debug Keep debug sections in Wasm files - --remove-name-section Remove the debugging `name` section of the file - --remove-producers-section Remove the telemetry `producers` section - --omit-default-module-path Don't add WebAssembly fallback imports in generated JavaScript - --split-linked-modules Split linked modules out into their own files. Recommended if possible. - If a bundler is used, it needs to be set up accordingly. - --encode-into MODE Whether or not to use TextEncoder#encodeInto, - valid values are [test, always, never] - --nodejs Deprecated, use `--target nodejs` - --web Deprecated, use `--target web` - --no-modules Deprecated, use `--target no-modules` - --weak-refs Deprecated, is runtime-detected - --reference-types Deprecated, use `-Ctarget-feature=+reference-types` - -V --version Print the version number of wasm-bindgen - -Additional documentation: https://rustwasm.github.io/wasm-bindgen/reference/cli.html -"; - -#[derive(Debug, Deserialize)] +#[derive(Debug, Parser)] +#[command( + version, + about, + long_about = None, + after_help = "Additional documentation: https://rustwasm.github.io/wasm-bindgen/reference/cli.html", +)] struct Args { - flag_nodejs: bool, - flag_browser: bool, - flag_web: bool, - flag_no_modules: bool, - flag_typescript: bool, - flag_no_typescript: bool, - flag_omit_imports: bool, - flag_out_dir: Option, - flag_out_name: Option, - flag_debug: bool, - flag_version: bool, - flag_no_demangle: bool, - flag_no_modules_global: Option, - flag_remove_name_section: bool, - flag_remove_producers_section: bool, + #[arg(long, help = "Deprecated, use `--target nodejs`")] + nodejs: bool, + #[arg(long, help = "Hint that JS should only be compatible with a browser")] + browser: bool, + #[arg(long, help = "Deprecated, use `--target web`")] + web: bool, + #[arg(long, help = "Deprecated, use `--target no-modules`")] + no_modules: bool, + #[arg(long, help = "Output a TypeScript definition file (on by default)")] + typescript: bool, + #[arg(long, help = "Don't emit a *.d.ts file")] + no_typescript: bool, + #[arg(long, help = "Don't emit imports in generated JavaScript")] + omit_imports: bool, + #[arg(long, value_name = "DIR", help = "Output directory")] + out_dir: Option, + #[arg( + long, + value_name = "VAR", + help = "Set a custom output filename (Without extension. Defaults to crate name)" + )] + out_name: Option, + #[arg(long, help = "Include otherwise-extraneous debug checks in output")] + debug: bool, + #[arg(long, help = "Don't demangle Rust symbol names")] + no_demangle: bool, + #[arg( + long, + value_name = "VAR", + help = "Name of the global variable to initialize" + )] + no_modules_global: Option, + #[arg(long, help = "Remove the debugging `name` section of the file")] + remove_name_section: bool, + #[arg(long, help = "Remove the telemetry `producers` section")] + remove_producers_section: bool, + #[arg(long, help = "Deprecated, is runtime-detected")] #[allow(dead_code)] - flag_weak_refs: Option, - flag_reference_types: Option, - flag_keep_lld_exports: bool, - flag_keep_debug: bool, - flag_encode_into: Option, - flag_target: Option, - flag_omit_default_module_path: bool, - flag_split_linked_modules: bool, - arg_input: Option, + weak_refs: bool, + #[arg(long, help = "Deprecated, use `-Ctarget-feature=+reference-types`")] + reference_types: bool, + #[arg(long, help = "Keep exports synthesized by LLD")] + keep_lld_exports: bool, + #[arg(long, help = "Keep debug sections in Wasm files")] + keep_debug: bool, + #[arg( + long, + value_name = "MODE", + help = "Whether or not to use TextEncoder#encodeInto, valid values are [test, always, never]" + )] + encode_into: Option, + #[arg( + long, + value_name = "TARGET", + help = "What type of output to generate, valid\n\ + values are [web, bundler, nodejs, no-modules, deno, experimental-nodejs-module],\n\ + and the default is [bundler]" + )] + target: Option, + #[arg( + long, + help = "Don't add WebAssembly fallback imports in generated JavaScript" + )] + omit_default_module_path: bool, + #[arg( + long, + help = "Split linked modules out into their own files. Recommended if possible.\n\ + If a bundler is used, it needs to be set up accordingly." + )] + split_linked_modules: bool, + input: PathBuf, } fn main() { env_logger::init(); - let args: Args = Docopt::new(USAGE) - .and_then(|d| d.deserialize()) - .unwrap_or_else(|e| e.exit()); + let args = Args::parse(); - if args.flag_version { - println!("wasm-bindgen {}", wasm_bindgen_shared::version()); - return; - } let err = match rmain(&args) { Ok(()) => return, Err(e) => e, @@ -94,15 +98,10 @@ fn main() { } fn rmain(args: &Args) -> Result<(), Error> { - let input = match args.arg_input { - Some(ref s) => s, - None => bail!("input file expected"), - }; - - let typescript = args.flag_typescript || !args.flag_no_typescript; + let typescript = args.typescript || !args.no_typescript; let mut b = Bindgen::new(); - if let Some(name) = &args.flag_target { + if let Some(name) = &args.target { match name.as_str() { "bundler" => b.bundler(true)?, "web" => b.web(true)?, @@ -113,32 +112,32 @@ fn rmain(args: &Args) -> Result<(), Error> { s => bail!("invalid encode-into mode: `{}`", s), }; } - b.input_path(input) - .nodejs(args.flag_nodejs)? - .web(args.flag_web)? - .browser(args.flag_browser)? - .no_modules(args.flag_no_modules)? - .debug(args.flag_debug) - .demangle(!args.flag_no_demangle) - .keep_lld_exports(args.flag_keep_lld_exports) - .keep_debug(args.flag_keep_debug) - .remove_name_section(args.flag_remove_name_section) - .remove_producers_section(args.flag_remove_producers_section) + b.input_path(&args.input) + .nodejs(args.nodejs)? + .web(args.web)? + .browser(args.browser)? + .no_modules(args.no_modules)? + .debug(args.debug) + .demangle(!args.no_demangle) + .keep_lld_exports(args.keep_lld_exports) + .keep_debug(args.keep_debug) + .remove_name_section(args.remove_name_section) + .remove_producers_section(args.remove_producers_section) .typescript(typescript) - .omit_imports(args.flag_omit_imports) - .omit_default_module_path(args.flag_omit_default_module_path) - .split_linked_modules(args.flag_split_linked_modules); - if let Some(true) = args.flag_reference_types { + .omit_imports(args.omit_imports) + .omit_default_module_path(args.omit_default_module_path) + .split_linked_modules(args.split_linked_modules); + if args.reference_types { #[allow(deprecated)] b.reference_types(true); } - if let Some(ref name) = args.flag_no_modules_global { + if let Some(ref name) = args.no_modules_global { b.no_modules_global(name)?; } - if let Some(ref name) = args.flag_out_name { + if let Some(ref name) = args.out_name { b.out_name(name); } - if let Some(mode) = &args.flag_encode_into { + if let Some(mode) = &args.encode_into { match mode.as_str() { "test" => b.encode_into(EncodeInto::Test), "always" => b.encode_into(EncodeInto::Always), @@ -147,7 +146,7 @@ fn rmain(args: &Args) -> Result<(), Error> { }; } - let out_dir = match args.flag_out_dir { + let out_dir = match args.out_dir { Some(ref p) => p, None => bail!("the `--out-dir` argument is now required"), }; diff --git a/crates/cli/src/bin/wasm2es6js.rs b/crates/cli/src/bin/wasm2es6js.rs index 593dcfb2d11..20204277629 100644 --- a/crates/cli/src/bin/wasm2es6js.rs +++ b/crates/cli/src/bin/wasm2es6js.rs @@ -1,52 +1,46 @@ use anyhow::{Context, Error}; -use docopt::Docopt; -use serde::Deserialize; +use clap::Parser; use std::fs; use std::path::PathBuf; -const USAGE: &str = " -Converts a Wasm file to an ES6 JS module - -Usage: - wasm2es6js [options] - wasm2es6js -h | --help - -Options: - -h --help Show this screen. - -o --output FILE File to place output in - --out-dir DIR Directory to place output in - --typescript Output a `*.d.ts` file next to the JS output - --base64 Inline the Wasm module using base64 encoding - --fetch PATH Load module by passing the PATH argument to `fetch()` - -Note that this is not intended to produce a production-ready output module -but rather is intended purely as a temporary \"hack\" until it's standard in -bundlers for working with wasm. Use this program with care! -"; - -#[derive(Debug, Deserialize)] +#[derive(Parser, Debug)] +#[command( + version, + about, + long_about = None, + after_help = "Note that this is not intended to produce a production-ready output module but rather\n\ + is intended purely as a temporary \"hack\" until it's standard in\n\ + bundlers for working with wasm. Use this program with care!", +)] struct Args { - flag_output: Option, - flag_out_dir: Option, - flag_typescript: bool, - flag_base64: bool, - flag_fetch: Option, - arg_input: PathBuf, + #[arg(long, short, value_name = "FILE", help = "File to place output in")] + output: Option, + #[arg(long, value_name = "DIR", help = "Directory to place output in")] + out_dir: Option, + #[arg(long, help = "Output a `*.d.ts` file next to the JS output")] + typescript: bool, + #[arg(long, help = "Inline the Wasm module using base64 encoding")] + base64: bool, + #[arg( + long, + value_name = "PATH", + help = "Load module by passing the PATH argument to `fetch()`" + )] + fetch: Option, + input: PathBuf, } fn main() -> anyhow::Result<()> { - let args: Args = Docopt::new(USAGE) - .and_then(|d| d.deserialize()) - .unwrap_or_else(|e| e.exit()); - let wasm = fs::read(&args.arg_input) - .with_context(|| format!("failed to read `{}`", args.arg_input.display()))?; + let args = Args::parse(); + let wasm = fs::read(&args.input) + .with_context(|| format!("failed to read `{}`", args.input.display()))?; let object = wasm_bindgen_cli_support::wasm2es6js::Config::new() - .base64(args.flag_base64) - .fetch(args.flag_fetch.clone()) + .base64(args.base64) + .fetch(args.fetch.clone()) .generate(&wasm)?; - if args.flag_typescript { + if args.typescript { let ts = object.typescript()?; write(&args, "d.ts", ts.as_bytes(), false)?; } @@ -61,12 +55,12 @@ fn main() -> anyhow::Result<()> { } fn write(args: &Args, extension: &str, contents: &[u8], print_fallback: bool) -> Result<(), Error> { - if let Some(p) = &args.flag_output { + if let Some(p) = &args.output { let dst = p.with_extension(extension); fs::write(&dst, contents) .with_context(|| format!("failed to write `{}`", dst.display()))?; - } else if let Some(p) = &args.flag_out_dir { - let filename = args.arg_input.file_name().unwrap(); + } else if let Some(p) = &args.out_dir { + let filename = args.input.file_name().unwrap(); let dst = p.join(filename).with_extension(extension); fs::write(&dst, contents) .with_context(|| format!("failed to write `{}`", dst.display()))?; diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 8961a7a4a70..3ae132cb0c6 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -120,7 +120,7 @@ fn version_useful() { .arg("-V") .assert() .stdout(str::ends_with("\n")) - .stdout(str::starts_with("wasm-bindgen ")) + .stdout(str::starts_with("wasm-bindgen-cli ")) .success(); } diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 6b35c145b56..b36f59100b9 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -344,35 +344,19 @@ impl Context { } } - /// Inform this context about runtime arguments passed to the test - /// harness. - pub fn args(&mut self, args: Vec) { - let mut filter = self.state.filter.borrow_mut(); - let mut skip = self.state.skip.borrow_mut(); - - let mut args = args.into_iter(); - - while let Some(arg) = args.next() { - let arg = arg.as_string().unwrap(); - if arg == "--include-ignored" { - self.state.include_ignored.set(true); - } else if arg == "--skip" { - skip.push( - args.next() - .expect("Argument to option 'skip' missing") - .as_string() - .unwrap(), - ); - } else if let Some(arg) = arg.strip_prefix("--skip=") { - skip.push(arg.to_owned()) - } else if arg.starts_with('-') { - panic!("flag {} not supported", arg); - } else if filter.is_some() { - panic!("more than one filter argument cannot be passed"); - } else { - *filter = Some(arg); - } - } + /// Handle `--include-ignored` flag. + pub fn include_ignored(&mut self, include_ignored: bool) { + self.state.include_ignored.set(include_ignored); + } + + /// Handle `--skip` arguments. + pub fn skip(&mut self, skip: Vec) { + *self.state.skip.borrow_mut() = skip; + } + + /// Handle filter argument. + pub fn filter(&mut self, filter: Option) { + *self.state.filter.borrow_mut() = filter; } /// Executes a list of tests, returning a promise representing their From 69607f675f386bcadf4bbddbc9dfc86de60b6bb8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 15 Dec 2024 23:20:28 +0100 Subject: [PATCH 617/641] Fix CLI binary names (#4355) --- crates/cli/src/bin/wasm-bindgen-test-runner/main.rs | 2 +- crates/cli/src/bin/wasm-bindgen.rs | 1 + crates/cli/src/bin/wasm2es6js.rs | 1 + crates/cli/tests/wasm-bindgen/main.rs | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 7d33d7b4208..27cff5952d9 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -28,7 +28,7 @@ mod server; mod shell; #[derive(Parser)] -#[command(version, about, long_about = None)] +#[command(name = "wasm-bindgen-test-runner", version, about, long_about = None)] struct Cli { #[arg( index = 1, diff --git a/crates/cli/src/bin/wasm-bindgen.rs b/crates/cli/src/bin/wasm-bindgen.rs index fb7bf5462c0..b705e8a09dd 100644 --- a/crates/cli/src/bin/wasm-bindgen.rs +++ b/crates/cli/src/bin/wasm-bindgen.rs @@ -6,6 +6,7 @@ use wasm_bindgen_cli_support::{Bindgen, EncodeInto}; #[derive(Debug, Parser)] #[command( + name = "wasm-bindgen", version, about, long_about = None, diff --git a/crates/cli/src/bin/wasm2es6js.rs b/crates/cli/src/bin/wasm2es6js.rs index 20204277629..6a13a6ae550 100644 --- a/crates/cli/src/bin/wasm2es6js.rs +++ b/crates/cli/src/bin/wasm2es6js.rs @@ -5,6 +5,7 @@ use std::path::PathBuf; #[derive(Parser, Debug)] #[command( + name = "wasm2es6js", version, about, long_about = None, diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index 3ae132cb0c6..8961a7a4a70 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -120,7 +120,7 @@ fn version_useful() { .arg("-V") .assert() .stdout(str::ends_with("\n")) - .stdout(str::starts_with("wasm-bindgen-cli ")) + .stdout(str::starts_with("wasm-bindgen ")) .success(); } From 08a4060bad7ffa2003bde6ca01570923f5406cd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 08:51:39 +0100 Subject: [PATCH 618/641] Bump `tokio-tungstenite` from v0.24 to v0.25 (#4357) --- crates/example-tests/Cargo.toml | 2 +- crates/example-tests/src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index d8c64e4d7be..1d900dd86a3 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -21,6 +21,6 @@ mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.29.1", features = ["macros", "net", "time"] } -tokio-tungstenite = "0.24" +tokio-tungstenite = "0.25" tower = { version = "0.5", features = ["make", "util"] } tower-http = { version = "0.6", features = ["fs", "util", "set-header"] } diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 6464941929a..e209e791819 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -203,7 +203,7 @@ impl WebDriver { self.next_id += 1; let json = serde_json::to_string(&BidiCommand { id, method, params }) .context("failed to serialize message")?; - self.ws.send(Message::Text(json)).await?; + self.ws.send(Message::Text(json.into())).await?; loop { let msg = self .ws @@ -211,7 +211,7 @@ impl WebDriver { .await .unwrap_or(Err(tungstenite::Error::AlreadyClosed))?; - let message: BidiMessage = serde_json::from_str(&msg.into_text()?)?; + let message: BidiMessage = serde_json::from_str(msg.to_text()?)?; match message { BidiMessage::CommandResponse { id: response_id, @@ -237,7 +237,7 @@ impl WebDriver { .await .unwrap_or(Err(tungstenite::Error::AlreadyClosed))?; - let message: BidiMessage = serde_json::from_str(&msg.into_text()?)?; + let message: BidiMessage = serde_json::from_str(msg.to_text()?)?; match message { BidiMessage::CommandResponse { .. } => bail!("unexpected command response"), BidiMessage::Event(event) => Ok(event), From 6006599d3b87115aeff476397e30e676ccae13ee Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 16 Dec 2024 09:37:06 +0100 Subject: [PATCH 619/641] Add sponsor button (#4359) --- .github/FUNDING.yaml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yaml diff --git a/.github/FUNDING.yaml b/.github/FUNDING.yaml new file mode 100644 index 00000000000..23be5540cd8 --- /dev/null +++ b/.github/FUNDING.yaml @@ -0,0 +1 @@ +github: [daxpedda] From a4bc41becd1076811cba7ba547d995fc32f31111 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 16 Dec 2024 10:56:30 +0100 Subject: [PATCH 620/641] Align test output closer to native `cargo test` (#4358) --- CHANGELOG.md | 3 ++ .../src/bin/wasm-bindgen-test-runner/main.rs | 10 ++-- crates/test/src/rt/mod.rs | 54 ++++++++++++++++++- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 524561857fe..e0b12052401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ * Handle stuck and failed WebDriver processes when re-trying to start them. [#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340) +* Align test output closer to native `cargo test`. + [#4358](https://github.com/rustwasm/wasm-bindgen/pull/4358) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 27cff5952d9..4c02db1357b 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -216,16 +216,14 @@ fn main() -> anyhow::Result<()> { let browser_timeout = env::var("WASM_BINDGEN_TEST_TIMEOUT") .map(|timeout| { - timeout + let timeout = timeout .parse() - .expect("Could not parse 'WASM_BINDGEN_TEST_TIMEOUT'") + .expect("Could not parse 'WASM_BINDGEN_TEST_TIMEOUT'"); + println!("Set timeout to {} seconds...", timeout); + timeout }) .unwrap_or(20); - if debug { - println!("Set timeout to {} seconds...", browser_timeout); - } - // Make the generated bindings available for the tests to execute against. shell.status("Executing bindgen..."); let mut b = Bindgen::new(); diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index b36f59100b9..1b0343a641c 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -165,6 +165,9 @@ struct State { /// How to actually format output, either node.js or browser-specific /// implementation. formatter: Box, + + /// Timing the total duration. + timer: Option, } /// Failure reasons. @@ -252,6 +255,18 @@ extern "C" { // General-purpose conversion into a `String`. #[wasm_bindgen(js_name = String)] fn stringify(val: &JsValue) -> String; + + type Global; + + #[wasm_bindgen(method, getter)] + fn performance(this: &Global) -> JsValue; + + /// Type for the [`Performance` object](https://developer.mozilla.org/en-US/docs/Web/API/Performance). + type Performance; + + /// Binding to [`Performance.now()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now). + #[wasm_bindgen(method)] + fn now(this: &Performance) -> f64; } /// Internal implementation detail of the `console_log!` macro. @@ -328,6 +343,8 @@ impl Context { detect::Runtime::Worker => Box::new(worker::Worker::new()) as Box, }; + let timer = Timer::new(); + Context { state: Rc::new(State { filter: Default::default(), @@ -340,6 +357,7 @@ impl Context { running: Default::default(), succeeded: Default::default(), formatter, + timer, }), } } @@ -373,7 +391,6 @@ impl Context { self.state .formatter .writeln(&format!("running {} {}", tests.len(), noun)); - self.state.formatter.writeln(""); // Execute all our test functions through their Wasm shims (unclear how // to pass native function pointers around here). Each test will @@ -523,6 +540,8 @@ impl Context { should_panic: Option>, ignore: Option>, ) { + // Split away + let name = name.split_once("::").unwrap().1; // If our test is filtered out, record that it was filtered and move // on, nothing to do here. let filter = self.state.filter.borrow(); @@ -677,18 +696,25 @@ impl State { self.formatter.writeln(&format!(" {}", test.name)); } } + let finished_in = if let Some(timer) = &self.timer { + format!("; finished in {:.2?}s", timer.elapsed()) + } else { + String::new() + }; self.formatter.writeln(""); self.formatter.writeln(&format!( "test result: {}. \ {} passed; \ {} failed; \ {} ignored; \ - {} filtered out\n", + {} filtered out\ + {}\n", if failures.len() == 0 { "ok" } else { "FAILED" }, self.succeeded.get(), failures.len(), self.ignored.get(), self.filtered.get(), + finished_in, )); } @@ -813,3 +839,27 @@ fn tab(s: &str) -> String { } result } + +struct Timer { + performance: Performance, + started: f64, +} + +impl Timer { + fn new() -> Option { + let global: Global = js_sys::global().unchecked_into(); + let performance = global.performance(); + (!performance.is_undefined()).then(|| { + let performance: Performance = performance.unchecked_into(); + let started = performance.now(); + Self { + performance, + started, + } + }) + } + + fn elapsed(&self) -> f64 { + (self.performance.now() - self.started) / 1000. + } +} From e250852b220d1ecb0a4b23b3e04d0a2d8c7304bf Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 16 Dec 2024 22:11:45 +0100 Subject: [PATCH 621/641] Pass `ignore` attribute to `unsupported` tests (#4360) --- CHANGELOG.md | 3 +++ crates/test-macro/src/lib.rs | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b12052401..dd62def6ecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ * Fixed passing large arrays into Rust failing because of internal memory allocations invalidating the memory buffer. [#4353](https://github.com/rustwasm/wasm-bindgen/pull/4353) +* Pass along an `ignore` attribute to `unsupported` tests. + [#4360](https://github.com/rustwasm/wasm-bindgen/pull/4360) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 510944ccd9a..6ff30a4450f 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -80,7 +80,7 @@ pub fn wasm_bindgen_test( None => quote! { ::core::option::Option::None }, }; - let ignore = match ignore { + let ignore_par = match &ignore { Some(Some(lit)) => { quote! { ::core::option::Option::Some(::core::option::Option::Some(#lit)) } } @@ -89,9 +89,9 @@ pub fn wasm_bindgen_test( }; let test_body = if attributes.r#async { - quote! { cx.execute_async(test_name, #ident, #should_panic_par, #ignore); } + quote! { cx.execute_async(test_name, #ident, #should_panic_par, #ignore_par); } } else { - quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore); } + quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore_par); } }; // We generate a `#[no_mangle]` with a known prefix so the test harness can @@ -130,6 +130,18 @@ pub fn wasm_bindgen_test( quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #should_panic)] } ) } + + if let Some(ignore) = ignore { + let ignore = if let Some(lit) = ignore { + quote! { ignore = #lit } + } else { + quote! { ignore } + }; + + tokens.extend( + quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #ignore)] } + ) + } } tokens.extend(leading_tokens); From c0fd24c69567c3003302c2babd30bf11964d9ad9 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Dec 2024 18:03:55 +0100 Subject: [PATCH 622/641] Use OS provided temporary directory for tests (#4361) --- CHANGELOG.md | 3 + crates/cli/Cargo.toml | 2 +- .../src/bin/wasm-bindgen-test-runner/main.rs | 60 ++++--------------- 3 files changed, 16 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd62def6ecc..722a63dd7f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ * Pass along an `ignore` attribute to `unsupported` tests. [#4360](https://github.com/rustwasm/wasm-bindgen/pull/4360) +* Use OS provided temporary directory for tests instead of Cargo's `target` directory. + [#4361](https://github.com/rustwasm/wasm-bindgen/pull/4361) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 56e564ea591..870ca4ef325 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -30,6 +30,7 @@ rouille = { version = "3.0.0", default-features = false } serde = { version = "1.0", features = ['derive'] } serde_derive = "1.0" serde_json = "1.0" +tempfile = "3.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = "0.23" wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.99" } @@ -40,7 +41,6 @@ assert_cmd = "2" diff = "0.1" predicates = "3" rayon = "1.0" -tempfile = "3.0" wasmparser = "0.214" wasmprinter = "0.214" diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 4c02db1357b..ec402fadeeb 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -11,9 +11,8 @@ //! For more documentation about this see the `wasm-bindgen-test` crate README //! and source code. -use anyhow::{anyhow, bail, Context}; +use anyhow::{bail, Context}; use clap::Parser; -use log::error; use std::env; use std::fs; use std::path::Path; @@ -83,32 +82,10 @@ fn main() -> anyhow::Result<()> { let file_name = cli .file .file_name() - .and_then(|s| s.to_str()) + .map(Path::new) .context("file to test is not a valid file, can't extract file name")?; - // wasm_file_to_test may be - // - a cargo-like directory layout and generate output at - // `target/wasm32-unknown-unknown/...` - // - a tmp directory, generated by rustdoc - // we would like a directory we have write access to. if we assume cargo-like directories, - // we end up with the path `/wbg-out` - let wasm_file_str = cli.file.to_string_lossy(); - let tmpdir = - if wasm_file_str.starts_with("/tmp/rustdoc") || wasm_file_str.starts_with("/var/folders") { - cli.file.parent() // chop off the file name and give us the /tmp/rustdoc directory - } else { - cli.file - .parent() // chop off file name - .and_then(|p| p.parent()) // chop off `deps` - .and_then(|p| p.parent()) // chop off `debug` - } - .map(|p| p.join(format!("wbg-tmp-{}", file_name))) - .ok_or_else(|| anyhow!("file to test doesn't follow the expected Cargo conventions"))?; - - // Make sure there's no stale state from before - drop(fs::remove_dir_all(&tmpdir)); - fs::create_dir(&tmpdir).context("creating temporary directory")?; - let _guard = TmpDirDeleteGuard(tmpdir.clone()); + let tmpdir = tempfile::tempdir()?; let module = "wasm-bindgen-test"; @@ -247,7 +224,7 @@ fn main() -> anyhow::Result<()> { b.split_linked_modules(true); } - let coverage = coverage_args(&tmpdir); + let coverage = coverage_args(file_name); b.debug(debug) .input_module(module, wasm) @@ -259,9 +236,9 @@ fn main() -> anyhow::Result<()> { match test_mode { TestMode::Node { no_modules } => { - node::execute(module, &tmpdir, cli, &tests, !no_modules, coverage)? + node::execute(module, tmpdir.path(), cli, &tests, !no_modules, coverage)? } - TestMode::Deno => deno::execute(module, &tmpdir, cli, &tests)?, + TestMode::Deno => deno::execute(module, tmpdir.path(), cli, &tests)?, TestMode::Browser { .. } | TestMode::DedicatedWorker { .. } | TestMode::SharedWorker { .. } @@ -276,7 +253,7 @@ fn main() -> anyhow::Result<()> { }, headless, module, - &tmpdir, + tmpdir.path(), cli, &tests, test_mode, @@ -350,22 +327,9 @@ impl TestMode { } } -struct TmpDirDeleteGuard(PathBuf); - -impl Drop for TmpDirDeleteGuard { - fn drop(&mut self) { - if let Err(e) = fs::remove_dir_all(&self.0) { - error!("failed to remove temporary directory: {}", e); - } - } -} - -fn coverage_args(tmpdir: &Path) -> PathBuf { - fn generated(tmpdir: &Path, prefix: &str) -> String { - let res = format!( - "{prefix}{}.profraw", - tmpdir.file_name().and_then(|s| s.to_str()).unwrap() - ); +fn coverage_args(file_name: &Path) -> PathBuf { + fn generated(file_name: &Path, prefix: &str) -> String { + let res = format!("{prefix}{}.profraw", file_name.display()); res } @@ -377,10 +341,10 @@ fn coverage_args(tmpdir: &Path) -> PathBuf { Some(s) => { let mut buf = PathBuf::from(s); if buf.is_dir() { - buf.push(generated(tmpdir, &prefix)); + buf.push(generated(file_name, &prefix)); } buf } - None => PathBuf::from(generated(tmpdir, &prefix)), + None => PathBuf::from(generated(file_name, &prefix)), } } From 292916db91aed4638ac6d7920f6b39ed74cb49f3 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Dec 2024 22:09:37 +0100 Subject: [PATCH 623/641] Error if URL in `_REMOTE` can't be parsed (#4362) --- CHANGELOG.md | 6 ++++++ crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722a63dd7f7..b818523fd2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Align test output closer to native `cargo test`. [#4358](https://github.com/rustwasm/wasm-bindgen/pull/4358) +* Error if URL in `_REMOTE` can't be parsed instead of just ignoring it. + [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. @@ -49,6 +52,9 @@ * Use OS provided temporary directory for tests instead of Cargo's `target` directory. [#4361](https://github.com/rustwasm/wasm-bindgen/pull/4361) +* Error if URL in `_REMOTE` can't be parsed. + [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 9692f83fce3..6064475312d 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -269,10 +269,7 @@ impl Driver { for (driver, ctor) in drivers.iter() { let env = format!("{}_REMOTE", driver.to_uppercase()); let url = match env::var(&env) { - Ok(var) => match Url::parse(&var) { - Ok(url) => url, - Err(_) => continue, - }, + Ok(var) => Url::parse(&var).context(format!("failed to parse `{env}`"))?, Err(_) => continue, }; return Ok(ctor(Locate::Remote(url))); From dfb9d92efa91a84640cbaebc007c3ebe314c0c8b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Dec 2024 23:27:43 +0100 Subject: [PATCH 624/641] Remove `WASM_BINDGEN_THREADS_MAX_MEMORY/STACK_SIZE` (#4363) --- CHANGELOG.md | 3 + crates/cli-support/src/js/mod.rs | 2 +- crates/cli-support/src/lib.rs | 22 +-- crates/threads-xform/src/lib.rs | 281 ++++++++++++------------------ crates/threads-xform/tests/all.rs | 4 +- 5 files changed, 115 insertions(+), 197 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b818523fd2c..ece0df74325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ * Error if URL in `_REMOTE` can't be parsed instead of just ignoring it. [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) +* Remove `WASM_BINDGEN_THREADS_MAX_MEMORY` and `WASM_BINDGEN_THREADS_STACK_SIZE`. The maximum memory size can be set via `-Clink-arg=--max-memory=`. The stack size of a thread can be set when initializing the thread via the `default` function. + [#4363](https://github.com/rustwasm/wasm-bindgen/pull/4363) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index e129e1e280c..118f75752cc 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -158,7 +158,7 @@ impl<'a> Context<'a> { used_string_enums: Default::default(), exported_classes: Some(Default::default()), config, - threads_enabled: config.threads.is_enabled(module), + threads_enabled: wasm_bindgen_threads_xform::is_enabled(module), module, npm_dependencies: Default::default(), next_export_idx: 0, diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index 4fa2ad7e6d8..a07f48306a1 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -35,9 +35,6 @@ pub struct Bindgen { remove_producers_section: bool, omit_default_module_path: bool, emit_start: bool, - // Support for the Wasm threads proposal, transforms the Wasm module to be - // "ready to be instantiated on any thread" - threads: wasm_bindgen_threads_xform::Config, externref: bool, multi_value: bool, encode_into: EncodeInto, @@ -105,7 +102,6 @@ impl Bindgen { remove_name_section: false, remove_producers_section: false, emit_start: true, - threads: threads_config(), externref, multi_value, encode_into: EncodeInto::Test, @@ -342,9 +338,7 @@ impl Bindgen { bail!("exported symbol \"default\" not allowed for --target web") } - let thread_count = self - .threads - .run(&mut module) + let thread_count = wasm_bindgen_threads_xform::run(&mut module) .with_context(|| "failed to prepare module for threading")?; // If requested, turn all mangled symbols into prettier unmangled @@ -535,20 +529,6 @@ fn reset_indentation(s: &str) -> String { dst } -// Eventually these will all be CLI options, but while they're unstable features -// they're left as environment variables. We don't guarantee anything about -// backwards-compatibility with these options. -fn threads_config() -> wasm_bindgen_threads_xform::Config { - let mut cfg = wasm_bindgen_threads_xform::Config::new(); - if let Ok(s) = env::var("WASM_BINDGEN_THREADS_MAX_MEMORY") { - cfg.maximum_memory(s.parse().unwrap()); - } - if let Ok(s) = env::var("WASM_BINDGEN_THREADS_STACK_SIZE") { - cfg.thread_stack_size(s.parse().unwrap()); - } - cfg -} - fn demangle(module: &mut Module) { for func in module.funcs.iter_mut() { let name = match &func.name { diff --git a/crates/threads-xform/src/lib.rs b/crates/threads-xform/src/lib.rs index f60a85c14d7..c131446ca86 100644 --- a/crates/threads-xform/src/lib.rs +++ b/crates/threads-xform/src/lib.rs @@ -1,6 +1,5 @@ use anyhow::{anyhow, bail, Error}; use std::cmp; -use std::env; use walrus::ir::Value; use walrus::FunctionBuilder; use walrus::{ @@ -10,189 +9,128 @@ use walrus::{ use wasm_bindgen_wasm_conventions as wasm_conventions; pub const PAGE_SIZE: u32 = 1 << 16; +const DEFAULT_THREAD_STACK_SIZE: u32 = 1 << 21; // 2MB const ATOMIC_MEM_ARG: MemArg = MemArg { align: 4, offset: 0, }; -/// Configuration for the transformation pass in this module. -/// -/// Created primarily through `new` and then executed through `run`. -pub struct Config { - maximum_memory: u32, - thread_stack_size: u32, - enabled: bool, -} - #[derive(Clone, Copy)] pub struct ThreadCount(walrus::LocalId); -impl Config { - /// Create a new configuration with default settings. - pub fn new() -> Config { - Config { - maximum_memory: 1 << 30, // 1GB - thread_stack_size: 1 << 21, // 2MB - enabled: env::var("WASM_BINDGEN_THREADS").is_ok(), - } - } - - /// Is threaded Wasm enabled? - pub fn is_enabled(&self, module: &Module) -> bool { - if self.enabled { - return true; - } - - // Compatibility with older LLVM outputs. Newer LLVM outputs, when - // atomics are enabled, emit a shared memory. That's a good indicator - // that we have work to do. If shared memory isn't enabled, though then - // this isn't an atomic module so there's nothing to do. We still allow, - // though, an environment variable to force us to go down this path to - // remain compatible with older LLVM outputs. - match wasm_conventions::get_memory(module) { - Ok(memory) => module.memories.get(memory).shared, - Err(_) => false, - } - } - - /// Specify the maximum amount of memory the Wasm module can ever have. - /// - /// We'll be specifying that the memory for this Wasm module is shared, and - /// all shared memories must have their maximum limit specified (whereas - /// by default Rust/LLVM/LLD don't specify a maximum). - /// - /// The default for this option is 16MB, and this can be used to change - /// the maximum memory we'll be specifying. - /// - /// The `max` argument is in units of bytes. - /// - /// If the maximum memory is already specified this setting won't have any - /// affect. - pub fn maximum_memory(&mut self, max: u32) -> &mut Config { - self.maximum_memory = max; - self +/// Is threaded Wasm enabled? +pub fn is_enabled(module: &Module) -> bool { + // Compatibility with older LLVM outputs. Newer LLVM outputs, when + // atomics are enabled, emit a shared memory. That's a good indicator + // that we have work to do. If shared memory isn't enabled, though then + // this isn't an atomic module so there's nothing to do. We still allow, + // though, an environment variable to force us to go down this path to + // remain compatible with older LLVM outputs. + match wasm_conventions::get_memory(module) { + Ok(memory) => module.memories.get(memory).shared, + Err(_) => false, } +} - /// Specify the stack size for all threads spawned. - /// - /// The stack size is typically set by rustc as an argument to LLD and - /// defaults to 1MB for the main thread. All threads spawned by the - /// main thread, however, need to allocate their own stack! - /// - /// This configuration option indicates how large the stack of each child - /// thread will be. This will be allocated as part of the `start` function - /// and will be stored in LLVM's global stack pointer. - pub fn thread_stack_size(&mut self, size: u32) -> &mut Config { - self.thread_stack_size = size; - self +/// Execute the transformation on the parsed Wasm module specified. +/// +/// This function will prepare `Module` to be run on multiple threads, +/// performing steps such as: +/// +/// * All data segments are switched to "passive" data segments to ensure +/// they're only initialized once (coming later) +/// * If memory is exported from this module, it is instead switched to +/// being imported (with the same parameters). +/// * The imported memory is required to be `shared`, ensuring it's backed +/// by a `SharedArrayBuffer` on the web. +/// * A `global` for a thread ID is injected. +/// * Four bytes in linear memory are reserved for the counter of thread +/// IDs. +/// * A `start` function is injected (or prepended if one already exists) +/// which initializes memory for the first thread and otherwise allocates +/// thread ids for all threads. +/// * Some stack space is prepared for each thread after the first one. +/// +/// More and/or less may happen here over time, stay tuned! +pub fn run(module: &mut Module) -> Result, Error> { + if !is_enabled(module) { + return Ok(None); } - /// Execute the transformation on the parsed Wasm module specified. - /// - /// This function will prepare `Module` to be run on multiple threads, - /// performing steps such as: - /// - /// * All data segments are switched to "passive" data segments to ensure - /// they're only initialized once (coming later) - /// * If memory is exported from this module, it is instead switched to - /// being imported (with the same parameters). - /// * The imported memory is required to be `shared`, ensuring it's backed - /// by a `SharedArrayBuffer` on the web. - /// * A `global` for a thread ID is injected. - /// * Four bytes in linear memory are reserved for the counter of thread - /// IDs. - /// * A `start` function is injected (or prepended if one already exists) - /// which initializes memory for the first thread and otherwise allocates - /// thread ids for all threads. - /// * Some stack space is prepared for each thread after the first one. - /// - /// More and/or less may happen here over time, stay tuned! - pub fn run(&self, module: &mut Module) -> Result, Error> { - if !self.is_enabled(module) { - return Ok(None); - } - - let memory = wasm_conventions::get_memory(module)?; - - // Now we need to allocate extra static memory for: - // - A thread id counter. - // - A temporary stack for calls to `malloc()` and `free()`. - // - A lock to synchronize usage of the above stack. - // For this, we allocate 1 extra page of memory (should be enough as temporary - // stack) and grab the first 2 _aligned_ i32 words to use as counter and lock. - let static_data_align = 4; - let static_data_pages = 1; - let (base, addr) = - allocate_static_data(module, memory, static_data_pages, static_data_align)?; - - let mem = module.memories.get_mut(memory); - assert!(mem.shared); - let prev_max = mem.maximum.unwrap(); - assert!(mem.import.is_some()); - mem.maximum = Some(cmp::max( - u64::from(self.maximum_memory / PAGE_SIZE), - prev_max, - )); - assert!(mem.data_segments.is_empty()); - - let tls = Tls { - init: delete_synthetic_func(module, "__wasm_init_tls")?, - size: delete_synthetic_global(module, "__tls_size")?, - align: delete_synthetic_global(module, "__tls_align")?, - base: wasm_conventions::get_tls_base(module) - .ok_or_else(|| anyhow!("failed to find tls base"))?, - }; + let memory = wasm_conventions::get_memory(module)?; + + // Now we need to allocate extra static memory for: + // - A thread id counter. + // - A temporary stack for calls to `malloc()` and `free()`. + // - A lock to synchronize usage of the above stack. + // For this, we allocate 1 extra page of memory (should be enough as temporary + // stack) and grab the first 2 _aligned_ i32 words to use as counter and lock. + let static_data_align = 4; + let static_data_pages = 1; + let (base, addr) = allocate_static_data(module, memory, static_data_pages, static_data_align)?; + + let mem = module.memories.get(memory); + assert!(mem.shared); + assert!(mem.import.is_some()); + assert!(mem.data_segments.is_empty()); + + let tls = Tls { + init: delete_synthetic_func(module, "__wasm_init_tls")?, + size: delete_synthetic_global(module, "__tls_size")?, + align: delete_synthetic_global(module, "__tls_align")?, + base: wasm_conventions::get_tls_base(module) + .ok_or_else(|| anyhow!("failed to find tls base"))?, + }; - let thread_counter_addr = addr as i32; - - let stack_alloc = - module - .globals - .add_local(ValType::I32, true, false, ConstExpr::Value(Value::I32(0))); - - // Make sure the temporary stack is aligned down - let temp_stack = (base + static_data_pages * PAGE_SIZE) & !(static_data_align - 1); - - assert!(self.thread_stack_size % PAGE_SIZE == 0); - - let stack = Stack { - pointer: wasm_conventions::get_stack_pointer(module) - .ok_or_else(|| anyhow!("failed to find stack pointer"))?, - temp: temp_stack as i32, - temp_lock: thread_counter_addr + 4, - alloc: stack_alloc, - size: module.globals.add_local( - ValType::I32, - true, - false, - ConstExpr::Value(Value::I32(self.thread_stack_size as i32)), - ), - }; + let thread_counter_addr = addr as i32; + + let stack_alloc = + module + .globals + .add_local(ValType::I32, true, false, ConstExpr::Value(Value::I32(0))); + + // Make sure the temporary stack is aligned down + let temp_stack = (base + static_data_pages * PAGE_SIZE) & !(static_data_align - 1); + + const _: () = assert!(DEFAULT_THREAD_STACK_SIZE % PAGE_SIZE == 0); + + let stack = Stack { + pointer: wasm_conventions::get_stack_pointer(module) + .ok_or_else(|| anyhow!("failed to find stack pointer"))?, + temp: temp_stack as i32, + temp_lock: thread_counter_addr + 4, + alloc: stack_alloc, + size: module.globals.add_local( + ValType::I32, + true, + false, + ConstExpr::Value(Value::I32(DEFAULT_THREAD_STACK_SIZE as i32)), + ), + }; - let _ = module.exports.add("__stack_alloc", stack.alloc); - - let thread_count = inject_start(module, &tls, &stack, thread_counter_addr, memory)?; - - // we expose a `__wbindgen_thread_destroy()` helper function that deallocates stack space. - // - // ## Safety - // After calling this function in a given agent, the instance should be considered - // "destroyed" and any further invocations into it will trigger UB. This function - // should not be called from an agent that cannot block (e.g. the main document thread). - // - // You can also call it from a "leader" agent, passing appropriate values, if said leader - // is in charge of cleaning up after a "follower" agent. In that case: - // - The "appropriate values" are the values of the `__tls_base` and `__stack_alloc` globals - // and the stack size from the follower thread, after initialization. - // - The leader does _not_ need to block. - // - Similar restrictions apply: the follower thread should be considered unusable afterwards, - // the leader should not call this function with the same set of parameters twice. - // - Moreover, concurrent calls can lead to UB: the follower could be in the middle of a - // call while the leader is destroying its stack! You should make sure that this cannot happen. - inject_destroy(self, module, &tls, &stack, memory)?; - - Ok(Some(thread_count)) - } + let _ = module.exports.add("__stack_alloc", stack.alloc); + + let thread_count = inject_start(module, &tls, &stack, thread_counter_addr, memory)?; + + // we expose a `__wbindgen_thread_destroy()` helper function that deallocates stack space. + // + // ## Safety + // After calling this function in a given agent, the instance should be considered + // "destroyed" and any further invocations into it will trigger UB. This function + // should not be called from an agent that cannot block (e.g. the main document thread). + // + // You can also call it from a "leader" agent, passing appropriate values, if said leader + // is in charge of cleaning up after a "follower" agent. In that case: + // - The "appropriate values" are the values of the `__tls_base` and `__stack_alloc` globals + // and the stack size from the follower thread, after initialization. + // - The leader does _not_ need to block. + // - Similar restrictions apply: the follower thread should be considered unusable afterwards, + // the leader should not call this function with the same set of parameters twice. + // - Moreover, concurrent calls can lead to UB: the follower could be in the middle of a + // call while the leader is destroying its stack! You should make sure that this cannot happen. + inject_destroy(module, &tls, &stack, memory)?; + + Ok(Some(thread_count)) } impl ThreadCount { @@ -403,7 +341,6 @@ fn inject_start( } fn inject_destroy( - config: &Config, module: &mut Module, tls: &Tls, stack: &Stack, @@ -457,7 +394,7 @@ fn inject_destroy( // we're destroying somebody else's stack, so we can use our own body.local_get(stack_alloc) .local_get(stack_size) - .i32_const(config.thread_stack_size as i32) + .i32_const(DEFAULT_THREAD_STACK_SIZE as i32) .local_get(stack_size) .select(None) .i32_const(16) diff --git a/crates/threads-xform/tests/all.rs b/crates/threads-xform/tests/all.rs index e38f377f211..c52b9625a44 100644 --- a/crates/threads-xform/tests/all.rs +++ b/crates/threads-xform/tests/all.rs @@ -23,9 +23,7 @@ fn runtest(test: &Test) -> Result { .generate_producers_section(false) .parse(&wasm)?; - let config = wasm_bindgen_threads_xform::Config::new(); - - config.run(&mut module)?; + wasm_bindgen_threads_xform::run(&mut module)?; walrus::passes::gc::run(&mut module); let features = wasmparser::WasmFeatures::default() | wasmparser::WasmFeatures::THREADS; From 54034a5dd92cef2a6ab99beccfe295688e7bfac0 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 17 Dec 2024 23:59:25 +0100 Subject: [PATCH 625/641] Add `--list`, `--ignored` and `--exact` to `wasm-bindgen-test-runner` (#4356) --- CHANGELOG.md | 6 ++ .../src/bin/wasm-bindgen-test-runner/deno.rs | 2 + .../bin/wasm-bindgen-test-runner/headless.rs | 13 ++-- .../index-headless.html | 4 + .../src/bin/wasm-bindgen-test-runner/main.rs | 77 ++++++++++++++++--- .../src/bin/wasm-bindgen-test-runner/node.rs | 8 +- .../bin/wasm-bindgen-test-runner/server.rs | 6 ++ crates/test-macro/src/lib.rs | 14 +--- crates/test/src/rt/mod.rs | 70 ++++++++++++----- crates/test/src/rt/node.rs | 4 +- 10 files changed, 158 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ece0df74325..72bc905f84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Support importing memory and using `wasm_bindgen::module()` in Node.js. [#4349](https://github.com/rustwasm/wasm-bindgen/pull/4349) +* Add `--list`, `--ignored`, `--exact` and `--nocapture` to `wasm-bindgen-test-runner`, analogous to `cargo test`. + [#4356](https://github.com/rustwasm/wasm-bindgen/pull/4356) + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. @@ -34,6 +37,9 @@ * Remove `WASM_BINDGEN_THREADS_MAX_MEMORY` and `WASM_BINDGEN_THREADS_STACK_SIZE`. The maximum memory size can be set via `-Clink-arg=--max-memory=`. The stack size of a thread can be set when initializing the thread via the `default` function. [#4363](https://github.com/rustwasm/wasm-bindgen/pull/4363) +* `console.*()` calls in tests are now always intercepted by default. To show them use `--nocapture`. When shown they are always printed in-place instead of after test results, analogous to `cargo test`. + [#4356](https://github.com/rustwasm/wasm-bindgen/pull/4356) + ### Fixed - Fixed using [JavaScript keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords) as identifiers not being handled correctly. diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index 58c824e0b31..019eb6f9123 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -13,6 +13,7 @@ pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Resul let mut js_to_execute = format!( r#"import * as wasm from "./{module}.js"; + const nocapture = {nocapture}; {console_override} window.__wbg_test_invoke = f => f(); @@ -21,6 +22,7 @@ pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Resul const tests = []; "#, + nocapture = cli.nocapture.clone(), console_override = SHARED_SETUP, args = cli.into_args(), ); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs index 6064475312d..d39229312b2 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs @@ -210,14 +210,15 @@ pub fn run( println!("output div contained:\n{}", tab(&output)); } } - if !logs.is_empty() { - println!("console.log div contained:\n{}", tab(&logs)); - } - if !errors.is_empty() { - println!("console.log div contained:\n{}", tab(&errors)); - } if !output.contains("test result: ok") { + if !logs.is_empty() { + println!("console.log div contained:\n{}", tab(&logs)); + } + if !errors.is_empty() { + println!("console.log div contained:\n{}", tab(&errors)); + } + bail!("some tests failed") } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html index 790245f20db..e5af4a0eb61 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/index-headless.html @@ -18,10 +18,14 @@ } }; + // {NOCAPTURE} const wrap = method => { const og = orig(`console_${method}`); const on_method = `on_console_${method}`; console[method] = function (...args) { + if (nocapture) { + orig("output").apply(this, args); + } if (window[on_method]) { window[on_method](args); } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index ec402fadeeb..a16e860fb12 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -13,6 +13,7 @@ use anyhow::{bail, Context}; use clap::Parser; +use clap::ValueEnum; use std::env; use std::fs; use std::path::Path; @@ -34,14 +35,32 @@ struct Cli { help = "The file to test. `cargo test` passes this argument for you." )] file: PathBuf, - #[arg(long = "include-ignored", help = "Run ignored tests")] + #[arg(long, conflicts_with = "ignored", help = "Run ignored tests")] include_ignored: bool, + #[arg(long, conflicts_with = "include_ignored", help = "Run ignored tests")] + ignored: bool, + #[arg(long, help = "Exactly match filters rather than by substring")] + exact: bool, #[arg( - long = "skip", + long, value_name = "FILTER", help = "Skip tests whose names contain FILTER (this flag can be used multiple times)" )] skip: Vec, + #[arg(long, help = "List all tests and benchmarks")] + list: bool, + #[arg( + long, + help = "don't capture `console.*()` of each task, allow printing directly" + )] + nocapture: bool, + #[arg( + long, + value_enum, + value_name = "terse", + help = "Configure formatting of output" + )] + format: Option, #[arg( index = 2, value_name = "FILTER", @@ -54,6 +73,8 @@ struct Cli { impl Cli { fn into_args(self) -> String { let include_ignored = self.include_ignored; + let ignored = self.ignored; + let exact = self.exact; let skip = self.skip; let filter = if let Some(filter) = self.filter { &format!("\"{filter}\"") @@ -65,6 +86,8 @@ impl Cli { r#" // Forward runtime arguments. cx.include_ignored({include_ignored:?}); + cx.ignored({ignored:?}); + cx.exact({exact:?}); cx.skip({skip:?}); cx.filter({filter}); "# @@ -85,10 +108,6 @@ fn main() -> anyhow::Result<()> { .map(Path::new) .context("file to test is not a valid file, can't extract file name")?; - let tmpdir = tempfile::tempdir()?; - - let module = "wasm-bindgen-test"; - // Collect all tests that the test harness is supposed to run. We assume // that any exported function with the prefix `__wbg_test` is a test we need // to execute. @@ -98,12 +117,45 @@ fn main() -> anyhow::Result<()> { let mut tests = Vec::new(); for export in wasm.exports.iter() { - if !export.name.starts_with("__wbgt_") { - continue; + if export.name.starts_with("__wbgt_") { + tests.push(export.name.to_string()); } - tests.push(export.name.to_string()); } + if cli.list { + 'outer: for test in tests { + if !cli.ignored || test.starts_with("__wbgt_$") { + if let Some(filter) = &cli.filter { + let matches = if cli.exact { + test == *filter + } else { + test.contains(filter) + }; + + if !matches { + continue; + } + } + + for skip in &cli.skip { + if test.contains(skip) { + continue 'outer; + } + } + + println!("{}: test", test.split_once("::").unwrap().1); + } + } + + // Returning cleanly has the strange effect of outputting + // an additional empty line with spaces in it. + std::process::exit(0); + } + + let tmpdir = tempfile::tempdir()?; + + let module = "wasm-bindgen-test"; + // Right now there's a bug where if no tests are present then the // `wasm-bindgen-test` runtime support isn't linked in, so just bail out // early saying everything is ok. @@ -348,3 +400,10 @@ fn coverage_args(file_name: &Path) -> PathBuf { None => PathBuf::from(generated(file_name, &prefix)), } } + +/// Possible values for the `--format` option. +#[derive(Debug, Clone, Copy, ValueEnum)] +enum FormatSetting { + /// Display one character per test + Terse, +} diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index c9bb0a7d4d4..68249ad7da9 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -15,13 +15,17 @@ const wrap = method => { const og = console[method]; const on_method = `on_console_${method}`; console[method] = function (...args) { - og.apply(this, args); + if (nocapture) { + og.apply(this, args); + } if (handlers[on_method]) { handlers[on_method](args); } }; }; +// save original `console.log` +global.__wbgtest_og_console_log = console.log; // override `console.log` and `console.error` etc... before we import tests to // ensure they're bound correctly in wasm. This'll allow us to intercept // all these calls and capture the output of tests @@ -53,6 +57,7 @@ pub fn execute( {fs}; {wasm}; + const nocapture = {nocapture}; {console_override} global.__wbg_test_invoke = f => f(); @@ -88,6 +93,7 @@ pub fn execute( r"import fs from 'node:fs/promises'".to_string() }, coverage = coverage.display(), + nocapture = cli.nocapture.clone(), console_override = SHARED_SETUP, args = cli.into_args(), ); diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index cae510afc43..88999940e52 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -70,6 +70,7 @@ pub(crate) fn spawn( ) }; + let nocapture = cli.nocapture; let args = cli.into_args(); if test_mode.is_worker() { @@ -102,9 +103,13 @@ pub(crate) fn spawn( worker_script.push_str(&format!( r#" + const nocapture = {nocapture}; const wrap = method => {{ const on_method = `on_console_${{method}}`; self.console[method] = function (...args) {{ + if (nocapture) {{ + self.__wbg_test_output_writeln(args); + }} if (self[on_method]) {{ self[on_method](args); }} @@ -297,6 +302,7 @@ pub(crate) fn spawn( } else { include_str!("index.html") }; + let s = s.replace("// {NOCAPTURE}", &format!("const nocapture = {nocapture};")); let s = if !test_mode.is_worker() && test_mode.no_modules() { s.replace( "", diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index 6ff30a4450f..f123b167b0a 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -4,12 +4,8 @@ extern crate proc_macro; use proc_macro2::*; -use quote::format_ident; use quote::quote; use quote::quote_spanned; -use std::sync::atomic::*; - -static CNT: AtomicUsize = AtomicUsize::new(0); #[proc_macro_attribute] pub fn wasm_bindgen_test( @@ -94,18 +90,16 @@ pub fn wasm_bindgen_test( quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore_par); } }; - // We generate a `#[no_mangle]` with a known prefix so the test harness can - // later slurp up all of these functions and pass them as arguments to the - // main test harness. This is the entry point for all tests. - let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); + let ignore_name = if ignore.is_some() { "$" } else { "" }; + let wasm_bindgen_path = attributes.wasm_bindgen_path; tokens.extend( quote! { const _: () = { #wasm_bindgen_path::__rt::wasm_bindgen::__wbindgen_coverage! { - #[no_mangle] + #[export_name = ::core::concat!("__wbgt_", #ignore_name, ::core::module_path!(), "::", ::core::stringify!(#ident))] #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] - pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) { + extern "C" fn __wbgt_test(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); #test_body } diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index 1b0343a641c..f5c4ae3bde7 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -136,17 +136,23 @@ struct State { /// Include ignored tests. include_ignored: Cell, + /// Include ignored tests. + ignored: Cell, + + /// Only execute with exactly matching name. + exact: Cell, + /// Tests to skip. skip: RefCell>, /// Counter of the number of tests that have succeeded. - succeeded: Cell, + succeeded_count: Cell, /// Counter of the number of tests that have been filtered - filtered: Cell, + filtered_count: Cell, /// Counter of the number of tests that have been ignored - ignored: Cell, + ignored_count: Cell, /// A list of all tests which have failed. /// @@ -349,13 +355,15 @@ impl Context { state: Rc::new(State { filter: Default::default(), include_ignored: Default::default(), + ignored: Default::default(), + exact: Default::default(), skip: Default::default(), failures: Default::default(), - filtered: Default::default(), - ignored: Default::default(), + filtered_count: Default::default(), + ignored_count: Default::default(), remaining: Default::default(), running: Default::default(), - succeeded: Default::default(), + succeeded_count: Default::default(), formatter, timer, }), @@ -367,6 +375,16 @@ impl Context { self.state.include_ignored.set(include_ignored); } + /// Handle `--ignored` flag. + pub fn ignored(&mut self, ignored: bool) { + self.state.ignored.set(ignored); + } + + /// Handle `--exact` flag. + pub fn exact(&mut self, exact: bool) { + self.state.exact.set(exact); + } + /// Handle `--skip` arguments. pub fn skip(&mut self, skip: Vec) { *self.state.skip.borrow_mut() = skip; @@ -546,28 +564,42 @@ impl Context { // on, nothing to do here. let filter = self.state.filter.borrow(); if let Some(filter) = &*filter { - if !name.contains(filter) { - let filtered = self.state.filtered.get(); - self.state.filtered.set(filtered + 1); + let exact = self.state.exact.get(); + + let matches = if exact { + name == filter + } else { + name.contains(filter) + }; + + if !matches { + let filtered = self.state.filtered_count.get(); + self.state.filtered_count.set(filtered + 1); return; } } for skip in &*self.state.skip.borrow() { if name.contains(skip) { - let filtered = self.state.filtered.get(); - self.state.filtered.set(filtered + 1); + let filtered = self.state.filtered_count.get(); + self.state.filtered_count.set(filtered + 1); return; } } - if !self.state.include_ignored.get() { + if self.state.ignored.get() && ignore.is_none() { + let filtered = self.state.filtered_count.get(); + self.state.filtered_count.set(filtered + 1); + return; + } + + if !self.state.include_ignored.get() && !self.state.ignored.get() { if let Some(ignore) = ignore { self.state .formatter .log_test(name, &TestResult::Ignored(ignore.map(str::to_owned))); - let ignored = self.state.ignored.get(); - self.state.ignored.set(ignored + 1); + let ignored = self.state.ignored_count.get(); + self.state.ignored_count.set(ignored + 1); return; } } @@ -665,7 +697,7 @@ impl State { } self.formatter.log_test(&test.name, &TestResult::Ok); - self.succeeded.set(self.succeeded.get() + 1); + self.succeeded_count.set(self.succeeded_count.get() + 1); } else { self.formatter .log_test(&test.name, &TestResult::Err(JsValue::NULL)); @@ -677,7 +709,7 @@ impl State { self.formatter.log_test(&test.name, &result); match result { - TestResult::Ok => self.succeeded.set(self.succeeded.get() + 1), + TestResult::Ok => self.succeeded_count.set(self.succeeded_count.get() + 1), TestResult::Err(e) => self.failures.borrow_mut().push((test, Failure::Error(e))), _ => (), } @@ -710,10 +742,10 @@ impl State { {} filtered out\ {}\n", if failures.len() == 0 { "ok" } else { "FAILED" }, - self.succeeded.get(), + self.succeeded_count.get(), failures.len(), - self.ignored.get(), - self.filtered.get(), + self.ignored_count.get(), + self.filtered_count.get(), finished_in, )); } diff --git a/crates/test/src/rt/node.rs b/crates/test/src/rt/node.rs index a505564f1e8..40e5276b3dd 100644 --- a/crates/test/src/rt/node.rs +++ b/crates/test/src/rt/node.rs @@ -19,6 +19,8 @@ extern "C" { type NodeError; #[wasm_bindgen(method, getter, js_class = "Error", structural)] fn stack(this: &NodeError) -> String; + #[wasm_bindgen(js_name = __wbgtest_og_console_log)] + fn og_console_log(s: &str); } impl Node { @@ -30,7 +32,7 @@ impl Node { impl super::Formatter for Node { fn writeln(&self, line: &str) { - super::js_console_log(line); + og_console_log(line); } fn log_test(&self, name: &str, result: &TestResult) { From c118dc5ff113e9addafa22c39d8913cd4ea47a92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:35:22 +0100 Subject: [PATCH 626/641] Bump `tokio-tungstenite` from v0.25 to v0.26 (#4364) --- crates/example-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/example-tests/Cargo.toml b/crates/example-tests/Cargo.toml index 1d900dd86a3..c023ea1b6b8 100644 --- a/crates/example-tests/Cargo.toml +++ b/crates/example-tests/Cargo.toml @@ -21,6 +21,6 @@ mozrunner = "0.15" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.29.1", features = ["macros", "net", "time"] } -tokio-tungstenite = "0.25" +tokio-tungstenite = "0.26" tower = { version = "0.5", features = ["make", "util"] } tower-http = { version = "0.6", features = ["fs", "util", "set-header"] } From e464ba3bfb9a961620ab47620d8bfe5381e3893c Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 19 Dec 2024 10:42:46 +0100 Subject: [PATCH 627/641] Apply transformations even if the shim is empty (#4366) --- CHANGELOG.md | 3 + .../cli/tests/reference/intrinsic-only.d.ts | 3 + crates/cli/tests/reference/intrinsic-only.js | 57 +++++++++++++++++++ crates/cli/tests/reference/intrinsic-only.rs | 6 ++ crates/cli/tests/reference/intrinsic-only.wat | 17 ++++++ crates/externref-xform/src/lib.rs | 6 -- 6 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 crates/cli/tests/reference/intrinsic-only.d.ts create mode 100644 crates/cli/tests/reference/intrinsic-only.js create mode 100644 crates/cli/tests/reference/intrinsic-only.rs create mode 100644 crates/cli/tests/reference/intrinsic-only.wat diff --git a/CHANGELOG.md b/CHANGELOG.md index 72bc905f84f..f00eaaa3cb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,9 @@ * Error if URL in `_REMOTE` can't be parsed. [#4362](https://github.com/rustwasm/wasm-bindgen/pull/4362) +* Internal functions are now removed instead of invalidly imported if they are unused. + [#4366](https://github.com/rustwasm/wasm-bindgen/pull/4366) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli/tests/reference/intrinsic-only.d.ts b/crates/cli/tests/reference/intrinsic-only.d.ts new file mode 100644 index 00000000000..bb95c9509da --- /dev/null +++ b/crates/cli/tests/reference/intrinsic-only.d.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export function causes_error(): number; diff --git a/crates/cli/tests/reference/intrinsic-only.js b/crates/cli/tests/reference/intrinsic-only.js new file mode 100644 index 00000000000..26525348f80 --- /dev/null +++ b/crates/cli/tests/reference/intrinsic-only.js @@ -0,0 +1,57 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_0.get(idx); + wasm.__externref_table_dealloc(idx); + return value; +} +/** + * @returns {number} + */ +export function causes_error() { + const ret = wasm.causes_error(); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return ret[0]; +} + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/intrinsic-only.rs b/crates/cli/tests/reference/intrinsic-only.rs new file mode 100644 index 00000000000..2dc264ef2b4 --- /dev/null +++ b/crates/cli/tests/reference/intrinsic-only.rs @@ -0,0 +1,6 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn causes_error() -> Result { + Ok(1.0) +} diff --git a/crates/cli/tests/reference/intrinsic-only.wat b/crates/cli/tests/reference/intrinsic-only.wat new file mode 100644 index 00000000000..8f0b95f09dc --- /dev/null +++ b/crates/cli/tests/reference/intrinsic-only.wat @@ -0,0 +1,17 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (result f64 i32 i32))) + (type (;2;) (func (param i32))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__externref_table_dealloc (;1;) (type 2) (param i32)) + (func $"causes_error multivalue shim" (;2;) (type 1) (result f64 i32 i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "causes_error" (func $"causes_error multivalue shim")) + (export "__wbindgen_export_0" (table 0)) + (export "__externref_table_dealloc" (func $__externref_table_dealloc)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) + diff --git a/crates/externref-xform/src/lib.rs b/crates/externref-xform/src/lib.rs index 018f2f96716..6d4688bf2b8 100644 --- a/crates/externref-xform/src/lib.rs +++ b/crates/externref-xform/src/lib.rs @@ -302,12 +302,6 @@ impl Transform<'_> { self.process_elements(module)?; assert!(self.cx.new_elements.is_empty()); - // If we didn't actually transform anything, no need to inject or - // rewrite anything from below. - if self.shims.is_empty() { - return Ok(()); - } - // Perform all instruction transformations to rewrite calls between // functions and make sure everything is still hooked up right. self.rewrite_calls(module)?; From e09c6fa4be7e0ca058ae9d3c0d7413b27c4ca7ae Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 19 Dec 2024 21:45:23 +0100 Subject: [PATCH 628/641] Sync `wasm-tools` dependencies (#4370) --- crates/externref-xform/Cargo.toml | 2 +- crates/wasm-conventions/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index e145ee3fa58..3da53a4d66d 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -22,7 +22,7 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2. rayon = "1.0" wasmprinter = "0.214" wast = "214" -wat = "1.0" +wat = "~1.214" [lints] workspace = true diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 8eb8c2d44ed..10d545a0c78 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -17,7 +17,7 @@ walrus = "0.23" # Matching the version `walrus` depends on. anyhow = "1.0" log = "0.4" -wasmparser = "0.212" +wasmparser = "0.214" [lints] workspace = true From f817a796ad8f34a8f2428e6a73ba588dad460f98 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 20 Dec 2024 12:35:53 +0100 Subject: [PATCH 629/641] Use cross-platform code in favor of accurate exit codes (#4372) --- .../src/bin/wasm-bindgen-test-runner/deno.rs | 24 +++++++------- .../src/bin/wasm-bindgen-test-runner/node.rs | 33 +++++++------------ 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index 019eb6f9123..ee6232943cc 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -1,13 +1,10 @@ -use std::fs; use std::path::Path; use std::process::Command; +use std::{fs, process}; use anyhow::{Context, Error}; -use crate::{ - node::{exec, SHARED_SETUP}, - Cli, -}; +use crate::{node::SHARED_SETUP, Cli}; pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Result<(), Error> { let mut js_to_execute = format!( @@ -60,10 +57,15 @@ if (!ok) Deno.exit(1);"#, .arg(&js_path) .args(args), )*/ - exec( - Command::new("deno") - .arg("run") - .arg("--allow-read") - .arg(&js_path), - ) + let status = Command::new("deno") + .arg("run") + .arg("--allow-read") + .arg(&js_path) + .status()?; + + if !status.success() { + process::exit(status.code().unwrap_or(1)) + } else { + Ok(()) + } } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 68249ad7da9..303583e7f2c 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -1,6 +1,7 @@ use std::env; use std::fs; use std::path::{Path, PathBuf}; +use std::process; use std::process::Command; use anyhow::{Context, Error}; @@ -138,27 +139,17 @@ pub fn execute( .map(|s| s.to_string()) .filter(|s| !s.is_empty()) .collect::>(); - exec( - Command::new("node") - .env("NODE_PATH", env::join_paths(&path).unwrap()) - .arg("--expose-gc") - .args(&extra_node_args) - .arg(&js_path), - ) -} -#[cfg(unix)] -pub fn exec(cmd: &mut Command) -> Result<(), Error> { - use std::os::unix::prelude::*; - Err(Error::from(cmd.exec()).context(format!( - "failed to execute `{}`", - cmd.get_program().to_string_lossy() - ))) -} + let status = Command::new("node") + .env("NODE_PATH", env::join_paths(&path).unwrap()) + .arg("--expose-gc") + .args(&extra_node_args) + .arg(&js_path) + .status()?; -#[cfg(windows)] -pub fn exec(cmd: &mut Command) -> Result<(), Error> { - use std::process; - let status = cmd.status()?; - process::exit(status.code().unwrap_or(3)); + if !status.success() { + process::exit(status.code().unwrap_or(1)) + } else { + Ok(()) + } } From 95cd15db2c7d7cc4c83f5f723e38ce48ac33e08a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 20 Dec 2024 13:10:01 +0100 Subject: [PATCH 630/641] De-duplicate test filtering (#4373) --- .../src/bin/wasm-bindgen-test-runner/deno.rs | 9 +- .../src/bin/wasm-bindgen-test-runner/main.rs | 110 +++++++++++------- .../src/bin/wasm-bindgen-test-runner/node.rs | 9 +- .../bin/wasm-bindgen-test-runner/server.rs | 10 +- crates/test-macro/src/lib.rs | 2 +- crates/test/src/rt/mod.rs | 66 ++--------- 6 files changed, 94 insertions(+), 112 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index ee6232943cc..2ed328d1fd4 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -4,9 +4,10 @@ use std::{fs, process}; use anyhow::{Context, Error}; +use crate::Tests; use crate::{node::SHARED_SETUP, Cli}; -pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Result<(), Error> { +pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: Tests) -> Result<(), Error> { let mut js_to_execute = format!( r#"import * as wasm from "./{module}.js"; @@ -21,11 +22,11 @@ pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Resul "#, nocapture = cli.nocapture.clone(), console_override = SHARED_SETUP, - args = cli.into_args(), + args = cli.into_args(&tests), ); - for test in tests { - js_to_execute.push_str(&format!("tests.push('{}')\n", test)); + for test in tests.tests { + js_to_execute.push_str(&format!("tests.push('{}')\n", test.name)); } js_to_execute.push_str( diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index a16e860fb12..6b910a49ae5 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -71,30 +71,41 @@ struct Cli { } impl Cli { - fn into_args(self) -> String { + fn into_args(self, tests: &Tests) -> String { let include_ignored = self.include_ignored; let ignored = self.ignored; - let exact = self.exact; - let skip = self.skip; - let filter = if let Some(filter) = self.filter { - &format!("\"{filter}\"") - } else { - "undefined" - }; + let filtered = tests.filtered; format!( r#" // Forward runtime arguments. cx.include_ignored({include_ignored:?}); cx.ignored({ignored:?}); - cx.exact({exact:?}); - cx.skip({skip:?}); - cx.filter({filter}); + cx.filtered_count({filtered}); "# ) } } +struct Tests { + tests: Vec, + filtered: usize, +} + +impl Tests { + fn new() -> Self { + Self { + tests: Vec::new(), + filtered: 0, + } + } +} + +struct Test { + name: String, + ignored: bool, +} + fn main() -> anyhow::Result<()> { env_logger::init(); @@ -114,36 +125,55 @@ fn main() -> anyhow::Result<()> { let wasm = fs::read(&cli.file).context("failed to read Wasm file")?; let mut wasm = walrus::Module::from_buffer(&wasm).context("failed to deserialize Wasm module")?; - let mut tests = Vec::new(); + let mut tests = Tests::new(); - for export in wasm.exports.iter() { - if export.name.starts_with("__wbgt_") { - tests.push(export.name.to_string()); + 'outer: for export in wasm.exports.iter() { + let Some(name) = export.name.strip_prefix("__wbgt_") else { + continue; + }; + let modifiers = name.split_once('_').expect("found invalid identifier").0; + let test = Test { + name: export.name.clone(), + ignored: modifiers.contains('$'), + }; + + if let Some(filter) = &cli.filter { + let matches = if cli.exact { + name == *filter + } else { + name.contains(filter) + }; + + if !matches { + tests.filtered += 1; + continue; + } } - } - if cli.list { - 'outer: for test in tests { - if !cli.ignored || test.starts_with("__wbgt_$") { - if let Some(filter) = &cli.filter { - let matches = if cli.exact { - test == *filter - } else { - test.contains(filter) - }; - - if !matches { - continue; - } - } + for skip in &cli.skip { + let matches = if cli.exact { + name == *skip + } else { + name.contains(skip) + }; - for skip in &cli.skip { - if test.contains(skip) { - continue 'outer; - } - } + if matches { + tests.filtered += 1; + continue 'outer; + } + } - println!("{}: test", test.split_once("::").unwrap().1); + if !test.ignored && cli.ignored { + tests.filtered += 1; + } else { + tests.tests.push(test); + } + } + + if cli.list { + for test in tests.tests { + if !cli.ignored || test.ignored { + println!("{}: test", test.name.split_once("::").unwrap().1); } } @@ -159,7 +189,7 @@ fn main() -> anyhow::Result<()> { // Right now there's a bug where if no tests are present then the // `wasm-bindgen-test` runtime support isn't linked in, so just bail out // early saying everything is ok. - if tests.is_empty() { + if tests.tests.is_empty() { println!("no tests to run!"); return Ok(()); } @@ -288,9 +318,9 @@ fn main() -> anyhow::Result<()> { match test_mode { TestMode::Node { no_modules } => { - node::execute(module, tmpdir.path(), cli, &tests, !no_modules, coverage)? + node::execute(module, tmpdir.path(), cli, tests, !no_modules, coverage)? } - TestMode::Deno => deno::execute(module, tmpdir.path(), cli, &tests)?, + TestMode::Deno => deno::execute(module, tmpdir.path(), cli, tests)?, TestMode::Browser { .. } | TestMode::DedicatedWorker { .. } | TestMode::SharedWorker { .. } @@ -307,7 +337,7 @@ fn main() -> anyhow::Result<()> { module, tmpdir.path(), cli, - &tests, + tests, test_mode, std::env::var("WASM_BINDGEN_TEST_NO_ORIGIN_ISOLATION").is_err(), coverage, diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 303583e7f2c..f7cef86faa7 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -7,6 +7,7 @@ use std::process::Command; use anyhow::{Context, Error}; use crate::Cli; +use crate::Tests; // depends on the variable 'wasm' and initializes te WasmBindgenTestContext cx pub const SHARED_SETUP: &str = r#" @@ -48,7 +49,7 @@ pub fn execute( module: &str, tmpdir: &Path, cli: Cli, - tests: &[String], + tests: Tests, module_format: bool, coverage: PathBuf, ) -> Result<(), Error> { @@ -96,14 +97,14 @@ pub fn execute( coverage = coverage.display(), nocapture = cli.nocapture.clone(), console_override = SHARED_SETUP, - args = cli.into_args(), + args = cli.into_args(&tests), ); // Note that we're collecting *JS objects* that represent the functions to // execute, and then those objects are passed into Wasm for it to execute // when it sees fit. - for test in tests { - js_to_execute.push_str(&format!("tests.push('{}')\n", test)); + for test in tests.tests { + js_to_execute.push_str(&format!("tests.push('{}')\n", test.name)); } // And as a final addendum, exit with a nonzero code if any tests fail. js_to_execute.push_str( diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs index 88999940e52..f5b088a17b6 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context, Error}; use rouille::{Request, Response, Server}; -use crate::{Cli, TestMode}; +use crate::{Cli, TestMode, Tests}; pub(crate) fn spawn( addr: &SocketAddr, @@ -15,7 +15,7 @@ pub(crate) fn spawn( module: &'static str, tmpdir: &Path, cli: Cli, - tests: &[String], + tests: Tests, test_mode: TestMode, isolate_origin: bool, coverage: PathBuf, @@ -71,7 +71,7 @@ pub(crate) fn spawn( }; let nocapture = cli.nocapture; - let args = cli.into_args(); + let args = cli.into_args(&tests); if test_mode.is_worker() { let mut worker_script = if test_mode.no_modules() { @@ -281,8 +281,8 @@ pub(crate) fn spawn( "#, )); } - for test in tests { - js_to_execute.push_str(&format!("tests.push('{}');\n", test)); + for test in tests.tests { + js_to_execute.push_str(&format!("tests.push('{}');\n", test.name)); } js_to_execute.push_str("main(tests);\n"); diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index f123b167b0a..c9e27eb6f63 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -97,7 +97,7 @@ pub fn wasm_bindgen_test( quote! { const _: () = { #wasm_bindgen_path::__rt::wasm_bindgen::__wbindgen_coverage! { - #[export_name = ::core::concat!("__wbgt_", #ignore_name, ::core::module_path!(), "::", ::core::stringify!(#ident))] + #[export_name = ::core::concat!("__wbgt_", #ignore_name, "_", ::core::module_path!(), "::", ::core::stringify!(#ident))] #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] extern "C" fn __wbgt_test(cx: &#wasm_bindgen_path::__rt::Context) { let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident)); diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index f5c4ae3bde7..f3730fd988e 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -127,31 +127,19 @@ pub struct Context { } struct State { - /// An optional filter used to restrict which tests are actually executed - /// and which are ignored. This is passed via the `args` function which - /// comes from the command line of `wasm-bindgen-test-runner`. Currently - /// this is the only "CLI option" - filter: RefCell>, - /// Include ignored tests. include_ignored: Cell, - /// Include ignored tests. + /// Only run ignored tests. ignored: Cell, - /// Only execute with exactly matching name. - exact: Cell, - - /// Tests to skip. - skip: RefCell>, - /// Counter of the number of tests that have succeeded. succeeded_count: Cell, - /// Counter of the number of tests that have been filtered + /// Number of tests that have been filtered. filtered_count: Cell, - /// Counter of the number of tests that have been ignored + /// Number of tests that have been ignored. ignored_count: Cell, /// A list of all tests which have failed. @@ -353,17 +341,14 @@ impl Context { Context { state: Rc::new(State { - filter: Default::default(), include_ignored: Default::default(), ignored: Default::default(), - exact: Default::default(), - skip: Default::default(), failures: Default::default(), + succeeded_count: Default::default(), filtered_count: Default::default(), ignored_count: Default::default(), remaining: Default::default(), running: Default::default(), - succeeded_count: Default::default(), formatter, timer, }), @@ -380,19 +365,9 @@ impl Context { self.state.ignored.set(ignored); } - /// Handle `--exact` flag. - pub fn exact(&mut self, exact: bool) { - self.state.exact.set(exact); - } - - /// Handle `--skip` arguments. - pub fn skip(&mut self, skip: Vec) { - *self.state.skip.borrow_mut() = skip; - } - /// Handle filter argument. - pub fn filter(&mut self, filter: Option) { - *self.state.filter.borrow_mut() = filter; + pub fn filtered_count(&mut self, filtered: usize) { + self.state.filtered_count.set(filtered); } /// Executes a list of tests, returning a promise representing their @@ -558,34 +533,9 @@ impl Context { should_panic: Option>, ignore: Option>, ) { - // Split away + // Remove the crate name to mimic libtest more closely. + // This also removes our `__wbgt_` prefix and the `ignored` and `should_panic` modifiers. let name = name.split_once("::").unwrap().1; - // If our test is filtered out, record that it was filtered and move - // on, nothing to do here. - let filter = self.state.filter.borrow(); - if let Some(filter) = &*filter { - let exact = self.state.exact.get(); - - let matches = if exact { - name == filter - } else { - name.contains(filter) - }; - - if !matches { - let filtered = self.state.filtered_count.get(); - self.state.filtered_count.set(filtered + 1); - return; - } - } - - for skip in &*self.state.skip.borrow() { - if name.contains(skip) { - let filtered = self.state.filtered_count.get(); - self.state.filtered_count.set(filtered + 1); - return; - } - } if self.state.ignored.get() && ignore.is_none() { let filtered = self.state.filtered_count.get(); From 130d2cfd0e267711d3cabe81ff62f5f58733cc69 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 20 Dec 2024 15:07:11 +0100 Subject: [PATCH 631/641] Further simplify test filtering (#4374) --- .../src/bin/wasm-bindgen-test-runner/main.rs | 6 +----- crates/test/src/rt/mod.rs | 19 ++----------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs index 6b910a49ae5..a4b8c58de2b 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/main.rs @@ -73,14 +73,12 @@ struct Cli { impl Cli { fn into_args(self, tests: &Tests) -> String { let include_ignored = self.include_ignored; - let ignored = self.ignored; let filtered = tests.filtered; format!( r#" // Forward runtime arguments. cx.include_ignored({include_ignored:?}); - cx.ignored({ignored:?}); cx.filtered_count({filtered}); "# ) @@ -172,9 +170,7 @@ fn main() -> anyhow::Result<()> { if cli.list { for test in tests.tests { - if !cli.ignored || test.ignored { - println!("{}: test", test.name.split_once("::").unwrap().1); - } + println!("{}: test", test.name.split_once("::").unwrap().1); } // Returning cleanly has the strange effect of outputting diff --git a/crates/test/src/rt/mod.rs b/crates/test/src/rt/mod.rs index f3730fd988e..7fd7c54a6b7 100644 --- a/crates/test/src/rt/mod.rs +++ b/crates/test/src/rt/mod.rs @@ -130,9 +130,6 @@ struct State { /// Include ignored tests. include_ignored: Cell, - /// Only run ignored tests. - ignored: Cell, - /// Counter of the number of tests that have succeeded. succeeded_count: Cell, @@ -342,7 +339,6 @@ impl Context { Context { state: Rc::new(State { include_ignored: Default::default(), - ignored: Default::default(), failures: Default::default(), succeeded_count: Default::default(), filtered_count: Default::default(), @@ -360,11 +356,6 @@ impl Context { self.state.include_ignored.set(include_ignored); } - /// Handle `--ignored` flag. - pub fn ignored(&mut self, ignored: bool) { - self.state.ignored.set(ignored); - } - /// Handle filter argument. pub fn filtered_count(&mut self, filtered: usize) { self.state.filtered_count.set(filtered); @@ -537,14 +528,8 @@ impl Context { // This also removes our `__wbgt_` prefix and the `ignored` and `should_panic` modifiers. let name = name.split_once("::").unwrap().1; - if self.state.ignored.get() && ignore.is_none() { - let filtered = self.state.filtered_count.get(); - self.state.filtered_count.set(filtered + 1); - return; - } - - if !self.state.include_ignored.get() && !self.state.ignored.get() { - if let Some(ignore) = ignore { + if let Some(ignore) = ignore { + if !self.state.include_ignored.get() { self.state .formatter .log_test(name, &TestResult::Ignored(ignore.map(str::to_owned))); From eb13ae3769423d1388d7b9fa0e4510981d8cfd53 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 25 Dec 2024 10:44:49 +0100 Subject: [PATCH 632/641] Bump `futures-channel` and `futures-lite` (#4379) --- crates/futures/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index 6c1f9dcdacf..b2b3be932da 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -35,8 +35,8 @@ web-sys = { path = "../web-sys", version = "=0.3.76", default-features = false, ] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] -futures-channel-preview = { version = "0.3.0-alpha.18" } -futures-lite = { version = "1.11.3", default-features = false } +futures-channel = "0.3" +futures-lite = { version = "2", default-features = false } wasm-bindgen-test = { path = '../test' } [lints] From 88452fade69e677f50643651d55e60bddc427491 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Wed, 25 Dec 2024 15:41:08 +0100 Subject: [PATCH 633/641] Use alloc::vec::Vec instead of Vec for no_std support (#4378) --- CHANGELOG.md | 3 +++ crates/web-sys/src/features/gen_AudioBuffer.rs | 5 ++++- .../src/features/gen_DomMatrixReadOnly.rs | 4 ++-- .../gen_FetchReadableStreamReadDataArray.rs | 2 +- crates/web-sys/src/features/gen_GamepadPose.rs | 16 ++++++++++------ crates/web-sys/src/features/gen_GamepadTouch.rs | 4 ++-- crates/web-sys/src/features/gen_ImageData.rs | 2 +- .../web-sys/src/features/gen_MidiMessageEvent.rs | 2 +- .../src/features/gen_MidiMessageEventInit.rs | 2 +- crates/web-sys/src/features/gen_TextEncoder.rs | 4 ++-- .../web-sys/src/features/gen_VrEyeParameters.rs | 2 +- crates/web-sys/src/features/gen_VrFrameData.rs | 8 ++++---- crates/web-sys/src/features/gen_VrPose.rs | 12 ++++++------ .../src/features/gen_VrStageParameters.rs | 4 +++- .../web-sys/src/features/gen_WaveShaperNode.rs | 2 +- .../web-sys/src/features/gen_XrRigidTransform.rs | 2 +- crates/web-sys/src/features/gen_XrSession.rs | 2 +- crates/web-sys/src/features/gen_XrView.rs | 2 +- crates/web-sys/src/lib.rs | 2 +- crates/webidl/src/util.rs | 16 ++++++++++++---- 20 files changed, 58 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00eaaa3cb8..c626bd35c14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,9 @@ * Internal functions are now removed instead of invalidly imported if they are unused. [#4366](https://github.com/rustwasm/wasm-bindgen/pull/4366) +* Fixed `no_std` support for all APIs in `web-sys`. + [#4378](https://github.com/rustwasm/wasm-bindgen/pull/4378) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/web-sys/src/features/gen_AudioBuffer.rs b/crates/web-sys/src/features/gen_AudioBuffer.rs index 2ae5bc16000..38bf0b0d404 100644 --- a/crates/web-sys/src/features/gen_AudioBuffer.rs +++ b/crates/web-sys/src/features/gen_AudioBuffer.rs @@ -146,5 +146,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/getChannelData)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`*"] - pub fn get_channel_data(this: &AudioBuffer, channel: u32) -> Result, JsValue>; + pub fn get_channel_data( + this: &AudioBuffer, + channel: u32, + ) -> Result<::alloc::vec::Vec, JsValue>; } diff --git a/crates/web-sys/src/features/gen_DomMatrixReadOnly.rs b/crates/web-sys/src/features/gen_DomMatrixReadOnly.rs index 90bf25ed14c..1aa88cc6b84 100644 --- a/crates/web-sys/src/features/gen_DomMatrixReadOnly.rs +++ b/crates/web-sys/src/features/gen_DomMatrixReadOnly.rs @@ -458,14 +458,14 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/toFloat32Array)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixReadOnly`*"] - pub fn to_float32_array(this: &DomMatrixReadOnly) -> Result, JsValue>; + pub fn to_float32_array(this: &DomMatrixReadOnly) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "DOMMatrixReadOnly" , js_name = toFloat64Array)] #[doc = "The `toFloat64Array()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/toFloat64Array)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomMatrixReadOnly`*"] - pub fn to_float64_array(this: &DomMatrixReadOnly) -> Result, JsValue>; + pub fn to_float64_array(this: &DomMatrixReadOnly) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (method , structural , js_class = "DOMMatrixReadOnly" , js_name = toJSON)] #[doc = "The `toJSON()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs index 3305164bc57..6fbca890dc4 100644 --- a/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs +++ b/crates/web-sys/src/features/gen_FetchReadableStreamReadDataArray.rs @@ -14,7 +14,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataArray`*"] #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &FetchReadableStreamReadDataArray) -> Option>; + pub fn get_value(this: &FetchReadableStreamReadDataArray) -> Option<::alloc::vec::Vec>; #[doc = "Change the `value` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `FetchReadableStreamReadDataArray`*"] diff --git a/crates/web-sys/src/features/gen_GamepadPose.rs b/crates/web-sys/src/features/gen_GamepadPose.rs index 923f1b47e6b..fb1b1ef287c 100644 --- a/crates/web-sys/src/features/gen_GamepadPose.rs +++ b/crates/web-sys/src/features/gen_GamepadPose.rs @@ -32,40 +32,44 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/position)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn position(this: &GamepadPose) -> Result>, JsValue>; + pub fn position(this: &GamepadPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "GamepadPose" , js_name = linearVelocity)] #[doc = "Getter for the `linearVelocity` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/linearVelocity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn linear_velocity(this: &GamepadPose) -> Result>, JsValue>; + pub fn linear_velocity(this: &GamepadPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "GamepadPose" , js_name = linearAcceleration)] #[doc = "Getter for the `linearAcceleration` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/linearAcceleration)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn linear_acceleration(this: &GamepadPose) -> Result>, JsValue>; + pub fn linear_acceleration( + this: &GamepadPose, + ) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "GamepadPose" , js_name = orientation)] #[doc = "Getter for the `orientation` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/orientation)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn orientation(this: &GamepadPose) -> Result>, JsValue>; + pub fn orientation(this: &GamepadPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "GamepadPose" , js_name = angularVelocity)] #[doc = "Getter for the `angularVelocity` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/angularVelocity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn angular_velocity(this: &GamepadPose) -> Result>, JsValue>; + pub fn angular_velocity(this: &GamepadPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "GamepadPose" , js_name = angularAcceleration)] #[doc = "Getter for the `angularAcceleration` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose/angularAcceleration)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadPose`*"] - pub fn angular_acceleration(this: &GamepadPose) -> Result>, JsValue>; + pub fn angular_acceleration( + this: &GamepadPose, + ) -> Result>, JsValue>; } diff --git a/crates/web-sys/src/features/gen_GamepadTouch.rs b/crates/web-sys/src/features/gen_GamepadTouch.rs index af4e6097294..f1bcd039a34 100644 --- a/crates/web-sys/src/features/gen_GamepadTouch.rs +++ b/crates/web-sys/src/features/gen_GamepadTouch.rs @@ -48,7 +48,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn position(this: &GamepadTouch) -> Vec; + pub fn position(this: &GamepadTouch) -> ::alloc::vec::Vec; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = surfaceDimensions)] #[doc = "Getter for the `surfaceDimensions` field of this object."] @@ -59,5 +59,5 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn surface_dimensions(this: &GamepadTouch) -> Option>; + pub fn surface_dimensions(this: &GamepadTouch) -> Option<::alloc::vec::Vec>; } diff --git a/crates/web-sys/src/features/gen_ImageData.rs b/crates/web-sys/src/features/gen_ImageData.rs index 71081d12b86..eed063ae96f 100644 --- a/crates/web-sys/src/features/gen_ImageData.rs +++ b/crates/web-sys/src/features/gen_ImageData.rs @@ -32,7 +32,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ImageData/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageData`*"] - pub fn data(this: &ImageData) -> ::wasm_bindgen::Clamped>; + pub fn data(this: &ImageData) -> ::wasm_bindgen::Clamped<::alloc::vec::Vec>; #[wasm_bindgen(catch, constructor, js_class = "ImageData")] #[doc = "The `new ImageData(..)` constructor, creating a new instance of `ImageData`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MidiMessageEvent.rs b/crates/web-sys/src/features/gen_MidiMessageEvent.rs index 9b19e305d18..0bfeb396953 100644 --- a/crates/web-sys/src/features/gen_MidiMessageEvent.rs +++ b/crates/web-sys/src/features/gen_MidiMessageEvent.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MIDIMessageEvent/data)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEvent`*"] - pub fn data(this: &MidiMessageEvent) -> Result, JsValue>; + pub fn data(this: &MidiMessageEvent) -> Result<::alloc::vec::Vec, JsValue>; #[wasm_bindgen(catch, constructor, js_class = "MIDIMessageEvent")] #[doc = "The `new MidiMessageEvent(..)` constructor, creating a new instance of `MidiMessageEvent`."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs index aa5489fcabb..cc97c207493 100644 --- a/crates/web-sys/src/features/gen_MidiMessageEventInit.rs +++ b/crates/web-sys/src/features/gen_MidiMessageEventInit.rs @@ -44,7 +44,7 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] #[wasm_bindgen(method, getter = "data")] - pub fn get_data(this: &MidiMessageEventInit) -> Option>; + pub fn get_data(this: &MidiMessageEventInit) -> Option<::alloc::vec::Vec>; #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `MidiMessageEventInit`*"] diff --git a/crates/web-sys/src/features/gen_TextEncoder.rs b/crates/web-sys/src/features/gen_TextEncoder.rs index 9585b5f87c6..4d49b845b39 100644 --- a/crates/web-sys/src/features/gen_TextEncoder.rs +++ b/crates/web-sys/src/features/gen_TextEncoder.rs @@ -32,12 +32,12 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextEncoder`*"] - pub fn encode(this: &TextEncoder) -> Vec; + pub fn encode(this: &TextEncoder) -> ::alloc::vec::Vec; # [wasm_bindgen (method , structural , js_class = "TextEncoder" , js_name = encode)] #[doc = "The `encode()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `TextEncoder`*"] - pub fn encode_with_input(this: &TextEncoder, input: &str) -> Vec; + pub fn encode_with_input(this: &TextEncoder, input: &str) -> ::alloc::vec::Vec; } diff --git a/crates/web-sys/src/features/gen_VrEyeParameters.rs b/crates/web-sys/src/features/gen_VrEyeParameters.rs index 5f92712bba0..c68f02bafd5 100644 --- a/crates/web-sys/src/features/gen_VrEyeParameters.rs +++ b/crates/web-sys/src/features/gen_VrEyeParameters.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VREyeParameters/offset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrEyeParameters`*"] - pub fn offset(this: &VrEyeParameters) -> Result, JsValue>; + pub fn offset(this: &VrEyeParameters) -> Result<::alloc::vec::Vec, JsValue>; #[cfg(feature = "VrFieldOfView")] # [wasm_bindgen (structural , method , getter , js_class = "VREyeParameters" , js_name = fieldOfView)] #[doc = "Getter for the `fieldOfView` field of this object."] diff --git a/crates/web-sys/src/features/gen_VrFrameData.rs b/crates/web-sys/src/features/gen_VrFrameData.rs index a1a3680b6de..8fbe18f9a8a 100644 --- a/crates/web-sys/src/features/gen_VrFrameData.rs +++ b/crates/web-sys/src/features/gen_VrFrameData.rs @@ -25,28 +25,28 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRFrameData/leftProjectionMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrFrameData`*"] - pub fn left_projection_matrix(this: &VrFrameData) -> Result, JsValue>; + pub fn left_projection_matrix(this: &VrFrameData) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRFrameData" , js_name = leftViewMatrix)] #[doc = "Getter for the `leftViewMatrix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRFrameData/leftViewMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrFrameData`*"] - pub fn left_view_matrix(this: &VrFrameData) -> Result, JsValue>; + pub fn left_view_matrix(this: &VrFrameData) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRFrameData" , js_name = rightProjectionMatrix)] #[doc = "Getter for the `rightProjectionMatrix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRFrameData/rightProjectionMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrFrameData`*"] - pub fn right_projection_matrix(this: &VrFrameData) -> Result, JsValue>; + pub fn right_projection_matrix(this: &VrFrameData) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRFrameData" , js_name = rightViewMatrix)] #[doc = "Getter for the `rightViewMatrix` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRFrameData/rightViewMatrix)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrFrameData`*"] - pub fn right_view_matrix(this: &VrFrameData) -> Result, JsValue>; + pub fn right_view_matrix(this: &VrFrameData) -> Result<::alloc::vec::Vec, JsValue>; #[cfg(feature = "VrPose")] # [wasm_bindgen (structural , method , getter , js_class = "VRFrameData" , js_name = pose)] #[doc = "Getter for the `pose` field of this object."] diff --git a/crates/web-sys/src/features/gen_VrPose.rs b/crates/web-sys/src/features/gen_VrPose.rs index ebbb37f85e6..076ea694c2c 100644 --- a/crates/web-sys/src/features/gen_VrPose.rs +++ b/crates/web-sys/src/features/gen_VrPose.rs @@ -18,40 +18,40 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/position)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn position(this: &VrPose) -> Result>, JsValue>; + pub fn position(this: &VrPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRPose" , js_name = linearVelocity)] #[doc = "Getter for the `linearVelocity` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/linearVelocity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn linear_velocity(this: &VrPose) -> Result>, JsValue>; + pub fn linear_velocity(this: &VrPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRPose" , js_name = linearAcceleration)] #[doc = "Getter for the `linearAcceleration` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/linearAcceleration)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn linear_acceleration(this: &VrPose) -> Result>, JsValue>; + pub fn linear_acceleration(this: &VrPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRPose" , js_name = orientation)] #[doc = "Getter for the `orientation` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/orientation)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn orientation(this: &VrPose) -> Result>, JsValue>; + pub fn orientation(this: &VrPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRPose" , js_name = angularVelocity)] #[doc = "Getter for the `angularVelocity` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/angularVelocity)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn angular_velocity(this: &VrPose) -> Result>, JsValue>; + pub fn angular_velocity(this: &VrPose) -> Result>, JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "VRPose" , js_name = angularAcceleration)] #[doc = "Getter for the `angularAcceleration` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRPose/angularAcceleration)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrPose`*"] - pub fn angular_acceleration(this: &VrPose) -> Result>, JsValue>; + pub fn angular_acceleration(this: &VrPose) -> Result>, JsValue>; } diff --git a/crates/web-sys/src/features/gen_VrStageParameters.rs b/crates/web-sys/src/features/gen_VrStageParameters.rs index 0c9b199ffa5..3ae11ff57fd 100644 --- a/crates/web-sys/src/features/gen_VrStageParameters.rs +++ b/crates/web-sys/src/features/gen_VrStageParameters.rs @@ -18,7 +18,9 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VRStageParameters/sittingToStandingTransform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `VrStageParameters`*"] - pub fn sitting_to_standing_transform(this: &VrStageParameters) -> Result, JsValue>; + pub fn sitting_to_standing_transform( + this: &VrStageParameters, + ) -> Result<::alloc::vec::Vec, JsValue>; # [wasm_bindgen (structural , method , getter , js_class = "VRStageParameters" , js_name = sizeX)] #[doc = "Getter for the `sizeX` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WaveShaperNode.rs b/crates/web-sys/src/features/gen_WaveShaperNode.rs index 88c2eaa017b..8d0315c4590 100644 --- a/crates/web-sys/src/features/gen_WaveShaperNode.rs +++ b/crates/web-sys/src/features/gen_WaveShaperNode.rs @@ -18,7 +18,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WaveShaperNode`*"] - pub fn curve(this: &WaveShaperNode) -> Option>; + pub fn curve(this: &WaveShaperNode) -> Option<::alloc::vec::Vec>; # [wasm_bindgen (structural , method , setter , js_class = "WaveShaperNode" , js_name = curve)] #[doc = "Setter for the `curve` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_XrRigidTransform.rs b/crates/web-sys/src/features/gen_XrRigidTransform.rs index e1970a1b80f..eaaaac7857b 100644 --- a/crates/web-sys/src/features/gen_XrRigidTransform.rs +++ b/crates/web-sys/src/features/gen_XrRigidTransform.rs @@ -50,7 +50,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn matrix(this: &XrRigidTransform) -> Vec; + pub fn matrix(this: &XrRigidTransform) -> ::alloc::vec::Vec; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRRigidTransform" , js_name = inverse)] #[doc = "Getter for the `inverse` field of this object."] diff --git a/crates/web-sys/src/features/gen_XrSession.rs b/crates/web-sys/src/features/gen_XrSession.rs index c761efbf2b1..ea79ee7238f 100644 --- a/crates/web-sys/src/features/gen_XrSession.rs +++ b/crates/web-sys/src/features/gen_XrSession.rs @@ -49,7 +49,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn supported_frame_rates(this: &XrSession) -> Option>; + pub fn supported_frame_rates(this: &XrSession) -> Option<::alloc::vec::Vec>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrRenderState")] # [wasm_bindgen (structural , method , getter , js_class = "XRSession" , js_name = renderState)] diff --git a/crates/web-sys/src/features/gen_XrView.rs b/crates/web-sys/src/features/gen_XrView.rs index 995458e823f..a304c594bd3 100644 --- a/crates/web-sys/src/features/gen_XrView.rs +++ b/crates/web-sys/src/features/gen_XrView.rs @@ -38,7 +38,7 @@ extern "C" { #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] - pub fn projection_matrix(this: &XrView) -> Vec; + pub fn projection_matrix(this: &XrView) -> ::alloc::vec::Vec; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrRigidTransform")] # [wasm_bindgen (structural , method , getter , js_class = "XRView" , js_name = transform)] diff --git a/crates/web-sys/src/lib.rs b/crates/web-sys/src/lib.rs index bb2e73de44e..38cdb6732e9 100644 --- a/crates/web-sys/src/lib.rs +++ b/crates/web-sys/src/lib.rs @@ -12,7 +12,7 @@ //! require. #![doc(html_root_url = "https://docs.rs/web-sys/0.3")] -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![allow(deprecated)] extern crate alloc; diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index df7808fb3a8..0121291b0c5 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -7,6 +7,7 @@ use std::ptr; use heck::{ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase}; use proc_macro2::{Ident, TokenStream}; use quote::quote; +use syn::punctuated::Punctuated; use wasm_bindgen_backend::util::{ident_ty, raw_ident, rust_ident}; use weedle::attribute::{ ExtendedAttribute, ExtendedAttributeIdent, ExtendedAttributeList, ExtendedAttributeNoArgs, @@ -177,7 +178,7 @@ pub(crate) fn slice_ty(t: syn::Type) -> syn::Type { .into() } -/// From `T` create `Vec`. +/// From `T` create `alloc::Vec`. pub(crate) fn vec_ty(t: syn::Type) -> syn::Type { let arguments = syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { colon2_token: None, @@ -186,9 +187,16 @@ pub(crate) fn vec_ty(t: syn::Type) -> syn::Type { gt_token: Default::default(), }); - let ident = raw_ident("Vec"); - let seg = syn::PathSegment { ident, arguments }; - let path: syn::Path = seg.into(); + let mut path = syn::Path { + leading_colon: Some(Default::default()), + segments: Punctuated::new(), + }; + path.segments.push(raw_ident("alloc").into()); + path.segments.push(raw_ident("vec").into()); + path.segments.push(syn::PathSegment { + ident: raw_ident("Vec"), + arguments, + }); let ty = syn::TypePath { qself: None, path }; ty.into() } From 24f20ae9bc480c5ad0778fdb1481eb23461f0d82 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 25 Dec 2024 19:51:14 +0100 Subject: [PATCH 634/641] Prevent generating duplicate exports (#4380) --- CHANGELOG.md | 3 +++ crates/cli-support/src/js/mod.rs | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c626bd35c14..16bd83de8e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,9 @@ * Fixed `no_std` support for all APIs in `web-sys`. [#4378](https://github.com/rustwasm/wasm-bindgen/pull/4378) +* Prevent generating duplicate exports for closure conversions. + [#4380](https://github.com/rustwasm/wasm-bindgen/pull/4380) + -------------------------------------------------------------------------------- ## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 118f75752cc..c7252852b49 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -4270,8 +4270,18 @@ __wbg_set_wasm(wasm);" "memory".to_owned() } walrus::ExportItem::Function(f) => match &self.module.funcs.get(f).name { - Some(s) => to_js_identifier(s), - None => default_name, + Some(s) => { + let mut name = to_js_identifier(s); + + // Account for duplicate export names. + // See https://github.com/rustwasm/wasm-bindgen/issues/4371. + if self.module.exports.get_func(&name).is_ok() { + name.push_str(&self.next_export_idx.to_string()); + } + + name + } + _ => default_name, }, _ => default_name, }; From d59de5c834c55c2f532a38ba535fef51d955fba8 Mon Sep 17 00:00:00 2001 From: Paul Hansen Date: Tue, 7 Jan 2025 02:57:43 -0600 Subject: [PATCH 635/641] Add binding for `Date.to_locale_time_string_with_options` (#4384) --- CHANGELOG.md | 3 +++ crates/js-sys/src/lib.rs | 7 +++++++ crates/js-sys/tests/wasm/Date.rs | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16bd83de8e0..f144ab366c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ * Add `--list`, `--ignored`, `--exact` and `--nocapture` to `wasm-bindgen-test-runner`, analogous to `cargo test`. [#4356](https://github.com/rustwasm/wasm-bindgen/pull/4356) +* Add bindings to `Date.to_locale_time_string_with_options`. + [#4384](https://github.com/rustwasm/wasm-bindgen/pull/4384) + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 459e4d93953..ac1d51bfadd 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -3392,6 +3392,13 @@ extern "C" { #[wasm_bindgen(method, js_name = toLocaleTimeString)] pub fn to_locale_time_string(this: &Date, locale: &str) -> JsString; + #[wasm_bindgen(method, js_name = toLocaleTimeString)] + pub fn to_locale_time_string_with_options( + this: &Date, + locale: &str, + options: &JsValue, + ) -> JsString; + /// The `toString()` method returns a string representing /// the specified Date object. /// diff --git a/crates/js-sys/tests/wasm/Date.rs b/crates/js-sys/tests/wasm/Date.rs index 484498d4739..16ccb3f1529 100644 --- a/crates/js-sys/tests/wasm/Date.rs +++ b/crates/js-sys/tests/wasm/Date.rs @@ -487,6 +487,10 @@ fn to_locale_time_string() { JsValue::from(date.to_locale_time_string("en-US")), "11:15:30 PM", ); + assert_eq!( + JsValue::from(date.to_locale_time_string_with_options("en-US", &JsValue::undefined())), + "11:15:30 PM", + ); } #[wasm_bindgen_test] From c9ee617e9a63340bfba0cecd7d53ba5262f25ddc Mon Sep 17 00:00:00 2001 From: Spxg Date: Tue, 7 Jan 2025 17:03:01 +0800 Subject: [PATCH 636/641] Add guide for running doctest (#4393) --- guide/src/wasm-bindgen-test/usage.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/guide/src/wasm-bindgen-test/usage.md b/guide/src/wasm-bindgen-test/usage.md index 18912049281..0bdf71d0c9c 100644 --- a/guide/src/wasm-bindgen-test/usage.md +++ b/guide/src/wasm-bindgen-test/usage.md @@ -127,3 +127,9 @@ Run the tests by passing `--target wasm32-unknown-unknown` to `cargo test`: ``` cargo test --target wasm32-unknown-unknown ``` + +If you also need to run doctests, add the unstable [`-Zdoctest-xcompile`](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) flag. This requires using the Rust nightly channel like this: + +``` +cargo +nightly test --target wasm32-unknown-unknown -Zdoctest-xcompile +``` From 949b6c62a8387086dbc115ef3d241980788308b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Wieczoreck?= Date: Thu, 9 Jan 2025 21:55:58 +0100 Subject: [PATCH 637/641] Add link to documentation of `wasm_bindgen` macro (#4401) --- crates/macro/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index aa4ab3f066b..85ef2f6c2a8 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -5,6 +5,7 @@ extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; +/// A list of all the attributes can be found here: https://rustwasm.github.io/docs/wasm-bindgen/reference/attributes/index.html #[proc_macro_attribute] pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { match wasm_bindgen_macro_support::expand(attr.into(), input.into()) { From b34ac032341625a13f294a9ee6cf74e990a6ded3 Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Sun, 12 Jan 2025 10:29:11 +0000 Subject: [PATCH 638/641] Add attributes to overwrite return and parameter types, descriptions and names (#4394) --- CHANGELOG.md | 3 + crates/backend/src/ast.rs | 32 ++- crates/backend/src/codegen.rs | 21 +- crates/backend/src/encode.rs | 34 ++- crates/cli-support/Cargo.toml | 1 - crates/cli-support/src/descriptor.rs | 2 +- crates/cli-support/src/js/binding.rs | 234 ++++++++++++---- crates/cli-support/src/js/mod.rs | 27 +- crates/cli-support/src/wit/mod.rs | 24 +- crates/cli-support/src/wit/nonstandard.rs | 21 +- .../cli/tests/reference/function-attrs.d.ts | 34 +++ crates/cli/tests/reference/function-attrs.rs | 69 +++++ crates/macro-support/src/parser.rs | 257 ++++++++++++++---- .../macro/ui-tests/illegal-char-fn-attrs.rs | 34 +++ .../ui-tests/illegal-char-fn-attrs.stderr | 29 ++ crates/macro/ui-tests/invalid-fn-arg-name.rs | 93 +++++++ .../macro/ui-tests/invalid-fn-arg-name.stderr | 71 +++++ .../macro/ui-tests/invalid-self-fn-attrs.rs | 29 ++ .../ui-tests/invalid-self-fn-attrs.stderr | 11 + crates/macro/ui-tests/no-ret-fn-attr.rs | 21 ++ crates/macro/ui-tests/no-ret-fn-attr.stderr | 23 ++ crates/macro/ui-tests/unused-fn-attrs.rs | 85 ++++++ crates/macro/ui-tests/unused-fn-attrs.stderr | 237 ++++++++++++++++ crates/shared/Cargo.toml | 3 + .../src/js => shared/src}/identifier.rs | 0 crates/shared/src/lib.rs | 13 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/typescript-tests/src/function_attrs.rs | 71 +++++ crates/typescript-tests/src/function_attrs.ts | 37 +++ crates/typescript-tests/src/lib.rs | 1 + guide/src/SUMMARY.md | 2 + .../attributes/on-rust-exports/description.md | 60 ++++ .../attributes/on-rust-exports/js_name.md | 48 ++++ .../on-rust-exports/unchecked_type.md | 53 ++++ 34 files changed, 1528 insertions(+), 154 deletions(-) create mode 100644 crates/cli/tests/reference/function-attrs.d.ts create mode 100644 crates/cli/tests/reference/function-attrs.rs create mode 100644 crates/macro/ui-tests/illegal-char-fn-attrs.rs create mode 100644 crates/macro/ui-tests/illegal-char-fn-attrs.stderr create mode 100644 crates/macro/ui-tests/invalid-fn-arg-name.rs create mode 100644 crates/macro/ui-tests/invalid-fn-arg-name.stderr create mode 100644 crates/macro/ui-tests/invalid-self-fn-attrs.rs create mode 100644 crates/macro/ui-tests/invalid-self-fn-attrs.stderr create mode 100644 crates/macro/ui-tests/no-ret-fn-attr.rs create mode 100644 crates/macro/ui-tests/no-ret-fn-attr.stderr create mode 100644 crates/macro/ui-tests/unused-fn-attrs.rs create mode 100644 crates/macro/ui-tests/unused-fn-attrs.stderr rename crates/{cli-support/src/js => shared/src}/identifier.rs (100%) create mode 100644 crates/typescript-tests/src/function_attrs.rs create mode 100644 crates/typescript-tests/src/function_attrs.ts create mode 100644 guide/src/reference/attributes/on-rust-exports/description.md create mode 100644 guide/src/reference/attributes/on-rust-exports/unchecked_type.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f144ab366c6..77a1cc1b33f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add attributes to overwrite return (``unchecked_return_type`) and parameter types (`unchecked_param_type`), descriptions (`return_description` and `param_description`) as well as parameter names (`js_name`) for exported functions and methods. See the guide for more details. + [#4394](https://github.com/rustwasm/wasm-bindgen/pull/4394) + * Add a `copy_to_uninit()` method to all `TypedArray`s. It takes `&mut [MaybeUninit]` and returns `&mut [T]`. [#4340](https://github.com/rustwasm/wasm-bindgen/pull/4340) diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index 0507f055306..0fed5f18c54 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -375,9 +375,9 @@ pub struct Function { /// Whether the function has a js_name attribute pub renamed_via_js_name: bool, /// The arguments to the function - pub arguments: Vec, - /// The return type of the function, if provided - pub ret: Option, + pub arguments: Vec, + /// The data of return type of the function + pub ret: Option, /// Any custom attributes being applied to the function pub rust_attrs: Vec, /// The visibility of this function in Rust @@ -394,6 +394,32 @@ pub struct Function { pub variadic: bool, } +/// Information about a function's return +#[cfg_attr(feature = "extra-traits", derive(Debug))] +#[derive(Clone)] +pub struct FunctionReturnData { + /// Specifies the type of the function's return + pub r#type: syn::Type, + /// Specifies the JS return type override + pub js_type: Option, + /// Specifies the return description + pub desc: Option, +} + +/// Information about a function's argument +#[cfg_attr(feature = "extra-traits", derive(Debug))] +#[derive(Clone)] +pub struct FunctionArgumentData { + /// Specifies the type of the function's argument + pub pat_type: syn::PatType, + /// Specifies the JS argument name override + pub js_name: Option, + /// Specifies the JS function argument type override + pub js_type: Option, + /// Specifies the argument description + pub desc: Option, +} + /// Information about a Struct being exported #[cfg_attr(feature = "extra-traits", derive(Debug))] #[derive(Clone)] diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index c8decb4a136..01450ccb9df 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -637,7 +637,7 @@ impl TryToTokens for ast::Export { let mut argtys = Vec::new(); for (i, arg) in self.function.arguments.iter().enumerate() { - argtys.push(&*arg.ty); + argtys.push(&*arg.pat_type.ty); let i = i + offset; let ident = Ident::new(&format!("arg{}", i), Span::call_site()); fn unwrap_nested_types(ty: &syn::Type) -> &syn::Type { @@ -647,7 +647,7 @@ impl TryToTokens for ast::Export { _ => ty, } } - let ty = unwrap_nested_types(&arg.ty); + let ty = unwrap_nested_types(&arg.pat_type.ty); match &ty { syn::Type::Reference(syn::TypeReference { @@ -720,7 +720,12 @@ impl TryToTokens for ast::Export { elems: Default::default(), paren_token: Default::default(), }); - let syn_ret = self.function.ret.as_ref().unwrap_or(&syn_unit); + let syn_ret = self + .function + .ret + .as_ref() + .map(|ret| &ret.r#type) + .unwrap_or(&syn_unit); if let syn::Type::Reference(_) = syn_ret { bail_span!(syn_ret, "cannot return a borrowed ref with #[wasm_bindgen]",) } @@ -1323,7 +1328,7 @@ impl TryToTokens for ast::ImportFunction { ast::ImportFunctionKind::Normal => {} } let vis = &self.function.rust_vis; - let ret = match &self.function.ret { + let ret = match self.function.ret.as_ref().map(|ret| &ret.r#type) { Some(ty) => quote! { -> #ty }, None => quote!(), }; @@ -1337,8 +1342,8 @@ impl TryToTokens for ast::ImportFunction { let wasm_bindgen_futures = &self.wasm_bindgen_futures; for (i, arg) in self.function.arguments.iter().enumerate() { - let ty = &arg.ty; - let name = match &*arg.pat { + let ty = &arg.pat_type.ty; + let name = match &*arg.pat_type.pat { syn::Pat::Ident(syn::PatIdent { by_ref: None, ident, @@ -1347,7 +1352,7 @@ impl TryToTokens for ast::ImportFunction { }) => ident.clone(), syn::Pat::Wild(_) => syn::Ident::new(&format!("__genarg_{}", i), Span::call_site()), _ => bail_span!( - arg.pat, + arg.pat_type.pat, "unsupported pattern in #[wasm_bindgen] imported function", ), }; @@ -1542,7 +1547,7 @@ impl ToTokens for DescribeImport<'_> { ast::ImportKind::Type(_) => return, ast::ImportKind::Enum(_) => return, }; - let argtys = f.function.arguments.iter().map(|arg| &arg.ty); + let argtys = f.function.arguments.iter().map(|arg| &arg.pat_type.ty); let nargs = f.function.arguments.len() as u32; let inform_ret = match &f.js_ret { Some(ref t) => quote! { <#t as WasmDescribe>::describe(); }, diff --git a/crates/backend/src/encode.rs b/crates/backend/src/encode.rs index d98fe628450..1285f19fc93 100644 --- a/crates/backend/src/encode.rs +++ b/crates/backend/src/encode.rs @@ -215,24 +215,34 @@ fn shared_export<'a>( } fn shared_function<'a>(func: &'a ast::Function, _intern: &'a Interner) -> Function<'a> { - let arg_names = func - .arguments - .iter() - .enumerate() - .map(|(idx, arg)| { - if let syn::Pat::Ident(x) = &*arg.pat { - return x.ident.unraw().to_string(); - } - format!("arg{}", idx) - }) - .collect::>(); + let args = + func.arguments + .iter() + .enumerate() + .map(|(idx, arg)| FunctionArgumentData { + // use argument's "js_name" if it was provided via attributes + // if not use the original Rust argument ident + name: arg.js_name.clone().unwrap_or( + if let syn::Pat::Ident(x) = &*arg.pat_type.pat { + x.ident.unraw().to_string() + } else { + format!("arg{}", idx) + }, + ), + ty_override: arg.js_type.as_deref(), + desc: arg.desc.as_deref(), + }) + .collect::>(); + Function { - arg_names, + args, asyncness: func.r#async, name: &func.name, generate_typescript: func.generate_typescript, generate_jsdoc: func.generate_jsdoc, variadic: func.variadic, + ret_ty_override: func.ret.as_ref().and_then(|v| v.js_type.as_deref()), + ret_desc: func.ret.as_ref().and_then(|v| v.desc.as_deref()), } } diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 6a4a5d94eee..60e3e6fe6f0 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -21,7 +21,6 @@ rustc-demangle = "0.1.13" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" -unicode-ident = "1.0.5" walrus = { version = "0.23", features = ['parallel'] } wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.99' } wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.99' } diff --git a/crates/cli-support/src/descriptor.rs b/crates/cli-support/src/descriptor.rs index d9b7fd63eab..3ddf75405b3 100644 --- a/crates/cli-support/src/descriptor.rs +++ b/crates/cli-support/src/descriptor.rs @@ -1,6 +1,6 @@ use std::char; -use crate::js::identifier::is_valid_ident; +use wasm_bindgen_shared::identifier::is_valid_ident; macro_rules! tys { ($($a:ident)*) => (tys! { @ ($($a)*) 0 }); diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index 637c3a5edf7..09501a67b40 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -6,7 +6,9 @@ use crate::js::Context; use crate::wit::InstructionData; -use crate::wit::{Adapter, AdapterId, AdapterKind, AdapterType, Instruction}; +use crate::wit::{ + Adapter, AdapterId, AdapterKind, AdapterType, AuxFunctionArgumentData, Instruction, +}; use anyhow::{anyhow, bail, Error}; use std::collections::HashSet; use std::fmt::Write; @@ -70,6 +72,7 @@ pub struct JsFunction { pub code: String, pub ts_sig: String, pub js_doc: String, + pub ts_doc: String, pub ts_arg_tys: Vec, pub ts_ret_ty: Option, pub ts_refs: HashSet, @@ -120,11 +123,13 @@ impl<'a, 'b> Builder<'a, 'b> { &mut self, adapter: &Adapter, instructions: &[InstructionData], - explicit_arg_names: &Option>, + args_data: &Option>, asyncness: bool, variadic: bool, generate_jsdoc: bool, debug_name: &str, + ret_ty_override: &Option, + ret_desc: &Option, ) -> Result { if self .cx @@ -158,11 +163,15 @@ impl<'a, 'b> Builder<'a, 'b> { } } for (i, param) in params.enumerate() { - let arg = match explicit_arg_names { + let arg = match args_data { Some(list) => list[i].clone(), - None => format!("arg{}", i), + None => AuxFunctionArgumentData { + name: format!("arg{}", i), + ty_override: None, + desc: None, + }, }; - js.args.push(arg.clone()); + js.args.push(arg.name.clone()); function_args.push(arg); arg_tys.push(param); } @@ -223,16 +232,16 @@ impl<'a, 'b> Builder<'a, 'b> { let mut code = String::new(); code.push('('); - if variadic { - if let Some((last, non_variadic_args)) = function_args.split_last() { - code.push_str(&non_variadic_args.join(", ")); - if !non_variadic_args.is_empty() { - code.push_str(", "); - } - code.push_str((String::from("...") + last).as_str()) + for (i, v) in function_args.iter().enumerate() { + if i != 0 { + code.push_str(", "); } - } else { - code.push_str(&function_args.join(", ")); + + if variadic && i == function_args.len() - 1 { + code.push_str("..."); + } + + code.push_str(&v.name); } code.push_str(") {\n"); @@ -272,17 +281,34 @@ impl<'a, 'b> Builder<'a, 'b> { &mut might_be_optional_field, asyncness, variadic, + ret_ty_override, ); let js_doc = if generate_jsdoc { - self.js_doc_comments(&function_args, &arg_tys, &ts_ret_ty, variadic) + self.js_doc_comments( + &function_args, + &arg_tys, + &ts_ret_ty, + variadic, + ret_ty_override, + ret_desc, + ) } else { String::new() }; + // generate ts_doc + // ts doc is slightly different than js doc, where there is no + // arguments types followed after @param tag, as well as no special + // casings for arguments names such as "@param {string} [arg]" that + // tags the argument as optional, for ts doc we only need arg names + // and rest are just derived from function ts signature + let ts_doc = self.ts_doc_comments(&function_args, ret_desc); + Ok(JsFunction { code, ts_sig, js_doc, + ts_doc, ts_arg_tys, ts_ret_ty, ts_refs, @@ -299,19 +325,26 @@ impl<'a, 'b> Builder<'a, 'b> { /// return value, it doesn't include the function name in any way. fn typescript_signature( &self, - arg_names: &[String], + args_data: &[AuxFunctionArgumentData], arg_tys: &[&AdapterType], result_tys: &[AdapterType], might_be_optional_field: &mut bool, asyncness: bool, variadic: bool, + ret_ty_override: &Option, ) -> (String, Vec, Option, HashSet) { // Build up the typescript signature as well let mut omittable = true; let mut ts_args = Vec::new(); let mut ts_arg_tys = Vec::new(); let mut ts_refs = HashSet::new(); - for (name, ty) in arg_names.iter().zip(arg_tys).rev() { + for ( + AuxFunctionArgumentData { + name, ty_override, .. + }, + ty, + ) in args_data.iter().zip(arg_tys).rev() + { // In TypeScript, we can mark optional parameters as omittable // using the `?` suffix, but only if they're not followed by // non-omittable parameters. Therefore iterate the parameter list @@ -319,17 +352,23 @@ impl<'a, 'b> Builder<'a, 'b> { // soon as a non-optional parameter is encountered. let mut arg = name.to_string(); let mut ts = String::new(); - match ty { - AdapterType::Option(ty) if omittable => { - // e.g. `foo?: string | null` - arg.push_str("?: "); - adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); - ts.push_str(" | null"); - } - ty => { - omittable = false; - arg.push_str(": "); - adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); + if let Some(v) = ty_override { + omittable = false; + arg.push_str(": "); + ts.push_str(v); + } else { + match ty { + AdapterType::Option(ty) if omittable => { + // e.g. `foo?: string | null` + arg.push_str("?: "); + adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); + ts.push_str(" | null"); + } + ty => { + adapter2ts(ty, TypePosition::Argument, &mut ts, Some(&mut ts_refs)); + omittable = false; + arg.push_str(": "); + } } } arg.push_str(&ts); @@ -363,15 +402,19 @@ impl<'a, 'b> Builder<'a, 'b> { if self.constructor.is_none() { ts.push_str(": "); let mut ret = String::new(); - match result_tys.len() { - 0 => ret.push_str("void"), - 1 => adapter2ts( - &result_tys[0], - TypePosition::Return, - &mut ret, - Some(&mut ts_refs), - ), - _ => ret.push_str("[any]"), + if let Some(v) = &ret_ty_override { + ret.push_str(v); + } else { + match result_tys.len() { + 0 => ret.push_str("void"), + 1 => adapter2ts( + &result_tys[0], + TypePosition::Return, + &mut ret, + Some(&mut ts_refs), + ), + _ => ret.push_str("[any]"), + } } if asyncness { ret = format!("Promise<{}>", ret); @@ -386,57 +429,132 @@ impl<'a, 'b> Builder<'a, 'b> { /// and the return value. fn js_doc_comments( &self, - arg_names: &[String], + args_data: &[AuxFunctionArgumentData], arg_tys: &[&AdapterType], ts_ret: &Option, variadic: bool, + ret_ty_override: &Option, + ret_desc: &Option, ) -> String { - let (variadic_arg, fn_arg_names) = match arg_names.split_last() { + let (variadic_arg, fn_arg_names) = match args_data.split_last() { Some((last, args)) if variadic => (Some(last), args), - _ => (None, arg_names), + _ => (None, args_data), }; let mut omittable = true; let mut js_doc_args = Vec::new(); - for (name, ty) in fn_arg_names.iter().zip(arg_tys).rev() { + for ( + AuxFunctionArgumentData { + name, + ty_override, + desc, + }, + ty, + ) in fn_arg_names.iter().zip(arg_tys).rev() + { let mut arg = "@param {".to_string(); - match ty { - AdapterType::Option(ty) if omittable => { - adapter2ts(ty, TypePosition::Argument, &mut arg, None); - arg.push_str(" | null} "); - arg.push('['); - arg.push_str(name); - arg.push(']'); - } - _ => { - omittable = false; - adapter2ts(ty, TypePosition::Argument, &mut arg, None); - arg.push_str("} "); - arg.push_str(name); + if let Some(v) = ty_override { + omittable = false; + arg.push_str(v); + arg.push_str("} "); + arg.push_str(name); + } else { + match ty { + AdapterType::Option(ty) if omittable => { + adapter2ts(ty, TypePosition::Argument, &mut arg, None); + arg.push_str(" | null} "); + arg.push('['); + arg.push_str(name); + arg.push(']'); + } + _ => { + omittable = false; + adapter2ts(ty, TypePosition::Argument, &mut arg, None); + arg.push_str("} "); + arg.push_str(name); + } } } + // append description + if let Some(v) = desc { + arg.push_str(" - "); + arg.push_str(v); + } arg.push('\n'); js_doc_args.push(arg); } let mut ret: String = js_doc_args.into_iter().rev().collect(); - if let (Some(name), Some(ty)) = (variadic_arg, arg_tys.last()) { + if let ( + Some(AuxFunctionArgumentData { + name, + ty_override, + desc, + }), + Some(ty), + ) = (variadic_arg, arg_tys.last()) + { ret.push_str("@param {..."); - adapter2ts(ty, TypePosition::Argument, &mut ret, None); + if let Some(v) = ty_override { + ret.push_str(v); + } else { + adapter2ts(ty, TypePosition::Argument, &mut ret, None); + } ret.push_str("} "); ret.push_str(name); + + // append desc + if let Some(v) = desc { + ret.push_str(" - "); + ret.push_str(v); + } ret.push('\n'); } - if let Some(ts) = ts_ret { - if ts != "void" { + if let Some(ts) = ret_ty_override.as_ref().or(ts_ret.as_ref()) { + // skip if type is void and there is no description + if ts != "void" || ret_desc.is_some() { ret.push_str(&format!("@returns {{{}}}", ts)); } + // append return description + if let Some(v) = ret_desc { + ret.push(' '); + ret.push_str(v); + } } ret } + + /// Returns a helpful TS doc comment which lists all parameters and + /// the return value descriptions. + fn ts_doc_comments( + &self, + args_data: &[AuxFunctionArgumentData], + ret_desc: &Option, + ) -> String { + let mut ts_doc = String::new(); + // ofc we dont need arg type for ts doc, only arg name + for AuxFunctionArgumentData { name, desc, .. } in args_data.iter() { + ts_doc.push_str("@param "); + ts_doc.push_str(name); + + // append desc + if let Some(v) = desc { + ts_doc.push_str(" - "); + ts_doc.push_str(v); + } + ts_doc.push('\n'); + } + + // only if there is return description, as we dont want empty @return tag + if let Some(ret_desc) = ret_desc { + ts_doc.push_str("@returns "); + ts_doc.push_str(ret_desc); + } + ts_doc + } } impl<'a, 'b> JsBuilder<'a, 'b> { diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index c7252852b49..3ba5be3a719 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -10,7 +10,6 @@ use crate::wit::{JsImport, JsImportName, NonstandardWitSection, WasmBindgenAux}; use crate::{reset_indentation, Bindgen, EncodeInto, OutputMode, PLACEHOLDER_MODULE}; use anyhow::{anyhow, bail, Context as _, Error}; use binding::TsReference; -use identifier::is_valid_ident; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::fmt; @@ -18,9 +17,9 @@ use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use walrus::{FunctionId, ImportId, MemoryId, Module, TableId, ValType}; +use wasm_bindgen_shared::identifier::is_valid_ident; mod binding; -pub mod identifier; pub struct Context<'a> { globals: String, @@ -2829,16 +2828,20 @@ __wbg_set_wasm(wasm);" ContextAdapterKind::Import(_) => builder.cx.config.debug, }); builder.catch(catch); - let mut arg_names = &None; + let mut args = &None; let mut asyncness = false; let mut variadic = false; let mut generate_jsdoc = false; + let mut ret_ty_override = &None; + let mut ret_desc = &None; match kind { ContextAdapterKind::Export(export) => { - arg_names = &export.arg_names; + args = &export.args; asyncness = export.asyncness; variadic = export.variadic; generate_jsdoc = export.generate_jsdoc; + ret_ty_override = &export.fn_ret_ty_override; + ret_desc = &export.fn_ret_desc; match &export.kind { AuxExportKind::Function(_) => {} AuxExportKind::Constructor(class) => builder.constructor(class), @@ -2870,6 +2873,7 @@ __wbg_set_wasm(wasm);" ts_ret_ty, ts_refs, js_doc, + ts_doc, code, might_be_optional_field, catch, @@ -2878,11 +2882,13 @@ __wbg_set_wasm(wasm);" .process( adapter, instrs, - arg_names, + args, asyncness, variadic, generate_jsdoc, &debug_name, + ret_ty_override, + ret_desc, ) .with_context(|| "failed to generates bindings for ".to_string() + &debug_name)?; @@ -2897,8 +2903,17 @@ __wbg_set_wasm(wasm);" let ts_sig = export.generate_typescript.then_some(ts_sig.as_str()); + // only include `ts_doc` for format if there were arguments or a return var description + // this is because if there are no arguments or return var description, `ts_doc` + // provides no additional value on top of what `ts_sig` already does + let ts_doc_opts = (ret_desc.is_some() + || args + .as_ref() + .is_some_and(|v| v.iter().any(|arg| arg.desc.is_some()))) + .then_some(ts_doc); + let js_docs = format_doc_comments(&export.comments, Some(js_doc)); - let ts_docs = format_doc_comments(&export.comments, None); + let ts_docs = format_doc_comments(&export.comments, ts_doc_opts); match &export.kind { AuxExportKind::Function(name) => { diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 930fddca566..a514e875b3d 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -521,18 +521,32 @@ impl<'a> Context<'a> { None => AuxExportKind::Function(export.function.name.to_string()), }; + let args = Some( + export + .function + .args + .into_iter() + .map(|v| AuxFunctionArgumentData { + name: v.name, + ty_override: v.ty_override.map(String::from), + desc: v.desc.map(String::from), + }) + .collect::>(), + ); let id = self.export_adapter(export_id, descriptor)?; self.aux.export_map.insert( id, AuxExport { debug_name: wasm_name, comments: concatenate_comments(&export.comments), - arg_names: Some(export.function.arg_names), + args, asyncness: export.function.asyncness, kind, generate_typescript: export.function.generate_typescript, generate_jsdoc: export.function.generate_jsdoc, variadic: export.function.variadic, + fn_ret_ty_override: export.function.ret_ty_override.map(String::from), + fn_ret_desc: export.function.ret_desc.map(String::from), }, ); Ok(()) @@ -946,7 +960,7 @@ impl<'a> Context<'a> { getter_id, AuxExport { debug_name: format!("getter for `{}::{}`", struct_.name, field.name), - arg_names: None, + args: None, asyncness: false, comments: concatenate_comments(&field.comments), kind: AuxExportKind::Method { @@ -958,6 +972,8 @@ impl<'a> Context<'a> { generate_typescript: field.generate_typescript, generate_jsdoc: field.generate_jsdoc, variadic: false, + fn_ret_ty_override: None, + fn_ret_desc: None, }, ); @@ -978,7 +994,7 @@ impl<'a> Context<'a> { setter_id, AuxExport { debug_name: format!("setter for `{}::{}`", struct_.name, field.name), - arg_names: None, + args: None, asyncness: false, comments: concatenate_comments(&field.comments), kind: AuxExportKind::Method { @@ -990,6 +1006,8 @@ impl<'a> Context<'a> { generate_typescript: field.generate_typescript, generate_jsdoc: field.generate_jsdoc, variadic: false, + fn_ret_ty_override: None, + fn_ret_desc: None, }, ); } diff --git a/crates/cli-support/src/wit/nonstandard.rs b/crates/cli-support/src/wit/nonstandard.rs index 1e9579dc8ba..2742ddb3262 100644 --- a/crates/cli-support/src/wit/nonstandard.rs +++ b/crates/cli-support/src/wit/nonstandard.rs @@ -73,9 +73,9 @@ pub struct AuxExport { pub debug_name: String, /// Comments parsed in Rust and forwarded here to show up in JS bindings. pub comments: String, - /// Argument names in Rust forwarded here to configure the names that show - /// up in TypeScript bindings. - pub arg_names: Option>, + /// Function's argument info in Rust forwarded here to configure the signature + /// that shows up in bindings. + pub args: Option>, /// Whether this is an async function, to configure the TypeScript return value. pub asyncness: bool, /// What kind of function this is and where it shows up @@ -86,6 +86,21 @@ pub struct AuxExport { pub generate_jsdoc: bool, /// Whether typescript bindings should be generated for this export. pub variadic: bool, + /// Function's return overriding type + pub fn_ret_ty_override: Option, + /// Function's return description + pub fn_ret_desc: Option, +} + +/// Information about a functions' argument +#[derive(Debug, Clone)] +pub struct AuxFunctionArgumentData { + /// Specifies the argument name + pub name: String, + /// Specifies the function argument type override + pub ty_override: Option, + /// Specifies the argument description + pub desc: Option, } /// All possible kinds of exports from a Wasm module. diff --git a/crates/cli/tests/reference/function-attrs.d.ts b/crates/cli/tests/reference/function-attrs.d.ts new file mode 100644 index 00000000000..7ae18c6a5c9 --- /dev/null +++ b/crates/cli/tests/reference/function-attrs.d.ts @@ -0,0 +1,34 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Description for fn_with_attr + * @param firstArg - some number + * @param secondArg + * @returns returns 1 if arg2 is true, or arg1 if arg2 is undefined or false + */ +export function fn_with_attr(firstArg: number, secondArg: boolean | undefined): Promise; +/** + * Description for HoldsNumber + */ +export class HoldsNumber { + private constructor(); + free(): void; + /** + * Description for static_fn_with_attr + * @param firstArg - some number + * @param secondArg + * @returns returns an instance of HoldsNumber, holding arg1 if arg2 is undefined and holding arg2 if not + */ + static static_fn_with_attr(firstArg: number, secondArg: number | undefined): HoldsNumber; + /** + * Description for method_with_attr + * @param firstArg - some number + * @param secondArg + * @returns returns arg1 if arg2 is true, or holding value of self if arg2 is undefined or false + */ + method_with_attr(firstArg: number, secondArg: boolean | undefined): number; + /** + * Inner value + */ + readonly inner: number; +} diff --git a/crates/cli/tests/reference/function-attrs.rs b/crates/cli/tests/reference/function-attrs.rs new file mode 100644 index 00000000000..2621a4cc37d --- /dev/null +++ b/crates/cli/tests/reference/function-attrs.rs @@ -0,0 +1,69 @@ +use wasm_bindgen::prelude::*; + +/// Description for fn_with_attr +#[wasm_bindgen( + unchecked_return_type = "number", + return_description = "returns 1 if arg2 is true, or arg1 if arg2 is undefined or false" +)] +pub async fn fn_with_attr( + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "boolean | undefined")] arg2: JsValue, +) -> Result { + if arg2.is_undefined() { + Ok(arg1.into()) + } else if arg2.is_truthy() { + Ok(1u32.into()) + } else { + Ok(arg1.into()) + } +} + +/// Description for HoldsNumber +#[wasm_bindgen] +pub struct HoldsNumber { + inner: JsValue, +} + +#[wasm_bindgen] +impl HoldsNumber { + /// Inner value + #[wasm_bindgen(getter = "inner", unchecked_return_type = "number")] + pub fn get_inner(&self) -> JsValue { + self.inner.clone() + } + + /// Description for static_fn_with_attr + #[wasm_bindgen( + return_description = "returns an instance of HoldsNumber, holding arg1 if arg2 is undefined and holding arg2 if not" + )] + pub fn static_fn_with_attr( + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "number | undefined")] + arg2: JsValue, + ) -> HoldsNumber { + if arg2.is_undefined() { + HoldsNumber { inner: arg1.into() } + } else { + HoldsNumber { inner: arg2 } + } + } + + /// Description for method_with_attr + #[wasm_bindgen( + unchecked_return_type = "number", + return_description = "returns arg1 if arg2 is true, or holding value of self if arg2 is undefined or false" + )] + pub fn method_with_attr( + &self, + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "boolean | undefined")] arg2: JsValue, + ) -> JsValue { + if arg2.is_undefined() { + self.inner.clone() + } else if arg2.is_truthy() { + arg1.into() + } else { + self.inner.clone() + } + } +} diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index 46c76a1ef21..a3cf49bffd2 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -1,7 +1,7 @@ use std::cell::{Cell, RefCell}; -use std::char; use std::collections::HashMap; use std::str::Chars; +use std::{char, iter}; use ast::OperationKind; use backend::ast::{self, ThreadLocal}; @@ -9,6 +9,7 @@ use backend::util::{ident_ty, ShortHash}; use backend::Diagnostic; use proc_macro2::{Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; +use shared::identifier::is_valid_ident; use syn::ext::IdentExt; use syn::parse::{Parse, ParseStream, Result as SynResult}; use syn::spanned::Spanned; @@ -103,11 +104,37 @@ fn is_non_value_js_keyword(keyword: &str) -> bool { JS_KEYWORDS.contains(&keyword) && !VALUE_LIKE_JS_KEYWORDS.contains(&keyword) } +/// Return an [`Err`] if the given string contains a comment close syntax (`*/``). +fn check_js_comment_close(str: &str, span: Span) -> Result<(), Diagnostic> { + if str.contains("*/") { + Err(Diagnostic::span_error( + span, + "contains comment close syntax", + )) + } else { + Ok(()) + } +} + +/// Return an [`Err`] if the given string is a JS keyword or contains a comment close syntax (`*/``). +fn check_invalid_type(str: &str, span: Span) -> Result<(), Diagnostic> { + if is_js_keyword(str) { + return Err(Diagnostic::span_error(span, "collides with JS keyword")); + } + check_js_comment_close(str, span)?; + Ok(()) +} + #[derive(Default)] struct AttributeParseState { parsed: Cell, checks: Cell, - unused_attrs: RefCell>, + unused_attrs: RefCell>, +} + +struct UnusedState { + error: bool, + ident: Ident, } /// Parsed attributes from a `#[wasm_bindgen(..)]`. @@ -128,53 +155,57 @@ pub struct JsNamespace(Vec); macro_rules! attrgen { ($mac:ident) => { $mac! { - (catch, Catch(Span)), - (constructor, Constructor(Span)), - (method, Method(Span)), - (static_method_of, StaticMethodOf(Span, Ident)), - (js_namespace, JsNamespace(Span, JsNamespace, Vec)), - (module, Module(Span, String, Span)), - (raw_module, RawModule(Span, String, Span)), - (inline_js, InlineJs(Span, String, Span)), - (getter, Getter(Span, Option)), - (setter, Setter(Span, Option)), - (indexing_getter, IndexingGetter(Span)), - (indexing_setter, IndexingSetter(Span)), - (indexing_deleter, IndexingDeleter(Span)), - (structural, Structural(Span)), - (r#final, Final(Span)), - (readonly, Readonly(Span)), - (js_name, JsName(Span, String, Span)), - (js_class, JsClass(Span, String, Span)), - (inspectable, Inspectable(Span)), - (is_type_of, IsTypeOf(Span, syn::Expr)), - (extends, Extends(Span, syn::Path)), - (no_deref, NoDeref(Span)), - (vendor_prefix, VendorPrefix(Span, Ident)), - (variadic, Variadic(Span)), - (typescript_custom_section, TypescriptCustomSection(Span)), - (skip_typescript, SkipTypescript(Span)), - (skip_jsdoc, SkipJsDoc(Span)), - (main, Main(Span)), - (start, Start(Span)), - (wasm_bindgen, WasmBindgen(Span, syn::Path)), - (js_sys, JsSys(Span, syn::Path)), - (wasm_bindgen_futures, WasmBindgenFutures(Span, syn::Path)), - (skip, Skip(Span)), - (typescript_type, TypeScriptType(Span, String, Span)), - (getter_with_clone, GetterWithClone(Span)), - (static_string, StaticString(Span)), - (thread_local, ThreadLocal(Span)), - (thread_local_v2, ThreadLocalV2(Span)), + (catch, false, Catch(Span)), + (constructor, false, Constructor(Span)), + (method, false, Method(Span)), + (static_method_of, false, StaticMethodOf(Span, Ident)), + (js_namespace, false, JsNamespace(Span, JsNamespace, Vec)), + (module, false, Module(Span, String, Span)), + (raw_module, false, RawModule(Span, String, Span)), + (inline_js, false, InlineJs(Span, String, Span)), + (getter, false, Getter(Span, Option)), + (setter, false, Setter(Span, Option)), + (indexing_getter, false, IndexingGetter(Span)), + (indexing_setter, false, IndexingSetter(Span)), + (indexing_deleter, false, IndexingDeleter(Span)), + (structural, false, Structural(Span)), + (r#final, false, Final(Span)), + (readonly, false, Readonly(Span)), + (js_name, false, JsName(Span, String, Span)), + (js_class, false, JsClass(Span, String, Span)), + (inspectable, false, Inspectable(Span)), + (is_type_of, false, IsTypeOf(Span, syn::Expr)), + (extends, false, Extends(Span, syn::Path)), + (no_deref, false, NoDeref(Span)), + (vendor_prefix, false, VendorPrefix(Span, Ident)), + (variadic, false, Variadic(Span)), + (typescript_custom_section, false, TypescriptCustomSection(Span)), + (skip_typescript, false, SkipTypescript(Span)), + (skip_jsdoc, false, SkipJsDoc(Span)), + (main, false, Main(Span)), + (start, false, Start(Span)), + (wasm_bindgen, false, WasmBindgen(Span, syn::Path)), + (js_sys, false, JsSys(Span, syn::Path)), + (wasm_bindgen_futures, false, WasmBindgenFutures(Span, syn::Path)), + (skip, false, Skip(Span)), + (typescript_type, false, TypeScriptType(Span, String, Span)), + (getter_with_clone, false, GetterWithClone(Span)), + (static_string, false, StaticString(Span)), + (thread_local, false, ThreadLocal(Span)), + (thread_local_v2, false, ThreadLocalV2(Span)), + (unchecked_return_type, true, ReturnType(Span, String, Span)), + (return_description, true, ReturnDesc(Span, String, Span)), + (unchecked_param_type, true, ParamType(Span, String, Span)), + (param_description, true, ParamDesc(Span, String, Span)), // For testing purposes only. - (assert_no_shim, AssertNoShim(Span)), + (assert_no_shim, false, AssertNoShim(Span)), } }; } macro_rules! methods { - ($(($name:ident, $variant:ident($($contents:tt)*)),)*) => { + ($(($name:ident, $invalid_unused:literal, $variant:ident($($contents:tt)*)),)*) => { $(methods!(@method $name, $variant($($contents)*));)* fn enforce_used(self) -> Result<(), Diagnostic> { @@ -206,7 +237,10 @@ macro_rules! methods { .map(|attr| { match attr { $(BindgenAttr::$variant(span, ..) => { - syn::parse_quote_spanned!(*span => $name) + UnusedState { + error: $invalid_unused, + ident: syn::parse_quote_spanned!(*span => $name) + } })* } }) @@ -350,7 +384,7 @@ impl Parse for BindgenAttrs { } macro_rules! gen_bindgen_attr { - ($(($method:ident, $($variants:tt)*),)*) => { + ($(($method:ident, $_:literal, $($variants:tt)*),)*) => { /// The possible attributes in the `#[wasm_bindgen]`. #[cfg_attr(feature = "extra-traits", derive(Debug))] pub enum BindgenAttr { @@ -370,7 +404,7 @@ impl Parse for BindgenAttr { let raw_attr_string = format!("r#{}", attr_string); macro_rules! parsers { - ($(($name:ident, $($contents:tt)*),)*) => { + ($(($name:ident, $_:literal, $($contents:tt)*),)*) => { $( if attr_string == stringify!($name) || raw_attr_string == stringify!($name) { parsers!( @@ -619,6 +653,7 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option &**elem, _ => bail_span!( - class.ty, + class.pat_type.ty, "first argument of method must be a shared reference" ), }; @@ -956,10 +991,13 @@ impl<'a> ConvertToAst<(&ast::Program, BindgenAttrs, &'a Option for syn::ItemFn { +impl ConvertToAst<(BindgenAttrs, Vec)> for syn::ItemFn { type Target = ast::Function; - fn convert(self, attrs: BindgenAttrs) -> Result { + fn convert( + self, + (attrs, args_attrs): (BindgenAttrs, Vec), + ) -> Result { match self.vis { syn::Visibility::Public(_) => {} _ if attrs.start().is_some() => {} @@ -979,6 +1017,7 @@ impl ConvertToAst for syn::ItemFn { self.attrs, self.vis, FunctionPosition::Free, + Some(args_attrs), )?; attrs.check_used(); @@ -1027,6 +1066,7 @@ fn function_from_decl( attrs: Vec, vis: syn::Visibility, position: FunctionPosition, + args_attrs: Option>, ) -> Result<(ast::Function, Option), Diagnostic> { if sig.variadic.is_some() { bail_span!(sig.variadic, "can't #[wasm_bindgen] variadic functions"); @@ -1122,10 +1162,44 @@ fn function_from_decl( } } + // process function return data + let ret_ty_override = opts.unchecked_return_type(); + let ret_desc = opts.return_description(); let ret = match output { syn::ReturnType::Default => None, - syn::ReturnType::Type(_, ty) => Some(replace_self(*ty)), + syn::ReturnType::Type(_, ty) => Some(ast::FunctionReturnData { + r#type: replace_self(*ty), + js_type: ret_ty_override + .as_ref() + .map_or::, _>(Ok(None), |(ty, span)| { + check_invalid_type(ty, *span)?; + Ok(Some(ty.to_string())) + })?, + desc: ret_desc.as_ref().map_or::, _>( + Ok(None), + |(desc, span)| { + check_js_comment_close(desc, *span)?; + Ok(Some(desc.to_string())) + }, + )?, + }), }; + // error if there were description or type override specified for + // function return while it doesn't actually return anything + if ret.is_none() && (ret_ty_override.is_some() || ret_desc.is_some()) { + if let Some((_, span)) = ret_ty_override { + return Err(Diagnostic::span_error( + span, + "cannot specify return type for a function that doesn't return", + )); + } + if let Some((_, span)) = ret_desc { + return Err(Diagnostic::span_error( + span, + "cannot specify return description for a function that doesn't return", + )); + } + } let (name, name_span, renamed_via_js_name) = if let Some((js_name, js_name_span)) = opts.js_name() { @@ -1141,11 +1215,9 @@ fn function_from_decl( Ok(( ast::Function { - arguments, name_span, name, renamed_via_js_name, - ret, rust_attrs: attrs, rust_vis: vis, r#unsafe: sig.unsafety.is_some(), @@ -1153,11 +1225,71 @@ fn function_from_decl( generate_typescript: opts.skip_typescript().is_none(), generate_jsdoc: opts.skip_jsdoc().is_none(), variadic: opts.variadic().is_some(), + ret, + arguments: arguments + .into_iter() + .zip( + args_attrs + .into_iter() + .flatten() + .chain(iter::repeat(FnArgAttrs::default())), + ) + .map(|(pat_type, attrs)| ast::FunctionArgumentData { + pat_type, + js_name: attrs.js_name, + js_type: attrs.js_type, + desc: attrs.desc, + }) + .collect(), }, method_self, )) } +/// Helper struct to store extracted function argument attrs +#[derive(Default, Clone)] +struct FnArgAttrs { + js_name: Option, + js_type: Option, + desc: Option, +} + +/// Extracts function arguments attributes +fn extract_args_attrs(sig: &mut syn::Signature) -> Result, Diagnostic> { + let mut args_attrs = vec![]; + for input in sig.inputs.iter_mut() { + if let syn::FnArg::Typed(pat_type) = input { + let attrs = BindgenAttrs::find(&mut pat_type.attrs)?; + let arg_attrs = FnArgAttrs { + js_name: attrs + .js_name() + .map_or(Ok(None), |(js_name_override, span)| { + if is_js_keyword(js_name_override) || !is_valid_ident(js_name_override) { + return Err(Diagnostic::span_error(span, "invalid JS identifier")); + } + Ok(Some(js_name_override.to_string())) + })?, + js_type: attrs + .unchecked_param_type() + .map_or::, _>(Ok(None), |(ty, span)| { + check_invalid_type(ty, span)?; + Ok(Some(ty.to_string())) + })?, + desc: attrs + .param_description() + .map_or::, _>(Ok(None), |(description, span)| { + check_js_comment_close(description, span)?; + Ok(Some(description.to_string())) + })?, + }; + // throw error for any unused attrs + attrs.enforce_used()?; + args_attrs.push(arg_attrs); + } + } + Ok(args_attrs) +} + pub(crate) trait MacroParse { /// Parse the contents of an object into our AST, with a context if necessary. /// @@ -1198,6 +1330,8 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { if let Some((i, _)) = no_mangle { f.attrs.remove(i); } + // extract fn args attributes before parsing to tokens stream + let args_attrs = extract_args_attrs(&mut f.sig)?; let comments = extract_doc_comments(&f.attrs); // If the function isn't used for anything other than being exported to JS, // it'll be unused when not building for the Wasm target and produce a @@ -1218,9 +1352,10 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { }); let rust_name = f.sig.ident.clone(); let start = opts.start().is_some(); + program.exports.push(ast::Export { comments, - function: f.convert(opts)?, + function: f.convert((opts, args_attrs))?, js_class: None, method_kind, method_self: None, @@ -1409,6 +1544,7 @@ impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn { let opts = BindgenAttrs::find(&mut self.attrs)?; let comments = extract_doc_comments(&self.attrs); + let args_attrs: Vec = extract_args_attrs(&mut self.sig)?; let (function, method_self) = function_from_decl( &self.sig.ident, &opts, @@ -1416,6 +1552,7 @@ impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn { self.attrs.clone(), self.vis.clone(), FunctionPosition::Impl { self_ty: class }, + Some(args_attrs), )?; let method_kind = if opts.constructor().is_some() { ast::MethodKind::Constructor @@ -2068,10 +2205,18 @@ pub fn check_unused_attrs(tokens: &mut TokenStream) { assert_eq!(state.parsed.get(), state.checks.get()); let unused_attrs = &*state.unused_attrs.borrow(); if !unused_attrs.is_empty() { + let unused_attrs = unused_attrs.iter().map(|UnusedState { error, ident }| { + if *error { + let text = format!("invalid attribute {} in this position", ident); + quote::quote! { ::core::compile_error!(#text); } + } else { + quote::quote! { let #ident: (); } + } + }); tokens.extend(quote::quote! { // Anonymous scope to prevent name clashes. const _: () = { - #(let #unused_attrs: ();)* + #(#unused_attrs)* }; }); } diff --git a/crates/macro/ui-tests/illegal-char-fn-attrs.rs b/crates/macro/ui-tests/illegal-char-fn-attrs.rs new file mode 100644 index 00000000000..11ba1fa8cda --- /dev/null +++ b/crates/macro/ui-tests/illegal-char-fn-attrs.rs @@ -0,0 +1,34 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn fn_with_illegal_char_attr1( + #[wasm_bindgen(unchecked_param_type = "abcd */firstArg")] arg1: u32, +) -> JsValue { + arg1.into() +} + +#[wasm_bindgen] +pub async fn fn_with_illegal_char_attr2( + #[wasm_bindgen(unchecked_param_type = "num*/ber")] arg1: u32, +) -> JsValue { + arg1.into() +} + +#[wasm_bindgen] +pub async fn fn_with_illegal_char_attr3( + #[wasm_bindgen(param_description = "/* some description */")] arg1: u32, +) -> JsValue { + arg1.into() +} + +#[wasm_bindgen(return_description = "*/ some description")] +pub async fn fn_with_illegal_char_attr4(arg1: u32) -> JsValue { + arg1.into() +} + +#[wasm_bindgen(unchecked_return_type = "number */ abcd")] +pub async fn fn_with_illegal_char_attr5(arg1: u32) -> JsValue { + arg1.into() +} + +fn main() {} diff --git a/crates/macro/ui-tests/illegal-char-fn-attrs.stderr b/crates/macro/ui-tests/illegal-char-fn-attrs.stderr new file mode 100644 index 00000000000..ef9de562305 --- /dev/null +++ b/crates/macro/ui-tests/illegal-char-fn-attrs.stderr @@ -0,0 +1,29 @@ +error: contains comment close syntax + --> ui-tests/illegal-char-fn-attrs.rs:5:43 + | +5 | #[wasm_bindgen(unchecked_param_type = "abcd */firstArg")] arg1: u32, + | ^^^^^^^^^^^^^^^^^ + +error: contains comment close syntax + --> ui-tests/illegal-char-fn-attrs.rs:12:43 + | +12 | #[wasm_bindgen(unchecked_param_type = "num*/ber")] arg1: u32, + | ^^^^^^^^^^ + +error: contains comment close syntax + --> ui-tests/illegal-char-fn-attrs.rs:19:40 + | +19 | #[wasm_bindgen(param_description = "/* some description */")] arg1: u32, + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contains comment close syntax + --> ui-tests/illegal-char-fn-attrs.rs:24:37 + | +24 | #[wasm_bindgen(return_description = "*/ some description")] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: contains comment close syntax + --> ui-tests/illegal-char-fn-attrs.rs:29:40 + | +29 | #[wasm_bindgen(unchecked_return_type = "number */ abcd")] + | ^^^^^^^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-fn-arg-name.rs b/crates/macro/ui-tests/invalid-fn-arg-name.rs new file mode 100644 index 00000000000..d6e882db168 --- /dev/null +++ b/crates/macro/ui-tests/invalid-fn-arg-name.rs @@ -0,0 +1,93 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name1( + #[wasm_bindgen(js_name = "*firstArg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name2( + #[wasm_bindgen(js_name = "#firstArg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name3( + #[wasm_bindgen(js_name = "firstArg#")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name4( + #[wasm_bindgen(js_name = "first-Arg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name5( + #[wasm_bindgen(js_name = "--firstArg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub fn fn_with_invalid_arg_name6( + #[wasm_bindgen(js_name = " first Arg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub struct A {} + +#[wasm_bindgen] +impl A { + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name1( + #[wasm_bindgen(js_name = "(firstArg)")] arg: u32, + ) -> JsValue { + arg.into() + } + + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name2( + #[wasm_bindgen(js_name = "[firstArg]")] arg: u32, + ) -> JsValue { + arg.into() + } + + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name3( + #[wasm_bindgen(js_name = "")] arg: u32, + ) -> JsValue { + arg.into() + } + + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name4( + #[wasm_bindgen(js_name = "firstArg+")] arg: u32, + ) -> JsValue { + arg.into() + } + + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name5( + #[wasm_bindgen(js_name = "@firstArg")] arg: u32, + ) -> JsValue { + arg.into() + } + + #[wasm_bindgen] + pub async fn method_with_invalid_arg_name6( + #[wasm_bindgen(js_name = "!firstArg")] arg: u32, + ) -> JsValue { + arg.into() + } +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-fn-arg-name.stderr b/crates/macro/ui-tests/invalid-fn-arg-name.stderr new file mode 100644 index 00000000000..bee7bd83a04 --- /dev/null +++ b/crates/macro/ui-tests/invalid-fn-arg-name.stderr @@ -0,0 +1,71 @@ +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:5:30 + | +5 | #[wasm_bindgen(js_name = "*firstArg")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:12:30 + | +12 | #[wasm_bindgen(js_name = "#firstArg")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:19:30 + | +19 | #[wasm_bindgen(js_name = "firstArg#")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:26:30 + | +26 | #[wasm_bindgen(js_name = "first-Arg")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:33:30 + | +33 | #[wasm_bindgen(js_name = "--firstArg")] arg: u32, + | ^^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:40:30 + | +40 | #[wasm_bindgen(js_name = " first Arg")] arg: u32, + | ^^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:52:34 + | +52 | #[wasm_bindgen(js_name = "(firstArg)")] arg: u32, + | ^^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:59:34 + | +59 | #[wasm_bindgen(js_name = "[firstArg]")] arg: u32, + | ^^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:66:34 + | +66 | #[wasm_bindgen(js_name = "")] arg: u32, + | ^^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:73:34 + | +73 | #[wasm_bindgen(js_name = "firstArg+")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:80:34 + | +80 | #[wasm_bindgen(js_name = "@firstArg")] arg: u32, + | ^^^^^^^^^^^ + +error: invalid JS identifier + --> ui-tests/invalid-fn-arg-name.rs:87:34 + | +87 | #[wasm_bindgen(js_name = "!firstArg")] arg: u32, + | ^^^^^^^^^^^ diff --git a/crates/macro/ui-tests/invalid-self-fn-attrs.rs b/crates/macro/ui-tests/invalid-self-fn-attrs.rs new file mode 100644 index 00000000000..628a9a38b49 --- /dev/null +++ b/crates/macro/ui-tests/invalid-self-fn-attrs.rs @@ -0,0 +1,29 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct A { + inner: u32 +} + +#[wasm_bindgen] +impl A { + #[wasm_bindgen] + pub fn method_with_self_attr1( + #[wasm_bindgen(unchecked_param_type = "number")] + &self, + arg: u32 + ) -> JsValue { + (self.inner + arg).into() + } + + #[wasm_bindgen] + pub fn method_with_self_attr2( + #[wasm_bindgen(param_description = "some description")] + &self, + arg: u32 + ) -> JsValue { + (self.inner + arg).into() + } +} + +fn main() {} diff --git a/crates/macro/ui-tests/invalid-self-fn-attrs.stderr b/crates/macro/ui-tests/invalid-self-fn-attrs.stderr new file mode 100644 index 00000000000..885f1465c67 --- /dev/null +++ b/crates/macro/ui-tests/invalid-self-fn-attrs.stderr @@ -0,0 +1,11 @@ +error: expected non-macro attribute, found attribute macro `wasm_bindgen` + --> ui-tests/invalid-self-fn-attrs.rs:12:11 + | +12 | #[wasm_bindgen(unchecked_param_type = "number")] + | ^^^^^^^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `wasm_bindgen` + --> ui-tests/invalid-self-fn-attrs.rs:21:11 + | +21 | #[wasm_bindgen(param_description = "some description")] + | ^^^^^^^^^^^^ not a non-macro attribute diff --git a/crates/macro/ui-tests/no-ret-fn-attr.rs b/crates/macro/ui-tests/no-ret-fn-attr.rs new file mode 100644 index 00000000000..afd2d764f31 --- /dev/null +++ b/crates/macro/ui-tests/no-ret-fn-attr.rs @@ -0,0 +1,21 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(unchecked_return_type = "number")] +pub fn no_ret_fn1() {} + +#[wasm_bindgen(return_description = "some description")] +pub async fn no_ret_fn2() {} + +#[wasm_bindgen] +pub struct A {} + +#[wasm_bindgen] +impl A { + #[wasm_bindgen(unchecked_return_type = "number")] + pub async fn no_ret_method1() {} + + #[wasm_bindgen(return_description = "some description")] + pub fn no_ret_method2() {} +} + +fn main() {} diff --git a/crates/macro/ui-tests/no-ret-fn-attr.stderr b/crates/macro/ui-tests/no-ret-fn-attr.stderr new file mode 100644 index 00000000000..66a6bdda801 --- /dev/null +++ b/crates/macro/ui-tests/no-ret-fn-attr.stderr @@ -0,0 +1,23 @@ +error: cannot specify return type for a function that doesn't return + --> ui-tests/no-ret-fn-attr.rs:3:40 + | +3 | #[wasm_bindgen(unchecked_return_type = "number")] + | ^^^^^^^^ + +error: cannot specify return description for a function that doesn't return + --> ui-tests/no-ret-fn-attr.rs:6:37 + | +6 | #[wasm_bindgen(return_description = "some description")] + | ^^^^^^^^^^^^^^^^^^ + +error: cannot specify return type for a function that doesn't return + --> ui-tests/no-ret-fn-attr.rs:14:44 + | +14 | #[wasm_bindgen(unchecked_return_type = "number")] + | ^^^^^^^^ + +error: cannot specify return description for a function that doesn't return + --> ui-tests/no-ret-fn-attr.rs:17:41 + | +17 | #[wasm_bindgen(return_description = "some description")] + | ^^^^^^^^^^^^^^^^^^ diff --git a/crates/macro/ui-tests/unused-fn-attrs.rs b/crates/macro/ui-tests/unused-fn-attrs.rs new file mode 100644 index 00000000000..d483273a5cd --- /dev/null +++ b/crates/macro/ui-tests/unused-fn-attrs.rs @@ -0,0 +1,85 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub fn fn_with_unused_attr1( + #[wasm_bindgen(js_name = "firstArg", js_name = "anotherFirstArg")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub async fn fn_with_unused_attr2( + #[wasm_bindgen(unchecked_param_type = "number", unchecked_param_type = "bigint")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub async fn fn_with_unused_attr3( + #[wasm_bindgen(unchecked_return_type = "number")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub async fn fn_with_unused_attr4( + #[wasm_bindgen(return_description = "some description")] arg: u32, +) -> JsValue { + arg.into() +} + +#[wasm_bindgen] +pub struct A {} + +#[wasm_bindgen] +impl A { + #[wasm_bindgen] + pub async fn fn_with_unused_attr( + #[wasm_bindgen(param_description = "some number")] + #[wasm_bindgen(param_description = "some other description")] arg: u32, + ) -> JsValue { + arg.into() + } +} + +#[wasm_bindgen( + unchecked_return_type = "something", + return_description = "something", + unchecked_param_type = "something", + param_description = "somthing" +)] +struct B {} + +#[wasm_bindgen( + unchecked_return_type = "something", + return_description = "something", + unchecked_param_type = "something", + param_description = "somthing" +)] +impl B { + #[wasm_bindgen] + pub fn foo() {} +} + +#[wasm_bindgen( + unchecked_return_type = "something", + return_description = "something", + unchecked_param_type = "something", + param_description = "somthing" +)] +pub enum C { + Variat +} + +#[wasm_bindgen( + unchecked_return_type = "something", + return_description = "something", + unchecked_param_type = "something", + param_description = "somthing" +)] +impl C { + #[wasm_bindgen] + pub fn foo() {} +} + +fn main() {} diff --git a/crates/macro/ui-tests/unused-fn-attrs.stderr b/crates/macro/ui-tests/unused-fn-attrs.stderr new file mode 100644 index 00000000000..1d53ef47e89 --- /dev/null +++ b/crates/macro/ui-tests/unused-fn-attrs.stderr @@ -0,0 +1,237 @@ +error: unused wasm_bindgen attribute + --> ui-tests/unused-fn-attrs.rs:5:42 + | +5 | #[wasm_bindgen(js_name = "firstArg", js_name = "anotherFirstArg")] arg: u32, + | ^^^^^^^ + +error: unused wasm_bindgen attribute + --> ui-tests/unused-fn-attrs.rs:12:53 + | +12 | #[wasm_bindgen(unchecked_param_type = "number", unchecked_param_type = "bigint")] arg: u32, + | ^^^^^^^^^^^^^^^^^^^^ + +error: unused wasm_bindgen attribute + --> ui-tests/unused-fn-attrs.rs:19:20 + | +19 | #[wasm_bindgen(unchecked_return_type = "number")] arg: u32, + | ^^^^^^^^^^^^^^^^^^^^^ + +error: unused wasm_bindgen attribute + --> ui-tests/unused-fn-attrs.rs:26:20 + | +26 | #[wasm_bindgen(return_description = "some description")] arg: u32, + | ^^^^^^^^^^^^^^^^^^ + +error: unused wasm_bindgen attribute + --> ui-tests/unused-fn-attrs.rs:39:24 + | +39 | #[wasm_bindgen(param_description = "some other description")] arg: u32, + | ^^^^^^^^^^^^^^^^^ + +error: invalid attribute unchecked_return_type in this position + --> ui-tests/unused-fn-attrs.rs:45:1 + | +45 | / #[wasm_bindgen( +46 | | unchecked_return_type = "something", +47 | | return_description = "something", +48 | | unchecked_param_type = "something", +49 | | param_description = "somthing" +50 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute return_description in this position + --> ui-tests/unused-fn-attrs.rs:45:1 + | +45 | / #[wasm_bindgen( +46 | | unchecked_return_type = "something", +47 | | return_description = "something", +48 | | unchecked_param_type = "something", +49 | | param_description = "somthing" +50 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_param_type in this position + --> ui-tests/unused-fn-attrs.rs:45:1 + | +45 | / #[wasm_bindgen( +46 | | unchecked_return_type = "something", +47 | | return_description = "something", +48 | | unchecked_param_type = "something", +49 | | param_description = "somthing" +50 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute param_description in this position + --> ui-tests/unused-fn-attrs.rs:45:1 + | +45 | / #[wasm_bindgen( +46 | | unchecked_return_type = "something", +47 | | return_description = "something", +48 | | unchecked_param_type = "something", +49 | | param_description = "somthing" +50 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_return_type in this position + --> ui-tests/unused-fn-attrs.rs:53:1 + | +53 | / #[wasm_bindgen( +54 | | unchecked_return_type = "something", +55 | | return_description = "something", +56 | | unchecked_param_type = "something", +57 | | param_description = "somthing" +58 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute return_description in this position + --> ui-tests/unused-fn-attrs.rs:53:1 + | +53 | / #[wasm_bindgen( +54 | | unchecked_return_type = "something", +55 | | return_description = "something", +56 | | unchecked_param_type = "something", +57 | | param_description = "somthing" +58 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_param_type in this position + --> ui-tests/unused-fn-attrs.rs:53:1 + | +53 | / #[wasm_bindgen( +54 | | unchecked_return_type = "something", +55 | | return_description = "something", +56 | | unchecked_param_type = "something", +57 | | param_description = "somthing" +58 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute param_description in this position + --> ui-tests/unused-fn-attrs.rs:53:1 + | +53 | / #[wasm_bindgen( +54 | | unchecked_return_type = "something", +55 | | return_description = "something", +56 | | unchecked_param_type = "something", +57 | | param_description = "somthing" +58 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_return_type in this position + --> ui-tests/unused-fn-attrs.rs:64:1 + | +64 | / #[wasm_bindgen( +65 | | unchecked_return_type = "something", +66 | | return_description = "something", +67 | | unchecked_param_type = "something", +68 | | param_description = "somthing" +69 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute return_description in this position + --> ui-tests/unused-fn-attrs.rs:64:1 + | +64 | / #[wasm_bindgen( +65 | | unchecked_return_type = "something", +66 | | return_description = "something", +67 | | unchecked_param_type = "something", +68 | | param_description = "somthing" +69 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_param_type in this position + --> ui-tests/unused-fn-attrs.rs:64:1 + | +64 | / #[wasm_bindgen( +65 | | unchecked_return_type = "something", +66 | | return_description = "something", +67 | | unchecked_param_type = "something", +68 | | param_description = "somthing" +69 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute param_description in this position + --> ui-tests/unused-fn-attrs.rs:64:1 + | +64 | / #[wasm_bindgen( +65 | | unchecked_return_type = "something", +66 | | return_description = "something", +67 | | unchecked_param_type = "something", +68 | | param_description = "somthing" +69 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_return_type in this position + --> ui-tests/unused-fn-attrs.rs:74:1 + | +74 | / #[wasm_bindgen( +75 | | unchecked_return_type = "something", +76 | | return_description = "something", +77 | | unchecked_param_type = "something", +78 | | param_description = "somthing" +79 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute return_description in this position + --> ui-tests/unused-fn-attrs.rs:74:1 + | +74 | / #[wasm_bindgen( +75 | | unchecked_return_type = "something", +76 | | return_description = "something", +77 | | unchecked_param_type = "something", +78 | | param_description = "somthing" +79 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute unchecked_param_type in this position + --> ui-tests/unused-fn-attrs.rs:74:1 + | +74 | / #[wasm_bindgen( +75 | | unchecked_return_type = "something", +76 | | return_description = "something", +77 | | unchecked_param_type = "something", +78 | | param_description = "somthing" +79 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid attribute param_description in this position + --> ui-tests/unused-fn-attrs.rs:74:1 + | +74 | / #[wasm_bindgen( +75 | | unchecked_return_type = "something", +76 | | return_description = "something", +77 | | unchecked_param_type = "something", +78 | | param_description = "somthing" +79 | | )] + | |__^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index d69ef902539..be3071b0f38 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -21,3 +21,6 @@ links = "wasm_bindgen" [lints] workspace = true + +[dependencies] +unicode-ident = "1.0.5" diff --git a/crates/cli-support/src/js/identifier.rs b/crates/shared/src/identifier.rs similarity index 100% rename from crates/cli-support/src/js/identifier.rs rename to crates/shared/src/identifier.rs diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index c5d46f1bad1..827d6d51033 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -1,12 +1,13 @@ #![doc(html_root_url = "https://docs.rs/wasm-bindgen-shared/0.2")] +pub mod identifier; #[cfg(test)] mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.98"; +pub const SCHEMA_VERSION: &str = "0.2.99"; #[macro_export] macro_rules! shared_api { @@ -135,12 +136,20 @@ macro_rules! shared_api { } struct Function<'a> { - arg_names: Vec, + args: Vec>, asyncness: bool, name: &'a str, generate_typescript: bool, generate_jsdoc: bool, variadic: bool, + ret_ty_override: Option<&'a str>, + ret_desc: Option<&'a str>, + } + + struct FunctionArgumentData<'a> { + name: String, + ty_override: Option<&'a str>, + desc: Option<&'a str>, } struct Struct<'a> { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index be50d273a1f..0f004f64550 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "12659088193118507901"; +const APPROVED_SCHEMA_FILE_HASH: &str = "15483723499309648925"; #[test] fn schema_version() { diff --git a/crates/typescript-tests/src/function_attrs.rs b/crates/typescript-tests/src/function_attrs.rs new file mode 100644 index 00000000000..824954f8cc5 --- /dev/null +++ b/crates/typescript-tests/src/function_attrs.rs @@ -0,0 +1,71 @@ +use wasm_bindgen::prelude::*; + +/// Description for fn_with_attr +#[wasm_bindgen( + unchecked_return_type = "number", + return_description = "returns 1 if arg2 is true, or arg1 if arg2 is undefined or false" +)] +pub async fn fn_with_attr( + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "boolean | undefined")] + arg2: JsValue, +) -> Result { + if arg2.is_undefined() { + Ok(arg1.into()) + } else if arg2.is_truthy() { + Ok(1u32.into()) + } else { + Ok(arg1.into()) + } +} + +/// Description for HoldsNumber +#[wasm_bindgen] +pub struct HoldsNumber { + inner: JsValue, +} + +#[wasm_bindgen] +impl HoldsNumber { + /// Inner value + #[wasm_bindgen(getter = "inner", unchecked_return_type = "number")] + pub fn get_inner(&self) -> JsValue { + self.inner.clone() + } + + /// Description for static_fn_with_attr + #[wasm_bindgen( + return_description = "returns an instance of HoldsNumber, holding arg1 if arg2 is undefined and holding arg2 if not" + )] + pub fn static_fn_with_attr( + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "number | undefined")] + arg2: JsValue, + ) -> HoldsNumber { + if arg2.is_undefined() { + HoldsNumber { inner: arg1.into() } + } else { + HoldsNumber { inner: arg2 } + } + } + + /// Description for method_with_attr + #[wasm_bindgen( + unchecked_return_type = "number", + return_description = "returns arg1 if arg2 is true, or holding value of self if arg2 is undefined or false" + )] + pub fn method_with_attr( + &self, + #[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg1: u32, + #[wasm_bindgen(js_name = "secondArg", unchecked_param_type = "boolean | undefined")] + arg2: JsValue, + ) -> JsValue { + if arg2.is_undefined() { + self.inner.clone() + } else if arg2.is_truthy() { + arg1.into() + } else { + self.inner.clone() + } + } +} diff --git a/crates/typescript-tests/src/function_attrs.ts b/crates/typescript-tests/src/function_attrs.ts new file mode 100644 index 00000000000..287edd2fbf7 --- /dev/null +++ b/crates/typescript-tests/src/function_attrs.ts @@ -0,0 +1,37 @@ +import * as wbg from '../pkg/typescript_tests'; +import * as wasm from '../pkg/typescript_tests_bg.wasm'; +import { expect, test } from "@jest/globals"; + +const wasm_fn_with_attr: (a: number, b: number) => number = wasm.fn_with_attr; +const wbg_fn_with_attr: (a: number, b: boolean) => Promise = wbg.fn_with_attr; +const wasm_holdsnumber_static_fn_with_attr: (a: number, b: number) => number = wasm.holdsnumber_static_fn_with_attr; +const wbg_holdsnumber_static_fn_with_attr: (a1: number, b: number) => wbg.HoldsNumber = wbg.HoldsNumber.static_fn_with_attr; +const wasm_holdsnumber_method_with_attr: (a: number, b: number, c: number) => number = wasm.holdsnumber_method_with_attr; +const wbg_holdsnumber_method_with_attr: (a: number, b: boolean) => number = wbg.HoldsNumber.static_fn_with_attr(1, undefined).method_with_attr; + +test("async function fn_with_attr", async () => { + let result = await wbg.fn_with_attr(4, undefined); + expect(result).toEqual(4); + + result = await wbg.fn_with_attr(5, false); + expect(result).toEqual(5); + + result = await wbg.fn_with_attr(6, true); + expect(result).toEqual(1); +}); + +test("HoldsNumber methods", () => { + const num1 = wbg.HoldsNumber.static_fn_with_attr(4, undefined).inner; + const num2 = wbg.HoldsNumber.static_fn_with_attr(3, 4).inner; + expect(num1).toEqual(num2); + + const holdsNumber = wbg.HoldsNumber.static_fn_with_attr(8, undefined); + let result = holdsNumber.method_with_attr(4, undefined); + expect(result).toEqual(8); + + result = holdsNumber.method_with_attr(5, false); + expect(result).toEqual(8); + + result = holdsNumber.method_with_attr(6, true); + expect(result).toEqual(6); +}); \ No newline at end of file diff --git a/crates/typescript-tests/src/lib.rs b/crates/typescript-tests/src/lib.rs index 96fc3e2107c..b4edbadb4aa 100644 --- a/crates/typescript-tests/src/lib.rs +++ b/crates/typescript-tests/src/lib.rs @@ -3,6 +3,7 @@ pub mod custom_section; pub mod enums; +pub mod function_attrs; pub mod getters_setters; pub mod inspectable; pub mod omit_definition; diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index c3b58139d00..1795bf6f011 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -96,6 +96,8 @@ - [`inspectable`](./reference/attributes/on-rust-exports/inspectable.md) - [`skip_typescript`](./reference/attributes/on-rust-exports/skip_typescript.md) - [`getter_with_clone`](./reference/attributes/on-rust-exports/getter_with_clone.md) + - [`unchecked_return_type` and `unchecked_param_type`](./reference/attributes/on-rust-exports/unchecked_type.md) + - [`return_description` and `param_description`](./reference/attributes/on-rust-exports/description.md) - [`web-sys`](./web-sys/index.md) - [Using `web-sys`](./web-sys/using-web-sys.md) diff --git a/guide/src/reference/attributes/on-rust-exports/description.md b/guide/src/reference/attributes/on-rust-exports/description.md new file mode 100644 index 00000000000..831cbb81815 --- /dev/null +++ b/guide/src/reference/attributes/on-rust-exports/description.md @@ -0,0 +1,60 @@ +# `return_description` and `param_description` + +Descriptions to return and parameter documentation can be added with `#[wasm_bindgen(return_description)]` and `#[wasm_bindgen(param_description)]`. + +```rust +/// Adds `arg1` and `arg2`. +#[wasm_bindgen(return_description = "the result of the addition of `arg1` and `arg2`")] +pub fn add( + #[wasm_bindgen(param_description = "the first number")] + arg1: u32, + #[wasm_bindgen(param_description = "the second number")] + arg2: u32, +) -> u32 { + arg1 + arg2 +} + +#[wasm_bindgen] +pub struct FooList { + // properties +} + +#[wasm_bindgen] +impl FooList { + /// Returns the number at the given index. + #[wasm_bindgen(return_description = "the number at the given index")] + pub fn number( + &self, + #[wasm_bindgen(param_description = "the index of the number to be returned")] + index: u32, + ) -> u32 { + // function body + } +} +``` + +Which will generate the following JS bindings: +```js +/** + * Adds `arg1` and `arg2`. + * + * @param {number} arg1 - the first number + * @param {number} arg2 - the second number + * @returns {number} the result of the addition of `arg1` and `arg2` + */ +export function add(arg1, arg2) { + // ... +} + +export class FooList { + /** + * Returns the number at the given index. + * + * @param {number} index - the index of the number to be returned + * @returns {number} the number at the given index + */ + number(index) { + // ... + } +} +``` diff --git a/guide/src/reference/attributes/on-rust-exports/js_name.md b/guide/src/reference/attributes/on-rust-exports/js_name.md index b6a883857f1..876f4106582 100644 --- a/guide/src/reference/attributes/on-rust-exports/js_name.md +++ b/guide/src/reference/attributes/on-rust-exports/js_name.md @@ -52,3 +52,51 @@ impl JsFoo { // ... } ``` + +It can also be used to rename parameters of exported functions and methods: + +```rust +#[wasm_bindgen] +pub fn foo( + #[wasm_bindgen(js_name = "firstArg")] + arg1: String, +) { + // function body +} + +#[wasm_bindgen] +pub struct Foo { + // properties +} + +#[wasm_bindgen] +impl Foo { + pub fn foo( + &self, + #[wasm_bindgen(js_name = "firstArg")] + arg1: u32, + ) { + // function body + } +} +``` + +Which will generate the following JS bindings: + +```js +/** + * @param {string} firstArg + */ +export function foo(firstArg) { + // ... +} + +export class Foo { + /** + * @param {number} firstArg + */ + foo(firstArg) { + // ... + } +} +``` diff --git a/guide/src/reference/attributes/on-rust-exports/unchecked_type.md b/guide/src/reference/attributes/on-rust-exports/unchecked_type.md new file mode 100644 index 00000000000..a1ac509bb9e --- /dev/null +++ b/guide/src/reference/attributes/on-rust-exports/unchecked_type.md @@ -0,0 +1,53 @@ +# `unchecked_return_type` and `unchecked_param_type` + +Return and parameter types of exported functions and methods can be overwritten with `#[wasm_bindgen(unchecked_return_type)]` and `#[wasm_bindgen(unchecked_param_type)]`. + +> **Note**: Types that are provided using `#[wasm_bindgen(unchecked_return_type)]` and `#[wasm_bindgen(unchecked_param_type)]` aren't checked for their contents. They will end up in a function signature and JSDoc exactly as they have been specified. E.g. `#[wasm_bindgen(unchecked_return_type = "number")]` on a function returning `String` will return a `string`, not a `number`, even if the TS signature and JSDoc will say otherwise. + +```rust +#[wasm_bindgen(unchecked_return_type = "Foo")] +pub fn foo( + #[wasm_bindgen(unchecked_param_type = "Bar")] + arg1: JsValue, +) -> JsValue { + // function body +} + +#[wasm_bindgen] +pub struct Foo { + // properties +} + +#[wasm_bindgen] +impl Foo { + #[wasm_bindgen(unchecked_return_type = "Baz")] + pub fn foo( + &self, + #[wasm_bindgen(unchecked_param_type = "Bar")] + arg1: JsValue, + ) -> JsValue { + // function body + } +} +``` + +Which will generate the following JS bindings: +```js +/** + * @param {Bar} arg1 + * @returns {Foo} + */ +export function foo(arg1) { + // ... +} + +export class Foo { + /** + * @param {Bar} arg1 + * @returns {Baz} + */ + foo(arg1) { + // ... + } +} +``` From 8acb195f64bcda4f44e4e5a4f1b60969c48034bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Florkiewicz?= Date: Sun, 12 Jan 2025 13:16:03 +0100 Subject: [PATCH 639/641] Add support for cfg_attr for struct fields (#4351) --- CHANGELOG.md | 4 +++ crates/macro-support/src/lib.rs | 37 +++++++++++++++++++-- crates/macro-support/src/parser.rs | 24 +++++-------- crates/macro/src/lib.rs | 13 ++++++++ crates/macro/ui-tests/import-keyword.stderr | 14 ++++++++ crates/macro/ui-tests/pub-not-copy.stderr | 2 +- crates/macro/ui-tests/struct-fields.stderr | 2 +- src/rt/mod.rs | 2 ++ tests/wasm/classes.js | 7 ++++ tests/wasm/classes.rs | 36 ++++++++++++++++++++ 10 files changed, 122 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77a1cc1b33f..273d92f07c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ * Add bindings to `Date.to_locale_time_string_with_options`. [#4384](https://github.com/rustwasm/wasm-bindgen/pull/4384) +* `#[wasm_bindgen]` now correctly applies `#[cfg(...)]`s in `struct`s. + [#4351](https://github.com/rustwasm/wasm-bindgen/pull/4351) + + ### Changed * Optional parameters are now typed as `T | undefined | null` to reflect the actual JS behavior. diff --git a/crates/macro-support/src/lib.rs b/crates/macro-support/src/lib.rs index dd609f42260..3070be02807 100644 --- a/crates/macro-support/src/lib.rs +++ b/crates/macro-support/src/lib.rs @@ -12,9 +12,10 @@ extern crate wasm_bindgen_backend as backend; extern crate wasm_bindgen_shared as shared; pub use crate::parser::BindgenAttrs; -use crate::parser::MacroParse; +use crate::parser::{ConvertToAst, MacroParse}; use backend::{Diagnostic, TryToTokens}; use proc_macro2::TokenStream; +use quote::quote; use quote::ToTokens; use quote::TokenStreamExt; use syn::parse::{Parse, ParseStream, Result as SynResult}; @@ -24,9 +25,25 @@ mod parser; /// Takes the parsed input from a `#[wasm_bindgen]` macro and returns the generated bindings pub fn expand(attr: TokenStream, input: TokenStream) -> Result { parser::reset_attrs_used(); + // if struct is encountered, add `derive` attribute and let everything happen there (workaround + // to help parsing cfg_attr correctly). let item = syn::parse2::(input)?; - let opts = syn::parse2(attr)?; + if let syn::Item::Struct(s) = item { + let opts: BindgenAttrs = syn::parse2(attr.clone())?; + let wasm_bindgen = opts + .wasm_bindgen() + .cloned() + .unwrap_or_else(|| syn::parse_quote! { wasm_bindgen }); + + let item = quote! { + #[derive(#wasm_bindgen::__rt::BindgenedStruct)] + #[wasm_bindgen(#attr)] + #s + }; + return Ok(item); + } + let opts = syn::parse2(attr)?; let mut tokens = proc_macro2::TokenStream::new(); let mut program = backend::ast::Program::default(); item.macro_parse(&mut program, (Some(opts), &mut tokens))?; @@ -168,3 +185,19 @@ impl Parse for ClassMarker { }) } } + +pub fn expand_struct_marker(item: TokenStream) -> Result { + parser::reset_attrs_used(); + + let mut s: syn::ItemStruct = syn::parse2(item)?; + + let mut program = backend::ast::Program::default(); + program.structs.push((&mut s).convert(&program)?); + + let mut tokens = proc_macro2::TokenStream::new(); + program.try_to_tokens(&mut tokens)?; + + parser::check_unused_attrs(&mut tokens); + + Ok(tokens) +} diff --git a/crates/macro-support/src/parser.rs b/crates/macro-support/src/parser.rs index a3cf49bffd2..41e54d7531e 100644 --- a/crates/macro-support/src/parser.rs +++ b/crates/macro-support/src/parser.rs @@ -250,7 +250,7 @@ macro_rules! methods { }; (@method $name:ident, $variant:ident(Span, String, Span)) => { - fn $name(&self) -> Option<(&str, Span)> { + pub(crate) fn $name(&self) -> Option<(&str, Span)> { self.attrs .iter() .find_map(|a| match &a.1 { @@ -264,7 +264,7 @@ macro_rules! methods { }; (@method $name:ident, $variant:ident(Span, JsNamespace, Vec)) => { - fn $name(&self) -> Option<(JsNamespace, &[Span])> { + pub(crate) fn $name(&self) -> Option<(JsNamespace, &[Span])> { self.attrs .iter() .find_map(|a| match &a.1 { @@ -279,7 +279,7 @@ macro_rules! methods { (@method $name:ident, $variant:ident(Span, $($other:tt)*)) => { #[allow(unused)] - fn $name(&self) -> Option<&$($other)*> { + pub(crate) fn $name(&self) -> Option<&$($other)*> { self.attrs .iter() .find_map(|a| match &a.1 { @@ -294,7 +294,7 @@ macro_rules! methods { (@method $name:ident, $variant:ident($($other:tt)*)) => { #[allow(unused)] - fn $name(&self) -> Option<&$($other)*> { + pub(crate) fn $name(&self) -> Option<&$($other)*> { self.attrs .iter() .find_map(|a| match &a.1 { @@ -527,7 +527,7 @@ impl Parse for AnyIdent { /// /// Used to convert syn tokens into an AST, that we can then use to generate glue code. The context /// (`Ctx`) is used to pass in the attributes from the `#[wasm_bindgen]`, if needed. -trait ConvertToAst { +pub(crate) trait ConvertToAst { /// What we are converting to. type Target; /// Convert into our target. @@ -536,13 +536,10 @@ trait ConvertToAst { fn convert(self, context: Ctx) -> Result; } -impl ConvertToAst<(&ast::Program, BindgenAttrs)> for &mut syn::ItemStruct { +impl ConvertToAst<&ast::Program> for &mut syn::ItemStruct { type Target = ast::Struct; - fn convert( - self, - (program, attrs): (&ast::Program, BindgenAttrs), - ) -> Result { + fn convert(self, program: &ast::Program) -> Result { if !self.generics.params.is_empty() { bail_span!( self.generics, @@ -550,6 +547,8 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for &mut syn::ItemStruct { type parameters currently" ); } + let attrs = BindgenAttrs::find(&mut self.attrs)?; + let mut fields = Vec::new(); let js_name = attrs .js_name() @@ -1366,11 +1365,6 @@ impl<'a> MacroParse<(Option, &'a mut TokenStream)> for syn::Item { wasm_bindgen_futures: program.wasm_bindgen_futures.clone(), }); } - syn::Item::Struct(mut s) => { - let opts = opts.unwrap_or_default(); - program.structs.push((&mut s).convert((program, opts))?); - s.to_tokens(tokens); - } syn::Item::Impl(mut i) => { let opts = opts.unwrap_or_default(); (&mut i).macro_parse(program, opts)?; diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index 85ef2f6c2a8..51656f335ee 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -60,3 +60,16 @@ pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> Tok Err(diagnostic) => (quote! { #diagnostic }).into(), } } + +#[proc_macro_derive(BindgenedStruct, attributes(wasm_bindgen))] +pub fn __wasm_bindgen_struct_marker(item: TokenStream) -> TokenStream { + match wasm_bindgen_macro_support::expand_struct_marker(item.into()) { + Ok(tokens) => { + if cfg!(feature = "xxx_debug_only_print_generated_code") { + println!("{}", tokens); + } + tokens.into() + } + Err(diagnostic) => (quote! { #diagnostic }).into(), + } +} diff --git a/crates/macro/ui-tests/import-keyword.stderr b/crates/macro/ui-tests/import-keyword.stderr index ecc9f087ded..b2c3d8e3fd3 100644 --- a/crates/macro/ui-tests/import-keyword.stderr +++ b/crates/macro/ui-tests/import-keyword.stderr @@ -57,3 +57,17 @@ error: enum cannot use the JS keyword `switch` as its name | 63 | pub enum switch { | ^^^^^^ + +warning: type `class` should have an upper camel case name + --> ui-tests/import-keyword.rs:59:12 + | +59 | pub struct class; + | ^^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Class` + | + = note: `#[warn(non_camel_case_types)]` on by default + +warning: type `true` should have an upper camel case name + --> ui-tests/import-keyword.rs:61:12 + | +61 | pub struct r#true; // forbid value-like keywords + | ^^^^^^ help: convert the identifier to upper camel case: `True` diff --git a/crates/macro/ui-tests/pub-not-copy.stderr b/crates/macro/ui-tests/pub-not-copy.stderr index e8f1c2c820f..a7d2930b854 100644 --- a/crates/macro/ui-tests/pub-not-copy.stderr +++ b/crates/macro/ui-tests/pub-not-copy.stderr @@ -12,4 +12,4 @@ note: required by a bound in `assert_copy` | 3 | #[wasm_bindgen] | ^^^^^^^^^^^^^^^ required by this bound in `assert_copy` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro/ui-tests/struct-fields.stderr b/crates/macro/ui-tests/struct-fields.stderr index f38391b27d8..0005e6740eb 100644 --- a/crates/macro/ui-tests/struct-fields.stderr +++ b/crates/macro/ui-tests/struct-fields.stderr @@ -12,7 +12,7 @@ note: required by a bound in `__wbg_get_bar_a::assert_copy` | 8 | #[wasm_bindgen] | ^^^^^^^^^^^^^^^ required by this bound in `assert_copy` - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Foo: Clone` is not satisfied --> ui-tests/struct-fields.rs:12:12 diff --git a/src/rt/mod.rs b/src/rt/mod.rs index c4b104abf4d..2f5d1b06adb 100644 --- a/src/rt/mod.rs +++ b/src/rt/mod.rs @@ -19,6 +19,8 @@ pub extern crate std; pub mod marker; +pub use wasm_bindgen_macro::BindgenedStruct; + /// Wrapper around [`Lazy`] adding `Send + Sync` when `atomics` is not enabled. pub struct LazyCell T>(Wrapper>); diff --git a/tests/wasm/classes.js b/tests/wasm/classes.js index 5317dbb0137..08960722c8c 100644 --- a/tests/wasm/classes.js +++ b/tests/wasm/classes.js @@ -170,6 +170,13 @@ exports.js_renamed_field = () => { x.foo(); } +exports.js_conditional_skip = () => { + const x = new wasm.ConditionalSkipClass(); + assert.strictEqual(x.skipped_field, undefined); + assert.ok(x.not_skipped_field === 42); + assert.strictEqual(x.needs_clone, 'foo'); +} + exports.js_conditional_bindings = () => { const x = new wasm.ConditionalBindings(); x.free(); diff --git a/tests/wasm/classes.rs b/tests/wasm/classes.rs index d701e2088ed..80acca1a837 100644 --- a/tests/wasm/classes.rs +++ b/tests/wasm/classes.rs @@ -24,6 +24,7 @@ extern "C" { fn js_access_fields(); fn js_renamed_export(); fn js_renamed_field(); + fn js_conditional_skip(); fn js_conditional_bindings(); fn js_assert_none(a: Option); @@ -480,6 +481,41 @@ fn renamed_field() { js_renamed_field(); } +#[cfg_attr( + target_arch = "wasm32", + wasm_bindgen(inspectable, js_name = "ConditionalSkipClass") +)] +pub struct ConditionalSkip { + /// [u8; 8] cannot be passed to JS, so this won't compile without `skip` + #[cfg_attr(target_arch = "wasm32", wasm_bindgen(skip))] + pub skipped_field: [u8; 8], + + /// this field shouldn't be skipped as predicate is false + #[cfg_attr(all(target_arch = "wasm32", target_arch = "x86"), wasm_bindgen(skip))] + pub not_skipped_field: u32, + + /// String struct field requires `getter_with_clone` to compile + #[cfg_attr(target_arch = "wasm32", wasm_bindgen(getter_with_clone))] + pub needs_clone: String, +} + +#[wasm_bindgen(js_class = "ConditionalSkipClass")] +impl ConditionalSkip { + #[wasm_bindgen(constructor)] + pub fn new() -> ConditionalSkip { + ConditionalSkip { + skipped_field: [0u8; 8], + not_skipped_field: 42, + needs_clone: "foo".to_string(), + } + } +} + +#[wasm_bindgen_test] +fn conditional_skip() { + js_conditional_skip(); +} + #[cfg_attr(target_arch = "wasm32", wasm_bindgen)] pub struct ConditionalBindings {} From 8c0e79446317790277cbf7a7a69842857a4657fa Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 12 Jan 2025 21:53:39 +0100 Subject: [PATCH 640/641] Fix UI tests (#4403) --- crates/macro/ui-tests/unused-fn-attrs.stderr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/macro/ui-tests/unused-fn-attrs.stderr b/crates/macro/ui-tests/unused-fn-attrs.stderr index 1d53ef47e89..056946c4fd6 100644 --- a/crates/macro/ui-tests/unused-fn-attrs.stderr +++ b/crates/macro/ui-tests/unused-fn-attrs.stderr @@ -39,7 +39,7 @@ error: invalid attribute unchecked_return_type in this position 50 | | )] | |__^ | - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid attribute return_description in this position --> ui-tests/unused-fn-attrs.rs:45:1 @@ -52,7 +52,7 @@ error: invalid attribute return_description in this position 50 | | )] | |__^ | - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid attribute unchecked_param_type in this position --> ui-tests/unused-fn-attrs.rs:45:1 @@ -65,7 +65,7 @@ error: invalid attribute unchecked_param_type in this position 50 | | )] | |__^ | - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid attribute param_description in this position --> ui-tests/unused-fn-attrs.rs:45:1 @@ -78,7 +78,7 @@ error: invalid attribute param_description in this position 50 | | )] | |__^ | - = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `wasm_bindgen::__rt::BindgenedStruct` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid attribute unchecked_return_type in this position --> ui-tests/unused-fn-attrs.rs:53:1 From 2405ec2b4bcd1cc4e3bd1562c373e9d5f0cbdcb5 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sun, 12 Jan 2025 23:46:06 +0100 Subject: [PATCH 641/641] Prepare v0.2.100 release (#4404) --- CHANGELOG.md | 4 +++- Cargo.toml | 4 ++-- crates/backend/Cargo.toml | 4 ++-- crates/cli-support/Cargo.toml | 14 +++++++------- crates/cli/Cargo.toml | 6 +++--- crates/cli/tests/reference/web-sys.js | 2 +- crates/externref-xform/Cargo.toml | 4 ++-- crates/futures/Cargo.toml | 8 ++++---- crates/js-sys/Cargo.toml | 4 ++-- crates/macro-support/Cargo.toml | 6 +++--- crates/macro/Cargo.toml | 4 ++-- crates/multi-value-xform/Cargo.toml | 4 ++-- crates/shared/Cargo.toml | 2 +- crates/shared/src/lib.rs | 2 +- crates/shared/src/schema_hash_approval.rs | 2 +- crates/test-macro/Cargo.toml | 2 +- crates/test/Cargo.toml | 10 +++++----- crates/threads-xform/Cargo.toml | 4 ++-- crates/wasm-conventions/Cargo.toml | 2 +- crates/wasm-interpreter/Cargo.toml | 4 ++-- crates/web-sys/Cargo.toml | 6 +++--- 21 files changed, 50 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 273d92f07c6..08dcd104a0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # `wasm-bindgen` Change Log -------------------------------------------------------------------------------- -## Unreleased +## [0.2.100](https://github.com/rustwasm/wasm-bindgen/compare/0.2.99...0.2.100) + +Released 2025-01-12 ### Added diff --git a/Cargo.toml b/Cargo.toml index 57536ab1ce9..cb97505b650 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "wasm-bindgen" readme = "README.md" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.2.99" +version = "0.2.100" [package.metadata.docs.rs] features = ["serde-serialize"] @@ -53,7 +53,7 @@ once_cell = { version = "1.12", default-features = false } rustversion = { version = "1.0", optional = true } serde = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true } -wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.99" } +wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.100" } [dev-dependencies] once_cell = "1" diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index ab964ab8ec1..cc7566ffa1d 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-backend" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend" rust-version = "1.57" -version = "0.2.99" +version = "0.2.100" [features] extra-traits = ["syn/extra-traits"] @@ -22,7 +22,7 @@ log = "0.4" proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['full'] } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.100" } [lints] workspace = true diff --git a/crates/cli-support/Cargo.toml b/crates/cli-support/Cargo.toml index 60e3e6fe6f0..bb4ba82842e 100644 --- a/crates/cli-support/Cargo.toml +++ b/crates/cli-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] anyhow = "1.0" @@ -22,12 +22,12 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3.0" walrus = { version = "0.23", features = ['parallel'] } -wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.99' } -wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.99' } -wasm-bindgen-shared = { path = "../shared", version = '=0.2.99' } -wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.99' } -wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.99' } -wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.99' } +wasm-bindgen-externref-xform = { path = '../externref-xform', version = '=0.2.100' } +wasm-bindgen-multi-value-xform = { path = '../multi-value-xform', version = '=0.2.100' } +wasm-bindgen-shared = { path = "../shared", version = '=0.2.100' } +wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.100' } +wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.100' } +wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.100' } [lints] workspace = true diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 870ca4ef325..2e9b8a28019 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-cli" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [package.metadata.binstall] bin-dir = "wasm-bindgen-{ version }-{ target }/{ bin }{ binary-ext }" @@ -33,8 +33,8 @@ serde_json = "1.0" tempfile = "3.0" ureq = { version = "2.7", default-features = false, features = ["brotli", "gzip"] } walrus = "0.23" -wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.99" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } +wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.100" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.100" } [dev-dependencies] assert_cmd = "2" diff --git a/crates/cli/tests/reference/web-sys.js b/crates/cli/tests/reference/web-sys.js index b8d534c9658..37300cfdcaa 100644 --- a/crates/cli/tests/reference/web-sys.js +++ b/crates/cli/tests/reference/web-sys.js @@ -188,7 +188,7 @@ export function get_media_source() { const __wbindgen_enum_MediaSourceEnum = ["camera", "screen", "application", "window", "browser", "microphone", "audioCapture", "other"]; -export function __wbg_new_17f755666e48d1d8() { return handleError(function (arg0, arg1) { +export function __wbg_new_9ffbe0a71eff35e3() { return handleError(function (arg0, arg1) { const ret = new URL(getStringFromWasm0(arg0, arg1)); return ret; }, arguments) }; diff --git a/crates/externref-xform/Cargo.toml b/crates/externref-xform/Cargo.toml index 3da53a4d66d..22ba0977336 100644 --- a/crates/externref-xform/Cargo.toml +++ b/crates/externref-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-externref-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/externref-xform" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.100" } [dev-dependencies] rayon = "1.0" diff --git a/crates/futures/Cargo.toml b/crates/futures/Cargo.toml index b2b3be932da..caf381c899b 100644 --- a/crates/futures/Cargo.toml +++ b/crates/futures/Cargo.toml @@ -10,7 +10,7 @@ name = "wasm-bindgen-futures" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures" rust-version = "1.57" -version = "0.4.49" +version = "0.4.50" [package.metadata.docs.rs] all-features = true @@ -19,9 +19,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] cfg-if = "1.0.0" futures-core = { version = '0.3.8', default-features = false, optional = true } -js-sys = { path = "../js-sys", version = '=0.3.76', default-features = false } +js-sys = { path = "../js-sys", version = '=0.3.77', default-features = false } once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = '=0.2.99', default-features = false } +wasm-bindgen = { path = "../..", version = '=0.2.100', default-features = false } [features] default = ["std"] @@ -29,7 +29,7 @@ futures-core-03-stream = ['futures-core'] std = ["wasm-bindgen/std", "js-sys/std", "web-sys/std"] [target.'cfg(target_feature = "atomics")'.dependencies] -web-sys = { path = "../web-sys", version = "=0.3.76", default-features = false, features = [ +web-sys = { path = "../web-sys", version = "=0.3.77", default-features = false, features = [ "MessageEvent", "Worker", ] } diff --git a/crates/js-sys/Cargo.toml b/crates/js-sys/Cargo.toml index 9fdb05f6c8f..57471e4e3b1 100644 --- a/crates/js-sys/Cargo.toml +++ b/crates/js-sys/Cargo.toml @@ -14,7 +14,7 @@ name = "js-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/js-sys" rust-version = "1.57" -version = "0.3.76" +version = "0.3.77" [lib] doctest = false @@ -26,7 +26,7 @@ std = ["wasm-bindgen/std"] [dependencies] once_cell = { version = "1.12", default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.99", default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.100", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-futures = { path = '../futures' } diff --git a/crates/macro-support/Cargo.toml b/crates/macro-support/Cargo.toml index 75eab654bd5..2a7067ca9fb 100644 --- a/crates/macro-support/Cargo.toml +++ b/crates/macro-support/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro-support" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support" rust-version = "1.57" -version = "0.2.99" +version = "0.2.100" [features] extra-traits = ["syn/extra-traits"] @@ -21,8 +21,8 @@ strict-macro = [] proc-macro2 = "1.0" quote = '1.0' syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] } -wasm-bindgen-backend = { path = "../backend", version = "=0.2.99" } -wasm-bindgen-shared = { path = "../shared", version = "=0.2.99" } +wasm-bindgen-backend = { path = "../backend", version = "=0.2.100" } +wasm-bindgen-shared = { path = "../shared", version = "=0.2.100" } [lints] workspace = true diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 1a194c6dcab..4e0fb0988c8 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-macro" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro" rust-version = "1.57" -version = "0.2.99" +version = "0.2.100" [lib] proc-macro = true @@ -22,7 +22,7 @@ xxx_debug_only_print_generated_code = [] [dependencies] quote = "1.0" -wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.99" } +wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.100" } [dev-dependencies] js-sys = { path = "../js-sys" } diff --git a/crates/multi-value-xform/Cargo.toml b/crates/multi-value-xform/Cargo.toml index 8ff477f071d..e9cf5ccc369 100644 --- a/crates/multi-value-xform/Cargo.toml +++ b/crates/multi-value-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-multi-value-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/multi-value-xform" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.100" } [dev-dependencies] rayon = "1.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index be3071b0f38..cc22b103c56 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-shared" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared" rust-version = "1.57" -version = "0.2.99" +version = "0.2.100" # Because only a single `wasm_bindgen` version can be used in a dependency # graph, pretend we link a native library so that `cargo` will provide better diff --git a/crates/shared/src/lib.rs b/crates/shared/src/lib.rs index 827d6d51033..20b1164efb3 100644 --- a/crates/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -7,7 +7,7 @@ mod schema_hash_approval; // This gets changed whenever our schema changes. // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same // SCHEMA_VERSION in order to work together. -pub const SCHEMA_VERSION: &str = "0.2.99"; +pub const SCHEMA_VERSION: &str = "0.2.100"; #[macro_export] macro_rules! shared_api { diff --git a/crates/shared/src/schema_hash_approval.rs b/crates/shared/src/schema_hash_approval.rs index 0f004f64550..16747438d63 100644 --- a/crates/shared/src/schema_hash_approval.rs +++ b/crates/shared/src/schema_hash_approval.rs @@ -8,7 +8,7 @@ // If the schema in this library has changed then: // 1. Bump the version in `crates/shared/Cargo.toml` // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version -const APPROVED_SCHEMA_FILE_HASH: &str = "15483723499309648925"; +const APPROVED_SCHEMA_FILE_HASH: &str = "6242250402756688161"; #[test] fn schema_version() { diff --git a/crates/test-macro/Cargo.toml b/crates/test-macro/Cargo.toml index 9912554d32d..e0acc967d0b 100644 --- a/crates/test-macro/Cargo.toml +++ b/crates/test-macro/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test-macro" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.49" +version = "0.3.50" [lib] proc-macro = true diff --git a/crates/test/Cargo.toml b/crates/test/Cargo.toml index 004e990cac7..114304a778e 100644 --- a/crates/test/Cargo.toml +++ b/crates/test/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-test" repository = "https://github.com/rustwasm/wasm-bindgen" rust-version = "1.57" -version = "0.3.49" +version = "0.3.50" [features] default = ["std"] @@ -15,10 +15,10 @@ std = ["wasm-bindgen/std", "js-sys/std", "wasm-bindgen-futures/std"] [dependencies] gg-alloc = { version = "1.0", optional = true } -js-sys = { path = '../js-sys', version = '=0.3.76', default-features = false } -wasm-bindgen = { path = '../..', version = '=0.2.99', default-features = false } -wasm-bindgen-futures = { path = '../futures', version = '=0.4.49', default-features = false } -wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.49' } +js-sys = { path = '../js-sys', version = '=0.3.77', default-features = false } +wasm-bindgen = { path = '../..', version = '=0.2.100', default-features = false } +wasm-bindgen-futures = { path = '../futures', version = '=0.4.50', default-features = false } +wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.50' } [target.'cfg(all(target_arch = "wasm32", wasm_bindgen_unstable_test_coverage))'.dependencies] minicov = "0.3" diff --git a/crates/threads-xform/Cargo.toml b/crates/threads-xform/Cargo.toml index 3f3b5f374aa..f32e53d59e2 100644 --- a/crates/threads-xform/Cargo.toml +++ b/crates/threads-xform/Cargo.toml @@ -11,12 +11,12 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-threads-xform" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/threads-xform" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] anyhow = "1.0" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.99" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "=0.2.100" } [dev-dependencies] rayon = "1.0" diff --git a/crates/wasm-conventions/Cargo.toml b/crates/wasm-conventions/Cargo.toml index 10d545a0c78..3554087cbde 100644 --- a/crates/wasm-conventions/Cargo.toml +++ b/crates/wasm-conventions/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-conventions" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-conventions" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] leb128 = "0.2" diff --git a/crates/wasm-interpreter/Cargo.toml b/crates/wasm-interpreter/Cargo.toml index 5bf7010e0f0..3f21fcc1eb2 100644 --- a/crates/wasm-interpreter/Cargo.toml +++ b/crates/wasm-interpreter/Cargo.toml @@ -11,13 +11,13 @@ license = "MIT OR Apache-2.0" name = "wasm-bindgen-wasm-interpreter" repository = "https://github.com/rustwasm/wasm-bindgen/tree/main/crates/wasm-interpreter" rust-version = "1.76" -version = "0.2.99" +version = "0.2.100" [dependencies] anyhow = "1.0" log = "0.4" walrus = "0.23" -wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.99" } +wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.100" } [dev-dependencies] tempfile = "3" diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 886467ca3ff..c3a73eaa363 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -12,7 +12,7 @@ name = "web-sys" readme = "./README.md" repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/web-sys" rust-version = "1.57" -version = "0.3.76" +version = "0.3.77" [package.metadata.docs.rs] all-features = true @@ -23,8 +23,8 @@ doctest = false test = false [dependencies] -js-sys = { path = '../js-sys', version = '=0.3.76', default-features = false } -wasm-bindgen = { path = "../..", version = "=0.2.99", default-features = false } +js-sys = { path = '../js-sys', version = '=0.3.77', default-features = false } +wasm-bindgen = { path = "../..", version = "=0.2.100", default-features = false } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] futures = "0.3"